@zonos/elements 1.5.1 → 1.5.2
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-CiXlehwQ.js → cart-BJpqPdFU.js} +13 -13
- package/dist/cjs/{collect-Drr8fY-q.js → collect-CyUttsvB.js} +3 -3
- package/dist/cjs/{getMissingRequiredShippingFields-DI6qF1z3.js → getMissingRequiredShippingFields-DEbNbRAZ.js} +1 -1
- package/dist/cjs/{handleFetch-DQLhurnE.js → handleFetch-DVfjFTYO.js} +181 -71
- package/dist/cjs/{hasInclusivePrice-84KS94yH.js → hasInclusivePrice-CEPf3_FG.js} +1 -1
- package/dist/cjs/index.cjs.js +104 -12
- package/dist/cjs/{invoice-5hVfSXpb.js → invoice-DzRkkpLu.js} +3 -3
- package/dist/cjs/{localization-B2mjW0Xa.js → localization-BhNVhLZs.js} +24 -48
- package/dist/cjs/{paypal-pd8Nz_R_.js → paypal-DCSqbdjW.js} +4 -4
- package/dist/cjs/{placeTestOrder-DrI8rD9o.js → placeTestOrder-Bkip4PUT.js} +3 -3
- package/dist/cjs/{renderCheckoutCurrency-u5q8YdUb.js → renderCheckoutCurrency-BDvEZ3Hv.js} +2 -2
- package/dist/cjs/{shouldShowLanguageSelect-gBg4KeTQ.js → shouldShowLanguageSelect-NOVWOU53.js} +1 -1
- package/dist/cjs/{submitGtag-Rc-S3PnH.js → submitGtag-D4sB7w4z.js} +1 -1
- package/dist/cjs/{taxIdFields-BrIaPTcd.js → taxIdFields-e4OCgr8K.js} +2 -2
- package/dist/cjs/{updateCheckoutSessionAttributes-d0IKpwW8.js → updateCheckoutSessionAttributes-KxwcsKhM.js} +1 -1
- package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +5 -5
- package/dist/cjs/zonos-address-display_2.cjs.entry.js +2 -2
- package/dist/cjs/zonos-address_4.cjs.entry.js +4 -4
- package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +4 -4
- package/dist/cjs/zonos-card_5.cjs.entry.js +5 -5
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +18 -18
- package/dist/cjs/zonos-checkout.cjs.entry.js +9 -9
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +3 -3
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +9 -9
- package/dist/cjs/zonos-collect.cjs.entry.js +6 -6
- package/dist/cjs/zonos-controller.cjs.entry.js +6 -6
- package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +3 -3
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +3 -3
- package/dist/cjs/zonos-hello.cjs.entry.js +2 -2
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +5 -5
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +9 -9
- package/dist/cjs/zonos-invoice.cjs.entry.js +6 -6
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
- package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +4 -4
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +8 -7
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +4 -3
- package/dist/collection/components/main/zonos-controller.js +3 -2
- package/dist/collection/components/store/checkout/cart.js +3 -2
- package/dist/collection/components/store/checkout/stripe.js +10 -9
- package/dist/collection/components/store/storageStore.js +7 -6
- package/dist/collection/components/utils/__tests__/helpers/blockStorage.js +24 -0
- package/dist/collection/components/utils/api/getExchangeRate.js +2 -1
- package/dist/collection/components/utils/handleFetch.js +19 -9
- package/dist/collection/components/utils/hello/countryOverrideStorage.js +17 -40
- package/dist/collection/components/utils/logging/installConstructorCapture.js +58 -0
- package/dist/collection/components/utils/logging/reportBlockedStorage.js +34 -0
- package/dist/collection/components/utils/logging/sendErrorLog.js +8 -1
- package/dist/collection/components/utils/logging/startZonosInit.js +35 -0
- package/dist/collection/components/utils/logging/thrownMessage.js +16 -0
- package/dist/collection/components/utils/safeStorage.js +39 -0
- package/dist/collection/scripts/_getZonosQaUrl.js +3 -2
- package/dist/collection/scripts/_zonosBase.js +6 -2
- package/dist/collection/types/generated/graphql.frontend.types.js +0 -16
- package/dist/collection/types/generated/graphql.internal.types.js +215 -1
- package/dist/esm/{cart-DmJkjiDE.js → cart-BS5mSI8x.js} +13 -13
- package/dist/esm/{collect-BV5GTPmh.js → collect-B9ZxDDl7.js} +3 -3
- package/dist/esm/{getMissingRequiredShippingFields-DljgpDZe.js → getMissingRequiredShippingFields-BkEV865q.js} +1 -1
- package/dist/esm/{handleFetch-D5GYDF-O.js → handleFetch-BFVO7oAR.js} +178 -72
- package/dist/esm/{hasInclusivePrice-DhGXpH2D.js → hasInclusivePrice-zSvDReDb.js} +1 -1
- package/dist/esm/index.js +104 -12
- package/dist/esm/{invoice-CO-iqlni.js → invoice-6iTuS6ek.js} +3 -3
- package/dist/esm/{localization-DHM91diu.js → localization-CXHiWcJp.js} +24 -48
- package/dist/esm/{paypal-BfW5aLJw.js → paypal-BE_NVBoy.js} +4 -4
- package/dist/esm/{placeTestOrder-CyWUFhxD.js → placeTestOrder-BXA9K9Iy.js} +3 -3
- package/dist/esm/{renderCheckoutCurrency-B31ZNkUv.js → renderCheckoutCurrency-KMa4HlAf.js} +2 -2
- package/dist/esm/{shouldShowLanguageSelect-DwSfSHar.js → shouldShowLanguageSelect-BI_ApEsQ.js} +1 -1
- package/dist/esm/{submitGtag-BEFrutel.js → submitGtag-C5xzFHjG.js} +1 -1
- package/dist/esm/{taxIdFields-ByEYfsO5.js → taxIdFields-BUKnHMaL.js} +2 -2
- package/dist/esm/{updateCheckoutSessionAttributes-B0bQH0uw.js → updateCheckoutSessionAttributes-C9bMKTjz.js} +1 -1
- package/dist/esm/zonos-address-completion-dialog_7.entry.js +5 -5
- package/dist/esm/zonos-address-display_2.entry.js +2 -2
- package/dist/esm/zonos-address_4.entry.js +4 -4
- package/dist/esm/zonos-airwallex-payment.entry.js +4 -4
- package/dist/esm/zonos-card_5.entry.js +5 -5
- package/dist/esm/zonos-cart-items_12.entry.js +18 -18
- package/dist/esm/zonos-checkout.entry.js +9 -9
- package/dist/esm/zonos-collect-cart-items_3.entry.js +3 -3
- package/dist/esm/zonos-collect-finish_6.entry.js +9 -9
- package/dist/esm/zonos-collect.entry.js +6 -6
- package/dist/esm/zonos-controller.entry.js +6 -6
- package/dist/esm/zonos-country-flag.entry.js +2 -2
- package/dist/esm/zonos-country-select_4.entry.js +3 -3
- package/dist/esm/zonos-hello-dialog.entry.js +3 -3
- package/dist/esm/zonos-hello.entry.js +2 -2
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +5 -5
- package/dist/esm/zonos-invoice-finish_5.entry.js +9 -9
- package/dist/esm/zonos-invoice.entry.js +6 -6
- package/dist/esm/zonos-language-select_2.entry.js +2 -2
- package/dist/esm/zonos-policy-consent_2.entry.js +4 -4
- package/dist/esm-es5/{cart-DmJkjiDE.js → cart-BS5mSI8x.js} +58 -58
- package/dist/esm-es5/{collect-BV5GTPmh.js → collect-B9ZxDDl7.js} +1 -1
- package/dist/esm-es5/{getMissingRequiredShippingFields-DljgpDZe.js → getMissingRequiredShippingFields-BkEV865q.js} +1 -1
- package/dist/esm-es5/handleFetch-BFVO7oAR.js +73 -0
- package/dist/esm-es5/{hasInclusivePrice-DhGXpH2D.js → hasInclusivePrice-zSvDReDb.js} +1 -1
- package/dist/esm-es5/index.js +26 -8
- package/dist/esm-es5/{invoice-CO-iqlni.js → invoice-6iTuS6ek.js} +1 -1
- package/dist/esm-es5/{localization-DHM91diu.js → localization-CXHiWcJp.js} +6 -9
- package/dist/esm-es5/{paypal-BfW5aLJw.js → paypal-BE_NVBoy.js} +1 -1
- package/dist/esm-es5/{placeTestOrder-CyWUFhxD.js → placeTestOrder-BXA9K9Iy.js} +1 -1
- package/dist/esm-es5/{renderCheckoutCurrency-B31ZNkUv.js → renderCheckoutCurrency-KMa4HlAf.js} +2 -2
- package/dist/esm-es5/{shouldShowLanguageSelect-DwSfSHar.js → shouldShowLanguageSelect-BI_ApEsQ.js} +1 -1
- package/dist/esm-es5/{submitGtag-BEFrutel.js → submitGtag-C5xzFHjG.js} +1 -1
- package/dist/esm-es5/{taxIdFields-ByEYfsO5.js → taxIdFields-BUKnHMaL.js} +2 -2
- package/dist/esm-es5/{updateCheckoutSessionAttributes-B0bQH0uw.js → updateCheckoutSessionAttributes-C9bMKTjz.js} +1 -1
- package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +1 -1
- package/dist/esm-es5/zonos-address-display_2.entry.js +1 -1
- package/dist/esm-es5/zonos-address_4.entry.js +1 -1
- package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
- package/dist/esm-es5/zonos-card_5.entry.js +6 -6
- package/dist/esm-es5/zonos-cart-items_12.entry.js +127 -127
- package/dist/esm-es5/zonos-checkout.entry.js +3 -3
- package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
- package/dist/esm-es5/zonos-collect.entry.js +6 -6
- package/dist/esm-es5/zonos-controller.entry.js +5 -5
- 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 +1 -1
- package/dist/esm-es5/zonos-invoice.entry.js +3 -3
- 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/scripts/index.d.ts +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/types/components/utils/__tests__/helpers/blockStorage.d.ts +3 -0
- package/dist/types/components/utils/logging/installConstructorCapture.d.ts +20 -0
- package/dist/types/components/utils/logging/reportBlockedStorage.d.ts +16 -0
- package/dist/types/components/utils/logging/startZonosInit.d.ts +5 -0
- package/dist/types/components/utils/logging/thrownMessage.d.ts +1 -0
- package/dist/types/components/utils/safeStorage.d.ts +4 -0
- package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +5 -0
- package/dist/types/types/generated/graphql.frontend.types.d.ts +0 -22
- package/dist/types/types/generated/graphql.frontend.types.ts +0 -51
- package/dist/types/types/generated/graphql.internal.types.d.ts +270 -1
- package/dist/types/types/generated/graphql.internal.types.ts +341 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-8fa6cfff.entry.js → p-08b01c96.entry.js} +1 -1
- package/dist/zonos-elements/{p-3e705c9b.entry.js → p-0909ef77.entry.js} +1 -1
- package/dist/zonos-elements/{p-2b63865a.system.entry.js → p-13015d34.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2d513aa3.entry.js → p-13d5b2f9.entry.js} +1 -1
- package/dist/zonos-elements/{p-46a839d2.system.entry.js → p-150047b3.system.entry.js} +16 -16
- package/dist/zonos-elements/{p-6e691736.entry.js → p-1986cc37.entry.js} +1 -1
- package/dist/zonos-elements/{p-vTIygnHq.system.js → p-1OG3IJgY.system.js} +1 -1
- package/dist/zonos-elements/{p-189cc594.system.entry.js → p-30bf4700.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4917b74d.entry.js → p-3466bcba.entry.js} +1 -1
- package/dist/zonos-elements/{p-12b24ebb.entry.js → p-383343c7.entry.js} +1 -1
- package/dist/zonos-elements/{p-5585db86.system.entry.js → p-3a506614.system.entry.js} +36 -36
- package/dist/zonos-elements/{p-46b9f0cf.entry.js → p-43c0ebe9.entry.js} +1 -1
- package/dist/zonos-elements/{p-84e76348.entry.js → p-4b65f192.entry.js} +1 -1
- package/dist/zonos-elements/{p-216a908d.system.entry.js → p-573a4e7c.system.entry.js} +6 -6
- package/dist/zonos-elements/{p-1fda4aec.system.entry.js → p-5a296dbc.system.entry.js} +87 -87
- package/dist/zonos-elements/{p-960070d0.system.entry.js → p-68325c5a.system.entry.js} +4 -4
- package/dist/zonos-elements/{p-53eac12f.system.entry.js → p-6db7317a.system.entry.js} +13 -13
- package/dist/zonos-elements/{p-1199baef.system.entry.js → p-709d1561.system.entry.js} +1 -1
- package/dist/zonos-elements/p-71d29603.entry.js +1 -0
- package/dist/zonos-elements/{p-064d8829.system.entry.js → p-7214c953.system.entry.js} +23 -23
- package/dist/zonos-elements/{p-65817880.entry.js → p-7fe83919.entry.js} +1 -1
- package/dist/zonos-elements/p-8ac26831.entry.js +1 -0
- package/dist/zonos-elements/{p-cccaad60.system.entry.js → p-8f9f859f.system.entry.js} +9 -9
- package/dist/zonos-elements/{p-f5f95990.system.entry.js → p-96b250d8.system.entry.js} +14 -14
- package/dist/zonos-elements/{p-678b9214.entry.js → p-97729873.entry.js} +1 -1
- package/dist/zonos-elements/{p-f3d9a380.system.entry.js → p-9b3668a4.system.entry.js} +144 -144
- package/dist/zonos-elements/{p-d8f375da.system.entry.js → p-9df31243.system.entry.js} +1 -1
- package/dist/zonos-elements/p-BI6VAB5B.js +1 -0
- package/dist/zonos-elements/p-BJFa5RwX.js +1 -0
- package/dist/zonos-elements/p-BJ_kE5rM.js +1 -0
- package/dist/zonos-elements/{p-XoQH3S7Z.system.js → p-BKUlQxBd.system.js} +1 -1
- package/dist/zonos-elements/{p-DprOoI2W.system.js → p-BUfCTQXY.system.js} +154 -154
- package/dist/zonos-elements/{p-CBUz18kA.system.js → p-BnQyot7Y.system.js} +23 -23
- package/dist/zonos-elements/p-Bu9WCfUC.system.js +1 -1
- package/dist/zonos-elements/{p-CMo3ZweU.js → p-C-zdj7MK.js} +1 -1
- package/dist/zonos-elements/{p-iAIzUA4k.js → p-C5fs3rIR.js} +1 -1
- package/dist/zonos-elements/{p-D1e9zNDA.js → p-CJmWr75U.js} +1 -1
- package/dist/zonos-elements/{p-Dtu_Japy.system.js → p-CMneHjck.system.js} +39 -39
- package/dist/zonos-elements/p-CP7KnfR3.system.js +245 -0
- package/dist/zonos-elements/p-CVRbGFV3.js +1 -0
- package/dist/zonos-elements/p-Cl5yV0ak.js +1 -0
- package/dist/zonos-elements/{p-CGNVm52g.system.js → p-Cp1IAJvW.system.js} +5 -5
- package/dist/zonos-elements/{p-6vSUiBfr.system.js → p-D-Lnf8mS.system.js} +50 -53
- package/dist/zonos-elements/p-D0DkOoAw.system.js +73 -0
- package/dist/zonos-elements/p-D4xpkSsK.js +1 -0
- package/dist/zonos-elements/p-DATNIakn.js +1 -0
- package/dist/zonos-elements/{p-CbhN65lj.system.js → p-DC1OPJDq.system.js} +1 -1
- package/dist/zonos-elements/{p-CHKKvuiz.js → p-DKnphvmJ.js} +1 -1
- package/dist/zonos-elements/{p-ojtNq-r5.system.js → p-DXlojp_Y.system.js} +1 -1
- package/dist/zonos-elements/{p-C9XLkmmb.system.js → p-DrS-0mk7.system.js} +1 -1
- package/dist/zonos-elements/{p-DpwmHU8R.js → p-DrbN3rPL.js} +2 -2
- package/dist/zonos-elements/{p-BrQ8n8NS.system.js → p-Dv5a-V6w.system.js} +3 -3
- package/dist/zonos-elements/{p-55813e9f.system.entry.js → p-a3c147d2.system.entry.js} +3 -3
- package/dist/zonos-elements/{p-DiMEP3mh.js → p-aK18R41t.js} +1 -1
- package/dist/zonos-elements/p-af4ad54b.entry.js +1 -0
- package/dist/zonos-elements/{p-1e6db427.entry.js → p-af741506.entry.js} +1 -1
- package/dist/zonos-elements/{p-2ca826b9.system.entry.js → p-b540c636.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-636b71d4.entry.js → p-bac94956.entry.js} +1 -1
- package/dist/zonos-elements/{p-941a95a1.system.entry.js → p-bb1b414a.system.entry.js} +5 -5
- package/dist/zonos-elements/{p-e7fdb2c9.entry.js → p-bfa9e32a.entry.js} +1 -1
- package/dist/zonos-elements/p-cf6bf7a4.entry.js +1 -0
- package/dist/zonos-elements/p-dJcbnNlE.system.js +7 -0
- package/dist/zonos-elements/{p-7dc7f328.entry.js → p-db40b9c3.entry.js} +1 -1
- package/dist/zonos-elements/{p-d3345b2c.entry.js → p-dd003161.entry.js} +1 -1
- package/dist/zonos-elements/{p-ef5344ea.entry.js → p-e374aaa4.entry.js} +1 -1
- package/dist/zonos-elements/{p-6410fa11.system.entry.js → p-e43470f7.system.entry.js} +22 -22
- package/dist/zonos-elements/{p-fda89981.system.entry.js → p-ebc7ea54.system.entry.js} +3 -3
- package/dist/zonos-elements/{p-1cc42a98.system.entry.js → p-f2ed52bc.system.entry.js} +16 -16
- package/dist/zonos-elements/p-gEViRqvf.js +1 -0
- package/dist/zonos-elements/{p-DgUrB-1a.system.js → p-yv7ekcdG.system.js} +2 -2
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/handleFetch-D5GYDF-O.js +0 -60
- package/dist/zonos-elements/p-107f287b.entry.js +0 -1
- package/dist/zonos-elements/p-25eb99d4.entry.js +0 -1
- package/dist/zonos-elements/p-8f9d8795.entry.js +0 -1
- package/dist/zonos-elements/p-BMPYH-LT.js +0 -1
- package/dist/zonos-elements/p-C70h5mKA.js +0 -1
- package/dist/zonos-elements/p-CTiqplrr.js +0 -1
- package/dist/zonos-elements/p-Ch1w0Lr7.js +0 -1
- package/dist/zonos-elements/p-D1SmY_fZ.js +0 -1
- package/dist/zonos-elements/p-D6xXnsM_.js +0 -1
- package/dist/zonos-elements/p-DE4a-QD5.js +0 -1
- package/dist/zonos-elements/p-DQrMfUzi.system.js +0 -227
- package/dist/zonos-elements/p-DZdkJHK9.system.js +0 -7
- package/dist/zonos-elements/p-U33isUJG.js +0 -1
- package/dist/zonos-elements/p-ebe157b5.entry.js +0 -1
- package/dist/zonos-elements/p-zVLAvre1.system.js +0 -60
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { sendErrorLog } from "./sendErrorLog";
|
|
2
|
+
import { thrownMessage } from "./thrownMessage";
|
|
3
|
+
const constructorNotFound = /^Constructor for .+ was not found/;
|
|
4
|
+
const constructorTag = /^Constructor for "?([^#"]+)#/;
|
|
5
|
+
const recordConstructorFailure = (value) => {
|
|
6
|
+
var _a;
|
|
7
|
+
const message = thrownMessage(value, '');
|
|
8
|
+
if (!message || !constructorNotFound.test(message)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (typeof window.Zonos === 'undefined') {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const capture = window.__zonosConstructorCapture;
|
|
15
|
+
if (!capture) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const tagMatch = constructorTag.exec(message);
|
|
19
|
+
const tag = (_a = tagMatch === null || tagMatch === void 0 ? void 0 : tagMatch[1]) !== null && _a !== void 0 ? _a : '';
|
|
20
|
+
if (capture.reported.has(tag)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
capture.reported.add(tag);
|
|
24
|
+
void sendErrorLog({
|
|
25
|
+
endpoint: 'stencil://constructor',
|
|
26
|
+
errors: [message],
|
|
27
|
+
metadata: {
|
|
28
|
+
shape: 'constructor-not-found',
|
|
29
|
+
tag,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Copy a missing-constructor failure onto the existing error log.
|
|
35
|
+
* Stencil catches `Constructor for "tag#mode" was not found` and passes that
|
|
36
|
+
* Error to `console.error`. One report is sent per tag, then the original
|
|
37
|
+
* console.error still runs. This does not request the chunk again.
|
|
38
|
+
*/
|
|
39
|
+
export const installConstructorCapture = () => {
|
|
40
|
+
if (window.__zonosConstructorCapture) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const listener = (event) => {
|
|
44
|
+
recordConstructorFailure(event.reason);
|
|
45
|
+
};
|
|
46
|
+
window.__zonosConstructorCapture = {
|
|
47
|
+
listener,
|
|
48
|
+
reported: new Set(),
|
|
49
|
+
};
|
|
50
|
+
window.addEventListener('unhandledrejection', listener);
|
|
51
|
+
// eslint-disable-next-line no-console -- Stencil reports the missing constructor here
|
|
52
|
+
const originalError = console.error.bind(console);
|
|
53
|
+
// eslint-disable-next-line no-console -- record the Stencil diagnostic, then forward it
|
|
54
|
+
console.error = (...data) => {
|
|
55
|
+
recordConstructorFailure(data[0]);
|
|
56
|
+
originalError(...data);
|
|
57
|
+
};
|
|
58
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { sendErrorLog } from "./sendErrorLog";
|
|
2
|
+
import { thrownMessage } from "./thrownMessage";
|
|
3
|
+
const reportedIds = () => {
|
|
4
|
+
if (!window.__zonosReportedBlockedStorage) {
|
|
5
|
+
window.__zonosReportedBlockedStorage = new Set();
|
|
6
|
+
}
|
|
7
|
+
return window.__zonosReportedBlockedStorage;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Record a blocked storage read or write on the existing error log.
|
|
11
|
+
* A throw before `window.Zonos` exists is swallowed and does not use up
|
|
12
|
+
* the per-page dedupe slot, so the later startup read can still report it.
|
|
13
|
+
*/
|
|
14
|
+
export const reportBlockedStorage = (area, operation, key, error) => {
|
|
15
|
+
if (typeof window.Zonos === 'undefined') {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const dedupeId = `${area}\u0000${operation}\u0000${key}`;
|
|
19
|
+
const reported = reportedIds();
|
|
20
|
+
if (reported.has(dedupeId)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
reported.add(dedupeId);
|
|
24
|
+
void sendErrorLog({
|
|
25
|
+
endpoint: `storage://${area}/${key}`,
|
|
26
|
+
errors: [thrownMessage(error, 'SecurityError')],
|
|
27
|
+
metadata: {
|
|
28
|
+
area,
|
|
29
|
+
key,
|
|
30
|
+
operation,
|
|
31
|
+
shape: 'blocked-storage',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
};
|
|
@@ -5,6 +5,13 @@ import { log } from "./log";
|
|
|
5
5
|
* @default 1 hour
|
|
6
6
|
*/
|
|
7
7
|
const postReleaseReportingDuration = 1 * 3600 * 1000; // 1 hour
|
|
8
|
+
const loggedHref = () => {
|
|
9
|
+
const url = new URL(window.location.href);
|
|
10
|
+
url.searchParams.delete('payment_intent');
|
|
11
|
+
url.searchParams.delete('payment_intent_client_secret');
|
|
12
|
+
url.searchParams.delete('redirect_status');
|
|
13
|
+
return url.toString();
|
|
14
|
+
};
|
|
8
15
|
export const sendErrorLog = async ({ endpoint, errors, metadata, shouldPostReleaseErrorReporting, }) => {
|
|
9
16
|
log('sendErrorLog', 'warn', endpoint, metadata, errors);
|
|
10
17
|
if (shouldPostReleaseErrorReporting) {
|
|
@@ -22,7 +29,7 @@ export const sendErrorLog = async ({ endpoint, errors, metadata, shouldPostRelea
|
|
|
22
29
|
const errorObject = {
|
|
23
30
|
endpoint,
|
|
24
31
|
errors,
|
|
25
|
-
href:
|
|
32
|
+
href: loggedHref(),
|
|
26
33
|
metadata: Object.assign({ appVersion: window.Zonos.version, domain: window.Zonos.domain, publicCredential: window.Zonos.zonosApiKey, userAgent: userAgentData && userAgentData.brands.length > 0
|
|
27
34
|
? userAgentData
|
|
28
35
|
: window.navigator.userAgent }, metadata),
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { sendErrorLog } from "./sendErrorLog";
|
|
2
|
+
import { thrownMessage } from "./thrownMessage";
|
|
3
|
+
const reportInitRejection = (error) => {
|
|
4
|
+
// sendErrorLog prints only when zonosDebug is on. Keep the failure in the
|
|
5
|
+
// merchant console without leaving an unhandled rejection.
|
|
6
|
+
// eslint-disable-next-line no-console -- the page console is the support signal
|
|
7
|
+
console.error(error);
|
|
8
|
+
if (typeof window.Zonos === 'undefined') {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
void sendErrorLog({
|
|
12
|
+
endpoint: 'zonos://init',
|
|
13
|
+
errors: [thrownMessage(error, 'Unknown init rejection')],
|
|
14
|
+
metadata: {
|
|
15
|
+
shape: 'init-rejection',
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Run an init that the caller is not waiting on. The rejection is recorded
|
|
21
|
+
* and not rethrown, so startup does not become an unhandled rejection.
|
|
22
|
+
*/
|
|
23
|
+
export const startZonosInit = (start) => {
|
|
24
|
+
let pending;
|
|
25
|
+
try {
|
|
26
|
+
pending = start();
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
reportInitRejection(error);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
void pending.catch((error) => {
|
|
33
|
+
reportInitRejection(error);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const thrownMessage = (error, fallback) => {
|
|
2
|
+
if (typeof error === 'string' && error) {
|
|
3
|
+
return error;
|
|
4
|
+
}
|
|
5
|
+
if (error instanceof Error && error.message) {
|
|
6
|
+
return error.message;
|
|
7
|
+
}
|
|
8
|
+
if (typeof error === 'object' &&
|
|
9
|
+
error !== null &&
|
|
10
|
+
'message' in error &&
|
|
11
|
+
typeof error.message === 'string' &&
|
|
12
|
+
error.message) {
|
|
13
|
+
return error.message;
|
|
14
|
+
}
|
|
15
|
+
return fallback;
|
|
16
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { reportBlockedStorage, } from "./logging/reportBlockedStorage";
|
|
2
|
+
/**
|
|
3
|
+
* Touch `window.localStorage` / `window.sessionStorage` inside the try.
|
|
4
|
+
* Safari throws SecurityError on the getter itself when storage is blocked.
|
|
5
|
+
* A missing storage object is the same failure: calling `getItem` on it
|
|
6
|
+
* would report a TypeError instead of blocked storage.
|
|
7
|
+
*/
|
|
8
|
+
const storageFor = (area) => {
|
|
9
|
+
const storage = area === 'local' ? window.localStorage : window.sessionStorage;
|
|
10
|
+
if (!storage) {
|
|
11
|
+
throw new DOMException('', 'SecurityError');
|
|
12
|
+
}
|
|
13
|
+
return storage;
|
|
14
|
+
};
|
|
15
|
+
export const safeGetItem = (area, key) => {
|
|
16
|
+
try {
|
|
17
|
+
return storageFor(area).getItem(key);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
reportBlockedStorage(area, 'getItem', key, error);
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export const safeRemoveItem = (area, key) => {
|
|
25
|
+
try {
|
|
26
|
+
storageFor(area).removeItem(key);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
reportBlockedStorage(area, 'removeItem', key, error);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export const safeSetItem = (area, key, value) => {
|
|
33
|
+
try {
|
|
34
|
+
storageFor(area).setItem(key, value);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
reportBlockedStorage(area, 'setItem', key, error);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { log } from "../components/utils/logging/log";
|
|
2
|
+
import { safeRemoveItem } from "../components/utils/safeStorage";
|
|
2
3
|
import { extractZonosQaUrl, extractZonosQaUrlApi, } from "./_extractZonosQaUrl";
|
|
3
4
|
/**
|
|
4
5
|
* Get the Zonos QA URL and return it. Will remove `zonosQaUrl` from the url query if it doesn't exists.
|
|
@@ -49,8 +50,8 @@ export const getZonosQaUrl = () => {
|
|
|
49
50
|
void fetch(fullUrl)
|
|
50
51
|
.then(() => {
|
|
51
52
|
// cleanup checkout session to avoid using the prod session in preview domain
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
safeRemoveItem('session', 'zonos--checkout-session-id');
|
|
54
|
+
safeRemoveItem('session', 'zonos--client-secret');
|
|
54
55
|
})
|
|
55
56
|
.catch(() => {
|
|
56
57
|
alert(`[ZONOS-WARNING] '${fullUrl}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { createCustomEvent } from "../components/utils/createCustomEvent";
|
|
3
3
|
import { IframeService } from "../components/utils/iframe/IframeHelpers";
|
|
4
|
+
import { installConstructorCapture } from "../components/utils/logging/installConstructorCapture";
|
|
4
5
|
import { log } from "../components/utils/logging/log";
|
|
5
6
|
import { logError } from "../components/utils/logging/logError";
|
|
7
|
+
import { startZonosInit } from "../components/utils/logging/startZonosInit";
|
|
8
|
+
import { safeGetItem } from "../components/utils/safeStorage";
|
|
6
9
|
import { checkIfLoadVersionDomain } from "./_checkIfLoadVersionDomain";
|
|
7
10
|
import { getNextFallbackUrl, MAIN_LOAD_CDN_TYPE, } from "./_getNextFallbackUrl";
|
|
8
11
|
import { getWithTestPublicCredential } from "./_getWithTestPublicCredential";
|
|
@@ -85,6 +88,7 @@ Zonos.zonosController = null;
|
|
|
85
88
|
Zonos.loadTimeApiInfoList = [];
|
|
86
89
|
Zonos.logIntervalId = null;
|
|
87
90
|
Zonos.init = async (params) => {
|
|
91
|
+
installConstructorCapture();
|
|
88
92
|
const { appearance, checkoutSettings, currencyConverter, helloSettings, onCountryChange, overrideCurrencyFormat, storeId, zonosApiKey, } = params;
|
|
89
93
|
_a.cartId = getCartIdFromQueryParam();
|
|
90
94
|
// Expose the checkout cart callbacks on the global so Stripe loading can be
|
|
@@ -120,7 +124,7 @@ Zonos.init = async (params) => {
|
|
|
120
124
|
window.Zonos.isLegacyCheckout = _a.isLegacyCheckout;
|
|
121
125
|
window.Zonos.zonosMode = _a.zonosMode;
|
|
122
126
|
// call init again after the script is loaded
|
|
123
|
-
|
|
127
|
+
startZonosInit(() => window.Zonos.init(params));
|
|
124
128
|
});
|
|
125
129
|
script.addEventListener('error', () => {
|
|
126
130
|
alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${zonosQaUrl}`);
|
|
@@ -156,7 +160,7 @@ Zonos.init = async (params) => {
|
|
|
156
160
|
}
|
|
157
161
|
}
|
|
158
162
|
// Check if the stripe client secret is available in the url or session storage, inject hidden button to trigger checkout right away to check status of client secret
|
|
159
|
-
const clientSecretUrlParam = new URL(window.location.href).searchParams.get('payment_intent_client_secret') ||
|
|
163
|
+
const clientSecretUrlParam = new URL(window.location.href).searchParams.get('payment_intent_client_secret') || safeGetItem('session', 'zonos--client-secret');
|
|
160
164
|
const shouldAttemptImmediatelyOpenCheckout = (_a.cartId && _a.cartData) || !!clientSecretUrlParam;
|
|
161
165
|
// inject hidden button to body to trigger checkout right away if we have cartData or stripe client secret
|
|
162
166
|
if (shouldAttemptImmediatelyOpenCheckout) {
|
|
@@ -665,14 +665,6 @@ export function getSdk(client, withWrapper = defaultWrapper) {
|
|
|
665
665
|
variables,
|
|
666
666
|
}), 'insertOrderImportLock', 'mutation', variables);
|
|
667
667
|
},
|
|
668
|
-
insertReserveOrder(variables, requestHeaders, signal) {
|
|
669
|
-
return withWrapper(wrappedRequestHeaders => client.request({
|
|
670
|
-
document: '',
|
|
671
|
-
requestHeaders: Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders),
|
|
672
|
-
signal,
|
|
673
|
-
variables,
|
|
674
|
-
}), 'insertReserveOrder', 'mutation', variables);
|
|
675
|
-
},
|
|
676
668
|
insertReserveOrderEvent(variables, requestHeaders, signal) {
|
|
677
669
|
return withWrapper(wrappedRequestHeaders => client.request({
|
|
678
670
|
document: '',
|
|
@@ -713,14 +705,6 @@ export function getSdk(client, withWrapper = defaultWrapper) {
|
|
|
713
705
|
variables,
|
|
714
706
|
}), 'storeVersionSetting', 'query', variables);
|
|
715
707
|
},
|
|
716
|
-
updateReserveOrder(variables, requestHeaders, signal) {
|
|
717
|
-
return withWrapper(wrappedRequestHeaders => client.request({
|
|
718
|
-
document: '',
|
|
719
|
-
requestHeaders: Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders),
|
|
720
|
-
signal,
|
|
721
|
-
variables,
|
|
722
|
-
}), 'updateReserveOrder', 'mutation', variables);
|
|
723
|
-
},
|
|
724
708
|
upsertBigCommerceSettings(variables, requestHeaders, signal) {
|
|
725
709
|
return withWrapper(wrappedRequestHeaders => client.request({
|
|
726
710
|
document: '',
|