@zonos/elements 1.3.129 → 1.3.130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{CheckoutConfig-62479cef.js → CheckoutConfig-1d38a21d.js} +2 -0
- package/dist/cjs/{cart-ba8cca00.js → cart-d5240ba9.js} +192 -5
- package/dist/cjs/{getBorderRadius-61ed5601.js → getBorderRadius-f72d8edf.js} +1 -1
- package/dist/cjs/index.cjs.js +8 -8
- package/dist/cjs/{isDarkColor-d206c6fa.js → isDarkColor-dd6d723b.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{paypal-441c3f79.js → paypal-78db30b7.js} +3 -3
- package/dist/cjs/zonos-address_7.cjs.entry.js +4 -4
- package/dist/cjs/zonos-badge.cjs.entry.js +1 -1
- package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
- package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
- package/dist/cjs/zonos-card.cjs.entry.js +2 -2
- package/dist/cjs/zonos-cart-items_13.cjs.entry.js +5 -5
- package/dist/cjs/zonos-checkout.cjs.entry.js +82 -7
- package/dist/cjs/zonos-collapse.cjs.entry.js +1 -1
- package/dist/cjs/zonos-controller.cjs.entry.js +4 -4
- package/dist/cjs/zonos-country-flag.cjs.entry.js +4 -4
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +4 -4
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +4 -4
- package/dist/cjs/zonos-hello.cjs.entry.js +4 -4
- package/dist/cjs/zonos-input.cjs.entry.js +2 -2
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +4 -4
- package/dist/cjs/zonos-logo.cjs.entry.js +1 -1
- package/dist/cjs/zonos-notification_3.cjs.entry.js +5 -5
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +2 -2
- package/dist/cjs/zonos-text.cjs.entry.js +1 -1
- package/dist/cjs/zonos-toggle.cjs.entry.js +1 -1
- package/dist/cjs/zonos-v-stack.cjs.entry.js +1 -1
- package/dist/cjs/{zonosStore-e12d459c.js → zonosStore-293bb3ba.js} +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +77 -1
- package/dist/collection/components/store/translationStore/strings.arabic.js +9 -0
- package/dist/collection/components/store/translationStore/strings.base.js +9 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +9 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +9 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +9 -0
- package/dist/collection/components/store/translationStore/strings.french.js +9 -0
- package/dist/collection/components/store/translationStore/strings.german.js +9 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js +9 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js +9 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +9 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +9 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +9 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +9 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +9 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +9 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +9 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js +9 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +9 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +9 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +9 -0
- package/dist/collection/components/store/zonosStore.js +1 -0
- package/dist/collection/components/utils/api/prepCalculateLandedCost.js +9 -2
- package/dist/collection/scripts/cart/_setupCartData.js +2 -0
- package/dist/esm/{CheckoutConfig-5da839fa.js → CheckoutConfig-56c63bdf.js} +2 -0
- package/dist/esm/{cart-01b5bf4a.js → cart-4f1ee6dd.js} +192 -5
- package/dist/esm/{getBorderRadius-008516a4.js → getBorderRadius-bdd709e7.js} +1 -1
- package/dist/esm/index.js +9 -9
- package/dist/esm/{isDarkColor-dc08fa26.js → isDarkColor-c6924924.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{paypal-4c094b25.js → paypal-5b1964b6.js} +3 -3
- package/dist/esm/zonos-address_7.entry.js +4 -4
- package/dist/esm/zonos-badge.entry.js +1 -1
- package/dist/esm/zonos-banner.entry.js +1 -1
- package/dist/esm/zonos-button_3.entry.js +3 -3
- package/dist/esm/zonos-card.entry.js +2 -2
- package/dist/esm/zonos-cart-items_13.entry.js +5 -5
- package/dist/esm/zonos-checkout.entry.js +83 -8
- package/dist/esm/zonos-collapse.entry.js +1 -1
- package/dist/esm/zonos-controller.entry.js +4 -4
- package/dist/esm/zonos-country-flag.entry.js +4 -4
- package/dist/esm/zonos-country-select_4.entry.js +4 -4
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +4 -4
- package/dist/esm/zonos-hello.entry.js +4 -4
- package/dist/esm/zonos-input.entry.js +2 -2
- package/dist/esm/zonos-language-select_2.entry.js +4 -4
- package/dist/esm/zonos-logo.entry.js +1 -1
- package/dist/esm/zonos-notification_3.entry.js +5 -5
- package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
- package/dist/esm/zonos-text.entry.js +1 -1
- package/dist/esm/zonos-toggle.entry.js +1 -1
- package/dist/esm/zonos-v-stack.entry.js +1 -1
- package/dist/esm/{zonosStore-6b5bd87c.js → zonosStore-c493c4fe.js} +1 -0
- package/dist/esm-es5/{CheckoutConfig-5da839fa.js → CheckoutConfig-56c63bdf.js} +1 -1
- package/dist/esm-es5/cart-4f1ee6dd.js +1 -0
- package/dist/esm-es5/{getBorderRadius-008516a4.js → getBorderRadius-bdd709e7.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{isDarkColor-dc08fa26.js → isDarkColor-c6924924.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{paypal-4c094b25.js → paypal-5b1964b6.js} +1 -1
- package/dist/esm-es5/zonos-address_7.entry.js +1 -1
- package/dist/esm-es5/zonos-badge.entry.js +1 -1
- package/dist/esm-es5/zonos-banner.entry.js +1 -1
- package/dist/esm-es5/zonos-button_3.entry.js +1 -1
- package/dist/esm-es5/zonos-card.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-collapse.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-input.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-logo.entry.js +1 -1
- package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
- package/dist/esm-es5/zonos-text.entry.js +1 -1
- package/dist/esm-es5/zonos-toggle.entry.js +1 -1
- package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
- package/dist/esm-es5/{zonosStore-6b5bd87c.js → zonosStore-c493c4fe.js} +1 -1
- package/dist/scripts/index.d.ts +7 -0
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +9 -0
- package/dist/types/components/store/translationStore.d.ts +1 -1
- package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
- package/dist/types/types/checkout/CheckoutConfig.d.ts +5 -0
- package/dist/types/types/checkout/api/CalculateLandedCost.d.ts +1 -0
- package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +1 -0
- package/dist/types/types/generated/graphql.frontend.types.d.ts +1 -1
- package/dist/types/types/generated/graphql.frontend.types.ts +1 -1
- package/dist/types/types/generated/graphql.internal.types.d.ts +1 -0
- package/dist/types/types/generated/graphql.internal.types.ts +1 -0
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-2faa3104.system.entry.js → p-0531689a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1e4d8228.entry.js → p-0cf44851.entry.js} +1 -1
- package/dist/zonos-elements/{p-57d93236.entry.js → p-0cfab69e.entry.js} +1 -1
- package/dist/zonos-elements/{p-5ac777a7.system.entry.js → p-0fc96872.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-700c5732.entry.js → p-10cebad7.entry.js} +1 -1
- package/dist/zonos-elements/{p-e1ce04b1.js → p-10d6fe23.js} +1 -1
- package/dist/zonos-elements/{p-00dc1507.system.js → p-10efff62.system.js} +1 -1
- package/dist/zonos-elements/{p-55a3db7d.entry.js → p-124a4a50.entry.js} +1 -1
- package/dist/zonos-elements/{p-c93c9524.system.js → p-14022fab.system.js} +2 -2
- package/dist/zonos-elements/{p-7312d038.system.entry.js → p-19944a13.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-9d057d1d.entry.js → p-1a6e9eec.entry.js} +1 -1
- package/dist/zonos-elements/{p-8ca3b73a.entry.js → p-1da0c1cb.entry.js} +1 -1
- package/dist/zonos-elements/{p-ff0a79e6.system.entry.js → p-22458c90.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-60b0025b.system.js → p-2b29a3ac.system.js} +1 -1
- package/dist/zonos-elements/{p-ce391c90.entry.js → p-30d6e78c.entry.js} +1 -1
- package/dist/zonos-elements/{p-4fee6e7f.system.entry.js → p-320e7cb9.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-0bc813a9.system.entry.js → p-3a89fb48.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4cd1e79c.system.entry.js → p-3cfa90d1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2bb86f3d.system.entry.js → p-3e4b11ed.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-6c047faf.system.entry.js → p-3efbcf88.system.entry.js} +1 -1
- package/dist/zonos-elements/p-3f40806c.entry.js +1 -0
- package/dist/zonos-elements/{p-5e22a288.system.js → p-40596087.system.js} +1 -1
- package/dist/zonos-elements/{p-c3e98be6.system.js → p-46a5ec52.system.js} +1 -1
- package/dist/zonos-elements/p-49fff22c.js +1 -0
- package/dist/zonos-elements/{p-970527fe.entry.js → p-5b90dd6d.entry.js} +1 -1
- package/dist/zonos-elements/{p-0f465aa6.entry.js → p-5cd970b9.entry.js} +1 -1
- package/dist/zonos-elements/{p-3b5f49f6.system.entry.js → p-68cfdd01.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2906956b.entry.js → p-6b00344a.entry.js} +1 -1
- package/dist/zonos-elements/p-6b6cd6c3.system.js +1 -0
- package/dist/zonos-elements/{p-17a5550a.system.entry.js → p-72c682ac.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-10aef679.system.entry.js → p-7af3b735.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-a9069f68.js → p-7d3a63c5.js} +2 -2
- package/dist/zonos-elements/{p-91e111c4.entry.js → p-7fa88e0a.entry.js} +1 -1
- package/dist/zonos-elements/{p-8390f23d.system.entry.js → p-876ded0e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-5ee9685e.system.entry.js → p-87945d75.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-6de5611e.entry.js → p-92fbf9e6.entry.js} +1 -1
- package/dist/zonos-elements/p-942a0605.js +1 -0
- package/dist/zonos-elements/{p-08948e65.system.entry.js → p-9cb6599d.system.entry.js} +1 -1
- package/dist/zonos-elements/p-a1c26abb.system.entry.js +1 -0
- package/dist/zonos-elements/{p-8612f8d1.system.entry.js → p-a277cde0.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-26172f0d.entry.js → p-a49ac35e.entry.js} +1 -1
- package/dist/zonos-elements/p-a50ebda1.entry.js +1 -0
- package/dist/zonos-elements/{p-c562de4a.entry.js → p-bc8b22ad.entry.js} +1 -1
- package/dist/zonos-elements/{p-8b3d9796.system.entry.js → p-c39dc3e9.system.entry.js} +1 -1
- package/dist/zonos-elements/p-c78dd680.system.js +1 -1
- package/dist/zonos-elements/{p-67a32cc5.js → p-d10ffd69.js} +1 -1
- package/dist/zonos-elements/{p-0c6a933c.entry.js → p-d963d9d4.entry.js} +1 -1
- package/dist/zonos-elements/{p-5610934b.entry.js → p-db5e0d2b.entry.js} +1 -1
- package/dist/zonos-elements/{p-7c7feadb.system.entry.js → p-dc09df19.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d6f8309b.entry.js → p-dc823080.entry.js} +1 -1
- package/dist/zonos-elements/{p-e6fad32a.system.entry.js → p-e205ef1c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-6b0a8709.system.entry.js → p-e5f27005.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-91cfbf46.js → p-edc16f69.js} +1 -1
- package/dist/zonos-elements/{p-798d715c.entry.js → p-fb6cf324.entry.js} +1 -1
- package/dist/zonos-elements/{p-a372a9a0.entry.js → p-fce202ab.entry.js} +1 -1
- package/dist/zonos-elements/p-fd05d150.system.js +1 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-01b5bf4a.js +0 -1
- package/dist/zonos-elements/p-0e8613be.entry.js +0 -1
- package/dist/zonos-elements/p-4d4ea5dc.system.entry.js +0 -1
- package/dist/zonos-elements/p-582cdd52.system.js +0 -1
- package/dist/zonos-elements/p-94146bc9.js +0 -1
- package/dist/zonos-elements/p-9b0cbd91.entry.js +0 -1
- package/dist/zonos-elements/p-b7cfbfc1.js +0 -1
- package/dist/zonos-elements/p-c85b4e43.system.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var __spreadArray=this&&this.__spreadArray||function(e,r,t){if(t||arguments.length===2)for(var a=0,n=r.length,i;a<n;a++){if(i||!(a in r)){if(!i)i=Array.prototype.slice.call(r,0,a);i[a]=r[a]}}return e.concat(i||Array.prototype.slice.call(r))};import{g as getRenderingRef,f as forceUpdate}from"./index-86b8247e.js";var appendToMap=function(e,r,t){var a=e.get(r);if(!a){e.set(r,[t])}else if(!a.includes(t)){a.push(t)}};var debounce=function(e,r){var t;return function(){var a=[];for(var n=0;n<arguments.length;n++){a[n]=arguments[n]}if(t){clearTimeout(t)}t=setTimeout((function(){t=0;e.apply(void 0,a)}),r)}};var isConnected=function(e){return!("isConnected"in e)||e.isConnected};var cleanupElements=debounce((function(e){for(var r=0,t=e.keys();r<t.length;r++){var a=t[r];e.set(a,e.get(a).filter(isConnected))}}),2e3);var stencilSubscription=function(){if(typeof getRenderingRef!=="function"){return{}}var e=new Map;return{dispose:function(){return e.clear()},get:function(r){var t=getRenderingRef();if(t){appendToMap(e,r,t)}},set:function(r){var t=e.get(r);if(t){e.set(r,t.filter(forceUpdate))}cleanupElements(e)},reset:function(){e.forEach((function(e){return e.forEach(forceUpdate)}));cleanupElements(e)}}};var unwrap=function(e){return typeof e==="function"?e():e};var createObservableMap=function(e,r){if(r===void 0){r=function(e,r){return e!==r}}var t=unwrap(e);var a=new Map(Object.entries(t!==null&&t!==void 0?t:{}));var n={dispose:[],get:[],set:[],reset:[]};var i=function(){var r;a=new Map(Object.entries((r=unwrap(e))!==null&&r!==void 0?r:{}));n.reset.forEach((function(e){return e()}))};var s=function(){n.dispose.forEach((function(e){return e()}));i()};var o=function(e){n.get.forEach((function(r){return r(e)}));return a.get(e)};var c=function(e,t){var i=a.get(e);if(r(t,i,e)){a.set(e,t);n.set.forEach((function(r){return r(e,t,i)}))}};var u=typeof Proxy==="undefined"?{}:new Proxy(t,{get:function(e,r){return o(r)},ownKeys:function(e){return Array.from(a.keys())},getOwnPropertyDescriptor:function(){return{enumerable:true,configurable:true}},has:function(e,r){return a.has(r)},set:function(e,r,t){c(r,t);return true}});var v=function(e,r){n[e].push(r);return function(){removeFromArray(n[e],r)}};var l=function(r,t){var a=v("set",(function(e,a){if(e===r){t(a)}}));var n=v("reset",(function(){return t(unwrap(e)[r])}));return function(){a();n()}};var f=function(){var e=[];for(var r=0;r<arguments.length;r++){e[r]=arguments[r]}var t=e.reduce((function(e,r){if(r.set){e.push(v("set",r.set))}if(r.get){e.push(v("get",r.get))}if(r.reset){e.push(v("reset",r.reset))}if(r.dispose){e.push(v("dispose",r.dispose))}return e}),[]);return function(){return t.forEach((function(e){return e()}))}};var $=function(e){var r=a.get(e);n.set.forEach((function(t){return t(e,r,r)}))};return{state:u,get:o,set:c,on:v,onChange:l,use:f,dispose:s,reset:i,forceUpdate:$}};var removeFromArray=function(e,r){var t=e.indexOf(r);if(t>=0){e[t]=e[e.length-1];e.length--}};var createStore=function(e,r){var t=createObservableMap(e,r);t.use(stencilSubscription());return t};var commonjsGlobal=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function listCacheClear$1(){this.__data__=[];this.size=0}var _listCacheClear=listCacheClear$1;function eq$4(e,r){return e===r||e!==e&&r!==r}var eq_1=eq$4;var eq$3=eq_1;function assocIndexOf$4(e,r){var t=e.length;while(t--){if(eq$3(e[t][0],r)){return t}}return-1}var _assocIndexOf=assocIndexOf$4;var assocIndexOf$3=_assocIndexOf;var arrayProto=Array.prototype;var splice=arrayProto.splice;function listCacheDelete$1(e){var r=this.__data__,t=assocIndexOf$3(r,e);if(t<0){return false}var a=r.length-1;if(t==a){r.pop()}else{splice.call(r,t,1)}--this.size;return true}var _listCacheDelete=listCacheDelete$1;var assocIndexOf$2=_assocIndexOf;function listCacheGet$1(e){var r=this.__data__,t=assocIndexOf$2(r,e);return t<0?undefined:r[t][1]}var _listCacheGet=listCacheGet$1;var assocIndexOf$1=_assocIndexOf;function listCacheHas$1(e){return assocIndexOf$1(this.__data__,e)>-1}var _listCacheHas=listCacheHas$1;var assocIndexOf=_assocIndexOf;function listCacheSet$1(e,r){var t=this.__data__,a=assocIndexOf(t,e);if(a<0){++this.size;t.push([e,r])}else{t[a][1]=r}return this}var _listCacheSet=listCacheSet$1;var listCacheClear=_listCacheClear,listCacheDelete=_listCacheDelete,listCacheGet=_listCacheGet,listCacheHas=_listCacheHas,listCacheSet=_listCacheSet;function ListCache$4(e){var r=-1,t=e==null?0:e.length;this.clear();while(++r<t){var a=e[r];this.set(a[0],a[1])}}ListCache$4.prototype.clear=listCacheClear;ListCache$4.prototype["delete"]=listCacheDelete;ListCache$4.prototype.get=listCacheGet;ListCache$4.prototype.has=listCacheHas;ListCache$4.prototype.set=listCacheSet;var _ListCache=ListCache$4;var ListCache$3=_ListCache;function stackClear$1(){this.__data__=new ListCache$3;this.size=0}var _stackClear=stackClear$1;function stackDelete$1(e){var r=this.__data__,t=r["delete"](e);this.size=r.size;return t}var _stackDelete=stackDelete$1;function stackGet$1(e){return this.__data__.get(e)}var _stackGet=stackGet$1;function stackHas$1(e){return this.__data__.has(e)}var _stackHas=stackHas$1;var freeGlobal$1=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal;var _freeGlobal=freeGlobal$1;var freeGlobal=_freeGlobal;var freeSelf=typeof self=="object"&&self&&self.Object===Object&&self;var root$4=freeGlobal||freeSelf||Function("return this")();var _root=root$4;var root$3=_root;var Symbol$2=root$3.Symbol;var _Symbol=Symbol$2;var Symbol$1=_Symbol;var objectProto$a=Object.prototype;var hasOwnProperty$8=objectProto$a.hasOwnProperty;var nativeObjectToString$1=objectProto$a.toString;var symToStringTag$1=Symbol$1?Symbol$1.toStringTag:undefined;function getRawTag$1(e){var r=hasOwnProperty$8.call(e,symToStringTag$1),t=e[symToStringTag$1];try{e[symToStringTag$1]=undefined;var a=true}catch(e){}var n=nativeObjectToString$1.call(e);if(a){if(r){e[symToStringTag$1]=t}else{delete e[symToStringTag$1]}}return n}var _getRawTag=getRawTag$1;var objectProto$9=Object.prototype;var nativeObjectToString=objectProto$9.toString;function objectToString$1(e){return nativeObjectToString.call(e)}var _objectToString=objectToString$1;var Symbol=_Symbol,getRawTag=_getRawTag,objectToString=_objectToString;var nullTag="[object Null]",undefinedTag="[object Undefined]";var symToStringTag=Symbol?Symbol.toStringTag:undefined;function baseGetTag$4(e){if(e==null){return e===undefined?undefinedTag:nullTag}return symToStringTag&&symToStringTag in Object(e)?getRawTag(e):objectToString(e)}var _baseGetTag=baseGetTag$4;function isObject$7(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}var isObject_1=isObject$7;var baseGetTag$3=_baseGetTag,isObject$6=isObject_1;var asyncTag="[object AsyncFunction]",funcTag$1="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$3(e){if(!isObject$6(e)){return false}var r=baseGetTag$3(e);return r==funcTag$1||r==genTag||r==asyncTag||r==proxyTag}var isFunction_1=isFunction$3;var root$2=_root;var coreJsData$1=root$2["__core-js_shared__"];var _coreJsData=coreJsData$1;var coreJsData=_coreJsData;var maskSrcKey=function(){var e=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked$1(e){return!!maskSrcKey&&maskSrcKey in e}var _isMasked=isMasked$1;var funcProto$2=Function.prototype;var funcToString$2=funcProto$2.toString;function toSource$1(e){if(e!=null){try{return funcToString$2.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var _toSource=toSource$1;var isFunction$2=isFunction_1,isMasked=_isMasked,isObject$5=isObject_1,toSource=_toSource;var reRegExpChar=/[\\^$.*+?()[\]{}|]/g;var reIsHostCtor=/^\[object .+?Constructor\]$/;var funcProto$1=Function.prototype,objectProto$8=Object.prototype;var funcToString$1=funcProto$1.toString;var hasOwnProperty$7=objectProto$8.hasOwnProperty;var reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$7).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative$1(e){if(!isObject$5(e)||isMasked(e)){return false}var r=isFunction$2(e)?reIsNative:reIsHostCtor;return r.test(toSource(e))}var _baseIsNative=baseIsNative$1;function getValue$1(e,r){return e==null?undefined:e[r]}var _getValue=getValue$1;var baseIsNative=_baseIsNative,getValue=_getValue;function getNative$3(e,r){var t=getValue(e,r);return baseIsNative(t)?t:undefined}var _getNative=getNative$3;var getNative$2=_getNative,root$1=_root;var Map$3=getNative$2(root$1,"Map");var _Map=Map$3;var getNative$1=_getNative;var nativeCreate$4=getNative$1(Object,"create");var _nativeCreate=nativeCreate$4;var nativeCreate$3=_nativeCreate;function hashClear$1(){this.__data__=nativeCreate$3?nativeCreate$3(null):{};this.size=0}var _hashClear=hashClear$1;function hashDelete$1(e){var r=this.has(e)&&delete this.__data__[e];this.size-=r?1:0;return r}var _hashDelete=hashDelete$1;var nativeCreate$2=_nativeCreate;var HASH_UNDEFINED$1="__lodash_hash_undefined__";var objectProto$7=Object.prototype;var hasOwnProperty$6=objectProto$7.hasOwnProperty;function hashGet$1(e){var r=this.__data__;if(nativeCreate$2){var t=r[e];return t===HASH_UNDEFINED$1?undefined:t}return hasOwnProperty$6.call(r,e)?r[e]:undefined}var _hashGet=hashGet$1;var nativeCreate$1=_nativeCreate;var objectProto$6=Object.prototype;var hasOwnProperty$5=objectProto$6.hasOwnProperty;function hashHas$1(e){var r=this.__data__;return nativeCreate$1?r[e]!==undefined:hasOwnProperty$5.call(r,e)}var _hashHas=hashHas$1;var nativeCreate=_nativeCreate;var HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet$1(e,r){var t=this.__data__;this.size+=this.has(e)?0:1;t[e]=nativeCreate&&r===undefined?HASH_UNDEFINED:r;return this}var _hashSet=hashSet$1;var hashClear=_hashClear,hashDelete=_hashDelete,hashGet=_hashGet,hashHas=_hashHas,hashSet=_hashSet;function Hash$1(e){var r=-1,t=e==null?0:e.length;this.clear();while(++r<t){var a=e[r];this.set(a[0],a[1])}}Hash$1.prototype.clear=hashClear;Hash$1.prototype["delete"]=hashDelete;Hash$1.prototype.get=hashGet;Hash$1.prototype.has=hashHas;Hash$1.prototype.set=hashSet;var _Hash=Hash$1;var Hash=_Hash,ListCache$2=_ListCache,Map$2=_Map;function mapCacheClear$1(){this.size=0;this.__data__={hash:new Hash,map:new(Map$2||ListCache$2),string:new Hash}}var _mapCacheClear=mapCacheClear$1;function isKeyable$1(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}var _isKeyable=isKeyable$1;var isKeyable=_isKeyable;function getMapData$4(e,r){var t=e.__data__;return isKeyable(r)?t[typeof r=="string"?"string":"hash"]:t.map}var _getMapData=getMapData$4;var getMapData$3=_getMapData;function mapCacheDelete$1(e){var r=getMapData$3(this,e)["delete"](e);this.size-=r?1:0;return r}var _mapCacheDelete=mapCacheDelete$1;var getMapData$2=_getMapData;function mapCacheGet$1(e){return getMapData$2(this,e).get(e)}var _mapCacheGet=mapCacheGet$1;var getMapData$1=_getMapData;function mapCacheHas$1(e){return getMapData$1(this,e).has(e)}var _mapCacheHas=mapCacheHas$1;var getMapData=_getMapData;function mapCacheSet$1(e,r){var t=getMapData(this,e),a=t.size;t.set(e,r);this.size+=t.size==a?0:1;return this}var _mapCacheSet=mapCacheSet$1;var mapCacheClear=_mapCacheClear,mapCacheDelete=_mapCacheDelete,mapCacheGet=_mapCacheGet,mapCacheHas=_mapCacheHas,mapCacheSet=_mapCacheSet;function MapCache$1(e){var r=-1,t=e==null?0:e.length;this.clear();while(++r<t){var a=e[r];this.set(a[0],a[1])}}MapCache$1.prototype.clear=mapCacheClear;MapCache$1.prototype["delete"]=mapCacheDelete;MapCache$1.prototype.get=mapCacheGet;MapCache$1.prototype.has=mapCacheHas;MapCache$1.prototype.set=mapCacheSet;var _MapCache=MapCache$1;var ListCache$1=_ListCache,Map$1=_Map,MapCache=_MapCache;var LARGE_ARRAY_SIZE=200;function stackSet$1(e,r){var t=this.__data__;if(t instanceof ListCache$1){var a=t.__data__;if(!Map$1||a.length<LARGE_ARRAY_SIZE-1){a.push([e,r]);this.size=++t.size;return this}t=this.__data__=new MapCache(a)}t.set(e,r);this.size=t.size;return this}var _stackSet=stackSet$1;var ListCache=_ListCache,stackClear=_stackClear,stackDelete=_stackDelete,stackGet=_stackGet,stackHas=_stackHas,stackSet=_stackSet;function Stack$1(e){var r=this.__data__=new ListCache(e);this.size=r.size}Stack$1.prototype.clear=stackClear;Stack$1.prototype["delete"]=stackDelete;Stack$1.prototype.get=stackGet;Stack$1.prototype.has=stackHas;Stack$1.prototype.set=stackSet;var _Stack=Stack$1;var getNative=_getNative;var defineProperty$2=function(){try{var e=getNative(Object,"defineProperty");e({},"",{});return e}catch(e){}}();var _defineProperty=defineProperty$2;var defineProperty$1=_defineProperty;function baseAssignValue$3(e,r,t){if(r=="__proto__"&&defineProperty$1){defineProperty$1(e,r,{configurable:true,enumerable:true,value:t,writable:true})}else{e[r]=t}}var _baseAssignValue=baseAssignValue$3;var baseAssignValue$2=_baseAssignValue,eq$2=eq_1;function assignMergeValue$2(e,r,t){if(t!==undefined&&!eq$2(e[r],t)||t===undefined&&!(r in e)){baseAssignValue$2(e,r,t)}}var _assignMergeValue=assignMergeValue$2;function createBaseFor$1(e){return function(r,t,a){var n=-1,i=Object(r),s=a(r),o=s.length;while(o--){var c=s[e?o:++n];if(t(i[c],c,i)===false){break}}return r}}var _createBaseFor=createBaseFor$1;var createBaseFor=_createBaseFor;var baseFor$1=createBaseFor();var _baseFor=baseFor$1;var _cloneBuffer={exports:{}};(function(e,r){var t=_root;var a=r&&!r.nodeType&&r;var n=a&&"object"=="object"&&e&&!e.nodeType&&e;var i=n&&n.exports===a;var s=i?t.Buffer:undefined,o=s?s.allocUnsafe:undefined;function c(e,r){if(r){return e.slice()}var t=e.length,a=o?o(t):new e.constructor(t);e.copy(a);return a}e.exports=c})(_cloneBuffer,_cloneBuffer.exports);var root=_root;var Uint8Array$1=root.Uint8Array;var _Uint8Array=Uint8Array$1;var Uint8Array=_Uint8Array;function cloneArrayBuffer$1(e){var r=new e.constructor(e.byteLength);new Uint8Array(r).set(new Uint8Array(e));return r}var _cloneArrayBuffer=cloneArrayBuffer$1;var cloneArrayBuffer=_cloneArrayBuffer;function cloneTypedArray$1(e,r){var t=r?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)}var _cloneTypedArray=cloneTypedArray$1;function copyArray$1(e,r){var t=-1,a=e.length;r||(r=Array(a));while(++t<a){r[t]=e[t]}return r}var _copyArray=copyArray$1;var isObject$4=isObject_1;var objectCreate=Object.create;var baseCreate$1=function(){function e(){}return function(r){if(!isObject$4(r)){return{}}if(objectCreate){return objectCreate(r)}e.prototype=r;var t=new e;e.prototype=undefined;return t}}();var _baseCreate=baseCreate$1;function overArg$1(e,r){return function(t){return e(r(t))}}var _overArg=overArg$1;var overArg=_overArg;var getPrototype$2=overArg(Object.getPrototypeOf,Object);var _getPrototype=getPrototype$2;var objectProto$5=Object.prototype;function isPrototype$2(e){var r=e&&e.constructor,t=typeof r=="function"&&r.prototype||objectProto$5;return e===t}var _isPrototype=isPrototype$2;var baseCreate=_baseCreate,getPrototype$1=_getPrototype,isPrototype$1=_isPrototype;function initCloneObject$1(e){return typeof e.constructor=="function"&&!isPrototype$1(e)?baseCreate(getPrototype$1(e)):{}}var _initCloneObject=initCloneObject$1;function isObjectLike$5(e){return e!=null&&typeof e=="object"}var isObjectLike_1=isObjectLike$5;var baseGetTag$2=_baseGetTag,isObjectLike$4=isObjectLike_1;var argsTag$1="[object Arguments]";function baseIsArguments$1(e){return isObjectLike$4(e)&&baseGetTag$2(e)==argsTag$1}var _baseIsArguments=baseIsArguments$1;var baseIsArguments=_baseIsArguments,isObjectLike$3=isObjectLike_1;var objectProto$4=Object.prototype;var hasOwnProperty$4=objectProto$4.hasOwnProperty;var propertyIsEnumerable=objectProto$4.propertyIsEnumerable;var isArguments$2=baseIsArguments(function(){return arguments}())?baseIsArguments:function(e){return isObjectLike$3(e)&&hasOwnProperty$4.call(e,"callee")&&!propertyIsEnumerable.call(e,"callee")};var isArguments_1=isArguments$2;var isArray$2=Array.isArray;var isArray_1=isArray$2;var MAX_SAFE_INTEGER$1=9007199254740991;function isLength$2(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=MAX_SAFE_INTEGER$1}var isLength_1=isLength$2;var isFunction$1=isFunction_1,isLength$1=isLength_1;function isArrayLike$3(e){return e!=null&&isLength$1(e.length)&&!isFunction$1(e)}var isArrayLike_1=isArrayLike$3;var isArrayLike$2=isArrayLike_1,isObjectLike$2=isObjectLike_1;function isArrayLikeObject$1(e){return isObjectLike$2(e)&&isArrayLike$2(e)}var isArrayLikeObject_1=isArrayLikeObject$1;var isBuffer$2={exports:{}};function stubFalse(){return false}var stubFalse_1=stubFalse;(function(e,r){var t=_root,a=stubFalse_1;var n=r&&!r.nodeType&&r;var i=n&&"object"=="object"&&e&&!e.nodeType&&e;var s=i&&i.exports===n;var o=s?t.Buffer:undefined;var c=o?o.isBuffer:undefined;var u=c||a;e.exports=u})(isBuffer$2,isBuffer$2.exports);var baseGetTag$1=_baseGetTag,getPrototype=_getPrototype,isObjectLike$1=isObjectLike_1;var objectTag$1="[object Object]";var funcProto=Function.prototype,objectProto$3=Object.prototype;var funcToString=funcProto.toString;var hasOwnProperty$3=objectProto$3.hasOwnProperty;var objectCtorString=funcToString.call(Object);function isPlainObject$1(e){if(!isObjectLike$1(e)||baseGetTag$1(e)!=objectTag$1){return false}var r=getPrototype(e);if(r===null){return true}var t=hasOwnProperty$3.call(r,"constructor")&&r.constructor;return typeof t=="function"&&t instanceof t&&funcToString.call(t)==objectCtorString}var isPlainObject_1=isPlainObject$1;var baseGetTag=_baseGetTag,isLength=isLength_1,isObjectLike=isObjectLike_1;var argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",mapTag="[object Map]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",weakMapTag="[object WeakMap]";var arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]";var typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=true;typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=false;function baseIsTypedArray$1(e){return isObjectLike(e)&&isLength(e.length)&&!!typedArrayTags[baseGetTag(e)]}var _baseIsTypedArray=baseIsTypedArray$1;function baseUnary$1(e){return function(r){return e(r)}}var _baseUnary=baseUnary$1;var _nodeUtil={exports:{}};(function(e,r){var t=_freeGlobal;var a=r&&!r.nodeType&&r;var n=a&&"object"=="object"&&e&&!e.nodeType&&e;var i=n&&n.exports===a;var s=i&&t.process;var o=function(){try{var e=n&&n.require&&n.require("util").types;if(e){return e}return s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=o})(_nodeUtil,_nodeUtil.exports);var baseIsTypedArray=_baseIsTypedArray,baseUnary=_baseUnary,nodeUtil=_nodeUtil.exports;var nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray;var isTypedArray$2=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray;var isTypedArray_1=isTypedArray$2;function safeGet$2(e,r){if(r==="constructor"&&typeof e[r]==="function"){return}if(r=="__proto__"){return}return e[r]}var _safeGet=safeGet$2;var baseAssignValue$1=_baseAssignValue,eq$1=eq_1;var objectProto$2=Object.prototype;var hasOwnProperty$2=objectProto$2.hasOwnProperty;function assignValue$1(e,r,t){var a=e[r];if(!(hasOwnProperty$2.call(e,r)&&eq$1(a,t))||t===undefined&&!(r in e)){baseAssignValue$1(e,r,t)}}var _assignValue=assignValue$1;var assignValue=_assignValue,baseAssignValue=_baseAssignValue;function copyObject$1(e,r,t,a){var n=!t;t||(t={});var i=-1,s=r.length;while(++i<s){var o=r[i];var c=a?a(t[o],e[o],o,t,e):undefined;if(c===undefined){c=e[o]}if(n){baseAssignValue(t,o,c)}else{assignValue(t,o,c)}}return t}var _copyObject=copyObject$1;function baseTimes$1(e,r){var t=-1,a=Array(e);while(++t<e){a[t]=r(t)}return a}var _baseTimes=baseTimes$1;var MAX_SAFE_INTEGER=9007199254740991;var reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex$2(e,r){var t=typeof e;r=r==null?MAX_SAFE_INTEGER:r;return!!r&&(t=="number"||t!="symbol"&&reIsUint.test(e))&&(e>-1&&e%1==0&&e<r)}var _isIndex=isIndex$2;var baseTimes=_baseTimes,isArguments$1=isArguments_1,isArray$1=isArray_1,isBuffer$1=isBuffer$2.exports,isIndex$1=_isIndex,isTypedArray$1=isTypedArray_1;var objectProto$1=Object.prototype;var hasOwnProperty$1=objectProto$1.hasOwnProperty;function arrayLikeKeys$1(e,r){var t=isArray$1(e),a=!t&&isArguments$1(e),n=!t&&!a&&isBuffer$1(e),i=!t&&!a&&!n&&isTypedArray$1(e),s=t||a||n||i,o=s?baseTimes(e.length,String):[],c=o.length;for(var u in e){if((r||hasOwnProperty$1.call(e,u))&&!(s&&(u=="length"||n&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||isIndex$1(u,c)))){o.push(u)}}return o}var _arrayLikeKeys=arrayLikeKeys$1;function nativeKeysIn$1(e){var r=[];if(e!=null){for(var t in Object(e)){r.push(t)}}return r}var _nativeKeysIn=nativeKeysIn$1;var isObject$3=isObject_1,isPrototype=_isPrototype,nativeKeysIn=_nativeKeysIn;var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;function baseKeysIn$1(e){if(!isObject$3(e)){return nativeKeysIn(e)}var r=isPrototype(e),t=[];for(var a in e){if(!(a=="constructor"&&(r||!hasOwnProperty.call(e,a)))){t.push(a)}}return t}var _baseKeysIn=baseKeysIn$1;var arrayLikeKeys=_arrayLikeKeys,baseKeysIn=_baseKeysIn,isArrayLike$1=isArrayLike_1;function keysIn$2(e){return isArrayLike$1(e)?arrayLikeKeys(e,true):baseKeysIn(e)}var keysIn_1=keysIn$2;var copyObject=_copyObject,keysIn$1=keysIn_1;function toPlainObject$1(e){return copyObject(e,keysIn$1(e))}var toPlainObject_1=toPlainObject$1;var assignMergeValue$1=_assignMergeValue,cloneBuffer=_cloneBuffer.exports,cloneTypedArray=_cloneTypedArray,copyArray=_copyArray,initCloneObject=_initCloneObject,isArguments=isArguments_1,isArray=isArray_1,isArrayLikeObject=isArrayLikeObject_1,isBuffer=isBuffer$2.exports,isFunction=isFunction_1,isObject$2=isObject_1,isPlainObject=isPlainObject_1,isTypedArray=isTypedArray_1,safeGet$1=_safeGet,toPlainObject=toPlainObject_1;function baseMergeDeep$1(e,r,t,a,n,i,s){var o=safeGet$1(e,t),c=safeGet$1(r,t),u=s.get(c);if(u){assignMergeValue$1(e,t,u);return}var v=i?i(o,c,t+"",e,r,s):undefined;var l=v===undefined;if(l){var f=isArray(c),$=!f&&isBuffer(c),g=!f&&!$&&isTypedArray(c);v=c;if(f||$||g){if(isArray(o)){v=o}else if(isArrayLikeObject(o)){v=copyArray(o)}else if($){l=false;v=cloneBuffer(c,true)}else if(g){l=false;v=cloneTypedArray(c,true)}else{v=[]}}else if(isPlainObject(c)||isArguments(c)){v=o;if(isArguments(o)){v=toPlainObject(o)}else if(!isObject$2(o)||isFunction(o)){v=initCloneObject(c)}}else{l=false}}if(l){s.set(c,v);n(v,c,a,i,s);s["delete"](c)}assignMergeValue$1(e,t,v)}var _baseMergeDeep=baseMergeDeep$1;var Stack=_Stack,assignMergeValue=_assignMergeValue,baseFor=_baseFor,baseMergeDeep=_baseMergeDeep,isObject$1=isObject_1,keysIn=keysIn_1,safeGet=_safeGet;function baseMerge$1(e,r,t,a,n){if(e===r){return}baseFor(r,(function(i,s){n||(n=new Stack);if(isObject$1(i)){baseMergeDeep(e,r,s,t,baseMerge$1,a,n)}else{var o=a?a(safeGet(e,s),i,s+"",e,r,n):undefined;if(o===undefined){o=i}assignMergeValue(e,s,o)}}),keysIn)}var _baseMerge=baseMerge$1;function identity$2(e){return e}var identity_1=identity$2;function apply$1(e,r,t){switch(t.length){case 0:return e.call(r);case 1:return e.call(r,t[0]);case 2:return e.call(r,t[0],t[1]);case 3:return e.call(r,t[0],t[1],t[2])}return e.apply(r,t)}var _apply=apply$1;var apply=_apply;var nativeMax=Math.max;function overRest$1(e,r,t){r=nativeMax(r===undefined?e.length-1:r,0);return function(){var a=arguments,n=-1,i=nativeMax(a.length-r,0),s=Array(i);while(++n<i){s[n]=a[r+n]}n=-1;var o=Array(r+1);while(++n<r){o[n]=a[n]}o[r]=t(s);return apply(e,this,o)}}var _overRest=overRest$1;function constant$1(e){return function(){return e}}var constant_1=constant$1;var constant=constant_1,defineProperty=_defineProperty,identity$1=identity_1;var baseSetToString$1=!defineProperty?identity$1:function(e,r){return defineProperty(e,"toString",{configurable:true,enumerable:false,value:constant(r),writable:true})};var _baseSetToString=baseSetToString$1;var HOT_COUNT=800,HOT_SPAN=16;var nativeNow=Date.now;function shortOut$1(e){var r=0,t=0;return function(){var a=nativeNow(),n=HOT_SPAN-(a-t);t=a;if(n>0){if(++r>=HOT_COUNT){return arguments[0]}}else{r=0}return e.apply(undefined,arguments)}}var _shortOut=shortOut$1;var baseSetToString=_baseSetToString,shortOut=_shortOut;var setToString$1=shortOut(baseSetToString);var _setToString=setToString$1;var identity=identity_1,overRest=_overRest,setToString=_setToString;function baseRest$1(e,r){return setToString(overRest(e,r,identity),e+"")}var _baseRest=baseRest$1;var eq=eq_1,isArrayLike=isArrayLike_1,isIndex=_isIndex,isObject=isObject_1;function isIterateeCall$1(e,r,t){if(!isObject(t)){return false}var a=typeof r;if(a=="number"?isArrayLike(t)&&isIndex(r,t.length):a=="string"&&r in t){return eq(t[r],e)}return false}var _isIterateeCall=isIterateeCall$1;var baseRest=_baseRest,isIterateeCall=_isIterateeCall;function createAssigner$1(e){return baseRest((function(r,t){var a=-1,n=t.length,i=n>1?t[n-1]:undefined,s=n>2?t[2]:undefined;i=e.length>3&&typeof i=="function"?(n--,i):undefined;if(s&&isIterateeCall(t[0],t[1],s)){i=n<3?undefined:i;n=1}r=Object(r);while(++a<n){var o=t[a];if(o){e(r,o,a,i)}}return r}))}var _createAssigner=createAssigner$1;var baseMerge=_baseMerge,createAssigner=_createAssigner;var merge=createAssigner((function(e,r,t){baseMerge(e,r,t)}));var merge_1=merge;var mergeConfig=function(e,r){var t=[];for(var a=2;a<arguments.length;a++){t[a-2]=arguments[a]}var n=__spreadArray([e,r],t,true).filter(Boolean);return merge_1.apply(null,n)};var _f=createStore((function(){return{appearance:{colorPrimary:"white",fontFamily:"Inter",logoUrl:"",style:"ROUNDED",theme:"LIGHT",zonosAttribution:"DISABLED"},checkoutSettings:{allowedCharacterSets:"ALL",analyticsProviders:[],externalPaymentMethods:[],externalServiceTokens:[],mode:"TEST",orderNotifications:{abandonedCart:{delay:0,discountPercent:0,status:{active:"DISABLED",sendCopiesTo:[]}},orderCancelled:{active:"DISABLED",sendCopiesTo:[]},orderConfirmation:{active:"DISABLED",sendCopiesTo:[]},orderShipped:{active:"DISABLED",sendCopiesTo:[]}},organization:"",placeOrderButtonSelector:null,subscriptionStatus:"INACTIVE",successBehavior:"REDIRECT_TO_SUCCESS_PAGE",successRedirectUrl:"",visibilityStatus:"ENABLED"},currentHelloPage:"",disabledCountries:[],helloSettings:{anchorElementSelector:"",cartUrlPattern:"",countryOverrideBehavior:"URL_PARAM",currencyBehavior:"ENABLED",currencyElementSelector:".money",desktopLocation:"BOTTOM_RIGHT",excludedUrlPatterns:[],homepageUrlPattern:"",mobileLocation:"BOTTOM_RIGHT",mode:"LIVE",notFoundElementFallback:null,organization:"",peekMessageBehavior:"ENABLED",peekMessageDelay:0,productAddToCartElementSelector:"",productDescriptionElementSelector:"",productDetailUrlPattern:"",productListUrlPattern:"",productTitleElementSelector:"",restrictionBehavior:"DISABLED",showForCountries:"ONLY_SHIPPABLE",visibilityStatus:"ENABLED"},loadedConfig:false,onlineStoreSettings:{allowedDomains:[],url:""},organizationId:"",organizationName:"",sourceCurrency:"USD",storeId:null,stripeApiKey:"",zonosApiKey:"",zonosMode:null}})),zonosStoreDispose=_f.dispose,reset=_f.reset,zonosStore=_f.state;var savedZonosSettings=null;var getZonosStoreTheme=function(e){if(e==="SYSTEM"){return window.matchMedia("(prefers-color-scheme: dark)").matches?"DARK":"LIGHT"}return e};var zonosStoreInitSetting=function(e){var r=e.overrideSettings,t=e.zonosSettings;var a,n,i,s,o;reset();if(t){savedZonosSettings=t}var c=mergeConfig(zonosStore.appearance,(savedZonosSettings===null||savedZonosSettings===void 0?void 0:savedZonosSettings.appearanceSettings)||(t===null||t===void 0?void 0:t.appearanceSettings)||null,r===null||r===void 0?void 0:r.appearance);if(c.theme==="SYSTEM"){c.theme=getZonosStoreTheme(c.theme)}zonosStore.onlineStoreSettings=mergeConfig(zonosStore.onlineStoreSettings,(t===null||t===void 0?void 0:t.onlineStoreSettings)||null);zonosStore.disabledCountries=((a=t===null||t===void 0?void 0:t.checkoutSettings)===null||a===void 0?void 0:a.disabledCountries)||[];zonosStore.appearance=c;zonosStore.checkoutSettings=mergeConfig(zonosStore.checkoutSettings,(savedZonosSettings===null||savedZonosSettings===void 0?void 0:savedZonosSettings.checkoutSettings)||(t===null||t===void 0?void 0:t.checkoutSettings)||null,r===null||r===void 0?void 0:r.checkoutSettings);zonosStore.helloSettings=mergeConfig(zonosStore.helloSettings,(savedZonosSettings===null||savedZonosSettings===void 0?void 0:savedZonosSettings.helloSettings)||(t===null||t===void 0?void 0:t.helloSettings)||null,r===null||r===void 0?void 0:r.helloSettings);zonosStore.loadedConfig=true;zonosStore.organizationId=((n=t===null||t===void 0?void 0:t.organization)===null||n===void 0?void 0:n.id)||"";zonosStore.organizationName=((i=t===null||t===void 0?void 0:t.organization)===null||i===void 0?void 0:i.name)||"";zonosStore.storeId=((o=(s=t===null||t===void 0?void 0:t.organization)===null||s===void 0?void 0:s.references)===null||o===void 0?void 0:o.storeId)||null;zonosStore.currencyConverter=r===null||r===void 0?void 0:r.currencyConverter;zonosStore.onCountryChange=r===null||r===void 0?void 0:r.onCountryChange;zonosStore.overrideCurrencyFormat=r===null||r===void 0?void 0:r.overrideCurrencyFormat};var zonosStoreFontFamily=function(){var e=zonosStore.appearance.fontFamily||"Inter";return e};export{_root as _,commonjsGlobal as a,zonosStoreInitSetting as b,createStore as c,zonosStoreFontFamily as d,_baseGetTag as e,isObject_1 as f,getZonosStoreTheme as g,isObjectLike_1 as i,mergeConfig as m,zonosStore as z};
|
|
1
|
+
var __spreadArray=this&&this.__spreadArray||function(e,r,t){if(t||arguments.length===2)for(var a=0,n=r.length,i;a<n;a++){if(i||!(a in r)){if(!i)i=Array.prototype.slice.call(r,0,a);i[a]=r[a]}}return e.concat(i||Array.prototype.slice.call(r))};import{g as getRenderingRef,f as forceUpdate}from"./index-86b8247e.js";var appendToMap=function(e,r,t){var a=e.get(r);if(!a){e.set(r,[t])}else if(!a.includes(t)){a.push(t)}};var debounce=function(e,r){var t;return function(){var a=[];for(var n=0;n<arguments.length;n++){a[n]=arguments[n]}if(t){clearTimeout(t)}t=setTimeout((function(){t=0;e.apply(void 0,a)}),r)}};var isConnected=function(e){return!("isConnected"in e)||e.isConnected};var cleanupElements=debounce((function(e){for(var r=0,t=e.keys();r<t.length;r++){var a=t[r];e.set(a,e.get(a).filter(isConnected))}}),2e3);var stencilSubscription=function(){if(typeof getRenderingRef!=="function"){return{}}var e=new Map;return{dispose:function(){return e.clear()},get:function(r){var t=getRenderingRef();if(t){appendToMap(e,r,t)}},set:function(r){var t=e.get(r);if(t){e.set(r,t.filter(forceUpdate))}cleanupElements(e)},reset:function(){e.forEach((function(e){return e.forEach(forceUpdate)}));cleanupElements(e)}}};var unwrap=function(e){return typeof e==="function"?e():e};var createObservableMap=function(e,r){if(r===void 0){r=function(e,r){return e!==r}}var t=unwrap(e);var a=new Map(Object.entries(t!==null&&t!==void 0?t:{}));var n={dispose:[],get:[],set:[],reset:[]};var i=function(){var r;a=new Map(Object.entries((r=unwrap(e))!==null&&r!==void 0?r:{}));n.reset.forEach((function(e){return e()}))};var s=function(){n.dispose.forEach((function(e){return e()}));i()};var o=function(e){n.get.forEach((function(r){return r(e)}));return a.get(e)};var c=function(e,t){var i=a.get(e);if(r(t,i,e)){a.set(e,t);n.set.forEach((function(r){return r(e,t,i)}))}};var u=typeof Proxy==="undefined"?{}:new Proxy(t,{get:function(e,r){return o(r)},ownKeys:function(e){return Array.from(a.keys())},getOwnPropertyDescriptor:function(){return{enumerable:true,configurable:true}},has:function(e,r){return a.has(r)},set:function(e,r,t){c(r,t);return true}});var v=function(e,r){n[e].push(r);return function(){removeFromArray(n[e],r)}};var l=function(r,t){var a=v("set",(function(e,a){if(e===r){t(a)}}));var n=v("reset",(function(){return t(unwrap(e)[r])}));return function(){a();n()}};var f=function(){var e=[];for(var r=0;r<arguments.length;r++){e[r]=arguments[r]}var t=e.reduce((function(e,r){if(r.set){e.push(v("set",r.set))}if(r.get){e.push(v("get",r.get))}if(r.reset){e.push(v("reset",r.reset))}if(r.dispose){e.push(v("dispose",r.dispose))}return e}),[]);return function(){return t.forEach((function(e){return e()}))}};var $=function(e){var r=a.get(e);n.set.forEach((function(t){return t(e,r,r)}))};return{state:u,get:o,set:c,on:v,onChange:l,use:f,dispose:s,reset:i,forceUpdate:$}};var removeFromArray=function(e,r){var t=e.indexOf(r);if(t>=0){e[t]=e[e.length-1];e.length--}};var createStore=function(e,r){var t=createObservableMap(e,r);t.use(stencilSubscription());return t};var commonjsGlobal=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function listCacheClear$1(){this.__data__=[];this.size=0}var _listCacheClear=listCacheClear$1;function eq$4(e,r){return e===r||e!==e&&r!==r}var eq_1=eq$4;var eq$3=eq_1;function assocIndexOf$4(e,r){var t=e.length;while(t--){if(eq$3(e[t][0],r)){return t}}return-1}var _assocIndexOf=assocIndexOf$4;var assocIndexOf$3=_assocIndexOf;var arrayProto=Array.prototype;var splice=arrayProto.splice;function listCacheDelete$1(e){var r=this.__data__,t=assocIndexOf$3(r,e);if(t<0){return false}var a=r.length-1;if(t==a){r.pop()}else{splice.call(r,t,1)}--this.size;return true}var _listCacheDelete=listCacheDelete$1;var assocIndexOf$2=_assocIndexOf;function listCacheGet$1(e){var r=this.__data__,t=assocIndexOf$2(r,e);return t<0?undefined:r[t][1]}var _listCacheGet=listCacheGet$1;var assocIndexOf$1=_assocIndexOf;function listCacheHas$1(e){return assocIndexOf$1(this.__data__,e)>-1}var _listCacheHas=listCacheHas$1;var assocIndexOf=_assocIndexOf;function listCacheSet$1(e,r){var t=this.__data__,a=assocIndexOf(t,e);if(a<0){++this.size;t.push([e,r])}else{t[a][1]=r}return this}var _listCacheSet=listCacheSet$1;var listCacheClear=_listCacheClear,listCacheDelete=_listCacheDelete,listCacheGet=_listCacheGet,listCacheHas=_listCacheHas,listCacheSet=_listCacheSet;function ListCache$4(e){var r=-1,t=e==null?0:e.length;this.clear();while(++r<t){var a=e[r];this.set(a[0],a[1])}}ListCache$4.prototype.clear=listCacheClear;ListCache$4.prototype["delete"]=listCacheDelete;ListCache$4.prototype.get=listCacheGet;ListCache$4.prototype.has=listCacheHas;ListCache$4.prototype.set=listCacheSet;var _ListCache=ListCache$4;var ListCache$3=_ListCache;function stackClear$1(){this.__data__=new ListCache$3;this.size=0}var _stackClear=stackClear$1;function stackDelete$1(e){var r=this.__data__,t=r["delete"](e);this.size=r.size;return t}var _stackDelete=stackDelete$1;function stackGet$1(e){return this.__data__.get(e)}var _stackGet=stackGet$1;function stackHas$1(e){return this.__data__.has(e)}var _stackHas=stackHas$1;var freeGlobal$1=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal;var _freeGlobal=freeGlobal$1;var freeGlobal=_freeGlobal;var freeSelf=typeof self=="object"&&self&&self.Object===Object&&self;var root$4=freeGlobal||freeSelf||Function("return this")();var _root=root$4;var root$3=_root;var Symbol$2=root$3.Symbol;var _Symbol=Symbol$2;var Symbol$1=_Symbol;var objectProto$a=Object.prototype;var hasOwnProperty$8=objectProto$a.hasOwnProperty;var nativeObjectToString$1=objectProto$a.toString;var symToStringTag$1=Symbol$1?Symbol$1.toStringTag:undefined;function getRawTag$1(e){var r=hasOwnProperty$8.call(e,symToStringTag$1),t=e[symToStringTag$1];try{e[symToStringTag$1]=undefined;var a=true}catch(e){}var n=nativeObjectToString$1.call(e);if(a){if(r){e[symToStringTag$1]=t}else{delete e[symToStringTag$1]}}return n}var _getRawTag=getRawTag$1;var objectProto$9=Object.prototype;var nativeObjectToString=objectProto$9.toString;function objectToString$1(e){return nativeObjectToString.call(e)}var _objectToString=objectToString$1;var Symbol=_Symbol,getRawTag=_getRawTag,objectToString=_objectToString;var nullTag="[object Null]",undefinedTag="[object Undefined]";var symToStringTag=Symbol?Symbol.toStringTag:undefined;function baseGetTag$4(e){if(e==null){return e===undefined?undefinedTag:nullTag}return symToStringTag&&symToStringTag in Object(e)?getRawTag(e):objectToString(e)}var _baseGetTag=baseGetTag$4;function isObject$7(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}var isObject_1=isObject$7;var baseGetTag$3=_baseGetTag,isObject$6=isObject_1;var asyncTag="[object AsyncFunction]",funcTag$1="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$3(e){if(!isObject$6(e)){return false}var r=baseGetTag$3(e);return r==funcTag$1||r==genTag||r==asyncTag||r==proxyTag}var isFunction_1=isFunction$3;var root$2=_root;var coreJsData$1=root$2["__core-js_shared__"];var _coreJsData=coreJsData$1;var coreJsData=_coreJsData;var maskSrcKey=function(){var e=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked$1(e){return!!maskSrcKey&&maskSrcKey in e}var _isMasked=isMasked$1;var funcProto$2=Function.prototype;var funcToString$2=funcProto$2.toString;function toSource$1(e){if(e!=null){try{return funcToString$2.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var _toSource=toSource$1;var isFunction$2=isFunction_1,isMasked=_isMasked,isObject$5=isObject_1,toSource=_toSource;var reRegExpChar=/[\\^$.*+?()[\]{}|]/g;var reIsHostCtor=/^\[object .+?Constructor\]$/;var funcProto$1=Function.prototype,objectProto$8=Object.prototype;var funcToString$1=funcProto$1.toString;var hasOwnProperty$7=objectProto$8.hasOwnProperty;var reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$7).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative$1(e){if(!isObject$5(e)||isMasked(e)){return false}var r=isFunction$2(e)?reIsNative:reIsHostCtor;return r.test(toSource(e))}var _baseIsNative=baseIsNative$1;function getValue$1(e,r){return e==null?undefined:e[r]}var _getValue=getValue$1;var baseIsNative=_baseIsNative,getValue=_getValue;function getNative$3(e,r){var t=getValue(e,r);return baseIsNative(t)?t:undefined}var _getNative=getNative$3;var getNative$2=_getNative,root$1=_root;var Map$3=getNative$2(root$1,"Map");var _Map=Map$3;var getNative$1=_getNative;var nativeCreate$4=getNative$1(Object,"create");var _nativeCreate=nativeCreate$4;var nativeCreate$3=_nativeCreate;function hashClear$1(){this.__data__=nativeCreate$3?nativeCreate$3(null):{};this.size=0}var _hashClear=hashClear$1;function hashDelete$1(e){var r=this.has(e)&&delete this.__data__[e];this.size-=r?1:0;return r}var _hashDelete=hashDelete$1;var nativeCreate$2=_nativeCreate;var HASH_UNDEFINED$1="__lodash_hash_undefined__";var objectProto$7=Object.prototype;var hasOwnProperty$6=objectProto$7.hasOwnProperty;function hashGet$1(e){var r=this.__data__;if(nativeCreate$2){var t=r[e];return t===HASH_UNDEFINED$1?undefined:t}return hasOwnProperty$6.call(r,e)?r[e]:undefined}var _hashGet=hashGet$1;var nativeCreate$1=_nativeCreate;var objectProto$6=Object.prototype;var hasOwnProperty$5=objectProto$6.hasOwnProperty;function hashHas$1(e){var r=this.__data__;return nativeCreate$1?r[e]!==undefined:hasOwnProperty$5.call(r,e)}var _hashHas=hashHas$1;var nativeCreate=_nativeCreate;var HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet$1(e,r){var t=this.__data__;this.size+=this.has(e)?0:1;t[e]=nativeCreate&&r===undefined?HASH_UNDEFINED:r;return this}var _hashSet=hashSet$1;var hashClear=_hashClear,hashDelete=_hashDelete,hashGet=_hashGet,hashHas=_hashHas,hashSet=_hashSet;function Hash$1(e){var r=-1,t=e==null?0:e.length;this.clear();while(++r<t){var a=e[r];this.set(a[0],a[1])}}Hash$1.prototype.clear=hashClear;Hash$1.prototype["delete"]=hashDelete;Hash$1.prototype.get=hashGet;Hash$1.prototype.has=hashHas;Hash$1.prototype.set=hashSet;var _Hash=Hash$1;var Hash=_Hash,ListCache$2=_ListCache,Map$2=_Map;function mapCacheClear$1(){this.size=0;this.__data__={hash:new Hash,map:new(Map$2||ListCache$2),string:new Hash}}var _mapCacheClear=mapCacheClear$1;function isKeyable$1(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}var _isKeyable=isKeyable$1;var isKeyable=_isKeyable;function getMapData$4(e,r){var t=e.__data__;return isKeyable(r)?t[typeof r=="string"?"string":"hash"]:t.map}var _getMapData=getMapData$4;var getMapData$3=_getMapData;function mapCacheDelete$1(e){var r=getMapData$3(this,e)["delete"](e);this.size-=r?1:0;return r}var _mapCacheDelete=mapCacheDelete$1;var getMapData$2=_getMapData;function mapCacheGet$1(e){return getMapData$2(this,e).get(e)}var _mapCacheGet=mapCacheGet$1;var getMapData$1=_getMapData;function mapCacheHas$1(e){return getMapData$1(this,e).has(e)}var _mapCacheHas=mapCacheHas$1;var getMapData=_getMapData;function mapCacheSet$1(e,r){var t=getMapData(this,e),a=t.size;t.set(e,r);this.size+=t.size==a?0:1;return this}var _mapCacheSet=mapCacheSet$1;var mapCacheClear=_mapCacheClear,mapCacheDelete=_mapCacheDelete,mapCacheGet=_mapCacheGet,mapCacheHas=_mapCacheHas,mapCacheSet=_mapCacheSet;function MapCache$1(e){var r=-1,t=e==null?0:e.length;this.clear();while(++r<t){var a=e[r];this.set(a[0],a[1])}}MapCache$1.prototype.clear=mapCacheClear;MapCache$1.prototype["delete"]=mapCacheDelete;MapCache$1.prototype.get=mapCacheGet;MapCache$1.prototype.has=mapCacheHas;MapCache$1.prototype.set=mapCacheSet;var _MapCache=MapCache$1;var ListCache$1=_ListCache,Map$1=_Map,MapCache=_MapCache;var LARGE_ARRAY_SIZE=200;function stackSet$1(e,r){var t=this.__data__;if(t instanceof ListCache$1){var a=t.__data__;if(!Map$1||a.length<LARGE_ARRAY_SIZE-1){a.push([e,r]);this.size=++t.size;return this}t=this.__data__=new MapCache(a)}t.set(e,r);this.size=t.size;return this}var _stackSet=stackSet$1;var ListCache=_ListCache,stackClear=_stackClear,stackDelete=_stackDelete,stackGet=_stackGet,stackHas=_stackHas,stackSet=_stackSet;function Stack$1(e){var r=this.__data__=new ListCache(e);this.size=r.size}Stack$1.prototype.clear=stackClear;Stack$1.prototype["delete"]=stackDelete;Stack$1.prototype.get=stackGet;Stack$1.prototype.has=stackHas;Stack$1.prototype.set=stackSet;var _Stack=Stack$1;var getNative=_getNative;var defineProperty$2=function(){try{var e=getNative(Object,"defineProperty");e({},"",{});return e}catch(e){}}();var _defineProperty=defineProperty$2;var defineProperty$1=_defineProperty;function baseAssignValue$3(e,r,t){if(r=="__proto__"&&defineProperty$1){defineProperty$1(e,r,{configurable:true,enumerable:true,value:t,writable:true})}else{e[r]=t}}var _baseAssignValue=baseAssignValue$3;var baseAssignValue$2=_baseAssignValue,eq$2=eq_1;function assignMergeValue$2(e,r,t){if(t!==undefined&&!eq$2(e[r],t)||t===undefined&&!(r in e)){baseAssignValue$2(e,r,t)}}var _assignMergeValue=assignMergeValue$2;function createBaseFor$1(e){return function(r,t,a){var n=-1,i=Object(r),s=a(r),o=s.length;while(o--){var c=s[e?o:++n];if(t(i[c],c,i)===false){break}}return r}}var _createBaseFor=createBaseFor$1;var createBaseFor=_createBaseFor;var baseFor$1=createBaseFor();var _baseFor=baseFor$1;var _cloneBuffer={exports:{}};(function(e,r){var t=_root;var a=r&&!r.nodeType&&r;var n=a&&"object"=="object"&&e&&!e.nodeType&&e;var i=n&&n.exports===a;var s=i?t.Buffer:undefined,o=s?s.allocUnsafe:undefined;function c(e,r){if(r){return e.slice()}var t=e.length,a=o?o(t):new e.constructor(t);e.copy(a);return a}e.exports=c})(_cloneBuffer,_cloneBuffer.exports);var root=_root;var Uint8Array$1=root.Uint8Array;var _Uint8Array=Uint8Array$1;var Uint8Array=_Uint8Array;function cloneArrayBuffer$1(e){var r=new e.constructor(e.byteLength);new Uint8Array(r).set(new Uint8Array(e));return r}var _cloneArrayBuffer=cloneArrayBuffer$1;var cloneArrayBuffer=_cloneArrayBuffer;function cloneTypedArray$1(e,r){var t=r?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)}var _cloneTypedArray=cloneTypedArray$1;function copyArray$1(e,r){var t=-1,a=e.length;r||(r=Array(a));while(++t<a){r[t]=e[t]}return r}var _copyArray=copyArray$1;var isObject$4=isObject_1;var objectCreate=Object.create;var baseCreate$1=function(){function e(){}return function(r){if(!isObject$4(r)){return{}}if(objectCreate){return objectCreate(r)}e.prototype=r;var t=new e;e.prototype=undefined;return t}}();var _baseCreate=baseCreate$1;function overArg$1(e,r){return function(t){return e(r(t))}}var _overArg=overArg$1;var overArg=_overArg;var getPrototype$2=overArg(Object.getPrototypeOf,Object);var _getPrototype=getPrototype$2;var objectProto$5=Object.prototype;function isPrototype$2(e){var r=e&&e.constructor,t=typeof r=="function"&&r.prototype||objectProto$5;return e===t}var _isPrototype=isPrototype$2;var baseCreate=_baseCreate,getPrototype$1=_getPrototype,isPrototype$1=_isPrototype;function initCloneObject$1(e){return typeof e.constructor=="function"&&!isPrototype$1(e)?baseCreate(getPrototype$1(e)):{}}var _initCloneObject=initCloneObject$1;function isObjectLike$5(e){return e!=null&&typeof e=="object"}var isObjectLike_1=isObjectLike$5;var baseGetTag$2=_baseGetTag,isObjectLike$4=isObjectLike_1;var argsTag$1="[object Arguments]";function baseIsArguments$1(e){return isObjectLike$4(e)&&baseGetTag$2(e)==argsTag$1}var _baseIsArguments=baseIsArguments$1;var baseIsArguments=_baseIsArguments,isObjectLike$3=isObjectLike_1;var objectProto$4=Object.prototype;var hasOwnProperty$4=objectProto$4.hasOwnProperty;var propertyIsEnumerable=objectProto$4.propertyIsEnumerable;var isArguments$2=baseIsArguments(function(){return arguments}())?baseIsArguments:function(e){return isObjectLike$3(e)&&hasOwnProperty$4.call(e,"callee")&&!propertyIsEnumerable.call(e,"callee")};var isArguments_1=isArguments$2;var isArray$2=Array.isArray;var isArray_1=isArray$2;var MAX_SAFE_INTEGER$1=9007199254740991;function isLength$2(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=MAX_SAFE_INTEGER$1}var isLength_1=isLength$2;var isFunction$1=isFunction_1,isLength$1=isLength_1;function isArrayLike$3(e){return e!=null&&isLength$1(e.length)&&!isFunction$1(e)}var isArrayLike_1=isArrayLike$3;var isArrayLike$2=isArrayLike_1,isObjectLike$2=isObjectLike_1;function isArrayLikeObject$1(e){return isObjectLike$2(e)&&isArrayLike$2(e)}var isArrayLikeObject_1=isArrayLikeObject$1;var isBuffer$2={exports:{}};function stubFalse(){return false}var stubFalse_1=stubFalse;(function(e,r){var t=_root,a=stubFalse_1;var n=r&&!r.nodeType&&r;var i=n&&"object"=="object"&&e&&!e.nodeType&&e;var s=i&&i.exports===n;var o=s?t.Buffer:undefined;var c=o?o.isBuffer:undefined;var u=c||a;e.exports=u})(isBuffer$2,isBuffer$2.exports);var baseGetTag$1=_baseGetTag,getPrototype=_getPrototype,isObjectLike$1=isObjectLike_1;var objectTag$1="[object Object]";var funcProto=Function.prototype,objectProto$3=Object.prototype;var funcToString=funcProto.toString;var hasOwnProperty$3=objectProto$3.hasOwnProperty;var objectCtorString=funcToString.call(Object);function isPlainObject$1(e){if(!isObjectLike$1(e)||baseGetTag$1(e)!=objectTag$1){return false}var r=getPrototype(e);if(r===null){return true}var t=hasOwnProperty$3.call(r,"constructor")&&r.constructor;return typeof t=="function"&&t instanceof t&&funcToString.call(t)==objectCtorString}var isPlainObject_1=isPlainObject$1;var baseGetTag=_baseGetTag,isLength=isLength_1,isObjectLike=isObjectLike_1;var argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",mapTag="[object Map]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",weakMapTag="[object WeakMap]";var arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]";var typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=true;typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=false;function baseIsTypedArray$1(e){return isObjectLike(e)&&isLength(e.length)&&!!typedArrayTags[baseGetTag(e)]}var _baseIsTypedArray=baseIsTypedArray$1;function baseUnary$1(e){return function(r){return e(r)}}var _baseUnary=baseUnary$1;var _nodeUtil={exports:{}};(function(e,r){var t=_freeGlobal;var a=r&&!r.nodeType&&r;var n=a&&"object"=="object"&&e&&!e.nodeType&&e;var i=n&&n.exports===a;var s=i&&t.process;var o=function(){try{var e=n&&n.require&&n.require("util").types;if(e){return e}return s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=o})(_nodeUtil,_nodeUtil.exports);var baseIsTypedArray=_baseIsTypedArray,baseUnary=_baseUnary,nodeUtil=_nodeUtil.exports;var nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray;var isTypedArray$2=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray;var isTypedArray_1=isTypedArray$2;function safeGet$2(e,r){if(r==="constructor"&&typeof e[r]==="function"){return}if(r=="__proto__"){return}return e[r]}var _safeGet=safeGet$2;var baseAssignValue$1=_baseAssignValue,eq$1=eq_1;var objectProto$2=Object.prototype;var hasOwnProperty$2=objectProto$2.hasOwnProperty;function assignValue$1(e,r,t){var a=e[r];if(!(hasOwnProperty$2.call(e,r)&&eq$1(a,t))||t===undefined&&!(r in e)){baseAssignValue$1(e,r,t)}}var _assignValue=assignValue$1;var assignValue=_assignValue,baseAssignValue=_baseAssignValue;function copyObject$1(e,r,t,a){var n=!t;t||(t={});var i=-1,s=r.length;while(++i<s){var o=r[i];var c=a?a(t[o],e[o],o,t,e):undefined;if(c===undefined){c=e[o]}if(n){baseAssignValue(t,o,c)}else{assignValue(t,o,c)}}return t}var _copyObject=copyObject$1;function baseTimes$1(e,r){var t=-1,a=Array(e);while(++t<e){a[t]=r(t)}return a}var _baseTimes=baseTimes$1;var MAX_SAFE_INTEGER=9007199254740991;var reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex$2(e,r){var t=typeof e;r=r==null?MAX_SAFE_INTEGER:r;return!!r&&(t=="number"||t!="symbol"&&reIsUint.test(e))&&(e>-1&&e%1==0&&e<r)}var _isIndex=isIndex$2;var baseTimes=_baseTimes,isArguments$1=isArguments_1,isArray$1=isArray_1,isBuffer$1=isBuffer$2.exports,isIndex$1=_isIndex,isTypedArray$1=isTypedArray_1;var objectProto$1=Object.prototype;var hasOwnProperty$1=objectProto$1.hasOwnProperty;function arrayLikeKeys$1(e,r){var t=isArray$1(e),a=!t&&isArguments$1(e),n=!t&&!a&&isBuffer$1(e),i=!t&&!a&&!n&&isTypedArray$1(e),s=t||a||n||i,o=s?baseTimes(e.length,String):[],c=o.length;for(var u in e){if((r||hasOwnProperty$1.call(e,u))&&!(s&&(u=="length"||n&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||isIndex$1(u,c)))){o.push(u)}}return o}var _arrayLikeKeys=arrayLikeKeys$1;function nativeKeysIn$1(e){var r=[];if(e!=null){for(var t in Object(e)){r.push(t)}}return r}var _nativeKeysIn=nativeKeysIn$1;var isObject$3=isObject_1,isPrototype=_isPrototype,nativeKeysIn=_nativeKeysIn;var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;function baseKeysIn$1(e){if(!isObject$3(e)){return nativeKeysIn(e)}var r=isPrototype(e),t=[];for(var a in e){if(!(a=="constructor"&&(r||!hasOwnProperty.call(e,a)))){t.push(a)}}return t}var _baseKeysIn=baseKeysIn$1;var arrayLikeKeys=_arrayLikeKeys,baseKeysIn=_baseKeysIn,isArrayLike$1=isArrayLike_1;function keysIn$2(e){return isArrayLike$1(e)?arrayLikeKeys(e,true):baseKeysIn(e)}var keysIn_1=keysIn$2;var copyObject=_copyObject,keysIn$1=keysIn_1;function toPlainObject$1(e){return copyObject(e,keysIn$1(e))}var toPlainObject_1=toPlainObject$1;var assignMergeValue$1=_assignMergeValue,cloneBuffer=_cloneBuffer.exports,cloneTypedArray=_cloneTypedArray,copyArray=_copyArray,initCloneObject=_initCloneObject,isArguments=isArguments_1,isArray=isArray_1,isArrayLikeObject=isArrayLikeObject_1,isBuffer=isBuffer$2.exports,isFunction=isFunction_1,isObject$2=isObject_1,isPlainObject=isPlainObject_1,isTypedArray=isTypedArray_1,safeGet$1=_safeGet,toPlainObject=toPlainObject_1;function baseMergeDeep$1(e,r,t,a,n,i,s){var o=safeGet$1(e,t),c=safeGet$1(r,t),u=s.get(c);if(u){assignMergeValue$1(e,t,u);return}var v=i?i(o,c,t+"",e,r,s):undefined;var l=v===undefined;if(l){var f=isArray(c),$=!f&&isBuffer(c),g=!f&&!$&&isTypedArray(c);v=c;if(f||$||g){if(isArray(o)){v=o}else if(isArrayLikeObject(o)){v=copyArray(o)}else if($){l=false;v=cloneBuffer(c,true)}else if(g){l=false;v=cloneTypedArray(c,true)}else{v=[]}}else if(isPlainObject(c)||isArguments(c)){v=o;if(isArguments(o)){v=toPlainObject(o)}else if(!isObject$2(o)||isFunction(o)){v=initCloneObject(c)}}else{l=false}}if(l){s.set(c,v);n(v,c,a,i,s);s["delete"](c)}assignMergeValue$1(e,t,v)}var _baseMergeDeep=baseMergeDeep$1;var Stack=_Stack,assignMergeValue=_assignMergeValue,baseFor=_baseFor,baseMergeDeep=_baseMergeDeep,isObject$1=isObject_1,keysIn=keysIn_1,safeGet=_safeGet;function baseMerge$1(e,r,t,a,n){if(e===r){return}baseFor(r,(function(i,s){n||(n=new Stack);if(isObject$1(i)){baseMergeDeep(e,r,s,t,baseMerge$1,a,n)}else{var o=a?a(safeGet(e,s),i,s+"",e,r,n):undefined;if(o===undefined){o=i}assignMergeValue(e,s,o)}}),keysIn)}var _baseMerge=baseMerge$1;function identity$2(e){return e}var identity_1=identity$2;function apply$1(e,r,t){switch(t.length){case 0:return e.call(r);case 1:return e.call(r,t[0]);case 2:return e.call(r,t[0],t[1]);case 3:return e.call(r,t[0],t[1],t[2])}return e.apply(r,t)}var _apply=apply$1;var apply=_apply;var nativeMax=Math.max;function overRest$1(e,r,t){r=nativeMax(r===undefined?e.length-1:r,0);return function(){var a=arguments,n=-1,i=nativeMax(a.length-r,0),s=Array(i);while(++n<i){s[n]=a[r+n]}n=-1;var o=Array(r+1);while(++n<r){o[n]=a[n]}o[r]=t(s);return apply(e,this,o)}}var _overRest=overRest$1;function constant$1(e){return function(){return e}}var constant_1=constant$1;var constant=constant_1,defineProperty=_defineProperty,identity$1=identity_1;var baseSetToString$1=!defineProperty?identity$1:function(e,r){return defineProperty(e,"toString",{configurable:true,enumerable:false,value:constant(r),writable:true})};var _baseSetToString=baseSetToString$1;var HOT_COUNT=800,HOT_SPAN=16;var nativeNow=Date.now;function shortOut$1(e){var r=0,t=0;return function(){var a=nativeNow(),n=HOT_SPAN-(a-t);t=a;if(n>0){if(++r>=HOT_COUNT){return arguments[0]}}else{r=0}return e.apply(undefined,arguments)}}var _shortOut=shortOut$1;var baseSetToString=_baseSetToString,shortOut=_shortOut;var setToString$1=shortOut(baseSetToString);var _setToString=setToString$1;var identity=identity_1,overRest=_overRest,setToString=_setToString;function baseRest$1(e,r){return setToString(overRest(e,r,identity),e+"")}var _baseRest=baseRest$1;var eq=eq_1,isArrayLike=isArrayLike_1,isIndex=_isIndex,isObject=isObject_1;function isIterateeCall$1(e,r,t){if(!isObject(t)){return false}var a=typeof r;if(a=="number"?isArrayLike(t)&&isIndex(r,t.length):a=="string"&&r in t){return eq(t[r],e)}return false}var _isIterateeCall=isIterateeCall$1;var baseRest=_baseRest,isIterateeCall=_isIterateeCall;function createAssigner$1(e){return baseRest((function(r,t){var a=-1,n=t.length,i=n>1?t[n-1]:undefined,s=n>2?t[2]:undefined;i=e.length>3&&typeof i=="function"?(n--,i):undefined;if(s&&isIterateeCall(t[0],t[1],s)){i=n<3?undefined:i;n=1}r=Object(r);while(++a<n){var o=t[a];if(o){e(r,o,a,i)}}return r}))}var _createAssigner=createAssigner$1;var baseMerge=_baseMerge,createAssigner=_createAssigner;var merge=createAssigner((function(e,r,t){baseMerge(e,r,t)}));var merge_1=merge;var mergeConfig=function(e,r){var t=[];for(var a=2;a<arguments.length;a++){t[a-2]=arguments[a]}var n=__spreadArray([e,r],t,true).filter(Boolean);return merge_1.apply(null,n)};var _f=createStore((function(){return{appearance:{colorPrimary:"white",fontFamily:"Inter",logoUrl:"",style:"ROUNDED",theme:"LIGHT",zonosAttribution:"DISABLED"},checkoutSettings:{allowedCharacterSets:"ALL",analyticsProviders:[],cartExpiration:60,externalPaymentMethods:[],externalServiceTokens:[],mode:"TEST",orderNotifications:{abandonedCart:{delay:0,discountPercent:0,status:{active:"DISABLED",sendCopiesTo:[]}},orderCancelled:{active:"DISABLED",sendCopiesTo:[]},orderConfirmation:{active:"DISABLED",sendCopiesTo:[]},orderShipped:{active:"DISABLED",sendCopiesTo:[]}},organization:"",placeOrderButtonSelector:null,subscriptionStatus:"INACTIVE",successBehavior:"REDIRECT_TO_SUCCESS_PAGE",successRedirectUrl:"",visibilityStatus:"ENABLED"},currentHelloPage:"",disabledCountries:[],helloSettings:{anchorElementSelector:"",cartUrlPattern:"",countryOverrideBehavior:"URL_PARAM",currencyBehavior:"ENABLED",currencyElementSelector:".money",desktopLocation:"BOTTOM_RIGHT",excludedUrlPatterns:[],homepageUrlPattern:"",mobileLocation:"BOTTOM_RIGHT",mode:"LIVE",notFoundElementFallback:null,organization:"",peekMessageBehavior:"ENABLED",peekMessageDelay:0,productAddToCartElementSelector:"",productDescriptionElementSelector:"",productDetailUrlPattern:"",productListUrlPattern:"",productTitleElementSelector:"",restrictionBehavior:"DISABLED",showForCountries:"ONLY_SHIPPABLE",visibilityStatus:"ENABLED"},loadedConfig:false,onlineStoreSettings:{allowedDomains:[],url:""},organizationId:"",organizationName:"",sourceCurrency:"USD",storeId:null,stripeApiKey:"",zonosApiKey:"",zonosMode:null}})),zonosStoreDispose=_f.dispose,reset=_f.reset,zonosStore=_f.state;var savedZonosSettings=null;var getZonosStoreTheme=function(e){if(e==="SYSTEM"){return window.matchMedia("(prefers-color-scheme: dark)").matches?"DARK":"LIGHT"}return e};var zonosStoreInitSetting=function(e){var r=e.overrideSettings,t=e.zonosSettings;var a,n,i,s,o;reset();if(t){savedZonosSettings=t}var c=mergeConfig(zonosStore.appearance,(savedZonosSettings===null||savedZonosSettings===void 0?void 0:savedZonosSettings.appearanceSettings)||(t===null||t===void 0?void 0:t.appearanceSettings)||null,r===null||r===void 0?void 0:r.appearance);if(c.theme==="SYSTEM"){c.theme=getZonosStoreTheme(c.theme)}zonosStore.onlineStoreSettings=mergeConfig(zonosStore.onlineStoreSettings,(t===null||t===void 0?void 0:t.onlineStoreSettings)||null);zonosStore.disabledCountries=((a=t===null||t===void 0?void 0:t.checkoutSettings)===null||a===void 0?void 0:a.disabledCountries)||[];zonosStore.appearance=c;zonosStore.checkoutSettings=mergeConfig(zonosStore.checkoutSettings,(savedZonosSettings===null||savedZonosSettings===void 0?void 0:savedZonosSettings.checkoutSettings)||(t===null||t===void 0?void 0:t.checkoutSettings)||null,r===null||r===void 0?void 0:r.checkoutSettings);zonosStore.helloSettings=mergeConfig(zonosStore.helloSettings,(savedZonosSettings===null||savedZonosSettings===void 0?void 0:savedZonosSettings.helloSettings)||(t===null||t===void 0?void 0:t.helloSettings)||null,r===null||r===void 0?void 0:r.helloSettings);zonosStore.loadedConfig=true;zonosStore.organizationId=((n=t===null||t===void 0?void 0:t.organization)===null||n===void 0?void 0:n.id)||"";zonosStore.organizationName=((i=t===null||t===void 0?void 0:t.organization)===null||i===void 0?void 0:i.name)||"";zonosStore.storeId=((o=(s=t===null||t===void 0?void 0:t.organization)===null||s===void 0?void 0:s.references)===null||o===void 0?void 0:o.storeId)||null;zonosStore.currencyConverter=r===null||r===void 0?void 0:r.currencyConverter;zonosStore.onCountryChange=r===null||r===void 0?void 0:r.onCountryChange;zonosStore.overrideCurrencyFormat=r===null||r===void 0?void 0:r.overrideCurrencyFormat};var zonosStoreFontFamily=function(){var e=zonosStore.appearance.fontFamily||"Inter";return e};export{_root as _,commonjsGlobal as a,zonosStoreInitSetting as b,createStore as c,zonosStoreFontFamily as d,_baseGetTag as e,isObject_1 as f,getZonosStoreTheme as g,isObjectLike_1 as i,mergeConfig as m,zonosStore as z};
|
package/dist/scripts/index.d.ts
CHANGED
|
@@ -991,6 +991,7 @@ type CartItem = {
|
|
|
991
991
|
|
|
992
992
|
type CalculateLandedCostAdjustmentInput = {
|
|
993
993
|
amount: number;
|
|
994
|
+
name?: string | null;
|
|
994
995
|
productId: string | null;
|
|
995
996
|
promoCode?: string | null;
|
|
996
997
|
sku: string | null;
|
|
@@ -1068,6 +1069,11 @@ type CheckoutConfig = {
|
|
|
1068
1069
|
status: AnalyticsProviderStatus;
|
|
1069
1070
|
type: AnalyticsProviderType;
|
|
1070
1071
|
}>;
|
|
1072
|
+
/**
|
|
1073
|
+
* Duration (in minutes) for which the cart remains valid for checkout in hosted checkout.
|
|
1074
|
+
* @default 60 (1 hour)
|
|
1075
|
+
*/
|
|
1076
|
+
cartExpiration?: number;
|
|
1071
1077
|
/**
|
|
1072
1078
|
* @default false - when false, the place order button will be disabled until the script is loaded
|
|
1073
1079
|
* @note if set to true, the place order button will not be enabled or disabled
|
|
@@ -4345,6 +4351,7 @@ type NormalizedTempCart = {
|
|
|
4345
4351
|
sku: string | null;
|
|
4346
4352
|
type: CartAdjustmentType;
|
|
4347
4353
|
}[];
|
|
4354
|
+
createdAt: string;
|
|
4348
4355
|
credentialToken: string;
|
|
4349
4356
|
id: string;
|
|
4350
4357
|
items: NormalizedTempCartItem[];
|
package/dist/scripts/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=performance.now(),o=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},t=(t,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const o=performance.now()-e,t=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:t}})(),l=[`(${a})`,...r];l.map(o).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(t,...l));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(t,...l);break;case"info":d.info(t,...l);break;case"error":d.error(t,...l);break;default:d.groupCollapsed(t,...l),d.trace(),d.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const o=r.indexOf(e);return r[o+1]||null},a=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),n="https://v1.3.129.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),r},l="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${l}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&c.test(t.src))return t}return null})();r&&e?console.warn(d):r||(r=(e=>{const o=document.createElement("script");o.src=`${l}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),u),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function w(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const y=["cloudflare","vercel"],g=y[0],f={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},v=f[g],b=(e=g)=>{const o=y.indexOf(e),t=y[o+1];return t||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=S(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},j=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||f[e]||g,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:a}}const c=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:c}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${c}: ${"Unknown error"}`,type:c}],json:null,response:null,zonosMode:a}}},O=async({basePathType:e,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=await j({basePathType:i,options:o,path:n}),{errors:l,response:c}=a,d=w(a,["errors","response"]),u=b(i),p=!!l.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(t("sendErrorLog","warn",e,n,o),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({domain:window.Zonos.domain,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=b();if(!o)return;fetch(`${f[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:f[i]+n,errors:l.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==o?void 0:o.headers,requestPayload:S(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(t(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:o,path:n})):Object.assign({errors:l,response:c},d)},C=async({cartId:e,retries:o})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:s}=await(async(e,o)=>{const n=w(o||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),a=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return t(e,"info"),O({basePathType:l||g,options:a,path:e})})("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&o?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),C({cartId:e,retries:o-1})):i?null:s},Z=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,E=new RegExp(`^${Z.source}$`),k=new RegExp(`^cart_${Z.source}$`),I=async e=>{const{isDgsCartId:o,isLegacyCartId:r}=(e=>e?k.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:E.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!o)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await C({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var $;const A=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),T="https://v1.3.129.js.zonos.com",U=A||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.129",L="https://rsms.me",P="https://fonts.googleapis.com",N=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class D{}$=D,D.doneInit=!1,D.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),D.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),D._paypalMockResponse=null,D.isBigCommerce=!1,D.releaseDate="1731519280297",D.isLegacyCheckout=!1,D.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",D.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),D.isNpm=!0,D.zonosQaUrl=null,D.zonosQaUrlApi=null,D.version="v1.3.129",D.modeAlerted=!1,D.cartData=null,D.paypal=null,D.getCurrentTimestamp=()=>(new Date).getTime(),D.zonosController=null,D.init=async e=>{const{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:c,storeId:d,zonosApiKey:u}=e;if($.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!$.doneInit){if(t(`====== ZONOS DEBUG MODE: on (${$.version}) ======`),$.zonosApiKey=u,$.storeId=d,$.isNpm){t("====== ZONOS LOADING FROM NPM ======");const o=a();if(o&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const n=document.createElement("script");return n.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=$.isNpm,window.Zonos.isBigCommerce=$.isBigCommerce,window.Zonos.isLegacyCheckout=$.isLegacyCheckout,window.Zonos.init(e)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!u&&!$.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!$.cartData&&$.cartId){t("Initialize cart data");const e=await I($.cartId);if(!e)return void n("Failed to get cart data");$.cartData=e.cartData,$.zonosApiKey=e.zonosApiKey}}if($.cartId&&$.cartData){t("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}t("init zonos"),$.injectZonosCdn(),$.injectZonosCss(),$.injectFonts(),$.injectController({config:{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:c}}),$.doneInit=!0}},D.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},D.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},D.showNotification=e=>{var o;null===(o=$.zonosController)||void 0===o||o.showNotification(e)},D.updateOrganizationName=e=>{var o;null===(o=$.zonosController)||void 0===o||o.updateOrganizationName(e)},D.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},D.injectController=({config:e})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;$.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{$.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=$.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const s=await(async(...e)=>{h=!0;const o=Date.now();return m.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),$.zonosController=r,t("Zonos controller injected!")},D.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${$.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,l=document.createElement("script");o?l.type="module":l.noModule=!0,l.src=s,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const t=i(e);t&&$.injectScript({cdnType:t,isModule:o,theRestUrl:r})},a.appendChild(l)},D.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return U;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.129";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.129";case"vercel":return T}};if($.isNpm){return a()||o()}return o()},D.injectZonosCdn=()=>{$.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),$.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},D.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=$.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${T}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${t}/${o}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const t=i(e);t&&$.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(a)},D.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):($.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},D.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${L}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!N.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=L,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${L}/inter/inter.css`,e.appendChild(n),t("Zonos font injected!")},D.setupGoogleFont=e=>{var o;null===(o=$.zonosController)||void 0===o||o.setupGoogleFont(e)},D.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${P}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=P,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)},exports.Zonos=D})();
|
|
1
|
+
(function(){"use strict";const e=performance.now(),o=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},t=(t,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const o=performance.now()-e,t=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:t}})(),l=[`(${a})`,...r];l.map(o).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(t,...l));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(t,...l);break;case"info":d.info(t,...l);break;case"error":d.error(t,...l);break;default:d.groupCollapsed(t,...l),d.trace(),d.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const o=r.indexOf(e);return r[o+1]||null},a=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),n="https://v1.3.130.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),r},l="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${l}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&c.test(t.src))return t}return null})();r&&e?console.warn(d):r||(r=(e=>{const o=document.createElement("script");o.src=`${l}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),u),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function w(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const y=["cloudflare","vercel"],g=y[0],f={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},v=f[g],b=(e=g)=>{const o=y.indexOf(e),t=y[o+1];return t||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=S(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},j=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||f[e]||g,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:a}}const c=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:c}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${c}: ${"Unknown error"}`,type:c}],json:null,response:null,zonosMode:a}}},O=async({basePathType:e,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=await j({basePathType:i,options:o,path:n}),{errors:l,response:c}=a,d=w(a,["errors","response"]),u=b(i),p=!!l.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(t("sendErrorLog","warn",e,n,o),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({domain:window.Zonos.domain,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=b();if(!o)return;fetch(`${f[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:f[i]+n,errors:l.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==o?void 0:o.headers,requestPayload:S(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(t(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:o,path:n})):Object.assign({errors:l,response:c},d)},C=async({cartId:e,retries:o})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:s}=await(async(e,o)=>{const n=w(o||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),a=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return t(e,"info"),O({basePathType:l||g,options:a,path:e})})("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&o?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),C({cartId:e,retries:o-1})):i?null:s},Z=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,E=new RegExp(`^${Z.source}$`),I=new RegExp(`^cart_${Z.source}$`),k=async e=>{const{isDgsCartId:o,isLegacyCartId:r}=(e=>e?I.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:E.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!o)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await C({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var $;const A=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),T="https://v1.3.130.js.zonos.com",U=A||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.130",L="https://rsms.me",P="https://fonts.googleapis.com",N=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class D{}$=D,D.doneInit=!1,D.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),D.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),D._paypalMockResponse=null,D.isBigCommerce=!1,D.releaseDate="1732051119768",D.isLegacyCheckout=!1,D.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",D.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),D.isNpm=!0,D.zonosQaUrl=null,D.zonosQaUrlApi=null,D.version="v1.3.130",D.modeAlerted=!1,D.cartData=null,D.paypal=null,D.getCurrentTimestamp=()=>(new Date).getTime(),D.zonosController=null,D.init=async e=>{const{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:c,storeId:d,zonosApiKey:u}=e;if($.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!$.doneInit){if(t(`====== ZONOS DEBUG MODE: on (${$.version}) ======`),$.zonosApiKey=u,$.storeId=d,$.isNpm){t("====== ZONOS LOADING FROM NPM ======");const o=a();if(o&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const n=document.createElement("script");return n.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=$.isNpm,window.Zonos.isBigCommerce=$.isBigCommerce,window.Zonos.isLegacyCheckout=$.isLegacyCheckout,window.Zonos.init(e)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!u&&!$.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!$.cartData&&$.cartId){t("Initialize cart data");const e=await k($.cartId);if(!e)return void n("Failed to get cart data");$.cartData=e.cartData,$.zonosApiKey=e.zonosApiKey}}if($.cartId&&$.cartData){t("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}t("init zonos"),$.injectZonosCdn(),$.injectZonosCss(),$.injectFonts(),$.injectController({config:{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:c}}),$.doneInit=!0}},D.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},D.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},D.showNotification=e=>{var o;null===(o=$.zonosController)||void 0===o||o.showNotification(e)},D.updateOrganizationName=e=>{var o;null===(o=$.zonosController)||void 0===o||o.updateOrganizationName(e)},D.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},D.injectController=({config:e})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;$.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{$.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=$.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const s=await(async(...e)=>{h=!0;const o=Date.now();return m.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),$.zonosController=r,t("Zonos controller injected!")},D.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${$.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,l=document.createElement("script");o?l.type="module":l.noModule=!0,l.src=s,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const t=i(e);t&&$.injectScript({cdnType:t,isModule:o,theRestUrl:r})},a.appendChild(l)},D.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return U;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.130";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.130";case"vercel":return T}};if($.isNpm){return a()||o()}return o()},D.injectZonosCdn=()=>{$.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),$.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},D.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=$.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${T}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${t}/${o}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const t=i(e);t&&$.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(a)},D.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):($.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},D.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${L}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!N.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=L,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${L}/inter/inter.css`,e.appendChild(n),t("Zonos font injected!")},D.setupGoogleFont=e=>{var o;null===(o=$.zonosController)||void 0===o||o.setupGoogleFont(e)},D.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${P}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=P,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)},exports.Zonos=D})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function o(o,e){var n={};for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&e.indexOf(r)<0&&(n[r]=o[r]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(r=Object.getOwnPropertySymbols(o);t<r.length;t++)e.indexOf(r[t])<0&&Object.prototype.propertyIsEnumerable.call(o,r[t])&&(n[r[t]]=o[r[t]])}return n}"function"==typeof SuppressedError&&SuppressedError;const e=["cloudflare","vercel"],n=e[0],r={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},t=r[n],s=(o=n)=>{const r=e.indexOf(o),t=e[r+1];return t||null},i=o=>{if("string"==typeof o)try{return JSON.parse(o)}catch(o){return null}return null},a=performance.now(),c=o=>{if("string"==typeof o)return o;try{return JSON.stringify(o)}catch(e){if(o&&"function"==typeof o.toString){return o.toString()}return"Unable to stringify info"}},d=(o,e,...n)=>{var r,t;const{elapsedTimePretty:s}=(()=>{const o=performance.now()-a,e=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:e}})(),i=[`(${s})`,...n];i.map(c).join(" ");if(!(!!(null===(r=window.Zonos)||void 0===r?void 0:r.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===e&&console.error(o,...i));let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const l=(null===(t=d.contentWindow)||void 0===t?void 0:t.window.console)||window.console;switch(e){case"warn":l.warn(o,...i);break;case"info":l.info(o,...i);break;case"error":l.error(o,...i);break;default:l.groupCollapsed(o,...i),l.trace(),l.groupEnd()}},l=async({endpoint:o,errors:e,metadata:n,shouldPostReleaseErrorReporting:i})=>{if(d("sendErrorLog","warn",o,n,e),i){const o=Number(window.Zonos.releaseDate);if((new Date).getTime()-o>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,c={endpoint:o,errors:e,href:window.location.href,metadata:Object.assign({domain:window.Zonos.domain,userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},n)};try{fetch(`${t}/api/zonos-elements/log-error`,{body:JSON.stringify(c),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(o){const e=s();if(!e)return;fetch(`${r[e]}/api/zonos-elements/log-error`,{body:JSON.stringify(c),method:"POST"})}},p=async({response:o,shouldLog:e=!0,shouldThrow:n=!1})=>{try{const e=await o.text(),n=i(e);if(!n)throw new Error(`Failed to parse content: ${e}`);return n}catch(o){if(n)throw o;return e&&console.error(o),null}},u=async({basePathType:o,options:e,path:t})=>{let s;const i=window.Zonos.zonosQaUrlApi||r[o]||n,a=new URL(i+t),c=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;a.searchParams.set("zToken",(o=>{try{return btoa(o).replace(/=/g,"")}catch(e){return o.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(c));try{s=await fetch(a.toString(),e)}catch(o){if(o instanceof Error)return{baseUrl:i,errors:[{message:o.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const d=s.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&d&&l&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await p({response:s}),response:s,zonosMode:d}}const u=s.status.toString();try{const o=await p({response:s,shouldThrow:!0});return{baseUrl:i,errors:[{message:JSON.stringify(o),type:u}],json:null,response:s,zonosMode:d}}catch(o){return{baseUrl:i,errors:[{message:`${u}: ${"Unknown error"}`,type:u}],json:null,response:null,zonosMode:d}}},m=async({basePathType:e,options:n,path:t})=>{var a,c;const p=t.startsWith("/api/bigcommerce")?"vercel":e,w=await u({basePathType:p,options:n,path:t}),{errors:g,response:f}=w,h=o(w,["errors","response"]),y=s(p),v=!!g.find((({type:o})=>"unknown"===o))||404===(null==f?void 0:f.status),S=y&&v;return v&&l({endpoint:r[p]+t,errors:g.map((({message:o})=>`API: ${o}`)),metadata:{currentBasePath:p,nextFallbackApiType:y,requestHeaders:null==n?void 0:n.headers,requestPayload:i(null===(a=null==n?void 0:n.body)||void 0===a?void 0:a.toString())||(null===(c=null==n?void 0:n.body)||void 0===c?void 0:c.toString()),status:null==f?void 0:f.status,statusText:null==f?void 0:f.statusText},shouldPostReleaseErrorReporting:!0}),S?(d(`=== "${t}" failed to fetch, trying next fallback ${y}`),m({basePathType:y,options:n,path:t})):Object.assign({errors:g,response:f},h)},w=async(e,r)=>{const t=o(r||{},[]),s=t.body?JSON.stringify(t.body):void 0,i=t.method||"GET",a=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers),c=Object.assign(Object.assign({},t),{body:"GET"===i?void 0:s,headers:a,method:i}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return d(e,"info"),m({basePathType:l||n,options:c,path:e})},g=(o,...e)=>{d(o,"error",...e)},f=["jsdelivr","cdnjs","unpkg","vercel"],h=o=>{if(!o)return null;const e=new URL(o).searchParams.get("zonosQaUrl");if(!e)return null;return/[^a-zA-Z0-9-_]+/.test(e)?null:e},y=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,v=new RegExp(`^${y.source}$`),S=new RegExp(`^cart_${y.source}$`),Z=o=>o?S.test(o)?{isDgsCartId:!0,isLegacyCartId:!1}:v.test(o)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},L=async({cartId:o,retries:e})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:t}=await w("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),s=!t||r.length;return s&&e?(d("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:e}),await new Promise((o=>setTimeout(o,500))),L({cartId:o,retries:e-1})):s?null:t};var z;const O=(()=>{const o=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||o)return null;const e=h(window.location.href),n="https://v1.3.129.js.zonos.com";if(!e&&(n.includes("test.")||n.includes("test-")))return n;if(!e&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!e)return null;if("dev-elements"===e)return"https://dev.elements.zonos.com";const r=`https://${e}.preview.js.zonos.com`;return d(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const o=new URLSearchParams(window.location.search);o.delete("zonosQaUrl");const{pathname:e}=window.location,n=`${e}?${o.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),r})(),b=(()=>{const o=(o=>{if(!o)return null;const e=new URL(o).searchParams.get("zonosQaUrlApi");return e?/[^a-zA-Z0-9-_]+/.test(e)?null:e:null})(window.location.href),e=h(window.location.href),n=o||e;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.demo.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.demo.elements.zonos.com";if(!o)return null;const r=`https://${o}.route.js.zonos.com`;return d(`[ZONOS-WARNING] using '${r}' for serverless API`,"warn"),r})();class U{}z=U,U.isNpm=!1,U.isBigCommerce=!1,U.requested=!1,U.cartData=null,U.domain=window.location!=window.parent.location?document.referrer:document.location.hostname,U.version="v1.3.129",U.isLegacyCheckout=!1,U.legacyStoreLogo=null,U.legacyStoreFavicon=null,U.parallelLoadTimes=[],U.parallelLoadState="off",U.releaseDate="1731519280297",U.loadScriptLogHandler=async({cdnLoadTime:o,fallbackLoadTime:e,isError:n,metadata:r,scriptLoadUrl:t,storeId:s,type:i})=>{try{const o=window.performance.getEntriesByType("resource").find((o=>{const e=o;return e.name.includes(t)&&"script"===e.initiatorType}));null==o||o.transferSize;(async o=>{})((o&&(null==o?void 0:o.duration)>0?parseFloat(o.duration.toFixed(2)):parseFloat(e.toFixed(2)),Object.assign({decodedBodySize:null==o?void 0:o.decodedBodySize,encodedBodySize:null==o?void 0:o.encodedBodySize,fallbackLoadTime:e,isError:!!n},r)))}catch(o){}},U.loadScriptLogParallelHandler=async o=>{try{if(z.parallelLoadTimes.push(o),2===z.parallelLoadTimes.length){const o=z.parallelLoadTimes.find((o=>"vercel"===o.type)),e=z.parallelLoadTimes.find((o=>"jsdelivr"===o.type));if(!o||!e)return;if(o.isError&&e.isError)return void l({endpoint:`<${o.scriptLoadUrl}> <${e.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:e.fallbackLoadTime,cdnType:e.type,vercelLoadTime:o.fallbackLoadTime}});z.loadScriptLogHandler({cdnLoadTime:e.fallbackLoadTime,fallbackLoadTime:o.fallbackLoadTime,isError:o.isError,metadata:{cdnScriptFallbackTime:e.fallbackLoadTime,cdnScriptIsError:!!e.isError,cdnScriptLoadUrl:e.scriptLoadUrl,cdnScriptType:e.type},scriptLoadUrl:o.scriptLoadUrl,storeId:o.storeId,type:o.type})}}catch(o){}},U.legacyCheckoutErrorHandler=({message:o,metadata:e})=>{g(`[ZONOS - loadZonos] ${o}`),l({endpoint:"LegacyCheckoutInit",errors:[o],metadata:Object.assign(Object.assign({},e),{tempCartUUID:z.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:o}))},U.getGithubCdn=({type:o,version:e})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.129";"cdnjs"===o?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.129":"unpkg"===o&&(n="https://unpkg.com/@zonos/elements@1.3.129");return e&&"alpha"!==e?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${e}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${e}`):n},U.injectZonos=({cdnType:o="jsdelivr",initConfig:e,parallelLoaded:n,vercelUrl:r,version:t})=>{var s;t&&(window.Zonos.version=`v${t}`);const i="vercel"===o?r:z.getGithubCdn({type:o,version:t}),a=O||i,c=a.replace("https://","").replace("http://",""),p=document.createElement("script"),u=t&&t<"1.2.5"?"loadZonos.js":"zonos.js";p.src=`https://${c}/dist/scripts/${u}`,d(`[ZONOS - loadZonos] Injecting "${u}" from "${c}"`,"info");const m="4g"===(null===(s=(()=>{const o="connection"in window.navigator?window.navigator.connection:null,e="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return o||e||n})())||void 0===s?void 0:s.effectiveType),w=["dev.elements.zonos.com","zonos.com"].some((o=>window.location.href.includes(o))),g=f[0]===o,h=f[1],y="on"===z.parallelLoadState&&m&&g&&h&&!w;y&&z.injectZonos({cdnType:h,initConfig:e,parallelLoaded:!0,vercelUrl:r,version:t});const v=performance.now();p.addEventListener("load",(()=>{var r;if(y||n?z.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:p.src,storeId:z.storeId,type:o}):z.loadScriptLogHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:p.src,storeId:z.storeId,type:o}),z.isBigCommerce||(z.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=O,window.Zonos.zonosQaUrlApi=b,window.Zonos.isBigCommerce=z.isBigCommerce,z.cartId){if(!z.zonosApiKey)throw z.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!z.cartData)throw z.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(z.legacyStoreFavicon&&z.isLegacyCheckout){const o=document.createElement("link");o.rel="shortcut icon",o.type="image/x-icon",o.href=z.legacyStoreFavicon,document.head.appendChild(o)}window.Zonos.cartData=z.cartData,window.Zonos.isLegacyCheckout=z.isLegacyCheckout;const o=z.isLegacyCheckout&&"CLOSE_MODAL"===(null===(r=e.checkoutSettings)||void 0===r?void 0:r.successBehavior),n=Object.assign(Object.assign({},e),{appearance:Object.assign(Object.assign({},e.appearance),{logoUrl:z.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},e.checkoutSettings),{successBehavior:o?"ZONOS_SUCCESS_PAGE":void 0,successRedirectUrl:o?z.cartData.storeBaseUrl:void 0}),zonosApiKey:z.zonosApiKey});e=n}window.Zonos.version&&(d(`[ZONOS - loadZonos] Execute "Zonos.init" from "${u}" from "${c}"`,"info"),window.Zonos.init(e))})),p.addEventListener("error",(async()=>{const s=(o=>{const e=f.indexOf(o);return f[e+1]||null})(o);if(!y&&!n){if(!s)return;z.injectZonos({cdnType:s,initConfig:e,vercelUrl:r,version:t})}if(["localhost",".zonos.com"].some((o=>window.location.href.includes(o)))||O)return;if(y||n)return void z.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,isError:!0,scriptLoadUrl:p.src,storeId:z.storeId,type:o});["unpkg","cdnjs","vercel"].includes(o)?l({endpoint:p.src,errors:[`zonos.js - Failed to fetch ${o} CDN.`],metadata:{cdnLoadTime:performance.now()-v,cdnType:o,loadUrl:a,version:t},shouldPostReleaseErrorReporting:!!s}):l({endpoint:p.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:o,vercelLoadTime:performance.now()-v}})})),document.head.appendChild(p)},U.init=async o=>{var e;if(O&&!window.isZonosPreview){d(`[ZONOS - loadZonos] Re-inject "loadZonos.js" from zonosQaUrl: ${O}`,"info");const e=document.createElement("script");return e.src=`${O}/dist/scripts/loadZonos.js?timestamp=${Date.now()}`,document.head.appendChild(e),e.addEventListener("load",(()=>{window.Zonos.isNpm=!1,window.Zonos.isBigCommerce=z.isBigCommerce,window.Zonos.isLegacyCheckout=z.isLegacyCheckout,window.Zonos.init(o)})),e.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${O}`)})),void(window.isZonosPreview=!0)}const n=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:r,isLegacyCartId:t}=Z(n);if(n&&!t&&!r)return void z.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${n}`,metadata:{invalidCartId:!0}});z.cartId=n;const s="https://v1.3.129.js.zonos.com",i=document.querySelector('script[src*="/zonos.js"]'),a=null===(e=document.querySelector("script[src*='/loadZonos.js']"))||void 0===e?void 0:e.src;d(`[ZONOS - init] first load script src: ${a}`,"info"),window.Zonos.zonosQaUrl=O,window.Zonos.zonosQaUrlApi=b,window.Zonos.zonosQaUrl&&d(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&d(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const c=null==a?void 0:a.includes("timestamp=");if(!(z.isNpm||a&&c))return void g("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(i||!a||z.requested)return void d("[ZONOS - loadZonos] script is already loaded or requested","info");if(!o.zonosApiKey&&!z.cartId)return z.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void g("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(z.requested=!0,z.zonosApiKey=o.zonosApiKey,z.storeId=o.storeId,z.cartId){const o=await(async o=>{const{isDgsCartId:e,isLegacyCartId:n}=Z(o);if(!n&&!e)return g("[ZONOS - loadZonos] invalid cart id"),null;const r=await L({cartId:o,retries:5});return d("[ZONOS - loadZonos] getting temp cart data","info",r),r?{cartData:r.cartData,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}:(g("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(z.cartId);if(!o)throw z.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");z.cartData=o.cartData,z.zonosApiKey=o.zonosApiKey,z.legacyStoreLogo=o.storeLogo,z.legacyStoreFavicon=o.storeFavicon,z.storeId=o.storeId,z.zonosApiKey=o.zonosApiKey}if(!z.zonosApiKey)return void g('"zonosApiKey" is required to initialize Zonos');if(!z.storeId)return d("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void z.injectZonos({initConfig:o,vercelUrl:s,version:null});const l=z.storeId||o.storeId;d(`[ZONOS - loadZonos] Store ID: ${l}`,"info");const p=new URLSearchParams;p.set("storeId",l.toString()),window.location.search.includes("_enableStoreVersionPinned=1")&&p.set("_enableStoreVersionPinned","1");const{errors:u,json:m}=await w(`/api/get-store-version?${p.toString()}`);if(u.length||!m)return d("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void z.injectZonos({initConfig:o,vercelUrl:s,version:null});const{isDifferent:f,source:h,version:y}=m;if(d(`[ZONOS - loadZonos] Store version: ${y}, source: ${h}`,"info"),f){d(`[ZONOS - loadZonos] Updating saved store version to ${y}`,"info");const o={storeId:l,version:y};w(`/api/set-store-version?${p.toString()}`,{body:o,method:"POST"}).catch((o=>g("Unable to save store's vesrion",o)))}if(!i){const{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:r}=(({loadScriptSrc:o})=>{if(!o)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const e=new URL(o).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((o=>e.includes(o))),r=["qa.js.zonos.com"].some((o=>e.includes(o)));return{currentLoadScriptUrl:e,isForceLoadVersionDomain:r,isWhiteListed:n}})({loadScriptSrc:a}),t=r&&!n?e:`${"alpha"===y?"alpha":`v${y}`}.js.zonos.com`,s=r&&!n?null:y;d("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:r,loadUrl:t,loadVersion:s,version:y}),z.injectZonos({initConfig:o,vercelUrl:t,version:s})}},void 0===window.Zonos&&(window.Zonos=U)})();
|
|
1
|
+
(function(){"use strict";function o(o,e){var n={};for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&e.indexOf(r)<0&&(n[r]=o[r]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(r=Object.getOwnPropertySymbols(o);t<r.length;t++)e.indexOf(r[t])<0&&Object.prototype.propertyIsEnumerable.call(o,r[t])&&(n[r[t]]=o[r[t]])}return n}"function"==typeof SuppressedError&&SuppressedError;const e=["cloudflare","vercel"],n=e[0],r={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},t=r[n],s=(o=n)=>{const r=e.indexOf(o),t=e[r+1];return t||null},i=o=>{if("string"==typeof o)try{return JSON.parse(o)}catch(o){return null}return null},a=performance.now(),c=o=>{if("string"==typeof o)return o;try{return JSON.stringify(o)}catch(e){if(o&&"function"==typeof o.toString){return o.toString()}return"Unable to stringify info"}},d=(o,e,...n)=>{var r,t;const{elapsedTimePretty:s}=(()=>{const o=performance.now()-a,e=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:e}})(),i=[`(${s})`,...n];i.map(c).join(" ");if(!(!!(null===(r=window.Zonos)||void 0===r?void 0:r.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===e&&console.error(o,...i));let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const l=(null===(t=d.contentWindow)||void 0===t?void 0:t.window.console)||window.console;switch(e){case"warn":l.warn(o,...i);break;case"info":l.info(o,...i);break;case"error":l.error(o,...i);break;default:l.groupCollapsed(o,...i),l.trace(),l.groupEnd()}},l=async({endpoint:o,errors:e,metadata:n,shouldPostReleaseErrorReporting:i})=>{if(d("sendErrorLog","warn",o,n,e),i){const o=Number(window.Zonos.releaseDate);if((new Date).getTime()-o>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,c={endpoint:o,errors:e,href:window.location.href,metadata:Object.assign({domain:window.Zonos.domain,userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},n)};try{fetch(`${t}/api/zonos-elements/log-error`,{body:JSON.stringify(c),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(o){const e=s();if(!e)return;fetch(`${r[e]}/api/zonos-elements/log-error`,{body:JSON.stringify(c),method:"POST"})}},p=async({response:o,shouldLog:e=!0,shouldThrow:n=!1})=>{try{const e=await o.text(),n=i(e);if(!n)throw new Error(`Failed to parse content: ${e}`);return n}catch(o){if(n)throw o;return e&&console.error(o),null}},u=async({basePathType:o,options:e,path:t})=>{let s;const i=window.Zonos.zonosQaUrlApi||r[o]||n,a=new URL(i+t),c=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;a.searchParams.set("zToken",(o=>{try{return btoa(o).replace(/=/g,"")}catch(e){return o.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(c));try{s=await fetch(a.toString(),e)}catch(o){if(o instanceof Error)return{baseUrl:i,errors:[{message:o.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const d=s.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&d&&l&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await p({response:s}),response:s,zonosMode:d}}const u=s.status.toString();try{const o=await p({response:s,shouldThrow:!0});return{baseUrl:i,errors:[{message:JSON.stringify(o),type:u}],json:null,response:s,zonosMode:d}}catch(o){return{baseUrl:i,errors:[{message:`${u}: ${"Unknown error"}`,type:u}],json:null,response:null,zonosMode:d}}},m=async({basePathType:e,options:n,path:t})=>{var a,c;const p=t.startsWith("/api/bigcommerce")?"vercel":e,w=await u({basePathType:p,options:n,path:t}),{errors:g,response:f}=w,h=o(w,["errors","response"]),y=s(p),v=!!g.find((({type:o})=>"unknown"===o))||404===(null==f?void 0:f.status),S=y&&v;return v&&l({endpoint:r[p]+t,errors:g.map((({message:o})=>`API: ${o}`)),metadata:{currentBasePath:p,nextFallbackApiType:y,requestHeaders:null==n?void 0:n.headers,requestPayload:i(null===(a=null==n?void 0:n.body)||void 0===a?void 0:a.toString())||(null===(c=null==n?void 0:n.body)||void 0===c?void 0:c.toString()),status:null==f?void 0:f.status,statusText:null==f?void 0:f.statusText},shouldPostReleaseErrorReporting:!0}),S?(d(`=== "${t}" failed to fetch, trying next fallback ${y}`),m({basePathType:y,options:n,path:t})):Object.assign({errors:g,response:f},h)},w=async(e,r)=>{const t=o(r||{},[]),s=t.body?JSON.stringify(t.body):void 0,i=t.method||"GET",a=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers),c=Object.assign(Object.assign({},t),{body:"GET"===i?void 0:s,headers:a,method:i}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return d(e,"info"),m({basePathType:l||n,options:c,path:e})},g=(o,...e)=>{d(o,"error",...e)},f=["jsdelivr","cdnjs","unpkg","vercel"],h=o=>{if(!o)return null;const e=new URL(o).searchParams.get("zonosQaUrl");if(!e)return null;return/[^a-zA-Z0-9-_]+/.test(e)?null:e},y=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,v=new RegExp(`^${y.source}$`),S=new RegExp(`^cart_${y.source}$`),Z=o=>o?S.test(o)?{isDgsCartId:!0,isLegacyCartId:!1}:v.test(o)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},z=async({cartId:o,retries:e})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:t}=await w("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),s=!t||r.length;return s&&e?(d("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:e}),await new Promise((o=>setTimeout(o,500))),z({cartId:o,retries:e-1})):s?null:t};var L;const O=(()=>{const o=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||o)return null;const e=h(window.location.href),n="https://v1.3.130.js.zonos.com";if(!e&&(n.includes("test.")||n.includes("test-")))return n;if(!e&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!e)return null;if("dev-elements"===e)return"https://dev.elements.zonos.com";const r=`https://${e}.preview.js.zonos.com`;return d(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const o=new URLSearchParams(window.location.search);o.delete("zonosQaUrl");const{pathname:e}=window.location,n=`${e}?${o.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),r})(),b=(()=>{const o=(o=>{if(!o)return null;const e=new URL(o).searchParams.get("zonosQaUrlApi");return e?/[^a-zA-Z0-9-_]+/.test(e)?null:e:null})(window.location.href),e=h(window.location.href),n=o||e;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.demo.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.demo.elements.zonos.com";if(!o)return null;const r=`https://${o}.route.js.zonos.com`;return d(`[ZONOS-WARNING] using '${r}' for serverless API`,"warn"),r})();class U{}L=U,U.isNpm=!1,U.isBigCommerce=!1,U.requested=!1,U.cartData=null,U.domain=window.location!=window.parent.location?document.referrer:document.location.hostname,U.version="v1.3.130",U.isLegacyCheckout=!1,U.legacyStoreLogo=null,U.legacyStoreFavicon=null,U.parallelLoadTimes=[],U.parallelLoadState="off",U.releaseDate="1732051119768",U.loadScriptLogHandler=async({cdnLoadTime:o,fallbackLoadTime:e,isError:n,metadata:r,scriptLoadUrl:t,storeId:s,type:i})=>{try{const o=window.performance.getEntriesByType("resource").find((o=>{const e=o;return e.name.includes(t)&&"script"===e.initiatorType}));null==o||o.transferSize;(async o=>{})((o&&(null==o?void 0:o.duration)>0?parseFloat(o.duration.toFixed(2)):parseFloat(e.toFixed(2)),Object.assign({decodedBodySize:null==o?void 0:o.decodedBodySize,encodedBodySize:null==o?void 0:o.encodedBodySize,fallbackLoadTime:e,isError:!!n},r)))}catch(o){}},U.loadScriptLogParallelHandler=async o=>{try{if(L.parallelLoadTimes.push(o),2===L.parallelLoadTimes.length){const o=L.parallelLoadTimes.find((o=>"vercel"===o.type)),e=L.parallelLoadTimes.find((o=>"jsdelivr"===o.type));if(!o||!e)return;if(o.isError&&e.isError)return void l({endpoint:`<${o.scriptLoadUrl}> <${e.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:e.fallbackLoadTime,cdnType:e.type,vercelLoadTime:o.fallbackLoadTime}});L.loadScriptLogHandler({cdnLoadTime:e.fallbackLoadTime,fallbackLoadTime:o.fallbackLoadTime,isError:o.isError,metadata:{cdnScriptFallbackTime:e.fallbackLoadTime,cdnScriptIsError:!!e.isError,cdnScriptLoadUrl:e.scriptLoadUrl,cdnScriptType:e.type},scriptLoadUrl:o.scriptLoadUrl,storeId:o.storeId,type:o.type})}}catch(o){}},U.legacyCheckoutErrorHandler=({message:o,metadata:e})=>{g(`[ZONOS - loadZonos] ${o}`),l({endpoint:"LegacyCheckoutInit",errors:[o],metadata:Object.assign(Object.assign({},e),{tempCartUUID:L.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:o}))},U.getGithubCdn=({type:o,version:e})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.130";"cdnjs"===o?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.130":"unpkg"===o&&(n="https://unpkg.com/@zonos/elements@1.3.130");return e&&"alpha"!==e?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${e}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${e}`):n},U.injectZonos=({cdnType:o="jsdelivr",initConfig:e,parallelLoaded:n,vercelUrl:r,version:t})=>{var s;t&&(window.Zonos.version=`v${t}`);const i="vercel"===o?r:L.getGithubCdn({type:o,version:t}),a=O||i,c=a.replace("https://","").replace("http://",""),p=document.createElement("script"),u=t&&t<"1.2.5"?"loadZonos.js":"zonos.js";p.src=`https://${c}/dist/scripts/${u}`,d(`[ZONOS - loadZonos] Injecting "${u}" from "${c}"`,"info");const m="4g"===(null===(s=(()=>{const o="connection"in window.navigator?window.navigator.connection:null,e="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return o||e||n})())||void 0===s?void 0:s.effectiveType),w=["dev.elements.zonos.com","zonos.com"].some((o=>window.location.href.includes(o))),g=f[0]===o,h=f[1],y="on"===L.parallelLoadState&&m&&g&&h&&!w;y&&L.injectZonos({cdnType:h,initConfig:e,parallelLoaded:!0,vercelUrl:r,version:t});const v=performance.now();p.addEventListener("load",(()=>{var r;if(y||n?L.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:p.src,storeId:L.storeId,type:o}):L.loadScriptLogHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:p.src,storeId:L.storeId,type:o}),L.isBigCommerce||(L.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=O,window.Zonos.zonosQaUrlApi=b,window.Zonos.isBigCommerce=L.isBigCommerce,L.cartId){if(!L.zonosApiKey)throw L.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!L.cartData)throw L.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(L.legacyStoreFavicon&&L.isLegacyCheckout){const o=document.createElement("link");o.rel="shortcut icon",o.type="image/x-icon",o.href=L.legacyStoreFavicon,document.head.appendChild(o)}window.Zonos.cartData=L.cartData,window.Zonos.isLegacyCheckout=L.isLegacyCheckout;const o=L.isLegacyCheckout&&"CLOSE_MODAL"===(null===(r=e.checkoutSettings)||void 0===r?void 0:r.successBehavior),n=Object.assign(Object.assign({},e),{appearance:Object.assign(Object.assign({},e.appearance),{logoUrl:L.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},e.checkoutSettings),{successBehavior:o?"ZONOS_SUCCESS_PAGE":void 0,successRedirectUrl:o?L.cartData.storeBaseUrl:void 0}),zonosApiKey:L.zonosApiKey});e=n}window.Zonos.version&&(d(`[ZONOS - loadZonos] Execute "Zonos.init" from "${u}" from "${c}"`,"info"),window.Zonos.init(e))})),p.addEventListener("error",(async()=>{const s=(o=>{const e=f.indexOf(o);return f[e+1]||null})(o);if(!y&&!n){if(!s)return;L.injectZonos({cdnType:s,initConfig:e,vercelUrl:r,version:t})}if(["localhost",".zonos.com"].some((o=>window.location.href.includes(o)))||O)return;if(y||n)return void L.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,isError:!0,scriptLoadUrl:p.src,storeId:L.storeId,type:o});["unpkg","cdnjs","vercel"].includes(o)?l({endpoint:p.src,errors:[`zonos.js - Failed to fetch ${o} CDN.`],metadata:{cdnLoadTime:performance.now()-v,cdnType:o,loadUrl:a,version:t},shouldPostReleaseErrorReporting:!!s}):l({endpoint:p.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:o,vercelLoadTime:performance.now()-v}})})),document.head.appendChild(p)},U.init=async o=>{var e;if(d("=== Init zonos script release date","info",L.releaseDate),O&&!window.isZonosPreview){d(`[ZONOS - loadZonos] Re-inject "loadZonos.js" from zonosQaUrl: ${O}`,"info");const e=document.createElement("script");return e.src=`${O}/dist/scripts/loadZonos.js?timestamp=${Date.now()}`,document.head.appendChild(e),e.addEventListener("load",(()=>{window.Zonos.isNpm=!1,window.Zonos.isBigCommerce=L.isBigCommerce,window.Zonos.isLegacyCheckout=L.isLegacyCheckout,window.Zonos.init(o)})),e.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${O}`)})),void(window.isZonosPreview=!0)}const n=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:r,isLegacyCartId:t}=Z(n);if(n&&!t&&!r)return void L.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${n}`,metadata:{invalidCartId:!0}});L.cartId=n;const s="https://v1.3.130.js.zonos.com",i=document.querySelector('script[src*="/zonos.js"]'),a=null===(e=document.querySelector("script[src*='/loadZonos.js']"))||void 0===e?void 0:e.src;d(`[ZONOS - init] first load script src: ${a}`,"info"),window.Zonos.zonosQaUrl=O,window.Zonos.zonosQaUrlApi=b,window.Zonos.zonosQaUrl&&d(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&d(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const c=null==a?void 0:a.includes("timestamp=");if(!(L.isNpm||a&&c))return void g("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(i||!a||L.requested)return void d("[ZONOS - loadZonos] script is already loaded or requested","info");if(!o.zonosApiKey&&!L.cartId)return L.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void g("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(L.requested=!0,L.zonosApiKey=o.zonosApiKey,L.storeId=o.storeId,L.cartId){const o=await(async o=>{const{isDgsCartId:e,isLegacyCartId:n}=Z(o);if(!n&&!e)return g("[ZONOS - loadZonos] invalid cart id"),null;const r=await z({cartId:o,retries:5});return d("[ZONOS - loadZonos] getting temp cart data","info",r),r?(window.Zonos.storeId=r.cartData.storeId,window.Zonos.zonosApiKey=r.cartData.credentialToken,{cartData:r.cartData,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}):(g("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(L.cartId);if(!o)throw L.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");L.cartData=o.cartData,L.zonosApiKey=o.zonosApiKey,L.legacyStoreLogo=o.storeLogo,L.legacyStoreFavicon=o.storeFavicon,L.storeId=o.storeId,L.zonosApiKey=o.zonosApiKey}if(!L.zonosApiKey)return void g('"zonosApiKey" is required to initialize Zonos');if(!L.storeId)return d("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void L.injectZonos({initConfig:o,vercelUrl:s,version:null});const l=L.storeId||o.storeId;d(`[ZONOS - loadZonos] Store ID: ${l}`,"info");const p=new URLSearchParams;p.set("storeId",l.toString()),window.location.search.includes("_enableStoreVersionPinned=1")&&p.set("_enableStoreVersionPinned","1");const{errors:u,json:m}=await w(`/api/get-store-version?${p.toString()}`);if(u.length||!m)return d("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void L.injectZonos({initConfig:o,vercelUrl:s,version:null});const{isDifferent:f,source:h,version:y}=m;if(d(`[ZONOS - loadZonos] Store version: ${y}, source: ${h}`,"info"),f){d(`[ZONOS - loadZonos] Updating saved store version to ${y}`,"info");const o={storeId:l,version:y};w(`/api/set-store-version?${p.toString()}`,{body:o,method:"POST"}).catch((o=>g("Unable to save store's vesrion",o)))}if(!i){const{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:r}=(({loadScriptSrc:o})=>{if(!o)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const e=new URL(o).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((o=>e.includes(o))),r=["qa.js.zonos.com"].some((o=>e.includes(o)));return{currentLoadScriptUrl:e,isForceLoadVersionDomain:r,isWhiteListed:n}})({loadScriptSrc:a}),t=r&&!n?e:`${"alpha"===y?"alpha":`v${y}`}.js.zonos.com`,s=r&&!n?null:y;d("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:r,loadUrl:t,loadVersion:s,version:y}),L.injectZonos({initConfig:o,vercelUrl:t,version:s})}},(void 0===window.Zonos||window.isZonosPreview)&&(window.Zonos=U)})();
|
package/dist/scripts/zonos.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=performance.now(),o=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},t=(t,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const o=performance.now()-e,t=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:t}})(),l=[`(${a})`,...r];l.map(o).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(t,...l));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(t,...l);break;case"info":d.info(t,...l);break;case"error":d.error(t,...l);break;default:d.groupCollapsed(t,...l),d.trace(),d.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const o=r.indexOf(e);return r[o+1]||null},a=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),n="https://v1.3.129.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),r},l="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${l}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&c.test(t.src))return t}return null})();r&&e?console.warn(d):r||(r=(e=>{const o=document.createElement("script");o.src=`${l}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),u),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function w(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const y=["cloudflare","vercel"],g=y[0],f={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},v=f[g],b=(e=g)=>{const o=y.indexOf(e),t=y[o+1];return t||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=S(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},j=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||f[e]||g,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:a}}const c=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:c}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${c}: ${"Unknown error"}`,type:c}],json:null,response:null,zonosMode:a}}},O=async({basePathType:e,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=await j({basePathType:i,options:o,path:n}),{errors:l,response:c}=a,d=w(a,["errors","response"]),u=b(i),p=!!l.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(t("sendErrorLog","warn",e,n,o),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({domain:window.Zonos.domain,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=b();if(!o)return;fetch(`${f[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:f[i]+n,errors:l.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==o?void 0:o.headers,requestPayload:S(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(t(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:o,path:n})):Object.assign({errors:l,response:c},d)},C=async({cartId:e,retries:o})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:s}=await(async(e,o)=>{const n=w(o||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),a=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return t(e,"info"),O({basePathType:l||g,options:a,path:e})})("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&o?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),C({cartId:e,retries:o-1})):i?null:s},Z=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,E=new RegExp(`^${Z.source}$`),I=new RegExp(`^cart_${Z.source}$`),k=async e=>{const{isDgsCartId:o,isLegacyCartId:r}=(e=>e?I.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:E.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!o)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await C({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var $;const A=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),T="https://v1.3.129.js.zonos.com",U=A||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.129",L="https://rsms.me",P="https://fonts.googleapis.com",N=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class D{}$=D,D.doneInit=!1,D.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),D.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),D._paypalMockResponse=null,D.isBigCommerce=!1,D.releaseDate="1731519280297",D.isLegacyCheckout=!1,D.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",D.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),D.isNpm=!0,D.zonosQaUrl=null,D.zonosQaUrlApi=null,D.version="v1.3.129",D.modeAlerted=!1,D.cartData=null,D.paypal=null,D.getCurrentTimestamp=()=>(new Date).getTime(),D.zonosController=null,D.init=async e=>{const{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:c,storeId:d,zonosApiKey:u}=e;if($.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!$.doneInit){if(t(`====== ZONOS DEBUG MODE: on (${$.version}) ======`),$.zonosApiKey=u,$.storeId=d,$.isNpm){t("====== ZONOS LOADING FROM NPM ======");const o=a();if(o&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const n=document.createElement("script");return n.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=$.isNpm,window.Zonos.isBigCommerce=$.isBigCommerce,window.Zonos.isLegacyCheckout=$.isLegacyCheckout,window.Zonos.init(e)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!u&&!$.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!$.cartData&&$.cartId){t("Initialize cart data");const e=await k($.cartId);if(!e)return void n("Failed to get cart data");$.cartData=e.cartData,$.zonosApiKey=e.zonosApiKey}}if($.cartId&&$.cartData){t("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}t("init zonos"),$.injectZonosCdn(),$.injectZonosCss(),$.injectFonts(),$.injectController({config:{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:c}}),$.doneInit=!0}},D.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},D.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},D.showNotification=e=>{var o;null===(o=$.zonosController)||void 0===o||o.showNotification(e)},D.updateOrganizationName=e=>{var o;null===(o=$.zonosController)||void 0===o||o.updateOrganizationName(e)},D.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},D.injectController=({config:e})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;$.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{$.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=$.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const s=await(async(...e)=>{h=!0;const o=Date.now();return m.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),$.zonosController=r,t("Zonos controller injected!")},D.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${$.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,l=document.createElement("script");o?l.type="module":l.noModule=!0,l.src=s,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const t=i(e);t&&$.injectScript({cdnType:t,isModule:o,theRestUrl:r})},a.appendChild(l)},D.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return U;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.129";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.129";case"vercel":return T}};if($.isNpm){return a()||o()}return o()},D.injectZonosCdn=()=>{$.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),$.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},D.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=$.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${T}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${t}/${o}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const t=i(e);t&&$.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(a)},D.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):($.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},D.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${L}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!N.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=L,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${L}/inter/inter.css`,e.appendChild(n),t("Zonos font injected!")},D.setupGoogleFont=e=>{var o;null===(o=$.zonosController)||void 0===o||o.setupGoogleFont(e)},D.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${P}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=P,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=D)})();
|
|
1
|
+
(function(){"use strict";const e=performance.now(),o=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},t=(t,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const o=performance.now()-e,t=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:t}})(),l=[`(${a})`,...r];l.map(o).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(t,...l));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(t,...l);break;case"info":d.info(t,...l);break;case"error":d.error(t,...l);break;default:d.groupCollapsed(t,...l),d.trace(),d.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const o=r.indexOf(e);return r[o+1]||null},a=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),n="https://v1.3.130.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),r},l="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${l}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&c.test(t.src))return t}return null})();r&&e?console.warn(d):r||(r=(e=>{const o=document.createElement("script");o.src=`${l}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),u),m=Promise.resolve().then((()=>p(null)));let w=!1;m.catch((e=>{w||console.warn(e)}));function h(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const y=["cloudflare","vercel"],g=y[0],f={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},v=f[g],b=(e=g)=>{const o=y.indexOf(e),t=y[o+1];return t||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=S(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},j=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||f[e]||g,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:a}}const c=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:c}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${c}: ${"Unknown error"}`,type:c}],json:null,response:null,zonosMode:a}}},O=async({basePathType:e,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=await j({basePathType:i,options:o,path:n}),{errors:l,response:c}=a,d=h(a,["errors","response"]),u=b(i),p=!!l.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(t("sendErrorLog","warn",e,n,o),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({domain:window.Zonos.domain,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=b();if(!o)return;fetch(`${f[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:f[i]+n,errors:l.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==o?void 0:o.headers,requestPayload:S(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(t(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:o,path:n})):Object.assign({errors:l,response:c},d)},C=async({cartId:e,retries:o})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:s}=await(async(e,o)=>{const n=h(o||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),a=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return t(e,"info"),O({basePathType:l||g,options:a,path:e})})("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&o?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),C({cartId:e,retries:o-1})):i?null:s},Z=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,E=new RegExp(`^${Z.source}$`),I=new RegExp(`^cart_${Z.source}$`),k=async e=>{const{isDgsCartId:o,isLegacyCartId:r}=(e=>e?I.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:E.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!o)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await C({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var $;const A=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),T="https://v1.3.130.js.zonos.com",U=A||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.130",L="https://rsms.me",P="https://fonts.googleapis.com",N=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class D{}$=D,D.doneInit=!1,D.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),D.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),D._paypalMockResponse=null,D.isBigCommerce=!1,D.releaseDate="1732051119768",D.isLegacyCheckout=!1,D.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",D.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),D.isNpm=!0,D.zonosQaUrl=null,D.zonosQaUrlApi=null,D.version="v1.3.130",D.modeAlerted=!1,D.cartData=null,D.paypal=null,D.getCurrentTimestamp=()=>(new Date).getTime(),D.zonosController=null,D.init=async e=>{const{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:c,storeId:d,zonosApiKey:u}=e;if($.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!$.doneInit){if(t(`====== ZONOS DEBUG MODE: on (${$.version}) ======`),$.zonosApiKey=u,$.storeId=d,$.isNpm){t("====== ZONOS LOADING FROM NPM ======");const o=a();if(o&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const n=document.createElement("script");return n.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=$.isNpm,window.Zonos.isBigCommerce=$.isBigCommerce,window.Zonos.isLegacyCheckout=$.isLegacyCheckout,window.Zonos.init(e)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!u&&!$.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!$.cartData&&$.cartId){t("Initialize cart data");const e=await k($.cartId);if(!e)return void n("Failed to get cart data");$.cartData=e.cartData,$.zonosApiKey=e.zonosApiKey}}if($.cartId&&$.cartData){t("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}t("init zonos"),$.injectZonosCdn(),$.injectZonosCss(),$.injectFonts(),$.injectController({config:{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:c}}),$.doneInit=!0}},D.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},D.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},D.showNotification=e=>{var o;null===(o=$.zonosController)||void 0===o||o.showNotification(e)},D.updateOrganizationName=e=>{var o;null===(o=$.zonosController)||void 0===o||o.updateOrganizationName(e)},D.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},D.injectController=({config:e})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;$.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{$.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=$.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const s=await(async(...e)=>{w=!0;const o=Date.now();return m.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),$.zonosController=r,t("Zonos controller injected!")},D.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${$.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,l=document.createElement("script");o?l.type="module":l.noModule=!0,l.src=s,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const t=i(e);t&&$.injectScript({cdnType:t,isModule:o,theRestUrl:r})},a.appendChild(l)},D.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return U;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.130";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.130";case"vercel":return T}};if($.isNpm){return a()||o()}return o()},D.injectZonosCdn=()=>{$.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),$.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},D.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=$.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${T}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${t}/${o}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const t=i(e);t&&$.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(a)},D.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):($.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},D.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${L}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!N.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=L,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${L}/inter/inter.css`,e.appendChild(n),t("Zonos font injected!")},D.setupGoogleFont=e=>{var o;null===(o=$.zonosController)||void 0===o||o.setupGoogleFont(e)},D.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${P}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=P,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=D)})();
|
|
@@ -56,6 +56,10 @@ export declare class ZonosCheckout {
|
|
|
56
56
|
* Confirm dialog open state
|
|
57
57
|
*/
|
|
58
58
|
confirmDialogOpen: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Cart expired state to show the cart expired dialog
|
|
61
|
+
*/
|
|
62
|
+
isCartExpired: boolean;
|
|
59
63
|
/**
|
|
60
64
|
* Error message from onInventoryCheck callback
|
|
61
65
|
*/
|
|
@@ -79,6 +83,10 @@ export declare class ZonosCheckout {
|
|
|
79
83
|
confirmed: boolean;
|
|
80
84
|
}): Promise<void>;
|
|
81
85
|
private applyStripeTheme;
|
|
86
|
+
/**
|
|
87
|
+
* Check if the cart is expired, return `true` if the cart is expired
|
|
88
|
+
*/
|
|
89
|
+
private handleCartExpiredCheck;
|
|
82
90
|
private buildCartAndInit;
|
|
83
91
|
private reloadCheckoutSession;
|
|
84
92
|
private handleOrderDuplication;
|
|
@@ -107,6 +115,7 @@ export declare class ZonosCheckout {
|
|
|
107
115
|
private handleCustomerInfoContinue;
|
|
108
116
|
private handleShippingContinue;
|
|
109
117
|
private handleInventoryCheckDialogConfirm;
|
|
118
|
+
private handleCartExpiredDialogConfirm;
|
|
110
119
|
private handleStripePaymentContinue;
|
|
111
120
|
private handleFinishClick;
|
|
112
121
|
private getCurrentLocalePageEnum;
|
|
@@ -185,6 +185,9 @@ export declare const stringsArabic: {
|
|
|
185
185
|
'Nothing due at the door': {
|
|
186
186
|
value: string;
|
|
187
187
|
};
|
|
188
|
+
OK: {
|
|
189
|
+
value: string;
|
|
190
|
+
};
|
|
188
191
|
'Order complete!': {
|
|
189
192
|
value: string;
|
|
190
193
|
};
|
|
@@ -299,6 +302,9 @@ export declare const stringsArabic: {
|
|
|
299
302
|
'Shipping method': {
|
|
300
303
|
value: string;
|
|
301
304
|
};
|
|
305
|
+
'Shopping cart expired': {
|
|
306
|
+
value: string;
|
|
307
|
+
};
|
|
302
308
|
Show: {
|
|
303
309
|
value: string;
|
|
304
310
|
};
|
|
@@ -380,6 +386,9 @@ export declare const stringsArabic: {
|
|
|
380
386
|
'Would you like to close checkout and return to the site?': {
|
|
381
387
|
value: string;
|
|
382
388
|
};
|
|
389
|
+
'You are being sent back to the shop to re-add items to your cart.': {
|
|
390
|
+
value: string;
|
|
391
|
+
};
|
|
383
392
|
'You may incur additional fees from the shipping carrier by not prepaying.': {
|
|
384
393
|
value: string;
|
|
385
394
|
};
|
|
@@ -185,6 +185,9 @@ export declare const stringsBase: {
|
|
|
185
185
|
'Nothing due at the door': {
|
|
186
186
|
value: string;
|
|
187
187
|
};
|
|
188
|
+
OK: {
|
|
189
|
+
value: string;
|
|
190
|
+
};
|
|
188
191
|
'Order complete!': {
|
|
189
192
|
value: string;
|
|
190
193
|
};
|
|
@@ -299,6 +302,9 @@ export declare const stringsBase: {
|
|
|
299
302
|
'Shipping method': {
|
|
300
303
|
value: string;
|
|
301
304
|
};
|
|
305
|
+
'Shopping cart expired': {
|
|
306
|
+
value: string;
|
|
307
|
+
};
|
|
302
308
|
Show: {
|
|
303
309
|
value: string;
|
|
304
310
|
};
|
|
@@ -380,6 +386,9 @@ export declare const stringsBase: {
|
|
|
380
386
|
'Would you like to close checkout and return to the site?': {
|
|
381
387
|
value: string;
|
|
382
388
|
};
|
|
389
|
+
'You are being sent back to the shop to re-add items to your cart.': {
|
|
390
|
+
value: string;
|
|
391
|
+
};
|
|
383
392
|
'You may incur additional fees from the shipping carrier by not prepaying.': {
|
|
384
393
|
value: string;
|
|
385
394
|
};
|
|
@@ -185,6 +185,9 @@ export declare const stringsChinese: {
|
|
|
185
185
|
'Nothing due at the door': {
|
|
186
186
|
value: string;
|
|
187
187
|
};
|
|
188
|
+
OK: {
|
|
189
|
+
value: string;
|
|
190
|
+
};
|
|
188
191
|
'Order complete!': {
|
|
189
192
|
value: string;
|
|
190
193
|
};
|
|
@@ -299,6 +302,9 @@ export declare const stringsChinese: {
|
|
|
299
302
|
'Shipping method': {
|
|
300
303
|
value: string;
|
|
301
304
|
};
|
|
305
|
+
'Shopping cart expired': {
|
|
306
|
+
value: string;
|
|
307
|
+
};
|
|
302
308
|
Show: {
|
|
303
309
|
value: string;
|
|
304
310
|
};
|
|
@@ -380,6 +386,9 @@ export declare const stringsChinese: {
|
|
|
380
386
|
'Would you like to close checkout and return to the site?': {
|
|
381
387
|
value: string;
|
|
382
388
|
};
|
|
389
|
+
'You are being sent back to the shop to re-add items to your cart.': {
|
|
390
|
+
value: string;
|
|
391
|
+
};
|
|
383
392
|
'You may incur additional fees from the shipping carrier by not prepaying.': {
|
|
384
393
|
value: string;
|
|
385
394
|
};
|