1 line
9.6 KiB
JavaScript
1 line
9.6 KiB
JavaScript
|
(()=>{"use strict";var e={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{__experimentalDeRegisterExpressPaymentMethod:()=>T,__experimentalDeRegisterPaymentMethod:()=>P,getExpressPaymentMethods:()=>E,getPaymentMethods:()=>C,getRegisteredBlockComponents:()=>I,getRegisteredInnerBlocks:()=>O,registerBlockComponent:()=>x,registerExpressPaymentMethod:()=>k,registerInnerBlock:()=>R,registerPaymentMethod:()=>w,registerPaymentMethodExtensionCallbacks:()=>M});const o=window.wp.deprecated;var n=e.n(o);const r=window.wp.data;function a(e){return a="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},a(e)}function i(e,t,o){return(t=function(e){var t=function(e,t){if("object"!==a(e)||null===e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var n=o.call(e,"string");if("object"!==a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===a(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}const s=window.React,l={},p=l,c=(e,t,o)=>{const n=((e,t)=>o=>((null==o?void 0:o.paymentRequirements)||[]).every((e=>t.includes(e)))&&e(o))(e,t);return Object.values(p).some((e=>o in e))?((e,t,o)=>n=>{let r=e(n);if(r){const e={};Object.entries(t).forEach((([t,n])=>{o in n&&"function"==typeof n[o]&&(e[t]=n[o])})),r=Object.keys(e).every((t=>{try{return e[t](n)}catch(e){return console.error(`Error when executing callback for ${o} in ${t}`,e),!0}}))}return r})(n,p,o):n},d=window.wp.element,m=(e,t)=>{if(null!==e&&!(0,d.isValidElement)(e))throw new TypeError(`The ${t} property for the payment method must be a React element or null.`)},u=(e,t=[])=>{const o=t.reduce(((t,o)=>(e.hasOwnProperty(o)||t.push(o),t)),[]);if(o.length>0)throw new TypeError("The payment method configuration object is missing the following properties:"+o.join(", "))},h=()=>null;class y{constructor(e){var t,o,n,r;i(this,"name",void 0),i(this,"content",void 0),i(this,"edit",void 0),i(this,"paymentMethodId",void 0),i(this,"supports",void 0),i(this,"icons",void 0),i(this,"label",void 0),i(this,"ariaLabel",void 0),i(this,"placeOrderButtonLabel",void 0),i(this,"savedTokenComponent",void 0),i(this,"canMakePaymentFromConfig",void 0),y.assertValidConfig(e),this.name=e.name,this.label=e.label,this.placeOrderButtonLabel=e.placeOrderButtonLabel,this.ariaLabel=e.ariaLabel,this.content=e.content,this.savedTokenComponent=e.savedTokenComponent,this.icons=e.icons||null,this.edit=e.edit,this.paymentMethodId=e.paymentMethodId||this.name,this.supports={showSavedCards:(null==e||null===(t=e.supports)||void 0===t?void 0:t.showSavedCards)||(null==e||null===(o=e.supports)||void 0===o?void 0:o.savePaymentInfo)||!1,showSaveOption:(null==e||null===(n=e.supports)||void 0===n?void 0:n.showSaveOption)||!1,features:(null==e||null===(r=e.supports)||void 0===r?void 0:r.features)||["products"]},this.canMakePaymentFromConfig=e.canMakePayment}get canMakePayment(){return c(this.canMakePaymentFromConfig,this.supports.features,this.name)}}i(y,"assertValidConfig",(e=>{var t,o,r,a,i,l,p;if(e.savedTokenComponent=e.savedTokenComponent||(0,s.createElement)(h,null),u(e,["name","label","ariaLabel","content","edit","canMakePayment"]),"string"!=typeof e.name)throw new Error("The name property for the payment method must be a string");if(void 0!==e.icons&&!Array.isArray(e.icons)&&null!==e.icons)throw new Error("The icons property for the payment method must be an array or null.");if("string"!=typeof e.paymentMethodId&&void 0!==e.paymentMethodId)throw new Error("The paymentMethodId property for the payment method mu
|