@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,o,t,n){function r(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function c(e){try{a(n["throw"](e))}catch(e){i(e)}}function a(e){e.done?t(e.value):r(e.value).then(s,c)}a((n=n.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,r,i,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(e){return function(o){return a([e,o])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,c[0]&&(t=0)),t)try{if(n=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:t.label++;return{value:c[1],done:false};case 5:t.label++;r=c[1];c=[0];continue;case 7:c=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1];i=c;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(c);break}if(i[2])t.ops.pop();t.trys.pop();continue}c=o.call(e,t)}catch(e){c=[6,e];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,o,t){if(t||arguments.length===2)for(var n=0,r=o.length,i;n<r;n++){if(i||!(n in o)){if(!i)i=Array.prototype.slice.call(o,0,n);i[n]=o[n]}}return e.concat(i||Array.prototype.slice.call(o))};System.register(["./p-7261e245.system.js","./p-e4dc24e1.system.js","./p-998975a3.system.js","./p-916228fb.system.js","./p-de58684b.system.js","./p-398d9022.system.js","./p-01174496.system.js","./p-ebbda085.system.js","./p-d938f42f.system.js","./p-40a4c8a2.system.js","./p-23e7c655.system.js","./p-bf37ccc7.system.js","./p-14afffa8.system.js","./p-6890e060.system.js","./p-1aa93d1e.system.js","./p-2770ba48.system.js","./p-989cb22b.system.js","./p-7fbbdb0f.system.js","./p-af19722c.system.js","./p-551fa762.system.js"],(function(e){"use strict";var o,t,n,r,i,s,c,a,u,d,l,f,h,v,m,g,p,w,z,k,y,b,_,C,x,S,T,I,A,O,E,U,L,P,B,N,D,j,R,F,M,H,Z,K,V,G,Q,W,Y,q,J,X,$,ee,oe,te,ne,re,ie,se,ce,ae,ue,de,le,fe,he,ve,me,ge,pe,we,ze,ke,ye,be,_e,Ce,xe,Se,Te,Ie,Ae,Oe,Ee;return{setters:[function(e){o=e.r;t=e.h;n=e.F;r=e.a},function(e){i=e.s;s=e.a;c=e.b;a=e.i;u=e.c;d=e.g;l=e.d;f=e.e;h=e.f;v=e.p;m=e.h;g=e.j;p=e.k;w=e.l;z=e.m;k=e.n;y=e.o;b=e.t;_=e.q;C=e.r;x=e.u;S=e.v;T=e.w;I=e.x;A=e.y;O=e.z;E=e.A;U=e.B;L=e.C;P=e.D;B=e.E;N=e.F;D=e.G;j=e.H;R=e.I;F=e.J;M=e.K},function(e){H=e.p;Z=e.s;K=e.a;V=e.b},function(e){G=e.f;Q=e.a;W=e.b;Y=e.i;q=e.l;J=e.c;X=e.g;$=e.s;ee=e.V;oe=e.d;te=e.t;ne=e.e;re=e.h},function(e){ie=e.z;se=e.g;ce=e.m},function(e){ae=e.b},function(e){ue=e.h;de=e.g;le=e.j;fe=e.l;he=e.b;ve=e.s;me=e.a;ge=e.i},function(e){pe=e.u},function(e){we=e.l;ze=e.g;ke=e.b},function(e){ye=e._;be=e.c;_e=e.a;Ce=e.d;xe=e.g},function(e){Se=e.c},function(e){Te=e.c},function(e){Ie=e.g},function(e){Ae=e.i},function(e){Oe=e.s},function(e){Ee=e.R},function(){},function(){},function(){},function(){}],execute:function(){var Ue=this;var Le=function(){return __awaiter(Ue,void 0,void 0,(function(){var e,o,t;return __generator(this,(function(n){switch(n.label){case 0:return[4,ue("/api/zonos-elements/get-store-discount-enabled-status")];case 1:e=n.sent(),o=e.errors,t=e.json;if(o.length||!(t===null||t===void 0?void 0:t.enabled)){return[2,{enabled:false}]}return[2,{enabled:true}]}}))}))};var Pe=function(e){return __awaiter(Ue,[e],void 0,(function(e){var o,t,n,r;var i=e.testKeys;return __generator(this,(function(e){switch(e.label){case 0:if(i.length===0){return[2,null]}return[4,ue("/api/zonos-elements/select-variance-test",{body:{testKeys:i},method:"POST"})];case 1:o=e.sent(),t=o.errors,n=o.json;if(t.length||!n){return[2,null]}r=G(n);return[2,r]}}))}))};var Be=function(e){var o=e.cartId,t=e.checkoutSessionId,n=e.customerAddress1,r=e.customerAddress2,i=e.customerCity,s=e.customerCountry,c=e.customerEmail,a=e.customerFirstName,u=e.customerLastName,d=e.customerPhone,l=e.customerState,f=e.customerZip,h=e.hostedCheckoutUrl,v=e.isTestMode,m=e.isVariantTest;var g=new URLSearchParams;g.set("tempCartUUID",o);if(a){g.set("customerFirstName",a)}if(u){g.set("customerLastName",u)}if(c){g.set("customerEmail",c)}if(d){g.set("customerPhone",d)}if(f){g.set("customerZip",f)}if(i){g.set("customerCity",i)}if(l){g.set("customerState",l)}if(s){g.set("zCountry",s)}if(n){g.set("customerAddress1",n)}if(r){g.set("customerAddress2",r)}if(v){g.set("zonosTestMode","1")}if(t){g.set("zonosCheckoutSessionId",t)}if(m){g.set("zonosVariantTest","1")}return"".concat(h,"?").concat(g.toString())};var Ne="isInternationalCheckout";var De=function(){var e=new URLSearchParams;e.set(Ne,"true");var o=new URLSearchParams(window.location.search);var t=o.get("zonosQaUrl");if(t){e.set("zonosQaUrl",t)}var n=o.get("zonosQaUrlApi");if(n){e.set("zonosQaUrlApi",n)}if(de()){e.set("zonosTestMode","1")}return"cart.php?".concat(e.toString())};var je=function(e){var o=e===void 0?{}:e,t=o.action;var n=new URL("/login.php",window.location.origin);if(t){n.searchParams.set("action",t)}var r=new URLSearchParams(window.location.search);var i=r.get("zonosQaUrl");if(i){n.searchParams.set("zonosQaUrl",i)}var s=r.get("zonosQaUrlApi");if(s){n.searchParams.set("zonosQaUrlApi",s)}if(de()){n.searchParams.set("zonosTestMode","1")}n.searchParams.set("from",De());return n.toString()};var Re=function(e){var o=new URL(e,window.location.origin);var t=new URLSearchParams(window.location.search);var n=t.get("zonosQaUrl");if(n){o.searchParams.set("zonosQaUrl",n)}if(t.get("zonosDebug")==="1"){o.searchParams.set("zonosDebug","1")}if(de()){o.searchParams.set("zonosTestMode","1")}return o.toString()};var Fe={customerGroupId:null,shouldBypass:false};var Me=function(e){return __awaiter(Ue,void 0,void 0,(function(){var o,t,n,r,i,s,c,a,u,d,l,f;return __generator(this,(function(h){switch(h.label){case 0:if(!window.Zonos.isBigCommerce){return[2,{conclusive:true,result:Fe}]}i=(o=ie.genericSettings)===null||o===void 0?void 0:o.bigcommerceBypassCustomerGroupIds;if(!(i===null||i===void 0?void 0:i.length)){if(ie.loadedConfig){return[2,{conclusive:true,result:Fe}]}return[2,{conclusive:false,result:Fe}]}if(!e)return[3,1];c=e.checkoutId;return[3,3];case 1:return[4,Q()];case 2:c=h.sent();h.label=3;case 3:s=c;if(!s){we("BigCommerce bypass check: no active cart yet, will retry on next call","info");return[2,{conclusive:false,result:Fe}]}if(!e)return[3,4];u=e.checkout;return[3,6];case 4:return[4,W(s)];case 5:u=h.sent();h.label=6;case 6:a=u;if(!a){we("BigCommerce bypass check: failed to fetch checkout data, will retry","info");return[2,{conclusive:false,result:Fe}]}d=(r=(n=(t=a.customer)===null||t===void 0?void 0:t.customerGroup)===null||n===void 0?void 0:n.id)!==null&&r!==void 0?r:null;if(d===null){we("BigCommerce bypass check: no customer group found (guest user)","info");return[2,{conclusive:true,result:Fe}]}l=i.includes(d);f={customerGroupId:d,shouldBypass:l};if(l){we("BigCommerce bypass check: customer group ".concat(String(d)," is in bypass list; caller should keep the user on BC native checkout"),"info")}else{we("BigCommerce bypass check: customer group ".concat(String(d)," is not in bypass list"),"info")}return[2,{conclusive:true,result:f}]}}))}))};var He=null;var Ze=function(e){var o=Me(e);var t=o.then((function(e){var o=e.conclusive,n=e.result;if(!o&&He===t){He=null}return n}));He=t;return t};var Ke=function(){var e;if(!window.Zonos.isBigCommerce){return}var o=(e=ie.genericSettings)===null||e===void 0?void 0:e.bigcommerceBypassCustomerGroupIds;if(!(o===null||o===void 0?void 0:o.length)){return}void Ze()};var Ve=function(){var e=[];for(var o=0;o<arguments.length;o++){e[o]=arguments[o]}return __awaiter(Ue,__spreadArray([],e,true),void 0,(function(e){if(e===void 0){e={}}return __generator(this,(function(o){if(e.forceRefresh||!He){return[2,Ze(e.preFetched)]}return[2,He]}))}))};var Ge={guestCheckoutType:null};var Qe=60*60*1e3;var We="zonos--bc-checkout-settings";var Ye=function(e){try{var o=window.localStorage.getItem(We);if(!o){return null}var t=le(o);if(!t){return null}if(t.storeHash!==e){return null}if(t.expiresAt<Date.now()){return null}return{guestCheckoutType:t.guestCheckoutType}}catch(e){return null}};var qe=function(e,o){try{var t={expiresAt:Date.now()+Qe,guestCheckoutType:o.guestCheckoutType,storeHash:e};window.localStorage.setItem(We,JSON.stringify(t))}catch(e){}};var Je=function(){return __awaiter(Ue,void 0,void 0,(function(){var e,o,t,n,r,i,s;return __generator(this,(function(c){switch(c.label){case 0:if(!window.Zonos.isBigCommerce){return[2,Ge]}o=(e=ie.checkoutSettings.bigCommerceConfig)===null||e===void 0?void 0:e.storeHash;if(!o){we("BigCommerce checkout settings: no storeHash provided — skipping fetch","info");return[2,Ge]}t=Ye(o);if(t){return[2,t]}return[4,ue("/api/bigcommerce/checkout-settings",{body:{storeHash:o},method:"POST"})];case 1:n=c.sent(),r=n.errors,i=n.json;if(r.length||!i){we("BigCommerce checkout settings: proxy call failed, falling back to guest-allowed behavior","info");return[2,Ge]}s={guestCheckoutType:i.guestCheckoutType};qe(o,s);return[2,s]}}))}))};var Xe={redirectUrl:null,shouldForceLogin:false};var $e=null;var eo=function(){if(!$e){var e=Je().then((function(o){var t=o.guestCheckoutType;if(!t){if($e===e){$e=null}return false}return t==="no_guest_checkout"})).catch((function(){if($e===e){$e=null}return false}));$e=e}return $e};var oo=function(){if(!window.Zonos.isBigCommerce){return}void eo()};var to=function(){var e=[];for(var o=0;o<arguments.length;o++){e[o]=arguments[o]}return __awaiter(Ue,__spreadArray([],e,true),void 0,(function(e){var o,t,n,r,i;var s=e===void 0?{}:e,c=s.preFetched;return __generator(this,(function(e){switch(e.label){case 0:if(!window.Zonos.isBigCommerce){return[2,Xe]}return[4,eo()];case 1:o=e.sent();if(!o){return[2,Xe]}if(!c)return[3,2];n=c.checkoutId;return[3,4];case 2:return[4,Q()];case 3:n=e.sent();e.label=4;case 4:t=n;if(!t){return[2,Xe]}if(!c)return[3,5];i=c.checkout;return[3,7];case 5:return[4,W(t)];case 6:i=e.sent();e.label=7;case 7:r=i;if(!r){we("BigCommerce force-login check: failed to fetch checkout data, allowing flow to continue","info");return[2,Xe]}if(Y(r)){return[2,Xe]}we("BigCommerce force-login check: guest shopper on no-guest-checkout store, redirecting to /login.php","info");return[2,{redirectUrl:je(),shouldForceLogin:true}]}}))}))};var no="data-zonos-login-from-rewritten";var ro='a[href*="login.php?action=create_account"]:not(['+no+"])";var io=function(){var e=document.querySelectorAll(ro);if(!e.length){return}var o=je({action:"create_account"});e.forEach((function(e){e.setAttribute("href",o);e.setAttribute(no,"true")}))};var so=function(){if(!window.Zonos.isBigCommerce){return}if(!window.location.pathname.includes("/login.php")){return}io();var e=new MutationObserver((function(){io()}));e.observe(document.body,{childList:true,subtree:true});setTimeout((function(){return e.disconnect()}),1e4)};var co=function(e,o){if(!e.address1||!e.countryCode){return null}var t=[e.firstName,e.lastName].filter(Boolean).join(" ").trim();return{address:{city:e.city||"",country:e.countryCode,line1:e.address1,line2:e.address2||"",postal_code:e.postalCode||"",state:e.stateOrProvinceCode||e.stateOrProvince||""},email:o,name:t,phone:e.phone||""}};var ao=function(e){return[e.address.line1,e.address.line2||"",e.address.postal_code,e.address.country].join("|").toLowerCase()};var uo=function(e,o){var t,n,r,i;if(!((t=e===null||e===void 0?void 0:e.customer)===null||t===void 0?void 0:t.id)){return[]}var s=o.isShippable,c=o.selectedCountryCode;var a=e.customer.email||"";var u=(r=(n=e.consignments)===null||n===void 0?void 0:n.flatMap((function(e){return e.shippingAddress?[e.shippingAddress]:[]})))!==null&&r!==void 0?r:[];var d=(i=e.customer.addresses)!==null&&i!==void 0?i:[];var l=new Set;var f=[];for(var h=0,v=__spreadArray(__spreadArray([],d,true),u,true);h<v.length;h++){var m=v[h];var g=co(m,a);if(!g){continue}if(!s(g.address.country)){continue}var p=ao(g);if(l.has(p)){continue}l.add(p);f.push(g)}if(!c){return f}return f.map((function(e,o){return{index:o,option:e}})).sort((function(e,o){var t=e.option.address.country===c;var n=o.option.address.country===c;if(t===n){return e.index-o.index}return t?-1:1})).map((function(e){return e.option}))};var lo=function(e){if(e===void 0){e=true}if(!q.localizationLoaded){return true}if(q.isDisabledCountry){if(e){we("Checkout: disabled country")}return true}return false};var fo=function(e,o){if(e===void 0){e=true}var t;if(!q.localizationLoaded){return false}if(o){var n=!!((t=q.shippingZoneCountries)===null||t===void 0?void 0:t[o])&&!ie.disabledCountries.includes(o);if(e&&!n){we("Checkout: ".concat(o," is not a shippable country: ").concat(n))}return n}if(!q.isShippableCountry){if(e){we("Checkout: not shippable country")}return false}return true};var ho='select[name="shippingAddress.countryCode"]';var vo="#checkout-shipping-continue, #checkout-billing-continue, #checkout-payment-continue";var mo=function(e){return __awaiter(Ue,[e],void 0,(function(e){var o,t,n,r,i,c,a,u,d,l,f,h,v,m,g,p,w,z;var k=e.onInternationalCheckoutSelected,y=e.onLoggedInInternationalAddressDetected;return __generator(this,(function(e){switch(e.label){case 0:return[4,Q()];case 1:f=e.sent();if(!f){return[2,"noAction"]}return[4,W(f)];case 2:h=e.sent();v={checkout:h,checkoutId:f};return[4,Ve({preFetched:v})];case 3:m=e.sent().shouldBypass;if(m){return[2,"noAction"]}g=(t=(o=h===null||h===void 0?void 0:h.consignments)===null||o===void 0?void 0:o[0])===null||t===void 0?void 0:t.shippingAddress;if(!(g===null||g===void 0?void 0:g.countryCode)){return[2,"noAction"]}p=g.countryCode;if(!fo(false,p)){return[2,"noAction"]}we(y?"Logged-in user has international shipping address: ".concat(p,", prompting user to choose checkout"):"Logged-in user has international shipping address: ".concat(p,", redirecting automatically (legacy behavior)"),"info");if(!y)return[3,5];return[4,y()];case 4:w=e.sent();if(w==="stay"){we("User opted to stay on BigCommerce native checkout despite international default address","info");return[2,"optedOut"]}e.label=5;case 5:return[4,to({preFetched:v})];case 6:z=e.sent();if(z.shouldForceLogin&&z.redirectUrl){window.location.href=z.redirectUrl;return[2,"redirected"]}if(!k)return[3,8];return[4,k()];case 7:e.sent();e.label=8;case 8:J({isInitializing:false,newSelectedCountryCode:p});s({address1:(n=g.address1)!==null&&n!==void 0?n:"",address2:(r=g.address2)!==null&&r!==void 0?r:"",city:(i=g.city)!==null&&i!==void 0?i:"",countryCode:p,firstName:(c=g.firstName)!==null&&c!==void 0?c:"",lastName:(a=g.lastName)!==null&&a!==void 0?a:"",phone:(u=g.phone)!==null&&u!==void 0?u:"",postalCode:(d=g.postalCode)!==null&&d!==void 0?d:"",state:(l=g.stateOrProvince)!==null&&l!==void 0?l:""});window.location.href=Re("/");return[2,"redirected"]}}))}))};var go=function(e){var o=e.domesticRedirectedBtnSelector,t=e.onInternationalCheckoutSelected,n=e.onLoggedInInternationalAddressDetected,r=e.onShippingAddressSessionFound;if(!window.Zonos.isBigCommerce){return}var c=function(e){return __awaiter(Ue,void 0,void 0,(function(){var o,n,r,i,c,a,u,d,l,f;return __generator(this,(function(h){switch(h.label){case 0:n=document.querySelector(((o=ie.genericSettings)===null||o===void 0?void 0:o.bigcommerceDomesticCheckoutCountrySelector)||ho);r=(n===null||n===void 0?void 0:n.value)||e;if(!r){return[2,"noAction"]}if(!fo(false,r)){return[2,"noAction"]}return[4,Q()];case 1:i=h.sent();if(!i)return[3,3];return[4,W(i)];case 2:a=h.sent();return[3,4];case 3:a=null;h.label=4;case 4:c=a;u={checkout:c,checkoutId:i};return[4,Ve({forceRefresh:true,preFetched:u})];case 5:d=h.sent().shouldBypass;if(d){we("Bypass customer group detected on BC checkout, stopping interval","info");return[2,"bypass"]}return[4,to({preFetched:u})];case 6:l=h.sent();if(l.shouldForceLogin&&l.redirectUrl){window.location.href=l.redirectUrl;return[2,"redirected"]}if(!t)return[3,8];return[4,t()];case 7:h.sent();h.label=8;case 8:J({isInitializing:false,newSelectedCountryCode:r});f={address1:"",address2:"",city:"",countryCode:r,firstName:"",lastName:"",phone:"",postalCode:"",stateOrProvince:""};s({address1:f.address1,address2:f.address2,city:f.city,countryCode:f.countryCode,firstName:f.firstName,lastName:f.lastName,phone:f.phone,postalCode:f.postalCode,state:f.stateOrProvince});window.location.href=Re("/");return[2,"redirected"]}}))}))};var a=false;var u=false;var d=function(){return __awaiter(Ue,void 0,void 0,(function(){var e,o,t,n,r,i,s,c;return __generator(this,(function(a){switch(a.label){case 0:return[4,Q()];case 1:r=a.sent();if(!r)return[3,3];return[4,W(r)];case 2:i=a.sent();s=(t=(o=(e=i===null||i===void 0?void 0:i.consignments)===null||e===void 0?void 0:e[0])===null||o===void 0?void 0:o.shippingAddress)===null||t===void 0?void 0:t.countryCode;if(s){return[2,s]}a.label=3;case 3:c=document.querySelector(((n=ie.genericSettings)===null||n===void 0?void 0:n.bigcommerceDomesticCheckoutCountrySelector)||ho);return[2,(c===null||c===void 0?void 0:c.value)||null]}}))}))};var l=function(e,o){return __awaiter(Ue,void 0,void 0,(function(){var t,n,r,i,s,u;return __generator(this,(function(l){switch(l.label){case 0:t=true;l.label=1;case 1:l.trys.push([1,9,,10]);n=null;l.label=2;case 2:l.trys.push([2,4,,5]);return[4,d()];case 3:n=l.sent();return[3,5];case 4:r=l.sent();fe("Error resolving selected shipping country on BC continue",r);return[3,5];case 5:if(n&&fo(false,n)){o.disconnect()}if(!n)return[3,7];return[4,c(n)];case 6:s=l.sent();return[3,8];case 7:s="noAction";l.label=8;case 8:i=s;if(i==="redirected"){t=false}return[3,10];case 9:u=l.sent();fe("Error handling BC continue international redirect",u);return[3,10];case 10:if(t){a=true;e.click();a=false}return[2]}}))}))};var f=function(e){if(u){return}u=true;document.addEventListener("click",(function(o){if(a){return}var t=o.target;if(!(t instanceof Element)){return}var n=t.closest(vo);if(!n){return}o.preventDefault();o.stopImmediatePropagation();void l(n,e)}),true)};var h=false;var v=false;var m=false;var g=false;var p=false;var w=new MutationObserver((function(){return __awaiter(Ue,void 0,void 0,(function(){var e,s,a,u,d,l,z,k,y,b;var _=this;return __generator(this,(function(C){switch(C.label){case 0:s=document.querySelector(o);a=i();if(!s&&a){u=document.createElement("button");u.style.display="none";u.id="zonos--domestic-redirected-checkout-button";document.body.appendChild(u);r===null||r===void 0?void 0:r(a);w.disconnect();return[2]}d=window.location.pathname.includes("/checkout")&&window.Zonos.isBigCommerce;if(!d){w.disconnect();return[2]}if(!(!g&&!m))return[3,5];m=true;p=true;C.label=1;case 1:C.trys.push([1,3,4,5]);return[4,mo({onInternationalCheckoutSelected:t,onLoggedInInternationalAddressDetected:n})];case 2:l=C.sent();if(l==="redirected"){w.disconnect();return[2]}if(l==="optedOut"){g=true;f(w)}return[3,5];case 3:z=C.sent();fe("Error checking logged-in user shipping address",z);return[3,5];case 4:m=false;p=false;return[7];case 5:k=document.querySelector(((e=ie.genericSettings)===null||e===void 0?void 0:e.bigcommerceDomesticCheckoutCountrySelector)||ho);if(!k){return[2]}we("Domestic checkout found - Listening for shipping country change","info",{value:k.value});if(v){return[2]}v=true;w.disconnect();y=setInterval((function(){return __awaiter(_,void 0,void 0,(function(){var e,o;return __generator(this,(function(t){switch(t.label){case 0:if(h||p){return[2]}h=true;t.label=1;case 1:t.trys.push([1,3,,4]);return[4,c()];case 2:e=t.sent();if(e==="redirected"||e==="bypass"){clearInterval(y);return[2]}h=false;return[3,4];case 3:o=t.sent();h=false;return[3,4];case 4:return[2]}}))}))}),1e3);b=setInterval((function(){var e;if(!window.bcStripeElements){clearInterval(b);return}var o=(e=window.bcStripeElements)===null||e===void 0?void 0:e.getElement("address");if(!o){return}clearInterval(b);o.on("change",(function(e){var o=e.value.address.country;if(o&&!p){void c(o)}}))}),500);return[2]}}))}))}));w.observe(document.body,{childList:true,subtree:true})};var po=function(){var e=new URLSearchParams(window.location.search);we("legacy urlParams","info",Object.fromEntries(e.entries()));var o=function(o){var t=e.get(o);if(!t||t==="undefined"){return""}return t};var t=X(e)||q.selectedCountryCode||"US";var n=o("customerCity");var r=o("customerEmail");var i=o("customerAddress1");var s=o("customerAddress2");var c=o("customerName");var a=o("customerPhone");var u=o("customerZip");var d=o("customerState");var l=o("customerFirstName");var f=o("customerLastName");return{customerAddress1:i,customerAddress2:s,customerCity:n,customerCountry:t,customerEmail:r,customerFirstName:l,customerLastName:f,customerName:c,customerPhone:a,customerState:d,customerZip:u}};var wo=0;var zo=function(){return __awaiter(Ue,void 0,void 0,(function(){var e,o;var t;return __generator(this,(function(n){switch(n.label){case 0:if(window.Zonos.loadTimeApiInfoList.length===0){return[2]}we("Sending bulk load time api log","info",{loadTimeApiInfoList:window.Zonos.loadTimeApiInfoList});e={data:__spreadArray([],window.Zonos.loadTimeApiInfoList,true),storeId:window.Zonos.storeId||0};window.Zonos.loadTimeApiInfoList.length=0;return[4,ue("/api/zonos-elements/log-bulk-load-data",{body:e,method:"POST"})];case 1:o=n.sent().errors;if(o.length){(t=window.Zonos.loadTimeApiInfoList).push.apply(t,e.data);wo++;if(wo>5&&window.Zonos.logIntervalId){clearInterval(window.Zonos.logIntervalId)}}return[2]}}))}))};var ko=function(){return __awaiter(Ue,void 0,void 0,(function(){var e,o;return __generator(this,(function(t){e=ze().elapsedTime;o={cache:"miss",eventName:"jsdelivr",flag:"LOG_CHECKOUT_FACADE_LOAD",href:window.location.href,loadTime:e,metadata:Object.assign({allLogs:ke},he()),scriptLoadUrl:"checkoutFacade",storeId:window.Zonos.storeId||0};void ue("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2]}))}))};var yo=function(e){return __awaiter(Ue,[e],void 0,(function(e){var o;var t=e.loadTime;return __generator(this,(function(e){o={cache:"miss",eventName:"jsdelivr",flag:"LOG_NATIVE_CHECKOUT_LOAD",href:window.location.href,loadTime:t,metadata:Object.assign({allLogs:ke},he()),scriptLoadUrl:"nativeCheckout",storeId:window.Zonos.storeId||0};void ue("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2]}))}))};var bo=function(e){return(e===null||e===void 0?void 0:e.filter((function(e){if(e.expiresAt&&e.expiresAt<Date.now()||!e.expiresAt){return false}return true})))||[]};var _o=function(e){var o;var t=(o=$.enabledVariantTestKeys)===null||o===void 0?void 0:o.find((function(o){return o.testKey===e}));return(t===null||t===void 0?void 0:t.selectedVariantKey)||null};var Co=function(e){return ie.enabledVariantTestKeys.includes(e)};var xo=function(e){var o=e.baseTestObj,t=e.mergeTestObj;return o.map((function(e){var o=e.testKey;var n=t.find((function(e){var t=e.testKey;return t===o}));return{expiresAt:(n===null||n===void 0?void 0:n.expiresAt)||Date.now()+ee,selectedVariantKey:(n===null||n===void 0?void 0:n.selectedVariantKey)||null,testKey:o}}))};var So=function(e){return __awaiter(Ue,[e],void 0,(function(e){var o,t,n,r,i;var s=e.cartId,c=e.retries;return __generator(this,(function(e){switch(e.label){case 0:o=de();return[4,ue("/api/zonos-elements/get-temp-cart",{body:{isTestMode:o,options:{noOnlineStoreSettings:true},tempCartUUID:s},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:t=e.sent(),n=t.errors,r=t.json;i=!r||n.length;if(!(i&&c))return[3,3];we("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:c});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,So({cartId:s,retries:c-1})];case 3:if(i){return[2,null]}return[2,r]}}))}))};var To=function(e){return __awaiter(Ue,void 0,void 0,(function(){var o,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:o=ye(e),t=o.isDgsCartId,n=o.isLegacyCartId;if(!n&&!t){fe("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,So({cartId:e,retries:5})];case 1:r=i.sent();we("[ZONOS - loadZonos] getting temp cart data","info",r);if(!r){fe("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;return[2,{cartData:r.cartData,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var Io='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>\n</svg>\n';var Ao=".sc-zonos-checkout-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-checkout-h *.sc-zonos-checkout{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-checkout-h img.sc-zonos-checkout{max-width:100%}.sc-zonos-checkout-h dl.sc-zonos-checkout,.sc-zonos-checkout-h dd.sc-zonos-checkout,.sc-zonos-checkout-h h1.sc-zonos-checkout,.sc-zonos-checkout-h h2.sc-zonos-checkout,.sc-zonos-checkout-h h3.sc-zonos-checkout,.sc-zonos-checkout-h h4.sc-zonos-checkout,.sc-zonos-checkout-h h5.sc-zonos-checkout,.sc-zonos-checkout-h h6.sc-zonos-checkout,.sc-zonos-checkout-h hr.sc-zonos-checkout,.sc-zonos-checkout-h figure.sc-zonos-checkout,.sc-zonos-checkout-h p.sc-zonos-checkout,.sc-zonos-checkout-h pre.sc-zonos-checkout{margin:0}.sc-zonos-checkout-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-checkout-h{z-index:2147483647;position:fixed}.sc-zonos-checkout-h *.sc-zonos-checkout{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex:1;flex:1;padding:32px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--zonos-elements-gray-0)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:100%;max-height:100%;height:100%;overflow:auto;-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-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--logo.sc-zonos-checkout{margin-bottom:0}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout zonos-checkout-finish.sc-zonos-checkout{-ms-flex:1;flex:1}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 8px 8px}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:24px}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--right-actions.sc-zonos-checkout{position:absolute;right:24px;top:24px;z-index:2;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--wrapper.sc-zonos-checkout{overflow:auto;max-height:100%;position:relative}.sc-zonos-checkout-h .flex--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout>*.sc-zonos-checkout{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout img.sc-zonos-checkout{max-height:72px}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:76px;margin-bottom:8px}.zonos--close-button.sc-zonos-checkout{-ms-flex-item-align:start;align-self:flex-start}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto;position:relative}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--zonos-elements-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:32px}.hidden-mode.sc-zonos-checkout-h{height:0;opacity:0;pointer-events:none;position:absolute;visibility:hidden;width:0;z-index:-1}.mobile.sc-zonos-checkout-h{min-width:auto}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{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-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding-bottom:0}}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{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-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--review.sc-zonos-checkout{margin-bottom:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--cart-items.sc-zonos-checkout{margin-top:8px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout zonos-checkout-footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{max-height:100%}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:auto}.mobile.sc-zonos-checkout-h .zonos--cart-subtotal.sc-zonos-checkout{margin:0}.iframed.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{-ms-scroll-chaining:chained;overscroll-behavior:auto}.zonos--processing-payment.sc-zonos-checkout-h{z-index:2147483646}";var Oo=Ao;var Eo=90*60*1e3;var Uo=6*60*60*1e3;var Lo=e("zonos_checkout",function(){function e(e){var t=this;o(this,e);this.storeUnsubscribeList=[];this.isRedirectAfterOrder=false;this.preview=false;this.hiddenMode=false;this.mobile=false;this.defaultAddress=[];this.forceDialogOpen=false;this.defaultAddressParams=[];this.defaultCustomerProfileAddress=[];this.customerProfile=null;this.open=this.forceDialogOpen;this.isOverlayLoading=false;this.stripe=window.Zonos.stripe;this.submitLoading=false;this.collapseReviewMobile=true;this.isAttachError=false;this.isMobile=false;this.isIframed=false;this.isLegacyCheckout=window.Zonos.isLegacyCheckout;this.confirmDialogOpen=false;this.isCartExpired=false;this.payInUsdConfirmDialogOpen=false;this.inventoryCheckErrorMessage=null;this.placedOrderInfo=null;this.shouldShowFedexShippingConsentDialog=false;this.detectedDomesticCheckoutDialogOpen=false;this.redirectToDomesticCheckoutDialogOpen=false;this.loggedInIntlAddressConfirmDialogOpen=false;this.loggedInIntlAddressResolver=null;this.clientSecret=c.clientSecret;this.stripeCustomerSessionClientSecret=c.stripeCustomerSessionClientSecret;this.applyStripeTheme=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:r=((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme)||ie.appearance.theme;return[4,a({overrideBorderRadius:(o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.style,overridePrimaryColor:(t=this.appearanceSettingsOverride)===null||t===void 0?void 0:t.colorPrimary,overrideSecondaryColor:(n=this.appearanceSettingsOverride)===null||n===void 0?void 0:n.colorSecondary,overrideTheme:this.isMobile?r:undefined,paypalEnabled:H()})];case 1:i.sent();return[2]}}))}))};this.checkStripePaymentIntentStatus=function(e){return __awaiter(t,[e],void 0,(function(e){var o,t,n,r,i,s,a,d,l;var f=e.triggeredButton;return __generator(this,(function(e){switch(e.label){case 0:o=f===null||f===void 0?void 0:f.matches("#".concat(be));t=!!window.Zonos.cartData;n=new URL(window.location.href).searchParams;r=n.get("payment_intent_client_secret");i=n.get("zonosCheckoutSessionId");if(!o){we("Checkout is triggered by user, no need to check stripe payment intent status");return[2,{shouldAllowOrder:true}]}we("Payment intent exist, checking stripe payment intent status");if(!r){we("No stripe client secret found in the URL, proceed to order if cart data is available");return[2,{shouldAllowOrder:t}]}return[4,u({clientSecret:r})];case 1:s=e.sent(),a=s.error,d=s.status;l=new URLSearchParams(window.location.search).get("redirect_status");if(l){if(!a){we("Payment intent is succeeded or in a good state to move forward, show success screen")}else{we("Payment intent failed, show status from error")}this.open=true;$.checkoutSessionId=i;c.clientSecret=r;void this.setToFinishStep(d);return[2,{shouldAllowOrder:false}]}if(!t){we("Cart data is not available, only check payment intent status, skip order.");return[2,{shouldAllowOrder:false}]}we("Payment intent is not succeeded, proceed to order");return[2,{shouldAllowOrder:true}]}}))}))};this.recoverCompletedOrderModificationSession=function(e){return __awaiter(t,void 0,void 0,(function(){var o,t,n,r,i;return __generator(this,(function(s){switch(s.label){case 0:$.checkoutSessionId=e;return[4,d()];case 1:o=s.sent(),t=o.errors,n=o.json;if(t.length||!n){return[2,false]}r=n.checkoutSession;if(r.completedAt&&r.order){void this.setToFinishStep("succeeded");return[2,true]}if(!r.clientSecret)return[3,3];return[4,u({clientSecret:r.clientSecret})];case 2:i=s.sent().status;if(i==="processing"||i==="succeeded"){c.clientSecret=r.clientSecret;void this.setToFinishStep(i);return[2,true]}s.label=3;case 3:return[2,false]}}))}))};this.initializeTestKeys=function(){$.enabledVariantTestKeys=bo($.enabledVariantTestKeys||[]);var e=ie.enabledVariantTestKeys.map((function(e){var o;var t=(o=$.enabledVariantTestKeys)===null||o===void 0?void 0:o.find((function(o){var t=o.testKey;return t===e}));return{expiresAt:(t===null||t===void 0?void 0:t.expiresAt)||Date.now()+ee,selectedVariantKey:(t===null||t===void 0?void 0:t.selectedVariantKey)||null,testKey:e}}));oe(e);return{allSelected:false}};this.shouldAllowHostedVsNativeTest=function(){if(typeof ie.checkoutSettings.createCartId!=="function"){return false}var e=ie.enabledVariantTestKeys.includes("hosted_vs_native");if(!e){return false}return true};this.registerTestHostedVsNative=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:e=this.shouldAllowHostedVsNativeTest();if(!e){return[2]}we("[TEST] - Registering hosted vs native test");o=_o("hosted_vs_native");if(o){we("[TEST] - Hosted vs native test already has variant selected: ".concat(o));return[2]}return[4,Pe({testKeys:["hosted_vs_native"]})];case 1:t=r.sent();if(!t){we("[TEST] - Failed to get selection for hosted vs native test");return[2]}n=xo({baseTestObj:$.enabledVariantTestKeys||[],mergeTestObj:t});oe(n);return[2]}}))}))};this.handleHostedVsNative=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n,r,i,s,c;return __generator(this,(function(a){switch(a.label){case 0:o=this.shouldAllowHostedVsNativeTest();if(!o){return[2,{redirected:false}]}t=_o("hosted_vs_native");we("[TEST] - hosted_vs_native: ".concat(t));if(typeof ie.checkoutSettings.createCartId!=="function"){we("[TEST] - createCartId is not provided, skipping hosted vs native test");return[2,{redirected:false}]}if(t!=="hosted"){we("[TEST] - Hosted vs native test is enabled for native, skipping");return[2,{redirected:false}]}if(!((e=ie.genericSettings)===null||e===void 0?void 0:e.hostedCheckoutUrl)){we("[TEST] - Hosted checkout URL is not provided");return[2,{redirected:false}]}we('"createCartId" is provided, start building cart');return[4,ie.checkoutSettings.createCartId()];case 1:n=a.sent();i=null;if(typeof n==="object"){r=n.cartId;i=n.shippingData||null}else{r=n}s=po();c=Be(Object.assign(Object.assign({cartId:r,checkoutSessionId:$.checkoutSessionId||undefined,hostedCheckoutUrl:ie.genericSettings.hostedCheckoutUrl,isTestMode:de(),isVariantTest:true},s),i));we("[TEST] - Redirecting to: ".concat(c));window.open(c,"_blank");return[2,{redirected:true}]}}))}))};this.formatDate=function(e){if(!e){return""}var o=new Date(e);return o.toLocaleDateString()};this.formatTime=function(e){if(!e){return""}var o=new Date(e);return o.toLocaleTimeString()};this.getCurrentLocalePageEnum=function(){switch(l.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}};this.getBaseCurrencySettlementInfo=function(){var e=l.selectedLandedCost;if(!e){return null}var o=e.landedCost.amountSubtotals;if(!o){return null}var t=(o.discounts||0)+o.items+o.landedCostTotal+o.shipping;return{settlementAmount:t}};this.prefillBigCommerceCustomerAddresses=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:if(!window.Zonos.isBigCommerce){return[2]}if(this.defaultCustomerProfileAddress.length){return[2]}e=Array.isArray(this.defaultAddress)&&this.defaultAddress.length>0||!Array.isArray(this.defaultAddress)&&typeof this.defaultAddress==="object"&&this.defaultAddress!==null;if(e){return[2]}return[4,Q()];case 1:o=r.sent();if(!o){return[2]}return[4,W(o)];case 2:t=r.sent();if(!Y(t)){return[2]}n=uo(t,{isShippable:function(e){return fo(false,e)},selectedCountryCode:q.selectedCountryCode||undefined});if(!n.length){return[2]}if(this.defaultCustomerProfileAddress.length){return[2]}this.defaultCustomerProfileAddress=n;we("Prefilled ".concat(String(n.length)," BigCommerce customer address(es) for logged-in shopper"),"info");return[2]}}))}))};this.getDefaultAddress=function(){if(t.defaultCustomerProfileAddress.length){return t.defaultCustomerProfileAddress}if(Array.isArray(t.defaultAddress)&&t.defaultAddress.length){return t.defaultAddress}if(!Array.isArray(t.defaultAddress)&&typeof t.defaultAddress==="object"){return[t.defaultAddress]}return t.defaultAddressParams};this.handleHostedOpenWindowCallback=function(e){var o;var t=(o=ie.genericSettings)===null||o===void 0?void 0:o.hostedCheckoutUrl;if(!origin){return}var n=["dev.checkout.elements.zonos.com"].some((function(o){return e.origin.includes(o)}));if(e.origin!==t&&!n){return}switch(e.data.type){case"zonos-checkout-session-update":$.checkoutSessionId=e.data.checkoutSessionId;break}};this.captureParamsRedirectedForVariantTest=function(){var e=new URL(window.location.href);var o=e.searchParams.get("zonosVariantTest")==="1";if(!o){return}var t=e.searchParams.get("zonosCheckoutSessionId");if(t){$.checkoutSessionId=t}var n=$.enabledVariantTestKeys||[];if(window.Zonos.isLegacyCheckout){var r=_o("hosted_vs_native");if(!r){n.push({expiresAt:Date.now()+ee,selectedVariantKey:"hosted",testKey:"hosted_vs_native"});oe(n)}else{oe(n.map((function(e){if(e.testKey==="hosted_vs_native"){return Object.assign(Object.assign({},e),{selectedVariantKey:"hosted"})}return e})))}}e.searchParams.delete("zonosCheckoutSessionId");e.searchParams.delete("zonosVariantTest");window.history.replaceState({},"",e.toString())}}e.prototype.initCartInfoHandler=function(e){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(t){o=e.detail;void f({adjustments:l.adjustments,cartItems:o});return[2]}))}))};e.prototype.handleKeyPress=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){if(e.key==="Escape"){void this.closeDialogHandler()}return[2]}))}))};e.prototype.closeDialogHandler=function(e){return __awaiter(this,void 0,void 0,(function(){var o,t;return __generator(this,(function(n){if(!this.open){return[2]}if(!(e===null||e===void 0?void 0:e.confirmed)){this.confirmDialogOpen=true;return[2]}this.confirmDialogOpen=false;Z({event:"zonos-checkout-close",metadata:{checkoutSessionId:$.checkoutSessionId}});this.open=this.forceDialogOpen||false;if(!this.preview&&l.step==="finish"){h()}if(!this.preview){v()}l.step="customer-info";m();g();(t=(o=ie.checkoutSettings).onClose)===null||t===void 0?void 0:t.call(o);return[2]}))}))};e.prototype.buildCartAndInit=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,i,s,a,u,d,h,s,a,a,v,m,s,g,k,y,b;return __generator(this,(function(_){switch(_.label){case 0:if(!(typeof ie.checkoutSettings.createCartId==="function"))return[3,4];we('"createCartId" is provided, start building cart');l.customMessage=[];return[4,ie.checkoutSettings.createCartId()];case 1:o=_.sent();t=void 0;if(typeof o==="object"){we("object detected, use cartId and prefill address from createCartId","info",o);t=o.cartId;this.useShippingDataFromCreateCartId(o.shippingData);l.customerAuthenticationToken=o.customerAuthenticationToken||null;l.customMessage=Array.isArray(o.customMessage)?o.customMessage.filter((function(e){return typeof e==="string"})):[]}else{t=o}window.Zonos.cartId=t;return[4,To(t)];case 2:n=_.sent();r=n===null||n===void 0?void 0:n.cartData;if(!r){fe("Failed to build cart, please try again.");return[2,false]}window.Zonos.cartData=r;i=ae(r),s=i.adjustments,a=i.cartItems;return[4,f({adjustments:s,cartItems:a})];case 3:_.sent();return[3,12];case 4:if(!window.Zonos.cartData)return[3,9];we("tempCartUUID is provided, start building cart");u=(e=window.Zonos.cartData.references)===null||e===void 0?void 0:e.checkoutSessionId;if(!u)return[3,6];we("Setting checkout session id from cart reference","info",u);return[4,this.recoverCompletedOrderModificationSession(u)];case 5:d=_.sent();if(d){c.isFetchingSession=false;return[2,true]}$.checkoutSessionId=u;return[3,7];case 6:we("Clear checkout session id from storage so we start from a fresh session for this cart");$.checkoutSessionId=null;_.label=7;case 7:h=ae(window.Zonos.cartData),s=h.adjustments,a=h.cartItems;return[4,f({adjustments:s,cartItems:a})];case 8:_.sent();return[3,12];case 9:if(!(ie.checkoutSettings.buildCartDetail&&q.selectedCountryCode))return[3,12];we("build cart detail");return[4,ie.checkoutSettings.buildCartDetail({countryCode:q.selectedCountryCode,currencyCode:q.targetCurrency})];case 10:a=_.sent();v=a.filter((function(e){return e.amount>=0}));m=a.filter((function(e){return e.amount<0}));we("cartItems","info",{cartItems:a});s=m.map((function(e){return{amount:e.amount,currencyCode:e.currencyCode,description:e.name||e.description||"",productId:e.productId||null,sku:e.sku||null,type:"CART_TOTAL"}}));return[4,f({adjustments:s,cartItems:v})];case 11:_.sent();_.label=12;case 12:if(!!$.checkoutSessionId)return[3,14];return[4,p()];case 13:g=_.sent();we("stripeStoreInitCheckoutSession: ".concat(g));if(!g){return[2,false]}_.label=14;case 14:if(!l.isStagingMode){void w()}return[4,this.applyStripeTheme()];case 15:_.sent();k=ie.checkoutSettings,y=k.successBehavior,b=k.successRedirectUrl;this.isRedirectAfterOrder=y==="REDIRECT_TO_SUCCESS_PAGE"||y==="CLOSE_MODAL"&&!!b||!!l.externalConfirmationPageURL;if(z()){l.step="payment"}return[2,true]}}))}))};e.prototype.reloadCheckoutSession=function(){window.location.reload()};e.prototype.handleOrderDuplication=function(){var e=le(localStorage.getItem("zonos--placed-order-info"));if(!e){localStorage.removeItem("zonos--placed-order-info");return}var o=Date.now()-e.time;we("=== Existing placed order info: ".concat(e.orderId," - ").concat(this.formatDate(e.time)," - elapsed in hh:ss format: ").concat(new Date(o).toISOString().substring(11,8)),"warn");var t=parseFloat(new URLSearchParams(window.location.search).get("zonosOverrideExpiredDuplication")||"0")||Uo;if(o>t){we("=== Existing placed order info is older than ".concat(t,"ms, cleaning localStorage"),"warn");localStorage.removeItem("zonos--placed-order-info");return}this.placedOrderInfo=e;we("=== Showing order duplication confirmation","warn")};e.prototype.recordCheckoutInfo=function(){if(!$.checkoutSessionId){return}void pe({attributes:[{key:"APP_VERSION",value:window.Zonos.version},{key:"APP_VERSION_NPM_INTEGRATION",value:window.Zonos.isNpm?"1":"0"},{key:"LEGACY_CHECKOUT_FACADE",value:window.Zonos.isLegacyCheckout?"1":"0"}],checkoutSessionId:$.checkoutSessionId})};e.prototype.confirmProceedWithOrderDuplication=function(){this.placedOrderInfo=null;if(!$.checkoutSessionId){return}void pe({attributes:[{key:"ORDER_DUPLICATION_CONSENT",value:"1"}],checkoutSessionId:$.checkoutSessionId})};e.prototype.markTheSessionAsAbandonedCart=function(){if(!$.checkoutSessionId){return}void pe({attributes:[{key:"WITH_ABANDONED_CART_TOKEN",value:"1"}],checkoutSessionId:$.checkoutSessionId})};e.prototype.handleCancelOrderDuplication=function(){var e;this.placedOrderInfo=null;if(this.isLegacyCheckout){var o=((e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl)||ie.onlineStoreSettings.url;if(!o){return}if(window.parent){window.parent.location.href=o}window.location.href=o;return}void this.closeDialogHandler({confirmed:true})};e.prototype.attachCheckout=function(){var e=this;var o=ie.checkoutSettings.placeOrderButtonSelector;var t=ie.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;var n=!!document.querySelector("#".concat(be));we("attach checkout ".concat(o),"info",{href:window.location.href});we("attach checkout to always trigger international checkout selector: ".concat(t));if(!o&&!t&&!window.Zonos.cartData&&!n){return}var r=[o,t,"#".concat(Ce),"#".concat(be),"#".concat(_e)].filter(Boolean);var i=document.querySelectorAll(r.join(","));i.forEach((function(n){var r=n.getAttribute("data-zonos-checkout-attached");if(r){return}we("attached event to button ".concat(o),"info",{button:n});n.addEventListener("click",(function(o){return __awaiter(e,void 0,void 0,(function(){var e,r,i,s,a,u,d,f,h,v,m,g,p,w,z,x,S,T,I,A;return __generator(this,(function(O){switch(O.label){case 0:i=performance.now();s=t&&n.matches(t);a=n.matches("#".concat(_e));u=n.matches("#".concat(Ce))||n.matches("#".concat(be));if(!window.Zonos.isLegacyCheckout&&(!fo()||lo())&&!s&&!a&&!u){return[2]}o.preventDefault();o.stopPropagation();we("zonos checkout button clicked");return[4,this.checkStripePaymentIntentStatus({triggeredButton:o.target})];case 1:d=O.sent().shouldAllowOrder;if(!d){return[2]}if(!window.Zonos.logIntervalId){window.Zonos.logIntervalId=setInterval((function(){void zo()}),2e3)}if(!Co("hosted_vs_native"))return[3,4];this.isOverlayLoading=true;return[4,this.registerTestHostedVsNative()];case 2:O.sent();return[4,this.handleHostedVsNative()];case 3:f=O.sent().redirected;this.isOverlayLoading=false;if(f){return[2]}O.label=4;case 4:if(!window.Zonos.isBigCommerce)return[3,7];return[4,Ve()];case 5:h=O.sent().shouldBypass;if(h){we("Bypass customer group detected, redirecting to BigCommerce native checkout","info");window.location.href=Re("/checkout");return[2]}return[4,to()];case 6:v=O.sent();if(v.shouldForceLogin&&v.redirectUrl){window.location.href=v.redirectUrl;return[2]}O.label=7;case 7:c.isFetchingSession=true;this.open=true;O.label=8;case 8:O.trys.push([8,16,,17]);return[4,this.buildCartAndInit()];case 9:m=O.sent();if(!m){throw new Error("Error building cart")}if(!!window.Zonos.isLegacyCheckout)return[3,14];g=null;O.label=10;case 10:O.trys.push([10,12,,13]);return[4,k()];case 11:g=O.sent();return[3,13];case 12:p=O.sent();g=te("Unable to check inventory. Please try again.");return[3,13];case 13:if(g){l.inventoryCheckErrorMessage=g;c.isFetchingSession=false;this.open=false;return[2]}O.label=14;case 14:(e=window.opener)===null||e===void 0?void 0:e.postMessage({checkoutSessionId:$.checkoutSessionId,type:"zonos-checkout-session-update"},"*");y({isPreview:this.preview,sessionTimeout:Eo});Z({event:"zonos-checkout-start",metadata:{checkoutSessionId:$.checkoutSessionId}});w=$.checkoutSessionId;void b({checkoutSessionId:w,eventName:"checkout_open"});return[4,Le()];case 15:z=O.sent().enabled;l.shouldHideDiscountInput=!z;this.handleOrderDuplication();if(window.Zonos.isLegacyCheckout){void ko()}else{x=performance.now();S=x-i;void yo({loadTime:S})}this.recordCheckoutInfo();T=!!xe();if(T){this.markTheSessionAsAbandonedCart()}return[3,17];case 16:I=O.sent();if(I instanceof Error){A=I.message;if(A==="Cart is expired."){this.isCartExpired=true}}c.isFetchingSession=false;fe(I);if(this.isCartExpired){c.isFetchingSession=true;return[2]}void ve({endpoint:"Error creating Checkout",errors:[I instanceof Error?I.toString():"Unknown error"],metadata:{allLogs:ke,cartId:window.Zonos.cartId,checkoutSessionBody:_(),href:window.location.href,storeBaseUrl:((r=window.Zonos.cartData)===null||r===void 0?void 0:r.storeBaseUrl)||ie.onlineStoreSettings.url}});C({messages:[te("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:te("Error creating Checkout")});return[3,17];case 17:return[2]}}))}))}),{capture:true,passive:false});if(!ie.checkoutSettings.disablePlaceOrderButtonActivation){n.removeAttribute("disabled")}n.setAttribute("data-zonos-checkout-attached","true");if(n.matches("#".concat(Ce))){n.dispatchEvent(Te("click"));x();n.remove()}if(n.matches("#".concat(be))){n.dispatchEvent(Te("click"));n.remove()}}))};e.prototype.appearanceSettingsOverrideChanged=function(){if(!this.appearanceSettingsOverride){return}void this.applyStripeTheme()};e.prototype.useShippingDataFromCreateCartId=function(e){if(!e){return}we("shipping data from createCartId result","info",Object.entries(e));var o=e.customerAddress1,t=e.customerAddress2,n=e.customerCity,r=e.customerCountry,i=e.customerEmail,s=e.customerFirstName,c=e.customerLastName,a=e.customerName,u=e.customerPhone,d=e.customerState,l=e.customerZip;var f=new URLSearchParams(window.location.search);var h=r||X(f)||q.selectedCountryCode;this.applyPrefillAddress({customerAddress1:o,customerAddress2:t,customerCity:n,customerCountry:h,customerEmail:i,customerFirstName:s,customerLastName:c,customerName:a,customerPhone:u,customerState:d,customerZip:l})};e.prototype.useLegacyQueryParams=function(){var e=new URLSearchParams(window.location.search);we("legacy urlParams","info",Object.fromEntries(e.entries()));var o=function(o){var t=e.get(o);if(!t||t==="undefined"){return null}return t};var t=X(e)||q.selectedCountryCode;var n=o("customerCity");var r=o("customerEmail");var i=o("customerAddress1");var s=o("customerAddress2");var c=o("customerName");var a=o("customerFirstName");var u=o("customerLastName");var d=o("customerPhone");var l=o("customerZip");var f=o("customerState");this.applyPrefillAddress({customerAddress1:i,customerAddress2:s,customerCity:n,customerCountry:t,customerEmail:r,customerFirstName:a,customerLastName:u,customerName:c,customerPhone:d,customerState:f,customerZip:l})};e.prototype.applyPrefillAddress=function(e){var o=e.customerAddress1||"";var t=e.customerCountry||"";var n=e.customerAddress2||"";var r=e.customerCity||"";var i=e.customerEmail||"";var s=e.customerFirstName&&e.customerLastName?"".concat(e.customerFirstName," ").concat(e.customerLastName):e.customerName||"";var c=e.customerPhone||"";var a=e.customerZip||"";var u=e.customerState||"";if(!o||!s||!c||!t){we("Missing required query params so it can not be prefilled","info",[!o&&"line1",!s&&"name",!c&&"phone",!t&&"country"].filter(Boolean).join(", "));return}if(t&&q.shippingZoneCountries&&!(t in q.shippingZoneCountries)){we('Country "'.concat(t,'" is not in the shipping zone, so it can not be prefilled'),"warn");return}this.defaultAddressParams=[{address:{city:r||"",country:t,line1:o,line2:n,postal_code:a,state:u},email:i,name:s,phone:c}];we("Prefill address applied","info",{prefillAddress:this.defaultAddressParams,providedAddress:e})};e.prototype.overrideStagingModeChanged=function(){l.isStagingMode=!!this.overrideStagingMode};e.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){var e;var o=this;return __generator(this,(function(t){c.stripe=window.Zonos.stripe;this.stripe=window.Zonos.stripe;l.isStagingMode=me();if(typeof this.overrideStagingMode!=="undefined"){l.isStagingMode=this.overrideStagingMode}Ke();oo();so();this.handleBigcommerceInternationalResumeFlag();void this.prefillBigCommerceCustomerAddresses();go({domesticRedirectedBtnSelector:Ce,onInternationalCheckoutSelected:function(){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:this.detectedDomesticCheckoutDialogOpen=true;return[4,new Promise((function(e){return setTimeout(e,2e3)}))];case 1:e.sent();return[2]}}))}))},onLoggedInInternationalAddressDetected:function(){return new Promise((function(e){o.loggedInIntlAddressResolver=e;o.loggedInIntlAddressConfirmDialogOpen=true}))},onShippingAddressSessionFound:function(e){o.defaultAddress=[{address:{city:e.city,country:e.countryCode,line1:e.address1,line2:e.address2,postal_code:e.postalCode,state:e.state},email:"",name:"".concat(e.firstName," ").concat(e.lastName),phone:e.phone}]}});if(window.Zonos){this.useLegacyQueryParams()}e=setInterval((function(){c.stripe=window.Zonos.stripe;o.stripe=window.Zonos.stripe;if(!o.stripe){we("waiting for stripe to be loaded");return}if(o.storybookPaymentStatusOverride){clearInterval(e);return}we("init checkout");if(o.preview||o.forceDialogOpen){void o.buildCartAndInit()}else if(window.Zonos.isLegacyCheckout){o.attachCheckout()}else if(window){o.attachCheckout();var t=new MutationObserver((function(){o.attachCheckout()}));t.observe(document.body,{childList:true,subtree:true})}clearInterval(e)}),50);setTimeout((function(){clearInterval(e)}),1e4);return[2]}))}))};e.prototype.handleBigcommerceInternationalResumeFlag=function(){if(!window.Zonos.isBigCommerce){return}var e=new URL(window.location.href);if(e.searchParams.get(Ne)!=="true"){return}e.searchParams.delete(Ne);window.history.replaceState({},"",e.toString());var o=Date.now();var t=setInterval((function(){if(!q.localizationLoaded||!q.selectedCountryCode){if(Date.now()-o>15e3){clearInterval(t);we("BigCommerce international checkout resume flag: localization did not initialize within 15s","info")}return}var e=document.querySelector("#".concat(_e));if(e){clearInterval(t);e.dispatchEvent(Te("click"));return}if(Date.now()-o>15e3){clearInterval(t);we("BigCommerce international checkout resume flag: trigger button did not mount within 15s","info")}}),200)};e.prototype.setToFinishStep=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){l.step="finish";this.storybookPaymentStatusOverride=e;return[2]}))}))};e.prototype.mockCheckoutSession=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){S(e);return[2]}))}))};e.prototype.triggerCheckoutInternational=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(o){e=document.querySelector("#".concat(_e));if(e){e.dispatchEvent(Te("click"))}return[2]}))}))};e.prototype.handleCustomerInfoContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,i,s,a;var u=this;return __generator(this,(function(d){switch(d.label){case 0:Z({event:"zonos-checkout-customer-info",metadata:{checkoutSessionId:$.checkoutSessionId}});r=$.checkoutSessionId;void b({checkoutSessionId:r,eventName:"checkout_customerInfoCompleted"});this.submitLoading=true;return[4,T()];case 1:i=d.sent().isRequestNotReady;if(i&&l.addressFormRenderType==="stripe"){void ve({endpoint:"ADDRESS_NOT_READY_AT_CUSTOMER_INFO_CONTINUE",errors:["Address not ready at customer info continue"],metadata:{address:(o=(e=c.stripeAddressEventData)===null||e===void 0?void 0:e.value)===null||o===void 0?void 0:o.address,billingAddress:(n=(t=c.stripeBillingAddressEventData)===null||t===void 0?void 0:t.value)===null||n===void 0?void 0:n.address,cartId:window.Zonos.cartId}})}s=function(e){if(l.step!=="customer-info"){clearInterval(e);return}if(!c.isFetchingLandedCost){if(l.landedCostData){void V({currency:l.currency});I()}u.submitLoading=false;if(e){clearInterval(e)}}};s();a=setInterval((function(){s(a)}),20);setTimeout((function(){clearInterval(a)}),1e4);return[2]}}))}))};e.prototype.handleShippingContinue=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){I();return[2]}))}))};e.prototype.handleInventoryCheckDialogConfirm=function(){l.inventoryCheckErrorMessage=null;if(!this.isLegacyCheckout){void this.closeDialogHandler({confirmed:true})}};e.prototype.handleCartExpiredDialogConfirm=function(){var e;this.isCartExpired=false;if(this.isLegacyCheckout){var o=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl;if(!o){return}if(window.parent){window.parent.location.href=o}window.location.href=o;return}if(window.parent){window.parent.location.href=window.location.href}window.location.reload()};e.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,i,s,a,u,d,f;return __generator(this,(function(h){switch(h.label){case 0:e=c.checkoutSettlementCurrency==="USD";if(e&&c.shouldRenderPayInUsdButton&&!this.payInUsdConfirmDialogOpen){this.payInUsdConfirmDialogOpen=true;return[2]}this.payInUsdConfirmDialogOpen=false;o=A();h.label=1;case 1:h.trys.push([1,,18,19]);K.paypalErrorMessage=null;c.hasPaymentError=false;this.submitLoading=true;l.inventoryCheckErrorMessage=null;return[4,O()];case 2:t=h.sent();if(!t){c.hasPaymentError=true;c.customErrorMessage=te("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:c.checkoutSettlementCurrency});this.submitLoading=false;return[2]}h.label=3;case 3:h.trys.push([3,5,,6]);n=l;return[4,k()];case 4:n.inventoryCheckErrorMessage=h.sent();return[3,6];case 5:r=h.sent();l.inventoryCheckErrorMessage=te("Unable to check inventory. Please try again.");return[3,6];case 6:if(l.inventoryCheckErrorMessage){this.submitLoading=false;return[2]}i=M();if(!(i>0))return[3,8];return[4,E()];case 7:s=h.sent();if(!s.success){c.hasPaymentError=true;c.customErrorMessage=s.error||te("Unable to apply store credit. Please try again.");this.submitLoading=false;return[2]}h.label=8;case 8:if(!U())return[3,14];h.label=9;case 9:h.trys.push([9,12,,13]);return[4,L()];case 10:a=h.sent();if(!a.valid){c.hasPaymentError=true;c.customErrorMessage=a.errorMessage;this.submitLoading=false;return[2]}return[4,P()];case 11:u=h.sent();if(!u.success){c.hasPaymentError=true;c.customErrorMessage=u.error||te("Unable to place order with store credit. Please try again.");this.submitLoading=false;return[2]}I();g();return[3,13];case 12:d=h.sent();fe(d);Z({event:"zonos-checkout-payment-fail",metadata:{checkoutSessionId:$.checkoutSessionId}});c.hasPaymentError=true;return[3,13];case 13:this.submitLoading=false;return[2];case 14:h.trys.push([14,16,,17]);return[4,B({noLandedCostCheck:z()})];case 15:h.sent();I();g();return[3,17];case 16:f=h.sent();fe(f);Z({event:"zonos-checkout-payment-fail",metadata:{checkoutSessionId:$.checkoutSessionId}});c.hasPaymentError=true;if(c.shouldInventoryRefund){void N();c.shouldInventoryRefund=false}return[3,17];case 17:this.submitLoading=false;return[3,19];case 18:if(o){D.locked=false}return[7];case 19:return[2]}}))}))};e.prototype.handleFinishClick=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:j();if(!this.preview)return[3,2];l.step="customer-info";return[4,this.init()];case 1:r.sent();return[2];case 2:h();v();if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData){e=window.Zonos.cartData.storeBaseUrl||ie.onlineStoreSettings.url;if(window.parent){window.parent.location.href=e}window.location.href=e;return[2]}o=window.location.href;t=o.split("?")[0];this.open=false;n=window.location.hostname.includes("dashboard.zonos.com");if(!n){window.history.replaceState(window.history.state,document.title,t);window.location.reload()}return[2]}}))}))};e.prototype.handleWindowResize=function(){this.isMobile=ge(this.mobile);void this.applyStripeTheme();we("mobile: ".concat(this.isMobile))};e.prototype.handleMobileChange=function(){this.isMobile=ge(this.mobile);void this.applyStripeTheme();we("mobile: ".concat(this.isMobile))};e.prototype.handleAppearanceSettingsOverrideChange=function(){var e;if((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme){this.appearanceSettingsOverride.theme=se(this.appearanceSettingsOverride.theme)}};e.prototype.handleAddressChange=function(){j()};e.prototype.handleCustomerProfileChange=function(){var e,o;if(!this.customerProfile){we("No customer profile","info");this.defaultCustomerProfileAddress=[];return}we("Customer profile found","info",{customerProfile:this.customerProfile});this.defaultCustomerProfileAddress=((o=(e=c.customerProfile)===null||e===void 0?void 0:e.locations)===null||o===void 0?void 0:o.map((function(e){var o;return{address:{city:e.locality,country:e.countryCode,line1:e.line1,line2:e.line2||"",postal_code:e.postalCode,state:e.administrativeArea},email:e.email||((o=c.customerProfile)===null||o===void 0?void 0:o.email)||"",name:e.name||"",phone:e.phone||""}})))||[]};e.prototype.handleClientSecretChange=function(){we("==== Client secret changed","info",{clientSecret:this.clientSecret,stripeCustomerSessionClientSecret:this.stripeCustomerSessionClientSecret});void this.applyStripeTheme()};e.prototype.handleOpenChange=function(){var e="data-zonos-overflow-origin";var o=document.body;var t=document.documentElement;if(this.open){window.Zonos.openHelloDialog(false);if(o.style.overflow){o.setAttribute(e,o.style.overflow)}o.style.overflow="hidden";if(t.style.overflow){t.setAttribute(e,t.style.overflow)}t.style.overflow="hidden"}else{this.stripeCustomerSessionClientSecret=null;var n=o.getAttribute(e);var r=t.getAttribute(e);if(n){o.removeAttribute(e);o.style.overflow=n}else{o.style.removeProperty("overflow")}if(r){t.removeAttribute(e);t.style.overflow=r}else{t.style.removeProperty("overflow")}}};e.prototype.componentWillLoad=function(){var e=this;void this.init();this.isMobile=ge(this.mobile);this.isIframed=window.self!==window.top;we("iframed: ".concat(this.isIframed));if(window.Zonos.isLegacyCheckout){this.captureParamsRedirectedForVariantTest()}this.handleAppearanceSettingsOverrideChange();this.storeUnsubscribeList=[ne("selectedLocale",(function(){void e.applyStripeTheme()})),R("selectedShippingOption",(function(){var o,t,n,r;var i=l.selectedShippingOption;if(((o=ie.genericSettings)===null||o===void 0?void 0:o.shouldFedExShippingConsentForCanadianShopper)&&((n=(t=i===null||i===void 0?void 0:i.shippingProfile)===null||t===void 0?void 0:t.serviceLevel.code)===null||n===void 0?void 0:n.toLowerCase().startsWith("fedex."))&&((r=c.stripeAddressEventData)===null||r===void 0?void 0:r.value.address.country)==="CA"){e.shouldShowFedexShippingConsentDialog=true}})),F("stripeAddressEventData",(function(o){var t;if(!window.Zonos.isBigCommerce||!o||e.redirectToDomesticCheckoutDialogOpen||!((t=ie.genericSettings)===null||t===void 0?void 0:t.isBigcommerceDomesticCheckoutRedirectEnabled)||ie.sourceCurrency!=="USD"){return}if(!e.open){return}if(window.location.pathname.includes("/checkout")){return}var n=o.value.address.country;if(n&&ie.disabledCountries.includes(n)){e.redirectToDomesticCheckoutDialogOpen=true;we("Domestic country ".concat(n," selected in international checkout, redirecting to BigCommerce domestic checkout"),"info");setTimeout((function(){window.location.href=Re("/checkout")}),2e3)}}))];this.initializeTestKeys();window.addEventListener("message",this.handleHostedOpenWindowCallback);we("mobile: ".concat(this.isMobile))};e.prototype.disconnectedCallback=function(){j();h();v();this.storeUnsubscribeList.forEach((function(e){return e()}));window.removeEventListener("message",this.handleHostedOpenWindowCallback)};e.prototype.render=function(){var e=this;var o,i,s,a;this.customerProfile=c.customerProfile;this.clientSecret=c.clientSecret;if(c.stripeCustomerSessionClientSecret){this.stripeCustomerSessionClientSecret=c.stripeCustomerSessionClientSecret}var u=l.step!=="finish"&&l.step!=="error"&&!c.stripeElements||c.isFetchingSession;var d=z();var f=ce(ie.appearance,this.appearanceSettingsOverride||null),h=f.colorPrimary,v=f.colorSecondary,m=f.logoUrl,g=f.style;var p=ie.appearance.zonosAttribution==="ENABLED";var w=ie.appearance.theme;var k=h&&Ae(h)?"DARK":"LIGHT";var y=this.isMobile?w:k;var b=!this.isMobile?v:undefined;var _=q.customMessages;var C=(o=_.find((function(e){return e.pageName==="checkout_default"})))===null||o===void 0?void 0:o.message;var x=this.getCurrentLocalePageEnum();var S=_.filter((function(e){return e.pageName===x}));var T=this.getBaseCurrencySettlementInfo();var I=function(){var o=e.preview?"".concat(m,"?timestamp=").concat(Date.now()):m;return t("div",{class:"zonos--logo"},o&&t("img",{alt:"".concat(ie.organizationName," logo"),src:o}))};var A=de();var O=function(){var o=new URLSearchParams(window.location.search);var n=o.get("zonosQaUrl");var r=o.get("zonosDebug");var i=o.get("zonosE2ETest");var s=e.overrideStagingMode||me();return t("zonos-v-stack",null,t("div",{class:"zonos--logo-wrapper"},I(),A&&t("zonos-badge",{badgeColor:"orange",size:"small"},te("Test mode")),s&&t("zonos-badge",{badgeColor:"red",size:"small"},te("Staging mode")),r==="1"&&t("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),n&&t("zonos-badge",{badgeColor:"purple",size:"small"},n),i&&t("zonos-badge",{badgeColor:"gray",size:"small"},"E2E Test")),!d&&t("zonos-checkout-progress-tabs",{backgroundColor:e.isMobile?"--zonos-elements-gray-0":null}),S.map((function(e){return t("zonos-custom-message",{icon:Io,message:e.message})})))};var E=function(){if(l.checkoutSessionTimeoutShow){return t("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:te("Your checkout session has expired. Please reload the page to continue."),restStateTitle:te("Session timed out"),restStateType:"Warning"},t("zonos-button",{onClick:function(){return e.reloadCheckoutSession()},variant:"primary"},te("Reload")))}return t("div",{class:"zonos--content",style:{"--zonos--border-radius":Ie({overrideBorderStyle:g})}},l.step!=="finish"&&l.step!=="error"&&t(n,null,t("div",{class:"zonos--left","data-theme":y,style:Oe({"--zonos--primary-color":!e.isMobile?h:undefined})},!e.isMobile&&O(),l.step==="customer-info"&&t("zonos-customer-info",{continueLoading:e.submitLoading,defaultAddress:e.getDefaultAddress(),isMobile:e.isMobile,onContinueClicked:function(){return e.handleCustomerInfoContinue()},submitBtnColor:b}),l.step==="shipping"&&t("zonos-shipping",{continueLoading:e.submitLoading,isMobile:e.isMobile,onContinueClicked:function(){return e.handleShippingContinue()},submitBtnColor:b}),l.step==="payment"&&t("zonos-checkout-payment",{continueLoading:e.submitLoading,isMobile:e.isMobile,onContinueClicked:function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.handleStripePaymentContinue()];case 1:e.sent();return[2]}}))}))},submitBtnColor:b})),t("div",{class:"zonos--right","data-theme":w},e.isMobile&&O(),t("div",{class:"zonos--right-actions"},window.Zonos.showBaseForeign&&t("zonos-currency-toggle",null),!e.isLegacyCheckout&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:Ee}),noBackground:true,onClick:function(){return e.closeDialogHandler()}})),t("div",{class:"flex--wrapper"},t("div",{class:"zonos--wrapper"},t("zonos-review",{collapsed:e.collapseReviewMobile,mobile:e.isMobile,onClick:function(){if(!e.isMobile){return}e.collapseReviewMobile=!e.collapseReviewMobile}}),t("zonos-collapse",{collapsed:e.collapseReviewMobile&&e.isMobile},t("zonos-cart-items",null),e.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",{submitBtnColor:b}),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Io,message:C})))),t("zonos-cart-restricted-items",null),!e.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",null),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Io,message:C}))))),(l.step==="finish"||l.step==="error")&&t("div",{class:"zonos--done","data-theme":w},t("div",{class:"zonos--header"},I(),!e.isRedirectAfterOrder&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:Ee}),noBackground:true,onClick:function(){return e.handleFinishClick()},theme:w})),t("zonos-checkout-finish",{borderRadius:g,onCloseClick:function(){return e.handleFinishClick()},overrideNotification:l.step==="error"&&!!l.error?Object.assign(Object.assign({},l.error),{type:"error"}):undefined,storybookForceStatus:e.storybookPaymentStatusOverride})),t("zonos-checkout-footer",{"data-theme":w,mobile:e.isMobile,slot:!e.isMobile?"dialog-footer":undefined}))};return t(r,{class:Se(["zonos--checkout zonos--elements",l.step==="payment"&&"zonos--processing-payment",p&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile",this.isIframed&&"iframed",this.hiddenMode&&"hidden-mode"])},this.preview?E():t("zonos-dialog",{borderStyle:g,class:"zonos--checkout-dialog","data-theme":w,height:"980px",isLoading:u,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return e.closeDialogHandler()},open:this.open,width:"1200px"},E()),t("zonos-dialog",{isLoading:true,loadingText:te("You will be redirected to international checkout shortly."),loadingTitle:te("We detected that you are shipping to an international address."),noClickOutside:true,noCloseButton:true,open:this.detectedDomesticCheckoutDialogOpen,width:"450px"}),t("zonos-dialog",{isLoading:true,loadingText:te("You will be redirected to domestic checkout shortly."),loadingTitle:te("We detected that you are shipping to a domestic address."),noClickOutside:true,noCloseButton:true,open:this.redirectToDomesticCheckoutDialogOpen,width:"450px"}),t("zonos-confirm-dialog",{class:"zonos--logged-in-intl-address-dialog",dialogCancelBtnText:te("Stay on this page"),dialogConfirmBtnText:te("Continue to international checkout"),dialogIntent:"info",dialogOpen:this.loggedInIntlAddressConfirmDialogOpen,dialogSubtitle:te("Your selected address ships internationally. Would you like to continue to international checkout, or stay here and select a domestic address?"),dialogTitle:te("International shipping address detected"),dialogWidth:480,onCancelClicked:function(){var o;e.loggedInIntlAddressConfirmDialogOpen=false;(o=e.loggedInIntlAddressResolver)===null||o===void 0?void 0:o.call(e,"stay");e.loggedInIntlAddressResolver=null},onConfirmClicked:function(){var o;e.loggedInIntlAddressConfirmDialogOpen=false;(o=e.loggedInIntlAddressResolver)===null||o===void 0?void 0:o.call(e,"redirect");e.loggedInIntlAddressResolver=null}}),t("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:te("Don't close"),dialogConfirmBtnText:te("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:te("Would you like to close checkout and return to the site?"),dialogTitle:te("Are you sure?"),onCancelClicked:function(){e.confirmDialogOpen=false},onConfirmClicked:function(){return e.closeDialogHandler({confirmed:true})}}),t("zonos-confirm-dialog",{class:"zonos--order-duplication-dialog",dialogCancelBtnText:te("Return to merchant site"),dialogConfirmBtnText:te("Proceed with order"),dialogIntent:"warn",dialogOpen:!!this.placedOrderInfo,dialogSubtitle:((i=this.placedOrderInfo)===null||i===void 0?void 0:i.zonosOrderNumber)?te("It looks like you placed an order recently ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?",{date:this.formatDate(this.placedOrderInfo.time),orderNumber:this.placedOrderInfo.zonosOrderNumber,time:this.formatTime(this.placedOrderInfo.time)}):te("It looks like you placed an order recently ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?",{date:this.formatDate(((s=this.placedOrderInfo)===null||s===void 0?void 0:s.time)||null),time:this.formatTime(((a=this.placedOrderInfo)===null||a===void 0?void 0:a.time)||null)}),dialogTitle:te("Are you sure?"),dialogWidth:530,onCancelClicked:function(){e.handleCancelOrderDuplication()},onConfirmClicked:function(){e.confirmProceedWithOrderDuplication()}}),t("zonos-confirm-dialog",{class:"zonos--fedex-shipping-dialog",dialogConfirmBtnText:te("Confirm"),dialogIntent:"info",dialogOpen:!!this.shouldShowFedexShippingConsentDialog,dialogSubtitle:t(n,null,te("If you select FedEx Ground as your shipping option, you'll need to complete a General Agency Agreement (GAA) after placing your order. This form allows FedEx to clear your package through Canadian customs on your behalf. FedEx will contact you directly—usually by email or phone—with instructions on how to complete the GAA. To avoid delays or the return of your package, please respond promptly to their request."),t("zonos-link",{href:"https://ftn.fedex.com/us/assets/docs/One-Time_GAA.pdf",target:"_blank"},te("View GAA Form."))),dialogTitle:te("Fedex Shipping Procedure"),dialogType:"alert",dialogWidth:500,onConfirmClicked:function(){return e.shouldShowFedexShippingConsentDialog=false}}),t("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:te("Return to cart"),dialogIntent:"danger",dialogOpen:!!l.inventoryCheckErrorMessage,dialogSubtitle:l.inventoryCheckErrorMessage,dialogTitle:te("Couldn't place order"),dialogType:"alert",onConfirmClicked:function(){return e.handleInventoryCheckDialogConfirm()}}),T&&t("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:te("Cancel"),dialogConfirmBtnText:te("Pay [orderTotal]",{orderTotal:re({amount:T.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:te("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:te("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:function(){e.payInUsdConfirmDialogOpen=false},onConfirmClicked:function(){return e.handleStripePaymentContinue()}}),t("zonos-confirm-dialog",{class:"zonos--shopping-cart-expired-dialog",dialogConfirmBtnText:te("OK"),dialogIntent:"danger",dialogOpen:this.isCartExpired,dialogSubtitle:te("You are being sent back to the shop to re-add items to your cart."),dialogTitle:te("Shopping cart expired"),dialogType:"alert",onConfirmClicked:function(){return e.handleCartExpiredDialogConfirm()}}),t("zonos-loading-overlay",{open:this.isOverlayLoading}))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],overrideStagingMode:["overrideStagingModeChanged"],mobile:["handleMobileChange"],defaultAddress:["handleAddressChange"],customerProfile:["handleCustomerProfileChange"],clientSecret:["handleClientSecretChange"],stripeCustomerSessionClientSecret:["handleClientSecretChange"],open:["handleOpenChange"]}},enumerable:false,configurable:true});return e}());Lo.style=Oo}}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,n,t,r){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r["throw"](e))}catch(e){o(e)}}function s(e){e.done?t(e.value):i(e.value).then(a,u)}s((r=r.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(n){return s([e,n])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(t=0)),t)try{if(r=1,i&&(o=u[0]&2?i["return"]:u[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;if(i=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;i=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(o=t.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1];o=u;break}if(o&&t.label<o[2]){t.label=o[2];t.ops.push(u);break}if(o[2])t.ops.pop();t.trys.pop();continue}u=n.call(e,t)}catch(e){u=[6,e];i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-de58684b.system.js","./p-916228fb.system.js","./p-01174496.system.js","./p-d938f42f.system.js","./p-4a20893e.system.js"],(function(e){"use strict";var n,t,r,i,o,a,u,s,c,f,l,d,v,p;return{setters:[function(e){n=e.c;t=e.z},function(e){r=e.t;i=e.l;o=e.s},function(e){a=e.l;u=e.h;s=e.s},function(e){c=e.l;f=e.b},function(e){l=e.b;d=e.K;v=e.d;p=e.L}],execute:function(){var m=this;function h(e,n){if(n==null||n>e.length)n=e.length;for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function y(e){if(Array.isArray(e))return e}function w(e){if(Array.isArray(e))return h(e)}function g(e,n,t,r,i,o,a){try{var u=e[o](a);var s=u.value}catch(e){t(e);return}if(u.done){n(s)}else{Promise.resolve(s).then(r,i)}}function b(e){return function(){var n=this,t=arguments;return new Promise((function(r,i){var o=e.apply(n,t);function a(e){g(o,r,i,a,u,"next",e)}function u(e){g(o,r,i,a,u,"throw",e)}a(undefined)}))}}function k(e,n){if(!(e instanceof n)){throw new TypeError("Cannot call a class as a function")}}function x(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function E(e,n,t){if(n)x(e.prototype,n);if(t)x(e,t);return e}function I(e,n,t){if(n in e){Object.defineProperty(e,n,{value:t,enumerable:true,configurable:true,writable:true})}else{e[n]=t}return e}function S(e,n){if(n!=null&&typeof Symbol!=="undefined"&&n[Symbol.hasInstance]){return!!n[Symbol.hasInstance](e)}else{return e instanceof n}}function C(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function N(e,n){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var r=[];var i=true;var o=false;var a,u;try{for(t=t.call(e);!(i=(a=t.next()).done);i=true){r.push(a.value);if(n&&r.length===n)break}}catch(e){o=true;u=e}finally{try{if(!i&&t["return"]!=null)t["return"]()}finally{if(o)throw u}}return r}function T(){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 D(){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 j(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};var r=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))}r.forEach((function(n){I(e,n,t[n])}))}return e}function P(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);if(n){r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))}t.push.apply(t,r)}return t}function R(e,n){n=n!=null?n:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(n))}else{P(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function O(e,n){return y(e)||N(e,n)||L(e,n)||T()}function _(e){return w(e)||C(e)||L(e)||D()}function A(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function L(e,n){if(!e)return;if(typeof e==="string")return h(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor)t=e.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return h(e,n)}function U(e,n){var t,r,i,o,a={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(e){return function(n){return s([e,n])}}function s(o){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,r&&(i=o[0]&2?r["return"]:o[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;if(r=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:a.label++;return{value:o[1],done:false};case 5:a.label++;r=o[1];o=[0];continue;case 7:o=a.ops.pop();a.trys.pop();continue;default:if(!(i=a.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){a=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(o[0]===6&&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}if(i[2])a.ops.pop();a.trys.pop();continue}o=n.call(e,a)}catch(e){o=[6,e];r=0}finally{t=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}var M=function(e){e["production"]="prod";e["demo"]="demo";e["staging"]="staging";return e}(M||{});var F="airTracker_unknown";var K={appName:F,appVersion:F,env:"staging",isWebappContainer:false,delay:2e3,errorRepeatTime:3,enableErrorMonitoring:false,assetSpeedMonitoringWhiteList:[],enableDetectPageChange:false,enableRecordPageRetention:false,hideSearchParams:false,useSessionStorageForSessionId:false,assetSpeedMonitoringWhiteListByMFE:{}};var q={appName:F,env:"staging",sessionId:F,deviceId:F};var H=function(e){if(!e){return false}if(/^\s*$/.test(e))return false;e=e.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@");e=e.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");e=e.replace(/(?:^|:|,)(?:\s*\[)+/g,"");return/^[\],:{}\s]*$/.test(e)};var z=function(){var e=new WeakSet;return function(n,t){if(S(t,Error)){return"Error.message: ".concat(t.message," \n Error.stack: ").concat(t.stack)}if((typeof t==="undefined"?"undefined":A(t))==="object"&&t!==null){if(e.has(t)){return"[Circular ".concat(n||"root","]")}e.add(t)}if(typeof t==="function"){return"function"}if((typeof t==="undefined"?"undefined":A(t))==="symbol"){return"symbol"}if(typeof t==="undefined"){return null}return t}};var B=function(e){if(typeof e==="string"){return e}try{if(S(e,Error)){return(JSON.stringify(e,z())||"undefined").replace(/"/gim,"")}return JSON.stringify(e,z())}catch(e){return'{"error":"error happen when airTracker stringify"}'}};var W=function(e){var n=e.method,t=n===void 0?"post":n,r=e.url,i=e.data,o=e.success,a=e.fail;if(!H(i)){return}var u=new XMLHttpRequest;u.addEventListener("readystatechange",(function(){if(u.readyState===4){if(u.status>=400||u.status===0){a===null||a===void 0?void 0:a(u.response)}else{o===null||o===void 0?void 0:o(u.response)}}}));u.open(t,r);u.setRequestHeader("Content-Type","application/json");u.send(i)};var X={onInit:"onInit",onConfigInit:"onConfigInit",onConfigUpdated:"onConfigUpdated",onCommonDataInit:"onCommonDataInit",onCommonUpdated:"onCommonUpdated",onPageChange:"onPageChange",onDestroy:"onDestroy,"};var G="AIR_ANALYTICS_DEVICE_ID";var V="AIR_ANALYTICS_SESSION_ID";var $="AWX_RISK_ID";var J=function(e){if(e=="prod"){return"https://o11y.airwallex.com/airtracker/logs"}if(e=="demo"){return"https://o11y-demo.airwallex.com/airtracker/logs"}return"https://o11y-staging.airwallex.com/airtracker/logs"};var Q=function(e){if(e=="prod"){return"https://o11y.airwallex.com/airtracker/metrics"}if(e=="demo"){return"https://o11y-demo.airwallex.com/airtracker/metrics"}return"https://o11y-staging.airwallex.com/airtracker/metrics"};var Y=function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=Math.random()*16|0;var t=e==="x"?n:n&3|8;return t.toString(16)}));return e};var Z=function(e){var n,t,r;if(e.config.getMFEName){return e.config.getMFEName()}return((r=location)===null||r===void 0?void 0:(t=r.pathname)===null||t===void 0?void 0:(n=t.split("/"))===null||n===void 0?void 0:n[2])||"unknown"};var ee=function(){try{var e=window.sessionStorage.getItem(V);if(!e){e=Y();window.sessionStorage.setItem(V,e)}return e}catch(e){return Y()}};var ne=function(){try{var e=window.localStorage.getItem(G);if(!e){e=Y();window.localStorage.setItem(G,e)}return e}catch(e){}};var te=function(){try{var e=window.localStorage.getItem($);return e||void 0}catch(e){}};var re=function(){var e;var n="";var t=navigator.userAgent.match(/NetType\/(\w+)/);if(t){var r;r=O(t,2),n=r[1]}else if((e=navigator)===null||e===void 0?void 0:e.connection){var i,o,a,u;n=((o=navigator)===null||o===void 0?void 0:(i=o.connection)===null||i===void 0?void 0:i.effectiveType)||((u=navigator)===null||u===void 0?void 0:(a=u.connection)===null||a===void 0?void 0:a.type)}if(!n){n="unknown"}return ie(n)};var ie=function(e){e=String(e).toLowerCase();if(e.indexOf("4g")>=0)return"net4g";if(e.indexOf("wifi")>=0)return"wifi";if(e.indexOf("5g")>=0)return"net5g";if(e.indexOf("3g")>=0)return"net3g";if(e.indexOf("2g")>=0)return"net2g";return"unknown"};var oe=function e(){return typeof window.performance!=="undefined"&&typeof window.performance.clearResourceTimings==="function"&&typeof window.performance.getEntriesByType==="function"&&typeof window.performance.now==="function"};var ae=function(e){if(typeof e==="string"){var n=e.split("?")[0]||"";return n.slice(0,200)}return e};var ue=function(e){if(typeof e==="string"){return e.split("?")[1]||""}return e};var se=function(e){var n=typeof e==="string"&&e.startsWith("//");return n?typeof location!=="undefined"&&location.protocol==="https:":/^https/.test(e)};var ce=function(e,n){if(typeof e==="number"){return e}if(typeof e==="string"){return e}return n?"":-1};var fe=function(e,n){var t;var r=false;if(!n.config.isWebappContainer){r=le(e,n.config.assetSpeedMonitoringWhiteList);return r}var i=Z(n);return r||le(e,(t=n.config.assetSpeedMonitoringWhiteListByMFE)===null||t===void 0?void 0:t[i])};var le=function(e,n){if(!(n===null||n===void 0?void 0:n.length)){return false}for(var t=0;t<n.length;t++){var r=n[t];if(S(r,RegExp)&&r.test(e)){return true}if(typeof r=="string"&&e.includes(r)){return true}}return false};var de=function(e,n){var t=100;return Math.round((e-n)*t)/t};var ve=function(e){return function(n){var t,r;var i=Z(e);var o=e.config.isWebappContainer?j({},e.commonData||{},((t=e.MFECommonDataMap)===null||t===void 0?void 0:t[i])||{}):e.commonData;var a=Array.isArray(n)?n:[n];if(a.length===0){return}var u={commonData:o,data:a};var s=B(u);var c={method:"post",url:J(e.commonData.env),data:s};if(typeof((r=navigator)===null||r===void 0?void 0:r.sendBeacon)==="function"){var f=navigator.sendBeacon(c.url,s);if(!f){W(c)}}else{W(c)}}};var pe=function(e){return function(n){var t,r;var i=Z(e);var o=e.config.isWebappContainer?j({},e.commonData||{},((t=e.MFECommonDataMap)===null||t===void 0?void 0:t[i])||{}):e.commonData;var a={commonData:o,data:Array.isArray(n)?n:[n]};var u=B(a);var s={method:"post",url:Q(e.commonData.env),data:u};if(typeof((r=navigator)===null||r===void 0?void 0:r.sendBeacon)==="function"){var c=navigator.sendBeacon(s.url,u);if(!c){W(s)}}else{W(s)}}};var me=function(e,n){var t;var r=[];var i=e.config;window.addEventListener("beforeunload",(function(){if(r.length>0){e.immediateSendPipe(r.splice(0,r.length));t&&clearTimeout(t)}}));return function(o,a){r.push(o);e.lifeCycle.on(X.onCommonUpdated,(function(){if(r.length>0){a===null||a===void 0?void 0:a(r.splice(0,r.length));e.lifeCycle.remove(X.onCommonUpdated);t&&clearTimeout(t)}}));if(n&&r.length>=n){a===null||a===void 0?void 0:a(r.splice(0,r.length));t&&clearTimeout(t);return}t&&clearTimeout(t);t=setTimeout((function(){t=null;if(r.length>0){a===null||a===void 0?void 0:a(r.splice(0,r.length));e.lifeCycle.remove(X.onCommonUpdated)}}),i.delay)}};var he=function(e){var n={};return function(t,r){var i=typeof e.config.errorRepeatTime==="number"?e.config.errorRepeatTime:5;if(i===0){return r===null||r===void 0?void 0:r(t)}r===null||r===void 0?void 0:r(t.filter((function(e){if(e.severity=="autoDetectError"){n[e.error]=n[e.error]||0;n[e.error]+=1;if(n[e.error]>i){return false}return true}return true})))}};var ye=function(){};var we=function(e){if(!e||!e.reduce||!e.length){throw new TypeError("createPipeline need at least one function param")}if(e.length===1){return function(n,t){e[0](n,t||ye)}}return e.reduce((function(e,n){return function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ye;return e(t,(function(e){return n===null||n===void 0?void 0:n(e,r)}))}}))};var ge=function(){function e(){var n=this;k(this,e);this.emit=function(e,t){if(!n)return;var r=n.eventsList[e];var i;if(r===null||r===void 0?void 0:r.length){r=r.slice();for(var o=0;o<r.length;o++){i=r[o];try{var a=i.callback.apply(n,[t]);if(1===i.type){n.remove(e,i.callback)}if(false===a){break}}catch(e){throw e}}}return n};this.eventsList={}}E(e,[{key:"indexOf",value:function e(n,t){for(var r=0;r<n.length;r++){if(n[r].callback===t){return r}}return-1}},{key:"on",value:function e(n,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(!this)return;var i=this.eventsList[n];if(!i){this.eventsList[n]=[];i=this.eventsList[n]}if(this.indexOf(i,t)===-1){var o={name:n,type:r||0,callback:t};i.push(o);return this}return this}},{key:"one",value:function e(n,t){this.on(n,t,1)}},{key:"remove",value:function e(n,t){if(!this)return;var r=this.eventsList[n];if(!r){return null}if(!t){try{delete this.eventsList[n]}catch(e){}return null}if(r.length){var i=this.indexOf(r,t);r.splice(i,1)}return this}},{key:"clear",value:function e(){this.eventsList={}}}]);return e}();var be=function(){function e(n){k(this,e);this.name="";this.isInit=false;this.name=n.name;this.option=n}E(e,[{key:"patch",value:function e(n){if(!this.isInit){var t,r;this.isInit=true;(r=this.option)===null||r===void 0?void 0:(t=r.setUp)===null||t===void 0?void 0:t.call(this.option,n)}}},{key:"uninstall",value:function e(){var n,t;(t=this.option)===null||t===void 0?void 0:(n=t.destroy)===null||n===void 0?void 0:n.apply(this);this.isInit=false}}]);return e}();var ke;var xe=function(e){var n="".concat(B(e.message)||""," @ (").concat(B(e.filename)||"",":").concat(e.lineno||0,":").concat(e.colno||0,")\n").concat(B(e.error||""));ke.normalLogPipeLine({severity:"autoDetectError",eventName:"windowOnError",extraInfo:{error:n}})};var Ee=function(e){var n=e&&B(e.reason);ke.normalLogPipeLine({severity:"autoDetectError",eventName:"promiseError",extraInfo:{error:n}})};var Ie=function(e){var n=(e===null||e===void 0?void 0:e.target)||(e===null||e===void 0?void 0:e.srcElement);if(!n){return}var t=(n===null||n===void 0?void 0:n.src)||(n===null||n===void 0?void 0:n.href);var r=n.tagName;var i="unknown";if(typeof t==="string"&&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}}ke.normalLogPipeLine({severity:"autoDetectError",eventName:"staticFileLoadError",extraInfo:{staticFileType:i,error:"".concat(r," load fail: ").concat(t)}})}};var Se=new be({name:"errorDetectionPlugin",setUp:function(e){ke=e;window.addEventListener("error",xe);window.addEventListener("unhandledrejection",Ee);window.document.addEventListener("error",Ie,true)},destroy:function(){window.removeEventListener("unhandledrejection",Ee);window.document.removeEventListener("error",Ie,true);window.removeEventListener("error",xe)}});var Ce=["img","css","script","link","audio","video","iframe"];var Ne="resource";var Te=function(e){var n=e.name;return{url:ae(n),method:"get",duration:Number(e.duration.toFixed(2)),type:"static",isHttps:se(n),urlQuery:ue(n),domainLookup:ce(e.domainLookupEnd-e.domainLookupStart),connectTime:ce(e.connectEnd-e.connectStart)}};var De=function(e,n){for(var t=0,r=e.length;t<r;t++){var i=e[t];if(Ce.indexOf(i.initiatorType)!==-1&&fe(i.name,n)){n.normalLogPipeLine({severity:"performance",eventName:"assets_speed",extraInfo:{log:Te(i)}})}}};var je;var Pe;var Re=new be({name:"assetsSpeedPlugin",setUp:function(e){if(!oe())return;var n=0;window.performance.onresourcetimingbufferfull=function(){n=0;window.performance.clearResourceTimings()};if(typeof window.PerformanceObserver==="function"){De(window.performance.getEntriesByType(Ne),e);Pe=new window.PerformanceObserver((function(n){De(n.getEntries(),e)}));Pe.observe({entryTypes:[Ne]})}else{je=setInterval((function(){var t=window.performance.getEntriesByType(Ne);var r=t.slice(n);n=t.length;De(r,e)}),3e3)}},destroy:function(){Pe===null||Pe===void 0?void 0:Pe.disconnect();je&&clearInterval(je)}});var Oe;var _e=new be({name:"onPageChangePlugin",setUp:function(){var e=b((function(e){var n,t,r,i,o;return U(this,(function(a){t=(n=location)===null||n===void 0?void 0:n.href;r=document.querySelector("body");i=function(n){var t=n.prevHref;var r,i,o,a,u;e.normalLogPipeLine({severity:"autoDetectEvent",eventName:"onPageChange",extraInfo:{prevHref:t,href:((r=location)===null||r===void 0?void 0:r.href)||"",hostname:(i=location)===null||i===void 0?void 0:i.hostname,pathName:(o=location)===null||o===void 0?void 0:o.pathname,protocol:(a=location)===null||a===void 0?void 0:a.protocol,search:(u=location)===null||u===void 0?void 0:u.search}})};i({prevHref:""});Oe=new MutationObserver((function(){if(location.href!==t){var e=t;t=location.href;i({prevHref:e})}}));o={subtree:true,childList:true};Oe.observe(r||document,o);return[2]}))}));return function(n){return e.apply(this,arguments)}}(),destroy:function(){Oe===null||Oe===void 0?void 0:Oe.disconnect()}});var Ae;var Le=new be({name:"onPageRetentionPlugin",setUp:function(){var e=b((function(e){var n,t,r,i,o,a,u;return U(this,(function(s){if(typeof document.visibilityState==="undefined"){return[2]}t=(n=location)===null||n===void 0?void 0:n.href;r=document.querySelector("body");o=function(){i=Date.now()};o();document.addEventListener("visibilitychange",(function(){if(document.visibilityState==="hidden"){a({href:location.href,leftReason:"visibilityChange"})}else if(document.visibilityState==="visible"){o()}}));window.addEventListener("beforeunload",(function(){a({href:location.href,sendImmediate:true,leftReason:"pageClose"})}));a=function(n){var t=n.href,r=n.sendImmediate,o=n.leftReason;if(!i){return}var a=Date.now()-i;if(a===0){return}i=void 0;var u={severity:"autoDetectEvent",eventName:"onPageRetention",extraInfo:{href:t,duration:a,leftReason:o}};if(r){e.ImmediatePipeline(u);return}e.normalLogPipeLine(u)};Ae=new MutationObserver((function(){if(location.href!==t){var e=t;t=location.href;a({href:e,leftReason:"nextPage"});o()}}));u={subtree:true,childList:true};Ae.observe(r||document,u);return[2]}))}));return function(n){return e.apply(this,arguments)}}(),destroy:function(){Ae===null||Ae===void 0?void 0:Ae.disconnect()}});var Ue=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2,15)};var Me=function(e,n){var t=[/^https?:\/\/[^\/]*\.airwallex\.com($|\/)/];var r=[/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];if(r.some((function(n){return n.test(e)}))){return false}return le(e,n||t)};var Fe=function(e){var n=e.startTime,t=e.endTime,r=e.entries;if(r.length===0){return void 0}if(r.length===1){return r[0]}var i=r.filter((function(e){return e.startTime>=n&&t&&e.responseEnd<=t})).sort((function(e,n){return e.startTime-n.startTime}));return i===null||i===void 0?void 0:i[0]};var Ke=function(e){return Math.round(e*100)/100};var qe=function(e){var n=e.startTime,t=e.duration,r=e.responseStart,i=e.connectEnd,o=e.connectStart,a=e.domainLookupEnd,u=e.domainLookupStart,s=e.requestStart,c=e.secureConnectionStart,f=e.redirectEnd,l=e.redirectStart,d=e.responseStatus,v=e.responseEnd,p=e.encodedBodySize,m=e.decodedBodySize,h=e.transferSize,y=e.deliveryType,w=e.initiatorType;return{startTime:Ke(n),totalDuration:Ke(t),timeToFirstByte:de(r,n),tcpDuration:de(i,o),dnsDuration:de(a,u),tlsDuration:de(s,c),redirectDuration:de(f,l),responseDuration:de(v,r),encodeResponseSize:p,decodeResponseSize:m,transferSize:h,deliveryType:y,statusCode:d,initiatorType:w}};var He=function(e,n){var t=e.url,r=e.method,i=e.errorType,o=e.errorDetail;var a=Fe(e);var u=new URL(t,window.location.href),s=u.href,c=u.protocol;var f=a?qe(a):{};var l={severity:"autoDetectEvent",eventName:"httpClientMetrics",extraInfo:j(R(j({httpUrl:s,method:r,scheme:c},i&&{errorType:i},o&&{errorDetail:o},f),{statusCode:(f===null||f===void 0?void 0:f.statusCode)||(e===null||e===void 0?void 0:e.responseStatus),startTime:(f===null||f===void 0?void 0:f.startTime)||(e===null||e===void 0?void 0:e.startTime),initiatorType:(f===null||f===void 0?void 0:f.initiatorType)||(e===null||e===void 0?void 0:e.initiatorType)}),n)};return l};var ze=function(e){return e&&(typeof e==="undefined"?"undefined":A(e))==="object"&&"errors"in e&&Array.isArray(e.errors)&&e.errors.every((function(e){return e&&(typeof e==="undefined"?"undefined":A(e))==="object"&&"message"in e}))};var Be="awx_airtracker_api_performance_queue";var We="awx_airtracker_api_performance_plugin_loaded";var Xe=300;var Ge=1e4;var Ve=typeof window!=="undefined"?window:typeof global!=="undefined"?global:{};Ve[Be]=Ve[Be]||[];var $e=function(e,n,t){setTimeout((function(){var r=He(e,t);n.observerPipeline(r);Ve[Be]=Ve[Be].filter((function(n){return n.id!==e.id}))}),Xe)};var Je=function(e,n){setTimeout((function(){var t=Ve[Be].find((function(n){return n.id===e}));if(!t){return}var r=He(t,{exceptionType:"timeout-without-response"});n.observerPipeline(r);Ve[Be]=Ve[Be].filter((function(n){return n.id!==e}))}),Ge)};var Qe=function(e){var n=XMLHttpRequest.prototype.open;var t=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function t(r,i,o,a,u){try{var s;var c=Ue();this.__requestId=c;var f=S(i,URL)?i.href:new URL(i,window.location.href).href;if(!Me(f,(s=e.config)===null||s===void 0?void 0:s.enableRecordAPIPerformanceWhitelist)){return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}var l={id:c,startTime:performance.now(),method:r,url:f,entries:[],initiatorType:"xmlhttprequest"};Ve[Be].push(l);Je(c,e);return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}catch(t){e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject XHR open error",error:t}});return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}};XMLHttpRequest.prototype.send=function n(){var r=this;for(var i=arguments.length,o=new Array(i),a=0;a<i;a++){o[a]=arguments[a]}try{var u=Ve[Be].find((function(e){return e.id===r.__requestId}));if(!u){return t.apply(this,o)}var s=this;this.addEventListener("loadend",b((function(){var n,t,r,i,o,a,c;return U(this,(function(f){switch(f.label){case 0:n=performance.now();t=n-u.startTime;r=s.status;if(r===0){return[2]}u.endTime=n;u.duration=t;u.responseStatus=r;f.label=1;case 1:f.trys.push([1,6,,7]);if(!(s.responseType===""||s.responseType==="text"))return[3,2];i=s.responseText;return[3,5];case 2:if(!(s.responseType==="json"))return[3,3];i=s.response;return[3,5];case 3:if(!(s.responseType==="blob"))return[3,5];o=s.response;if(!((o===null||o===void 0?void 0:o.type)==="application/json"))return[3,5];return[4,o.text()];case 4:i=f.sent();f.label=5;case 5:a=i&&typeof i==="string"?JSON.parse(i):i;if(a&&ze(a)){u.errorType="graphqlError";u.errorDetail=a.errors}return[3,7];case 6:c=f.sent();e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in XHR",url:u===null||u===void 0?void 0:u.url,error:c}});return[3,7];case 7:$e(u,e);return[2]}}))})));this.addEventListener("error",(function(){$e(u,e,{exceptionType:"network-error"})}));this.addEventListener("abort",(function(){$e(u,e,{exceptionType:"abort-error"})}));this.addEventListener("timeout",(function(){$e(u,e,{exceptionType:"timeout-error"})}));return t.apply(this,o)}catch(n){e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"InjectXHR send error",error:n}});throw n}}};var Ye=function(e){var n=window.fetch;window.fetch=b((function(){var t,r,i,o,a,u,s,c,f,l,d,v,p,m,h,y;var w=arguments;return U(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]}u=new URL(S(r[0],Request)?r[0].url:String(r[0]),window.location.href).href;if(!!Me(u,(o=e.config)===null||o===void 0?void 0:o.enableRecordAPIPerformanceWhitelist))return[3,2];return[4,n.apply(this,r)];case 1:return[2,g.sent()];case 2:g.trys.push([2,9,,10]);c=performance.now();f=Ue();a={id:f,startTime:c,method:((s=S(r[0],Request)?r[0]:r[1])===null||s===void 0?void 0:s.method)||"GET",url:u,entries:[],initiatorType:"fetch"};Ve[Be].push(a);Je(f,e);return[4,n.apply(this,r)];case 3:l=g.sent();d=performance.now();a.endTime=d;a.duration=d-c;a.responseStatus=l.status;v=l.clone();g.label=4;case 4:g.trys.push([4,7,,8]);if(!v.ok)return[3,6];return[4,v.json()];case 5:p=g.sent();if(p&&ze(p)){a.errorType="graphqlError";a.errorDetail=p.errors}g.label=6;case 6:return[3,8];case 7:m=g.sent();e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in fetch",url:a===null||a===void 0?void 0:a.url,error:m}});return[3,8];case 8:$e(a,e);return[2,l];case 9:h=g.sent();if(a&&a.id&&Ve[Be].find((function(e){return e.id===(a===null||a===void 0?void 0:a.id)}))){y="fetch-error";if(S(h,TypeError)){y="network-error"}else if(S(h,DOMException)&&h.name==="AbortError"){y="abort-error"}$e(a,e,{exceptionType:y})}else{e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject fetch error",error:h}})}throw h;case 10:return[2]}}))}))};var Ze=function(e){var n;Qe(e);Ye(e);if((n=window)===null||n===void 0?void 0:n.PerformanceObserver){var t=new window.PerformanceObserver((function(e){var n=e.getEntries();n.forEach((function(e){var n=e;if(n.initiatorType==="fetch"||n.initiatorType==="xmlhttprequest"){var t=Ve[Be].filter((function(e){return e.url===n.name}));t.forEach((function(e){e.entries.push(n)}))}}))}));t.observe({entryTypes:["resource"],buffered:true})}else{e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{error:"PerformanceObserver Not Supported"}})}};var en=new be({name:"apiPerformancePlugin",setUp:function(){var e=b((function(e){var n,t;return U(this,(function(r){if(Ve[We]){return[2]}if(((n=e.config)===null||n===void 0?void 0:n.enableRecordAPIPerformance)&&Math.random()<(((t=e.config)===null||t===void 0?void 0:t.enableRecordAPIPerformancePercentage)||0)){Ve[We]=true;Ze(e)}return[2]}))}));return function(n){return e.apply(this,arguments)}}()});var nn="3.1.0";var tn=function(){function e(n){var t=this;var r=n.config,i=n.plugins,o=i===void 0?[]:i;k(this,e);this.config=K;this.lifeCycle=new ge;this.plugins=[];this._commonData=q;this._MFECommonDataMap={};this.timeMap={};this.packedDataConvert=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o,a;var u=j({severity:n,eventName:r,currentHref:t.config.hideSearchParams?(((o=location)===null||o===void 0?void 0:o.href)||"").split("?")[0]||"":((a=location)===null||a===void 0?void 0:a.href)||""},i);if(t.config.isWebappContainer){u.MFEName=Z(t)}return u};this.normalPipelineObj=we([me(this,8),he(this),ve(this)]);this.observerPipelineObj=we([me(this,8),pe(this)]);this.immediateSendPipe=ve(this);this.observerPipeline=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});return t.observerPipelineObj(o)};this.normalLogPipeLine=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});if(t.config.disableThrottle){return t.immediateSendPipe(o)}else{return t.normalPipelineObj(o)}};this.ImmediatePipeline=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});return t.immediateSendPipe(o)};this.plugins=_(o);this.setConfig(r);this.initCommonData(r);this.lifeCycle.emit(X.onInit);if(r.enableErrorMonitoring){this.plugins.push(Se)}if((r===null||r===void 0?void 0:r.assetSpeedMonitoringWhiteList)&&r.assetSpeedMonitoringWhiteList.length>0||r.isWebappContainer){this.plugins.push(Re)}if(r===null||r===void 0?void 0:r.enableDetectPageChange){this.plugins.push(_e)}if(r===null||r===void 0?void 0:r.enableRecordPageRetention){this.plugins.push(Le)}if((r===null||r===void 0?void 0:r.enableRecordAPIPerformance)&&(r===null||r===void 0?void 0:r.enableRecordAPIPerformancePercentage)&&r.enableRecordAPIPerformancePercentage>0&&r.enableRecordAPIPerformancePercentage<=1){this.plugins.push(en)}this.installPlugins()}E(e,[{key:"installPlugins",value:function e(){var n=this;this.plugins.forEach((function(e){e.patch(n)}))}},{key:"commonData",get:function e(){return this._commonData}},{key:"MFECommonDataMap",get:function e(){return this._MFECommonDataMap}},{key:"initCommonData",value:function e(n){this._commonData.sessionId=n.useSessionStorageForSessionId?ee():Y();this._commonData.deviceId=ne()||F;this._commonData.riskDeviceId=te();this._commonData.networkType=re()||"unknown";this._commonData.env=n.env||this._commonData.env;this._commonData.accountId=n.accountId||F;this._commonData.appVersion=n.appVersion;this._commonData.appName=n.appName;this._commonData.sdkVersion=nn;this.lifeCycle.emit(X.onCommonDataInit,this.commonData)}},{key:"updateCommonDataBasedOnConfig",value:function e(n){this.lifeCycle.emit(X.onCommonUpdated,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 e(n){this.lifeCycle.emit(X.onCommonUpdated,this._commonData);this._commonData=j({},this._commonData,n)}},{key:"removeCommonDataByKey",value:function e(n){var t=this;this.lifeCycle.emit(X.onCommonUpdated,this._commonData);setTimeout((function(){n.forEach((function(e){delete t._commonData[e]}))}),1e3)}},{key:"addToMFECommonData",value:function e(n){var t=n.MFEName,r=n.MFECommonData;var i;if(!this.config.isWebappContainer){return}if(!t||!r){return}this._MFECommonDataMap=R(j({},this._MFECommonDataMap||{}),I({},t,j({},((i=this._MFECommonDataMap)===null||i===void 0?void 0:i[t])||{},r)))}},{key:"setConfig",value:function e(n){var t=this;if(this.config.isWebappContainer){return}var r=function(e,n){t.config[e]=n};Object.entries(n).forEach((function(e){var n=O(e,2),t=n[0],i=n[1];if((typeof i==="undefined"?"undefined":A(i))!==void 0){r(t,i)}}));this.lifeCycle.emit(X.onConfigInit,this.config);this.updateCommonDataBasedOnConfig(n)}},{key:"verbose",value:function e(n,t){this.normalLogPipeLine({severity:"verbose",eventName:n,extraInfo:t})}},{key:"httpLog",value:function e(n,t){this.normalLogPipeLine({severity:"http",eventName:n,extraInfo:t})}},{key:"info",value:function e(n,t){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:t})}},{key:"warn",value:function e(n,t){this.normalLogPipeLine({severity:"warn",eventName:n,extraInfo:t})}},{key:"error",value:function e(n,t){console.error("error",n);this.normalLogPipeLine({severity:"error",eventName:n,extraInfo:t})}},{key:"businessLog",value:function e(n,t){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:R(j({},t),{isBusinessLog:true})})}},{key:"reportDuration",value:function e(n,t,r){if(typeof n!=="string"){console.warn("reportDuration: eventName (first param) must be a string");return}if(typeof t!=="number"){console.warn("reportDuration: duration (second param) must be number");return}if(t<0||t>6e4){console.warn("reportDuration: duration (second param) must between 0 and 60000");return}this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:j({duration:t},r)})}},{key:"getTimerKey",value:function e(n){var t=Z(this);return this.config.isWebappContainer?"".concat(t,"_").concat(n):n}},{key:"timeStart",value:function e(n){if(typeof n!=="string"){console.warn("time: first param must be a string");return}if(this.timeMap[this.getTimerKey(n)]){console.warn("Timer ".concat(n," already exists"))}this.timeMap[this.getTimerKey(n)]=Date.now()}},{key:"timeEnd",value:function e(n,t){if(typeof n!=="string"){console.warn("timeEnd: first param must be a string");return}if(this.timeMap[this.getTimerKey(n)]){var r=Date.now()-this.timeMap[this.getTimerKey(n)]+(t||0);this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:{duration:r}});delete this.timeMap[this.getTimerKey(n)]}else{console.warn("Timer key :".concat(n," does not exist"))}}},{key:"addToAssetSpeedWhiteListByMFE",value:function e(n){var t=n.MFEName,r=n.whiteList;var i;if(!this.config.isWebappContainer){return}if(!t||!(r===null||r===void 0?void 0:r.length)){return}if(!this.config.assetSpeedMonitoringWhiteListByMFE){this.config.assetSpeedMonitoringWhiteListByMFE={}}if(!((i=this.config.assetSpeedMonitoringWhiteListByMFE)===null||i===void 0?void 0:i[t])){this.config.assetSpeedMonitoringWhiteListByMFE=R(j({},this.config.assetSpeedMonitoringWhiteListByMFE),I({},t,r))}else{var o;var a,u;(u=this.config.assetSpeedMonitoringWhiteListByMFE)===null||u===void 0?void 0:(a=u[t])===null||a===void 0?void 0:(o=a).push.apply(o,_(r))}}},{key:"destroy",value:function e(){if(this.config.isWebappContainer){return}this.plugins.forEach((function(e){e.uninstall()}))}}]);return e}();var rn=tn;var on=function(e,n){on=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)if(Object.prototype.hasOwnProperty.call(n,t))e[t]=n[t]};return on(e,n)};function an(e,n){if(typeof n!=="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");on(e,n);function t(){this.constructor=e}e.prototype=n===null?Object.create(n):(t.prototype=n.prototype,new t)}var un=function(){un=Object.assign||function e(n){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))n[o]=t[o]}return n};return un.apply(this,arguments)};function sn(e,n,t,r){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r["throw"](e))}catch(e){o(e)}}function s(e){e.done?t(e.value):i(e.value).then(a,u)}s((r=r.apply(e,n||[])).next())}))}function cn(e,n){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(n){return s([e,n])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(t=0)),t)try{if(r=1,i&&(o=u[0]&2?i["return"]:u[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;if(i=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;i=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(o=t.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1];o=u;break}if(o&&t.label<o[2]){t.label=o[2];t.ops.push(u);break}if(o[2])t.ops.pop();t.trys.pop();continue}u=n.call(e,t)}catch(e){u=[6,e];i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}function fn(e,n,t){if(t||arguments.length===2)for(var r=0,i=n.length,o;r<i;r++){if(o||!(r in n)){if(!o)o=Array.prototype.slice.call(n,0,r);o[r]=n[r]}}return e.concat(o||Array.prototype.slice.call(n))}typeof SuppressedError==="function"?SuppressedError:function(e,n,t){var r=new Error(t);return r.name="SuppressedError",r.error=e,r.suppressed=n,r};var ln="@airwallex/components-sdk";var dn="1.30.2";var vn="./lib/index.js";var pn="./lib/index.mjs";var mn="./lib/index.d.ts";var hn=["lib/**"];var yn="MIT";var wn={"load-types":"node ./load-types.js && yarn prettier -w src/types/*d.ts",prebuild:"yarn clean",build:"yarn rollup --config",postbuild:"yarn bundle-types","bundle-types":"dts-bundle-generator -o ./lib/index.d.ts ./src/index.ts",clean:"rm -rf dist lib",lint:'eslint "src/**/*.ts*"',test:"jest",sonar:"sonar-scanner",release:"semantic-release","lint-stage":"lint-staged",prepare:"husky"};var gn={semi:true,singleQuote:true,printWidth:80,trailingComma:"all"};var bn={access:"public"};var kn={"@babel/preset-typescript":"^7.18.6","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^11.1.6","@semantic-release/changelog":"^5.0.1","@semantic-release/commit-analyzer":"^8.0.1","@semantic-release/git":"^9.0.0","@semantic-release/gitlab":"^6.1.0","@semantic-release/release-notes-generator":"^9.0.0","@swc/core":"^1.3.46","@types/jest":"^29.5.0","@typescript-eslint/eslint-plugin":"^5.57.0","@typescript-eslint/parser":"^5.57.0","dts-bundle-generator":"^9.0.0",eslint:"^7.23.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^5.1.3",husky:"^9.0.11",jest:"^29.5.0","jest-environment-jsdom":"^29.5.0","lint-staged":"^15.2.7",prettier:"^3.3.2",rollup:"^4.9.6","semantic-release":"^17.3.8","sonarqube-scanner":"^3.0.1","ts-jest":"^29.0.5","ts-loader":"^9.5.1",tslib:"^2.6.2",typescript:"^4.5.2"};var xn={"@airwallex/airtracker":"^3.0.0"};var En={name:ln,version:dn,main:vn,module:pn,types:mn,files:hn,license:yn,scripts:wn,prettier:gn,"lint-staged":{"src/**/*.{ts,tsx}":["yarn lint"],"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}":"prettier --write"},publishConfig:bn,devDependencies:kn,dependencies:xn};var In={dev:M.staging,staging:M.staging,demo:M.demo,prod:M.production};var Sn=function(e,n){if(e===void 0){e=M.production}if(!window._AirwallexSDKs.airTracker){window._AirwallexSDKs.airTracker=new rn({config:{appName:"components-sdk",appVersion:En.version,env:In[e]||M.production}});window._AirwallexSDKs.airTracker.updateCommonData({clientId:n})}return window._AirwallexSDKs.airTracker};var Cn=function(e){if(typeof e!=="object"){return e}try{var n=JSON.parse(JSON.stringify(e));Object.keys(n).forEach((function(e){if(typeof e==="string"&&["auth","code"].some((function(n){return e.includes(n)}))){n[e]="***"}}));return n}catch(n){return e}};var Nn=function(e,n){var t,r;(r=(t=window._AirwallexSDKs)===null||t===void 0?void 0:t.airTracker)===null||r===void 0?void 0:r.error(e,un(un({},n),{context:"components-sdk"}))};var Tn=function(e,n){var t;(t=window._AirwallexSDKs.airTracker)===null||t===void 0?void 0:t.warn(e,un(un({},n),{context:"components-sdk"}))};var Dn=function(e,n){var t;(t=window._AirwallexSDKs.airTracker)===null||t===void 0?void 0:t.info(e,un(un({},n),{context:"components-sdk"}))};var jn=function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="LOAD_SCRIPT_ERROR";return t}return n}(Error);var Pn,Rn;var On;(function(e){e["dev"]="dev";e["staging"]="staging";e["demo"]="demo";e["prod"]="prod";e["sandbox"]="sandbox"})(On||(On={}));var _n=(Pn={},Pn[On.dev]="https://checkout-staging.airwallex.com",Pn[On.staging]="https://checkout-staging.airwallex.com",Pn[On.demo]="https://checkout-demo.airwallex.com",Pn[On.prod]="https://checkout.airwallex.com",Pn[On.sandbox]="https://checkout.sandbox.airwallex.com",Pn);var An=(Rn={},Rn[On.dev]="https://static-staging.airwallex.com",Rn[On.staging]="https://static-staging.airwallex.com",Rn[On.demo]="https://static-demo.airwallex.com",Rn[On.prod]="https://static.airwallex.com",Rn[On.sandbox]="https://static.sandbox.airwallex.com",Rn);var Ln="sdkController";var Un="payments";var Mn={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"};var Fn={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"};var Kn={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"]};var qn={billing:["payments"]};var Hn=["payments","sca"];var zn=function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="INVALID_STATIC_RESOURCE_ERROR";return t}return n}(Error);var Bn=Date.now();var Wn=function(e){return Object.keys(Kn).includes(e)};var Xn=function(e){if(e===void 0){e=500}return new Promise((function(n){return window.setTimeout(n,e)}))};var Gn=function(e){return Fn[e]};var Vn=function(e,n){var t=e===Un?_n:An;return t[n]||t.prod};var $n=function(e){var n=e.reduce((function(e,n){return e.concat(Wn(n)?Kn[n]:n)}),[]);return Array.from(new Set(n)).map((function(e){return{elementName:e,sdkName:Gn(e)}}))};var Jn=function(e){return Array.from(new Set($n(e).map((function(e){var n=e.sdkName;return n})).filter((function(e){return Hn.includes(e)}))))};var Qn=function(e){return e==="payments"?"payment":e};var Yn=function(e){var n=e.name,t=e.env,r=t===void 0?On.prod:t;var i=Vn(n,r);var o=Mn[n];if(!o){Nn("[components-sdk] Element static resource not found",{sdkName:n});throw new zn("Element ".concat(n," static resource URL is invalid."))}return"".concat(i).concat(o,"?ts=").concat(Bn)};var Zn=function(){return Hn.reduce((function(e,n){var t;return un(un({},e),(t={},t[n]=window._AirwallexSDKs.__controller__.internalSDKs[n],t))}),{})};var et=function(e){return qn[e]||[]};var nt=function(){return Math.floor(performance.now())};var tt=function(e){var n=document.createElement("script");n.src=e;n.type="module";var t=document.head||document.body;t.appendChild(n);return n};var rt=3;var it=function(e){return sn(void 0,void 0,void 0,(function(){var n,t;return cn(this,(function(r){switch(r.label){case 0:if(typeof window==="undefined"){throw new Error("Please load script in browser environment")}n=0;t=function(){return sn(void 0,void 0,void 0,(function(){var t,r,i;return cn(this,(function(o){t=nt();if(n>0&&e.includes("?ts=")){r=new URL(e,window.location.href);r.searchParams.set("ts","".concat(Date.now()));e=r.toString()}i=tt(e);return[2,new Promise((function(r,o){i.addEventListener("load",(function(){var i=nt();Dn("[components-sdk] SDK script loaded",{scriptUrl:e,start:t,latency:i-t,end:i,retryCount:n});r(true)}));i.addEventListener("error",(function(r){i.remove();console.error(r);var a=nt();Nn("[components-sdk] Failed to load script",{scriptUrl:e,error:r,start:t,latency:a-t,end:a,retryCount:n});o(new jn("Failed to load Airwallex SDK scripts: ".concat(e)))}))}))]}))}))};r.label=1;case 1:if(!(n<rt))return[3,7];r.label=2;case 2:r.trys.push([2,4,,6]);return[4,t()];case 3:return[2,r.sent()];case 4:r.sent();n++;return[4,Xn()];case 5:r.sent();return[3,6];case 6:return[3,1];case 7:Nn("[components-sdk] Failed to load script after retry",{scriptUrl:e,retryCount:n});throw new jn("Failed to load Airwallex SDK scripts: ".concat(e))}}))}))};var ot=function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="INSTANCE_NOT_FOUND_ERROR";return t}return n}(Error);var at;var ut=new Map;var st=function(e){var n=e.env,t=e.scriptName;var r=Yn({name:t,env:n});var i=ut.get(t);if(i){return i}var o=it(r);ut.set(t,o);return o};var ct=function(e){var n=e.env,t=e.scriptName;return sn(void 0,void 0,void 0,(function(){var e;return cn(this,(function(r){switch(r.label){case 0:e=et(t);if(!(e.length>0))return[3,2];return[4,Promise.all(e.map((function(e){return st({env:n,scriptName:e})})))];case 1:r.sent();r.label=2;case 2:return[2,st({env:n,scriptName:t})]}}))}))};var ft=function(e){return sn(void 0,void 0,void 0,(function(){return cn(this,(function(n){if(typeof window==="undefined"){throw new Error("Please call the `init()` function in a browser environment.")}Sn(e.env,e.clientId);Dn("[components-sdk] SDK init start",{options:Cn(e),start:nt()});at=new Promise((function(n,t){var r;var i=un(un({},e),{env:e.env&&On[e.env]?e.env:On.prod});window.AirwallexComponentsSDK.__env__=i.env;var o=st({env:i.env,scriptName:Ln}).then((function(){return window._AirwallexSDKs.__controller__.init(i)}));var a=(r=e.enabledElements)!==null&&r!==void 0?r:[];var u=Jn(a);var s=u.map((function(e){return st({env:i.env,scriptName:e}).then((function(){return o})).then((function(){var n=window._AirwallexSDKs[Qn(e)];if(!n){Nn("[components-sdk] SDK instance not found",{functionsNamespace:e,windowSDKInstanceName:Qn(e)});throw new ot("SDK instance not found")}return window._AirwallexSDKs.__controller__.registerFunctions({functionsNamespace:e,instance:n})}))}));var c=$n(a);var f=c.map((function(e){var n=e.sdkName,t=e.elementName;return ct({scriptName:n,env:i.env}).then((function(){return o})).then((function(){var e=window._AirwallexSDKs[Qn(n)];if(!e){Nn("[components-sdk] SDK instance not found",{sdkName:n,windowSDKInstanceName:Qn(n)});throw new ot("SDK instance not found")}return window._AirwallexSDKs.__controller__.registerElement({sdkName:n,elementName:t,instance:e})}))}));Promise.all(fn(fn([o],s,true),f,true)).then((function(){Dn("[components-sdk] SDK initialized",{options:Cn(e),start:nt()});n(Zn())}))["catch"]((function(e){if(!e.code){Nn("[components-sdk] Unexpected errors when init",{error:e})}t(e)}))}));return[2,at]}))}))};var lt=e("l",(function(e,n){return sn(void 0,void 0,void 0,(function(){var t,r,i,o,a;return cn(this,(function(u){switch(u.label){case 0:if(!e){throw new Error("Element type is missing. Please specify a valid element.")}Dn("[components-sdk] SDK createElement start",{elementName:e,options:Cn(n),timestamp:nt()});if(!at){Tn("[components-sdk] Did not call init before createElement");throw new Error("Please initialize the Element before creating it.")}return[4,at];case 1:u.sent();t=Gn(e);if(!t){throw new Error("`createElement()` with type `".concat(e,"` is not supported. Please specify a valid Element type."))}r=nt();u.label=2;case 2:u.trys.push([2,6,,7]);return[4,ct({scriptName:t,env:window.AirwallexComponentsSDK.__env__||On.prod})];case 3:u.sent();return[4,window._AirwallexSDKs.__controller__.registerElement({sdkName:t,elementName:e,instance:window._AirwallexSDKs[Qn(t)]})];case 4:u.sent();return[4,window._AirwallexSDKs.__controller__.createElement(e,n)];case 5:i=u.sent();o=nt();Dn("[components-sdk] SDK createElement being called",{elementName:e,options:Cn(n),start:r,latency:o-r,end:o});return[3,7];case 6:a=u.sent();if(!a.code){Nn("[components-sdk] Unexpected errors when createElement",{error:a})}else{throw a}return[3,7];case 7:return[2,i]}}))}))}));var dt=[Ln,Un];var vt=function(){dt.forEach((function(e){var n=Yn({name:e,env:On.prod});var t=document.createElement("link");t.href=n;t.rel="modulepreload";t.as="script";var r=document.head||document.body;r.appendChild(t)}))};var pt=typeof document==="undefined"||typeof window==="undefined";if(!pt){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",vt)}else{vt()}}if(typeof window!=="undefined"){if(!window.AirwallexComponentsSDK){Object.defineProperties(window,{AirwallexComponentsSDK:{value:{},writable:false},_AirwallexSDKs:{value:{},writable:false}})}window.AirwallexComponentsSDK.init=ft;window.AirwallexComponentsSDK.createElement=lt}var mt=n((function(){return{clientSecret:null,currency:null,hasPaymentError:false,isReady:false,paymentConfirmed:false,paymentIntentId:null}})),ht=mt.onChange,yt=mt.reset,wt=mt.state;e({n:ht,k:yt,b:wt});var gt=e("a",(function(e){if(e.paymentProcessor!=="AIRWALLEX"){return false}if(e.clientSecret){wt.clientSecret=e.clientSecret}if(e.paymentIntentId){wt.paymentIntentId=e.paymentIntentId}if(!wt.clientSecret){a("Airwallex checkout session is missing the client secret");return false}return true}));var bt={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"};var kt=e("m",(function(e){return bt[e]||"en"}));var xt=null;var Et=e("f",(function(){return sn(m,void 0,void 0,(function(){var e;return cn(this,(function(n){if(wt.isReady){return[2,true]}if(!xt){e=(!t.zonosMode||t.zonosMode==="production")&&t.checkoutSettings.mode==="LIVE";xt=ft({enabledElements:["payments"],env:e?"prod":"demo",locale:kt(i.selectedLocale)}).then((function(){wt.isReady=true;c("Airwallex SDK initialized");return true})).catch((function(e){a(e);xt=null;return false}))}return[2,xt]}))}))}));var It=["SUCCEEDED","REQUIRES_CAPTURE","PENDING_REVIEW","PENDING"];var St=e("e",(function(e){return!!e&&It.includes(e)}));var Ct=e("j",(function(e){switch(e){case"SUCCEEDED":{return{isError:false,messages:[r("Thank you for submitting your payment. We appreciate your prompt attention."),"",r("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:false,messages:[r("Payment processing. We'll update you when payment is received.")]}}case"REQUIRES_CUSTOMER_ACTION":{return{isError:false,messages:[r("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:true,messages:[r("Payment failed. Please reload the page and try another payment method.")]}}default:{return{isError:true,messages:[r("Something went wrong.")]}}}}));var Nt=e("d",(function(e){return sn(m,void 0,void 0,(function(){var n,t,r;return cn(this,(function(i){switch(i.label){case 0:return[4,u("/api/zonos-elements/collect/airwallex-payment-intent",{body:{paymentIntentId:e},method:"POST"})];case 1:n=i.sent(),t=n.errors,r=n.json;if(t.length||!r){a("Failed to retrieve Airwallex payment intent",t);return[2,{status:null}]}return[2,{status:r.airwallexPaymentIntent.status}]}}))}))}));var Tt=n((function(){return{amountDutyTaxFeeTotal:null,amountTotalPaid:null,collectLogoUrl:null,isFetchingShippingInfo:true,landedCostShortId:null,originCompanyName:null,partyBillingId:null,paymentProcessor:null,shippingAddress:null}})),Dt=Tt.reset,jt=Tt.state;e("c",jt);var Pt=e("h",(function(e){return sn(m,[e],void 0,(function(e){var n,r,i,o,a,c,f,l,d,p,m,h,y,w;var g=e.landedCostId,b=e.retries,k=b===void 0?5:b;return cn(this,(function(e){switch(e.label){case 0:jt.isFetchingShippingInfo=true;return[4,u("/api/zonos-elements/collect/get-shipping-info-by-lc-id",{body:{landedCostId:g},method:"POST"})];case 1:m=e.sent();if(!m.errors.length)return[3,4];if(!(k>0))return[3,3];return[4,new Promise((function(e){return setTimeout(e,1e3)}))];case 2:e.sent();return[2,Pt({landedCostId:g,retries:k-1})];case 3:return[2,null];case 4:jt.landedCostShortId=((n=m.json)===null||n===void 0?void 0:n.landedCostShortId)||null;jt.isFetchingShippingInfo=false;jt.shippingAddress=((r=m.json)===null||r===void 0?void 0:r.shipping)||null;h=(i=v.checkoutSession)===null||i===void 0?void 0:i.landedCost;y=(o=v.checkoutSession)===null||o===void 0?void 0:o.subtotals;w=(((a=h===null||h===void 0?void 0:h.amountSubtotals)===null||a===void 0?void 0:a.shipping)||0)+(((c=h===null||h===void 0?void 0:h.amountSubtotals)===null||c===void 0?void 0:c.items)||0);jt.amountTotalPaid=w*(((f=y===null||y===void 0?void 0:y.exchangeRate)===null||f===void 0?void 0:f.rate)||1);jt.amountDutyTaxFeeTotal=((y===null||y===void 0?void 0:y.duties)||0)+((y===null||y===void 0?void 0:y.taxes)||0)+((y===null||y===void 0?void 0:y.fees)||0);jt.originCompanyName=((d=(l=m.json)===null||l===void 0?void 0:l.origin)===null||d===void 0?void 0:d.companyName)||null;jt.collectLogoUrl=((p=m.json)===null||p===void 0?void 0:p.collectLogoUrl)||null;if(jt.amountTotalPaid===0){void s({endpoint:"COLLECT_NO_TOTAL_PAID",errors:[],metadata:{landedCostId:g,organizationId:t.organizationId}})}return[2]}}))}))}));var Rt=e("i",(function(){return sn(m,void 0,void 0,(function(){var e,n,t,r,i,c,p,m,h,y;return cn(this,(function(w){switch(w.label){case 0:if(!((e=l.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){return[2,{partiesCreated:false}]}i=(t=(n=v.checkoutSession)===null||n===void 0?void 0:n.landedCost)===null||t===void 0?void 0:t.rootId;if(!i){void s({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:f,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}});return[2,{partiesCreated:false}]}if(!o.checkoutSessionId){void s({endpoint:"COLLECT_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:f,cartId:window.Zonos.cartId,landedCostRootId:i}});return[2,{partiesCreated:false}]}c=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});p=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,u("/api/zonos-elements/create-billing-party",{body:{billingAddress:c,checkoutSessionId:o.checkoutSessionId,companyName:l.companyName,email:((r=l.stripeLinkEventData)===null||r===void 0?void 0:r.value.email)||"",isTest:p,rootId:i},method:"POST"})];case 1:m=w.sent(),h=m.errors,y=m.json;if(h.length||!y){a("Error occurs when creating billing party",JSON.stringify(h,null,2));void s({endpoint:"COLLECT_BILLING_PARTY_CREATE_FAILED",errors:["[COLLECT] Failed to create billing party"],metadata:{allLogs:f,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:h,json:y}});return[2,{partiesCreated:false}]}jt.partyBillingId=y.billToPartyId;return[2,{partiesCreated:true}]}}))}))}));var Ot=e("g",(function(e){return sn(m,void 0,void 0,(function(){var n;return cn(this,(function(t){n=e.landedCost;if(!n){return[2,false]}v.landedCostData=[Object.assign(Object.assign({},e),{landedCost:Object.assign({},n),landedCostId:n.id})];return[2,p({applySubtotalsOnly:true,landedCostId:n.id,selectedShippingOption:n.shipmentRating})]}))}))}))}}}));
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,n,t,r){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r["throw"](e))}catch(e){o(e)}}function s(e){e.done?t(e.value):i(e.value).then(a,u)}s((r=r.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(n){return s([e,n])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(t=0)),t)try{if(r=1,i&&(o=u[0]&2?i["return"]:u[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;if(i=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;i=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(o=t.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1];o=u;break}if(o&&t.label<o[2]){t.label=o[2];t.ops.push(u);break}if(o[2])t.ops.pop();t.trys.pop();continue}u=n.call(e,t)}catch(e){u=[6,e];i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-de58684b.system.js","./p-916228fb.system.js","./p-01174496.system.js","./p-d938f42f.system.js","./p-e4dc24e1.system.js"],(function(e){"use strict";var n,t,r,i,o,a,u,s,c,f,l,d,v,p;return{setters:[function(e){n=e.c;t=e.z},function(e){r=e.t;i=e.l;o=e.s},function(e){a=e.l;u=e.h;s=e.s},function(e){c=e.l;f=e.b},function(e){l=e.b;d=e.M;v=e.d;p=e.N}],execute:function(){var m=this;function h(e,n){if(n==null||n>e.length)n=e.length;for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function y(e){if(Array.isArray(e))return e}function w(e){if(Array.isArray(e))return h(e)}function g(e,n,t,r,i,o,a){try{var u=e[o](a);var s=u.value}catch(e){t(e);return}if(u.done){n(s)}else{Promise.resolve(s).then(r,i)}}function b(e){return function(){var n=this,t=arguments;return new Promise((function(r,i){var o=e.apply(n,t);function a(e){g(o,r,i,a,u,"next",e)}function u(e){g(o,r,i,a,u,"throw",e)}a(undefined)}))}}function k(e,n){if(!(e instanceof n)){throw new TypeError("Cannot call a class as a function")}}function x(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function E(e,n,t){if(n)x(e.prototype,n);if(t)x(e,t);return e}function I(e,n,t){if(n in e){Object.defineProperty(e,n,{value:t,enumerable:true,configurable:true,writable:true})}else{e[n]=t}return e}function S(e,n){if(n!=null&&typeof Symbol!=="undefined"&&n[Symbol.hasInstance]){return!!n[Symbol.hasInstance](e)}else{return e instanceof n}}function C(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function N(e,n){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var r=[];var i=true;var o=false;var a,u;try{for(t=t.call(e);!(i=(a=t.next()).done);i=true){r.push(a.value);if(n&&r.length===n)break}}catch(e){o=true;u=e}finally{try{if(!i&&t["return"]!=null)t["return"]()}finally{if(o)throw u}}return r}function T(){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 D(){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 j(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};var r=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))}r.forEach((function(n){I(e,n,t[n])}))}return e}function P(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);if(n){r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))}t.push.apply(t,r)}return t}function R(e,n){n=n!=null?n:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(n))}else{P(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function O(e,n){return y(e)||N(e,n)||L(e,n)||T()}function _(e){return w(e)||C(e)||L(e)||D()}function A(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function L(e,n){if(!e)return;if(typeof e==="string")return h(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor)t=e.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return h(e,n)}function U(e,n){var t,r,i,o,a={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(e){return function(n){return s([e,n])}}function s(o){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,r&&(i=o[0]&2?r["return"]:o[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;if(r=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:a.label++;return{value:o[1],done:false};case 5:a.label++;r=o[1];o=[0];continue;case 7:o=a.ops.pop();a.trys.pop();continue;default:if(!(i=a.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){a=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(o[0]===6&&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}if(i[2])a.ops.pop();a.trys.pop();continue}o=n.call(e,a)}catch(e){o=[6,e];r=0}finally{t=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}var M=function(e){e["production"]="prod";e["demo"]="demo";e["staging"]="staging";return e}(M||{});var F="airTracker_unknown";var K={appName:F,appVersion:F,env:"staging",isWebappContainer:false,delay:2e3,errorRepeatTime:3,enableErrorMonitoring:false,assetSpeedMonitoringWhiteList:[],enableDetectPageChange:false,enableRecordPageRetention:false,hideSearchParams:false,useSessionStorageForSessionId:false,assetSpeedMonitoringWhiteListByMFE:{}};var q={appName:F,env:"staging",sessionId:F,deviceId:F};var H=function(e){if(!e){return false}if(/^\s*$/.test(e))return false;e=e.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@");e=e.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");e=e.replace(/(?:^|:|,)(?:\s*\[)+/g,"");return/^[\],:{}\s]*$/.test(e)};var z=function(){var e=new WeakSet;return function(n,t){if(S(t,Error)){return"Error.message: ".concat(t.message," \n Error.stack: ").concat(t.stack)}if((typeof t==="undefined"?"undefined":A(t))==="object"&&t!==null){if(e.has(t)){return"[Circular ".concat(n||"root","]")}e.add(t)}if(typeof t==="function"){return"function"}if((typeof t==="undefined"?"undefined":A(t))==="symbol"){return"symbol"}if(typeof t==="undefined"){return null}return t}};var B=function(e){if(typeof e==="string"){return e}try{if(S(e,Error)){return(JSON.stringify(e,z())||"undefined").replace(/"/gim,"")}return JSON.stringify(e,z())}catch(e){return'{"error":"error happen when airTracker stringify"}'}};var W=function(e){var n=e.method,t=n===void 0?"post":n,r=e.url,i=e.data,o=e.success,a=e.fail;if(!H(i)){return}var u=new XMLHttpRequest;u.addEventListener("readystatechange",(function(){if(u.readyState===4){if(u.status>=400||u.status===0){a===null||a===void 0?void 0:a(u.response)}else{o===null||o===void 0?void 0:o(u.response)}}}));u.open(t,r);u.setRequestHeader("Content-Type","application/json");u.send(i)};var X={onInit:"onInit",onConfigInit:"onConfigInit",onConfigUpdated:"onConfigUpdated",onCommonDataInit:"onCommonDataInit",onCommonUpdated:"onCommonUpdated",onPageChange:"onPageChange",onDestroy:"onDestroy,"};var G="AIR_ANALYTICS_DEVICE_ID";var V="AIR_ANALYTICS_SESSION_ID";var $="AWX_RISK_ID";var J=function(e){if(e=="prod"){return"https://o11y.airwallex.com/airtracker/logs"}if(e=="demo"){return"https://o11y-demo.airwallex.com/airtracker/logs"}return"https://o11y-staging.airwallex.com/airtracker/logs"};var Q=function(e){if(e=="prod"){return"https://o11y.airwallex.com/airtracker/metrics"}if(e=="demo"){return"https://o11y-demo.airwallex.com/airtracker/metrics"}return"https://o11y-staging.airwallex.com/airtracker/metrics"};var Y=function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=Math.random()*16|0;var t=e==="x"?n:n&3|8;return t.toString(16)}));return e};var Z=function(e){var n,t,r;if(e.config.getMFEName){return e.config.getMFEName()}return((r=location)===null||r===void 0?void 0:(t=r.pathname)===null||t===void 0?void 0:(n=t.split("/"))===null||n===void 0?void 0:n[2])||"unknown"};var ee=function(){try{var e=window.sessionStorage.getItem(V);if(!e){e=Y();window.sessionStorage.setItem(V,e)}return e}catch(e){return Y()}};var ne=function(){try{var e=window.localStorage.getItem(G);if(!e){e=Y();window.localStorage.setItem(G,e)}return e}catch(e){}};var te=function(){try{var e=window.localStorage.getItem($);return e||void 0}catch(e){}};var re=function(){var e;var n="";var t=navigator.userAgent.match(/NetType\/(\w+)/);if(t){var r;r=O(t,2),n=r[1]}else if((e=navigator)===null||e===void 0?void 0:e.connection){var i,o,a,u;n=((o=navigator)===null||o===void 0?void 0:(i=o.connection)===null||i===void 0?void 0:i.effectiveType)||((u=navigator)===null||u===void 0?void 0:(a=u.connection)===null||a===void 0?void 0:a.type)}if(!n){n="unknown"}return ie(n)};var ie=function(e){e=String(e).toLowerCase();if(e.indexOf("4g")>=0)return"net4g";if(e.indexOf("wifi")>=0)return"wifi";if(e.indexOf("5g")>=0)return"net5g";if(e.indexOf("3g")>=0)return"net3g";if(e.indexOf("2g")>=0)return"net2g";return"unknown"};var oe=function e(){return typeof window.performance!=="undefined"&&typeof window.performance.clearResourceTimings==="function"&&typeof window.performance.getEntriesByType==="function"&&typeof window.performance.now==="function"};var ae=function(e){if(typeof e==="string"){var n=e.split("?")[0]||"";return n.slice(0,200)}return e};var ue=function(e){if(typeof e==="string"){return e.split("?")[1]||""}return e};var se=function(e){var n=typeof e==="string"&&e.startsWith("//");return n?typeof location!=="undefined"&&location.protocol==="https:":/^https/.test(e)};var ce=function(e,n){if(typeof e==="number"){return e}if(typeof e==="string"){return e}return n?"":-1};var fe=function(e,n){var t;var r=false;if(!n.config.isWebappContainer){r=le(e,n.config.assetSpeedMonitoringWhiteList);return r}var i=Z(n);return r||le(e,(t=n.config.assetSpeedMonitoringWhiteListByMFE)===null||t===void 0?void 0:t[i])};var le=function(e,n){if(!(n===null||n===void 0?void 0:n.length)){return false}for(var t=0;t<n.length;t++){var r=n[t];if(S(r,RegExp)&&r.test(e)){return true}if(typeof r=="string"&&e.includes(r)){return true}}return false};var de=function(e,n){var t=100;return Math.round((e-n)*t)/t};var ve=function(e){return function(n){var t,r;var i=Z(e);var o=e.config.isWebappContainer?j({},e.commonData||{},((t=e.MFECommonDataMap)===null||t===void 0?void 0:t[i])||{}):e.commonData;var a=Array.isArray(n)?n:[n];if(a.length===0){return}var u={commonData:o,data:a};var s=B(u);var c={method:"post",url:J(e.commonData.env),data:s};if(typeof((r=navigator)===null||r===void 0?void 0:r.sendBeacon)==="function"){var f=navigator.sendBeacon(c.url,s);if(!f){W(c)}}else{W(c)}}};var pe=function(e){return function(n){var t,r;var i=Z(e);var o=e.config.isWebappContainer?j({},e.commonData||{},((t=e.MFECommonDataMap)===null||t===void 0?void 0:t[i])||{}):e.commonData;var a={commonData:o,data:Array.isArray(n)?n:[n]};var u=B(a);var s={method:"post",url:Q(e.commonData.env),data:u};if(typeof((r=navigator)===null||r===void 0?void 0:r.sendBeacon)==="function"){var c=navigator.sendBeacon(s.url,u);if(!c){W(s)}}else{W(s)}}};var me=function(e,n){var t;var r=[];var i=e.config;window.addEventListener("beforeunload",(function(){if(r.length>0){e.immediateSendPipe(r.splice(0,r.length));t&&clearTimeout(t)}}));return function(o,a){r.push(o);e.lifeCycle.on(X.onCommonUpdated,(function(){if(r.length>0){a===null||a===void 0?void 0:a(r.splice(0,r.length));e.lifeCycle.remove(X.onCommonUpdated);t&&clearTimeout(t)}}));if(n&&r.length>=n){a===null||a===void 0?void 0:a(r.splice(0,r.length));t&&clearTimeout(t);return}t&&clearTimeout(t);t=setTimeout((function(){t=null;if(r.length>0){a===null||a===void 0?void 0:a(r.splice(0,r.length));e.lifeCycle.remove(X.onCommonUpdated)}}),i.delay)}};var he=function(e){var n={};return function(t,r){var i=typeof e.config.errorRepeatTime==="number"?e.config.errorRepeatTime:5;if(i===0){return r===null||r===void 0?void 0:r(t)}r===null||r===void 0?void 0:r(t.filter((function(e){if(e.severity=="autoDetectError"){n[e.error]=n[e.error]||0;n[e.error]+=1;if(n[e.error]>i){return false}return true}return true})))}};var ye=function(){};var we=function(e){if(!e||!e.reduce||!e.length){throw new TypeError("createPipeline need at least one function param")}if(e.length===1){return function(n,t){e[0](n,t||ye)}}return e.reduce((function(e,n){return function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ye;return e(t,(function(e){return n===null||n===void 0?void 0:n(e,r)}))}}))};var ge=function(){function e(){var n=this;k(this,e);this.emit=function(e,t){if(!n)return;var r=n.eventsList[e];var i;if(r===null||r===void 0?void 0:r.length){r=r.slice();for(var o=0;o<r.length;o++){i=r[o];try{var a=i.callback.apply(n,[t]);if(1===i.type){n.remove(e,i.callback)}if(false===a){break}}catch(e){throw e}}}return n};this.eventsList={}}E(e,[{key:"indexOf",value:function e(n,t){for(var r=0;r<n.length;r++){if(n[r].callback===t){return r}}return-1}},{key:"on",value:function e(n,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(!this)return;var i=this.eventsList[n];if(!i){this.eventsList[n]=[];i=this.eventsList[n]}if(this.indexOf(i,t)===-1){var o={name:n,type:r||0,callback:t};i.push(o);return this}return this}},{key:"one",value:function e(n,t){this.on(n,t,1)}},{key:"remove",value:function e(n,t){if(!this)return;var r=this.eventsList[n];if(!r){return null}if(!t){try{delete this.eventsList[n]}catch(e){}return null}if(r.length){var i=this.indexOf(r,t);r.splice(i,1)}return this}},{key:"clear",value:function e(){this.eventsList={}}}]);return e}();var be=function(){function e(n){k(this,e);this.name="";this.isInit=false;this.name=n.name;this.option=n}E(e,[{key:"patch",value:function e(n){if(!this.isInit){var t,r;this.isInit=true;(r=this.option)===null||r===void 0?void 0:(t=r.setUp)===null||t===void 0?void 0:t.call(this.option,n)}}},{key:"uninstall",value:function e(){var n,t;(t=this.option)===null||t===void 0?void 0:(n=t.destroy)===null||n===void 0?void 0:n.apply(this);this.isInit=false}}]);return e}();var ke;var xe=function(e){var n="".concat(B(e.message)||""," @ (").concat(B(e.filename)||"",":").concat(e.lineno||0,":").concat(e.colno||0,")\n").concat(B(e.error||""));ke.normalLogPipeLine({severity:"autoDetectError",eventName:"windowOnError",extraInfo:{error:n}})};var Ee=function(e){var n=e&&B(e.reason);ke.normalLogPipeLine({severity:"autoDetectError",eventName:"promiseError",extraInfo:{error:n}})};var Ie=function(e){var n=(e===null||e===void 0?void 0:e.target)||(e===null||e===void 0?void 0:e.srcElement);if(!n){return}var t=(n===null||n===void 0?void 0:n.src)||(n===null||n===void 0?void 0:n.href);var r=n.tagName;var i="unknown";if(typeof t==="string"&&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}}ke.normalLogPipeLine({severity:"autoDetectError",eventName:"staticFileLoadError",extraInfo:{staticFileType:i,error:"".concat(r," load fail: ").concat(t)}})}};var Se=new be({name:"errorDetectionPlugin",setUp:function(e){ke=e;window.addEventListener("error",xe);window.addEventListener("unhandledrejection",Ee);window.document.addEventListener("error",Ie,true)},destroy:function(){window.removeEventListener("unhandledrejection",Ee);window.document.removeEventListener("error",Ie,true);window.removeEventListener("error",xe)}});var Ce=["img","css","script","link","audio","video","iframe"];var Ne="resource";var Te=function(e){var n=e.name;return{url:ae(n),method:"get",duration:Number(e.duration.toFixed(2)),type:"static",isHttps:se(n),urlQuery:ue(n),domainLookup:ce(e.domainLookupEnd-e.domainLookupStart),connectTime:ce(e.connectEnd-e.connectStart)}};var De=function(e,n){for(var t=0,r=e.length;t<r;t++){var i=e[t];if(Ce.indexOf(i.initiatorType)!==-1&&fe(i.name,n)){n.normalLogPipeLine({severity:"performance",eventName:"assets_speed",extraInfo:{log:Te(i)}})}}};var je;var Pe;var Re=new be({name:"assetsSpeedPlugin",setUp:function(e){if(!oe())return;var n=0;window.performance.onresourcetimingbufferfull=function(){n=0;window.performance.clearResourceTimings()};if(typeof window.PerformanceObserver==="function"){De(window.performance.getEntriesByType(Ne),e);Pe=new window.PerformanceObserver((function(n){De(n.getEntries(),e)}));Pe.observe({entryTypes:[Ne]})}else{je=setInterval((function(){var t=window.performance.getEntriesByType(Ne);var r=t.slice(n);n=t.length;De(r,e)}),3e3)}},destroy:function(){Pe===null||Pe===void 0?void 0:Pe.disconnect();je&&clearInterval(je)}});var Oe;var _e=new be({name:"onPageChangePlugin",setUp:function(){var e=b((function(e){var n,t,r,i,o;return U(this,(function(a){t=(n=location)===null||n===void 0?void 0:n.href;r=document.querySelector("body");i=function(n){var t=n.prevHref;var r,i,o,a,u;e.normalLogPipeLine({severity:"autoDetectEvent",eventName:"onPageChange",extraInfo:{prevHref:t,href:((r=location)===null||r===void 0?void 0:r.href)||"",hostname:(i=location)===null||i===void 0?void 0:i.hostname,pathName:(o=location)===null||o===void 0?void 0:o.pathname,protocol:(a=location)===null||a===void 0?void 0:a.protocol,search:(u=location)===null||u===void 0?void 0:u.search}})};i({prevHref:""});Oe=new MutationObserver((function(){if(location.href!==t){var e=t;t=location.href;i({prevHref:e})}}));o={subtree:true,childList:true};Oe.observe(r||document,o);return[2]}))}));return function(n){return e.apply(this,arguments)}}(),destroy:function(){Oe===null||Oe===void 0?void 0:Oe.disconnect()}});var Ae;var Le=new be({name:"onPageRetentionPlugin",setUp:function(){var e=b((function(e){var n,t,r,i,o,a,u;return U(this,(function(s){if(typeof document.visibilityState==="undefined"){return[2]}t=(n=location)===null||n===void 0?void 0:n.href;r=document.querySelector("body");o=function(){i=Date.now()};o();document.addEventListener("visibilitychange",(function(){if(document.visibilityState==="hidden"){a({href:location.href,leftReason:"visibilityChange"})}else if(document.visibilityState==="visible"){o()}}));window.addEventListener("beforeunload",(function(){a({href:location.href,sendImmediate:true,leftReason:"pageClose"})}));a=function(n){var t=n.href,r=n.sendImmediate,o=n.leftReason;if(!i){return}var a=Date.now()-i;if(a===0){return}i=void 0;var u={severity:"autoDetectEvent",eventName:"onPageRetention",extraInfo:{href:t,duration:a,leftReason:o}};if(r){e.ImmediatePipeline(u);return}e.normalLogPipeLine(u)};Ae=new MutationObserver((function(){if(location.href!==t){var e=t;t=location.href;a({href:e,leftReason:"nextPage"});o()}}));u={subtree:true,childList:true};Ae.observe(r||document,u);return[2]}))}));return function(n){return e.apply(this,arguments)}}(),destroy:function(){Ae===null||Ae===void 0?void 0:Ae.disconnect()}});var Ue=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2,15)};var Me=function(e,n){var t=[/^https?:\/\/[^\/]*\.airwallex\.com($|\/)/];var r=[/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];if(r.some((function(n){return n.test(e)}))){return false}return le(e,n||t)};var Fe=function(e){var n=e.startTime,t=e.endTime,r=e.entries;if(r.length===0){return void 0}if(r.length===1){return r[0]}var i=r.filter((function(e){return e.startTime>=n&&t&&e.responseEnd<=t})).sort((function(e,n){return e.startTime-n.startTime}));return i===null||i===void 0?void 0:i[0]};var Ke=function(e){return Math.round(e*100)/100};var qe=function(e){var n=e.startTime,t=e.duration,r=e.responseStart,i=e.connectEnd,o=e.connectStart,a=e.domainLookupEnd,u=e.domainLookupStart,s=e.requestStart,c=e.secureConnectionStart,f=e.redirectEnd,l=e.redirectStart,d=e.responseStatus,v=e.responseEnd,p=e.encodedBodySize,m=e.decodedBodySize,h=e.transferSize,y=e.deliveryType,w=e.initiatorType;return{startTime:Ke(n),totalDuration:Ke(t),timeToFirstByte:de(r,n),tcpDuration:de(i,o),dnsDuration:de(a,u),tlsDuration:de(s,c),redirectDuration:de(f,l),responseDuration:de(v,r),encodeResponseSize:p,decodeResponseSize:m,transferSize:h,deliveryType:y,statusCode:d,initiatorType:w}};var He=function(e,n){var t=e.url,r=e.method,i=e.errorType,o=e.errorDetail;var a=Fe(e);var u=new URL(t,window.location.href),s=u.href,c=u.protocol;var f=a?qe(a):{};var l={severity:"autoDetectEvent",eventName:"httpClientMetrics",extraInfo:j(R(j({httpUrl:s,method:r,scheme:c},i&&{errorType:i},o&&{errorDetail:o},f),{statusCode:(f===null||f===void 0?void 0:f.statusCode)||(e===null||e===void 0?void 0:e.responseStatus),startTime:(f===null||f===void 0?void 0:f.startTime)||(e===null||e===void 0?void 0:e.startTime),initiatorType:(f===null||f===void 0?void 0:f.initiatorType)||(e===null||e===void 0?void 0:e.initiatorType)}),n)};return l};var ze=function(e){return e&&(typeof e==="undefined"?"undefined":A(e))==="object"&&"errors"in e&&Array.isArray(e.errors)&&e.errors.every((function(e){return e&&(typeof e==="undefined"?"undefined":A(e))==="object"&&"message"in e}))};var Be="awx_airtracker_api_performance_queue";var We="awx_airtracker_api_performance_plugin_loaded";var Xe=300;var Ge=1e4;var Ve=typeof window!=="undefined"?window:typeof global!=="undefined"?global:{};Ve[Be]=Ve[Be]||[];var $e=function(e,n,t){setTimeout((function(){var r=He(e,t);n.observerPipeline(r);Ve[Be]=Ve[Be].filter((function(n){return n.id!==e.id}))}),Xe)};var Je=function(e,n){setTimeout((function(){var t=Ve[Be].find((function(n){return n.id===e}));if(!t){return}var r=He(t,{exceptionType:"timeout-without-response"});n.observerPipeline(r);Ve[Be]=Ve[Be].filter((function(n){return n.id!==e}))}),Ge)};var Qe=function(e){var n=XMLHttpRequest.prototype.open;var t=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function t(r,i,o,a,u){try{var s;var c=Ue();this.__requestId=c;var f=S(i,URL)?i.href:new URL(i,window.location.href).href;if(!Me(f,(s=e.config)===null||s===void 0?void 0:s.enableRecordAPIPerformanceWhitelist)){return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}var l={id:c,startTime:performance.now(),method:r,url:f,entries:[],initiatorType:"xmlhttprequest"};Ve[Be].push(l);Je(c,e);return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}catch(t){e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject XHR open error",error:t}});return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}};XMLHttpRequest.prototype.send=function n(){var r=this;for(var i=arguments.length,o=new Array(i),a=0;a<i;a++){o[a]=arguments[a]}try{var u=Ve[Be].find((function(e){return e.id===r.__requestId}));if(!u){return t.apply(this,o)}var s=this;this.addEventListener("loadend",b((function(){var n,t,r,i,o,a,c;return U(this,(function(f){switch(f.label){case 0:n=performance.now();t=n-u.startTime;r=s.status;if(r===0){return[2]}u.endTime=n;u.duration=t;u.responseStatus=r;f.label=1;case 1:f.trys.push([1,6,,7]);if(!(s.responseType===""||s.responseType==="text"))return[3,2];i=s.responseText;return[3,5];case 2:if(!(s.responseType==="json"))return[3,3];i=s.response;return[3,5];case 3:if(!(s.responseType==="blob"))return[3,5];o=s.response;if(!((o===null||o===void 0?void 0:o.type)==="application/json"))return[3,5];return[4,o.text()];case 4:i=f.sent();f.label=5;case 5:a=i&&typeof i==="string"?JSON.parse(i):i;if(a&&ze(a)){u.errorType="graphqlError";u.errorDetail=a.errors}return[3,7];case 6:c=f.sent();e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in XHR",url:u===null||u===void 0?void 0:u.url,error:c}});return[3,7];case 7:$e(u,e);return[2]}}))})));this.addEventListener("error",(function(){$e(u,e,{exceptionType:"network-error"})}));this.addEventListener("abort",(function(){$e(u,e,{exceptionType:"abort-error"})}));this.addEventListener("timeout",(function(){$e(u,e,{exceptionType:"timeout-error"})}));return t.apply(this,o)}catch(n){e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"InjectXHR send error",error:n}});throw n}}};var Ye=function(e){var n=window.fetch;window.fetch=b((function(){var t,r,i,o,a,u,s,c,f,l,d,v,p,m,h,y;var w=arguments;return U(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]}u=new URL(S(r[0],Request)?r[0].url:String(r[0]),window.location.href).href;if(!!Me(u,(o=e.config)===null||o===void 0?void 0:o.enableRecordAPIPerformanceWhitelist))return[3,2];return[4,n.apply(this,r)];case 1:return[2,g.sent()];case 2:g.trys.push([2,9,,10]);c=performance.now();f=Ue();a={id:f,startTime:c,method:((s=S(r[0],Request)?r[0]:r[1])===null||s===void 0?void 0:s.method)||"GET",url:u,entries:[],initiatorType:"fetch"};Ve[Be].push(a);Je(f,e);return[4,n.apply(this,r)];case 3:l=g.sent();d=performance.now();a.endTime=d;a.duration=d-c;a.responseStatus=l.status;v=l.clone();g.label=4;case 4:g.trys.push([4,7,,8]);if(!v.ok)return[3,6];return[4,v.json()];case 5:p=g.sent();if(p&&ze(p)){a.errorType="graphqlError";a.errorDetail=p.errors}g.label=6;case 6:return[3,8];case 7:m=g.sent();e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in fetch",url:a===null||a===void 0?void 0:a.url,error:m}});return[3,8];case 8:$e(a,e);return[2,l];case 9:h=g.sent();if(a&&a.id&&Ve[Be].find((function(e){return e.id===(a===null||a===void 0?void 0:a.id)}))){y="fetch-error";if(S(h,TypeError)){y="network-error"}else if(S(h,DOMException)&&h.name==="AbortError"){y="abort-error"}$e(a,e,{exceptionType:y})}else{e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject fetch error",error:h}})}throw h;case 10:return[2]}}))}))};var Ze=function(e){var n;Qe(e);Ye(e);if((n=window)===null||n===void 0?void 0:n.PerformanceObserver){var t=new window.PerformanceObserver((function(e){var n=e.getEntries();n.forEach((function(e){var n=e;if(n.initiatorType==="fetch"||n.initiatorType==="xmlhttprequest"){var t=Ve[Be].filter((function(e){return e.url===n.name}));t.forEach((function(e){e.entries.push(n)}))}}))}));t.observe({entryTypes:["resource"],buffered:true})}else{e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{error:"PerformanceObserver Not Supported"}})}};var en=new be({name:"apiPerformancePlugin",setUp:function(){var e=b((function(e){var n,t;return U(this,(function(r){if(Ve[We]){return[2]}if(((n=e.config)===null||n===void 0?void 0:n.enableRecordAPIPerformance)&&Math.random()<(((t=e.config)===null||t===void 0?void 0:t.enableRecordAPIPerformancePercentage)||0)){Ve[We]=true;Ze(e)}return[2]}))}));return function(n){return e.apply(this,arguments)}}()});var nn="3.1.0";var tn=function(){function e(n){var t=this;var r=n.config,i=n.plugins,o=i===void 0?[]:i;k(this,e);this.config=K;this.lifeCycle=new ge;this.plugins=[];this._commonData=q;this._MFECommonDataMap={};this.timeMap={};this.packedDataConvert=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o,a;var u=j({severity:n,eventName:r,currentHref:t.config.hideSearchParams?(((o=location)===null||o===void 0?void 0:o.href)||"").split("?")[0]||"":((a=location)===null||a===void 0?void 0:a.href)||""},i);if(t.config.isWebappContainer){u.MFEName=Z(t)}return u};this.normalPipelineObj=we([me(this,8),he(this),ve(this)]);this.observerPipelineObj=we([me(this,8),pe(this)]);this.immediateSendPipe=ve(this);this.observerPipeline=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});return t.observerPipelineObj(o)};this.normalLogPipeLine=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});if(t.config.disableThrottle){return t.immediateSendPipe(o)}else{return t.normalPipelineObj(o)}};this.ImmediatePipeline=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});return t.immediateSendPipe(o)};this.plugins=_(o);this.setConfig(r);this.initCommonData(r);this.lifeCycle.emit(X.onInit);if(r.enableErrorMonitoring){this.plugins.push(Se)}if((r===null||r===void 0?void 0:r.assetSpeedMonitoringWhiteList)&&r.assetSpeedMonitoringWhiteList.length>0||r.isWebappContainer){this.plugins.push(Re)}if(r===null||r===void 0?void 0:r.enableDetectPageChange){this.plugins.push(_e)}if(r===null||r===void 0?void 0:r.enableRecordPageRetention){this.plugins.push(Le)}if((r===null||r===void 0?void 0:r.enableRecordAPIPerformance)&&(r===null||r===void 0?void 0:r.enableRecordAPIPerformancePercentage)&&r.enableRecordAPIPerformancePercentage>0&&r.enableRecordAPIPerformancePercentage<=1){this.plugins.push(en)}this.installPlugins()}E(e,[{key:"installPlugins",value:function e(){var n=this;this.plugins.forEach((function(e){e.patch(n)}))}},{key:"commonData",get:function e(){return this._commonData}},{key:"MFECommonDataMap",get:function e(){return this._MFECommonDataMap}},{key:"initCommonData",value:function e(n){this._commonData.sessionId=n.useSessionStorageForSessionId?ee():Y();this._commonData.deviceId=ne()||F;this._commonData.riskDeviceId=te();this._commonData.networkType=re()||"unknown";this._commonData.env=n.env||this._commonData.env;this._commonData.accountId=n.accountId||F;this._commonData.appVersion=n.appVersion;this._commonData.appName=n.appName;this._commonData.sdkVersion=nn;this.lifeCycle.emit(X.onCommonDataInit,this.commonData)}},{key:"updateCommonDataBasedOnConfig",value:function e(n){this.lifeCycle.emit(X.onCommonUpdated,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 e(n){this.lifeCycle.emit(X.onCommonUpdated,this._commonData);this._commonData=j({},this._commonData,n)}},{key:"removeCommonDataByKey",value:function e(n){var t=this;this.lifeCycle.emit(X.onCommonUpdated,this._commonData);setTimeout((function(){n.forEach((function(e){delete t._commonData[e]}))}),1e3)}},{key:"addToMFECommonData",value:function e(n){var t=n.MFEName,r=n.MFECommonData;var i;if(!this.config.isWebappContainer){return}if(!t||!r){return}this._MFECommonDataMap=R(j({},this._MFECommonDataMap||{}),I({},t,j({},((i=this._MFECommonDataMap)===null||i===void 0?void 0:i[t])||{},r)))}},{key:"setConfig",value:function e(n){var t=this;if(this.config.isWebappContainer){return}var r=function(e,n){t.config[e]=n};Object.entries(n).forEach((function(e){var n=O(e,2),t=n[0],i=n[1];if((typeof i==="undefined"?"undefined":A(i))!==void 0){r(t,i)}}));this.lifeCycle.emit(X.onConfigInit,this.config);this.updateCommonDataBasedOnConfig(n)}},{key:"verbose",value:function e(n,t){this.normalLogPipeLine({severity:"verbose",eventName:n,extraInfo:t})}},{key:"httpLog",value:function e(n,t){this.normalLogPipeLine({severity:"http",eventName:n,extraInfo:t})}},{key:"info",value:function e(n,t){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:t})}},{key:"warn",value:function e(n,t){this.normalLogPipeLine({severity:"warn",eventName:n,extraInfo:t})}},{key:"error",value:function e(n,t){console.error("error",n);this.normalLogPipeLine({severity:"error",eventName:n,extraInfo:t})}},{key:"businessLog",value:function e(n,t){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:R(j({},t),{isBusinessLog:true})})}},{key:"reportDuration",value:function e(n,t,r){if(typeof n!=="string"){console.warn("reportDuration: eventName (first param) must be a string");return}if(typeof t!=="number"){console.warn("reportDuration: duration (second param) must be number");return}if(t<0||t>6e4){console.warn("reportDuration: duration (second param) must between 0 and 60000");return}this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:j({duration:t},r)})}},{key:"getTimerKey",value:function e(n){var t=Z(this);return this.config.isWebappContainer?"".concat(t,"_").concat(n):n}},{key:"timeStart",value:function e(n){if(typeof n!=="string"){console.warn("time: first param must be a string");return}if(this.timeMap[this.getTimerKey(n)]){console.warn("Timer ".concat(n," already exists"))}this.timeMap[this.getTimerKey(n)]=Date.now()}},{key:"timeEnd",value:function e(n,t){if(typeof n!=="string"){console.warn("timeEnd: first param must be a string");return}if(this.timeMap[this.getTimerKey(n)]){var r=Date.now()-this.timeMap[this.getTimerKey(n)]+(t||0);this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:{duration:r}});delete this.timeMap[this.getTimerKey(n)]}else{console.warn("Timer key :".concat(n," does not exist"))}}},{key:"addToAssetSpeedWhiteListByMFE",value:function e(n){var t=n.MFEName,r=n.whiteList;var i;if(!this.config.isWebappContainer){return}if(!t||!(r===null||r===void 0?void 0:r.length)){return}if(!this.config.assetSpeedMonitoringWhiteListByMFE){this.config.assetSpeedMonitoringWhiteListByMFE={}}if(!((i=this.config.assetSpeedMonitoringWhiteListByMFE)===null||i===void 0?void 0:i[t])){this.config.assetSpeedMonitoringWhiteListByMFE=R(j({},this.config.assetSpeedMonitoringWhiteListByMFE),I({},t,r))}else{var o;var a,u;(u=this.config.assetSpeedMonitoringWhiteListByMFE)===null||u===void 0?void 0:(a=u[t])===null||a===void 0?void 0:(o=a).push.apply(o,_(r))}}},{key:"destroy",value:function e(){if(this.config.isWebappContainer){return}this.plugins.forEach((function(e){e.uninstall()}))}}]);return e}();var rn=tn;var on=function(e,n){on=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)if(Object.prototype.hasOwnProperty.call(n,t))e[t]=n[t]};return on(e,n)};function an(e,n){if(typeof n!=="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");on(e,n);function t(){this.constructor=e}e.prototype=n===null?Object.create(n):(t.prototype=n.prototype,new t)}var un=function(){un=Object.assign||function e(n){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))n[o]=t[o]}return n};return un.apply(this,arguments)};function sn(e,n,t,r){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r["throw"](e))}catch(e){o(e)}}function s(e){e.done?t(e.value):i(e.value).then(a,u)}s((r=r.apply(e,n||[])).next())}))}function cn(e,n){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(n){return s([e,n])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(t=0)),t)try{if(r=1,i&&(o=u[0]&2?i["return"]:u[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;if(i=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;i=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(o=t.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1];o=u;break}if(o&&t.label<o[2]){t.label=o[2];t.ops.push(u);break}if(o[2])t.ops.pop();t.trys.pop();continue}u=n.call(e,t)}catch(e){u=[6,e];i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}function fn(e,n,t){if(t||arguments.length===2)for(var r=0,i=n.length,o;r<i;r++){if(o||!(r in n)){if(!o)o=Array.prototype.slice.call(n,0,r);o[r]=n[r]}}return e.concat(o||Array.prototype.slice.call(n))}typeof SuppressedError==="function"?SuppressedError:function(e,n,t){var r=new Error(t);return r.name="SuppressedError",r.error=e,r.suppressed=n,r};var ln="@airwallex/components-sdk";var dn="1.30.2";var vn="./lib/index.js";var pn="./lib/index.mjs";var mn="./lib/index.d.ts";var hn=["lib/**"];var yn="MIT";var wn={"load-types":"node ./load-types.js && yarn prettier -w src/types/*d.ts",prebuild:"yarn clean",build:"yarn rollup --config",postbuild:"yarn bundle-types","bundle-types":"dts-bundle-generator -o ./lib/index.d.ts ./src/index.ts",clean:"rm -rf dist lib",lint:'eslint "src/**/*.ts*"',test:"jest",sonar:"sonar-scanner",release:"semantic-release","lint-stage":"lint-staged",prepare:"husky"};var gn={semi:true,singleQuote:true,printWidth:80,trailingComma:"all"};var bn={access:"public"};var kn={"@babel/preset-typescript":"^7.18.6","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^11.1.6","@semantic-release/changelog":"^5.0.1","@semantic-release/commit-analyzer":"^8.0.1","@semantic-release/git":"^9.0.0","@semantic-release/gitlab":"^6.1.0","@semantic-release/release-notes-generator":"^9.0.0","@swc/core":"^1.3.46","@types/jest":"^29.5.0","@typescript-eslint/eslint-plugin":"^5.57.0","@typescript-eslint/parser":"^5.57.0","dts-bundle-generator":"^9.0.0",eslint:"^7.23.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^5.1.3",husky:"^9.0.11",jest:"^29.5.0","jest-environment-jsdom":"^29.5.0","lint-staged":"^15.2.7",prettier:"^3.3.2",rollup:"^4.9.6","semantic-release":"^17.3.8","sonarqube-scanner":"^3.0.1","ts-jest":"^29.0.5","ts-loader":"^9.5.1",tslib:"^2.6.2",typescript:"^4.5.2"};var xn={"@airwallex/airtracker":"^3.0.0"};var En={name:ln,version:dn,main:vn,module:pn,types:mn,files:hn,license:yn,scripts:wn,prettier:gn,"lint-staged":{"src/**/*.{ts,tsx}":["yarn lint"],"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}":"prettier --write"},publishConfig:bn,devDependencies:kn,dependencies:xn};var In={dev:M.staging,staging:M.staging,demo:M.demo,prod:M.production};var Sn=function(e,n){if(e===void 0){e=M.production}if(!window._AirwallexSDKs.airTracker){window._AirwallexSDKs.airTracker=new rn({config:{appName:"components-sdk",appVersion:En.version,env:In[e]||M.production}});window._AirwallexSDKs.airTracker.updateCommonData({clientId:n})}return window._AirwallexSDKs.airTracker};var Cn=function(e){if(typeof e!=="object"){return e}try{var n=JSON.parse(JSON.stringify(e));Object.keys(n).forEach((function(e){if(typeof e==="string"&&["auth","code"].some((function(n){return e.includes(n)}))){n[e]="***"}}));return n}catch(n){return e}};var Nn=function(e,n){var t,r;(r=(t=window._AirwallexSDKs)===null||t===void 0?void 0:t.airTracker)===null||r===void 0?void 0:r.error(e,un(un({},n),{context:"components-sdk"}))};var Tn=function(e,n){var t;(t=window._AirwallexSDKs.airTracker)===null||t===void 0?void 0:t.warn(e,un(un({},n),{context:"components-sdk"}))};var Dn=function(e,n){var t;(t=window._AirwallexSDKs.airTracker)===null||t===void 0?void 0:t.info(e,un(un({},n),{context:"components-sdk"}))};var jn=function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="LOAD_SCRIPT_ERROR";return t}return n}(Error);var Pn,Rn;var On;(function(e){e["dev"]="dev";e["staging"]="staging";e["demo"]="demo";e["prod"]="prod";e["sandbox"]="sandbox"})(On||(On={}));var _n=(Pn={},Pn[On.dev]="https://checkout-staging.airwallex.com",Pn[On.staging]="https://checkout-staging.airwallex.com",Pn[On.demo]="https://checkout-demo.airwallex.com",Pn[On.prod]="https://checkout.airwallex.com",Pn[On.sandbox]="https://checkout.sandbox.airwallex.com",Pn);var An=(Rn={},Rn[On.dev]="https://static-staging.airwallex.com",Rn[On.staging]="https://static-staging.airwallex.com",Rn[On.demo]="https://static-demo.airwallex.com",Rn[On.prod]="https://static.airwallex.com",Rn[On.sandbox]="https://static.sandbox.airwallex.com",Rn);var Ln="sdkController";var Un="payments";var Mn={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"};var Fn={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"};var Kn={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"]};var qn={billing:["payments"]};var Hn=["payments","sca"];var zn=function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="INVALID_STATIC_RESOURCE_ERROR";return t}return n}(Error);var Bn=Date.now();var Wn=function(e){return Object.keys(Kn).includes(e)};var Xn=function(e){if(e===void 0){e=500}return new Promise((function(n){return window.setTimeout(n,e)}))};var Gn=function(e){return Fn[e]};var Vn=function(e,n){var t=e===Un?_n:An;return t[n]||t.prod};var $n=function(e){var n=e.reduce((function(e,n){return e.concat(Wn(n)?Kn[n]:n)}),[]);return Array.from(new Set(n)).map((function(e){return{elementName:e,sdkName:Gn(e)}}))};var Jn=function(e){return Array.from(new Set($n(e).map((function(e){var n=e.sdkName;return n})).filter((function(e){return Hn.includes(e)}))))};var Qn=function(e){return e==="payments"?"payment":e};var Yn=function(e){var n=e.name,t=e.env,r=t===void 0?On.prod:t;var i=Vn(n,r);var o=Mn[n];if(!o){Nn("[components-sdk] Element static resource not found",{sdkName:n});throw new zn("Element ".concat(n," static resource URL is invalid."))}return"".concat(i).concat(o,"?ts=").concat(Bn)};var Zn=function(){return Hn.reduce((function(e,n){var t;return un(un({},e),(t={},t[n]=window._AirwallexSDKs.__controller__.internalSDKs[n],t))}),{})};var et=function(e){return qn[e]||[]};var nt=function(){return Math.floor(performance.now())};var tt=function(e){var n=document.createElement("script");n.src=e;n.type="module";var t=document.head||document.body;t.appendChild(n);return n};var rt=3;var it=function(e){return sn(void 0,void 0,void 0,(function(){var n,t;return cn(this,(function(r){switch(r.label){case 0:if(typeof window==="undefined"){throw new Error("Please load script in browser environment")}n=0;t=function(){return sn(void 0,void 0,void 0,(function(){var t,r,i;return cn(this,(function(o){t=nt();if(n>0&&e.includes("?ts=")){r=new URL(e,window.location.href);r.searchParams.set("ts","".concat(Date.now()));e=r.toString()}i=tt(e);return[2,new Promise((function(r,o){i.addEventListener("load",(function(){var i=nt();Dn("[components-sdk] SDK script loaded",{scriptUrl:e,start:t,latency:i-t,end:i,retryCount:n});r(true)}));i.addEventListener("error",(function(r){i.remove();console.error(r);var a=nt();Nn("[components-sdk] Failed to load script",{scriptUrl:e,error:r,start:t,latency:a-t,end:a,retryCount:n});o(new jn("Failed to load Airwallex SDK scripts: ".concat(e)))}))}))]}))}))};r.label=1;case 1:if(!(n<rt))return[3,7];r.label=2;case 2:r.trys.push([2,4,,6]);return[4,t()];case 3:return[2,r.sent()];case 4:r.sent();n++;return[4,Xn()];case 5:r.sent();return[3,6];case 6:return[3,1];case 7:Nn("[components-sdk] Failed to load script after retry",{scriptUrl:e,retryCount:n});throw new jn("Failed to load Airwallex SDK scripts: ".concat(e))}}))}))};var ot=function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="INSTANCE_NOT_FOUND_ERROR";return t}return n}(Error);var at;var ut=new Map;var st=function(e){var n=e.env,t=e.scriptName;var r=Yn({name:t,env:n});var i=ut.get(t);if(i){return i}var o=it(r);ut.set(t,o);return o};var ct=function(e){var n=e.env,t=e.scriptName;return sn(void 0,void 0,void 0,(function(){var e;return cn(this,(function(r){switch(r.label){case 0:e=et(t);if(!(e.length>0))return[3,2];return[4,Promise.all(e.map((function(e){return st({env:n,scriptName:e})})))];case 1:r.sent();r.label=2;case 2:return[2,st({env:n,scriptName:t})]}}))}))};var ft=function(e){return sn(void 0,void 0,void 0,(function(){return cn(this,(function(n){if(typeof window==="undefined"){throw new Error("Please call the `init()` function in a browser environment.")}Sn(e.env,e.clientId);Dn("[components-sdk] SDK init start",{options:Cn(e),start:nt()});at=new Promise((function(n,t){var r;var i=un(un({},e),{env:e.env&&On[e.env]?e.env:On.prod});window.AirwallexComponentsSDK.__env__=i.env;var o=st({env:i.env,scriptName:Ln}).then((function(){return window._AirwallexSDKs.__controller__.init(i)}));var a=(r=e.enabledElements)!==null&&r!==void 0?r:[];var u=Jn(a);var s=u.map((function(e){return st({env:i.env,scriptName:e}).then((function(){return o})).then((function(){var n=window._AirwallexSDKs[Qn(e)];if(!n){Nn("[components-sdk] SDK instance not found",{functionsNamespace:e,windowSDKInstanceName:Qn(e)});throw new ot("SDK instance not found")}return window._AirwallexSDKs.__controller__.registerFunctions({functionsNamespace:e,instance:n})}))}));var c=$n(a);var f=c.map((function(e){var n=e.sdkName,t=e.elementName;return ct({scriptName:n,env:i.env}).then((function(){return o})).then((function(){var e=window._AirwallexSDKs[Qn(n)];if(!e){Nn("[components-sdk] SDK instance not found",{sdkName:n,windowSDKInstanceName:Qn(n)});throw new ot("SDK instance not found")}return window._AirwallexSDKs.__controller__.registerElement({sdkName:n,elementName:t,instance:e})}))}));Promise.all(fn(fn([o],s,true),f,true)).then((function(){Dn("[components-sdk] SDK initialized",{options:Cn(e),start:nt()});n(Zn())}))["catch"]((function(e){if(!e.code){Nn("[components-sdk] Unexpected errors when init",{error:e})}t(e)}))}));return[2,at]}))}))};var lt=e("l",(function(e,n){return sn(void 0,void 0,void 0,(function(){var t,r,i,o,a;return cn(this,(function(u){switch(u.label){case 0:if(!e){throw new Error("Element type is missing. Please specify a valid element.")}Dn("[components-sdk] SDK createElement start",{elementName:e,options:Cn(n),timestamp:nt()});if(!at){Tn("[components-sdk] Did not call init before createElement");throw new Error("Please initialize the Element before creating it.")}return[4,at];case 1:u.sent();t=Gn(e);if(!t){throw new Error("`createElement()` with type `".concat(e,"` is not supported. Please specify a valid Element type."))}r=nt();u.label=2;case 2:u.trys.push([2,6,,7]);return[4,ct({scriptName:t,env:window.AirwallexComponentsSDK.__env__||On.prod})];case 3:u.sent();return[4,window._AirwallexSDKs.__controller__.registerElement({sdkName:t,elementName:e,instance:window._AirwallexSDKs[Qn(t)]})];case 4:u.sent();return[4,window._AirwallexSDKs.__controller__.createElement(e,n)];case 5:i=u.sent();o=nt();Dn("[components-sdk] SDK createElement being called",{elementName:e,options:Cn(n),start:r,latency:o-r,end:o});return[3,7];case 6:a=u.sent();if(!a.code){Nn("[components-sdk] Unexpected errors when createElement",{error:a})}else{throw a}return[3,7];case 7:return[2,i]}}))}))}));var dt=[Ln,Un];var vt=function(){dt.forEach((function(e){var n=Yn({name:e,env:On.prod});var t=document.createElement("link");t.href=n;t.rel="modulepreload";t.as="script";var r=document.head||document.body;r.appendChild(t)}))};var pt=typeof document==="undefined"||typeof window==="undefined";if(!pt){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",vt)}else{vt()}}if(typeof window!=="undefined"){if(!window.AirwallexComponentsSDK){Object.defineProperties(window,{AirwallexComponentsSDK:{value:{},writable:false},_AirwallexSDKs:{value:{},writable:false}})}window.AirwallexComponentsSDK.init=ft;window.AirwallexComponentsSDK.createElement=lt}var mt=n((function(){return{clientSecret:null,currency:null,hasPaymentError:false,isReady:false,paymentConfirmed:false,paymentIntentId:null}})),ht=mt.onChange,yt=mt.reset,wt=mt.state;e({n:ht,k:yt,b:wt});var gt=e("a",(function(e){if(e.paymentProcessor!=="AIRWALLEX"){return false}if(e.clientSecret){wt.clientSecret=e.clientSecret}if(e.paymentIntentId){wt.paymentIntentId=e.paymentIntentId}if(!wt.clientSecret){a("Airwallex checkout session is missing the client secret");return false}return true}));var bt={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"};var kt=e("m",(function(e){return bt[e]||"en"}));var xt=null;var Et=e("f",(function(){return sn(m,void 0,void 0,(function(){var e;return cn(this,(function(n){if(wt.isReady){return[2,true]}if(!xt){e=(!t.zonosMode||t.zonosMode==="production")&&t.checkoutSettings.mode==="LIVE";xt=ft({enabledElements:["payments"],env:e?"prod":"demo",locale:kt(i.selectedLocale)}).then((function(){wt.isReady=true;c("Airwallex SDK initialized");return true})).catch((function(e){a(e);xt=null;return false}))}return[2,xt]}))}))}));var It=["SUCCEEDED","REQUIRES_CAPTURE","PENDING_REVIEW","PENDING"];var St=e("e",(function(e){return!!e&&It.includes(e)}));var Ct=e("j",(function(e){switch(e){case"SUCCEEDED":{return{isError:false,messages:[r("Thank you for submitting your payment. We appreciate your prompt attention."),"",r("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:false,messages:[r("Payment processing. We'll update you when payment is received.")]}}case"REQUIRES_CUSTOMER_ACTION":{return{isError:false,messages:[r("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:true,messages:[r("Payment failed. Please reload the page and try another payment method.")]}}default:{return{isError:true,messages:[r("Something went wrong.")]}}}}));var Nt=e("d",(function(e){return sn(m,void 0,void 0,(function(){var n,t,r;return cn(this,(function(i){switch(i.label){case 0:return[4,u("/api/zonos-elements/collect/airwallex-payment-intent",{body:{paymentIntentId:e},method:"POST"})];case 1:n=i.sent(),t=n.errors,r=n.json;if(t.length||!r){a("Failed to retrieve Airwallex payment intent",t);return[2,{status:null}]}return[2,{status:r.airwallexPaymentIntent.status}]}}))}))}));var Tt=n((function(){return{amountDutyTaxFeeTotal:null,amountTotalPaid:null,collectLogoUrl:null,isFetchingShippingInfo:true,landedCostShortId:null,originCompanyName:null,partyBillingId:null,paymentProcessor:null,shippingAddress:null}})),Dt=Tt.reset,jt=Tt.state;e("c",jt);var Pt=e("h",(function(e){return sn(m,[e],void 0,(function(e){var n,r,i,o,a,c,f,l,d,p,m,h,y,w;var g=e.landedCostId,b=e.retries,k=b===void 0?5:b;return cn(this,(function(e){switch(e.label){case 0:jt.isFetchingShippingInfo=true;return[4,u("/api/zonos-elements/collect/get-shipping-info-by-lc-id",{body:{landedCostId:g},method:"POST"})];case 1:m=e.sent();if(!m.errors.length)return[3,4];if(!(k>0))return[3,3];return[4,new Promise((function(e){return setTimeout(e,1e3)}))];case 2:e.sent();return[2,Pt({landedCostId:g,retries:k-1})];case 3:return[2,null];case 4:jt.landedCostShortId=((n=m.json)===null||n===void 0?void 0:n.landedCostShortId)||null;jt.isFetchingShippingInfo=false;jt.shippingAddress=((r=m.json)===null||r===void 0?void 0:r.shipping)||null;h=(i=v.checkoutSession)===null||i===void 0?void 0:i.landedCost;y=(o=v.checkoutSession)===null||o===void 0?void 0:o.subtotals;w=(((a=h===null||h===void 0?void 0:h.amountSubtotals)===null||a===void 0?void 0:a.shipping)||0)+(((c=h===null||h===void 0?void 0:h.amountSubtotals)===null||c===void 0?void 0:c.items)||0);jt.amountTotalPaid=w*(((f=y===null||y===void 0?void 0:y.exchangeRate)===null||f===void 0?void 0:f.rate)||1);jt.amountDutyTaxFeeTotal=((y===null||y===void 0?void 0:y.duties)||0)+((y===null||y===void 0?void 0:y.taxes)||0)+((y===null||y===void 0?void 0:y.fees)||0);jt.originCompanyName=((d=(l=m.json)===null||l===void 0?void 0:l.origin)===null||d===void 0?void 0:d.companyName)||null;jt.collectLogoUrl=((p=m.json)===null||p===void 0?void 0:p.collectLogoUrl)||null;if(jt.amountTotalPaid===0){void s({endpoint:"COLLECT_NO_TOTAL_PAID",errors:[],metadata:{landedCostId:g,organizationId:t.organizationId}})}return[2]}}))}))}));var Rt=e("i",(function(){return sn(m,void 0,void 0,(function(){var e,n,t,r,i,c,p,m,h,y;return cn(this,(function(w){switch(w.label){case 0:if(!((e=l.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){return[2,{partiesCreated:false}]}i=(t=(n=v.checkoutSession)===null||n===void 0?void 0:n.landedCost)===null||t===void 0?void 0:t.rootId;if(!i){void s({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:f,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}});return[2,{partiesCreated:false}]}if(!o.checkoutSessionId){void s({endpoint:"COLLECT_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:f,cartId:window.Zonos.cartId,landedCostRootId:i}});return[2,{partiesCreated:false}]}c=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});p=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,u("/api/zonos-elements/create-billing-party",{body:{billingAddress:c,checkoutSessionId:o.checkoutSessionId,companyName:l.companyName,email:((r=l.stripeLinkEventData)===null||r===void 0?void 0:r.value.email)||"",isTest:p,rootId:i},method:"POST"})];case 1:m=w.sent(),h=m.errors,y=m.json;if(h.length||!y){a("Error occurs when creating billing party",JSON.stringify(h,null,2));void s({endpoint:"COLLECT_BILLING_PARTY_CREATE_FAILED",errors:["[COLLECT] Failed to create billing party"],metadata:{allLogs:f,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:h,json:y}});return[2,{partiesCreated:false}]}jt.partyBillingId=y.billToPartyId;return[2,{partiesCreated:true}]}}))}))}));var Ot=e("g",(function(e){return sn(m,void 0,void 0,(function(){var n;return cn(this,(function(t){n=e.landedCost;if(!n){return[2,false]}v.landedCostData=[Object.assign(Object.assign({},e),{landedCost:Object.assign({},n),landedCostId:n.id})];return[2,p({applySubtotalsOnly:true,landedCostId:n.id,selectedShippingOption:n.shipmentRating})]}))}))}))}}}));
|