@zonos/elements 1.3.292 → 1.3.293
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/{collect-Oeo5tjN5.js → collect-DnrvaXUI.js} +24 -4
- package/dist/cjs/index.cjs.js +30 -8
- package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +1 -1
- package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +1 -1
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +1 -1
- package/dist/cjs/zonos-collect.cjs.entry.js +1 -1
- package/dist/cjs/zonos-controller.cjs.entry.js +9 -0
- package/dist/collection/components/utils/checkout/injectDomesticElementHideStyle.js +9 -0
- package/dist/collection/scripts/_stripe.js +23 -1
- package/dist/esm/{collect-CdrR5OBy.js → collect-Eo4gtyql.js} +24 -4
- package/dist/esm/index.js +30 -8
- package/dist/esm/zonos-address-completion-dialog_7.entry.js +1 -1
- package/dist/esm/zonos-airwallex-payment.entry.js +1 -1
- package/dist/esm/zonos-collect-finish_6.entry.js +1 -1
- package/dist/esm/zonos-collect.entry.js +1 -1
- package/dist/esm/zonos-controller.entry.js +9 -0
- package/dist/esm-es5/{collect-CdrR5OBy.js → collect-Eo4gtyql.js} +4 -2
- package/dist/esm-es5/index.js +6 -6
- package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +1 -1
- package/dist/esm-es5/zonos-airwallex-payment.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 +6 -0
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-e0e9cff5.system.entry.js → p-06030d3b.system.entry.js} +6 -0
- package/dist/zonos-elements/{p-DzLNk-Pf.js → p-0mGRBGcf.js} +1 -1
- package/dist/zonos-elements/{p-552fbde1.system.entry.js → p-155ed3d3.system.entry.js} +6 -6
- package/dist/zonos-elements/{p-04bded81.system.entry.js → p-31043c2e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-938fc1e4.entry.js → p-3a2da031.entry.js} +1 -1
- package/dist/zonos-elements/{p-b2dd7f02.system.entry.js → p-5967a1c1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c5bab786.entry.js → p-725e29bb.entry.js} +1 -1
- package/dist/zonos-elements/{p-c3646ae6.system.entry.js → p-7bd99479.system.entry.js} +3 -3
- package/dist/zonos-elements/p-Bu9WCfUC.system.js +1 -1
- package/dist/zonos-elements/{p-DNc279vN.system.js → p-CZD8WvyY.system.js} +33 -31
- package/dist/zonos-elements/{p-y7PFdTUN.system.js → p-D6qXIvFm.system.js} +52 -52
- package/dist/zonos-elements/{p-6e296228.entry.js → p-ad9ff14c.entry.js} +1 -1
- package/dist/zonos-elements/p-c9d5d8f1.entry.js +1 -0
- package/dist/zonos-elements/{p-550d4eea.entry.js → p-d8b312e5.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +6 -4
- package/dist/zonos-elements/p-82595838.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as n}from"./p-XQfWgQLB.js";import{g as o,I as t}from"./p-HeAZDwVW.js";import{l as r}from"./p-BJmZPrZl.js";export{a as availableTestKeys}from"./p-BJmZPrZl.js";import{g as i,a as l,h as u,l as m}from"./p-DE4a-QD5.js";import{g as p,_ as w,c as f,a as v}from"./p-D5SpFsQJ.js";export{d as domesticRedirectedBtnSelector}from"./p-D5SpFsQJ.js";export{c as countryRequireShortAddressCode}from"./p-nJ6oI8-n.js";export{c as countryRequireTaxId,e as euCountryCodes,s as shipToTaxIdLabels}from"./p-Cye-evFK.js";const y=["jsdelivr","cdnjs","unpkg","vercel"],h="jsdelivr",O=e=>{const n=y.indexOf(e);return y[n+1]||null},S=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const n=(e=>{if(!e)return null;const n=new URL(e).searchParams.get("zonosQaUrl");return n?/[^a-zA-Z0-9-_]+/.test(n)?null:n:null})(window.location.href),o="https://v1.3.292.js.zonos.com";if(!n&&(o.includes("test.")||o.includes("test-")))return o;if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.elements.zonos.com";const t=`https://${n}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${t}' for loading elements script`,"warn"),fetch(t).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,o=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),t},g="https://js.stripe.com/v3",j=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;let z=null;const b=e=>(null!==z||(z=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)n(window.Stripe);else try{let t=(()=>{const e=document.querySelectorAll(`script[src^="${g}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&j.test(o.src))return o}return null})();t&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):t||(t=(()=>{const e=document.createElement("script");e.src=`${g}`;const n=document.head||document.body;return n?(n.appendChild(e),e):(m("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==t||t.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):o(new Error("Stripe.js not available"))})),null==t||t.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else n(null)}))),z),N=Promise.resolve().then((()=>(()=>{var e,n;return"undefined"!=typeof window&&("function"==typeof(null===(e=window.Zonos)||void 0===e?void 0:e.createCartId)||"function"==typeof(null===(n=window.Zonos)||void 0===n?void 0:n.buildCartDetail))})()?b(null):null));let I=!1;N.catch((e=>{I||console.warn(e)}));const Z=async({cartId:e,retries:n})=>{const t=i(),s=o(),c=p()||void 0,d=new URLSearchParams;s.overrideShouldEnabledCustomAddress&&d.set("overrideShouldEnabledCustomAddress",s.overrideShouldEnabledCustomAddress);const{errors:l,json:a,zonosMode:m}=await u(`/api/zonos-elements/get-cart?${d.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:c,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),w=!a||l.length;return w&&n?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:n}),await new Promise((e=>setTimeout(e,500))),Z({cartId:e,retries:n-1})):w?null:Object.assign(Object.assign({},a),{zonosMode:m})};var k;const R=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:n,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const n=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>n.includes(e))),t=["qa.js.zonos.com"].some((e=>n.includes(e)));return{currentLoadScriptUrl:n,isForceLoadVersionDomain:t,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?n:null})(),T=Date.now(),$="https://v1.3.292.js.zonos.com",A=R||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.292",L="https://fonts.googleapis.com",C=/^https:\/\/fonts\.googleapis\.com/;class U{}k=U,U.doneInit=!1,U.cartSettings=null,U.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),U.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),U._paypalMockResponse=null,U.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,U.isBigCommerce=!1,U.releaseDate="1791222618677",U.isLegacyCheckout=!1,U.googleAnalyticId=null,U.googleAnalyticReady=!1,U.facebookPixelId=null,U.facebookPixelReady=!1,U.startLoadTime=T,U.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",U.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),U.overrideUseCustomAddressForm=!1,U.isCollect=!1,U.isInvoice=!1,U.isNpm=!0,U.zonosQaUrl=null,U.zonosQaUrlApi=null,U.trackEventLogs=[],U.version="v1.3.292",U.modeAlerted=!1,U.cartData=null,U.paypal=null,U.zonosMode=null,U.IframeService=t,U.getCurrentTimestamp=()=>(new Date).getTime(),U.zonosController=null,U.loadTimeApiInfoList=[],U.logIntervalId=null,U.init=async e=>{const{appearance:n,checkoutSettings:o,currencyConverter:t,helloSettings:s,onCountryChange:c,overrideCurrencyFormat:d,storeId:a,zonosApiKey:p}=e;if(k.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),k.createCartId=null==o?void 0:o.createCartId,k.buildCartDetail=null==o?void 0:o.buildCartDetail,k.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${k.version}) ======`),k.zonosApiKey=p,k.storeId=a,"undefined"!=typeof window&&window.parent===window&&(k.googleAnalyticReady=!0,k.facebookPixelReady=!0),k.isNpm){r("====== ZONOS LOADING FROM NPM ======");const n=S();if(n&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${n} ======`,"info");const o=document.createElement("script");return o.src=`${n}/dist/scripts/zonos.js`,document.head.appendChild(o),o.addEventListener("load",(()=>{window.Zonos.isNpm=k.isNpm,window.Zonos.isBigCommerce=k.isBigCommerce,window.Zonos.isLegacyCheckout=k.isLegacyCheckout,window.Zonos.zonosMode=k.zonosMode,window.Zonos.init(e)})),o.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${n}`)})),void(window.isZonosPreview=!0)}if(!p&&!k.cartId)return void m("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!k.cartData&&k.cartId){r("Initialize cart data");const e=await(async e=>{const{isDgsCartId:n,isLegacyCartId:o}=w(e);if(!o&&!n)return m("[ZONOS - loadZonos] invalid cart id"),null;const t=await Z({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",t),t?(window.Zonos.storeId=t.cartData.storeId,window.Zonos.zonosApiKey=t.cartData.credentialToken,window.Zonos.zonosMode=t.zonosMode,{cartData:t.cartData,settings:t.settings,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}):(m("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(k.cartId);if(!e)return void m("Failed to get cart data");k.cartData=e.cartData,k.zonosApiKey=e.zonosApiKey,k.cartSettings=e.settings}const o=await(async()=>{const e=i(),n=l();if(!e&&!n||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:o,json:t}=await u("/api/get-test-public-credential");if(o.length||!t)return m("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",o),null;const s=t.publicCredential;return s?(r(`[ZONOS - loadZonos] Retrieve new test public token ${s}`,"info"),s):(m("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();o&&(k.zonosApiKey=o)}const v=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(k.cartId&&k.cartData||v){r("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id=`${f}`,document.body.appendChild(e)}r("init zonos"),k.restoreNativeBrowserFunctions(),k.injectCustomScriptForHostedCheckout(),k.injectZonosCdn(),k.injectZonosCss(),k.injectFonts(),k.injectCheckoutInternationalButton(),k.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:t,helloSettings:s,onCountryChange:c,overrideCurrencyFormat:d}}),k.doneInit=!0},U.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${v}`)){const e=document.createElement("button");e.id=v,e.style.display="none",document.body.appendChild(e)}},U.injectCustomScriptForHostedCheckout=()=>{const e=k.cartData,n=(null==e?void 0:e.metadata)||[],o=n.find((e=>"customHeaderScript"===e.key)),t=n.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(o||t)){if(o){r("Injecting custom header script");const e=document.createElement("script");e.textContent=o.value,document.head.appendChild(e)}if(t){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=t.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:t,headerScript:o,isLegacyCheckout:window.Zonos.isLegacyCheckout})},U.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},U.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${v}`);setTimeout((()=>{e&&e.dispatchEvent(n("click"))}),10)},U.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},U.showNotification=e=>{var n;null===(n=k.zonosController)||void 0===n||n.showNotification(e)},U.updateOrganizationName=e=>{var n;null===(n=k.zonosController)||void 0===n||n.updateOrganizationName(e)},U.disablePlaceOrderButtons=({autoEnable:e=!0,config:n,disable:o,placeOrderButtonSelector:t})=>{var s;if(!(null===(s=n.checkoutSettings)||void 0===s?void 0:s.disablePlaceOrderButtonActivation)&&t){const n=document.querySelectorAll(t),s=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&o&&setTimeout((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},U.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const n="zonos---native-browser";let o=document.querySelector(`iframe#${n}`);o||(o=document.createElement("iframe"),o.id=n,o.style.display="none",o.style.opacity="0",o.style.position="absolute",o.style.top="-9999px",o.style.left="-9999px",o.style.width="1px",o.style.height="1px",o.style.border="none",o.style.overflow="hidden",o.style.visibility="hidden",document.body.appendChild(o));const t=(null===(e=o.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=t,document.body.removeChild(o)},U.injectController=({config:e})=>{var n,o;if(document.querySelector("zonos-controller"))return;if(null===(n=e.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const n=e.checkoutSettings.placeOrderButtonSelector;k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.alwaysTriggerInternationalCheckoutSelector){const n=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}const t=document.createElement("zonos-controller");t.config=e,t.zonosApiKey=k.zonosApiKey||"",t.addEventListener("stripeInitEvent",(async e=>{const{detail:n}=e;r("loading Stripe");const o=await(async(...e)=>{var n;I=!0;const o=Date.now();return((e,n,o)=>{if(null===e)return null;const t=e.apply(void 0,n);return((e,n)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:n})})(t,o),t})(null!==(n=await N)&&void 0!==n?n:await b(null),e,o)})(n.publishableKey);o?(window.Zonos.stripe=o,window.Zonos.isCollect?t.initCollectElement(o):window.Zonos.isInvoice?t.initInvoiceElement(o):t.initCheckoutElement(o)):m("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(t),k.zonosController=t,r("Zonos controller injected!")},U.injectScript=({cdnType:e,isModule:n,theRestUrl:o})=>{const t=`${k.getZonosUrl(e)}/${o}`;if(document.querySelector(`script[src="${t}"]`))return void r(`Zonos script "${t}" already exists in the document`,"warn");const s=document.head||document.body,i=document.createElement("script");n?i.type="module":i.noModule=!0,i.src=t,i.crossOrigin="anonymous",i.onerror=()=>{m(`Failed to load ${i.src}`);const t=O(e);t&&k.injectScript({cdnType:t,isModule:n,theRestUrl:o})},s.appendChild(i)},U.getZonosUrl=e=>{const n=()=>{switch(e){case"jsdelivr":return A;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.292";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.292";case"vercel":return $}};return k.isNpm&&S()||n()},U.injectZonosCdn=()=>{k.injectScript({cdnType:h,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),k.injectScript({cdnType:h,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},U.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const o=k.getZonosUrl(e),t=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${$}/`,t.appendChild(s);const r=document.createElement("link");r.rel="stylesheet",r.href=`${o}/${n}`,r.onerror=()=>{m(`Failed to load ${r.href}`);const o=O(e);o&&k.injectStylesheet({cdnType:o,theRestUrl:n})},t.appendChild(r)},U.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(k.injectStylesheet({cdnType:h,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},U.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${L}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&!C.test(o.href))return o}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=L,e.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${L}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(o),r("Zonos font injected!")},U.setupGoogleFont=e=>{var n;null===(n=k.zonosController)||void 0===n||n.setupGoogleFont(e)},U.injectSupportGoogleFont=e=>{var n;r(`[FONT] injecting ${e}`);const o=null===(n=e.match(/family=(.*?):/))||void 0===n?void 0:n[1],t=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${L}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=L,t.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,t.appendChild(s),r(`[FONT] ${o} font injected!`)};const E=["ZONOS_FORM_TYPE_USING","APP_VERSION","APP_VERSION_NPM_INTEGRATION","LEGACY_CHECKOUT_FACADE"],D=["ORDER_DUPLICATION_CONSENT","WITH_ABANDONED_CART_TOKEN"],P=[...E,...D];export{U as Zonos,f as checkoutHiddenBtnSelector,v as checkoutHiddenInternationalBtnSelector,P as checkoutSessionAttributeKeys,D as checkoutSessionImmutableAttributeKeys,E as checkoutSessionMutableAttributeKeys}
|
|
1
|
+
import{c as n}from"./p-XQfWgQLB.js";import{g as o,I as t}from"./p-HeAZDwVW.js";import{l as r}from"./p-BJmZPrZl.js";export{a as availableTestKeys}from"./p-BJmZPrZl.js";import{g as i,a as l,h as u,l as m}from"./p-DE4a-QD5.js";import{g as p,_ as w,c as f,a as y}from"./p-D5SpFsQJ.js";export{d as domesticRedirectedBtnSelector}from"./p-D5SpFsQJ.js";export{c as countryRequireShortAddressCode}from"./p-nJ6oI8-n.js";export{c as countryRequireTaxId,e as euCountryCodes,s as shipToTaxIdLabels}from"./p-Cye-evFK.js";const v=["jsdelivr","cdnjs","unpkg","vercel"],h="jsdelivr",O=e=>{const n=v.indexOf(e);return v[n+1]||null},g=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const n=(e=>{if(!e)return null;const n=new URL(e).searchParams.get("zonosQaUrl");return n?/[^a-zA-Z0-9-_]+/.test(n)?null:n:null})(window.location.href),o="https://v1.3.293.js.zonos.com";if(!n&&(o.includes("test.")||o.includes("test-")))return o;if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.elements.zonos.com";const t=`https://${n}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${t}' for loading elements script`,"warn"),fetch(t).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,o=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),t},S="https://js.stripe.com/v3",j=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;let z=null;const b=e=>(null!==z||(z=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)n(window.Stripe);else try{let t=(()=>{const e=document.querySelectorAll(`script[src^="${S}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&j.test(o.src))return o}return null})();t&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):t||(t=(()=>{const e=document.createElement("script");e.src=`${S}`;const n=document.head||document.body;return n?(n.appendChild(e),e):(m("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==t||t.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):o(new Error("Stripe.js not available"))})),null==t||t.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else n(null)}))),z),N=Promise.resolve().then((()=>(()=>{var e,n;return"undefined"!=typeof window&&("function"==typeof(null===(e=window.Zonos)||void 0===e?void 0:e.createCartId)||"function"==typeof(null===(n=window.Zonos)||void 0===n?void 0:n.buildCartDetail))})()?b(null):null));let I=!1;N.catch((e=>{I||console.warn(e)}));const Z=async({cartId:e,retries:n})=>{const t=i(),s=o(),c=p()||void 0,d=new URLSearchParams;s.overrideShouldEnabledCustomAddress&&d.set("overrideShouldEnabledCustomAddress",s.overrideShouldEnabledCustomAddress);const{errors:l,json:a,zonosMode:m}=await u(`/api/zonos-elements/get-cart?${d.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:c,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),w=!a||l.length;return w&&n?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:n}),await new Promise((e=>setTimeout(e,500))),Z({cartId:e,retries:n-1})):w?null:Object.assign(Object.assign({},a),{zonosMode:m})};var k;const R=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:n,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const n=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>n.includes(e))),t=["qa.js.zonos.com"].some((e=>n.includes(e)));return{currentLoadScriptUrl:n,isForceLoadVersionDomain:t,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?n:null})(),T=Date.now(),$="https://v1.3.293.js.zonos.com",A=R||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.293",L="https://fonts.googleapis.com",C=/^https:\/\/fonts\.googleapis\.com/;class U{}k=U,U.doneInit=!1,U.cartSettings=null,U.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),U.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),U._paypalMockResponse=null,U.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,U.isBigCommerce=!1,U.releaseDate="1792077383128",U.isLegacyCheckout=!1,U.googleAnalyticId=null,U.googleAnalyticReady=!1,U.facebookPixelId=null,U.facebookPixelReady=!1,U.startLoadTime=T,U.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",U.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),U.overrideUseCustomAddressForm=!1,U.isCollect=!1,U.isInvoice=!1,U.isNpm=!0,U.zonosQaUrl=null,U.zonosQaUrlApi=null,U.trackEventLogs=[],U.version="v1.3.293",U.modeAlerted=!1,U.cartData=null,U.paypal=null,U.zonosMode=null,U.IframeService=t,U.getCurrentTimestamp=()=>(new Date).getTime(),U.zonosController=null,U.loadTimeApiInfoList=[],U.logIntervalId=null,U.init=async e=>{const{appearance:n,checkoutSettings:o,currencyConverter:t,helloSettings:s,onCountryChange:c,overrideCurrencyFormat:d,storeId:a,zonosApiKey:p}=e;if(k.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),k.createCartId=null==o?void 0:o.createCartId,k.buildCartDetail=null==o?void 0:o.buildCartDetail,k.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${k.version}) ======`),k.zonosApiKey=p,k.storeId=a,"undefined"!=typeof window&&window.parent===window&&(k.googleAnalyticReady=!0,k.facebookPixelReady=!0),k.isNpm){r("====== ZONOS LOADING FROM NPM ======");const n=g();if(n&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${n} ======`,"info");const o=document.createElement("script");return o.src=`${n}/dist/scripts/zonos.js`,document.head.appendChild(o),o.addEventListener("load",(()=>{window.Zonos.isNpm=k.isNpm,window.Zonos.isBigCommerce=k.isBigCommerce,window.Zonos.isLegacyCheckout=k.isLegacyCheckout,window.Zonos.zonosMode=k.zonosMode,window.Zonos.init(e)})),o.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${n}`)})),void(window.isZonosPreview=!0)}if(!p&&!k.cartId)return void m("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!k.cartData&&k.cartId){r("Initialize cart data");const e=await(async e=>{const{isDgsCartId:n,isLegacyCartId:o}=w(e);if(!o&&!n)return m("[ZONOS - loadZonos] invalid cart id"),null;const t=await Z({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",t),t?(window.Zonos.storeId=t.cartData.storeId,window.Zonos.zonosApiKey=t.cartData.credentialToken,window.Zonos.zonosMode=t.zonosMode,{cartData:t.cartData,settings:t.settings,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}):(m("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(k.cartId);if(!e)return void m("Failed to get cart data");k.cartData=e.cartData,k.zonosApiKey=e.zonosApiKey,k.cartSettings=e.settings}const o=await(async()=>{const e=i(),n=l();if(!e&&!n||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:o,json:t}=await u("/api/get-test-public-credential");if(o.length||!t)return m("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",o),null;const s=t.publicCredential;return s?(r(`[ZONOS - loadZonos] Retrieve new test public token ${s}`,"info"),s):(m("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();o&&(k.zonosApiKey=o)}const y=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(k.cartId&&k.cartData||y){r("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id=`${f}`,document.body.appendChild(e)}r("init zonos"),k.restoreNativeBrowserFunctions(),k.injectCustomScriptForHostedCheckout(),k.injectZonosCdn(),k.injectZonosCss(),k.injectFonts(),k.injectCheckoutInternationalButton(),k.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:t,helloSettings:s,onCountryChange:c,overrideCurrencyFormat:d}}),k.doneInit=!0},U.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${y}`)){const e=document.createElement("button");e.id=y,e.style.display="none",document.body.appendChild(e)}},U.injectCustomScriptForHostedCheckout=()=>{const e=k.cartData,n=(null==e?void 0:e.metadata)||[],o=n.find((e=>"customHeaderScript"===e.key)),t=n.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(o||t)){if(o){r("Injecting custom header script");const e=document.createElement("script");e.textContent=o.value,document.head.appendChild(e)}if(t){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=t.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:t,headerScript:o,isLegacyCheckout:window.Zonos.isLegacyCheckout})},U.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},U.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${y}`);setTimeout((()=>{e&&e.dispatchEvent(n("click"))}),10)},U.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},U.showNotification=e=>{var n;null===(n=k.zonosController)||void 0===n||n.showNotification(e)},U.updateOrganizationName=e=>{var n;null===(n=k.zonosController)||void 0===n||n.updateOrganizationName(e)},U.disablePlaceOrderButtons=({autoEnable:e=!0,config:n,disable:o,placeOrderButtonSelector:t})=>{var s;if(!(null===(s=n.checkoutSettings)||void 0===s?void 0:s.disablePlaceOrderButtonActivation)&&t){const n=document.querySelectorAll(t),s=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&o&&setTimeout((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},U.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const n="zonos---native-browser";let o=document.querySelector(`iframe#${n}`);o||(o=document.createElement("iframe"),o.id=n,o.style.display="none",o.style.opacity="0",o.style.position="absolute",o.style.top="-9999px",o.style.left="-9999px",o.style.width="1px",o.style.height="1px",o.style.border="none",o.style.overflow="hidden",o.style.visibility="hidden",document.body.appendChild(o));const t=(null===(e=o.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=t,document.body.removeChild(o)},U.injectController=({config:e})=>{var n,o;if(document.querySelector("zonos-controller"))return;if(null===(n=e.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const n=e.checkoutSettings.placeOrderButtonSelector;k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.alwaysTriggerInternationalCheckoutSelector){const n=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}const t=document.createElement("zonos-controller");t.config=e,t.zonosApiKey=k.zonosApiKey||"",t.addEventListener("stripeInitEvent",(async e=>{const{detail:n}=e;r("loading Stripe");const o=await(async(...e)=>{var n;I=!0;const o=Date.now();return((e,n,o)=>{if(null===e)return null;const[t,s]=n,r=Object.assign({},s),i=(e=>{if(!("version"in e))return;const{version:n}=e;return"number"==typeof n||"string"==typeof n?n:void 0})(e);"string"==typeof i&&i!==3..toString()?delete r.apiVersion:r.apiVersion="2025-02-24.acacia";const c=e(t,r);return((e,n)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:n})})(c,o),c})(null!==(n=await N)&&void 0!==n?n:await b(null),e,o)})(n.publishableKey);o?(window.Zonos.stripe=o,window.Zonos.isCollect?t.initCollectElement(o):window.Zonos.isInvoice?t.initInvoiceElement(o):t.initCheckoutElement(o)):m("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(t),k.zonosController=t,r("Zonos controller injected!")},U.injectScript=({cdnType:e,isModule:n,theRestUrl:o})=>{const t=`${k.getZonosUrl(e)}/${o}`;if(document.querySelector(`script[src="${t}"]`))return void r(`Zonos script "${t}" already exists in the document`,"warn");const s=document.head||document.body,i=document.createElement("script");n?i.type="module":i.noModule=!0,i.src=t,i.crossOrigin="anonymous",i.onerror=()=>{m(`Failed to load ${i.src}`);const t=O(e);t&&k.injectScript({cdnType:t,isModule:n,theRestUrl:o})},s.appendChild(i)},U.getZonosUrl=e=>{const n=()=>{switch(e){case"jsdelivr":return A;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.293";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.293";case"vercel":return $}};return k.isNpm&&g()||n()},U.injectZonosCdn=()=>{k.injectScript({cdnType:h,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),k.injectScript({cdnType:h,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},U.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const o=k.getZonosUrl(e),t=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${$}/`,t.appendChild(s);const r=document.createElement("link");r.rel="stylesheet",r.href=`${o}/${n}`,r.onerror=()=>{m(`Failed to load ${r.href}`);const o=O(e);o&&k.injectStylesheet({cdnType:o,theRestUrl:n})},t.appendChild(r)},U.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(k.injectStylesheet({cdnType:h,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},U.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${L}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&!C.test(o.href))return o}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=L,e.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${L}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(o),r("Zonos font injected!")},U.setupGoogleFont=e=>{var n;null===(n=k.zonosController)||void 0===n||n.setupGoogleFont(e)},U.injectSupportGoogleFont=e=>{var n;r(`[FONT] injecting ${e}`);const o=null===(n=e.match(/family=(.*?):/))||void 0===n?void 0:n[1],t=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${L}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=L,t.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,t.appendChild(s),r(`[FONT] ${o} font injected!`)};const E=["ZONOS_FORM_TYPE_USING","APP_VERSION","APP_VERSION_NPM_INTEGRATION","LEGACY_CHECKOUT_FACADE"],D=["ORDER_DUPLICATION_CONSENT","WITH_ABANDONED_CART_TOKEN"],P=[...E,...D];export{U as Zonos,f as checkoutHiddenBtnSelector,y as checkoutHiddenInternationalBtnSelector,P as checkoutSessionAttributeKeys,D as checkoutSessionImmutableAttributeKeys,E as checkoutSessionMutableAttributeKeys}
|
|
@@ -47,6 +47,12 @@ return T(n).map((function(t){return"body.z-intl ".concat(t)})).join(", ")};
|
|
|
47
47
|
* also the selector we validate — see [[buildDomesticHideSelector]] for the
|
|
48
48
|
* `:is()`-support branching.
|
|
49
49
|
*/var L=function(t){if(typeof document==="undefined"||!t){return}var n=P({merchantSelector:t,supportsIs:E});
|
|
50
|
+
// A raw `<` is never a valid CSS selector character, and it is the
|
|
51
|
+
// character that would close a `<style>` tag if this string were ever
|
|
52
|
+
// assigned as HTML. Some parsers (current jsdom) do not throw on it, so
|
|
53
|
+
// reject it before `querySelector`. `>` stays allowed: it is the child
|
|
54
|
+
// combinator.
|
|
55
|
+
if(n.includes("<")){_('Skip domesticElementSelector injection: "'.concat(t,'" contains "<"'),"warn");return}
|
|
50
56
|
// The browser's own parser is the source of truth — `document.querySelector`
|
|
51
57
|
// throws `DOMException(SyntaxError)` for syntactically invalid selectors.
|
|
52
58
|
// Validating the exact string we're about to emit catches both malformed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as n,z as e}from"./p-W82paT5F.js";import{t,l as r,s as i}from"./p-clDfq9AL.js";import{l as o,h as a,s}from"./p-DE4a-QD5.js";import{l as u,b as c}from"./p-BJmZPrZl.js";import{d as l,Y as d,b as f,a0 as v}from"./p-FRWZayxL.js";function m(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function p(n,e,t,r,i,o,a){try{var s=n[o](a),u=s.value}catch(n){return void t(n)}s.done?e(u):Promise.resolve(u).then(r,i)}function h(n){return function(){var e=this,t=arguments;return new Promise((function(r,i){var o=n.apply(e,t);function a(n){p(o,r,i,a,s,"next",n)}function s(n){p(o,r,i,a,s,"throw",n)}a(void 0)}))}}function y(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function w(n,e){return e&&function(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}(n.prototype,e),n}function g(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function b(n,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](n):n instanceof e}function k(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})))),r.forEach((function(e){g(n,e,t[e])}))}return n}function x(n,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):function(n){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);e.push.apply(e,t)}return e}(Object(e)).forEach((function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))})),n}function E(n,e){return function(n){if(Array.isArray(n))return n}(n)||function(n,e){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=t){var r,i,o=[],a=!0,s=!1;try{for(t=t.call(n);!(a=(r=t.next()).done)&&(o.push(r.value),o.length!==e);a=!0);}catch(n){s=!0,i=n}finally{try{a||null==t.return||t.return()}finally{if(s)throw i}}return o}}(n,e)||N(n,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(n){return function(n){if(Array.isArray(n))return m(n)}(n)||function(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}(n)||N(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(n){return n&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n}function N(n,e){if(n){if("string"==typeof n)return m(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?m(n,e):void 0}}function C(n,e){var t,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(n,a)}catch(n){o=[6,n],r=0}finally{t=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var T,D,P,R,O,j=function(n){return n.production="prod",n.demo="demo",n.staging="staging",n}(j||{}),_="airTracker_unknown",A={appName:_,appVersion:_,env:"staging",isWebappContainer:!1,delay:2e3,errorRepeatTime:3,enableErrorMonitoring:!1,assetSpeedMonitoringWhiteList:[],enableDetectPageChange:!1,enableRecordPageRetention:!1,hideSearchParams:!1,useSessionStorageForSessionId:!1,assetSpeedMonitoringWhiteListByMFE:{}},L={appName:_,env:"staging",sessionId:_,deviceId:_},U=function(){var n=new WeakSet;return function(e,t){if(b(t,Error))return"Error.message: ".concat(t.message," \n Error.stack: ").concat(t.stack);if("object"===(void 0===t?"undefined":S(t))&&null!==t){if(n.has(t))return"[Circular ".concat(e||"root","]");n.add(t)}return"function"==typeof t?"function":"symbol"===(void 0===t?"undefined":S(t))?"symbol":void 0===t?null:t}},F=function(n){if("string"==typeof n)return n;try{return b(n,Error)?(JSON.stringify(n,U())||"undefined").replace(/"/gim,""):JSON.stringify(n,U())}catch(n){return'{"error":"error happen when airTracker stringify"}'}},M=function(n){var e=n.method,t=void 0===e?"post":e,r=n.url,i=n.data,o=n.success,a=n.fail;if((s=i)&&!/^\s*$/.test(s)&&(s=(s=(s=s.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@")).replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]")).replace(/(?:^|:|,)(?:\s*\[)+/g,""),/^[\],:{}\s]*$/.test(s))){var s,u=new XMLHttpRequest;u.addEventListener("readystatechange",(function(){4===u.readyState&&(u.status>=400||0===u.status?null==a||a(u.response):null==o||o(u.response))})),u.open(t,r),u.setRequestHeader("Content-Type","application/json"),u.send(i)}},K="onCommonUpdated",q="AIR_ANALYTICS_DEVICE_ID",H="AIR_ANALYTICS_SESSION_ID",z=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(n){var e=16*Math.random()|0;return("x"===n?e:3&e|8).toString(16)}))},B=function(n){var e,t,r;return n.config.getMFEName?n.config.getMFEName():(null===(r=location)||void 0===r||null===(t=r.pathname)||void 0===t||null===(e=t.split("/"))||void 0===e?void 0:e[2])||"unknown"},W=function(n){return"string"==typeof n?n.split("?")[1]||"":n},X=function(n){return"string"==typeof n&&n.startsWith("//")?"undefined"!=typeof location&&"https:"===location.protocol:/^https/.test(n)},V=function(n){return"number"==typeof n||"string"==typeof n?n:-1},G=function(n,e){var t,r=!1;if(!e.config.isWebappContainer)return J(n,e.config.assetSpeedMonitoringWhiteList);var i=B(e);return r||J(n,null===(t=e.config.assetSpeedMonitoringWhiteListByMFE)||void 0===t?void 0:t[i])},J=function(n,e){if(!(null==e?void 0:e.length))return!1;for(var t=0;t<e.length;t++){var r=e[t];if(b(r,RegExp)&&r.test(n))return!0;if("string"==typeof r&&n.includes(r))return!0}return!1},$=function(n,e){return Math.round(100*(n-e))/100},Q=function(n){return function(e){var t,r,i=B(n),o=n.config.isWebappContainer?k({},n.commonData||{},(null===(t=n.MFECommonDataMap)||void 0===t?void 0:t[i])||{}):n.commonData,a=Array.isArray(e)?e:[e];if(0!==a.length){var s,u=F({commonData:o,data:a}),c={method:"post",url:(s=n.commonData.env,"prod"==s?"https://o11y.airwallex.com/airtracker/logs":"demo"==s?"https://o11y-demo.airwallex.com/airtracker/logs":"https://o11y-staging.airwallex.com/airtracker/logs"),data:u};"function"==typeof(null===(r=navigator)||void 0===r?void 0:r.sendBeacon)&&navigator.sendBeacon(c.url,u)||M(c)}}},Y=function(n){return function(e){var t,r,i,o=B(n),a={commonData:n.config.isWebappContainer?k({},n.commonData||{},(null===(t=n.MFECommonDataMap)||void 0===t?void 0:t[o])||{}):n.commonData,data:Array.isArray(e)?e:[e]},s=F(a),u={method:"post",url:(i=n.commonData.env,"prod"==i?"https://o11y.airwallex.com/airtracker/metrics":"demo"==i?"https://o11y-demo.airwallex.com/airtracker/metrics":"https://o11y-staging.airwallex.com/airtracker/metrics"),data:s};"function"==typeof(null===(r=navigator)||void 0===r?void 0:r.sendBeacon)&&navigator.sendBeacon(u.url,s)||M(u)}},Z=function(n,e){var t,r=[],i=n.config;return window.addEventListener("beforeunload",(function(){r.length>0&&(n.immediateSendPipe(r.splice(0,r.length)),t&&clearTimeout(t))})),function(o,a){if(r.push(o),n.lifeCycle.on(K,(function(){r.length>0&&(null==a||a(r.splice(0,r.length)),n.lifeCycle.remove(K),t&&clearTimeout(t))})),r.length>=e)return null==a||a(r.splice(0,r.length)),void(t&&clearTimeout(t));t&&clearTimeout(t),t=setTimeout((function(){t=null,r.length>0&&(null==a||a(r.splice(0,r.length)),n.lifeCycle.remove(K))}),i.delay)}},nn=function(){},en=function(n){if(!n||!n.reduce||!n.length)throw new TypeError("createPipeline need at least one function param");return 1===n.length?function(e,t){n[0](e,t||nn)}:n.reduce((function(n,e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nn;return n(t,(function(n){return null==e?void 0:e(n,r)}))}}))},tn=function(){function n(){var e=this;y(this,n),this.emit=function(n,t){if(e){var r,i=e.eventsList[n];if(null==i?void 0:i.length){i=i.slice();for(var o=0;o<i.length;o++){r=i[o];try{var a=r.callback.apply(e,[t]);if(1===r.type&&e.remove(n,r.callback),!1===a)break}catch(n){throw n}}}return e}},this.eventsList={}}return w(n,[{key:"indexOf",value:function(n,e){for(var t=0;t<n.length;t++)if(n[t].callback===e)return t;return-1}},{key:"on",value:function(n,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(this){var r=this.eventsList[n];return r||(this.eventsList[n]=[],r=this.eventsList[n]),-1===this.indexOf(r,e)?(r.push({name:n,type:t||0,callback:e}),this):this}}},{key:"one",value:function(n,e){this.on(n,e,1)}},{key:"remove",value:function(n,e){if(this){var t=this.eventsList[n];if(!t)return null;if(!e){try{delete this.eventsList[n]}catch(n){}return null}if(t.length){var r=this.indexOf(t,e);t.splice(r,1)}return this}}},{key:"clear",value:function(){this.eventsList={}}}]),n}(),rn=function(){function n(e){y(this,n),this.name="",this.isInit=!1,this.name=e.name,this.option=e}return w(n,[{key:"patch",value:function(n){var e,t;this.isInit||(this.isInit=!0,null===(t=this.option)||void 0===t||null===(e=t.setUp)||void 0===e||e.call(this.option,n))}},{key:"uninstall",value:function(){var n,e;null===(e=this.option)||void 0===e||null===(n=e.destroy)||void 0===n||n.apply(this),this.isInit=!1}}]),n}(),on=function(n){var e="".concat(F(n.message)||""," @ (").concat(F(n.filename)||"",":").concat(n.lineno||0,":").concat(n.colno||0,")\n").concat(F(n.error||""));T.normalLogPipeLine({severity:"autoDetectError",eventName:"windowOnError",extraInfo:{error:e}})},an=function(n){var e=n&&F(n.reason);T.normalLogPipeLine({severity:"autoDetectError",eventName:"promiseError",extraInfo:{error:e}})},sn=function(n){var e=(null==n?void 0:n.target)||(null==n?void 0:n.srcElement);if(e){var t=(null==e?void 0:e.src)||(null==e?void 0:e.href),r=e.tagName,i="unknown";if("string"==typeof t&&r){if(window.location.href.indexOf(t)>-1)return;if(/\.js$/.test(t))i="script";else if(/\.css$/.test(t))i="css";else switch(r.toLowerCase()){case"script":i="script";break;case"link":i="css";break;case"img":i="image";break;case"audio":case"video":i="media";break;default:return}T.normalLogPipeLine({severity:"autoDetectError",eventName:"staticFileLoadError",extraInfo:{staticFileType:i,error:"".concat(r," load fail: ").concat(t)}})}}},un=new rn({name:"errorDetectionPlugin",setUp:function(n){T=n,window.addEventListener("error",on),window.addEventListener("unhandledrejection",an),window.document.addEventListener("error",sn,!0)},destroy:function(){window.removeEventListener("unhandledrejection",an),window.document.removeEventListener("error",sn,!0),window.removeEventListener("error",on)}}),cn=["img","css","script","link","audio","video","iframe"],ln="resource",dn=function(n){var e,t=n.name;return{url:(e=t,"string"==typeof e?(e.split("?")[0]||"").slice(0,200):e),method:"get",duration:Number(n.duration.toFixed(2)),type:"static",isHttps:X(t),urlQuery:W(t),domainLookup:V(n.domainLookupEnd-n.domainLookupStart),connectTime:V(n.connectEnd-n.connectStart)}},fn=function(n,e){for(var t=0,r=n.length;t<r;t++){var i=n[t];-1!==cn.indexOf(i.initiatorType)&&G(i.name,e)&&e.normalLogPipeLine({severity:"performance",eventName:"assets_speed",extraInfo:{log:dn(i)}})}},vn=new rn({name:"assetsSpeedPlugin",setUp:function(n){if(void 0!==window.performance&&"function"==typeof window.performance.clearResourceTimings&&"function"==typeof window.performance.getEntriesByType&&"function"==typeof window.performance.now){var e=0;window.performance.onresourcetimingbufferfull=function(){e=0,window.performance.clearResourceTimings()},"function"==typeof window.PerformanceObserver?(fn(window.performance.getEntriesByType(ln),n),(P=new window.PerformanceObserver((function(e){fn(e.getEntries(),n)}))).observe({entryTypes:[ln]})):D=setInterval((function(){var t=window.performance.getEntriesByType(ln),r=t.slice(e);e=t.length,fn(r,n)}),3e3)}},destroy:function(){null==P||P.disconnect(),D&&clearInterval(D)}}),mn=new rn({name:"onPageChangePlugin",setUp:function(){var n=h((function(n){var e,t,r,i;return C(this,(function(){return t=null===(e=location)||void 0===e?void 0:e.href,r=document.querySelector("body"),i=function(e){var t,r,i,o,a;n.normalLogPipeLine({severity:"autoDetectEvent",eventName:"onPageChange",extraInfo:{prevHref:e.prevHref,href:(null===(t=location)||void 0===t?void 0:t.href)||"",hostname:null===(r=location)||void 0===r?void 0:r.hostname,pathName:null===(i=location)||void 0===i?void 0:i.pathname,protocol:null===(o=location)||void 0===o?void 0:o.protocol,search:null===(a=location)||void 0===a?void 0:a.search}})},i({prevHref:""}),(R=new MutationObserver((function(){if(location.href!==t){var n=t;t=location.href,i({prevHref:n})}}))).observe(r||document,{subtree:!0,childList:!0}),[2]}))}));return function(e){return n.apply(this,arguments)}}(),destroy:function(){null==R||R.disconnect()}}),pn=new rn({name:"onPageRetentionPlugin",setUp:function(){var n=h((function(n){var e,t,r,i,o,a;return C(this,(function(){return void 0===document.visibilityState||(t=null===(e=location)||void 0===e?void 0:e.href,r=document.querySelector("body"),(o=function(){i=Date.now()})(),document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState?a({href:location.href,leftReason:"visibilityChange"}):"visible"===document.visibilityState&&o()})),window.addEventListener("beforeunload",(function(){a({href:location.href,sendImmediate:!0,leftReason:"pageClose"})})),a=function(e){var t=e.href,r=e.sendImmediate,o=e.leftReason;if(i){var a=Date.now()-i;if(0!==a){i=void 0;var s={severity:"autoDetectEvent",eventName:"onPageRetention",extraInfo:{href:t,duration:a,leftReason:o}};r?n.ImmediatePipeline(s):n.normalLogPipeLine(s)}}},(O=new MutationObserver((function(){if(location.href!==t){var n=t;t=location.href,a({href:n,leftReason:"nextPage"}),o()}}))).observe(r||document,{subtree:!0,childList:!0})),[2]}))}));return function(e){return n.apply(this,arguments)}}(),destroy:function(){null==O||O.disconnect()}}),hn=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2,15)},yn=function(n,e){return![/authenticate\/heartbeat/,/papluginlogs\/.*/,/airtracker\/.*/,/o11y(-staging|-demo)?\.airwallex\.com/,/\.(png|jpe?g|gif|svg|ico|webp|avif|css|js|json|woff2?|ttf|eot|map|txt|csv|xml)(\?.*)?(#.*)?$/i].some((function(e){return e.test(n)}))&&J(n,e||[/^https?:\/\/[^\/]*\.airwallex\.com($|\/)/])},wn=function(n){return Math.round(100*n)/100},gn=function(n,e){var t,r,i,o,a,s,u,c,l,d,f,v,m,p,h,y,w,g,b,E=n.url,I=n.method,S=n.errorType,N=n.errorDetail,C=function(n){var e=n.startTime,t=n.endTime,r=n.entries;if(0!==r.length){if(1===r.length)return r[0];var i=r.filter((function(n){return n.startTime>=e&&t&&n.responseEnd<=t})).sort((function(n,e){return n.startTime-e.startTime}));return null==i?void 0:i[0]}}(n),T=new URL(E,window.location.href),D=T.href,P=T.protocol,R=C?(i=(t=C).duration,o=t.responseStart,a=t.connectEnd,s=t.connectStart,u=t.domainLookupEnd,c=t.domainLookupStart,l=t.requestStart,d=t.secureConnectionStart,f=t.redirectEnd,v=t.redirectStart,m=t.responseStatus,p=t.responseEnd,h=t.encodedBodySize,y=t.decodedBodySize,w=t.transferSize,g=t.deliveryType,b=t.initiatorType,{startTime:wn(r=t.startTime),totalDuration:wn(i),timeToFirstByte:$(o,r),tcpDuration:$(a,s),dnsDuration:$(u,c),tlsDuration:$(l,d),redirectDuration:$(f,v),responseDuration:$(p,o),encodeResponseSize:h,decodeResponseSize:y,transferSize:w,deliveryType:g,statusCode:m,initiatorType:b}):{};return{severity:"autoDetectEvent",eventName:"httpClientMetrics",extraInfo:k(x(k({httpUrl:D,method:I,scheme:P},S&&{errorType:S},N&&{errorDetail:N},R),{statusCode:(null==R?void 0:R.statusCode)||(null==n?void 0:n.responseStatus),startTime:(null==R?void 0:R.startTime)||(null==n?void 0:n.startTime),initiatorType:(null==R?void 0:R.initiatorType)||(null==n?void 0:n.initiatorType)}),e)}},bn=function(n){return n&&"object"===(void 0===n?"undefined":S(n))&&"errors"in n&&Array.isArray(n.errors)&&n.errors.every((function(n){return n&&"object"===(void 0===n?"undefined":S(n))&&"message"in n}))},kn="awx_airtracker_api_performance_queue",xn="awx_airtracker_api_performance_plugin_loaded",En="undefined"!=typeof window?window:"undefined"!=typeof global?global:{};En[kn]=En[kn]||[];var In=function(n,e,t){setTimeout((function(){var r=gn(n,t);e.observerPipeline(r),En[kn]=En[kn].filter((function(e){return e.id!==n.id}))}),300)},Sn=function(n,e){setTimeout((function(){var t=En[kn].find((function(e){return e.id===n}));if(t){var r=gn(t,{exceptionType:"timeout-without-response"});e.observerPipeline(r),En[kn]=En[kn].filter((function(e){return e.id!==n}))}}),1e4)},Nn=new rn({name:"apiPerformancePlugin",setUp:function(){var n=h((function(n){var e,t;return C(this,(function(){return En[xn]||(null===(e=n.config)||void 0===e?void 0:e.enableRecordAPIPerformance)&&Math.random()<((null===(t=n.config)||void 0===t?void 0:t.enableRecordAPIPerformancePercentage)||0)&&(En[xn]=!0,function(n){var e;(function(n){var e=XMLHttpRequest.prototype.open,t=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function(t,r,i,o,a){try{var s,u=hn();this.__requestId=u;var c=b(r,URL)?r.href:new URL(r,window.location.href).href;if(!yn(c,null===(s=n.config)||void 0===s?void 0:s.enableRecordAPIPerformanceWhitelist))return e.call(this,t,r,null==i||i,o,a);var l={id:u,startTime:performance.now(),method:t,url:c,entries:[],initiatorType:"xmlhttprequest"};return En[kn].push(l),Sn(u,n),e.call(this,t,r,null==i||i,o,a)}catch(s){return n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject XHR open error",error:s}}),e.call(this,t,r,null==i||i,o,a)}},XMLHttpRequest.prototype.send=function(){for(var e=this,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];try{var a=En[kn].find((function(n){return n.id===e.__requestId}));if(!a)return t.apply(this,i);var s=this;return this.addEventListener("loadend",h((function(){var e,t,r,i,o,u,c;return C(this,(function(l){switch(l.label){case 0:if(e=performance.now(),t=e-a.startTime,0===(r=s.status))return[2];a.endTime=e,a.duration=t,a.responseStatus=r,l.label=1;case 1:return l.trys.push([1,6,,7]),""!==s.responseType&&"text"!==s.responseType?[3,2]:(i=s.responseText,[3,5]);case 2:return"json"!==s.responseType?[3,3]:(i=s.response,[3,5]);case 3:return"blob"!==s.responseType||"application/json"!==(null==(o=s.response)?void 0:o.type)?[3,5]:[4,o.text()];case 4:i=l.sent(),l.label=5;case 5:return(u=i&&"string"==typeof i?JSON.parse(i):i)&&bn(u)&&(a.errorType="graphqlError",a.errorDetail=u.errors),[3,7];case 6:return c=l.sent(),n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in XHR",url:null==a?void 0:a.url,error:c}}),[3,7];case 7:return In(a,n),[2]}}))}))),this.addEventListener("error",(function(){In(a,n,{exceptionType:"network-error"})})),this.addEventListener("abort",(function(){In(a,n,{exceptionType:"abort-error"})})),this.addEventListener("timeout",(function(){In(a,n,{exceptionType:"timeout-error"})})),t.apply(this,i)}catch(e){throw n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"InjectXHR send error",error:e}}),e}}})(n),function(n){var e=window.fetch;window.fetch=h((function(){var t,r,i,o,a,s,u,c,l,d,f,v,m,p,h,y,w=arguments;return C(this,(function(g){switch(g.label){case 0:for(t=w.length,r=new Array(t),i=0;i<t;i++)r[i]=w[i];return s=new URL(b(r[0],Request)?r[0].url:String(r[0]),window.location.href).href,yn(s,null===(o=n.config)||void 0===o?void 0:o.enableRecordAPIPerformanceWhitelist)?[3,2]:[4,e.apply(this,r)];case 1:return[2,g.sent()];case 2:return g.trys.push([2,9,,10]),c=performance.now(),l=hn(),a={id:l,startTime:c,method:(null===(u=b(r[0],Request)?r[0]:r[1])||void 0===u?void 0:u.method)||"GET",url:s,entries:[],initiatorType:"fetch"},En[kn].push(a),Sn(l,n),[4,e.apply(this,r)];case 3:d=g.sent(),f=performance.now(),a.endTime=f,a.duration=f-c,a.responseStatus=d.status,v=d.clone(),g.label=4;case 4:return g.trys.push([4,7,,8]),v.ok?[4,v.json()]:[3,6];case 5:(m=g.sent())&&bn(m)&&(a.errorType="graphqlError",a.errorDetail=m.errors),g.label=6;case 6:return[3,8];case 7:return p=g.sent(),n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in fetch",url:null==a?void 0:a.url,error:p}}),[3,8];case 8:return In(a,n),[2,d];case 9:throw h=g.sent(),a&&a.id&&En[kn].find((function(n){return n.id===(null==a?void 0:a.id)}))?(y="fetch-error",b(h,TypeError)?y="network-error":b(h,DOMException)&&"AbortError"===h.name&&(y="abort-error"),In(a,n,{exceptionType:y})):n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject fetch error",error:h}}),h;case 10:return[2]}}))}))}(n),(null===(e=window)||void 0===e?void 0:e.PerformanceObserver)?new window.PerformanceObserver((function(n){n.getEntries().forEach((function(n){var e=n;"fetch"!==e.initiatorType&&"xmlhttprequest"!==e.initiatorType||En[kn].filter((function(n){return n.url===e.name})).forEach((function(n){n.entries.push(e)}))}))})).observe({entryTypes:["resource"],buffered:!0}):n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{error:"PerformanceObserver Not Supported"}})}(n)),[2]}))}));return function(e){return n.apply(this,arguments)}}()}),Cn=function(){function n(e){var t,r,i=this,o=e.config,a=e.plugins,s=void 0===a?[]:a;y(this,n),this.config=A,this.lifeCycle=new tn,this.plugins=[],this._commonData=L,this._MFECommonDataMap={},this.timeMap={},this.packedDataConvert=function(n){var e,t,r=n.extraInfo,o=k({severity:n.severity,eventName:n.eventName,currentHref:i.config.hideSearchParams?((null===(e=location)||void 0===e?void 0:e.href)||"").split("?")[0]||"":(null===(t=location)||void 0===t?void 0:t.href)||""},r);return i.config.isWebappContainer&&(o.MFEName=B(i)),o},this.normalPipelineObj=en([Z(this,8),(t=this,r={},function(n,e){var i="number"==typeof t.config.errorRepeatTime?t.config.errorRepeatTime:5;if(0===i)return null==e?void 0:e(n);null==e||e(n.filter((function(n){return"autoDetectError"!=n.severity||(r[n.error]=r[n.error]||0,r[n.error]+=1,!(r[n.error]>i))})))}),Q(this)]),this.observerPipelineObj=en([Z(this,8),Y(this)]),this.immediateSendPipe=Q(this),this.observerPipeline=function(n){var e=i.packedDataConvert({severity:n.severity,eventName:n.eventName,extraInfo:n.extraInfo});return i.observerPipelineObj(e)},this.normalLogPipeLine=function(n){var e=i.packedDataConvert({severity:n.severity,eventName:n.eventName,extraInfo:n.extraInfo});return i.config.disableThrottle?i.immediateSendPipe(e):i.normalPipelineObj(e)},this.ImmediatePipeline=function(n){var e=i.packedDataConvert({severity:n.severity,eventName:n.eventName,extraInfo:n.extraInfo});return i.immediateSendPipe(e)},this.plugins=I(s),this.setConfig(o),this.initCommonData(o),this.lifeCycle.emit("onInit"),o.enableErrorMonitoring&&this.plugins.push(un),((null==o?void 0:o.assetSpeedMonitoringWhiteList)&&o.assetSpeedMonitoringWhiteList.length>0||o.isWebappContainer)&&this.plugins.push(vn),(null==o?void 0:o.enableDetectPageChange)&&this.plugins.push(mn),(null==o?void 0:o.enableRecordPageRetention)&&this.plugins.push(pn),(null==o?void 0:o.enableRecordAPIPerformance)&&(null==o?void 0:o.enableRecordAPIPerformancePercentage)&&o.enableRecordAPIPerformancePercentage>0&&o.enableRecordAPIPerformancePercentage<=1&&this.plugins.push(Nn),this.installPlugins()}return w(n,[{key:"installPlugins",value:function(){var n=this;this.plugins.forEach((function(e){e.patch(n)}))}},{key:"commonData",get:function(){return this._commonData}},{key:"MFECommonDataMap",get:function(){return this._MFECommonDataMap}},{key:"initCommonData",value:function(n){this._commonData.sessionId=n.useSessionStorageForSessionId?function(){try{var n=window.sessionStorage.getItem(H);return n||(n=z(),window.sessionStorage.setItem(H,n)),n}catch(n){return z()}}():z(),this._commonData.deviceId=function(){try{var n=window.localStorage.getItem(q);return n||(n=z(),window.localStorage.setItem(q,n)),n}catch(n){}}()||_,this._commonData.riskDeviceId=function(){try{return window.localStorage.getItem("AWX_RISK_ID")||void 0}catch(n){}}(),this._commonData.networkType=function(){var n,e,t="",r=navigator.userAgent.match(/NetType\/(\w+)/);if(r)t=E(r,2)[1];else if(null===(n=navigator)||void 0===n?void 0:n.connection){var i,o,a,s;t=(null===(o=navigator)||void 0===o||null===(i=o.connection)||void 0===i?void 0:i.effectiveType)||(null===(s=navigator)||void 0===s||null===(a=s.connection)||void 0===a?void 0:a.type)}return t||(t="unknown"),e=t,(e=String(e).toLowerCase()).indexOf("4g")>=0?"net4g":e.indexOf("wifi")>=0?"wifi":e.indexOf("5g")>=0?"net5g":e.indexOf("3g")>=0?"net3g":e.indexOf("2g")>=0?"net2g":"unknown"}()||"unknown",this._commonData.env=n.env||this._commonData.env,this._commonData.accountId=n.accountId||_,this._commonData.appVersion=n.appVersion,this._commonData.appName=n.appName,this._commonData.sdkVersion="3.1.0",this.lifeCycle.emit("onCommonDataInit",this.commonData)}},{key:"updateCommonDataBasedOnConfig",value:function(n){this.lifeCycle.emit(K,this._commonData),this._commonData.env=n.env||this._commonData.env,this._commonData.appName=n.appName||this._commonData.appName,this._commonData.env=n.env||this._commonData.env,this._commonData.accountId=n.accountId||this._commonData.accountId,this._commonData.appVersion=n.appVersion||this._commonData.appVersion}},{key:"updateCommonData",value:function(n){this.lifeCycle.emit(K,this._commonData),this._commonData=k({},this._commonData,n)}},{key:"removeCommonDataByKey",value:function(n){var e=this;this.lifeCycle.emit(K,this._commonData),setTimeout((function(){n.forEach((function(n){delete e._commonData[n]}))}),1e3)}},{key:"addToMFECommonData",value:function(n){var e,t=n.MFEName,r=n.MFECommonData;this.config.isWebappContainer&&t&&r&&(this._MFECommonDataMap=x(k({},this._MFECommonDataMap||{}),g({},t,k({},(null===(e=this._MFECommonDataMap)||void 0===e?void 0:e[t])||{},r))))}},{key:"setConfig",value:function(n){var e=this;this.config.isWebappContainer||(Object.entries(n).forEach((function(n){var t=E(n,2),r=t[0],i=t[1];void 0!==(void 0===i?"undefined":S(i))&&function(n,t){e.config[n]=t}(r,i)})),this.lifeCycle.emit("onConfigInit",this.config),this.updateCommonDataBasedOnConfig(n))}},{key:"verbose",value:function(n,e){this.normalLogPipeLine({severity:"verbose",eventName:n,extraInfo:e})}},{key:"httpLog",value:function(n,e){this.normalLogPipeLine({severity:"http",eventName:n,extraInfo:e})}},{key:"info",value:function(n,e){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:e})}},{key:"warn",value:function(n,e){this.normalLogPipeLine({severity:"warn",eventName:n,extraInfo:e})}},{key:"error",value:function(n,e){console.error("error",n),this.normalLogPipeLine({severity:"error",eventName:n,extraInfo:e})}},{key:"businessLog",value:function(n,e){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:x(k({},e),{isBusinessLog:!0})})}},{key:"reportDuration",value:function(n,e,t){"string"==typeof n?"number"==typeof e?e<0||e>6e4?console.warn("reportDuration: duration (second param) must between 0 and 60000"):this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:k({duration:e},t)}):console.warn("reportDuration: duration (second param) must be number"):console.warn("reportDuration: eventName (first param) must be a string")}},{key:"getTimerKey",value:function(n){var e=B(this);return this.config.isWebappContainer?"".concat(e,"_").concat(n):n}},{key:"timeStart",value:function(n){"string"==typeof n?(this.timeMap[this.getTimerKey(n)]&&console.warn("Timer ".concat(n," already exists")),this.timeMap[this.getTimerKey(n)]=Date.now()):console.warn("time: first param must be a string")}},{key:"timeEnd",value:function(n,e){if("string"==typeof n)if(this.timeMap[this.getTimerKey(n)]){var t=Date.now()-this.timeMap[this.getTimerKey(n)]+(e||0);this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:{duration:t}}),delete this.timeMap[this.getTimerKey(n)]}else console.warn("Timer key :".concat(n," does not exist"));else console.warn("timeEnd: first param must be a string")}},{key:"addToAssetSpeedWhiteListByMFE",value:function(n){var e,t,r,i,o=n.MFEName,a=n.whiteList;this.config.isWebappContainer&&o&&(null==a?void 0:a.length)&&(this.config.assetSpeedMonitoringWhiteListByMFE||(this.config.assetSpeedMonitoringWhiteListByMFE={}),(null===(e=this.config.assetSpeedMonitoringWhiteListByMFE)||void 0===e?void 0:e[o])?null===(i=this.config.assetSpeedMonitoringWhiteListByMFE)||void 0===i||null===(r=i[o])||void 0===r||(t=r).push.apply(t,I(a)):this.config.assetSpeedMonitoringWhiteListByMFE=x(k({},this.config.assetSpeedMonitoringWhiteListByMFE),g({},o,a)))}},{key:"destroy",value:function(){this.config.isWebappContainer||this.plugins.forEach((function(n){n.uninstall()}))}}]),n}(),Tn=Cn,Dn=function(n,e){return Dn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])},Dn(n,e)};function Pn(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=n}Dn(n,e),n.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t)}var Rn=function(){return Rn=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var i in e=arguments[t])Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n},Rn.apply(this,arguments)};function On(n,e,t,r){return new(t||(t=Promise))((function(e,i){function o(n){try{s(r.next(n))}catch(n){i(n)}}function a(n){try{s(r.throw(n))}catch(n){i(n)}}function s(n){var r;n.done?e(n.value):(r=n.value,r instanceof t?r:new t((function(n){n(r)}))).then(o,a)}s((r=r.apply(n,[])).next())}))}function jn(n,e){var t,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(t=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(n,a)}catch(n){s=[6,n],r=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function _n(n,e){for(var t,r=0,i=e.length;r<i;r++)!t&&r in e||(t||(t=Array.prototype.slice.call(e,0,r)),t[r]=e[r]);return n.concat(t||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var An,Ln,Un,Fn={dev:j.staging,staging:j.staging,demo:j.demo,prod:j.production},Mn=function(n){if("object"!=typeof n)return n;try{var e=JSON.parse(JSON.stringify(n));return Object.keys(e).forEach((function(n){"string"==typeof n&&["auth","code"].some((function(e){return n.includes(e)}))&&(e[n]="***")})),e}catch(e){return n}},Kn=function(n,e){var t,r;null===(r=null===(t=window._AirwallexSDKs)||void 0===t?void 0:t.airTracker)||void 0===r||r.error(n,Rn(Rn({},e),{context:"components-sdk"}))},qn=function(n,e){var t;null===(t=window._AirwallexSDKs.airTracker)||void 0===t||t.info(n,Rn(Rn({},e),{context:"components-sdk"}))},Hn=function(n){function e(e){var t=n.call(this,e)||this;return t.code="LOAD_SCRIPT_ERROR",t}return Pn(e,n),e}(Error);!function(n){n.dev="dev",n.staging="staging",n.demo="demo",n.prod="prod",n.sandbox="sandbox"}(Un||(Un={}));var zn,Bn=((An={})[Un.dev]="https://checkout-staging.airwallex.com",An[Un.staging]="https://checkout-staging.airwallex.com",An[Un.demo]="https://checkout-demo.airwallex.com",An[Un.prod]="https://checkout.airwallex.com",An[Un.sandbox]="https://checkout.sandbox.airwallex.com",An),Wn=((Ln={})[Un.dev]="https://static-staging.airwallex.com",Ln[Un.staging]="https://static-staging.airwallex.com",Ln[Un.demo]="https://static-demo.airwallex.com",Ln[Un.prod]="https://static.airwallex.com",Ln[Un.sandbox]="https://static.sandbox.airwallex.com",Ln),Xn="sdkController",Vn="payments",Gn={kyc:"/widgets/kyc/sdk/v1/index.js",rfi:"/widgets/kycRfi/sdk/v1/index.js",paymentsKyb:"/widgets/paymentsKyb/sdk/v1/index.js",sdkController:"/widgets/sdk-controller/sdk/v1/index.js",payouts:"/widgets/payouts/sdk/v1/index.js",payments:"/assets/elements.bundle.min.js",sca:"/hosted-sca/sdk/v1/index.js",taxForm:"/widgets/taxForm/sdk/v1/index.js",billing:"/widgets/checkout/sdk/v1/index.js"},Jn={kyc:"kyc",paymentsKyb:"paymentsKyb",kycRfi:"rfi",transactionRfi:"rfi",paymentEnablementRfi:"rfi",lendingRfi:"rfi",mrmRfi:"rfi",payoutForm:"payouts",beneficiaryForm:"payouts",hpp:"payments",cvc:"payments",card:"payments",expiry:"payments",dropIn:"payments",cardNumber:"payments",applePayButton:"payments",googlePayButton:"payments",krCardNumber:"payments",krCardIdentifier:"payments",krCardExpiry:"payments",krCardPswFirstTwo:"payments",scaSetup:"sca",scaVerify:"sca",scaManagement:"sca",taxForm:"taxForm",embeddedCheckout:"billing"},$n={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"]},Qn={billing:["payments"]},Yn=["payments","sca","billing"],Zn=function(n){function e(e){var t=n.call(this,e)||this;return t.code="INVALID_STATIC_RESOURCE_ERROR",t}return Pn(e,n),e}(Error),ne=Date.now(),ee=function(n){return Jn[n]},te=function(n){var e=n.reduce((function(n,e){return n.concat((t=e,Object.keys($n).includes(t)?$n[e]:e));var t}),[]);return Array.from(new Set(e)).map((function(n){return{elementName:n,sdkName:ee(n)}}))},re=function(n){return"payments"===n?"payment":n},ie=function(n){var e=n.name,t=n.env,r=function(n,e){var t=n===Vn?Bn:Wn;return t[e]||t.prod}(e,void 0===t?Un.prod:t),i=Gn[e];if(!i)throw Kn("[components-sdk] Element static resource not found",{sdkName:e}),new Zn("Element ".concat(e," static resource URL is invalid."));return"".concat(r).concat(i,"?ts=").concat(ne)},oe=function(){return Math.floor(performance.now())},ae=function(n){function e(e){var t=n.call(this,e)||this;return t.code="INSTANCE_NOT_FOUND_ERROR",t}return Pn(e,n),e}(Error),se=new Map,ue=function(n){var e=n.scriptName,t=ie({name:e,env:n.env}),r=se.get(e);if(r)return r;var i=function(n){return On(void 0,0,void 0,(function(){var e,t;return jn(this,(function(r){switch(r.label){case 0:if("undefined"==typeof window)throw new Error("Please load script in browser environment");e=0,t=function(){return On(void 0,0,void 0,(function(){var t,r,i;return jn(this,(function(){return t=oe(),e>0&&n.includes("?ts=")&&((r=new URL(n,window.location.href)).searchParams.set("ts","".concat(Date.now())),n=r.toString()),i=function(n){var e=document.createElement("script");return e.src=n,e.type="module",(document.head||document.body).appendChild(e),e}(n),[2,new Promise((function(r,o){i.addEventListener("load",(function(){var i=oe();qn("[components-sdk] SDK script loaded",{scriptUrl:n,start:t,latency:i-t,end:i,retryCount:e}),r(!0)})),i.addEventListener("error",(function(r){i.remove(),console.error(r);var a=oe();Kn("[components-sdk] Failed to load script",{scriptUrl:n,error:r,start:t,latency:a-t,end:a,retryCount:e}),o(new Hn("Failed to load Airwallex SDK scripts: ".concat(n)))}))}))]}))}))},r.label=1;case 1:if(!(e<3))return[3,7];r.label=2;case 2:return r.trys.push([2,4,,6]),[4,t()];case 3:return[2,r.sent()];case 4:return r.sent(),e++,[4,(void 0===i&&(i=500),new Promise((function(n){return window.setTimeout(n,i)})))];case 5:return r.sent(),[3,6];case 6:return[3,1];case 7:throw Kn("[components-sdk] Failed to load script after retry",{scriptUrl:n,retryCount:e}),new Hn("Failed to load Airwallex SDK scripts: ".concat(n))}var i}))}))}(t);return se.set(e,i),i},ce=function(n){var e=n.env,t=n.scriptName;return On(void 0,0,void 0,(function(){var n;return jn(this,(function(r){switch(r.label){case 0:return(n=Qn[t]||[]).length>0?[4,Promise.all(n.map((function(n){return ue({env:e,scriptName:n})})))]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2,ue({env:e,scriptName:t})]}}))}))},le=function(n){return On(void 0,0,void 0,(function(){return jn(this,(function(){if("undefined"==typeof window)throw new Error("Please call the `init()` function in a browser environment.");var e,t;return t=n.clientId,void 0===(e=n.env)&&(e=j.production),window._AirwallexSDKs.airTracker||(window._AirwallexSDKs.airTracker=new Tn({config:{appName:"components-sdk",appVersion:"1.35.0",env:Fn[e]||j.production}}),window._AirwallexSDKs.airTracker.updateCommonData({clientId:t})),window,qn("[components-sdk] SDK init start",{options:Mn(n),start:oe()}),zn=new Promise((function(e,t){var r,i=Rn(Rn({},n),{env:n.env&&Un[n.env]?n.env:Un.prod});window.AirwallexComponentsSDK.__env__=i.env;var o=ue({env:i.env,scriptName:Xn}).then((function(){return window._AirwallexSDKs.__controller__.init(i)})),a=null!==(r=n.enabledElements)&&void 0!==r?r:[],s=function(n){return Array.from(new Set(te(n).map((function(n){return n.sdkName})).filter((function(n){return Yn.includes(n)}))))}(a),u=s.map((function(n){return ce({env:i.env,scriptName:n}).then((function(){return o})).then((function(){var e=window._AirwallexSDKs[re(n)];if(!e)throw Kn("[components-sdk] SDK instance not found",{functionsNamespace:n,windowSDKInstanceName:re(n)}),new ae("SDK instance not found");return window._AirwallexSDKs.__controller__.registerFunctions({functionsNamespace:n,instance:e})}))})),c=te(a).map((function(n){var e=n.sdkName,t=n.elementName;return ce({scriptName:e,env:i.env}).then((function(){return o})).then((function(){var n=window._AirwallexSDKs[re(e)];if(!n)throw Kn("[components-sdk] SDK instance not found",{sdkName:e,windowSDKInstanceName:re(e)}),new ae("SDK instance not found");return window._AirwallexSDKs.__controller__.registerElement({sdkName:e,elementName:t,instance:n})}))}));Promise.all(_n(_n([o],u),c)).then((function(){qn("[components-sdk] SDK initialized",{options:Mn(n),start:oe()}),e(Yn.reduce((function(n,e){var t;return Rn(Rn({},n),((t={})[e]=window._AirwallexSDKs.__controller__.internalSDKs[e],t))}),{}))})).catch((function(n){n.code||Kn("[components-sdk] Unexpected errors when init",{error:n}),t(n)}))})),[2,zn]}))}))},de=function(n,e){return On(void 0,0,void 0,(function(){var t,r,i,o,a;return jn(this,(function(s){switch(s.label){case 0:if(!n)throw new Error("Element type is missing. Please specify a valid element.");if(qn("[components-sdk] SDK createElement start",{elementName:n,options:Mn(e),timestamp:oe()}),!zn)throw function(){var n;null===(n=window._AirwallexSDKs.airTracker)||void 0===n||n.warn("[components-sdk] Did not call init before createElement",Rn(Rn({},void 0),{context:"components-sdk"}))}(),new Error("Please initialize the Element before creating it.");return[4,zn];case 1:if(s.sent(),!(t=ee(n)))throw new Error("`createElement()` with type `".concat(n,"` is not supported. Please specify a valid Element type."));r=oe(),s.label=2;case 2:return s.trys.push([2,6,,7]),[4,ce({scriptName:t,env:window.AirwallexComponentsSDK.__env__||Un.prod})];case 3:return s.sent(),[4,window._AirwallexSDKs.__controller__.registerElement({sdkName:t,elementName:n,instance:window._AirwallexSDKs[re(t)]})];case 4:return s.sent(),[4,window._AirwallexSDKs.__controller__.createElement(n,e)];case 5:return i=s.sent(),o=oe(),qn("[components-sdk] SDK createElement being called",{elementName:n,options:Mn(e),start:r,latency:o-r,end:o}),[3,7];case 6:if((a=s.sent()).code)throw a;return Kn("[components-sdk] Unexpected errors when createElement",{error:a}),[3,7];case 7:return[2,i]}}))}))},fe=[Xn,Vn],ve=function(){fe.forEach((function(n){var e=ie({name:n,env:Un.prod}),t=document.createElement("link");t.href=e,t.rel="modulepreload",t.as="script",(document.head||document.body).appendChild(t)}))};"undefined"==typeof document||"undefined"==typeof window||("loading"===document.readyState?document.addEventListener("DOMContentLoaded",ve):ve()),"undefined"!=typeof window&&(window.AirwallexComponentsSDK||Object.defineProperties(window,{AirwallexComponentsSDK:{value:{},writable:!1},_AirwallexSDKs:{value:{},writable:!1}}),window.AirwallexComponentsSDK.init=le,window.AirwallexComponentsSDK.createElement=de);const{onChange:me,reset:pe,state:he}=n((()=>({clientSecret:null,currency:null,hasPaymentError:!1,isReady:!1,paymentConfirmed:!1,paymentIntentId:null}))),ye=n=>"AIRWALLEX"===n.paymentProcessor&&(n.clientSecret&&(he.clientSecret=n.clientSecret),n.paymentIntentId&&(he.paymentIntentId=n.paymentIntentId),!!he.clientSecret||(o("Airwallex checkout session is missing the client secret"),!1)),we={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"},ge=n=>we[n]||"en";let be=null;const ke=async()=>!!he.isReady||(be||(be=le({enabledElements:["payments"],env:e.zonosMode&&"production"!==e.zonosMode||"LIVE"!==e.checkoutSettings.mode?"demo":"prod",locale:ge(r.selectedLocale)}).then((()=>(he.isReady=!0,u("Airwallex SDK initialized"),!0))).catch((n=>(o(n),be=null,!1)))),be),xe=["SUCCEEDED","REQUIRES_CAPTURE","PENDING_REVIEW","PENDING"],Ee=n=>!!n&&xe.includes(n),Ie=n=>{switch(n){case"SUCCEEDED":return{isError:!1,messages:[t("Thank you for submitting your payment. We appreciate your prompt attention."),"",t("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]};case"PENDING":case"PENDING_REVIEW":case"REQUIRES_CAPTURE":return{isError:!1,messages:[t("Payment processing. We'll update you when payment is received.")]};case"REQUIRES_CUSTOMER_ACTION":return{isError:!1,messages:[t("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]};case"CANCELLED":case"REQUIRES_PAYMENT_METHOD":return{isError:!0,messages:[t("Payment failed. Please reload the page and try another payment method.")]};default:return{isError:!0,messages:[t("Something went wrong.")]}}},Se=async n=>{const{errors:e,json:t}=await a("/api/zonos-elements/collect/airwallex-payment-intent",{body:{paymentIntentId:n},method:"POST"});return e.length||!t?(o("Failed to retrieve Airwallex payment intent",e),{status:null}):{status:t.airwallexPaymentIntent.status}},{state:Ne}=n((()=>({amountDutyTaxFeeTotal:null,amountTotalPaid:null,collectLogoUrl:null,isFetchingShippingInfo:!0,landedCostShortId:null,originCompanyName:null,partyBillingId:null,paymentProcessor:null,shippingAddress:null}))),Ce=async({landedCostId:n,retries:t=5})=>{var r,i,o,u,c,d,f,v,m,p;Ne.isFetchingShippingInfo=!0;const h=await a("/api/zonos-elements/collect/get-shipping-info-by-lc-id",{body:{landedCostId:n},method:"POST"});if(h.errors.length)return t>0?(await new Promise((n=>setTimeout(n,1e3))),Ce({landedCostId:n,retries:t-1})):null;Ne.landedCostShortId=(null===(r=h.json)||void 0===r?void 0:r.landedCostShortId)||null,Ne.isFetchingShippingInfo=!1,Ne.shippingAddress=(null===(i=h.json)||void 0===i?void 0:i.shipping)||null;const y=null===(o=l.checkoutSession)||void 0===o?void 0:o.landedCost,w=null===(u=l.checkoutSession)||void 0===u?void 0:u.subtotals,g=((null===(c=null==y?void 0:y.amountSubtotals)||void 0===c?void 0:c.shipping)||0)+((null===(d=null==y?void 0:y.amountSubtotals)||void 0===d?void 0:d.items)||0);Ne.amountTotalPaid=g*((null===(f=null==w?void 0:w.exchangeRate)||void 0===f?void 0:f.rate)||1),Ne.amountDutyTaxFeeTotal=((null==w?void 0:w.duties)||0)+((null==w?void 0:w.taxes)||0)+((null==w?void 0:w.fees)||0),Ne.originCompanyName=(null===(m=null===(v=h.json)||void 0===v?void 0:v.origin)||void 0===m?void 0:m.companyName)||null,Ne.collectLogoUrl=(null===(p=h.json)||void 0===p?void 0:p.collectLogoUrl)||null,0===Ne.amountTotalPaid&&s({endpoint:"COLLECT_NO_TOTAL_PAID",errors:[],metadata:{landedCostId:n,organizationId:e.organizationId}})},Te=async()=>{var n,e,t,r;if(!(null===(n=f.stripeBillingAddressEventData)||void 0===n?void 0:n.complete))return{partiesCreated:!1};const u=null===(t=null===(e=l.checkoutSession)||void 0===e?void 0:e.landedCost)||void 0===t?void 0:t.rootId;if(!u)return s({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:c,cartId:window.Zonos.cartId,checkoutSessionId:i.checkoutSessionId}}),{partiesCreated:!1};if(!i.checkoutSessionId)return s({endpoint:"COLLECT_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:c,cartId:window.Zonos.cartId,landedCostRootId:u}}),{partiesCreated:!1};const d=v({address:f.stripeBillingAddressEventData.value.address,firstName:f.stripeBillingAddressEventData.value.firstName,lastName:f.stripeBillingAddressEventData.value.lastName,name:f.stripeBillingAddressEventData.value.name,phone:f.stripeBillingAddressEventData.value.phone}),m="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:p,json:h}=await a("/api/zonos-elements/create-billing-party",{body:{billingAddress:d,checkoutSessionId:i.checkoutSessionId,companyName:f.companyName,email:(null===(r=f.stripeLinkEventData)||void 0===r?void 0:r.value.email)||"",isTest:m,rootId:u},method:"POST"});return p.length||!h?(o("Error occurs when creating billing party",JSON.stringify(p,null,2)),s({endpoint:"COLLECT_BILLING_PARTY_CREATE_FAILED",errors:["[COLLECT] Failed to create billing party"],metadata:{allLogs:c,cartId:window.Zonos.cartId,checkoutSessionId:i.checkoutSessionId,errors:p,json:h}}),{partiesCreated:!1}):(Ne.partyBillingId=h.billToPartyId,{partiesCreated:!0})},De=async n=>{const e=n.landedCost;return!!e&&(l.landedCostData=[Object.assign(Object.assign({},n),{landedCost:Object.assign({},e),landedCostId:e.id})],d({applySubtotalsOnly:!0,landedCostId:e.id,selectedShippingOption:e.shipmentRating}))};export{ye as a,he as b,Ne as c,Se as d,Ee as e,ke as f,De as g,Ce as h,Te as i,Ie as j,pe as k,de as l,ge as m,me as n}
|
|
1
|
+
import{c as n,z as e}from"./p-W82paT5F.js";import{t,l as r,s as i}from"./p-clDfq9AL.js";import{l as o,h as a,s}from"./p-DE4a-QD5.js";import{l as u,b as c}from"./p-BJmZPrZl.js";import{d as l,Y as d,b as f,a0 as v}from"./p-FRWZayxL.js";function m(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function p(n,e,t,r,i,o,a){try{var s=n[o](a),u=s.value}catch(n){return void t(n)}s.done?e(u):Promise.resolve(u).then(r,i)}function h(n){return function(){var e=this,t=arguments;return new Promise((function(r,i){var o=n.apply(e,t);function a(n){p(o,r,i,a,s,"next",n)}function s(n){p(o,r,i,a,s,"throw",n)}a(void 0)}))}}function y(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function w(n,e){return e&&function(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}(n.prototype,e),n}function b(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function g(n,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](n):n instanceof e}function k(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})))),r.forEach((function(e){b(n,e,t[e])}))}return n}function x(n,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):function(n){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);e.push.apply(e,t)}return e}(Object(e)).forEach((function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))})),n}function E(n,e){return function(n){if(Array.isArray(n))return n}(n)||function(n,e){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=t){var r,i,o=[],a=!0,s=!1;try{for(t=t.call(n);!(a=(r=t.next()).done)&&(o.push(r.value),o.length!==e);a=!0);}catch(n){s=!0,i=n}finally{try{a||null==t.return||t.return()}finally{if(s)throw i}}return o}}(n,e)||N(n,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(n){return function(n){if(Array.isArray(n))return m(n)}(n)||function(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}(n)||N(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(n){return n&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n}function N(n,e){if(n){if("string"==typeof n)return m(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?m(n,e):void 0}}function C(n,e){var t,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(n,a)}catch(n){o=[6,n],r=0}finally{t=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var D,T,P,R,O,j=function(n){return n.production="prod",n.demo="demo",n.staging="staging",n}(j||{}),A="airTracker_unknown",_={appName:A,appVersion:A,env:"staging",isWebappContainer:!1,delay:2e3,errorRepeatTime:3,enableErrorMonitoring:!1,assetSpeedMonitoringWhiteList:[],enableDetectPageChange:!1,enableRecordPageRetention:!1,hideSearchParams:!1,useSessionStorageForSessionId:!1,assetSpeedMonitoringWhiteListByMFE:{}},L={appName:A,env:"staging",sessionId:A,deviceId:A},U=function(){var n=new WeakSet;return function(e,t){if(g(t,Error))return"Error.message: ".concat(t.message," \n Error.stack: ").concat(t.stack);if("object"===(void 0===t?"undefined":S(t))&&null!==t){if(n.has(t))return"[Circular ".concat(e||"root","]");n.add(t)}return"function"==typeof t?"function":"symbol"===(void 0===t?"undefined":S(t))?"symbol":void 0===t?null:t}},F=function(n){if("string"==typeof n)return n;try{return g(n,Error)?(JSON.stringify(n,U())||"undefined").replace(/"/gim,""):JSON.stringify(n,U())}catch(n){return'{"error":"error happen when airTracker stringify"}'}},M=function(n){var e=n.method,t=void 0===e?"post":e,r=n.url,i=n.data,o=n.success,a=n.fail;if((s=i)&&!/^\s*$/.test(s)&&(s=(s=(s=s.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@")).replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]")).replace(/(?:^|:|,)(?:\s*\[)+/g,""),/^[\],:{}\s]*$/.test(s))){var s,u=new XMLHttpRequest;u.addEventListener("readystatechange",(function(){4===u.readyState&&(u.status>=400||0===u.status?null==a||a(u.response):null==o||o(u.response))})),u.open(t,r),u.setRequestHeader("Content-Type","application/json"),u.send(i)}},K="onCommonUpdated",H="AIR_ANALYTICS_DEVICE_ID",q="AIR_ANALYTICS_SESSION_ID",z=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(n){var e=16*Math.random()|0;return("x"===n?e:3&e|8).toString(16)}))},B=function(n){var e,t,r;return n.config.getMFEName?n.config.getMFEName():(null===(r=location)||void 0===r||null===(t=r.pathname)||void 0===t||null===(e=t.split("/"))||void 0===e?void 0:e[2])||"unknown"},W=function(n){return"string"==typeof n?n.split("?")[1]||"":n},X=function(n){return"string"==typeof n&&n.startsWith("//")?"undefined"!=typeof location&&"https:"===location.protocol:/^https/.test(n)},V=function(n){return"number"==typeof n||"string"==typeof n?n:-1},G=function(n,e){var t,r=!1;if(!e.config.isWebappContainer)return J(n,e.config.assetSpeedMonitoringWhiteList);var i=B(e);return r||J(n,null===(t=e.config.assetSpeedMonitoringWhiteListByMFE)||void 0===t?void 0:t[i])},J=function(n,e){if(!(null==e?void 0:e.length))return!1;for(var t=0;t<e.length;t++){var r=e[t];if(g(r,RegExp)&&r.test(n))return!0;if("string"==typeof r&&n.includes(r))return!0}return!1},$=function(n,e){return Math.round(100*(n-e))/100},Q=function(n){return function(e){var t,r,i=B(n),o=n.config.isWebappContainer?k({},n.commonData||{},(null===(t=n.MFECommonDataMap)||void 0===t?void 0:t[i])||{}):n.commonData,a=Array.isArray(e)?e:[e];if(0!==a.length){var s,u=F({commonData:o,data:a}),c={method:"post",url:(s=n.commonData.env,"prod"==s?"https://o11y.airwallex.com/airtracker/logs":"demo"==s?"https://o11y-demo.airwallex.com/airtracker/logs":"https://o11y-staging.airwallex.com/airtracker/logs"),data:u};"function"==typeof(null===(r=navigator)||void 0===r?void 0:r.sendBeacon)&&navigator.sendBeacon(c.url,u)||M(c)}}},Y=function(n){return function(e){var t,r,i,o=B(n),a={commonData:n.config.isWebappContainer?k({},n.commonData||{},(null===(t=n.MFECommonDataMap)||void 0===t?void 0:t[o])||{}):n.commonData,data:Array.isArray(e)?e:[e]},s=F(a),u={method:"post",url:(i=n.commonData.env,"prod"==i?"https://o11y.airwallex.com/airtracker/metrics":"demo"==i?"https://o11y-demo.airwallex.com/airtracker/metrics":"https://o11y-staging.airwallex.com/airtracker/metrics"),data:s};"function"==typeof(null===(r=navigator)||void 0===r?void 0:r.sendBeacon)&&navigator.sendBeacon(u.url,s)||M(u)}},Z=function(n,e){var t,r=[],i=n.config;return window.addEventListener("beforeunload",(function(){r.length>0&&(n.immediateSendPipe(r.splice(0,r.length)),t&&clearTimeout(t))})),function(o,a){if(r.push(o),n.lifeCycle.on(K,(function(){r.length>0&&(null==a||a(r.splice(0,r.length)),n.lifeCycle.remove(K),t&&clearTimeout(t))})),r.length>=e)return null==a||a(r.splice(0,r.length)),void(t&&clearTimeout(t));t&&clearTimeout(t),t=setTimeout((function(){t=null,r.length>0&&(null==a||a(r.splice(0,r.length)),n.lifeCycle.remove(K))}),i.delay)}},nn=function(){},en=function(n){if(!n||!n.reduce||!n.length)throw new TypeError("createPipeline need at least one function param");return 1===n.length?function(e,t){n[0](e,t||nn)}:n.reduce((function(n,e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nn;return n(t,(function(n){return null==e?void 0:e(n,r)}))}}))},tn=function(){function n(){var e=this;y(this,n),this.emit=function(n,t){if(e){var r,i=e.eventsList[n];if(null==i?void 0:i.length){i=i.slice();for(var o=0;o<i.length;o++){r=i[o];try{var a=r.callback.apply(e,[t]);if(1===r.type&&e.remove(n,r.callback),!1===a)break}catch(n){throw n}}}return e}},this.eventsList={}}return w(n,[{key:"indexOf",value:function(n,e){for(var t=0;t<n.length;t++)if(n[t].callback===e)return t;return-1}},{key:"on",value:function(n,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(this){var r=this.eventsList[n];return r||(this.eventsList[n]=[],r=this.eventsList[n]),-1===this.indexOf(r,e)?(r.push({name:n,type:t||0,callback:e}),this):this}}},{key:"one",value:function(n,e){this.on(n,e,1)}},{key:"remove",value:function(n,e){if(this){var t=this.eventsList[n];if(!t)return null;if(!e){try{delete this.eventsList[n]}catch(n){}return null}if(t.length){var r=this.indexOf(t,e);t.splice(r,1)}return this}}},{key:"clear",value:function(){this.eventsList={}}}]),n}(),rn=function(){function n(e){y(this,n),this.name="",this.isInit=!1,this.name=e.name,this.option=e}return w(n,[{key:"patch",value:function(n){var e,t;this.isInit||(this.isInit=!0,null===(t=this.option)||void 0===t||null===(e=t.setUp)||void 0===e||e.call(this.option,n))}},{key:"uninstall",value:function(){var n,e;null===(e=this.option)||void 0===e||null===(n=e.destroy)||void 0===n||n.apply(this),this.isInit=!1}}]),n}(),on=function(n){var e="".concat(F(n.message)||""," @ (").concat(F(n.filename)||"",":").concat(n.lineno||0,":").concat(n.colno||0,")\n").concat(F(n.error||""));D.normalLogPipeLine({severity:"autoDetectError",eventName:"windowOnError",extraInfo:{error:e}})},an=function(n){var e=n&&F(n.reason);D.normalLogPipeLine({severity:"autoDetectError",eventName:"promiseError",extraInfo:{error:e}})},sn=function(n){var e=(null==n?void 0:n.target)||(null==n?void 0:n.srcElement);if(e){var t=(null==e?void 0:e.src)||(null==e?void 0:e.href),r=e.tagName,i="unknown";if("string"==typeof t&&r){if(window.location.href.indexOf(t)>-1)return;if(/\.js$/.test(t))i="script";else if(/\.css$/.test(t))i="css";else switch(r.toLowerCase()){case"script":i="script";break;case"link":i="css";break;case"img":i="image";break;case"audio":case"video":i="media";break;default:return}D.normalLogPipeLine({severity:"autoDetectError",eventName:"staticFileLoadError",extraInfo:{staticFileType:i,error:"".concat(r," load fail: ").concat(t)}})}}},un=new rn({name:"errorDetectionPlugin",setUp:function(n){D=n,window.addEventListener("error",on),window.addEventListener("unhandledrejection",an),window.document.addEventListener("error",sn,!0)},destroy:function(){window.removeEventListener("unhandledrejection",an),window.document.removeEventListener("error",sn,!0),window.removeEventListener("error",on)}}),cn=["img","css","script","link","audio","video","iframe"],ln="resource",dn=function(n){var e,t=n.name;return{url:(e=t,"string"==typeof e?(e.split("?")[0]||"").slice(0,200):e),method:"get",duration:Number(n.duration.toFixed(2)),type:"static",isHttps:X(t),urlQuery:W(t),domainLookup:V(n.domainLookupEnd-n.domainLookupStart),connectTime:V(n.connectEnd-n.connectStart)}},fn=function(n,e){for(var t=0,r=n.length;t<r;t++){var i=n[t];-1!==cn.indexOf(i.initiatorType)&&G(i.name,e)&&e.normalLogPipeLine({severity:"performance",eventName:"assets_speed",extraInfo:{log:dn(i)}})}},vn=new rn({name:"assetsSpeedPlugin",setUp:function(n){if(void 0!==window.performance&&"function"==typeof window.performance.clearResourceTimings&&"function"==typeof window.performance.getEntriesByType&&"function"==typeof window.performance.now){var e=0;window.performance.onresourcetimingbufferfull=function(){e=0,window.performance.clearResourceTimings()},"function"==typeof window.PerformanceObserver?(fn(window.performance.getEntriesByType(ln),n),(P=new window.PerformanceObserver((function(e){fn(e.getEntries(),n)}))).observe({entryTypes:[ln]})):T=setInterval((function(){var t=window.performance.getEntriesByType(ln),r=t.slice(e);e=t.length,fn(r,n)}),3e3)}},destroy:function(){null==P||P.disconnect(),T&&clearInterval(T)}}),mn=new rn({name:"onPageChangePlugin",setUp:function(){var n=h((function(n){var e,t,r,i;return C(this,(function(){return t=null===(e=location)||void 0===e?void 0:e.href,r=document.querySelector("body"),i=function(e){var t,r,i,o,a;n.normalLogPipeLine({severity:"autoDetectEvent",eventName:"onPageChange",extraInfo:{prevHref:e.prevHref,href:(null===(t=location)||void 0===t?void 0:t.href)||"",hostname:null===(r=location)||void 0===r?void 0:r.hostname,pathName:null===(i=location)||void 0===i?void 0:i.pathname,protocol:null===(o=location)||void 0===o?void 0:o.protocol,search:null===(a=location)||void 0===a?void 0:a.search}})},i({prevHref:""}),(R=new MutationObserver((function(){if(location.href!==t){var n=t;t=location.href,i({prevHref:n})}}))).observe(r||document,{subtree:!0,childList:!0}),[2]}))}));return function(e){return n.apply(this,arguments)}}(),destroy:function(){null==R||R.disconnect()}}),pn=new rn({name:"onPageRetentionPlugin",setUp:function(){var n=h((function(n){var e,t,r,i,o,a;return C(this,(function(){return void 0===document.visibilityState||(t=null===(e=location)||void 0===e?void 0:e.href,r=document.querySelector("body"),(o=function(){i=Date.now()})(),document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState?a({href:location.href,leftReason:"visibilityChange"}):"visible"===document.visibilityState&&o()})),window.addEventListener("beforeunload",(function(){a({href:location.href,sendImmediate:!0,leftReason:"pageClose"})})),a=function(e){var t=e.href,r=e.sendImmediate,o=e.leftReason;if(i){var a=Date.now()-i;if(0!==a){i=void 0;var s={severity:"autoDetectEvent",eventName:"onPageRetention",extraInfo:{href:t,duration:a,leftReason:o}};r?n.ImmediatePipeline(s):n.normalLogPipeLine(s)}}},(O=new MutationObserver((function(){if(location.href!==t){var n=t;t=location.href,a({href:n,leftReason:"nextPage"}),o()}}))).observe(r||document,{subtree:!0,childList:!0})),[2]}))}));return function(e){return n.apply(this,arguments)}}(),destroy:function(){null==O||O.disconnect()}}),hn=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2,15)},yn=function(n,e){return![/authenticate\/heartbeat/,/papluginlogs\/.*/,/airtracker\/.*/,/o11y(-staging|-demo)?\.airwallex\.com/,/\.(png|jpe?g|gif|svg|ico|webp|avif|css|js|json|woff2?|ttf|eot|map|txt|csv|xml)(\?.*)?(#.*)?$/i].some((function(e){return e.test(n)}))&&J(n,e||[/^https?:\/\/[^\/]*\.airwallex\.com($|\/)/])},wn=function(n){return Math.round(100*n)/100},bn=function(n,e){var t,r,i,o,a,s,u,c,l,d,f,v,m,p,h,y,w,b,g,E=n.url,I=n.method,S=n.errorType,N=n.errorDetail,C=function(n){var e=n.startTime,t=n.endTime,r=n.entries;if(0!==r.length){if(1===r.length)return r[0];var i=r.filter((function(n){return n.startTime>=e&&t&&n.responseEnd<=t})).sort((function(n,e){return n.startTime-e.startTime}));return null==i?void 0:i[0]}}(n),D=new URL(E,window.location.href),T=D.href,P=D.protocol,R=C?(i=(t=C).duration,o=t.responseStart,a=t.connectEnd,s=t.connectStart,u=t.domainLookupEnd,c=t.domainLookupStart,l=t.requestStart,d=t.secureConnectionStart,f=t.redirectEnd,v=t.redirectStart,m=t.responseStatus,p=t.responseEnd,h=t.encodedBodySize,y=t.decodedBodySize,w=t.transferSize,b=t.deliveryType,g=t.initiatorType,{startTime:wn(r=t.startTime),totalDuration:wn(i),timeToFirstByte:$(o,r),tcpDuration:$(a,s),dnsDuration:$(u,c),tlsDuration:$(l,d),redirectDuration:$(f,v),responseDuration:$(p,o),encodeResponseSize:h,decodeResponseSize:y,transferSize:w,deliveryType:b,statusCode:m,initiatorType:g}):{};return{severity:"autoDetectEvent",eventName:"httpClientMetrics",extraInfo:k(x(k({httpUrl:T,method:I,scheme:P},S&&{errorType:S},N&&{errorDetail:N},R),{statusCode:(null==R?void 0:R.statusCode)||(null==n?void 0:n.responseStatus),startTime:(null==R?void 0:R.startTime)||(null==n?void 0:n.startTime),initiatorType:(null==R?void 0:R.initiatorType)||(null==n?void 0:n.initiatorType)}),e)}},gn=function(n){return n&&"object"===(void 0===n?"undefined":S(n))&&"errors"in n&&Array.isArray(n.errors)&&n.errors.every((function(n){return n&&"object"===(void 0===n?"undefined":S(n))&&"message"in n}))},kn="awx_airtracker_api_performance_queue",xn="awx_airtracker_api_performance_plugin_loaded",En="undefined"!=typeof window?window:"undefined"!=typeof global?global:{};En[kn]=En[kn]||[];var In=function(n,e,t){setTimeout((function(){var r=bn(n,t);e.observerPipeline(r),En[kn]=En[kn].filter((function(e){return e.id!==n.id}))}),300)},Sn=function(n,e){setTimeout((function(){var t=En[kn].find((function(e){return e.id===n}));if(t){var r=bn(t,{exceptionType:"timeout-without-response"});e.observerPipeline(r),En[kn]=En[kn].filter((function(e){return e.id!==n}))}}),1e4)},Nn=new rn({name:"apiPerformancePlugin",setUp:function(){var n=h((function(n){var e,t;return C(this,(function(){return En[xn]||(null===(e=n.config)||void 0===e?void 0:e.enableRecordAPIPerformance)&&Math.random()<((null===(t=n.config)||void 0===t?void 0:t.enableRecordAPIPerformancePercentage)||0)&&(En[xn]=!0,function(n){var e;(function(n){var e=XMLHttpRequest.prototype.open,t=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function(t,r,i,o,a){try{var s,u=hn();this.__requestId=u;var c=g(r,URL)?r.href:new URL(r,window.location.href).href;if(!yn(c,null===(s=n.config)||void 0===s?void 0:s.enableRecordAPIPerformanceWhitelist))return e.call(this,t,r,null==i||i,o,a);var l={id:u,startTime:performance.now(),method:t,url:c,entries:[],initiatorType:"xmlhttprequest"};return En[kn].push(l),Sn(u,n),e.call(this,t,r,null==i||i,o,a)}catch(s){return n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject XHR open error",error:s}}),e.call(this,t,r,null==i||i,o,a)}},XMLHttpRequest.prototype.send=function(){for(var e=this,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];try{var a=En[kn].find((function(n){return n.id===e.__requestId}));if(!a)return t.apply(this,i);var s=this;return this.addEventListener("loadend",h((function(){var e,t,r,i,o,u,c;return C(this,(function(l){switch(l.label){case 0:if(e=performance.now(),t=e-a.startTime,0===(r=s.status))return[2];a.endTime=e,a.duration=t,a.responseStatus=r,l.label=1;case 1:return l.trys.push([1,6,,7]),""!==s.responseType&&"text"!==s.responseType?[3,2]:(i=s.responseText,[3,5]);case 2:return"json"!==s.responseType?[3,3]:(i=s.response,[3,5]);case 3:return"blob"!==s.responseType||"application/json"!==(null==(o=s.response)?void 0:o.type)?[3,5]:[4,o.text()];case 4:i=l.sent(),l.label=5;case 5:return(u=i&&"string"==typeof i?JSON.parse(i):i)&&gn(u)&&(a.errorType="graphqlError",a.errorDetail=u.errors),[3,7];case 6:return c=l.sent(),n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in XHR",url:null==a?void 0:a.url,error:c}}),[3,7];case 7:return In(a,n),[2]}}))}))),this.addEventListener("error",(function(){In(a,n,{exceptionType:"network-error"})})),this.addEventListener("abort",(function(){In(a,n,{exceptionType:"abort-error"})})),this.addEventListener("timeout",(function(){In(a,n,{exceptionType:"timeout-error"})})),t.apply(this,i)}catch(e){throw n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"InjectXHR send error",error:e}}),e}}})(n),function(n){var e=window.fetch;window.fetch=h((function(){var t,r,i,o,a,s,u,c,l,d,f,v,m,p,h,y,w=arguments;return C(this,(function(b){switch(b.label){case 0:for(t=w.length,r=new Array(t),i=0;i<t;i++)r[i]=w[i];return s=new URL(g(r[0],Request)?r[0].url:String(r[0]),window.location.href).href,yn(s,null===(o=n.config)||void 0===o?void 0:o.enableRecordAPIPerformanceWhitelist)?[3,2]:[4,e.apply(this,r)];case 1:return[2,b.sent()];case 2:return b.trys.push([2,9,,10]),c=performance.now(),l=hn(),a={id:l,startTime:c,method:(null===(u=g(r[0],Request)?r[0]:r[1])||void 0===u?void 0:u.method)||"GET",url:s,entries:[],initiatorType:"fetch"},En[kn].push(a),Sn(l,n),[4,e.apply(this,r)];case 3:d=b.sent(),f=performance.now(),a.endTime=f,a.duration=f-c,a.responseStatus=d.status,v=d.clone(),b.label=4;case 4:return b.trys.push([4,7,,8]),v.ok?[4,v.json()]:[3,6];case 5:(m=b.sent())&&gn(m)&&(a.errorType="graphqlError",a.errorDetail=m.errors),b.label=6;case 6:return[3,8];case 7:return p=b.sent(),n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in fetch",url:null==a?void 0:a.url,error:p}}),[3,8];case 8:return In(a,n),[2,d];case 9:throw h=b.sent(),a&&a.id&&En[kn].find((function(n){return n.id===(null==a?void 0:a.id)}))?(y="fetch-error",g(h,TypeError)?y="network-error":g(h,DOMException)&&"AbortError"===h.name&&(y="abort-error"),In(a,n,{exceptionType:y})):n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject fetch error",error:h}}),h;case 10:return[2]}}))}))}(n),(null===(e=window)||void 0===e?void 0:e.PerformanceObserver)?new window.PerformanceObserver((function(n){n.getEntries().forEach((function(n){var e=n;"fetch"!==e.initiatorType&&"xmlhttprequest"!==e.initiatorType||En[kn].filter((function(n){return n.url===e.name})).forEach((function(n){n.entries.push(e)}))}))})).observe({entryTypes:["resource"],buffered:!0}):n.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{error:"PerformanceObserver Not Supported"}})}(n)),[2]}))}));return function(e){return n.apply(this,arguments)}}()}),Cn=function(){function n(e){var t,r,i=this,o=e.config,a=e.plugins,s=void 0===a?[]:a;y(this,n),this.config=_,this.lifeCycle=new tn,this.plugins=[],this._commonData=L,this._MFECommonDataMap={},this.timeMap={},this.packedDataConvert=function(n){var e,t,r=n.extraInfo,o=k({severity:n.severity,eventName:n.eventName,currentHref:i.config.hideSearchParams?((null===(e=location)||void 0===e?void 0:e.href)||"").split("?")[0]||"":(null===(t=location)||void 0===t?void 0:t.href)||""},r);return i.config.isWebappContainer&&(o.MFEName=B(i)),o},this.normalPipelineObj=en([Z(this,8),(t=this,r={},function(n,e){var i="number"==typeof t.config.errorRepeatTime?t.config.errorRepeatTime:5;if(0===i)return null==e?void 0:e(n);null==e||e(n.filter((function(n){return"autoDetectError"!=n.severity||(r[n.error]=r[n.error]||0,r[n.error]+=1,!(r[n.error]>i))})))}),Q(this)]),this.observerPipelineObj=en([Z(this,8),Y(this)]),this.immediateSendPipe=Q(this),this.observerPipeline=function(n){var e=i.packedDataConvert({severity:n.severity,eventName:n.eventName,extraInfo:n.extraInfo});return i.observerPipelineObj(e)},this.normalLogPipeLine=function(n){var e=i.packedDataConvert({severity:n.severity,eventName:n.eventName,extraInfo:n.extraInfo});return i.config.disableThrottle?i.immediateSendPipe(e):i.normalPipelineObj(e)},this.ImmediatePipeline=function(n){var e=i.packedDataConvert({severity:n.severity,eventName:n.eventName,extraInfo:n.extraInfo});return i.immediateSendPipe(e)},this.plugins=I(s),this.setConfig(o),this.initCommonData(o),this.lifeCycle.emit("onInit"),o.enableErrorMonitoring&&this.plugins.push(un),((null==o?void 0:o.assetSpeedMonitoringWhiteList)&&o.assetSpeedMonitoringWhiteList.length>0||o.isWebappContainer)&&this.plugins.push(vn),(null==o?void 0:o.enableDetectPageChange)&&this.plugins.push(mn),(null==o?void 0:o.enableRecordPageRetention)&&this.plugins.push(pn),(null==o?void 0:o.enableRecordAPIPerformance)&&(null==o?void 0:o.enableRecordAPIPerformancePercentage)&&o.enableRecordAPIPerformancePercentage>0&&o.enableRecordAPIPerformancePercentage<=1&&this.plugins.push(Nn),this.installPlugins()}return w(n,[{key:"installPlugins",value:function(){var n=this;this.plugins.forEach((function(e){e.patch(n)}))}},{key:"commonData",get:function(){return this._commonData}},{key:"MFECommonDataMap",get:function(){return this._MFECommonDataMap}},{key:"initCommonData",value:function(n){this._commonData.sessionId=n.useSessionStorageForSessionId?function(){try{var n=window.sessionStorage.getItem(q);return n||(n=z(),window.sessionStorage.setItem(q,n)),n}catch(n){return z()}}():z(),this._commonData.deviceId=function(){try{var n=window.localStorage.getItem(H);return n||(n=z(),window.localStorage.setItem(H,n)),n}catch(n){}}()||A,this._commonData.riskDeviceId=function(){try{return window.localStorage.getItem("AWX_RISK_ID")||void 0}catch(n){}}(),this._commonData.networkType=function(){var n,e,t="",r=navigator.userAgent.match(/NetType\/(\w+)/);if(r)t=E(r,2)[1];else if(null===(n=navigator)||void 0===n?void 0:n.connection){var i,o,a,s;t=(null===(o=navigator)||void 0===o||null===(i=o.connection)||void 0===i?void 0:i.effectiveType)||(null===(s=navigator)||void 0===s||null===(a=s.connection)||void 0===a?void 0:a.type)}return t||(t="unknown"),e=t,(e=String(e).toLowerCase()).indexOf("4g")>=0?"net4g":e.indexOf("wifi")>=0?"wifi":e.indexOf("5g")>=0?"net5g":e.indexOf("3g")>=0?"net3g":e.indexOf("2g")>=0?"net2g":"unknown"}()||"unknown",this._commonData.env=n.env||this._commonData.env,this._commonData.accountId=n.accountId||A,this._commonData.appVersion=n.appVersion,this._commonData.appName=n.appName,this._commonData.sdkVersion="3.1.0",this.lifeCycle.emit("onCommonDataInit",this.commonData)}},{key:"updateCommonDataBasedOnConfig",value:function(n){this.lifeCycle.emit(K,this._commonData),this._commonData.env=n.env||this._commonData.env,this._commonData.appName=n.appName||this._commonData.appName,this._commonData.env=n.env||this._commonData.env,this._commonData.accountId=n.accountId||this._commonData.accountId,this._commonData.appVersion=n.appVersion||this._commonData.appVersion}},{key:"updateCommonData",value:function(n){this.lifeCycle.emit(K,this._commonData),this._commonData=k({},this._commonData,n)}},{key:"removeCommonDataByKey",value:function(n){var e=this;this.lifeCycle.emit(K,this._commonData),setTimeout((function(){n.forEach((function(n){delete e._commonData[n]}))}),1e3)}},{key:"addToMFECommonData",value:function(n){var e,t=n.MFEName,r=n.MFECommonData;this.config.isWebappContainer&&t&&r&&(this._MFECommonDataMap=x(k({},this._MFECommonDataMap||{}),b({},t,k({},(null===(e=this._MFECommonDataMap)||void 0===e?void 0:e[t])||{},r))))}},{key:"setConfig",value:function(n){var e=this;this.config.isWebappContainer||(Object.entries(n).forEach((function(n){var t=E(n,2),r=t[0],i=t[1];void 0!==(void 0===i?"undefined":S(i))&&function(n,t){e.config[n]=t}(r,i)})),this.lifeCycle.emit("onConfigInit",this.config),this.updateCommonDataBasedOnConfig(n))}},{key:"verbose",value:function(n,e){this.normalLogPipeLine({severity:"verbose",eventName:n,extraInfo:e})}},{key:"httpLog",value:function(n,e){this.normalLogPipeLine({severity:"http",eventName:n,extraInfo:e})}},{key:"info",value:function(n,e){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:e})}},{key:"warn",value:function(n,e){this.normalLogPipeLine({severity:"warn",eventName:n,extraInfo:e})}},{key:"error",value:function(n,e){console.error("error",n),this.normalLogPipeLine({severity:"error",eventName:n,extraInfo:e})}},{key:"businessLog",value:function(n,e){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:x(k({},e),{isBusinessLog:!0})})}},{key:"reportDuration",value:function(n,e,t){"string"==typeof n?"number"==typeof e?e<0||e>6e4?console.warn("reportDuration: duration (second param) must between 0 and 60000"):this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:k({duration:e},t)}):console.warn("reportDuration: duration (second param) must be number"):console.warn("reportDuration: eventName (first param) must be a string")}},{key:"getTimerKey",value:function(n){var e=B(this);return this.config.isWebappContainer?"".concat(e,"_").concat(n):n}},{key:"timeStart",value:function(n){"string"==typeof n?(this.timeMap[this.getTimerKey(n)]&&console.warn("Timer ".concat(n," already exists")),this.timeMap[this.getTimerKey(n)]=Date.now()):console.warn("time: first param must be a string")}},{key:"timeEnd",value:function(n,e){if("string"==typeof n)if(this.timeMap[this.getTimerKey(n)]){var t=Date.now()-this.timeMap[this.getTimerKey(n)]+(e||0);this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:{duration:t}}),delete this.timeMap[this.getTimerKey(n)]}else console.warn("Timer key :".concat(n," does not exist"));else console.warn("timeEnd: first param must be a string")}},{key:"addToAssetSpeedWhiteListByMFE",value:function(n){var e,t,r,i,o=n.MFEName,a=n.whiteList;this.config.isWebappContainer&&o&&(null==a?void 0:a.length)&&(this.config.assetSpeedMonitoringWhiteListByMFE||(this.config.assetSpeedMonitoringWhiteListByMFE={}),(null===(e=this.config.assetSpeedMonitoringWhiteListByMFE)||void 0===e?void 0:e[o])?null===(i=this.config.assetSpeedMonitoringWhiteListByMFE)||void 0===i||null===(r=i[o])||void 0===r||(t=r).push.apply(t,I(a)):this.config.assetSpeedMonitoringWhiteListByMFE=x(k({},this.config.assetSpeedMonitoringWhiteListByMFE),b({},o,a)))}},{key:"destroy",value:function(){this.config.isWebappContainer||this.plugins.forEach((function(n){n.uninstall()}))}}]),n}(),Dn=Cn,Tn=function(n,e){return Tn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])},Tn(n,e)};function Pn(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=n}Tn(n,e),n.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t)}var Rn=function(){return Rn=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var i in e=arguments[t])Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n},Rn.apply(this,arguments)};function On(n,e,t,r){return new(t||(t=Promise))((function(e,i){function o(n){try{s(r.next(n))}catch(n){i(n)}}function a(n){try{s(r.throw(n))}catch(n){i(n)}}function s(n){var r;n.done?e(n.value):(r=n.value,r instanceof t?r:new t((function(n){n(r)}))).then(o,a)}s((r=r.apply(n,[])).next())}))}function jn(n,e){var t,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(t=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(n,a)}catch(n){s=[6,n],r=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function An(n,e){for(var t,r=0,i=e.length;r<i;r++)!t&&r in e||(t||(t=Array.prototype.slice.call(e,0,r)),t[r]=e[r]);return n.concat(t||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var _n,Ln,Un,Fn={dev:j.staging,staging:j.staging,demo:j.demo,prod:j.production},Mn=function(n){if("object"!=typeof n)return n;try{var e=JSON.parse(JSON.stringify(n));return Object.keys(e).forEach((function(n){"string"==typeof n&&["auth","code"].some((function(e){return n.includes(e)}))&&(e[n]="***")})),e}catch(e){return n}},Kn=function(n,e){var t,r;null===(r=null===(t=window._AirwallexSDKs)||void 0===t?void 0:t.airTracker)||void 0===r||r.error(n,Rn(Rn({},e),{context:"components-sdk"}))},Hn=function(n,e){var t;null===(t=window._AirwallexSDKs.airTracker)||void 0===t||t.info(n,Rn(Rn({},e),{context:"components-sdk"}))},qn=function(n){function e(e){var t=n.call(this,e)||this;return t.code="LOAD_SCRIPT_ERROR",t}return Pn(e,n),e}(Error);!function(n){n.dev="dev",n.staging="staging",n.demo="demo",n.prod="prod",n.sandbox="sandbox"}(Un||(Un={}));var zn,Bn=((_n={})[Un.dev]="https://checkout-staging.airwallex.com",_n[Un.staging]="https://checkout-staging.airwallex.com",_n[Un.demo]="https://checkout-demo.airwallex.com",_n[Un.prod]="https://checkout.airwallex.com",_n[Un.sandbox]="https://checkout.sandbox.airwallex.com",_n),Wn=((Ln={})[Un.dev]="https://static-staging.airwallex.com",Ln[Un.staging]="https://static-staging.airwallex.com",Ln[Un.demo]="https://static-demo.airwallex.com",Ln[Un.prod]="https://static.airwallex.com",Ln[Un.sandbox]="https://static.sandbox.airwallex.com",Ln),Xn="sdkController",Vn="payments",Gn={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",balance:"/widgets/embedded-balance/sdk/v1/index.js"},Jn={kyc:"kyc",paymentsKyb:"paymentsKyb",kycRfi:"rfi",transactionRfi:"rfi",paymentEnablementRfi:"rfi",lendingRfi:"rfi",mrmRfi:"rfi",payoutForm:"payouts",beneficiaryForm:"payouts",hpp:"payments",cvc:"payments",card:"payments",expiry:"payments",dropIn:"payments",cardNumber:"payments",applePayButton:"payments",googlePayButton:"payments",krCardNumber:"payments",krCardIdentifier:"payments",krCardExpiry:"payments",krCardPswFirstTwo:"payments",scaSetup:"sca",scaVerify:"sca",scaManagement:"sca",taxForm:"taxForm",embeddedCheckout:"billing",balanceOverview:"balance",balanceDetail:"balance",balanceActivities:"balance",balanceActivityDetails:"balance",balanceHistoryChart:"balance",balanceInfo:"balance",balanceScheduledTransactions:"balance",balanceList:"balance"},$n={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"],balance:["balanceOverview","balanceDetail","balanceActivities","balanceHistoryChart","balanceInfo","balanceScheduledTransactions","balanceList","balanceActivityDetails"]},Qn={billing:["payments"]},Yn=["payments","sca","billing"],Zn=function(n){function e(e){var t=n.call(this,e)||this;return t.code="INVALID_STATIC_RESOURCE_ERROR",t}return Pn(e,n),e}(Error),ne=Date.now(),ee=function(n){return Jn[n]},te=function(n){var e=n.reduce((function(n,e){return n.concat((t=e,Object.keys($n).includes(t)?$n[e]:e));var t}),[]);return Array.from(new Set(e)).map((function(n){return{elementName:n,sdkName:ee(n)}}))},re=function(n){return"payments"===n?"payment":n},ie=function(n){var e=n.name,t=n.env,r=function(n,e){var t=n===Vn?Bn:Wn;return t[e]||t.prod}(e,void 0===t?Un.prod:t),i=Gn[e];if(!i)throw Kn("[components-sdk] Element static resource not found",{sdkName:e}),new Zn("Element ".concat(e," static resource URL is invalid."));return"".concat(r).concat(i,"?ts=").concat(ne)},oe=function(){return Math.floor(performance.now())},ae=function(n){function e(e){var t=n.call(this,e)||this;return t.code="INSTANCE_NOT_FOUND_ERROR",t}return Pn(e,n),e}(Error),se=new Map,ue=function(n){var e=n.scriptName,t=ie({name:e,env:n.env}),r=se.get(e);if(r)return r;var i=function(n){return On(void 0,0,void 0,(function(){var e,t;return jn(this,(function(r){switch(r.label){case 0:if("undefined"==typeof window)throw new Error("Please load script in browser environment");e=0,t=function(){return On(void 0,0,void 0,(function(){var t,r,i;return jn(this,(function(){return t=oe(),e>0&&n.includes("?ts=")&&((r=new URL(n,window.location.href)).searchParams.set("ts","".concat(Date.now())),n=r.toString()),i=function(n){var e=document.createElement("script");return e.src=n,e.type="module",(document.head||document.body).appendChild(e),e}(n),[2,new Promise((function(r,o){i.addEventListener("load",(function(){var i=oe();Hn("[components-sdk] SDK script loaded",{scriptUrl:n,start:t,latency:i-t,end:i,retryCount:e}),r(!0)})),i.addEventListener("error",(function(r){i.remove(),console.error(r);var a=oe();Kn("[components-sdk] Failed to load script",{scriptUrl:n,error:r,start:t,latency:a-t,end:a,retryCount:e}),o(new qn("Failed to load Airwallex SDK scripts: ".concat(n)))}))}))]}))}))},r.label=1;case 1:if(!(e<3))return[3,7];r.label=2;case 2:return r.trys.push([2,4,,6]),[4,t()];case 3:return[2,r.sent()];case 4:return r.sent(),e++,[4,(void 0===i&&(i=500),new Promise((function(n){return window.setTimeout(n,i)})))];case 5:return r.sent(),[3,6];case 6:return[3,1];case 7:throw Kn("[components-sdk] Failed to load script after retry",{scriptUrl:n,retryCount:e}),new qn("Failed to load Airwallex SDK scripts: ".concat(n))}var i}))}))}(t);return se.set(e,i),i},ce=function(n){var e=n.env,t=n.scriptName;return On(void 0,0,void 0,(function(){var n;return jn(this,(function(r){switch(r.label){case 0:return(n=Qn[t]||[]).length>0?[4,Promise.all(n.map((function(n){return ue({env:e,scriptName:n})})))]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2,ue({env:e,scriptName:t})]}}))}))},le=function(n){return On(void 0,0,void 0,(function(){return jn(this,(function(){if("undefined"==typeof window)throw new Error("Please call the `init()` function in a browser environment.");var e,t;return t=n.clientId,void 0===(e=n.env)&&(e=j.production),window._AirwallexSDKs.airTracker||(window._AirwallexSDKs.airTracker=new Dn({config:{appName:"components-sdk",appVersion:"1.35.1",env:Fn[e]||j.production}}),window._AirwallexSDKs.airTracker.updateCommonData({clientId:t})),window,Hn("[components-sdk] SDK init start",{options:Mn(n),start:oe()}),zn=new Promise((function(e,t){var r,i=Rn(Rn({},n),{env:n.env&&Un[n.env]?n.env:Un.prod});window.AirwallexComponentsSDK.__env__=i.env;var o=ue({env:i.env,scriptName:Xn}).then((function(){return window._AirwallexSDKs.__controller__.init(i)})),a=null!==(r=n.enabledElements)&&void 0!==r?r:[],s=function(n){return Array.from(new Set(te(n).map((function(n){return n.sdkName})).filter((function(n){return Yn.includes(n)}))))}(a),u=s.map((function(n){return ce({env:i.env,scriptName:n}).then((function(){return o})).then((function(){var e=window._AirwallexSDKs[re(n)];if(!e)throw Kn("[components-sdk] SDK instance not found",{functionsNamespace:n,windowSDKInstanceName:re(n)}),new ae("SDK instance not found");return window._AirwallexSDKs.__controller__.registerFunctions({functionsNamespace:n,instance:e})}))})),c=te(a).map((function(n){var e=n.sdkName,t=n.elementName;return ce({scriptName:e,env:i.env}).then((function(){return o})).then((function(){var n=window._AirwallexSDKs[re(e)];if(!n)throw Kn("[components-sdk] SDK instance not found",{sdkName:e,windowSDKInstanceName:re(e)}),new ae("SDK instance not found");return window._AirwallexSDKs.__controller__.registerElement({sdkName:e,elementName:t,instance:n})}))}));Promise.all(An(An([o],u),c)).then((function(){Hn("[components-sdk] SDK initialized",{options:Mn(n),start:oe()}),e(Yn.reduce((function(n,e){var t;return Rn(Rn({},n),((t={})[e]=window._AirwallexSDKs.__controller__.internalSDKs[e],t))}),{}))})).catch((function(n){n.code||Kn("[components-sdk] Unexpected errors when init",{error:n}),t(n)}))})),[2,zn]}))}))},de=function(n,e){return On(void 0,0,void 0,(function(){var t,r,i,o,a;return jn(this,(function(s){switch(s.label){case 0:if(!n)throw new Error("Element type is missing. Please specify a valid element.");if(Hn("[components-sdk] SDK createElement start",{elementName:n,options:Mn(e),timestamp:oe()}),!zn)throw function(){var n;null===(n=window._AirwallexSDKs.airTracker)||void 0===n||n.warn("[components-sdk] Did not call init before createElement",Rn(Rn({},void 0),{context:"components-sdk"}))}(),new Error("Please initialize the Element before creating it.");return[4,zn];case 1:if(s.sent(),!(t=ee(n)))throw new Error("`createElement()` with type `".concat(n,"` is not supported. Please specify a valid Element type."));r=oe(),s.label=2;case 2:return s.trys.push([2,6,,7]),[4,ce({scriptName:t,env:window.AirwallexComponentsSDK.__env__||Un.prod})];case 3:return s.sent(),[4,window._AirwallexSDKs.__controller__.registerElement({sdkName:t,elementName:n,instance:window._AirwallexSDKs[re(t)]})];case 4:return s.sent(),[4,window._AirwallexSDKs.__controller__.createElement(n,e)];case 5:return i=s.sent(),o=oe(),Hn("[components-sdk] SDK createElement being called",{elementName:n,options:Mn(e),start:r,latency:o-r,end:o}),[3,7];case 6:if((a=s.sent()).code)throw a;return Kn("[components-sdk] Unexpected errors when createElement",{error:a}),[3,7];case 7:return[2,i]}}))}))},fe=[Xn,Vn],ve=function(){fe.forEach((function(n){var e=ie({name:n,env:Un.prod}),t=document.createElement("link");t.href=e,t.rel="modulepreload",t.as="script",(document.head||document.body).appendChild(t)}))};"undefined"==typeof document||"undefined"==typeof window||("loading"===document.readyState?document.addEventListener("DOMContentLoaded",ve):ve()),"undefined"!=typeof window&&(window.AirwallexComponentsSDK||Object.defineProperties(window,{AirwallexComponentsSDK:{value:{},writable:!1},_AirwallexSDKs:{value:{},writable:!1}}),window.AirwallexComponentsSDK.init=le,window.AirwallexComponentsSDK.createElement=de);const{onChange:me,reset:pe,state:he}=n((()=>({clientSecret:null,currency:null,hasPaymentError:!1,isReady:!1,paymentConfirmed:!1,paymentIntentId:null}))),ye=n=>"AIRWALLEX"===n.paymentProcessor&&(n.clientSecret&&(he.clientSecret=n.clientSecret),n.paymentIntentId&&(he.paymentIntentId=n.paymentIntentId),!!he.clientSecret||(o("Airwallex checkout session is missing the client secret"),!1)),we={ar:"ar",da:"da",de:"de",en:"en",es:"es",fr:"fr",id:"id",it:"it",ja:"ja",ko:"ko",nl:"nl",pl:"pl",pt:"pt",ru:"ru",sv:"sv",zh:"zh"},be=n=>we[n]||"en";let ge=null;const ke=async()=>!!he.isReady||(ge||(ge=le({enabledElements:["payments"],env:e.zonosMode&&"production"!==e.zonosMode||"LIVE"!==e.checkoutSettings.mode?"demo":"prod",locale:be(r.selectedLocale)}).then((()=>(he.isReady=!0,u("Airwallex SDK initialized"),!0))).catch((n=>(o(n),ge=null,!1)))),ge),xe=["SUCCEEDED","REQUIRES_CAPTURE","PENDING_REVIEW","PENDING"],Ee=n=>!!n&&xe.includes(n),Ie=n=>{switch(n){case"SUCCEEDED":return{isError:!1,messages:[t("Thank you for submitting your payment. We appreciate your prompt attention."),"",t("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]};case"PENDING":case"PENDING_REVIEW":case"REQUIRES_CAPTURE":return{isError:!1,messages:[t("Payment processing. We'll update you when payment is received.")]};case"REQUIRES_CUSTOMER_ACTION":return{isError:!1,messages:[t("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]};case"CANCELLED":case"REQUIRES_PAYMENT_METHOD":return{isError:!0,messages:[t("Payment failed. Please reload the page and try another payment method.")]};default:return{isError:!0,messages:[t("Something went wrong.")]}}},Se=async n=>{const{errors:e,json:t}=await a("/api/zonos-elements/collect/airwallex-payment-intent",{body:{paymentIntentId:n},method:"POST"});return e.length||!t?(o("Failed to retrieve Airwallex payment intent",e),{status:null}):{status:t.airwallexPaymentIntent.status}},{state:Ne}=n((()=>({amountDutyTaxFeeTotal:null,amountTotalPaid:null,collectLogoUrl:null,isFetchingShippingInfo:!0,landedCostShortId:null,originCompanyName:null,partyBillingId:null,paymentProcessor:null,shippingAddress:null}))),Ce=async({landedCostId:n,retries:t=5})=>{var r,i,o,u,c,d,f,v,m,p;Ne.isFetchingShippingInfo=!0;const h=await a("/api/zonos-elements/collect/get-shipping-info-by-lc-id",{body:{landedCostId:n},method:"POST"});if(h.errors.length)return t>0?(await new Promise((n=>setTimeout(n,1e3))),Ce({landedCostId:n,retries:t-1})):null;Ne.landedCostShortId=(null===(r=h.json)||void 0===r?void 0:r.landedCostShortId)||null,Ne.isFetchingShippingInfo=!1,Ne.shippingAddress=(null===(i=h.json)||void 0===i?void 0:i.shipping)||null;const y=null===(o=l.checkoutSession)||void 0===o?void 0:o.landedCost,w=null===(u=l.checkoutSession)||void 0===u?void 0:u.subtotals,b=((null===(c=null==y?void 0:y.amountSubtotals)||void 0===c?void 0:c.shipping)||0)+((null===(d=null==y?void 0:y.amountSubtotals)||void 0===d?void 0:d.items)||0);Ne.amountTotalPaid=b*((null===(f=null==w?void 0:w.exchangeRate)||void 0===f?void 0:f.rate)||1),Ne.amountDutyTaxFeeTotal=((null==w?void 0:w.duties)||0)+((null==w?void 0:w.taxes)||0)+((null==w?void 0:w.fees)||0),Ne.originCompanyName=(null===(m=null===(v=h.json)||void 0===v?void 0:v.origin)||void 0===m?void 0:m.companyName)||null,Ne.collectLogoUrl=(null===(p=h.json)||void 0===p?void 0:p.collectLogoUrl)||null,0===Ne.amountTotalPaid&&s({endpoint:"COLLECT_NO_TOTAL_PAID",errors:[],metadata:{landedCostId:n,organizationId:e.organizationId}})},De=async()=>{var n,e,t,r;if(!(null===(n=f.stripeBillingAddressEventData)||void 0===n?void 0:n.complete))return{partiesCreated:!1};const u=null===(t=null===(e=l.checkoutSession)||void 0===e?void 0:e.landedCost)||void 0===t?void 0:t.rootId;if(!u)return s({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:c,cartId:window.Zonos.cartId,checkoutSessionId:i.checkoutSessionId}}),{partiesCreated:!1};if(!i.checkoutSessionId)return s({endpoint:"COLLECT_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:c,cartId:window.Zonos.cartId,landedCostRootId:u}}),{partiesCreated:!1};const d=v({address:f.stripeBillingAddressEventData.value.address,firstName:f.stripeBillingAddressEventData.value.firstName,lastName:f.stripeBillingAddressEventData.value.lastName,name:f.stripeBillingAddressEventData.value.name,phone:f.stripeBillingAddressEventData.value.phone}),m="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:p,json:h}=await a("/api/zonos-elements/create-billing-party",{body:{billingAddress:d,checkoutSessionId:i.checkoutSessionId,companyName:f.companyName,email:(null===(r=f.stripeLinkEventData)||void 0===r?void 0:r.value.email)||"",isTest:m,rootId:u},method:"POST"});return p.length||!h?(o("Error occurs when creating billing party",JSON.stringify(p,null,2)),s({endpoint:"COLLECT_BILLING_PARTY_CREATE_FAILED",errors:["[COLLECT] Failed to create billing party"],metadata:{allLogs:c,cartId:window.Zonos.cartId,checkoutSessionId:i.checkoutSessionId,errors:p,json:h}}),{partiesCreated:!1}):(Ne.partyBillingId=h.billToPartyId,{partiesCreated:!0})},Te=async n=>{const e=n.landedCost;return!!e&&(l.landedCostData=[Object.assign(Object.assign({},n),{landedCost:Object.assign({},e),landedCostId:e.id})],d({applySubtotalsOnly:!0,landedCostId:e.id,selectedShippingOption:e.shipmentRating}))};export{ye as a,he as b,Ne as c,Se as d,Ee as e,ke as f,Te as g,Ce as h,De as i,Ie as j,pe as k,de as l,be as m,me as n}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(o,e,t,n){function s(o){return o instanceof t?o:new t((function(e){e(o)}))}return new(t||(t=Promise))((function(t,a){function l(o){try{r(n.next(o))}catch(o){a(o)}}function i(o){try{r(n["throw"](o))}catch(o){a(o)}}function r(o){o.done?t(o.value):s(o.value).then(l,i)}r((n=n.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,s,a,l=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return l.next=i(0),l["throw"]=i(1),l["return"]=i(2),typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function i(o){return function(e){return r([o,e])}}function r(i){if(n)throw new TypeError("Generator is already executing.");while(l&&(l=0,i[0]&&(t=0)),t)try{if(n=1,s&&(a=i[0]&2?s["return"]:i[0]?s["throw"]||((a=s["return"])&&a.call(s),0):s.next)&&!(a=a.call(s,i[1])).done)return a;if(s=0,a)i=[i[0]&2,a.value];switch(i[0]){case 0:case 1:a=i;break;case 4:t.label++;return{value:i[1],done:false};case 5:t.label++;s=i[1];i=[0];continue;case 7:i=t.ops.pop();t.trys.pop();continue;default:if(!(a=t.trys,a=a.length>0&&a[a.length-1])&&(i[0]===6||i[0]===2)){t=0;continue}if(i[0]===3&&(!a||i[1]>a[0]&&i[1]<a[3])){t.label=i[1];break}if(i[0]===6&&t.label<a[1]){t.label=a[1];a=i;break}if(a&&t.label<a[2]){t.label=a[2];t.ops.push(i);break}if(a[2])t.ops.pop();t.trys.pop();continue}i=e.call(o,t)}catch(o){i=[6,o];s=0}finally{n=a=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(o,e,t){if(t||arguments.length===2)for(var n=0,s=e.length,a;n<s;n++){if(a||!(n in e)){if(!a)a=Array.prototype.slice.call(e,0,n);a[n]=e[n]}}return o.concat(a||Array.prototype.slice.call(e))};System.register(["./p-CIevpRv_.system.js","./p-
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(o,e,t,n){function s(o){return o instanceof t?o:new t((function(e){e(o)}))}return new(t||(t=Promise))((function(t,a){function l(o){try{r(n.next(o))}catch(o){a(o)}}function i(o){try{r(n["throw"](o))}catch(o){a(o)}}function r(o){o.done?t(o.value):s(o.value).then(l,i)}r((n=n.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,s,a,l=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return l.next=i(0),l["throw"]=i(1),l["return"]=i(2),typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function i(o){return function(e){return r([o,e])}}function r(i){if(n)throw new TypeError("Generator is already executing.");while(l&&(l=0,i[0]&&(t=0)),t)try{if(n=1,s&&(a=i[0]&2?s["return"]:i[0]?s["throw"]||((a=s["return"])&&a.call(s),0):s.next)&&!(a=a.call(s,i[1])).done)return a;if(s=0,a)i=[i[0]&2,a.value];switch(i[0]){case 0:case 1:a=i;break;case 4:t.label++;return{value:i[1],done:false};case 5:t.label++;s=i[1];i=[0];continue;case 7:i=t.ops.pop();t.trys.pop();continue;default:if(!(a=t.trys,a=a.length>0&&a[a.length-1])&&(i[0]===6||i[0]===2)){t=0;continue}if(i[0]===3&&(!a||i[1]>a[0]&&i[1]<a[3])){t.label=i[1];break}if(i[0]===6&&t.label<a[1]){t.label=a[1];a=i;break}if(a&&t.label<a[2]){t.label=a[2];t.ops.push(i);break}if(a[2])t.ops.pop();t.trys.pop();continue}i=e.call(o,t)}catch(o){i=[6,o];s=0}finally{n=a=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(o,e,t){if(t||arguments.length===2)for(var n=0,s=e.length,a;n<s;n++){if(a||!(n in e)){if(!a)a=Array.prototype.slice.call(e,0,n);a[n]=e[n]}}return o.concat(a||Array.prototype.slice.call(e))};System.register(["./p-CIevpRv_.system.js","./p-CZD8WvyY.system.js","./p-DS-qw_qc.system.js","./p-XDxdMlQl.system.js","./p-DOD2I44l.system.js","./p-BuU_p5DP.system.js","./p-zVLAvre1.system.js","./p-DBOI98r5.system.js","./p-DQZncB2d.system.js","./p-BbgqQIHv.system.js","./p-_GDmY2H7.system.js","./p-C2j7R11h.system.js","./p-XqkqjeNV.system.js","./p-kaOxUR9u.system.js","./p-Be3Hpms1.system.js","./p-CeLaK0Ff.system.js","./p-DW-fW8yR.system.js","./p-Cby4EkFu.system.js","./p-B3GRrRtL.system.js","./p-DoEHepOc.system.js"],(function(o){"use strict";var e,t,n,s,a,l,i,r,c,d,u,f,h,p,m,b,y,z,g,v,x,w,k,C,_,I,L,S,j,H,D,P,Z,M,B,O,F,U,V,T,W,R,A,E,N,q,Y;return{setters:[function(o){e=o.r;t=o.d;n=o.h;s=o.F;a=o.a;l=o.g},function(o){i=o.b;r=o.d;c=o.j;d=o.e;u=o.k;f=o.c},function(o){h=o.b;p=o.c;m=o.t;b=o.P;y=o.H;z=o.Q;g=o.d;v=o.x;x=o.I},function(o){w=o.s;k=o.c;C=o.a;_=o.b},function(o){I=o.t;L=o.s;S=o.k;j=o.l;H=o.y},function(o){D=o.z},function(o){P=o.h;Z=o.s;M=o.g;B=o.i;O=o.a},function(o){F=o.c},function(o){U=o.g},function(o){V=o.l;T=o.b},function(o){W=o.i;R=o.a},function(o){A=o.c},function(o){E=o.s},function(o){N=o.r},function(o){q=o.p},function(o){Y=o.r},null,null,null,null],execute:function(){var Q='<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-200)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var X='<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-100)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M15.707 9.293a1 1 0 0 1 0 1.414l-3.646 3.647a1.5 1.5 0 0 1-2.122 0l-1.646-1.647a1 1 0 1 1 1.414-1.414L11 12.586l3.293-3.293a1 1 0 0 1 1.414 0Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var G=function(){return":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;height:100%}:host .zonos--group{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;margin-bottom:24px;border-radius:var(--zonos--border-radius, 10px);gap:24px;margin-top:24px;background-color:var(--zonos-elements-gray-50);padding:48px}:host .zonos--finish-details{max-width:640px;min-width:300px;line-height:24px;width:0 auto;margin:auto}:host zonos-button{width:100%}:host .loading-wrapper{min-height:300px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host .zonos--finish-button-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;gap:16px;margin:0 auto;margin-top:48px;max-width:300px}:host .zonos--button-container{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;gap:16px;margin:0 auto}:host .zonos--subtitle{text-align:center}:host .zonos--order-number{background-color:var(--zonos-elements-gray-0);border:1px solid var(--zonos-elements-gray-200);color:var(--zonos-elements-gray-800);border-radius:var(--zonos-elements-radius-6);padding:4px 8px}"};
|
|
2
2
|
/**
|
|
3
3
|
* Maximum number of retries to pull order info (gap between each retry is 1 second)
|
|
4
4
|
*/var K=30;var J=o("zonos_collect_finish",/** @class */function(){function o(o){var n=this;e(this,o);this.closeClick=t(this,"closeClick",7);
|
|
@@ -74,13 +74,13 @@ var n=M();if(n){t.searchParams.set("zonosTestMode","1")}
|
|
|
74
74
|
// Carry over the zonosQaUrl if it exists
|
|
75
75
|
var s=new URLSearchParams(window.location.search).get("zonosQaUrl");if(s){t.searchParams.set("zonosQaUrl",s)}return t.toString()}}o.prototype.componentDidLoad=function(){if(this.overrideNotification){
|
|
76
76
|
// just show the notification and don't check any of the payment status
|
|
77
|
-
this.notificationType=this.overrideNotification.type;this.notificationTitle=this.overrideNotification.title;this.notificationMessages=this.overrideNotification.messages;this.isLoading=false;return}if(g.isStagingMode){void this.checkStagingOrderStatus()}else if(f.paymentProcessor==="AIRWALLEX"){void this.checkAirwallexPaymentStatus()}else if(C.orderIdCreated){void this.checkPaypalPaymentStatus()}else{void this.checkStripePaymentStatus()}};o.prototype.render=function(){var o=this;var e=window.Zonos.cartId;return n(a,{key:"af26499a2062cf495d4c46a7763ed988a4da0669",class:"zonos--checkout-finish zonos--elements",style:{"--zonos--border-radius":U({overrideBorderStyle:this.borderRadius})}},!this.isLoading&&n("div",{key:"54fb28be3daee7dd1d63f1dcbdb9a84354fcdb6c",class:"zonos--finish-details"},n("div",{key:"9c71e5dbd23e613e1038924f14c0465d94dbad07",class:"zonos--group"},this.notificationType==="success"?n("zonos-icon",{"aria-label":"Order success",content:X,iconColor:"blue-800",size:50}):n("zonos-icon",{"aria-label":"Order failed",content:Y,iconColor:"red-800",size:50}),n("zonos-text",{key:"3285f4bb8854d5bab6eef487d2b2ae3556794998",class:"zonos--title",type:"semiBoldSubheader"},this.notificationTitle),this.confirmationId&&n("zonos-badge",{key:"4cecd6f15ed26fe1e525c01a48e3961845e6f6d8",badgeColor:"gray"},this.confirmationId),n("zonos-text",{key:"dd7c4011d4d7f92fcd19d53e945adf42f2b3f05e",class:"zonos--subtitle",textColor:"gray-600"},this.notificationMessages.map((function(o){return n(s,null,o,n("br",null))}))),this.order&&e&&n("div",{key:"a11bd49a754d32dd15dc34f2311f9706d459f07b",class:"zonos--button-container"},n("zonos-button",{key:"305bcf958a1772cc123414285522e9e0f0b1a839",onClick:function(){window.open(o.getReceiptUrl({cartId:e}),"_blank")},size:"lg",variant:"primary"},I("View receipt"))))))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return o}());J.style=G();var $='<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var oo='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12ZM11.4709 5.80634C11.7686 5.53723 11.9541 5.5 12 5.5C12.0459 5.5 12.2314 5.53723 12.5291 5.80634C12.8115 6.06164 13.1289 6.46913 13.4271 7.03651C13.9505 8.03191 14.3838 9.46098 14.48 11.25H9.51996C9.61624 9.46098 10.0495 8.03191 10.5729 7.03651C10.8711 6.46913 11.1885 6.06164 11.4709 5.80634ZM8.01802 11.25C8.11591 9.23031 8.60319 7.55958 9.24516 6.33849C9.29983 6.23451 9.35585 6.13335 9.41312 6.03514C7.32916 6.94017 5.81218 8.90533 5.5428 11.25H8.01802ZM5.5428 12.75H8.01802C8.11591 14.7697 8.60319 16.4404 9.24516 17.6615C9.29983 17.7655 9.35585 17.8666 9.41312 17.9649C7.32916 17.0598 5.81218 15.0947 5.5428 12.75ZM9.51996 12.75H14.48C14.3838 14.539 13.9505 15.9681 13.4271 16.9635C13.1289 17.5309 12.8115 17.9384 12.5291 18.1937C12.2314 18.4628 12.0459 18.5 12 18.5C11.9541 18.5 11.7686 18.4628 11.4709 18.1937C11.1885 17.9384 10.8711 17.5309 10.5729 16.9635C10.0495 15.9681 9.61624 14.539 9.51996 12.75ZM15.982 12.75C15.8841 14.7697 15.3968 16.4404 14.7548 17.6615C14.7002 17.7655 14.6441 17.8666 14.5869 17.9649C16.6708 17.0598 18.1878 15.0947 18.4572 12.75H15.982ZM18.4572 11.25C18.1878 8.90533 16.6708 6.94017 14.5869 6.03514C14.6441 6.13335 14.7002 6.23451 14.7548 6.33849C15.3968 7.55958 15.8841 9.23031 15.982 11.25H18.4572Z" fill="currentColor"/>\n</svg>\n';var eo='<svg width="43" height="10" viewBox="0 0 43 10" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.35896 0.0640869H0.30768C0.166068 0.0640869 0.0512695 0.178886 0.0512695 0.320497V1.85896C0.0512695 2.00057 0.166068 2.11537 0.30768 2.11537H4.44439C4.54964 2.11537 4.61005 2.2352 4.54745 2.31982L0.151823 8.2615C0.0865163 8.34978 0.0512695 8.45669 0.0512695 8.56649V9.67947C0.0512695 9.82108 0.166068 9.93588 0.30768 9.93588H7.35896C7.50057 9.93588 7.61537 9.82108 7.61537 9.67947V8.14101C7.61537 7.9994 7.50057 7.8846 7.35896 7.8846H3.22226C3.117 7.8846 3.05659 7.76477 3.11919 7.68015L7.51482 1.73847C7.58013 1.65019 7.61537 1.54328 7.61537 1.43348V0.320497C7.61537 0.178886 7.50057 0.0640869 7.35896 0.0640869Z" fill="var(--zonos-elements-gray-800)"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M11.718 0C10.1602 0 8.89746 1.26279 8.89746 2.82051V7.17949C8.89746 8.73721 10.1602 10 11.718 10H13.6411C15.1988 10 16.4616 8.73721 16.4616 7.17949V2.82051C16.4616 1.26279 15.1988 0 13.6411 0H11.718ZM11.718 2.05128C11.2931 2.05128 10.9487 2.39568 10.9487 2.82051V7.17949C10.9487 7.60432 11.2931 7.94872 11.718 7.94872H13.6411C14.0659 7.94872 14.4103 7.60432 14.4103 7.17949V5V2.82051C14.4103 2.39568 14.0659 2.05128 13.6411 2.05128H11.718Z" fill="var(--zonos-elements-gray-800)"/>\n<path d="M17.7437 0.436316V9.71132C17.7437 9.85293 17.8585 9.96773 18.0001 9.96773H19.5385C19.6801 9.96773 19.7949 9.85293 19.7949 9.71132V3.74801C19.7949 3.44829 19.969 3.17587 20.241 3.04996L22.1641 2.15964C22.6739 1.92363 23.2565 2.29592 23.2565 2.85769V9.71132C23.2565 9.85293 23.3713 9.96773 23.5129 9.96773H25.0513C25.193 9.96773 25.3078 9.85293 25.3078 9.71132V2.85595C25.3078 0.79631 23.1718 -0.568775 21.3027 0.296257L19.9742 0.911055C19.8685 0.959946 19.7432 0.931536 19.669 0.84187L19.2748 0.365697C19.1773 0.248019 19.0325 0.179905 18.8797 0.179905H18.0001C17.8585 0.179905 17.7437 0.294704 17.7437 0.436316Z" fill="var(--zonos-elements-gray-800)"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M29.4104 0C27.8526 0 26.5898 1.26279 26.5898 2.82051V7.17949C26.5898 8.73721 27.8526 10 29.4104 10H31.3334C32.8912 10 34.1539 8.73721 34.1539 7.17949V2.82051C34.1539 1.26279 32.8912 0 31.3334 0H29.4104ZM29.4104 2.05128C28.9855 2.05128 28.6411 2.39568 28.6411 2.82051V7.17949C28.6411 7.60432 28.9855 7.94872 29.4104 7.94872H31.3334C31.7583 7.94872 32.1027 7.60432 32.1027 7.17949V2.82051C32.1027 2.39568 31.7583 2.05128 31.3334 2.05128H29.4104Z" fill="var(--zonos-elements-gray-800)"/>\n<path d="M38.2085 0.0640869H40.3889C41.8309 0.0640869 42.9999 1.23306 42.9999 2.67506C42.9999 2.79477 42.9108 2.89574 42.792 2.91059L41.1732 3.11293C41.054 3.12784 40.9486 3.03485 40.9486 2.91466C40.9486 2.47322 40.5908 2.11537 40.1493 2.11537H38.3397C37.8688 2.11537 37.4871 2.49712 37.4871 2.96803C37.4871 3.3685 37.7658 3.71501 38.1569 3.80087L40.7916 4.37922C42.0811 4.66229 42.9999 5.80462 42.9999 7.12486C42.9999 8.67735 41.7414 9.93588 40.1889 9.93588H38.0468C36.6048 9.93588 35.4358 8.76691 35.4358 7.32491C35.4358 7.2052 35.5249 7.10423 35.6437 7.08938L37.2625 6.88703C37.3817 6.87213 37.4871 6.96512 37.4871 7.08531C37.4871 7.52675 37.8449 7.8846 38.2864 7.8846H40.1176C40.5765 7.8846 40.9486 7.51252 40.9486 7.05354C40.9486 6.67478 40.6925 6.34394 40.3258 6.24901L37.5136 5.52093C36.2902 5.20422 35.4358 4.10042 35.4358 2.83676C35.4358 1.30545 36.6772 0.0640869 38.2085 0.0640869Z" fill="var(--zonos-elements-gray-700)"/>\n</svg>\n';var to=function(){return":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:absolute;bottom:0;left:32px;right:32px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;z-index:2}:host .zonos--collect-footer{gap:16px;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;padding:12px;padding-left:0;-ms-flex-align:center;align-items:center;width:100%}:host .zonos--collect-footer .zonos--collect-footer-icon-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:16px}:host .zonos--collect-footer .zonos--collect-footer-icon-wrapper .zonos--collect-footer-logo{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-align:center;align-items:center}:host .zonos--collect-footer .zonos--collect-footer-icon-wrapper .zonos--collect-footer-logo a{line-height:0}:host .zonos--collect-footer .zonos--collect-footer-icon-wrapper a{text-decoration:none}:host .zonos--collect-footer zonos-button button.outline{outline:1px solid var(--zonos-elements-gray-800)}:host .zonos--collect-footer .zonos--collect-locale-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:8px;position:relative}@media (max-width: 400px){:host .zonos--collect-footer .zonos--collect-locale-wrapper{gap:4px}}:host .zonos--collect-footer .zonos--collect-locale-wrapper .zonos--collect-locale-label{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;gap:4px}:host .zonos--collect-footer .zonos--collect-language-dialog{position:absolute;bottom:36px;left:var(--language-dialog-left);background:var(--zonos-elements-surface-color);-webkit-box-shadow:var(--zonos-elements-v3-shadow-xl);box-shadow:var(--zonos-elements-v3-shadow-xl);border-radius:var(--zonos-elements-radius-12);width:360px;max-width:100vw;max-height:500px;z-index:2147483011;overflow:auto;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:bottom left;transform-origin:bottom left;opacity:0;-webkit-transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--collect-footer .zonos--collect-language-dialog::-webkit-scrollbar{width:10px}:host .zonos--collect-footer .zonos--collect-language-dialog::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--collect-footer .zonos--collect-language-dialog::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--collect-footer .zonos--collect-language-dialog::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--collect-footer .zonos--collect-language-dialog::-webkit-scrollbar-track{border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}:host .zonos--collect-footer .zonos--collect-language-dialog.zonos--collect-language-dialog-open{opacity:1;-webkit-transform:scale(1);transform:scale(1)}:host .dot{display:-ms-inline-flexbox;display:inline-flex;background:var(--zonos-elements-gray-400);width:6px;height:6px;border-radius:50%}:host(.mobile),:host(.tablet){background-color:var(--zonos-elements-gray-0);width:100%;position:-webkit-sticky;position:sticky;bottom:0}:host(.tablet) .zonos--collect-footer{width:100%;max-width:800px;-ms-flex-pack:justify;justify-content:space-between;display:-ms-flexbox;display:flex}:host(.mobile) .zonos--collect-locale-wrapper{display:none}:host(.mobile) .zonos--collect-footer{-ms-flex-pack:center;justify-content:center}"};var no=o("zonos_collect_footer",/** @class */function(){function o(o){e(this,o);
|
|
77
|
+
this.notificationType=this.overrideNotification.type;this.notificationTitle=this.overrideNotification.title;this.notificationMessages=this.overrideNotification.messages;this.isLoading=false;return}if(g.isStagingMode){void this.checkStagingOrderStatus()}else if(f.paymentProcessor==="AIRWALLEX"){void this.checkAirwallexPaymentStatus()}else if(C.orderIdCreated){void this.checkPaypalPaymentStatus()}else{void this.checkStripePaymentStatus()}};o.prototype.render=function(){var o=this;var e=window.Zonos.cartId;return n(a,{key:"af26499a2062cf495d4c46a7763ed988a4da0669",class:"zonos--checkout-finish zonos--elements",style:{"--zonos--border-radius":U({overrideBorderStyle:this.borderRadius})}},!this.isLoading&&n("div",{key:"54fb28be3daee7dd1d63f1dcbdb9a84354fcdb6c",class:"zonos--finish-details"},n("div",{key:"9c71e5dbd23e613e1038924f14c0465d94dbad07",class:"zonos--group"},this.notificationType==="success"?n("zonos-icon",{"aria-label":"Order success",content:X,iconColor:"blue-800",size:50}):n("zonos-icon",{"aria-label":"Order failed",content:Q,iconColor:"red-800",size:50}),n("zonos-text",{key:"3285f4bb8854d5bab6eef487d2b2ae3556794998",class:"zonos--title",type:"semiBoldSubheader"},this.notificationTitle),this.confirmationId&&n("zonos-badge",{key:"4cecd6f15ed26fe1e525c01a48e3961845e6f6d8",badgeColor:"gray"},this.confirmationId),n("zonos-text",{key:"dd7c4011d4d7f92fcd19d53e945adf42f2b3f05e",class:"zonos--subtitle",textColor:"gray-600"},this.notificationMessages.map((function(o){return n(s,null,o,n("br",null))}))),this.order&&e&&n("div",{key:"a11bd49a754d32dd15dc34f2311f9706d459f07b",class:"zonos--button-container"},n("zonos-button",{key:"305bcf958a1772cc123414285522e9e0f0b1a839",onClick:function(){window.open(o.getReceiptUrl({cartId:e}),"_blank")},size:"lg",variant:"primary"},I("View receipt"))))))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return o}());J.style=G();var $='<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var oo='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12ZM11.4709 5.80634C11.7686 5.53723 11.9541 5.5 12 5.5C12.0459 5.5 12.2314 5.53723 12.5291 5.80634C12.8115 6.06164 13.1289 6.46913 13.4271 7.03651C13.9505 8.03191 14.3838 9.46098 14.48 11.25H9.51996C9.61624 9.46098 10.0495 8.03191 10.5729 7.03651C10.8711 6.46913 11.1885 6.06164 11.4709 5.80634ZM8.01802 11.25C8.11591 9.23031 8.60319 7.55958 9.24516 6.33849C9.29983 6.23451 9.35585 6.13335 9.41312 6.03514C7.32916 6.94017 5.81218 8.90533 5.5428 11.25H8.01802ZM5.5428 12.75H8.01802C8.11591 14.7697 8.60319 16.4404 9.24516 17.6615C9.29983 17.7655 9.35585 17.8666 9.41312 17.9649C7.32916 17.0598 5.81218 15.0947 5.5428 12.75ZM9.51996 12.75H14.48C14.3838 14.539 13.9505 15.9681 13.4271 16.9635C13.1289 17.5309 12.8115 17.9384 12.5291 18.1937C12.2314 18.4628 12.0459 18.5 12 18.5C11.9541 18.5 11.7686 18.4628 11.4709 18.1937C11.1885 17.9384 10.8711 17.5309 10.5729 16.9635C10.0495 15.9681 9.61624 14.539 9.51996 12.75ZM15.982 12.75C15.8841 14.7697 15.3968 16.4404 14.7548 17.6615C14.7002 17.7655 14.6441 17.8666 14.5869 17.9649C16.6708 17.0598 18.1878 15.0947 18.4572 12.75H15.982ZM18.4572 11.25C18.1878 8.90533 16.6708 6.94017 14.5869 6.03514C14.6441 6.13335 14.7002 6.23451 14.7548 6.33849C15.3968 7.55958 15.8841 9.23031 15.982 11.25H18.4572Z" fill="currentColor"/>\n</svg>\n';var eo='<svg width="43" height="10" viewBox="0 0 43 10" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.35896 0.0640869H0.30768C0.166068 0.0640869 0.0512695 0.178886 0.0512695 0.320497V1.85896C0.0512695 2.00057 0.166068 2.11537 0.30768 2.11537H4.44439C4.54964 2.11537 4.61005 2.2352 4.54745 2.31982L0.151823 8.2615C0.0865163 8.34978 0.0512695 8.45669 0.0512695 8.56649V9.67947C0.0512695 9.82108 0.166068 9.93588 0.30768 9.93588H7.35896C7.50057 9.93588 7.61537 9.82108 7.61537 9.67947V8.14101C7.61537 7.9994 7.50057 7.8846 7.35896 7.8846H3.22226C3.117 7.8846 3.05659 7.76477 3.11919 7.68015L7.51482 1.73847C7.58013 1.65019 7.61537 1.54328 7.61537 1.43348V0.320497C7.61537 0.178886 7.50057 0.0640869 7.35896 0.0640869Z" fill="var(--zonos-elements-gray-800)"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M11.718 0C10.1602 0 8.89746 1.26279 8.89746 2.82051V7.17949C8.89746 8.73721 10.1602 10 11.718 10H13.6411C15.1988 10 16.4616 8.73721 16.4616 7.17949V2.82051C16.4616 1.26279 15.1988 0 13.6411 0H11.718ZM11.718 2.05128C11.2931 2.05128 10.9487 2.39568 10.9487 2.82051V7.17949C10.9487 7.60432 11.2931 7.94872 11.718 7.94872H13.6411C14.0659 7.94872 14.4103 7.60432 14.4103 7.17949V5V2.82051C14.4103 2.39568 14.0659 2.05128 13.6411 2.05128H11.718Z" fill="var(--zonos-elements-gray-800)"/>\n<path d="M17.7437 0.436316V9.71132C17.7437 9.85293 17.8585 9.96773 18.0001 9.96773H19.5385C19.6801 9.96773 19.7949 9.85293 19.7949 9.71132V3.74801C19.7949 3.44829 19.969 3.17587 20.241 3.04996L22.1641 2.15964C22.6739 1.92363 23.2565 2.29592 23.2565 2.85769V9.71132C23.2565 9.85293 23.3713 9.96773 23.5129 9.96773H25.0513C25.193 9.96773 25.3078 9.85293 25.3078 9.71132V2.85595C25.3078 0.79631 23.1718 -0.568775 21.3027 0.296257L19.9742 0.911055C19.8685 0.959946 19.7432 0.931536 19.669 0.84187L19.2748 0.365697C19.1773 0.248019 19.0325 0.179905 18.8797 0.179905H18.0001C17.8585 0.179905 17.7437 0.294704 17.7437 0.436316Z" fill="var(--zonos-elements-gray-800)"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M29.4104 0C27.8526 0 26.5898 1.26279 26.5898 2.82051V7.17949C26.5898 8.73721 27.8526 10 29.4104 10H31.3334C32.8912 10 34.1539 8.73721 34.1539 7.17949V2.82051C34.1539 1.26279 32.8912 0 31.3334 0H29.4104ZM29.4104 2.05128C28.9855 2.05128 28.6411 2.39568 28.6411 2.82051V7.17949C28.6411 7.60432 28.9855 7.94872 29.4104 7.94872H31.3334C31.7583 7.94872 32.1027 7.60432 32.1027 7.17949V2.82051C32.1027 2.39568 31.7583 2.05128 31.3334 2.05128H29.4104Z" fill="var(--zonos-elements-gray-800)"/>\n<path d="M38.2085 0.0640869H40.3889C41.8309 0.0640869 42.9999 1.23306 42.9999 2.67506C42.9999 2.79477 42.9108 2.89574 42.792 2.91059L41.1732 3.11293C41.054 3.12784 40.9486 3.03485 40.9486 2.91466C40.9486 2.47322 40.5908 2.11537 40.1493 2.11537H38.3397C37.8688 2.11537 37.4871 2.49712 37.4871 2.96803C37.4871 3.3685 37.7658 3.71501 38.1569 3.80087L40.7916 4.37922C42.0811 4.66229 42.9999 5.80462 42.9999 7.12486C42.9999 8.67735 41.7414 9.93588 40.1889 9.93588H38.0468C36.6048 9.93588 35.4358 8.76691 35.4358 7.32491C35.4358 7.2052 35.5249 7.10423 35.6437 7.08938L37.2625 6.88703C37.3817 6.87213 37.4871 6.96512 37.4871 7.08531C37.4871 7.52675 37.8449 7.8846 38.2864 7.8846H40.1176C40.5765 7.8846 40.9486 7.51252 40.9486 7.05354C40.9486 6.67478 40.6925 6.34394 40.3258 6.24901L37.5136 5.52093C36.2902 5.20422 35.4358 4.10042 35.4358 2.83676C35.4358 1.30545 36.6772 0.0640869 38.2085 0.0640869Z" fill="var(--zonos-elements-gray-700)"/>\n</svg>\n';var to=function(){return":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:absolute;bottom:0;left:32px;right:32px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;z-index:2}:host .zonos--collect-footer{gap:16px;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;padding:12px;padding-left:0;-ms-flex-align:center;align-items:center;width:100%}:host .zonos--collect-footer .zonos--collect-footer-icon-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:16px}:host .zonos--collect-footer .zonos--collect-footer-icon-wrapper .zonos--collect-footer-logo{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-align:center;align-items:center}:host .zonos--collect-footer .zonos--collect-footer-icon-wrapper .zonos--collect-footer-logo a{line-height:0}:host .zonos--collect-footer .zonos--collect-footer-icon-wrapper a{text-decoration:none}:host .zonos--collect-footer zonos-button button.outline{outline:1px solid var(--zonos-elements-gray-800)}:host .zonos--collect-footer .zonos--collect-locale-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:8px;position:relative}@media (max-width: 400px){:host .zonos--collect-footer .zonos--collect-locale-wrapper{gap:4px}}:host .zonos--collect-footer .zonos--collect-locale-wrapper .zonos--collect-locale-label{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;gap:4px}:host .zonos--collect-footer .zonos--collect-language-dialog{position:absolute;bottom:36px;left:var(--language-dialog-left);background:var(--zonos-elements-surface-color);-webkit-box-shadow:var(--zonos-elements-v3-shadow-xl);box-shadow:var(--zonos-elements-v3-shadow-xl);border-radius:var(--zonos-elements-radius-12);width:360px;max-width:100vw;max-height:500px;z-index:2147483011;overflow:auto;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:bottom left;transform-origin:bottom left;opacity:0;-webkit-transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--collect-footer .zonos--collect-language-dialog::-webkit-scrollbar{width:10px}:host .zonos--collect-footer .zonos--collect-language-dialog::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--collect-footer .zonos--collect-language-dialog::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--collect-footer .zonos--collect-language-dialog::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--collect-footer .zonos--collect-language-dialog::-webkit-scrollbar-track{border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}:host .zonos--collect-footer .zonos--collect-language-dialog.zonos--collect-language-dialog-open{opacity:1;-webkit-transform:scale(1);transform:scale(1)}:host .dot{display:-ms-inline-flexbox;display:inline-flex;background:var(--zonos-elements-gray-400);width:6px;height:6px;border-radius:50%}:host(.mobile),:host(.tablet){background-color:var(--zonos-elements-gray-0);width:100%;position:-webkit-sticky;position:sticky;bottom:0}:host(.tablet) .zonos--collect-footer{width:100%;max-width:800px;-ms-flex-pack:justify;justify-content:space-between;display:-ms-flexbox;display:flex}:host(.mobile) .zonos--collect-locale-wrapper{display:none}:host(.mobile) .zonos--collect-footer{-ms-flex-pack:center;justify-content:center}"};var no=o("zonos_collect_footer",/** @class */function(){function o(o){e(this,o);
|
|
78
78
|
/**
|
|
79
79
|
* Override mobile mode
|
|
80
80
|
*/this.mobile=false;
|
|
81
81
|
/**
|
|
82
82
|
* Override tablet mode
|
|
83
|
-
*/this.tablet=false;this.showLanguageDialog=false;this.isMobile=false;this.isTablet=false}o.prototype.handleGlobalClick=function(o){if(!this.el.contains(o.target)&&this.showLanguageDialog){this.showLanguageDialog=false}};o.prototype.toggleLanguageDialog=function(){this.showLanguageDialog=!this.showLanguageDialog};o.prototype.handleMobileChange=function(){this.isMobile=
|
|
83
|
+
*/this.tablet=false;this.showLanguageDialog=false;this.isMobile=false;this.isTablet=false}o.prototype.handleGlobalClick=function(o){if(!this.el.contains(o.target)&&this.showLanguageDialog){this.showLanguageDialog=false}};o.prototype.toggleLanguageDialog=function(){this.showLanguageDialog=!this.showLanguageDialog};o.prototype.handleMobileChange=function(){this.isMobile=W(this.mobile)};o.prototype.handleTabletChange=function(){this.isTablet=R(this.tablet)};o.prototype.componentWillLoad=function(){this.isMobile=W(this.mobile);this.isTablet=R(this.tablet)};o.prototype.render=function(){var o=this;var e;
|
|
84
84
|
// label resolves against every language, not just the offered ones, so the current
|
|
85
85
|
// locale always renders even if the merchant later drops it from the selector
|
|
86
86
|
var t=(e=S.find((function(o){return o.code===j.selectedLocale})))===null||e===void 0?void 0:e.label;
|
|
@@ -150,8 +150,8 @@ variant:o.submitBtnType},I("Pay [orderTotal]",{orderTotal:N({amount:f.amountDuty
|
|
|
150
150
|
* Whether or not to show the collapse icon
|
|
151
151
|
* This is controled from the collapsed state of the zonos-collapse component
|
|
152
152
|
* to show the collapse icon
|
|
153
|
-
*/this.collapsed=false;this.isMobile=false;this.isTablet=false;this.isLoading=true}o.prototype.handleWindowResize=function(){this.isMobile=
|
|
153
|
+
*/this.collapsed=false;this.isMobile=false;this.isTablet=false;this.isLoading=true}o.prototype.handleWindowResize=function(){this.isMobile=W(this.mobile);this.isTablet=R(this.tablet)};o.prototype.componentWillLoad=function(){var o=this;this.handleWindowResize();
|
|
154
154
|
// Wait for the data to load
|
|
155
|
-
setTimeout((function(){o.isLoading=false}),1e3)};o.prototype.render=function(){var o=this.isMobile?"gray-1000":"gray-800";return n(a,{key:"2ed81c7a0a16b9414fe1ce3799efa3b85679f982",class:A(["zonos--collect-review zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"])},n("div",{key:"fcf9fbc8dd807289bcd1c70406495b0c3396bfb8",class:"zonos--title"},n("zonos-text",{key:"44cfb3b82b8e617687c212e108cacafb45713243",textColor:o,type:"semiBoldLabel"},I("Pay [organizationName] duties, taxes and fees for your shipment",{organizationName:D.organizationName}))),n("div",{key:"5472a1ccc61b49ce8c9578a4c3f801386cab1e7d",class:"zonos--total-pay"},
|
|
155
|
+
setTimeout((function(){o.isLoading=false}),1e3)};o.prototype.render=function(){var o=this.isMobile?"gray-1000":"gray-800";return n(a,{key:"2ed81c7a0a16b9414fe1ce3799efa3b85679f982",class:A(["zonos--collect-review zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"])},n("div",{key:"fcf9fbc8dd807289bcd1c70406495b0c3396bfb8",class:"zonos--title"},n("zonos-text",{key:"44cfb3b82b8e617687c212e108cacafb45713243",textColor:o,type:"semiBoldLabel"},I("Pay [organizationName] duties, taxes and fees for your shipment",{organizationName:D.organizationName}))),n("div",{key:"5472a1ccc61b49ce8c9578a4c3f801386cab1e7d",class:"zonos--total-pay"},Y({content:n("zonos-text",{type:"secondaryPageHeader"},N({amount:f.amountDutyTaxFeeTotal||0,isForeign:true})),isLoading:f.isFetchingShippingInfo,skeletonHeight:"36px",skeletonWidth:"150px"})))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return o}());po.style=ho();var mo=function(){return":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:-webkit-sticky;position:sticky;bottom:60px}:host .zonos--collect-table{width:100%;border:none;border-collapse:collapse;overflow:auto;font-size:var(--zonos-elements-font-size-base)}:host .zonos--collect-table .zonos--column{padding:8px 8px;vertical-align:top}:host .zonos--collect-table .zonos--column:last-child{text-align:right;padding-right:0}:host .zonos--collect-table .zonos--column:first-child{width:60px;max-width:100px}:host .zonos--title-with-icon{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:8px}:host .zonos--collect-subtotal-price{text-align:right}:host .zonos--collect-subtotal-price zonos-text{white-space:nowrap}:host .zonos--collect-total .zonos--column{padding:16px 0}:host .zonos--collect-total-subtotal .zonos--collect-subtotal-title,:host .zonos--collect-total-subtotal .zonos--collect-subtotal-price{border-bottom:1px solid var(--zonos-elements-gray-200)}:host .zonos--collect-subtotal-price zonos-text,:host .zonos--collect-pay-total zonos-text{white-space:nowrap}"};var bo=o("zonos_collect_subtotal",/** @class */function(){function o(o){var t=this;e(this,o);this.storeUnsubscribeList=[];this.subtotals={};this.initSubtotalData=function(){var o;var e;var n=(e=g.checkoutSession)===null||e===void 0?void 0:e.subtotals;if(!n){return}
|
|
156
156
|
// Some countries have same name for duties, taxes and fees in their language. If that happens, we need to group their values by name
|
|
157
|
-
var s=I("Duties");var a=I("Taxes");var l=I("Fees");var i=(o={},o[s]=0,o[l]=0,o[a]=0,o);var r=n.duties;var c=n.taxes;var d=n.fees;if(r!==undefined){i[s]||(i[s]=0);i[s]+=r}if(c!==undefined){i[a]||(i[a]=0);i[a]+=c}if(d!==undefined){i[l]||(i[l]=0);i[l]+=d}t.subtotals=i}}o.prototype.disconnectedCallback=function(){this.storeUnsubscribeList.forEach((function(o){return o()}))};o.prototype.componentWillLoad=function(){this.storeUnsubscribeList=[x("checkoutSession",this.initSubtotalData),H("translatedChunks",this.initSubtotalData)]};o.prototype.render=function(){this.initSubtotalData();return n(a,{key:"f014c2ae733fe652d7d74349c0e12f93f46d71f5",class:"zonos--collect-subtotal zonos--elements"},n("table",{key:"0bab186aa957c29f026151f5a112ff66bb42cb04",class:"zonos--collect-table"},!!this.subtotals[I("Duties")]&&n("tr",{key:"97c24d5f179f5b59bcb91bc156b1d3e15b811262",class:"zonos--row zonos--collect-duty"},n("td",{key:"cba67296a6d17c0cd665981eb19ba95706f68843",class:"zonos--column zonos--collect-subtotal-title"},n("zonos-text",{key:"6665f531a8656c4a1e0f9761d919c150587a36fb",type:"semiBoldLabel"},I("Duties"))),n("td",{key:"20aeeee1fde0e63aaa168f32a5400ea82758a14c",class:"zonos--column"}),n("td",{key:"14994ca56e814f68fa3511098f5299a0942a295a",class:"zonos--column zonos--collect-subtotal-price"},
|
|
157
|
+
var s=I("Duties");var a=I("Taxes");var l=I("Fees");var i=(o={},o[s]=0,o[l]=0,o[a]=0,o);var r=n.duties;var c=n.taxes;var d=n.fees;if(r!==undefined){i[s]||(i[s]=0);i[s]+=r}if(c!==undefined){i[a]||(i[a]=0);i[a]+=c}if(d!==undefined){i[l]||(i[l]=0);i[l]+=d}t.subtotals=i}}o.prototype.disconnectedCallback=function(){this.storeUnsubscribeList.forEach((function(o){return o()}))};o.prototype.componentWillLoad=function(){this.storeUnsubscribeList=[x("checkoutSession",this.initSubtotalData),H("translatedChunks",this.initSubtotalData)]};o.prototype.render=function(){this.initSubtotalData();return n(a,{key:"f014c2ae733fe652d7d74349c0e12f93f46d71f5",class:"zonos--collect-subtotal zonos--elements"},n("table",{key:"0bab186aa957c29f026151f5a112ff66bb42cb04",class:"zonos--collect-table"},!!this.subtotals[I("Duties")]&&n("tr",{key:"97c24d5f179f5b59bcb91bc156b1d3e15b811262",class:"zonos--row zonos--collect-duty"},n("td",{key:"cba67296a6d17c0cd665981eb19ba95706f68843",class:"zonos--column zonos--collect-subtotal-title"},n("zonos-text",{key:"6665f531a8656c4a1e0f9761d919c150587a36fb",type:"semiBoldLabel"},I("Duties"))),n("td",{key:"20aeeee1fde0e63aaa168f32a5400ea82758a14c",class:"zonos--column"}),n("td",{key:"14994ca56e814f68fa3511098f5299a0942a295a",class:"zonos--column zonos--collect-subtotal-price"},Y({content:n("zonos-text",{type:"label"},N({amount:this.subtotals[I("Duties")]||0,isForeign:true})),isLoading:f.isFetchingShippingInfo,skeletonHeight:"14px",skeletonWidth:"150px"}))),!!this.subtotals[I("Taxes")]&&n("tr",{key:"cbbe4ddf13aabca9ff86b21317b067191f4155b8",class:"zonos--row zonos--collect-tax"},n("td",{key:"675a36a92e136f3afd1960616e842e152cba6256",class:"zonos--column zonos--collect-subtotal-title"},n("zonos-text",{key:"8896868f1e7f545d5b92c148a0f9812936ac2a9a",type:"semiBoldLabel"},I("Taxes"))),n("td",{key:"8a4c29f6d2d513fd7da8be7b1ab695794f3a99ab",class:"zonos--column"}),n("td",{key:"c15f7a872e59cce222a674acb55388dd18bfb74a",class:"zonos--column zonos--collect-subtotal-price"},Y({content:n("zonos-text",{type:"label"},N({amount:this.subtotals[I("Taxes")]||0,isForeign:true})),isLoading:f.isFetchingShippingInfo,skeletonHeight:"14px",skeletonWidth:"150px"}))),!!this.subtotals[I("Fees")]&&n("tr",{key:"4cf155874e4446b9ecab121cbaceba2328323359",class:"zonos--row zonos--collect-fee"},n("td",{key:"3efcb4779f34f35a2398eb661f4b799b6b4480c7",class:"zonos--column zonos--collect-subtotal-title"},n("zonos-text",{key:"41d30bb15d216663cd507f2c92d6639b5559708c",type:"semiBoldLabel"},I("Fees"))),n("td",{key:"ef8259d337fb047d8979f5008d2d46f3fc76b007",class:"zonos--column"}),n("td",{key:"e0430efffbe23880a776953ba6a05b0cea268df4",class:"zonos--column zonos--collect-subtotal-price"},Y({content:n("zonos-text",{type:"label"},N({amount:this.subtotals[I("Fees")]||0,isForeign:true})),isLoading:f.isFetchingShippingInfo,skeletonHeight:"14px",skeletonWidth:"150px"}))),n("tr",{key:"279ddddfc6e9fe88bc1f16aeaeb6464737ec212f",class:"zonos--row zonos--collect-spacing"},n("td",{key:"de88842e26eb39938b573fc2ac89915d9f6708ba",class:"zonos--column",colSpan:3})),n("tr",{key:"48ecfc5852f1cb25b7816503f3279a3cffc1a581",class:"zonos--row zonos--collect-total zonos--collect-total-subtotal"},n("td",{key:"06e65acfd5dd213481f415dc2475d9353e18ee53",class:"zonos--column"}),n("td",{key:"b5ae37799d471defdb983a9167b96aa5e176f78e",class:"zonos--column zonos--collect-subtotal-title"},n("zonos-text",{key:"52afa80c7b0eeda13093c26ce031dab4e4a62ee8",type:"label"},I("Subtotal"))),n("td",{key:"840e0413b9c0d651ba7de6529d7c6581f165c047",class:"zonos--column zonos--collect-subtotal-price"},Y({content:n("zonos-text",{type:"label"},N({amount:f.amountDutyTaxFeeTotal||0,isForeign:true})),isLoading:f.isFetchingShippingInfo,skeletonHeight:"14px",skeletonWidth:"150px"}))),n("tr",{key:"62ffc4102084c920e8bde4527415ea93d8ae8292",class:"zonos--row zonos--collect-total"},n("td",{key:"ef199898aa67686f1c36d2d0c73d1695443e81a9",class:"zonos--column"}),n("td",{key:"1bd5949e640823841ac7425a46b519482b975c37",class:"zonos--column zonos--collect-subtotal-title"},n("zonos-text",{key:"96d53a1ffd935ac98cd5560419cc7d5395945da4",type:"semiBoldLabel"},I("Customs fees total"))),n("td",{key:"008f69a34b557f2660426acccafe925f6b554293",class:"zonos--column zonos--collect-subtotal-price"},Y({content:n("zonos-text",{type:"semiBoldLabel"},N({amount:f.amountDutyTaxFeeTotal||0,isForeign:true})),isLoading:f.isFetchingShippingInfo,skeletonHeight:"14px",skeletonWidth:"150px"})))))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return o}());bo.style=mo()}}}));
|