@zonos/elements 1.3.285 → 1.3.286
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-94908542.js → cart-0cf8897b.js} +26 -3
- package/dist/cjs/{collect-0c05e2b4.js → collect-79131e52.js} +1 -1
- package/dist/cjs/{getMissingRequiredShippingFields-124b3f20.js → getMissingRequiredShippingFields-a8f04267.js} +1 -1
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/{invoice-205fb5bc.js → invoice-254ae23b.js} +1 -1
- package/dist/cjs/{paypal-45ca5301.js → paypal-8ca67278.js} +1 -1
- package/dist/cjs/{placeTestOrder-302b6862.js → placeTestOrder-12b63822.js} +1 -1
- package/dist/cjs/{renderCheckoutCurrency-1b0cd5f2.js → renderCheckoutCurrency-a1f71587.js} +1 -1
- package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +2 -2
- package/dist/cjs/zonos-address_4.cjs.entry.js +1 -1
- package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +2 -2
- package/dist/cjs/zonos-card_5.cjs.entry.js +2 -2
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +21 -9
- package/dist/cjs/zonos-checkout.cjs.entry.js +103 -5
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +1 -1
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +5 -5
- package/dist/cjs/zonos-collect.cjs.entry.js +3 -3
- package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +3 -3
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +5 -5
- package/dist/cjs/zonos-invoice.cjs.entry.js +3 -3
- package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +17 -5
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +104 -5
- package/dist/collection/components/store/checkout/cart.js +14 -1
- package/dist/collection/components/utils/validateCheckoutSession.js +11 -3
- package/dist/collection/types/generated/graphql.frontend.types.js +2 -0
- package/dist/collection/types/generated/graphql.internal.types.js +71 -6
- package/dist/esm/{cart-2e407f7b.js → cart-d04742f5.js} +25 -4
- package/dist/esm/{collect-19428e18.js → collect-4c310a16.js} +1 -1
- package/dist/esm/{getMissingRequiredShippingFields-719b206f.js → getMissingRequiredShippingFields-f0878e32.js} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/{invoice-67a47785.js → invoice-86487dac.js} +1 -1
- package/dist/esm/{paypal-6dca6567.js → paypal-997935ab.js} +1 -1
- package/dist/esm/{placeTestOrder-9563c89a.js → placeTestOrder-a53f2056.js} +1 -1
- package/dist/esm/{renderCheckoutCurrency-282384f0.js → renderCheckoutCurrency-e0e16eb7.js} +1 -1
- package/dist/esm/zonos-address-completion-dialog_7.entry.js +2 -2
- package/dist/esm/zonos-address_4.entry.js +1 -1
- package/dist/esm/zonos-airwallex-payment.entry.js +2 -2
- package/dist/esm/zonos-card_5.entry.js +2 -2
- package/dist/esm/zonos-cart-items_12.entry.js +21 -9
- package/dist/esm/zonos-checkout.entry.js +103 -5
- package/dist/esm/zonos-collect-cart-items_3.entry.js +1 -1
- package/dist/esm/zonos-collect-finish_6.entry.js +5 -5
- package/dist/esm/zonos-collect.entry.js +3 -3
- package/dist/esm/zonos-controller.entry.js +1 -1
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +3 -3
- package/dist/esm/zonos-invoice-finish_5.entry.js +5 -5
- package/dist/esm/zonos-invoice.entry.js +3 -3
- package/dist/esm/zonos-policy-consent_2.entry.js +2 -2
- package/dist/esm-es5/cart-d04742f5.js +1 -0
- package/dist/esm-es5/{collect-19428e18.js → collect-4c310a16.js} +1 -1
- package/dist/esm-es5/getMissingRequiredShippingFields-f0878e32.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{invoice-67a47785.js → invoice-86487dac.js} +1 -1
- package/dist/esm-es5/{paypal-6dca6567.js → paypal-997935ab.js} +1 -1
- package/dist/esm-es5/{placeTestOrder-9563c89a.js → placeTestOrder-a53f2056.js} +1 -1
- package/dist/esm-es5/{renderCheckoutCurrency-282384f0.js → renderCheckoutCurrency-e0e16eb7.js} +1 -1
- package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +1 -1
- package/dist/esm-es5/zonos-address_4.entry.js +1 -1
- package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
- package/dist/esm-es5/zonos-card_5.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +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/esm-es5/zonos-policy-consent_2.entry.js +1 -1
- package/dist/scripts/index.d.ts +37 -34
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +14 -0
- package/dist/types/components/store/checkout/cart.d.ts +10 -1
- package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +24 -24
- package/dist/types/types/generated/graphql.frontend.types.d.ts +2 -0
- package/dist/types/types/generated/graphql.frontend.types.ts +2 -0
- package/dist/types/types/generated/graphql.internal.types.d.ts +188 -98
- package/dist/types/types/generated/graphql.internal.types.ts +200 -93
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-dd3c00d6.system.entry.js → p-0c327a57.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e32ee011.system.entry.js → p-117953db.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-260ad739.system.entry.js → p-1cfb5c2a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-f4acce01.js → p-277b77e3.js} +1 -1
- package/dist/zonos-elements/{p-ae0de3e4.entry.js → p-278abdcf.entry.js} +1 -1
- package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
- package/dist/zonos-elements/{p-e5c76a9b.js → p-344a6278.js} +2 -2
- package/dist/zonos-elements/{p-f59a0129.system.entry.js → p-3a26e5e7.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-94722bf6.system.entry.js → p-40af92a1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e8587f9f.system.entry.js → p-41f1697a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e2b4c082.system.entry.js → p-490d7fec.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1277abac.system.entry.js → p-4941c096.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d20fe2c2.system.entry.js → p-50d088f7.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8311edc7.entry.js → p-5227aa69.entry.js} +1 -1
- package/dist/zonos-elements/{p-bced320e.entry.js → p-5d110c2b.entry.js} +1 -1
- package/dist/zonos-elements/{p-b1e95f95.entry.js → p-6de2f9c9.entry.js} +1 -1
- package/dist/zonos-elements/{p-6dde1e85.system.entry.js → p-6eaf7c9e.system.entry.js} +1 -1
- package/dist/zonos-elements/p-7352abe9.js +1 -0
- package/dist/zonos-elements/{p-fe5f05fc.system.js → p-74230da8.system.js} +1 -1
- package/dist/zonos-elements/{p-22e10b7d.entry.js → p-77993ba1.entry.js} +1 -1
- package/dist/zonos-elements/p-78f8e594.entry.js +1 -0
- package/dist/zonos-elements/p-7b525c75.system.js +1 -0
- package/dist/zonos-elements/p-7f688485.system.entry.js +1 -0
- package/dist/zonos-elements/p-8861d47e.js +1 -0
- package/dist/zonos-elements/p-8d14cb66.entry.js +1 -0
- package/dist/zonos-elements/{p-a07e5011.entry.js → p-944c1fb3.entry.js} +1 -1
- package/dist/zonos-elements/{p-cb49dcfe.entry.js → p-96ab529e.entry.js} +1 -1
- package/dist/zonos-elements/{p-eb5f3451.system.js → p-998975a3.system.js} +1 -1
- package/dist/zonos-elements/p-a4c7ee17.js +1 -0
- package/dist/zonos-elements/{p-3a13e58c.system.js → p-c0af11fe.system.js} +1 -1
- package/dist/zonos-elements/p-c112fa12.system.entry.js +1 -0
- package/dist/zonos-elements/{p-2b8c96e3.system.js → p-c4321a1a.system.js} +1 -1
- package/dist/zonos-elements/{p-aecb5d61.entry.js → p-c7329333.entry.js} +1 -1
- package/dist/zonos-elements/{p-6695de06.system.js → p-c756a59d.system.js} +1 -1
- package/dist/zonos-elements/p-d1a51fac.js +1 -0
- package/dist/zonos-elements/{p-d42bd250.system.entry.js → p-d75726e5.system.entry.js} +1 -1
- package/dist/zonos-elements/p-dd866ca3.system.entry.js +1 -0
- package/dist/zonos-elements/{p-8bfe5b2b.entry.js → p-dd8a7bf4.entry.js} +1 -1
- package/dist/zonos-elements/p-e4dc24e1.system.js +1 -0
- package/dist/zonos-elements/{p-60a6b71d.system.js → p-e5865ad9.system.js} +1 -1
- package/dist/zonos-elements/{p-65c1f51e.entry.js → p-e7d7afda.entry.js} +1 -1
- package/dist/zonos-elements/p-f9346f1c.entry.js +1 -0
- package/dist/zonos-elements/{p-0c9fec73.js → p-fc5f6113.js} +1 -1
- package/dist/zonos-elements/p-fe28dbe6.entry.js +1 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-2e407f7b.js +0 -1
- package/dist/esm-es5/getMissingRequiredShippingFields-719b206f.js +0 -1
- package/dist/zonos-elements/p-2c2afed4.entry.js +0 -1
- package/dist/zonos-elements/p-2cdd1b49.system.entry.js +0 -1
- package/dist/zonos-elements/p-46cd14e5.js +0 -1
- package/dist/zonos-elements/p-4a20893e.system.js +0 -1
- package/dist/zonos-elements/p-5a491f28.js +0 -1
- package/dist/zonos-elements/p-5ebb7ae6.entry.js +0 -1
- package/dist/zonos-elements/p-62f6a757.entry.js +0 -1
- package/dist/zonos-elements/p-8b298971.system.entry.js +0 -1
- package/dist/zonos-elements/p-a9ad74e5.system.entry.js +0 -1
- package/dist/zonos-elements/p-c1631c9c.js +0 -1
- package/dist/zonos-elements/p-cb4cb5a3.system.js +0 -1
- package/dist/zonos-elements/p-dc80cb87.js +0 -1
- package/dist/zonos-elements/p-ff4e6811.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,n,t,a){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,s){function o(e){try{l(a.next(e))}catch(e){s(e)}}function r(e){try{l(a["throw"](e))}catch(e){s(e)}}function l(e){e.done?t(e.value):i(e.value).then(o,r)}l((a=a.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},a,i,s,o;return o={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function r(e){return function(n){return l([e,n])}}function l(r){if(a)throw new TypeError("Generator is already executing.");while(o&&(o=0,r[0]&&(t=0)),t)try{if(a=1,i&&(s=r[0]&2?i["return"]:r[0]?i["throw"]||((s=i["return"])&&s.call(i),0):i.next)&&!(s=s.call(i,r[1])).done)return s;if(i=0,s)r=[r[0]&2,s.value];switch(r[0]){case 0:case 1:s=r;break;case 4:t.label++;return{value:r[1],done:false};case 5:t.label++;i=r[1];r=[0];continue;case 7:r=t.ops.pop();t.trys.pop();continue;default:if(!(s=t.trys,s=s.length>0&&s[s.length-1])&&(r[0]===6||r[0]===2)){t=0;continue}if(r[0]===3&&(!s||r[1]>s[0]&&r[1]<s[3])){t.label=r[1];break}if(r[0]===6&&t.label<s[1]){t.label=s[1];s=r;break}if(s&&t.label<s[2]){t.label=s[2];t.ops.push(r);break}if(s[2])t.ops.pop();t.trys.pop();continue}r=n.call(e,t)}catch(e){r=[6,e];i=0}finally{a=s=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};System.register(["./p-7261e245.system.js","./p-
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,n,t,a){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,s){function o(e){try{l(a.next(e))}catch(e){s(e)}}function r(e){try{l(a["throw"](e))}catch(e){s(e)}}function l(e){e.done?t(e.value):i(e.value).then(o,r)}l((a=a.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},a,i,s,o;return o={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function r(e){return function(n){return l([e,n])}}function l(r){if(a)throw new TypeError("Generator is already executing.");while(o&&(o=0,r[0]&&(t=0)),t)try{if(a=1,i&&(s=r[0]&2?i["return"]:r[0]?i["throw"]||((s=i["return"])&&s.call(i),0):i.next)&&!(s=s.call(i,r[1])).done)return s;if(i=0,s)r=[r[0]&2,s.value];switch(r[0]){case 0:case 1:s=r;break;case 4:t.label++;return{value:r[1],done:false};case 5:t.label++;i=r[1];r=[0];continue;case 7:r=t.ops.pop();t.trys.pop();continue;default:if(!(s=t.trys,s=s.length>0&&s[s.length-1])&&(r[0]===6||r[0]===2)){t=0;continue}if(r[0]===3&&(!s||r[1]>s[0]&&r[1]<s[3])){t.label=r[1];break}if(r[0]===6&&t.label<s[1]){t.label=s[1];s=r;break}if(s&&t.label<s[2]){t.label=s[2];t.ops.push(r);break}if(s[2])t.ops.pop();t.trys.pop();continue}r=n.call(e,t)}catch(e){r=[6,e];i=0}finally{a=s=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};System.register(["./p-7261e245.system.js","./p-c4321a1a.system.js","./p-e4dc24e1.system.js","./p-916228fb.system.js","./p-de58684b.system.js","./p-d938f42f.system.js","./p-01174496.system.js","./p-6890e060.system.js","./p-14afffa8.system.js","./p-989cb22b.system.js"],(function(e){"use strict";var n,t,a,i,s,o,r,l,c,u,f,h,m,y,p,w,x,z;return{setters:[function(e){n=e.r;t=e.d;a=e.h;i=e.a;s=e.g},function(e){o=e.b;r=e.c;l=e.f;c=e.l;u=e.m;f=e.n},function(e){h=e.d},function(e){m=e.e;y=e.t;p=e.l},function(e){w=e.z},function(e){x=e.l},function(e){z=e.l},function(){},function(){},function(){}],execute:function(){var d=".sc-zonos-airwallex-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-airwallex-payment-h *.sc-zonos-airwallex-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-airwallex-payment-h img.sc-zonos-airwallex-payment{max-width:100%}.sc-zonos-airwallex-payment-h dl.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h dd.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h1.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h2.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h3.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h4.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h5.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h6.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h hr.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h figure.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h p.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h pre.sc-zonos-airwallex-payment{margin:0}.sc-zonos-airwallex-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-airwallex-payment-h{display:block}.sc-zonos-airwallex-payment-h .zonos--payment-error-banner.sc-zonos-airwallex-payment{margin-bottom:16px}.sc-zonos-airwallex-payment-h .zonos--airwallex-payment-component.sc-zonos-airwallex-payment{margin-bottom:4px;min-height:40px}";var b=d;var v=e("zonos_airwallex_payment",function(){function e(e){var a=this;n(this,e);this.airwallexPaymentSuccess=t(this,"airwallexPaymentSuccess",7);this.airwallexPaymentError=t(this,"airwallexPaymentError",7);this.element=null;this.storeUnsubscribeList=[];this.mountingClientSecret=null;this.hasError=false;this.clientSecret=o.clientSecret;this.getDropInOptions=function(e){var n;var t=w.checkoutSettings.captureDelay&&w.checkoutSettings.captureDelay>0;return{autoCapture:!t,client_secret:e,country_code:((n=r.shippingAddress)===null||n===void 0?void 0:n.location.countryCode)||undefined,currency:o.currency||h.currency,intent_id:o.paymentIntentId||undefined}};this.mountPaymentElement=function(){return __awaiter(a,void 0,void 0,(function(){var e,n,t,a,i,s;var r=this;return __generator(this,(function(u){switch(u.label){case 0:n=this.clientSecret;if(!n){return[2]}if(this.mountingClientSecret===n){return[2]}this.mountingClientSecret=n;return[4,l()];case 1:t=u.sent();if(!t){this.hasError=true;this.mountingClientSecret=null;return[2]}a=this.el.querySelector(".zonos--airwallex-payment-component");if(!a){z("Cannot find container element for Airwallex payment element");this.hasError=true;this.mountingClientSecret=null;return[2]}u.label=2;case 2:u.trys.push([2,4,,5]);(e=this.element)===null||e===void 0?void 0:e.destroy();this.element=null;return[4,c("dropIn",this.getDropInOptions(n))];case 3:i=u.sent();if(!i){z("Failed to create Airwallex payment element");this.hasError=true;this.mountingClientSecret=null;return[2]}i.mount(a);i.on("success",(function(){x("Airwallex payment succeeded");o.hasPaymentError=false;o.paymentConfirmed=true;r.airwallexPaymentSuccess.emit()}));i.on("error",(function(e){z(e);o.hasPaymentError=true;r.airwallexPaymentError.emit()}));this.element=i;this.hasError=false;return[3,5];case 4:s=u.sent();z(s);this.hasError=true;this.mountingClientSecret=null;return[3,5];case 5:return[2]}}))}))};this.localeChangeHandler=function(){if(!a.element||!a.clientSecret){return}a.element.update(a.getDropInOptions(a.clientSecret),{locale:u(p.selectedLocale)})}}e.prototype.clientSecretWatcher=function(){void this.mountPaymentElement()};e.prototype.componentWillLoad=function(){var e=this;this.storeUnsubscribeList=[f("clientSecret",(function(n){e.clientSecret=n})),m("selectedLocale",this.localeChangeHandler)]};e.prototype.componentDidLoad=function(){void this.mountPaymentElement()};e.prototype.disconnectedCallback=function(){var e;this.storeUnsubscribeList.forEach((function(e){return e()}));(e=this.element)===null||e===void 0?void 0:e.destroy();this.element=null};e.prototype.render=function(){return a(i,{key:"3d5f4aaea91533348ae6273757b8af6f17a7ab59",class:"zonos--airwallex-payment zonos--elements"},this.hasError&&a("zonos-banner",{key:"27fe7775145b9ff4f9b572ee592eb0cdc5f2ef13",class:"zonos--payment-error-banner",intent:"error"},y("We couldn't complete your payment. Please verify the payment details and try again.")),a("div",{key:"48a50ebcc6ad1e3b3cbf807ef5d466030995a171",class:"zonos--airwallex-payment-component"}))};Object.defineProperty(e.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{clientSecret:["clientSecretWatcher"]}},enumerable:false,configurable:true});return e}());v.style=b}}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(o,n,e,i){function s(o){return o instanceof e?o:new e((function(n){n(o)}))}return new(e||(e=Promise))((function(e,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?e(o.value):s(o.value).then(c,r)}a((i=i.apply(o,n||[])).next())}))};var __generator=this&&this.__generator||function(o,n){var e={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(n){return a([o,n])}}function a(r){if(i)throw new TypeError("Generator is already executing.");while(c&&(c=0,r[0]&&(e=0)),e)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:e.label++;return{value:r[1],done:false};case 5:e.label++;s=r[1];r=[0];continue;case 7:r=e.ops.pop();e.trys.pop();continue;default:if(!(t=e.trys,t=t.length>0&&t[t.length-1])&&(r[0]===6||r[0]===2)){e=0;continue}if(r[0]===3&&(!t||r[1]>t[0]&&r[1]<t[3])){e.label=r[1];break}if(r[0]===6&&e.label<t[1]){e.label=t[1];t=r;break}if(t&&e.label<t[2]){e.label=t[2];e.ops.push(r);break}if(t[2])e.ops.pop();e.trys.pop();continue}r=n.call(o,e)}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}}};System.register(["./p-7261e245.system.js","./p-4a20893e.system.js","./p-fe5f05fc.system.js","./p-eb5f3451.system.js","./p-916228fb.system.js","./p-de58684b.system.js","./p-398d9022.system.js","./p-01174496.system.js","./p-6f23a26a.system.js","./p-23e7c655.system.js","./p-d938f42f.system.js","./p-6890e060.system.js","./p-14afffa8.system.js","./p-989cb22b.system.js","./p-7fbbdb0f.system.js","./p-af19722c.system.js"],(function(o){"use strict";var n,e,i,s,t,c,r,a,l,v,z,d,h,u,f,m,p,g,b,w,x,y,k,_,C,I,S,j,O,T,E,L,U,P,N,A,D,B,R;return{setters:[function(o){n=o.r;e=o.h;i=o.a;s=o.F},function(o){t=o.b;c=o.i;r=o.c;a=o.d;l=o.o;v=o.e;z=o.j;d=o.k;h=o.x;u=o.C;f=o.H;m=o.F;p=o.f},function(o){g=o.i;b=o.a;w=o.b;x=o.c},function(o){y=o.p;k=o.a},function(o){_=o.s;C=o.t;I=o.e;S=o.h;j=o.k;O=o.l},function(o){T=o.z},function(o){E=o.b},function(o){L=o.h;U=o.s;P=o.l;N=o.g},function(o){A=o.i;D=o.a},function(o){B=o.c},function(o){R=o.l},function(){},function(){},function(){},function(){},function(){}],execute:function(){var F='<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 V=".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 H=V;var K=o("zonos_invoice",function(){function o(o){var e=this;n(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=t.clientSecret;this.stripeCustomerSessionClientSecret=t.stripeCustomerSessionClientSecret;this.getBaseCurrencySettlementInfo=function(){var o=a.selectedLandedCost;if(!o){return null}var n=o.landedCost.amountSubtotals;if(!n){return null}var e=(n.discounts||0)+n.items+n.landedCostTotal+n.shipping;return{settlementAmount:e}};this.applyStripeTheme=function(){return __awaiter(e,void 0,void 0,(function(){var o;return __generator(this,(function(n){switch(n.label){case 0:o=T.appearance.theme;return[4,c({overrideTheme:this.isMobile?o:undefined,paypalEnabled:y()})];case 1:n.sent();return[2]}}))}))};this.fetchCheckoutSession=function(o){return __awaiter(e,void 0,void 0,(function(){var n;return __generator(this,(function(e){switch(e.label){case 0:return[4,L("/api/zonos-elements/collect/get-checkout-session",{body:{checkoutSessionId:o},method:"POST"})];case 1:n=e.sent().json;return[2,n]}}))}))};this.checkStripePaymentIntentStatus=function(){return __awaiter(e,void 0,void 0,(function(){var o,n,e,i,s,c,a,l,v,z;return __generator(this,(function(d){switch(d.label){case 0:n=!!window.Zonos.cartData;e=new URL(window.location.href).searchParams;i=e.get("payment_intent_client_secret");s=e.get("zonosCheckoutSessionId");R("Payment intent exist, checking stripe payment intent status");if(!i){R("No stripe client secret found in the URL, proceed to order if cart data is available");return[2,{shouldAllowOrder:n}]}return[4,r({clientSecret:i})];case 1:c=d.sent(),a=c.error,l=c.status;v=new URLSearchParams(window.location.search).get("redirect_status");if(!(v&&s))return[3,3];if(!a){R("Payment intent is succeeded or in a good state to move forward, show success screen")}else{R("Payment intent failed, show status from error")}return[4,this.fetchCheckoutSession(s)];case 2:z=d.sent();this.confirmationId=((o=z===null||z===void 0?void 0:z.checkoutSession.landedCost)===null||o===void 0?void 0:o.shortId)||null;_.checkoutSessionId=s;t.clientSecret=i;void this.setToFinishStep(l);return[2,{shouldAllowOrder:false}];case 3:if(!n){R("Cart data is not available, only check payment intent status, skip order.");return[2,{shouldAllowOrder:false}]}R("Payment intent is not succeeded, proceed to order");return[2,{shouldAllowOrder:true}]}}))}))}}o.prototype.resizeListener=function(){this.isMobile=A(this.mobile);this.isTablet=D(this.tablet)};o.prototype.setToFinishStep=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){t.stripe=window.Zonos.stripe;a.step="finish";this.storybookPaymentStatusOverride=o;this.isOverlayLoading=false;return[2]}))}))};o.prototype.initInvoiceCart=function(){return __awaiter(this,void 0,void 0,(function(){var o,n,e,i,s,t,c,h,u,f,m,p,w,x,y,k,I,S,j,O,L,N,A;return __generator(this,(function(D){switch(D.label){case 0:if(!window.Zonos.cartData){return[2]}p=(n=(o=window.Zonos.cartData)===null||o===void 0?void 0:o.items[0])===null||n===void 0?void 0:n.currencyCode;if(p){a.currency=p}w=(i=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.references)===null||i===void 0?void 0:i.checkoutSessionId;x=(t=(s=window.Zonos.cartData)===null||s===void 0?void 0:s.references)===null||t===void 0?void 0:t.landedCostId;if(!x){l({messages:[C("Session does not have valid landed cost. Please contact [organizationName] for assistance.",{organizationName:T.organizationName})],title:C("Invalid session")});return[2]}if(w){R("Setting checkout session id from cart reference","info",w);_.checkoutSessionId=w}else{R("Clear checkout session id from storage so we start from a fresh session for the invoice cart");_.checkoutSessionId=null}return[4,this.checkStripePaymentIntentStatus()];case 1:y=D.sent().shouldAllowOrder;if(!y){return[2]}D.label=2;case 2:D.trys.push([2,11,,12]);k=E(window.Zonos.cartData),I=k.adjustments,S=k.cartItems;return[4,v({adjustments:I,cartItems:S,landedCostId:x,shouldInitSessionOnFailure:false})];case 3:D.sent();if(!(!_.checkoutSessionId&&!w))return[3,5];return[4,z()];case 4:j=D.sent();R("stripeStoreInitCheckoutSession: ".concat(j));if(!j){throw new Error("Failed to initialize checkout session! The cart might be created with LIVE Invoice quote but being used with sandbox credential")}D.label=5;case 5:if(!((!a.checkoutSession||((c=a.checkoutSession)===null||c===void 0?void 0:c.completedAt))&&w))return[3,9];return[4,this.fetchCheckoutSession(w)];case 6:O=D.sent();this.confirmationId=((h=O===null||O===void 0?void 0:O.checkoutSession.landedCost)===null||h===void 0?void 0:h.shortId)||null;if(!!(O===null||O===void 0?void 0:O.checkoutSession.completedAt)&&!!O.checkoutSession.order){void this.setToFinishStep("succeeded");return[2]}if(!(O===null||O===void 0?void 0:O.checkoutSession.clientSecret))return[3,8];return[4,r({clientSecret:O.checkoutSession.clientSecret})];case 7:L=D.sent().status;if(L==="processing"||L==="succeeded"){void this.setToFinishStep(L);return[2]}D.label=8;case 8:void U({endpoint:"INVALID_INVOICE_CHECKOUT_SESSION",errors:["Invalid checkout session, can not retrieve the checkout session after failing to update it"],metadata:{cartCheckoutSessionId:w,cartId:(u=window.Zonos.cartData)===null||u===void 0?void 0:u.id,cartLandedCostId:x}});throw new Error("Invalid checkout session, can not retrieve the checkout session after failing to update it");case 9:if(!a.checkoutSession){void U({endpoint:"FAIL_TO_UPDATE_CREATE_INVOICE_CHECKOUT_SESSION",errors:["Could not update/create checkout session for this invoice cart"],metadata:{cartCheckoutSessionId:w||"N/A",cartId:(f=window.Zonos.cartData)===null||f===void 0?void 0:f.id,cartLandedCostId:x||"N/A"}});throw new Error("Could not update/create checkout session for this invoice cart")}void d();N=(m=a.checkoutSession)===null||m===void 0?void 0:m.landedCost;if(!N){throw new Error("Landed cost could not be found in checkout session after creating/updating them")}return[4,g(Object.assign(Object.assign({},a.checkoutSession),{id:_.checkoutSessionId||""}))];case 10:D.sent();void b({landedCostId:N.id});void this.applyStripeTheme();return[3,12];case 11:A=D.sent();P(A);l({messages:[C("Session does not have valid landed cost. Please contact [organizationName] for assistance.",{organizationName:T.organizationName})],title:C("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,n,e,i,s,c,r,l,v;return __generator(this,(function(z){switch(z.label){case 0:void((o=t.stripeBillingAddressElement)===null||o===void 0?void 0:o.getValue());if(!((n=t.stripeLinkEventData)===null||n===void 0?void 0:n.complete)){s=document.querySelector("zonos-link-authentication");s===null||s===void 0?void 0:s.scrollIntoView({behavior:"smooth"});return[2]}if(!((e=t.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){c=document.querySelector(".zonos--billing-address");c===null||c===void 0?void 0:c.scrollIntoView({behavior:"smooth"});return[2]}r=t.checkoutSettlementCurrency==="USD";if(r&&t.shouldRenderPayInUsdButton&&!this.payInUsdConfirmDialogOpen){this.payInUsdConfirmDialogOpen=true;return[2]}this.payInUsdConfirmDialogOpen=false;k.paypalErrorMessage=null;t.hasPaymentError=false;this.submitLoading=true;a.inventoryCheckErrorMessage=null;return[4,h()];case 1:l=z.sent();if(!l){t.hasPaymentError=true;t.customErrorMessage=C("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:t.checkoutSettlementCurrency});this.submitLoading=false;return[2]}return[4,w()];case 2:z.sent();z.label=3;case 3:z.trys.push([3,5,,6]);return[4,u({noLandedCostCheck:true})];case 4:z.sent();a.step="finish";this.confirmationId=x.landedCostShortId||((i=a.selectedLandedCost)===null||i===void 0?void 0:i.landedCostId)||null;return[2];case 5:v=z.sent();P(v);t.hasPaymentError=true;return[3,6];case 6:this.submitLoading=false;return[2]}}))}))};o.prototype.componentWillLoad=function(){var o=this;t.stripe=window.Zonos.stripe;a.step="payment";void this.initInvoiceCart();this.resizeListener();this.storeUnsubscribeList=[f("clientSecret",(function(){void o.applyStripeTheme()})),I("selectedLocale",(function(){void o.applyStripeTheme()}))];R("mobile: ".concat(this.isMobile))};o.prototype.disconnectedCallback=function(){m();p();this.onChangeLocaleListener();this.storeUnsubscribeList.forEach((function(o){return o()}))};o.prototype.render=function(){var o=this;this.clientSecret=t.clientSecret;if(t.stripeCustomerSessionClientSecret){this.stripeCustomerSessionClientSecret=t.stripeCustomerSessionClientSecret}var n=this.getBaseCurrencySettlementInfo();var c=T.appearance,r=c.logoUrl,l=c.theme;var v=function(){var o="".concat(r,"?timestamp=").concat(Date.now());return e("div",{class:"zonos--logo"},o&&e("img",{alt:"".concat(T.organizationName," logo"),src:o}))};var z=N();var d=function(){var n;var i=new URLSearchParams(window.location.search);var t=i.get("zonosQaUrl");var c=i.get("zonosDebug");var r=(n=j.find((function(o){return o.code===O.selectedLocale})))===null||n===void 0?void 0:n.label;return e(s,null,e("zonos-h-stack",{class:"zonos--header-wrapper",spacing:16},e("div",{class:"zonos--logo-wrapper"},v(),z&&e("zonos-badge",{badgeColor:"orange",size:"small"},C("Test mode")),c==="1"&&e("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),t&&e("zonos-badge",{badgeColor:"purple",size:"small"},t)),e("div",{class:"zonos--header-right"},e("zonos-button",{backgroundColor:"gray-0",class:"zonos--header-right-button",onClick:function(){return o.toggleLanguageDialog()},variant:"outline"},r,e("zonos-icon",{"aria-label":"Language select",content:F,iconColor:"gray-1200"})),e("div",{class:B(["zonos--invoice-language-dialog",o.showLanguageDialogMobile&&"zonos--invoice-language-dialog-open"])},e("zonos-language-select",{handleOnClose:function(){return o.toggleLanguageDialog()}})))))};var h=function(){if(o.isOverlayLoading||t.isFetchingSession){return null}return e("div",{class:"zonos--content"},a.step!=="finish"&&a.step!=="error"&&e(s,null,(o.isMobile||o.isTablet)&&d(),e("div",{class:"zonos--left","data-theme":l},!o.isMobile&&!o.isTablet&&d(),e("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},C("Billing info")),e("zonos-v-stack",{spacing:16},e("zonos-link-authentication",{titleText:""}),e("zonos-address",{titleText:"",type:"billing"})),e("zonos-invoice-payment",{class:B(["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]}}))}))}})),e("div",{class:"zonos--right","data-theme":l},!o.isMobile&&e("zonos-invoice-review",{mobile:o.isMobile,tablet:o.isTablet}),e("div",{class:"zonos--order-details-container"},!o.isMobile&&e("zonos-invoice-cart-items",null),o.isMobile&&e("zonos-invoice-order-details",{collapsed:o.collapseReviewMobile,mobile:o.isMobile,onCollapseClicked:function(){o.collapseReviewMobile=!o.collapseReviewMobile}})),e("div",{class:"flex--wrapper"},!o.isMobile&&e("zonos-v-stack",{spacing:16},e("zonos-invoice-subtotal",null)),!o.isMobile&&!o.isTablet&&e("zonos-invoice-footer",{"data-theme":l,mobile:o.isMobile,tablet:o.isTablet})))),(a.step==="finish"||a.step==="error")&&e("div",{class:"zonos--done","data-theme":l},e("div",{class:"zonos--header"},v()),e("zonos-invoice-finish",{confirmationId:o.confirmationId,overrideNotification:a.step==="error"&&!!a.error?Object.assign(Object.assign({},a.error),{type:"error"}):undefined,storybookForceStatus:o.storybookPaymentStatusOverride})),(o.isMobile||o.isTablet||a.step==="finish"||a.step==="error")&&e("zonos-invoice-footer",{"data-theme":l,mobile:o.isMobile,tablet:o.isTablet}))};return e(i,{class:B(["zonos--invoice zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"]),"data-theme":l},h(),n&&e("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:C("Cancel"),dialogConfirmBtnText:C("Pay [orderTotal]",{orderTotal:S({amount:n.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:C("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:C("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:function(){o.payInUsdConfirmDialogOpen=false},onConfirmClicked:function(){return o.handleStripePaymentContinue()}}),e("zonos-loading-overlay",{open:this.isOverlayLoading}))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return o}());K.style=H}}}));
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(o,n,e,i){function s(o){return o instanceof e?o:new e((function(n){n(o)}))}return new(e||(e=Promise))((function(e,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?e(o.value):s(o.value).then(c,r)}a((i=i.apply(o,n||[])).next())}))};var __generator=this&&this.__generator||function(o,n){var e={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(n){return a([o,n])}}function a(r){if(i)throw new TypeError("Generator is already executing.");while(c&&(c=0,r[0]&&(e=0)),e)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:e.label++;return{value:r[1],done:false};case 5:e.label++;s=r[1];r=[0];continue;case 7:r=e.ops.pop();e.trys.pop();continue;default:if(!(t=e.trys,t=t.length>0&&t[t.length-1])&&(r[0]===6||r[0]===2)){e=0;continue}if(r[0]===3&&(!t||r[1]>t[0]&&r[1]<t[3])){e.label=r[1];break}if(r[0]===6&&e.label<t[1]){e.label=t[1];t=r;break}if(t&&e.label<t[2]){e.label=t[2];e.ops.push(r);break}if(t[2])e.ops.pop();e.trys.pop();continue}r=n.call(o,e)}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}}};System.register(["./p-7261e245.system.js","./p-e4dc24e1.system.js","./p-74230da8.system.js","./p-998975a3.system.js","./p-916228fb.system.js","./p-de58684b.system.js","./p-398d9022.system.js","./p-01174496.system.js","./p-6f23a26a.system.js","./p-23e7c655.system.js","./p-d938f42f.system.js","./p-6890e060.system.js","./p-14afffa8.system.js","./p-989cb22b.system.js","./p-7fbbdb0f.system.js","./p-af19722c.system.js"],(function(o){"use strict";var n,e,i,s,t,c,r,a,l,v,z,d,h,u,f,m,p,g,b,w,x,y,k,_,C,I,S,j,O,T,E,L,U,P,N,A,D,B,R;return{setters:[function(o){n=o.r;e=o.h;i=o.a;s=o.F},function(o){t=o.b;c=o.i;r=o.c;a=o.d;l=o.r;v=o.e;z=o.k;d=o.l;h=o.z;u=o.E;f=o.J;m=o.H;p=o.f},function(o){g=o.i;b=o.a;w=o.b;x=o.c},function(o){y=o.p;k=o.a},function(o){_=o.s;C=o.t;I=o.e;S=o.h;j=o.k;O=o.l},function(o){T=o.z},function(o){E=o.b},function(o){L=o.h;U=o.s;P=o.l;N=o.g},function(o){A=o.i;D=o.a},function(o){B=o.c},function(o){R=o.l},function(){},function(){},function(){},function(){},function(){}],execute:function(){var F='<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 V=".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 H=V;var K=o("zonos_invoice",function(){function o(o){var e=this;n(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=t.clientSecret;this.stripeCustomerSessionClientSecret=t.stripeCustomerSessionClientSecret;this.getBaseCurrencySettlementInfo=function(){var o=a.selectedLandedCost;if(!o){return null}var n=o.landedCost.amountSubtotals;if(!n){return null}var e=(n.discounts||0)+n.items+n.landedCostTotal+n.shipping;return{settlementAmount:e}};this.applyStripeTheme=function(){return __awaiter(e,void 0,void 0,(function(){var o;return __generator(this,(function(n){switch(n.label){case 0:o=T.appearance.theme;return[4,c({overrideTheme:this.isMobile?o:undefined,paypalEnabled:y()})];case 1:n.sent();return[2]}}))}))};this.fetchCheckoutSession=function(o){return __awaiter(e,void 0,void 0,(function(){var n;return __generator(this,(function(e){switch(e.label){case 0:return[4,L("/api/zonos-elements/collect/get-checkout-session",{body:{checkoutSessionId:o},method:"POST"})];case 1:n=e.sent().json;return[2,n]}}))}))};this.checkStripePaymentIntentStatus=function(){return __awaiter(e,void 0,void 0,(function(){var o,n,e,i,s,c,a,l,v,z;return __generator(this,(function(d){switch(d.label){case 0:n=!!window.Zonos.cartData;e=new URL(window.location.href).searchParams;i=e.get("payment_intent_client_secret");s=e.get("zonosCheckoutSessionId");R("Payment intent exist, checking stripe payment intent status");if(!i){R("No stripe client secret found in the URL, proceed to order if cart data is available");return[2,{shouldAllowOrder:n}]}return[4,r({clientSecret:i})];case 1:c=d.sent(),a=c.error,l=c.status;v=new URLSearchParams(window.location.search).get("redirect_status");if(!(v&&s))return[3,3];if(!a){R("Payment intent is succeeded or in a good state to move forward, show success screen")}else{R("Payment intent failed, show status from error")}return[4,this.fetchCheckoutSession(s)];case 2:z=d.sent();this.confirmationId=((o=z===null||z===void 0?void 0:z.checkoutSession.landedCost)===null||o===void 0?void 0:o.shortId)||null;_.checkoutSessionId=s;t.clientSecret=i;void this.setToFinishStep(l);return[2,{shouldAllowOrder:false}];case 3:if(!n){R("Cart data is not available, only check payment intent status, skip order.");return[2,{shouldAllowOrder:false}]}R("Payment intent is not succeeded, proceed to order");return[2,{shouldAllowOrder:true}]}}))}))}}o.prototype.resizeListener=function(){this.isMobile=A(this.mobile);this.isTablet=D(this.tablet)};o.prototype.setToFinishStep=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){t.stripe=window.Zonos.stripe;a.step="finish";this.storybookPaymentStatusOverride=o;this.isOverlayLoading=false;return[2]}))}))};o.prototype.initInvoiceCart=function(){return __awaiter(this,void 0,void 0,(function(){var o,n,e,i,s,t,c,h,u,f,m,p,w,x,y,k,I,S,j,O,L,N,A;return __generator(this,(function(D){switch(D.label){case 0:if(!window.Zonos.cartData){return[2]}p=(n=(o=window.Zonos.cartData)===null||o===void 0?void 0:o.items[0])===null||n===void 0?void 0:n.currencyCode;if(p){a.currency=p}w=(i=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.references)===null||i===void 0?void 0:i.checkoutSessionId;x=(t=(s=window.Zonos.cartData)===null||s===void 0?void 0:s.references)===null||t===void 0?void 0:t.landedCostId;if(!x){l({messages:[C("Session does not have valid landed cost. Please contact [organizationName] for assistance.",{organizationName:T.organizationName})],title:C("Invalid session")});return[2]}if(w){R("Setting checkout session id from cart reference","info",w);_.checkoutSessionId=w}else{R("Clear checkout session id from storage so we start from a fresh session for the invoice cart");_.checkoutSessionId=null}return[4,this.checkStripePaymentIntentStatus()];case 1:y=D.sent().shouldAllowOrder;if(!y){return[2]}D.label=2;case 2:D.trys.push([2,11,,12]);k=E(window.Zonos.cartData),I=k.adjustments,S=k.cartItems;return[4,v({adjustments:I,cartItems:S,landedCostId:x,shouldInitSessionOnFailure:false})];case 3:D.sent();if(!(!_.checkoutSessionId&&!w))return[3,5];return[4,z()];case 4:j=D.sent();R("stripeStoreInitCheckoutSession: ".concat(j));if(!j){throw new Error("Failed to initialize checkout session! The cart might be created with LIVE Invoice quote but being used with sandbox credential")}D.label=5;case 5:if(!((!a.checkoutSession||((c=a.checkoutSession)===null||c===void 0?void 0:c.completedAt))&&w))return[3,9];return[4,this.fetchCheckoutSession(w)];case 6:O=D.sent();this.confirmationId=((h=O===null||O===void 0?void 0:O.checkoutSession.landedCost)===null||h===void 0?void 0:h.shortId)||null;if(!!(O===null||O===void 0?void 0:O.checkoutSession.completedAt)&&!!O.checkoutSession.order){void this.setToFinishStep("succeeded");return[2]}if(!(O===null||O===void 0?void 0:O.checkoutSession.clientSecret))return[3,8];return[4,r({clientSecret:O.checkoutSession.clientSecret})];case 7:L=D.sent().status;if(L==="processing"||L==="succeeded"){void this.setToFinishStep(L);return[2]}D.label=8;case 8:void U({endpoint:"INVALID_INVOICE_CHECKOUT_SESSION",errors:["Invalid checkout session, can not retrieve the checkout session after failing to update it"],metadata:{cartCheckoutSessionId:w,cartId:(u=window.Zonos.cartData)===null||u===void 0?void 0:u.id,cartLandedCostId:x}});throw new Error("Invalid checkout session, can not retrieve the checkout session after failing to update it");case 9:if(!a.checkoutSession){void U({endpoint:"FAIL_TO_UPDATE_CREATE_INVOICE_CHECKOUT_SESSION",errors:["Could not update/create checkout session for this invoice cart"],metadata:{cartCheckoutSessionId:w||"N/A",cartId:(f=window.Zonos.cartData)===null||f===void 0?void 0:f.id,cartLandedCostId:x||"N/A"}});throw new Error("Could not update/create checkout session for this invoice cart")}void d();N=(m=a.checkoutSession)===null||m===void 0?void 0:m.landedCost;if(!N){throw new Error("Landed cost could not be found in checkout session after creating/updating them")}return[4,g(Object.assign(Object.assign({},a.checkoutSession),{id:_.checkoutSessionId||""}))];case 10:D.sent();void b({landedCostId:N.id});void this.applyStripeTheme();return[3,12];case 11:A=D.sent();P(A);l({messages:[C("Session does not have valid landed cost. Please contact [organizationName] for assistance.",{organizationName:T.organizationName})],title:C("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,n,e,i,s,c,r,l,v;return __generator(this,(function(z){switch(z.label){case 0:void((o=t.stripeBillingAddressElement)===null||o===void 0?void 0:o.getValue());if(!((n=t.stripeLinkEventData)===null||n===void 0?void 0:n.complete)){s=document.querySelector("zonos-link-authentication");s===null||s===void 0?void 0:s.scrollIntoView({behavior:"smooth"});return[2]}if(!((e=t.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){c=document.querySelector(".zonos--billing-address");c===null||c===void 0?void 0:c.scrollIntoView({behavior:"smooth"});return[2]}r=t.checkoutSettlementCurrency==="USD";if(r&&t.shouldRenderPayInUsdButton&&!this.payInUsdConfirmDialogOpen){this.payInUsdConfirmDialogOpen=true;return[2]}this.payInUsdConfirmDialogOpen=false;k.paypalErrorMessage=null;t.hasPaymentError=false;this.submitLoading=true;a.inventoryCheckErrorMessage=null;return[4,h()];case 1:l=z.sent();if(!l){t.hasPaymentError=true;t.customErrorMessage=C("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:t.checkoutSettlementCurrency});this.submitLoading=false;return[2]}return[4,w()];case 2:z.sent();z.label=3;case 3:z.trys.push([3,5,,6]);return[4,u({noLandedCostCheck:true})];case 4:z.sent();a.step="finish";this.confirmationId=x.landedCostShortId||((i=a.selectedLandedCost)===null||i===void 0?void 0:i.landedCostId)||null;return[2];case 5:v=z.sent();P(v);t.hasPaymentError=true;return[3,6];case 6:this.submitLoading=false;return[2]}}))}))};o.prototype.componentWillLoad=function(){var o=this;t.stripe=window.Zonos.stripe;a.step="payment";void this.initInvoiceCart();this.resizeListener();this.storeUnsubscribeList=[f("clientSecret",(function(){void o.applyStripeTheme()})),I("selectedLocale",(function(){void o.applyStripeTheme()}))];R("mobile: ".concat(this.isMobile))};o.prototype.disconnectedCallback=function(){m();p();this.onChangeLocaleListener();this.storeUnsubscribeList.forEach((function(o){return o()}))};o.prototype.render=function(){var o=this;this.clientSecret=t.clientSecret;if(t.stripeCustomerSessionClientSecret){this.stripeCustomerSessionClientSecret=t.stripeCustomerSessionClientSecret}var n=this.getBaseCurrencySettlementInfo();var c=T.appearance,r=c.logoUrl,l=c.theme;var v=function(){var o="".concat(r,"?timestamp=").concat(Date.now());return e("div",{class:"zonos--logo"},o&&e("img",{alt:"".concat(T.organizationName," logo"),src:o}))};var z=N();var d=function(){var n;var i=new URLSearchParams(window.location.search);var t=i.get("zonosQaUrl");var c=i.get("zonosDebug");var r=(n=j.find((function(o){return o.code===O.selectedLocale})))===null||n===void 0?void 0:n.label;return e(s,null,e("zonos-h-stack",{class:"zonos--header-wrapper",spacing:16},e("div",{class:"zonos--logo-wrapper"},v(),z&&e("zonos-badge",{badgeColor:"orange",size:"small"},C("Test mode")),c==="1"&&e("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),t&&e("zonos-badge",{badgeColor:"purple",size:"small"},t)),e("div",{class:"zonos--header-right"},e("zonos-button",{backgroundColor:"gray-0",class:"zonos--header-right-button",onClick:function(){return o.toggleLanguageDialog()},variant:"outline"},r,e("zonos-icon",{"aria-label":"Language select",content:F,iconColor:"gray-1200"})),e("div",{class:B(["zonos--invoice-language-dialog",o.showLanguageDialogMobile&&"zonos--invoice-language-dialog-open"])},e("zonos-language-select",{handleOnClose:function(){return o.toggleLanguageDialog()}})))))};var h=function(){if(o.isOverlayLoading||t.isFetchingSession){return null}return e("div",{class:"zonos--content"},a.step!=="finish"&&a.step!=="error"&&e(s,null,(o.isMobile||o.isTablet)&&d(),e("div",{class:"zonos--left","data-theme":l},!o.isMobile&&!o.isTablet&&d(),e("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},C("Billing info")),e("zonos-v-stack",{spacing:16},e("zonos-link-authentication",{titleText:""}),e("zonos-address",{titleText:"",type:"billing"})),e("zonos-invoice-payment",{class:B(["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]}}))}))}})),e("div",{class:"zonos--right","data-theme":l},!o.isMobile&&e("zonos-invoice-review",{mobile:o.isMobile,tablet:o.isTablet}),e("div",{class:"zonos--order-details-container"},!o.isMobile&&e("zonos-invoice-cart-items",null),o.isMobile&&e("zonos-invoice-order-details",{collapsed:o.collapseReviewMobile,mobile:o.isMobile,onCollapseClicked:function(){o.collapseReviewMobile=!o.collapseReviewMobile}})),e("div",{class:"flex--wrapper"},!o.isMobile&&e("zonos-v-stack",{spacing:16},e("zonos-invoice-subtotal",null)),!o.isMobile&&!o.isTablet&&e("zonos-invoice-footer",{"data-theme":l,mobile:o.isMobile,tablet:o.isTablet})))),(a.step==="finish"||a.step==="error")&&e("div",{class:"zonos--done","data-theme":l},e("div",{class:"zonos--header"},v()),e("zonos-invoice-finish",{confirmationId:o.confirmationId,overrideNotification:a.step==="error"&&!!a.error?Object.assign(Object.assign({},a.error),{type:"error"}):undefined,storybookForceStatus:o.storybookPaymentStatusOverride})),(o.isMobile||o.isTablet||a.step==="finish"||a.step==="error")&&e("zonos-invoice-footer",{"data-theme":l,mobile:o.isMobile,tablet:o.isTablet}))};return e(i,{class:B(["zonos--invoice zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"]),"data-theme":l},h(),n&&e("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:C("Cancel"),dialogConfirmBtnText:C("Pay [orderTotal]",{orderTotal:S({amount:n.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:C("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:C("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:function(){o.payInUsdConfirmDialogOpen=false},onConfirmClicked:function(){return o.handleStripePaymentContinue()}}),e("zonos-loading-overlay",{open:this.isOverlayLoading}))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return o}());K.style=H}}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as n,z as e}from"./p-27660512.js";import{t,l as r,s as i}from"./p-6bdc5c96.js";import{l as o,h as a,s}from"./p-41dd1cb8.js";import{l as u,b as c}from"./p-0a377722.js";import{b as l,K as d,d as f,L as v}from"./p-dc80cb87.js";function m(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function p(n,e,t,r,i,o,a){try{var s=n[o](a),u=s.value}catch(n){return void t(n)}s.done?e(u):Promise.resolve(u).then(r,i)}function h(n){return function(){var e=this,t=arguments;return new Promise((function(r,i){var o=n.apply(e,t);function a(n){p(o,r,i,a,s,"next",n)}function s(n){p(o,r,i,a,s,"throw",n)}a(void 0)}))}}function y(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function w(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}function g(n,e,t){return e&&w(n.prototype,e),t&&w(n,t),n}function b(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function k(n,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](n):n instanceof e}function x(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})))),r.forEach((function(e){b(n,e,t[e])}))}return n}function E(n,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):function(n){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);e.push.apply(e,t)}return e}(Object(e)).forEach((function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))})),n}function I(n,e){return function(n){if(Array.isArray(n))return n}(n)||function(n,e){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=t){var r,i,o=[],a=!0,s=!1;try{for(t=t.call(n);!(a=(r=t.next()).done)&&(o.push(r.value),!e||o.length!==e);a=!0);}catch(n){s=!0,i=n}finally{try{a||null==t.return||t.return()}finally{if(s)throw i}}return o}}(n,e)||C(n,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(n){return function(n){if(Array.isArray(n))return m(n)}(n)||function(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}(n)||C(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(n){return n&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n}function C(n,e){if(n){if("string"==typeof n)return m(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?m(n,e):void 0}}function T(n,e){var t,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(n,a)}catch(n){o=[6,n],r=0}finally{t=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var D,P,R,O,j,_=function(n){return n.production="prod",n.demo="demo",n.staging="staging",n}(_||{}),A="airTracker_unknown",L={appName:A,appVersion:A,env:"staging",isWebappContainer:!1,delay:2e3,errorRepeatTime:3,enableErrorMonitoring:!1,assetSpeedMonitoringWhiteList:[],enableDetectPageChange:!1,enableRecordPageRetention:!1,hideSearchParams:!1,useSessionStorageForSessionId:!1,assetSpeedMonitoringWhiteListByMFE:{}},U={appName:A,env:"staging",sessionId:A,deviceId:A},M=function(){var n=new WeakSet;return function(e,t){if(k(t,Error))return"Error.message: ".concat(t.message," \n Error.stack: ").concat(t.stack);if("object"===(void 0===t?"undefined":N(t))&&null!==t){if(n.has(t))return"[Circular ".concat(e||"root","]");n.add(t)}return"function"==typeof t?"function":"symbol"===(void 0===t?"undefined":N(t))?"symbol":void 0===t?null:t}},F=function(n){if("string"==typeof n)return n;try{return k(n,Error)?(JSON.stringify(n,M())||"undefined").replace(/"/gim,""):JSON.stringify(n,M())}catch(n){return'{"error":"error happen when airTracker stringify"}'}},K=function(n){var e=n.method,t=void 0===e?"post":e,r=n.url,i=n.data,o=n.success,a=n.fail;if((s=i)&&!/^\s*$/.test(s)&&(s=(s=(s=s.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@")).replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]")).replace(/(?:^|:|,)(?:\s*\[)+/g,""),/^[\],:{}\s]*$/.test(s))){var s,u=new XMLHttpRequest;u.addEventListener("readystatechange",(function(){4===u.readyState&&(u.status>=400||0===u.status?null==a||a(u.response):null==o||o(u.response))})),u.open(t,r),u.setRequestHeader("Content-Type","application/json"),u.send(i)}},H="onCommonUpdated",q="AIR_ANALYTICS_DEVICE_ID",z="AIR_ANALYTICS_SESSION_ID",B=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(n){var e=16*Math.random()|0;return("x"===n?e:3&e|8).toString(16)}))},W=function(n){var e,t,r;return n.config.getMFEName?n.config.getMFEName():(null===(r=location)||void 0===r||null===(t=r.pathname)||void 0===t||null===(e=t.split("/"))||void 0===e?void 0:e[2])||"unknown"},X=function(n){return"string"==typeof n?n.split("?")[1]||"":n},V=function(n){return"string"==typeof n&&n.startsWith("//")?"undefined"!=typeof location&&"https:"===location.protocol:/^https/.test(n)},G=function(n,e){return"number"==typeof n||"string"==typeof n?n:e?"":-1},$=function(n,e){var t,r=!1;if(!e.config.isWebappContainer)return J(n,e.config.assetSpeedMonitoringWhiteList);var i=W(e);return r||J(n,null===(t=e.config.assetSpeedMonitoringWhiteListByMFE)||void 0===t?void 0:t[i])},J=function(n,e){if(!(null==e?void 0:e.length))return!1;for(var t=0;t<e.length;t++){var r=e[t];if(k(r,RegExp)&&r.test(n))return!0;if("string"==typeof r&&n.includes(r))return!0}return!1},Q=function(n,e){return Math.round(100*(n-e))/100},Y=function(n){return function(e){var t,r,i=W(n),o=n.config.isWebappContainer?x({},n.commonData||{},(null===(t=n.MFECommonDataMap)||void 0===t?void 0:t[i])||{}):n.commonData,a=Array.isArray(e)?e:[e];if(0!==a.length){var s,u=F({commonData:o,data:a}),c={method:"post",url:(s=n.commonData.env,"prod"==s?"https://o11y.airwallex.com/airtracker/logs":"demo"==s?"https://o11y-demo.airwallex.com/airtracker/logs":"https://o11y-staging.airwallex.com/airtracker/logs"),data:u};"function"==typeof(null===(r=navigator)||void 0===r?void 0:r.sendBeacon)&&navigator.sendBeacon(c.url,u)||K(c)}}},Z=function(n){return function(e){var t,r,i,o=W(n),a={commonData:n.config.isWebappContainer?x({},n.commonData||{},(null===(t=n.MFECommonDataMap)||void 0===t?void 0:t[o])||{}):n.commonData,data:Array.isArray(e)?e:[e]},s=F(a),u={method:"post",url:(i=n.commonData.env,"prod"==i?"https://o11y.airwallex.com/airtracker/metrics":"demo"==i?"https://o11y-demo.airwallex.com/airtracker/metrics":"https://o11y-staging.airwallex.com/airtracker/metrics"),data:s};"function"==typeof(null===(r=navigator)||void 0===r?void 0:r.sendBeacon)&&navigator.sendBeacon(u.url,s)||K(u)}},nn=function(n,e){var t,r=[],i=n.config;return window.addEventListener("beforeunload",(function(){r.length>0&&(n.immediateSendPipe(r.splice(0,r.length)),t&&clearTimeout(t))})),function(o,a){if(r.push(o),n.lifeCycle.on(H,(function(){r.length>0&&(null==a||a(r.splice(0,r.length)),n.lifeCycle.remove(H),t&&clearTimeout(t))})),e&&r.length>=e)return null==a||a(r.splice(0,r.length)),void(t&&clearTimeout(t));t&&clearTimeout(t),t=setTimeout((function(){t=null,r.length>0&&(null==a||a(r.splice(0,r.length)),n.lifeCycle.remove(H))}),i.delay)}},en=function(){},tn=function(n){if(!n||!n.reduce||!n.length)throw new TypeError("createPipeline need at least one function param");return 1===n.length?function(e,t){n[0](e,t||en)}:n.reduce((function(n,e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:en;return n(t,(function(n){return null==e?void 0:e(n,r)}))}}))},rn=function(){function n(){var e=this;y(this,n),this.emit=function(n,t){if(e){var r,i=e.eventsList[n];if(null==i?void 0:i.length){i=i.slice();for(var o=0;o<i.length;o++){r=i[o];try{var a=r.callback.apply(e,[t]);if(1===r.type&&e.remove(n,r.callback),!1===a)break}catch(n){throw n}}}return e}},this.eventsList={}}return g(n,[{key:"indexOf",value:function(n,e){for(var t=0;t<n.length;t++)if(n[t].callback===e)return t;return-1}},{key:"on",value:function(n,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(this){var r=this.eventsList[n];return r||(this.eventsList[n]=[],r=this.eventsList[n]),-1===this.indexOf(r,e)?(r.push({name:n,type:t||0,callback:e}),this):this}}},{key:"one",value:function(n,e){this.on(n,e,1)}},{key:"remove",value:function(n,e){if(this){var t=this.eventsList[n];if(!t)return null;if(!e){try{delete this.eventsList[n]}catch(n){}return null}if(t.length){var r=this.indexOf(t,e);t.splice(r,1)}return this}}},{key:"clear",value:function(){this.eventsList={}}}]),n}(),on=function(){function n(e){y(this,n),this.name="",this.isInit=!1,this.name=e.name,this.option=e}return g(n,[{key:"patch",value:function(n){var e,t;this.isInit||(this.isInit=!0,null===(t=this.option)||void 0===t||null===(e=t.setUp)||void 0===e||e.call(this.option,n))}},{key:"uninstall",value:function(){var n,e;null===(e=this.option)||void 0===e||null===(n=e.destroy)||void 0===n||n.apply(this),this.isInit=!1}}]),n}(),an=function(n){var e="".concat(F(n.message)||""," @ (").concat(F(n.filename)||"",":").concat(n.lineno||0,":").concat(n.colno||0,")\n").concat(F(n.error||""));D.normalLogPipeLine({severity:"autoDetectError",eventName:"windowOnError",extraInfo:{error:e}})},sn=function(n){var e=n&&F(n.reason);D.normalLogPipeLine({severity:"autoDetectError",eventName:"promiseError",extraInfo:{error:e}})},un=function(n){var e=(null==n?void 0:n.target)||(null==n?void 0:n.srcElement);if(e){var t=(null==e?void 0:e.src)||(null==e?void 0:e.href),r=e.tagName,i="unknown";if("string"==typeof t&&r){if(window.location.href.indexOf(t)>-1)return;if(/\.js$/.test(t))i="script";else if(/\.css$/.test(t))i="css";else switch(r.toLowerCase()){case"script":i="script";break;case"link":i="css";break;case"img":i="image";break;case"audio":case"video":i="media";break;default:return}D.normalLogPipeLine({severity:"autoDetectError",eventName:"staticFileLoadError",extraInfo:{staticFileType:i,error:"".concat(r," load fail: ").concat(t)}})}}},cn=new on({name:"errorDetectionPlugin",setUp:function(n){D=n,window.addEventListener("error",an),window.addEventListener("unhandledrejection",sn),window.document.addEventListener("error",un,!0)},destroy:function(){window.removeEventListener("unhandledrejection",sn),window.document.removeEventListener("error",un,!0),window.removeEventListener("error",an)}}),ln=["img","css","script","link","audio","video","iframe"],dn="resource",fn=function(n){var e,t=n.name;return{url:(e=t,"string"==typeof e?(e.split("?")[0]||"").slice(0,200):e),method:"get",duration:Number(n.duration.toFixed(2)),type:"static",isHttps:V(t),urlQuery:X(t),domainLookup:G(n.domainLookupEnd-n.domainLookupStart),connectTime:G(n.connectEnd-n.connectStart)}},vn=function(n,e){for(var t=0,r=n.length;t<r;t++){var i=n[t];-1!==ln.indexOf(i.initiatorType)&&$(i.name,e)&&e.normalLogPipeLine({severity:"performance",eventName:"assets_speed",extraInfo:{log:fn(i)}})}},mn=new on({name:"assetsSpeedPlugin",setUp:function(n){if(void 0!==window.performance&&"function"==typeof window.performance.clearResourceTimings&&"function"==typeof window.performance.getEntriesByType&&"function"==typeof window.performance.now){var e=0;window.performance.onresourcetimingbufferfull=function(){e=0,window.performance.clearResourceTimings()},"function"==typeof window.PerformanceObserver?(vn(window.performance.getEntriesByType(dn),n),(R=new window.PerformanceObserver((function(e){vn(e.getEntries(),n)}))).observe({entryTypes:[dn]})):P=setInterval((function(){var t=window.performance.getEntriesByType(dn),r=t.slice(e);e=t.length,vn(r,n)}),3e3)}},destroy:function(){null==R||R.disconnect(),P&&clearInterval(P)}}),pn=new on({name:"onPageChangePlugin",setUp:function(){var n=h((function(n){var e,t,r,i;return T(this,(function(){return t=null===(e=location)||void 0===e?void 0:e.href,r=document.querySelector("body"),i=function(e){var t,r,i,o,a;n.normalLogPipeLine({severity:"autoDetectEvent",eventName:"onPageChange",extraInfo:{prevHref:e.prevHref,href:(null===(t=location)||void 0===t?void 0:t.href)||"",hostname:null===(r=location)||void 0===r?void 0:r.hostname,pathName:null===(i=location)||void 0===i?void 0:i.pathname,protocol:null===(o=location)||void 0===o?void 0:o.protocol,search:null===(a=location)||void 0===a?void 0:a.search}})},i({prevHref:""}),(O=new MutationObserver((function(){if(location.href!==t){var n=t;t=location.href,i({prevHref:n})}}))).observe(r||document,{subtree:!0,childList:!0}),[2]}))}));return function(e){return n.apply(this,arguments)}}(),destroy:function(){null==O||O.disconnect()}}),hn=new on({name:"onPageRetentionPlugin",setUp:function(){var n=h((function(n){var e,t,r,i,o,a;return T(this,(function(){return void 0===document.visibilityState||(t=null===(e=location)||void 0===e?void 0:e.href,r=document.querySelector("body"),(o=function(){i=Date.now()})(),document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState?a({href:location.href,leftReason:"visibilityChange"}):"visible"===document.visibilityState&&o()})),window.addEventListener("beforeunload",(function(){a({href:location.href,sendImmediate:!0,leftReason:"pageClose"})})),a=function(e){var t=e.href,r=e.sendImmediate,o=e.leftReason;if(i){var a=Date.now()-i;if(0!==a){i=void 0;var s={severity:"autoDetectEvent",eventName:"onPageRetention",extraInfo:{href:t,duration:a,leftReason:o}};r?n.ImmediatePipeline(s):n.normalLogPipeLine(s)}}},(j=new MutationObserver((function(){if(location.href!==t){var n=t;t=location.href,a({href:n,leftReason:"nextPage"}),o()}}))).observe(r||document,{subtree:!0,childList:!0})),[2]}))}));return function(e){return n.apply(this,arguments)}}(),destroy:function(){null==j||j.disconnect()}}),yn=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2,15)},wn=function(n,e){return![/authenticate\/heartbeat/,/papluginlogs\/.*/,/airtracker\/.*/,/o11y(-staging|-demo)?\.airwallex\.com/,/\.(png|jpe?g|gif|svg|ico|webp|avif|css|js|json|woff2?|ttf|eot|map|txt|csv|xml)(\?.*)?(#.*)?$/i].some((function(e){return e.test(n)}))&&J(n,e||[/^https?:\/\/[^\/]*\.airwallex\.com($|\/)/])},gn=function(n){return Math.round(100*n)/100},bn=function(n,e){var t,r,i,o,a,s,u,c,l,d,f,v,m,p,h,y,w,g,b,k=n.url,I=n.method,S=n.errorType,N=n.errorDetail,C=function(n){var e=n.startTime,t=n.endTime,r=n.entries;if(0!==r.length){if(1===r.length)return r[0];var i=r.filter((function(n){return n.startTime>=e&&t&&n.responseEnd<=t})).sort((function(n,e){return n.startTime-e.startTime}));return null==i?void 0:i[0]}}(n),T=new URL(k,window.location.href),D=T.href,P=T.protocol,R=C?(i=(t=C).duration,o=t.responseStart,a=t.connectEnd,s=t.connectStart,u=t.domainLookupEnd,c=t.domainLookupStart,l=t.requestStart,d=t.secureConnectionStart,f=t.redirectEnd,v=t.redirectStart,m=t.responseStatus,p=t.responseEnd,h=t.encodedBodySize,y=t.decodedBodySize,w=t.transferSize,g=t.deliveryType,b=t.initiatorType,{startTime:gn(r=t.startTime),totalDuration:gn(i),timeToFirstByte:Q(o,r),tcpDuration:Q(a,s),dnsDuration:Q(u,c),tlsDuration:Q(l,d),redirectDuration:Q(f,v),responseDuration:Q(p,o),encodeResponseSize:h,decodeResponseSize:y,transferSize:w,deliveryType:g,statusCode:m,initiatorType:b}):{};return{severity:"autoDetectEvent",eventName:"httpClientMetrics",extraInfo:x(E(x({httpUrl:D,method:I,scheme:P},S&&{errorType:S},N&&{errorDetail:N},R),{statusCode:(null==R?void 0:R.statusCode)||(null==n?void 0:n.responseStatus),startTime:(null==R?void 0:R.startTime)||(null==n?void 0:n.startTime),initiatorType:(null==R?void 0:R.initiatorType)||(null==n?void 0:n.initiatorType)}),e)}},kn=function(n){return n&&"object"===(void 0===n?"undefined":N(n))&&"errors"in n&&Array.isArray(n.errors)&&n.errors.every((function(n){return n&&"object"===(void 0===n?"undefined":N(n))&&"message"in n}))},xn="awx_airtracker_api_performance_queue",En="awx_airtracker_api_performance_plugin_loaded",In="undefined"!=typeof window?window:"undefined"!=typeof global?global:{};In[xn]=In[xn]||[];var Sn=function(n,e,t){setTimeout((function(){var r=bn(n,t);e.observerPipeline(r),In[xn]=In[xn].filter((function(e){return e.id!==n.id}))}),300)},Nn=function(n,e){setTimeout((function(){var t=In[xn].find((function(e){return e.id===n}));if(t){var r=bn(t,{exceptionType:"timeout-without-response"});e.observerPipeline(r),In[xn]=In[xn].filter((function(e){return e.id!==n}))}}),1e4)},Cn=new on({name:"apiPerformancePlugin",setUp:function(){var n=h((function(n){var e,t;return T(this,(function(){return In[En]||(null===(e=n.config)||void 0===e?void 0:e.enableRecordAPIPerformance)&&Math.random()<((null===(t=n.config)||void 0===t?void 0:t.enableRecordAPIPerformancePercentage)||0)&&(In[En]=!0,function(n){var e;(function(n){var e=XMLHttpRequest.prototype.open,t=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function(t,r,i,o,a){try{var s,u=yn();this.__requestId=u;var c=k(r,URL)?r.href:new URL(r,window.location.href).href;if(!wn(c,null===(s=n.config)||void 0===s?void 0:s.enableRecordAPIPerformanceWhitelist))return e.call(this,t,r,null==i||i,o,a);var l={id:u,startTime:performance.now(),method:t,url:c,entries:[],initiatorType:"xmlhttprequest"};return In[xn].push(l),Nn(u,n),e.call(this,t,r,null==i||i,o,a)}catch(s){return n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject XHR open error",error:s}}),e.call(this,t,r,null==i||i,o,a)}},XMLHttpRequest.prototype.send=function(){for(var e=this,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];try{var a=In[xn].find((function(n){return n.id===e.__requestId}));if(!a)return t.apply(this,i);var s=this;return this.addEventListener("loadend",h((function(){var e,t,r,i,o,u,c;return T(this,(function(l){switch(l.label){case 0:if(e=performance.now(),t=e-a.startTime,0===(r=s.status))return[2];a.endTime=e,a.duration=t,a.responseStatus=r,l.label=1;case 1:return l.trys.push([1,6,,7]),""!==s.responseType&&"text"!==s.responseType?[3,2]:(i=s.responseText,[3,5]);case 2:return"json"!==s.responseType?[3,3]:(i=s.response,[3,5]);case 3:return"blob"!==s.responseType||"application/json"!==(null==(o=s.response)?void 0:o.type)?[3,5]:[4,o.text()];case 4:i=l.sent(),l.label=5;case 5:return(u=i&&"string"==typeof i?JSON.parse(i):i)&&kn(u)&&(a.errorType="graphqlError",a.errorDetail=u.errors),[3,7];case 6:return c=l.sent(),n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in XHR",url:null==a?void 0:a.url,error:c}}),[3,7];case 7:return Sn(a,n),[2]}}))}))),this.addEventListener("error",(function(){Sn(a,n,{exceptionType:"network-error"})})),this.addEventListener("abort",(function(){Sn(a,n,{exceptionType:"abort-error"})})),this.addEventListener("timeout",(function(){Sn(a,n,{exceptionType:"timeout-error"})})),t.apply(this,i)}catch(e){throw n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"InjectXHR send error",error:e}}),e}}})(n),function(n){var e=window.fetch;window.fetch=h((function(){var t,r,i,o,a,s,u,c,l,d,f,v,m,p,h,y,w=arguments;return T(this,(function(g){switch(g.label){case 0:for(t=w.length,r=new Array(t),i=0;i<t;i++)r[i]=w[i];return s=new URL(k(r[0],Request)?r[0].url:String(r[0]),window.location.href).href,wn(s,null===(o=n.config)||void 0===o?void 0:o.enableRecordAPIPerformanceWhitelist)?[3,2]:[4,e.apply(this,r)];case 1:return[2,g.sent()];case 2:return g.trys.push([2,9,,10]),c=performance.now(),l=yn(),a={id:l,startTime:c,method:(null===(u=k(r[0],Request)?r[0]:r[1])||void 0===u?void 0:u.method)||"GET",url:s,entries:[],initiatorType:"fetch"},In[xn].push(a),Nn(l,n),[4,e.apply(this,r)];case 3:d=g.sent(),f=performance.now(),a.endTime=f,a.duration=f-c,a.responseStatus=d.status,v=d.clone(),g.label=4;case 4:return g.trys.push([4,7,,8]),v.ok?[4,v.json()]:[3,6];case 5:(m=g.sent())&&kn(m)&&(a.errorType="graphqlError",a.errorDetail=m.errors),g.label=6;case 6:return[3,8];case 7:return p=g.sent(),n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in fetch",url:null==a?void 0:a.url,error:p}}),[3,8];case 8:return Sn(a,n),[2,d];case 9:throw h=g.sent(),a&&a.id&&In[xn].find((function(n){return n.id===(null==a?void 0:a.id)}))?(y="fetch-error",k(h,TypeError)?y="network-error":k(h,DOMException)&&"AbortError"===h.name&&(y="abort-error"),Sn(a,n,{exceptionType:y})):n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject fetch error",error:h}}),h;case 10:return[2]}}))}))}(n),(null===(e=window)||void 0===e?void 0:e.PerformanceObserver)?new window.PerformanceObserver((function(n){n.getEntries().forEach((function(n){var e=n;"fetch"!==e.initiatorType&&"xmlhttprequest"!==e.initiatorType||In[xn].filter((function(n){return n.url===e.name})).forEach((function(n){n.entries.push(e)}))}))})).observe({entryTypes:["resource"],buffered:!0}):n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{error:"PerformanceObserver Not Supported"}})}(n)),[2]}))}));return function(e){return n.apply(this,arguments)}}()}),Tn=function(){function n(e){var t,r,i=this,o=e.config,a=e.plugins,s=void 0===a?[]:a;y(this,n),this.config=L,this.lifeCycle=new rn,this.plugins=[],this._commonData=U,this._MFECommonDataMap={},this.timeMap={},this.packedDataConvert=function(n){var e,t,r=n.extraInfo,o=x({severity:n.severity,eventName:n.eventName,currentHref:i.config.hideSearchParams?((null===(e=location)||void 0===e?void 0:e.href)||"").split("?")[0]||"":(null===(t=location)||void 0===t?void 0:t.href)||""},r);return i.config.isWebappContainer&&(o.MFEName=W(i)),o},this.normalPipelineObj=tn([nn(this,8),(t=this,r={},function(n,e){var i="number"==typeof t.config.errorRepeatTime?t.config.errorRepeatTime:5;if(0===i)return null==e?void 0:e(n);null==e||e(n.filter((function(n){return"autoDetectError"!=n.severity||(r[n.error]=r[n.error]||0,r[n.error]+=1,!(r[n.error]>i))})))}),Y(this)]),this.observerPipelineObj=tn([nn(this,8),Z(this)]),this.immediateSendPipe=Y(this),this.observerPipeline=function(n){var e=i.packedDataConvert({severity:n.severity,eventName:n.eventName,extraInfo:n.extraInfo});return i.observerPipelineObj(e)},this.normalLogPipeLine=function(n){var e=i.packedDataConvert({severity:n.severity,eventName:n.eventName,extraInfo:n.extraInfo});return i.config.disableThrottle?i.immediateSendPipe(e):i.normalPipelineObj(e)},this.ImmediatePipeline=function(n){var e=i.packedDataConvert({severity:n.severity,eventName:n.eventName,extraInfo:n.extraInfo});return i.immediateSendPipe(e)},this.plugins=S(s),this.setConfig(o),this.initCommonData(o),this.lifeCycle.emit("onInit"),o.enableErrorMonitoring&&this.plugins.push(cn),((null==o?void 0:o.assetSpeedMonitoringWhiteList)&&o.assetSpeedMonitoringWhiteList.length>0||o.isWebappContainer)&&this.plugins.push(mn),(null==o?void 0:o.enableDetectPageChange)&&this.plugins.push(pn),(null==o?void 0:o.enableRecordPageRetention)&&this.plugins.push(hn),(null==o?void 0:o.enableRecordAPIPerformance)&&(null==o?void 0:o.enableRecordAPIPerformancePercentage)&&o.enableRecordAPIPerformancePercentage>0&&o.enableRecordAPIPerformancePercentage<=1&&this.plugins.push(Cn),this.installPlugins()}return g(n,[{key:"installPlugins",value:function(){var n=this;this.plugins.forEach((function(e){e.patch(n)}))}},{key:"commonData",get:function(){return this._commonData}},{key:"MFECommonDataMap",get:function(){return this._MFECommonDataMap}},{key:"initCommonData",value:function(n){this._commonData.sessionId=n.useSessionStorageForSessionId?function(){try{var n=window.sessionStorage.getItem(z);return n||(n=B(),window.sessionStorage.setItem(z,n)),n}catch(n){return B()}}():B(),this._commonData.deviceId=function(){try{var n=window.localStorage.getItem(q);return n||(n=B(),window.localStorage.setItem(q,n)),n}catch(n){}}()||A,this._commonData.riskDeviceId=function(){try{return window.localStorage.getItem("AWX_RISK_ID")||void 0}catch(n){}}(),this._commonData.networkType=function(){var n,e,t="",r=navigator.userAgent.match(/NetType\/(\w+)/);if(r)t=I(r,2)[1];else if(null===(n=navigator)||void 0===n?void 0:n.connection){var i,o,a,s;t=(null===(o=navigator)||void 0===o||null===(i=o.connection)||void 0===i?void 0:i.effectiveType)||(null===(s=navigator)||void 0===s||null===(a=s.connection)||void 0===a?void 0:a.type)}return t||(t="unknown"),e=t,(e=String(e).toLowerCase()).indexOf("4g")>=0?"net4g":e.indexOf("wifi")>=0?"wifi":e.indexOf("5g")>=0?"net5g":e.indexOf("3g")>=0?"net3g":e.indexOf("2g")>=0?"net2g":"unknown"}()||"unknown",this._commonData.env=n.env||this._commonData.env,this._commonData.accountId=n.accountId||A,this._commonData.appVersion=n.appVersion,this._commonData.appName=n.appName,this._commonData.sdkVersion="3.1.0",this.lifeCycle.emit("onCommonDataInit",this.commonData)}},{key:"updateCommonDataBasedOnConfig",value:function(n){this.lifeCycle.emit(H,this._commonData),this._commonData.env=n.env||this._commonData.env,this._commonData.appName=n.appName||this._commonData.appName,this._commonData.env=n.env||this._commonData.env,this._commonData.accountId=n.accountId||this._commonData.accountId,this._commonData.appVersion=n.appVersion||this._commonData.appVersion}},{key:"updateCommonData",value:function(n){this.lifeCycle.emit(H,this._commonData),this._commonData=x({},this._commonData,n)}},{key:"removeCommonDataByKey",value:function(n){var e=this;this.lifeCycle.emit(H,this._commonData),setTimeout((function(){n.forEach((function(n){delete e._commonData[n]}))}),1e3)}},{key:"addToMFECommonData",value:function(n){var e,t=n.MFEName,r=n.MFECommonData;this.config.isWebappContainer&&t&&r&&(this._MFECommonDataMap=E(x({},this._MFECommonDataMap||{}),b({},t,x({},(null===(e=this._MFECommonDataMap)||void 0===e?void 0:e[t])||{},r))))}},{key:"setConfig",value:function(n){var e=this;this.config.isWebappContainer||(Object.entries(n).forEach((function(n){var t=I(n,2),r=t[0],i=t[1];void 0!==(void 0===i?"undefined":N(i))&&function(n,t){e.config[n]=t}(r,i)})),this.lifeCycle.emit("onConfigInit",this.config),this.updateCommonDataBasedOnConfig(n))}},{key:"verbose",value:function(n,e){this.normalLogPipeLine({severity:"verbose",eventName:n,extraInfo:e})}},{key:"httpLog",value:function(n,e){this.normalLogPipeLine({severity:"http",eventName:n,extraInfo:e})}},{key:"info",value:function(n,e){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:e})}},{key:"warn",value:function(n,e){this.normalLogPipeLine({severity:"warn",eventName:n,extraInfo:e})}},{key:"error",value:function(n,e){console.error("error",n),this.normalLogPipeLine({severity:"error",eventName:n,extraInfo:e})}},{key:"businessLog",value:function(n,e){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:E(x({},e),{isBusinessLog:!0})})}},{key:"reportDuration",value:function(n,e,t){"string"==typeof n?"number"==typeof e?e<0||e>6e4?console.warn("reportDuration: duration (second param) must between 0 and 60000"):this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:x({duration:e},t)}):console.warn("reportDuration: duration (second param) must be number"):console.warn("reportDuration: eventName (first param) must be a string")}},{key:"getTimerKey",value:function(n){var e=W(this);return this.config.isWebappContainer?"".concat(e,"_").concat(n):n}},{key:"timeStart",value:function(n){"string"==typeof n?(this.timeMap[this.getTimerKey(n)]&&console.warn("Timer ".concat(n," already exists")),this.timeMap[this.getTimerKey(n)]=Date.now()):console.warn("time: first param must be a string")}},{key:"timeEnd",value:function(n,e){if("string"==typeof n)if(this.timeMap[this.getTimerKey(n)]){var t=Date.now()-this.timeMap[this.getTimerKey(n)]+(e||0);this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:{duration:t}}),delete this.timeMap[this.getTimerKey(n)]}else console.warn("Timer key :".concat(n," does not exist"));else console.warn("timeEnd: first param must be a string")}},{key:"addToAssetSpeedWhiteListByMFE",value:function(n){var e,t,r,i,o=n.MFEName,a=n.whiteList;this.config.isWebappContainer&&o&&(null==a?void 0:a.length)&&(this.config.assetSpeedMonitoringWhiteListByMFE||(this.config.assetSpeedMonitoringWhiteListByMFE={}),(null===(e=this.config.assetSpeedMonitoringWhiteListByMFE)||void 0===e?void 0:e[o])?null===(i=this.config.assetSpeedMonitoringWhiteListByMFE)||void 0===i||null===(r=i[o])||void 0===r||(t=r).push.apply(t,S(a)):this.config.assetSpeedMonitoringWhiteListByMFE=E(x({},this.config.assetSpeedMonitoringWhiteListByMFE),b({},o,a)))}},{key:"destroy",value:function(){this.config.isWebappContainer||this.plugins.forEach((function(n){n.uninstall()}))}}]),n}(),Dn=Tn,Pn=function(n,e){return Pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])},Pn(n,e)};function Rn(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=n}Pn(n,e),n.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t)}var On=function(){return On=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var i in e=arguments[t])Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n},On.apply(this,arguments)};function jn(n,e,t,r){return new(t||(t=Promise))((function(i,o){function a(n){try{u(r.next(n))}catch(n){o(n)}}function s(n){try{u(r.throw(n))}catch(n){o(n)}}function u(n){var e;n.done?i(n.value):(e=n.value,e instanceof t?e:new t((function(n){n(e)}))).then(a,s)}u((r=r.apply(n,e||[])).next())}))}function _n(n,e){var t,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(t=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(n,a)}catch(n){s=[6,n],r=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function An(n,e,t){if(t||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return n.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var Ln,Un,Mn,Fn={dev:_.staging,staging:_.staging,demo:_.demo,prod:_.production},Kn=function(n){if("object"!=typeof n)return n;try{var e=JSON.parse(JSON.stringify(n));return Object.keys(e).forEach((function(n){"string"==typeof n&&["auth","code"].some((function(e){return n.includes(e)}))&&(e[n]="***")})),e}catch(e){return n}},Hn=function(n,e){var t,r;null===(r=null===(t=window._AirwallexSDKs)||void 0===t?void 0:t.airTracker)||void 0===r||r.error(n,On(On({},e),{context:"components-sdk"}))},qn=function(n,e){var t;null===(t=window._AirwallexSDKs.airTracker)||void 0===t||t.info(n,On(On({},e),{context:"components-sdk"}))},zn=function(n){function e(e){var t=n.call(this,e)||this;return t.code="LOAD_SCRIPT_ERROR",t}return Rn(e,n),e}(Error);!function(n){n.dev="dev",n.staging="staging",n.demo="demo",n.prod="prod",n.sandbox="sandbox"}(Mn||(Mn={}));var Bn,Wn=((Ln={})[Mn.dev]="https://checkout-staging.airwallex.com",Ln[Mn.staging]="https://checkout-staging.airwallex.com",Ln[Mn.demo]="https://checkout-demo.airwallex.com",Ln[Mn.prod]="https://checkout.airwallex.com",Ln[Mn.sandbox]="https://checkout.sandbox.airwallex.com",Ln),Xn=((Un={})[Mn.dev]="https://static-staging.airwallex.com",Un[Mn.staging]="https://static-staging.airwallex.com",Un[Mn.demo]="https://static-demo.airwallex.com",Un[Mn.prod]="https://static.airwallex.com",Un[Mn.sandbox]="https://static.sandbox.airwallex.com",Un),Vn="sdkController",Gn="payments",$n={kyc:"/widgets/kyc/sdk/v1/index.js",rfi:"/widgets/kycRfi/sdk/v1/index.js",paymentsKyb:"/widgets/paymentsKyb/sdk/v1/index.js",sdkController:"/widgets/sdk-controller/sdk/v1/index.js",payouts:"/widgets/payouts/sdk/v1/index.js",payments:"/assets/elements.bundle.min.js",sca:"/hosted-sca/sdk/v1/index.js",taxForm:"/widgets/taxForm/sdk/v1/index.js",billing:"/widgets/checkout/sdk/v1/index.js"},Jn={kyc:"kyc",paymentsKyb:"paymentsKyb",kycRfi:"rfi",transactionRfi:"rfi",paymentEnablementRfi:"rfi",lendingRfi:"rfi",mrmRfi:"rfi",payoutForm:"payouts",beneficiaryForm:"payouts",hpp:"payments",cvc:"payments",card:"payments",expiry:"payments",dropIn:"payments",cardNumber:"payments",applePayButton:"payments",googlePayButton:"payments",krCardNumber:"payments",krCardIdentifier:"payments",krCardExpiry:"payments",krCardPswFirstTwo:"payments",scaSetup:"sca",scaVerify:"sca",scaManagement:"sca",taxForm:"taxForm",embeddedCheckout:"billing"},Qn={payments:["hpp","cvc","card","expiry","dropIn","cardNumber","applePayButton","googlePayButton","krCardNumber","krCardIdentifier","krCardExpiry","krCardPswFirstTwo"],payouts:["payoutForm","beneficiaryForm"],onboarding:["kyc","paymentsKyb"],risk:["scaSetup","scaVerify","scaManagement","transactionRfi","kycRfi","paymentEnablementRfi","lendingRfi","mrmRfi"],billing:["embeddedCheckout"]},Yn={billing:["payments"]},Zn=["payments","sca"],ne=function(n){function e(e){var t=n.call(this,e)||this;return t.code="INVALID_STATIC_RESOURCE_ERROR",t}return Rn(e,n),e}(Error),ee=Date.now(),te=function(n){return Jn[n]},re=function(n){var e=n.reduce((function(n,e){return n.concat((t=e,Object.keys(Qn).includes(t)?Qn[e]:e));var t}),[]);return Array.from(new Set(e)).map((function(n){return{elementName:n,sdkName:te(n)}}))},ie=function(n){return"payments"===n?"payment":n},oe=function(n){var e=n.name,t=n.env,r=function(n,e){var t=n===Gn?Wn:Xn;return t[e]||t.prod}(e,void 0===t?Mn.prod:t),i=$n[e];if(!i)throw Hn("[components-sdk] Element static resource not found",{sdkName:e}),new ne("Element ".concat(e," static resource URL is invalid."));return"".concat(r).concat(i,"?ts=").concat(ee)},ae=function(){return Math.floor(performance.now())},se=function(n){function e(e){var t=n.call(this,e)||this;return t.code="INSTANCE_NOT_FOUND_ERROR",t}return Rn(e,n),e}(Error),ue=new Map,ce=function(n){var e=n.scriptName,t=oe({name:e,env:n.env}),r=ue.get(e);if(r)return r;var i=function(n){return jn(void 0,void 0,void 0,(function(){var e,t;return _n(this,(function(r){switch(r.label){case 0:if("undefined"==typeof window)throw new Error("Please load script in browser environment");e=0,t=function(){return jn(void 0,void 0,void 0,(function(){var t,r,i;return _n(this,(function(){return t=ae(),e>0&&n.includes("?ts=")&&((r=new URL(n,window.location.href)).searchParams.set("ts","".concat(Date.now())),n=r.toString()),i=function(n){var e=document.createElement("script");return e.src=n,e.type="module",(document.head||document.body).appendChild(e),e}(n),[2,new Promise((function(r,o){i.addEventListener("load",(function(){var i=ae();qn("[components-sdk] SDK script loaded",{scriptUrl:n,start:t,latency:i-t,end:i,retryCount:e}),r(!0)})),i.addEventListener("error",(function(r){i.remove(),console.error(r);var a=ae();Hn("[components-sdk] Failed to load script",{scriptUrl:n,error:r,start:t,latency:a-t,end:a,retryCount:e}),o(new zn("Failed to load Airwallex SDK scripts: ".concat(n)))}))}))]}))}))},r.label=1;case 1:if(!(e<3))return[3,7];r.label=2;case 2:return r.trys.push([2,4,,6]),[4,t()];case 3:return[2,r.sent()];case 4:return r.sent(),e++,[4,(void 0===i&&(i=500),new Promise((function(n){return window.setTimeout(n,i)})))];case 5:return r.sent(),[3,6];case 6:return[3,1];case 7:throw Hn("[components-sdk] Failed to load script after retry",{scriptUrl:n,retryCount:e}),new zn("Failed to load Airwallex SDK scripts: ".concat(n))}var i}))}))}(t);return ue.set(e,i),i},le=function(n){var e=n.env,t=n.scriptName;return jn(void 0,void 0,void 0,(function(){var n;return _n(this,(function(r){switch(r.label){case 0:return(n=Yn[t]||[]).length>0?[4,Promise.all(n.map((function(n){return ce({env:e,scriptName:n})})))]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2,ce({env:e,scriptName:t})]}}))}))},de=function(n){return jn(void 0,void 0,void 0,(function(){return _n(this,(function(){if("undefined"==typeof window)throw new Error("Please call the `init()` function in a browser environment.");var e,t;return t=n.clientId,void 0===(e=n.env)&&(e=_.production),window._AirwallexSDKs.airTracker||(window._AirwallexSDKs.airTracker=new Dn({config:{appName:"components-sdk",appVersion:"1.30.2",env:Fn[e]||_.production}}),window._AirwallexSDKs.airTracker.updateCommonData({clientId:t})),window,qn("[components-sdk] SDK init start",{options:Kn(n),start:ae()}),Bn=new Promise((function(e,t){var r,i=On(On({},n),{env:n.env&&Mn[n.env]?n.env:Mn.prod});window.AirwallexComponentsSDK.__env__=i.env;var o=ce({env:i.env,scriptName:Vn}).then((function(){return window._AirwallexSDKs.__controller__.init(i)})),a=null!==(r=n.enabledElements)&&void 0!==r?r:[],s=function(n){return Array.from(new Set(re(n).map((function(n){return n.sdkName})).filter((function(n){return Zn.includes(n)}))))}(a),u=s.map((function(n){return ce({env:i.env,scriptName:n}).then((function(){return o})).then((function(){var e=window._AirwallexSDKs[ie(n)];if(!e)throw Hn("[components-sdk] SDK instance not found",{functionsNamespace:n,windowSDKInstanceName:ie(n)}),new se("SDK instance not found");return window._AirwallexSDKs.__controller__.registerFunctions({functionsNamespace:n,instance:e})}))})),c=re(a).map((function(n){var e=n.sdkName,t=n.elementName;return le({scriptName:e,env:i.env}).then((function(){return o})).then((function(){var n=window._AirwallexSDKs[ie(e)];if(!n)throw Hn("[components-sdk] SDK instance not found",{sdkName:e,windowSDKInstanceName:ie(e)}),new se("SDK instance not found");return window._AirwallexSDKs.__controller__.registerElement({sdkName:e,elementName:t,instance:n})}))}));Promise.all(An(An([o],u,!0),c,!0)).then((function(){qn("[components-sdk] SDK initialized",{options:Kn(n),start:ae()}),e(Zn.reduce((function(n,e){var t;return On(On({},n),((t={})[e]=window._AirwallexSDKs.__controller__.internalSDKs[e],t))}),{}))})).catch((function(n){n.code||Hn("[components-sdk] Unexpected errors when init",{error:n}),t(n)}))})),[2,Bn]}))}))},fe=function(n,e){return jn(void 0,void 0,void 0,(function(){var t,r,i,o,a;return _n(this,(function(s){switch(s.label){case 0:if(!n)throw new Error("Element type is missing. Please specify a valid element.");if(qn("[components-sdk] SDK createElement start",{elementName:n,options:Kn(e),timestamp:ae()}),!Bn)throw function(){var n;null===(n=window._AirwallexSDKs.airTracker)||void 0===n||n.warn("[components-sdk] Did not call init before createElement",On(On({},void 0),{context:"components-sdk"}))}(),new Error("Please initialize the Element before creating it.");return[4,Bn];case 1:if(s.sent(),!(t=te(n)))throw new Error("`createElement()` with type `".concat(n,"` is not supported. Please specify a valid Element type."));r=ae(),s.label=2;case 2:return s.trys.push([2,6,,7]),[4,le({scriptName:t,env:window.AirwallexComponentsSDK.__env__||Mn.prod})];case 3:return s.sent(),[4,window._AirwallexSDKs.__controller__.registerElement({sdkName:t,elementName:n,instance:window._AirwallexSDKs[ie(t)]})];case 4:return s.sent(),[4,window._AirwallexSDKs.__controller__.createElement(n,e)];case 5:return i=s.sent(),o=ae(),qn("[components-sdk] SDK createElement being called",{elementName:n,options:Kn(e),start:r,latency:o-r,end:o}),[3,7];case 6:if((a=s.sent()).code)throw a;return Hn("[components-sdk] Unexpected errors when createElement",{error:a}),[3,7];case 7:return[2,i]}}))}))},ve=[Vn,Gn],me=function(){ve.forEach((function(n){var e=oe({name:n,env:Mn.prod}),t=document.createElement("link");t.href=e,t.rel="modulepreload",t.as="script",(document.head||document.body).appendChild(t)}))};"undefined"==typeof document||"undefined"==typeof window||("loading"===document.readyState?document.addEventListener("DOMContentLoaded",me):me()),"undefined"!=typeof window&&(window.AirwallexComponentsSDK||Object.defineProperties(window,{AirwallexComponentsSDK:{value:{},writable:!1},_AirwallexSDKs:{value:{},writable:!1}}),window.AirwallexComponentsSDK.init=de,window.AirwallexComponentsSDK.createElement=fe);const{onChange:pe,reset:he,state:ye}=n((()=>({clientSecret:null,currency:null,hasPaymentError:!1,isReady:!1,paymentConfirmed:!1,paymentIntentId:null}))),we=n=>"AIRWALLEX"===n.paymentProcessor&&(n.clientSecret&&(ye.clientSecret=n.clientSecret),n.paymentIntentId&&(ye.paymentIntentId=n.paymentIntentId),!!ye.clientSecret||(o("Airwallex checkout session is missing the client secret"),!1)),ge={ar:"ar",da:"da",de:"de",en:"en",es:"es",fr:"fr",id:"id",it:"it",ja:"ja",ko:"ko",nl:"nl",pl:"pl",pt:"pt",ru:"ru",sv:"sv",zh:"zh"},be=n=>ge[n]||"en";let ke=null;const xe=async()=>!!ye.isReady||(ke||(ke=de({enabledElements:["payments"],env:e.zonosMode&&"production"!==e.zonosMode||"LIVE"!==e.checkoutSettings.mode?"demo":"prod",locale:be(r.selectedLocale)}).then((()=>(ye.isReady=!0,u("Airwallex SDK initialized"),!0))).catch((n=>(o(n),ke=null,!1)))),ke),Ee=["SUCCEEDED","REQUIRES_CAPTURE","PENDING_REVIEW","PENDING"],Ie=n=>!!n&&Ee.includes(n),Se=n=>{switch(n){case"SUCCEEDED":return{isError:!1,messages:[t("Thank you for submitting your payment. We appreciate your prompt attention."),"",t("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]};case"PENDING":case"PENDING_REVIEW":case"REQUIRES_CAPTURE":return{isError:!1,messages:[t("Payment processing. We'll update you when payment is received.")]};case"REQUIRES_CUSTOMER_ACTION":return{isError:!1,messages:[t("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]};case"CANCELLED":case"REQUIRES_PAYMENT_METHOD":return{isError:!0,messages:[t("Payment failed. Please reload the page and try another payment method.")]};default:return{isError:!0,messages:[t("Something went wrong.")]}}},Ne=async n=>{const{errors:e,json:t}=await a("/api/zonos-elements/collect/airwallex-payment-intent",{body:{paymentIntentId:n},method:"POST"});return e.length||!t?(o("Failed to retrieve Airwallex payment intent",e),{status:null}):{status:t.airwallexPaymentIntent.status}},{state:Ce}=n((()=>({amountDutyTaxFeeTotal:null,amountTotalPaid:null,collectLogoUrl:null,isFetchingShippingInfo:!0,landedCostShortId:null,originCompanyName:null,partyBillingId:null,paymentProcessor:null,shippingAddress:null}))),Te=async({landedCostId:n,retries:t=5})=>{var r,i,o,u,c,l,d,v,m,p;Ce.isFetchingShippingInfo=!0;const h=await a("/api/zonos-elements/collect/get-shipping-info-by-lc-id",{body:{landedCostId:n},method:"POST"});if(h.errors.length)return t>0?(await new Promise((n=>setTimeout(n,1e3))),Te({landedCostId:n,retries:t-1})):null;Ce.landedCostShortId=(null===(r=h.json)||void 0===r?void 0:r.landedCostShortId)||null,Ce.isFetchingShippingInfo=!1,Ce.shippingAddress=(null===(i=h.json)||void 0===i?void 0:i.shipping)||null;const y=null===(o=f.checkoutSession)||void 0===o?void 0:o.landedCost,w=null===(u=f.checkoutSession)||void 0===u?void 0:u.subtotals,g=((null===(c=null==y?void 0:y.amountSubtotals)||void 0===c?void 0:c.shipping)||0)+((null===(l=null==y?void 0:y.amountSubtotals)||void 0===l?void 0:l.items)||0);Ce.amountTotalPaid=g*((null===(d=null==w?void 0:w.exchangeRate)||void 0===d?void 0:d.rate)||1),Ce.amountDutyTaxFeeTotal=((null==w?void 0:w.duties)||0)+((null==w?void 0:w.taxes)||0)+((null==w?void 0:w.fees)||0),Ce.originCompanyName=(null===(m=null===(v=h.json)||void 0===v?void 0:v.origin)||void 0===m?void 0:m.companyName)||null,Ce.collectLogoUrl=(null===(p=h.json)||void 0===p?void 0:p.collectLogoUrl)||null,0===Ce.amountTotalPaid&&s({endpoint:"COLLECT_NO_TOTAL_PAID",errors:[],metadata:{landedCostId:n,organizationId:e.organizationId}})},De=async()=>{var n,e,t,r;if(!(null===(n=l.stripeBillingAddressEventData)||void 0===n?void 0:n.complete))return{partiesCreated:!1};const u=null===(t=null===(e=f.checkoutSession)||void 0===e?void 0:e.landedCost)||void 0===t?void 0:t.rootId;if(!u)return s({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:c,cartId:window.Zonos.cartId,checkoutSessionId:i.checkoutSessionId}}),{partiesCreated:!1};if(!i.checkoutSessionId)return s({endpoint:"COLLECT_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:c,cartId:window.Zonos.cartId,landedCostRootId:u}}),{partiesCreated:!1};const v=d({address:l.stripeBillingAddressEventData.value.address,firstName:l.stripeBillingAddressEventData.value.firstName,lastName:l.stripeBillingAddressEventData.value.lastName,name:l.stripeBillingAddressEventData.value.name,phone:l.stripeBillingAddressEventData.value.phone}),m="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:p,json:h}=await a("/api/zonos-elements/create-billing-party",{body:{billingAddress:v,checkoutSessionId:i.checkoutSessionId,companyName:l.companyName,email:(null===(r=l.stripeLinkEventData)||void 0===r?void 0:r.value.email)||"",isTest:m,rootId:u},method:"POST"});return p.length||!h?(o("Error occurs when creating billing party",JSON.stringify(p,null,2)),s({endpoint:"COLLECT_BILLING_PARTY_CREATE_FAILED",errors:["[COLLECT] Failed to create billing party"],metadata:{allLogs:c,cartId:window.Zonos.cartId,checkoutSessionId:i.checkoutSessionId,errors:p,json:h}}),{partiesCreated:!1}):(Ce.partyBillingId=h.billToPartyId,{partiesCreated:!0})},Pe=async n=>{const e=n.landedCost;return!!e&&(f.landedCostData=[Object.assign(Object.assign({},n),{landedCost:Object.assign({},e),landedCostId:e.id})],v({applySubtotalsOnly:!0,landedCostId:e.id,selectedShippingOption:e.shipmentRating}))};export{we as a,ye as b,Ce as c,Ne as d,Ie as e,xe as f,Pe as g,Te as h,De as i,Se as j,he as k,fe as l,be as m,pe as n}
|
|
1
|
+
import{c as n,z as e}from"./p-27660512.js";import{t,l as r,s as i}from"./p-6bdc5c96.js";import{l as o,h as a,s}from"./p-41dd1cb8.js";import{l as u,b as c}from"./p-0a377722.js";import{b as l,M as d,d as f,N as v}from"./p-a4c7ee17.js";function m(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function p(n,e,t,r,i,o,a){try{var s=n[o](a),u=s.value}catch(n){return void t(n)}s.done?e(u):Promise.resolve(u).then(r,i)}function h(n){return function(){var e=this,t=arguments;return new Promise((function(r,i){var o=n.apply(e,t);function a(n){p(o,r,i,a,s,"next",n)}function s(n){p(o,r,i,a,s,"throw",n)}a(void 0)}))}}function y(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function w(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}function g(n,e,t){return e&&w(n.prototype,e),t&&w(n,t),n}function b(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function k(n,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](n):n instanceof e}function x(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})))),r.forEach((function(e){b(n,e,t[e])}))}return n}function E(n,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):function(n){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);e.push.apply(e,t)}return e}(Object(e)).forEach((function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))})),n}function I(n,e){return function(n){if(Array.isArray(n))return n}(n)||function(n,e){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=t){var r,i,o=[],a=!0,s=!1;try{for(t=t.call(n);!(a=(r=t.next()).done)&&(o.push(r.value),!e||o.length!==e);a=!0);}catch(n){s=!0,i=n}finally{try{a||null==t.return||t.return()}finally{if(s)throw i}}return o}}(n,e)||C(n,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(n){return function(n){if(Array.isArray(n))return m(n)}(n)||function(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}(n)||C(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(n){return n&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n}function C(n,e){if(n){if("string"==typeof n)return m(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?m(n,e):void 0}}function T(n,e){var t,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(n,a)}catch(n){o=[6,n],r=0}finally{t=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var D,P,R,O,j,_=function(n){return n.production="prod",n.demo="demo",n.staging="staging",n}(_||{}),A="airTracker_unknown",L={appName:A,appVersion:A,env:"staging",isWebappContainer:!1,delay:2e3,errorRepeatTime:3,enableErrorMonitoring:!1,assetSpeedMonitoringWhiteList:[],enableDetectPageChange:!1,enableRecordPageRetention:!1,hideSearchParams:!1,useSessionStorageForSessionId:!1,assetSpeedMonitoringWhiteListByMFE:{}},U={appName:A,env:"staging",sessionId:A,deviceId:A},M=function(){var n=new WeakSet;return function(e,t){if(k(t,Error))return"Error.message: ".concat(t.message," \n Error.stack: ").concat(t.stack);if("object"===(void 0===t?"undefined":N(t))&&null!==t){if(n.has(t))return"[Circular ".concat(e||"root","]");n.add(t)}return"function"==typeof t?"function":"symbol"===(void 0===t?"undefined":N(t))?"symbol":void 0===t?null:t}},F=function(n){if("string"==typeof n)return n;try{return k(n,Error)?(JSON.stringify(n,M())||"undefined").replace(/"/gim,""):JSON.stringify(n,M())}catch(n){return'{"error":"error happen when airTracker stringify"}'}},K=function(n){var e=n.method,t=void 0===e?"post":e,r=n.url,i=n.data,o=n.success,a=n.fail;if((s=i)&&!/^\s*$/.test(s)&&(s=(s=(s=s.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@")).replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]")).replace(/(?:^|:|,)(?:\s*\[)+/g,""),/^[\],:{}\s]*$/.test(s))){var s,u=new XMLHttpRequest;u.addEventListener("readystatechange",(function(){4===u.readyState&&(u.status>=400||0===u.status?null==a||a(u.response):null==o||o(u.response))})),u.open(t,r),u.setRequestHeader("Content-Type","application/json"),u.send(i)}},H="onCommonUpdated",q="AIR_ANALYTICS_DEVICE_ID",z="AIR_ANALYTICS_SESSION_ID",B=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(n){var e=16*Math.random()|0;return("x"===n?e:3&e|8).toString(16)}))},W=function(n){var e,t,r;return n.config.getMFEName?n.config.getMFEName():(null===(r=location)||void 0===r||null===(t=r.pathname)||void 0===t||null===(e=t.split("/"))||void 0===e?void 0:e[2])||"unknown"},X=function(n){return"string"==typeof n?n.split("?")[1]||"":n},V=function(n){return"string"==typeof n&&n.startsWith("//")?"undefined"!=typeof location&&"https:"===location.protocol:/^https/.test(n)},G=function(n,e){return"number"==typeof n||"string"==typeof n?n:e?"":-1},$=function(n,e){var t,r=!1;if(!e.config.isWebappContainer)return J(n,e.config.assetSpeedMonitoringWhiteList);var i=W(e);return r||J(n,null===(t=e.config.assetSpeedMonitoringWhiteListByMFE)||void 0===t?void 0:t[i])},J=function(n,e){if(!(null==e?void 0:e.length))return!1;for(var t=0;t<e.length;t++){var r=e[t];if(k(r,RegExp)&&r.test(n))return!0;if("string"==typeof r&&n.includes(r))return!0}return!1},Q=function(n,e){return Math.round(100*(n-e))/100},Y=function(n){return function(e){var t,r,i=W(n),o=n.config.isWebappContainer?x({},n.commonData||{},(null===(t=n.MFECommonDataMap)||void 0===t?void 0:t[i])||{}):n.commonData,a=Array.isArray(e)?e:[e];if(0!==a.length){var s,u=F({commonData:o,data:a}),c={method:"post",url:(s=n.commonData.env,"prod"==s?"https://o11y.airwallex.com/airtracker/logs":"demo"==s?"https://o11y-demo.airwallex.com/airtracker/logs":"https://o11y-staging.airwallex.com/airtracker/logs"),data:u};"function"==typeof(null===(r=navigator)||void 0===r?void 0:r.sendBeacon)&&navigator.sendBeacon(c.url,u)||K(c)}}},Z=function(n){return function(e){var t,r,i,o=W(n),a={commonData:n.config.isWebappContainer?x({},n.commonData||{},(null===(t=n.MFECommonDataMap)||void 0===t?void 0:t[o])||{}):n.commonData,data:Array.isArray(e)?e:[e]},s=F(a),u={method:"post",url:(i=n.commonData.env,"prod"==i?"https://o11y.airwallex.com/airtracker/metrics":"demo"==i?"https://o11y-demo.airwallex.com/airtracker/metrics":"https://o11y-staging.airwallex.com/airtracker/metrics"),data:s};"function"==typeof(null===(r=navigator)||void 0===r?void 0:r.sendBeacon)&&navigator.sendBeacon(u.url,s)||K(u)}},nn=function(n,e){var t,r=[],i=n.config;return window.addEventListener("beforeunload",(function(){r.length>0&&(n.immediateSendPipe(r.splice(0,r.length)),t&&clearTimeout(t))})),function(o,a){if(r.push(o),n.lifeCycle.on(H,(function(){r.length>0&&(null==a||a(r.splice(0,r.length)),n.lifeCycle.remove(H),t&&clearTimeout(t))})),e&&r.length>=e)return null==a||a(r.splice(0,r.length)),void(t&&clearTimeout(t));t&&clearTimeout(t),t=setTimeout((function(){t=null,r.length>0&&(null==a||a(r.splice(0,r.length)),n.lifeCycle.remove(H))}),i.delay)}},en=function(){},tn=function(n){if(!n||!n.reduce||!n.length)throw new TypeError("createPipeline need at least one function param");return 1===n.length?function(e,t){n[0](e,t||en)}:n.reduce((function(n,e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:en;return n(t,(function(n){return null==e?void 0:e(n,r)}))}}))},rn=function(){function n(){var e=this;y(this,n),this.emit=function(n,t){if(e){var r,i=e.eventsList[n];if(null==i?void 0:i.length){i=i.slice();for(var o=0;o<i.length;o++){r=i[o];try{var a=r.callback.apply(e,[t]);if(1===r.type&&e.remove(n,r.callback),!1===a)break}catch(n){throw n}}}return e}},this.eventsList={}}return g(n,[{key:"indexOf",value:function(n,e){for(var t=0;t<n.length;t++)if(n[t].callback===e)return t;return-1}},{key:"on",value:function(n,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(this){var r=this.eventsList[n];return r||(this.eventsList[n]=[],r=this.eventsList[n]),-1===this.indexOf(r,e)?(r.push({name:n,type:t||0,callback:e}),this):this}}},{key:"one",value:function(n,e){this.on(n,e,1)}},{key:"remove",value:function(n,e){if(this){var t=this.eventsList[n];if(!t)return null;if(!e){try{delete this.eventsList[n]}catch(n){}return null}if(t.length){var r=this.indexOf(t,e);t.splice(r,1)}return this}}},{key:"clear",value:function(){this.eventsList={}}}]),n}(),on=function(){function n(e){y(this,n),this.name="",this.isInit=!1,this.name=e.name,this.option=e}return g(n,[{key:"patch",value:function(n){var e,t;this.isInit||(this.isInit=!0,null===(t=this.option)||void 0===t||null===(e=t.setUp)||void 0===e||e.call(this.option,n))}},{key:"uninstall",value:function(){var n,e;null===(e=this.option)||void 0===e||null===(n=e.destroy)||void 0===n||n.apply(this),this.isInit=!1}}]),n}(),an=function(n){var e="".concat(F(n.message)||""," @ (").concat(F(n.filename)||"",":").concat(n.lineno||0,":").concat(n.colno||0,")\n").concat(F(n.error||""));D.normalLogPipeLine({severity:"autoDetectError",eventName:"windowOnError",extraInfo:{error:e}})},sn=function(n){var e=n&&F(n.reason);D.normalLogPipeLine({severity:"autoDetectError",eventName:"promiseError",extraInfo:{error:e}})},un=function(n){var e=(null==n?void 0:n.target)||(null==n?void 0:n.srcElement);if(e){var t=(null==e?void 0:e.src)||(null==e?void 0:e.href),r=e.tagName,i="unknown";if("string"==typeof t&&r){if(window.location.href.indexOf(t)>-1)return;if(/\.js$/.test(t))i="script";else if(/\.css$/.test(t))i="css";else switch(r.toLowerCase()){case"script":i="script";break;case"link":i="css";break;case"img":i="image";break;case"audio":case"video":i="media";break;default:return}D.normalLogPipeLine({severity:"autoDetectError",eventName:"staticFileLoadError",extraInfo:{staticFileType:i,error:"".concat(r," load fail: ").concat(t)}})}}},cn=new on({name:"errorDetectionPlugin",setUp:function(n){D=n,window.addEventListener("error",an),window.addEventListener("unhandledrejection",sn),window.document.addEventListener("error",un,!0)},destroy:function(){window.removeEventListener("unhandledrejection",sn),window.document.removeEventListener("error",un,!0),window.removeEventListener("error",an)}}),ln=["img","css","script","link","audio","video","iframe"],dn="resource",fn=function(n){var e,t=n.name;return{url:(e=t,"string"==typeof e?(e.split("?")[0]||"").slice(0,200):e),method:"get",duration:Number(n.duration.toFixed(2)),type:"static",isHttps:V(t),urlQuery:X(t),domainLookup:G(n.domainLookupEnd-n.domainLookupStart),connectTime:G(n.connectEnd-n.connectStart)}},vn=function(n,e){for(var t=0,r=n.length;t<r;t++){var i=n[t];-1!==ln.indexOf(i.initiatorType)&&$(i.name,e)&&e.normalLogPipeLine({severity:"performance",eventName:"assets_speed",extraInfo:{log:fn(i)}})}},mn=new on({name:"assetsSpeedPlugin",setUp:function(n){if(void 0!==window.performance&&"function"==typeof window.performance.clearResourceTimings&&"function"==typeof window.performance.getEntriesByType&&"function"==typeof window.performance.now){var e=0;window.performance.onresourcetimingbufferfull=function(){e=0,window.performance.clearResourceTimings()},"function"==typeof window.PerformanceObserver?(vn(window.performance.getEntriesByType(dn),n),(R=new window.PerformanceObserver((function(e){vn(e.getEntries(),n)}))).observe({entryTypes:[dn]})):P=setInterval((function(){var t=window.performance.getEntriesByType(dn),r=t.slice(e);e=t.length,vn(r,n)}),3e3)}},destroy:function(){null==R||R.disconnect(),P&&clearInterval(P)}}),pn=new on({name:"onPageChangePlugin",setUp:function(){var n=h((function(n){var e,t,r,i;return T(this,(function(){return t=null===(e=location)||void 0===e?void 0:e.href,r=document.querySelector("body"),i=function(e){var t,r,i,o,a;n.normalLogPipeLine({severity:"autoDetectEvent",eventName:"onPageChange",extraInfo:{prevHref:e.prevHref,href:(null===(t=location)||void 0===t?void 0:t.href)||"",hostname:null===(r=location)||void 0===r?void 0:r.hostname,pathName:null===(i=location)||void 0===i?void 0:i.pathname,protocol:null===(o=location)||void 0===o?void 0:o.protocol,search:null===(a=location)||void 0===a?void 0:a.search}})},i({prevHref:""}),(O=new MutationObserver((function(){if(location.href!==t){var n=t;t=location.href,i({prevHref:n})}}))).observe(r||document,{subtree:!0,childList:!0}),[2]}))}));return function(e){return n.apply(this,arguments)}}(),destroy:function(){null==O||O.disconnect()}}),hn=new on({name:"onPageRetentionPlugin",setUp:function(){var n=h((function(n){var e,t,r,i,o,a;return T(this,(function(){return void 0===document.visibilityState||(t=null===(e=location)||void 0===e?void 0:e.href,r=document.querySelector("body"),(o=function(){i=Date.now()})(),document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState?a({href:location.href,leftReason:"visibilityChange"}):"visible"===document.visibilityState&&o()})),window.addEventListener("beforeunload",(function(){a({href:location.href,sendImmediate:!0,leftReason:"pageClose"})})),a=function(e){var t=e.href,r=e.sendImmediate,o=e.leftReason;if(i){var a=Date.now()-i;if(0!==a){i=void 0;var s={severity:"autoDetectEvent",eventName:"onPageRetention",extraInfo:{href:t,duration:a,leftReason:o}};r?n.ImmediatePipeline(s):n.normalLogPipeLine(s)}}},(j=new MutationObserver((function(){if(location.href!==t){var n=t;t=location.href,a({href:n,leftReason:"nextPage"}),o()}}))).observe(r||document,{subtree:!0,childList:!0})),[2]}))}));return function(e){return n.apply(this,arguments)}}(),destroy:function(){null==j||j.disconnect()}}),yn=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2,15)},wn=function(n,e){return![/authenticate\/heartbeat/,/papluginlogs\/.*/,/airtracker\/.*/,/o11y(-staging|-demo)?\.airwallex\.com/,/\.(png|jpe?g|gif|svg|ico|webp|avif|css|js|json|woff2?|ttf|eot|map|txt|csv|xml)(\?.*)?(#.*)?$/i].some((function(e){return e.test(n)}))&&J(n,e||[/^https?:\/\/[^\/]*\.airwallex\.com($|\/)/])},gn=function(n){return Math.round(100*n)/100},bn=function(n,e){var t,r,i,o,a,s,u,c,l,d,f,v,m,p,h,y,w,g,b,k=n.url,I=n.method,S=n.errorType,N=n.errorDetail,C=function(n){var e=n.startTime,t=n.endTime,r=n.entries;if(0!==r.length){if(1===r.length)return r[0];var i=r.filter((function(n){return n.startTime>=e&&t&&n.responseEnd<=t})).sort((function(n,e){return n.startTime-e.startTime}));return null==i?void 0:i[0]}}(n),T=new URL(k,window.location.href),D=T.href,P=T.protocol,R=C?(i=(t=C).duration,o=t.responseStart,a=t.connectEnd,s=t.connectStart,u=t.domainLookupEnd,c=t.domainLookupStart,l=t.requestStart,d=t.secureConnectionStart,f=t.redirectEnd,v=t.redirectStart,m=t.responseStatus,p=t.responseEnd,h=t.encodedBodySize,y=t.decodedBodySize,w=t.transferSize,g=t.deliveryType,b=t.initiatorType,{startTime:gn(r=t.startTime),totalDuration:gn(i),timeToFirstByte:Q(o,r),tcpDuration:Q(a,s),dnsDuration:Q(u,c),tlsDuration:Q(l,d),redirectDuration:Q(f,v),responseDuration:Q(p,o),encodeResponseSize:h,decodeResponseSize:y,transferSize:w,deliveryType:g,statusCode:m,initiatorType:b}):{};return{severity:"autoDetectEvent",eventName:"httpClientMetrics",extraInfo:x(E(x({httpUrl:D,method:I,scheme:P},S&&{errorType:S},N&&{errorDetail:N},R),{statusCode:(null==R?void 0:R.statusCode)||(null==n?void 0:n.responseStatus),startTime:(null==R?void 0:R.startTime)||(null==n?void 0:n.startTime),initiatorType:(null==R?void 0:R.initiatorType)||(null==n?void 0:n.initiatorType)}),e)}},kn=function(n){return n&&"object"===(void 0===n?"undefined":N(n))&&"errors"in n&&Array.isArray(n.errors)&&n.errors.every((function(n){return n&&"object"===(void 0===n?"undefined":N(n))&&"message"in n}))},xn="awx_airtracker_api_performance_queue",En="awx_airtracker_api_performance_plugin_loaded",In="undefined"!=typeof window?window:"undefined"!=typeof global?global:{};In[xn]=In[xn]||[];var Sn=function(n,e,t){setTimeout((function(){var r=bn(n,t);e.observerPipeline(r),In[xn]=In[xn].filter((function(e){return e.id!==n.id}))}),300)},Nn=function(n,e){setTimeout((function(){var t=In[xn].find((function(e){return e.id===n}));if(t){var r=bn(t,{exceptionType:"timeout-without-response"});e.observerPipeline(r),In[xn]=In[xn].filter((function(e){return e.id!==n}))}}),1e4)},Cn=new on({name:"apiPerformancePlugin",setUp:function(){var n=h((function(n){var e,t;return T(this,(function(){return In[En]||(null===(e=n.config)||void 0===e?void 0:e.enableRecordAPIPerformance)&&Math.random()<((null===(t=n.config)||void 0===t?void 0:t.enableRecordAPIPerformancePercentage)||0)&&(In[En]=!0,function(n){var e;(function(n){var e=XMLHttpRequest.prototype.open,t=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function(t,r,i,o,a){try{var s,u=yn();this.__requestId=u;var c=k(r,URL)?r.href:new URL(r,window.location.href).href;if(!wn(c,null===(s=n.config)||void 0===s?void 0:s.enableRecordAPIPerformanceWhitelist))return e.call(this,t,r,null==i||i,o,a);var l={id:u,startTime:performance.now(),method:t,url:c,entries:[],initiatorType:"xmlhttprequest"};return In[xn].push(l),Nn(u,n),e.call(this,t,r,null==i||i,o,a)}catch(s){return n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject XHR open error",error:s}}),e.call(this,t,r,null==i||i,o,a)}},XMLHttpRequest.prototype.send=function(){for(var e=this,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];try{var a=In[xn].find((function(n){return n.id===e.__requestId}));if(!a)return t.apply(this,i);var s=this;return this.addEventListener("loadend",h((function(){var e,t,r,i,o,u,c;return T(this,(function(l){switch(l.label){case 0:if(e=performance.now(),t=e-a.startTime,0===(r=s.status))return[2];a.endTime=e,a.duration=t,a.responseStatus=r,l.label=1;case 1:return l.trys.push([1,6,,7]),""!==s.responseType&&"text"!==s.responseType?[3,2]:(i=s.responseText,[3,5]);case 2:return"json"!==s.responseType?[3,3]:(i=s.response,[3,5]);case 3:return"blob"!==s.responseType||"application/json"!==(null==(o=s.response)?void 0:o.type)?[3,5]:[4,o.text()];case 4:i=l.sent(),l.label=5;case 5:return(u=i&&"string"==typeof i?JSON.parse(i):i)&&kn(u)&&(a.errorType="graphqlError",a.errorDetail=u.errors),[3,7];case 6:return c=l.sent(),n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in XHR",url:null==a?void 0:a.url,error:c}}),[3,7];case 7:return Sn(a,n),[2]}}))}))),this.addEventListener("error",(function(){Sn(a,n,{exceptionType:"network-error"})})),this.addEventListener("abort",(function(){Sn(a,n,{exceptionType:"abort-error"})})),this.addEventListener("timeout",(function(){Sn(a,n,{exceptionType:"timeout-error"})})),t.apply(this,i)}catch(e){throw n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"InjectXHR send error",error:e}}),e}}})(n),function(n){var e=window.fetch;window.fetch=h((function(){var t,r,i,o,a,s,u,c,l,d,f,v,m,p,h,y,w=arguments;return T(this,(function(g){switch(g.label){case 0:for(t=w.length,r=new Array(t),i=0;i<t;i++)r[i]=w[i];return s=new URL(k(r[0],Request)?r[0].url:String(r[0]),window.location.href).href,wn(s,null===(o=n.config)||void 0===o?void 0:o.enableRecordAPIPerformanceWhitelist)?[3,2]:[4,e.apply(this,r)];case 1:return[2,g.sent()];case 2:return g.trys.push([2,9,,10]),c=performance.now(),l=yn(),a={id:l,startTime:c,method:(null===(u=k(r[0],Request)?r[0]:r[1])||void 0===u?void 0:u.method)||"GET",url:s,entries:[],initiatorType:"fetch"},In[xn].push(a),Nn(l,n),[4,e.apply(this,r)];case 3:d=g.sent(),f=performance.now(),a.endTime=f,a.duration=f-c,a.responseStatus=d.status,v=d.clone(),g.label=4;case 4:return g.trys.push([4,7,,8]),v.ok?[4,v.json()]:[3,6];case 5:(m=g.sent())&&kn(m)&&(a.errorType="graphqlError",a.errorDetail=m.errors),g.label=6;case 6:return[3,8];case 7:return p=g.sent(),n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in fetch",url:null==a?void 0:a.url,error:p}}),[3,8];case 8:return Sn(a,n),[2,d];case 9:throw h=g.sent(),a&&a.id&&In[xn].find((function(n){return n.id===(null==a?void 0:a.id)}))?(y="fetch-error",k(h,TypeError)?y="network-error":k(h,DOMException)&&"AbortError"===h.name&&(y="abort-error"),Sn(a,n,{exceptionType:y})):n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject fetch error",error:h}}),h;case 10:return[2]}}))}))}(n),(null===(e=window)||void 0===e?void 0:e.PerformanceObserver)?new window.PerformanceObserver((function(n){n.getEntries().forEach((function(n){var e=n;"fetch"!==e.initiatorType&&"xmlhttprequest"!==e.initiatorType||In[xn].filter((function(n){return n.url===e.name})).forEach((function(n){n.entries.push(e)}))}))})).observe({entryTypes:["resource"],buffered:!0}):n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{error:"PerformanceObserver Not Supported"}})}(n)),[2]}))}));return function(e){return n.apply(this,arguments)}}()}),Tn=function(){function n(e){var t,r,i=this,o=e.config,a=e.plugins,s=void 0===a?[]:a;y(this,n),this.config=L,this.lifeCycle=new rn,this.plugins=[],this._commonData=U,this._MFECommonDataMap={},this.timeMap={},this.packedDataConvert=function(n){var e,t,r=n.extraInfo,o=x({severity:n.severity,eventName:n.eventName,currentHref:i.config.hideSearchParams?((null===(e=location)||void 0===e?void 0:e.href)||"").split("?")[0]||"":(null===(t=location)||void 0===t?void 0:t.href)||""},r);return i.config.isWebappContainer&&(o.MFEName=W(i)),o},this.normalPipelineObj=tn([nn(this,8),(t=this,r={},function(n,e){var i="number"==typeof t.config.errorRepeatTime?t.config.errorRepeatTime:5;if(0===i)return null==e?void 0:e(n);null==e||e(n.filter((function(n){return"autoDetectError"!=n.severity||(r[n.error]=r[n.error]||0,r[n.error]+=1,!(r[n.error]>i))})))}),Y(this)]),this.observerPipelineObj=tn([nn(this,8),Z(this)]),this.immediateSendPipe=Y(this),this.observerPipeline=function(n){var e=i.packedDataConvert({severity:n.severity,eventName:n.eventName,extraInfo:n.extraInfo});return i.observerPipelineObj(e)},this.normalLogPipeLine=function(n){var e=i.packedDataConvert({severity:n.severity,eventName:n.eventName,extraInfo:n.extraInfo});return i.config.disableThrottle?i.immediateSendPipe(e):i.normalPipelineObj(e)},this.ImmediatePipeline=function(n){var e=i.packedDataConvert({severity:n.severity,eventName:n.eventName,extraInfo:n.extraInfo});return i.immediateSendPipe(e)},this.plugins=S(s),this.setConfig(o),this.initCommonData(o),this.lifeCycle.emit("onInit"),o.enableErrorMonitoring&&this.plugins.push(cn),((null==o?void 0:o.assetSpeedMonitoringWhiteList)&&o.assetSpeedMonitoringWhiteList.length>0||o.isWebappContainer)&&this.plugins.push(mn),(null==o?void 0:o.enableDetectPageChange)&&this.plugins.push(pn),(null==o?void 0:o.enableRecordPageRetention)&&this.plugins.push(hn),(null==o?void 0:o.enableRecordAPIPerformance)&&(null==o?void 0:o.enableRecordAPIPerformancePercentage)&&o.enableRecordAPIPerformancePercentage>0&&o.enableRecordAPIPerformancePercentage<=1&&this.plugins.push(Cn),this.installPlugins()}return g(n,[{key:"installPlugins",value:function(){var n=this;this.plugins.forEach((function(e){e.patch(n)}))}},{key:"commonData",get:function(){return this._commonData}},{key:"MFECommonDataMap",get:function(){return this._MFECommonDataMap}},{key:"initCommonData",value:function(n){this._commonData.sessionId=n.useSessionStorageForSessionId?function(){try{var n=window.sessionStorage.getItem(z);return n||(n=B(),window.sessionStorage.setItem(z,n)),n}catch(n){return B()}}():B(),this._commonData.deviceId=function(){try{var n=window.localStorage.getItem(q);return n||(n=B(),window.localStorage.setItem(q,n)),n}catch(n){}}()||A,this._commonData.riskDeviceId=function(){try{return window.localStorage.getItem("AWX_RISK_ID")||void 0}catch(n){}}(),this._commonData.networkType=function(){var n,e,t="",r=navigator.userAgent.match(/NetType\/(\w+)/);if(r)t=I(r,2)[1];else if(null===(n=navigator)||void 0===n?void 0:n.connection){var i,o,a,s;t=(null===(o=navigator)||void 0===o||null===(i=o.connection)||void 0===i?void 0:i.effectiveType)||(null===(s=navigator)||void 0===s||null===(a=s.connection)||void 0===a?void 0:a.type)}return t||(t="unknown"),e=t,(e=String(e).toLowerCase()).indexOf("4g")>=0?"net4g":e.indexOf("wifi")>=0?"wifi":e.indexOf("5g")>=0?"net5g":e.indexOf("3g")>=0?"net3g":e.indexOf("2g")>=0?"net2g":"unknown"}()||"unknown",this._commonData.env=n.env||this._commonData.env,this._commonData.accountId=n.accountId||A,this._commonData.appVersion=n.appVersion,this._commonData.appName=n.appName,this._commonData.sdkVersion="3.1.0",this.lifeCycle.emit("onCommonDataInit",this.commonData)}},{key:"updateCommonDataBasedOnConfig",value:function(n){this.lifeCycle.emit(H,this._commonData),this._commonData.env=n.env||this._commonData.env,this._commonData.appName=n.appName||this._commonData.appName,this._commonData.env=n.env||this._commonData.env,this._commonData.accountId=n.accountId||this._commonData.accountId,this._commonData.appVersion=n.appVersion||this._commonData.appVersion}},{key:"updateCommonData",value:function(n){this.lifeCycle.emit(H,this._commonData),this._commonData=x({},this._commonData,n)}},{key:"removeCommonDataByKey",value:function(n){var e=this;this.lifeCycle.emit(H,this._commonData),setTimeout((function(){n.forEach((function(n){delete e._commonData[n]}))}),1e3)}},{key:"addToMFECommonData",value:function(n){var e,t=n.MFEName,r=n.MFECommonData;this.config.isWebappContainer&&t&&r&&(this._MFECommonDataMap=E(x({},this._MFECommonDataMap||{}),b({},t,x({},(null===(e=this._MFECommonDataMap)||void 0===e?void 0:e[t])||{},r))))}},{key:"setConfig",value:function(n){var e=this;this.config.isWebappContainer||(Object.entries(n).forEach((function(n){var t=I(n,2),r=t[0],i=t[1];void 0!==(void 0===i?"undefined":N(i))&&function(n,t){e.config[n]=t}(r,i)})),this.lifeCycle.emit("onConfigInit",this.config),this.updateCommonDataBasedOnConfig(n))}},{key:"verbose",value:function(n,e){this.normalLogPipeLine({severity:"verbose",eventName:n,extraInfo:e})}},{key:"httpLog",value:function(n,e){this.normalLogPipeLine({severity:"http",eventName:n,extraInfo:e})}},{key:"info",value:function(n,e){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:e})}},{key:"warn",value:function(n,e){this.normalLogPipeLine({severity:"warn",eventName:n,extraInfo:e})}},{key:"error",value:function(n,e){console.error("error",n),this.normalLogPipeLine({severity:"error",eventName:n,extraInfo:e})}},{key:"businessLog",value:function(n,e){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:E(x({},e),{isBusinessLog:!0})})}},{key:"reportDuration",value:function(n,e,t){"string"==typeof n?"number"==typeof e?e<0||e>6e4?console.warn("reportDuration: duration (second param) must between 0 and 60000"):this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:x({duration:e},t)}):console.warn("reportDuration: duration (second param) must be number"):console.warn("reportDuration: eventName (first param) must be a string")}},{key:"getTimerKey",value:function(n){var e=W(this);return this.config.isWebappContainer?"".concat(e,"_").concat(n):n}},{key:"timeStart",value:function(n){"string"==typeof n?(this.timeMap[this.getTimerKey(n)]&&console.warn("Timer ".concat(n," already exists")),this.timeMap[this.getTimerKey(n)]=Date.now()):console.warn("time: first param must be a string")}},{key:"timeEnd",value:function(n,e){if("string"==typeof n)if(this.timeMap[this.getTimerKey(n)]){var t=Date.now()-this.timeMap[this.getTimerKey(n)]+(e||0);this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:{duration:t}}),delete this.timeMap[this.getTimerKey(n)]}else console.warn("Timer key :".concat(n," does not exist"));else console.warn("timeEnd: first param must be a string")}},{key:"addToAssetSpeedWhiteListByMFE",value:function(n){var e,t,r,i,o=n.MFEName,a=n.whiteList;this.config.isWebappContainer&&o&&(null==a?void 0:a.length)&&(this.config.assetSpeedMonitoringWhiteListByMFE||(this.config.assetSpeedMonitoringWhiteListByMFE={}),(null===(e=this.config.assetSpeedMonitoringWhiteListByMFE)||void 0===e?void 0:e[o])?null===(i=this.config.assetSpeedMonitoringWhiteListByMFE)||void 0===i||null===(r=i[o])||void 0===r||(t=r).push.apply(t,S(a)):this.config.assetSpeedMonitoringWhiteListByMFE=E(x({},this.config.assetSpeedMonitoringWhiteListByMFE),b({},o,a)))}},{key:"destroy",value:function(){this.config.isWebappContainer||this.plugins.forEach((function(n){n.uninstall()}))}}]),n}(),Dn=Tn,Pn=function(n,e){return Pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])},Pn(n,e)};function Rn(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=n}Pn(n,e),n.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t)}var On=function(){return On=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var i in e=arguments[t])Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n},On.apply(this,arguments)};function jn(n,e,t,r){return new(t||(t=Promise))((function(i,o){function a(n){try{u(r.next(n))}catch(n){o(n)}}function s(n){try{u(r.throw(n))}catch(n){o(n)}}function u(n){var e;n.done?i(n.value):(e=n.value,e instanceof t?e:new t((function(n){n(e)}))).then(a,s)}u((r=r.apply(n,e||[])).next())}))}function _n(n,e){var t,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(t=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(n,a)}catch(n){s=[6,n],r=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function An(n,e,t){if(t||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return n.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var Ln,Un,Mn,Fn={dev:_.staging,staging:_.staging,demo:_.demo,prod:_.production},Kn=function(n){if("object"!=typeof n)return n;try{var e=JSON.parse(JSON.stringify(n));return Object.keys(e).forEach((function(n){"string"==typeof n&&["auth","code"].some((function(e){return n.includes(e)}))&&(e[n]="***")})),e}catch(e){return n}},Hn=function(n,e){var t,r;null===(r=null===(t=window._AirwallexSDKs)||void 0===t?void 0:t.airTracker)||void 0===r||r.error(n,On(On({},e),{context:"components-sdk"}))},qn=function(n,e){var t;null===(t=window._AirwallexSDKs.airTracker)||void 0===t||t.info(n,On(On({},e),{context:"components-sdk"}))},zn=function(n){function e(e){var t=n.call(this,e)||this;return t.code="LOAD_SCRIPT_ERROR",t}return Rn(e,n),e}(Error);!function(n){n.dev="dev",n.staging="staging",n.demo="demo",n.prod="prod",n.sandbox="sandbox"}(Mn||(Mn={}));var Bn,Wn=((Ln={})[Mn.dev]="https://checkout-staging.airwallex.com",Ln[Mn.staging]="https://checkout-staging.airwallex.com",Ln[Mn.demo]="https://checkout-demo.airwallex.com",Ln[Mn.prod]="https://checkout.airwallex.com",Ln[Mn.sandbox]="https://checkout.sandbox.airwallex.com",Ln),Xn=((Un={})[Mn.dev]="https://static-staging.airwallex.com",Un[Mn.staging]="https://static-staging.airwallex.com",Un[Mn.demo]="https://static-demo.airwallex.com",Un[Mn.prod]="https://static.airwallex.com",Un[Mn.sandbox]="https://static.sandbox.airwallex.com",Un),Vn="sdkController",Gn="payments",$n={kyc:"/widgets/kyc/sdk/v1/index.js",rfi:"/widgets/kycRfi/sdk/v1/index.js",paymentsKyb:"/widgets/paymentsKyb/sdk/v1/index.js",sdkController:"/widgets/sdk-controller/sdk/v1/index.js",payouts:"/widgets/payouts/sdk/v1/index.js",payments:"/assets/elements.bundle.min.js",sca:"/hosted-sca/sdk/v1/index.js",taxForm:"/widgets/taxForm/sdk/v1/index.js",billing:"/widgets/checkout/sdk/v1/index.js"},Jn={kyc:"kyc",paymentsKyb:"paymentsKyb",kycRfi:"rfi",transactionRfi:"rfi",paymentEnablementRfi:"rfi",lendingRfi:"rfi",mrmRfi:"rfi",payoutForm:"payouts",beneficiaryForm:"payouts",hpp:"payments",cvc:"payments",card:"payments",expiry:"payments",dropIn:"payments",cardNumber:"payments",applePayButton:"payments",googlePayButton:"payments",krCardNumber:"payments",krCardIdentifier:"payments",krCardExpiry:"payments",krCardPswFirstTwo:"payments",scaSetup:"sca",scaVerify:"sca",scaManagement:"sca",taxForm:"taxForm",embeddedCheckout:"billing"},Qn={payments:["hpp","cvc","card","expiry","dropIn","cardNumber","applePayButton","googlePayButton","krCardNumber","krCardIdentifier","krCardExpiry","krCardPswFirstTwo"],payouts:["payoutForm","beneficiaryForm"],onboarding:["kyc","paymentsKyb"],risk:["scaSetup","scaVerify","scaManagement","transactionRfi","kycRfi","paymentEnablementRfi","lendingRfi","mrmRfi"],billing:["embeddedCheckout"]},Yn={billing:["payments"]},Zn=["payments","sca"],ne=function(n){function e(e){var t=n.call(this,e)||this;return t.code="INVALID_STATIC_RESOURCE_ERROR",t}return Rn(e,n),e}(Error),ee=Date.now(),te=function(n){return Jn[n]},re=function(n){var e=n.reduce((function(n,e){return n.concat((t=e,Object.keys(Qn).includes(t)?Qn[e]:e));var t}),[]);return Array.from(new Set(e)).map((function(n){return{elementName:n,sdkName:te(n)}}))},ie=function(n){return"payments"===n?"payment":n},oe=function(n){var e=n.name,t=n.env,r=function(n,e){var t=n===Gn?Wn:Xn;return t[e]||t.prod}(e,void 0===t?Mn.prod:t),i=$n[e];if(!i)throw Hn("[components-sdk] Element static resource not found",{sdkName:e}),new ne("Element ".concat(e," static resource URL is invalid."));return"".concat(r).concat(i,"?ts=").concat(ee)},ae=function(){return Math.floor(performance.now())},se=function(n){function e(e){var t=n.call(this,e)||this;return t.code="INSTANCE_NOT_FOUND_ERROR",t}return Rn(e,n),e}(Error),ue=new Map,ce=function(n){var e=n.scriptName,t=oe({name:e,env:n.env}),r=ue.get(e);if(r)return r;var i=function(n){return jn(void 0,void 0,void 0,(function(){var e,t;return _n(this,(function(r){switch(r.label){case 0:if("undefined"==typeof window)throw new Error("Please load script in browser environment");e=0,t=function(){return jn(void 0,void 0,void 0,(function(){var t,r,i;return _n(this,(function(){return t=ae(),e>0&&n.includes("?ts=")&&((r=new URL(n,window.location.href)).searchParams.set("ts","".concat(Date.now())),n=r.toString()),i=function(n){var e=document.createElement("script");return e.src=n,e.type="module",(document.head||document.body).appendChild(e),e}(n),[2,new Promise((function(r,o){i.addEventListener("load",(function(){var i=ae();qn("[components-sdk] SDK script loaded",{scriptUrl:n,start:t,latency:i-t,end:i,retryCount:e}),r(!0)})),i.addEventListener("error",(function(r){i.remove(),console.error(r);var a=ae();Hn("[components-sdk] Failed to load script",{scriptUrl:n,error:r,start:t,latency:a-t,end:a,retryCount:e}),o(new zn("Failed to load Airwallex SDK scripts: ".concat(n)))}))}))]}))}))},r.label=1;case 1:if(!(e<3))return[3,7];r.label=2;case 2:return r.trys.push([2,4,,6]),[4,t()];case 3:return[2,r.sent()];case 4:return r.sent(),e++,[4,(void 0===i&&(i=500),new Promise((function(n){return window.setTimeout(n,i)})))];case 5:return r.sent(),[3,6];case 6:return[3,1];case 7:throw Hn("[components-sdk] Failed to load script after retry",{scriptUrl:n,retryCount:e}),new zn("Failed to load Airwallex SDK scripts: ".concat(n))}var i}))}))}(t);return ue.set(e,i),i},le=function(n){var e=n.env,t=n.scriptName;return jn(void 0,void 0,void 0,(function(){var n;return _n(this,(function(r){switch(r.label){case 0:return(n=Yn[t]||[]).length>0?[4,Promise.all(n.map((function(n){return ce({env:e,scriptName:n})})))]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2,ce({env:e,scriptName:t})]}}))}))},de=function(n){return jn(void 0,void 0,void 0,(function(){return _n(this,(function(){if("undefined"==typeof window)throw new Error("Please call the `init()` function in a browser environment.");var e,t;return t=n.clientId,void 0===(e=n.env)&&(e=_.production),window._AirwallexSDKs.airTracker||(window._AirwallexSDKs.airTracker=new Dn({config:{appName:"components-sdk",appVersion:"1.30.2",env:Fn[e]||_.production}}),window._AirwallexSDKs.airTracker.updateCommonData({clientId:t})),window,qn("[components-sdk] SDK init start",{options:Kn(n),start:ae()}),Bn=new Promise((function(e,t){var r,i=On(On({},n),{env:n.env&&Mn[n.env]?n.env:Mn.prod});window.AirwallexComponentsSDK.__env__=i.env;var o=ce({env:i.env,scriptName:Vn}).then((function(){return window._AirwallexSDKs.__controller__.init(i)})),a=null!==(r=n.enabledElements)&&void 0!==r?r:[],s=function(n){return Array.from(new Set(re(n).map((function(n){return n.sdkName})).filter((function(n){return Zn.includes(n)}))))}(a),u=s.map((function(n){return ce({env:i.env,scriptName:n}).then((function(){return o})).then((function(){var e=window._AirwallexSDKs[ie(n)];if(!e)throw Hn("[components-sdk] SDK instance not found",{functionsNamespace:n,windowSDKInstanceName:ie(n)}),new se("SDK instance not found");return window._AirwallexSDKs.__controller__.registerFunctions({functionsNamespace:n,instance:e})}))})),c=re(a).map((function(n){var e=n.sdkName,t=n.elementName;return le({scriptName:e,env:i.env}).then((function(){return o})).then((function(){var n=window._AirwallexSDKs[ie(e)];if(!n)throw Hn("[components-sdk] SDK instance not found",{sdkName:e,windowSDKInstanceName:ie(e)}),new se("SDK instance not found");return window._AirwallexSDKs.__controller__.registerElement({sdkName:e,elementName:t,instance:n})}))}));Promise.all(An(An([o],u,!0),c,!0)).then((function(){qn("[components-sdk] SDK initialized",{options:Kn(n),start:ae()}),e(Zn.reduce((function(n,e){var t;return On(On({},n),((t={})[e]=window._AirwallexSDKs.__controller__.internalSDKs[e],t))}),{}))})).catch((function(n){n.code||Hn("[components-sdk] Unexpected errors when init",{error:n}),t(n)}))})),[2,Bn]}))}))},fe=function(n,e){return jn(void 0,void 0,void 0,(function(){var t,r,i,o,a;return _n(this,(function(s){switch(s.label){case 0:if(!n)throw new Error("Element type is missing. Please specify a valid element.");if(qn("[components-sdk] SDK createElement start",{elementName:n,options:Kn(e),timestamp:ae()}),!Bn)throw function(){var n;null===(n=window._AirwallexSDKs.airTracker)||void 0===n||n.warn("[components-sdk] Did not call init before createElement",On(On({},void 0),{context:"components-sdk"}))}(),new Error("Please initialize the Element before creating it.");return[4,Bn];case 1:if(s.sent(),!(t=te(n)))throw new Error("`createElement()` with type `".concat(n,"` is not supported. Please specify a valid Element type."));r=ae(),s.label=2;case 2:return s.trys.push([2,6,,7]),[4,le({scriptName:t,env:window.AirwallexComponentsSDK.__env__||Mn.prod})];case 3:return s.sent(),[4,window._AirwallexSDKs.__controller__.registerElement({sdkName:t,elementName:n,instance:window._AirwallexSDKs[ie(t)]})];case 4:return s.sent(),[4,window._AirwallexSDKs.__controller__.createElement(n,e)];case 5:return i=s.sent(),o=ae(),qn("[components-sdk] SDK createElement being called",{elementName:n,options:Kn(e),start:r,latency:o-r,end:o}),[3,7];case 6:if((a=s.sent()).code)throw a;return Hn("[components-sdk] Unexpected errors when createElement",{error:a}),[3,7];case 7:return[2,i]}}))}))},ve=[Vn,Gn],me=function(){ve.forEach((function(n){var e=oe({name:n,env:Mn.prod}),t=document.createElement("link");t.href=e,t.rel="modulepreload",t.as="script",(document.head||document.body).appendChild(t)}))};"undefined"==typeof document||"undefined"==typeof window||("loading"===document.readyState?document.addEventListener("DOMContentLoaded",me):me()),"undefined"!=typeof window&&(window.AirwallexComponentsSDK||Object.defineProperties(window,{AirwallexComponentsSDK:{value:{},writable:!1},_AirwallexSDKs:{value:{},writable:!1}}),window.AirwallexComponentsSDK.init=de,window.AirwallexComponentsSDK.createElement=fe);const{onChange:pe,reset:he,state:ye}=n((()=>({clientSecret:null,currency:null,hasPaymentError:!1,isReady:!1,paymentConfirmed:!1,paymentIntentId:null}))),we=n=>"AIRWALLEX"===n.paymentProcessor&&(n.clientSecret&&(ye.clientSecret=n.clientSecret),n.paymentIntentId&&(ye.paymentIntentId=n.paymentIntentId),!!ye.clientSecret||(o("Airwallex checkout session is missing the client secret"),!1)),ge={ar:"ar",da:"da",de:"de",en:"en",es:"es",fr:"fr",id:"id",it:"it",ja:"ja",ko:"ko",nl:"nl",pl:"pl",pt:"pt",ru:"ru",sv:"sv",zh:"zh"},be=n=>ge[n]||"en";let ke=null;const xe=async()=>!!ye.isReady||(ke||(ke=de({enabledElements:["payments"],env:e.zonosMode&&"production"!==e.zonosMode||"LIVE"!==e.checkoutSettings.mode?"demo":"prod",locale:be(r.selectedLocale)}).then((()=>(ye.isReady=!0,u("Airwallex SDK initialized"),!0))).catch((n=>(o(n),ke=null,!1)))),ke),Ee=["SUCCEEDED","REQUIRES_CAPTURE","PENDING_REVIEW","PENDING"],Ie=n=>!!n&&Ee.includes(n),Se=n=>{switch(n){case"SUCCEEDED":return{isError:!1,messages:[t("Thank you for submitting your payment. We appreciate your prompt attention."),"",t("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]};case"PENDING":case"PENDING_REVIEW":case"REQUIRES_CAPTURE":return{isError:!1,messages:[t("Payment processing. We'll update you when payment is received.")]};case"REQUIRES_CUSTOMER_ACTION":return{isError:!1,messages:[t("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]};case"CANCELLED":case"REQUIRES_PAYMENT_METHOD":return{isError:!0,messages:[t("Payment failed. Please reload the page and try another payment method.")]};default:return{isError:!0,messages:[t("Something went wrong.")]}}},Ne=async n=>{const{errors:e,json:t}=await a("/api/zonos-elements/collect/airwallex-payment-intent",{body:{paymentIntentId:n},method:"POST"});return e.length||!t?(o("Failed to retrieve Airwallex payment intent",e),{status:null}):{status:t.airwallexPaymentIntent.status}},{state:Ce}=n((()=>({amountDutyTaxFeeTotal:null,amountTotalPaid:null,collectLogoUrl:null,isFetchingShippingInfo:!0,landedCostShortId:null,originCompanyName:null,partyBillingId:null,paymentProcessor:null,shippingAddress:null}))),Te=async({landedCostId:n,retries:t=5})=>{var r,i,o,u,c,l,d,v,m,p;Ce.isFetchingShippingInfo=!0;const h=await a("/api/zonos-elements/collect/get-shipping-info-by-lc-id",{body:{landedCostId:n},method:"POST"});if(h.errors.length)return t>0?(await new Promise((n=>setTimeout(n,1e3))),Te({landedCostId:n,retries:t-1})):null;Ce.landedCostShortId=(null===(r=h.json)||void 0===r?void 0:r.landedCostShortId)||null,Ce.isFetchingShippingInfo=!1,Ce.shippingAddress=(null===(i=h.json)||void 0===i?void 0:i.shipping)||null;const y=null===(o=f.checkoutSession)||void 0===o?void 0:o.landedCost,w=null===(u=f.checkoutSession)||void 0===u?void 0:u.subtotals,g=((null===(c=null==y?void 0:y.amountSubtotals)||void 0===c?void 0:c.shipping)||0)+((null===(l=null==y?void 0:y.amountSubtotals)||void 0===l?void 0:l.items)||0);Ce.amountTotalPaid=g*((null===(d=null==w?void 0:w.exchangeRate)||void 0===d?void 0:d.rate)||1),Ce.amountDutyTaxFeeTotal=((null==w?void 0:w.duties)||0)+((null==w?void 0:w.taxes)||0)+((null==w?void 0:w.fees)||0),Ce.originCompanyName=(null===(m=null===(v=h.json)||void 0===v?void 0:v.origin)||void 0===m?void 0:m.companyName)||null,Ce.collectLogoUrl=(null===(p=h.json)||void 0===p?void 0:p.collectLogoUrl)||null,0===Ce.amountTotalPaid&&s({endpoint:"COLLECT_NO_TOTAL_PAID",errors:[],metadata:{landedCostId:n,organizationId:e.organizationId}})},De=async()=>{var n,e,t,r;if(!(null===(n=l.stripeBillingAddressEventData)||void 0===n?void 0:n.complete))return{partiesCreated:!1};const u=null===(t=null===(e=f.checkoutSession)||void 0===e?void 0:e.landedCost)||void 0===t?void 0:t.rootId;if(!u)return s({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:c,cartId:window.Zonos.cartId,checkoutSessionId:i.checkoutSessionId}}),{partiesCreated:!1};if(!i.checkoutSessionId)return s({endpoint:"COLLECT_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:c,cartId:window.Zonos.cartId,landedCostRootId:u}}),{partiesCreated:!1};const v=d({address:l.stripeBillingAddressEventData.value.address,firstName:l.stripeBillingAddressEventData.value.firstName,lastName:l.stripeBillingAddressEventData.value.lastName,name:l.stripeBillingAddressEventData.value.name,phone:l.stripeBillingAddressEventData.value.phone}),m="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:p,json:h}=await a("/api/zonos-elements/create-billing-party",{body:{billingAddress:v,checkoutSessionId:i.checkoutSessionId,companyName:l.companyName,email:(null===(r=l.stripeLinkEventData)||void 0===r?void 0:r.value.email)||"",isTest:m,rootId:u},method:"POST"});return p.length||!h?(o("Error occurs when creating billing party",JSON.stringify(p,null,2)),s({endpoint:"COLLECT_BILLING_PARTY_CREATE_FAILED",errors:["[COLLECT] Failed to create billing party"],metadata:{allLogs:c,cartId:window.Zonos.cartId,checkoutSessionId:i.checkoutSessionId,errors:p,json:h}}),{partiesCreated:!1}):(Ce.partyBillingId=h.billToPartyId,{partiesCreated:!0})},Pe=async n=>{const e=n.landedCost;return!!e&&(f.landedCostData=[Object.assign(Object.assign({},n),{landedCost:Object.assign({},e),landedCostId:e.id})],v({applySubtotalsOnly:!0,landedCostId:e.id,selectedShippingOption:e.shipmentRating}))};export{we as a,ye as b,Ce as c,Ne as d,Ie as e,xe as f,Pe as g,Te as h,De as i,Se as j,he as k,fe as l,be as m,pe as n}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as o,a as s,g as e,d as a}from"./p-ce75b047.js";import{f as n}from"./p-27660512.js";import{c as i}from"./p-b4b7f705.js";import{g as r}from"./p-1834f486.js";import{b as c,t as h}from"./p-dc80cb87.js";import{s as l}from"./p-6bdc5c96.js";import{l as p}from"./p-41dd1cb8.js";import{d,e as m}from"./p-e5c76a9b.js";import{l as y}from"./p-0a377722.js";import"./p-502d6eeb.js";import"./p-bcf5cffb.js";import"./p-1cdd27ec.js";import"./p-adfbf57b.js";const f=class{constructor(o){t(this,o),this.borderRadius=6,this.spacing="24px"}render(){const t=this.backgroundColor?`var(--zonos-elements-${this.backgroundColor})`:"transparent",e=r({customRoundRadius:`${this.borderRadius}px`,overrideBorderStyle:"ROUNDED"});return o(s,{key:"afc0d2d9b79510aa9d85c89af3c01d5a5c767787",style:{"--zonos--font-family":n()}},o("div",{key:"b68bbbb581f56db81f9b7819f6047c1ec48a956f",class:i(["styled-card"]),style:{"--zonos--background-color":t,"--zonos--border-radius":e,padding:this.spacing}},this.label&&o("header",{key:"27db75fa9c5ac5dbdfefd92656aa6d8e5b654349",class:"card-header",style:{padding:this.spacing}},o("zonos-text",{key:"f54d58eb5f010346d2fcf919baf69d5c799bdbc4",type:"subheader"},this.label),o("h-stack",{key:"a3cbee0ae5fc73bb9507d5e30ab6779f2ce46f55",spacing:8},this.actions)),o("slot",{key:"6ce557ff8df6046d428b22b290c3d79ce6bf36ad"}),(this.footerActions||this.footerContent)&&o("footer",{key:"7cc44dfa05e46026444ac1db6755b30151937be0",class:"card-footer",style:{height:this.footerHeight?`${this.footerHeight}px`:"auto",padding:this.spacing}},o("div",{key:"6c401d4fbc34346f160b239a7190eb170763c382"},this.footerContent),o("h-stack",{key:"e6cc5de886d04757374b380149fe5b78b0874cf2",spacing:8},this.footerActions))))}};f.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .styled-card{border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));padding:var(--spacing, 24px);text-align:left;background-color:var(--zonos--background-color);overflow:hidden}:host .styled-card hr{margin-left:calc(var(--spacing, 24px) * -1);margin-right:calc(var(--spacing, 24px) * -1)}:host .styled-card .card-header{margin:calc(var(--spacing, 24px) * -1);padding:var(--spacing, 24px);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-bottom:var(--spacing, 24px);border-bottom:var(--zonos-elements-border);height:65px;line-height:65px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host .styled-card .card-header h5{margin-bottom:0;-ms-flex:1;flex:1}:host .styled-card .card-footer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;margin:calc(var(--spacing, 24px) * -1);padding:var(--spacing, 24px);border-top:var(--zonos-elements-border);background:var(--zonos-elements-surface-color-secondary);margin-top:var(--spacing, 24px);border-bottom-left-radius:var(--zonos-elements-radius-8);border-bottom-right-radius:var(--zonos-elements-radius-8);height:var(--footerHeight)}";const b=class{constructor(o){t(this,o),this.theme="LIGHT"}render(){return this.el.shadowRoot?(this.el.shadowRoot.innerHTML="DARK"===this.theme?'<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19124" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19124)"/>\n</mask>\n<g mask="url(#mask0_3739_19124)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="white" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19124" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n':'<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19125" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19125)"/>\n</mask>\n<g mask="url(#mask0_3739_19125)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="black" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19125" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n',o(s,{class:"zonos--elements",style:{"--zonos--font-family":n(),"--zonos--height":"100%","--zonos--width":"100%"}},o("zonos-text",{type:"semiBoldLabel"},this.emptyStateText))):null}get el(){return e(this)}};b.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex;position:relative}:host zonos-text{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host svg{width:var(--zonos--width);height:var(--zonos--height)}";const z=class{constructor(o){t(this,o),this.notificationArray=[]}async showNotification(t){const o=`id-${Math.random().toString(36).substring(2,9)}`,s=Object.assign(Object.assign({},t),{id:o,timeout:t.timeout||5e3,transitionClass:"",type:t.type||"success"});this.notificationArray=[...this.notificationArray,s],setTimeout((()=>{this.updateTransitionClass({id:o,transitionClass:"show"})}),50),setTimeout((()=>{this.removeNotification(o)}),s.timeout)}updateTransitionClass({id:t,transitionClass:o}){this.notificationArray=this.notificationArray.map((s=>s.id===t?Object.assign(Object.assign({},s),{transitionClass:o}):s))}removeNotification(t){this.updateTransitionClass({id:t,transitionClass:""}),setTimeout((()=>{this.notificationArray=this.notificationArray.filter((o=>o.id!==t))}),300)}render(){return o(s,{key:"6a790a39afc037ae56f8a53dc89c3fa899b2d659",class:i(["zonos--elements zonos--notification"]),style:{"--zonos--border-radius":r(),"--zonos--font-family":n()}},o("div",{key:"32245a784f2322fb69a65b491648a30a84b0b3d3",class:"zonos--notification-items"},this.notificationArray.map((t=>o("div",{"aria-hidden":"true",class:i(["zonos--notification-item",t.type,t.transitionClass]),key:t.id,onClick:()=>{this.removeNotification(t.id)}},o("zonos-text",{textColor:"gray-0"},t.message))))))}};z.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";const g=class{constructor(o){t(this,o),this.stripe=c.stripe,this.stripeElements=c.stripeElements,this.isPaymentInfoFilled=!1,this.trackingSent=!1}watchIsPaymentInfoFilled(){var t;this.isPaymentInfoFilled&&!this.trackingSent&&(h({checkoutSessionId:l.checkoutSessionId,eventName:"checkout_paymentInfoFilled",metadata:{paymentMethod:null===(t=c.stripePaymentEventData)||void 0===t?void 0:t.value.type}}),this.trackingSent=!0)}async watchInitStripe(){var t;if(!this.stripeElements)return;await this.stripeElements.fetchUpdates();const o=c.stripePaymentElement||this.stripeElements.create("payment",{defaultValues:{billingDetails:{address:{country:null===(t=c.stripeAddressEventData)||void 0===t?void 0:t.value.address.country}}},layout:"tabs"}),s=this.el.querySelector(".zonos--payment-component");s?(o.mount(s),o.on("change",(t=>{t.complete&&(this.isPaymentInfoFilled=!0),c.stripePaymentEventData=t})),c.stripePaymentElement=o):p("Cannot find container element for paymentElement")}componentDidLoad(){this.watchInitStripe()}render(){return o(s,{key:"faf7791e4cbf6bf8c98fe0b2f368f408ef32b644",class:"zonos--payment zonos--elements"},this.titleText&&o("zonos-text",{key:"e6103d0e04f9905b90533bf94539aaae1d5aa604",class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("div",{key:"b042060ff6fef2d7f20b20ec672b2696cb5f837c",class:"zonos--payment-component"}),o("div",{key:"b6a220513bb964a057c70141dcec89059dbbb0c8",class:"zonos--payment-paypal-container"}))}get el(){return e(this)}static get watchers(){return{isPaymentInfoFilled:["watchIsPaymentInfoFilled"],stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}}};g.style=".sc-zonos-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-payment-h *.sc-zonos-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-payment-h img.sc-zonos-payment{max-width:100%}.sc-zonos-payment-h dl.sc-zonos-payment,.sc-zonos-payment-h dd.sc-zonos-payment,.sc-zonos-payment-h h1.sc-zonos-payment,.sc-zonos-payment-h h2.sc-zonos-payment,.sc-zonos-payment-h h3.sc-zonos-payment,.sc-zonos-payment-h h4.sc-zonos-payment,.sc-zonos-payment-h h5.sc-zonos-payment,.sc-zonos-payment-h h6.sc-zonos-payment,.sc-zonos-payment-h hr.sc-zonos-payment,.sc-zonos-payment-h figure.sc-zonos-payment,.sc-zonos-payment-h p.sc-zonos-payment,.sc-zonos-payment-h pre.sc-zonos-payment{margin:0}.sc-zonos-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-payment-h .zonos--title.sc-zonos-payment{margin-bottom:16px}.sc-zonos-payment-h .zonos--payment-component.sc-zonos-payment{margin-bottom:4px}";const x=class{constructor(o){t(this,o),this.paypalSessionDone=a(this,"paypalSessionDone",7),this.paypalSessionFail=a(this,"paypalSessionFail",7),this.storeUnsubscribeList=[]}async loadPaypal(){if(!window.Zonos.paypal)return void y("Paypal is not available");const t=d({onPaypalFail:()=>{y("onPaypalFail"),this.paypalSessionFail.emit()},onPaypalSessionDone:({orderId:t})=>{y("onPaypalSessionDone","info",{orderId:t}),this.paypalSessionDone.emit({orderId:t})}});if(!(null==t?void 0:t.length))return void y("There are no paypal buttons available");const o=this.el.querySelector(".zonos--payment-paypal-container");o?t.forEach((async t=>{await t.render(o)})):y("Cannot find container element for paypal buttons")}componentWillLoad(){this.storeUnsubscribeList=[m("paypal",this.loadPaypal.bind(this))]}componentDidLoad(){this.loadPaypal()}disconnectedCallback(){this.storeUnsubscribeList.forEach((t=>t()))}render(){return o(s,{key:"2eb9e7f7acbe26f51c32ceb722f1e59832ac918a",class:"zonos--paypal-payment zonos--elements"},o("div",{key:"47ad7f3dfdea67dd5e222e6bbba46ed4599680be",class:"zonos--payment-paypal-container"}))}get el(){return e(this)}};x.style=".sc-zonos-paypal-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-paypal-payment-h *.sc-zonos-paypal-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-paypal-payment-h img.sc-zonos-paypal-payment{max-width:100%}.sc-zonos-paypal-payment-h dl.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h dd.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h1.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h2.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h3.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h4.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h5.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h6.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h hr.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h figure.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h p.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h pre.sc-zonos-paypal-payment{margin:0}.sc-zonos-paypal-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-paypal-payment-h{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}";export{f as zonos_card,b as zonos_empty_state_payment,z as zonos_notification,g as zonos_payment,x as zonos_paypal_payment}
|
|
1
|
+
import{r as t,h as o,a as s,g as e,d as a}from"./p-ce75b047.js";import{f as n}from"./p-27660512.js";import{c as i}from"./p-b4b7f705.js";import{g as r}from"./p-1834f486.js";import{b as c,t as h}from"./p-a4c7ee17.js";import{s as l}from"./p-6bdc5c96.js";import{l as p}from"./p-41dd1cb8.js";import{d,e as m}from"./p-344a6278.js";import{l as y}from"./p-0a377722.js";import"./p-502d6eeb.js";import"./p-bcf5cffb.js";import"./p-1cdd27ec.js";import"./p-adfbf57b.js";const f=class{constructor(o){t(this,o),this.borderRadius=6,this.spacing="24px"}render(){const t=this.backgroundColor?`var(--zonos-elements-${this.backgroundColor})`:"transparent",e=r({customRoundRadius:`${this.borderRadius}px`,overrideBorderStyle:"ROUNDED"});return o(s,{key:"afc0d2d9b79510aa9d85c89af3c01d5a5c767787",style:{"--zonos--font-family":n()}},o("div",{key:"b68bbbb581f56db81f9b7819f6047c1ec48a956f",class:i(["styled-card"]),style:{"--zonos--background-color":t,"--zonos--border-radius":e,padding:this.spacing}},this.label&&o("header",{key:"27db75fa9c5ac5dbdfefd92656aa6d8e5b654349",class:"card-header",style:{padding:this.spacing}},o("zonos-text",{key:"f54d58eb5f010346d2fcf919baf69d5c799bdbc4",type:"subheader"},this.label),o("h-stack",{key:"a3cbee0ae5fc73bb9507d5e30ab6779f2ce46f55",spacing:8},this.actions)),o("slot",{key:"6ce557ff8df6046d428b22b290c3d79ce6bf36ad"}),(this.footerActions||this.footerContent)&&o("footer",{key:"7cc44dfa05e46026444ac1db6755b30151937be0",class:"card-footer",style:{height:this.footerHeight?`${this.footerHeight}px`:"auto",padding:this.spacing}},o("div",{key:"6c401d4fbc34346f160b239a7190eb170763c382"},this.footerContent),o("h-stack",{key:"e6cc5de886d04757374b380149fe5b78b0874cf2",spacing:8},this.footerActions))))}};f.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .styled-card{border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));padding:var(--spacing, 24px);text-align:left;background-color:var(--zonos--background-color);overflow:hidden}:host .styled-card hr{margin-left:calc(var(--spacing, 24px) * -1);margin-right:calc(var(--spacing, 24px) * -1)}:host .styled-card .card-header{margin:calc(var(--spacing, 24px) * -1);padding:var(--spacing, 24px);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-bottom:var(--spacing, 24px);border-bottom:var(--zonos-elements-border);height:65px;line-height:65px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host .styled-card .card-header h5{margin-bottom:0;-ms-flex:1;flex:1}:host .styled-card .card-footer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;margin:calc(var(--spacing, 24px) * -1);padding:var(--spacing, 24px);border-top:var(--zonos-elements-border);background:var(--zonos-elements-surface-color-secondary);margin-top:var(--spacing, 24px);border-bottom-left-radius:var(--zonos-elements-radius-8);border-bottom-right-radius:var(--zonos-elements-radius-8);height:var(--footerHeight)}";const b=class{constructor(o){t(this,o),this.theme="LIGHT"}render(){return this.el.shadowRoot?(this.el.shadowRoot.innerHTML="DARK"===this.theme?'<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19124" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19124)"/>\n</mask>\n<g mask="url(#mask0_3739_19124)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="white" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19124" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n':'<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19125" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19125)"/>\n</mask>\n<g mask="url(#mask0_3739_19125)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="black" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19125" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n',o(s,{class:"zonos--elements",style:{"--zonos--font-family":n(),"--zonos--height":"100%","--zonos--width":"100%"}},o("zonos-text",{type:"semiBoldLabel"},this.emptyStateText))):null}get el(){return e(this)}};b.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex;position:relative}:host zonos-text{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host svg{width:var(--zonos--width);height:var(--zonos--height)}";const z=class{constructor(o){t(this,o),this.notificationArray=[]}async showNotification(t){const o=`id-${Math.random().toString(36).substring(2,9)}`,s=Object.assign(Object.assign({},t),{id:o,timeout:t.timeout||5e3,transitionClass:"",type:t.type||"success"});this.notificationArray=[...this.notificationArray,s],setTimeout((()=>{this.updateTransitionClass({id:o,transitionClass:"show"})}),50),setTimeout((()=>{this.removeNotification(o)}),s.timeout)}updateTransitionClass({id:t,transitionClass:o}){this.notificationArray=this.notificationArray.map((s=>s.id===t?Object.assign(Object.assign({},s),{transitionClass:o}):s))}removeNotification(t){this.updateTransitionClass({id:t,transitionClass:""}),setTimeout((()=>{this.notificationArray=this.notificationArray.filter((o=>o.id!==t))}),300)}render(){return o(s,{key:"6a790a39afc037ae56f8a53dc89c3fa899b2d659",class:i(["zonos--elements zonos--notification"]),style:{"--zonos--border-radius":r(),"--zonos--font-family":n()}},o("div",{key:"32245a784f2322fb69a65b491648a30a84b0b3d3",class:"zonos--notification-items"},this.notificationArray.map((t=>o("div",{"aria-hidden":"true",class:i(["zonos--notification-item",t.type,t.transitionClass]),key:t.id,onClick:()=>{this.removeNotification(t.id)}},o("zonos-text",{textColor:"gray-0"},t.message))))))}};z.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";const g=class{constructor(o){t(this,o),this.stripe=c.stripe,this.stripeElements=c.stripeElements,this.isPaymentInfoFilled=!1,this.trackingSent=!1}watchIsPaymentInfoFilled(){var t;this.isPaymentInfoFilled&&!this.trackingSent&&(h({checkoutSessionId:l.checkoutSessionId,eventName:"checkout_paymentInfoFilled",metadata:{paymentMethod:null===(t=c.stripePaymentEventData)||void 0===t?void 0:t.value.type}}),this.trackingSent=!0)}async watchInitStripe(){var t;if(!this.stripeElements)return;await this.stripeElements.fetchUpdates();const o=c.stripePaymentElement||this.stripeElements.create("payment",{defaultValues:{billingDetails:{address:{country:null===(t=c.stripeAddressEventData)||void 0===t?void 0:t.value.address.country}}},layout:"tabs"}),s=this.el.querySelector(".zonos--payment-component");s?(o.mount(s),o.on("change",(t=>{t.complete&&(this.isPaymentInfoFilled=!0),c.stripePaymentEventData=t})),c.stripePaymentElement=o):p("Cannot find container element for paymentElement")}componentDidLoad(){this.watchInitStripe()}render(){return o(s,{key:"faf7791e4cbf6bf8c98fe0b2f368f408ef32b644",class:"zonos--payment zonos--elements"},this.titleText&&o("zonos-text",{key:"e6103d0e04f9905b90533bf94539aaae1d5aa604",class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("div",{key:"b042060ff6fef2d7f20b20ec672b2696cb5f837c",class:"zonos--payment-component"}),o("div",{key:"b6a220513bb964a057c70141dcec89059dbbb0c8",class:"zonos--payment-paypal-container"}))}get el(){return e(this)}static get watchers(){return{isPaymentInfoFilled:["watchIsPaymentInfoFilled"],stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}}};g.style=".sc-zonos-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-payment-h *.sc-zonos-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-payment-h img.sc-zonos-payment{max-width:100%}.sc-zonos-payment-h dl.sc-zonos-payment,.sc-zonos-payment-h dd.sc-zonos-payment,.sc-zonos-payment-h h1.sc-zonos-payment,.sc-zonos-payment-h h2.sc-zonos-payment,.sc-zonos-payment-h h3.sc-zonos-payment,.sc-zonos-payment-h h4.sc-zonos-payment,.sc-zonos-payment-h h5.sc-zonos-payment,.sc-zonos-payment-h h6.sc-zonos-payment,.sc-zonos-payment-h hr.sc-zonos-payment,.sc-zonos-payment-h figure.sc-zonos-payment,.sc-zonos-payment-h p.sc-zonos-payment,.sc-zonos-payment-h pre.sc-zonos-payment{margin:0}.sc-zonos-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-payment-h .zonos--title.sc-zonos-payment{margin-bottom:16px}.sc-zonos-payment-h .zonos--payment-component.sc-zonos-payment{margin-bottom:4px}";const x=class{constructor(o){t(this,o),this.paypalSessionDone=a(this,"paypalSessionDone",7),this.paypalSessionFail=a(this,"paypalSessionFail",7),this.storeUnsubscribeList=[]}async loadPaypal(){if(!window.Zonos.paypal)return void y("Paypal is not available");const t=d({onPaypalFail:()=>{y("onPaypalFail"),this.paypalSessionFail.emit()},onPaypalSessionDone:({orderId:t})=>{y("onPaypalSessionDone","info",{orderId:t}),this.paypalSessionDone.emit({orderId:t})}});if(!(null==t?void 0:t.length))return void y("There are no paypal buttons available");const o=this.el.querySelector(".zonos--payment-paypal-container");o?t.forEach((async t=>{await t.render(o)})):y("Cannot find container element for paypal buttons")}componentWillLoad(){this.storeUnsubscribeList=[m("paypal",this.loadPaypal.bind(this))]}componentDidLoad(){this.loadPaypal()}disconnectedCallback(){this.storeUnsubscribeList.forEach((t=>t()))}render(){return o(s,{key:"2eb9e7f7acbe26f51c32ceb722f1e59832ac918a",class:"zonos--paypal-payment zonos--elements"},o("div",{key:"47ad7f3dfdea67dd5e222e6bbba46ed4599680be",class:"zonos--payment-paypal-container"}))}get el(){return e(this)}};x.style=".sc-zonos-paypal-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-paypal-payment-h *.sc-zonos-paypal-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-paypal-payment-h img.sc-zonos-paypal-payment{max-width:100%}.sc-zonos-paypal-payment-h dl.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h dd.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h1.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h2.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h3.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h4.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h5.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h6.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h hr.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h figure.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h p.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h pre.sc-zonos-paypal-payment{margin:0}.sc-zonos-paypal-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-paypal-payment-h{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}";export{f as zonos_card,b as zonos_empty_state_payment,z as zonos_notification,g as zonos_payment,x as zonos_paypal_payment}
|