@zonos/elements 1.3.247 → 1.3.248
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-97a2d20a.js → cart-28310848.js} +2 -0
- package/dist/cjs/index.cjs.js +14 -7
- package/dist/cjs/{invoice-05a10ee1.js → invoice-2e8e5879.js} +1 -1
- package/dist/cjs/{isCollectMobileTablet-edd4804c.js → isCollectMobileTablet-bd0f4556.js} +1 -1
- package/dist/cjs/{paypal-0b4b352b.js → paypal-3019ae94.js} +21 -18
- package/dist/cjs/{placeTestOrder-07b46688.js → placeTestOrder-b0369cfd.js} +1 -1
- package/dist/cjs/{renderCheckoutCurrency-dd3b0609.js → renderCheckoutCurrency-9e919b9f.js} +1 -1
- package/dist/cjs/submitGtag-a50ab32e.js +116 -0
- package/dist/cjs/zonos-address-display_9.cjs.entry.js +1 -1
- package/dist/cjs/zonos-address_4.cjs.entry.js +1 -1
- package/dist/cjs/zonos-card_5.cjs.entry.js +3 -2
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +109 -17
- package/dist/cjs/zonos-checkout.cjs.entry.js +27 -6
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +1 -1
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +12 -11
- package/dist/cjs/zonos-collect.cjs.entry.js +4 -3
- package/dist/cjs/zonos-controller.cjs.entry.js +5 -2
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +3 -3
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +12 -11
- package/dist/cjs/zonos-invoice.cjs.entry.js +4 -3
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +88 -9
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +9 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +24 -4
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +9 -3
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/zonos-collect-finish.js +5 -5
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.js +1 -1
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.js +5 -5
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.js +1 -1
- package/dist/collection/components/main/zonos-controller.js +4 -1
- package/dist/collection/components/store/checkout/paypal.js +19 -1
- package/dist/collection/components/store/checkout/stripe.js +2 -0
- package/dist/collection/components/utils/submitGtag.js +90 -2
- package/dist/collection/scripts/_zonosBase.js +7 -0
- package/dist/collection/types/analyticsRelay.js +6 -0
- package/dist/esm/{cart-99ec4a3d.js → cart-ba8f3890.js} +2 -0
- package/dist/esm/index.js +14 -7
- package/dist/esm/{invoice-44e97c22.js → invoice-055bb6e5.js} +1 -1
- package/dist/esm/{isCollectMobileTablet-566ff0aa.js → isCollectMobileTablet-797cea8b.js} +1 -1
- package/dist/esm/{paypal-56534e48.js → paypal-8d8518c0.js} +23 -19
- package/dist/esm/{placeTestOrder-9e0ab5fd.js → placeTestOrder-0a74923e.js} +1 -1
- package/dist/esm/{renderCheckoutCurrency-1bd40006.js → renderCheckoutCurrency-bd059ecf.js} +1 -1
- package/dist/esm/submitGtag-89d6e9cb.js +113 -0
- package/dist/esm/zonos-address-display_9.entry.js +1 -1
- package/dist/esm/zonos-address_4.entry.js +1 -1
- package/dist/esm/zonos-card_5.entry.js +3 -2
- package/dist/esm/zonos-cart-items_12.entry.js +109 -17
- package/dist/esm/zonos-checkout.entry.js +27 -6
- package/dist/esm/zonos-collect-cart-items_3.entry.js +1 -1
- package/dist/esm/zonos-collect-finish_6.entry.js +12 -11
- package/dist/esm/zonos-collect.entry.js +4 -3
- package/dist/esm/zonos-controller.entry.js +5 -2
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +3 -3
- package/dist/esm/zonos-invoice-finish_5.entry.js +12 -11
- package/dist/esm/zonos-invoice.entry.js +4 -3
- package/dist/esm-es5/{cart-99ec4a3d.js → cart-ba8f3890.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{invoice-44e97c22.js → invoice-055bb6e5.js} +1 -1
- package/dist/esm-es5/{isCollectMobileTablet-566ff0aa.js → isCollectMobileTablet-797cea8b.js} +1 -1
- package/dist/esm-es5/paypal-8d8518c0.js +17 -0
- package/dist/esm-es5/{placeTestOrder-9e0ab5fd.js → placeTestOrder-0a74923e.js} +1 -1
- package/dist/esm-es5/{renderCheckoutCurrency-1bd40006.js → renderCheckoutCurrency-bd059ecf.js} +1 -1
- package/dist/esm-es5/submitGtag-89d6e9cb.js +1 -0
- package/dist/esm-es5/zonos-address-display_9.entry.js +1 -1
- package/dist/esm-es5/zonos-address_4.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 +1 -1
- 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-invoice-cart-items_2.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice.entry.js +1 -1
- package/dist/scripts/analyticsRelayOnInit.js +1 -0
- package/dist/scripts/index.d.ts +11 -0
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +4 -0
- package/dist/types/components/store/checkout/stripe.d.ts +6 -0
- package/dist/types/components/utils/submitGtag.d.ts +32 -2
- package/dist/types/scripts/_zonosBase.d.ts +11 -0
- package/dist/types/types/analyticsRelay.d.ts +12 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-002e45f9.system.js +17 -0
- package/dist/zonos-elements/p-0792688d.system.entry.js +1 -0
- package/dist/zonos-elements/p-0b7beb16.system.entry.js +1 -0
- package/dist/zonos-elements/p-0f787f5d.entry.js +1 -0
- package/dist/zonos-elements/{p-2e8f842c.entry.js → p-0ff93ca6.entry.js} +1 -1
- package/dist/zonos-elements/{p-10355cf6.system.entry.js → p-1acf0a71.system.entry.js} +1 -1
- package/dist/zonos-elements/p-291f7ccb.system.entry.js +1 -0
- package/dist/zonos-elements/p-3972663a.system.entry.js +1 -0
- package/dist/zonos-elements/{p-53a9da45.entry.js → p-39fa55c7.entry.js} +1 -1
- package/dist/zonos-elements/{p-f6f1d779.system.entry.js → p-3e85b9f5.system.entry.js} +1 -1
- package/dist/zonos-elements/p-48475755.entry.js +1 -0
- package/dist/zonos-elements/{p-d0411b2d.entry.js → p-58248f03.entry.js} +1 -1
- package/dist/zonos-elements/p-5edef7c3.system.js +1 -0
- package/dist/zonos-elements/{p-678331f0.system.js → p-63a3d3b9.system.js} +1 -1
- package/dist/zonos-elements/p-64661dd1.js +1 -0
- package/dist/zonos-elements/p-69212d0f.entry.js +1 -0
- package/dist/zonos-elements/{p-71185d24.system.js → p-719403e0.system.js} +1 -1
- package/dist/zonos-elements/{p-382601a9.system.entry.js → p-71a8d971.system.entry.js} +1 -1
- package/dist/zonos-elements/p-71d855b8.system.entry.js +1 -0
- package/dist/zonos-elements/p-71f10bf0.entry.js +1 -0
- package/dist/zonos-elements/p-72ff005c.entry.js +1 -0
- package/dist/zonos-elements/{p-08365fdb.system.js → p-7dba5f23.system.js} +1 -1
- package/dist/zonos-elements/p-85e59f3a.system.entry.js +1 -0
- package/dist/zonos-elements/{p-ce98e472.js → p-866afec1.js} +1 -1
- package/dist/zonos-elements/p-942358eb.system.js +1 -0
- package/dist/zonos-elements/{p-2c10b067.system.entry.js → p-94c5fbfc.system.entry.js} +1 -1
- package/dist/zonos-elements/p-a12cb7ce.entry.js +1 -0
- package/dist/zonos-elements/p-abf38ed6.js +1 -0
- package/dist/zonos-elements/{p-df6e62f8.system.js → p-ae16dda9.system.js} +1 -1
- package/dist/zonos-elements/{p-46ece7ae.js → p-bc4bfa06.js} +1 -1
- package/dist/zonos-elements/p-bf5e47e2.entry.js +1 -0
- package/dist/zonos-elements/{p-dca14319.system.js → p-c027a832.system.js} +1 -1
- package/dist/zonos-elements/p-c2442878.system.js +1 -1
- package/dist/zonos-elements/p-c2f34b10.system.entry.js +1 -0
- package/dist/zonos-elements/p-c36696f9.js +1 -0
- package/dist/zonos-elements/p-c7311ce5.system.entry.js +1 -0
- package/dist/zonos-elements/{p-1b86711b.js → p-de8899bc.js} +1 -1
- package/dist/zonos-elements/p-e17bbcee.entry.js +1 -0
- package/dist/zonos-elements/{p-e458f737.entry.js → p-f6c2c743.entry.js} +1 -1
- package/dist/zonos-elements/p-fe06c9ea.js +17 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/paypal-56534e48.js +0 -17
- package/dist/zonos-elements/p-0c201c39.system.entry.js +0 -1
- package/dist/zonos-elements/p-0cb5f151.system.entry.js +0 -1
- package/dist/zonos-elements/p-3e2f175c.entry.js +0 -1
- package/dist/zonos-elements/p-5295d36e.entry.js +0 -1
- package/dist/zonos-elements/p-64870563.entry.js +0 -1
- package/dist/zonos-elements/p-695e0803.system.entry.js +0 -1
- package/dist/zonos-elements/p-6e3cf6eb.entry.js +0 -1
- package/dist/zonos-elements/p-6f430d6f.system.entry.js +0 -1
- package/dist/zonos-elements/p-794d29dc.entry.js +0 -1
- package/dist/zonos-elements/p-8defdf0d.system.js +0 -17
- package/dist/zonos-elements/p-8e98a7c8.js +0 -1
- package/dist/zonos-elements/p-95348ebf.system.entry.js +0 -1
- package/dist/zonos-elements/p-9a066833.system.entry.js +0 -1
- package/dist/zonos-elements/p-aa6c2348.system.entry.js +0 -1
- package/dist/zonos-elements/p-ada8841a.js +0 -1
- package/dist/zonos-elements/p-c75b7c47.entry.js +0 -1
- package/dist/zonos-elements/p-caff391d.system.entry.js +0 -1
- package/dist/zonos-elements/p-dd19d9d8.js +0 -17
- package/dist/zonos-elements/p-df90bccf.entry.js +0 -1
- package/dist/zonos-elements/p-e07aaf09.system.js +0 -1
- package/dist/zonos-elements/p-f8eb618b.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,o,t,n){function s(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,i){function r(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n["throw"](e))}catch(e){i(e)}}function c(e){e.done?t(e.value):s(e.value).then(r,a)}c((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,s,i,r;return r={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function a(e){return function(o){return c([e,o])}}function c(a){if(n)throw new TypeError("Generator is already executing.");while(r&&(r=0,a[0]&&(t=0)),t)try{if(n=1,s&&(i=a[0]&2?s["return"]:a[0]?s["throw"]||((i=s["return"])&&i.call(s),0):s.next)&&!(i=i.call(s,a[1])).done)return i;if(s=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;s=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1];i=a;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(a);break}if(i[2])t.ops.pop();t.trys.pop();continue}a=o.call(e,t)}catch(e){a=[6,e];s=0}finally{n=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,o,t){if(t||arguments.length===2)for(var n=0,s=o.length,i;n<s;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))};import{r as registerInstance,c as createEvent,h,F as Fragment,H as Host,a as getElement}from"./index-0bbe9693.js";import{b as stripeStore,c as stripeStoreRetrievePayment,t as trackConversionEvent,H as stripeStoreResetPromoCode,y as stripeStoreReset,I as stripeStoreMessageBasedOnStatus,d as cartStore,r as cartStoreNextStep,z as cartStoreOnChange}from"./cart-99ec4a3d.js";import{s as submitGtag,c as paypalStoreReset,a as paypalStore,b as paypalInitScript}from"./paypal-56534e48.js";import{t as translate,s as storageStore,l as localizationStore}from"./localization-853b48a9.js";import{z as zonosStore}from"./zonosStore-b434e436.js";import{h as handleFetch,s as sendErrorLog,g as getIsTestMode,i as isCheckoutMobile,a as getIsStagingMode}from"./handleFetch-a844cac1.js";import{c as createCustomEvent}from"./createCustomEvent-58159025.js";import{g as getBorderRadius}from"./getBorderRadius-877f6389.js";import{l as log,b as allLogs}from"./VarianceTest-572cecf5.js";import{i as isInvoiceMobile,a as isInvoiceTablet}from"./isInvoiceMobileTablet-1f7b614e.js";import{c as classes}from"./classes-0d95c529.js";import{l as languages}from"./ILanguage-cd6acb72.js";import{c as invoiceStore}from"./invoice-44e97c22.js";import{r as renderCheckoutCurrency}from"./renderCheckoutCurrency-1bd40006.js";import{p as placeTestOrder}from"./placeTestOrder-9e0ab5fd.js";import{r as renderFallback}from"./renderFallback-3f010b48.js";import"./isDarkColor-9ddd90cc.js";import"./isContrastColor-69778cea.js";var RemoveIcon='<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-200)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var SuccessIcon='<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-100)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M15.707 9.293a1 1 0 0 1 0 1.414l-3.646 3.647a1.5 1.5 0 0 1-2.122 0l-1.646-1.647a1 1 0 1 1 1.414-1.414L11 12.586l3.293-3.293a1 1 0 0 1 1.414 0Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var zonosInvoiceFinishCss=":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{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;height:100%}:host .zonos--group{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;margin-bottom:24px;border-radius:var(--zonos--border-radius, 10px);gap:24px;margin-top:24px;background-color:var(--zonos-elements-gray-50);padding:48px}:host .zonos--finish-details{max-width:640px;min-width:300px;line-height:24px;width:0 auto;margin:auto}:host zonos-button{width:100%}:host .loading-wrapper{min-height:300px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host .zonos--finish-button-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;gap:16px;margin:0 auto;margin-top:48px;max-width:300px}:host .zonos--button-container{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;gap:16px;margin:0 auto}:host .zonos--subtitle{text-align:center}:host .zonos--order-number{background-color:var(--zonos-elements-gray-0);border:1px solid var(--zonos-elements-gray-200);color:var(--zonos-elements-gray-800);border-radius:var(--zonos-elements-radius-6);padding:4px 8px}";var ZonosInvoiceFinishStyle0=zonosInvoiceFinishCss;var MAX_RETRIES=30;var ZonosInvoiceFinish=function(){function e(e){var o=this;registerInstance(this,e);this.closeClick=createEvent(this,"closeClick",7);this.borderRadius="ROUNDED";this.confirmationId=null;this.isLoading=true;this.notificationType="success";this.notificationTitle="";this.notificationMessages=[];this.notificationActionText=translate("Keep shopping");this.order=null;this.isWaitingToRedirect=true;this.pullOrder=function(){return __awaiter(o,void 0,void 0,(function(){var e,o,t,n,s,i,r,a;return __generator(this,(function(c){switch(c.label){case 0:t=storageStore.checkoutSessionId;n=new URLSearchParams;n.set("checkoutSessionId",t||"");return[4,handleFetch("/api/zonos-elements/get-order?".concat(n.toString()))];case 1:s=c.sent(),i=s.baseUrl,r=s.errors,a=s.json;if(r.length||!(a===null||a===void 0?void 0:a.id)){return[2,{baseUrl:i,order:null}]}return[4,(o=(e=zonosStore.checkoutSettings).onOrderSuccess)===null||o===void 0?void 0:o.call(e,{zonosApiRoute:i,zonosOrder:a})];case 2:c.sent();return[2,{baseUrl:i,order:a}]}}))}))};this.handleSuccessBehavior=function(){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:this.isLoading=false;return[4,this.getPullOrder()];case 1:e.sent();return[2]}}))}))};this.getPullOrder=function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return __awaiter(o,__spreadArray([],e,true),void 0,(function(e){var o,t,n,s,i,r,a,c;if(e===void 0){e=0}return __generator(this,(function(l){switch(l.label){case 0:if(e===0){log("=== Start to poll for order info","info")}return[4,this.pullOrder()];case 1:n=l.sent(),s=n.baseUrl,i=n.order;r=!!((t=(o=i===null||i===void 0?void 0:i.references)===null||o===void 0?void 0:o.find((function(e){return(e===null||e===void 0?void 0:e.key)==="zonosOrderNumber"})))===null||t===void 0?void 0:t.value);a=storageStore.checkoutSessionId;c=parseFloat(new URLSearchParams(window.location.search).get("maxPollingRetries")||"0")||MAX_RETRIES;log("=== Polling order (".concat(e," attemps)"),"info");if(!i)return[3,2];log("=== InvoiceOrder info found","info");if(e>10){void sendErrorLog({endpoint:"".concat(s,"/api/zonos-elements/get-order?checkoutSessionId=").concat(a,"&orderId=").concat(i.id),errors:["Invoice order found after ".concat(e," attempts")],metadata:{allLogs:allLogs,checkoutSessionId:storageStore.checkoutSessionId||"",orderId:i.id,storeId:zonosStore.storeId}})}this.order=i;return[3,6];case 2:if(!((!i||!r)&&e<c))return[3,5];return[4,new Promise((function(e){return setTimeout(e,1e3)}))];case 3:l.sent();return[4,this.getPullOrder(e+1)];case 4:l.sent();return[3,6];case 5:void sendErrorLog({endpoint:"".concat(s,"/api/zonos-elements/get-order?checkoutSessionId=").concat(a),errors:["Invoice order not found after ".concat(c," attempts")],metadata:{allLogs:allLogs,checkoutSessionId:storageStore.checkoutSessionId||"",storeId:zonosStore.storeId}});l.label=6;case 6:return[2]}}))}))};this.checkStripePaymentStatus=function(){return __awaiter(o,void 0,void 0,(function(){var e,o,t,n,s,i,r,a,c;return __generator(this,(function(l){switch(l.label){case 0:e=new URLSearchParams(window.location.search).get("payment_intent_client_secret")||stripeStore.clientSecret;if(!(e||this.storybookForceStatus))return[3,4];return[4,stripeStoreRetrievePayment({clientSecret:e,storybookForceStatus:this.storybookForceStatus})];case 1:o=l.sent(),t=o.error,n=o.messages,s=o.status;i=s==="requires_action"||t;this.notificationType=i?"error":"success";this.notificationMessages=n||[];this.notificationTitle=i?translate("Payment failed"):translate("You're all set!");log("=== Payment intent retrieve status","info",{clientSecret:e,error:t,messages:n,status:s});r=new URL(window.location.href);r.searchParams.delete("payment_intent_client_secret");r.searchParams.delete("payment_intent");r.searchParams.delete("redirect_status");r.searchParams.delete("zonosCheckoutSessionId");window.history.replaceState({},"",r.toString());if(!(t&&(n===null||n===void 0?void 0:n.length)))return[3,2];submitGtag("zonos-checkout-payment-fail");void sendErrorLog({endpoint:"Stripe payment failed",errors:['Payment intent "'.concat(e.split("_secret_")[0]||e,'" status: ').concat(s," - checkout session: ").concat(storageStore.checkoutSessionId)],metadata:{allLogs:allLogs,credentialToken:window.Zonos.zonosApiKey}});return[3,4];case 2:submitGtag("zonos-checkout-success");a=storageStore.checkoutSessionId;void trackConversionEvent({checkoutSessionId:a,eventName:"checkout_orderCompleted"});c=createCustomEvent("zonos-checkout-success",{message:"Zonos Checkout successfully processed order"});document.dispatchEvent(c);return[4,this.handleSuccessBehavior()];case 3:l.sent();l.label=4;case 4:this.isLoading=false;stripeStoreResetPromoCode();stripeStoreReset();storageStore.checkoutSessionId=null;return[2]}}))}))};this.checkStagingOrderStatus=function(){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:this.notificationType="success";this.notificationTitle=translate("You're all set!");this.notificationMessages=stripeStoreMessageBasedOnStatus("succeeded").messages;return[4,this.handleSuccessBehavior()];case 1:e.sent();stripeStoreResetPromoCode();stripeStoreReset();paypalStoreReset();storageStore.checkoutSessionId=null;return[2]}}))}))};this.checkPaypalPaymentStatus=function(){return __awaiter(o,void 0,void 0,(function(){var e;return __generator(this,(function(o){switch(o.label){case 0:if(paypalStore.paypalErrorMessage){this.notificationType="error";this.notificationTitle=translate("Payment failed");this.notificationMessages=[paypalStore.paypalErrorMessage];this.isLoading=false;return[2]}this.isLoading=false;if(!paypalStore.orderIdCreated)return[3,2];submitGtag("zonos-checkout-success");e=storageStore.checkoutSessionId;void trackConversionEvent({checkoutSessionId:e,eventName:"checkout_orderCompleted"});this.notificationType="success";this.notificationTitle=translate("You're all set!");this.notificationMessages=stripeStoreMessageBasedOnStatus("succeeded").messages;return[4,this.handleSuccessBehavior()];case 1:o.sent();o.label=2;case 2:stripeStoreResetPromoCode();stripeStoreReset();paypalStoreReset();storageStore.checkoutSessionId=null;return[2]}}))}))};this.getReceiptUrl=function(e){var o=e.cartId;var t=new URL("".concat(window.location.origin,"/receipt"));t.searchParams.set("referenceId",o);var n=getIsTestMode();if(n){t.searchParams.set("zonosTestMode","1")}var s=new URLSearchParams(window.location.search).get("zonosQaUrl");if(s){t.searchParams.set("zonosQaUrl",s)}return t.toString()}}e.prototype.componentDidLoad=function(){if(this.overrideNotification){this.notificationType=this.overrideNotification.type;this.notificationTitle=this.overrideNotification.title;this.notificationMessages=this.overrideNotification.messages;this.isLoading=false;return}if(cartStore.isStagingMode){void this.checkStagingOrderStatus()}else if(paypalStore.orderIdCreated){void this.checkPaypalPaymentStatus()}else{void this.checkStripePaymentStatus()}};e.prototype.render=function(){var e=this;var o=window.Zonos.cartId;return h(Host,{key:"2d8d736241298daa30fdf8935cef67bfa748e2df",class:"zonos--checkout-finish zonos--elements",style:{"--zonos--border-radius":getBorderRadius({overrideBorderStyle:this.borderRadius})}},!this.isLoading&&h("div",{key:"30e1eae6e9ac7289af88f8fe2048d40796dfdf0e",class:"zonos--finish-details"},h("div",{key:"0324e34b72e58d0862ed319576018bd45bd18b18",class:"zonos--group"},this.notificationType==="success"?h("zonos-icon",{"aria-label":"Order success",content:SuccessIcon,iconColor:"blue-800",size:50}):h("zonos-icon",{"aria-label":"Order failed",content:RemoveIcon,iconColor:"red-800",size:50}),h("zonos-text",{key:"227f3cdda8e9cb0ed15ea91acb88c88d15d3d21c",class:"zonos--title",type:"semiBoldSubheader"},this.notificationTitle),this.confirmationId&&h("zonos-badge",{key:"1458ad439dc56e9ca7641a9ca95f3dfb2fd6b28f",badgeColor:"gray"},this.confirmationId),h("zonos-text",{key:"8b0ab258c7beab09b0bc12999198f38813a144b3",class:"zonos--subtitle",textColor:"gray-600"},this.notificationMessages.map((function(e){return h(Fragment,null,e,h("br",null))}))),this.order&&o&&h("div",{key:"ea6b4f8c1f8cce779fadf358966fece018d9869b",class:"zonos--button-container"},h("zonos-button",{key:"e5140fa1fab1e3150a2b15915c29d988f54468b2",onClick:function(){window.open(e.getReceiptUrl({cartId:o}),"_blank")},size:"lg",variant:"primary"},translate("View receipt"))))))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return e}();ZonosInvoiceFinish.style=ZonosInvoiceFinishStyle0;var Globe='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12ZM11.4709 5.80634C11.7686 5.53723 11.9541 5.5 12 5.5C12.0459 5.5 12.2314 5.53723 12.5291 5.80634C12.8115 6.06164 13.1289 6.46913 13.4271 7.03651C13.9505 8.03191 14.3838 9.46098 14.48 11.25H9.51996C9.61624 9.46098 10.0495 8.03191 10.5729 7.03651C10.8711 6.46913 11.1885 6.06164 11.4709 5.80634ZM8.01802 11.25C8.11591 9.23031 8.60319 7.55958 9.24516 6.33849C9.29983 6.23451 9.35585 6.13335 9.41312 6.03514C7.32916 6.94017 5.81218 8.90533 5.5428 11.25H8.01802ZM5.5428 12.75H8.01802C8.11591 14.7697 8.60319 16.4404 9.24516 17.6615C9.29983 17.7655 9.35585 17.8666 9.41312 17.9649C7.32916 17.0598 5.81218 15.0947 5.5428 12.75ZM9.51996 12.75H14.48C14.3838 14.539 13.9505 15.9681 13.4271 16.9635C13.1289 17.5309 12.8115 17.9384 12.5291 18.1937C12.2314 18.4628 12.0459 18.5 12 18.5C11.9541 18.5 11.7686 18.4628 11.4709 18.1937C11.1885 17.9384 10.8711 17.5309 10.5729 16.9635C10.0495 15.9681 9.61624 14.539 9.51996 12.75ZM15.982 12.75C15.8841 14.7697 15.3968 16.4404 14.7548 17.6615C14.7002 17.7655 14.6441 17.8666 14.5869 17.9649C16.6708 17.0598 18.1878 15.0947 18.4572 12.75H15.982ZM18.4572 11.25C18.1878 8.90533 16.6708 6.94017 14.5869 6.03514C14.6441 6.13335 14.7002 6.23451 14.7548 6.33849C15.3968 7.55958 15.8841 9.23031 15.982 11.25H18.4572Z" fill="currentColor"/>\n</svg>\n';var ZonosWordmark='<svg width="43" height="10" viewBox="0 0 43 10" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.35896 0.0640869H0.30768C0.166068 0.0640869 0.0512695 0.178886 0.0512695 0.320497V1.85896C0.0512695 2.00057 0.166068 2.11537 0.30768 2.11537H4.44439C4.54964 2.11537 4.61005 2.2352 4.54745 2.31982L0.151823 8.2615C0.0865163 8.34978 0.0512695 8.45669 0.0512695 8.56649V9.67947C0.0512695 9.82108 0.166068 9.93588 0.30768 9.93588H7.35896C7.50057 9.93588 7.61537 9.82108 7.61537 9.67947V8.14101C7.61537 7.9994 7.50057 7.8846 7.35896 7.8846H3.22226C3.117 7.8846 3.05659 7.76477 3.11919 7.68015L7.51482 1.73847C7.58013 1.65019 7.61537 1.54328 7.61537 1.43348V0.320497C7.61537 0.178886 7.50057 0.0640869 7.35896 0.0640869Z" fill="var(--zonos-elements-gray-800)"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M11.718 0C10.1602 0 8.89746 1.26279 8.89746 2.82051V7.17949C8.89746 8.73721 10.1602 10 11.718 10H13.6411C15.1988 10 16.4616 8.73721 16.4616 7.17949V2.82051C16.4616 1.26279 15.1988 0 13.6411 0H11.718ZM11.718 2.05128C11.2931 2.05128 10.9487 2.39568 10.9487 2.82051V7.17949C10.9487 7.60432 11.2931 7.94872 11.718 7.94872H13.6411C14.0659 7.94872 14.4103 7.60432 14.4103 7.17949V5V2.82051C14.4103 2.39568 14.0659 2.05128 13.6411 2.05128H11.718Z" fill="var(--zonos-elements-gray-800)"/>\n<path d="M17.7437 0.436316V9.71132C17.7437 9.85293 17.8585 9.96773 18.0001 9.96773H19.5385C19.6801 9.96773 19.7949 9.85293 19.7949 9.71132V3.74801C19.7949 3.44829 19.969 3.17587 20.241 3.04996L22.1641 2.15964C22.6739 1.92363 23.2565 2.29592 23.2565 2.85769V9.71132C23.2565 9.85293 23.3713 9.96773 23.5129 9.96773H25.0513C25.193 9.96773 25.3078 9.85293 25.3078 9.71132V2.85595C25.3078 0.79631 23.1718 -0.568775 21.3027 0.296257L19.9742 0.911055C19.8685 0.959946 19.7432 0.931536 19.669 0.84187L19.2748 0.365697C19.1773 0.248019 19.0325 0.179905 18.8797 0.179905H18.0001C17.8585 0.179905 17.7437 0.294704 17.7437 0.436316Z" fill="var(--zonos-elements-gray-800)"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M29.4104 0C27.8526 0 26.5898 1.26279 26.5898 2.82051V7.17949C26.5898 8.73721 27.8526 10 29.4104 10H31.3334C32.8912 10 34.1539 8.73721 34.1539 7.17949V2.82051C34.1539 1.26279 32.8912 0 31.3334 0H29.4104ZM29.4104 2.05128C28.9855 2.05128 28.6411 2.39568 28.6411 2.82051V7.17949C28.6411 7.60432 28.9855 7.94872 29.4104 7.94872H31.3334C31.7583 7.94872 32.1027 7.60432 32.1027 7.17949V2.82051C32.1027 2.39568 31.7583 2.05128 31.3334 2.05128H29.4104Z" fill="var(--zonos-elements-gray-800)"/>\n<path d="M38.2085 0.0640869H40.3889C41.8309 0.0640869 42.9999 1.23306 42.9999 2.67506C42.9999 2.79477 42.9108 2.89574 42.792 2.91059L41.1732 3.11293C41.054 3.12784 40.9486 3.03485 40.9486 2.91466C40.9486 2.47322 40.5908 2.11537 40.1493 2.11537H38.3397C37.8688 2.11537 37.4871 2.49712 37.4871 2.96803C37.4871 3.3685 37.7658 3.71501 38.1569 3.80087L40.7916 4.37922C42.0811 4.66229 42.9999 5.80462 42.9999 7.12486C42.9999 8.67735 41.7414 9.93588 40.1889 9.93588H38.0468C36.6048 9.93588 35.4358 8.76691 35.4358 7.32491C35.4358 7.2052 35.5249 7.10423 35.6437 7.08938L37.2625 6.88703C37.3817 6.87213 37.4871 6.96512 37.4871 7.08531C37.4871 7.52675 37.8449 7.8846 38.2864 7.8846H40.1176C40.5765 7.8846 40.9486 7.51252 40.9486 7.05354C40.9486 6.67478 40.6925 6.34394 40.3258 6.24901L37.5136 5.52093C36.2902 5.20422 35.4358 4.10042 35.4358 2.83676C35.4358 1.30545 36.6772 0.0640869 38.2085 0.0640869Z" fill="var(--zonos-elements-gray-700)"/>\n</svg>\n';var zonosInvoiceFooterCss=":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{position:absolute;bottom:0;left:32px;right:32px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;z-index:2}:host .zonos--invoice-footer{gap:16px;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;padding:12px;padding-left:0;-ms-flex-align:center;align-items:center;width:100%}:host .zonos--invoice-footer .zonos--invoice-footer-icon-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:16px}:host .zonos--invoice-footer .zonos--invoice-footer-icon-wrapper .zonos--invoice-footer-logo{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-align:center;align-items:center}:host .zonos--invoice-footer .zonos--invoice-footer-icon-wrapper .zonos--invoice-footer-logo a{line-height:0}:host .zonos--invoice-footer .zonos--invoice-footer-icon-wrapper a{text-decoration:none}:host .zonos--invoice-footer zonos-button button.outline{outline:1px solid var(--zonos-elements-gray-800)}:host .zonos--invoice-footer .zonos--invoice-locale-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:8px;position:relative}@media (max-width: 400px){:host .zonos--invoice-footer .zonos--invoice-locale-wrapper{gap:4px}}:host .zonos--invoice-footer .zonos--invoice-language-dialog{position:absolute;bottom:36px;left:var(--language-dialog-left);background:var(--zonos-elements-surface-color);-webkit-box-shadow:var(--zonos-elements-v3-shadow-xl);box-shadow:var(--zonos-elements-v3-shadow-xl);border-radius:var(--zonos-elements-radius-12);width:360px;max-width:100vw;max-height:500px;z-index:2147483011;overflow:auto;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:bottom left;transform-origin:bottom left;opacity:0;-webkit-transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar{width:10px}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar-track{border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}:host .zonos--invoice-footer .zonos--invoice-language-dialog.zonos--invoice-language-dialog-open{opacity:1;-webkit-transform:scale(1);transform:scale(1)}:host .dot{display:-ms-inline-flexbox;display:inline-flex;background:var(--zonos-elements-gray-400);width:6px;height:6px;border-radius:50%}:host(.mobile),:host(.tablet){background-color:var(--zonos-elements-gray-0);width:100%;position:-webkit-sticky;position:sticky;bottom:0}:host(.tablet) .zonos--invoice-footer{width:100%;max-width:800px;-ms-flex-pack:justify;justify-content:space-between;display:-ms-flexbox;display:flex}:host(.mobile){-ms-flex-order:3;order:3}:host(.mobile) .zonos--invoice-locale-wrapper{display:none}:host(.mobile) .zonos--invoice-footer{-ms-flex-pack:center;justify-content:center}";var ZonosInvoiceFooterStyle0=zonosInvoiceFooterCss;var ZonosInvoiceFooter=function(){function e(e){registerInstance(this,e);this.mobile=false;this.tablet=false;this.showLanguageDialog=false;this.isMobile=false;this.isTablet=false}e.prototype.handleGlobalClick=function(e){if(!this.el.contains(e.target)&&this.showLanguageDialog){this.showLanguageDialog=false}};e.prototype.toggleLanguageDialog=function(){this.showLanguageDialog=!this.showLanguageDialog};e.prototype.handleMobileChange=function(){this.isMobile=isInvoiceMobile(this.mobile)};e.prototype.handleTabletChange=function(){this.isTablet=isInvoiceTablet(this.tablet)};e.prototype.componentWillLoad=function(){this.isMobile=isInvoiceMobile(this.mobile);this.isTablet=isInvoiceTablet(this.tablet)};e.prototype.render=function(){var e=this;var o;var t=(o=languages.find((function(e){return e.code===localizationStore.selectedLocale})))===null||o===void 0?void 0:o.label;var n="gray-1000";return h(Host,{key:"c84163fd8ab0bc0f2c791028b6896379a4ae6a27",class:classes(["zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"])},h("div",{key:"099a3be332fa52c5e7551bdd2a618041c4a6eb22",class:"zonos--invoice-footer"},h("div",{key:"ab727f45f3a67bcdd51eb29b392462f15eb5fedd",class:"zonos--invoice-locale-wrapper"},h("zonos-button",{key:"3d8431c78d54e0fe630677d0dd4ae2c975a208fa",buttonColor:n,class:"zonos--invoice-footer-language-button",icon:h("zonos-icon",{"aria-label":"Language select",content:Globe,iconColor:n}),onClick:function(){return e.toggleLanguageDialog()},variant:"subtle"},t),h("div",{key:"2920b4105b6209c4177fc91651dc5d9397d6abf2",class:classes(["zonos--invoice-language-dialog",this.showLanguageDialog&&"zonos--invoice-language-dialog-open"])},h("zonos-language-select",{key:"705e1a4243dc7ebc73c522a82f93c3d833240a95",handleOnClose:function(){return e.toggleLanguageDialog()}}))),h("div",{key:"49c2d0ae1f587079b48f12d62d10eb422991255e",class:"zonos--invoice-footer-icon-wrapper"},h("div",{key:"58a4da788527ddf4abd759b5e305e747aa96d540",class:"zonos--invoice-footer-logo"},h("zonos-text",{key:"45bf1af64ec0f0a2e11e8d23361b71f4b4189881",textColor:n},translate("Powered by")),h("a",{key:"1dd7224f3e126bcabe60a42c9529ab65c64f0063",href:"https://zonos.com",target:"_blank",title:"Zonos website"},h("zonos-icon",{key:"7dc21ce09b72bf37efd30e2c17b6d8b9328e8c3d",autoHeight:true,content:ZonosWordmark,size:42}))),h("div",{key:"a0d053e6745733cd61868c109628a1835f4fe3ed",class:"dot"}),h("a",{key:"fd467e88aa2ed10b707f88ed0d1a5af80af35539",href:"https://zonos.com/docs/legal/zonos-privacy-policy",target:"_blank"},h("zonos-text",{key:"35db684368ff8abc05c2c7fab22500270b0b7e21",textColor:n},translate("Privacy policy"))))))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{mobile:["handleMobileChange"],tablet:["handleTabletChange"]}},enumerable:false,configurable:true});return e}();ZonosInvoiceFooter.style=ZonosInvoiceFooterStyle0;var ChevronDownIcon='<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var ChevronUpIcon='<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M17.707 14.707a1 1 0 0 1-1.414 0L12 10.414l-4.293 4.293a1 1 0 0 1-1.414-1.414l4.93-4.93a1.1 1.1 0 0 1 1.555 0l4.93 4.93a1 1 0 0 1 0 1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var zonosInvoiceOrderDetailsCss=":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{height:100%}:host *{-ms-scroll-chaining:none;overscroll-behavior:contain}:host *::-webkit-scrollbar{width:10px}:host *::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host *::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host *::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--order-details-header-text{display:-ms-flexbox;display:flex}:host .zonos--wrapper{overflow:auto;background-color:var(--zonos-elements-gray-50);border-radius:16px;height:100%;min-height:56px}:host .zonos--order-details-header-text{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:8px}:host .zonos--order-details-header{position:-webkit-sticky;position:sticky;top:0;z-index:1;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--zonos-elements-gray-50);border:none;display:-ms-flexbox;display:flex;padding:16px 16px 0 16px;width:100%;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center}:host .zonos--order-details-header:focus-visible{outline:none}:host .zonos--order-details-wrapper{position:relative;padding:0 16px 16px 16px}:host .zonos--invoice-order-details-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:16px}:host .zonos--invoice-order-info{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:32px}:host .zonos--invoice-order-info .zonos--invoice-order-details-row{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:16px}:host .zonos--invoice-order-info .zonos--invoice-order-details-row>*{-ms-flex:1 1 150px;flex:1 1 150px}:host .zonos--invoice-order-info .zonos--invoice-order-details-column{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px}:host .zonos--invoice-order-info .zonos--invoice-order-shipping-info{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:0}";var ZonosInvoiceOrderDetailsStyle0=zonosInvoiceOrderDetailsCss;var ZonosInvoiceOrderDetails=function(){function e(e){registerInstance(this,e);this.collapseClicked=createEvent(this,"collapseClicked",7);this.mobile=true;this.landedCostId="";this.isMobile=false;this.collapseState=this.collapsed}e.prototype.handleCollapseChangeFromProp=function(e){this.collapseState=e};e.prototype.handleCollapseChange=function(e){this.collapseClicked.emit(e)};e.prototype.handleWindowResize=function(){this.isMobile=isCheckoutMobile(this.mobile)};e.prototype.componentWillLoad=function(){this.handleWindowResize()};e.prototype.render=function(){var e=this;var o=function(){if(e.collapseState){return h("zonos-icon",{"aria-label":"Collapse expanded section",content:ChevronDownIcon,iconColor:"gray-1200"})}return h("zonos-icon",{"aria-label":"Expand collapsed section",content:ChevronUpIcon,iconColor:"gray-1200"})};return h(Host,{class:classes(["zonos--invoice-order-details zonos--elements",this.isMobile&&"mobile"])},h("div",{class:"zonos--wrapper"},h("button",{class:"zonos--order-details-header",onClick:function(){e.collapseState=!e.collapseState},type:"button"},h("div",{class:"zonos--order-details-header-text"},h("zonos-text",{type:"boldSubheader"},translate("Pay [organizationName]",{organizationName:zonosStore.organizationName})),o()),h("zonos-text",{type:"boldSubheader"},renderCheckoutCurrency({amount:invoiceStore.amountTotalDue||0,isForeign:true}))),h("div",{class:"zonos--order-details-wrapper"},h("zonos-collapse",{collapsed:this.collapseState},h("div",{class:"zonos--invoice-order-details-content"},h("zonos-invoice-cart-items",{isMobile:this.isMobile}),h("zonos-invoice-subtotal",{isMobile:this.isMobile}))))))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{collapsed:["handleCollapseChangeFromProp"],collapseState:["handleCollapseChange"]}},enumerable:false,configurable:true});return e}();ZonosInvoiceOrderDetails.style=ZonosInvoiceOrderDetailsStyle0;var CheckmarkLineIcon='<svg color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="var(--zonos-elements-gray-1000)" d="M15.342 10.21a.75.75 0 0 0-1.184-.92l-2.978 3.829-1.4-1.4a.75.75 0 1 0-1.06 1.061l1.8 1.8a1 1 0 0 0 1.496-.093l3.326-4.277Z"/><path fill="var(--zonos-elements-gray-1000)" fill-rule="evenodd" d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-6.5 8a6.5 6.5 0 1 1 13 0 6.5 6.5 0 0 1-13 0Z" clip-rule="evenodd"/></svg>';var RemoveLineIcon='<svg color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="var(--zonos-elements-gray-1000)" d="M14.475 10.586a.75.75 0 1 0-1.06-1.06L12 10.938l-1.414-1.414a.75.75 0 0 0-1.06 1.06L10.938 12l-1.414 1.414a.75.75 0 1 0 1.06 1.06L12 13.062l1.414 1.414a.75.75 0 0 0 1.06-1.06L13.062 12l1.414-1.414Z"/><path fill="var(--zonos-elements-gray-1000)" fill-rule="evenodd" d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-6.5 8a6.5 6.5 0 1 1 13 0 6.5 6.5 0 0 1-13 0Z" clip-rule="evenodd"/></svg>';var zonosInvoicePaymentCss=".sc-zonos-invoice-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-invoice-payment-h *.sc-zonos-invoice-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-invoice-payment-h img.sc-zonos-invoice-payment{max-width:100%}.sc-zonos-invoice-payment-h dl.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h dd.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h1.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h2.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h3.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h4.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h5.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h6.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h hr.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h figure.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h p.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h pre.sc-zonos-invoice-payment{margin:0}.sc-zonos-invoice-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-invoice-payment-h{overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:1;flex:1}.sc-zonos-invoice-payment-h .zonos--title.sc-zonos-invoice-payment{margin-bottom:24px}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment{margin-bottom:20px;overflow:auto;padding:5px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:1;flex:1;-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment::-webkit-scrollbar{width:10px}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-invoice-payment-h .zonos--payment-error-banner.sc-zonos-invoice-payment{margin-bottom:8px}.sc-zonos-invoice-payment-h .zonos--error-banner.sc-zonos-invoice-payment{margin-bottom:16px}.sc-zonos-invoice-payment-h zonos-button.sc-zonos-invoice-payment{-webkit-box-shadow:0 0 1px 0 var(--zonos-elements-gray-600);box-shadow:0 0 1px 0 var(--zonos-elements-gray-600)}.sc-zonos-invoice-payment-h .zonos--pay-in-base-currency-btn.sc-zonos-invoice-payment{-webkit-box-shadow:none;box-shadow:none}.sc-zonos-invoice-payment-h .zonos--group-btn.sc-zonos-invoice-payment{position:-webkit-sticky;position:sticky;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-direction:column;flex-direction:column;gap:12px;bottom:-4px;padding-top:12px;background:var(--zonos--primary-color, var(--zonos-elements-gray-0))}.sc-zonos-invoice-payment-h .zonos--group-btn.sc-zonos-invoice-payment zonos-text.sc-zonos-invoice-payment{text-align:center}.sc-zonos-invoice-payment-h .zonos--group-btn.sc-zonos-invoice-payment zonos-button.sc-zonos-invoice-payment{width:100%}.sc-zonos-invoice-payment-h .zonos--test-cards.sc-zonos-invoice-payment{margin-top:auto;padding-top:16px}";var ZonosInvoicePaymentStyle0=zonosInvoicePaymentCss;var ZonosInvoicePayment=function(){function e(e){var o=this;registerInstance(this,e);this.continueClicked=createEvent(this,"continueClicked",7);this.paypalSessionFailed=createEvent(this,"paypalSessionFailed",7);this.paypalSessionDone=createEvent(this,"paypalSessionDone",7);this.storeUnsubscribeList=[];this.continueLoading=false;this.showErrorBanner=false;this.hasStripePaymentError=false;this.stagingOrderCreateErrorMessage="";this.internalContinueLoading=this.continueLoading;this.handleValidate=function(){var e;return!!((e=stripeStore.stripePaymentEventData)===null||e===void 0?void 0:e.complete)};this.continueClickHandler=function(e){return __awaiter(o,[e],void 0,(function(e){var o,t;var n=this;var s=e.currencyCode;return __generator(this,(function(e){if(!this.handleValidate()){void((o=stripeStore.stripeBillingAddressElement)===null||o===void 0?void 0:o.getValue());this.showErrorBanner=true;void((t=stripeStore.stripeElements)===null||t===void 0?void 0:t.submit());setTimeout((function(){var e;(e=n.ele.querySelector("zonos-banner"))===null||e===void 0?void 0:e.scrollIntoView({behavior:"smooth"})}),10);return[2]}stripeStore.checkoutSettlementCurrency=s;submitGtag("zonos-checkout-payment-info");this.continueClicked.emit();return[2]}))}))};this.copyCardToClipboard=function(e){return __awaiter(o,void 0,void 0,(function(){var o,t;return __generator(this,(function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,navigator.clipboard.writeText(e)];case 1:n.sent();return[3,3];case 2:o=n.sent();t=document.createElement("textarea");t.style.position="fixed";t.style.left="-1000px";t.style.top="-1000px";t.style.width="1px";t.style.height="1px";t.value=e;t.id="zonos-copy-card-number";document.body.appendChild(t);t.select();document.execCommand("copy");document.body.removeChild(t);return[3,3];case 3:window.Zonos.showNotification({message:translate("Card number copied to clipboard"),timeout:4e3,type:"success"});return[2]}}))}))};this.placeTestOrder=function(){return __awaiter(o,void 0,void 0,(function(){var e;return __generator(this,(function(o){switch(o.label){case 0:this.internalContinueLoading=true;return[4,placeTestOrder()];case 1:e=o.sent().errors;if(e.length){this.stagingOrderCreateErrorMessage=e[0]||"Failed to create staging order. Please try again.";this.internalContinueLoading=false;return[2]}this.internalContinueLoading=false;cartStoreNextStep();return[2]}}))}))}}e.prototype.continueLoadingWatcher=function(){this.internalContinueLoading=this.continueLoading};e.prototype.stripePaymentErrorWatcher=function(){var e=this;if(this.hasStripePaymentError){setTimeout((function(){var o;(o=e.ele.querySelector("zonos-banner"))===null||o===void 0?void 0:o.scrollIntoView({behavior:"smooth"})}),50)}};e.prototype.componentWillLoad=function(){this.storeUnsubscribeList=[cartStoreOnChange("currency",(function(){void paypalInitScript({currency:cartStore.currency})}))];void paypalInitScript({currency:cartStore.currency})};e.prototype.disconnectedCallback=function(){this.storeUnsubscribeList.forEach((function(e){return e()}))};e.prototype.render=function(){var e=this;var o;this.hasStripePaymentError=stripeStore.hasPaymentError;if(!stripeStore.stripeElements){return null}if(!stripeStore.clientSecret){return null}if(this.showErrorBanner){this.showErrorBanner=!this.handleValidate()}var t=getIsTestMode();var n=cartStore.isStagingMode||getIsStagingMode();var s=((o=stripeStore.stripePaymentEventData)===null||o===void 0?void 0:o.value.type)==="external_paypal";var i=function(){if(n){var o=zonosStore.appearance.theme;return h(Fragment,null,e.stagingOrderCreateErrorMessage&&h("zonos-banner",{class:"zonos--error-banner",intent:"error"},e.stagingOrderCreateErrorMessage),h("zonos-empty-state-payment",{emptyStateText:translate("No payment method needed for staging"),theme:o}),h("div",{class:"zonos--group-btn"},h("zonos-button",{backgroundColor:e.submitBtnColor,loading:e.internalContinueLoading,onClick:function(){void e.placeTestOrder()},size:"lg",variant:e.submitBtnType},translate("Place test order"))))}if(stripeStore.isFetchingSession||invoiceStore.isFetchingPayorInfo){return null}return h(Fragment,null,e.showErrorBanner&&h("zonos-banner",{class:"zonos--error-banner",intent:"error"},translate("Missing required fields. Make sure all fields are completed.")),e.hasStripePaymentError&&h("zonos-banner",{class:"zonos--payment-error-banner",intent:"error"},stripeStore.customErrorMessage||translate("We couldn't complete your payment. Please verify the payment details and try again.")),paypalStore.paypalErrorMessage&&h("zonos-banner",{class:"zonos--payment-error-banner",intent:"error"},paypalStore.paypalErrorMessage),h("zonos-payment",null),h("div",{class:"zonos--group-btn"},!s&&h(Fragment,null,h("zonos-button",{backgroundColor:e.submitBtnColor,bold:true,isDisabled:e.continueLoading&&stripeStore.checkoutSettlementCurrency==="USD",loading:e.continueLoading&&stripeStore.checkoutSettlementCurrency!=="USD",onClick:function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(!cartStore.checkoutSession){log("Checkout session is not found");return[2]}return[4,this.continueClickHandler({currencyCode:cartStore.checkoutSession.subtotals.presentmentCurrencyCode})];case 1:e.sent();return[2]}}))}))},size:"lg",variant:e.submitBtnType},translate("Pay [orderTotal]",{orderTotal:renderCheckoutCurrency({amount:invoiceStore.amountTotalDue||0,isForeign:true})})),stripeStore.shouldRenderPayInUsdButton&&h("zonos-button",{class:"zonos--pay-in-base-currency-btn",isDisabled:e.continueLoading&&stripeStore.checkoutSettlementCurrency!=="USD",loading:e.continueLoading&&stripeStore.checkoutSettlementCurrency==="USD",onClick:function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.continueClickHandler({currencyCode:"USD"})];case 1:e.sent();return[2]}}))}))},size:"lg",variant:"subtle"},translate("Click to pay in USD"))),h("zonos-paypal-payment",{onPaypalSessionDone:function(o){var t=o.detail.orderId;e.paypalSessionDone.emit(t)},onPaypalSessionFail:function(){return e.paypalSessionFailed.emit()},style:{display:s?"block":"none"}})),t&&h("zonos-card",{backgroundColor:"gray-100",borderRadius:12,class:"zonos--test-cards"},h("zonos-v-stack",{spacing:16},h("div",null,h("zonos-text",{type:"semiBoldLabel"},translate("Test cards")),h("zonos-text",{textColor:"gray-700"},translate("Click to copy the card number. Use any future expiration date and three number CVC."))),h("zonos-button",{icon:h("zonos-icon",{content:CheckmarkLineIcon}),justifyContent:"flex-start",onClick:function(){return e.copyCardToClipboard("4242424242424242")}},translate("Success")," (****4242)"),h("zonos-button",{icon:h("zonos-icon",{content:RemoveLineIcon}),justifyContent:"flex-start",onClick:function(){return e.copyCardToClipboard("4000000000000002")}},translate("Failure")," (****0002)")),h("zonos-notification",null)))};return h(Host,{class:"zonos--checkout-payment zonos--elements"},h("div",{class:"zonos--group"},h("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},translate("Payment method")),i()))};Object.defineProperty(e.prototype,"ele",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{continueLoading:["continueLoadingWatcher"],hasStripePaymentError:["stripePaymentErrorWatcher"]}},enumerable:false,configurable:true});return e}();ZonosInvoicePayment.style=ZonosInvoicePaymentStyle0;var zonosInvoiceReviewCss=':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{position:-webkit-sticky;position:sticky;top:0;background-color:var(--zonos-elements-gray-0);z-index:1}:host .zonos--total-pay{margin:8px 0 24px;display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;gap:48px}:host .zonos--total-pay zonos-text{-ms-flex-negative:0;flex-shrink:0}:host .zonos--total-pay::after{content:"";position:relative;height:1px;width:100%;background:var(--zonos-elements-gray-200)}:host(.mobile),:host(.tablet){display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px;padding:4px 0;background-color:transparent;position:relative}:host(.mobile) .zonos--total-pay,:host(.tablet) .zonos--total-pay{margin:0}';var ZonosInvoiceReviewStyle0=zonosInvoiceReviewCss;var ZonosInvoiceReview=function(){function e(e){registerInstance(this,e);this.mobile=false;this.tablet=false;this.collapsed=false;this.isMobile=false;this.isTablet=false;this.isLoading=true}e.prototype.handleWindowResize=function(){this.isMobile=isInvoiceMobile(this.mobile);this.isTablet=isInvoiceTablet(this.tablet)};e.prototype.componentWillLoad=function(){var e=this;this.handleWindowResize();setTimeout((function(){e.isLoading=false}),1e3)};e.prototype.render=function(){var e=this.isMobile?"gray-1000":"gray-800";return h(Host,{key:"60da23c47f39a94478f1eb83e003b788aab3b98c",class:classes(["zonos--invoice-review zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"])},h("div",{key:"70bbb1973ec1c7197da666ba30be6dc6a20bd386",class:"zonos--title"},h("zonos-text",{key:"35ffffa411ccde7c702b5d5ac3f11d7a8d62916f",textColor:e,type:"semiBoldLabel"},translate("Pay [organizationName]",{organizationName:zonosStore.organizationName}))),h("div",{key:"c965e47314d1c3178b1dd2e54e835c0b91966a81",class:"zonos--total-pay"},renderFallback({content:h("zonos-text",{type:"secondaryPageHeader"},renderCheckoutCurrency({amount:invoiceStore.amountTotalDue||0,isForeign:true})),isLoading:invoiceStore.isFetchingPayorInfo,skeletonHeight:"36px",skeletonWidth:"150px"})))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return e}();ZonosInvoiceReview.style=ZonosInvoiceReviewStyle0;export{ZonosInvoiceFinish as zonos_invoice_finish,ZonosInvoiceFooter as zonos_invoice_footer,ZonosInvoiceOrderDetails as zonos_invoice_order_details,ZonosInvoicePayment as zonos_invoice_payment,ZonosInvoiceReview as zonos_invoice_review};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,o,t,n){function s(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,i){function r(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n["throw"](e))}catch(e){i(e)}}function c(e){e.done?t(e.value):s(e.value).then(r,a)}c((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,s,i,r;return r={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function a(e){return function(o){return c([e,o])}}function c(a){if(n)throw new TypeError("Generator is already executing.");while(r&&(r=0,a[0]&&(t=0)),t)try{if(n=1,s&&(i=a[0]&2?s["return"]:a[0]?s["throw"]||((i=s["return"])&&i.call(s),0):s.next)&&!(i=i.call(s,a[1])).done)return i;if(s=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;s=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1];i=a;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(a);break}if(i[2])t.ops.pop();t.trys.pop();continue}a=o.call(e,t)}catch(e){a=[6,e];s=0}finally{n=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,o,t){if(t||arguments.length===2)for(var n=0,s=o.length,i;n<s;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))};import{r as registerInstance,c as createEvent,h,F as Fragment,H as Host,a as getElement}from"./index-0bbe9693.js";import{b as stripeStore,c as stripeStoreRetrievePayment,t as trackConversionEvent,H as stripeStoreResetPromoCode,y as stripeStoreReset,I as stripeStoreMessageBasedOnStatus,d as cartStore,r as cartStoreNextStep,z as cartStoreOnChange}from"./cart-ba8f3890.js";import{c as paypalStoreReset,a as paypalStore,b as paypalInitScript}from"./paypal-8d8518c0.js";import{t as translate,s as storageStore,l as localizationStore}from"./localization-853b48a9.js";import{z as zonosStore}from"./zonosStore-b434e436.js";import{h as handleFetch,s as sendErrorLog,g as getIsTestMode,i as isCheckoutMobile,a as getIsStagingMode}from"./handleFetch-a844cac1.js";import{c as createCustomEvent}from"./createCustomEvent-58159025.js";import{g as getBorderRadius}from"./getBorderRadius-877f6389.js";import{l as log,b as allLogs}from"./VarianceTest-572cecf5.js";import{s as submitGtag}from"./submitGtag-89d6e9cb.js";import{i as isInvoiceMobile,a as isInvoiceTablet}from"./isInvoiceMobileTablet-1f7b614e.js";import{c as classes}from"./classes-0d95c529.js";import{l as languages}from"./ILanguage-cd6acb72.js";import{c as invoiceStore}from"./invoice-055bb6e5.js";import{r as renderCheckoutCurrency}from"./renderCheckoutCurrency-bd059ecf.js";import{p as placeTestOrder}from"./placeTestOrder-0a74923e.js";import{r as renderFallback}from"./renderFallback-3f010b48.js";import"./isDarkColor-9ddd90cc.js";import"./isContrastColor-69778cea.js";var RemoveIcon='<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-200)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var SuccessIcon='<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-100)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M15.707 9.293a1 1 0 0 1 0 1.414l-3.646 3.647a1.5 1.5 0 0 1-2.122 0l-1.646-1.647a1 1 0 1 1 1.414-1.414L11 12.586l3.293-3.293a1 1 0 0 1 1.414 0Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var zonosInvoiceFinishCss=":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{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;height:100%}:host .zonos--group{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;margin-bottom:24px;border-radius:var(--zonos--border-radius, 10px);gap:24px;margin-top:24px;background-color:var(--zonos-elements-gray-50);padding:48px}:host .zonos--finish-details{max-width:640px;min-width:300px;line-height:24px;width:0 auto;margin:auto}:host zonos-button{width:100%}:host .loading-wrapper{min-height:300px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host .zonos--finish-button-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;gap:16px;margin:0 auto;margin-top:48px;max-width:300px}:host .zonos--button-container{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;gap:16px;margin:0 auto}:host .zonos--subtitle{text-align:center}:host .zonos--order-number{background-color:var(--zonos-elements-gray-0);border:1px solid var(--zonos-elements-gray-200);color:var(--zonos-elements-gray-800);border-radius:var(--zonos-elements-radius-6);padding:4px 8px}";var ZonosInvoiceFinishStyle0=zonosInvoiceFinishCss;var MAX_RETRIES=30;var ZonosInvoiceFinish=function(){function e(e){var o=this;registerInstance(this,e);this.closeClick=createEvent(this,"closeClick",7);this.borderRadius="ROUNDED";this.confirmationId=null;this.isLoading=true;this.notificationType="success";this.notificationTitle="";this.notificationMessages=[];this.notificationActionText=translate("Keep shopping");this.order=null;this.isWaitingToRedirect=true;this.pullOrder=function(){return __awaiter(o,void 0,void 0,(function(){var e,o,t,n,s,i,r,a;return __generator(this,(function(c){switch(c.label){case 0:t=storageStore.checkoutSessionId;n=new URLSearchParams;n.set("checkoutSessionId",t||"");return[4,handleFetch("/api/zonos-elements/get-order?".concat(n.toString()))];case 1:s=c.sent(),i=s.baseUrl,r=s.errors,a=s.json;if(r.length||!(a===null||a===void 0?void 0:a.id)){return[2,{baseUrl:i,order:null}]}return[4,(o=(e=zonosStore.checkoutSettings).onOrderSuccess)===null||o===void 0?void 0:o.call(e,{zonosApiRoute:i,zonosOrder:a})];case 2:c.sent();return[2,{baseUrl:i,order:a}]}}))}))};this.handleSuccessBehavior=function(){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:this.isLoading=false;return[4,this.getPullOrder()];case 1:e.sent();return[2]}}))}))};this.getPullOrder=function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return __awaiter(o,__spreadArray([],e,true),void 0,(function(e){var o,t,n,s,i,r,a,c;if(e===void 0){e=0}return __generator(this,(function(l){switch(l.label){case 0:if(e===0){log("=== Start to poll for order info","info")}return[4,this.pullOrder()];case 1:n=l.sent(),s=n.baseUrl,i=n.order;r=!!((t=(o=i===null||i===void 0?void 0:i.references)===null||o===void 0?void 0:o.find((function(e){return(e===null||e===void 0?void 0:e.key)==="zonosOrderNumber"})))===null||t===void 0?void 0:t.value);a=storageStore.checkoutSessionId;c=parseFloat(new URLSearchParams(window.location.search).get("maxPollingRetries")||"0")||MAX_RETRIES;log("=== Polling order (".concat(e," attemps)"),"info");if(!i)return[3,2];log("=== InvoiceOrder info found","info");if(e>10){void sendErrorLog({endpoint:"".concat(s,"/api/zonos-elements/get-order?checkoutSessionId=").concat(a,"&orderId=").concat(i.id),errors:["Invoice order found after ".concat(e," attempts")],metadata:{allLogs:allLogs,checkoutSessionId:storageStore.checkoutSessionId||"",orderId:i.id,storeId:zonosStore.storeId}})}this.order=i;return[3,6];case 2:if(!((!i||!r)&&e<c))return[3,5];return[4,new Promise((function(e){return setTimeout(e,1e3)}))];case 3:l.sent();return[4,this.getPullOrder(e+1)];case 4:l.sent();return[3,6];case 5:void sendErrorLog({endpoint:"".concat(s,"/api/zonos-elements/get-order?checkoutSessionId=").concat(a),errors:["Invoice order not found after ".concat(c," attempts")],metadata:{allLogs:allLogs,checkoutSessionId:storageStore.checkoutSessionId||"",storeId:zonosStore.storeId}});l.label=6;case 6:return[2]}}))}))};this.checkStripePaymentStatus=function(){return __awaiter(o,void 0,void 0,(function(){var e,o,t,n,s,i,r,a,c;return __generator(this,(function(l){switch(l.label){case 0:e=new URLSearchParams(window.location.search).get("payment_intent_client_secret")||stripeStore.clientSecret;if(!(e||this.storybookForceStatus))return[3,4];return[4,stripeStoreRetrievePayment({clientSecret:e,storybookForceStatus:this.storybookForceStatus})];case 1:o=l.sent(),t=o.error,n=o.messages,s=o.status;i=s==="requires_action"||t;this.notificationType=i?"error":"success";this.notificationMessages=n||[];this.notificationTitle=i?translate("Payment failed"):translate("You're all set!");log("=== Payment intent retrieve status","info",{clientSecret:e,error:t,messages:n,status:s});r=new URL(window.location.href);r.searchParams.delete("payment_intent_client_secret");r.searchParams.delete("payment_intent");r.searchParams.delete("redirect_status");r.searchParams.delete("zonosCheckoutSessionId");window.history.replaceState({},"",r.toString());if(!(t&&(n===null||n===void 0?void 0:n.length)))return[3,2];submitGtag({event:"zonos-checkout-payment-fail"});void sendErrorLog({endpoint:"Stripe payment failed",errors:['Payment intent "'.concat(e.split("_secret_")[0]||e,'" status: ').concat(s," - checkout session: ").concat(storageStore.checkoutSessionId)],metadata:{allLogs:allLogs,credentialToken:window.Zonos.zonosApiKey}});return[3,4];case 2:submitGtag({event:"zonos-checkout-success"});a=storageStore.checkoutSessionId;void trackConversionEvent({checkoutSessionId:a,eventName:"checkout_orderCompleted"});c=createCustomEvent("zonos-checkout-success",{message:"Zonos Checkout successfully processed order"});document.dispatchEvent(c);return[4,this.handleSuccessBehavior()];case 3:l.sent();l.label=4;case 4:this.isLoading=false;stripeStoreResetPromoCode();stripeStoreReset();storageStore.checkoutSessionId=null;return[2]}}))}))};this.checkStagingOrderStatus=function(){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:this.notificationType="success";this.notificationTitle=translate("You're all set!");this.notificationMessages=stripeStoreMessageBasedOnStatus("succeeded").messages;return[4,this.handleSuccessBehavior()];case 1:e.sent();stripeStoreResetPromoCode();stripeStoreReset();paypalStoreReset();storageStore.checkoutSessionId=null;return[2]}}))}))};this.checkPaypalPaymentStatus=function(){return __awaiter(o,void 0,void 0,(function(){var e;return __generator(this,(function(o){switch(o.label){case 0:if(paypalStore.paypalErrorMessage){this.notificationType="error";this.notificationTitle=translate("Payment failed");this.notificationMessages=[paypalStore.paypalErrorMessage];this.isLoading=false;return[2]}this.isLoading=false;if(!paypalStore.orderIdCreated)return[3,2];submitGtag({event:"zonos-checkout-success"});e=storageStore.checkoutSessionId;void trackConversionEvent({checkoutSessionId:e,eventName:"checkout_orderCompleted"});this.notificationType="success";this.notificationTitle=translate("You're all set!");this.notificationMessages=stripeStoreMessageBasedOnStatus("succeeded").messages;return[4,this.handleSuccessBehavior()];case 1:o.sent();o.label=2;case 2:stripeStoreResetPromoCode();stripeStoreReset();paypalStoreReset();storageStore.checkoutSessionId=null;return[2]}}))}))};this.getReceiptUrl=function(e){var o=e.cartId;var t=new URL("".concat(window.location.origin,"/receipt"));t.searchParams.set("referenceId",o);var n=getIsTestMode();if(n){t.searchParams.set("zonosTestMode","1")}var s=new URLSearchParams(window.location.search).get("zonosQaUrl");if(s){t.searchParams.set("zonosQaUrl",s)}return t.toString()}}e.prototype.componentDidLoad=function(){if(this.overrideNotification){this.notificationType=this.overrideNotification.type;this.notificationTitle=this.overrideNotification.title;this.notificationMessages=this.overrideNotification.messages;this.isLoading=false;return}if(cartStore.isStagingMode){void this.checkStagingOrderStatus()}else if(paypalStore.orderIdCreated){void this.checkPaypalPaymentStatus()}else{void this.checkStripePaymentStatus()}};e.prototype.render=function(){var e=this;var o=window.Zonos.cartId;return h(Host,{key:"5d2fc87bc549fa2cb6d622e664043bbfe55f8b0e",class:"zonos--checkout-finish zonos--elements",style:{"--zonos--border-radius":getBorderRadius({overrideBorderStyle:this.borderRadius})}},!this.isLoading&&h("div",{key:"1268de9e5be1edc4cbe2e7e2f1d2590b168d8c7b",class:"zonos--finish-details"},h("div",{key:"ce63ee565c176ea5687fc1c0f721932e26b93ebd",class:"zonos--group"},this.notificationType==="success"?h("zonos-icon",{"aria-label":"Order success",content:SuccessIcon,iconColor:"blue-800",size:50}):h("zonos-icon",{"aria-label":"Order failed",content:RemoveIcon,iconColor:"red-800",size:50}),h("zonos-text",{key:"a073858eac699426dc5947b85d3b3665868f164e",class:"zonos--title",type:"semiBoldSubheader"},this.notificationTitle),this.confirmationId&&h("zonos-badge",{key:"a96c40f5cc977de82585f7827d6bc6aef55ba873",badgeColor:"gray"},this.confirmationId),h("zonos-text",{key:"d97bc54085b9fe69eb05b44042deae25c379ee3a",class:"zonos--subtitle",textColor:"gray-600"},this.notificationMessages.map((function(e){return h(Fragment,null,e,h("br",null))}))),this.order&&o&&h("div",{key:"488c3442e40fedf65caedbd3e098bd8b95976aab",class:"zonos--button-container"},h("zonos-button",{key:"9a01b9cca0e3747548d386345015ecea80dc29d3",onClick:function(){window.open(e.getReceiptUrl({cartId:o}),"_blank")},size:"lg",variant:"primary"},translate("View receipt"))))))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return e}();ZonosInvoiceFinish.style=ZonosInvoiceFinishStyle0;var Globe='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12ZM11.4709 5.80634C11.7686 5.53723 11.9541 5.5 12 5.5C12.0459 5.5 12.2314 5.53723 12.5291 5.80634C12.8115 6.06164 13.1289 6.46913 13.4271 7.03651C13.9505 8.03191 14.3838 9.46098 14.48 11.25H9.51996C9.61624 9.46098 10.0495 8.03191 10.5729 7.03651C10.8711 6.46913 11.1885 6.06164 11.4709 5.80634ZM8.01802 11.25C8.11591 9.23031 8.60319 7.55958 9.24516 6.33849C9.29983 6.23451 9.35585 6.13335 9.41312 6.03514C7.32916 6.94017 5.81218 8.90533 5.5428 11.25H8.01802ZM5.5428 12.75H8.01802C8.11591 14.7697 8.60319 16.4404 9.24516 17.6615C9.29983 17.7655 9.35585 17.8666 9.41312 17.9649C7.32916 17.0598 5.81218 15.0947 5.5428 12.75ZM9.51996 12.75H14.48C14.3838 14.539 13.9505 15.9681 13.4271 16.9635C13.1289 17.5309 12.8115 17.9384 12.5291 18.1937C12.2314 18.4628 12.0459 18.5 12 18.5C11.9541 18.5 11.7686 18.4628 11.4709 18.1937C11.1885 17.9384 10.8711 17.5309 10.5729 16.9635C10.0495 15.9681 9.61624 14.539 9.51996 12.75ZM15.982 12.75C15.8841 14.7697 15.3968 16.4404 14.7548 17.6615C14.7002 17.7655 14.6441 17.8666 14.5869 17.9649C16.6708 17.0598 18.1878 15.0947 18.4572 12.75H15.982ZM18.4572 11.25C18.1878 8.90533 16.6708 6.94017 14.5869 6.03514C14.6441 6.13335 14.7002 6.23451 14.7548 6.33849C15.3968 7.55958 15.8841 9.23031 15.982 11.25H18.4572Z" fill="currentColor"/>\n</svg>\n';var ZonosWordmark='<svg width="43" height="10" viewBox="0 0 43 10" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.35896 0.0640869H0.30768C0.166068 0.0640869 0.0512695 0.178886 0.0512695 0.320497V1.85896C0.0512695 2.00057 0.166068 2.11537 0.30768 2.11537H4.44439C4.54964 2.11537 4.61005 2.2352 4.54745 2.31982L0.151823 8.2615C0.0865163 8.34978 0.0512695 8.45669 0.0512695 8.56649V9.67947C0.0512695 9.82108 0.166068 9.93588 0.30768 9.93588H7.35896C7.50057 9.93588 7.61537 9.82108 7.61537 9.67947V8.14101C7.61537 7.9994 7.50057 7.8846 7.35896 7.8846H3.22226C3.117 7.8846 3.05659 7.76477 3.11919 7.68015L7.51482 1.73847C7.58013 1.65019 7.61537 1.54328 7.61537 1.43348V0.320497C7.61537 0.178886 7.50057 0.0640869 7.35896 0.0640869Z" fill="var(--zonos-elements-gray-800)"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M11.718 0C10.1602 0 8.89746 1.26279 8.89746 2.82051V7.17949C8.89746 8.73721 10.1602 10 11.718 10H13.6411C15.1988 10 16.4616 8.73721 16.4616 7.17949V2.82051C16.4616 1.26279 15.1988 0 13.6411 0H11.718ZM11.718 2.05128C11.2931 2.05128 10.9487 2.39568 10.9487 2.82051V7.17949C10.9487 7.60432 11.2931 7.94872 11.718 7.94872H13.6411C14.0659 7.94872 14.4103 7.60432 14.4103 7.17949V5V2.82051C14.4103 2.39568 14.0659 2.05128 13.6411 2.05128H11.718Z" fill="var(--zonos-elements-gray-800)"/>\n<path d="M17.7437 0.436316V9.71132C17.7437 9.85293 17.8585 9.96773 18.0001 9.96773H19.5385C19.6801 9.96773 19.7949 9.85293 19.7949 9.71132V3.74801C19.7949 3.44829 19.969 3.17587 20.241 3.04996L22.1641 2.15964C22.6739 1.92363 23.2565 2.29592 23.2565 2.85769V9.71132C23.2565 9.85293 23.3713 9.96773 23.5129 9.96773H25.0513C25.193 9.96773 25.3078 9.85293 25.3078 9.71132V2.85595C25.3078 0.79631 23.1718 -0.568775 21.3027 0.296257L19.9742 0.911055C19.8685 0.959946 19.7432 0.931536 19.669 0.84187L19.2748 0.365697C19.1773 0.248019 19.0325 0.179905 18.8797 0.179905H18.0001C17.8585 0.179905 17.7437 0.294704 17.7437 0.436316Z" fill="var(--zonos-elements-gray-800)"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M29.4104 0C27.8526 0 26.5898 1.26279 26.5898 2.82051V7.17949C26.5898 8.73721 27.8526 10 29.4104 10H31.3334C32.8912 10 34.1539 8.73721 34.1539 7.17949V2.82051C34.1539 1.26279 32.8912 0 31.3334 0H29.4104ZM29.4104 2.05128C28.9855 2.05128 28.6411 2.39568 28.6411 2.82051V7.17949C28.6411 7.60432 28.9855 7.94872 29.4104 7.94872H31.3334C31.7583 7.94872 32.1027 7.60432 32.1027 7.17949V2.82051C32.1027 2.39568 31.7583 2.05128 31.3334 2.05128H29.4104Z" fill="var(--zonos-elements-gray-800)"/>\n<path d="M38.2085 0.0640869H40.3889C41.8309 0.0640869 42.9999 1.23306 42.9999 2.67506C42.9999 2.79477 42.9108 2.89574 42.792 2.91059L41.1732 3.11293C41.054 3.12784 40.9486 3.03485 40.9486 2.91466C40.9486 2.47322 40.5908 2.11537 40.1493 2.11537H38.3397C37.8688 2.11537 37.4871 2.49712 37.4871 2.96803C37.4871 3.3685 37.7658 3.71501 38.1569 3.80087L40.7916 4.37922C42.0811 4.66229 42.9999 5.80462 42.9999 7.12486C42.9999 8.67735 41.7414 9.93588 40.1889 9.93588H38.0468C36.6048 9.93588 35.4358 8.76691 35.4358 7.32491C35.4358 7.2052 35.5249 7.10423 35.6437 7.08938L37.2625 6.88703C37.3817 6.87213 37.4871 6.96512 37.4871 7.08531C37.4871 7.52675 37.8449 7.8846 38.2864 7.8846H40.1176C40.5765 7.8846 40.9486 7.51252 40.9486 7.05354C40.9486 6.67478 40.6925 6.34394 40.3258 6.24901L37.5136 5.52093C36.2902 5.20422 35.4358 4.10042 35.4358 2.83676C35.4358 1.30545 36.6772 0.0640869 38.2085 0.0640869Z" fill="var(--zonos-elements-gray-700)"/>\n</svg>\n';var zonosInvoiceFooterCss=":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{position:absolute;bottom:0;left:32px;right:32px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;z-index:2}:host .zonos--invoice-footer{gap:16px;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;padding:12px;padding-left:0;-ms-flex-align:center;align-items:center;width:100%}:host .zonos--invoice-footer .zonos--invoice-footer-icon-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:16px}:host .zonos--invoice-footer .zonos--invoice-footer-icon-wrapper .zonos--invoice-footer-logo{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-align:center;align-items:center}:host .zonos--invoice-footer .zonos--invoice-footer-icon-wrapper .zonos--invoice-footer-logo a{line-height:0}:host .zonos--invoice-footer .zonos--invoice-footer-icon-wrapper a{text-decoration:none}:host .zonos--invoice-footer zonos-button button.outline{outline:1px solid var(--zonos-elements-gray-800)}:host .zonos--invoice-footer .zonos--invoice-locale-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:8px;position:relative}@media (max-width: 400px){:host .zonos--invoice-footer .zonos--invoice-locale-wrapper{gap:4px}}:host .zonos--invoice-footer .zonos--invoice-language-dialog{position:absolute;bottom:36px;left:var(--language-dialog-left);background:var(--zonos-elements-surface-color);-webkit-box-shadow:var(--zonos-elements-v3-shadow-xl);box-shadow:var(--zonos-elements-v3-shadow-xl);border-radius:var(--zonos-elements-radius-12);width:360px;max-width:100vw;max-height:500px;z-index:2147483011;overflow:auto;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:bottom left;transform-origin:bottom left;opacity:0;-webkit-transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar{width:10px}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar-track{border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}:host .zonos--invoice-footer .zonos--invoice-language-dialog.zonos--invoice-language-dialog-open{opacity:1;-webkit-transform:scale(1);transform:scale(1)}:host .dot{display:-ms-inline-flexbox;display:inline-flex;background:var(--zonos-elements-gray-400);width:6px;height:6px;border-radius:50%}:host(.mobile),:host(.tablet){background-color:var(--zonos-elements-gray-0);width:100%;position:-webkit-sticky;position:sticky;bottom:0}:host(.tablet) .zonos--invoice-footer{width:100%;max-width:800px;-ms-flex-pack:justify;justify-content:space-between;display:-ms-flexbox;display:flex}:host(.mobile){-ms-flex-order:3;order:3}:host(.mobile) .zonos--invoice-locale-wrapper{display:none}:host(.mobile) .zonos--invoice-footer{-ms-flex-pack:center;justify-content:center}";var ZonosInvoiceFooterStyle0=zonosInvoiceFooterCss;var ZonosInvoiceFooter=function(){function e(e){registerInstance(this,e);this.mobile=false;this.tablet=false;this.showLanguageDialog=false;this.isMobile=false;this.isTablet=false}e.prototype.handleGlobalClick=function(e){if(!this.el.contains(e.target)&&this.showLanguageDialog){this.showLanguageDialog=false}};e.prototype.toggleLanguageDialog=function(){this.showLanguageDialog=!this.showLanguageDialog};e.prototype.handleMobileChange=function(){this.isMobile=isInvoiceMobile(this.mobile)};e.prototype.handleTabletChange=function(){this.isTablet=isInvoiceTablet(this.tablet)};e.prototype.componentWillLoad=function(){this.isMobile=isInvoiceMobile(this.mobile);this.isTablet=isInvoiceTablet(this.tablet)};e.prototype.render=function(){var e=this;var o;var t=(o=languages.find((function(e){return e.code===localizationStore.selectedLocale})))===null||o===void 0?void 0:o.label;var n="gray-1000";return h(Host,{key:"c84163fd8ab0bc0f2c791028b6896379a4ae6a27",class:classes(["zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"])},h("div",{key:"099a3be332fa52c5e7551bdd2a618041c4a6eb22",class:"zonos--invoice-footer"},h("div",{key:"ab727f45f3a67bcdd51eb29b392462f15eb5fedd",class:"zonos--invoice-locale-wrapper"},h("zonos-button",{key:"3d8431c78d54e0fe630677d0dd4ae2c975a208fa",buttonColor:n,class:"zonos--invoice-footer-language-button",icon:h("zonos-icon",{"aria-label":"Language select",content:Globe,iconColor:n}),onClick:function(){return e.toggleLanguageDialog()},variant:"subtle"},t),h("div",{key:"2920b4105b6209c4177fc91651dc5d9397d6abf2",class:classes(["zonos--invoice-language-dialog",this.showLanguageDialog&&"zonos--invoice-language-dialog-open"])},h("zonos-language-select",{key:"705e1a4243dc7ebc73c522a82f93c3d833240a95",handleOnClose:function(){return e.toggleLanguageDialog()}}))),h("div",{key:"49c2d0ae1f587079b48f12d62d10eb422991255e",class:"zonos--invoice-footer-icon-wrapper"},h("div",{key:"58a4da788527ddf4abd759b5e305e747aa96d540",class:"zonos--invoice-footer-logo"},h("zonos-text",{key:"45bf1af64ec0f0a2e11e8d23361b71f4b4189881",textColor:n},translate("Powered by")),h("a",{key:"1dd7224f3e126bcabe60a42c9529ab65c64f0063",href:"https://zonos.com",target:"_blank",title:"Zonos website"},h("zonos-icon",{key:"7dc21ce09b72bf37efd30e2c17b6d8b9328e8c3d",autoHeight:true,content:ZonosWordmark,size:42}))),h("div",{key:"a0d053e6745733cd61868c109628a1835f4fe3ed",class:"dot"}),h("a",{key:"fd467e88aa2ed10b707f88ed0d1a5af80af35539",href:"https://zonos.com/docs/legal/zonos-privacy-policy",target:"_blank"},h("zonos-text",{key:"35db684368ff8abc05c2c7fab22500270b0b7e21",textColor:n},translate("Privacy policy"))))))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{mobile:["handleMobileChange"],tablet:["handleTabletChange"]}},enumerable:false,configurable:true});return e}();ZonosInvoiceFooter.style=ZonosInvoiceFooterStyle0;var ChevronDownIcon='<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var ChevronUpIcon='<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M17.707 14.707a1 1 0 0 1-1.414 0L12 10.414l-4.293 4.293a1 1 0 0 1-1.414-1.414l4.93-4.93a1.1 1.1 0 0 1 1.555 0l4.93 4.93a1 1 0 0 1 0 1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var zonosInvoiceOrderDetailsCss=":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{height:100%}:host *{-ms-scroll-chaining:none;overscroll-behavior:contain}:host *::-webkit-scrollbar{width:10px}:host *::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host *::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host *::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--order-details-header-text{display:-ms-flexbox;display:flex}:host .zonos--wrapper{overflow:auto;background-color:var(--zonos-elements-gray-50);border-radius:16px;height:100%;min-height:56px}:host .zonos--order-details-header-text{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:8px}:host .zonos--order-details-header{position:-webkit-sticky;position:sticky;top:0;z-index:1;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--zonos-elements-gray-50);border:none;display:-ms-flexbox;display:flex;padding:16px 16px 0 16px;width:100%;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center}:host .zonos--order-details-header:focus-visible{outline:none}:host .zonos--order-details-wrapper{position:relative;padding:0 16px 16px 16px}:host .zonos--invoice-order-details-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:16px}:host .zonos--invoice-order-info{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:32px}:host .zonos--invoice-order-info .zonos--invoice-order-details-row{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:16px}:host .zonos--invoice-order-info .zonos--invoice-order-details-row>*{-ms-flex:1 1 150px;flex:1 1 150px}:host .zonos--invoice-order-info .zonos--invoice-order-details-column{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px}:host .zonos--invoice-order-info .zonos--invoice-order-shipping-info{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:0}";var ZonosInvoiceOrderDetailsStyle0=zonosInvoiceOrderDetailsCss;var ZonosInvoiceOrderDetails=function(){function e(e){registerInstance(this,e);this.collapseClicked=createEvent(this,"collapseClicked",7);this.mobile=true;this.landedCostId="";this.isMobile=false;this.collapseState=this.collapsed}e.prototype.handleCollapseChangeFromProp=function(e){this.collapseState=e};e.prototype.handleCollapseChange=function(e){this.collapseClicked.emit(e)};e.prototype.handleWindowResize=function(){this.isMobile=isCheckoutMobile(this.mobile)};e.prototype.componentWillLoad=function(){this.handleWindowResize()};e.prototype.render=function(){var e=this;var o=function(){if(e.collapseState){return h("zonos-icon",{"aria-label":"Collapse expanded section",content:ChevronDownIcon,iconColor:"gray-1200"})}return h("zonos-icon",{"aria-label":"Expand collapsed section",content:ChevronUpIcon,iconColor:"gray-1200"})};return h(Host,{class:classes(["zonos--invoice-order-details zonos--elements",this.isMobile&&"mobile"])},h("div",{class:"zonos--wrapper"},h("button",{class:"zonos--order-details-header",onClick:function(){e.collapseState=!e.collapseState},type:"button"},h("div",{class:"zonos--order-details-header-text"},h("zonos-text",{type:"boldSubheader"},translate("Pay [organizationName]",{organizationName:zonosStore.organizationName})),o()),h("zonos-text",{type:"boldSubheader"},renderCheckoutCurrency({amount:invoiceStore.amountTotalDue||0,isForeign:true}))),h("div",{class:"zonos--order-details-wrapper"},h("zonos-collapse",{collapsed:this.collapseState},h("div",{class:"zonos--invoice-order-details-content"},h("zonos-invoice-cart-items",{isMobile:this.isMobile}),h("zonos-invoice-subtotal",{isMobile:this.isMobile}))))))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{collapsed:["handleCollapseChangeFromProp"],collapseState:["handleCollapseChange"]}},enumerable:false,configurable:true});return e}();ZonosInvoiceOrderDetails.style=ZonosInvoiceOrderDetailsStyle0;var CheckmarkLineIcon='<svg color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="var(--zonos-elements-gray-1000)" d="M15.342 10.21a.75.75 0 0 0-1.184-.92l-2.978 3.829-1.4-1.4a.75.75 0 1 0-1.06 1.061l1.8 1.8a1 1 0 0 0 1.496-.093l3.326-4.277Z"/><path fill="var(--zonos-elements-gray-1000)" fill-rule="evenodd" d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-6.5 8a6.5 6.5 0 1 1 13 0 6.5 6.5 0 0 1-13 0Z" clip-rule="evenodd"/></svg>';var RemoveLineIcon='<svg color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="var(--zonos-elements-gray-1000)" d="M14.475 10.586a.75.75 0 1 0-1.06-1.06L12 10.938l-1.414-1.414a.75.75 0 0 0-1.06 1.06L10.938 12l-1.414 1.414a.75.75 0 1 0 1.06 1.06L12 13.062l1.414 1.414a.75.75 0 0 0 1.06-1.06L13.062 12l1.414-1.414Z"/><path fill="var(--zonos-elements-gray-1000)" fill-rule="evenodd" d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-6.5 8a6.5 6.5 0 1 1 13 0 6.5 6.5 0 0 1-13 0Z" clip-rule="evenodd"/></svg>';var zonosInvoicePaymentCss=".sc-zonos-invoice-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-invoice-payment-h *.sc-zonos-invoice-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-invoice-payment-h img.sc-zonos-invoice-payment{max-width:100%}.sc-zonos-invoice-payment-h dl.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h dd.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h1.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h2.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h3.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h4.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h5.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h6.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h hr.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h figure.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h p.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h pre.sc-zonos-invoice-payment{margin:0}.sc-zonos-invoice-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-invoice-payment-h{overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:1;flex:1}.sc-zonos-invoice-payment-h .zonos--title.sc-zonos-invoice-payment{margin-bottom:24px}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment{margin-bottom:20px;overflow:auto;padding:5px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:1;flex:1;-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment::-webkit-scrollbar{width:10px}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-invoice-payment-h .zonos--payment-error-banner.sc-zonos-invoice-payment{margin-bottom:8px}.sc-zonos-invoice-payment-h .zonos--error-banner.sc-zonos-invoice-payment{margin-bottom:16px}.sc-zonos-invoice-payment-h zonos-button.sc-zonos-invoice-payment{-webkit-box-shadow:0 0 1px 0 var(--zonos-elements-gray-600);box-shadow:0 0 1px 0 var(--zonos-elements-gray-600)}.sc-zonos-invoice-payment-h .zonos--pay-in-base-currency-btn.sc-zonos-invoice-payment{-webkit-box-shadow:none;box-shadow:none}.sc-zonos-invoice-payment-h .zonos--group-btn.sc-zonos-invoice-payment{position:-webkit-sticky;position:sticky;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-direction:column;flex-direction:column;gap:12px;bottom:-4px;padding-top:12px;background:var(--zonos--primary-color, var(--zonos-elements-gray-0))}.sc-zonos-invoice-payment-h .zonos--group-btn.sc-zonos-invoice-payment zonos-text.sc-zonos-invoice-payment{text-align:center}.sc-zonos-invoice-payment-h .zonos--group-btn.sc-zonos-invoice-payment zonos-button.sc-zonos-invoice-payment{width:100%}.sc-zonos-invoice-payment-h .zonos--test-cards.sc-zonos-invoice-payment{margin-top:auto;padding-top:16px}";var ZonosInvoicePaymentStyle0=zonosInvoicePaymentCss;var ZonosInvoicePayment=function(){function e(e){var o=this;registerInstance(this,e);this.continueClicked=createEvent(this,"continueClicked",7);this.paypalSessionFailed=createEvent(this,"paypalSessionFailed",7);this.paypalSessionDone=createEvent(this,"paypalSessionDone",7);this.storeUnsubscribeList=[];this.continueLoading=false;this.showErrorBanner=false;this.hasStripePaymentError=false;this.stagingOrderCreateErrorMessage="";this.internalContinueLoading=this.continueLoading;this.handleValidate=function(){var e;return!!((e=stripeStore.stripePaymentEventData)===null||e===void 0?void 0:e.complete)};this.continueClickHandler=function(e){return __awaiter(o,[e],void 0,(function(e){var o,t;var n=this;var s=e.currencyCode;return __generator(this,(function(e){if(!this.handleValidate()){void((o=stripeStore.stripeBillingAddressElement)===null||o===void 0?void 0:o.getValue());this.showErrorBanner=true;void((t=stripeStore.stripeElements)===null||t===void 0?void 0:t.submit());setTimeout((function(){var e;(e=n.ele.querySelector("zonos-banner"))===null||e===void 0?void 0:e.scrollIntoView({behavior:"smooth"})}),10);return[2]}stripeStore.checkoutSettlementCurrency=s;submitGtag({event:"zonos-checkout-payment-info"});this.continueClicked.emit();return[2]}))}))};this.copyCardToClipboard=function(e){return __awaiter(o,void 0,void 0,(function(){var o,t;return __generator(this,(function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,navigator.clipboard.writeText(e)];case 1:n.sent();return[3,3];case 2:o=n.sent();t=document.createElement("textarea");t.style.position="fixed";t.style.left="-1000px";t.style.top="-1000px";t.style.width="1px";t.style.height="1px";t.value=e;t.id="zonos-copy-card-number";document.body.appendChild(t);t.select();document.execCommand("copy");document.body.removeChild(t);return[3,3];case 3:window.Zonos.showNotification({message:translate("Card number copied to clipboard"),timeout:4e3,type:"success"});return[2]}}))}))};this.placeTestOrder=function(){return __awaiter(o,void 0,void 0,(function(){var e;return __generator(this,(function(o){switch(o.label){case 0:this.internalContinueLoading=true;return[4,placeTestOrder()];case 1:e=o.sent().errors;if(e.length){this.stagingOrderCreateErrorMessage=e[0]||"Failed to create staging order. Please try again.";this.internalContinueLoading=false;return[2]}this.internalContinueLoading=false;cartStoreNextStep();return[2]}}))}))}}e.prototype.continueLoadingWatcher=function(){this.internalContinueLoading=this.continueLoading};e.prototype.stripePaymentErrorWatcher=function(){var e=this;if(this.hasStripePaymentError){setTimeout((function(){var o;(o=e.ele.querySelector("zonos-banner"))===null||o===void 0?void 0:o.scrollIntoView({behavior:"smooth"})}),50)}};e.prototype.componentWillLoad=function(){this.storeUnsubscribeList=[cartStoreOnChange("currency",(function(){void paypalInitScript({currency:cartStore.currency})}))];void paypalInitScript({currency:cartStore.currency})};e.prototype.disconnectedCallback=function(){this.storeUnsubscribeList.forEach((function(e){return e()}))};e.prototype.render=function(){var e=this;var o;this.hasStripePaymentError=stripeStore.hasPaymentError;if(!stripeStore.stripeElements){return null}if(!stripeStore.clientSecret){return null}if(this.showErrorBanner){this.showErrorBanner=!this.handleValidate()}var t=getIsTestMode();var n=cartStore.isStagingMode||getIsStagingMode();var s=((o=stripeStore.stripePaymentEventData)===null||o===void 0?void 0:o.value.type)==="external_paypal";var i=function(){if(n){var o=zonosStore.appearance.theme;return h(Fragment,null,e.stagingOrderCreateErrorMessage&&h("zonos-banner",{class:"zonos--error-banner",intent:"error"},e.stagingOrderCreateErrorMessage),h("zonos-empty-state-payment",{emptyStateText:translate("No payment method needed for staging"),theme:o}),h("div",{class:"zonos--group-btn"},h("zonos-button",{backgroundColor:e.submitBtnColor,loading:e.internalContinueLoading,onClick:function(){void e.placeTestOrder()},size:"lg",variant:e.submitBtnType},translate("Place test order"))))}if(stripeStore.isFetchingSession||invoiceStore.isFetchingPayorInfo){return null}return h(Fragment,null,e.showErrorBanner&&h("zonos-banner",{class:"zonos--error-banner",intent:"error"},translate("Missing required fields. Make sure all fields are completed.")),e.hasStripePaymentError&&h("zonos-banner",{class:"zonos--payment-error-banner",intent:"error"},stripeStore.customErrorMessage||translate("We couldn't complete your payment. Please verify the payment details and try again.")),paypalStore.paypalErrorMessage&&h("zonos-banner",{class:"zonos--payment-error-banner",intent:"error"},paypalStore.paypalErrorMessage),h("zonos-payment",null),h("div",{class:"zonos--group-btn"},!s&&h(Fragment,null,h("zonos-button",{backgroundColor:e.submitBtnColor,bold:true,isDisabled:e.continueLoading&&stripeStore.checkoutSettlementCurrency==="USD",loading:e.continueLoading&&stripeStore.checkoutSettlementCurrency!=="USD",onClick:function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(!cartStore.checkoutSession){log("Checkout session is not found");return[2]}return[4,this.continueClickHandler({currencyCode:cartStore.checkoutSession.subtotals.presentmentCurrencyCode})];case 1:e.sent();return[2]}}))}))},size:"lg",variant:e.submitBtnType},translate("Pay [orderTotal]",{orderTotal:renderCheckoutCurrency({amount:invoiceStore.amountTotalDue||0,isForeign:true})})),stripeStore.shouldRenderPayInUsdButton&&h("zonos-button",{class:"zonos--pay-in-base-currency-btn",isDisabled:e.continueLoading&&stripeStore.checkoutSettlementCurrency!=="USD",loading:e.continueLoading&&stripeStore.checkoutSettlementCurrency==="USD",onClick:function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.continueClickHandler({currencyCode:"USD"})];case 1:e.sent();return[2]}}))}))},size:"lg",variant:"subtle"},translate("Click to pay in USD"))),h("zonos-paypal-payment",{onPaypalSessionDone:function(o){var t=o.detail.orderId;e.paypalSessionDone.emit(t)},onPaypalSessionFail:function(){return e.paypalSessionFailed.emit()},style:{display:s?"block":"none"}})),t&&h("zonos-card",{backgroundColor:"gray-100",borderRadius:12,class:"zonos--test-cards"},h("zonos-v-stack",{spacing:16},h("div",null,h("zonos-text",{type:"semiBoldLabel"},translate("Test cards")),h("zonos-text",{textColor:"gray-700"},translate("Click to copy the card number. Use any future expiration date and three number CVC."))),h("zonos-button",{icon:h("zonos-icon",{content:CheckmarkLineIcon}),justifyContent:"flex-start",onClick:function(){return e.copyCardToClipboard("4242424242424242")}},translate("Success")," (****4242)"),h("zonos-button",{icon:h("zonos-icon",{content:RemoveLineIcon}),justifyContent:"flex-start",onClick:function(){return e.copyCardToClipboard("4000000000000002")}},translate("Failure")," (****0002)")),h("zonos-notification",null)))};return h(Host,{class:"zonos--checkout-payment zonos--elements"},h("div",{class:"zonos--group"},h("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},translate("Payment method")),i()))};Object.defineProperty(e.prototype,"ele",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{continueLoading:["continueLoadingWatcher"],hasStripePaymentError:["stripePaymentErrorWatcher"]}},enumerable:false,configurable:true});return e}();ZonosInvoicePayment.style=ZonosInvoicePaymentStyle0;var zonosInvoiceReviewCss=':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{position:-webkit-sticky;position:sticky;top:0;background-color:var(--zonos-elements-gray-0);z-index:1}:host .zonos--total-pay{margin:8px 0 24px;display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;gap:48px}:host .zonos--total-pay zonos-text{-ms-flex-negative:0;flex-shrink:0}:host .zonos--total-pay::after{content:"";position:relative;height:1px;width:100%;background:var(--zonos-elements-gray-200)}:host(.mobile),:host(.tablet){display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px;padding:4px 0;background-color:transparent;position:relative}:host(.mobile) .zonos--total-pay,:host(.tablet) .zonos--total-pay{margin:0}';var ZonosInvoiceReviewStyle0=zonosInvoiceReviewCss;var ZonosInvoiceReview=function(){function e(e){registerInstance(this,e);this.mobile=false;this.tablet=false;this.collapsed=false;this.isMobile=false;this.isTablet=false;this.isLoading=true}e.prototype.handleWindowResize=function(){this.isMobile=isInvoiceMobile(this.mobile);this.isTablet=isInvoiceTablet(this.tablet)};e.prototype.componentWillLoad=function(){var e=this;this.handleWindowResize();setTimeout((function(){e.isLoading=false}),1e3)};e.prototype.render=function(){var e=this.isMobile?"gray-1000":"gray-800";return h(Host,{key:"60da23c47f39a94478f1eb83e003b788aab3b98c",class:classes(["zonos--invoice-review zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"])},h("div",{key:"70bbb1973ec1c7197da666ba30be6dc6a20bd386",class:"zonos--title"},h("zonos-text",{key:"35ffffa411ccde7c702b5d5ac3f11d7a8d62916f",textColor:e,type:"semiBoldLabel"},translate("Pay [organizationName]",{organizationName:zonosStore.organizationName}))),h("div",{key:"c965e47314d1c3178b1dd2e54e835c0b91966a81",class:"zonos--total-pay"},renderFallback({content:h("zonos-text",{type:"secondaryPageHeader"},renderCheckoutCurrency({amount:invoiceStore.amountTotalDue||0,isForeign:true})),isLoading:invoiceStore.isFetchingPayorInfo,skeletonHeight:"36px",skeletonWidth:"150px"})))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return e}();ZonosInvoiceReview.style=ZonosInvoiceReviewStyle0;export{ZonosInvoiceFinish as zonos_invoice_finish,ZonosInvoiceFooter as zonos_invoice_footer,ZonosInvoiceOrderDetails as zonos_invoice_order_details,ZonosInvoicePayment as zonos_invoice_payment,ZonosInvoiceReview as zonos_invoice_review};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(o,e,n,i){function s(o){return o instanceof n?o:new n((function(e){e(o)}))}return new(n||(n=Promise))((function(n,t){function c(o){try{a(i.next(o))}catch(o){t(o)}}function r(o){try{a(i["throw"](o))}catch(o){t(o)}}function a(o){o.done?n(o.value):s(o.value).then(c,r)}a((i=i.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var n={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},i,s,t,c;return c={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function r(o){return function(e){return a([o,e])}}function a(r){if(i)throw new TypeError("Generator is already executing.");while(c&&(c=0,r[0]&&(n=0)),n)try{if(i=1,s&&(t=r[0]&2?s["return"]:r[0]?s["throw"]||((t=s["return"])&&t.call(s),0):s.next)&&!(t=t.call(s,r[1])).done)return t;if(s=0,t)r=[r[0]&2,t.value];switch(r[0]){case 0:case 1:t=r;break;case 4:n.label++;return{value:r[1],done:false};case 5:n.label++;s=r[1];r=[0];continue;case 7:r=n.ops.pop();n.trys.pop();continue;default:if(!(t=n.trys,t=t.length>0&&t[t.length-1])&&(r[0]===6||r[0]===2)){n=0;continue}if(r[0]===3&&(!t||r[1]>t[0]&&r[1]<t[3])){n.label=r[1];break}if(r[0]===6&&n.label<t[1]){n.label=t[1];t=r;break}if(t&&n.label<t[2]){n.label=t[2];n.ops.push(r);break}if(t[2])n.ops.pop();n.trys.pop();continue}r=e.call(o,n)}catch(o){r=[6,o];s=0}finally{i=t=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};import{r as registerInstance,h,H as Host,F as Fragment}from"./index-0bbe9693.js";import{b as stripeStore,i as initStripeElements,c as stripeStoreRetrievePayment,d as cartStore,n as cartStoreUpdateToErrorState,e as cartStoreUpdateItems,j as stripeStoreInitCheckoutSession,k as stripeStoreGetPaymentIntent,u as stripeStoreUpdateCheckoutSessionBaseCurrency,w as stripeStoreConfirmPayment,B as stripeStoreOnChange,y as stripeStoreReset,f as cartStoreReset}from"./cart-99ec4a3d.js";import{i as invoiceStoreUpdateSelectedShippingOption,a as invoiceStoreInitShippingInfo,b as invoiceStoreAsyncAddressUpdate,c as invoiceStore}from"./invoice-44e97c22.js";import{p as paypalStoreHasPaypalEnabled,a as paypalStore}from"./paypal-56534e48.js";import{s as storageStore,t as translate,c as localizationStoreOnChange,d as currencyFormat,l as localizationStore}from"./localization-853b48a9.js";import{z as zonosStore}from"./zonosStore-b434e436.js";import{b as buildCartItemsByTempCart}from"./buildCartItemsByTempCart-a117f75d.js";import{h as handleFetch,s as sendErrorLog,l as logError,g as getIsTestMode}from"./handleFetch-a844cac1.js";import{i as isInvoiceMobile,a as isInvoiceTablet}from"./isInvoiceMobileTablet-1f7b614e.js";import{c as classes}from"./classes-0d95c529.js";import{l as log}from"./VarianceTest-572cecf5.js";import{l as languages}from"./ILanguage-cd6acb72.js";import"./isDarkColor-9ddd90cc.js";import"./getBorderRadius-877f6389.js";import"./isContrastColor-69778cea.js";var ChevronDownIcon='<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var zonosInvoiceCss=".sc-zonos-invoice-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-invoice-h *.sc-zonos-invoice{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-invoice-h img.sc-zonos-invoice{max-width:100%}.sc-zonos-invoice-h dl.sc-zonos-invoice,.sc-zonos-invoice-h dd.sc-zonos-invoice,.sc-zonos-invoice-h h1.sc-zonos-invoice,.sc-zonos-invoice-h h2.sc-zonos-invoice,.sc-zonos-invoice-h h3.sc-zonos-invoice,.sc-zonos-invoice-h h4.sc-zonos-invoice,.sc-zonos-invoice-h h5.sc-zonos-invoice,.sc-zonos-invoice-h h6.sc-zonos-invoice,.sc-zonos-invoice-h hr.sc-zonos-invoice,.sc-zonos-invoice-h figure.sc-zonos-invoice,.sc-zonos-invoice-h p.sc-zonos-invoice,.sc-zonos-invoice-h pre.sc-zonos-invoice{margin:0}.sc-zonos-invoice-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-invoice-h{z-index:2147483647;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;top:0;left:0;width:100%;height:100%;-ms-flex-align:center;align-items:center;background-color:var(--zonos-elements-gray-0)}.sc-zonos-invoice-h *.sc-zonos-invoice{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar{width:10px}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;width:100%;-ms-flex-pack:center;justify-content:center}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{-ms-flex:1;flex:1;padding:56px 80px 60px;max-width:800px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200);overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:32px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{background-color:var(--zonos-elements-gray-0)}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice{width:100%;max-width:1400px;max-height:100%;height:calc(100% - 100px);overflow:hidden;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice .zonos--header.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice .zonos--logo.sc-zonos-invoice{margin-bottom:0}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice zonos-checkout-finish.sc-zonos-invoice{-ms-flex:1;flex:1}.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{max-width:800px}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{padding:0 8px 8px}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice .zonos--payment-error-banner.sc-zonos-invoice{margin-top:24px}.sc-zonos-invoice-h .zonos--right.sc-zonos-invoice{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-invoice-h .zonos--right.sc-zonos-invoice .zonos--order-details-container.sc-zonos-invoice{overflow:auto}.sc-zonos-invoice-h .zonos--wrapper.sc-zonos-invoice{overflow:auto;max-height:100%;position:relative}.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-invoice-h .zonos--logo-wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center;-ms-flex:1;flex:1}.sc-zonos-invoice-h .zonos--logo-wrapper.sc-zonos-invoice>*.sc-zonos-invoice{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-invoice-h .zonos--header-right.sc-zonos-invoice{display:none}.sc-zonos-invoice-h .zonos--logo.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-invoice-h .zonos--logo.sc-zonos-invoice img.sc-zonos-invoice{max-height:70px;-o-object-position:left center;object-position:left center;-o-object-fit:contain;object-fit:contain}.sc-zonos-invoice-h .zonos--invoice-container.sc-zonos-invoice{overflow:visible}.mobile.sc-zonos-invoice-h,.tablet.sc-zonos-invoice-h{min-width:auto}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{padding-bottom:0}}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--review.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--review.sc-zonos-invoice{margin-bottom:0}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--cart-items.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--cart-items.sc-zonos-invoice{margin-top:8px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice zonos-checkout-footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice zonos-checkout-footer.sc-zonos-invoice{-ms-flex-order:3;order:3}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{max-height:100%}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--footer.sc-zonos-invoice{-ms-flex-order:3;order:3}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice{width:auto}.mobile.sc-zonos-invoice-h .zonos--cart-subtotal.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--cart-subtotal.sc-zonos-invoice{margin:0}.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{position:-webkit-sticky;position:sticky;top:0;width:100%;padding:16px;background-color:var(--zonos-elements-gray-0);z-index:3}.mobile.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{max-width:800px;padding:0 16px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{overflow:auto;-ms-flex-pack:unset;justify-content:unset;-ms-flex-align:center;align-items:center;gap:24px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{overflow:visible;width:100%}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{gap:32px}.mobile.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice{margin-top:0}.mobile.sc-zonos-invoice-h zonos-collect-footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h zonos-collect-footer.sc-zonos-invoice{-ms-flex-order:3;order:3;left:0}.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{padding-top:56px;top:-56px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--header-right.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{padding-top:28px;top:-28px}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice{position:fixed;left:0;right:0;bottom:0;-webkit-transform-origin:bottom center;transform-origin:bottom center;width:100vw;background:var(--zonos-elements-surface-color);-webkit-box-shadow:var(--zonos-elements-v3-shadow-xl);box-shadow:var(--zonos-elements-v3-shadow-xl);border-radius:var(--zonos-elements-radius-12);max-width:100vw;max-height:500px;z-index:2147483011;overflow:auto;-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;-ms-scroll-chaining:none;overscroll-behavior:contain}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar{width:10px}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-track{border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.zonos--invoice-language-dialog-open.sc-zonos-invoice{opacity:1;-webkit-transform:scale(1);transform:scale(1)}.iframed.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{-ms-scroll-chaining:chained;overscroll-behavior:auto}";var ZonosInvoiceStyle0=zonosInvoiceCss;var ZonosInvoice=function(){function o(o){var e=this;registerInstance(this,o);this.storeUnsubscribeList=[];this.onChangeLocaleListener=function(){};this.mobile=false;this.tablet=false;this.stripe=window.Zonos.stripe;this.showLanguageDialogMobile=false;this.submitLoading=false;this.collapseReviewMobile=true;this.isMobile=false;this.isTablet=false;this.isOverlayLoading=true;this.isCartCollected=false;this.isCartExpired=false;this.payInUsdConfirmDialogOpen=false;this.inventoryCheckErrorMessage=null;this.confirmationId=null;this.clientSecret=stripeStore.clientSecret;this.stripeCustomerSessionClientSecret=stripeStore.stripeCustomerSessionClientSecret;this.getBaseCurrencySettlementInfo=function(){var o=cartStore.selectedLandedCost;if(!o){return null}var e=o.landedCost.amountSubtotals;if(!e){return null}var n=(e.discounts||0)+e.items+e.landedCostTotal+e.shipping;return{settlementAmount:n}};this.applyStripeTheme=function(){return __awaiter(e,void 0,void 0,(function(){var o;return __generator(this,(function(e){switch(e.label){case 0:o=zonosStore.appearance.theme;return[4,initStripeElements({overrideTheme:this.isMobile?o:undefined,paypalEnabled:paypalStoreHasPaypalEnabled()})];case 1:e.sent();return[2]}}))}))};this.fetchCheckoutSession=function(o){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(n){switch(n.label){case 0:return[4,handleFetch("/api/zonos-elements/collect/get-checkout-session",{body:{checkoutSessionId:o},method:"POST"})];case 1:e=n.sent().json;return[2,e]}}))}))};this.checkStripePaymentIntentStatus=function(){return __awaiter(e,void 0,void 0,(function(){var o,e,n,i,s,t,c,r,a,l;return __generator(this,(function(v){switch(v.label){case 0:e=!!window.Zonos.cartData;n=new URL(window.location.href).searchParams;i=n.get("payment_intent_client_secret");s=n.get("zonosCheckoutSessionId");log("Payment intent exist, checking stripe payment intent status");if(!i){log("No stripe client secret found in the URL, proceed to order if cart data is available");return[2,{shouldAllowOrder:e}]}return[4,stripeStoreRetrievePayment({clientSecret:i})];case 1:t=v.sent(),c=t.error,r=t.status;a=new URLSearchParams(window.location.search).get("redirect_status");if(!(a&&s))return[3,3];if(!c){log("Payment intent is succeeded or in a good state to move forward, show success screen")}else{log("Payment intent failed, show status from error")}return[4,this.fetchCheckoutSession(s)];case 2:l=v.sent();this.confirmationId=((o=l===null||l===void 0?void 0:l.checkoutSession.landedCost)===null||o===void 0?void 0:o.shortId)||null;storageStore.checkoutSessionId=s;stripeStore.clientSecret=i;void this.setToFinishStep(r);return[2,{shouldAllowOrder:false}];case 3:if(!e){log("Cart data is not available, only check payment intent status, skip order.");return[2,{shouldAllowOrder:false}]}log("Payment intent is not succeeded, proceed to order");return[2,{shouldAllowOrder:true}]}}))}))}}o.prototype.resizeListener=function(){this.isMobile=isInvoiceMobile(this.mobile);this.isTablet=isInvoiceTablet(this.tablet)};o.prototype.setToFinishStep=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){stripeStore.stripe=window.Zonos.stripe;cartStore.step="finish";this.storybookPaymentStatusOverride=o;this.isOverlayLoading=false;return[2]}))}))};o.prototype.initInvoiceCart=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,n,i,s,t,c,r,a,l,v,d,z,h,u,f,p,m,g,b,w,x,S;return __generator(this,(function(y){switch(y.label){case 0:if(!window.Zonos.cartData){return[2]}d=(e=(o=window.Zonos.cartData)===null||o===void 0?void 0:o.items[0])===null||e===void 0?void 0:e.currencyCode;if(d){cartStore.currency=d}z=(i=(n=window.Zonos.cartData)===null||n===void 0?void 0:n.references)===null||i===void 0?void 0:i.checkoutSessionId;h=(t=(s=window.Zonos.cartData)===null||s===void 0?void 0:s.references)===null||t===void 0?void 0:t.landedCostId;if(!h){cartStoreUpdateToErrorState({messages:[translate("Session does not have valid landed cost. Please contact [organizationName] for assistance.",{organizationName:zonosStore.organizationName})],title:translate("Invalid session")});return[2]}if(z){log("Setting checkout session id from cart reference","info",z);storageStore.checkoutSessionId=z}else{log("Clear checkout session id from storage so we start from a fresh session for the invoice cart");storageStore.checkoutSessionId=null}return[4,this.checkStripePaymentIntentStatus()];case 1:u=y.sent().shouldAllowOrder;if(!u){return[2]}y.label=2;case 2:y.trys.push([2,11,,12]);f=buildCartItemsByTempCart(window.Zonos.cartData),p=f.adjustments,m=f.cartItems;return[4,cartStoreUpdateItems({adjustments:p,cartItems:m,landedCostId:h,shouldInitSessionOnFailure:false})];case 3:y.sent();if(!(!storageStore.checkoutSessionId&&!z))return[3,5];return[4,stripeStoreInitCheckoutSession()];case 4:g=y.sent();log("stripeStoreInitCheckoutSession: ".concat(g));if(!g){throw new Error("Failed to initialize checkout session! The cart might be created with LIVE Invoice quote but being used with sandbox credential")}y.label=5;case 5:if(!((!cartStore.checkoutSession||((c=cartStore.checkoutSession)===null||c===void 0?void 0:c.completedAt))&&z))return[3,9];return[4,this.fetchCheckoutSession(z)];case 6:b=y.sent();this.confirmationId=((r=b===null||b===void 0?void 0:b.checkoutSession.landedCost)===null||r===void 0?void 0:r.shortId)||null;if(!!(b===null||b===void 0?void 0:b.checkoutSession.completedAt)&&!!b.checkoutSession.order){void this.setToFinishStep("succeeded");return[2]}if(!(b===null||b===void 0?void 0:b.checkoutSession.clientSecret))return[3,8];return[4,stripeStoreRetrievePayment({clientSecret:b.checkoutSession.clientSecret})];case 7:w=y.sent().status;if(w==="processing"||w==="succeeded"){void this.setToFinishStep(w);return[2]}y.label=8;case 8:void sendErrorLog({endpoint:"INVALID_INVOICE_CHECKOUT_SESSION",errors:["Invalid checkout session, can not retrieve the checkout session after failing to update it"],metadata:{cartCheckoutSessionId:z,cartId:(a=window.Zonos.cartData)===null||a===void 0?void 0:a.id,cartLandedCostId:h}});throw new Error("Invalid checkout session, can not retrieve the checkout session after failing to update it");case 9:if(!cartStore.checkoutSession){void sendErrorLog({endpoint:"FAIL_TO_UPDATE_CREATE_INVOICE_CHECKOUT_SESSION",errors:["Could not update/create checkout session for this invoice cart"],metadata:{cartCheckoutSessionId:z||"N/A",cartId:(l=window.Zonos.cartData)===null||l===void 0?void 0:l.id,cartLandedCostId:h||"N/A"}});throw new Error("Could not update/create checkout session for this invoice cart")}void stripeStoreGetPaymentIntent();x=(v=cartStore.checkoutSession)===null||v===void 0?void 0:v.landedCost;if(!x){throw new Error("Landed cost could not be found in checkout session after creating/updating them")}return[4,invoiceStoreUpdateSelectedShippingOption(Object.assign(Object.assign({},cartStore.checkoutSession),{id:storageStore.checkoutSessionId||""}))];case 10:y.sent();void invoiceStoreInitShippingInfo({landedCostId:x.id});void this.applyStripeTheme();return[3,12];case 11:S=y.sent();logError(S);cartStoreUpdateToErrorState({messages:[translate("Session does not have valid landed cost. Please contact [organizationName] for assistance.",{organizationName:zonosStore.organizationName})],title:translate("Invalid session")});return[3,12];case 12:this.isOverlayLoading=false;return[2]}}))}))};o.prototype.toggleLanguageDialog=function(){this.showLanguageDialogMobile=!this.showLanguageDialogMobile};o.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,n,i,s,t,c,r,a;return __generator(this,(function(l){switch(l.label){case 0:void((o=stripeStore.stripeBillingAddressElement)===null||o===void 0?void 0:o.getValue());if(!((e=stripeStore.stripeLinkEventData)===null||e===void 0?void 0:e.complete)){s=document.querySelector("zonos-link-authentication");s===null||s===void 0?void 0:s.scrollIntoView({behavior:"smooth"});return[2]}if(!((n=stripeStore.stripeBillingAddressEventData)===null||n===void 0?void 0:n.complete)){t=document.querySelector(".zonos--billing-address");t===null||t===void 0?void 0:t.scrollIntoView({behavior:"smooth"});return[2]}c=stripeStore.checkoutSettlementCurrency==="USD";if(c&&stripeStore.shouldRenderPayInUsdButton&&!this.payInUsdConfirmDialogOpen){this.payInUsdConfirmDialogOpen=true;return[2]}this.payInUsdConfirmDialogOpen=false;paypalStore.paypalErrorMessage=null;stripeStore.hasPaymentError=false;this.submitLoading=true;cartStore.inventoryCheckErrorMessage=null;return[4,stripeStoreUpdateCheckoutSessionBaseCurrency()];case 1:r=l.sent();if(!r){stripeStore.hasPaymentError=true;stripeStore.customErrorMessage=translate("Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.",{currency:stripeStore.checkoutSettlementCurrency});this.submitLoading=false;return[2]}return[4,invoiceStoreAsyncAddressUpdate()];case 2:l.sent();l.label=3;case 3:l.trys.push([3,5,,6]);return[4,stripeStoreConfirmPayment({noLandedCostCheck:true})];case 4:l.sent();cartStore.step="finish";this.confirmationId=invoiceStore.landedCostShortId||((i=cartStore.selectedLandedCost)===null||i===void 0?void 0:i.landedCostId)||null;return[2];case 5:a=l.sent();logError(a);stripeStore.hasPaymentError=true;return[3,6];case 6:this.submitLoading=false;return[2]}}))}))};o.prototype.componentWillLoad=function(){var o=this;stripeStore.stripe=window.Zonos.stripe;cartStore.step="payment";void this.initInvoiceCart();this.resizeListener();this.storeUnsubscribeList=[stripeStoreOnChange("clientSecret",(function(){void o.applyStripeTheme()})),localizationStoreOnChange("selectedLocale",(function(){void o.applyStripeTheme()}))];log("mobile: ".concat(this.isMobile))};o.prototype.disconnectedCallback=function(){stripeStoreReset();cartStoreReset();this.onChangeLocaleListener();this.storeUnsubscribeList.forEach((function(o){return o()}))};o.prototype.render=function(){var o=this;this.clientSecret=stripeStore.clientSecret;if(stripeStore.stripeCustomerSessionClientSecret){this.stripeCustomerSessionClientSecret=stripeStore.stripeCustomerSessionClientSecret}var e=this.getBaseCurrencySettlementInfo();var n=zonosStore.appearance,i=n.logoUrl,s=n.theme;var t=function(){var o="".concat(i,"?timestamp=").concat(Date.now());return h("div",{class:"zonos--logo"},o&&h("img",{alt:"".concat(zonosStore.organizationName," logo"),src:o}))};var c=getIsTestMode();var r=function(){var e;var n=new URLSearchParams(window.location.search);var i=n.get("zonosQaUrl");var s=n.get("zonosDebug");var r=(e=languages.find((function(o){return o.code===localizationStore.selectedLocale})))===null||e===void 0?void 0:e.label;return h(Fragment,null,h("zonos-h-stack",{class:"zonos--header-wrapper",spacing:16},h("div",{class:"zonos--logo-wrapper"},t(),c&&h("zonos-badge",{badgeColor:"orange",size:"small"},translate("Test mode")),s==="1"&&h("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),i&&h("zonos-badge",{badgeColor:"purple",size:"small"},i)),h("div",{class:"zonos--header-right"},h("zonos-button",{backgroundColor:"gray-0",class:"zonos--header-right-button",onClick:function(){return o.toggleLanguageDialog()},variant:"outline"},r,h("zonos-icon",{"aria-label":"Language select",content:ChevronDownIcon,iconColor:"gray-1200"})),h("div",{class:classes(["zonos--invoice-language-dialog",o.showLanguageDialogMobile&&"zonos--invoice-language-dialog-open"])},h("zonos-language-select",{handleOnClose:function(){return o.toggleLanguageDialog()}})))))};var a=function(){if(o.isOverlayLoading||stripeStore.isFetchingSession){return null}return h("div",{class:"zonos--content"},cartStore.step!=="finish"&&cartStore.step!=="error"&&h(Fragment,null,(o.isMobile||o.isTablet)&&r(),h("div",{class:"zonos--left","data-theme":s},!o.isMobile&&!o.isTablet&&r(),h("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},translate("Billing info")),h("zonos-v-stack",{spacing:16},h("zonos-link-authentication",{titleText:""}),h("zonos-address",{titleText:"",type:"billing"})),h("zonos-invoice-payment",{class:classes(["zonos--invoice-container"]),continueLoading:o.submitLoading,onContinueClicked:function(){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:return[4,this.handleStripePaymentContinue()];case 1:o.sent();return[2]}}))}))}})),h("div",{class:"zonos--right","data-theme":s},!o.isMobile&&h("zonos-invoice-review",{mobile:o.isMobile,tablet:o.isTablet}),h("div",{class:"zonos--order-details-container"},!o.isMobile&&h("zonos-invoice-cart-items",null),o.isMobile&&h("zonos-invoice-order-details",{collapsed:o.collapseReviewMobile,mobile:o.isMobile,onCollapseClicked:function(){o.collapseReviewMobile=!o.collapseReviewMobile}})),h("div",{class:"flex--wrapper"},!o.isMobile&&h("zonos-v-stack",{spacing:16},h("zonos-invoice-subtotal",null)),!o.isMobile&&!o.isTablet&&h("zonos-invoice-footer",{"data-theme":s,mobile:o.isMobile,tablet:o.isTablet})))),(cartStore.step==="finish"||cartStore.step==="error")&&h("div",{class:"zonos--done","data-theme":s},h("div",{class:"zonos--header"},t()),h("zonos-invoice-finish",{confirmationId:o.confirmationId,overrideNotification:cartStore.step==="error"&&!!cartStore.error?Object.assign(Object.assign({},cartStore.error),{type:"error"}):undefined,storybookForceStatus:o.storybookPaymentStatusOverride})),(o.isMobile||o.isTablet||cartStore.step==="finish"||cartStore.step==="error")&&h("zonos-invoice-footer",{"data-theme":s,mobile:o.isMobile,tablet:o.isTablet}))};return h(Host,{class:classes(["zonos--invoice zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"]),"data-theme":s},a(),e&&h("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:translate("Cancel"),dialogConfirmBtnText:translate("Pay [orderTotal]",{orderTotal:currencyFormat({amount:e.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:translate("By paying in USD, your card will be charged directly with no currency conversion. However, using a non-USD based card may result in additional currency conversion fees at the bank level."),dialogTitle:translate("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:function(){o.payInUsdConfirmDialogOpen=false},onConfirmClicked:function(){return o.handleStripePaymentContinue()}}),h("zonos-loading-overlay",{open:this.isOverlayLoading}))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return o}();ZonosInvoice.style=ZonosInvoiceStyle0;export{ZonosInvoice as zonos_invoice};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(o,e,n,i){function s(o){return o instanceof n?o:new n((function(e){e(o)}))}return new(n||(n=Promise))((function(n,t){function c(o){try{a(i.next(o))}catch(o){t(o)}}function r(o){try{a(i["throw"](o))}catch(o){t(o)}}function a(o){o.done?n(o.value):s(o.value).then(c,r)}a((i=i.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var n={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},i,s,t,c;return c={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function r(o){return function(e){return a([o,e])}}function a(r){if(i)throw new TypeError("Generator is already executing.");while(c&&(c=0,r[0]&&(n=0)),n)try{if(i=1,s&&(t=r[0]&2?s["return"]:r[0]?s["throw"]||((t=s["return"])&&t.call(s),0):s.next)&&!(t=t.call(s,r[1])).done)return t;if(s=0,t)r=[r[0]&2,t.value];switch(r[0]){case 0:case 1:t=r;break;case 4:n.label++;return{value:r[1],done:false};case 5:n.label++;s=r[1];r=[0];continue;case 7:r=n.ops.pop();n.trys.pop();continue;default:if(!(t=n.trys,t=t.length>0&&t[t.length-1])&&(r[0]===6||r[0]===2)){n=0;continue}if(r[0]===3&&(!t||r[1]>t[0]&&r[1]<t[3])){n.label=r[1];break}if(r[0]===6&&n.label<t[1]){n.label=t[1];t=r;break}if(t&&n.label<t[2]){n.label=t[2];n.ops.push(r);break}if(t[2])n.ops.pop();n.trys.pop();continue}r=e.call(o,n)}catch(o){r=[6,o];s=0}finally{i=t=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};import{r as registerInstance,h,H as Host,F as Fragment}from"./index-0bbe9693.js";import{b as stripeStore,i as initStripeElements,c as stripeStoreRetrievePayment,d as cartStore,n as cartStoreUpdateToErrorState,e as cartStoreUpdateItems,j as stripeStoreInitCheckoutSession,k as stripeStoreGetPaymentIntent,u as stripeStoreUpdateCheckoutSessionBaseCurrency,w as stripeStoreConfirmPayment,B as stripeStoreOnChange,y as stripeStoreReset,f as cartStoreReset}from"./cart-ba8f3890.js";import{i as invoiceStoreUpdateSelectedShippingOption,a as invoiceStoreInitShippingInfo,b as invoiceStoreAsyncAddressUpdate,c as invoiceStore}from"./invoice-055bb6e5.js";import{p as paypalStoreHasPaypalEnabled,a as paypalStore}from"./paypal-8d8518c0.js";import{s as storageStore,t as translate,c as localizationStoreOnChange,d as currencyFormat,l as localizationStore}from"./localization-853b48a9.js";import{z as zonosStore}from"./zonosStore-b434e436.js";import{b as buildCartItemsByTempCart}from"./buildCartItemsByTempCart-a117f75d.js";import{h as handleFetch,s as sendErrorLog,l as logError,g as getIsTestMode}from"./handleFetch-a844cac1.js";import{i as isInvoiceMobile,a as isInvoiceTablet}from"./isInvoiceMobileTablet-1f7b614e.js";import{c as classes}from"./classes-0d95c529.js";import{l as log}from"./VarianceTest-572cecf5.js";import{l as languages}from"./ILanguage-cd6acb72.js";import"./isDarkColor-9ddd90cc.js";import"./getBorderRadius-877f6389.js";import"./isContrastColor-69778cea.js";import"./submitGtag-89d6e9cb.js";var ChevronDownIcon='<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var zonosInvoiceCss=".sc-zonos-invoice-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-invoice-h *.sc-zonos-invoice{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-invoice-h img.sc-zonos-invoice{max-width:100%}.sc-zonos-invoice-h dl.sc-zonos-invoice,.sc-zonos-invoice-h dd.sc-zonos-invoice,.sc-zonos-invoice-h h1.sc-zonos-invoice,.sc-zonos-invoice-h h2.sc-zonos-invoice,.sc-zonos-invoice-h h3.sc-zonos-invoice,.sc-zonos-invoice-h h4.sc-zonos-invoice,.sc-zonos-invoice-h h5.sc-zonos-invoice,.sc-zonos-invoice-h h6.sc-zonos-invoice,.sc-zonos-invoice-h hr.sc-zonos-invoice,.sc-zonos-invoice-h figure.sc-zonos-invoice,.sc-zonos-invoice-h p.sc-zonos-invoice,.sc-zonos-invoice-h pre.sc-zonos-invoice{margin:0}.sc-zonos-invoice-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-invoice-h{z-index:2147483647;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;top:0;left:0;width:100%;height:100%;-ms-flex-align:center;align-items:center;background-color:var(--zonos-elements-gray-0)}.sc-zonos-invoice-h *.sc-zonos-invoice{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar{width:10px}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;width:100%;-ms-flex-pack:center;justify-content:center}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{-ms-flex:1;flex:1;padding:56px 80px 60px;max-width:800px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200);overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:32px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{background-color:var(--zonos-elements-gray-0)}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice{width:100%;max-width:1400px;max-height:100%;height:calc(100% - 100px);overflow:hidden;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice .zonos--header.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice .zonos--logo.sc-zonos-invoice{margin-bottom:0}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice zonos-checkout-finish.sc-zonos-invoice{-ms-flex:1;flex:1}.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{max-width:800px}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{padding:0 8px 8px}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice .zonos--payment-error-banner.sc-zonos-invoice{margin-top:24px}.sc-zonos-invoice-h .zonos--right.sc-zonos-invoice{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-invoice-h .zonos--right.sc-zonos-invoice .zonos--order-details-container.sc-zonos-invoice{overflow:auto}.sc-zonos-invoice-h .zonos--wrapper.sc-zonos-invoice{overflow:auto;max-height:100%;position:relative}.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-invoice-h .zonos--logo-wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center;-ms-flex:1;flex:1}.sc-zonos-invoice-h .zonos--logo-wrapper.sc-zonos-invoice>*.sc-zonos-invoice{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-invoice-h .zonos--header-right.sc-zonos-invoice{display:none}.sc-zonos-invoice-h .zonos--logo.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-invoice-h .zonos--logo.sc-zonos-invoice img.sc-zonos-invoice{max-height:70px;-o-object-position:left center;object-position:left center;-o-object-fit:contain;object-fit:contain}.sc-zonos-invoice-h .zonos--invoice-container.sc-zonos-invoice{overflow:visible}.mobile.sc-zonos-invoice-h,.tablet.sc-zonos-invoice-h{min-width:auto}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{padding-bottom:0}}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--review.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--review.sc-zonos-invoice{margin-bottom:0}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--cart-items.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--cart-items.sc-zonos-invoice{margin-top:8px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice zonos-checkout-footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice zonos-checkout-footer.sc-zonos-invoice{-ms-flex-order:3;order:3}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{max-height:100%}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--footer.sc-zonos-invoice{-ms-flex-order:3;order:3}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice{width:auto}.mobile.sc-zonos-invoice-h .zonos--cart-subtotal.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--cart-subtotal.sc-zonos-invoice{margin:0}.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{position:-webkit-sticky;position:sticky;top:0;width:100%;padding:16px;background-color:var(--zonos-elements-gray-0);z-index:3}.mobile.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{max-width:800px;padding:0 16px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{overflow:auto;-ms-flex-pack:unset;justify-content:unset;-ms-flex-align:center;align-items:center;gap:24px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{overflow:visible;width:100%}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{gap:32px}.mobile.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice{margin-top:0}.mobile.sc-zonos-invoice-h zonos-collect-footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h zonos-collect-footer.sc-zonos-invoice{-ms-flex-order:3;order:3;left:0}.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{padding-top:56px;top:-56px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--header-right.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{padding-top:28px;top:-28px}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice{position:fixed;left:0;right:0;bottom:0;-webkit-transform-origin:bottom center;transform-origin:bottom center;width:100vw;background:var(--zonos-elements-surface-color);-webkit-box-shadow:var(--zonos-elements-v3-shadow-xl);box-shadow:var(--zonos-elements-v3-shadow-xl);border-radius:var(--zonos-elements-radius-12);max-width:100vw;max-height:500px;z-index:2147483011;overflow:auto;-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;-ms-scroll-chaining:none;overscroll-behavior:contain}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar{width:10px}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-track{border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.zonos--invoice-language-dialog-open.sc-zonos-invoice{opacity:1;-webkit-transform:scale(1);transform:scale(1)}.iframed.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{-ms-scroll-chaining:chained;overscroll-behavior:auto}";var ZonosInvoiceStyle0=zonosInvoiceCss;var ZonosInvoice=function(){function o(o){var e=this;registerInstance(this,o);this.storeUnsubscribeList=[];this.onChangeLocaleListener=function(){};this.mobile=false;this.tablet=false;this.stripe=window.Zonos.stripe;this.showLanguageDialogMobile=false;this.submitLoading=false;this.collapseReviewMobile=true;this.isMobile=false;this.isTablet=false;this.isOverlayLoading=true;this.isCartCollected=false;this.isCartExpired=false;this.payInUsdConfirmDialogOpen=false;this.inventoryCheckErrorMessage=null;this.confirmationId=null;this.clientSecret=stripeStore.clientSecret;this.stripeCustomerSessionClientSecret=stripeStore.stripeCustomerSessionClientSecret;this.getBaseCurrencySettlementInfo=function(){var o=cartStore.selectedLandedCost;if(!o){return null}var e=o.landedCost.amountSubtotals;if(!e){return null}var n=(e.discounts||0)+e.items+e.landedCostTotal+e.shipping;return{settlementAmount:n}};this.applyStripeTheme=function(){return __awaiter(e,void 0,void 0,(function(){var o;return __generator(this,(function(e){switch(e.label){case 0:o=zonosStore.appearance.theme;return[4,initStripeElements({overrideTheme:this.isMobile?o:undefined,paypalEnabled:paypalStoreHasPaypalEnabled()})];case 1:e.sent();return[2]}}))}))};this.fetchCheckoutSession=function(o){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(n){switch(n.label){case 0:return[4,handleFetch("/api/zonos-elements/collect/get-checkout-session",{body:{checkoutSessionId:o},method:"POST"})];case 1:e=n.sent().json;return[2,e]}}))}))};this.checkStripePaymentIntentStatus=function(){return __awaiter(e,void 0,void 0,(function(){var o,e,n,i,s,t,c,r,a,l;return __generator(this,(function(v){switch(v.label){case 0:e=!!window.Zonos.cartData;n=new URL(window.location.href).searchParams;i=n.get("payment_intent_client_secret");s=n.get("zonosCheckoutSessionId");log("Payment intent exist, checking stripe payment intent status");if(!i){log("No stripe client secret found in the URL, proceed to order if cart data is available");return[2,{shouldAllowOrder:e}]}return[4,stripeStoreRetrievePayment({clientSecret:i})];case 1:t=v.sent(),c=t.error,r=t.status;a=new URLSearchParams(window.location.search).get("redirect_status");if(!(a&&s))return[3,3];if(!c){log("Payment intent is succeeded or in a good state to move forward, show success screen")}else{log("Payment intent failed, show status from error")}return[4,this.fetchCheckoutSession(s)];case 2:l=v.sent();this.confirmationId=((o=l===null||l===void 0?void 0:l.checkoutSession.landedCost)===null||o===void 0?void 0:o.shortId)||null;storageStore.checkoutSessionId=s;stripeStore.clientSecret=i;void this.setToFinishStep(r);return[2,{shouldAllowOrder:false}];case 3:if(!e){log("Cart data is not available, only check payment intent status, skip order.");return[2,{shouldAllowOrder:false}]}log("Payment intent is not succeeded, proceed to order");return[2,{shouldAllowOrder:true}]}}))}))}}o.prototype.resizeListener=function(){this.isMobile=isInvoiceMobile(this.mobile);this.isTablet=isInvoiceTablet(this.tablet)};o.prototype.setToFinishStep=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){stripeStore.stripe=window.Zonos.stripe;cartStore.step="finish";this.storybookPaymentStatusOverride=o;this.isOverlayLoading=false;return[2]}))}))};o.prototype.initInvoiceCart=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,n,i,s,t,c,r,a,l,v,d,z,h,u,f,m,p,g,b,w,x,S;return __generator(this,(function(y){switch(y.label){case 0:if(!window.Zonos.cartData){return[2]}d=(e=(o=window.Zonos.cartData)===null||o===void 0?void 0:o.items[0])===null||e===void 0?void 0:e.currencyCode;if(d){cartStore.currency=d}z=(i=(n=window.Zonos.cartData)===null||n===void 0?void 0:n.references)===null||i===void 0?void 0:i.checkoutSessionId;h=(t=(s=window.Zonos.cartData)===null||s===void 0?void 0:s.references)===null||t===void 0?void 0:t.landedCostId;if(!h){cartStoreUpdateToErrorState({messages:[translate("Session does not have valid landed cost. Please contact [organizationName] for assistance.",{organizationName:zonosStore.organizationName})],title:translate("Invalid session")});return[2]}if(z){log("Setting checkout session id from cart reference","info",z);storageStore.checkoutSessionId=z}else{log("Clear checkout session id from storage so we start from a fresh session for the invoice cart");storageStore.checkoutSessionId=null}return[4,this.checkStripePaymentIntentStatus()];case 1:u=y.sent().shouldAllowOrder;if(!u){return[2]}y.label=2;case 2:y.trys.push([2,11,,12]);f=buildCartItemsByTempCart(window.Zonos.cartData),m=f.adjustments,p=f.cartItems;return[4,cartStoreUpdateItems({adjustments:m,cartItems:p,landedCostId:h,shouldInitSessionOnFailure:false})];case 3:y.sent();if(!(!storageStore.checkoutSessionId&&!z))return[3,5];return[4,stripeStoreInitCheckoutSession()];case 4:g=y.sent();log("stripeStoreInitCheckoutSession: ".concat(g));if(!g){throw new Error("Failed to initialize checkout session! The cart might be created with LIVE Invoice quote but being used with sandbox credential")}y.label=5;case 5:if(!((!cartStore.checkoutSession||((c=cartStore.checkoutSession)===null||c===void 0?void 0:c.completedAt))&&z))return[3,9];return[4,this.fetchCheckoutSession(z)];case 6:b=y.sent();this.confirmationId=((r=b===null||b===void 0?void 0:b.checkoutSession.landedCost)===null||r===void 0?void 0:r.shortId)||null;if(!!(b===null||b===void 0?void 0:b.checkoutSession.completedAt)&&!!b.checkoutSession.order){void this.setToFinishStep("succeeded");return[2]}if(!(b===null||b===void 0?void 0:b.checkoutSession.clientSecret))return[3,8];return[4,stripeStoreRetrievePayment({clientSecret:b.checkoutSession.clientSecret})];case 7:w=y.sent().status;if(w==="processing"||w==="succeeded"){void this.setToFinishStep(w);return[2]}y.label=8;case 8:void sendErrorLog({endpoint:"INVALID_INVOICE_CHECKOUT_SESSION",errors:["Invalid checkout session, can not retrieve the checkout session after failing to update it"],metadata:{cartCheckoutSessionId:z,cartId:(a=window.Zonos.cartData)===null||a===void 0?void 0:a.id,cartLandedCostId:h}});throw new Error("Invalid checkout session, can not retrieve the checkout session after failing to update it");case 9:if(!cartStore.checkoutSession){void sendErrorLog({endpoint:"FAIL_TO_UPDATE_CREATE_INVOICE_CHECKOUT_SESSION",errors:["Could not update/create checkout session for this invoice cart"],metadata:{cartCheckoutSessionId:z||"N/A",cartId:(l=window.Zonos.cartData)===null||l===void 0?void 0:l.id,cartLandedCostId:h||"N/A"}});throw new Error("Could not update/create checkout session for this invoice cart")}void stripeStoreGetPaymentIntent();x=(v=cartStore.checkoutSession)===null||v===void 0?void 0:v.landedCost;if(!x){throw new Error("Landed cost could not be found in checkout session after creating/updating them")}return[4,invoiceStoreUpdateSelectedShippingOption(Object.assign(Object.assign({},cartStore.checkoutSession),{id:storageStore.checkoutSessionId||""}))];case 10:y.sent();void invoiceStoreInitShippingInfo({landedCostId:x.id});void this.applyStripeTheme();return[3,12];case 11:S=y.sent();logError(S);cartStoreUpdateToErrorState({messages:[translate("Session does not have valid landed cost. Please contact [organizationName] for assistance.",{organizationName:zonosStore.organizationName})],title:translate("Invalid session")});return[3,12];case 12:this.isOverlayLoading=false;return[2]}}))}))};o.prototype.toggleLanguageDialog=function(){this.showLanguageDialogMobile=!this.showLanguageDialogMobile};o.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,n,i,s,t,c,r,a;return __generator(this,(function(l){switch(l.label){case 0:void((o=stripeStore.stripeBillingAddressElement)===null||o===void 0?void 0:o.getValue());if(!((e=stripeStore.stripeLinkEventData)===null||e===void 0?void 0:e.complete)){s=document.querySelector("zonos-link-authentication");s===null||s===void 0?void 0:s.scrollIntoView({behavior:"smooth"});return[2]}if(!((n=stripeStore.stripeBillingAddressEventData)===null||n===void 0?void 0:n.complete)){t=document.querySelector(".zonos--billing-address");t===null||t===void 0?void 0:t.scrollIntoView({behavior:"smooth"});return[2]}c=stripeStore.checkoutSettlementCurrency==="USD";if(c&&stripeStore.shouldRenderPayInUsdButton&&!this.payInUsdConfirmDialogOpen){this.payInUsdConfirmDialogOpen=true;return[2]}this.payInUsdConfirmDialogOpen=false;paypalStore.paypalErrorMessage=null;stripeStore.hasPaymentError=false;this.submitLoading=true;cartStore.inventoryCheckErrorMessage=null;return[4,stripeStoreUpdateCheckoutSessionBaseCurrency()];case 1:r=l.sent();if(!r){stripeStore.hasPaymentError=true;stripeStore.customErrorMessage=translate("Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.",{currency:stripeStore.checkoutSettlementCurrency});this.submitLoading=false;return[2]}return[4,invoiceStoreAsyncAddressUpdate()];case 2:l.sent();l.label=3;case 3:l.trys.push([3,5,,6]);return[4,stripeStoreConfirmPayment({noLandedCostCheck:true})];case 4:l.sent();cartStore.step="finish";this.confirmationId=invoiceStore.landedCostShortId||((i=cartStore.selectedLandedCost)===null||i===void 0?void 0:i.landedCostId)||null;return[2];case 5:a=l.sent();logError(a);stripeStore.hasPaymentError=true;return[3,6];case 6:this.submitLoading=false;return[2]}}))}))};o.prototype.componentWillLoad=function(){var o=this;stripeStore.stripe=window.Zonos.stripe;cartStore.step="payment";void this.initInvoiceCart();this.resizeListener();this.storeUnsubscribeList=[stripeStoreOnChange("clientSecret",(function(){void o.applyStripeTheme()})),localizationStoreOnChange("selectedLocale",(function(){void o.applyStripeTheme()}))];log("mobile: ".concat(this.isMobile))};o.prototype.disconnectedCallback=function(){stripeStoreReset();cartStoreReset();this.onChangeLocaleListener();this.storeUnsubscribeList.forEach((function(o){return o()}))};o.prototype.render=function(){var o=this;this.clientSecret=stripeStore.clientSecret;if(stripeStore.stripeCustomerSessionClientSecret){this.stripeCustomerSessionClientSecret=stripeStore.stripeCustomerSessionClientSecret}var e=this.getBaseCurrencySettlementInfo();var n=zonosStore.appearance,i=n.logoUrl,s=n.theme;var t=function(){var o="".concat(i,"?timestamp=").concat(Date.now());return h("div",{class:"zonos--logo"},o&&h("img",{alt:"".concat(zonosStore.organizationName," logo"),src:o}))};var c=getIsTestMode();var r=function(){var e;var n=new URLSearchParams(window.location.search);var i=n.get("zonosQaUrl");var s=n.get("zonosDebug");var r=(e=languages.find((function(o){return o.code===localizationStore.selectedLocale})))===null||e===void 0?void 0:e.label;return h(Fragment,null,h("zonos-h-stack",{class:"zonos--header-wrapper",spacing:16},h("div",{class:"zonos--logo-wrapper"},t(),c&&h("zonos-badge",{badgeColor:"orange",size:"small"},translate("Test mode")),s==="1"&&h("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),i&&h("zonos-badge",{badgeColor:"purple",size:"small"},i)),h("div",{class:"zonos--header-right"},h("zonos-button",{backgroundColor:"gray-0",class:"zonos--header-right-button",onClick:function(){return o.toggleLanguageDialog()},variant:"outline"},r,h("zonos-icon",{"aria-label":"Language select",content:ChevronDownIcon,iconColor:"gray-1200"})),h("div",{class:classes(["zonos--invoice-language-dialog",o.showLanguageDialogMobile&&"zonos--invoice-language-dialog-open"])},h("zonos-language-select",{handleOnClose:function(){return o.toggleLanguageDialog()}})))))};var a=function(){if(o.isOverlayLoading||stripeStore.isFetchingSession){return null}return h("div",{class:"zonos--content"},cartStore.step!=="finish"&&cartStore.step!=="error"&&h(Fragment,null,(o.isMobile||o.isTablet)&&r(),h("div",{class:"zonos--left","data-theme":s},!o.isMobile&&!o.isTablet&&r(),h("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},translate("Billing info")),h("zonos-v-stack",{spacing:16},h("zonos-link-authentication",{titleText:""}),h("zonos-address",{titleText:"",type:"billing"})),h("zonos-invoice-payment",{class:classes(["zonos--invoice-container"]),continueLoading:o.submitLoading,onContinueClicked:function(){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:return[4,this.handleStripePaymentContinue()];case 1:o.sent();return[2]}}))}))}})),h("div",{class:"zonos--right","data-theme":s},!o.isMobile&&h("zonos-invoice-review",{mobile:o.isMobile,tablet:o.isTablet}),h("div",{class:"zonos--order-details-container"},!o.isMobile&&h("zonos-invoice-cart-items",null),o.isMobile&&h("zonos-invoice-order-details",{collapsed:o.collapseReviewMobile,mobile:o.isMobile,onCollapseClicked:function(){o.collapseReviewMobile=!o.collapseReviewMobile}})),h("div",{class:"flex--wrapper"},!o.isMobile&&h("zonos-v-stack",{spacing:16},h("zonos-invoice-subtotal",null)),!o.isMobile&&!o.isTablet&&h("zonos-invoice-footer",{"data-theme":s,mobile:o.isMobile,tablet:o.isTablet})))),(cartStore.step==="finish"||cartStore.step==="error")&&h("div",{class:"zonos--done","data-theme":s},h("div",{class:"zonos--header"},t()),h("zonos-invoice-finish",{confirmationId:o.confirmationId,overrideNotification:cartStore.step==="error"&&!!cartStore.error?Object.assign(Object.assign({},cartStore.error),{type:"error"}):undefined,storybookForceStatus:o.storybookPaymentStatusOverride})),(o.isMobile||o.isTablet||cartStore.step==="finish"||cartStore.step==="error")&&h("zonos-invoice-footer",{"data-theme":s,mobile:o.isMobile,tablet:o.isTablet}))};return h(Host,{class:classes(["zonos--invoice zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"]),"data-theme":s},a(),e&&h("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:translate("Cancel"),dialogConfirmBtnText:translate("Pay [orderTotal]",{orderTotal:currencyFormat({amount:e.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:translate("By paying in USD, your card will be charged directly with no currency conversion. However, using a non-USD based card may result in additional currency conversion fees at the bank level."),dialogTitle:translate("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:function(){o.payInUsdConfirmDialogOpen=false},onConfirmClicked:function(){return o.handleStripePaymentContinue()}}),h("zonos-loading-overlay",{open:this.isOverlayLoading}))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return o}();ZonosInvoice.style=ZonosInvoiceStyle0;export{ZonosInvoice as zonos_invoice};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){"use strict";const t="zonos-analytic",n="zonos-analytics-relay-ping",e=["iglobalstores.com","zonos.com"],a="https://www.googletagmanager.com/gtag/js";function o(...t){"undefined"!=typeof window&&window.location.search.match(/\?.*(&*)zonosDebug=1/)&&console.log("[analyticsRelayOnInit]",...t)}function i(){return"function"==typeof window.gtag}async function r(t){var n;const e=window;return i()?(t&&/^G-[A-Z0-9]+$/i.test(t)&&(r=t,document.querySelector(`script[src^="${a}?"][src*="${r}"]`))&&(null===(n=e.gtag)||void 0===n||n.call(e,"config",t,{send_page_view:!1})),!0):t&&/^G-[A-Z0-9]+$/i.test(t)?(o("injecting GA script",t),await(function(t){return new Promise((n=>{window.dataLayer=window.dataLayer||[],window.gtag=function(){var t;null===(t=window.dataLayer)||void 0===t||t.push(arguments)},window.gtag("js",new Date);const e=document.createElement("script");e.async=!0,e.src=`${a}?id=${t}`,e.addEventListener("load",(()=>{var e;null===(e=window.gtag)||void 0===e||e.call(window,"config",t),n()})),e.addEventListener("error",(()=>n())),document.head.appendChild(e)}))})(t),i()):(o("no gtag and no valid googleAnalyticId",t),!1);var r}function c(a){if(o("message received",{data:a.data,origin:a.origin}),!(function(t){try{const n=new URL(t);if("https:"!==n.protocol)return!1;const a=n.hostname.toLowerCase();return e.some((t=>a===t||a.endsWith(`.${t}`)))}catch(t){return!1}})(a.origin))return void o("origin not allowed",a.origin);if((i=a.data)&&"object"==typeof i&&"type"in i&&i.type===n){const{googleAnalyticId:t}=a.data;return o("relay ping",{googleAnalyticId:t}),void r(t).then((t=>{if(o("gtag ready",t),t&&a.source)try{a.source.postMessage({type:"zonos-analytics-relay-ready"},a.origin),o("sent relay ready to iframe")}catch(t){}}))}var i;if(!(function(n){if(!n||"object"!=typeof n)return!1;const e=n;return e.type===t&&"string"==typeof e.event&&(void 0===e.metadata||"object"==typeof e.metadata&&null!==e.metadata)})(a.data))return void o("ignored payload (wrong type or missing event)",a.data);const c=window.gtag;if("function"!=typeof c)return void o("gtag not available, skipping event");const{event:d,metadata:s={}}=a.data;o("forwarding to gtag",d,s),c("event",d,s)}o("initializing analyticsRelayOnInit script"),window.addEventListener("message",c),o("analyticsRelayOnInit script initialized")})();
|
package/dist/scripts/index.d.ts
CHANGED
|
@@ -7538,6 +7538,15 @@ interface Zonos {
|
|
|
7538
7538
|
debug?: boolean;
|
|
7539
7539
|
domain: string;
|
|
7540
7540
|
doneInit: boolean;
|
|
7541
|
+
/**
|
|
7542
|
+
* Google Analytics 4 measurement ID (e.g. G-XXXXXXXXXX). Set from cart metadata or custom script.
|
|
7543
|
+
* When in iframe, used to tell parent's analyticsRelay to inject and configure GA.
|
|
7544
|
+
*/
|
|
7545
|
+
googleAnalyticId: string | null;
|
|
7546
|
+
/**
|
|
7547
|
+
* True when GA is enabled and ready (either not in iframe, or parent relay has confirmed gtag ready).
|
|
7548
|
+
*/
|
|
7549
|
+
googleAnalyticReady: boolean;
|
|
7541
7550
|
/**
|
|
7542
7551
|
* Log type for iframe, print out console or not
|
|
7543
7552
|
*/
|
|
@@ -7624,6 +7633,8 @@ declare abstract class Zonos {
|
|
|
7624
7633
|
static isBigCommerce: boolean;
|
|
7625
7634
|
static releaseDate: string;
|
|
7626
7635
|
static isLegacyCheckout: boolean;
|
|
7636
|
+
static googleAnalyticId: string | null;
|
|
7637
|
+
static googleAnalyticReady: boolean;
|
|
7627
7638
|
static startLoadTime: number;
|
|
7628
7639
|
static domain: string;
|
|
7629
7640
|
static showBaseForeign: boolean;
|
package/dist/scripts/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=({id:e,payload:t,target:o,type:n})=>{var r;o instanceof HTMLIFrameElement?null===(r=o.contentWindow)||void 0===r||r.postMessage({id:e,payload:t,type:n},"*"):o.postMessage({id:e,payload:t,type:n},"*")};class t{constructor(t,o){this.targetElement=t,this.targetId=o,this.sendMessage=(t,o)=>{e({id:this.targetId,payload:o,target:this.targetElement,type:t})}}}t.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},t.sendMessage=e,t.injectPrivateIframe=({id:e,onload:t,src:o})=>{const n=document.createElement("iframe");return n.src=o,n.id=e,n.style.display="none",n.role="presentation",n.ariaHidden="true",n.tabIndex=-1,n.style.border="none !important",n.style.margin="0px !important",n.style.padding="0px !important",n.style.width="1px !important",n.style.minWidth="100% !important",n.style.overflow="hidden !important",n.style.display="block !important",n.style.visibility="hidden !important",n.style.position="fixed !important",n.style.pointerEvents="none !important",n.style.userSelect="none !important",n.style.height="1px !important",n.onload=()=>t(n),document.body.appendChild(n),n};const o=performance.now(),n=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},r=(e,t,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const e=performance.now()-o,t=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:t}})(),l=[`(${a})`,...r];l.map(n).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(i=d.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(t){case"warn":c.warn(e,...l);break;case"info":c.info(e,...l);break;case"error":c.error(e,...l);break;default:c.groupCollapsed(e,...l),c.trace(),c.groupEnd()}},s=(e,...t)=>{r(e,"error",...t)},i=["jsdelivr","cdnjs","unpkg","vercel"],a="jsdelivr",l=e=>{const t=i.indexOf(e);return i[t+1]||null},d=()=>window.location.search.includes("zonosStagingMode=1"),c=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function u(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 p=["cloudflare","vercel"],m=p[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},h=w[m],y=(e=m)=>{const t=p.indexOf(e),o=p[t+1];return o||null},g=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},f=()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,t=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,t="mozConnection"in window.navigator?window.navigator.mozConnection:null,o="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||t||o})();return{connectionDownlink:null==t?void 0:t.downlink,connectionEffectiveType:null==t?void 0:t.effectiveType,connectionRtt:null==t?void 0:t.rtt,connectionSaveData:null==t?void 0:t.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}},v=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],b=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{const t=await e.text(),o=g(t);if(!o)throw new Error(`Failed to parse content: ${t}`);return o}catch(e){if(o)throw e;return t&&console.error(e),null}},S=async({basePathType:e,options:t,path:o})=>{let n;const r=window.Zonos.zonosQaUrlApi||w[e]||m,s=new URL(r+o),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));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 a=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:a}}const d=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const t=e.errors;return{baseUrl:r,errors:t.map((e=>"string"==typeof e?{message:e,type:d}:e)),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:d}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:a}}},C=async({basePathType:e,options:t,path:o})=>{var n,s;const i=o.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),l=await S({basePathType:i,options:t,path:o}),{errors:d,response:c}=l,p=u(l,["errors","response"]),m=performance.now()-a;r(`${o} (${m.toFixed(2)}ms)`,"info");const b=null==c?void 0:c.headers.get("Zonos-Duration");200===(null==c?void 0:c.status)&&(({apiPath:e,apiType:t,loadTimeInternal:o,loadTimeTotal:n})=>{if(v.includes(e))return;const r=n-o;if(r<0)return;const s=e.split("?")[0]||e,i=f(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:t,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:o,loadTimeTotal:n,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map((e=>e.brand)).filter((e=>!/Not.*A.*Brand.*/.test(e))).join(",")};var d;window.Zonos.loadTimeApiInfoList.push(l)})({apiPath:o,apiType:i,loadTimeInternal:b?Number(b):0,loadTimeTotal:m});const z=y(i),k=d.find((({type:e})=>"unknown"===e)),Z=d.find((({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted")))),j=!!k||404===(null==c?void 0:c.status)||500===(null==c?void 0:c.status),O=z&&j;return j&&!Z&&(async({endpoint:e,errors:t,metadata:o,shouldPostReleaseErrorReporting:n})=>{r("sendErrorLog","warn",e,o,t);{const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:t,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},o)};try{fetch(`${h}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=y();if(!t)return;fetch(`${w[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:w[i]+o,errors:d.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:z,requestHeaders:null==t?void 0:t.headers,requestPayload:g(null===(n=null==t?void 0:t.body)||void 0===n?void 0:n.toString())||(null===(s=null==t?void 0:t.body)||void 0===s?void 0:s.toString()),shouldCallFallback:O,status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),O?(r(`=== "${o}" failed to fetch, trying next fallback ${z}`),C({basePathType:z,options:t,path:o})):Object.assign({errors:d,response:c},p)},z=async(e,t)=>{const o=u(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-Staging-Mode":d()?"1":void 0,"Zonos-Test-Mode":c()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},o.headers);Object.keys(s).forEach((e=>void 0===s[e]&&delete s[e]));const i=Object.assign(Object.assign({},o),{body:"GET"===r?void 0:n,headers:s,method:r}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return C({basePathType:a||m,options:i,path:e})},k=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const t=(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),o="https://v1.3.247.js.zonos.com";if(!t&&(o.includes("test.")||o.includes("test-")))return o;if(!t&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const n=`https://${t}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${n}' for loading elements 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:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),n},Z="https://js.stripe.com/v3",j=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;let O=null;const I=e=>(null!==O||(O=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)t(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${Z}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&j.test(o.src))return o}return null})();n&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):n||(n=(e=>{const t=document.createElement("script");t.src=`${Z}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(s("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==n||n.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),O),A=Promise.resolve().then((()=>I(null)));let E=!1;A.catch((e=>{E||console.warn(e)}));const T=async({cartId:e,retries:t})=>{const o=c(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,i=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&i.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:a,json:l,zonosMode:d}=await z(`/api/zonos-elements/get-cart?${i.toString()}`,{body:{isTestMode:o,renewCartExpirationToken:s,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||a.length;return u&&t?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:t}),await new Promise((e=>setTimeout(e,500))),T({cartId:e,retries:t-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:d})},L=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,$=new RegExp(`^${L.source}$`),P=new RegExp(`^cart_${L.source}$`),U=/^[a-zA-Z0-9]{2,}$/,N=/^cart_[a-zA-Z0-9]{2,}$/,D=async e=>{const{isDgsCartId:t,isLegacyCartId:o}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:N.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:U.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:P.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:$.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!o&&!t)return s("[ZONOS - loadZonos] invalid cart id"),null;const n=await T({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},F="zonos--checkout-hidden-international-button";var M;const R=(()=>{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","dev.assets-checkout.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})(),x=Date.now(),B="https://v1.3.247.js.zonos.com",q=R||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.247",W="https://fonts.googleapis.com",K=/^https:\/\/fonts\.googleapis\.com/;class G{}M=G,G.doneInit=!1,G.cartSettings=null,G.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),G.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),G._paypalMockResponse=null,G.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,G.isBigCommerce=!1,G.releaseDate="1769706884126",G.isLegacyCheckout=!1,G.startLoadTime=x,G.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",G.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),G.overrideUseCustomAddressForm=!1,G.isCollect=!1,G.isInvoice=!1,G.isNpm=!0,G.zonosQaUrl=null,G.zonosQaUrlApi=null,G.trackEventLogs=[],G.version="v1.3.247",G.modeAlerted=!1,G.cartData=null,G.paypal=null,G.zonosMode=null,G.IframeService=t,G.getCurrentTimestamp=()=>(new Date).getTime(),G.zonosController=null,G.loadTimeApiInfoList=[],G.logIntervalId=null,G.init=async e=>{const{appearance:t,checkoutSettings:o,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:u,zonosApiKey:p}=e;if(M.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),M.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${M.version}) ======`),M.zonosApiKey=p,M.storeId=u,M.isNpm){r("====== ZONOS LOADING FROM NPM ======");const t=k();if(t&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${t} ======`,"info");const o=document.createElement("script");return o.src=`${t}/dist/scripts/zonos.js`,document.head.appendChild(o),o.addEventListener("load",(()=>{window.Zonos.isNpm=M.isNpm,window.Zonos.isBigCommerce=M.isBigCommerce,window.Zonos.isLegacyCheckout=M.isLegacyCheckout,window.Zonos.zonosMode=M.zonosMode,window.Zonos.init(e)})),o.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${t}`)})),void(window.isZonosPreview=!0)}if(!p&&!M.cartId)return void s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!M.cartData&&M.cartId){r("Initialize cart data");const e=await D(M.cartId);if(!e)return void s("Failed to get cart data");M.cartData=e.cartData,M.zonosApiKey=e.zonosApiKey,M.cartSettings=e.settings}const o=await(async()=>{const e=c(),t=d();if(!e&&!t||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:o,json:n}=await z("/api/get-test-public-credential");if(o.length||!n)return s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",o),null;const i=n.publicCredential;return i?(r(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(s("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();o&&(M.zonosApiKey=o)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(M.cartId&&M.cartData||!!m){r("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}r("init zonos"),M.restoreNativeBrowserFunctions(),M.injectCustomScriptForHostedCheckout(),M.injectZonosCdn(),M.injectZonosCss(),M.injectFonts(),M.injectCheckoutInternationalButton(),M.injectController({config:{appearance:t,checkoutSettings:o,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),M.doneInit=!0},G.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${F}`)){const e=document.createElement("button");e.id=F,e.style.display="none",document.body.appendChild(e)}},G.injectCustomScriptForHostedCheckout=()=>{const e=M.cartData,t=(null==e?void 0:e.metadata)||[],o=t.find((e=>"customHeaderScript"===e.key)),n=t.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(o||n)){if(o){r("Injecting custom header script");const e=document.createElement("script");e.textContent=o.value,document.head.appendChild(e)}if(n){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=n.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:n,headerScript:o,isLegacyCheckout:window.Zonos.isLegacyCheckout})},G.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},G.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${F}`);setTimeout((()=>{var t;e&&e.dispatchEvent(new CustomEvent("click",{detail:t}))}),10)},G.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},G.showNotification=e=>{var t;null===(t=M.zonosController)||void 0===t||t.showNotification(e)},G.updateOrganizationName=e=>{var t;null===(t=M.zonosController)||void 0===t||t.updateOrganizationName(e)},G.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)}},G.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const t="zonos---native-browser";let o=document.querySelector(`iframe#${t}`);o||(o=document.createElement("iframe"),o.id=t,o.style.display="none",o.style.opacity="0",o.style.position="absolute",o.style.top="-9999px",o.style.left="-9999px",o.style.width="1px",o.style.height="1px",o.style.border="none",o.style.overflow="hidden",o.style.visibility="hidden",document.body.appendChild(o));const n=(null===(e=o.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(o)},G.injectController=({config:e})=>{var t,o;if(document.querySelector("zonos-controller"))return;if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.placeOrderButtonSelector){const t=e.checkoutSettings.placeOrderButtonSelector;M.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{M.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.alwaysTriggerInternationalCheckoutSelector){const t=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;M.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{M.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}const n=document.createElement("zonos-controller");n.config=e,n.zonosApiKey=M.zonosApiKey||"",n.addEventListener("stripeInitEvent",(async e=>{const{detail:t}=e;r("loading Stripe");const o=await(async(...e)=>{E=!0;const t=Date.now();return A.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)))})(t.publishableKey);o?(window.Zonos.stripe=o,window.Zonos.isCollect?n.initCollectElement(o):window.Zonos.isInvoice?n.initInvoiceElement(o):n.initCheckoutElement(o)):s("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(n),M.zonosController=n,r("Zonos controller injected!")},G.injectScript=({cdnType:e,isModule:t,theRestUrl:o})=>{const n=`${M.getZonosUrl(e)}/${o}`;if(document.querySelector(`script[src="${n}"]`))return void r(`Zonos script "${n}" already exists in the document`,"warn");const i=document.head||document.body,a=document.createElement("script");t?a.type="module":a.noModule=!0,a.src=n,a.crossOrigin="anonymous",a.onerror=()=>{s(`Failed to load ${a.src}`);const n=l(e);n&&M.injectScript({cdnType:n,isModule:t,theRestUrl:o})},i.appendChild(a)},G.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return q;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.247";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.247";case"vercel":return B}};if(M.isNpm){return k()||t()}return t()},G.injectZonosCdn=()=>{M.injectScript({cdnType:a,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),M.injectScript({cdnType:a,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},G.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=M.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${B}/`,n.appendChild(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${o}/${t}`,i.onerror=()=>{s(`Failed to load ${i.href}`);const o=l(e);o&&M.injectStylesheet({cdnType:o,theRestUrl:t})},n.appendChild(i)},G.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(M.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},G.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${W}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!K.test(o.href))return o}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=W,e.appendChild(t);const o=document.createElement("link");o.rel="stylesheet",o.href=`${W}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(o),r("Zonos font injected!")},G.setupGoogleFont=e=>{var t;null===(t=M.zonosController)||void 0===t||t.setupGoogleFont(e)},G.injectSupportGoogleFont=e=>{var t;r(`[FONT] injecting ${e}`);const o=null===(t=e.match(/family=(.*?):/))||void 0===t?void 0:t[1],n=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${W}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=W,n.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,n.appendChild(s),r(`[FONT] ${o} font injected!`)},exports.Zonos=G})();
|
|
1
|
+
(function(){"use strict";const e=({id:e,payload:o,target:t,type:n})=>{var r;t instanceof HTMLIFrameElement?null===(r=t.contentWindow)||void 0===r||r.postMessage({id:e,payload:o,type:n},"*"):t.postMessage({id:e,payload:o,type:n},"*")};class o{constructor(o,t){this.targetElement=o,this.targetId=t,this.sendMessage=(o,t)=>{e({id:this.targetId,payload:t,target:this.targetElement,type:o})}}}o.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},o.sendMessage=e,o.injectPrivateIframe=({id:e,onload:o,src:t})=>{const n=document.createElement("iframe");return n.src=t,n.id=e,n.style.display="none",n.role="presentation",n.ariaHidden="true",n.tabIndex=-1,n.style.border="none !important",n.style.margin="0px !important",n.style.padding="0px !important",n.style.width="1px !important",n.style.minWidth="100% !important",n.style.overflow="hidden !important",n.style.display="block !important",n.style.visibility="hidden !important",n.style.position="fixed !important",n.style.pointerEvents="none !important",n.style.userSelect="none !important",n.style.height="1px !important",n.onload=()=>o(n),document.body.appendChild(n),n};const t=performance.now(),n=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},r=(e,o,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const e=performance.now()-t,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(n).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(i=d.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(o){case"warn":c.warn(e,...l);break;case"info":c.info(e,...l);break;case"error":c.error(e,...l);break;default:c.groupCollapsed(e,...l),c.trace(),c.groupEnd()}},s=(e,...o)=>{r(e,"error",...o)},i=["jsdelivr","cdnjs","unpkg","vercel"],a="jsdelivr",l=e=>{const o=i.indexOf(e);return i[o+1]||null},d=()=>window.location.search.includes("zonosStagingMode=1"),c=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function u(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const p=["cloudflare","vercel"],m=p[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},h=w[m],y=(e=m)=>{const o=p.indexOf(e),t=p[o+1];return t||null},g=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},f=()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}},v=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],b=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=g(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},S=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||w[e]||m,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:a}}const d=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map((e=>"string"==typeof e?{message:e,type:d}:e)),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:d}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:a}}},C=async({basePathType:e,options:o,path:t})=>{var n,s;const i=t.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),l=await S({basePathType:i,options:o,path:t}),{errors:d,response:c}=l,p=u(l,["errors","response"]),m=performance.now()-a;r(`${t} (${m.toFixed(2)}ms)`,"info");const b=null==c?void 0:c.headers.get("Zonos-Duration");200===(null==c?void 0:c.status)&&(({apiPath:e,apiType:o,loadTimeInternal:t,loadTimeTotal:n})=>{if(v.includes(e))return;const r=n-t;if(r<0)return;const s=e.split("?")[0]||e,i=f(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:t,loadTimeTotal:n,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map((e=>e.brand)).filter((e=>!/Not.*A.*Brand.*/.test(e))).join(",")};var d;window.Zonos.loadTimeApiInfoList.push(l)})({apiPath:t,apiType:i,loadTimeInternal:b?Number(b):0,loadTimeTotal:m});const z=y(i),k=d.find((({type:e})=>"unknown"===e)),Z=d.find((({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted")))),j=!!k||404===(null==c?void 0:c.status)||500===(null==c?void 0:c.status),O=z&&j;return j&&!Z&&(async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:n})=>{r("sendErrorLog","warn",e,t,o);{const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},t)};try{fetch(`${h}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=y();if(!o)return;fetch(`${w[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:w[i]+t,errors:d.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:z,requestHeaders:null==o?void 0:o.headers,requestPayload:g(null===(n=null==o?void 0:o.body)||void 0===n?void 0:n.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),shouldCallFallback:O,status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),O?(r(`=== "${t}" failed to fetch, trying next fallback ${z}`),C({basePathType:z,options:o,path:t})):Object.assign({errors:d,response:c},p)},z=async(e,o)=>{const t=u(o||{},[]),n=t.body?JSON.stringify(t.body):void 0,r=t.method||"GET",s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":d()?"1":void 0,"Zonos-Test-Mode":c()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers);Object.keys(s).forEach((e=>void 0===s[e]&&delete s[e]));const i=Object.assign(Object.assign({},t),{body:"GET"===r?void 0:n,headers:s,method:r}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return C({basePathType:a||m,options:i,path:e})},k=()=>{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),t="https://v1.3.248.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.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 r(`[ZONOS-WARNING] using '${n}' for loading elements 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,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),n},Z="https://js.stripe.com/v3",j=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;let O=null;const I=e=>(null!==O||(O=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)o(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${Z}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&j.test(t.src))return t}return null})();n&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):n||(n=(e=>{const o=document.createElement("script");o.src=`${Z}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(s("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==n||n.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),O),A=Promise.resolve().then((()=>I(null)));let E=!1;A.catch((e=>{E||console.warn(e)}));const T=async({cartId:e,retries:o})=>{const t=c(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,i=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&i.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:a,json:l,zonosMode:d}=await z(`/api/zonos-elements/get-cart?${i.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:s,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||a.length;return u&&o?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),T({cartId:e,retries:o-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:d})},L=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,$=new RegExp(`^${L.source}$`),P=new RegExp(`^cart_${L.source}$`),U=/^[a-zA-Z0-9]{2,}$/,N=/^cart_[a-zA-Z0-9]{2,}$/,D=async e=>{const{isDgsCartId:o,isLegacyCartId:t}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:N.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:U.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:P.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:$.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!t&&!o)return s("[ZONOS - loadZonos] invalid cart id"),null;const n=await T({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},F="zonos--checkout-hidden-international-button";var R;const M=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),x=Date.now(),B="https://v1.3.248.js.zonos.com",q=M||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.248",W="https://fonts.googleapis.com",K=/^https:\/\/fonts\.googleapis\.com/;class G{}R=G,G.doneInit=!1,G.cartSettings=null,G.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),G.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),G._paypalMockResponse=null,G.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,G.isBigCommerce=!1,G.releaseDate="1772221128718",G.isLegacyCheckout=!1,G.googleAnalyticId=null,G.googleAnalyticReady=!1,G.startLoadTime=x,G.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",G.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),G.overrideUseCustomAddressForm=!1,G.isCollect=!1,G.isInvoice=!1,G.isNpm=!0,G.zonosQaUrl=null,G.zonosQaUrlApi=null,G.trackEventLogs=[],G.version="v1.3.248",G.modeAlerted=!1,G.cartData=null,G.paypal=null,G.zonosMode=null,G.IframeService=o,G.getCurrentTimestamp=()=>(new Date).getTime(),G.zonosController=null,G.loadTimeApiInfoList=[],G.logIntervalId=null,G.init=async e=>{const{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:u,zonosApiKey:p}=e;if(R.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),R.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${R.version}) ======`),R.zonosApiKey=p,R.storeId=u,"undefined"!=typeof window&&window.parent===window&&(R.googleAnalyticReady=!0),R.isNpm){r("====== ZONOS LOADING FROM NPM ======");const o=k();if(o&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const t=document.createElement("script");return t.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(t),t.addEventListener("load",(()=>{window.Zonos.isNpm=R.isNpm,window.Zonos.isBigCommerce=R.isBigCommerce,window.Zonos.isLegacyCheckout=R.isLegacyCheckout,window.Zonos.zonosMode=R.zonosMode,window.Zonos.init(e)})),t.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!p&&!R.cartId)return void s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!R.cartData&&R.cartId){r("Initialize cart data");const e=await D(R.cartId);if(!e)return void s("Failed to get cart data");R.cartData=e.cartData,R.zonosApiKey=e.zonosApiKey,R.cartSettings=e.settings}const t=await(async()=>{const e=c(),o=d();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:t,json:n}=await z("/api/get-test-public-credential");if(t.length||!n)return s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t),null;const i=n.publicCredential;return i?(r(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(s("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();t&&(R.zonosApiKey=t)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(R.cartId&&R.cartData||!!m){r("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}r("init zonos"),R.restoreNativeBrowserFunctions(),R.injectCustomScriptForHostedCheckout(),R.injectZonosCdn(),R.injectZonosCss(),R.injectFonts(),R.injectCheckoutInternationalButton(),R.injectController({config:{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),R.doneInit=!0},G.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${F}`)){const e=document.createElement("button");e.id=F,e.style.display="none",document.body.appendChild(e)}},G.injectCustomScriptForHostedCheckout=()=>{const e=R.cartData,o=(null==e?void 0:e.metadata)||[],t=o.find((e=>"customHeaderScript"===e.key)),n=o.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(t||n)){if(t){r("Injecting custom header script");const e=document.createElement("script");e.textContent=t.value,document.head.appendChild(e)}if(n){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=n.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:n,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout})},G.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},G.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${F}`);setTimeout((()=>{var o;e&&e.dispatchEvent(new CustomEvent("click",{detail:o}))}),10)},G.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},G.showNotification=e=>{var o;null===(o=R.zonosController)||void 0===o||o.showNotification(e)},G.updateOrganizationName=e=>{var o;null===(o=R.zonosController)||void 0===o||o.updateOrganizationName(e)},G.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},G.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const o="zonos---native-browser";let t=document.querySelector(`iframe#${o}`);t||(t=document.createElement("iframe"),t.id=o,t.style.display="none",t.style.opacity="0",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.border="none",t.style.overflow="hidden",t.style.visibility="hidden",document.body.appendChild(t));const n=(null===(e=t.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(t)},G.injectController=({config:e})=>{var o,t;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.alwaysTriggerInternationalCheckoutSelector){const o=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const n=document.createElement("zonos-controller");n.config=e,n.zonosApiKey=R.zonosApiKey||"",n.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;r("loading Stripe");const t=await(async(...e)=>{E=!0;const o=Date.now();return A.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);t?(window.Zonos.stripe=t,window.Zonos.isCollect?n.initCollectElement(t):window.Zonos.isInvoice?n.initInvoiceElement(t):n.initCheckoutElement(t)):s("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(n),R.zonosController=n,r("Zonos controller injected!")},G.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${R.getZonosUrl(e)}/${t}`;if(document.querySelector(`script[src="${n}"]`))return void r(`Zonos script "${n}" already exists in the document`,"warn");const i=document.head||document.body,a=document.createElement("script");o?a.type="module":a.noModule=!0,a.src=n,a.crossOrigin="anonymous",a.onerror=()=>{s(`Failed to load ${a.src}`);const n=l(e);n&&R.injectScript({cdnType:n,isModule:o,theRestUrl:t})},i.appendChild(a)},G.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return q;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.248";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.248";case"vercel":return B}};if(R.isNpm){return k()||o()}return o()},G.injectZonosCdn=()=>{R.injectScript({cdnType:a,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),R.injectScript({cdnType:a,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},G.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=R.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${B}/`,n.appendChild(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${o}`,i.onerror=()=>{s(`Failed to load ${i.href}`);const t=l(e);t&&R.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(i)},G.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(R.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},G.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${W}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!K.test(t.href))return t}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=W,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${W}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(t),r("Zonos font injected!")},G.setupGoogleFont=e=>{var o;null===(o=R.zonosController)||void 0===o||o.setupGoogleFont(e)},G.injectSupportGoogleFont=e=>{var o;r(`[FONT] injecting ${e}`);const t=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],n=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${W}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=W,n.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${t} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,n.appendChild(s),r(`[FONT] ${t} font injected!`)},exports.Zonos=G})();
|