Plugin Directory

Changeset 3244360


Ignore:
Timestamp:
02/21/2025 09:39:23 AM (12 months ago)
Author:
bookster
Message:

Version 2.1.0

Location:
bookster-paypal/trunk
Files:
1 added
1 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • bookster-paypal/trunk/assets/dist/paypal/admin.js

    r3135815 r3244360  
    1 import{R as e,_ as a,a as t,b as l,c as n}from"./@wordpress_i18n-d8f34da1.js";var o=booksterModules.antd;function r(){const r=o.Form.useFormInstance(),d=o.Form.useWatch(["addonPaymentPaypal","enabled"],r),s=o.Form.useWatch(["addonPaymentPaypal","is_live_mode"],r);return e.createElement(a.ReactCollapsible.Root,{open:d},e.createElement("div",{className:"bw-flex bw-items-center bw-gap-3 bw-bg-base-bg2/60 bw-p-3 bw-pr-4"},e.createElement(o.Form.Item,{name:["addonPaymentPaypal","enabled"],trigger:"onCheckedChange",valuePropName:"checked",noStyle:!0},e.createElement(a.Switch,{checkedChildren:"ON",unCheckedChildren:"OFF",id:"payment-paypal-enabled",onCheckedChange:function(e){const a=n.booksterHooks.applyFilters(n.HOOK_NAMES.settings.validateGatewayEnabledPath,{later:["payment","payment-later","enabled"],now:[]});e&&a.now.forEach((e=>{2===e.length&&"addonPaymentPaypal"===e[0]||r.setFieldValue(e,!1)}))}})),e.createElement(a.Label,{className:"bw-font-medium",htmlFor:"payment-paypal-enabled"},t.__("Paypal","bookster-paypal"))),e.createElement(a.CollapsibleContent,{forceMountWithAnimation:!0},e.createElement("div",{className:"bw-border-t bw-p-3 bw-pr-4"},e.createElement("div",{className:"bw-mb-3 bw-mt-1 bw-flex bw-items-center bw-gap-3"},e.createElement(o.Form.Item,{name:["addonPaymentPaypal","is_live_mode"],valuePropName:"checked",trigger:"onCheckedChange",noStyle:!0},e.createElement(a.Switch,{checkedChildren:"Live",unCheckedChildren:"Sandbox",id:"payment_paypal_is_live_mode",onClick:e=>e.stopPropagation()})),e.createElement(a.Label,{htmlFor:"payment_paypal_is_live_mode"},t.__("Sandbox or Live Mode","bookster-paypal")),e.createElement(a.Button,{className:"bw-ms-auto bw-rounded-full",color:"info",variant:"ghost",size:"icon",asChild:!0},e.createElement("a",{href:"https://developer.paypal.com/api/rest",target:"_blank"},e.createElement(l.HelpCircle,null)))),e.createElement("div",{className:"bw-grid bw-grid-cols-1 bw-gap-x-4 sm:bw-grid-cols-2"},e.createElement("div",null,e.createElement(o.Form.Item,{name:["addonPaymentPaypal","live_client_id"],label:t.__("Live Client Id","bookster-paypal"),hidden:!s,rules:[{required:d&&s}]},e.createElement(a.Input,{placeholder:t.__("Please enter the Client Id","bookster-paypal")})),e.createElement(o.Form.Item,{name:["addonPaymentPaypal","sandbox_client_id"],label:t.__("Sandbox Client Id","bookster-paypal"),hidden:s,rules:[{required:d&&!s}]},e.createElement(a.Input,{placeholder:t.__("Please enter the Client Id","bookster-paypal")}))),e.createElement("div",null,e.createElement(o.Form.Item,{name:["addonPaymentPaypal","live_client_secret"],label:t.__("Live Client Secret","bookster-paypal"),hidden:!s,rules:[{required:d&&s}]},e.createElement(a.PasswordInput,{placeholder:t.__("Please enter the Client Secret","bookster-paypal")})),e.createElement(o.Form.Item,{name:["addonPaymentPaypal","sandbox_client_secret"],label:t.__("Sandbox Client Secret","bookster-paypal"),hidden:s,rules:[{required:d&&!s}]},e.createElement(a.PasswordInput,{placeholder:t.__("Please enter the Client Secret","bookster-paypal")})))))))}n.booksterHooks.addFilter(n.HOOK_NAMES.settings.PaymentGateways,"bookster-paypal",(a=>[...a,e.createElement(r,{key:"bookster-paypal"})]),20),n.booksterHooks.addFilter(n.HOOK_NAMES.settings.validateGatewayEnabledPath,"bookster-paypal",(e=>({later:e.later,now:[...e.now,["addonPaymentPaypal","enabled"]]})),20),n.booksterHooks.addFilter(n.HOOK_NAMES.settings.initPaymentSettingsForm,"bookster-paypal",(e=>({...e,addonPaymentPaypal:window.booksterManagerData.addonPaymentPaypal})),20);
     1import{R as e,_ as a,a as t,b as l,c as n}from"./@bookster_icons-65b3aaee.js";var o=booksterModules.antd;function r(){const n=o.Form.useFormInstance(),r=o.Form.useWatch(["addonPaymentPaypal","enabled"],n),s=o.Form.useWatch(["addonPaymentPaypal","is_live_mode"],n);return e.createElement(a.TabsContent,{forceMount:!0,value:"bookster-paypal",className:"bw-border-t bw-px-0 bw-py-4"},e.createElement(o.Form.Item,{name:["addonPaymentPaypal","enabled"],hidden:!0}),e.createElement("div",{className:"bw-mb-1 bw-flex bw-items-center bw-justify-between"},e.createElement("div",{className:"bw-flex bw-items-center"},e.createElement(a.Label,{htmlFor:"payment_paypal_is_live_mode",className:"bw-cursor-pointer bw-text-sm bw-leading-none"},t.__("Sandbox or Live Mode","bookster-paypal")),e.createElement("a",{href:"https://developer.paypal.com/api/rest",target:"_blank"},e.createElement(l.HelpCircle,{className:"bw-ms-1 bw-h-2.5 bw-w-2.5 bw-text-info"}))),e.createElement(o.Form.Item,{name:["addonPaymentPaypal","is_live_mode"],valuePropName:"checked",trigger:"onCheckedChange",noStyle:!0},e.createElement(a.Switch,{id:"payment_paypal_is_live_mode"}))),e.createElement("div",{className:"bw-grid bw-grid-cols-1 bw-gap-x-4 sm:bw-grid-cols-2"},e.createElement("div",null,e.createElement(o.Form.Item,{name:["addonPaymentPaypal","live_client_id"],label:t.__("Live Client Id","bookster-paypal"),hidden:!s,rules:[{required:r&&s}]},e.createElement(a.Input,{placeholder:t.__("Please enter the Client Id","bookster-paypal")})),e.createElement(o.Form.Item,{name:["addonPaymentPaypal","sandbox_client_id"],label:t.__("Sandbox Client Id","bookster-paypal"),hidden:s,rules:[{required:r&&!s}]},e.createElement(a.Input,{placeholder:t.__("Please enter the Client Id","bookster-paypal")}))),e.createElement("div",null,e.createElement(o.Form.Item,{name:["addonPaymentPaypal","live_client_secret"],label:t.__("Live Client Secret","bookster-paypal"),hidden:!s,rules:[{required:r&&s}]},e.createElement(a.PasswordInput,{placeholder:t.__("Please enter the Client Secret","bookster-paypal")})),e.createElement(o.Form.Item,{name:["addonPaymentPaypal","sandbox_client_secret"],label:t.__("Sandbox Client Secret","bookster-paypal"),hidden:s,rules:[{required:r&&!s}]},e.createElement(a.PasswordInput,{placeholder:t.__("Please enter the Client Secret","bookster-paypal")})))))}n.booksterHooks.addFilter(n.HOOK_NAMES.settings.initPaymentSettingsForm,"bookster-paypal",(e=>({...e,addonPaymentPaypal:window.booksterManagerData.addonPaymentPaypal})),30),n.booksterHooks.addFilter(n.HOOK_NAMES.settings.paymentMethods,"bookster-paypal",(e=>[...e,{label:t.__("Paypal","bookster-paypal"),slug:"bookster-paypal",enablePath:["addonPaymentPaypal","enabled"]}]),30),n.booksterHooks.addFilter(n.HOOK_NAMES.settings.PaymentMethodTabsContent,"bookster-paypal",(a=>[...a,e.createElement(r,{key:"bookster-paypal"})]),30);
  • bookster-paypal/trunk/assets/dist/paypal/frontend.js

    r3161763 r3244360  
    1 import{r as t,R as e,b as n,_ as a,a as o,c as r}from"./@wordpress_i18n-d8f34da1.js";var i,c,s,l,u,d;(c=i||(i={})).INITIAL="initial",c.PENDING="pending",c.REJECTED="rejected",c.RESOLVED="resolved",(l=s||(s={})).LOADING_STATUS="setLoadingStatus",l.RESET_OPTIONS="resetOptions",l.SET_BRAINTREE_INSTANCE="braintreeInstance",(d=u||(u={})).NUMBER="number",d.CVV="cvv",d.EXPIRATION_DATE="expirationDate",d.EXPIRATION_MONTH="expirationMonth",d.EXPIRATION_YEAR="expirationYear",d.POSTAL_CODE="postalCode";var p=function(){return p=Object.assign||function(t){for(var e,n=1,a=arguments.length;n<a;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},p.apply(this,arguments)};function m(t,e){var n={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.indexOf(a)<0&&(n[a]=t[a]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(t);o<a.length;o++)e.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(t,a[o])&&(n[a[o]]=t[a[o]])}return n}function b(t,e,n){if(n||2===arguments.length)for(var a,o=0,r=e.length;o<r;o++)!a&&o in e||(a||(a=Array.prototype.slice.call(e,0,o)),a[o]=e[o]);return t.concat(a||Array.prototype.slice.call(e))}var f="data-react-paypal-script-id",y="react-paypal-js",w="dataSdkIntegrationSource",E="paypal";function g(t){var e=t,n=f;e[n];var a=m(e,[n+""]);return"react-paypal-js-".concat(function(t){for(var e="",n=0;n<t.length;n++){var a=t[n].charCodeAt(0)*n;t[n+1]&&(a+=t[n+1].charCodeAt(0)*(n-1)),e+=String.fromCharCode(97+Math.abs(a)%26)}return e}(JSON.stringify(a)))}function v(t,e){var n,a,o,r;switch(e.type){case s.LOADING_STATUS:return"object"==typeof e.value?p(p({},t),{loadingStatus:e.value.state,loadingStatusErrorMessage:e.value.message}):p(p({},t),{loadingStatus:e.value});case s.RESET_OPTIONS:return o=t.options[f],(null==(r=self.document.querySelector("script[".concat(f,'="').concat(o,'"]')))?void 0:r.parentNode)&&r.parentNode.removeChild(r),p(p({},t),{loadingStatus:i.PENDING,options:p(p((n={},n[w]=y,n),e.value),(a={},a[f]="".concat(g(e.value)),a))});case s.SET_BRAINTREE_INSTANCE:return p(p({},t),{braintreePayPalCheckoutInstance:e.value});default:return t}}var h=t.createContext(null);t.createContext({});var S=function(n){var a,o=n.className,r=void 0===o?"":o,c=n.disabled,s=void 0!==c&&c,l=n.children,u=n.forceReRender,d=void 0===u?[]:u,f=m(n,["className","disabled","children","forceReRender"]),y=s?{opacity:.38}:{},w="".concat(r," ").concat(s?"paypal-buttons-disabled":"").trim(),g=t.useRef(null),v=t.useRef(null),P=(a=function(t){if("function"==typeof(null==t?void 0:t.dispatch)&&0!==t.dispatch.length)return t;throw new Error("usePayPalScriptReducer must be used within a PayPalScriptProvider")}(t.useContext(h)),[p(p({},a),{isInitial:a.loadingStatus===i.INITIAL,isPending:a.loadingStatus===i.PENDING,isResolved:a.loadingStatus===i.RESOLVED,isRejected:a.loadingStatus===i.REJECTED}),a.dispatch])[0],k=P.isResolved,I=P.options,N=t.useState(null),A=N[0],O=N[1],T=t.useState(!0),C=T[0],j=T[1],R=t.useState(null)[1];function x(){null!==v.current&&v.current.close().catch((function(){}))}return t.useEffect((function(){if(!1===k)return x;var t,e=(void 0===(t=I.dataNamespace)&&(t=E),window[t]);if(void 0===e||void 0===e.Buttons)return R((function(){throw new Error(function(t){var e=t.reactComponentName,n=t.sdkComponentKey,a=t.sdkRequestedComponents,o=void 0===a?"":a,r=t.sdkDataNamespace,i=void 0===r?E:r,c=n.charAt(0).toUpperCase().concat(n.substring(1)),s="Unable to render <".concat(e," /> because window.").concat(i,".").concat(c," is undefined."),l="string"==typeof o?o:o.join(",");if(!l.includes(n)){var u=[l,n].filter(Boolean).join();s+="\nTo fix the issue, add '".concat(n,"' to the list of components passed to the parent PayPalScriptProvider:")+"\n`<PayPalScriptProvider options={{ components: '".concat(u,"'}}>`.")}return s}({reactComponentName:S.displayName,sdkComponentKey:"buttons",sdkRequestedComponents:I.components,sdkDataNamespace:I.dataNamespace}))})),x;try{v.current=e.Buttons(p(p({},f),{onInit:function(t,e){O(e),"function"==typeof f.onInit&&f.onInit(t,e)}}))}catch(n){return R((function(){throw new Error("Failed to render <PayPalButtons /> component. Failed to initialize:  ".concat(n))}))}return!1===v.current.isEligible()?(j(!1),x):g.current?(v.current.render(g.current).catch((function(t){null!==g.current&&0!==g.current.children.length&&R((function(){throw new Error("Failed to render <PayPalButtons /> component. ".concat(t))}))})),x):x}),b(b([k],d,!0),[f.fundingSource],!1)),t.useEffect((function(){null!==A&&(!0===s?A.disable().catch((function(){})):A.enable().catch((function(){})))}),[s,A]),e.createElement(e.Fragment,null,C?e.createElement("div",{ref:g,style:y,className:w}):l)};function P(t,e){void 0===e&&(e={});var n=document.createElement("script");return n.src=t,Object.keys(e).forEach((function(t){n.setAttribute(t,e[t]),"data-csp-nonce"===t&&n.setAttribute("nonce",e["data-csp-nonce"])})),n}function k(t){return window[t]}function I(t,e){if("object"!=typeof t||null===t)throw new Error("Expected an options object.");if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}S.displayName="PayPalButtons";var N=function(n){var a,o=n.options,r=void 0===o?{clientId:"test"}:o,c=n.children,l=n.deferLoading,u=void 0!==l&&l,d=t.useReducer(v,{options:p(p({},r),(a={},a.dataJsSdkLibrary=y,a[w]=y,a[f]="".concat(g(r)),a)),loadingStatus:u?i.INITIAL:i.PENDING}),m=d[0],b=d[1];return t.useEffect((function(){if(!1===u&&m.loadingStatus===i.INITIAL)return b({type:s.LOADING_STATUS,value:i.PENDING});if(m.loadingStatus===i.PENDING){var t=!0;return function(t,e){if(void 0===e&&(e=Promise),I(t,e),"undefined"==typeof document)return e.resolve(null);var n=function(t){var e="https://www.paypal.com/sdk/js";t.sdkBaseUrl&&(e=t.sdkBaseUrl,delete t.sdkBaseUrl);var n,a,o=t,r=Object.keys(o).filter((function(t){return void 0!==o[t]&&null!==o[t]&&""!==o[t]})).reduce((function(t,e){var n,a=o[e].toString();return n=function(t,e){return(e?"-":"")+t.toLowerCase()},"data"===(e=e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,n)).substring(0,4)||"crossorigin"===e?t.attributes[e]=a:t.queryParams[e]=a,t}),{queryParams:{},attributes:{}}),i=r.queryParams,c=r.attributes;return i["merchant-id"]&&-1!==i["merchant-id"].indexOf(",")&&(c["data-merchant-id"]=i["merchant-id"],i["merchant-id"]="*"),{url:"".concat(e,"?").concat((n=i,a="",Object.keys(n).forEach((function(t){0!==a.length&&(a+="&"),a+=t+"="+n[t]})),a)),attributes:c}}(t),a=n.url,o=n.attributes,r=o["data-namespace"]||"paypal",i=k(r);return o["data-js-sdk-library"]||(o["data-js-sdk-library"]="paypal-js"),function(t,e){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var a=P(t,e),o=n.cloneNode();if(delete o.dataset.uidAuto,Object.keys(o.dataset).length!==Object.keys(a.dataset).length)return null;var r=!0;return Object.keys(o.dataset).forEach((function(t){o.dataset[t]!==a.dataset[t]&&(r=!1)})),r?n:null}(a,o)&&i?e.resolve(i):function(t,e){void 0===e&&(e=Promise),I(t,e);var n=t.url,a=t.attributes;if("string"!=typeof n||0===n.length)throw new Error("Invalid url.");if(void 0!==a&&"object"!=typeof a)throw new Error("Expected attributes to be an object.");return new e((function(t,e){if("undefined"==typeof document)return t();!function(t){var e=t.onSuccess,n=t.onError,a=P(t.url,t.attributes);a.onerror=n,a.onload=e,document.head.insertBefore(a,document.head.firstElementChild)}({url:n,attributes:a,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(n,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return e(t)}})}))}({url:a,attributes:o},e).then((function(){var t=k(r);if(t)return t;throw new Error("The window.".concat(r," global variable is not available."))}))}(m.options).then((function(){t&&b({type:s.LOADING_STATUS,value:i.RESOLVED})})).catch((function(e){console.error("".concat("Failed to load the PayPal JS SDK script."," ").concat(e)),t&&b({type:s.LOADING_STATUS,value:{state:i.REJECTED,message:String(e)}})})),function(){t=!1}}}),[m.options,u,m.loadingStatus]),e.createElement(h.Provider,{value:p(p({},m),{dispatch:b})},c)},A=booksterModules.utils;const O=A.CURRENCY.toUpperCase();function T(){return window.booksterPublicData}var C=booksterModules.booking,j=booksterModules.decimal;function R(){return C.useBookingStore()}function x(t,e){const n=R();return A.useStore(n,t,e)}const D="paypalPaymentForm",L={isLoading:!1,transactionId:null,orderId:null,orderAmount:null};function _(){const{bookingDetailsValue:t}=C.useBookingLogic().input;return e.createElement(e.Fragment,null,e.createElement("p",{className:"bw-mb-4 bw-mt-6 bw-flex bw-items-center bw-justify-center bw-gap-1.5 bw-text-sm bw-font-semibold bw-text-success"},e.createElement(n.Lock,{className:"bw-h-3.5 bw-w-3.5"}),e.createElement("span",{className:"bw-overflow-x-auto bw-text-nowrap"},"All transactions are secure, your card information will not be stored.")),e.createElement("div",{className:"bw-rounded-lg bw-bg-base-bg2 bw-px-4 bw-py-2"},"Total booking price:"," ",e.createElement("strong",null,t&&A.formatPrice(t.tax.total))))}function B({children:t,...n}){return e.createElement("div",{className:"bw-relative bw-mb-4 bw-rounded bw-border bw-border-error/80 bw-bg-error/10 bw-px-4 bw-py-3 bw-text-error",...n},e.createElement("span",{className:"bw-block sm:bw-inline"},t))}function M(){const r=R(),i=x((t=>t.select.contact)),{isLoading:c}=x((t=>t.addonPaymentPaypal)),s=C.useBookingLogic(),{apptInput:l,transactionInput:u,bookingMetaInput:d,bookingDetailsValue:p}=s.input,m=s.process,[b,f]=t.useState(null);if(!(p&&l&&u&&i&&d))throw new Error("Sorry, Your Booking Selection is not Complete!");return e.createElement(e.Fragment,null,e.createElement(C.MainHeader,null),e.createElement(a.ScrollArea,{className:"btr-main-scrollarea bw-flex-grow"},e.createElement(a.XyzTransition,{appear:!0,xyz:"fade down-4"},e.createElement("div",{className:"bw-mx-auto bw-flex bw-min-h-[30rem] bw-max-w-[34rem] bw-flex-col bw-justify-center bw-p-4 bw-pt-8"},e.createElement("div",{className:"bw-flex-none"},b&&e.createElement(B,null,b),e.createElement(S,{style:{layout:"vertical"},createOrder:async()=>{const{orderAmount:t,orderId:e,transactionId:n}=r.getState().addonPaymentPaypal,a=p.tax.total;if(e&&t&&t.equals(a))return e;try{const t={apptInput:l,transactionInput:u,contactInput:i,bookingMetaInput:d||{}};if(e&&n){const o=await async function(t,e){return await A.api.patch("paypal/orders/amount",{json:{bookingRequestInput:e,transactionId:t}}).json()}(n,t);if(!a.equals(j.Decimal.fromString(o.orderAmount)))throw new Error("Sorry, Cannot calculate your Checkout!");return r.setState((t=>{t.addonPaymentPaypal.orderAmount=j.Decimal.fromString(o.orderAmount)})),e}{const e=await async function(t){return await A.api.post("paypal/orders",{json:{bookingRequestInput:t}}).json()}(t);if(!a.equals(j.Decimal.fromString(e.orderAmount)))throw new Error("Sorry, Cannot calculate your Checkout!");return r.setState((t=>{t.addonPaymentPaypal.orderAmount=a,t.addonPaymentPaypal.transactionId=e.transactionId,t.addonPaymentPaypal.orderId=e.orderId})),e.orderId}}catch(o){throw f(await A.getErrorMsg(o)),o}},onApprove:async()=>{const{orderId:t,transactionId:e}=r.getState().addonPaymentPaypal;try{if(r.setState((t=>{t.addonPaymentPaypal.isLoading=!0})),!t||!e)throw"Paypal Order Missing!";await async function(t){return await A.api.patch("paypal/orders/capture",{json:{transactionId:t}}).json()}(e);const{appointment:n,transaction:a,customer:o}=await A.requestBooking({apptInput:l,bookingMetaInput:d,transactionInput:u,contactInput:i});r.setState((t=>{t.booked.state="success",t.booked.appointment=n,t.booked.transaction=a,t.booked.customer=o})),m.mutate.nextAct()}catch(n){throw f(await A.getErrorMsg(n)),n}finally{r.setState((t=>{t.addonPaymentPaypal.isLoading=!1}))}}}),e.createElement(_,null),e.createElement(a.LoadingOverlay,{className:"-bw-inset-4 bw-z-[10000] bw-text-lg bw-font-medium bw-text-base-foreground/80 bw-opacity-80",loading:c},e.createElement(n.Loader2,{className:"bw-mr-4 bw-h-6 bw-w-6 bw-animate-spin"}),o.__("Booking your Appointment!","bookster-paypal")))))),e.createElement(C.MainFooter,{prevButton:e.createElement(a.Button,{key:"paypal-prev-btn",className:"bw-pl-0",variant:"link",disabled:c,onClick:()=>m.mutate.prevAct()},e.createElement(n.ArrowLeft,null),"Back")}))}function F(t){return e.createElement("div",{...t},e.createElement(N,{options:{clientId:T().addonPaymentPaypal.client_id,intent:"capture",components:"buttons",currency:O}},e.createElement(M,null)))}"payment-paypal"===T().paymentGateway.now&&(r.booksterHooks.addFilter(r.HOOK_NAMES.bookingForm.bookingConfig,"bookster-paypal",(function(t){const e=t.process.steps.map((t=>"checkout"===t.name?{...t,acts:[...t.acts,D]}:t));return{...t,process:{...t.process,steps:e}}})),r.booksterHooks.addFilter(r.HOOK_NAMES.bookingForm.bookingParts,"bookster-paypal",(function(t,n,a,o){return o.process.computed.act===D?{...t,main:{key:"paypal-payment-form",node:e.createElement(F,null)}}:t})),r.booksterHooks.addFilter(r.HOOK_NAMES.bookingForm.bookingInitState,"bookster-paypal",(function(t){return{...t,addonPaymentPaypal:L}})),r.booksterHooks.addFilter(r.HOOK_NAMES.bookingForm.bookingLogic,"bookster-paypal",(function(t,e,n){const{transactionId:a}=n.addonPaymentPaypal;return null!==a&&t.input.transactionInput&&(t.input.transactionInput.transactionId=a),t})),r.booksterHooks.addFilter(r.HOOK_NAMES.bookingForm.mutatePrevAct,"bookster-paypal",(function(t,e,n,{newPhase:a,oldPhase:o}){return a!==o&&"complete"===o&&(e.addonPaymentPaypal=L),t})));
     1import{r as t,R as e,b as n,_ as a,a as o,c as r}from"./@bookster_icons-65b3aaee.js";var i,c,s,l,u,d;(c=i||(i={})).INITIAL="initial",c.PENDING="pending",c.REJECTED="rejected",c.RESOLVED="resolved",(l=s||(s={})).LOADING_STATUS="setLoadingStatus",l.RESET_OPTIONS="resetOptions",l.SET_BRAINTREE_INSTANCE="braintreeInstance",(d=u||(u={})).NUMBER="number",d.CVV="cvv",d.EXPIRATION_DATE="expirationDate",d.EXPIRATION_MONTH="expirationMonth",d.EXPIRATION_YEAR="expirationYear",d.POSTAL_CODE="postalCode";var p=function(){return p=Object.assign||function(t){for(var e,n=1,a=arguments.length;n<a;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},p.apply(this,arguments)};function m(t,e){var n={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.indexOf(a)<0&&(n[a]=t[a]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(t);o<a.length;o++)e.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(t,a[o])&&(n[a[o]]=t[a[o]])}return n}function b(t,e,n){if(n||2===arguments.length)for(var a,o=0,r=e.length;o<r;o++)!a&&o in e||(a||(a=Array.prototype.slice.call(e,0,o)),a[o]=e[o]);return t.concat(a||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var f="data-react-paypal-script-id",y="react-paypal-js",w="dataSdkIntegrationSource",E="paypal";function g(t){var e=t,n=f;e[n];var a=m(e,[n+""]);return"react-paypal-js-".concat(function(t){for(var e="",n=0;n<t.length;n++){var a=t[n].charCodeAt(0)*n;t[n+1]&&(a+=t[n+1].charCodeAt(0)*(n-1)),e+=String.fromCharCode(97+Math.abs(a)%26)}return e}(JSON.stringify(a)))}function v(t,e){var n,a,o,r;switch(e.type){case s.LOADING_STATUS:return"object"==typeof e.value?p(p({},t),{loadingStatus:e.value.state,loadingStatusErrorMessage:e.value.message}):p(p({},t),{loadingStatus:e.value});case s.RESET_OPTIONS:return o=t.options[f],(null==(r=self.document.querySelector("script[".concat(f,'="').concat(o,'"]')))?void 0:r.parentNode)&&r.parentNode.removeChild(r),p(p({},t),{loadingStatus:i.PENDING,options:p(p((n={},n[w]=y,n),e.value),(a={},a[f]="".concat(g(e.value)),a))});case s.SET_BRAINTREE_INSTANCE:return p(p({},t),{braintreePayPalCheckoutInstance:e.value});default:return t}}var h=t.createContext(null);t.createContext({});var S=function(n){var a,o,r=n.className,c=void 0===r?"":r,s=n.disabled,l=void 0!==s&&s,u=n.children,d=n.forceReRender,f=void 0===d?[]:d,y=m(n,["className","disabled","children","forceReRender"]),w=l?{opacity:.38}:{},g="".concat(c," ").concat(l?"paypal-buttons-disabled":"").trim(),v=t.useRef(null),P=t.useRef(null),k=(o=function(t){if("function"==typeof(null==t?void 0:t.dispatch)&&0!==t.dispatch.length)return t;throw new Error("usePayPalScriptReducer must be used within a PayPalScriptProvider")}(t.useContext(h)),[p(p({},o),{isInitial:o.loadingStatus===i.INITIAL,isPending:o.loadingStatus===i.PENDING,isResolved:o.loadingStatus===i.RESOLVED,isRejected:o.loadingStatus===i.REJECTED}),o.dispatch])[0],I=k.isResolved,N=k.options,A=t.useState(null),O=A[0],T=A[1],x=t.useState(!0),C=x[0],j=x[1],R=t.useState(null)[1];function D(){null!==P.current&&P.current.close().catch((function(){}))}return(null===(a=P.current)||void 0===a?void 0:a.updateProps)&&P.current.updateProps({message:y.message}),t.useEffect((function(){if(!1===I)return D;var t,e=(void 0===(t=N.dataNamespace)&&(t=E),window[t]);if(void 0===e||void 0===e.Buttons)return R((function(){throw new Error(function(t){var e=t.reactComponentName,n=t.sdkComponentKey,a=t.sdkRequestedComponents,o=void 0===a?"":a,r=t.sdkDataNamespace,i=void 0===r?E:r,c=n.charAt(0).toUpperCase().concat(n.substring(1)),s="Unable to render <".concat(e," /> because window.").concat(i,".").concat(c," is undefined."),l="string"==typeof o?o:o.join(",");if(!l.includes(n)){var u=[l,n].filter(Boolean).join();s+="\nTo fix the issue, add '".concat(n,"' to the list of components passed to the parent PayPalScriptProvider:")+"\n`<PayPalScriptProvider options={{ components: '".concat(u,"'}}>`.")}return s}({reactComponentName:S.displayName,sdkComponentKey:"buttons",sdkRequestedComponents:N.components,sdkDataNamespace:N.dataNamespace}))})),D;try{P.current=e.Buttons(p(p({},y),{onInit:function(t,e){T(e),"function"==typeof y.onInit&&y.onInit(t,e)}}))}catch(n){return R((function(){throw new Error("Failed to render <PayPalButtons /> component. Failed to initialize:  ".concat(n))}))}return!1===P.current.isEligible()?(j(!1),D):v.current?(P.current.render(v.current).catch((function(t){null!==v.current&&0!==v.current.children.length&&R((function(){throw new Error("Failed to render <PayPalButtons /> component. ".concat(t))}))})),D):D}),b(b([I],f,!0),[y.fundingSource],!1)),t.useEffect((function(){null!==O&&(!0===l?O.disable().catch((function(){})):O.enable().catch((function(){})))}),[l,O]),e.createElement(e.Fragment,null,C?e.createElement("div",{ref:v,style:w,className:g}):u)};function P(t,e){void 0===e&&(e={});var n=document.createElement("script");return n.src=t,Object.keys(e).forEach((function(t){n.setAttribute(t,e[t]),"data-csp-nonce"===t&&n.setAttribute("nonce",e["data-csp-nonce"])})),n}function k(t){return window[t]}function I(t,e){if("object"!=typeof t||null===t)throw new Error("Expected an options object.");var n=t.environment;if(n&&"production"!==n&&"sandbox"!==n)throw new Error('The `environment` option must be either "production" or "sandbox".');if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}S.displayName="PayPalButtons";var N=function(n){var a,o=n.options,r=void 0===o?{clientId:"test"}:o,c=n.children,l=n.deferLoading,u=void 0!==l&&l,d=t.useReducer(v,{options:p(p({},r),(a={},a.dataJsSdkLibrary=y,a[w]=y,a[f]="".concat(g(r)),a)),loadingStatus:u?i.INITIAL:i.PENDING}),m=d[0],b=d[1];return t.useEffect((function(){if(!1===u&&m.loadingStatus===i.INITIAL)return b({type:s.LOADING_STATUS,value:i.PENDING});if(m.loadingStatus===i.PENDING){var t=!0;return function(t,e){if(void 0===e&&(e=Promise),I(t,e),"undefined"==typeof document)return e.resolve(null);var n=function(t){var e="sandbox"===t.environment?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js";delete t.environment,t.sdkBaseUrl&&(e=t.sdkBaseUrl,delete t.sdkBaseUrl);var n,a,o=t,r=Object.keys(o).filter((function(t){return void 0!==o[t]&&null!==o[t]&&""!==o[t]})).reduce((function(t,e){var n,a=o[e].toString();return n=function(t,e){return(e?"-":"")+t.toLowerCase()},"data"===(e=e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,n)).substring(0,4)||"crossorigin"===e?t.attributes[e]=a:t.queryParams[e]=a,t}),{queryParams:{},attributes:{}}),i=r.queryParams,c=r.attributes;return i["merchant-id"]&&-1!==i["merchant-id"].indexOf(",")&&(c["data-merchant-id"]=i["merchant-id"],i["merchant-id"]="*"),{url:"".concat(e,"?").concat((n=i,a="",Object.keys(n).forEach((function(t){0!==a.length&&(a+="&"),a+=t+"="+n[t]})),a)),attributes:c}}(t),a=n.url,o=n.attributes,r=o["data-namespace"]||"paypal",i=k(r);return o["data-js-sdk-library"]||(o["data-js-sdk-library"]="paypal-js"),function(t,e){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var a=P(t,e),o=n.cloneNode();if(delete o.dataset.uidAuto,Object.keys(o.dataset).length!==Object.keys(a.dataset).length)return null;var r=!0;return Object.keys(o.dataset).forEach((function(t){o.dataset[t]!==a.dataset[t]&&(r=!1)})),r?n:null}(a,o)&&i?e.resolve(i):function(t,e){void 0===e&&(e=Promise),I(t,e);var n=t.url,a=t.attributes;if("string"!=typeof n||0===n.length)throw new Error("Invalid url.");if(void 0!==a&&"object"!=typeof a)throw new Error("Expected attributes to be an object.");return new e((function(t,e){if("undefined"==typeof document)return t();!function(t){var e=t.onSuccess,n=t.onError,a=P(t.url,t.attributes);a.onerror=n,a.onload=e,document.head.insertBefore(a,document.head.firstElementChild)}({url:n,attributes:a,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(n,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return e(t)}})}))}({url:a,attributes:o},e).then((function(){var t=k(r);if(t)return t;throw new Error("The window.".concat(r," global variable is not available."))}))}(m.options).then((function(){t&&b({type:s.LOADING_STATUS,value:i.RESOLVED})})).catch((function(e){console.error("".concat("Failed to load the PayPal JS SDK script."," ").concat(e)),t&&b({type:s.LOADING_STATUS,value:{state:i.REJECTED,message:String(e)}})})),function(){t=!1}}}),[m.options,u,m.loadingStatus]),e.createElement(h.Provider,{value:p(p({},m),{dispatch:b})},c)};function A(){}t.createContext({cardFieldsForm:null,fields:{},registerField:A,unregisterField:A});var O=booksterModules.utils;const T=O.CURRENCY.toUpperCase();function x(){return window.booksterPublicData}var C=booksterModules.booking,j=booksterModules.decimal;function R(){return C.useBookingStore()}function D(t,e){const n=R();return O.useStore(n,t,e)}const L="paypalPaymentForm",_={isLoading:!1,transactionId:null,orderId:null,orderAmount:null};function F(){const{bookingDetailsValue:t}=C.useBookingLogic().input;return e.createElement(e.Fragment,null,e.createElement("p",{className:"bw-mb-4 bw-mt-6 bw-flex bw-items-center bw-justify-center bw-gap-1.5 bw-text-sm bw-font-semibold bw-text-success"},e.createElement(n.Lock,{className:"bw-h-3.5 bw-w-3.5"}),e.createElement("span",{className:"bw-overflow-x-auto bw-text-nowrap"},"All transactions are secure, your card information will not be stored.")),e.createElement("div",{className:"bw-rounded-lg bw-bg-gray-50 bw-px-4 bw-py-2"},"Total booking price:"," ",e.createElement("strong",null,t&&O.formatPrice(t.tax.total))))}function B({children:t,...n}){return e.createElement("div",{className:"bw-relative bw-mb-4 bw-rounded bw-border bw-border-error/80 bw-bg-error/10 bw-px-4 bw-py-3 bw-text-error",...n},e.createElement("span",{className:"bw-block sm:bw-inline"},t))}function M(){const r=R(),i=D((t=>t.select.contact)),{isLoading:c}=D((t=>t.addonPaymentPaypal)),s=C.useBookingLogic(),{apptInput:l,transactionInput:u,bookingMetaInput:d,bookingDetailsValue:p}=s.input,m=s.process,[b,f]=t.useState(null);if(!(p&&l&&u&&i&&d))throw new Error("Sorry, Your Booking Selection is not Complete!");return e.createElement(e.Fragment,null,e.createElement(C.MainHeader,null),e.createElement(a.ScrollArea,{className:"btr-main-scrollarea bw-flex-grow"},e.createElement(a.XyzTransition,{appear:!0,xyz:"fade down-4"},e.createElement("div",{className:"bw-mx-auto bw-flex bw-min-h-[30rem] bw-max-w-[34rem] bw-flex-col bw-justify-center bw-p-4 bw-pt-8"},e.createElement("div",{className:"bw-flex-none"},b&&e.createElement(B,null,b),e.createElement(S,{style:{layout:"vertical"},createOrder:async()=>{const{orderAmount:t,orderId:e,transactionId:n}=r.getState().addonPaymentPaypal,a=p.tax.total;if(e&&t&&t.equals(a))return e;try{const t={apptInput:l,transactionInput:u,contactInput:i,bookingMetaInput:d||{}};if(e&&n){const o=await async function(t,e){return await O.api.patch("paypal/orders/amount",{json:{bookingRequestInput:e,transactionId:t}}).json()}(n,t);if(!a.equals(j.Decimal.fromString(o.orderAmount)))throw new Error("Sorry, Cannot calculate your Checkout!");return r.setState((t=>{t.addonPaymentPaypal.orderAmount=j.Decimal.fromString(o.orderAmount)})),e}{const e=await async function(t){return await O.api.post("paypal/orders",{json:{bookingRequestInput:t}}).json()}(t);if(!a.equals(j.Decimal.fromString(e.orderAmount)))throw new Error("Sorry, Cannot calculate your Checkout!");return r.setState((t=>{t.addonPaymentPaypal.orderAmount=a,t.addonPaymentPaypal.transactionId=e.transactionId,t.addonPaymentPaypal.orderId=e.orderId})),e.orderId}}catch(o){throw f(await O.getErrorMsg(o)),o}},onApprove:async()=>{const{orderId:t,transactionId:e}=r.getState().addonPaymentPaypal;try{if(r.setState((t=>{t.addonPaymentPaypal.isLoading=!0})),!t||!e)throw"Paypal Order Missing!";await async function(t){return await O.api.patch("paypal/orders/capture",{json:{transactionId:t}}).json()}(e);const{appointment:n,transaction:a,customer:o}=await O.requestBooking({apptInput:l,bookingMetaInput:d,transactionInput:u,contactInput:i});r.setState((t=>{t.booked.state="success",t.booked.appointment=n,t.booked.transaction=a,t.booked.customer=o})),m.mutate.nextAct()}catch(n){throw f(await O.getErrorMsg(n)),n}finally{r.setState((t=>{t.addonPaymentPaypal.isLoading=!1}))}}}),e.createElement(F,null),e.createElement(a.LoadingOverlay,{className:"-bw-inset-4 bw-z-[10000] bw-text-lg bw-font-medium bw-text-gray-500 bw-opacity-80",loading:c},e.createElement(n.Loader2,{className:"bw-mr-4 bw-h-6 bw-w-6 bw-animate-spin"}),o.__("Booking your Appointment!","bookster-paypal")))))),e.createElement(C.MainFooter,{prevButton:e.createElement(a.Button,{key:"paypal-prev-btn",className:"bw-me-auto bw-pl-0",variant:"link",disabled:c,onClick:()=>m.mutate.prevAct()},e.createElement(n.ArrowLeft,null),"Back")}))}function q(t){return e.createElement("div",{...t},e.createElement(N,{options:{clientId:x().addonPaymentPaypal.client_id,intent:"capture",components:"buttons",currency:T}},e.createElement(M,null)))}"payment-paypal"===x().paymentGateway.now&&(r.booksterHooks.addFilter(r.HOOK_NAMES.bookingForm.bookingConfig,"bookster-paypal",(function(t){const e=t.process.steps.map((t=>"checkout"===t.name?{...t,acts:[...t.acts,L]}:t));return{...t,process:{...t.process,steps:e}}})),r.booksterHooks.addFilter(r.HOOK_NAMES.bookingForm.bookingParts,"bookster-paypal",(function(t,n,a,o){return o.process.computed.act===L?{...t,main:{key:"paypal-payment-form",node:e.createElement(q,null)}}:t})),r.booksterHooks.addFilter(r.HOOK_NAMES.bookingForm.bookingInitState,"bookster-paypal",(function(t){return{...t,addonPaymentPaypal:_}})),r.booksterHooks.addFilter(r.HOOK_NAMES.bookingForm.bookingLogic,"bookster-paypal",(function(t,e,n){const{transactionId:a}=n.addonPaymentPaypal;return null!==a&&t.input.transactionInput&&(t.input.transactionInput.transactionId=a),t})),r.booksterHooks.addFilter(r.HOOK_NAMES.bookingForm.mutatePrevAct,"bookster-paypal",(function(t,e,n,{newPhase:a,oldPhase:o}){return a!==o&&"complete"===o&&(e.addonPaymentPaypal=_),t})));
  • bookster-paypal/trunk/assets/dist/paypal/style.css

    r3135815 r3244360  
    1 div.bookster-root .-bw-inset-4{top:-1rem;right:-1rem;bottom:-1rem;left:-1rem}div.bookster-root .bw-z-\[10000\]{z-index:10000}div.bookster-root .bw-h-3\.5{height:.875rem}div.bookster-root .bw-min-h-\[30rem\]{min-height:30rem}div.bookster-root .bw-w-3\.5{width:.875rem}div.bookster-root .bw-max-w-\[34rem\]{max-width:34rem}@keyframes bw-spin{to{transform:rotate(1turn)}}div.bookster-root .bw-animate-spin{animation:bw-spin 1s linear infinite}div.bookster-root .bw-gap-1\.5{gap:.375rem}div.bookster-root .bw-gap-x-4{-moz-column-gap:1rem;column-gap:1rem}div.bookster-root .bw-overflow-x-auto{overflow-x:auto}div.bookster-root .bw-text-nowrap{text-wrap:nowrap}div.bookster-root .bw-bg-base-bg2\/60{background-color:rgb(var(--btr-bbg2)/.6)}div.bookster-root .bw-bg-error\/10{background-color:rgb(var(--btr-er)/.1)}div.bookster-root .bw-opacity-80{opacity:.8}@media (min-width:576px){div.bookster-root .sm\:bw-inline{display:inline}div.bookster-root .sm\:bw-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}
     1div.bookster-root .-bw-inset-4{top:-1rem;right:-1rem;bottom:-1rem;left:-1rem}div.bookster-root .bw-z-\[10000\]{z-index:10000}div.bookster-root .bw-h-2\.5{height:.625rem}div.bookster-root .bw-h-3\.5{height:.875rem}div.bookster-root .bw-min-h-\[30rem\]{min-height:30rem}div.bookster-root .bw-w-2\.5{width:.625rem}div.bookster-root .bw-w-3\.5{width:.875rem}div.bookster-root .bw-max-w-\[34rem\]{max-width:34rem}@keyframes bw-spin{to{transform:rotate(1turn)}}div.bookster-root .bw-animate-spin{animation:bw-spin 1s linear infinite}div.bookster-root .bw-gap-1\.5{gap:.375rem}div.bookster-root .bw-gap-x-4{-moz-column-gap:1rem;column-gap:1rem}div.bookster-root .bw-overflow-x-auto{overflow-x:auto}div.bookster-root .bw-text-nowrap{text-wrap:nowrap}div.bookster-root .bw-bg-error\/10{background-color:rgb(var(--btr-er)/.1)}div.bookster-root .bw-opacity-80{opacity:.8}@media (min-width:576px){div.bookster-root .sm\:bw-inline{display:inline}div.bookster-root .sm\:bw-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}
  • bookster-paypal/trunk/bookster-paypal.php

    r3161763 r3244360  
    1313 * Requires Plugins:    bookster
    1414 * Description:         Official Bookster Paypal addon - Intergrate Paypal Payment to your Bookings.
    15  * Version:             2.0.0
     15 * Version:             2.1.0
    1616 * Requires at least:   6.2
    1717 * Requires PHP:        7.4
     
    2727}
    2828
    29 define( 'BOOKSTER_PAYPAL_VERSION', '2.0.0' );
     29define( 'BOOKSTER_PAYPAL_VERSION', '2.1.0' );
    3030
    3131define( 'BOOKSTER_PAYPAL_PLUGIN_FILE', __FILE__ );
  • bookster-paypal/trunk/languages/bookster-paypal.pot

    r3161763 r3244360  
    1 # Copyright (C) 2024 WPBookster
     1# Copyright (C) 2025 WPBookster
    22# This file is distributed under the GPL v3 or later.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Bookster Paypal 1.1.0\n"
     5"Project-Id-Version: Bookster Paypal 2.1.0\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/bookster-paypal\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-09-26T08:09:20+00:00\n"
     12"POT-Creation-Date: 2025-02-17T01:57:32+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    14 "X-Generator: WP-CLI 2.6.0\n"
     14"X-Generator: WP-CLI 2.11.0\n"
    1515"X-Domain: bookster-paypal\n"
    1616
    1717#. Plugin Name of the plugin
     18#: bookster-paypal.php
    1819msgid "Bookster Paypal"
    1920msgstr ""
    2021
    2122#. Plugin URI of the plugin
     23#: bookster-paypal.php
    2224msgid "https://wpbookster.com/"
    2325msgstr ""
    2426
    2527#. Description of the plugin
     28#: bookster-paypal.php
    2629msgid "Official Bookster Paypal addon - Intergrate Paypal Payment to your Bookings."
    2730msgstr ""
    2831
    2932#. Author of the plugin
     33#: bookster-paypal.php
    3034msgid "WPBookster"
    3135msgstr ""
    3236
    3337#. Author URI of the plugin
     38#: bookster-paypal.php
    3439msgid "https://wpbookster.com/about"
    3540msgstr ""
     
    5156#: src/Engine/PaypalSettings.php:59
    5257msgid "Settings"
    53 msgstr ""
    54 
    55 #: assets/dist/paypal/admin.js:1
    56 msgid "Paypal"
    5758msgstr ""
    5859
     
    8586msgstr ""
    8687
     88#: assets/dist/paypal/admin.js:1
     89msgid "Paypal"
     90msgstr ""
     91
    8792#: assets/dist/paypal/frontend.js:1
    8893msgid "Booking your Appointment!"
  • bookster-paypal/trunk/readme.txt

    r3161763 r3244360  
    44Tags: online payments, appointments, paypal, payments, checkout
    55Requires at least: 5.2
    6 Tested up to: 6.6
    7 Stable tag: 2.0.0
     6Tested up to: 6.7.2
     7Stable tag: 2.1.0
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    5454== Changelog ==
    5555
     56= Feb 21, 2025 – Version 2.1.0 =
     57- Improved: Compatible with Bookster version 2.1.0
     58- Improved: UI/UX
     59
    5660= Oct 2, 2024 - Version 2.0.0 =
    5761- Added: Compatibility with Bookster v2.0.0
  • bookster-paypal/trunk/src/Engine/Enqueue.php

    r3135815 r3244360  
    3939        $deps = [ ScriptName::LIB_CORE, ScriptName::LIB_ICONS, ScriptName::LIB_COMPONENTS, ScriptName::LIB_BOOKING, 'react', 'react-dom', 'wp-hooks', 'wp-i18n' ];
    4040
    41         wp_register_script( self::FRONTEND_SCRIPT, BOOKSTER_PAYPAL_PLUGIN_URL . 'assets/dist/paypal/frontend.js', $deps, BOOKSTER_PAYPAL_VERSION, false );
     41        wp_register_script( self::FRONTEND_SCRIPT, BOOKSTER_PAYPAL_PLUGIN_URL . 'assets/dist/paypal/frontend.js', $deps, BOOKSTER_PAYPAL_VERSION, true );
    4242        wp_set_script_translations( self::FRONTEND_SCRIPT, 'bookster-paypal', BOOKSTER_PAYPAL_PLUGIN_PATH . 'languages' );
    4343
    44         wp_register_script( self::ADMIN_SCRIPT, BOOKSTER_PAYPAL_PLUGIN_URL . 'assets/dist/paypal/admin.js', $deps, BOOKSTER_PAYPAL_VERSION, false );
     44        wp_register_script( self::ADMIN_SCRIPT, BOOKSTER_PAYPAL_PLUGIN_URL . 'assets/dist/paypal/admin.js', $deps, BOOKSTER_PAYPAL_VERSION, true );
    4545        wp_set_script_translations( self::ADMIN_SCRIPT, 'bookster-paypal', BOOKSTER_PAYPAL_PLUGIN_PATH . 'languages' );
    4646    }
  • bookster-paypal/trunk/vendor/autoload.php

    r3120716 r3244360  
    44
    55if (PHP_VERSION_ID < 50600) {
    6     echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
    7     exit(1);
     6    if (!headers_sent()) {
     7        header('HTTP/1.1 500 Internal Server Error');
     8    }
     9    $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
     10    if (!ini_get('display_errors')) {
     11        if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
     12            fwrite(STDERR, $err);
     13        } elseif (!headers_sent()) {
     14            echo $err;
     15        }
     16    }
     17    trigger_error(
     18        $err,
     19        E_USER_ERROR
     20    );
    821}
    922
    1023require_once __DIR__ . '/composer/autoload_real.php';
    1124
    12 return ComposerAutoloaderInitba5ec13b608a9d093bc629ca1333162d::getLoader();
     25return ComposerAutoloaderInitbdefbc1b05bb26f9e417e43e41232339::getLoader();
  • bookster-paypal/trunk/vendor/composer/ClassLoader.php

    r3120716 r3244360  
    4343class ClassLoader
    4444{
    45     /** @var ?string */
     45    /** @var \Closure(string):void */
     46    private static $includeFile;
     47
     48    /** @var string|null */
    4649    private $vendorDir;
    4750
    4851    // PSR-4
    4952    /**
    50      * @var array[]
    51      * @psalm-var array<string, array<string, int>>
     53     * @var array<string, array<string, int>>
    5254     */
    5355    private $prefixLengthsPsr4 = array();
    5456    /**
    55      * @var array[]
    56      * @psalm-var array<string, array<int, string>>
     57     * @var array<string, list<string>>
    5758     */
    5859    private $prefixDirsPsr4 = array();
    5960    /**
    60      * @var array[]
    61      * @psalm-var array<string, string>
     61     * @var list<string>
    6262     */
    6363    private $fallbackDirsPsr4 = array();
     
    6565    // PSR-0
    6666    /**
    67      * @var array[]
    68      * @psalm-var array<string, array<string, string[]>>
     67     * List of PSR-0 prefixes
     68     *
     69     * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
     70     *
     71     * @var array<string, array<string, list<string>>>
    6972     */
    7073    private $prefixesPsr0 = array();
    7174    /**
    72      * @var array[]
    73      * @psalm-var array<string, string>
     75     * @var list<string>
    7476     */
    7577    private $fallbackDirsPsr0 = array();
     
    7981
    8082    /**
    81      * @var string[]
    82      * @psalm-var array<string, string>
     83     * @var array<string, string>
    8384     */
    8485    private $classMap = array();
     
    8889
    8990    /**
    90      * @var bool[]
    91      * @psalm-var array<string, bool>
     91     * @var array<string, bool>
    9292     */
    9393    private $missingClasses = array();
    9494
    95     /** @var ?string */
     95    /** @var string|null */
    9696    private $apcuPrefix;
    9797
    9898    /**
    99      * @var self[]
     99     * @var array<string, self>
    100100     */
    101101    private static $registeredLoaders = array();
    102102
    103103    /**
    104      * @param ?string $vendorDir
     104     * @param string|null $vendorDir
    105105     */
    106106    public function __construct($vendorDir = null)
    107107    {
    108108        $this->vendorDir = $vendorDir;
    109     }
    110 
    111     /**
    112      * @return string[]
     109        self::initializeIncludeClosure();
     110    }
     111
     112    /**
     113     * @return array<string, list<string>>
    113114     */
    114115    public function getPrefixes()
     
    122123
    123124    /**
    124      * @return array[]
    125      * @psalm-return array<string, array<int, string>>
     125     * @return array<string, list<string>>
    126126     */
    127127    public function getPrefixesPsr4()
     
    131131
    132132    /**
    133      * @return array[]
    134      * @psalm-return array<string, string>
     133     * @return list<string>
    135134     */
    136135    public function getFallbackDirs()
     
    140139
    141140    /**
    142      * @return array[]
    143      * @psalm-return array<string, string>
     141     * @return list<string>
    144142     */
    145143    public function getFallbackDirsPsr4()
     
    149147
    150148    /**
    151      * @return string[] Array of classname => path
    152      * @psalm-return array<string, string>
     149     * @return array<string, string> Array of classname => path
    153150     */
    154151    public function getClassMap()
     
    158155
    159156    /**
    160      * @param string[] $classMap Class to filename map
    161      * @psalm-param array<string, string> $classMap
     157     * @param array<string, string> $classMap Class to filename map
    162158     *
    163159     * @return void
     
    176172     * appending or prepending to the ones previously set for this prefix.
    177173     *
    178      * @param string          $prefix  The prefix
    179      * @param string[]|string $paths   The PSR-0 root directories
    180      * @param bool            $prepend Whether to prepend the directories
     174     * @param string              $prefix  The prefix
     175     * @param list<string>|string $paths   The PSR-0 root directories
     176     * @param bool                $prepend Whether to prepend the directories
    181177     *
    182178     * @return void
     
    184180    public function add($prefix, $paths, $prepend = false)
    185181    {
     182        $paths = (array) $paths;
    186183        if (!$prefix) {
    187184            if ($prepend) {
    188185                $this->fallbackDirsPsr0 = array_merge(
    189                     (array) $paths,
     186                    $paths,
    190187                    $this->fallbackDirsPsr0
    191188                );
     
    193190                $this->fallbackDirsPsr0 = array_merge(
    194191                    $this->fallbackDirsPsr0,
    195                     (array) $paths
     192                    $paths
    196193                );
    197194            }
     
    202199        $first = $prefix[0];
    203200        if (!isset($this->prefixesPsr0[$first][$prefix])) {
    204             $this->prefixesPsr0[$first][$prefix] = (array) $paths;
     201            $this->prefixesPsr0[$first][$prefix] = $paths;
    205202
    206203            return;
     
    208205        if ($prepend) {
    209206            $this->prefixesPsr0[$first][$prefix] = array_merge(
    210                 (array) $paths,
     207                $paths,
    211208                $this->prefixesPsr0[$first][$prefix]
    212209            );
     
    214211            $this->prefixesPsr0[$first][$prefix] = array_merge(
    215212                $this->prefixesPsr0[$first][$prefix],
    216                 (array) $paths
     213                $paths
    217214            );
    218215        }
     
    223220     * appending or prepending to the ones previously set for this namespace.
    224221     *
    225      * @param string          $prefix  The prefix/namespace, with trailing '\\'
    226      * @param string[]|string $paths   The PSR-4 base directories
    227      * @param bool            $prepend Whether to prepend the directories
     222     * @param string              $prefix  The prefix/namespace, with trailing '\\'
     223     * @param list<string>|string $paths   The PSR-4 base directories
     224     * @param bool                $prepend Whether to prepend the directories
    228225     *
    229226     * @throws \InvalidArgumentException
     
    233230    public function addPsr4($prefix, $paths, $prepend = false)
    234231    {
     232        $paths = (array) $paths;
    235233        if (!$prefix) {
    236234            // Register directories for the root namespace.
    237235            if ($prepend) {
    238236                $this->fallbackDirsPsr4 = array_merge(
    239                     (array) $paths,
     237                    $paths,
    240238                    $this->fallbackDirsPsr4
    241239                );
     
    243241                $this->fallbackDirsPsr4 = array_merge(
    244242                    $this->fallbackDirsPsr4,
    245                     (array) $paths
     243                    $paths
    246244                );
    247245            }
     
    253251            }
    254252            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
    255             $this->prefixDirsPsr4[$prefix] = (array) $paths;
     253            $this->prefixDirsPsr4[$prefix] = $paths;
    256254        } elseif ($prepend) {
    257255            // Prepend directories for an already registered namespace.
    258256            $this->prefixDirsPsr4[$prefix] = array_merge(
    259                 (array) $paths,
     257                $paths,
    260258                $this->prefixDirsPsr4[$prefix]
    261259            );
     
    264262            $this->prefixDirsPsr4[$prefix] = array_merge(
    265263                $this->prefixDirsPsr4[$prefix],
    266                 (array) $paths
     264                $paths
    267265            );
    268266        }
     
    273271     * replacing any others previously set for this prefix.
    274272     *
    275      * @param string          $prefix The prefix
    276      * @param string[]|string $paths  The PSR-0 base directories
     273     * @param string              $prefix The prefix
     274     * @param list<string>|string $paths  The PSR-0 base directories
    277275     *
    278276     * @return void
     
    291289     * replacing any others previously set for this namespace.
    292290     *
    293      * @param string          $prefix The prefix/namespace, with trailing '\\'
    294      * @param string[]|string $paths  The PSR-4 base directories
     291     * @param string              $prefix The prefix/namespace, with trailing '\\'
     292     * @param list<string>|string $paths  The PSR-4 base directories
    295293     *
    296294     * @throws \InvalidArgumentException
     
    426424    {
    427425        if ($file = $this->findFile($class)) {
    428             includeFile($file);
     426            $includeFile = self::$includeFile;
     427            $includeFile($file);
    429428
    430429            return true;
     
    477476
    478477    /**
    479      * Returns the currently registered loaders indexed by their corresponding vendor directories.
    480      *
    481      * @return self[]
     478     * Returns the currently registered loaders keyed by their corresponding vendor directories.
     479     *
     480     * @return array<string, self>
    482481     */
    483482    public static function getRegisteredLoaders()
     
    556555        return false;
    557556    }
     557
     558    /**
     559     * @return void
     560     */
     561    private static function initializeIncludeClosure()
     562    {
     563        if (self::$includeFile !== null) {
     564            return;
     565        }
     566
     567        /**
     568         * Scope isolated include.
     569         *
     570         * Prevents access to $this/self from included files.
     571         *
     572         * @param  string $file
     573         * @return void
     574         */
     575        self::$includeFile = \Closure::bind(static function($file) {
     576            include $file;
     577        }, null, null);
     578    }
    558579}
    559 
    560 /**
    561  * Scope isolated include.
    562  *
    563  * Prevents access to $this/self from included files.
    564  *
    565  * @param  string $file
    566  * @return void
    567  * @private
    568  */
    569 function includeFile($file)
    570 {
    571     include $file;
    572 }
  • bookster-paypal/trunk/vendor/composer/InstalledVersions.php

    r3120716 r3244360  
    3434
    3535    /**
     36     * @var bool
     37     */
     38    private static $installedIsLocalDir;
     39
     40    /**
    3641     * @var bool|null
    3742     */
     
    99104        foreach (self::getInstalled() as $installed) {
    100105            if (isset($installed['versions'][$packageName])) {
    101                 return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
     106                return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
    102107            }
    103108        }
     
    120125    public static function satisfies(VersionParser $parser, $packageName, $constraint)
    121126    {
    122         $constraint = $parser->parseConstraints($constraint);
     127        $constraint = $parser->parseConstraints((string) $constraint);
    123128        $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
    124129
     
    310315        self::$installed = $data;
    311316        self::$installedByVendor = array();
     317
     318        // when using reload, we disable the duplicate protection to ensure that self::$installed data is
     319        // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
     320        // so we have to assume it does not, and that may result in duplicate data being returned when listing
     321        // all installed packages for example
     322        self::$installedIsLocalDir = false;
    312323    }
    313324
     
    323334
    324335        $installed = array();
     336        $copiedLocalDir = false;
    325337
    326338        if (self::$canGetVendors) {
     339            $selfDir = strtr(__DIR__, '\\', '/');
    327340            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     341                $vendorDir = strtr($vendorDir, '\\', '/');
    328342                if (isset(self::$installedByVendor[$vendorDir])) {
    329343                    $installed[] = self::$installedByVendor[$vendorDir];
    330344                } elseif (is_file($vendorDir.'/composer/installed.php')) {
    331                     $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
    332                     if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    333                         self::$installed = $installed[count($installed) - 1];
     345                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
     346                    $required = require $vendorDir.'/composer/installed.php';
     347                    self::$installedByVendor[$vendorDir] = $required;
     348                    $installed[] = $required;
     349                    if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
     350                        self::$installed = $required;
     351                        self::$installedIsLocalDir = true;
    334352                    }
     353                }
     354                if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
     355                    $copiedLocalDir = true;
    335356                }
    336357            }
     
    341362            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
    342363            if (substr(__DIR__, -8, 1) !== 'C') {
    343                 self::$installed = require __DIR__ . '/installed.php';
     364                /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
     365                $required = require __DIR__ . '/installed.php';
     366                self::$installed = $required;
    344367            } else {
    345368                self::$installed = array();
    346369            }
    347370        }
    348         $installed[] = self::$installed;
     371
     372        if (self::$installed !== array() && !$copiedLocalDir) {
     373            $installed[] = self::$installed;
     374        }
    349375
    350376        return $installed;
  • bookster-paypal/trunk/vendor/composer/autoload_real.php

    r3120716 r3244360  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitba5ec13b608a9d093bc629ca1333162d
     5class ComposerAutoloaderInitbdefbc1b05bb26f9e417e43e41232339
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInitba5ec13b608a9d093bc629ca1333162d', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInitbdefbc1b05bb26f9e417e43e41232339', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInitba5ec13b608a9d093bc629ca1333162d', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInitbdefbc1b05bb26f9e417e43e41232339', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInitba5ec13b608a9d093bc629ca1333162d::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInitbdefbc1b05bb26f9e417e43e41232339::getInitializer($loader));
    3333
    3434        $loader->register(true);
  • bookster-paypal/trunk/vendor/composer/autoload_static.php

    r3135815 r3244360  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitba5ec13b608a9d093bc629ca1333162d
     7class ComposerStaticInitbdefbc1b05bb26f9e417e43e41232339
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    2828    {
    2929        return \Closure::bind(function () use ($loader) {
    30             $loader->prefixLengthsPsr4 = ComposerStaticInitba5ec13b608a9d093bc629ca1333162d::$prefixLengthsPsr4;
    31             $loader->prefixDirsPsr4 = ComposerStaticInitba5ec13b608a9d093bc629ca1333162d::$prefixDirsPsr4;
    32             $loader->classMap = ComposerStaticInitba5ec13b608a9d093bc629ca1333162d::$classMap;
     30            $loader->prefixLengthsPsr4 = ComposerStaticInitbdefbc1b05bb26f9e417e43e41232339::$prefixLengthsPsr4;
     31            $loader->prefixDirsPsr4 = ComposerStaticInitbdefbc1b05bb26f9e417e43e41232339::$prefixDirsPsr4;
     32            $loader->classMap = ComposerStaticInitbdefbc1b05bb26f9e417e43e41232339::$classMap;
    3333
    3434        }, null, ClassLoader::class);
  • bookster-paypal/trunk/vendor/composer/installed.php

    r3161763 r3244360  
    44        'pretty_version' => 'dev-develop',
    55        'version' => 'dev-develop',
    6         'reference' => 'dea5b652a104261a0c370f254b3273acece5bb8d',
     6        'reference' => '5b82c01500f2e3ec05a0806ec18d87fcf4034737',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-develop',
    1515            'version' => 'dev-develop',
    16             'reference' => 'dea5b652a104261a0c370f254b3273acece5bb8d',
     16            'reference' => '5b82c01500f2e3ec05a0806ec18d87fcf4034737',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.