2026-03-27 11:54:51 +00:00

2 lines
9.9 KiB
JavaScript

/*! For license information please see ssa-booking-module.js.LICENSE.txt */
(()=>{"use strict";var e,t={};function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function n(){var e,t,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.toStringTag||"@@toStringTag";function l(o,n,i,a){var l=n&&n.prototype instanceof d?n:d,c=Object.create(l.prototype);return r(c,"_invoke",function(o,n,r){var i,a,l,d=0,c=r||[],s=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,o){return i=t,a=0,l=e,p.n=o,u}};function f(o,n){for(a=o,l=n,t=0;!s&&d&&!r&&t<c.length;t++){var r,i=c[t],f=p.p,m=i[2];o>3?(r=m===n)&&(l=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=f&&((r=o<2&&f<i[1])?(a=0,p.v=n,p.n=i[1]):f<m&&(r=o<3||i[0]>n||n>m)&&(i[4]=o,i[5]=n,p.n=m,a=0))}if(r||o>1)return u;throw s=!0,n}return function(r,c,m){if(d>1)throw TypeError("Generator is already running");for(s&&1===c&&f(c,m),a=c,l=m;(t=a<2?e:l)||!s;){i||(a?a<3?(a>1&&(p.n=-1),f(a,l)):p.n=l:p.v=l);try{if(d=2,i){if(a||(r="next"),t=i[r]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);i=e}else if((t=(s=p.n<0)?l:o.call(n,p))!==u)break}catch(t){i=e,a=1,l=t}finally{d=1}}return{value:t,done:s}}}(o,i,a),!0),c}var u={};function d(){}function c(){}function s(){}t=Object.getPrototypeOf;var p=[][i]?t(t([][i]())):(r(t={},i,function(){return this}),t),f=s.prototype=d.prototype=Object.create(p);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,r(e,a,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=s,r(f,"constructor",s),r(s,"constructor",c),c.displayName="GeneratorFunction",r(s,a,"GeneratorFunction"),r(f),r(f,a,"Generator"),r(f,i,function(){return this}),r(f,"toString",function(){return"[object Generator]"}),(n=function(){return{w:l,m}})()}function r(e,t,o,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}r=function(e,t,o,n){function a(t,o){r(e,t,function(e){return this._invoke(t,o,e)})}t?i?i(e,t,{value:o,enumerable:!n,configurable:!n,writable:!n}):e[t]=o:(a("next",0),a("throw",1),a("return",2))},r(e,t,o,n)}function i(e,t,o,n,r,i,a){try{var l=e[i](a),u=l.value}catch(e){return void o(e)}l.done?t(u):Promise.resolve(u).then(n,r)}function a(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,l(n.key),n)}}function l(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}t.n=e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},t.d=(e,o)=>{for(var n in o)t.o(o,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:o[n]})},t.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var s=window.React,p=s.Component,f=((null===(e=window)||void 0===e||null===(e=e.divi)||void 0===e?void 0:e.module)||{}).ModuleContainer,m=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t,n){return t=d(t),function(e,t){if(t&&("object"==o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}(this,t,[e])).state={bookingHTML:null,isLoading:!0},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),r=t,l=[{key:"componentDidMount",value:function(){this.fetchBookingForm()}},{key:"componentDidUpdate",value:function(e){var t;((null==e?void 0:e.appointmentType)||"")!==((null===(t=this.props)||void 0===t?void 0:t.appointmentType)||"")&&this.fetchBookingForm()}},{key:"fetchBookingForm",value:(p=n().m(function e(){var t,o,r,i,a,l,u;return n().w(function(e){for(;;)switch(e.p=e.n){case 0:return this.setState({isLoading:!0}),t=this.props.appointmentType||"",o=t?'type="'.concat(t,'"'):"",r="[ssa_booking ".concat(o,"]"),e.p=1,e.n=2,fetch("".concat((null===(i=window.wpApiSettings)||void 0===i?void 0:i.root)||"/wp-json/","ssa/v1/render-shortcode"),{method:"POST",headers:{"X-WP-Nonce":(null===(a=window.wpApiSettings)||void 0===a?void 0:a.nonce)||"","Content-Type":"application/json"},body:JSON.stringify({shortcode:r})});case 2:return l=e.v,e.n=3,l.json();case 3:u=e.v,this.setState({bookingHTML:u.html||u,isLoading:!1}),e.n=5;break;case 4:e.p=4,e.v,this.setState({bookingHTML:'<div style="padding: 20px; color: red;">Error loading booking form</div>',isLoading:!1});case 5:return e.a(2)}},e,this,[[1,4]])}),f=function(){var e=this,t=arguments;return new Promise(function(o,n){var r=p.apply(e,t);function a(e){i(r,o,n,a,l,"next",e)}function l(e){i(r,o,n,a,l,"throw",e)}a(void 0)})},function(){return f.apply(this,arguments)})},{key:"render",value:function(){var e=this.state,t=e.bookingHTML;return e.isLoading?s.createElement("div",{style:{padding:"40px",textAlign:"center",color:"#666"}},"Loading booking form..."):s.createElement("div",{dangerouslySetInnerHTML:{__html:t}})}}],l&&a(r.prototype,l),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,l,p,f}(p);const v=React;var y,b,g,h,w,_=t.n(v),k=(null===(y=window)||void 0===y||null===(y=y.vendor)||void 0===y||null===(y=y.wp)||void 0===y||null===(y=y.i18n)||void 0===y?void 0:y.__)||(null===(b=window)||void 0===b||null===(b=b.wp)||void 0===b||null===(b=b.i18n)||void 0===b?void 0:b.__)||function(e){return e},S=((null===(g=window)||void 0===g||null===(g=g.divi)||void 0===g?void 0:g.module)||{}).FieldContainer,O=((null===(h=window)||void 0===h||null===(h=h.divi)||void 0===h?void 0:h.modal)||{}).GroupContainer,T=((null===(w=window)||void 0===w||null===(w=w.divi)||void 0===w?void 0:w.fieldLibrary)||{}).SelectContainer;const j=JSON.parse('{"name":"ssa/booking","d4Shortcode":"ssa_divi_booking_module","title":"SSA Appointment Booking","titles":"SSA Appointment Bookings","moduleIcon":"calendar-alt","category":"module","attributes":{"type":{"type":"string","default":""},"module":{"type":"object","default":{"innerContent":{"appointmentType":""}},"settings":{"innerContent":{},"meta":{},"advanced":{},"decoration":{"background":{},"border":{},"spacing":{}}}}},"settings":{"content":"custom","design":"auto","advanced":"auto","groups":{"contentText":{"panel":"content","priority":10,"groupName":"text","component":{"name":"divi/composite","props":{"groupLabel":"Settings"}}}}}}');var P,x=window.divi.moduleLibrary.registerModule,E=(null===(P=window)||void 0===P||null===(P=P.vendor)||void 0===P||null===(P=P.wp)||void 0===P?void 0:P.hooks).addAction,C={settings:{content:function(e){var t=window.ssaAppointmentTypes||[{label:"All Types",value:""}],o={};return Array.isArray(t)&&t.forEach(function(e){o[String(e.value)]={label:String(e.label),value:String(e.value)}}),_().createElement(_().Fragment,null,_().createElement(O,{id:"ssa_booking_settings",title:k("Booking Settings","simply-schedule-appointments")},_().createElement(S,{attrName:"module.innerContent.appointmentType",label:k("Appointment Type","simply-schedule-appointments"),description:k("Select which appointment type to display","simply-schedule-appointments"),features:{sticky:!1}},_().createElement(T,{options:o}))))}},renderers:{edit:function(e){var t,o=e.attrs,n=e.elements,r=e.id,i=e.name,a=(null==o||null===(t=o.module)||void 0===t||null===(t=t.innerContent)||void 0===t||null===(t=t.appointmentType)||void 0===t||null===(t=t.desktop)||void 0===t?void 0:t.value)||"";return s.createElement(f,{attrs:o,elements:n,id:r,name:i},null==n?void 0:n.styleComponents({attrName:"module"}),s.createElement(m,{appointmentType:a}))}},conversionOutline:{advanced:{admin_label:"module.meta.adminLabel",animation:"module.decoration.animation",background:"module.decoration.background",disabled_on:"module.decoration.disabledOn",module:"module.advanced.htmlAttributes",overflow:"module.decoration.overflow",position_fields:"module.decoration.position",scroll:"module.decoration.scroll",sticky:"module.decoration.sticky",text:"module.advanced.text",transform:"module.decoration.transform",transition:"module.decoration.transition",z_index:"module.decoration.zIndex",margin_padding:"module.decoration.spacing",max_width:"module.decoration.sizing",height:"module.decoration.sizing",link_options:"module.advanced.link",text_shadow:{default:"module.advanced.text.textShadow"},box_shadow:{default:"module.decoration.boxShadow"},borders:{default:"module.decoration.border"},filters:{default:"module.decoration.filters"}},css:{after:"css.*.after",before:"css.*.before",main_element:"css.*.mainElement"},module:{appointment_type:"module.innerContent.appointmentType",accent_color:"module.advanced.customColors.accentColor",background_color:"module.advanced.customColors.backgroundColor",font_family:"module.advanced.typography.fontFamily",padding:"module.decoration.spacing.padding",padding_css_unit:"module.decoration.spacing.paddingUnit"}}};E("divi.moduleLibrary.registerModuleLibraryStore.after","ssa",function(){x(j,C)})})();