File "wc-blocks-registry.js"

Full Path: /home/warrior1/public_html/plugins/woocommerce/packages/woocommerce-blocks/build/wc-blocks-registry.js
File size: 9.39 KB
MIME-type: text/plain
Charset: utf-8

this.wc=this.wc||{},this.wc.wcBlocksRegistry=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=139)}({0:function(e,t){e.exports=window.wp.element},139:function(e,t,n){"use strict";n.r(t),n.d(t,"registerPaymentMethod",(function(){return g})),n.d(t,"registerExpressPaymentMethod",(function(){return v})),n.d(t,"registerPaymentMethodExtensionCallbacks",(function(){return w})),n.d(t,"__experimentalDeRegisterPaymentMethod",(function(){return k})),n.d(t,"__experimentalDeRegisterExpressPaymentMethod",(function(){return M})),n.d(t,"getPaymentMethods",(function(){return P})),n.d(t,"getExpressPaymentMethods",(function(){return T})),n.d(t,"getRegisteredBlockComponents",(function(){return C})),n.d(t,"getRegisteredInnerBlocks",(function(){return x})),n.d(t,"registerBlockComponent",(function(){return O})),n.d(t,"registerInnerBlock",(function(){return S}));var o=n(7),r=n.n(o),a=n(16),i=n.n(a),s=n(0);const c={},l=c,u=(e,t,n)=>{const o=((e,t)=>n=>((null==n?void 0:n.paymentRequirements)||[]).every(e=>t.includes(e))&&e(n))(e,t);return Object.values(l).some(e=>n in e)?((e,t,n)=>o=>{let r=e(o);if(r){const e={};Object.entries(t).forEach(t=>{let[o,r]=t;e[o]=r[n]}),r=Object.keys(e).every(t=>{try{return e[t](o)}catch(e){return console.error(`Error when executing callback for ${n} in ${t}`,e),!0}})}return r})(o,l,n):o},p=(e,t)=>{if(null!==e&&!Object(s.isValidElement)(e))throw new TypeError(`The ${t} property for the payment method must be a React element or null.`)},d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n=t.reduce((t,n)=>(e.hasOwnProperty(n)||t.push(n),t),[]);if(n.length>0)throw new TypeError("The payment method configuration object is missing the following properties:"+n.join(", "))},m=()=>null;class h{constructor(e){var t,n,o,r;h.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===(n=e.supports)||void 0===n?void 0:n.savePaymentInfo)||!1,showSaveOption:(null==e||null===(o=e.supports)||void 0===o?void 0:o.showSaveOption)||!1,features:(null==e||null===(r=e.supports)||void 0===r?void 0:r.features)||["products"]},this.canMakePaymentFromConfig=e.canMakePayment}get canMakePayment(){return u(this.canMakePaymentFromConfig,this.supports.features,this.name)}}i()(h,"assertValidConfig",e=>{var t,n,o,a,i,c,l;if(e.savedTokenComponent=e.savedTokenComponent||Object(s.createElement)(m,null),d(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 must be a string or undefined (in which case it will be the value of the name property).");if("string"!=typeof e.placeOrderButtonLabel&&void 0!==e.placeOrderButtonLabel)throw new TypeError("The placeOrderButtonLabel property for the payment method must be a string");if(((e,t)=>{if(null!==e&&!Object(s.isValidElement)(e)&&"string"!=typeof e)throw new TypeError("The label property for the payment method must be a React element, a string, or null.")})(e.label),p(e.content,"content"),p(e.edit,"edit"),p(e.savedTokenComponent,"savedTokenComponent"),"string"!=typeof e.ariaLabel)throw new TypeError("The ariaLabel property for the payment method must be a string");if("function"!=typeof e.canMakePayment)throw new TypeError("The canMakePayment property for the payment method must be a function.");if(void 0!==(null===(t=e.supports)||void 0===t?void 0:t.showSavedCards)&&"boolean"!=typeof(null===(n=e.supports)||void 0===n?void 0:n.showSavedCards))throw new TypeError("If the payment method includes the `supports.showSavedCards` property, it must be a boolean");if(void 0!==(null===(o=e.supports)||void 0===o?void 0:o.savePaymentInfo)&&r()("Passing savePaymentInfo when registering a payment method.",{alternative:"Pass showSavedCards and showSaveOption",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3686"}),void 0!==(null===(a=e.supports)||void 0===a?void 0:a.features)&&!Array.isArray(null===(i=e.supports)||void 0===i?void 0:i.features))throw new Error("The features property for the payment method must be an array or undefined.");if(void 0!==(null===(c=e.supports)||void 0===c?void 0:c.showSaveOption)&&"boolean"!=typeof(null===(l=e.supports)||void 0===l?void 0:l.showSaveOption))throw new TypeError("If the payment method includes the `supports.showSaveOption` property, it must be a boolean")});class f{constructor(e){var t;f.assertValidConfig(e),this.name=e.name,this.content=e.content,this.edit=e.edit,this.paymentMethodId=e.paymentMethodId||this.name,this.supports={features:(null==e||null===(t=e.supports)||void 0===t?void 0:t.features)||["products"]},this.canMakePaymentFromConfig=e.canMakePayment}get canMakePayment(){return u(this.canMakePaymentFromConfig,this.supports.features,this.name)}}i()(f,"assertValidConfig",e=>{var t,n;if(d(e,["name","content","edit"]),"string"!=typeof e.name)throw new TypeError("The name property for the express payment method must be a string");if("string"!=typeof e.paymentMethodId&&void 0!==e.paymentMethodId)throw new Error("The paymentMethodId property for the payment method must be a string or undefined (in which case it will be the value of the name property).");if(void 0!==(null===(t=e.supports)||void 0===t?void 0:t.features)&&!Array.isArray(null===(n=e.supports)||void 0===n?void 0:n.features))throw new Error("The features property for the payment method must be an array or undefined.");if(p(e.content,"content"),p(e.edit,"edit"),"function"!=typeof e.canMakePayment)throw new TypeError("The canMakePayment property for the express payment method must be a function.")});const y={},b={},g=e=>{let t;"function"==typeof e?(t=e(h),r()("Passing a callback to registerPaymentMethod()",{alternative:"a config options object",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3404"})):t=new h(e),t instanceof h&&(y[t.name]=t)},v=e=>{let t;"function"==typeof e?(t=e(f),r()("Passing a callback to registerExpressPaymentMethod()",{alternative:"a config options object",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3404"})):t=new f(e),t instanceof f&&(b[t.name]=t)},w=(e,t)=>{c[e]?console.error(`The namespace provided to registerPaymentMethodExtensionCallbacks must be unique. Callbacks have already been registered for the ${e} namespace.`):(c[e]={},Object.entries(t).forEach(t=>{let[n,o]=t;"function"==typeof o?c[e][n]=o:console.error(`All callbacks provided to registerPaymentMethodExtensionCallbacks must be functions. The callback for the ${n} payment method in the ${e} namespace was not a function.`)}))},k=e=>{delete y[e]},M=e=>{delete b[e]},P=()=>y,T=()=>b,E={};function C(e){return{..."object"==typeof E[e]&&Object.keys(E[e]).length>0?E[e]:{},...E.any}}function x(e){return r()("getRegisteredInnerBlocks",{version:"2.8.0",alternative:"getRegisteredBlockComponents",plugin:"WooCommerce Blocks"}),C(e)}function O(e){e.context||(e.context="any"),j(e,"context","string"),j(e,"blockName","string"),I(e,"component");const{context:t,blockName:n,component:o}=e;E[t]||(E[t]={}),E[t][n]=o}const I=(e,t)=>{if(e[t]){if("function"==typeof e[t])return;if(e[t].$$typeof&&e[t].$$typeof===Symbol.for("react.lazy"))return}throw new Error(`Incorrect value for the ${t} argument when registering a block component. Component must be a valid React Element or Lazy callback.`)},j=(e,t,n)=>{const o=typeof e[t];if(o!==n)throw new Error(`Incorrect value for the ${t} argument when registering a block component. It was a ${o}, but must be a ${n}.`)};function S(e){r()("registerInnerBlock",{version:"2.8.0",alternative:"registerBlockComponent",plugin:"WooCommerce Blocks",hint:'"main" has been replaced with "context" and is now optional.'}),j(e,"main","string"),O({...e,context:e.main})}},16:function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},7:function(e,t){e.exports=window.wp.deprecated}});