1 line
21 KiB
JavaScript
1 line
21 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 r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},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:()=>S,__experimentalDeRegisterPaymentMethod:()=>I,__experimentalRegisterProductCollection:()=>G,getExpressPaymentMethods:()=>C,getPaymentMethods:()=>E,getRegisteredBlockComponents:()=>A,getRegisteredInnerBlocks:()=>x,registerBlockComponent:()=>O,registerExpressPaymentMethod:()=>k,registerInnerBlock:()=>R,registerPaymentMethod:()=>g,registerPaymentMethodExtensionCallbacks:()=>P});const o=window.wp.deprecated;var r=e.n(o);const n=window.wp.data;function i(e){return i="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},i(e)}function a(e,t,o){return(t=function(e){var t=function(e,t){if("object"!==i(e)||null===e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,"string");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===i(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={},c=l,d=(e,t,o)=>{const r=((e,t)=>o=>((null==o?void 0:o.paymentRequirements)||[]).every((e=>t.includes(e)))&&e(o))(e,t);return Object.values(c).some((e=>o in e))?((e,t,o)=>r=>{let n=e(r);if(n){const e={};Object.entries(t).forEach((([t,r])=>{o in r&&"function"==typeof r[o]&&(e[t]=r[o])})),n=Object.keys(e).every((t=>{try{return e[t](r)}catch(e){return console.error(`Error when executing callback for ${o} in ${t}`,e),!0}}))}return n})(r,c,o):r},u=window.wp.element,m=(e,t)=>{if(null!==e&&!(0,u.isValidElement)(e))throw new TypeError(`The ${t} property for the payment method must be a React element or null.`)},p=(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(", "))},y=()=>null;class v{constructor(e){var t,o,r,n;a(this,"name",void 0),a(this,"content",void 0),a(this,"edit",void 0),a(this,"paymentMethodId",void 0),a(this,"supports",void 0),a(this,"icons",void 0),a(this,"label",void 0),a(this,"ariaLabel",void 0),a(this,"placeOrderButtonLabel",void 0),a(this,"savedTokenComponent",void 0),a(this,"canMakePaymentFromConfig",void 0),v.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===(r=e.supports)||void 0===r?void 0:r.showSaveOption)||!1,features:(null==e||null===(n=e.supports)||void 0===n?void 0:n.features)||["products"]},this.canMakePaymentFromConfig=e.canMakePayment}get canMakePayment(){return d(this.canMakePaymentFromConfig,this.supports.features,this.name)}}a(v,"assertValidConfig",(e=>{var t,o,n,i,a,l,c;if(e.savedTokenComponent=e.savedTokenComponent||(0,s.createElement)(y,null),p(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 paym
|