@zonos/elements 1.3.290 → 1.3.292
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-7DceSLKl.js → cart-B6Aty-21.js} +1 -1
- package/dist/cjs/{collect-C08DUE1L.js → collect-Oeo5tjN5.js} +2 -2
- package/dist/cjs/{getMissingRequiredShippingFields-Duz8xpmf.js → getMissingRequiredShippingFields-D03ICqss.js} +1 -1
- package/dist/cjs/{hasInclusivePrice-C-iyXqJ0.js → hasInclusivePrice-CPCoVeU3.js} +1 -1
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/{invoice-DSuHUQpi.js → invoice-Cj8W7NW0.js} +2 -2
- package/dist/cjs/{localization-BJqYz_PB.js → localization-BzNeXeDe.js} +24 -15
- package/dist/cjs/{paypal-CZoctP9S.js → paypal-CuKshRmZ.js} +2 -2
- package/dist/cjs/{placeTestOrder-D7baFuaV.js → placeTestOrder-7czjwkjm.js} +2 -2
- package/dist/cjs/{renderCheckoutCurrency-Ca2HH1Gc.js → renderCheckoutCurrency-BH8t2b2x.js} +2 -2
- package/dist/cjs/{shouldShowLanguageSelect-FyTdz7U_.js → shouldShowLanguageSelect-yAbtCmd8.js} +1 -1
- package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +3 -3
- package/dist/cjs/zonos-address-display_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-address_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +3 -3
- package/dist/cjs/zonos-card_5.cjs.entry.js +3 -3
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +8 -8
- package/dist/cjs/zonos-checkout.cjs.entry.js +3 -3
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +2 -2
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +7 -7
- package/dist/cjs/zonos-collect.cjs.entry.js +4 -4
- package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +4 -4
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +7 -7
- package/dist/cjs/zonos-invoice.cjs.entry.js +4 -4
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +3 -3
- package/dist/collection/components/store/hello/localization.js +4 -1
- package/dist/collection/components/utils/hello/countryOverrideStorage.js +20 -14
- package/dist/esm/{cart-Cleo1j5P.js → cart-BoQp8Ema.js} +1 -1
- package/dist/esm/{collect-CspdWIRo.js → collect-CdrR5OBy.js} +2 -2
- package/dist/esm/{getMissingRequiredShippingFields-B1IL1-gn.js → getMissingRequiredShippingFields-Ks6_tpjn.js} +1 -1
- package/dist/esm/{hasInclusivePrice-DKRplpLX.js → hasInclusivePrice-CbEfIhI5.js} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/{invoice-D49igPQ9.js → invoice-S1KahJ_Z.js} +2 -2
- package/dist/esm/{localization-BiL8bPsY.js → localization-BIh-4pc_.js} +24 -15
- package/dist/esm/{paypal-D4vWRxHJ.js → paypal-DNfvnuUU.js} +2 -2
- package/dist/esm/{placeTestOrder-BNmc5RCo.js → placeTestOrder-CQaMKFOg.js} +2 -2
- package/dist/esm/{renderCheckoutCurrency-BNbwijGo.js → renderCheckoutCurrency-C2Tw73uR.js} +2 -2
- package/dist/esm/{shouldShowLanguageSelect-B82gTfHz.js → shouldShowLanguageSelect-CCD7gpSY.js} +1 -1
- package/dist/esm/zonos-address-completion-dialog_7.entry.js +3 -3
- package/dist/esm/zonos-address-display_2.entry.js +1 -1
- package/dist/esm/zonos-address_4.entry.js +2 -2
- package/dist/esm/zonos-airwallex-payment.entry.js +3 -3
- package/dist/esm/zonos-card_5.entry.js +3 -3
- package/dist/esm/zonos-cart-items_12.entry.js +8 -8
- package/dist/esm/zonos-checkout.entry.js +3 -3
- package/dist/esm/zonos-collect-cart-items_3.entry.js +2 -2
- package/dist/esm/zonos-collect-finish_6.entry.js +7 -7
- package/dist/esm/zonos-collect.entry.js +4 -4
- package/dist/esm/zonos-controller.entry.js +2 -2
- package/dist/esm/zonos-country-flag.entry.js +2 -2
- package/dist/esm/zonos-country-select_4.entry.js +2 -2
- package/dist/esm/zonos-hello-dialog.entry.js +2 -2
- package/dist/esm/zonos-hello.entry.js +1 -1
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +4 -4
- package/dist/esm/zonos-invoice-finish_5.entry.js +7 -7
- package/dist/esm/zonos-invoice.entry.js +4 -4
- package/dist/esm/zonos-language-select_2.entry.js +1 -1
- package/dist/esm/zonos-policy-consent_2.entry.js +3 -3
- package/dist/esm-es5/{cart-Cleo1j5P.js → cart-BoQp8Ema.js} +8 -8
- package/dist/esm-es5/{collect-CspdWIRo.js → collect-CdrR5OBy.js} +1 -1
- package/dist/esm-es5/{getMissingRequiredShippingFields-B1IL1-gn.js → getMissingRequiredShippingFields-Ks6_tpjn.js} +3 -3
- package/dist/esm-es5/{hasInclusivePrice-DKRplpLX.js → hasInclusivePrice-CbEfIhI5.js} +1 -1
- package/dist/esm-es5/index.js +4 -4
- package/dist/esm-es5/{invoice-D49igPQ9.js → invoice-S1KahJ_Z.js} +1 -1
- package/dist/esm-es5/{localization-BiL8bPsY.js → localization-BIh-4pc_.js} +13 -3
- package/dist/esm-es5/{paypal-D4vWRxHJ.js → paypal-DNfvnuUU.js} +1 -1
- package/dist/esm-es5/{placeTestOrder-BNmc5RCo.js → placeTestOrder-CQaMKFOg.js} +1 -1
- package/dist/esm-es5/{renderCheckoutCurrency-BNbwijGo.js → renderCheckoutCurrency-C2Tw73uR.js} +2 -2
- package/dist/esm-es5/{shouldShowLanguageSelect-B82gTfHz.js → shouldShowLanguageSelect-CCD7gpSY.js} +1 -1
- package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +1 -1
- package/dist/esm-es5/zonos-address-display_2.entry.js +1 -1
- package/dist/esm-es5/zonos-address_4.entry.js +1 -1
- package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
- package/dist/esm-es5/zonos-card_5.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +3 -3
- package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
- package/dist/esm-es5/zonos-collect.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 +2 -2
- 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-invoice-cart-items_2.entry.js +2 -2
- package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
- package/dist/scripts/index.d.ts +2 -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/checkout/cart.d.ts +2 -0
- package/dist/types/components/utils/hello/countryOverrideStorage.d.ts +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-0ee74bf3.system.entry.js → p-04bded81.system.entry.js} +22 -22
- package/dist/zonos-elements/{p-c3b02dbf.entry.js → p-06fe2939.entry.js} +1 -1
- package/dist/zonos-elements/{p-13d3a372.system.entry.js → p-0b81f8b9.system.entry.js} +14 -14
- package/dist/zonos-elements/{p-d6b72f6d.entry.js → p-0fca452b.entry.js} +1 -1
- package/dist/zonos-elements/{p-a571beaa.system.entry.js → p-11defdca.system.entry.js} +16 -16
- package/dist/zonos-elements/{p-fb869759.system.entry.js → p-17c7ea4a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-9ef0f69e.system.entry.js → p-23352709.system.entry.js} +3 -3
- package/dist/zonos-elements/{p-a5c25829.system.entry.js → p-249c1ee1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-52d9fd3a.entry.js → p-34656e6c.entry.js} +1 -1
- package/dist/zonos-elements/{p-c4ad6d4b.entry.js → p-39ee1558.entry.js} +1 -1
- package/dist/zonos-elements/p-4679f0ec.entry.js +1 -0
- package/dist/zonos-elements/{p-23f6346b.system.entry.js → p-4806b264.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3c800376.system.entry.js → p-5016d71b.system.entry.js} +59 -59
- package/dist/zonos-elements/{p-5f347f91.system.entry.js → p-51400242.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-35509b10.system.entry.js → p-5236c676.system.entry.js} +20 -20
- package/dist/zonos-elements/{p-ddca5ee1.entry.js → p-550d4eea.entry.js} +1 -1
- package/dist/zonos-elements/{p-481ecc23.system.entry.js → p-552fbde1.system.entry.js} +20 -20
- package/dist/zonos-elements/{p-1b77464d.system.entry.js → p-5b80aff2.system.entry.js} +13 -13
- package/dist/zonos-elements/{p-079af8c0.system.entry.js → p-69c3e367.system.entry.js} +9 -9
- package/dist/zonos-elements/{p-7d284341.system.entry.js → p-6abec43f.system.entry.js} +3 -3
- package/dist/zonos-elements/{p-5df25a1a.entry.js → p-6c41b00c.entry.js} +1 -1
- package/dist/zonos-elements/{p-f37b8aaf.system.entry.js → p-6db7c0b1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-990b49f2.entry.js → p-6e296228.entry.js} +1 -1
- package/dist/zonos-elements/{p-BDrM4x5N.js → p-7abqRc9V.js} +2 -2
- package/dist/zonos-elements/{p-ba510730.entry.js → p-82595838.entry.js} +1 -1
- package/dist/zonos-elements/{p-84c9ce16.entry.js → p-938fc1e4.entry.js} +1 -1
- package/dist/zonos-elements/{p-7ee2af6e.system.entry.js → p-9c33f7ed.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-DVITR-Eu.system.js → p-Be3Hpms1.system.js} +1 -1
- package/dist/zonos-elements/p-Bu9WCfUC.system.js +1 -1
- package/dist/zonos-elements/{p-BT9_ehlh.system.js → p-CEK_Wk6v.system.js} +1 -1
- package/dist/zonos-elements/p-CFbfEmjN.js +1 -0
- package/dist/zonos-elements/p-D-bZg-Pc.js +1 -0
- package/dist/zonos-elements/{p-CASTsiDR.system.js → p-D4MevhAL.system.js} +3 -3
- package/dist/zonos-elements/{p-tGJYTlGL.system.js → p-DI2vXnXc.system.js} +3 -3
- package/dist/zonos-elements/{p-Cpe_ISNt.system.js → p-DNc279vN.system.js} +27 -27
- package/dist/zonos-elements/{p-CEmXVahp.system.js → p-DOD2I44l.system.js} +92 -82
- package/dist/zonos-elements/{p-uuZUZPIm.system.js → p-DS-qw_qc.system.js} +10 -10
- package/dist/zonos-elements/p-DZ2mevDK.js +1 -0
- package/dist/zonos-elements/{p-CewmhMGk.js → p-DzLNk-Pf.js} +1 -1
- package/dist/zonos-elements/{p-DwkyNtpD.js → p-FRWZayxL.js} +1 -1
- package/dist/zonos-elements/p-Mrz_lnC1.js +1 -0
- package/dist/zonos-elements/{p-B_5RofQ9.system.js → p-XDxdMlQl.system.js} +23 -23
- package/dist/zonos-elements/{p-DYIisqF7.system.js → p-XqkqjeNV.system.js} +1 -1
- package/dist/zonos-elements/{p-4fd78ecf.system.entry.js → p-a40fd99b.system.entry.js} +9 -9
- package/dist/zonos-elements/{p-79ddb12a.system.entry.js → p-b2dd7f02.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-11bab88b.entry.js → p-b79036fc.entry.js} +1 -1
- package/dist/zonos-elements/{p-26295311.entry.js → p-bb3546c0.entry.js} +1 -1
- package/dist/zonos-elements/p-c1cbfdba.entry.js +1 -0
- package/dist/zonos-elements/{p-7e1050dd.system.entry.js → p-c3646ae6.system.entry.js} +15 -15
- package/dist/zonos-elements/{p-028e0500.entry.js → p-c47ce656.entry.js} +1 -1
- package/dist/zonos-elements/{p-34c5e145.entry.js → p-c5bab786.entry.js} +1 -1
- package/dist/zonos-elements/{p-234c202c.entry.js → p-c961caaf.entry.js} +1 -1
- package/dist/zonos-elements/{p-NJVOYjda.js → p-c9QtIdJX.js} +1 -1
- package/dist/zonos-elements/{p-Cuk0LLGQ.js → p-clDfq9AL.js} +1 -1
- package/dist/zonos-elements/{p-db75322d.entry.js → p-d168023b.entry.js} +1 -1
- package/dist/zonos-elements/{p-5b06f069.entry.js → p-db87b0dd.entry.js} +1 -1
- package/dist/zonos-elements/{p-dd8ca91e.entry.js → p-defc2d18.entry.js} +1 -1
- package/dist/zonos-elements/{p-0dca8a26.system.entry.js → p-e0e9cff5.system.entry.js} +26 -26
- package/dist/zonos-elements/p-f8b50aa0.entry.js +1 -0
- package/dist/zonos-elements/{p-tkSf-lrO.system.js → p-kaOxUR9u.system.js} +5 -5
- package/dist/zonos-elements/p-rVp8hgWw.js +1 -0
- package/dist/zonos-elements/{p-B5NDhB1w.system.js → p-y7PFdTUN.system.js} +4 -4
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/zonos-elements/p-35539d3d.entry.js +0 -1
- package/dist/zonos-elements/p-BJzAgoqz.js +0 -1
- package/dist/zonos-elements/p-BKoLoalh.js +0 -1
- package/dist/zonos-elements/p-BaF00SfB.js +0 -1
- package/dist/zonos-elements/p-BtWDzGMx.js +0 -1
- package/dist/zonos-elements/p-CX_vfdWt.js +0 -1
- package/dist/zonos-elements/p-ab54d0a1.entry.js +0 -1
- package/dist/zonos-elements/p-ca3175d9.entry.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
System.register(["./p-CIevpRv_.system.js","./p-
|
|
1
|
+
System.register(["./p-CIevpRv_.system.js","./p-DOD2I44l.system.js","./p-BgSx82zO.system.js","./p-BuU_p5DP.system.js","./p-C2j7R11h.system.js","./p-DQZncB2d.system.js","./p-zVLAvre1.system.js","./p-BbgqQIHv.system.js"],(function(o){"use strict";var e,s,t,n,i,a,l,d,r,h;return{setters:[function(o){e=o.r;s=o.h;t=o.a;n=o.d},function(o){i=o.t;a=o.l},function(o){l=o.i},function(o){d=o.a},function(o){r=o.c},function(o){h=o.g},null,null],execute:function(){var c=function(){return':host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--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 .zonos--title{margin-bottom:12px}:host .zonos--address-group{display:-ms-flexbox;display:flex;gap:4px;-ms-flex-direction:column;flex-direction:column}:host .zonos--address-line{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .zonos--address-line zonos-text+zonos-text::before{content:", ";color:var(--zonos-elements-gray-1000);margin-right:4px}:host .zonos--country-flag{width:20px;height:14px;border-radius:2px;margin:1px;position:relative;overflow:hidden;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);margin-right:8px;z-index:10;justify-self:center}'};var f=o("zonos_address_display",/** @class */function(){function o(o){e(this,o)}o.prototype.render=function(){var o,e;var n=this.currentAddress,d=n.city,r=n.country,h=n.email,c=n.line1,f=n.line2,m=n.name,z=n.phone,u=n.postal_code,g=n.state;
|
|
2
2
|
/**
|
|
3
3
|
* Look the country up in the full country list first, since a billing
|
|
4
4
|
* address can be in a country the merchant does not ship to and would
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,o,t,n){function r(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function c(e){try{a(n["throw"](e))}catch(e){i(e)}}function a(e){e.done?t(e.value):r(e.value).then(s,c)}a((n=n.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,r,i,s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=c(0),s["throw"]=c(1),s["return"]=c(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(e){return function(o){return a([e,o])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,c[0]&&(t=0)),t)try{if(n=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:t.label++;return{value:c[1],done:false};case 5:t.label++;r=c[1];c=[0];continue;case 7:c=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1];i=c;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(c);break}if(i[2])t.ops.pop();t.trys.pop();continue}c=o.call(e,t)}catch(e){c=[6,e];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,o,t){if(t||arguments.length===2)for(var n=0,r=o.length,i;n<r;n++){if(i||!(n in o)){if(!i)i=Array.prototype.slice.call(o,0,n);i[n]=o[n]}}return e.concat(i||Array.prototype.slice.call(o))};System.register(["./p-CIevpRv_.system.js","./p-
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,o,t,n){function r(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function c(e){try{a(n["throw"](e))}catch(e){i(e)}}function a(e){e.done?t(e.value):r(e.value).then(s,c)}a((n=n.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,r,i,s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=c(0),s["throw"]=c(1),s["return"]=c(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(e){return function(o){return a([e,o])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,c[0]&&(t=0)),t)try{if(n=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:t.label++;return{value:c[1],done:false};case 5:t.label++;r=c[1];c=[0];continue;case 7:c=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1];i=c;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(c);break}if(i[2])t.ops.pop();t.trys.pop();continue}c=o.call(e,t)}catch(e){c=[6,e];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,o,t){if(t||arguments.length===2)for(var n=0,r=o.length,i;n<r;n++){if(i||!(n in o)){if(!i)i=Array.prototype.slice.call(o,0,n);i[n]=o[n]}}return e.concat(i||Array.prototype.slice.call(o))};System.register(["./p-CIevpRv_.system.js","./p-DS-qw_qc.system.js","./p-XDxdMlQl.system.js","./p-DOD2I44l.system.js","./p-BuU_p5DP.system.js","./p-BDopxBpR.system.js","./p-zVLAvre1.system.js","./p-CBx5nYet.system.js","./p-BbgqQIHv.system.js","./p-smUku7Ku.system.js","./p-C2j7R11h.system.js","./p-DBOI98r5.system.js","./p-DQZncB2d.system.js","./p-DW-fW8yR.system.js","./p-BNtWsPPP.system.js","./p-0D0aCMu6.system.js","./p-Cby4EkFu.system.js","./p-B3GRrRtL.system.js","./p-DoEHepOc.system.js","./p-BGktDPwA.system.js","./p-8PPEbm_0.system.js"],(function(e){"use strict";var o,t,n,r,i,s,c,a,u,d,l,f,h,v,m,p,g,w,z,k,y,b,_,C,x,S,I,T,A,O,B,E,P,D,U,L,N,j,R,F,M,H,Z,G,K,V,Q,W,Y,q,J,X,$,ee,oe,te,ne,re,ie,se,ce,ae,ue,de,le,fe,he,ve,me,pe,ge,we,ze,ke,ye,be,_e,Ce,xe,Se,Ie,Te,Ae,Oe,Be,Ee;return{setters:[function(e){o=e.r;t=e.h;n=e.F;r=e.a},function(e){i=e.s;s=e.a;c=e.b;a=e.i;u=e.c;d=e.g;l=e.d;f=e.e;h=e.f;v=e.p;m=e.h;p=e.j;g=e.k;w=e.l;z=e.m;k=e.n;y=e.o;b=e.t;_=e.q;C=e.r;x=e.u;S=e.v;I=e.w;T=e.x;A=e.y;O=e.z;B=e.A;E=e.B;P=e.C;D=e.D;U=e.E;L=e.F;N=e.G;j=e.H;R=e.I;F=e.J;M=e.K},function(e){H=e.p;Z=e.s;G=e.a;K=e.b},function(e){V=e.f;Q=e.a;W=e.b;Y=e.i;q=e.l;J=e.c;X=e.d;$=e.g;ee=e.s;oe=e.V;te=e.e;ne=e.t;re=e.h;ie=e.j},function(e){se=e.z;ce=e.g;ae=e.m},function(e){ue=e.b},function(e){de=e.h;le=e.g;fe=e.j;he=e.l;ve=e.b;me=e.s;pe=e.a;ge=e.i},function(e){we=e.u},function(e){ze=e.l;ke=e.g;ye=e.b},function(e){be=e._;_e=e.c;Ce=e.d;xe=e.a;Se=e.g},function(e){Ie=e.c},function(e){Te=e.c},function(e){Ae=e.g},function(e){Oe=e.i},function(e){Be=e.s},function(e){Ee=e.R},null,null,null,null,null],execute:function(){var Pe=this;
|
|
2
2
|
/**
|
|
3
3
|
* Check if store discount is enabled
|
|
4
|
-
*/var
|
|
4
|
+
*/var De=function(){return __awaiter(Pe,void 0,void 0,(function(){var e,o,t;return __generator(this,(function(n){switch(n.label){case 0:return[4/*yield*/,de("/api/zonos-elements/get-store-discount-enabled-status")];case 1:e=n.sent(),o=e.errors,t=e.json;if(o.length||!(t===null||t===void 0?void 0:t.enabled)){return[2/*return*/,{enabled:false}]}return[2/*return*/,{enabled:true}]}}))}))};var Ue=function(e){return __awaiter(Pe,[e],void 0,(function(e){var o,t,n,r;var i=e.testKeys;return __generator(this,(function(e){switch(e.label){case 0:
|
|
5
5
|
// Do nothing if no test keys are provided
|
|
6
|
-
if(i.length===0){return[2/*return*/,null]}return[4/*yield*/,de("/api/zonos-elements/select-variance-test",{body:{testKeys:i},method:"POST"})];case 1:o=e.sent(),t=o.errors,n=o.json;if(t.length||!n){return[2/*return*/,null]}r=
|
|
6
|
+
if(i.length===0){return[2/*return*/,null]}return[4/*yield*/,de("/api/zonos-elements/select-variance-test",{body:{testKeys:i},method:"POST"})];case 1:o=e.sent(),t=o.errors,n=o.json;if(t.length||!n){return[2/*return*/,null]}r=V(n);
|
|
7
7
|
// Filter the response to only include test keys that we support
|
|
8
|
-
return[2/*return*/,r]}}))}))};var
|
|
8
|
+
return[2/*return*/,r]}}))}))};var Le=function(e){var o=e.cartId,t=e.checkoutSessionId,n=e.customerAddress1,r=e.customerAddress2,i=e.customerCity,s=e.customerCountry,c=e.customerEmail,a=e.customerFirstName,u=e.customerLastName,d=e.customerPhone,l=e.customerState,f=e.customerZip,h=e.hostedCheckoutUrl,v=e.isTestMode,m=e.isVariantTest;var p=new URLSearchParams;p.set("tempCartUUID",o);if(a){p.set("customerFirstName",a)}if(u){p.set("customerLastName",u)}if(c){p.set("customerEmail",c)}if(d){p.set("customerPhone",d)}if(f){p.set("customerZip",f)}if(i){p.set("customerCity",i)}if(l){p.set("customerState",l)}if(s){p.set("zCountry",s)}if(n){p.set("customerAddress1",n)}if(r){p.set("customerAddress2",r)}if(v){p.set("zonosTestMode","1")}if(t){p.set("zonosCheckoutSessionId",t)}if(m){p.set("zonosVariantTest","1")}return"".concat(h,"?").concat(p.toString())};
|
|
9
9
|
/**
|
|
10
10
|
* The query flag that BigCommerce carries back to `cart.php` after the
|
|
11
11
|
* shopper logs in. When present, Zonos-elements knows to resume the
|
|
@@ -77,7 +77,7 @@ return[2/*return*/,{conclusive:true,result:Me}]}l=i.includes(d);f={customerGroup
|
|
|
77
77
|
* Automatically invalidated when a fetch resolves to an inconclusive outcome,
|
|
78
78
|
* so subsequent callers retry (e.g. after the user adds an item to their
|
|
79
79
|
* cart or after settings finish loading).
|
|
80
|
-
*/var Ze=null;var
|
|
80
|
+
*/var Ze=null;var Ge=function(e){var o=He(e);var t=o.then((function(e){var o=e.conclusive,n=e.result;if(!o&&Ze===t){
|
|
81
81
|
// Invalidate cache so the next caller performs a fresh fetch.
|
|
82
82
|
Ze=null}return n}));Ze=t;return t};
|
|
83
83
|
/**
|
|
@@ -85,9 +85,9 @@ Ze=null}return n}));Ze=t;return t};
|
|
|
85
85
|
* Call this once during initialization (e.g. in `zonos-checkout.init()`).
|
|
86
86
|
* The fetch runs in the background; `checkBigCommerceBypassCustomerGroup`
|
|
87
87
|
* will await the result when needed.
|
|
88
|
-
*/var
|
|
88
|
+
*/var Ke=function(){var e;if(!window.Zonos.isBigCommerce){return}var o=(e=se.genericSettings)===null||e===void 0?void 0:e.bigcommerceBypassCustomerGroupIds;if(!(o===null||o===void 0?void 0:o.length)){return}
|
|
89
89
|
// Fire the fetch immediately; consumers will await the same promise
|
|
90
|
-
void
|
|
90
|
+
void Ge()};
|
|
91
91
|
/**
|
|
92
92
|
* Check if the current BigCommerce customer belongs to a customer group
|
|
93
93
|
* that should bypass Zonos Checkout.
|
|
@@ -102,7 +102,7 @@ void Ve()};
|
|
|
102
102
|
* always fetches fresh BigCommerce checkout data. Use this on the
|
|
103
103
|
* BigCommerce domestic checkout page when the shipping country changes,
|
|
104
104
|
* to ensure the customer group reflects the current checkout state.
|
|
105
|
-
*/var
|
|
105
|
+
*/var Ve=function(){var e=[];for(var o=0;o<arguments.length;o++){e[o]=arguments[o]}return __awaiter(Pe,__spreadArray([],e,true),void 0,(function(e){if(e===void 0){e={}}return __generator(this,(function(o){if(e.forceRefresh||!Ze){return[2/*return*/,Ge(e.preFetched)]}return[2/*return*/,Ze]}))}))};var Qe={guestCheckoutType:null};
|
|
106
106
|
/**
|
|
107
107
|
* BigCommerce's `/checkouts/settings` values almost never change after a
|
|
108
108
|
* merchant's initial setup, so we persist the result in `localStorage` and
|
|
@@ -249,7 +249,7 @@ if(!q.isShippableCountry){if(e){ze("Checkout: not shippable country")}return fal
|
|
|
249
249
|
* that is internationally shippable. If so, optionally prompt the user to
|
|
250
250
|
* confirm before saving the address to session and redirecting to the home
|
|
251
251
|
* page to open the international checkout.
|
|
252
|
-
*/var po=function(e){return __awaiter(Pe,[e],void 0,(function(e){var o,t,n,r,i,c,a,u,d,l,f,h,v,m,p,g,w,z;var k=e.onInternationalCheckoutSelected,y=e.onLoggedInInternationalAddressDetected;return __generator(this,(function(e){switch(e.label){case 0:return[4/*yield*/,Q()];case 1:f=e.sent();if(!f){return[2/*return*/,"noAction"]}return[4/*yield*/,W(f)];case 2:h=e.sent();v={checkout:h,checkoutId:f};return[4/*yield*/,
|
|
252
|
+
*/var po=function(e){return __awaiter(Pe,[e],void 0,(function(e){var o,t,n,r,i,c,a,u,d,l,f,h,v,m,p,g,w,z;var k=e.onInternationalCheckoutSelected,y=e.onLoggedInInternationalAddressDetected;return __generator(this,(function(e){switch(e.label){case 0:return[4/*yield*/,Q()];case 1:f=e.sent();if(!f){return[2/*return*/,"noAction"]}return[4/*yield*/,W(f)];case 2:h=e.sent();v={checkout:h,checkoutId:f};return[4/*yield*/,Ve({preFetched:v})];case 3:m=e.sent().shouldBypass;if(m){return[2/*return*/,"noAction"]}p=(t=(o=h===null||h===void 0?void 0:h.consignments)===null||o===void 0?void 0:o[0])===null||t===void 0?void 0:t.shippingAddress;if(!(p===null||p===void 0?void 0:p.countryCode)){return[2/*return*/,"noAction"]}g=p.countryCode;if(!ho(false,g)){return[2/*return*/,"noAction"]}ze(y?"Logged-in user has international shipping address: ".concat(g,", prompting user to choose checkout"):"Logged-in user has international shipping address: ".concat(g,", redirecting automatically (legacy behavior)"),"info");if(!y)return[3/*break*/,5];return[4/*yield*/,y()];case 4:w=e.sent();if(w==="stay"){ze("User opted to stay on BigCommerce native checkout despite international default address","info");return[2/*return*/,"optedOut"]}e.label=5;case 5:return[4/*yield*/,no({preFetched:v})];case 6:z=e.sent();if(z.shouldForceLogin&&z.redirectUrl){window.location.href=z.redirectUrl;return[2/*return*/,"redirected"]}if(!k)return[3/*break*/,8];return[4/*yield*/,k()];case 7:e.sent();e.label=8;case 8:
|
|
253
253
|
// Update localization store with the detected country
|
|
254
254
|
X({isInitializing:false,newSelectedCountryCode:g,persistOverride:false});
|
|
255
255
|
// Save the shipping address to session storage for the international checkout
|
|
@@ -271,7 +271,7 @@ window.location.href=Fe("/");return[2/*return*/,"redirected"]}}))}))};
|
|
|
271
271
|
// do nothing if shipping country is not found
|
|
272
272
|
return[2/*return*/,"noAction"]}if(!ho(false,r)){
|
|
273
273
|
// do nothing if shipping country is not shippable
|
|
274
|
-
return[2/*return*/,"noAction"]}return[4/*yield*/,Q()];case 1:i=h.sent();if(!i)return[3/*break*/,3];return[4/*yield*/,W(i)];case 2:a=h.sent();return[3/*break*/,4];case 3:a=null;h.label=4;case 4:c=a;u={checkout:c,checkoutId:i};return[4/*yield*/,
|
|
274
|
+
return[2/*return*/,"noAction"]}return[4/*yield*/,Q()];case 1:i=h.sent();if(!i)return[3/*break*/,3];return[4/*yield*/,W(i)];case 2:a=h.sent();return[3/*break*/,4];case 3:a=null;h.label=4;case 4:c=a;u={checkout:c,checkoutId:i};return[4/*yield*/,Ve({forceRefresh:true,preFetched:u})];case 5:d=h.sent().shouldBypass;if(d){
|
|
275
275
|
// Logged-in customer is in a bypass group — keep them on BC native
|
|
276
276
|
// checkout and stop polling / fetching further.
|
|
277
277
|
ze("Bypass customer group detected on BC checkout, stopping interval","info");return[2/*return*/,"bypass"]}return[4/*yield*/,no({preFetched:u})];case 6:l=h.sent();if(l.shouldForceLogin&&l.redirectUrl){window.location.href=l.redirectUrl;return[2/*return*/,"redirected"]}if(!t)return[3/*break*/,8];return[4/*yield*/,t()];case 7:h.sent();h.label=8;case 8:
|
|
@@ -548,7 +548,7 @@ if(!e){return false}return true};
|
|
|
548
548
|
// Register test hosted vs native if needed to get the variant selection for this test
|
|
549
549
|
this.registerTestHostedVsNative=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:e=this.shouldAllowHostedVsNativeTest();if(!e){return[2/*return*/]}ze("[TEST] - Registering hosted vs native test");o=Co("hosted_vs_native");
|
|
550
550
|
// No need to request variant test for this test if the test already has variant selected
|
|
551
|
-
if(o){ze("[TEST] - Hosted vs native test already has variant selected: ".concat(o));return[2/*return*/]}return[4/*yield*/,
|
|
551
|
+
if(o){ze("[TEST] - Hosted vs native test already has variant selected: ".concat(o));return[2/*return*/]}return[4/*yield*/,Ue({testKeys:["hosted_vs_native"]})];case 1:t=r.sent();
|
|
552
552
|
// Do not prevent user from proceeding if the test is not enabled or failed to get selection
|
|
553
553
|
if(!t){ze("[TEST] - Failed to get selection for hosted vs native test");return[2/*return*/]}n=So({baseTestObj:ee.enabledVariantTestKeys||[],mergeTestObj:t});
|
|
554
554
|
// Set the selected variant to the storage store
|
|
@@ -558,7 +558,7 @@ this.handleHostedVsNative=function(){return __awaiter(t,void 0,void 0,(function(
|
|
|
558
558
|
// This test is only applicable to checkout that's using createCartid callback
|
|
559
559
|
if(typeof se.checkoutSettings.createCartId!=="function"){ze("[TEST] - createCartId is not provided, skipping hosted vs native test");return[2/*return*/,{redirected:false}]}
|
|
560
560
|
// No need to do anything if the test is enabled for native
|
|
561
|
-
if(t!=="hosted"){ze("[TEST] - Hosted vs native test is enabled for native, skipping");return[2/*return*/,{redirected:false}]}if(!((e=se.genericSettings)===null||e===void 0?void 0:e.hostedCheckoutUrl)){ze("[TEST] - Hosted checkout URL is not provided");return[2/*return*/,{redirected:false}]}ze('"createCartId" is provided, start building cart');return[4/*yield*/,se.checkoutSettings.createCartId()];case 1:n=a.sent();i=null;if(typeof n==="object"){r=n.cartId;i=n.shippingData||null}else{r=n}s=wo();c=
|
|
561
|
+
if(t!=="hosted"){ze("[TEST] - Hosted vs native test is enabled for native, skipping");return[2/*return*/,{redirected:false}]}if(!((e=se.genericSettings)===null||e===void 0?void 0:e.hostedCheckoutUrl)){ze("[TEST] - Hosted checkout URL is not provided");return[2/*return*/,{redirected:false}]}ze('"createCartId" is provided, start building cart');return[4/*yield*/,se.checkoutSettings.createCartId()];case 1:n=a.sent();i=null;if(typeof n==="object"){r=n.cartId;i=n.shippingData||null}else{r=n}s=wo();c=Le(Object.assign(Object.assign({cartId:r,checkoutSessionId:ee.checkoutSessionId||undefined,hostedCheckoutUrl:se.genericSettings.hostedCheckoutUrl,isTestMode:le(),isVariantTest:true},s),i));ze("[TEST] - Redirecting to: ".concat(c));
|
|
562
562
|
// Open new page with the cart URL
|
|
563
563
|
window.open(c,"_blank");return[2/*return*/,{redirected:true}]}}))}))};this.formatDate=function(e){if(!e){return""}
|
|
564
564
|
// get date in 24/12/2024 format (without time)
|
|
@@ -716,7 +716,7 @@ if(!d){return[2/*return*/]}
|
|
|
716
716
|
// log the load time of all API calls every 2 seconds. This is to track the load time of all API calls for checkout user
|
|
717
717
|
window.Zonos.logIntervalId=setInterval((function(){void ko()}),2e3)}if(!xo("hosted_vs_native"))return[3/*break*/,4];this.isOverlayLoading=true;return[4/*yield*/,this.registerTestHostedVsNative()];case 2:O.sent();return[4/*yield*/,this.handleHostedVsNative()];case 3:f=O.sent().redirected;this.isOverlayLoading=false;
|
|
718
718
|
// Stop the process if the user is being redirected to the hosted checkout page
|
|
719
|
-
if(f){return[2/*return*/]}O.label=4;case 4:if(!window.Zonos.isBigCommerce)return[3/*break*/,7];return[4/*yield*/,
|
|
719
|
+
if(f){return[2/*return*/]}O.label=4;case 4:if(!window.Zonos.isBigCommerce)return[3/*break*/,7];return[4/*yield*/,Ve()];case 5:h=O.sent().shouldBypass;if(h){ze("Bypass customer group detected, redirecting to BigCommerce native checkout","info");
|
|
720
720
|
// Carry over zonosQaUrl / zonosTestMode so the BC native
|
|
721
721
|
// checkout keeps loading the same Zonos elements build/env.
|
|
722
722
|
window.location.href=Fe("/checkout");return[2/*return*/]}return[4/*yield*/,no()];case 6:v=O.sent();if(v.shouldForceLogin&&v.redirectUrl){window.location.href=v.redirectUrl;return[2/*return*/]}O.label=7;case 7:
|
|
@@ -733,7 +733,7 @@ p=ne("Unable to check inventory. Please try again.");return[3/*break*/,13];case
|
|
|
733
733
|
// and "Return to cart" resets the message + closes cleanly.
|
|
734
734
|
l.inventoryCheckErrorMessage=p;c.isFetchingSession=false;this.open=false;return[2/*return*/]}O.label=14;case 14:(e=window.opener)===null||e===void 0?void 0:e.postMessage({checkoutSessionId:ee.checkoutSessionId,type:"zonos-checkout-session-update"},"*");
|
|
735
735
|
// start the timer to validate the price
|
|
736
|
-
y({isPreview:this.preview,sessionTimeout:Bo});Z({event:"zonos-checkout-start",metadata:{checkoutSessionId:ee.checkoutSessionId}});w=ee.checkoutSessionId;void b({checkoutSessionId:w,eventName:"checkout_open"});return[4/*yield*/,
|
|
736
|
+
y({isPreview:this.preview,sessionTimeout:Bo});Z({event:"zonos-checkout-start",metadata:{checkoutSessionId:ee.checkoutSessionId}});w=ee.checkoutSessionId;void b({checkoutSessionId:w,eventName:"checkout_open"});return[4/*yield*/,De()];case 15:z=O.sent().enabled;
|
|
737
737
|
// Hide discount input if there's no active discount configured for the store
|
|
738
738
|
l.shouldHideDiscountInput=!z;this.handleOrderDuplication();if(window.Zonos.isLegacyCheckout){void yo()}else{x=performance.now();S=x-i;void bo({loadTime:S})}this.recordCheckoutInfo();I=!!Se();if(I){this.markTheSessionAsAbandonedCart()}return[3/*break*/,17];case 16:T=O.sent();if(T instanceof Error){A=T.message;if(A==="Cart is expired."){this.isCartExpired=true}}
|
|
739
739
|
// stop loading
|
|
@@ -775,7 +775,7 @@ l.isStagingMode=pe();
|
|
|
775
775
|
if(typeof this.overrideStagingMode!=="undefined"){l.isStagingMode=this.overrideStagingMode}
|
|
776
776
|
// Start fetching BigCommerce customer group on page load so the bypass
|
|
777
777
|
// result is ready by the time checkout opens or the BC watcher fires
|
|
778
|
-
|
|
778
|
+
Ke();
|
|
779
779
|
// Warm the BigCommerce `/checkouts/settings` fetch (merchant's
|
|
780
780
|
// `guest_checkout_type`) so force-login gating resolves instantly when
|
|
781
781
|
// the shopper clicks checkout — otherwise the first checkout open
|
|
@@ -849,7 +849,7 @@ if(i&&l.addressFormRenderType==="stripe"){void me({endpoint:"ADDRESS_NOT_READY_A
|
|
|
849
849
|
// stop interval if the step is not customer-info
|
|
850
850
|
clearInterval(e);return}if(!c.isFetchingLandedCost){if(l.landedCostData){
|
|
851
851
|
// start init paypal with the presentment currency when landed cost is fetched
|
|
852
|
-
void
|
|
852
|
+
void K({currency:l.currency});
|
|
853
853
|
// only go to next step if landed cost data is ready
|
|
854
854
|
T()}u.submitLoading=false;if(e){clearInterval(e)}}};
|
|
855
855
|
// Immediately move to the next step
|
|
@@ -873,7 +873,7 @@ return[2/*return*/]}
|
|
|
873
873
|
// Close the dialog after the user confirms to proceed with the payment in USD
|
|
874
874
|
this.payInUsdConfirmDialogOpen=false;o=A();h.label=1;case 1:h.trys.push([1,,18,19]);
|
|
875
875
|
// reset paypal error message
|
|
876
|
-
|
|
876
|
+
G.paypalErrorMessage=null;
|
|
877
877
|
// reset error state
|
|
878
878
|
c.hasPaymentError=false;this.submitLoading=true;
|
|
879
879
|
// reset inventory check message
|
|
@@ -889,12 +889,12 @@ l.inventoryCheckErrorMessage=ne("Unable to check inventory. Please try again.");
|
|
|
889
889
|
// Don't proceed to payment if there's an error message
|
|
890
890
|
if(l.inventoryCheckErrorMessage){
|
|
891
891
|
// stop the submit loading state
|
|
892
|
-
this.submitLoading=false;return[2/*return*/]}i=M();if(!(i>0))return[3/*break*/,8];return[4/*yield*/,B()];case 7:s=h.sent();if(!s.success){c.hasPaymentError=true;c.customErrorMessage=s.error||ne("Unable to apply store credit. Please try again.");this.submitLoading=false;return[2/*return*/]}h.label=8;case 8:if(!E())return[3/*break*/,14];h.label=9;case 9:h.trys.push([9,12,,13]);return[4/*yield*/,P()];case 10:a=h.sent();if(!a.valid){c.hasPaymentError=true;c.customErrorMessage=a.errorMessage;this.submitLoading=false;return[2/*return*/]}return[4/*yield*/,
|
|
892
|
+
this.submitLoading=false;return[2/*return*/]}i=M();if(!(i>0))return[3/*break*/,8];return[4/*yield*/,B()];case 7:s=h.sent();if(!s.success){c.hasPaymentError=true;c.customErrorMessage=s.error||ne("Unable to apply store credit. Please try again.");this.submitLoading=false;return[2/*return*/]}h.label=8;case 8:if(!E())return[3/*break*/,14];h.label=9;case 9:h.trys.push([9,12,,13]);return[4/*yield*/,P()];case 10:a=h.sent();if(!a.valid){c.hasPaymentError=true;c.customErrorMessage=a.errorMessage;this.submitLoading=false;return[2/*return*/]}return[4/*yield*/,D()];case 11:u=h.sent();if(!u.success){c.hasPaymentError=true;c.customErrorMessage=u.error||ne("Unable to place order with store credit. Please try again.");this.submitLoading=false;return[2/*return*/]}T();p();return[3/*break*/,13];case 12:d=h.sent();he(d);Z({event:"zonos-checkout-payment-fail",metadata:{checkoutSessionId:ee.checkoutSessionId}});c.hasPaymentError=true;return[3/*break*/,13];case 13:this.submitLoading=false;return[2/*return*/];case 14:h.trys.push([14,16,,17]);
|
|
893
893
|
// Order-modification payment-only sessions skip the shipping step,
|
|
894
894
|
// so cartStore.selectedLandedCost is never populated — bypass the
|
|
895
895
|
// landed-cost guard the same way zonos-collect does for its own
|
|
896
896
|
// no-shipping-step flow.
|
|
897
|
-
return[4/*yield*/,
|
|
897
|
+
return[4/*yield*/,U({noLandedCostCheck:z()})];case 15:
|
|
898
898
|
// Order-modification payment-only sessions skip the shipping step,
|
|
899
899
|
// so cartStore.selectedLandedCost is never populated — bypass the
|
|
900
900
|
// landed-cost guard the same way zonos-collect does for its own
|
|
@@ -903,7 +903,7 @@ h.sent();T();
|
|
|
903
903
|
// clear the checkout session timeout timer when purchase is complete
|
|
904
904
|
p();return[3/*break*/,17];case 16:f=h.sent();he(f);Z({event:"zonos-checkout-payment-fail",metadata:{checkoutSessionId:ee.checkoutSessionId}});c.hasPaymentError=true;
|
|
905
905
|
// should request inventory refund if there's an error during payment
|
|
906
|
-
if(c.shouldInventoryRefund){void
|
|
906
|
+
if(c.shouldInventoryRefund){void L();c.shouldInventoryRefund=false}return[3/*break*/,17];case 17:this.submitLoading=false;return[3/*break*/,19];case 18:
|
|
907
907
|
// Release the consent lock on every terminal exit (success or failure)
|
|
908
908
|
// so the buyer can re-toggle / retry. On success the cart advances and
|
|
909
909
|
// the close-handler reset would clean this up anyway.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,d as e,h as o,a as n}from"./p-_lt63o7c.js";import{b as i}from"./p-DwkyNtpD.js";import{m as s,n as r,o as c,s as l,d as a}from"./p-Cuk0LLGQ.js";import{z as d,a as u,b as h}from"./p-W82paT5F.js";import{g as p,i as m,a as w}from"./p-HeAZDwVW.js";import{h as f,l as v}from"./p-DE4a-QD5.js";import{l as g}from"./p-BJmZPrZl.js";import{e as y}from"./p-sz4L-ZnB.js";import"./p-YdrG78th.js";import"./p-C_z9WL8a.js";import"./p-Cye-evFK.js";const S="zonos-domestic-element-hide-style",b="undefined"!=typeof document&&(()=>{try{return document.querySelector(":is(.zonos-is-probe)"),!0}catch(t){return!1}})(),z=t=>{const e=document.querySelector(t);if(!document.querySelector("zonos-hello")&&e){const t=document.createElement("zonos-hello");return e.appendChild(t),!0}return!1},j=t=>{switch(t){case"BOTTOM_RIGHT":default:return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right"}},I=({position:t="bottom-right"})=>{const e=".zonos--hello-mobile-wrapper";if(document.querySelector(e))return e;const o=document.createElement("div");return o.className="zonos--hello-mobile-wrapper",o.style.position="fixed","top-right"===t&&(o.style.top="72px",o.style.right="24px"),"top-left"===t&&(o.style.top="72px",o.style.left="24px"),"bottom-right"===t&&(o.style.bottom="72px",o.style.right="24px"),"bottom-left"===t&&(o.style.bottom="72px",o.style.left="24px"),o.style.zIndex="2147483647",document.body.appendChild(o),e},C=async t=>{if(window.Zonos.isLegacyCheckout)return void g("Hello is disabled when isLegacyCheckout","info");const{anchorElementSelector:e}=t;let o=e;if(!t.anchorElementSelector&&t.desktopLocation){const t=I({position:"bottom-right"});o=t}if(o&&r(o)){if(g("Hello init complete"),!z(o)){const e=new MutationObserver((()=>{z(o)&&e.disconnect()}));e.observe(document.body,{childList:!0,subtree:!0}),setTimeout((()=>{z(o)}),1e3),setTimeout((()=>{if(t.notFoundElementFallback){g(`Hello anchor selector ${t.anchorElementSelector} not found after 3 seconds, falling back to 'notFoundElementFallback': ${t.notFoundElementFallback}`,"info");const e=I({position:j(t.notFoundElementFallback)});z(e)}}),3e3)}}else v(`Selector anchorElementSelector "${t.anchorElementSelector}" is not a valid selector.`)};class O{constructor(t,e){this.targetId=t,this.allowedEvents=e,this.listeners=new Map,this.handleMessage=t=>{var e,o,n;const i=t.data,s=(null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||(null===(n=null===(o=this.iframe)||void 0===o?void 0:o.contentDocument)||void 0===n?void 0:n.defaultView);if(t.source!==s)return;if(!this.isValidMessage(i))return;const r=this.listeners.get(i.type);null==r||r.forEach((t=>{try{t(i.payload)}catch(t){v("Error in event listener:",t)}}))},this.initializeEventListeners(),this.iframe=document.getElementById(this.targetId)}initializeEventListeners(){window.addEventListener("message",this.handleMessage)}isValidMessage(t){if(!t||"object"!=typeof t)return!1;const e=t;return e.id===this.targetId&&"string"==typeof e.type&&this.allowedEvents.includes(e.type)&&void 0!==e.payload}on(t,e){this.listeners.has(t)||this.listeners.set(t,new Set),g(`[CheckoutAddressService] listening to ${t}`,"info");const o=e,n=this.listeners.get(t);return n&&n.add(o),()=>{const e=this.listeners.get(t);e&&e.delete(o)}}destroy(){window.removeEventListener("message",this.handleMessage),this.listeners.clear()}}class k extends O{constructor(){g("=== [Google Places Service] Initializing","info"),super(m.GOOGLE_PLACES,["fetchAutocompleteSuggestions","initializeGooglePlacesService","placeSelected","onFetchAutocompleteSuggestions","onInitializeGooglePlacesService","onPlaceSelected"])}sendMessage(t,e){var o;if(!(null===(o=this.iframe)||void 0===o?void 0:o.contentWindow))return;const n={id:this.targetId,logType:window.Zonos.iframeLogType,payload:e,type:t};g(`GooglePlacesService] parent --\x3e ${t}`,"info",e),this.iframe.contentWindow.postMessage(n,"*")}initialize(){this.sendMessage("initializeGooglePlacesService",{})}fetchSuggestions({country:t,query:e,type:o}){t&&this.sendMessage("fetchAutocompleteSuggestions",{request:{includedRegionCodes:[t],input:e},type:o})}selectPlace({placeId:t,type:e}){this.sendMessage("placeSelected",{placeId:t,type:e})}}class E{constructor(){this.googlePlaceInitialized=!1,g("=== [CheckoutAddressService] Initializing","info"),this.googlePlaces=new k,this.googlePlaces.on("onInitializeGooglePlacesService",(()=>{g("=== [CheckoutAddressService] parent <-- onInitializeGooglePlacesService","info"),this.googlePlaceInitialized=!0})),this.initialize()}initialize(){this.googlePlaces.initialize()}onInitializeGooglePlacesService(t){return this.googlePlaces.on("onInitializeGooglePlacesService",(()=>{g("[CheckoutAddressService] parent <-- onInitializeGooglePlacesService"),t()}))}isGooglePlaceInitialized(){return this.googlePlaceInitialized}onAddressSuggestions(t){return this.suggestionsCallback=t,this.googlePlaces.on("onFetchAutocompleteSuggestions",((...e)=>{g(`[CheckoutAddressService] parent <-- onFetchAutocompleteSuggestions ${e[0].type}`,"info",...e),t(...e)}))}onAddressSelected(t){return this.placeSelectedCallback=t,this.googlePlaces.on("onPlaceSelected",((...e)=>{g(`[CheckoutAddressService] parent <-- onPlaceSelected ${e[0].type}`,"info",...e),t(...e)}))}getAddressSuggestions({country:t,query:e,type:o}){this.googlePlaceInitialized&&this.googlePlaces.fetchSuggestions({country:t,query:e,type:o})}selectAddress({placeId:t,type:e}){this.googlePlaces.selectPlace({placeId:t,type:e})}destroy(){this.googlePlaces.destroy(),this.suggestionsCallback&&(this.suggestionsCallback=void 0),this.placeSelectedCallback&&(this.placeSelectedCallback=void 0)}}const A=class{constructor(o){t(this,o),this.paypalInitEvent=e(this,"paypalInitEvent",7),this.stripeInitEvent=e(this,"stripeInitEvent",7)}async initCheckoutElement(t){var e;t?(i.stripe=t,((e=d.checkoutSettings).placeOrderButtonSelector||e.alwaysTriggerInternationalCheckoutSelector||window.Zonos.cartData)&&(!e.placeOrderButtonSelector||r(e.placeOrderButtonSelector)?!e.alwaysTriggerInternationalCheckoutSelector||r(e.alwaysTriggerInternationalCheckoutSelector)?(()=>{if(!document.querySelector("zonos-checkout")){const t=document.createElement("zonos-checkout");document.body.appendChild(t)}})():v(`Selector alwaysTriggerInternationalCheckoutSelector "${e.alwaysTriggerInternationalCheckoutSelector}" is not a valid selector`):v(`Selector checkoutButtonAnchor "${e.placeOrderButtonSelector}" is not a valid selector`)),g("init checkout element")):g("Stripe is not loaded yet - cannot init checkout element","warn")}async initCollectElement(t){t?(i.stripe=t,window.Zonos.cartData&&(()=>{if(!document.querySelector("zonos-collect")){const t=document.createElement("zonos-collect");document.body.appendChild(t)}})(),g("init Collect element")):g("Stripe is not loaded yet - cannot init Collect element","warn")}async initInvoiceElement(t){t?(i.stripe=t,window.Zonos.cartData&&(()=>{if(!document.querySelector("zonos-invoice")){const t=document.createElement("zonos-invoice");document.body.appendChild(t)}})(),g("init Invoice element")):g("Stripe is not loaded yet - cannot init Invoice element","warn")}initZonosNotification(){if(document.querySelector("zonos-notification"))return;const t=document.createElement("zonos-notification");document.body.appendChild(t)}async setupGoogleFont(t){var e,o;const n=t||u();if("Inter"===n){if(!t)return;g("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn"),d.appearance=Object.assign(Object.assign({},d.appearance),{fontFamily:t})}const i=new URLSearchParams;i.set("family",n);const{errors:s,json:r}=await f(`/api/zonos-elements/get-font-detail?${i.toString()}`);if(s.length>0)return g(`Failed to load font ${n}`,"warn"),void(d.appearance=Object.assign(Object.assign({},d.appearance),{fontFamily:"Inter"}));const c=null==r?void 0:r.fontUrl;c&&(null===(o=(e=window.Zonos).injectSupportGoogleFont)||void 0===o||o.call(e,c)),t&&(g(`[FONT] ${t} font override applied`),d.appearance=Object.assign(Object.assign({},d.appearance),{fontFamily:t}))}handleLocationChange(){C(d.helloSettings)}initHistoryListener(){const t=history.pushState;history.pushState=function(){return window.dispatchEvent(new window.Event("pushstate")),window.dispatchEvent(new window.Event("locationchange")),t.apply(this,arguments)};const e=history.replaceState;history.replaceState=function(){return window.dispatchEvent(new window.Event("replacestate")),window.dispatchEvent(new window.Event("locationchange")),e.apply(this,arguments)}}injectCustomHTML(t){if(!t)return;if(!window.Zonos.isLegacyCheckout||window.Zonos.isCollect||window.Zonos.isInvoice)return void g("=== Skip injecting custom HTML for hosted checkout","info");g("=== Injecting custom HTML for hosted checkout");const e=document.createElement("template");e.innerHTML=t,e.content.querySelectorAll("script").forEach((t=>{const e=document.createElement("script");t.src?(e.src=t.src,e.async=t.async):e.textContent=t.innerHTML,document.body.appendChild(e)})),y()}async initGooglePlacesService(t){const e=null==t?void 0:t.genericSettings;if(!e)return;const o=e.signedTokenGooglePlaces;o&&w({id:m.GOOGLE_PLACES,onload:()=>{d.checkoutAddressService=new E},src:`https://route.elements.zonos.com/iframe/google-maps?signedToken=${o}`})}buildBaseConfig(t){var e,o;const n=Object.assign(Object.assign({},this.config.checkoutSettings),{allowedSettlementCurrencies:void 0,captureDelay:void 0,subscriptionStatus:void 0});if(window.Zonos.isCollect||window.Zonos.isInvoice)return Object.assign(Object.assign({},this.config),{checkoutSettings:n,helloSettings:Object.assign(Object.assign({},this.config.helloSettings),{visibilityStatus:"DISABLED"})});if(!this.config.checkoutSettings)return Object.assign(Object.assign({},this.config),{checkoutSettings:void 0});const i=window.Zonos.isLegacyCheckout&&!!window.Zonos.cartData&&"CLOSE_MODAL"===(null===(e=this.config.checkoutSettings)||void 0===e?void 0:e.successBehavior);return Object.assign(Object.assign({},this.config),{checkoutSettings:Object.assign(Object.assign({},n),{successBehavior:i?"ZONOS_SUCCESS_PAGE":this.config.checkoutSettings.successBehavior,successRedirectUrl:i?(null===(o=window.Zonos.cartData)||void 0===o?void 0:o.storeBaseUrl)||(null==t?void 0:t.onlineStoreSettings.url):this.config.checkoutSettings.successRedirectUrl})})}async componentWillLoad(){this.initHistoryListener(),d.zonosApiKey=this.zonosApiKey,(async()=>{var t,e,o,n,i,r;const{errors:l,json:a,zonosMode:u}=await(async()=>{if(window.Zonos.cartSettings)return g("Reusing cached zonos settings"),{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode};const t=p(),e=new URLSearchParams;t.overrideShouldEnabledCustomAddress&&e.set("overrideShouldEnabledCustomAddress",t.overrideShouldEnabledCustomAddress);const o=s();o&&e.set("zCountry",o);const{errors:n,json:i,zonosMode:r}=await f(`/api/zonos-elements/zonos-settings?${e.toString()}`);return n.length?(v("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:n,json:null,zonosMode:r}):{errors:[],json:i,zonosMode:r}})();if("403"===(null===(e=null===(t=l[0])||void 0===t?void 0:t.type)||void 0===e?void 0:e.toString()))return void g("Failed to load zonos settings. This domain may not have access","warn");const m=(null===(o=null==a?void 0:a.checkoutSettings)||void 0===o?void 0:o.customHTML)||"";this.injectCustomHTML(m),this.initZonosNotification();const w=this.buildBaseConfig(a),y=Object.assign(Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:(()=>{var t,e,o;return window.Zonos.isLegacyCheckout?(null===(t=null==a?void 0:a.appearanceSettings)||void 0===t?void 0:t.logoUrl)||(null===(e=this.config.appearance)||void 0===e?void 0:e.logoUrl):null===(o=this.config.appearance)||void 0===o?void 0:o.logoUrl})()})}),w);h({overrideSettings:y,zonosSettings:a}),d.zonosMode=u,(t=>{if("undefined"==typeof document||!t)return;const e=(({merchantSelector:t,supportsIs:e})=>e?`body.z-intl :is(${t})`:(t=>{const e=[];let o=0,n=0,i="";for(let s=0;s<t.length;s++){const r=t[s];if("("===r?o++:")"===r?o--:"["===r?n++:"]"===r&&n--,","===r&&0===o&&0===n){const t=i.trim();t&&e.push(t),i=""}else i+=r}const s=i.trim();return s&&e.push(s),e})(t).map((t=>`body.z-intl ${t}`)).join(", "))({merchantSelector:t,supportsIs:b});try{document.querySelector(e)}catch(o){return void g(`Skip domesticElementSelector injection: "${t}" produced an invalid CSS selector ("${e}")`,"warn")}if(document.getElementById(S))return;const o=document.createElement("style");o.id=S,o.textContent=`${e} { display: none !important; }`,(document.head||document.body).appendChild(o),g("Zonos domestic element hide style injected")})(d.checkoutSettings.domesticElementSelector),this.setupGoogleFont(),"DISABLED"===d.helloSettings.visibilityStatus&&g("=== Hello is disabled by store owner ===","warn"),d.helloSettings&&"ENABLED"===d.helloSettings.visibilityStatus&&(g("Initializing hello"),C(d.helloSettings)),await c();const z=(null===(n=null==a?void 0:a.checkoutSettings)||void 0===n?void 0:n.externalServiceTokens.find((t=>"STRIPE_PUBLISHABLE_TOKEN"===t.type)))||null;if(!z||!this.stripeInitEvent)return void g("Checkout failed to load -- missing publishable key","warn");if(window.Zonos.isCollect||window.Zonos.isInvoice)return this.stripeInitEvent.emit({publishableKey:z.token}),void this.initGooglePlacesService(a);if("INACTIVE"===d.checkoutSettings.subscriptionStatus)return g('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn"),void g("zonos controller loaded");if("DISABLED"===d.checkoutSettings.visibilityStatus)return g("=== Checkout is disabled by store owner ===","warn"),void g("zonos controller loaded");const j="function"==typeof(null===(i=d.checkoutSettings)||void 0===i?void 0:i.buildCartDetail)||"function"==typeof(null===(r=d.checkoutSettings)||void 0===r?void 0:r.createCartId),I=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret"),O=!(!window.Zonos.cartId||!window.Zonos.cartData)||!!I;j||O?(this.stripeInitEvent.emit({publishableKey:z.token}),this.initGooglePlacesService(a)):g("Skip loading Stripe because no cart callback (buildCartDetail/createCartId), prefetched cart, or payment client secret is present","warn")})()}async showNotification(t){const e=document.querySelector("zonos-notification");e?e.showNotification(t):g("Failed to show notification - zonos-notification not found","warn")}async reset(){l.checkoutSessionId=null,i.clientSecret=""}async overrideConfig(t){h({overrideSettings:t,zonosSettings:null})}async overrideCountry(t){g(`Override country code to ${t}`),a({isInitializing:!1,newSelectedCountryCode:t})}async getAppearanceSetting(){return d.appearance}async updateOrganizationName(t){d.organizationName=t}render(){return o(n,{key:"1714865012d806892f03e03896ee2f04aa1a729d",class:"zonos--elements"})}};A.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--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{visibility:hidden;opacity:0;height:0}";export{A as zonos_controller}
|
|
1
|
+
import{r as t,d as e,h as o,a as n}from"./p-_lt63o7c.js";import{b as i}from"./p-FRWZayxL.js";import{m as s,n as r,o as c,s as l,d as a}from"./p-clDfq9AL.js";import{z as d,a as u,b as h}from"./p-W82paT5F.js";import{g as p,i as m,a as f}from"./p-HeAZDwVW.js";import{h as w,l as v}from"./p-DE4a-QD5.js";import{l as g}from"./p-BJmZPrZl.js";import{e as y}from"./p-sz4L-ZnB.js";import"./p-YdrG78th.js";import"./p-C_z9WL8a.js";import"./p-Cye-evFK.js";const S="zonos-domestic-element-hide-style",b="undefined"!=typeof document&&(()=>{try{return document.querySelector(":is(.zonos-is-probe)"),!0}catch(t){return!1}})(),z=t=>{const e=document.querySelector(t);if(!document.querySelector("zonos-hello")&&e){const t=document.createElement("zonos-hello");return e.appendChild(t),!0}return!1},j=t=>{switch(t){case"BOTTOM_RIGHT":default:return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right"}},I=({position:t="bottom-right"})=>{const e=".zonos--hello-mobile-wrapper";if(document.querySelector(e))return e;const o=document.createElement("div");return o.className="zonos--hello-mobile-wrapper",o.style.position="fixed","top-right"===t&&(o.style.top="72px",o.style.right="24px"),"top-left"===t&&(o.style.top="72px",o.style.left="24px"),"bottom-right"===t&&(o.style.bottom="72px",o.style.right="24px"),"bottom-left"===t&&(o.style.bottom="72px",o.style.left="24px"),o.style.zIndex="2147483647",document.body.appendChild(o),e},O=async t=>{if(window.Zonos.isLegacyCheckout)return void g("Hello is disabled when isLegacyCheckout","info");const{anchorElementSelector:e}=t;let o=e;if(!t.anchorElementSelector&&t.desktopLocation){const t=I({position:"bottom-right"});o=t}if(o&&r(o)){if(g("Hello init complete"),!z(o)){const e=new MutationObserver((()=>{z(o)&&e.disconnect()}));e.observe(document.body,{childList:!0,subtree:!0}),setTimeout((()=>{z(o)}),1e3),setTimeout((()=>{if(t.notFoundElementFallback){g(`Hello anchor selector ${t.anchorElementSelector} not found after 3 seconds, falling back to 'notFoundElementFallback': ${t.notFoundElementFallback}`,"info");const e=I({position:j(t.notFoundElementFallback)});z(e)}}),3e3)}}else v(`Selector anchorElementSelector "${t.anchorElementSelector}" is not a valid selector.`)};class C{constructor(t,e){this.targetId=t,this.allowedEvents=e,this.listeners=new Map,this.handleMessage=t=>{var e,o,n;const i=t.data,s=(null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||(null===(n=null===(o=this.iframe)||void 0===o?void 0:o.contentDocument)||void 0===n?void 0:n.defaultView);if(t.source!==s)return;if(!this.isValidMessage(i))return;const r=this.listeners.get(i.type);null==r||r.forEach((t=>{try{t(i.payload)}catch(t){v("Error in event listener:",t)}}))},this.initializeEventListeners(),this.iframe=document.getElementById(this.targetId)}initializeEventListeners(){window.addEventListener("message",this.handleMessage)}isValidMessage(t){if(!t||"object"!=typeof t)return!1;const e=t;return e.id===this.targetId&&"string"==typeof e.type&&this.allowedEvents.includes(e.type)&&void 0!==e.payload}on(t,e){this.listeners.has(t)||this.listeners.set(t,new Set),g(`[CheckoutAddressService] listening to ${t}`,"info");const o=e,n=this.listeners.get(t);return n&&n.add(o),()=>{const e=this.listeners.get(t);e&&e.delete(o)}}destroy(){window.removeEventListener("message",this.handleMessage),this.listeners.clear()}}class k extends C{constructor(){g("=== [Google Places Service] Initializing","info"),super(m.GOOGLE_PLACES,["fetchAutocompleteSuggestions","initializeGooglePlacesService","placeSelected","onFetchAutocompleteSuggestions","onInitializeGooglePlacesService","onPlaceSelected"])}sendMessage(t,e){var o;if(!(null===(o=this.iframe)||void 0===o?void 0:o.contentWindow))return;const n={id:this.targetId,logType:window.Zonos.iframeLogType,payload:e,type:t};g(`GooglePlacesService] parent --\x3e ${t}`,"info",e),this.iframe.contentWindow.postMessage(n,"*")}initialize(){this.sendMessage("initializeGooglePlacesService",{})}fetchSuggestions({country:t,query:e,type:o}){t&&this.sendMessage("fetchAutocompleteSuggestions",{request:{includedRegionCodes:[t],input:e},type:o})}selectPlace({placeId:t,type:e}){this.sendMessage("placeSelected",{placeId:t,type:e})}}class A{constructor(){this.googlePlaceInitialized=!1,g("=== [CheckoutAddressService] Initializing","info"),this.googlePlaces=new k,this.googlePlaces.on("onInitializeGooglePlacesService",(()=>{g("=== [CheckoutAddressService] parent <-- onInitializeGooglePlacesService","info"),this.googlePlaceInitialized=!0})),this.initialize()}initialize(){this.googlePlaces.initialize()}onInitializeGooglePlacesService(t){return this.googlePlaces.on("onInitializeGooglePlacesService",(()=>{g("[CheckoutAddressService] parent <-- onInitializeGooglePlacesService"),t()}))}isGooglePlaceInitialized(){return this.googlePlaceInitialized}onAddressSuggestions(t){return this.suggestionsCallback=t,this.googlePlaces.on("onFetchAutocompleteSuggestions",((...e)=>{g(`[CheckoutAddressService] parent <-- onFetchAutocompleteSuggestions ${e[0].type}`,"info",...e),t(...e)}))}onAddressSelected(t){return this.placeSelectedCallback=t,this.googlePlaces.on("onPlaceSelected",((...e)=>{g(`[CheckoutAddressService] parent <-- onPlaceSelected ${e[0].type}`,"info",...e),t(...e)}))}getAddressSuggestions({country:t,query:e,type:o}){this.googlePlaceInitialized&&this.googlePlaces.fetchSuggestions({country:t,query:e,type:o})}selectAddress({placeId:t,type:e}){this.googlePlaces.selectPlace({placeId:t,type:e})}destroy(){this.googlePlaces.destroy(),this.suggestionsCallback&&(this.suggestionsCallback=void 0),this.placeSelectedCallback&&(this.placeSelectedCallback=void 0)}}const E=class{constructor(o){t(this,o),this.paypalInitEvent=e(this,"paypalInitEvent",7),this.stripeInitEvent=e(this,"stripeInitEvent",7)}async initCheckoutElement(t){var e;t?(i.stripe=t,((e=d.checkoutSettings).placeOrderButtonSelector||e.alwaysTriggerInternationalCheckoutSelector||window.Zonos.cartData)&&(!e.placeOrderButtonSelector||r(e.placeOrderButtonSelector)?!e.alwaysTriggerInternationalCheckoutSelector||r(e.alwaysTriggerInternationalCheckoutSelector)?(()=>{if(!document.querySelector("zonos-checkout")){const t=document.createElement("zonos-checkout");document.body.appendChild(t)}})():v(`Selector alwaysTriggerInternationalCheckoutSelector "${e.alwaysTriggerInternationalCheckoutSelector}" is not a valid selector`):v(`Selector checkoutButtonAnchor "${e.placeOrderButtonSelector}" is not a valid selector`)),g("init checkout element")):g("Stripe is not loaded yet - cannot init checkout element","warn")}async initCollectElement(t){t?(i.stripe=t,window.Zonos.cartData&&(()=>{if(!document.querySelector("zonos-collect")){const t=document.createElement("zonos-collect");document.body.appendChild(t)}})(),g("init Collect element")):g("Stripe is not loaded yet - cannot init Collect element","warn")}async initInvoiceElement(t){t?(i.stripe=t,window.Zonos.cartData&&(()=>{if(!document.querySelector("zonos-invoice")){const t=document.createElement("zonos-invoice");document.body.appendChild(t)}})(),g("init Invoice element")):g("Stripe is not loaded yet - cannot init Invoice element","warn")}initZonosNotification(){if(document.querySelector("zonos-notification"))return;const t=document.createElement("zonos-notification");document.body.appendChild(t)}async setupGoogleFont(t){var e,o;const n=t||u();if("Inter"===n){if(!t)return;g("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn"),d.appearance=Object.assign(Object.assign({},d.appearance),{fontFamily:t})}const i=new URLSearchParams;i.set("family",n);const{errors:s,json:r}=await w(`/api/zonos-elements/get-font-detail?${i.toString()}`);if(s.length>0)return g(`Failed to load font ${n}`,"warn"),void(d.appearance=Object.assign(Object.assign({},d.appearance),{fontFamily:"Inter"}));const c=null==r?void 0:r.fontUrl;c&&(null===(o=(e=window.Zonos).injectSupportGoogleFont)||void 0===o||o.call(e,c)),t&&(g(`[FONT] ${t} font override applied`),d.appearance=Object.assign(Object.assign({},d.appearance),{fontFamily:t}))}handleLocationChange(){O(d.helloSettings)}initHistoryListener(){const t=history.pushState;history.pushState=function(){return window.dispatchEvent(new window.Event("pushstate")),window.dispatchEvent(new window.Event("locationchange")),t.apply(this,arguments)};const e=history.replaceState;history.replaceState=function(){return window.dispatchEvent(new window.Event("replacestate")),window.dispatchEvent(new window.Event("locationchange")),e.apply(this,arguments)}}injectCustomHTML(t){if(!t)return;if(!window.Zonos.isLegacyCheckout||window.Zonos.isCollect||window.Zonos.isInvoice)return void g("=== Skip injecting custom HTML for hosted checkout","info");g("=== Injecting custom HTML for hosted checkout");const e=document.createElement("template");e.innerHTML=t,e.content.querySelectorAll("script").forEach((t=>{const e=document.createElement("script");t.src?(e.src=t.src,e.async=t.async):e.textContent=t.innerHTML,document.body.appendChild(e)})),y()}async initGooglePlacesService(t){const e=null==t?void 0:t.genericSettings;if(!e)return;const o=e.signedTokenGooglePlaces;o&&f({id:m.GOOGLE_PLACES,onload:()=>{d.checkoutAddressService=new A},src:`https://route.elements.zonos.com/iframe/google-maps?signedToken=${o}`})}buildBaseConfig(t){var e,o;const n=Object.assign(Object.assign({},this.config.checkoutSettings),{allowedSettlementCurrencies:void 0,captureDelay:void 0,subscriptionStatus:void 0});if(window.Zonos.isCollect||window.Zonos.isInvoice)return Object.assign(Object.assign({},this.config),{checkoutSettings:n,helloSettings:Object.assign(Object.assign({},this.config.helloSettings),{visibilityStatus:"DISABLED"})});if(!this.config.checkoutSettings)return Object.assign(Object.assign({},this.config),{checkoutSettings:void 0});const i=window.Zonos.isLegacyCheckout&&!!window.Zonos.cartData&&"CLOSE_MODAL"===(null===(e=this.config.checkoutSettings)||void 0===e?void 0:e.successBehavior);return Object.assign(Object.assign({},this.config),{checkoutSettings:Object.assign(Object.assign({},n),{successBehavior:i?"ZONOS_SUCCESS_PAGE":this.config.checkoutSettings.successBehavior,successRedirectUrl:i?(null===(o=window.Zonos.cartData)||void 0===o?void 0:o.storeBaseUrl)||(null==t?void 0:t.onlineStoreSettings.url):this.config.checkoutSettings.successRedirectUrl})})}async componentWillLoad(){this.initHistoryListener(),d.zonosApiKey=this.zonosApiKey,(async()=>{var t,e,o,n,i,r;const{errors:l,json:a,zonosMode:u}=await(async()=>{if(window.Zonos.cartSettings)return g("Reusing cached zonos settings"),{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode};const t=p(),e=new URLSearchParams;t.overrideShouldEnabledCustomAddress&&e.set("overrideShouldEnabledCustomAddress",t.overrideShouldEnabledCustomAddress);const o=s();o&&e.set("zCountry",o);const{errors:n,json:i,zonosMode:r}=await w(`/api/zonos-elements/zonos-settings?${e.toString()}`);return n.length?(v("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:n,json:null,zonosMode:r}):{errors:[],json:i,zonosMode:r}})();if("403"===(null===(e=null===(t=l[0])||void 0===t?void 0:t.type)||void 0===e?void 0:e.toString()))return void g("Failed to load zonos settings. This domain may not have access","warn");const m=(null===(o=null==a?void 0:a.checkoutSettings)||void 0===o?void 0:o.customHTML)||"";this.injectCustomHTML(m),this.initZonosNotification();const f=this.buildBaseConfig(a),y=Object.assign(Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:(()=>{var t,e,o;return window.Zonos.isLegacyCheckout?(null===(t=null==a?void 0:a.appearanceSettings)||void 0===t?void 0:t.logoUrl)||(null===(e=this.config.appearance)||void 0===e?void 0:e.logoUrl):null===(o=this.config.appearance)||void 0===o?void 0:o.logoUrl})()})}),f);h({overrideSettings:y,zonosSettings:a}),d.zonosMode=u,(t=>{if("undefined"==typeof document||!t)return;const e=(({merchantSelector:t,supportsIs:e})=>e?`body.z-intl :is(${t})`:(t=>{const e=[];let o=0,n=0,i="";for(let s=0;s<t.length;s++){const r=t[s];if("("===r?o++:")"===r?o--:"["===r?n++:"]"===r&&n--,","===r&&0===o&&0===n){const t=i.trim();t&&e.push(t),i=""}else i+=r}const s=i.trim();return s&&e.push(s),e})(t).map((t=>`body.z-intl ${t}`)).join(", "))({merchantSelector:t,supportsIs:b});try{document.querySelector(e)}catch(o){return void g(`Skip domesticElementSelector injection: "${t}" produced an invalid CSS selector ("${e}")`,"warn")}if(document.getElementById(S))return;const o=document.createElement("style");o.id=S,o.textContent=`${e} { display: none !important; }`,(document.head||document.body).appendChild(o),g("Zonos domestic element hide style injected")})(d.checkoutSettings.domesticElementSelector),this.setupGoogleFont(),"DISABLED"===d.helloSettings.visibilityStatus&&g("=== Hello is disabled by store owner ===","warn"),d.helloSettings&&"ENABLED"===d.helloSettings.visibilityStatus&&(g("Initializing hello"),O(d.helloSettings)),await c();const z=(null===(n=null==a?void 0:a.checkoutSettings)||void 0===n?void 0:n.externalServiceTokens.find((t=>"STRIPE_PUBLISHABLE_TOKEN"===t.type)))||null;if(!z||!this.stripeInitEvent)return void g("Checkout failed to load -- missing publishable key","warn");if(window.Zonos.isCollect||window.Zonos.isInvoice)return this.stripeInitEvent.emit({publishableKey:z.token}),void this.initGooglePlacesService(a);if("INACTIVE"===d.checkoutSettings.subscriptionStatus)return g('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn"),void g("zonos controller loaded");if("DISABLED"===d.checkoutSettings.visibilityStatus)return g("=== Checkout is disabled by store owner ===","warn"),void g("zonos controller loaded");const j="function"==typeof(null===(i=d.checkoutSettings)||void 0===i?void 0:i.buildCartDetail)||"function"==typeof(null===(r=d.checkoutSettings)||void 0===r?void 0:r.createCartId),I=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret"),C=!(!window.Zonos.cartId||!window.Zonos.cartData)||!!I;j||C?(this.stripeInitEvent.emit({publishableKey:z.token}),this.initGooglePlacesService(a)):g("Skip loading Stripe because no cart callback (buildCartDetail/createCartId), prefetched cart, or payment client secret is present","warn")})()}async showNotification(t){const e=document.querySelector("zonos-notification");e?e.showNotification(t):g("Failed to show notification - zonos-notification not found","warn")}async reset(){l.checkoutSessionId=null,i.clientSecret=""}async overrideConfig(t){h({overrideSettings:t,zonosSettings:null})}async overrideCountry(t){g(`Override country code to ${t}`),a({isInitializing:!1,newSelectedCountryCode:t})}async getAppearanceSetting(){return d.appearance}async updateOrganizationName(t){d.organizationName=t}render(){return o(n,{key:"1714865012d806892f03e03896ee2f04aa1a729d",class:"zonos--elements"})}};E.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--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{visibility:hidden;opacity:0;height:0}";export{E as zonos_controller}
|