@zonos/elements 1.3.59 → 1.3.61
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/{cart-edf1ddc0.js → cart-22476910.js} +9 -5
- package/dist/cjs/{createCustomEvent-512ed4a5.js → createCustomEvent-f1848925.js} +2 -2
- package/dist/cjs/{getBorderRadius-a6a3b35e.js → getBorderRadius-5a64574c.js} +1 -1
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/{isDarkColor-7a056d05.js → isDarkColor-5efc8367.js} +1 -1
- package/dist/cjs/{paypal-570085f3.js → paypal-3c6fcdd7.js} +3 -3
- package/dist/cjs/zonos-address_8.cjs.entry.js +4 -4
- package/dist/cjs/zonos-badge_13.cjs.entry.js +6 -6
- 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-checkout.cjs.entry.js +6 -6
- 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-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-v-stack.cjs.entry.js +1 -1
- package/dist/cjs/{zonosStore-67139f0e.js → zonosStore-a4395972.js} +7 -4
- package/dist/collection/components/store/hello/localization.js +3 -1
- package/dist/collection/components/store/zonosStore.js +7 -4
- package/dist/collection/components/utils/hello/getZCountryUrlParam.js +3 -1
- package/dist/collection/types/generated/graphql.customer.types.js +16 -0
- package/dist/esm/{cart-70f3af44.js → cart-c2bd0e1d.js} +9 -5
- package/dist/esm/{createCustomEvent-887a44ea.js → createCustomEvent-540e5c74.js} +2 -2
- package/dist/esm/{getBorderRadius-23398fc6.js → getBorderRadius-cff1e39b.js} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/{isDarkColor-c927f77d.js → isDarkColor-b3afa948.js} +1 -1
- package/dist/esm/{paypal-86eba67d.js → paypal-96d0a3d0.js} +3 -3
- package/dist/esm/zonos-address_8.entry.js +4 -4
- package/dist/esm/zonos-badge_13.entry.js +6 -6
- 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-checkout.entry.js +6 -6
- 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-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-v-stack.entry.js +1 -1
- package/dist/esm/{zonosStore-473f4654.js → zonosStore-0dc7a947.js} +7 -4
- package/dist/esm-es5/{cart-70f3af44.js → cart-c2bd0e1d.js} +1 -1
- package/dist/esm-es5/{createCustomEvent-887a44ea.js → createCustomEvent-540e5c74.js} +1 -1
- package/dist/esm-es5/{getBorderRadius-23398fc6.js → getBorderRadius-cff1e39b.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{isDarkColor-c927f77d.js → isDarkColor-b3afa948.js} +1 -1
- package/dist/esm-es5/{paypal-86eba67d.js → paypal-96d0a3d0.js} +1 -1
- package/dist/esm-es5/zonos-address_8.entry.js +1 -1
- package/dist/esm-es5/zonos-badge_13.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-checkout.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-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-v-stack.entry.js +1 -1
- package/dist/esm-es5/{zonosStore-473f4654.js → zonosStore-0dc7a947.js} +1 -1
- package/dist/scripts/index.d.ts +1 -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/store/zonosStore.d.ts +5 -1
- package/dist/types/types/generated/graphql.customer.types.d.ts +25 -5
- package/dist/types/types/generated/graphql.customer.types.ts +29 -5
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-7ef2737b.system.entry.js → p-04553c97.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d16e0d7a.system.js → p-081ff323.system.js} +2 -2
- package/dist/zonos-elements/{p-a4d627b8.system.entry.js → p-08d50098.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-6ee0286a.system.js → p-094d1cd6.system.js} +1 -1
- package/dist/zonos-elements/{p-9dd6b00d.js → p-1086aac3.js} +1 -1
- package/dist/zonos-elements/{p-1c72e53f.system.entry.js → p-19fc5e11.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-0ac98033.system.js → p-1a940770.system.js} +1 -1
- package/dist/zonos-elements/p-1ca5696d.js +1 -0
- package/dist/zonos-elements/{p-77c2dd5c.entry.js → p-1cbc77c6.entry.js} +1 -1
- package/dist/zonos-elements/{p-4402dc5f.system.entry.js → p-227f082e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-20db26fd.entry.js → p-3007d9c6.entry.js} +1 -1
- package/dist/zonos-elements/{p-5f7f51bd.entry.js → p-30470eb7.entry.js} +1 -1
- package/dist/zonos-elements/{p-5e32f30b.entry.js → p-38b85799.entry.js} +1 -1
- package/dist/zonos-elements/{p-a4309beb.entry.js → p-41f42a5c.entry.js} +1 -1
- package/dist/zonos-elements/{p-09b19142.system.entry.js → p-44d15ef5.system.entry.js} +1 -1
- package/dist/zonos-elements/p-455b7545.system.js +1 -0
- package/dist/zonos-elements/{p-0b8e2e60.system.entry.js → p-4bae8815.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b0d02c6d.entry.js → p-55cc6046.entry.js} +1 -1
- package/dist/zonos-elements/{p-2fa0644e.entry.js → p-654b1660.entry.js} +1 -1
- package/dist/zonos-elements/{p-89d8c1ad.system.entry.js → p-698f7fd8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4b59ada6.system.entry.js → p-76faa16f.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-02e2d953.js → p-78f6354c.js} +1 -1
- package/dist/zonos-elements/{p-cf9a46e8.entry.js → p-7a4fc640.entry.js} +1 -1
- package/dist/zonos-elements/{p-9c07322c.system.entry.js → p-7b0a7afd.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-70bb4a25.entry.js → p-7be7bd28.entry.js} +1 -1
- package/dist/zonos-elements/{p-cee1293a.system.entry.js → p-869ee990.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-6dcef5ce.entry.js → p-8894c902.entry.js} +1 -1
- package/dist/zonos-elements/{p-7f0cea76.js → p-8a8fa05c.js} +1 -1
- package/dist/zonos-elements/{p-71c23712.system.entry.js → p-8cbaae6e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-29814fd7.system.js → p-91462d96.system.js} +1 -1
- package/dist/zonos-elements/{p-f619cb3b.entry.js → p-9972bc02.entry.js} +1 -1
- package/dist/zonos-elements/{p-a3547b34.system.entry.js → p-a033685e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-23a84835.js → p-a1b755bf.js} +1 -1
- package/dist/zonos-elements/{p-8e8defdc.system.js → p-b74ff880.system.js} +1 -1
- package/dist/zonos-elements/{p-f3811c4c.system.entry.js → p-ba05f1d6.system.entry.js} +1 -1
- package/dist/zonos-elements/p-ba76d50f.js +1 -0
- package/dist/zonos-elements/{p-0a8e0498.system.js → p-bd50ac54.system.js} +1 -1
- package/dist/zonos-elements/{p-d740b7d1.entry.js → p-bf2b90af.entry.js} +1 -1
- package/dist/zonos-elements/{p-c27e9d00.entry.js → p-c5fd32f4.entry.js} +1 -1
- package/dist/zonos-elements/p-c78dd680.system.js +1 -1
- package/dist/zonos-elements/{p-c95a8b8f.entry.js → p-d4e92269.entry.js} +1 -1
- package/dist/zonos-elements/{p-ecd6a58a.system.entry.js → p-d56f87ab.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-5a59ed7f.system.entry.js → p-de93cc65.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-75ad3056.entry.js → p-e4c9e92c.entry.js} +1 -1
- package/dist/zonos-elements/{p-e7870ba2.system.entry.js → p-e4d88f11.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-cb912299.system.entry.js → p-ea0ee9e7.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-54f66cd1.entry.js → p-f3fc05a8.entry.js} +1 -1
- package/dist/zonos-elements/{p-eb3520e7.entry.js → p-f4765417.entry.js} +1 -1
- package/dist/zonos-elements/{p-c328aa74.system.entry.js → p-fc040c52.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8e9dcaa3.entry.js → p-fca6f444.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/zonos-elements/p-a75f5d63.js +0 -1
- package/dist/zonos-elements/p-e97793ce.system.js +0 -1
- package/dist/zonos-elements/p-f05f3e27.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,h,a as getAssetPath,H as Host}from"./index-86b8247e.js";import{d as zonosStoreFontFamily}from"./zonosStore-
|
|
1
|
+
import{r as registerInstance,h,a as getAssetPath,H as Host}from"./index-86b8247e.js";import{d as zonosStoreFontFamily}from"./zonosStore-0dc7a947.js";import{c as classes}from"./classes-0d95c529.js";var zonosLogoCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host img{-webkit-filter:var(--filter-color);filter:var(--filter-color);width:var(--width)}";var ZonosLogoStyle0=zonosLogoCss;var ZonosLogo=function(){function o(o){registerInstance(this,o);this.theme="LIGHT";this.width="auto"}o.prototype.render=function(){var o=this.theme==="DARK"?"invert(100%) sepia(100%) saturate(0%) hue-rotate(288deg) brightness(102%) contrast(102%)":"whiteinvert(0%) sepia(100%) saturate(32%) hue-rotate(92deg) brightness(107%) contrast(107%)";return h(Host,{key:"8737fef033ef8114ca67be72b2f598897a6929b3",class:classes(["zonos--elements zonos--logo"]),style:{"--filter-color":o,"--font-family":zonosStoreFontFamily(),"--width":this.width}},h("img",{key:"d5a15f2f8f891f865c7eb46268ae2f113ad1d3b4",alt:"Zonos Logo",src:getAssetPath("./assets/ZonosLogo.png")}))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return o}();ZonosLogo.style=ZonosLogoStyle0;export{ZonosLogo as zonos_logo};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(n,o,t,a){function e(n){return n instanceof t?n:new t((function(o){o(n)}))}return new(t||(t=Promise))((function(t,s){function i(n){try{c(a.next(n))}catch(n){s(n)}}function r(n){try{c(a["throw"](n))}catch(n){s(n)}}function c(n){n.done?t(n.value):e(n.value).then(i,r)}c((a=a.apply(n,o||[])).next())}))};var __generator=this&&this.__generator||function(n,o){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},a,e,s,i;return i={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function r(n){return function(o){return c([n,o])}}function c(r){if(a)throw new TypeError("Generator is already executing.");while(i&&(i=0,r[0]&&(t=0)),t)try{if(a=1,e&&(s=r[0]&2?e["return"]:r[0]?e["throw"]||((s=e["return"])&&s.call(e),0):e.next)&&!(s=s.call(e,r[1])).done)return s;if(e=0,s)r=[r[0]&2,s.value];switch(r[0]){case 0:case 1:s=r;break;case 4:t.label++;return{value:r[1],done:false};case 5:t.label++;e=r[1];r=[0];continue;case 7:r=t.ops.pop();t.trys.pop();continue;default:if(!(s=t.trys,s=s.length>0&&s[s.length-1])&&(r[0]===6||r[0]===2)){t=0;continue}if(r[0]===3&&(!s||r[1]>s[0]&&r[1]<s[3])){t.label=r[1];break}if(r[0]===6&&t.label<s[1]){t.label=s[1];s=r;break}if(s&&t.label<s[2]){t.label=s[2];t.ops.push(r);break}if(s[2])t.ops.pop();t.trys.pop();continue}r=o.call(n,t)}catch(n){r=[6,n];e=0}finally{a=s=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(n,o,t){if(t||arguments.length===2)for(var a=0,e=o.length,s;a<e;a++){if(s||!(a in o)){if(!s)s=Array.prototype.slice.call(o,0,a);s[a]=o[a]}}return n.concat(s||Array.prototype.slice.call(o))};import{r as registerInstance,h,H as Host,d as getElement,c as createEvent}from"./index-86b8247e.js";import{d as zonosStoreFontFamily}from"./zonosStore-473f4654.js";import{c as classes}from"./classes-0d95c529.js";import{j as stripeStore}from"./cart-70f3af44.js";import{a as logError,l as log}from"./handleFetch-613fbc00.js";import{d as paypalStoreInitButtons}from"./paypal-86eba67d.js";import"./isDarkColor-c927f77d.js";import"./getBorderRadius-23398fc6.js";var zonosNotificationCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";var ZonosNotificationStyle0=zonosNotificationCss;var ZonosNotification=function(){function n(n){registerInstance(this,n);this.notificationArray=[]}n.prototype.showNotification=function(n){return __awaiter(this,void 0,void 0,(function(){var o,t;var a=this;return __generator(this,(function(e){o="id-".concat(Math.random().toString(36).substring(2,9));t=Object.assign(Object.assign({},n),{id:o,timeout:n.timeout||5e3,transitionClass:"",type:n.type||"success"});this.notificationArray=__spreadArray(__spreadArray([],this.notificationArray,true),[t],false);setTimeout((function(){a.updateTransitionClass({id:o,transitionClass:"show"})}),50);setTimeout((function(){a.removeNotification(o)}),t.timeout);return[2]}))}))};n.prototype.updateTransitionClass=function(n){var o=n.id,t=n.transitionClass;this.notificationArray=this.notificationArray.map((function(n){if(n.id===o){return Object.assign(Object.assign({},n),{transitionClass:t})}return n}))};n.prototype.removeNotification=function(n){var o=this;this.updateTransitionClass({id:n,transitionClass:""});setTimeout((function(){o.notificationArray=o.notificationArray.filter((function(o){return o.id!==n}))}),300)};n.prototype.render=function(){var n=this;return h(Host,{key:"17c08c90c6c1dfade4e43451c196127a0f53429e",class:classes(["zonos--elements zonos--notification"]),style:{"--font-family":zonosStoreFontFamily()}},h("div",{key:"6624419d86a5c7518539069dbc5c9d7c08262c75",class:"zonos--notification-items"},this.notificationArray.map((function(o){return h("div",{"aria-hidden":"true",class:classes(["zonos--notification-item",o.type,o.transitionClass]),key:o.id,onClick:function(){n.removeNotification(o.id)}},h("zonos-text",{textColor:"gray-0"},o.message))}))))};return n}();ZonosNotification.style=ZonosNotificationStyle0;var zonosPaymentCss=".sc-zonos-payment-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-payment-h *.sc-zonos-payment{font-family:var(--font-family, Inter), Inter}.sc-zonos-payment-h img.sc-zonos-payment{max-width:100%}.sc-zonos-payment-h dl.sc-zonos-payment,.sc-zonos-payment-h dd.sc-zonos-payment,.sc-zonos-payment-h h1.sc-zonos-payment,.sc-zonos-payment-h h2.sc-zonos-payment,.sc-zonos-payment-h h3.sc-zonos-payment,.sc-zonos-payment-h h4.sc-zonos-payment,.sc-zonos-payment-h h5.sc-zonos-payment,.sc-zonos-payment-h h6.sc-zonos-payment,.sc-zonos-payment-h hr.sc-zonos-payment,.sc-zonos-payment-h figure.sc-zonos-payment,.sc-zonos-payment-h p.sc-zonos-payment,.sc-zonos-payment-h pre.sc-zonos-payment{margin:0}.sc-zonos-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-payment-h .zonos--title.sc-zonos-payment{margin-bottom:16px}";var ZonosPaymentStyle0=zonosPaymentCss;var ZonosPayment=function(){function n(n){registerInstance(this,n);this.titleText=undefined;this.stripe=stripeStore.stripe;this.stripeElements=stripeStore.stripeElements}n.prototype.watchInitStripe=function(){if(!this.stripeElements){return}var n=stripeStore.stripePaymentElement||this.stripeElements.create("payment",{layout:"accordion"});var o=this.el.querySelector(".zonos--payment-component");if(!o){logError("Cannot find container element for paymentElement");return}n.mount(o);n.on("change",(function(n){stripeStore.stripePaymentEventData=n}));stripeStore.stripePaymentElement=n};n.prototype.componentDidLoad=function(){this.watchInitStripe()};n.prototype.render=function(){return h(Host,{key:"ab601d9a0cc6fe2fee19f45d6321dcc81b418cff",class:"zonos--payment zonos--elements"},this.titleText&&h("zonos-text",{key:"27857c99c59e4913fa403ef5b23b5b7d7f32bd45",class:"zonos--title",type:"semiBoldLabel"},this.titleText),h("div",{key:"329b5a5617f0c5942b209df1ccf3bfcb4ddabb0c",class:"zonos--payment-component"}),h("div",{key:"7abb08922e9f607314713fc9fa762a3bb8a35b13",class:"zonos--payment-paypal-container"}))};Object.defineProperty(n.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(n,"watchers",{get:function(){return{stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return n}();ZonosPayment.style=ZonosPaymentStyle0;var zonosPaypalPaymentCss=".sc-zonos-paypal-payment-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-paypal-payment-h *.sc-zonos-paypal-payment{font-family:var(--font-family, Inter), Inter}.sc-zonos-paypal-payment-h img.sc-zonos-paypal-payment{max-width:100%}.sc-zonos-paypal-payment-h dl.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h dd.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h1.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h2.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h3.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h4.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h5.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h6.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h hr.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h figure.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h p.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h pre.sc-zonos-paypal-payment{margin:0}.sc-zonos-paypal-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-paypal-payment-h{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}";var ZonosPaypalPaymentStyle0=zonosPaypalPaymentCss;var ZonosPaypalPayment=function(){function n(n){registerInstance(this,n);this.paypalSessionDone=createEvent(this,"paypalSessionDone",7);this.paypalSessionFail=createEvent(this,"paypalSessionFail",7)}n.prototype.loadPaypal=function(){return __awaiter(this,void 0,void 0,(function(){var n,o;var t=this;return __generator(this,(function(a){if(!window.Zonos.paypal){log("Paypal is not available");return[2]}n=paypalStoreInitButtons({onPaypalFail:function(){log("onPaypalFail");t.paypalSessionFail.emit()},onPaypalSessionDone:function(n){var o=n.orderId;log("onPaypalSessionDone","info",{orderId:o});t.paypalSessionDone.emit({orderId:o})}});if(!(n===null||n===void 0?void 0:n.length)){log("There are no paypal buttons available");return[2]}o=this.el.querySelector(".zonos--payment-paypal-container");if(!o){log("Cannot find container element for paypal buttons");return[2]}n.forEach((function(n){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,n.render(o)];case 1:t.sent();return[2]}}))}))}));return[2]}))}))};n.prototype.componentDidLoad=function(){void this.loadPaypal()};n.prototype.render=function(){return h(Host,{key:"a09fe5b66b1ac971c10529ecb6213479f2870f08",class:"zonos--paypal-payment zonos--elements"},h("div",{key:"6ba337785b8a90965e0cba05fd62681bc92633fe",class:"zonos--payment-paypal-container"}))};Object.defineProperty(n.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return n}();ZonosPaypalPayment.style=ZonosPaypalPaymentStyle0;export{ZonosNotification as zonos_notification,ZonosPayment as zonos_payment,ZonosPaypalPayment as zonos_paypal_payment};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(n,o,t,a){function e(n){return n instanceof t?n:new t((function(o){o(n)}))}return new(t||(t=Promise))((function(t,s){function i(n){try{c(a.next(n))}catch(n){s(n)}}function r(n){try{c(a["throw"](n))}catch(n){s(n)}}function c(n){n.done?t(n.value):e(n.value).then(i,r)}c((a=a.apply(n,o||[])).next())}))};var __generator=this&&this.__generator||function(n,o){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},a,e,s,i;return i={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function r(n){return function(o){return c([n,o])}}function c(r){if(a)throw new TypeError("Generator is already executing.");while(i&&(i=0,r[0]&&(t=0)),t)try{if(a=1,e&&(s=r[0]&2?e["return"]:r[0]?e["throw"]||((s=e["return"])&&s.call(e),0):e.next)&&!(s=s.call(e,r[1])).done)return s;if(e=0,s)r=[r[0]&2,s.value];switch(r[0]){case 0:case 1:s=r;break;case 4:t.label++;return{value:r[1],done:false};case 5:t.label++;e=r[1];r=[0];continue;case 7:r=t.ops.pop();t.trys.pop();continue;default:if(!(s=t.trys,s=s.length>0&&s[s.length-1])&&(r[0]===6||r[0]===2)){t=0;continue}if(r[0]===3&&(!s||r[1]>s[0]&&r[1]<s[3])){t.label=r[1];break}if(r[0]===6&&t.label<s[1]){t.label=s[1];s=r;break}if(s&&t.label<s[2]){t.label=s[2];t.ops.push(r);break}if(s[2])t.ops.pop();t.trys.pop();continue}r=o.call(n,t)}catch(n){r=[6,n];e=0}finally{a=s=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(n,o,t){if(t||arguments.length===2)for(var a=0,e=o.length,s;a<e;a++){if(s||!(a in o)){if(!s)s=Array.prototype.slice.call(o,0,a);s[a]=o[a]}}return n.concat(s||Array.prototype.slice.call(o))};import{r as registerInstance,h,H as Host,d as getElement,c as createEvent}from"./index-86b8247e.js";import{d as zonosStoreFontFamily}from"./zonosStore-0dc7a947.js";import{c as classes}from"./classes-0d95c529.js";import{j as stripeStore}from"./cart-c2bd0e1d.js";import{a as logError,l as log}from"./handleFetch-613fbc00.js";import{d as paypalStoreInitButtons}from"./paypal-96d0a3d0.js";import"./isDarkColor-b3afa948.js";import"./getBorderRadius-cff1e39b.js";var zonosNotificationCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";var ZonosNotificationStyle0=zonosNotificationCss;var ZonosNotification=function(){function n(n){registerInstance(this,n);this.notificationArray=[]}n.prototype.showNotification=function(n){return __awaiter(this,void 0,void 0,(function(){var o,t;var a=this;return __generator(this,(function(e){o="id-".concat(Math.random().toString(36).substring(2,9));t=Object.assign(Object.assign({},n),{id:o,timeout:n.timeout||5e3,transitionClass:"",type:n.type||"success"});this.notificationArray=__spreadArray(__spreadArray([],this.notificationArray,true),[t],false);setTimeout((function(){a.updateTransitionClass({id:o,transitionClass:"show"})}),50);setTimeout((function(){a.removeNotification(o)}),t.timeout);return[2]}))}))};n.prototype.updateTransitionClass=function(n){var o=n.id,t=n.transitionClass;this.notificationArray=this.notificationArray.map((function(n){if(n.id===o){return Object.assign(Object.assign({},n),{transitionClass:t})}return n}))};n.prototype.removeNotification=function(n){var o=this;this.updateTransitionClass({id:n,transitionClass:""});setTimeout((function(){o.notificationArray=o.notificationArray.filter((function(o){return o.id!==n}))}),300)};n.prototype.render=function(){var n=this;return h(Host,{key:"17c08c90c6c1dfade4e43451c196127a0f53429e",class:classes(["zonos--elements zonos--notification"]),style:{"--font-family":zonosStoreFontFamily()}},h("div",{key:"6624419d86a5c7518539069dbc5c9d7c08262c75",class:"zonos--notification-items"},this.notificationArray.map((function(o){return h("div",{"aria-hidden":"true",class:classes(["zonos--notification-item",o.type,o.transitionClass]),key:o.id,onClick:function(){n.removeNotification(o.id)}},h("zonos-text",{textColor:"gray-0"},o.message))}))))};return n}();ZonosNotification.style=ZonosNotificationStyle0;var zonosPaymentCss=".sc-zonos-payment-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-payment-h *.sc-zonos-payment{font-family:var(--font-family, Inter), Inter}.sc-zonos-payment-h img.sc-zonos-payment{max-width:100%}.sc-zonos-payment-h dl.sc-zonos-payment,.sc-zonos-payment-h dd.sc-zonos-payment,.sc-zonos-payment-h h1.sc-zonos-payment,.sc-zonos-payment-h h2.sc-zonos-payment,.sc-zonos-payment-h h3.sc-zonos-payment,.sc-zonos-payment-h h4.sc-zonos-payment,.sc-zonos-payment-h h5.sc-zonos-payment,.sc-zonos-payment-h h6.sc-zonos-payment,.sc-zonos-payment-h hr.sc-zonos-payment,.sc-zonos-payment-h figure.sc-zonos-payment,.sc-zonos-payment-h p.sc-zonos-payment,.sc-zonos-payment-h pre.sc-zonos-payment{margin:0}.sc-zonos-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-payment-h .zonos--title.sc-zonos-payment{margin-bottom:16px}";var ZonosPaymentStyle0=zonosPaymentCss;var ZonosPayment=function(){function n(n){registerInstance(this,n);this.titleText=undefined;this.stripe=stripeStore.stripe;this.stripeElements=stripeStore.stripeElements}n.prototype.watchInitStripe=function(){if(!this.stripeElements){return}var n=stripeStore.stripePaymentElement||this.stripeElements.create("payment",{layout:"accordion"});var o=this.el.querySelector(".zonos--payment-component");if(!o){logError("Cannot find container element for paymentElement");return}n.mount(o);n.on("change",(function(n){stripeStore.stripePaymentEventData=n}));stripeStore.stripePaymentElement=n};n.prototype.componentDidLoad=function(){this.watchInitStripe()};n.prototype.render=function(){return h(Host,{key:"ab601d9a0cc6fe2fee19f45d6321dcc81b418cff",class:"zonos--payment zonos--elements"},this.titleText&&h("zonos-text",{key:"27857c99c59e4913fa403ef5b23b5b7d7f32bd45",class:"zonos--title",type:"semiBoldLabel"},this.titleText),h("div",{key:"329b5a5617f0c5942b209df1ccf3bfcb4ddabb0c",class:"zonos--payment-component"}),h("div",{key:"7abb08922e9f607314713fc9fa762a3bb8a35b13",class:"zonos--payment-paypal-container"}))};Object.defineProperty(n.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(n,"watchers",{get:function(){return{stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return n}();ZonosPayment.style=ZonosPaymentStyle0;var zonosPaypalPaymentCss=".sc-zonos-paypal-payment-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-paypal-payment-h *.sc-zonos-paypal-payment{font-family:var(--font-family, Inter), Inter}.sc-zonos-paypal-payment-h img.sc-zonos-paypal-payment{max-width:100%}.sc-zonos-paypal-payment-h dl.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h dd.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h1.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h2.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h3.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h4.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h5.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h6.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h hr.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h figure.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h p.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h pre.sc-zonos-paypal-payment{margin:0}.sc-zonos-paypal-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-paypal-payment-h{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}";var ZonosPaypalPaymentStyle0=zonosPaypalPaymentCss;var ZonosPaypalPayment=function(){function n(n){registerInstance(this,n);this.paypalSessionDone=createEvent(this,"paypalSessionDone",7);this.paypalSessionFail=createEvent(this,"paypalSessionFail",7)}n.prototype.loadPaypal=function(){return __awaiter(this,void 0,void 0,(function(){var n,o;var t=this;return __generator(this,(function(a){if(!window.Zonos.paypal){log("Paypal is not available");return[2]}n=paypalStoreInitButtons({onPaypalFail:function(){log("onPaypalFail");t.paypalSessionFail.emit()},onPaypalSessionDone:function(n){var o=n.orderId;log("onPaypalSessionDone","info",{orderId:o});t.paypalSessionDone.emit({orderId:o})}});if(!(n===null||n===void 0?void 0:n.length)){log("There are no paypal buttons available");return[2]}o=this.el.querySelector(".zonos--payment-paypal-container");if(!o){log("Cannot find container element for paypal buttons");return[2]}n.forEach((function(n){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,n.render(o)];case 1:t.sent();return[2]}}))}))}));return[2]}))}))};n.prototype.componentDidLoad=function(){void this.loadPaypal()};n.prototype.render=function(){return h(Host,{key:"a09fe5b66b1ac971c10529ecb6213479f2870f08",class:"zonos--paypal-payment zonos--elements"},h("div",{key:"6ba337785b8a90965e0cba05fd62681bc92633fe",class:"zonos--payment-paypal-container"}))};Object.defineProperty(n.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return n}();ZonosPaypalPayment.style=ZonosPaypalPaymentStyle0;export{ZonosNotification as zonos_notification,ZonosPayment as zonos_payment,ZonosPaypalPayment as zonos_paypal_payment};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,c as createEvent,h,H as Host}from"./index-86b8247e.js";import{d as zonosStoreFontFamily,z as zonosStore}from"./zonosStore-
|
|
1
|
+
import{r as registerInstance,c as createEvent,h,H as Host}from"./index-86b8247e.js";import{d as zonosStoreFontFamily,z as zonosStore}from"./zonosStore-0dc7a947.js";import{c as classes}from"./classes-0d95c529.js";import{g as getBorderRadius}from"./getBorderRadius-cff1e39b.js";import{i as isColorVariable}from"./isColorVariable-82457bef.js";var zonosShippingRichRadioCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host input{margin:0;accent-color:var(--selected-border-color, var(--zonos-elements-blue-600))}:host .zonos--shipping-rich-radio-item{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;padding:16px;-ms-flex-align:center;align-items:center;gap:16px;cursor:pointer;border:1px solid var(--zonos-elements-gray-200)}:host .zonos--shipping-rich-radio-item:first-child{border-top-left-radius:var(--border-radius, var(--zonos-elements-radius-10));border-top-right-radius:var(--border-radius, var(--zonos-elements-radius-10))}:host .zonos--shipping-rich-radio-item:last-child{border-bottom-right-radius:var(--border-radius, var(--zonos-elements-radius-10));border-bottom-left-radius:var(--border-radius, var(--zonos-elements-radius-10))}:host .zonos--shipping-rich-radio-item:not(:last-child){border-bottom:none}:host .zonos--shipping-rich-radio-item.selected{outline:1px solid var(--selected-border-color, var(--zonos-elements-blue-600));outline-offset:-1px}:host .zonos--shipping-info{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex:1;flex:1}:host .zonos--shipping-detail{-ms-flex:1;flex:1}:host .zonos--sub-detail{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap}";var ZonosShippingRichRadioStyle0=zonosShippingRichRadioCss;var ZonosShippingRichRadio=function(){function o(o){var i=this;registerInstance(this,o);this.radioSelected=createEvent(this,"radioSelected",7);this.handleRichRadioSelect=function(o){var s;i.selectedItem=o;(s=i.radioSelected)===null||s===void 0?void 0:s.emit(o)};this.getRadioItemStyleVariables=function(){var o=i.borderColor||zonosStore.appearance.colorSecondary;var s=isColorVariable(o)?"var(--zonos-elements-".concat(o,")"):o;return{"--border-radius":getBorderRadius({overrideBorderStyle:i.borderStyle}),"--selected-border-color":s||"unset"}};this.items=undefined;this.borderColor=undefined;this.borderStyle=undefined;this.theme=undefined;this.initialSelectedValue=undefined;this.selectedItem=null}o.prototype.componentWillLoad=function(){var o=this;if(this.initialSelectedValue){this.selectedItem=this.items.find((function(i){return i.value===o.initialSelectedValue}))||null}};o.prototype.render=function(){var o=this;var i;return h(Host,{key:"48381df130f6021b73c543c7244a71e7b1e8cd05",class:"zonos--shipping-rich-radio zonos--elements","data-theme":this.theme,style:Object.assign(Object.assign({},this.getRadioItemStyleVariables()),{"--font-family":zonosStoreFontFamily()})},(i=this.items)===null||i===void 0?void 0:i.map((function(i){var s;var e=((s=o.selectedItem)===null||s===void 0?void 0:s.value)===i.value;return h("div",{"aria-hidden":"true",class:classes(["zonos--shipping-rich-radio-item",e&&"selected"]),onClick:function(){return o.handleRichRadioSelect(i)}},h("input",{checked:e,class:"zonos--shipping-rich-radio-input",name:"zonos--shipping-rich-radio",type:"radio",value:i.value}),h("div",{class:"zonos--shipping-info"},h("div",{class:"zonos--shipping-detail"},h("zonos-text",{class:"zonos--shipping-label",type:"label"},i.label),(i.sublabel||i.caption)&&h("div",{class:"zonos--sub-detail"},i.sublabel&&h("zonos-text",{textColor:"gray-800"},i.sublabel),i.caption&&h("zonos-text",{textColor:"gray-600"},i.caption))),h("zonos-text",{type:"semiBoldLabel"},i.price)))})))};return o}();ZonosShippingRichRadio.style=ZonosShippingRichRadioStyle0;export{ZonosShippingRichRadio as zonos_shipping_rich_radio};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,h,H as Host}from"./index-86b8247e.js";import{d as zonosStoreFontFamily}from"./zonosStore-
|
|
1
|
+
import{r as registerInstance,h,H as Host}from"./index-86b8247e.js";import{d as zonosStoreFontFamily}from"./zonosStore-0dc7a947.js";import{c as classes}from"./classes-0d95c529.js";import{i as isColorVariable}from"./isColorVariable-82457bef.js";var textOptions={pageHeader:{label:"Page Header (3XL) · 34px (2.125rem)",size:"3xl",tag:"h2",weight:900},secondaryPageHeader:{label:'Secondary Page Header (3XL) • 34px, 500 "Medium"',size:"3xl",tag:"h2",weight:500},header:{label:"Header (2XL) · 28px (1.75rem)",size:"2xl",tag:"h3",weight:700},descriptionHeader:{label:"Description Header (2XL) · 28px (1.75rem)",size:"2xl",tag:"h3",weight:700},title:{label:"Title (XL) • 22px (1.375rem)",size:"xl",tag:"h4",weight:600},boldSubheader:{label:"Bold Subheader (L) • 18px (1.125rem)",size:"l",tag:"h5",weight:700},semiBoldSubheader:{label:"Semi Bold Subheader (L / H4) • 18px (1.125rem)",size:"l",tag:"h5",weight:600},subheader:{label:"Subheader (L) • 18px (1.125rem)",size:"l",tag:"h5",weight:500},boldLabel:{label:"Bold Label (Base) • 14px (.875rem)",size:"base",tag:"span",weight:700},semiBoldLabel:{label:"Semi Bold Label (Base) • 14px (.875rem)",size:"base",tag:"span",weight:600},label:{label:"Label (Base) • 14px (.875rem)",size:"base",tag:"span",weight:500},body:{label:"Body (Base) • 14px (.875rem)",size:"base",tag:"span",weight:400},smallHeader:{label:"Small header (S) • 12px (.75rem)",size:"s",tag:"span",weight:600},caption:{label:"Caption (S) • 12px (.75rem)",size:"s",tag:"span",weight:400},hintText:{label:"Hint text (XS) • 10px (.625rem)",size:"xs",tag:"span",weight:400}};var zonosTextCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{color:var(--color)}:host(.zonos--text-size-3xl)>*,:host(.zonos--text-size-3xl){font-size:var(--zonos-elements-font-size-3xl)}:host(.zonos--text-size-2xl)>*,:host(.zonos--text-size-2xl){font-size:var(--zonos-elements-font-size-2xl)}:host(.zonos--text-size-xl)>*,:host(.zonos--text-size-xl){font-size:var(--zonos-elements-font-size-xl)}:host(.zonos--text-size-l)>*,:host(.zonos--text-size-l){font-size:var(--zonos-elements-font-size-l)}:host(.zonos--text-size-base)>*,:host(.zonos--text-size-base){font-size:var(--zonos-elements-font-size-base)}:host(.zonos--text-size-s)>*,:host(.zonos--text-size-s){font-size:var(--zonos-elements-font-size-s)}:host(.zonos--text-size-xs)>*,:host(.zonos--text-size-xs){font-size:var(--zonos-elements-font-size-xs)}:host(.zonos--text-weight-900)>*,:host(.zonos--text-weight-900){font-weight:900}:host(.zonos--text-weight-700)>*,:host(.zonos--text-weight-700){font-weight:700}:host(.zonos--text-weight-600)>*,:host(.zonos--text-weight-600){font-weight:600}:host(.zonos--text-weight-500)>*,:host(.zonos--text-weight-500){font-weight:500}:host(.zonos--text-weight-400)>*,:host(.zonos--text-weight-400){font-weight:400}";var ZonosTextStyle0=zonosTextCss;var ZonosText=function(){function e(e){registerInstance(this,e);this.textColor="gray-1200";this.size=undefined;this.type="body";this.weight=undefined;this.ready=false}e.prototype.componentDidRender=function(){var e=this;setTimeout((function(){e.ready=true}),100)};e.prototype.render=function(){var e=textOptions.body,t=e.size,s=e.tag,o=e.weight;var n=textOptions[this.type],a=n.size,i=n.tag,l=n.weight;var r=this.size||a||t;var z=this.weight||l||o;var x=i||s;var g=isColorVariable(this.textColor)?"var(--zonos-elements-".concat(this.textColor,")"):this.textColor;var m=function(){switch(x){case"h2":return h("h2",null,h("slot",null));case"h3":return h("h3",null,h("slot",null));case"h4":return h("h4",null,h("slot",null));case"h5":return h("h5",null,h("slot",null));case"span":default:return h("span",null,h("slot",null))}};return h(Host,{class:classes(["zonos--elements","zonos--text-size-".concat(r),"zonos--text-weight-".concat(z)]),style:{"--color":g,"--font-family":zonosStoreFontFamily()}},m())};return e}();ZonosText.style=ZonosTextStyle0;export{ZonosText as zonos_text};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,h,H as Host}from"./index-86b8247e.js";import{d as zonosStoreFontFamily}from"./zonosStore-
|
|
1
|
+
import{r as registerInstance,h,H as Host}from"./index-86b8247e.js";import{d as zonosStoreFontFamily}from"./zonosStore-0dc7a947.js";import{c as classes}from"./classes-0d95c529.js";var zonosVStackCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .vstack{display:grid;grid-auto-columns:minmax(0, 1fr);grid-row-gap:var(--spacing, 24px);grid-auto-flow:row}";var ZonosVStackStyle0=zonosVStackCss;var VStack=function(){function t(t){registerInstance(this,t);this.spacing=24}t.prototype.render=function(){return h(Host,{key:"e542ff8bbefa3223f157ad4bd6e537af8e5d5a5d",style:{"--font-family":zonosStoreFontFamily()}},h("div",{key:"9bd1cc8fdf94265d7d2767d507af7ad21d77234d",class:classes(["vstack"]),style:{"grid-row-gap":"".concat(this.spacing,"px")}},h("slot",{key:"c8a294410e4c1348405c53283cf4dba176d5b27b"})))};return t}();VStack.style=ZonosVStackStyle0;export{VStack as zonos_v_stack};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __spreadArray=this&&this.__spreadArray||function(e,r,t){if(t||arguments.length===2)for(var a=0,n=r.length,s;a<n;a++){if(s||!(a in r)){if(!s)s=Array.prototype.slice.call(r,0,a);s[a]=r[a]}}return e.concat(s||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 s=function(){var r;a=new Map(Object.entries((r=unwrap(e))!==null&&r!==void 0?r:{}));n.reset.forEach((function(e){return e()}))};var i=function(){n.dispose.forEach((function(e){return e()}));s()};var o=function(e){n.get.forEach((function(r){return r(e)}));return a.get(e)};var c=function(e,t){var s=a.get(e);if(r(t,s,e)){a.set(e,t);n.set.forEach((function(r){return r(e,t,s)}))}};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:i,reset:s,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,s=Object(r),i=a(r),o=i.length;while(o--){var c=i[e?o:++n];if(t(s[c],c,s)===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 s=n&&n.exports===a;var i=s?t.Buffer:undefined,o=i?i.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 s=n&&"object"=="object"&&e&&!e.nodeType&&e;var i=s&&s.exports===n;var o=i?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 s=n&&n.exports===a;var i=s&&t.process;var o=function(){try{var e=n&&n.require&&n.require("util").types;if(e){return e}return i&&i.binding&&i.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 s=-1,i=r.length;while(++s<i){var o=r[s];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),s=!t&&!a&&!n&&isTypedArray$1(e),i=t||a||n||s,o=i?baseTimes(e.length,String):[],c=o.length;for(var u in e){if((r||hasOwnProperty$1.call(e,u))&&!(i&&(u=="length"||n&&(u=="offset"||u=="parent")||s&&(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,s,i){var o=safeGet$1(e,t),c=safeGet$1(r,t),u=i.get(c);if(u){assignMergeValue$1(e,t,u);return}var v=s?s(o,c,t+"",e,r,i):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){i.set(c,v);n(v,c,a,s,i);i["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(s,i){n||(n=new Stack);if(isObject$1(s)){baseMergeDeep(e,r,i,t,baseMerge$1,a,n)}else{var o=a?a(safeGet(e,i),s,i+"",e,r,n):undefined;if(o===undefined){o=s}assignMergeValue(e,i,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,s=nativeMax(a.length-r,0),i=Array(s);while(++n<s){i[n]=a[r+n]}n=-1;var o=Array(r+1);while(++n<r){o[n]=a[n]}o[r]=t(i);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,s=n>1?t[n-1]:undefined,i=n>2?t[2]:undefined;s=e.length>3&&typeof s=="function"?(n--,s):undefined;if(i&&isIterateeCall(t[0],t[1],i)){s=n<3?undefined:s;n=1}r=Object(r);while(++a<n){var o=t[a];if(o){e(r,o,a,s)}}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 _e=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:"",helloSettings:{anchorElementSelector:"",cartUrlPattern:"",countryOverrideBehavior:"URL_PARAM",currencyBehavior:"ENABLED",currencyElementSelector:".money",desktopLocation:"BOTTOM_RIGHT",excludedUrlPatterns:[],homepageUrlPattern:"",mobileLocation:"BOTTOM_RIGHT",mode:"LIVE",organization:"",peekMessageBehavior:"ENABLED",peekMessageDelay:0,productAddToCartElementSelector:"",productDescriptionElementSelector:"",productDetailUrlPattern:"",productListUrlPattern:"",productTitleElementSelector:"",restrictionBehavior:"DISABLED",showForCountries:"ONLY_SHIPPABLE",visibilityStatus:"ENABLED"},loadedConfig:false,organizationId:"",organizationName:"",sourceCurrency:"USD",storeId:null,stripeApiKey:"",zonosApiKey:"",zonosMode:null}})),zonosStoreDispose=_e.dispose,reset=_e.reset,zonosStore=_e.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,s,i;reset();if(t){savedZonosSettings=t}var o=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(o.theme==="SYSTEM"){o.theme=getZonosStoreTheme(o.theme)}zonosStore.appearance=o;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=((a=t===null||t===void 0?void 0:t.organization)===null||a===void 0?void 0:a.id)||"";zonosStore.organizationName=((n=t===null||t===void 0?void 0:t.organization)===null||n===void 0?void 0:n.name)||"";zonosStore.storeId=((i=(s=t===null||t===void 0?void 0:t.organization)===null||s===void 0?void 0:s.references)===null||i===void 0?void 0:i.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,s;a<n;a++){if(s||!(a in r)){if(!s)s=Array.prototype.slice.call(r,0,a);s[a]=r[a]}}return e.concat(s||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 s=function(){var r;a=new Map(Object.entries((r=unwrap(e))!==null&&r!==void 0?r:{}));n.reset.forEach((function(e){return e()}))};var i=function(){n.dispose.forEach((function(e){return e()}));s()};var o=function(e){n.get.forEach((function(r){return r(e)}));return a.get(e)};var c=function(e,t){var s=a.get(e);if(r(t,s,e)){a.set(e,t);n.set.forEach((function(r){return r(e,t,s)}))}};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:i,reset:s,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,s=Object(r),i=a(r),o=i.length;while(o--){var c=i[e?o:++n];if(t(s[c],c,s)===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 s=n&&n.exports===a;var i=s?t.Buffer:undefined,o=i?i.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 s=n&&"object"=="object"&&e&&!e.nodeType&&e;var i=s&&s.exports===n;var o=i?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 s=n&&n.exports===a;var i=s&&t.process;var o=function(){try{var e=n&&n.require&&n.require("util").types;if(e){return e}return i&&i.binding&&i.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 s=-1,i=r.length;while(++s<i){var o=r[s];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),s=!t&&!a&&!n&&isTypedArray$1(e),i=t||a||n||s,o=i?baseTimes(e.length,String):[],c=o.length;for(var u in e){if((r||hasOwnProperty$1.call(e,u))&&!(i&&(u=="length"||n&&(u=="offset"||u=="parent")||s&&(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,s,i){var o=safeGet$1(e,t),c=safeGet$1(r,t),u=i.get(c);if(u){assignMergeValue$1(e,t,u);return}var v=s?s(o,c,t+"",e,r,i):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){i.set(c,v);n(v,c,a,s,i);i["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(s,i){n||(n=new Stack);if(isObject$1(s)){baseMergeDeep(e,r,i,t,baseMerge$1,a,n)}else{var o=a?a(safeGet(e,i),s,i+"",e,r,n):undefined;if(o===undefined){o=s}assignMergeValue(e,i,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,s=nativeMax(a.length-r,0),i=Array(s);while(++n<s){i[n]=a[r+n]}n=-1;var o=Array(r+1);while(++n<r){o[n]=a[n]}o[r]=t(i);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,s=n>1?t[n-1]:undefined,i=n>2?t[2]:undefined;s=e.length>3&&typeof s=="function"?(n--,s):undefined;if(i&&isIterateeCall(t[0],t[1],i)){s=n<3?undefined:s;n=1}r=Object(r);while(++a<n){var o=t[a];if(o){e(r,o,a,s)}}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",organization:"",peekMessageBehavior:"ENABLED",peekMessageDelay:0,productAddToCartElementSelector:"",productDescriptionElementSelector:"",productDetailUrlPattern:"",productListUrlPattern:"",productTitleElementSelector:"",restrictionBehavior:"DISABLED",showForCountries:"ONLY_SHIPPABLE",visibilityStatus:"ENABLED"},loadedConfig:false,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,s,i,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.disabledCountries=((a=t===null||t===void 0?void 0:t.checkoutSettings)===null||a===void 0?void 0:a.disabledCountries)||["US"];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=((s=t===null||t===void 0?void 0:t.organization)===null||s===void 0?void 0:s.name)||"";zonosStore.storeId=((o=(i=t===null||t===void 0?void 0:t.organization)===null||i===void 0?void 0:i.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
|
@@ -579,6 +579,7 @@ type ItemUnitOfMeasure = (typeof itemUnitOfMeasure)[keyof typeof itemUnitOfMeasu
|
|
|
579
579
|
declare const landedCostAdjustmentType: {
|
|
580
580
|
readonly CartTotal: "CART_TOTAL";
|
|
581
581
|
readonly Item: "ITEM";
|
|
582
|
+
readonly PromoCode: "PROMO_CODE";
|
|
582
583
|
readonly Shipping: "SHIPPING";
|
|
583
584
|
};
|
|
584
585
|
type LandedCostAdjustmentType = (typeof landedCostAdjustmentType)[keyof typeof landedCostAdjustmentType];
|
package/dist/scripts/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=(e,t,...o)=>{var n,r;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...o));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...o);break;case"info":i.info(e,...o);break;case"error":i.error(e,...o);break;default:i.groupCollapsed(e,...o),i.trace(),i.groupEnd()}},t=(t,...o)=>{e(t,"error",...o)},o=["jsdelivr","cdnjs","unpkg","vercel"],n="jsdelivr",r=e=>{const t=o.indexOf(e);return o[t+1]||null},s=()=>{const t=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||t)return null;const o=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.59.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 e(`[ZONOS-WARNING] using '${r}' for loading 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:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},i="https://js.stripe.com/v3",l=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,a="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((o,n)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(a),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${i}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&l.test(o.src))return o}return null})();r&&e?console.warn(a):r||(r=(e=>{const o=document.createElement("script");o.src=`${i}`;const n=document.head||document.body;return n?(n.appendChild(o),o):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):n(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else o(null)}))),c),u=Promise.resolve().then((()=>d(null)));let p=!1;u.catch((e=>{p||console.warn(e)}));function m(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const h=["cloudflare","vercel"],y=h[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},g=w[y],f=(e=y)=>{const t=h.indexOf(e),o=h[t+1];return o||null},v=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},b=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},S=async({basePathType:e,options:t,path:o})=>{let n;const r=w[e]||y,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}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 i=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:i}}const a=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:a}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${a}: ${"Unknown error"}`,type:a}],json:null,response:null,zonosMode:i}}},z=async({basePathType:t,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":t,l=await S({basePathType:i,options:o,path:n}),{errors:a,response:c}=l,d=m(l,["errors","response"]),u=f(i),p=!!a.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),h=u&&p;return p&&(async({endpoint:e,errors:t,metadata:o,shouldPostReleaseErrorReporting:n})=>{if(n){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},o)};try{fetch(`${g}/api/zonos-elements/log-error`,{body:JSON.stringify(s),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=f();if(!t)return;fetch(`${w[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(s),method:"POST"})}})({endpoint:w[i]+n,errors:a.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==o?void 0:o.headers,requestPayload:v(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}),h?(e(`=== "${n}" failed to fetch, trying next fallback ${u}`),z({basePathType:u,options:o,path:n})):Object.assign({errors:a,response:c},d)},j=async e=>{const{errors:t,json:o}=await(async(e,t)=>{const o=m(t||{},[]),n=o.body?JSON.stringify(o.body):void 0,r=o.method||"GET",s=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"},o.headers),i=Object.assign(Object.assign({},o),{body:"GET"===r?void 0:n,headers:s,method:r}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return z({basePathType:l||y,options:i,path:e})})("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!o||t.length?null:o};var O;const C=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),k="https://v1.3.59.js.zonos.com",E=C||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.59",A="https://rsms.me",U="https://fonts.googleapis.com",Z=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class T{}O=T,T.doneInit=!1,T.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),T.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),T._paypalMockResponse=null,T.isBigCommerce=!1,T.releaseDate="1727798297919",T.isLegacyCheckout=!1,T.isNpm=!0,T.zonosQaUrl=null,T.version="v1.3.59",T.modeAlerted=!1,T.cartData=null,T.paypal=null,T.getCurrentTimestamp=()=>(new Date).getTime(),T.zonosController=null,T.init=async({appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:a,zonosApiKey:c})=>{if(O.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!O.doneInit){if(e(`====== ZONOS DEBUG MODE: on (${O.version}) ======`),O.zonosApiKey=c,O.storeId=a,O.isNpm){if(e("====== ZONOS LOADING FROM NPM ======"),!c&&!O.cartId)return void t("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!O.cartData&&O.cartId){e("Initialize cart data");const o=await(async o=>{const n=await j(o);return e("[ZONOS - loadZonos] getting temp cart data","info",n),n?{cartData:n.cartData,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}:(t("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(O.cartId);if(!o)return void t("Failed to get cart data");O.cartData=o.cartData,O.zonosApiKey=o.zonosApiKey}}if(O.cartId&&O.cartData){e("Cart data is available, inject hidden button and trigger checkout");const t=document.createElement("button");t.style.display="none",t.id="zonos--checkout-hidden-button",document.body.appendChild(t)}e("init zonos"),O.injectZonosCdn(),O.injectZonosCss(),O.injectFonts(),O.injectController({config:{appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l}}),O.doneInit=!0}},T.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},T.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},T.showNotification=e=>{var t;null===(t=O.zonosController)||void 0===t||t.showNotification(e)},T.updateOrganizationName=e=>{var t;null===(t=O.zonosController)||void 0===t||t.updateOrganizationName(e)},T.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:o,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const t=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&o&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},T.injectController=({config:o})=>{var n;if(document.querySelector("zonos-controller"))return;if(null===(n=o.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const e=o.checkoutSettings.placeOrderButtonSelector;O.disablePlaceOrderButtons({config:o,disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{O.disablePlaceOrderButtons({config:o,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=o,r.zonosApiKey=O.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async o=>{const{detail:n}=o;e("loading Stripe");const s=await(async(...e)=>{p=!0;const t=Date.now();return u.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(n.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),O.zonosController=r,e("Zonos controller injected!")},T.injectScript=({cdnType:o,isModule:n,theRestUrl:s})=>{const i=`${O.getZonosUrl(o)}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,a=document.createElement("script");n?a.type="module":a.noModule=!0,a.src=i,a.crossOrigin="anonymous",a.onerror=()=>{t(`Failed to load ${a.src}`);const e=r(o);e&&O.injectScript({cdnType:e,isModule:n,theRestUrl:s})},l.appendChild(a)},T.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return E;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.59";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.59";case"vercel":return k}};if(O.isNpm){return s()||t()}return t()},T.injectZonosCdn=()=>{O.injectScript({cdnType:n,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),O.injectScript({cdnType:n,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},T.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const n=O.getZonosUrl(e),s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${k}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${n}/${o}`,l.onerror=()=>{t(`Failed to load ${l.href}`);const n=r(e);n&&O.injectStylesheet({cdnType:n,theRestUrl:o})},s.appendChild(l)},T.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(O.injectStylesheet({cdnType:n,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},T.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${A}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!Z.test(o.href))return o}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=A,t.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${A}/inter/inter.css`,t.appendChild(n),e("Zonos font injected!")},T.setupGoogleFont=e=>{var t;null===(t=O.zonosController)||void 0===t||t.setupGoogleFont(e)},T.injectSupportGoogleFont=t=>{var o;e(`[FONT] injecting ${t}`);const n=null===(o=t.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${U}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=U,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${n} font injected!`)},exports.Zonos=T})();
|
|
1
|
+
(function(){"use strict";const e=(e,t,...o)=>{var n,r;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...o));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...o);break;case"info":i.info(e,...o);break;case"error":i.error(e,...o);break;default:i.groupCollapsed(e,...o),i.trace(),i.groupEnd()}},t=(t,...o)=>{e(t,"error",...o)},o=["jsdelivr","cdnjs","unpkg","vercel"],n="jsdelivr",r=e=>{const t=o.indexOf(e);return o[t+1]||null},s=()=>{const t=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||t)return null;const o=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.61.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 e(`[ZONOS-WARNING] using '${r}' for loading 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:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},i="https://js.stripe.com/v3",l=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,a="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((o,n)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(a),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${i}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&l.test(o.src))return o}return null})();r&&e?console.warn(a):r||(r=(e=>{const o=document.createElement("script");o.src=`${i}`;const n=document.head||document.body;return n?(n.appendChild(o),o):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):n(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else o(null)}))),c),u=Promise.resolve().then((()=>d(null)));let p=!1;u.catch((e=>{p||console.warn(e)}));function m(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const h=["cloudflare","vercel"],y=h[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},g=w[y],f=(e=y)=>{const t=h.indexOf(e),o=h[t+1];return o||null},v=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},b=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},S=async({basePathType:e,options:t,path:o})=>{let n;const r=w[e]||y,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}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 i=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:i}}const a=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:a}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${a}: ${"Unknown error"}`,type:a}],json:null,response:null,zonosMode:i}}},z=async({basePathType:t,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":t,l=await S({basePathType:i,options:o,path:n}),{errors:a,response:c}=l,d=m(l,["errors","response"]),u=f(i),p=!!a.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),h=u&&p;return p&&(async({endpoint:e,errors:t,metadata:o,shouldPostReleaseErrorReporting:n})=>{if(n){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},o)};try{fetch(`${g}/api/zonos-elements/log-error`,{body:JSON.stringify(s),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=f();if(!t)return;fetch(`${w[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(s),method:"POST"})}})({endpoint:w[i]+n,errors:a.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==o?void 0:o.headers,requestPayload:v(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}),h?(e(`=== "${n}" failed to fetch, trying next fallback ${u}`),z({basePathType:u,options:o,path:n})):Object.assign({errors:a,response:c},d)},j=async e=>{const{errors:t,json:o}=await(async(e,t)=>{const o=m(t||{},[]),n=o.body?JSON.stringify(o.body):void 0,r=o.method||"GET",s=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"},o.headers),i=Object.assign(Object.assign({},o),{body:"GET"===r?void 0:n,headers:s,method:r}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return z({basePathType:l||y,options:i,path:e})})("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!o||t.length?null:o};var O;const C=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),k="https://v1.3.61.js.zonos.com",E=C||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.61",A="https://rsms.me",U="https://fonts.googleapis.com",Z=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class T{}O=T,T.doneInit=!1,T.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),T.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),T._paypalMockResponse=null,T.isBigCommerce=!1,T.releaseDate="1727820260282",T.isLegacyCheckout=!1,T.isNpm=!0,T.zonosQaUrl=null,T.version="v1.3.61",T.modeAlerted=!1,T.cartData=null,T.paypal=null,T.getCurrentTimestamp=()=>(new Date).getTime(),T.zonosController=null,T.init=async({appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:a,zonosApiKey:c})=>{if(O.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!O.doneInit){if(e(`====== ZONOS DEBUG MODE: on (${O.version}) ======`),O.zonosApiKey=c,O.storeId=a,O.isNpm){if(e("====== ZONOS LOADING FROM NPM ======"),!c&&!O.cartId)return void t("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!O.cartData&&O.cartId){e("Initialize cart data");const o=await(async o=>{const n=await j(o);return e("[ZONOS - loadZonos] getting temp cart data","info",n),n?{cartData:n.cartData,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}:(t("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(O.cartId);if(!o)return void t("Failed to get cart data");O.cartData=o.cartData,O.zonosApiKey=o.zonosApiKey}}if(O.cartId&&O.cartData){e("Cart data is available, inject hidden button and trigger checkout");const t=document.createElement("button");t.style.display="none",t.id="zonos--checkout-hidden-button",document.body.appendChild(t)}e("init zonos"),O.injectZonosCdn(),O.injectZonosCss(),O.injectFonts(),O.injectController({config:{appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l}}),O.doneInit=!0}},T.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},T.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},T.showNotification=e=>{var t;null===(t=O.zonosController)||void 0===t||t.showNotification(e)},T.updateOrganizationName=e=>{var t;null===(t=O.zonosController)||void 0===t||t.updateOrganizationName(e)},T.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:o,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const t=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&o&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},T.injectController=({config:o})=>{var n;if(document.querySelector("zonos-controller"))return;if(null===(n=o.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const e=o.checkoutSettings.placeOrderButtonSelector;O.disablePlaceOrderButtons({config:o,disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{O.disablePlaceOrderButtons({config:o,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=o,r.zonosApiKey=O.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async o=>{const{detail:n}=o;e("loading Stripe");const s=await(async(...e)=>{p=!0;const t=Date.now();return u.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(n.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),O.zonosController=r,e("Zonos controller injected!")},T.injectScript=({cdnType:o,isModule:n,theRestUrl:s})=>{const i=`${O.getZonosUrl(o)}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,a=document.createElement("script");n?a.type="module":a.noModule=!0,a.src=i,a.crossOrigin="anonymous",a.onerror=()=>{t(`Failed to load ${a.src}`);const e=r(o);e&&O.injectScript({cdnType:e,isModule:n,theRestUrl:s})},l.appendChild(a)},T.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return E;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.61";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.61";case"vercel":return k}};if(O.isNpm){return s()||t()}return t()},T.injectZonosCdn=()=>{O.injectScript({cdnType:n,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),O.injectScript({cdnType:n,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},T.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const n=O.getZonosUrl(e),s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${k}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${n}/${o}`,l.onerror=()=>{t(`Failed to load ${l.href}`);const n=r(e);n&&O.injectStylesheet({cdnType:n,theRestUrl:o})},s.appendChild(l)},T.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(O.injectStylesheet({cdnType:n,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},T.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${A}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!Z.test(o.href))return o}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=A,t.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${A}/inter/inter.css`,t.appendChild(n),e("Zonos font injected!")},T.setupGoogleFont=e=>{var t;null===(t=O.zonosController)||void 0===t||t.setupGoogleFont(e)},T.injectSupportGoogleFont=t=>{var o;e(`[FONT] injecting ${t}`);const n=null===(o=t.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${U}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=U,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${n} font injected!`)},exports.Zonos=T})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function e(e,o){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(n=Object.getOwnPropertySymbols(e);t<n.length;t++)o.indexOf(n[t])<0&&Object.prototype.propertyIsEnumerable.call(e,n[t])&&(r[n[t]]=e[n[t]])}return r}"function"==typeof SuppressedError&&SuppressedError;const o=["cloudflare","vercel"],r=o[0],n={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},t=n[r],s=(e=r)=>{const n=o.indexOf(e),t=o[n+1];return t||null},i=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},a=(e,o,...r)=>{var n,t;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===o&&console.error(e,...r));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(t=s.contentWindow)||void 0===t?void 0:t.window.console)||window.console;switch(o){case"warn":i.warn(e,...r);break;case"info":i.info(e,...r);break;case"error":i.error(e,...r);break;default:i.groupCollapsed(e,...r),i.trace(),i.groupEnd()}},c=async({endpoint:e,errors:o,metadata:r,shouldPostReleaseErrorReporting:i})=>{if(i){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,c={endpoint:e,errors:o,metadata:Object.assign({href:window.location.href,userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},r)};try{fetch(`${t}/api/zonos-elements/log-error`,{body:JSON.stringify(c),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=s();if(!o)return;fetch(`${n[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(c),method:"POST"})}},l=async({response:e,shouldLog:o=!0,shouldThrow:r=!1})=>{try{return await e.json()}catch(e){if(r)throw e;return o&&console.error(e),null}},d=async({basePathType:e,options:o,path:t})=>{let s;const i=n[e]||r,a=new URL(i+t);a.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{s=await fetch(a.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:i,errors:[{message:e.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 c=s.headers.get("Zonos-Mode"),d=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&c&&d&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await l({response:s}),response:s,zonosMode:c}}const p=s.status.toString();try{const e=await l({response:s,shouldThrow:!0});return{baseUrl:i,errors:[{message:JSON.stringify(e),type:p}],json:null,response:s,zonosMode:c}}catch(e){return{baseUrl:i,errors:[{message:`${p}: ${"Unknown error"}`,type:p}],json:null,response:null,zonosMode:c}}},p=async({basePathType:o,options:r,path:t})=>{var l,u;const m=t.startsWith("/api/bigcommerce")?"vercel":o,g=await d({basePathType:m,options:r,path:t}),{errors:w,response:y}=g,h=e(g,["errors","response"]),f=s(m),v=!!w.find((({type:e})=>"unknown"===e))||404===(null==y?void 0:y.status),L=f&&v;return v&&c({endpoint:n[m]+t,errors:w.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:m,nextFallbackApiType:f,requestHeaders:null==r?void 0:r.headers,requestPayload:i(null===(l=null==r?void 0:r.body)||void 0===l?void 0:l.toString())||(null===(u=null==r?void 0:r.body)||void 0===u?void 0:u.toString()),status:null==y?void 0:y.status,statusText:null==y?void 0:y.statusText},shouldPostReleaseErrorReporting:!0}),L?(a(`=== "${t}" failed to fetch, trying next fallback ${f}`),p({basePathType:f,options:r,path:t})):Object.assign({errors:w,response:y},h)},u=async(o,n)=>{const t=e(n||{},[]),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 p({basePathType:l||r,options:c,path:o})},m=(e,...o)=>{a(e,"error",...o)},g=["jsdelivr","cdnjs","unpkg","vercel"],w=async e=>{const o=await(async e=>{const{errors:o,json:r}=await u("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!r||o.length?null:r})(e);return a("[ZONOS - loadZonos] getting temp cart data","info",o),o?{cartData:o.cartData,storeFavicon:o.storeFaviconUrl,storeId:o.cartData.storeId,storeLogo:o.storeLogoUrl,zonosApiKey:o.cartData.credentialToken}:(m("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var y;const h=(()=>{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),r="https://v1.3.59.js.zonos.com";if(!o&&(r.includes("test.")||r.includes("test-")))return r;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 n=`https://${o}.preview.js.zonos.com`;return a(`[ZONOS-WARNING] using '${n}' for loading script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' 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,r=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",r),window.location.reload(),null})),n})();class f{static get isNpm(){return!1}}y=f,f.isBigCommerce=!1,f.requested=!1,f.zonosQaUrl=null,f.cartData=null,f.isLegacyCheckout=!1,f.legacyStoreLogo=null,f.legacyStoreFavicon=null,f.parallelLoadTimes=[],f.paralellLoadState="off",f.releaseDate="1727798297919",f.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:r,metadata:n,scriptLoadUrl:t,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(t)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!r},n)))}catch(e){}},f.loadScriptLogParallelHandler=async e=>{try{if(y.parallelLoadTimes.push(e),2===y.parallelLoadTimes.length){const e=y.parallelLoadTimes.find((e=>"vercel"===e.type)),o=y.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void c({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});y.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},f.legacyCheckoutErrorHandler=({message:e})=>{m(`[ZONOS - loadZonos] ${e}`),c({endpoint:"LegacyCheckoutInit",errors:[e],metadata:{tempCartUUID:y.cartId}}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},f.getGithubCdn=({type:e,version:o})=>{let r="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.59";"cdnjs"===e?r="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.59":"unpkg"===e&&(r="https://unpkg.com/@zonos/elements@1.3.59");return o&&"alpha"!==o?r.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):r},f.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:r,vercelUrl:n,version:t})=>{var s;const i="vercel"===e?n:y.getGithubCdn({type:e,version:t}),l=h||i,d=l.replace("https://","").replace("http://",""),p=document.createElement("script"),u=t&&t<"1.2.5"?"loadZonos.js":"zonos.js";p.src=`https://${d}/dist/scripts/${u}`,a(`[ZONOS - loadZonos] Injecting "${u}" from "${d}"`,"info");const m="4g"===(null===(s=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,r="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||r})())||void 0===s?void 0:s.effectiveType),w=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),f=g[0]===e,v=g[1],L="on"===y.paralellLoadState&&m&&f&&v&&!w;L&&y.injectZonos({cdnType:v,initConfig:o,parallelLoaded:!0,vercelUrl:n,version:t});const S=performance.now();p.addEventListener("load",(()=>{if(L||r?y.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-S,scriptLoadUrl:p.src,storeId:y.storeId,type:e}):y.loadScriptLogHandler({fallbackLoadTime:performance.now()-S,scriptLoadUrl:p.src,storeId:y.storeId,type:e}),y.isBigCommerce||(y.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=h,window.Zonos.isBigCommerce=y.isBigCommerce,y.cartId){if(!y.zonosApiKey)throw y.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!y.cartData)throw y.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(y.legacyStoreFavicon&&y.isLegacyCheckout){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=y.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.cartData=y.cartData,window.Zonos.isLegacyCheckout=y.isLegacyCheckout;const e=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:y.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},o.checkoutSettings),{successBehavior:y.isLegacyCheckout?"ZONOS_SUCCESS_PAGE":void 0,successRedirectUrl:y.isLegacyCheckout?y.cartData.storeBaseUrl:void 0}),zonosApiKey:y.zonosApiKey});o=e}window.Zonos.version&&(a(`[ZONOS - loadZonos] Execute "Zonos.init" from "${u}" from "${d}"`,"info"),window.Zonos.init(o))})),p.addEventListener("error",(async()=>{const s=(e=>{const o=g.indexOf(e);return g[o+1]||null})(e);if(!L&&!r){if(!s)return;y.injectZonos({cdnType:s,initConfig:o,vercelUrl:n,version:t})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||h)return;if(L||r)return void y.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-S,isError:!0,scriptLoadUrl:p.src,storeId:y.storeId,type:e});["unpkg","cdnjs","vercel"].includes(e)?c({endpoint:p.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-S,cdnType:e,loadUrl:l,version:t},shouldPostReleaseErrorReporting:!!s}):c({endpoint:p.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-S}})})),document.head.appendChild(p)},f.init=async e=>{var o;y.cartId=new URLSearchParams(window.location.search).get("tempCartUUID");const r="https://v1.3.59.js.zonos.com",n=document.querySelector('script[src*="/zonos.js"]'),t=null===(o=document.querySelector("script[src*='/loadZonos.js']"))||void 0===o?void 0:o.src,s=null==t?void 0:t.includes("timestamp=");if(!(y.isNpm||t&&s))return void m("[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(n||!t||y.requested)return void a("[ZONOS - loadZonos] script is already loaded or requested","info");if(!e.zonosApiKey&&!y.cartId)return y.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void m("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(y.requested=!0,y.zonosApiKey=e.zonosApiKey,y.storeId=e.storeId,y.cartId){const e=await w(y.cartId);if(!e)throw y.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");y.cartData=e.cartData,y.zonosApiKey=e.zonosApiKey,y.legacyStoreLogo=e.storeLogo,y.legacyStoreFavicon=e.storeFavicon,y.storeId=e.storeId,y.zonosApiKey=e.zonosApiKey}if(!y.zonosApiKey)return void m('"zonosApiKey" is required to initialize Zonos');if(!y.storeId)return a("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void y.injectZonos({initConfig:e,vercelUrl:r,version:null});const i=new URLSearchParams;i.set("storeId",e.storeId.toString());const c=`/api/get-store-version?${i.toString()}`,{errors:l,json:d}=await u(c);if(l.length||!d)return a("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void y.injectZonos({initConfig:e,vercelUrl:r,version:null});const{version:p}=d;if(!n){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,r=["dev.elements.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:r}})({loadScriptSrc:t}),s=n&&!r?o:`${"alpha"===p?"alpha":`v${p}`}.js.zonos.com`,i=n&&!r?null:p;a("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n,loadUrl:s,loadVersion:i,version:p}),y.injectZonos({initConfig:e,vercelUrl:s,version:i})}},void 0===window.Zonos&&(window.Zonos=f)})();
|
|
1
|
+
(function(){"use strict";function e(e,o){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(n=Object.getOwnPropertySymbols(e);t<n.length;t++)o.indexOf(n[t])<0&&Object.prototype.propertyIsEnumerable.call(e,n[t])&&(r[n[t]]=e[n[t]])}return r}"function"==typeof SuppressedError&&SuppressedError;const o=["cloudflare","vercel"],r=o[0],n={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},t=n[r],s=(e=r)=>{const n=o.indexOf(e),t=o[n+1];return t||null},i=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},a=(e,o,...r)=>{var n,t;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===o&&console.error(e,...r));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(t=s.contentWindow)||void 0===t?void 0:t.window.console)||window.console;switch(o){case"warn":i.warn(e,...r);break;case"info":i.info(e,...r);break;case"error":i.error(e,...r);break;default:i.groupCollapsed(e,...r),i.trace(),i.groupEnd()}},c=async({endpoint:e,errors:o,metadata:r,shouldPostReleaseErrorReporting:i})=>{if(i){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,c={endpoint:e,errors:o,metadata:Object.assign({href:window.location.href,userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},r)};try{fetch(`${t}/api/zonos-elements/log-error`,{body:JSON.stringify(c),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=s();if(!o)return;fetch(`${n[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(c),method:"POST"})}},l=async({response:e,shouldLog:o=!0,shouldThrow:r=!1})=>{try{return await e.json()}catch(e){if(r)throw e;return o&&console.error(e),null}},d=async({basePathType:e,options:o,path:t})=>{let s;const i=n[e]||r,a=new URL(i+t);a.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{s=await fetch(a.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:i,errors:[{message:e.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 c=s.headers.get("Zonos-Mode"),d=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&c&&d&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await l({response:s}),response:s,zonosMode:c}}const p=s.status.toString();try{const e=await l({response:s,shouldThrow:!0});return{baseUrl:i,errors:[{message:JSON.stringify(e),type:p}],json:null,response:s,zonosMode:c}}catch(e){return{baseUrl:i,errors:[{message:`${p}: ${"Unknown error"}`,type:p}],json:null,response:null,zonosMode:c}}},p=async({basePathType:o,options:r,path:t})=>{var l,u;const m=t.startsWith("/api/bigcommerce")?"vercel":o,g=await d({basePathType:m,options:r,path:t}),{errors:w,response:y}=g,h=e(g,["errors","response"]),f=s(m),v=!!w.find((({type:e})=>"unknown"===e))||404===(null==y?void 0:y.status),L=f&&v;return v&&c({endpoint:n[m]+t,errors:w.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:m,nextFallbackApiType:f,requestHeaders:null==r?void 0:r.headers,requestPayload:i(null===(l=null==r?void 0:r.body)||void 0===l?void 0:l.toString())||(null===(u=null==r?void 0:r.body)||void 0===u?void 0:u.toString()),status:null==y?void 0:y.status,statusText:null==y?void 0:y.statusText},shouldPostReleaseErrorReporting:!0}),L?(a(`=== "${t}" failed to fetch, trying next fallback ${f}`),p({basePathType:f,options:r,path:t})):Object.assign({errors:w,response:y},h)},u=async(o,n)=>{const t=e(n||{},[]),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 p({basePathType:l||r,options:c,path:o})},m=(e,...o)=>{a(e,"error",...o)},g=["jsdelivr","cdnjs","unpkg","vercel"],w=async e=>{const o=await(async e=>{const{errors:o,json:r}=await u("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!r||o.length?null:r})(e);return a("[ZONOS - loadZonos] getting temp cart data","info",o),o?{cartData:o.cartData,storeFavicon:o.storeFaviconUrl,storeId:o.cartData.storeId,storeLogo:o.storeLogoUrl,zonosApiKey:o.cartData.credentialToken}:(m("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var y;const h=(()=>{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),r="https://v1.3.61.js.zonos.com";if(!o&&(r.includes("test.")||r.includes("test-")))return r;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 n=`https://${o}.preview.js.zonos.com`;return a(`[ZONOS-WARNING] using '${n}' for loading script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' 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,r=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",r),window.location.reload(),null})),n})();class f{static get isNpm(){return!1}}y=f,f.isBigCommerce=!1,f.requested=!1,f.zonosQaUrl=null,f.cartData=null,f.isLegacyCheckout=!1,f.legacyStoreLogo=null,f.legacyStoreFavicon=null,f.parallelLoadTimes=[],f.paralellLoadState="off",f.releaseDate="1727820260282",f.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:r,metadata:n,scriptLoadUrl:t,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(t)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!r},n)))}catch(e){}},f.loadScriptLogParallelHandler=async e=>{try{if(y.parallelLoadTimes.push(e),2===y.parallelLoadTimes.length){const e=y.parallelLoadTimes.find((e=>"vercel"===e.type)),o=y.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void c({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});y.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},f.legacyCheckoutErrorHandler=({message:e})=>{m(`[ZONOS - loadZonos] ${e}`),c({endpoint:"LegacyCheckoutInit",errors:[e],metadata:{tempCartUUID:y.cartId}}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},f.getGithubCdn=({type:e,version:o})=>{let r="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.61";"cdnjs"===e?r="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.61":"unpkg"===e&&(r="https://unpkg.com/@zonos/elements@1.3.61");return o&&"alpha"!==o?r.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):r},f.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:r,vercelUrl:n,version:t})=>{var s;const i="vercel"===e?n:y.getGithubCdn({type:e,version:t}),l=h||i,d=l.replace("https://","").replace("http://",""),p=document.createElement("script"),u=t&&t<"1.2.5"?"loadZonos.js":"zonos.js";p.src=`https://${d}/dist/scripts/${u}`,a(`[ZONOS - loadZonos] Injecting "${u}" from "${d}"`,"info");const m="4g"===(null===(s=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,r="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||r})())||void 0===s?void 0:s.effectiveType),w=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),f=g[0]===e,v=g[1],L="on"===y.paralellLoadState&&m&&f&&v&&!w;L&&y.injectZonos({cdnType:v,initConfig:o,parallelLoaded:!0,vercelUrl:n,version:t});const S=performance.now();p.addEventListener("load",(()=>{if(L||r?y.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-S,scriptLoadUrl:p.src,storeId:y.storeId,type:e}):y.loadScriptLogHandler({fallbackLoadTime:performance.now()-S,scriptLoadUrl:p.src,storeId:y.storeId,type:e}),y.isBigCommerce||(y.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=h,window.Zonos.isBigCommerce=y.isBigCommerce,y.cartId){if(!y.zonosApiKey)throw y.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!y.cartData)throw y.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(y.legacyStoreFavicon&&y.isLegacyCheckout){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=y.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.cartData=y.cartData,window.Zonos.isLegacyCheckout=y.isLegacyCheckout;const e=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:y.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},o.checkoutSettings),{successBehavior:y.isLegacyCheckout?"ZONOS_SUCCESS_PAGE":void 0,successRedirectUrl:y.isLegacyCheckout?y.cartData.storeBaseUrl:void 0}),zonosApiKey:y.zonosApiKey});o=e}window.Zonos.version&&(a(`[ZONOS - loadZonos] Execute "Zonos.init" from "${u}" from "${d}"`,"info"),window.Zonos.init(o))})),p.addEventListener("error",(async()=>{const s=(e=>{const o=g.indexOf(e);return g[o+1]||null})(e);if(!L&&!r){if(!s)return;y.injectZonos({cdnType:s,initConfig:o,vercelUrl:n,version:t})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||h)return;if(L||r)return void y.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-S,isError:!0,scriptLoadUrl:p.src,storeId:y.storeId,type:e});["unpkg","cdnjs","vercel"].includes(e)?c({endpoint:p.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-S,cdnType:e,loadUrl:l,version:t},shouldPostReleaseErrorReporting:!!s}):c({endpoint:p.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-S}})})),document.head.appendChild(p)},f.init=async e=>{var o;y.cartId=new URLSearchParams(window.location.search).get("tempCartUUID");const r="https://v1.3.61.js.zonos.com",n=document.querySelector('script[src*="/zonos.js"]'),t=null===(o=document.querySelector("script[src*='/loadZonos.js']"))||void 0===o?void 0:o.src,s=null==t?void 0:t.includes("timestamp=");if(!(y.isNpm||t&&s))return void m("[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(n||!t||y.requested)return void a("[ZONOS - loadZonos] script is already loaded or requested","info");if(!e.zonosApiKey&&!y.cartId)return y.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void m("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(y.requested=!0,y.zonosApiKey=e.zonosApiKey,y.storeId=e.storeId,y.cartId){const e=await w(y.cartId);if(!e)throw y.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");y.cartData=e.cartData,y.zonosApiKey=e.zonosApiKey,y.legacyStoreLogo=e.storeLogo,y.legacyStoreFavicon=e.storeFavicon,y.storeId=e.storeId,y.zonosApiKey=e.zonosApiKey}if(!y.zonosApiKey)return void m('"zonosApiKey" is required to initialize Zonos');if(!y.storeId)return a("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void y.injectZonos({initConfig:e,vercelUrl:r,version:null});const i=new URLSearchParams;i.set("storeId",e.storeId.toString());const c=`/api/get-store-version?${i.toString()}`,{errors:l,json:d}=await u(c);if(l.length||!d)return a("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void y.injectZonos({initConfig:e,vercelUrl:r,version:null});const{version:p}=d;if(!n){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,r=["dev.elements.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:r}})({loadScriptSrc:t}),s=n&&!r?o:`${"alpha"===p?"alpha":`v${p}`}.js.zonos.com`,i=n&&!r?null:p;a("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n,loadUrl:s,loadVersion:i,version:p}),y.injectZonos({initConfig:e,vercelUrl:s,version:i})}},void 0===window.Zonos&&(window.Zonos=f)})();
|
package/dist/scripts/zonos.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=(e,t,...o)=>{var n,r;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...o));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...o);break;case"info":i.info(e,...o);break;case"error":i.error(e,...o);break;default:i.groupCollapsed(e,...o),i.trace(),i.groupEnd()}},t=(t,...o)=>{e(t,"error",...o)},o=["jsdelivr","cdnjs","unpkg","vercel"],n="jsdelivr",r=e=>{const t=o.indexOf(e);return o[t+1]||null},s=()=>{const t=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||t)return null;const o=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.59.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 e(`[ZONOS-WARNING] using '${r}' for loading 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:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},i="https://js.stripe.com/v3",l=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,a="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((o,n)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(a),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${i}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&l.test(o.src))return o}return null})();r&&e?console.warn(a):r||(r=(e=>{const o=document.createElement("script");o.src=`${i}`;const n=document.head||document.body;return n?(n.appendChild(o),o):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):n(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else o(null)}))),c),u=Promise.resolve().then((()=>d(null)));let p=!1;u.catch((e=>{p||console.warn(e)}));function m(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const h=["cloudflare","vercel"],y=h[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},g=w[y],f=(e=y)=>{const t=h.indexOf(e),o=h[t+1];return o||null},v=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},b=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},S=async({basePathType:e,options:t,path:o})=>{let n;const r=w[e]||y,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}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 i=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:i}}const a=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:a}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${a}: ${"Unknown error"}`,type:a}],json:null,response:null,zonosMode:i}}},z=async({basePathType:t,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":t,l=await S({basePathType:i,options:o,path:n}),{errors:a,response:c}=l,d=m(l,["errors","response"]),u=f(i),p=!!a.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),h=u&&p;return p&&(async({endpoint:e,errors:t,metadata:o,shouldPostReleaseErrorReporting:n})=>{if(n){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},o)};try{fetch(`${g}/api/zonos-elements/log-error`,{body:JSON.stringify(s),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=f();if(!t)return;fetch(`${w[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(s),method:"POST"})}})({endpoint:w[i]+n,errors:a.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==o?void 0:o.headers,requestPayload:v(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}),h?(e(`=== "${n}" failed to fetch, trying next fallback ${u}`),z({basePathType:u,options:o,path:n})):Object.assign({errors:a,response:c},d)},j=async e=>{const{errors:t,json:o}=await(async(e,t)=>{const o=m(t||{},[]),n=o.body?JSON.stringify(o.body):void 0,r=o.method||"GET",s=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"},o.headers),i=Object.assign(Object.assign({},o),{body:"GET"===r?void 0:n,headers:s,method:r}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return z({basePathType:l||y,options:i,path:e})})("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!o||t.length?null:o};var O;const C=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),k="https://v1.3.59.js.zonos.com",E=C||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.59",A="https://rsms.me",Z="https://fonts.googleapis.com",U=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class T{}O=T,T.doneInit=!1,T.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),T.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),T._paypalMockResponse=null,T.isBigCommerce=!1,T.releaseDate="1727798297919",T.isLegacyCheckout=!1,T.isNpm=!0,T.zonosQaUrl=null,T.version="v1.3.59",T.modeAlerted=!1,T.cartData=null,T.paypal=null,T.getCurrentTimestamp=()=>(new Date).getTime(),T.zonosController=null,T.init=async({appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:a,zonosApiKey:c})=>{if(O.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!O.doneInit){if(e(`====== ZONOS DEBUG MODE: on (${O.version}) ======`),O.zonosApiKey=c,O.storeId=a,O.isNpm){if(e("====== ZONOS LOADING FROM NPM ======"),!c&&!O.cartId)return void t("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!O.cartData&&O.cartId){e("Initialize cart data");const o=await(async o=>{const n=await j(o);return e("[ZONOS - loadZonos] getting temp cart data","info",n),n?{cartData:n.cartData,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}:(t("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(O.cartId);if(!o)return void t("Failed to get cart data");O.cartData=o.cartData,O.zonosApiKey=o.zonosApiKey}}if(O.cartId&&O.cartData){e("Cart data is available, inject hidden button and trigger checkout");const t=document.createElement("button");t.style.display="none",t.id="zonos--checkout-hidden-button",document.body.appendChild(t)}e("init zonos"),O.injectZonosCdn(),O.injectZonosCss(),O.injectFonts(),O.injectController({config:{appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l}}),O.doneInit=!0}},T.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},T.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},T.showNotification=e=>{var t;null===(t=O.zonosController)||void 0===t||t.showNotification(e)},T.updateOrganizationName=e=>{var t;null===(t=O.zonosController)||void 0===t||t.updateOrganizationName(e)},T.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:o,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const t=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&o&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},T.injectController=({config:o})=>{var n;if(document.querySelector("zonos-controller"))return;if(null===(n=o.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const e=o.checkoutSettings.placeOrderButtonSelector;O.disablePlaceOrderButtons({config:o,disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{O.disablePlaceOrderButtons({config:o,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=o,r.zonosApiKey=O.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async o=>{const{detail:n}=o;e("loading Stripe");const s=await(async(...e)=>{p=!0;const t=Date.now();return u.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(n.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),O.zonosController=r,e("Zonos controller injected!")},T.injectScript=({cdnType:o,isModule:n,theRestUrl:s})=>{const i=`${O.getZonosUrl(o)}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,a=document.createElement("script");n?a.type="module":a.noModule=!0,a.src=i,a.crossOrigin="anonymous",a.onerror=()=>{t(`Failed to load ${a.src}`);const e=r(o);e&&O.injectScript({cdnType:e,isModule:n,theRestUrl:s})},l.appendChild(a)},T.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return E;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.59";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.59";case"vercel":return k}};if(O.isNpm){return s()||t()}return t()},T.injectZonosCdn=()=>{O.injectScript({cdnType:n,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),O.injectScript({cdnType:n,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},T.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const n=O.getZonosUrl(e),s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${k}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${n}/${o}`,l.onerror=()=>{t(`Failed to load ${l.href}`);const n=r(e);n&&O.injectStylesheet({cdnType:n,theRestUrl:o})},s.appendChild(l)},T.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(O.injectStylesheet({cdnType:n,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},T.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${A}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!U.test(o.href))return o}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=A,t.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${A}/inter/inter.css`,t.appendChild(n),e("Zonos font injected!")},T.setupGoogleFont=e=>{var t;null===(t=O.zonosController)||void 0===t||t.setupGoogleFont(e)},T.injectSupportGoogleFont=t=>{var o;e(`[FONT] injecting ${t}`);const n=null===(o=t.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${Z}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=Z,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=T)})();
|
|
1
|
+
(function(){"use strict";const e=(e,t,...o)=>{var n,r;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...o));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...o);break;case"info":i.info(e,...o);break;case"error":i.error(e,...o);break;default:i.groupCollapsed(e,...o),i.trace(),i.groupEnd()}},t=(t,...o)=>{e(t,"error",...o)},o=["jsdelivr","cdnjs","unpkg","vercel"],n="jsdelivr",r=e=>{const t=o.indexOf(e);return o[t+1]||null},s=()=>{const t=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||t)return null;const o=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.61.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 e(`[ZONOS-WARNING] using '${r}' for loading 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:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},i="https://js.stripe.com/v3",l=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,a="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((o,n)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(a),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${i}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&l.test(o.src))return o}return null})();r&&e?console.warn(a):r||(r=(e=>{const o=document.createElement("script");o.src=`${i}`;const n=document.head||document.body;return n?(n.appendChild(o),o):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):n(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else o(null)}))),c),u=Promise.resolve().then((()=>d(null)));let p=!1;u.catch((e=>{p||console.warn(e)}));function m(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const h=["cloudflare","vercel"],y=h[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},g=w[y],f=(e=y)=>{const t=h.indexOf(e),o=h[t+1];return o||null},v=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},b=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},S=async({basePathType:e,options:t,path:o})=>{let n;const r=w[e]||y,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}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 i=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:i}}const a=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:a}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${a}: ${"Unknown error"}`,type:a}],json:null,response:null,zonosMode:i}}},z=async({basePathType:t,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":t,l=await S({basePathType:i,options:o,path:n}),{errors:a,response:c}=l,d=m(l,["errors","response"]),u=f(i),p=!!a.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),h=u&&p;return p&&(async({endpoint:e,errors:t,metadata:o,shouldPostReleaseErrorReporting:n})=>{if(n){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},o)};try{fetch(`${g}/api/zonos-elements/log-error`,{body:JSON.stringify(s),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=f();if(!t)return;fetch(`${w[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(s),method:"POST"})}})({endpoint:w[i]+n,errors:a.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==o?void 0:o.headers,requestPayload:v(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}),h?(e(`=== "${n}" failed to fetch, trying next fallback ${u}`),z({basePathType:u,options:o,path:n})):Object.assign({errors:a,response:c},d)},j=async e=>{const{errors:t,json:o}=await(async(e,t)=>{const o=m(t||{},[]),n=o.body?JSON.stringify(o.body):void 0,r=o.method||"GET",s=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"},o.headers),i=Object.assign(Object.assign({},o),{body:"GET"===r?void 0:n,headers:s,method:r}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return z({basePathType:l||y,options:i,path:e})})("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!o||t.length?null:o};var O;const C=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),k="https://v1.3.61.js.zonos.com",E=C||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.61",A="https://rsms.me",Z="https://fonts.googleapis.com",U=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class T{}O=T,T.doneInit=!1,T.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),T.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),T._paypalMockResponse=null,T.isBigCommerce=!1,T.releaseDate="1727820260282",T.isLegacyCheckout=!1,T.isNpm=!0,T.zonosQaUrl=null,T.version="v1.3.61",T.modeAlerted=!1,T.cartData=null,T.paypal=null,T.getCurrentTimestamp=()=>(new Date).getTime(),T.zonosController=null,T.init=async({appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:a,zonosApiKey:c})=>{if(O.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!O.doneInit){if(e(`====== ZONOS DEBUG MODE: on (${O.version}) ======`),O.zonosApiKey=c,O.storeId=a,O.isNpm){if(e("====== ZONOS LOADING FROM NPM ======"),!c&&!O.cartId)return void t("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!O.cartData&&O.cartId){e("Initialize cart data");const o=await(async o=>{const n=await j(o);return e("[ZONOS - loadZonos] getting temp cart data","info",n),n?{cartData:n.cartData,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}:(t("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(O.cartId);if(!o)return void t("Failed to get cart data");O.cartData=o.cartData,O.zonosApiKey=o.zonosApiKey}}if(O.cartId&&O.cartData){e("Cart data is available, inject hidden button and trigger checkout");const t=document.createElement("button");t.style.display="none",t.id="zonos--checkout-hidden-button",document.body.appendChild(t)}e("init zonos"),O.injectZonosCdn(),O.injectZonosCss(),O.injectFonts(),O.injectController({config:{appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l}}),O.doneInit=!0}},T.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},T.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},T.showNotification=e=>{var t;null===(t=O.zonosController)||void 0===t||t.showNotification(e)},T.updateOrganizationName=e=>{var t;null===(t=O.zonosController)||void 0===t||t.updateOrganizationName(e)},T.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:o,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const t=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&o&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},T.injectController=({config:o})=>{var n;if(document.querySelector("zonos-controller"))return;if(null===(n=o.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const e=o.checkoutSettings.placeOrderButtonSelector;O.disablePlaceOrderButtons({config:o,disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{O.disablePlaceOrderButtons({config:o,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=o,r.zonosApiKey=O.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async o=>{const{detail:n}=o;e("loading Stripe");const s=await(async(...e)=>{p=!0;const t=Date.now();return u.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(n.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),O.zonosController=r,e("Zonos controller injected!")},T.injectScript=({cdnType:o,isModule:n,theRestUrl:s})=>{const i=`${O.getZonosUrl(o)}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,a=document.createElement("script");n?a.type="module":a.noModule=!0,a.src=i,a.crossOrigin="anonymous",a.onerror=()=>{t(`Failed to load ${a.src}`);const e=r(o);e&&O.injectScript({cdnType:e,isModule:n,theRestUrl:s})},l.appendChild(a)},T.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return E;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.61";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.61";case"vercel":return k}};if(O.isNpm){return s()||t()}return t()},T.injectZonosCdn=()=>{O.injectScript({cdnType:n,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),O.injectScript({cdnType:n,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},T.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const n=O.getZonosUrl(e),s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${k}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${n}/${o}`,l.onerror=()=>{t(`Failed to load ${l.href}`);const n=r(e);n&&O.injectStylesheet({cdnType:n,theRestUrl:o})},s.appendChild(l)},T.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(O.injectStylesheet({cdnType:n,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},T.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${A}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!U.test(o.href))return o}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=A,t.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${A}/inter/inter.css`,t.appendChild(n),e("Zonos font injected!")},T.setupGoogleFont=e=>{var t;null===(t=O.zonosController)||void 0===t||t.setupGoogleFont(e)},T.injectSupportGoogleFont=t=>{var o;e(`[FONT] injecting ${t}`);const n=null===(o=t.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${Z}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=Z,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=T)})();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CurrencyConverter, LoadZonosParamsConfig } from "../../scripts/_zonosBase";
|
|
2
2
|
import type { CheckoutConfig } from "../../types/checkout/CheckoutConfig";
|
|
3
|
-
import type { ElementsUiStyle, ElementsUiTheme, ZonosAttribution, ZonosSettingsQuery } from "../../types/generated/graphql.customer.types";
|
|
3
|
+
import type { CountryCode, ElementsUiStyle, ElementsUiTheme, ZonosAttribution, ZonosSettingsQuery } from "../../types/generated/graphql.customer.types";
|
|
4
4
|
import type { HelloConfig } from "../../types/hello/HelloConfig";
|
|
5
5
|
export type AppearanceConfig = {
|
|
6
6
|
colorPrimary?: string;
|
|
@@ -17,6 +17,10 @@ export type ZonosConfig = {
|
|
|
17
17
|
checkoutSettings: CheckoutConfig;
|
|
18
18
|
currencyConverter?: CurrencyConverter;
|
|
19
19
|
currentHelloPage: Page | '';
|
|
20
|
+
/**
|
|
21
|
+
* List of countries that are disabled in the checkout, will also be disabled for hello
|
|
22
|
+
*/
|
|
23
|
+
disabledCountries: CountryCode[];
|
|
20
24
|
helloSettings: HelloConfig;
|
|
21
25
|
/**
|
|
22
26
|
* Callback to be called when the country is changed
|