woocommerce/packages/woocommerce-blocks/build/blocks-checkout.js

5 lines
77 KiB
JavaScript
Raw Normal View History

2021-12-10 12:03:04 +00:00
this.wc=this.wc||{},this.wc.blocksCheckout=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},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=160)}([function(e,t){e.exports=window.wp.element},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.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.i18n},,function(e,t){e.exports=window.lodash},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var c=o.apply(null,r);c&&e.push(c)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var a in r)n.call(r,a)&&r[a]&&e.push(a);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=n=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),n(t)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wc.wcSettings},,function(e,t){e.exports=window.wp.deprecated},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.primitives},function(e,t,n){var r=n(20),o=n(21),i=n(18),c=n(22);e.exports=function(e,t){return r(e)||o(e,t)||i(e,t)||c()},e.exports.default=e.exports,e.exports.__esModule=!0},,function(e,t,n){"use strict";n.d(t,"c",(function(){return o})),n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return c}));var r=n(2),o="wc/store/cart",i={code:"cart_api_error",message:Object(r.__)("Unable to get cart data from the API.",'woocommerce'),data:{status:500}},c="wc-blocks_cart_update_timestamp"},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.React},function(e,t,n){var r=n(19);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){var n=null==e?null:"undefined"!=type
/* translators: %1$s value passed to filter, %2$s : value that must be included. */
Object(U.__)('Returned value must include %1$s, you passed "%2$s"','woocommerce'),e,t));return!0},G=function(){return!0},q=n(10),Y=n(14),Z=function(e){return(0,Object(q.dispatch)(Y.c).applyExtensionCartUpdate)(e)},J=n(9),Q=n.n(J),X=n(11);function ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var te=n(28);function ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(n),!0).forEach((function(t){ee(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function oe(e){var t=Object(r.useContext)(te.a),n=t.slots[e]||{},o=t.fills[e],i=Object(r.useMemo)((function(){return o||[]}),[o]),c=Object(r.useCallback)((function(n){t.updateSlot(e,n)}),[e,t.updateSlot]),a=Object(r.useCallback)((function(n){t.unregisterSlot(e,n)}),[e,t.unregisterSlot]),u=Object(r.useCallback)((function(n){t.registerFill(e,n)}),[e,t.registerFill]),s=Object(r.useCallback)((function(n){t.unregisterFill(e,n)}),[e,t.unregisterFill]);return re(re({},n),{},{updateSlot:c,unregisterSlot:a,fills:i,registerFill:u,unregisterFill:s})}function ie(){return(ie=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function ce(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function ae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ue(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function se(e,t,n){return t&&ue(e.prototype,t),n&&ue(e,n),e}function le(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function fe(e){return(fe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function pe(e,t,n){return(pe="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=fe(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}})(e,t,n||e)}var de=n(44);function me(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}}),t&&Object(de.a)(e,t)}var he=n(6),be=n.n(he);function ve(e,t){return!t||"object"!==be()(t)&&"function"!=typeof t?le(e):t}var ge=n(4);function ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Oe(e,t){if(e){if("string"==typeof e)return ye(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ye(e,t):void 0}}function we(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],_n=!0,c=!1;try{for(n=n.call(e);!(_n=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);_n=!0);}catch(e){c=!0,o=e}finally{try{_n||null==n.return||n.return()}finally{if(c)throw o}}return
/* translators: %1$s is the type of the variable passed to the filter function, %2$s is the type of the value returned by the filter function. */
Object(U.__)("The type returned by checkout filters must be the same as the type they receive. The function received %1$s but returned %2$s.",'woocommerce'),be()(r),be()(t)));r=s(t)?t:r}catch(e){if(W.CURRENT_USER_IS_ADMIN)throw e;console.error(e)}})),r}),[t,n,i,a,s])},pt=(n(156),function(e){var t=e.children,n=e.slotWrapper,o=void 0!==n&&n;return p.Children.count(t)?Object(r.createElement)("div",{className:"wc-block-components-totals-wrapper".concat(o?" slot-wrapper":"")},t):null});!function(e){e.CHECKOUT="woocommerce/checkout",e.CHECKOUT_FIELDS="woocommerce/checkout-fields-block",e.CHECKOUT_TOTALS="woocommerce/checkout-totals-block",e.CONTACT_INFORMATION="woocommerce/checkout-contact-information-block",e.SHIPPING_ADDRESS="woocommerce/checkout-shipping-address-block",e.BILLING_ADDRESS="woocommerce/checkout-billing-address-block",e.SHIPPING_METHODS="woocommerce/checkout-shipping-methods-block",e.PAYMENT_METHODS="woocommerce/checkout-payment-methods-block",e.CART="woocommerce/cart-i2",e.EMPTY_CART="woocommerce/empty-cart-block",e.FILLED_CART="woocommerce/filled-cart-block",e.CART_ITEMS="woocommerce/cart-items-block",e.CART_TOTALS="woocommerce/cart-totals-block"}(ut||(ut={}));var dt={},mt=function(e){return Object.values(ut).includes(e)},ht=function(e){return mt(e)?Object.values(dt).filter((function(t){var n=t.metadata;return((null==n?void 0:n.parent)||[]).includes(e)})):[]},bt=n(48),vt=function(e){return!function(e){return null===e}(e)&&e instanceof Object&&e.constructor===Object},gt=function(e){var t,n,r,o;!function(e,t,n){if(vt(e)){var r=be()(e.metadata);if("object"!==r)throw new Error("Incorrect value for the ".concat("metadata"," argument when registering a block component. It was a ").concat(r,", but must be a ").concat("object","."))}}(e),function(e){if(function(e,t,n){var r=be()(t);if("string"!==r)throw new Error("Incorrect value for the ".concat("blockName"," argument when registering a checkout block. It was a ").concat(r,", but must be a ").concat("string","."))}(0,e),!e)throw new Error("Value for the blockName argument must not be empty.")}(e.metadata.name),function(e){if("string"!=typeof e&&!Array.isArray(e))throw new Error("Incorrect value for the parent argument when registering a checkout block. It was a ".concat(be()(e),", but must be a string or array of strings."));if("string"==typeof e&&!mt(e))throw new Error("When registering a checkout block, the parent must be a valid inner block area.");if(Array.isArray(e)&&!e.some((function(e){return mt(e)})))throw new Error("When registering a checkout block, the parent must be a valid inner block area.")}(e.metadata.parent),function(e,t){var n=e.component;if(n){if("function"==typeof n)return;if(vt(n)&&n.$$typeof&&n.$$typeof===Symbol.for("react.lazy"))return}throw new Error("Incorrect value for the ".concat("component"," argument when registering a block component. Component must be a valid React Element or Lazy callback."))}(e),Object(bt.registerBlockComponent)({blockName:e.metadata.name,component:e.component}),dt[e.metadata.name]={blockName:e.metadata.name,metadata:e.metadata,component:e.component,force:!(null===(t=e.metadata)||void 0===t||null===(n=t.attributes)||void 0===n||null===(r=n.lock)||void 0===r||null===(o=r.default)||void 0===o||!o.remove)}},yt=it("__experimentalOrderMeta"),Ot=yt.Fill,wt=yt.Slot;Ot.Slot=function(e){var t=e.className,n=e.extensions,o=e.cart,c=nt("__experimentalOrderMeta").fills;return ot(c)&&Object(r.createElement)(pt,{slotWrapper:!0},Object(r.createElement)(wt,{className:i()(t,"wc-block-components-order-meta"),fillProps:{extensions:n,cart:o}}))};var jt=Ot,St=it("__experimentalDiscountsMeta"),xt=St.Fill,Et=St.Slot;xt.Slot=function(e){var t=e.className,n=e.extensions,o=e.cart,c=nt("__experimentalDiscountsMeta").fills;return ot(c)&&Object(r.createElement)(pt,{slotWrapper:!0},Object(r.createElement)(Et,{className:i()(t,"wc-block-components-discounts-meta"),fillProps:{extensions:n,cart:o}}))};var kt=xt,Pt=it("__experimentalOrderShippingPackages"),_t=Pt.Fill,Ft=Pt.Slot;_t.Slot=function(e){var t=e.className,n=e.collapsible,o=e.noResultsMessag