@zonos/elements 1.5.0 → 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/{TaxId-Q6aDqqWv.js → TaxId-ChhNwG04.js} +36 -0
- package/dist/cjs/{cart-B6Aty-21.js → cart-BJpqPdFU.js} +100 -64
- package/dist/cjs/{collect-DnrvaXUI.js → collect-CyUttsvB.js} +4 -4
- package/dist/cjs/{debounce-Cd2emZPn.js → debounce-BhgA8_3W.js} +2 -2
- package/dist/cjs/{debounce-vY0QYT6o.js → debounce-DRPMxNew.js} +1 -1
- package/dist/cjs/{getBorderRadius-CyYZw4qq.js → getBorderRadius-CJ_95w3o.js} +1 -1
- package/dist/cjs/{getMissingRequiredShippingFields-D03ICqss.js → getMissingRequiredShippingFields-DEbNbRAZ.js} +1 -1
- package/dist/cjs/{handleFetch-DQLhurnE.js → handleFetch-DVfjFTYO.js} +181 -71
- package/dist/cjs/{hasInclusivePrice-CPCoVeU3.js → hasInclusivePrice-CEPf3_FG.js} +1 -1
- package/dist/cjs/index.cjs.js +116 -13
- package/dist/cjs/{invoice-Cj8W7NW0.js → invoice-DzRkkpLu.js} +4 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{localization-BzNeXeDe.js → localization-BhNVhLZs.js} +725 -89
- package/dist/cjs/{paypal-CuKshRmZ.js → paypal-DCSqbdjW.js} +5 -5
- package/dist/cjs/{placeTestOrder-7czjwkjm.js → placeTestOrder-Bkip4PUT.js} +3 -3
- package/dist/cjs/{renderCheckoutCurrency-BH8t2b2x.js → renderCheckoutCurrency-BDvEZ3Hv.js} +2 -2
- package/dist/cjs/shouldRenderShortAddressCodeInput-gpu_bMfp.js +21 -0
- package/dist/cjs/{shouldShowLanguageSelect-yAbtCmd8.js → shouldShowLanguageSelect-NOVWOU53.js} +1 -1
- package/dist/cjs/{submitGtag-D79e8u6s.js → submitGtag-D4sB7w4z.js} +2 -2
- package/dist/cjs/{throttle-zSVRQLC0.js → taxIdFields-e4OCgr8K.js} +57 -2
- package/dist/cjs/taxIdRules-BBj8kQxJ.js +58 -0
- package/dist/cjs/{updateCheckoutSessionAttributes-jMtfOL2m.js → updateCheckoutSessionAttributes-KxwcsKhM.js} +2 -2
- package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +26 -31
- package/dist/cjs/zonos-address-display_2.cjs.entry.js +4 -4
- package/dist/cjs/zonos-address_4.cjs.entry.js +28 -31
- package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +8 -7
- package/dist/cjs/zonos-badge.cjs.entry.js +1 -1
- package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
- package/dist/cjs/zonos-button_3.cjs.entry.js +2 -2
- package/dist/cjs/zonos-card_5.cjs.entry.js +9 -8
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +91 -86
- package/dist/cjs/zonos-checkbox_2.cjs.entry.js +2 -2
- package/dist/cjs/zonos-checkout.cjs.entry.js +15 -14
- package/dist/cjs/zonos-collapse.cjs.entry.js +1 -1
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +7 -6
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +13 -12
- package/dist/cjs/zonos-collect.cjs.entry.js +10 -9
- package/dist/cjs/zonos-controller.cjs.entry.js +10 -9
- package/dist/cjs/zonos-country-flag.cjs.entry.js +3 -3
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +4 -4
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +5 -5
- package/dist/cjs/zonos-hello.cjs.entry.js +5 -5
- package/dist/cjs/zonos-input.cjs.entry.js +2 -2
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +9 -8
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +13 -12
- package/dist/cjs/zonos-invoice.cjs.entry.js +10 -9
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +3 -3
- package/dist/cjs/zonos-logo.cjs.entry.js +1 -1
- package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +8 -7
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +2 -2
- package/dist/cjs/zonos-stripe-input.cjs.entry.js +2 -2
- package/dist/cjs/zonos-text.cjs.entry.js +1 -1
- package/dist/cjs/zonos-v-stack.cjs.entry.js +1 -1
- package/dist/cjs/{zonosStore-Bx9jK82G.js → zonosStore-CDV83QyK.js} +2 -0
- 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/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +12 -4
- 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 +20 -21
- package/dist/collection/components/store/storageStore.js +7 -6
- package/dist/collection/components/store/translationStore/strings.arabic.js +35 -2
- package/dist/collection/components/store/translationStore/strings.base.js +35 -2
- package/dist/collection/components/store/translationStore/strings.chinese.js +35 -2
- package/dist/collection/components/store/translationStore/strings.danish.js +35 -2
- package/dist/collection/components/store/translationStore/strings.dutch.js +35 -2
- package/dist/collection/components/store/translationStore/strings.french.js +35 -2
- package/dist/collection/components/store/translationStore/strings.german.js +35 -2
- package/dist/collection/components/store/translationStore/strings.hebrew.js +35 -2
- package/dist/collection/components/store/translationStore/strings.indonesian.js +35 -2
- package/dist/collection/components/store/translationStore/strings.italian.js +35 -2
- package/dist/collection/components/store/translationStore/strings.japanese.js +35 -2
- package/dist/collection/components/store/translationStore/strings.korean.js +35 -2
- package/dist/collection/components/store/translationStore/strings.norwegian.js +35 -2
- package/dist/collection/components/store/translationStore/strings.polish.js +35 -2
- package/dist/collection/components/store/translationStore/strings.portuguese.js +35 -2
- package/dist/collection/components/store/translationStore/strings.russian.js +35 -2
- package/dist/collection/components/store/translationStore/strings.spanish.js +35 -2
- package/dist/collection/components/store/translationStore/strings.swedish.js +35 -2
- package/dist/collection/components/store/translationStore/strings.turkish.js +35 -2
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +35 -2
- package/dist/collection/components/store/zonosStore.js +2 -1
- package/dist/collection/components/stripe/zonos-address/zonos-address.css +5 -0
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +37 -22
- package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.css +5 -0
- package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +34 -21
- 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/api/prepCalculateLandedCost.js +24 -35
- package/dist/collection/components/utils/checkout/getCheckoutTaxIdPayload.js +16 -0
- package/dist/collection/components/utils/checkout/getTaxIdFieldState.js +26 -0
- package/dist/collection/components/utils/checkout/resolveTaxIdSelection.js +23 -0
- package/dist/collection/components/utils/checkout/shouldRenderTaxIdInput.js +7 -11
- package/dist/collection/components/utils/checkout/taxIdFields.js +29 -0
- 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/components/utils/taxId/taxIdRules.js +44 -0
- package/dist/collection/components/utils/taxIdValidationResult.js +57 -58
- package/dist/collection/index.js +1 -0
- package/dist/collection/scripts/_getZonosQaUrl.js +3 -2
- package/dist/collection/scripts/_zonosBase.js +6 -2
- package/dist/collection/types/checkout/TaxId.js +31 -0
- 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/{TaxId-Cye-evFK.js → TaxId-DMIgN_sT.js} +32 -1
- package/dist/esm/{cart-BoQp8Ema.js → cart-BS5mSI8x.js} +100 -65
- package/dist/esm/{collect-Eo4gtyql.js → collect-B9ZxDDl7.js} +4 -4
- package/dist/esm/{debounce-BR3PaG8X.js → debounce-DHj2iHA1.js} +1 -1
- package/dist/esm/{debounce-CrmpwbEE.js → debounce-DWqMT4lo.js} +2 -2
- package/dist/esm/{getBorderRadius-DYfkeXdx.js → getBorderRadius-BiGd45jw.js} +1 -1
- package/dist/esm/{getMissingRequiredShippingFields-Ks6_tpjn.js → getMissingRequiredShippingFields-BkEV865q.js} +1 -1
- package/dist/esm/{handleFetch-D5GYDF-O.js → handleFetch-BFVO7oAR.js} +178 -72
- package/dist/esm/{hasInclusivePrice-CbEfIhI5.js → hasInclusivePrice-zSvDReDb.js} +1 -1
- package/dist/esm/index.js +106 -13
- package/dist/esm/{invoice-S1KahJ_Z.js → invoice-6iTuS6ek.js} +4 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{localization-BIh-4pc_.js → localization-CXHiWcJp.js} +725 -89
- package/dist/esm/{paypal-DNfvnuUU.js → paypal-BE_NVBoy.js} +5 -5
- package/dist/esm/{placeTestOrder-CQaMKFOg.js → placeTestOrder-BXA9K9Iy.js} +3 -3
- package/dist/esm/{renderCheckoutCurrency-C2Tw73uR.js → renderCheckoutCurrency-KMa4HlAf.js} +2 -2
- package/dist/esm/shouldRenderShortAddressCodeInput-Bc8k2vN0.js +19 -0
- package/dist/esm/{shouldShowLanguageSelect-CCD7gpSY.js → shouldShowLanguageSelect-BI_ApEsQ.js} +1 -1
- package/dist/esm/{submitGtag-df9AQ2zL.js → submitGtag-C5xzFHjG.js} +2 -2
- package/dist/esm/taxIdFields-BUKnHMaL.js +139 -0
- package/dist/esm/taxIdRules-xYlx7ZXW.js +47 -0
- package/dist/esm/{updateCheckoutSessionAttributes-4Jq6V4pO.js → updateCheckoutSessionAttributes-C9bMKTjz.js} +2 -2
- package/dist/esm/zonos-address-completion-dialog_7.entry.js +24 -29
- package/dist/esm/zonos-address-display_2.entry.js +4 -4
- package/dist/esm/zonos-address_4.entry.js +26 -29
- package/dist/esm/zonos-airwallex-payment.entry.js +8 -7
- package/dist/esm/zonos-badge.entry.js +1 -1
- package/dist/esm/zonos-banner.entry.js +1 -1
- package/dist/esm/zonos-button_3.entry.js +2 -2
- package/dist/esm/zonos-card_5.entry.js +9 -8
- package/dist/esm/zonos-cart-items_12.entry.js +90 -85
- package/dist/esm/zonos-checkbox_2.entry.js +2 -2
- package/dist/esm/zonos-checkout.entry.js +15 -14
- package/dist/esm/zonos-collapse.entry.js +1 -1
- package/dist/esm/zonos-collect-cart-items_3.entry.js +7 -6
- package/dist/esm/zonos-collect-finish_6.entry.js +13 -12
- package/dist/esm/zonos-collect.entry.js +10 -9
- package/dist/esm/zonos-controller.entry.js +10 -9
- package/dist/esm/zonos-country-flag.entry.js +3 -3
- package/dist/esm/zonos-country-select_4.entry.js +4 -4
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +5 -5
- package/dist/esm/zonos-hello.entry.js +5 -5
- package/dist/esm/zonos-input.entry.js +2 -2
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +9 -8
- package/dist/esm/zonos-invoice-finish_5.entry.js +13 -12
- package/dist/esm/zonos-invoice.entry.js +10 -9
- package/dist/esm/zonos-language-select_2.entry.js +3 -3
- package/dist/esm/zonos-logo.entry.js +1 -1
- package/dist/esm/zonos-policy-consent_2.entry.js +8 -7
- package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
- package/dist/esm/zonos-stripe-input.entry.js +2 -2
- package/dist/esm/zonos-text.entry.js +1 -1
- package/dist/esm/zonos-v-stack.entry.js +1 -1
- package/dist/esm/{zonosStore-msUlqmSD.js → zonosStore-BXP9FvIt.js} +2 -1
- package/dist/esm-es5/{TaxId-Cye-evFK.js → TaxId-DMIgN_sT.js} +2 -1
- package/dist/esm-es5/{cart-BoQp8Ema.js → cart-BS5mSI8x.js} +42 -31
- package/dist/esm-es5/{collect-Eo4gtyql.js → collect-B9ZxDDl7.js} +1 -1
- package/dist/esm-es5/{debounce-BR3PaG8X.js → debounce-DHj2iHA1.js} +7 -7
- package/dist/esm-es5/debounce-DWqMT4lo.js +1 -0
- package/dist/esm-es5/getBorderRadius-BiGd45jw.js +8 -0
- package/dist/esm-es5/{getMissingRequiredShippingFields-Ks6_tpjn.js → getMissingRequiredShippingFields-BkEV865q.js} +3 -3
- package/dist/esm-es5/handleFetch-BFVO7oAR.js +73 -0
- package/dist/esm-es5/{hasInclusivePrice-CbEfIhI5.js → hasInclusivePrice-zSvDReDb.js} +1 -1
- package/dist/esm-es5/index.js +30 -12
- package/dist/esm-es5/{invoice-S1KahJ_Z.js → invoice-6iTuS6ek.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/localization-CXHiWcJp.js +345 -0
- package/dist/esm-es5/{paypal-DNfvnuUU.js → paypal-BE_NVBoy.js} +1 -1
- package/dist/esm-es5/{placeTestOrder-CQaMKFOg.js → placeTestOrder-BXA9K9Iy.js} +1 -1
- package/dist/esm-es5/{renderCheckoutCurrency-C2Tw73uR.js → renderCheckoutCurrency-KMa4HlAf.js} +1 -1
- package/dist/esm-es5/shouldRenderShortAddressCodeInput-Bc8k2vN0.js +8 -0
- package/dist/esm-es5/{shouldShowLanguageSelect-CCD7gpSY.js → shouldShowLanguageSelect-BI_ApEsQ.js} +1 -1
- package/dist/esm-es5/{submitGtag-df9AQ2zL.js → submitGtag-C5xzFHjG.js} +1 -1
- package/dist/esm-es5/taxIdFields-BUKnHMaL.js +46 -0
- package/dist/esm-es5/taxIdRules-xYlx7ZXW.js +6 -0
- package/dist/esm-es5/{updateCheckoutSessionAttributes-4Jq6V4pO.js → updateCheckoutSessionAttributes-C9bMKTjz.js} +1 -1
- package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +253 -254
- package/dist/esm-es5/zonos-address-display_2.entry.js +1 -1
- package/dist/esm-es5/zonos-address_4.entry.js +8 -9
- package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
- package/dist/esm-es5/zonos-badge.entry.js +1 -1
- package/dist/esm-es5/zonos-banner.entry.js +1 -1
- package/dist/esm-es5/zonos-button_3.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 +137 -136
- package/dist/esm-es5/zonos-checkbox_2.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +3 -3
- package/dist/esm-es5/zonos-collapse.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
- package/dist/esm-es5/zonos-collect.entry.js +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 +2 -2
- package/dist/esm-es5/zonos-elements.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-input.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +2 -2
- 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-logo.entry.js +1 -1
- package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
- package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
- package/dist/esm-es5/zonos-text.entry.js +1 -1
- package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
- package/dist/esm-es5/{zonosStore-msUlqmSD.js → zonosStore-BXP9FvIt.js} +1 -1
- package/dist/scripts/index.d.ts +103 -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/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +4 -0
- package/dist/types/components/store/checkout/stripe.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.base.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.danish.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.french.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.german.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.italian.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.korean.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.polish.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.russian.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +34 -1
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +34 -1
- package/dist/types/components/store/zonosStore.d.ts +2 -1
- package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +4 -1
- package/dist/types/components/stripe/zonos-custom-address/zonos-custom-address.d.ts +4 -1
- package/dist/types/components/utils/__tests__/helpers/blockStorage.d.ts +3 -0
- package/dist/types/components/utils/checkout/getCheckoutTaxIdPayload.d.ts +6 -0
- package/dist/types/components/utils/checkout/getTaxIdFieldState.d.ts +18 -0
- package/dist/types/components/utils/checkout/resolveTaxIdSelection.d.ts +12 -0
- package/dist/types/components/utils/checkout/shouldRenderTaxIdInput.d.ts +2 -1
- package/dist/types/components/utils/checkout/taxIdFields.d.ts +11 -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/components/utils/taxId/taxIdRules.d.ts +37 -0
- package/dist/types/components/utils/taxIdValidationResult.d.ts +8 -2
- package/dist/types/components.d.ts +22 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +5 -0
- package/dist/types/types/checkout/TaxId.d.ts +45 -0
- package/dist/types/types/checkout/api/CalculateLandedCost.d.ts +11 -0
- package/dist/types/types/checkout/api/CreateParty.d.ts +2 -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/types/types/utils/ZonosSettings.d.ts +5 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-08b01c96.entry.js +1 -0
- package/dist/zonos-elements/{p-c961caaf.entry.js → p-0909ef77.entry.js} +1 -1
- package/dist/zonos-elements/{p-23352709.system.entry.js → p-13015d34.system.entry.js} +4 -4
- package/dist/zonos-elements/{p-6c41b00c.entry.js → p-13d5b2f9.entry.js} +1 -1
- package/dist/zonos-elements/{p-5b80aff2.system.entry.js → p-150047b3.system.entry.js} +25 -25
- package/dist/zonos-elements/p-1986cc37.entry.js +1 -0
- package/dist/zonos-elements/{p-CBx5nYet.system.js → p-1OG3IJgY.system.js} +1 -1
- package/dist/zonos-elements/{p-d3d0656a.entry.js → p-1a5acbcd.entry.js} +1 -1
- package/dist/zonos-elements/{p-756d303f.system.entry.js → p-20eb00de.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-9c33f7ed.system.entry.js → p-30bf4700.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d168023b.entry.js → p-3466bcba.entry.js} +1 -1
- package/dist/zonos-elements/p-383343c7.entry.js +1 -0
- package/dist/zonos-elements/{p-06030d3b.system.entry.js → p-3a506614.system.entry.js} +54 -54
- package/dist/zonos-elements/p-43c0ebe9.entry.js +1 -0
- package/dist/zonos-elements/{p-acd50b0b.entry.js → p-4612facd.entry.js} +1 -1
- package/dist/zonos-elements/{p-244e0302.system.entry.js → p-4715045c.system.entry.js} +1 -1
- package/dist/zonos-elements/p-4b65f192.entry.js +1 -0
- package/dist/zonos-elements/{p-5967a1c1.system.entry.js → p-573a4e7c.system.entry.js} +6 -6
- package/dist/zonos-elements/p-59fc32af.entry.js +1 -0
- package/dist/zonos-elements/{p-d82fd8a9.system.entry.js → p-5a296dbc.system.entry.js} +117 -116
- package/dist/zonos-elements/{p-193d9722.entry.js → p-61312d5b.entry.js} +1 -1
- package/dist/zonos-elements/{p-6abec43f.system.entry.js → p-68325c5a.system.entry.js} +4 -4
- package/dist/zonos-elements/{p-0b81f8b9.system.entry.js → p-6db7317a.system.entry.js} +6 -6
- package/dist/zonos-elements/{p-51400242.system.entry.js → p-709d1561.system.entry.js} +3 -3
- package/dist/zonos-elements/p-71d29603.entry.js +1 -0
- package/dist/zonos-elements/{p-7bd99479.system.entry.js → p-7214c953.system.entry.js} +21 -21
- package/dist/zonos-elements/p-74659d88.entry.js +1 -0
- package/dist/zonos-elements/{p-55916c90.entry.js → p-7f1bea9b.entry.js} +1 -1
- package/dist/zonos-elements/{p-0fca452b.entry.js → p-7fe83919.entry.js} +1 -1
- package/dist/zonos-elements/{p-1c150f26.entry.js → p-821e413a.entry.js} +1 -1
- package/dist/zonos-elements/{p-c403f004.system.entry.js → p-82e45d0c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1409de3b.system.entry.js → p-88e20e99.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-195f6e38.system.entry.js → p-89a3c4db.system.entry.js} +1 -1
- package/dist/zonos-elements/p-8ac26831.entry.js +1 -0
- package/dist/zonos-elements/{p-a40fd99b.system.entry.js → p-8f9f859f.system.entry.js} +39 -40
- package/dist/zonos-elements/{p-92fe9a1f.system.entry.js → p-902cca23.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-0a4a7742.system.entry.js → p-93860183.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b5882fbb.system.entry.js → p-9449b4f4.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-31043c2e.system.entry.js → p-96b250d8.system.entry.js} +298 -299
- package/dist/zonos-elements/p-97729873.entry.js +1 -0
- package/dist/zonos-elements/{p-1bac5ac1.system.entry.js → p-990fcf81.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-7f031592.system.entry.js → p-9b3668a4.system.entry.js} +155 -155
- package/dist/zonos-elements/{p-249c1ee1.system.entry.js → p-9df31243.system.entry.js} +3 -3
- package/dist/zonos-elements/p-BD-9rD53.js +1 -0
- 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-Be3Hpms1.system.js → p-BKUlQxBd.system.js} +1 -1
- package/dist/zonos-elements/p-BUfCTQXY.system.js +528 -0
- package/dist/zonos-elements/{p-CZD8WvyY.system.js → p-BnQyot7Y.system.js} +23 -23
- package/dist/zonos-elements/p-Bu9WCfUC.system.js +2 -2
- package/dist/zonos-elements/{p-0mGRBGcf.js → p-C-zdj7MK.js} +1 -1
- package/dist/zonos-elements/p-C5fs3rIR.js +1 -0
- package/dist/zonos-elements/{p-sz4L-ZnB.js → p-CJmWr75U.js} +1 -1
- package/dist/zonos-elements/{p-XDxdMlQl.system.js → p-CMneHjck.system.js} +15 -15
- package/dist/zonos-elements/p-CP7KnfR3.system.js +245 -0
- package/dist/zonos-elements/p-CVRbGFV3.js +1 -0
- package/dist/zonos-elements/p-CYxMfUL7.system.js +1 -0
- package/dist/zonos-elements/p-Cl5yV0ak.js +1 -0
- package/dist/zonos-elements/{p-kaOxUR9u.system.js → p-Cp1IAJvW.system.js} +5 -5
- package/dist/zonos-elements/{p-W82paT5F.js → p-CqB9AfBf.js} +1 -1
- package/dist/zonos-elements/p-CzKlS3E-.system.js +6 -0
- package/dist/zonos-elements/p-D-Lnf8mS.system.js +345 -0
- package/dist/zonos-elements/p-D0DkOoAw.system.js +73 -0
- package/dist/zonos-elements/{p-c9QtIdJX.js → p-D4xpkSsK.js} +1 -1
- package/dist/zonos-elements/p-DATNIakn.js +1 -0
- package/dist/zonos-elements/{p-D4MevhAL.system.js → p-DC1OPJDq.system.js} +3 -3
- package/dist/zonos-elements/{p-8PPEbm_0.system.js → p-DIab60nK.system.js} +12 -12
- package/dist/zonos-elements/p-DKnphvmJ.js +1 -0
- package/dist/zonos-elements/{p-Cye-evFK.js → p-DMIgN_sT.js} +1 -1
- package/dist/zonos-elements/{p-BuU_p5DP.system.js → p-DTgUqgwV.system.js} +2 -2
- package/dist/zonos-elements/p-DW7I0zOF.js +1 -0
- package/dist/zonos-elements/{p-DoEHepOc.system.js → p-DXlojp_Y.system.js} +1 -1
- package/dist/zonos-elements/p-DqVePqqx.system.js +8 -0
- package/dist/zonos-elements/{p-B4Ufchqh.system.js → p-DrS-0mk7.system.js} +3 -3
- package/dist/zonos-elements/{p-7abqRc9V.js → p-DrbN3rPL.js} +2 -2
- package/dist/zonos-elements/{p-Cby4EkFu.system.js → p-DsBuZ6ob.system.js} +2 -1
- package/dist/zonos-elements/{p-DI2vXnXc.system.js → p-Dv5a-V6w.system.js} +1 -1
- package/dist/zonos-elements/p-Dwg61Ft_.js +1 -0
- package/dist/zonos-elements/{p-474e8a92.system.entry.js → p-a1022808.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-17c7ea4a.system.entry.js → p-a3c147d2.system.entry.js} +3 -3
- package/dist/zonos-elements/p-aK18R41t.js +1 -0
- package/dist/zonos-elements/{p-83aa1c8c.entry.js → p-ad04bba2.entry.js} +1 -1
- package/dist/zonos-elements/p-af4ad54b.entry.js +1 -0
- package/dist/zonos-elements/p-af741506.entry.js +1 -0
- package/dist/zonos-elements/{p-a938c174.entry.js → p-b51010b9.entry.js} +1 -1
- package/dist/zonos-elements/{p-6db7c0b1.system.entry.js → p-b540c636.system.entry.js} +2 -2
- package/dist/zonos-elements/p-bac94956.entry.js +1 -0
- package/dist/zonos-elements/{p-69c3e367.system.entry.js → p-bb1b414a.system.entry.js} +9 -9
- package/dist/zonos-elements/{p-b79036fc.entry.js → p-bfa9e32a.entry.js} +1 -1
- package/dist/zonos-elements/{p-dfc87b10.system.entry.js → p-c33b8f6a.system.entry.js} +1 -1
- package/dist/zonos-elements/p-cf6bf7a4.entry.js +1 -0
- package/dist/zonos-elements/{p-CEK_Wk6v.system.js → p-dJcbnNlE.system.js} +1 -1
- package/dist/zonos-elements/p-db40b9c3.entry.js +1 -0
- package/dist/zonos-elements/p-dd003161.entry.js +1 -0
- package/dist/zonos-elements/{p-2603dce0.entry.js → p-e216cc8c.entry.js} +1 -1
- package/dist/zonos-elements/p-e374aaa4.entry.js +1 -0
- package/dist/zonos-elements/{p-155ed3d3.system.entry.js → p-e43470f7.system.entry.js} +21 -21
- package/dist/zonos-elements/p-ebc7ea54.system.entry.js +13 -0
- package/dist/zonos-elements/{p-11defdca.system.entry.js → p-f2ed52bc.system.entry.js} +8 -8
- package/dist/zonos-elements/{p-d4d2b39e.entry.js → p-fddf3556.entry.js} +1 -1
- package/dist/zonos-elements/p-gEViRqvf.js +1 -0
- package/dist/zonos-elements/{p-BpDCLBwW.js → p-n5PZKz1k.js} +1 -1
- package/dist/zonos-elements/{p-C_z9WL8a.js → p-r-YGHhLa.js} +1 -1
- package/dist/zonos-elements/{p-XqkqjeNV.system.js → p-yv7ekcdG.system.js} +2 -2
- package/dist/zonos-elements/{p-DQZncB2d.system.js → p-zsTASoh2.system.js} +3 -3
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/shouldRenderTaxIdInput-TxekHCp7.js +0 -43
- package/dist/esm/shouldRenderTaxIdInput-CKyZ6Zni.js +0 -40
- package/dist/esm/throttle-Cvlvb-dm.js +0 -85
- package/dist/esm-es5/debounce-CrmpwbEE.js +0 -1
- package/dist/esm-es5/getBorderRadius-DYfkeXdx.js +0 -8
- package/dist/esm-es5/handleFetch-D5GYDF-O.js +0 -60
- package/dist/esm-es5/localization-BIh-4pc_.js +0 -348
- package/dist/esm-es5/shouldRenderTaxIdInput-CKyZ6Zni.js +0 -17
- package/dist/esm-es5/throttle-Cvlvb-dm.js +0 -46
- package/dist/zonos-elements/p-06fe2939.entry.js +0 -1
- package/dist/zonos-elements/p-24f3c547.entry.js +0 -1
- package/dist/zonos-elements/p-30b3c9d3.entry.js +0 -1
- package/dist/zonos-elements/p-39ee1558.entry.js +0 -1
- package/dist/zonos-elements/p-3a2da031.entry.js +0 -1
- package/dist/zonos-elements/p-4679f0ec.entry.js +0 -1
- package/dist/zonos-elements/p-4806b264.system.entry.js +0 -13
- package/dist/zonos-elements/p-5873ab8e.entry.js +0 -1
- package/dist/zonos-elements/p-725e29bb.entry.js +0 -1
- package/dist/zonos-elements/p-BGktDPwA.system.js +0 -1
- package/dist/zonos-elements/p-Bi-s0fp_.system.js +0 -17
- package/dist/zonos-elements/p-CFbfEmjN.js +0 -1
- package/dist/zonos-elements/p-CUaf1cEg.js +0 -1
- package/dist/zonos-elements/p-CXxvn4GX.system.js +0 -227
- package/dist/zonos-elements/p-CcJF6xhQ.js +0 -1
- package/dist/zonos-elements/p-Cxuiqv1I.js +0 -1
- package/dist/zonos-elements/p-D-bZg-Pc.js +0 -1
- package/dist/zonos-elements/p-DE4a-QD5.js +0 -1
- package/dist/zonos-elements/p-DOD2I44l.system.js +0 -348
- package/dist/zonos-elements/p-DS-qw_qc.system.js +0 -517
- package/dist/zonos-elements/p-DZ2mevDK.js +0 -1
- package/dist/zonos-elements/p-DnjGkbEy.js +0 -1
- package/dist/zonos-elements/p-FRWZayxL.js +0 -1
- package/dist/zonos-elements/p-Mrz_lnC1.js +0 -1
- package/dist/zonos-elements/p-ad9ff14c.entry.js +0 -1
- package/dist/zonos-elements/p-bb3546c0.entry.js +0 -1
- package/dist/zonos-elements/p-c1cbfdba.entry.js +0 -1
- package/dist/zonos-elements/p-c47ce656.entry.js +0 -1
- package/dist/zonos-elements/p-c9d5d8f1.entry.js +0 -1
- package/dist/zonos-elements/p-clDfq9AL.js +0 -1
- package/dist/zonos-elements/p-d74bc3e8.entry.js +0 -1
- package/dist/zonos-elements/p-d8b312e5.entry.js +0 -1
- package/dist/zonos-elements/p-db87b0dd.entry.js +0 -1
- package/dist/zonos-elements/p-defc2d18.entry.js +0 -1
- package/dist/zonos-elements/p-rVp8hgWw.js +0 -1
- package/dist/zonos-elements/p-zVLAvre1.system.js +0 -60
|
@@ -1,55 +1,32 @@
|
|
|
1
1
|
import { isCountryCode } from "./isCountryCode";
|
|
2
|
+
import { safeGetItem, safeRemoveItem, safeSetItem, } from "../safeStorage";
|
|
2
3
|
const COUNTRY_OVERRIDE_KEY = 'zonos--country';
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
catch (_a) {
|
|
8
|
-
// localStorage/sessionStorage can throw in blocked-storage contexts
|
|
9
|
-
// (Safari private mode, cross-origin iframes).
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
const readStoredCountry = (storage) => {
|
|
13
|
-
try {
|
|
14
|
-
const value = storage.getItem(COUNTRY_OVERRIDE_KEY);
|
|
15
|
-
if (!value || !isCountryCode(value)) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
return value;
|
|
19
|
-
}
|
|
20
|
-
catch (_a) {
|
|
4
|
+
const readStoredCountry = (area) => {
|
|
5
|
+
const value = safeGetItem(area, COUNTRY_OVERRIDE_KEY);
|
|
6
|
+
if (!value || !isCountryCode(value)) {
|
|
21
7
|
return null;
|
|
22
8
|
}
|
|
9
|
+
return value;
|
|
23
10
|
};
|
|
24
|
-
const
|
|
25
|
-
storage.setItem(COUNTRY_OVERRIDE_KEY, countryCode);
|
|
26
|
-
};
|
|
27
|
-
const withEachStorage = (run) => {
|
|
28
|
-
withBlockedStorage(() => run(window.localStorage));
|
|
29
|
-
withBlockedStorage(() => run(window.sessionStorage));
|
|
30
|
-
};
|
|
31
|
-
export const getCountryOverrideStorage = () => {
|
|
32
|
-
var _a;
|
|
33
|
-
return (_a = readStoredCountry(window.localStorage)) !== null && _a !== void 0 ? _a : readStoredCountry(window.sessionStorage);
|
|
34
|
-
};
|
|
11
|
+
export const getCountryOverrideStorage = () => { var _a; return (_a = readStoredCountry('local')) !== null && _a !== void 0 ? _a : readStoredCountry('session'); };
|
|
35
12
|
export const migrateCountryOverrideStorage = (selectedCountryCode) => {
|
|
36
13
|
if (!selectedCountryCode) {
|
|
37
14
|
return;
|
|
38
15
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
});
|
|
16
|
+
const localCountry = readStoredCountry('local');
|
|
17
|
+
// Only mirror the country Hello actually kept. A failed localStorage
|
|
18
|
+
// clear can leave a discarded country in local; never copy that to
|
|
19
|
+
// session for older Elements. Never copy session → local.
|
|
20
|
+
if (localCountry === selectedCountryCode) {
|
|
21
|
+
safeSetItem('session', COUNTRY_OVERRIDE_KEY, localCountry);
|
|
22
|
+
}
|
|
48
23
|
};
|
|
49
24
|
export const setCountryOverrideStorage = (countryCode) => {
|
|
50
25
|
// Dual-write so older Elements that only read sessionStorage see the pick.
|
|
51
|
-
|
|
26
|
+
safeSetItem('local', COUNTRY_OVERRIDE_KEY, countryCode);
|
|
27
|
+
safeSetItem('session', COUNTRY_OVERRIDE_KEY, countryCode);
|
|
52
28
|
};
|
|
53
29
|
export const clearCountryOverrideStorage = () => {
|
|
54
|
-
|
|
30
|
+
safeRemoveItem('local', COUNTRY_OVERRIDE_KEY);
|
|
31
|
+
safeRemoveItem('session', COUNTRY_OVERRIDE_KEY);
|
|
55
32
|
};
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { checkoutTaxIdTypeValues, isCountryRequireTaxId, peruTaxIdDigitLength, shipToTaxIdLabels, taxIdTypeOptions, } from "../../../types/checkout/TaxId";
|
|
2
|
+
export const stripTaxIdSeparators = (taxId) => taxId.replace(/[\s-]/g, '');
|
|
3
|
+
export const rfcRegex = /^[A-ZÑ]{3,4}[0-9]{6}[A-Z0-9]{3}$/;
|
|
4
|
+
export const curpRegex = /^[A-Z]{4}[0-9]{6}[HMX][A-Z]{5}[A-Z0-9][0-9]$/;
|
|
5
|
+
export const isMexicoTaxIdType = (taxIdType) => taxIdTypeOptions.MX.some(option => option.value === taxIdType);
|
|
6
|
+
export const isPeruTaxIdType = (taxIdType) => taxIdTypeOptions.PE.some(option => option.value === taxIdType);
|
|
7
|
+
export const isCheckoutTaxIdTypeValue = (taxIdType) => checkoutTaxIdTypeValues.some(value => value === taxIdType);
|
|
8
|
+
/** 8 digits are a DNI, 9 a carné, 11 an RUC. Anything else is not a Peru tax id. */
|
|
9
|
+
export const peruTaxIdTypeFromValue = (taxId) => {
|
|
10
|
+
const digits = stripTaxIdSeparators(taxId);
|
|
11
|
+
if (!/^\d+$/.test(digits)) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
if (digits.length === peruTaxIdDigitLength.DNI) {
|
|
15
|
+
return 'DNI';
|
|
16
|
+
}
|
|
17
|
+
if (digits.length === peruTaxIdDigitLength.CE) {
|
|
18
|
+
return 'CE';
|
|
19
|
+
}
|
|
20
|
+
if (digits.length === peruTaxIdDigitLength.RUC) {
|
|
21
|
+
return 'RUC';
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
};
|
|
25
|
+
export const isPeruTaxIdActive = ({ countryCode, shouldRequirePeruTaxId, }) => shouldRequirePeruTaxId && countryCode === 'PE';
|
|
26
|
+
/**
|
|
27
|
+
* Peru stays off `countryRequireTaxId`. The API flag decides which stores see it.
|
|
28
|
+
* Mexico and Peru pick the kind from a dropdown instead of a regex.
|
|
29
|
+
*/
|
|
30
|
+
export const taxIdTypeOptionsForCheckout = ({ countryCode, shouldRequirePeruTaxId, }) => {
|
|
31
|
+
if (isPeruTaxIdActive({ countryCode, shouldRequirePeruTaxId })) {
|
|
32
|
+
return taxIdTypeOptions.PE;
|
|
33
|
+
}
|
|
34
|
+
if (countryCode === 'MX') {
|
|
35
|
+
return taxIdTypeOptions.MX;
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
39
|
+
export const taxIdLabelForCheckout = (countryCode) => {
|
|
40
|
+
if (isCountryRequireTaxId(countryCode)) {
|
|
41
|
+
return shipToTaxIdLabels[countryCode];
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveTaxIdSelection } from "./checkout/resolveTaxIdSelection";
|
|
2
|
+
import { curpRegex, isPeruTaxIdActive, isPeruTaxIdType, peruTaxIdTypeFromValue, rfcRegex, stripTaxIdSeparators, } from "./taxId/taxIdRules";
|
|
2
3
|
import { euCountryCodes } from "../../types/index";
|
|
4
|
+
import { peruTaxIdFormatError, } from "../../types/checkout/TaxId";
|
|
3
5
|
const isTaxIdRequired = (shippingCountry) => {
|
|
4
6
|
const requireTaxIdCountry = [
|
|
5
7
|
'MX',
|
|
@@ -8,86 +10,83 @@ const isTaxIdRequired = (shippingCountry) => {
|
|
|
8
10
|
];
|
|
9
11
|
return requireTaxIdCountry.includes(shippingCountry);
|
|
10
12
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
const invalid = (error, field) => ({
|
|
14
|
+
error,
|
|
15
|
+
field,
|
|
16
|
+
valid: false,
|
|
17
|
+
});
|
|
18
|
+
const valid = () => ({
|
|
19
|
+
error: null,
|
|
20
|
+
field: null,
|
|
21
|
+
valid: true,
|
|
22
|
+
});
|
|
23
|
+
export const taxIdValidationResult = ({ companyName, shippingCountry, shouldRequirePeruTaxId, taxId, taxIdType, }) => {
|
|
24
|
+
const { rendered, selectedType, typeOptions } = resolveTaxIdSelection({
|
|
14
25
|
companyName,
|
|
15
26
|
countryCode: shippingCountry,
|
|
27
|
+
shouldRequirePeruTaxId,
|
|
28
|
+
taxIdType,
|
|
16
29
|
});
|
|
17
30
|
// If the tax id input is not even rendered, no need to validate anything and allow to proceed. Validate when tax id input is not even rendered would prevent the user from checking out
|
|
18
|
-
if (!
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
if (!rendered) {
|
|
32
|
+
return valid();
|
|
33
|
+
}
|
|
34
|
+
// The number field is hidden until a type is chosen.
|
|
35
|
+
if (typeOptions && !selectedType) {
|
|
36
|
+
return invalid('Tax id type is required', 'type');
|
|
37
|
+
}
|
|
38
|
+
// Spaces and hyphens count as blank only. The original text is left unchanged.
|
|
39
|
+
if (isPeruTaxIdActive({
|
|
40
|
+
countryCode: shippingCountry,
|
|
41
|
+
shouldRequirePeruTaxId,
|
|
42
|
+
}) &&
|
|
43
|
+
selectedType &&
|
|
44
|
+
isPeruTaxIdType(selectedType.value)) {
|
|
45
|
+
if (!stripTaxIdSeparators(taxId)) {
|
|
46
|
+
return invalid('Tax id is required', 'value');
|
|
47
|
+
}
|
|
48
|
+
if (peruTaxIdTypeFromValue(taxId) !== selectedType.value) {
|
|
49
|
+
return invalid(peruTaxIdFormatError[selectedType.value], 'value');
|
|
50
|
+
}
|
|
51
|
+
return valid();
|
|
23
52
|
}
|
|
24
53
|
// Cache the result of isTaxIdRequired for reuse
|
|
25
54
|
const taxIdRequired = isTaxIdRequired(shippingCountry);
|
|
26
55
|
if (!taxIdRequired) {
|
|
27
56
|
// If the shipping country does not require a tax id, the validation immediately returns valid
|
|
28
|
-
return
|
|
29
|
-
error: null,
|
|
30
|
-
valid: true,
|
|
31
|
-
};
|
|
57
|
+
return valid();
|
|
32
58
|
}
|
|
33
59
|
// For all EU countries, tax id is not required if company name is not filled (not business address)
|
|
34
60
|
if (euCountryCodes.includes(shippingCountry)) {
|
|
35
61
|
if (!companyName.trim()) {
|
|
36
|
-
return
|
|
37
|
-
error: null,
|
|
38
|
-
valid: true,
|
|
39
|
-
};
|
|
62
|
+
return valid();
|
|
40
63
|
}
|
|
41
64
|
if (!taxId) {
|
|
42
|
-
return
|
|
43
|
-
error: 'Tax id is required',
|
|
44
|
-
valid: false,
|
|
45
|
-
};
|
|
65
|
+
return invalid('Tax id is required', 'value');
|
|
46
66
|
}
|
|
47
|
-
return
|
|
48
|
-
error: null,
|
|
49
|
-
valid: true,
|
|
50
|
-
};
|
|
67
|
+
return valid();
|
|
51
68
|
}
|
|
52
69
|
if (!taxId) {
|
|
53
|
-
return
|
|
54
|
-
error: 'Tax id is required',
|
|
55
|
-
valid: false,
|
|
56
|
-
};
|
|
70
|
+
return invalid('Tax id is required', 'value');
|
|
57
71
|
}
|
|
58
72
|
if (shippingCountry === 'AR') {
|
|
59
|
-
const
|
|
60
|
-
if (!
|
|
61
|
-
return
|
|
62
|
-
error: 'Invalid CUIT/CUIL format. Must contain 11 digits, with or without dashes (XX-XXXXXXXX-X).',
|
|
63
|
-
valid: false,
|
|
64
|
-
};
|
|
73
|
+
const isValidAr = /^[0-9]{2}-?[0-9]{8}-?[0-9]$/.test(taxId);
|
|
74
|
+
if (!isValidAr) {
|
|
75
|
+
return invalid('Invalid CUIT/CUIL format. Must contain 11 digits, with or without dashes (XX-XXXXXXXX-X).', 'value');
|
|
65
76
|
}
|
|
66
|
-
return
|
|
67
|
-
error: null,
|
|
68
|
-
valid: true,
|
|
69
|
-
};
|
|
77
|
+
return valid();
|
|
70
78
|
}
|
|
71
|
-
// validate tax id for mexico
|
|
72
|
-
if (shippingCountry === 'MX') {
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
error: 'Invalid RFC or CURP format. Must be a 12–13 character RFC or an 18 character CURP, uppercase letters and numbers only.',
|
|
80
|
-
valid: false,
|
|
81
|
-
};
|
|
79
|
+
// validate tax id for mexico against the type the shopper selected
|
|
80
|
+
if (shippingCountry === 'MX' && selectedType) {
|
|
81
|
+
const isRfc = selectedType.value === 'RFC';
|
|
82
|
+
const isValidMx = isRfc ? rfcRegex.test(taxId) : curpRegex.test(taxId);
|
|
83
|
+
if (!isValidMx) {
|
|
84
|
+
return invalid(isRfc
|
|
85
|
+
? 'Invalid RFC format. Must be 12–13 uppercase letters and numbers.'
|
|
86
|
+
: 'Invalid CURP format. Must be 18 uppercase letters and numbers.', 'value');
|
|
82
87
|
}
|
|
83
|
-
return
|
|
84
|
-
error: null,
|
|
85
|
-
valid: true,
|
|
86
|
-
};
|
|
88
|
+
return valid();
|
|
87
89
|
}
|
|
88
90
|
// Other countries doesn't need to validate tax id in the right format
|
|
89
|
-
return
|
|
90
|
-
error: null,
|
|
91
|
-
valid: true,
|
|
92
|
-
};
|
|
91
|
+
return valid();
|
|
93
92
|
};
|
package/dist/collection/index.js
CHANGED
|
@@ -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) {
|
|
@@ -86,3 +86,34 @@ export const shipToTaxIdLabels = {
|
|
|
86
86
|
SI: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
87
87
|
SK: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
88
88
|
};
|
|
89
|
+
export const isCountryRequireTaxId = (countryCode) => {
|
|
90
|
+
return countryRequireTaxId.some(code => code === countryCode);
|
|
91
|
+
};
|
|
92
|
+
export const taxIdTypeOptions = {
|
|
93
|
+
MX: [
|
|
94
|
+
{ label: 'RFC', placeholder: 'XAXX010101000', value: 'RFC' },
|
|
95
|
+
{ label: 'CURP', placeholder: 'AAAA800101HDFRRR09', value: 'CURP' },
|
|
96
|
+
],
|
|
97
|
+
PE: [
|
|
98
|
+
{ label: 'DNI', placeholder: '12345678', value: 'DNI' },
|
|
99
|
+
{ label: 'RUC', placeholder: '20123456789', value: 'RUC' },
|
|
100
|
+
{
|
|
101
|
+
label: 'Carné de extranjería',
|
|
102
|
+
placeholder: '001234567',
|
|
103
|
+
value: 'CE',
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
const checkoutTaxIdTypeValueList = ['CE', 'CURP', 'DNI', 'RFC', 'RUC'];
|
|
108
|
+
/** Every document kind checkout can send. Older clients omit the field. */
|
|
109
|
+
export const checkoutTaxIdTypeValues = checkoutTaxIdTypeValueList;
|
|
110
|
+
export const peruTaxIdDigitLength = {
|
|
111
|
+
CE: 9,
|
|
112
|
+
DNI: 8,
|
|
113
|
+
RUC: 11,
|
|
114
|
+
};
|
|
115
|
+
export const peruTaxIdFormatError = {
|
|
116
|
+
CE: 'Carné de extranjería must be 9 digits.',
|
|
117
|
+
DNI: 'DNI must be 8 digits.',
|
|
118
|
+
RUC: 'RUC must be 11 digits.',
|
|
119
|
+
};
|
|
@@ -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: '',
|