@zonos/elements 1.3.288 → 1.3.289
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{cart-CV4buPlT.js → cart-WLQb2hbe.js} +1 -1
- package/dist/cjs/{collect-jzWKzrV7.js → collect-B92uIdsY.js} +2 -2
- package/dist/cjs/{getMissingRequiredShippingFields-r5vYIqoX.js → getMissingRequiredShippingFields-5w62gTIB.js} +1 -1
- package/dist/cjs/{hasInclusivePrice-BZMQohG9.js → hasInclusivePrice-hmV0Inld.js} +1 -1
- package/dist/cjs/index.cjs.js +8 -9
- package/dist/cjs/{invoice-CHw-mJdS.js → invoice-Bal1mqYR.js} +2 -2
- package/dist/cjs/{localization-CxXsmxs5.js → localization-C5HPlCNK.js} +191 -68
- package/dist/cjs/{paypal-BLuHeOJH.js → paypal-o164C26_.js} +2 -2
- package/dist/cjs/{placeTestOrder-VK_CMeq0.js → placeTestOrder-C7tAipav.js} +2 -2
- package/dist/cjs/{renderCheckoutCurrency-CC4CAy-a.js → renderCheckoutCurrency-Bpx-vrTQ.js} +2 -2
- package/dist/cjs/{shouldShowLanguageSelect-Bj_jKWPK.js → shouldShowLanguageSelect-CtwkMt8b.js} +1 -1
- package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +7 -7
- package/dist/cjs/zonos-address-display_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-address_4.cjs.entry.js +4 -4
- package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +3 -3
- package/dist/cjs/zonos-card_5.cjs.entry.js +4 -4
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +9 -9
- package/dist/cjs/zonos-checkout.cjs.entry.js +6 -6
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +2 -2
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +8 -8
- package/dist/cjs/zonos-collect.cjs.entry.js +4 -4
- package/dist/cjs/zonos-controller.cjs.entry.js +4 -4
- package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +4 -4
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +8 -8
- package/dist/cjs/zonos-invoice.cjs.entry.js +4 -4
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +3 -3
- package/dist/cjs/zonos-stripe-input.cjs.entry.js +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +1 -1
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.js +1 -1
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.js +1 -1
- package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +1 -1
- package/dist/collection/components/main/zonos-controller.js +2 -2
- package/dist/collection/components/paypal/zonos-paypal-payment.js +1 -2
- package/dist/collection/components/store/hello/localization.js +69 -34
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +2 -2
- package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +2 -3
- package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +2 -2
- package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +0 -1
- package/dist/collection/components/utils/api/getLocalization.js +2 -2
- package/dist/collection/components/utils/checkout/isShippableCountry.js +2 -4
- package/dist/collection/components/utils/checkout/watchBigcommerceDomesticCheckout.js +1 -0
- package/dist/collection/components/utils/checkout/watchImmediateBigcommerceDomesticCheckoutRedirect.js +2 -0
- package/dist/collection/components/utils/formatDate.js +1 -3
- package/dist/collection/components/utils/getOverridenZCountry.js +3 -5
- package/dist/collection/components/utils/hello/countryOverrideStorage.js +49 -0
- package/dist/collection/components/utils/hello/getZCountryUrlParam.js +5 -9
- package/dist/collection/components/utils/hello/isCountryCode.js +1 -0
- package/dist/collection/components/utils/hello/isCountryInShippingZone.js +8 -0
- package/dist/collection/components/utils/hello/reconcileRememberedCountryOverride.js +37 -0
- package/dist/collection/components/utils/hello/shouldShowHelloWidget.js +27 -20
- package/dist/collection/environment.js +0 -1
- package/dist/collection/scripts/_stripe.js +0 -2
- package/dist/collection/scripts/_zonosBase.js +1 -1
- package/dist/collection/types/generated/graphql.frontend.types.js +218 -63
- package/dist/collection/types/generated/graphql.internal.types.js +643 -147
- package/dist/collection/utils/formattedCloudflareApiUrl.js +1 -0
- package/dist/collection/utils/generateCloudflareDeployUrl.js +5 -2
- package/dist/esm/{cart-ekBk_gxV.js → cart-BDc4RTBJ.js} +1 -1
- package/dist/esm/{collect-33rMINDo.js → collect-NRCK3t-M.js} +2 -2
- package/dist/esm/{getMissingRequiredShippingFields-u1nhQzJ1.js → getMissingRequiredShippingFields-D-B-N1NH.js} +1 -1
- package/dist/esm/{hasInclusivePrice-CAVXi310.js → hasInclusivePrice-Bti4iudO.js} +1 -1
- package/dist/esm/index.js +8 -9
- package/dist/esm/{invoice-BNDWuVsD.js → invoice-DsvQvu4a.js} +2 -2
- package/dist/esm/{localization-AOqYXGdP.js → localization-Bs6hVcKV.js} +191 -69
- package/dist/esm/{paypal-CW1D2XqZ.js → paypal-BqyEZS_u.js} +2 -2
- package/dist/esm/{placeTestOrder-nhmsLLOA.js → placeTestOrder-x3xwMAnW.js} +2 -2
- package/dist/esm/{renderCheckoutCurrency-BQANmZyM.js → renderCheckoutCurrency-DIBdWKN1.js} +2 -2
- package/dist/esm/{shouldShowLanguageSelect-BQFCXouB.js → shouldShowLanguageSelect-Bb9sbQ41.js} +1 -1
- package/dist/esm/zonos-address-completion-dialog_7.entry.js +7 -7
- package/dist/esm/zonos-address-display_2.entry.js +1 -1
- package/dist/esm/zonos-address_4.entry.js +4 -4
- package/dist/esm/zonos-airwallex-payment.entry.js +3 -3
- package/dist/esm/zonos-card_5.entry.js +4 -4
- package/dist/esm/zonos-cart-items_12.entry.js +9 -9
- package/dist/esm/zonos-checkout.entry.js +6 -6
- package/dist/esm/zonos-collect-cart-items_3.entry.js +2 -2
- package/dist/esm/zonos-collect-finish_6.entry.js +8 -8
- package/dist/esm/zonos-collect.entry.js +4 -4
- package/dist/esm/zonos-controller.entry.js +4 -4
- package/dist/esm/zonos-country-flag.entry.js +1 -1
- package/dist/esm/zonos-country-select_4.entry.js +2 -2
- package/dist/esm/zonos-hello-dialog.entry.js +2 -2
- package/dist/esm/zonos-hello.entry.js +1 -1
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +4 -4
- package/dist/esm/zonos-invoice-finish_5.entry.js +8 -8
- package/dist/esm/zonos-invoice.entry.js +4 -4
- package/dist/esm/zonos-language-select_2.entry.js +1 -1
- package/dist/esm/zonos-policy-consent_2.entry.js +3 -3
- package/dist/esm/zonos-stripe-input.entry.js +1 -1
- package/dist/esm-es5/{cart-ekBk_gxV.js → cart-BDc4RTBJ.js} +1 -1
- package/dist/esm-es5/{collect-33rMINDo.js → collect-NRCK3t-M.js} +1 -1
- package/dist/esm-es5/{getMissingRequiredShippingFields-u1nhQzJ1.js → getMissingRequiredShippingFields-D-B-N1NH.js} +1 -1
- package/dist/esm-es5/{hasInclusivePrice-CAVXi310.js → hasInclusivePrice-Bti4iudO.js} +1 -1
- package/dist/esm-es5/index.js +6 -8
- package/dist/esm-es5/{invoice-BNDWuVsD.js → invoice-DsvQvu4a.js} +1 -1
- package/dist/esm-es5/{localization-AOqYXGdP.js → localization-Bs6hVcKV.js} +74 -68
- package/dist/esm-es5/{paypal-CW1D2XqZ.js → paypal-BqyEZS_u.js} +1 -1
- package/dist/esm-es5/{placeTestOrder-nhmsLLOA.js → placeTestOrder-x3xwMAnW.js} +1 -1
- package/dist/esm-es5/{renderCheckoutCurrency-BQANmZyM.js → renderCheckoutCurrency-DIBdWKN1.js} +1 -1
- package/dist/esm-es5/{shouldShowLanguageSelect-BQFCXouB.js → shouldShowLanguageSelect-Bb9sbQ41.js} +1 -1
- package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +3 -3
- package/dist/esm-es5/zonos-address-display_2.entry.js +1 -1
- package/dist/esm-es5/zonos-address_4.entry.js +2 -2
- package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
- package/dist/esm-es5/zonos-card_5.entry.js +2 -2
- package/dist/esm-es5/zonos-cart-items_12.entry.js +2 -2
- package/dist/esm-es5/zonos-checkout.entry.js +4 -4
- package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-finish_6.entry.js +2 -2
- package/dist/esm-es5/zonos-collect.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +3 -3
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-finish_5.entry.js +2 -2
- package/dist/esm-es5/zonos-invoice.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
- package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/store/hello/localization.d.ts +2 -1
- package/dist/types/components/utils/api/getLocalization.d.ts +3 -1
- package/dist/types/components/utils/getOverridenZCountry.d.ts +2 -3
- package/dist/types/components/utils/hello/countryOverrideStorage.d.ts +5 -0
- package/dist/types/components/utils/hello/isCountryCode.d.ts +2 -0
- package/dist/types/components/utils/hello/isCountryInShippingZone.d.ts +2 -0
- package/dist/types/components/utils/hello/reconcileRememberedCountryOverride.d.ts +18 -0
- package/dist/types/components/utils/hello/shouldShowHelloWidget.d.ts +8 -4
- package/dist/types/types/generated/graphql.frontend.types.d.ts +41 -52
- package/dist/types/types/generated/graphql.frontend.types.ts +226 -114
- package/dist/types/types/generated/graphql.internal.types.d.ts +231 -94
- package/dist/types/types/generated/graphql.internal.types.ts +712 -245
- package/dist/types/utils/formattedCloudflareApiUrl.d.ts +1 -0
- package/dist/types/utils/generateCloudflareDeployUrl.d.ts +5 -2
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-02628b9f.entry.js +1 -0
- package/dist/zonos-elements/{p-04cc0dac.system.entry.js → p-02ff6f8b.system.entry.js} +38 -38
- package/dist/zonos-elements/p-037d3688.entry.js +1 -0
- package/dist/zonos-elements/{p-02ef0f99.system.entry.js → p-03fbe813.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-5a631080.system.entry.js → p-0ff26236.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-f2cedbcd.system.entry.js → p-163b81c0.system.entry.js} +6 -6
- package/dist/zonos-elements/{p-e9320825.entry.js → p-18021e6b.entry.js} +1 -1
- package/dist/zonos-elements/{p-dcdbc610.system.entry.js → p-22fab1ba.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b14819ab.system.entry.js → p-2466b5f0.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-daf9fa07.system.entry.js → p-317d4665.system.entry.js} +19 -19
- package/dist/zonos-elements/{p-d55b9664.system.entry.js → p-36559431.system.entry.js} +17 -17
- package/dist/zonos-elements/{p-f27317d3.system.entry.js → p-3cc27e0e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-891b47d7.entry.js → p-3d536086.entry.js} +1 -1
- package/dist/zonos-elements/{p-a38e62cc.entry.js → p-3e59d41c.entry.js} +1 -1
- package/dist/zonos-elements/{p-64e7bc5b.entry.js → p-4625058a.entry.js} +1 -1
- package/dist/zonos-elements/{p-5024df2d.system.entry.js → p-56159b7c.system.entry.js} +60 -60
- package/dist/zonos-elements/p-5e074243.entry.js +1 -0
- package/dist/zonos-elements/{p-9818f823.entry.js → p-5eb82be3.entry.js} +1 -1
- package/dist/zonos-elements/{p-cf5688f7.entry.js → p-628a0f7f.entry.js} +1 -1
- package/dist/zonos-elements/{p-5d3079e8.entry.js → p-635341d6.entry.js} +1 -1
- package/dist/zonos-elements/{p-d4c4a00e.entry.js → p-68e0180a.entry.js} +1 -1
- package/dist/zonos-elements/{p-6b0afaa7.entry.js → p-6c6c65f0.entry.js} +1 -1
- package/dist/zonos-elements/{p-04bfcd72.system.entry.js → p-72b6a006.system.entry.js} +18 -18
- package/dist/zonos-elements/{p-4973f8d8.system.entry.js → p-8cac7911.system.entry.js} +8 -8
- package/dist/zonos-elements/p-97f848f6.entry.js +1 -0
- package/dist/zonos-elements/p-9H2p9XKE.js +1 -0
- package/dist/zonos-elements/{p-CJCoACvU.js → p-B6X55m0b.js} +2 -2
- package/dist/zonos-elements/p-Bu9WCfUC.system.js +1 -1
- package/dist/zonos-elements/{p-D31lQiWo.system.js → p-BybDGrH4.system.js} +4 -4
- package/dist/zonos-elements/{p-DTgv0QpG.js → p-CGkdA4pY.js} +1 -1
- package/dist/zonos-elements/{p-D5AtAlJx.system.js → p-CH6tsv9B.system.js} +1 -1
- package/dist/zonos-elements/{p-CYdt69j5.system.js → p-CQyFoOXW.system.js} +23 -23
- package/dist/zonos-elements/{p-B2EZRfoq.system.js → p-CVQ7-7E2.system.js} +18 -18
- package/dist/zonos-elements/{p-DIJaXkiE.system.js → p-Cd9xIgx7.system.js} +111 -105
- package/dist/zonos-elements/{p-CQqNJo0D.system.js → p-ClUEwqZW.system.js} +4 -4
- package/dist/zonos-elements/{p-DkpYo2Fs.js → p-CpvnCfKt.js} +1 -1
- package/dist/zonos-elements/p-CtKp6AQ4.js +1 -0
- package/dist/zonos-elements/{p-DGsEWFDU.system.js → p-CuhGrJBA.system.js} +1 -1
- package/dist/zonos-elements/{p-D-DawUYF.system.js → p-D2fOB4Wn.system.js} +1 -1
- package/dist/zonos-elements/{p-BtMauqj_.system.js → p-D4WI0B6-.system.js} +6 -8
- package/dist/zonos-elements/{p-CKTIJ2Gr.js → p-DdpeA8cH.js} +1 -1
- package/dist/zonos-elements/p-DkirvyAh.js +1 -0
- package/dist/zonos-elements/{p-DHwpNxG9.js → p-DqEtY53c.js} +1 -1
- package/dist/zonos-elements/{p-DjuFsKLG.js → p-MHVIIOVE.js} +1 -1
- package/dist/zonos-elements/{p-DPW1yXt9.system.js → p-NL_Eiq6m.system.js} +65 -65
- package/dist/zonos-elements/{p-Dj-O6VfM.system.js → p-UM1aYZBV.system.js} +2 -2
- package/dist/zonos-elements/p-a6354d15.entry.js +1 -0
- package/dist/zonos-elements/{p-8cd3f1e2.entry.js → p-b78bab27.entry.js} +1 -1
- package/dist/zonos-elements/{p-f6ba59f6.system.entry.js → p-b88e521e.system.entry.js} +14 -14
- package/dist/zonos-elements/{p-450ed170.system.entry.js → p-b96666ca.system.entry.js} +3 -3
- package/dist/zonos-elements/{p-39c8a898.entry.js → p-c090cc60.entry.js} +1 -1
- package/dist/zonos-elements/{p-cadf6b63.system.entry.js → p-c4713ff1.system.entry.js} +10 -10
- package/dist/zonos-elements/{p-ea8790aa.entry.js → p-c5f17bad.entry.js} +1 -1
- package/dist/zonos-elements/{p-f57495dc.entry.js → p-cc17a230.entry.js} +1 -1
- package/dist/zonos-elements/{p-7ae48e31.entry.js → p-cf53f67a.entry.js} +1 -1
- package/dist/zonos-elements/{p-7a5d2211.system.entry.js → p-d261f27c.system.entry.js} +15 -15
- package/dist/zonos-elements/{p-e101d722.system.entry.js → p-d451d5bc.system.entry.js} +4 -4
- package/dist/zonos-elements/{p-d33dfc78.system.entry.js → p-d9527bd7.system.entry.js} +35 -35
- package/dist/zonos-elements/{p-f6e0aeba.system.entry.js → p-e126e9bd.system.entry.js} +176 -176
- package/dist/zonos-elements/{p-e284d329.entry.js → p-e582ae2a.entry.js} +1 -1
- package/dist/zonos-elements/{p-5562a955.system.entry.js → p-e9a3bc27.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-844a743a.entry.js → p-f44631d5.entry.js} +1 -1
- package/dist/zonos-elements/{p-5836d426.system.entry.js → p-fcfac62f.system.entry.js} +1 -1
- package/dist/zonos-elements/p-opB7B9YB.js +1 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +12 -11
- package/dist/zonos-elements/p-2ba738ec.entry.js +0 -1
- package/dist/zonos-elements/p-4a54f664.entry.js +0 -1
- package/dist/zonos-elements/p-6f742021.entry.js +0 -1
- package/dist/zonos-elements/p-89ddab88.entry.js +0 -1
- package/dist/zonos-elements/p-C19J2XSh.js +0 -1
- package/dist/zonos-elements/p-LypTHRUC.js +0 -1
- package/dist/zonos-elements/p-adfee3a3.entry.js +0 -1
- package/dist/zonos-elements/p-lGLcGvEA.js +0 -1
- package/dist/zonos-elements/p-pfIceXbY.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r["throw"](e))}catch(e){o(e)}}function u(e){e.done?n(e.value):i(e.value).then(a,s)}u((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=s(0),a["throw"]=s(1),a["return"]=s(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return u([e,t])}}function u(s){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(n=0)),n)try{if(r=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;i=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){n.label=s[1];break}if(s[0]===6&&n.label<o[1]){n.label=o[1];o=s;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(s);break}if(o[2])n.ops.pop();n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e];i=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-CPnR_T0a.system.js","./p-
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r["throw"](e))}catch(e){o(e)}}function u(e){e.done?n(e.value):i(e.value).then(a,s)}u((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=s(0),a["throw"]=s(1),a["return"]=s(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return u([e,t])}}function u(s){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(n=0)),n)try{if(r=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;i=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){n.label=s[1];break}if(s[0]===6&&n.label<o[1]){n.label=o[1];o=s;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(s);break}if(o[2])n.ops.pop();n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e];i=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-CPnR_T0a.system.js","./p-NL_Eiq6m.system.js","./p-Cd9xIgx7.system.js","./p-zVLAvre1.system.js","./p-BbgqQIHv.system.js"],(function(e){"use strict";var t,n,r,i,o,a,s,u,d,c,l;return{setters:[function(e){t=e.c;n=e.z},function(e){r=e.d;i=e.Y;o=e.b;a=e.a0},function(e){s=e.s},function(e){u=e.h;d=e.s;c=e.l},function(e){l=e.b}],execute:function(){var f=this;var v=t((function(){return{amountTotalDue:null,isFetchingPayorInfo:true,landedCostShortId:null,partyBillingId:null,payorAddress:null}})).state;e("c",v);var I=e("a",(function(e){return __awaiter(f,[e],void 0,(function(e){var t,i,o,a,s;var c=e.landedCostId,l=e.retries,f=l===void 0?5:l;return __generator(this,(function(e){switch(e.label){case 0:v.isFetchingPayorInfo=true;return[4/*yield*/,u("/api/zonos-elements/invoice/get-payor-info-by-lc-id",{body:{landedCostId:c},method:"POST"})];case 1:a=e.sent();if(!a.errors.length)return[3/*break*/,4];if(!(f>0))return[3/*break*/,3];
|
|
2
2
|
// Wait for 1 second before retrying
|
|
3
3
|
return[4/*yield*/,new Promise((function(e){return setTimeout(e,1e3)}))];case 2:
|
|
4
4
|
// Wait for 1 second before retrying
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,n,t,r){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r["throw"](e))}catch(e){o(e)}}function s(e){e.done?t(e.value):i(e.value).then(a,u)}s((r=r.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=u(0),a["throw"]=u(1),a["return"]=u(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(n){return s([e,n])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(t=0)),t)try{if(r=1,i&&(o=u[0]&2?i["return"]:u[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;if(i=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;i=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(o=t.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1];o=u;break}if(o&&t.label<o[2]){t.label=o[2];t.ops.push(u);break}if(o[2])t.ops.pop();t.trys.pop();continue}u=n.call(e,t)}catch(e){u=[6,e];i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-CPnR_T0a.system.js","./p-
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,n,t,r){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r["throw"](e))}catch(e){o(e)}}function s(e){e.done?t(e.value):i(e.value).then(a,u)}s((r=r.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=u(0),a["throw"]=u(1),a["return"]=u(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(n){return s([e,n])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(t=0)),t)try{if(r=1,i&&(o=u[0]&2?i["return"]:u[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;if(i=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;i=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(o=t.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1];o=u;break}if(o&&t.label<o[2]){t.label=o[2];t.ops.push(u);break}if(o[2])t.ops.pop();t.trys.pop();continue}u=n.call(e,t)}catch(e){u=[6,e];i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-CPnR_T0a.system.js","./p-Cd9xIgx7.system.js","./p-zVLAvre1.system.js","./p-BbgqQIHv.system.js","./p-NL_Eiq6m.system.js"],(function(e){"use strict";var n,t,r,i,o,a,u,s,c,f,l,v,d,m;return{setters:[function(e){n=e.c;t=e.z},function(e){r=e.t;i=e.l;o=e.s},function(e){a=e.l;u=e.h;s=e.s},function(e){c=e.l;f=e.b},function(e){l=e.d;v=e.Y;d=e.b;m=e.a0}],execute:function(){var p=this;
|
|
2
2
|
// src/constant/common.ts
|
|
3
3
|
function h(e,n){if(n==null||n>e.length)n=e.length;for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function y(e){if(Array.isArray(e))return e}function w(e){if(Array.isArray(e))return h(e)}function g(e,n,t,r,i,o,a){try{var u=e[o](a);var s=u.value}catch(e){t(e);return}if(u.done){n(s)}else{Promise.resolve(s).then(r,i)}}function b(e){return function(){var n=this,t=arguments;return new Promise((function(r,i){var o=e.apply(n,t);function a(e){g(o,r,i,a,u,"next",e)}function u(e){g(o,r,i,a,u,"throw",e)}a(undefined)}))}}function k(e,n){if(!(e instanceof n)){throw new TypeError("Cannot call a class as a function")}}function x(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function E(e,n,t){if(n)x(e.prototype,n);return e}function I(e,n,t){if(n in e){Object.defineProperty(e,n,{value:t,enumerable:true,configurable:true,writable:true})}else{e[n]=t}return e}function S(e,n){if(n!=null&&typeof Symbol!=="undefined"&&n[Symbol.hasInstance]){return!!n[Symbol.hasInstance](e)}else{return e instanceof n}}function N(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function C(e,n){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var r=[];var i=true;var o=false;var a,u;try{for(t=t.call(e);!(i=(a=t.next()).done);i=true){r.push(a.value);if(r.length===n)break}}catch(e){o=true;u=e}finally{try{if(!i&&t["return"]!=null)t["return"]()}finally{if(o)throw u}}return r}function T(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function D(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function P(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};var r=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))}r.forEach((function(n){I(e,n,t[n])}))}return e}function R(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}function O(e,n){n=n!=null?n:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(n))}else{R(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function j(e,n){return y(e)||C(e,n)||L(e,n)||T()}function _(e){return w(e)||N(e)||L(e)||D()}function A(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function L(e,n){if(!e)return;if(typeof e==="string")return h(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor)t=e.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return h(e,n)}function U(e,n){var t,r,i,o,a={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(e){return function(n){return s([e,n])}}function s(o){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,r&&(i=o[0]&2?r["return"]:o[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;if(r=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:a.label++;return{value:o[1],done:false};case 5:a.label++;r=o[1];o=[0];continue;case 7:o=a.ops.pop();a.trys.pop();continue;default:if(!(i=a.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){a=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(o[0]===6&&a.label<i[1]){a.label=i[1];i=o;break}if(i&&a.label<i[2]){a.label=i[2];a.ops.push(o);break}if(i[2])a.ops.pop();a.trys.pop();continue}o=n.call(e,a)}catch(e){o=[6,e];r=0}finally{t=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}var M=function(e){e["production"]="prod";e["demo"]="demo";e["staging"]="staging";return e}(M||{});
|
|
4
4
|
// src/constant/config.ts
|
|
5
|
-
var F="airTracker_unknown";var K={appName:F,appVersion:F,env:"staging"/* staging */,isWebappContainer:false,delay:2e3,errorRepeatTime:3,enableErrorMonitoring:false,assetSpeedMonitoringWhiteList:[],enableDetectPageChange:false,enableRecordPageRetention:false,hideSearchParams:false,useSessionStorageForSessionId:false,assetSpeedMonitoringWhiteListByMFE:{}};var
|
|
5
|
+
var F="airTracker_unknown";var K={appName:F,appVersion:F,env:"staging"/* staging */,isWebappContainer:false,delay:2e3,errorRepeatTime:3,enableErrorMonitoring:false,assetSpeedMonitoringWhiteList:[],enableDetectPageChange:false,enableRecordPageRetention:false,hideSearchParams:false,useSessionStorageForSessionId:false,assetSpeedMonitoringWhiteListByMFE:{}};var q={appName:F,env:"staging"/* staging */,sessionId:F,deviceId:F};
|
|
6
6
|
// src/util/jsonHelper.ts
|
|
7
|
-
var
|
|
7
|
+
var H=function(e){if(!e){return false}if(/^\s*$/.test(e))return false;e=e.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@");e=e.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");e=e.replace(/(?:^|:|,)(?:\s*\[)+/g,"");return/^[\],:{}\s]*$/.test(e)};var z=function(){var e=new WeakSet;return function(n,t){if(S(t,Error)){return"Error.message: ".concat(t.message," \n Error.stack: ").concat(t.stack)}if((typeof t==="undefined"?"undefined":A(t))==="object"&&t!==null){if(e.has(t)){return"[Circular ".concat(n||"root","]")}e.add(t)}if(typeof t==="function"){return"function"}if((typeof t==="undefined"?"undefined":A(t))==="symbol"){return"symbol"}if(typeof t==="undefined"){return null}return t}};var B=function(e){if(typeof e==="string"){return e}try{if(S(e,Error)){return(JSON.stringify(e,z())||"undefined").replace(/"/gim,"")}return JSON.stringify(e,z())}catch(e){return'{"error":"error happen when airTracker stringify"}'}};
|
|
8
8
|
// src/util/http.ts
|
|
9
|
-
var W=function(e){var n=e.method,t=n===void 0?"post":n,r=e.url,i=e.data,o=e.success,a=e.fail;if(!
|
|
9
|
+
var W=function(e){var n=e.method,t=n===void 0?"post":n,r=e.url,i=e.data,o=e.success,a=e.fail;if(!H(i)){return}var u=new XMLHttpRequest;u.addEventListener("readystatechange",(function(){if(u.readyState===4){if(u.status>=400||u.status===0){a===null||a===void 0?void 0:a(u.response)}else{o===null||o===void 0?void 0:o(u.response)}}}));u.open(t,r);u.setRequestHeader("Content-Type","application/json");u.send(i)};
|
|
10
10
|
// src/constant/lifeCycleEventName.ts
|
|
11
|
-
var
|
|
11
|
+
var V={onInit:"onInit",onConfigInit:"onConfigInit",onCommonDataInit:"onCommonDataInit",onCommonUpdated:"onCommonUpdated"};
|
|
12
12
|
// src/constant/index.ts
|
|
13
|
-
var
|
|
13
|
+
var X="AIR_ANALYTICS_DEVICE_ID";var G="AIR_ANALYTICS_SESSION_ID";var $="AWX_RISK_ID";var J=function(e){if(e=="prod"/* production */){return"https://o11y.airwallex.com/airtracker/logs"}if(e=="demo"/* demo */){return"https://o11y-demo.airwallex.com/airtracker/logs"}return"https://o11y-staging.airwallex.com/airtracker/logs"};var Q=function(e){if(e=="prod"/* production */){return"https://o11y.airwallex.com/airtracker/metrics"}if(e=="demo"/* demo */){return"https://o11y-demo.airwallex.com/airtracker/metrics"}return"https://o11y-staging.airwallex.com/airtracker/metrics"};
|
|
14
14
|
// src/util/index.ts
|
|
15
|
-
var Y=function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=Math.random()*16|0;var t=e==="x"?n:n&3|8;return t.toString(16)}));return e};var Z=function(e){var n,t,r;if(e.config.getMFEName){return e.config.getMFEName()}return((r=location)===null||r===void 0?void 0:(t=r.pathname)===null||t===void 0?void 0:(n=t.split("/"))===null||n===void 0?void 0:n[2])||"unknown"};var ee=function(){try{var e=window.sessionStorage.getItem(G);if(!e){e=Y();window.sessionStorage.setItem(G,e)}return e}catch(e){return Y()}};var ne=function(){try{var e=window.localStorage.getItem(
|
|
15
|
+
var Y=function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=Math.random()*16|0;var t=e==="x"?n:n&3|8;return t.toString(16)}));return e};var Z=function(e){var n,t,r;if(e.config.getMFEName){return e.config.getMFEName()}return((r=location)===null||r===void 0?void 0:(t=r.pathname)===null||t===void 0?void 0:(n=t.split("/"))===null||n===void 0?void 0:n[2])||"unknown"};var ee=function(){try{var e=window.sessionStorage.getItem(G);if(!e){e=Y();window.sessionStorage.setItem(G,e)}return e}catch(e){return Y()}};var ne=function(){try{var e=window.localStorage.getItem(X);if(!e){e=Y();window.localStorage.setItem(X,e)}return e}catch(e){}};var te=function(){try{var e=window.localStorage.getItem($);return e||void 0}catch(e){}};var re=function(){var e;var n="";var t=navigator.userAgent.match(/NetType\/(\w+)/);if(t){var r;r=j(t,2),n=r[1]}else if((e=navigator)===null||e===void 0?void 0:e.connection){var i,o,a,u;n=((o=navigator)===null||o===void 0?void 0:(i=o.connection)===null||i===void 0?void 0:i.effectiveType)||((u=navigator)===null||u===void 0?void 0:(a=u.connection)===null||a===void 0?void 0:a.type)}if(!n){n="unknown"}return ie(n)};var ie=function(e){e=String(e).toLowerCase();if(e.indexOf("4g")>=0)return"net4g"/* net4g */;if(e.indexOf("wifi")>=0)return"wifi"/* wifi */;if(e.indexOf("5g")>=0)return"net5g"/* net5g */;if(e.indexOf("3g")>=0)return"net3g"/* net3g */;if(e.indexOf("2g")>=0)return"net2g"/* net2g */;return"unknown"/* unknown */};var oe=function e(){return typeof window.performance!=="undefined"&&typeof window.performance.clearResourceTimings==="function"&&typeof window.performance.getEntriesByType==="function"&&typeof window.performance.now==="function"};var ae=function(e){if(typeof e==="string"){var n=e.split("?")[0]||"";return n.slice(0,200)}return e};var ue=function(e){if(typeof e==="string"){return e.split("?")[1]||""}return e};var se=function(e){var n=typeof e==="string"&&e.startsWith("//");return n?typeof location!=="undefined"&&location.protocol==="https:":/^https/.test(e)};var ce=function(e,n){if(typeof e==="number"){return e}if(typeof e==="string"){return e}return-1/* number */};var fe=function(e,n){var t;var r=false;if(!n.config.isWebappContainer){r=le(e,n.config.assetSpeedMonitoringWhiteList);return r}var i=Z(n);return r||le(e,(t=n.config.assetSpeedMonitoringWhiteListByMFE)===null||t===void 0?void 0:t[i])};var le=function(e,n){if(!(n===null||n===void 0?void 0:n.length)){return false}for(var t=0;t<n.length;t++){var r=n[t];if(S(r,RegExp)&&r.test(e)){return true}if(typeof r=="string"&&e.includes(r)){return true}}return false};var ve=function(e,n){var t=100;return Math.round((e-n)*t)/t};
|
|
16
16
|
// src/pipes/send.ts
|
|
17
|
-
var de=function(e){return function(n){var t,r;var i=Z(e);var o=e.config.isWebappContainer?P({},e.commonData||{},((t=e.MFECommonDataMap)===null||t===void 0?void 0:t[i])||{}):e.commonData;var a=Array.isArray(n)?n:[n];if(a.length===0){return}var u={commonData:o,data:a};var s=B(u);var c={method:"post",url
|
|
17
|
+
var de=function(e){return function(n){var t,r;var i=Z(e);var o=e.config.isWebappContainer?P({},e.commonData||{},((t=e.MFECommonDataMap)===null||t===void 0?void 0:t[i])||{}):e.commonData;var a=Array.isArray(n)?n:[n];if(a.length===0){return}var u={commonData:o,data:a};var s=B(u);var c={method:"post",url:J(e.commonData.env),data:s};if(typeof((r=navigator)===null||r===void 0?void 0:r.sendBeacon)==="function"){var f=navigator.sendBeacon(c.url,s);if(!f){W(c)}}else{W(c)}}};var me=function(e){return function(n){var t,r;var i=Z(e);var o=e.config.isWebappContainer?P({},e.commonData||{},((t=e.MFECommonDataMap)===null||t===void 0?void 0:t[i])||{}):e.commonData;var a={commonData:o,data:Array.isArray(n)?n:[n]};var u=B(a);var s={method:"post",url:Q(e.commonData.env),data:u};if(typeof((r=navigator)===null||r===void 0?void 0:r.sendBeacon)==="function"){var c=navigator.sendBeacon(s.url,u);if(!c){W(s)}}else{W(s)}}};
|
|
18
18
|
// src/pipes/throttle.ts
|
|
19
|
-
var pe=function(e,n){var t;var r=[];var i=e.config;window.addEventListener("beforeunload",(function(){if(r.length>0){e.immediateSendPipe(r.splice(0,r.length));t&&clearTimeout(t)}}));return function(o,a){r.push(o);e.lifeCycle.on(
|
|
19
|
+
var pe=function(e,n){var t;var r=[];var i=e.config;window.addEventListener("beforeunload",(function(){if(r.length>0){e.immediateSendPipe(r.splice(0,r.length));t&&clearTimeout(t)}}));return function(o,a){r.push(o);e.lifeCycle.on(V.onCommonUpdated,(function(){if(r.length>0){a===null||a===void 0?void 0:a(r.splice(0,r.length));e.lifeCycle.remove(V.onCommonUpdated);t&&clearTimeout(t)}}));if(r.length>=n){a===null||a===void 0?void 0:a(r.splice(0,r.length));t&&clearTimeout(t);return}t&&clearTimeout(t);t=setTimeout((function(){t=null;if(r.length>0){a===null||a===void 0?void 0:a(r.splice(0,r.length));e.lifeCycle.remove(V.onCommonUpdated)}}),i.delay)}};
|
|
20
20
|
// src/pipes/errorRepeatLimit.ts
|
|
21
21
|
var he=function(e){var n={};return function(t,r){var i=typeof e.config.errorRepeatTime==="number"?e.config.errorRepeatTime:5;if(i===0){return r===null||r===void 0?void 0:r(t)}r===null||r===void 0?void 0:r(t.filter((function(e){if(e.severity=="autoDetectError"/* AUTO_DETECT_ERROR */){n[e.error]=n[e.error]||0;n[e.error]+=1;if(n[e.error]>i){return false}return true}return true})))}};
|
|
22
22
|
// src/pipes/index.ts
|
|
@@ -40,7 +40,7 @@ var je;var _e=new be({name:"onPageChangePlugin",setUp:function(){var e=b((functi
|
|
|
40
40
|
// src/plugins/pageRetentionPlugin.ts
|
|
41
41
|
var Ae;var Le=new be({name:"onPageRetentionPlugin",setUp:function(){var e=b((function(e){var n,t,r,i,o,a,u;return U(this,(function(s){if(typeof document.visibilityState==="undefined"){return[2]}t=(n=location)===null||n===void 0?void 0:n.href;r=document.querySelector("body");o=function(){i=Date.now()};o();document.addEventListener("visibilitychange",(function(){if(document.visibilityState==="hidden"){a({href:location.href,leftReason:"visibilityChange"/* visibilityChange */})}else if(document.visibilityState==="visible"){o()}}));window.addEventListener("beforeunload",(function(){a({href:location.href,sendImmediate:true,leftReason:"pageClose"/* pageClose */})}));a=function(n){var t=n.href,r=n.sendImmediate,o=n.leftReason;if(!i){return}var a=Date.now()-i;if(a===0){return}i=void 0;var u={severity:"autoDetectEvent"/* AUTO_DETECT_EVENT */,eventName:"onPageRetention"/* onPageRetention */,extraInfo:{href:t,duration:a,leftReason:o}};if(r){e.ImmediatePipeline(u);return}e.normalLogPipeLine(u)};Ae=new MutationObserver((function(){if(location.href!==t){var e=t;t=location.href;a({href:e,leftReason:"nextPage"/* nextPage */});o()}}));u={subtree:true,childList:true};Ae.observe(r||document,u);return[2]}))}));return function(n){return e.apply(this,arguments)}}(),destroy:function(){Ae===null||Ae===void 0?void 0:Ae.disconnect()}});
|
|
42
42
|
// src/plugins/apiPerformancePlugin/utils.ts
|
|
43
|
-
var Ue=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2,15)};var Me=function(e,n){var t=[/^https?:\/\/[^\/]*\.airwallex\.com($|\/)/];var r=[/authenticate\/heartbeat/,/papluginlogs\/.*/,/airtracker\/.*/,/o11y(-staging|-demo)?\.airwallex\.com/,/\.(png|jpe?g|gif|svg|ico|webp|avif|css|js|json|woff2?|ttf|eot|map|txt|csv|xml)(\?.*)?(#.*)?$/i];if(r.some((function(n){return n.test(e)}))){return false}return le(e,n||t)};var Fe=function(e){var n=e.startTime,t=e.endTime,r=e.entries;if(r.length===0){return void 0}if(r.length===1){return r[0]}var i=r.filter((function(e){return e.startTime>=n&&t&&e.responseEnd<=t})).sort((function(e,n){return e.startTime-n.startTime}));return i===null||i===void 0?void 0:i[0]};var Ke=function(e){return Math.round(e*100)/100};var
|
|
43
|
+
var Ue=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2,15)};var Me=function(e,n){var t=[/^https?:\/\/[^\/]*\.airwallex\.com($|\/)/];var r=[/authenticate\/heartbeat/,/papluginlogs\/.*/,/airtracker\/.*/,/o11y(-staging|-demo)?\.airwallex\.com/,/\.(png|jpe?g|gif|svg|ico|webp|avif|css|js|json|woff2?|ttf|eot|map|txt|csv|xml)(\?.*)?(#.*)?$/i];if(r.some((function(n){return n.test(e)}))){return false}return le(e,n||t)};var Fe=function(e){var n=e.startTime,t=e.endTime,r=e.entries;if(r.length===0){return void 0}if(r.length===1){return r[0]}var i=r.filter((function(e){return e.startTime>=n&&t&&e.responseEnd<=t})).sort((function(e,n){return e.startTime-n.startTime}));return i===null||i===void 0?void 0:i[0]};var Ke=function(e){return Math.round(e*100)/100};var qe=function(e){var n=e.startTime,t=e.duration,r=e.responseStart,i=e.connectEnd,o=e.connectStart,a=e.domainLookupEnd,u=e.domainLookupStart,s=e.requestStart,c=e.secureConnectionStart,f=e.redirectEnd,l=e.redirectStart,v=e.responseStatus,d=e.responseEnd,m=e.encodedBodySize,p=e.decodedBodySize,h=e.transferSize,y=e.deliveryType,w=e.initiatorType;return{startTime:Ke(n),totalDuration:Ke(t),timeToFirstByte:ve(r,n),tcpDuration:ve(i,o),dnsDuration:ve(a,u),tlsDuration:ve(s,c),redirectDuration:ve(f,l),responseDuration:ve(d,r),encodeResponseSize:m,decodeResponseSize:p,transferSize:h,deliveryType:y,statusCode:v,initiatorType:w}};var He=function(e,n){var t=e.url,r=e.method,i=e.errorType,o=e.errorDetail;var a=Fe(e);var u=new URL(t,window.location.href),s=u.href,c=u.protocol;var f=a?qe(a):{};var l={severity:"autoDetectEvent"/* AUTO_DETECT_EVENT */,eventName:"httpClientMetrics"/* httpClientMetrics */,extraInfo:P(O(P({httpUrl:s,method:r,scheme:c},i&&{errorType:i},o&&{errorDetail:o},f),{
|
|
44
44
|
// use injected response as fallback
|
|
45
45
|
statusCode:(f===null||f===void 0?void 0:f.statusCode)||(e===null||e===void 0?void 0:e.responseStatus),startTime:(f===null||f===void 0?void 0:f.startTime)||(e===null||e===void 0?void 0:e.startTime),initiatorType:(f===null||f===void 0?void 0:f.initiatorType)||(e===null||e===void 0?void 0:e.initiatorType)}),n)};return l};var ze=function(e){// Has data or errors at root level
|
|
46
46
|
return e&&(typeof e==="undefined"?"undefined":A(e))==="object"&&"errors"in e&&// If errors exist, they should be an array with proper GraphQL error shape
|
|
@@ -48,19 +48,19 @@ Array.isArray(e.errors)&&e.errors.every((function(e){return e&&(typeof e==="unde
|
|
|
48
48
|
// src/plugins/apiPerformancePlugin/type.ts
|
|
49
49
|
var Be="awx_airtracker_api_performance_queue";var We="awx_airtracker_api_performance_plugin_loaded";
|
|
50
50
|
// src/plugins/apiPerformancePlugin/index.ts
|
|
51
|
-
var
|
|
51
|
+
var Ve=300;var Xe=1e4;var Ge=typeof window!=="undefined"?window:typeof global!=="undefined"?global:{};Ge[Be]=Ge[Be]||[];var $e=function(e,n,t){setTimeout((function(){var r=He(e,t);n.observerPipeline(r);Ge[Be]=Ge[Be].filter((function(n){return n.id!==e.id}))}),Ve)};var Je=function(e,n){setTimeout((function(){var t=Ge[Be].find((function(n){return n.id===e}));if(!t){return}var r=He(t,{exceptionType:"timeout-without-response"});n.observerPipeline(r);Ge[Be]=Ge[Be].filter((function(n){return n.id!==e}))}),Xe)};var Qe=function(e){var n=XMLHttpRequest.prototype.open;var t=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function t(r,i,o,a,u){try{var s;var c=Ue();this.__requestId=c;var f=S(i,URL)?i.href:new URL(i,window.location.href).href;if(!Me(f,(s=e.config)===null||s===void 0?void 0:s.enableRecordAPIPerformanceWhitelist)){return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}var l={id:c,startTime:performance.now(),method:r,url:f,entries:[],initiatorType:"xmlhttprequest"};Ge[Be].push(l);Je(c,e);return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}catch(t){e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{message:"Inject XHR open error",error:t}});return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}};XMLHttpRequest.prototype.send=function n(){var r=this;for(var i=arguments.length,o=new Array(i),a=0;a<i;a++){o[a]=arguments[a]}try{var u=Ge[Be].find((function(e){return e.id===r.__requestId}));if(!u){return t.apply(this,o)}var s=this;this.addEventListener("loadend",b((function(){var n,t,r,i,o,a,c;return U(this,(function(f){switch(f.label){case 0:n=performance.now();t=n-u.startTime;r=s.status;if(r===0){return[2]}u.endTime=n;u.duration=t;u.responseStatus=r;f.label=1;case 1:f.trys.push([1,6,,7]);if(!(s.responseType===""||s.responseType==="text"))return[3,2];i=s.responseText;return[3,5];case 2:if(!(s.responseType==="json"))return[3,3];i=s.response;return[3,5];case 3:if(!(s.responseType==="blob"))return[3,5];o=s.response;if(!((o===null||o===void 0?void 0:o.type)==="application/json"))return[3,5];return[4,o.text()];case 4:i=f.sent();f.label=5;case 5:a=i&&typeof i==="string"?JSON.parse(i):i;if(a&&ze(a)){u.errorType="graphqlError";u.errorDetail=a.errors}return[3,7];case 6:c=f.sent();e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in XHR",url:u===null||u===void 0?void 0:u.url,error:c}});return[3,7];case 7:$e(u,e);return[2]}}))})));this.addEventListener("error",(function(){$e(u,e,{exceptionType:"network-error"})}));this.addEventListener("abort",(function(){$e(u,e,{exceptionType:"abort-error"})}));this.addEventListener("timeout",(function(){$e(u,e,{exceptionType:"timeout-error"})}));return t.apply(this,o)}catch(n){e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{message:"InjectXHR send error",error:n}});throw n}}};var Ye=function(e){var n=window.fetch;window.fetch=b((function(){var t,r,i,o,a,u,s,c,f,l,v,d,m,p,h,y;var w=arguments;return U(this,(function(g){switch(g.label){case 0:for(t=w.length,r=new Array(t),i=0;i<t;i++){r[i]=w[i]}u=new URL(S(r[0],Request)?r[0].url:String(r[0]),window.location.href).href;if(!!Me(u,(o=e.config)===null||o===void 0?void 0:o.enableRecordAPIPerformanceWhitelist))return[3,2];return[4,n.apply(this,r)];case 1:return[2,g.sent()];case 2:g.trys.push([2,9,,10]);c=performance.now();f=Ue();a={id:f,startTime:c,method:((s=S(r[0],Request)?r[0]:r[1])===null||s===void 0?void 0:s.method)||"GET",url:u,entries:[],initiatorType:"fetch"};Ge[Be].push(a);Je(f,e);return[4,n.apply(this,r)];case 3:l=g.sent();v=performance.now();a.endTime=v;a.duration=v-c;a.responseStatus=l.status;d=l.clone();g.label=4;case 4:g.trys.push([4,7,,8]);if(!d.ok)return[3,6];return[4,d.json()];case 5:m=g.sent();if(m&&ze(m)){a.errorType="graphqlError";a.errorDetail=m.errors}g.label=6;case 6:return[3,8];case 7:p=g.sent();e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in fetch",url:a===null||a===void 0?void 0:a.url,error:p}});return[3,8];case 8:$e(a,e);return[2,l];case 9:h=g.sent();if(a&&a.id&&Ge[Be].find((function(e){return e.id===(a===null||a===void 0?void 0:a.id)}))){y="fetch-error";if(S(h,TypeError)){y="network-error"}else if(S(h,DOMException)&&h.name==="AbortError"){y="abort-error"}$e(a,e,{exceptionType:y})}else{e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{message:"Inject fetch error",error:h}})}throw h;case 10:return[2]}}))}))};var Ze=function(e){var n;Qe(e);Ye(e);if((n=window)===null||n===void 0?void 0:n.PerformanceObserver){var t=new window.PerformanceObserver((function(e){var n=e.getEntries();n.forEach((function(e){var n=e;if(n.initiatorType==="fetch"||n.initiatorType==="xmlhttprequest"){var t=Ge[Be].filter((function(e){return e.url===n.name}));t.forEach((function(e){e.entries.push(n)}))}}))}));t.observe({entryTypes:["resource"],buffered:true})}else{e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{error:"PerformanceObserver Not Supported"}})}};var en=new be({name:"apiPerformancePlugin",setUp:function(){var e=b((function(e){var n,t;return U(this,(function(r){if(Ge[We]){return[2]}if(((n=e.config)===null||n===void 0?void 0:n.enableRecordAPIPerformance)&&Math.random()<(((t=e.config)===null||t===void 0?void 0:t.enableRecordAPIPerformancePercentage)||0)){Ge[We]=true;Ze(e)}return[2]}))}));return function(n){return e.apply(this,arguments)}}()});
|
|
52
52
|
// src/util/version.ts
|
|
53
53
|
var nn="3.1.0";
|
|
54
54
|
// src/airTracker.ts
|
|
55
|
-
var tn=function(){function e(n){var t=this;var r=n.config,i=n.plugins,o=i===void 0?[]:i;k(this,e);this.config=K;this.lifeCycle=new ge;this.plugins=[];this._commonData=
|
|
55
|
+
var tn=function(){function e(n){var t=this;var r=n.config,i=n.plugins,o=i===void 0?[]:i;k(this,e);this.config=K;this.lifeCycle=new ge;this.plugins=[];this._commonData=q;this._MFECommonDataMap={};
|
|
56
56
|
// customized speed log
|
|
57
|
-
this.timeMap={};this.packedDataConvert=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o,a;var u=P({severity:n,eventName:r,currentHref:t.config.hideSearchParams?(((o=location)===null||o===void 0?void 0:o.href)||"").split("?")[0]||"":((a=location)===null||a===void 0?void 0:a.href)||""},i);if(t.config.isWebappContainer){u.MFEName=Z(t)}return u};this.normalPipelineObj=we([pe(this,8),he(this),de(this)]);this.observerPipelineObj=we([pe(this,8),me(this)]);this.immediateSendPipe=de(this);this.observerPipeline=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});return t.observerPipelineObj(o)};this.normalLogPipeLine=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});if(t.config.disableThrottle){return t.immediateSendPipe(o)}else{return t.normalPipelineObj(o)}};this.ImmediatePipeline=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});return t.immediateSendPipe(o)};this.plugins=_(o);this.setConfig(r);this.initCommonData(r);this.lifeCycle.emit(
|
|
57
|
+
this.timeMap={};this.packedDataConvert=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o,a;var u=P({severity:n,eventName:r,currentHref:t.config.hideSearchParams?(((o=location)===null||o===void 0?void 0:o.href)||"").split("?")[0]||"":((a=location)===null||a===void 0?void 0:a.href)||""},i);if(t.config.isWebappContainer){u.MFEName=Z(t)}return u};this.normalPipelineObj=we([pe(this,8),he(this),de(this)]);this.observerPipelineObj=we([pe(this,8),me(this)]);this.immediateSendPipe=de(this);this.observerPipeline=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});return t.observerPipelineObj(o)};this.normalLogPipeLine=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});if(t.config.disableThrottle){return t.immediateSendPipe(o)}else{return t.normalPipelineObj(o)}};this.ImmediatePipeline=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});return t.immediateSendPipe(o)};this.plugins=_(o);this.setConfig(r);this.initCommonData(r);this.lifeCycle.emit(V.onInit);if(r.enableErrorMonitoring){this.plugins.push(Se)}if((r===null||r===void 0?void 0:r.assetSpeedMonitoringWhiteList)&&r.assetSpeedMonitoringWhiteList.length>0||r.isWebappContainer){this.plugins.push(Oe)}if(r===null||r===void 0?void 0:r.enableDetectPageChange){this.plugins.push(_e)}if(r===null||r===void 0?void 0:r.enableRecordPageRetention){this.plugins.push(Le)}if((r===null||r===void 0?void 0:r.enableRecordAPIPerformance)&&(r===null||r===void 0?void 0:r.enableRecordAPIPerformancePercentage)&&r.enableRecordAPIPerformancePercentage>0&&r.enableRecordAPIPerformancePercentage<=1){this.plugins.push(en)}this.installPlugins()}E(e,[{key:"installPlugins",value:function e(){var n=this;this.plugins.forEach((function(e){e.patch(n)}))}},{key:"commonData",get:function e(){return this._commonData}},{key:"MFECommonDataMap",get:function e(){return this._MFECommonDataMap}},{key:"initCommonData",value:function e(n){this._commonData.sessionId=n.useSessionStorageForSessionId?ee():Y();this._commonData.deviceId=ne()||F;this._commonData.riskDeviceId=te();this._commonData.networkType=re()||"unknown"/* unknown */;this._commonData.env=n.env||this._commonData.env;this._commonData.accountId=n.accountId||F;this._commonData.appVersion=n.appVersion;this._commonData.appName=n.appName;this._commonData.sdkVersion=nn;this.lifeCycle.emit(V.onCommonDataInit,this.commonData)}},{key:"updateCommonDataBasedOnConfig",value:function e(n){this.lifeCycle.emit(V.onCommonUpdated,this._commonData);this._commonData.env=n.env||this._commonData.env;this._commonData.appName=n.appName||this._commonData.appName;this._commonData.env=n.env||this._commonData.env;this._commonData.accountId=n.accountId||this._commonData.accountId;this._commonData.appVersion=n.appVersion||this._commonData.appVersion}},{
|
|
58
58
|
// Can add extra common data based on developers' needs
|
|
59
|
-
key:"updateCommonData",value:function e(n){this.lifeCycle.emit(
|
|
59
|
+
key:"updateCommonData",value:function e(n){this.lifeCycle.emit(V.onCommonUpdated,this._commonData);this._commonData=P({},this._commonData,n)}},{key:"removeCommonDataByKey",value:function e(n){var t=this;this.lifeCycle.emit(V.onCommonUpdated,this._commonData);setTimeout((function(){n.forEach((function(e){delete t._commonData[e]}))}),1e3)}},{
|
|
60
60
|
// only worked if isWebappContainer is true
|
|
61
61
|
key:"addToMFECommonData",value:function e(n){var t=n.MFEName,r=n.MFECommonData;var i;if(!this.config.isWebappContainer){return}if(!t||!r){return}this._MFECommonDataMap=O(P({},this._MFECommonDataMap||{}),I({},t,P({},((i=this._MFECommonDataMap)===null||i===void 0?void 0:i[t])||{},r)))}},{
|
|
62
62
|
// support set config later
|
|
63
|
-
key:"setConfig",value:function e(n){var t=this;if(this.config.isWebappContainer){return}var r=function(e,n){t.config[e]=n};Object.entries(n).forEach((function(e){var n=j(e,2),t=n[0],i=n[1];if((typeof i==="undefined"?"undefined":A(i))!==void 0){r(t,i)}}));this.lifeCycle.emit(
|
|
63
|
+
key:"setConfig",value:function e(n){var t=this;if(this.config.isWebappContainer){return}var r=function(e,n){t.config[e]=n};Object.entries(n).forEach((function(e){var n=j(e,2),t=n[0],i=n[1];if((typeof i==="undefined"?"undefined":A(i))!==void 0){r(t,i)}}));this.lifeCycle.emit(V.onConfigInit,this.config);this.updateCommonDataBasedOnConfig(n)}},{
|
|
64
64
|
// send verbose level log
|
|
65
65
|
key:"verbose",value:function e(n,t){this.normalLogPipeLine({severity:"verbose"/* VERBOSE */,eventName:n,extraInfo:t})}},{
|
|
66
66
|
// send HTTP request log
|
|
@@ -121,18 +121,18 @@ var n=e.reduce((function(e,n){return e.concat(_n(n)?Dn[n]:n)}),[]);return Array.
|
|
|
121
121
|
* @param name declare the element name
|
|
122
122
|
* @param env the environment of package
|
|
123
123
|
* @returns string the CDN url
|
|
124
|
-
*/var
|
|
124
|
+
*/var qn=function(e){var n=e.name,t=e.env,r=t===void 0?xn.prod:t;var i=Un(n,r);var o=Cn[n];if(!o){hn("[components-sdk] Element static resource not found",{sdkName:n});throw new On("Element ".concat(n," static resource URL is invalid."))}return"".concat(i).concat(o,"?ts=").concat(jn)};var Hn=function(){return Rn.reduce((function(e,n){var t;return un(un({},e),(t={},t[n]=window._AirwallexSDKs.__controller__.internalSDKs[n],t))}),{})};var zn=function(e){return Pn[e]||[]};var Bn=function(){return Math.floor(performance.now())};var Wn=function(e){var n=document.createElement("script");n.src=e;n.type="module";var t=document.head||document.body;t.appendChild(n);return n};var Vn=3;var Xn=function(e){return sn(void 0,void 0,void 0,(function(){var n,t;return cn(this,(function(r){switch(r.label){case 0:if(typeof window==="undefined"){throw new Error("Please load script in browser environment")}n=0;t=function(){return sn(void 0,void 0,void 0,(function(){var t,r,i;return cn(this,(function(o){t=Bn();if(n>0&&e.includes("?ts=")){r=new URL(e,window.location.href);r.searchParams.set("ts","".concat(Date.now()));e=r.toString()}i=Wn(e);return[2/*return*/,new Promise((function(r,o){i.addEventListener("load",(function(){var i=Bn();wn("[components-sdk] SDK script loaded",{scriptUrl:e,start:t,latency:i-t,end:i,retryCount:n});r(true)}));i.addEventListener("error",(function(r){i.remove();console.error(r);var a=Bn();hn("[components-sdk] Failed to load script",{scriptUrl:e,error:r,start:t,latency:a-t,end:a,retryCount:n});o(new gn("Failed to load Airwallex SDK scripts: ".concat(e)))}))}))]}))}))};r.label=1;case 1:if(!(n<Vn))return[3/*break*/,7];r.label=2;case 2:r.trys.push([2,4,,6]);return[4/*yield*/,t()];case 3:return[2/*return*/,r.sent()];case 4:r.sent();n++;return[4/*yield*/,An()];case 5:r.sent();return[3/*break*/,6];case 6:return[3/*break*/,1];case 7:hn("[components-sdk] Failed to load script after retry",{scriptUrl:e,retryCount:n});throw new gn("Failed to load Airwallex SDK scripts: ".concat(e))}}))}))};var Gn=/** @class */function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="INSTANCE_NOT_FOUND_ERROR";return t}return n}(Error);var $n;
|
|
125
125
|
/**
|
|
126
126
|
* ensure one script one promise
|
|
127
|
-
*/var
|
|
127
|
+
*/var Jn=new Map;
|
|
128
128
|
/**
|
|
129
129
|
* get the Promise to load the element script
|
|
130
130
|
* @param scriptName declare the SDK or Functions namespace
|
|
131
131
|
* @param env the resource url
|
|
132
132
|
* @returns Promise to load the script
|
|
133
|
-
*/var Qn=function(e){var n=e.env,t=e.scriptName;var r=
|
|
133
|
+
*/var Qn=function(e){var n=e.env,t=e.scriptName;var r=qn({name:t,env:n});
|
|
134
134
|
// if promise was made
|
|
135
|
-
var i
|
|
135
|
+
var i=Jn.get(t);if(i){return i}var o=Xn(r);Jn.set(t,o);return o};
|
|
136
136
|
/**
|
|
137
137
|
* Load an SDK script along with its dependencies
|
|
138
138
|
* @param scriptName the SDK name to load
|
|
@@ -145,7 +145,7 @@ var i=$n.get(t);if(i){return i}var o=Vn(r);$n.set(t,o);return o};
|
|
|
145
145
|
* @returns Promise to load the script
|
|
146
146
|
*/var Zn=function(e){return sn(void 0,void 0,void 0,(function(){return cn(this,(function(n){if(typeof window==="undefined"){throw new Error("Please call the `init()` function in a browser environment.")}
|
|
147
147
|
// initialize airTracker
|
|
148
|
-
mn(e.env,e.clientId);wn("[components-sdk] SDK init start",{options:pn(e),start:Bn()})
|
|
148
|
+
mn(e.env,e.clientId);wn("[components-sdk] SDK init start",{options:pn(e),start:Bn()});$n=new Promise((function(n,t){var r;var i=un(un({},e),{env:e.env&&xn[e.env]?e.env:xn.prod});window.AirwallexComponentsSDK.__env__=i.env;
|
|
149
149
|
// load SDK controller script
|
|
150
150
|
var o=Qn({env:i.env,scriptName:Sn}).then((function(){return window._AirwallexSDKs.__controller__.init(i)}));
|
|
151
151
|
// For old version backward compatibility
|
|
@@ -153,19 +153,19 @@ var a=(r=e.enabledElements)!==null&&r!==void 0?r:[];var u=Fn(a);
|
|
|
153
153
|
// load SDK functions scripts
|
|
154
154
|
var s=u.map((function(e){return Yn({env:i.env,scriptName:e}).then((function(){return o})).then((function(){var n=window._AirwallexSDKs[Kn(e)];if(!n){hn("[components-sdk] SDK instance not found",{functionsNamespace:e,windowSDKInstanceName:Kn(e)});throw new Gn("SDK instance not found")}return window._AirwallexSDKs.__controller__.registerFunctions({functionsNamespace:e,instance:n})}))}));
|
|
155
155
|
// load SDK elements scripts
|
|
156
|
-
var c=Mn(a);var f=c.map((function(e){var n=e.sdkName,t=e.elementName;return Yn({scriptName:n,env:i.env}).then((function(){return o})).then((function(){var e=window._AirwallexSDKs[Kn(n)];if(!e){hn("[components-sdk] SDK instance not found",{sdkName:n,windowSDKInstanceName:Kn(n)});throw new Gn("SDK instance not found")}return window._AirwallexSDKs.__controller__.registerElement({sdkName:n,elementName:t,instance:e})}))}));Promise.all(fn(fn([o],s,true),f)).then((function(){wn("[components-sdk] SDK initialized",{options:pn(e),start:Bn()});n(
|
|
156
|
+
var c=Mn(a);var f=c.map((function(e){var n=e.sdkName,t=e.elementName;return Yn({scriptName:n,env:i.env}).then((function(){return o})).then((function(){var e=window._AirwallexSDKs[Kn(n)];if(!e){hn("[components-sdk] SDK instance not found",{sdkName:n,windowSDKInstanceName:Kn(n)});throw new Gn("SDK instance not found")}return window._AirwallexSDKs.__controller__.registerElement({sdkName:n,elementName:t,instance:e})}))}));Promise.all(fn(fn([o],s,true),f)).then((function(){wn("[components-sdk] SDK initialized",{options:pn(e),start:Bn()});n(Hn())}))["catch"]((function(e){if(!e.code){hn("[components-sdk] Unexpected errors when init",{error:e})}t(e)}))}));return[2/*return*/,$n]}))}))};
|
|
157
157
|
/**
|
|
158
158
|
* load SDK element script and call SDK instance.createElement.
|
|
159
159
|
* @param elementName the element name to create
|
|
160
160
|
* @param options createElement options
|
|
161
161
|
* @returns return type of SDK instance.createElement
|
|
162
|
-
*/var et=e("l",(function(e,n){return sn(void 0,void 0,void 0,(function(){var t,r,i,o,a;return cn(this,(function(u){switch(u.label){case 0:if(!e){throw new Error("Element type is missing. Please specify a valid element.")}wn("[components-sdk] SDK createElement start",{elementName:e,options:pn(n),timestamp:Bn()});if(
|
|
162
|
+
*/var et=e("l",(function(e,n){return sn(void 0,void 0,void 0,(function(){var t,r,i,o,a;return cn(this,(function(u){switch(u.label){case 0:if(!e){throw new Error("Element type is missing. Please specify a valid element.")}wn("[components-sdk] SDK createElement start",{elementName:e,options:pn(n),timestamp:Bn()});if(!$n){yn("[components-sdk] Did not call init before createElement");throw new Error("Please initialize the Element before creating it.")}return[4/*yield*/,$n];case 1:u.sent();t=Ln(e);if(!t){throw new Error("`createElement()` with type `".concat(e,"` is not supported. Please specify a valid Element type."))}r=Bn();u.label=2;case 2:u.trys.push([2,6,,7]);return[4/*yield*/,Yn({scriptName:t,env:window.AirwallexComponentsSDK.__env__||xn.prod})];case 3:u.sent();return[4/*yield*/,window._AirwallexSDKs.__controller__.registerElement({sdkName:t,elementName:e,instance:window._AirwallexSDKs[Kn(t)]})];case 4:u.sent();return[4/*yield*/,window._AirwallexSDKs.__controller__.createElement(e,n)];case 5:i=u.sent();o=Bn();wn("[components-sdk] SDK createElement being called",{elementName:e,options:pn(n),start:r,latency:o-r,end:o});return[3/*break*/,7];case 6:a=u.sent();if(!a.code){hn("[components-sdk] Unexpected errors when createElement",{error:a})}else{throw a}return[3/*break*/,7];case 7:return[2/*return*/,i]}}))}))}));
|
|
163
163
|
/**
|
|
164
164
|
* List of scripts to prefetch
|
|
165
165
|
*/var nt=[Sn,Nn];
|
|
166
166
|
/**
|
|
167
167
|
* Prefetch scripts by preload link, only for production as there's no environment context before SDK init
|
|
168
|
-
*/var tt=function(){nt.forEach((function(e){var n=
|
|
168
|
+
*/var tt=function(){nt.forEach((function(e){var n=qn({name:e,env:xn.prod});var t=document.createElement("link");t.href=n;t.rel="modulepreload";t.as="script";var r=document.head||document.body;r.appendChild(t)}))};
|
|
169
169
|
/**
|
|
170
170
|
* @airwallex/components-sdk may run in node environment, e.g., in Next.js
|
|
171
171
|
* Prefetch scripts only in browser environment
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(n,r,e,t){function o(n){return n instanceof e?n:new e((function(r){r(n)}))}return new(e||(e=Promise))((function(e,i){function a(n){try{c(t.next(n))}catch(n){i(n)}}function u(n){try{c(t["throw"](n))}catch(n){i(n)}}function c(n){n.done?e(n.value):o(n.value).then(a,u)}c((t=t.apply(n,r||[])).next())}))};var __generator=this&&this.__generator||function(n,r){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=u(0),a["throw"]=u(1),a["return"]=u(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(n){return function(r){return c([n,r])}}function c(u){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(e=0)),e)try{if(t=1,o&&(i=u[0]&2?o["return"]:u[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;if(o=0,i)u=[u[0]&2,i.value];switch(u[0]){case 0:case 1:i=u;break;case 4:e.label++;return{value:u[1],done:false};case 5:e.label++;o=u[1];u=[0];continue;case 7:u=e.ops.pop();e.trys.pop();continue;default:if(!(i=e.trys,i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){e.label=u[1];break}if(u[0]===6&&e.label<i[1]){e.label=i[1];i=u;break}if(i&&e.label<i[2]){e.label=i[2];e.ops.push(u);break}if(i[2])e.ops.pop();e.trys.pop();continue}u=r.call(n,e)}catch(n){u=[6,n];o=0}finally{t=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-CPnR_T0a.system.js","./p-
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(n,r,e,t){function o(n){return n instanceof e?n:new e((function(r){r(n)}))}return new(e||(e=Promise))((function(e,i){function a(n){try{c(t.next(n))}catch(n){i(n)}}function u(n){try{c(t["throw"](n))}catch(n){i(n)}}function c(n){n.done?e(n.value):o(n.value).then(a,u)}c((t=t.apply(n,r||[])).next())}))};var __generator=this&&this.__generator||function(n,r){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=u(0),a["throw"]=u(1),a["return"]=u(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(n){return function(r){return c([n,r])}}function c(u){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(e=0)),e)try{if(t=1,o&&(i=u[0]&2?o["return"]:u[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;if(o=0,i)u=[u[0]&2,i.value];switch(u[0]){case 0:case 1:i=u;break;case 4:e.label++;return{value:u[1],done:false};case 5:e.label++;o=u[1];u=[0];continue;case 7:u=e.ops.pop();e.trys.pop();continue;default:if(!(i=e.trys,i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){e.label=u[1];break}if(u[0]===6&&e.label<i[1]){e.label=i[1];i=u;break}if(i&&e.label<i[2]){e.label=i[2];e.ops.push(u);break}if(i[2])e.ops.pop();e.trys.pop();continue}u=r.call(n,e)}catch(n){u=[6,n];o=0}finally{t=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-CPnR_T0a.system.js","./p-NL_Eiq6m.system.js","./p-Cd9xIgx7.system.js","./p-zVLAvre1.system.js","./p-B3GRrRtL.system.js","./p-BbgqQIHv.system.js","./p-uV7m6KrY.system.js"],(function(n){"use strict";var r,e,t,o,i,a,u,c,s,f,d,l,v,p,y,h,b,w,m,_,j,P,k,g,E,O,I;return{setters:[function(n){r=n.z;e=n.c},function(n){t=n.x;o=n.j;i=n.t;a=n.y;u=n.G;c=n.C;s=n.b;f=n.d;d=n.n;l=n.A;v=n.T;p=n.B;y=n.D;h=n.K},function(n){b=n.s;w=n.t},function(n){m=n.h;_=n.g;j=n.l;P=n.j},function(n){k=n.i},function(n){g=n.l},function(n){E=n.i;O=n.a;I=n.s}],execute:function(){
|
|
2
2
|
/*!
|
|
3
3
|
* paypal-js v8.4.2 (2025-09-04T17:21:30.135Z)
|
|
4
4
|
* Copyright 2020-present, PayPal, Inc. All rights reserved.
|
|
@@ -36,7 +36,7 @@ var o=e.cloneNode();delete o.dataset.uidAuto;
|
|
|
36
36
|
// check if the new script has the same number of data attributes
|
|
37
37
|
if(Object.keys(o.dataset).length!==Object.keys(t.dataset).length){return null}var i=true;
|
|
38
38
|
// check if the data attribute values are the same
|
|
39
|
-
Object.keys(o.dataset).forEach((function(n){if(o.dataset[n]!==t.dataset[n]){i=false}}));return i?e:null}function B(n){var r=n.url,e=n.attributes,t=n.onSuccess,o=n.onError;var i=M(r,e);i.onerror=o;i.onload=t;document.head.insertBefore(i,document.head.firstElementChild)}function L(n){var r=n.sdkBaseUrl,e=n.environment,t=A(n,["sdkBaseUrl","environment"]);var o=r||
|
|
39
|
+
Object.keys(o.dataset).forEach((function(n){if(o.dataset[n]!==t.dataset[n]){i=false}}));return i?e:null}function B(n){var r=n.url,e=n.attributes,t=n.onSuccess,o=n.onError;var i=M(r,e);i.onerror=o;i.onload=t;document.head.insertBefore(i,document.head.firstElementChild)}function L(n){var r=n.sdkBaseUrl,e=n.environment,t=A(n,["sdkBaseUrl","environment"]);var o=r||z(e);var i=t;var a=Object.keys(i).filter((function(n){return typeof i[n]!=="undefined"&&i[n]!==null&&i[n]!==""})).reduce((function(n,r){var e=i[r].toString();r=C(r);if(r.substring(0,4)==="data"||r==="crossorigin"){n.attributes[r]=e}else{n.queryParams[r]=e}return n}),{queryParams:{},attributes:{}}),u=a.queryParams,c=a.attributes;if(u["merchant-id"]&&u["merchant-id"].indexOf(",")!==-1){c["data-merchant-id"]=u["merchant-id"];u["merchant-id"]="*"}return{url:"".concat(o,"?").concat(T(u)),attributes:c}}function C(n){var r=function(n,r){return(r?"-":"")+n.toLowerCase()};return n.replace(/[A-Z]+(?![a-z])|[A-Z]/g,r)}function T(n){var r="";Object.keys(n).forEach((function(e){if(r.length!==0)r+="&";r+=e+"="+n[e]}));return r}function z(n){
|
|
40
40
|
// Keeping production as default to maintain backward compatibility.
|
|
41
41
|
// In the future this logic needs to be changed to use sandbox domain as default instead of production.
|
|
42
42
|
return n==="sandbox"?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js"}function M(n,r){if(r===void 0){r={}}var e=document.createElement("script");e.src=n;Object.keys(r).forEach((function(n){e.setAttribute(n,r[n]);if(n==="data-csp-nonce"){e.setAttribute("nonce",r["data-csp-nonce"])}}));return e}
|
|
@@ -46,29 +46,29 @@ return n==="sandbox"?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal
|
|
|
46
46
|
* @param {Object} options - used to configure query parameters and data attributes for the JS SDK.
|
|
47
47
|
* @param {PromiseConstructor} [PromisePonyfill=window.Promise] - optional Promise Constructor ponyfill.
|
|
48
48
|
* @return {Promise<Object>} paypalObject - reference to the global window PayPal object.
|
|
49
|
-
*/function R(n,r){if(r===void 0){r=Promise}
|
|
49
|
+
*/function R(n,r){if(r===void 0){r=Promise}N(n,r);
|
|
50
50
|
// resolve with null when running in Node or Deno
|
|
51
|
-
if(typeof document==="undefined")return r.resolve(null);var e=L(n),t=e.url,o=e.attributes;var i=o["data-namespace"]||"paypal";var a=
|
|
51
|
+
if(typeof document==="undefined")return r.resolve(null);var e=L(n),t=e.url,o=e.attributes;var i=o["data-namespace"]||"paypal";var a=F(i);if(!o["data-js-sdk-library"]){o["data-js-sdk-library"]="paypal-js"}
|
|
52
52
|
// resolve with the existing global paypal namespace when a script with the same params already exists
|
|
53
|
-
if(x(t,o)&&a){return r.resolve(a)}return
|
|
53
|
+
if(x(t,o)&&a){return r.resolve(a)}return q({url:t,attributes:o},r).then((function(){var n=F(i);if(n){return n}throw new Error("The window.".concat(i," global variable is not available."))}))}
|
|
54
54
|
/**
|
|
55
55
|
* Load a custom script asynchronously.
|
|
56
56
|
*
|
|
57
57
|
* @param {Object} options - used to set the script url and attributes.
|
|
58
58
|
* @param {PromiseConstructor} [PromisePonyfill=window.Promise] - optional Promise Constructor ponyfill.
|
|
59
59
|
* @return {Promise<void>} returns a promise to indicate if the script was successfully loaded.
|
|
60
|
-
*/function
|
|
60
|
+
*/function q(n,r){if(r===void 0){r=Promise}N(n,r);var e=n.url,t=n.attributes;if(typeof e!=="string"||e.length===0){throw new Error("Invalid url.")}if(typeof t!=="undefined"&&typeof t!=="object"){throw new Error("Expected attributes to be an object.")}return new r((function(n,r){
|
|
61
61
|
// resolve with undefined when running in Node or Deno
|
|
62
|
-
if(typeof document==="undefined")return n();B({url:e,attributes:t,onSuccess:function(){return n()},onError:function(){var n=new Error('The script "'.concat(e,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return r(n)}})}))}function
|
|
62
|
+
if(typeof document==="undefined")return n();B({url:e,attributes:t,onSuccess:function(){return n()},onError:function(){var n=new Error('The script "'.concat(e,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return r(n)}})}))}function F(n){
|
|
63
63
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
|
-
return window[n]}function
|
|
64
|
+
return window[n]}function N(n,r){if(typeof n!=="object"||n===null){throw new Error("Expected an options object.")}var e=n.environment;if(e&&e!=="production"&&e!=="sandbox"){throw new Error('The `environment` option must be either "production" or "sandbox".')}if(typeof r!=="undefined"&&typeof r!=="function"){throw new Error("Expected PromisePonyfill to be a function.")}}var D=function(n){return __awaiter(S,[n],void 0,(function(n){var r,e,t;var o=n.checkoutSessionId,i=n.paypalMockResponse;return __generator(this,(function(n){switch(n.label){case 0:return[4/*yield*/,m("/api/zonos-elements/capture-paypal-order",{body:{checkoutSessionId:o,paypalMockResponse:i},method:"POST"})];case 1:r=n.sent(),e=r.errors,t=r.json;return[2/*return*/,{errors:e,json:t}]}}))}))};var U=function(n){return __awaiter(S,[n],void 0,(function(n){var r,e,t;var o=n.checkoutSessionId,i=n.intent;return __generator(this,(function(n){switch(n.label){case 0:return[4/*yield*/,m("/api/zonos-elements/create-paypal-order",{body:{checkoutSessionId:o,intent:i},method:"POST"})];case 1:r=n.sent(),e=r.errors,t=r.json;return[2/*return*/,{errors:e,json:t}]}}))}))};var Y=undefined&&undefined.__rest||function(n,r){var e={};for(var t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&r.indexOf(t)<0)e[t]=n[t];if(n!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,t=Object.getOwnPropertySymbols(n);o<t.length;o++){if(r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(n,t[o]))e[t[o]]=n[t[o]]}return e};
|
|
65
65
|
/**
|
|
66
66
|
* Mapping from our internal event names (GA-style) to Facebook Pixel standard event names.
|
|
67
67
|
* @see https://developers.facebook.com/docs/meta-pixel/reference#standard-events
|
|
68
68
|
*
|
|
69
69
|
* Events without an entry have no FB standard equivalent — they are still fired as a custom event
|
|
70
70
|
* via `fbq('trackCustom', ...)` so merchants can target them.
|
|
71
|
-
*/var H={purchase:"Purchase","zonos-checkout-payment-info":"AddPaymentInfo","zonos-checkout-start":"InitiateCheckout"};var V=function(n){var r;return(r=H[n])!==null&&r!==void 0?r:null};var
|
|
71
|
+
*/var H={purchase:"Purchase","zonos-checkout-payment-info":"AddPaymentInfo","zonos-checkout-start":"InitiateCheckout"};var V=function(n){var r;return(r=H[n])!==null&&r!==void 0?r:null};var Z=function(n){if(!n)return false;return Array.isArray(n.items)};
|
|
72
72
|
/**
|
|
73
73
|
* Convert a GA-style event payload into a Facebook Pixel parameter object.
|
|
74
74
|
*
|
|
@@ -77,9 +77,9 @@ return window[n]}function F(n,r){if(typeof n!=="object"||n===null){throw new Err
|
|
|
77
77
|
* and `content_type: 'product'`. Other primitive params (e.g. `checkoutSessionId`,
|
|
78
78
|
* `paymentMethod`, `serviceLevelId`) are forwarded as-is so merchants can build
|
|
79
79
|
* custom audiences on them.
|
|
80
|
-
*/var
|
|
80
|
+
*/var G=function(n){if(!n)return{};if(!Z(n)){
|
|
81
81
|
// Forward primitive metadata as-is for custom events
|
|
82
|
-
return Object.assign({},n)}var r=n.currency,e=n.items,t=n.transaction_id,o=n.value,i=Y(n,["currency","items","transaction_id","value"]);var a=e.map((function(n){return{id:n.item_id,item_price:n.price,quantity:n.quantity}}));var u=e.map((function(n){return n.item_id}));var c=e.reduce((function(n,r){return n+r.quantity}),0);var s=Object.assign(Object.assign({},i),{content_ids:u,content_type:"product",contents:a,num_items:c});if(t){s.order_id=t}if(r!==undefined){s.currency=r}if(o!==undefined){s.value=o}return s};var
|
|
82
|
+
return Object.assign({},n)}var r=n.currency,e=n.items,t=n.transaction_id,o=n.value,i=Y(n,["currency","items","transaction_id","value"]);var a=e.map((function(n){return{id:n.item_id,item_price:n.price,quantity:n.quantity}}));var u=e.map((function(n){return n.item_id}));var c=e.reduce((function(n,r){return n+r.quantity}),0);var s=Object.assign(Object.assign({},i),{content_ids:u,content_type:"product",contents:a,num_items:c});if(t){s.order_id=t}if(r!==undefined){s.currency=r}if(o!==undefined){s.value=o}return s};var K=function(){var n=r.checkoutSettings.analyticsProviders.find((function(n){return n.type==="FACEBOOK_PIXEL"}));return!!n&&n.status==="ENABLED"};var Q=function(n,r,e){if(E()){
|
|
83
83
|
// fbq does not work in the iframe (Facebook Pixel must be on the parent for proper attribution).
|
|
84
84
|
// Relay to parent which will call fbq() once the FB Pixel script is ready.
|
|
85
85
|
O({event:r,fbqMode:n,payload:e,provider:"fbq"});return}if(typeof window.fbq==="function"){g("Zonos submits fbq event","log","".concat(n,":").concat(r));window.fbq(n,r,e)}};
|
|
@@ -94,14 +94,14 @@ O({event:r,fbqMode:n,payload:e,provider:"fbq"});return}if(typeof window.fbq==="f
|
|
|
94
94
|
* FB-formatted parameters.
|
|
95
95
|
*
|
|
96
96
|
* @see https://developers.facebook.com/docs/meta-pixel/reference
|
|
97
|
-
*/var
|
|
97
|
+
*/var X=function(n){var r=n.event,e=n.metadata;if(!K()){return}var t=_();var o=G(e);var i=Object.assign(Object.assign({},o),t&&{isTestMode:true});
|
|
98
98
|
// filter null values
|
|
99
99
|
var a=Object.fromEntries(Object.entries(i).filter((function(n){var r=n[0],e=n[1];return e!==null})));
|
|
100
100
|
// 1) Always emit the original event as a custom event so merchants can target zonos-xxx names.
|
|
101
|
-
|
|
101
|
+
Q("trackCustom",r,a);
|
|
102
102
|
// 2) Emit FB standard equivalent if one exists. Skipped when the event itself is the standard
|
|
103
103
|
// name to avoid double-firing (e.g. 'purchase' -> 'Purchase').
|
|
104
|
-
var u=V(r);if(u&&u!==r){
|
|
104
|
+
var u=V(r);if(u&&u!==r){Q("track",u,a)}};
|
|
105
105
|
/**
|
|
106
106
|
* Fan out an analytics event to every enabled provider.
|
|
107
107
|
*
|
|
@@ -111,7 +111,7 @@ var u=V(r);if(u&&u!==r){K("track",u,a)}};
|
|
|
111
111
|
* (e.g. `purchase` → `Purchase`, `zonos-checkout-start` → `InitiateCheckout`).
|
|
112
112
|
*
|
|
113
113
|
* Each submitter no-ops when its provider is disabled in `analyticsProviders` settings.
|
|
114
|
-
*/var
|
|
114
|
+
*/var J=n("s",(function(n){I(n);X(n)}));var W=e((function(){return{intent:"capture",orderIdCreated:null,paypal:null,paypalButtons:[],paypalClientId:"",paypalErrorMessage:null}})),$=W.onChange,nn=W.reset,rn=W.state;n({e:$,c:nn,a:rn});var en=function(n){return __awaiter(S,[n],void 0,(function(n){var r,e,t,o,i,a,u;var c=n.checkoutSessionId;return __generator(this,(function(n){switch(n.label){case 0:t=rn.intent.toUpperCase();return[4/*yield*/,U({checkoutSessionId:c,intent:t})];case 1:o=n.sent(),i=o.errors,a=o.json;u=(r=a===null||a===void 0?void 0:a.paypalOrderCreate)===null||r===void 0?void 0:r.paypalOrderId;if(i.length||!u){throw new Error(((e=i.find(Boolean))===null||e===void 0?void 0:e.message)||"An unexpected error occurred when creating paypal order.")}return[2/*return*/,u]}}))}))};var tn=function(n){return __awaiter(S,[n],void 0,(function(n){var r,e,t,o,i,a;var u=n.checkoutSessionId,c=n.paypalMockResponse;return __generator(this,(function(n){switch(n.label){case 0:return[4/*yield*/,D({checkoutSessionId:u,paypalMockResponse:c})];case 1:t=n.sent(),o=t.errors,i=t.json;a=(r=i===null||i===void 0?void 0:i.paypalOrderCapture.order)===null||r===void 0?void 0:r.id;if(o.length||!a){throw new Error(((e=o.find(Boolean))===null||e===void 0?void 0:e.message)||w("An unexpected error occurred when processing PayPal order."))}return[2/*return*/,a]}}))}))};var on=function(n){var r=n.error;var e;var t=P(r.message);var o=(e=t===null||t===void 0?void 0:t.errors.find(Boolean))===null||e===void 0?void 0:e.message;var i=(o===null||o===void 0?void 0:o.match(/\[(.*?)\] (.*)/i))||[];if(!i){rn.paypalErrorMessage=w("An unexpected error occurred when processing PayPal order.")}var a=i[2]||w("An unexpected error occurred when processing PayPal order.");
|
|
115
115
|
// show the error message
|
|
116
116
|
rn.paypalErrorMessage=a};
|
|
117
117
|
/**
|
|
@@ -132,7 +132,7 @@ void i({checkoutSessionId:e,eventName:"checkout_paymentInfoCompleted",metadata:{
|
|
|
132
132
|
// the same legal contract.
|
|
133
133
|
if(a()&&!u.accepted){u.showError=true;(n=document.querySelector("zonos-policy-consent"))===null||n===void 0?void 0:n.scrollIntoView({behavior:"smooth"});b===null||b===void 0?void 0:b();return[2/*return*/,""]}r=a();if(r){u.locked=true}_=false;x.label=1;case 1:x.trys.push([1,13,14,15]);return[4/*yield*/,c()];case 2:P=x.sent();if(!P.valid){rn.paypalErrorMessage=P.errorMessage;
|
|
134
134
|
// reset stripe error message
|
|
135
|
-
s.hasPaymentError=false;s.customErrorMessage=null;
|
|
135
|
+
s.hasPaymentError=false;s.customErrorMessage=null;J({event:"zonos-checkout-payment-fail",metadata:{checkoutSessionId:e}});b===null||b===void 0?void 0:b();return[2/*return*/,""]}
|
|
136
136
|
// reset paypal error banner
|
|
137
137
|
rn.paypalErrorMessage=null;
|
|
138
138
|
// reset inventory check error message
|
|
@@ -167,7 +167,7 @@ _=true;return[2/*return*/,""];case 11:return[4/*yield*/,en({checkoutSessionId:e}
|
|
|
167
167
|
// clean up; an empty ID falls through to the unlock in `finally`.
|
|
168
168
|
_=!!S;return[2/*return*/,S];case 13:A=x.sent();j("Failed to create paypal order",A);rn.paypalErrorMessage=w("Failed to create PayPal order. Please try again, or consider using an alternative method.");
|
|
169
169
|
// reset stripe error message
|
|
170
|
-
s.hasPaymentError=false;s.customErrorMessage=null;
|
|
170
|
+
s.hasPaymentError=false;s.customErrorMessage=null;J({event:"zonos-checkout-payment-fail",metadata:{checkoutSessionId:e}});
|
|
171
171
|
// trigger fail event
|
|
172
172
|
b===null||b===void 0?void 0:b();return[2/*return*/,""];case 14:
|
|
173
173
|
// Clear the lock unless we successfully handed off the order — on
|
|
@@ -176,7 +176,7 @@ if(r&&!_){u.locked=false}return[7/*endfinally*/];case 15:return[2/*return*/]}}))
|
|
|
176
176
|
// reset paypal error banner
|
|
177
177
|
rn.paypalErrorMessage=null;
|
|
178
178
|
// submit google tag when the form is complete
|
|
179
|
-
|
|
179
|
+
J({event:"zonos-checkout-payment-info",metadata:{checkoutSessionId:e,paymentMethod:"paypal"}});return[4/*yield*/,tn({checkoutSessionId:e,paypalMockResponse:window.Zonos._paypalMockResponse})];case 1:n=i.sent();rn.orderIdCreated=n;m===null||m===void 0?void 0:m({orderId:n});t();
|
|
180
180
|
// clear the checkout session timeout timer when purchase is complete
|
|
181
181
|
o();return[3/*break*/,3];case 2:r=i.sent();j("==== Failed to capture paypal order",r);if(r instanceof Error){return[2/*return*/,on({error:r})]}b===null||b===void 0?void 0:b();return[3/*break*/,3];case 3:return[2/*return*/]}}))}))},style:{
|
|
182
182
|
// @ts-ignore
|