@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 +0,0 @@
|
|
|
1
|
-
import{r as o,h as t,e as s,a as e}from"./p-_lt63o7c.js";import{a}from"./p-W82paT5F.js";import{c as r}from"./p-BJHSB96f.js";import"./p-BJmZPrZl.js";const i=class{constructor(t){o(this,t),this.theme="LIGHT",this.width="auto"}render(){const o="DARK"===this.theme?"invert(100%) sepia(100%) saturate(0%) hue-rotate(288deg) brightness(102%) contrast(102%)":"whiteinvert(0%) sepia(100%) saturate(32%) hue-rotate(92deg) brightness(107%) contrast(107%)";return t(e,{key:"89d856c28d227afbe76656ce217544faad91715e",class:r(["zonos--elements zonos--logo"]),style:{"--zonos--filter-color":o,"--zonos--font-family":a(),"--zonos--width":this.width}},t("img",{key:"025c97e65f2666028391f6ca2d548bf905528133",alt:"Zonos Logo",src:s("./assets/ZonosLogo.png")}))}static get assetsDirs(){return["assets"]}};i.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host img{-webkit-filter:var(--zonos--filter-color);filter:var(--zonos--filter-color);width:var(--zonos--width)}";export{i as zonos_logo}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,d as e,h as o,a as n}from"./p-_lt63o7c.js";import{b as i}from"./p-FRWZayxL.js";import{m as s,n as r,o as c,s as l,d as a}from"./p-clDfq9AL.js";import{z as d,a as u,b as h}from"./p-W82paT5F.js";import{g as p,i as m,a as f}from"./p-HeAZDwVW.js";import{h as w,l as v}from"./p-DE4a-QD5.js";import{l as g}from"./p-BJmZPrZl.js";import{e as y}from"./p-sz4L-ZnB.js";import"./p-YdrG78th.js";import"./p-C_z9WL8a.js";import"./p-Cye-evFK.js";const S="zonos-domestic-element-hide-style",b="undefined"!=typeof document&&(()=>{try{return document.querySelector(":is(.zonos-is-probe)"),!0}catch(t){return!1}})(),z=t=>{const e=document.querySelector(t);if(!document.querySelector("zonos-hello")&&e){const t=document.createElement("zonos-hello");return e.appendChild(t),!0}return!1},j=t=>{switch(t){case"BOTTOM_RIGHT":default:return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right"}},I=({position:t="bottom-right"})=>{const e=".zonos--hello-mobile-wrapper";if(document.querySelector(e))return e;const o=document.createElement("div");return o.className="zonos--hello-mobile-wrapper",o.style.position="fixed","top-right"===t&&(o.style.top="72px",o.style.right="24px"),"top-left"===t&&(o.style.top="72px",o.style.left="24px"),"bottom-right"===t&&(o.style.bottom="72px",o.style.right="24px"),"bottom-left"===t&&(o.style.bottom="72px",o.style.left="24px"),o.style.zIndex="2147483647",document.body.appendChild(o),e},O=async t=>{if(window.Zonos.isLegacyCheckout)return void g("Hello is disabled when isLegacyCheckout","info");const{anchorElementSelector:e}=t;let o=e;if(!t.anchorElementSelector&&t.desktopLocation){const t=I({position:"bottom-right"});o=t}if(o&&r(o)){if(g("Hello init complete"),!z(o)){const e=new MutationObserver((()=>{z(o)&&e.disconnect()}));e.observe(document.body,{childList:!0,subtree:!0}),setTimeout((()=>{z(o)}),1e3),setTimeout((()=>{if(t.notFoundElementFallback){g(`Hello anchor selector ${t.anchorElementSelector} not found after 3 seconds, falling back to 'notFoundElementFallback': ${t.notFoundElementFallback}`,"info");const e=I({position:j(t.notFoundElementFallback)});z(e)}}),3e3)}}else v(`Selector anchorElementSelector "${t.anchorElementSelector}" is not a valid selector.`)};class C{constructor(t,e){this.targetId=t,this.allowedEvents=e,this.listeners=new Map,this.handleMessage=t=>{var e,o,n;const i=t.data,s=(null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||(null===(n=null===(o=this.iframe)||void 0===o?void 0:o.contentDocument)||void 0===n?void 0:n.defaultView);if(t.source!==s)return;if(!this.isValidMessage(i))return;const r=this.listeners.get(i.type);null==r||r.forEach((t=>{try{t(i.payload)}catch(t){v("Error in event listener:",t)}}))},this.initializeEventListeners(),this.iframe=document.getElementById(this.targetId)}initializeEventListeners(){window.addEventListener("message",this.handleMessage)}isValidMessage(t){if(!t||"object"!=typeof t)return!1;const e=t;return e.id===this.targetId&&"string"==typeof e.type&&this.allowedEvents.includes(e.type)&&void 0!==e.payload}on(t,e){this.listeners.has(t)||this.listeners.set(t,new Set),g(`[CheckoutAddressService] listening to ${t}`,"info");const o=e,n=this.listeners.get(t);return n&&n.add(o),()=>{const e=this.listeners.get(t);e&&e.delete(o)}}destroy(){window.removeEventListener("message",this.handleMessage),this.listeners.clear()}}class k extends C{constructor(){g("=== [Google Places Service] Initializing","info"),super(m.GOOGLE_PLACES,["fetchAutocompleteSuggestions","initializeGooglePlacesService","placeSelected","onFetchAutocompleteSuggestions","onInitializeGooglePlacesService","onPlaceSelected"])}sendMessage(t,e){var o;if(!(null===(o=this.iframe)||void 0===o?void 0:o.contentWindow))return;const n={id:this.targetId,logType:window.Zonos.iframeLogType,payload:e,type:t};g(`GooglePlacesService] parent --\x3e ${t}`,"info",e),this.iframe.contentWindow.postMessage(n,"*")}initialize(){this.sendMessage("initializeGooglePlacesService",{})}fetchSuggestions({country:t,query:e,type:o}){t&&this.sendMessage("fetchAutocompleteSuggestions",{request:{includedRegionCodes:[t],input:e},type:o})}selectPlace({placeId:t,type:e}){this.sendMessage("placeSelected",{placeId:t,type:e})}}class E{constructor(){this.googlePlaceInitialized=!1,g("=== [CheckoutAddressService] Initializing","info"),this.googlePlaces=new k,this.googlePlaces.on("onInitializeGooglePlacesService",(()=>{g("=== [CheckoutAddressService] parent <-- onInitializeGooglePlacesService","info"),this.googlePlaceInitialized=!0})),this.initialize()}initialize(){this.googlePlaces.initialize()}onInitializeGooglePlacesService(t){return this.googlePlaces.on("onInitializeGooglePlacesService",(()=>{g("[CheckoutAddressService] parent <-- onInitializeGooglePlacesService"),t()}))}isGooglePlaceInitialized(){return this.googlePlaceInitialized}onAddressSuggestions(t){return this.suggestionsCallback=t,this.googlePlaces.on("onFetchAutocompleteSuggestions",((...e)=>{g(`[CheckoutAddressService] parent <-- onFetchAutocompleteSuggestions ${e[0].type}`,"info",...e),t(...e)}))}onAddressSelected(t){return this.placeSelectedCallback=t,this.googlePlaces.on("onPlaceSelected",((...e)=>{g(`[CheckoutAddressService] parent <-- onPlaceSelected ${e[0].type}`,"info",...e),t(...e)}))}getAddressSuggestions({country:t,query:e,type:o}){this.googlePlaceInitialized&&this.googlePlaces.fetchSuggestions({country:t,query:e,type:o})}selectAddress({placeId:t,type:e}){this.googlePlaces.selectPlace({placeId:t,type:e})}destroy(){this.googlePlaces.destroy(),this.suggestionsCallback&&(this.suggestionsCallback=void 0),this.placeSelectedCallback&&(this.placeSelectedCallback=void 0)}}const A=class{constructor(o){t(this,o),this.paypalInitEvent=e(this,"paypalInitEvent",7),this.stripeInitEvent=e(this,"stripeInitEvent",7)}async initCheckoutElement(t){var e;t?(i.stripe=t,((e=d.checkoutSettings).placeOrderButtonSelector||e.alwaysTriggerInternationalCheckoutSelector||window.Zonos.cartData)&&(!e.placeOrderButtonSelector||r(e.placeOrderButtonSelector)?!e.alwaysTriggerInternationalCheckoutSelector||r(e.alwaysTriggerInternationalCheckoutSelector)?(()=>{if(!document.querySelector("zonos-checkout")){const t=document.createElement("zonos-checkout");document.body.appendChild(t)}})():v(`Selector alwaysTriggerInternationalCheckoutSelector "${e.alwaysTriggerInternationalCheckoutSelector}" is not a valid selector`):v(`Selector checkoutButtonAnchor "${e.placeOrderButtonSelector}" is not a valid selector`)),g("init checkout element")):g("Stripe is not loaded yet - cannot init checkout element","warn")}async initCollectElement(t){t?(i.stripe=t,window.Zonos.cartData&&(()=>{if(!document.querySelector("zonos-collect")){const t=document.createElement("zonos-collect");document.body.appendChild(t)}})(),g("init Collect element")):g("Stripe is not loaded yet - cannot init Collect element","warn")}async initInvoiceElement(t){t?(i.stripe=t,window.Zonos.cartData&&(()=>{if(!document.querySelector("zonos-invoice")){const t=document.createElement("zonos-invoice");document.body.appendChild(t)}})(),g("init Invoice element")):g("Stripe is not loaded yet - cannot init Invoice element","warn")}initZonosNotification(){if(document.querySelector("zonos-notification"))return;const t=document.createElement("zonos-notification");document.body.appendChild(t)}async setupGoogleFont(t){var e,o;const n=t||u();if("Inter"===n){if(!t)return;g("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn"),d.appearance=Object.assign(Object.assign({},d.appearance),{fontFamily:t})}const i=new URLSearchParams;i.set("family",n);const{errors:s,json:r}=await w(`/api/zonos-elements/get-font-detail?${i.toString()}`);if(s.length>0)return g(`Failed to load font ${n}`,"warn"),void(d.appearance=Object.assign(Object.assign({},d.appearance),{fontFamily:"Inter"}));const c=null==r?void 0:r.fontUrl;c&&(null===(o=(e=window.Zonos).injectSupportGoogleFont)||void 0===o||o.call(e,c)),t&&(g(`[FONT] ${t} font override applied`),d.appearance=Object.assign(Object.assign({},d.appearance),{fontFamily:t}))}handleLocationChange(){O(d.helloSettings)}initHistoryListener(){const t=history.pushState;history.pushState=function(){return window.dispatchEvent(new window.Event("pushstate")),window.dispatchEvent(new window.Event("locationchange")),t.apply(this,arguments)};const e=history.replaceState;history.replaceState=function(){return window.dispatchEvent(new window.Event("replacestate")),window.dispatchEvent(new window.Event("locationchange")),e.apply(this,arguments)}}injectCustomHTML(t){if(!t)return;if(!window.Zonos.isLegacyCheckout||window.Zonos.isCollect||window.Zonos.isInvoice)return void g("=== Skip injecting custom HTML for hosted checkout","info");g("=== Injecting custom HTML for hosted checkout");const e=document.createElement("template");e.innerHTML=t,e.content.querySelectorAll("script").forEach((t=>{const e=document.createElement("script");t.src?(e.src=t.src,e.async=t.async):e.textContent=t.innerHTML,document.body.appendChild(e)})),y()}async initGooglePlacesService(t){const e=null==t?void 0:t.genericSettings;if(!e)return;const o=e.signedTokenGooglePlaces;o&&f({id:m.GOOGLE_PLACES,onload:()=>{d.checkoutAddressService=new E},src:`https://route.elements.zonos.com/iframe/google-maps?signedToken=${o}`})}buildBaseConfig(t){var e,o;const n=Object.assign(Object.assign({},this.config.checkoutSettings),{allowedSettlementCurrencies:void 0,captureDelay:void 0,subscriptionStatus:void 0});if(window.Zonos.isCollect||window.Zonos.isInvoice)return Object.assign(Object.assign({},this.config),{checkoutSettings:n,helloSettings:Object.assign(Object.assign({},this.config.helloSettings),{visibilityStatus:"DISABLED"})});if(!this.config.checkoutSettings)return Object.assign(Object.assign({},this.config),{checkoutSettings:void 0});const i=window.Zonos.isLegacyCheckout&&!!window.Zonos.cartData&&"CLOSE_MODAL"===(null===(e=this.config.checkoutSettings)||void 0===e?void 0:e.successBehavior);return Object.assign(Object.assign({},this.config),{checkoutSettings:Object.assign(Object.assign({},n),{successBehavior:i?"ZONOS_SUCCESS_PAGE":this.config.checkoutSettings.successBehavior,successRedirectUrl:i?(null===(o=window.Zonos.cartData)||void 0===o?void 0:o.storeBaseUrl)||(null==t?void 0:t.onlineStoreSettings.url):this.config.checkoutSettings.successRedirectUrl})})}async componentWillLoad(){this.initHistoryListener(),d.zonosApiKey=this.zonosApiKey,(async()=>{var t,e,o,n,i,r;const{errors:l,json:a,zonosMode:u}=await(async()=>{if(window.Zonos.cartSettings)return g("Reusing cached zonos settings"),{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode};const t=p(),e=new URLSearchParams;t.overrideShouldEnabledCustomAddress&&e.set("overrideShouldEnabledCustomAddress",t.overrideShouldEnabledCustomAddress);const o=s();o&&e.set("zCountry",o);const{errors:n,json:i,zonosMode:r}=await w(`/api/zonos-elements/zonos-settings?${e.toString()}`);return n.length?(v("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:n,json:null,zonosMode:r}):{errors:[],json:i,zonosMode:r}})();if("403"===(null===(e=null===(t=l[0])||void 0===t?void 0:t.type)||void 0===e?void 0:e.toString()))return void g("Failed to load zonos settings. This domain may not have access","warn");const m=(null===(o=null==a?void 0:a.checkoutSettings)||void 0===o?void 0:o.customHTML)||"";this.injectCustomHTML(m),this.initZonosNotification();const f=this.buildBaseConfig(a),y=Object.assign(Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:(()=>{var t,e,o;return window.Zonos.isLegacyCheckout?(null===(t=null==a?void 0:a.appearanceSettings)||void 0===t?void 0:t.logoUrl)||(null===(e=this.config.appearance)||void 0===e?void 0:e.logoUrl):null===(o=this.config.appearance)||void 0===o?void 0:o.logoUrl})()})}),f);h({overrideSettings:y,zonosSettings:a}),d.zonosMode=u,(t=>{if("undefined"==typeof document||!t)return;const e=(({merchantSelector:t,supportsIs:e})=>e?`body.z-intl :is(${t})`:(t=>{const e=[];let o=0,n=0,i="";for(let s=0;s<t.length;s++){const r=t[s];if("("===r?o++:")"===r?o--:"["===r?n++:"]"===r&&n--,","===r&&0===o&&0===n){const t=i.trim();t&&e.push(t),i=""}else i+=r}const s=i.trim();return s&&e.push(s),e})(t).map((t=>`body.z-intl ${t}`)).join(", "))({merchantSelector:t,supportsIs:b});if(e.includes("<"))return void g(`Skip domesticElementSelector injection: "${t}" contains "<"`,"warn");try{document.querySelector(e)}catch(o){return void g(`Skip domesticElementSelector injection: "${t}" produced an invalid CSS selector ("${e}")`,"warn")}if(document.getElementById(S))return;const o=document.createElement("style");o.id=S,o.textContent=`${e} { display: none !important; }`,(document.head||document.body).appendChild(o),g("Zonos domestic element hide style injected")})(d.checkoutSettings.domesticElementSelector),this.setupGoogleFont(),"DISABLED"===d.helloSettings.visibilityStatus&&g("=== Hello is disabled by store owner ===","warn"),d.helloSettings&&"ENABLED"===d.helloSettings.visibilityStatus&&(g("Initializing hello"),O(d.helloSettings)),await c();const z=(null===(n=null==a?void 0:a.checkoutSettings)||void 0===n?void 0:n.externalServiceTokens.find((t=>"STRIPE_PUBLISHABLE_TOKEN"===t.type)))||null;if(!z||!this.stripeInitEvent)return void g("Checkout failed to load -- missing publishable key","warn");if(window.Zonos.isCollect||window.Zonos.isInvoice)return this.stripeInitEvent.emit({publishableKey:z.token}),void this.initGooglePlacesService(a);if("INACTIVE"===d.checkoutSettings.subscriptionStatus)return g('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn"),void g("zonos controller loaded");if("DISABLED"===d.checkoutSettings.visibilityStatus)return g("=== Checkout is disabled by store owner ===","warn"),void g("zonos controller loaded");const j="function"==typeof(null===(i=d.checkoutSettings)||void 0===i?void 0:i.buildCartDetail)||"function"==typeof(null===(r=d.checkoutSettings)||void 0===r?void 0:r.createCartId),I=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret"),C=!(!window.Zonos.cartId||!window.Zonos.cartData)||!!I;j||C?(this.stripeInitEvent.emit({publishableKey:z.token}),this.initGooglePlacesService(a)):g("Skip loading Stripe because no cart callback (buildCartDetail/createCartId), prefetched cart, or payment client secret is present","warn")})()}async showNotification(t){const e=document.querySelector("zonos-notification");e?e.showNotification(t):g("Failed to show notification - zonos-notification not found","warn")}async reset(){l.checkoutSessionId=null,i.clientSecret=""}async overrideConfig(t){h({overrideSettings:t,zonosSettings:null})}async overrideCountry(t){g(`Override country code to ${t}`),a({isInitializing:!1,newSelectedCountryCode:t})}async getAppearanceSetting(){return d.appearance}async updateOrganizationName(t){d.organizationName=t}render(){return o(n,{key:"1714865012d806892f03e03896ee2f04aa1a729d",class:"zonos--elements"})}};A.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{visibility:hidden;opacity:0;height:0}";export{A as zonos_controller}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o,h as n,a as s,F as i}from"./p-_lt63o7c.js";import{b as e,i as t,c,d as a,r,e as l,k as z,l as d,z as v,E as h,J as m,H as p,f as u}from"./p-FRWZayxL.js";import{i as g,a as f,b,c as w}from"./p-c9QtIdJX.js";import{p as x,a as y}from"./p-7abqRc9V.js";import{s as k,t as C,h as I,j,k as S,l as L}from"./p-clDfq9AL.js";import{z as O}from"./p-W82paT5F.js";import{b as T}from"./p-BycjkdlE.js";import{h as E,s as U,l as _,g as D}from"./p-DE4a-QD5.js";import{i as P,a as A}from"./p-Clej0Ffe.js";import{c as N}from"./p-BJHSB96f.js";import{l as B}from"./p-BJmZPrZl.js";import"./p-YdrG78th.js";import"./p-C_z9WL8a.js";import"./p-Cye-evFK.js";import"./p-CICjAi70.js";import"./p-sz4L-ZnB.js";const F=class{constructor(n){o(this,n),this.storeUnsubscribeList=[],this.onChangeLocaleListener=()=>{},this.mobile=!1,this.tablet=!1,this.stripe=window.Zonos.stripe,this.showLanguageDialogMobile=!1,this.submitLoading=!1,this.collapseReviewMobile=!0,this.isMobile=!1,this.isTablet=!1,this.isOverlayLoading=!0,this.isCartCollected=!1,this.isCartExpired=!1,this.payInUsdConfirmDialogOpen=!1,this.inventoryCheckErrorMessage=null,this.confirmationId=null,this.clientSecret=e.clientSecret,this.stripeCustomerSessionClientSecret=e.stripeCustomerSessionClientSecret,this.getBaseCurrencySettlementInfo=()=>{const o=a.selectedLandedCost;if(!o)return null;const{landedCost:{amountSubtotals:n}}=o;return n?{settlementAmount:(n.discounts||0)+n.items+n.landedCostTotal+n.shipping}:null},this.applyStripeTheme=async()=>{const o=O.appearance.theme;await t({overrideTheme:this.isMobile?o:void 0,paypalEnabled:x()})},this.fetchCheckoutSession=async o=>{const{json:n}=await E("/api/zonos-elements/collect/get-checkout-session",{body:{checkoutSessionId:o},method:"POST"});return n},this.checkStripePaymentIntentStatus=async()=>{var o;const n=!!window.Zonos.cartData,s=new URL(window.location.href).searchParams,i=s.get("payment_intent_client_secret"),t=s.get("zonosCheckoutSessionId");if(B("Payment intent exist, checking stripe payment intent status"),!i)return B("No stripe client secret found in the URL, proceed to order if cart data is available"),{shouldAllowOrder:n};const{error:a,status:r}=await c({clientSecret:i});if(new URLSearchParams(window.location.search).get("redirect_status")&&t){B(a?"Payment intent failed, show status from error":"Payment intent is succeeded or in a good state to move forward, show success screen");const n=await this.fetchCheckoutSession(t);return this.confirmationId=(null===(o=null==n?void 0:n.checkoutSession.landedCost)||void 0===o?void 0:o.shortId)||null,k.checkoutSessionId=t,e.clientSecret=i,this.setToFinishStep(r),{shouldAllowOrder:!1}}return n?(B("Payment intent is not succeeded, proceed to order"),{shouldAllowOrder:!0}):(B("Cart data is not available, only check payment intent status, skip order."),{shouldAllowOrder:!1})}}resizeListener(){this.isMobile=P(this.mobile),this.isTablet=A(this.tablet)}async setToFinishStep(o){e.stripe=window.Zonos.stripe,a.step="finish",this.storybookPaymentStatusOverride=o,this.isOverlayLoading=!1}async initInvoiceCart(){var o,n,s,i,e,t,v,h,m,p,u;if(!window.Zonos.cartData)return;const b=null===(n=null===(o=window.Zonos.cartData)||void 0===o?void 0:o.items[0])||void 0===n?void 0:n.currencyCode;b&&(a.currency=b);const w=null===(i=null===(s=window.Zonos.cartData)||void 0===s?void 0:s.references)||void 0===i?void 0:i.checkoutSessionId,x=null===(t=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.references)||void 0===t?void 0:t.landedCostId;if(!x)return void r({messages:[C("Session does not have valid landed cost. Please contact [organizationName] for assistance.",{organizationName:O.organizationName})],title:C("Invalid session")});w?(B("Setting checkout session id from cart reference","info",w),k.checkoutSessionId=w):(B("Clear checkout session id from storage so we start from a fresh session for the invoice cart"),k.checkoutSessionId=null);const{shouldAllowOrder:y}=await this.checkStripePaymentIntentStatus();if(y){try{const{adjustments:o,cartItems:n}=T(window.Zonos.cartData);if(await l({adjustments:o,cartItems:n,landedCostId:x,shouldInitSessionOnFailure:!1}),!k.checkoutSessionId&&!w){const o=await z();if(B(`stripeStoreInitCheckoutSession: ${o}`),!o)throw new Error("Failed to initialize checkout session! The cart might be created with LIVE Invoice quote but being used with sandbox credential")}if((!a.checkoutSession||(null===(v=a.checkoutSession)||void 0===v?void 0:v.completedAt))&&w){const o=await this.fetchCheckoutSession(w);if(this.confirmationId=(null===(h=null==o?void 0:o.checkoutSession.landedCost)||void 0===h?void 0:h.shortId)||null,(null==o?void 0:o.checkoutSession.completedAt)&&o.checkoutSession.order)return void this.setToFinishStep("succeeded");if(null==o?void 0:o.checkoutSession.clientSecret){const{status:n}=await c({clientSecret:o.checkoutSession.clientSecret});if("processing"===n||"succeeded"===n)return void this.setToFinishStep(n)}throw U({endpoint:"INVALID_INVOICE_CHECKOUT_SESSION",errors:["Invalid checkout session, can not retrieve the checkout session after failing to update it"],metadata:{cartCheckoutSessionId:w,cartId:null===(m=window.Zonos.cartData)||void 0===m?void 0:m.id,cartLandedCostId:x}}),new Error("Invalid checkout session, can not retrieve the checkout session after failing to update it")}if(!a.checkoutSession)throw U({endpoint:"FAIL_TO_UPDATE_CREATE_INVOICE_CHECKOUT_SESSION",errors:["Could not update/create checkout session for this invoice cart"],metadata:{cartCheckoutSessionId:w||"N/A",cartId:null===(p=window.Zonos.cartData)||void 0===p?void 0:p.id,cartLandedCostId:x||"N/A"}}),new Error("Could not update/create checkout session for this invoice cart");d();const s=null===(u=a.checkoutSession)||void 0===u?void 0:u.landedCost;if(!s)throw new Error("Landed cost could not be found in checkout session after creating/updating them");await g(Object.assign(Object.assign({},a.checkoutSession),{id:k.checkoutSessionId||""})),f({landedCostId:s.id}),this.applyStripeTheme()}catch(o){_(o),r({messages:[C("Session does not have valid landed cost. Please contact [organizationName] for assistance.",{organizationName:O.organizationName})],title:C("Invalid session")})}this.isOverlayLoading=!1}}toggleLanguageDialog(){this.showLanguageDialogMobile=!this.showLanguageDialogMobile}async handleStripePaymentContinue(){var o,n,s,i;if(null===(o=e.stripeBillingAddressElement)||void 0===o||o.getValue(),null===(n=e.stripeLinkEventData)||void 0===n?void 0:n.complete)if(null===(s=e.stripeBillingAddressEventData)||void 0===s?void 0:s.complete)if("USD"!==e.checkoutSettlementCurrency||!e.shouldRenderPayInUsdButton||this.payInUsdConfirmDialogOpen){if(this.payInUsdConfirmDialogOpen=!1,y.paypalErrorMessage=null,e.hasPaymentError=!1,this.submitLoading=!0,a.inventoryCheckErrorMessage=null,!await v())return e.hasPaymentError=!0,e.customErrorMessage=C("Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.",{currency:e.checkoutSettlementCurrency}),void(this.submitLoading=!1);await b();try{return await h({noLandedCostCheck:!0}),a.step="finish",void(this.confirmationId=w.landedCostShortId||(null===(i=a.selectedLandedCost)||void 0===i?void 0:i.landedCostId)||null)}catch(o){_(o),e.hasPaymentError=!0}this.submitLoading=!1}else this.payInUsdConfirmDialogOpen=!0;else{const o=document.querySelector(".zonos--billing-address");null==o||o.scrollIntoView({behavior:"smooth"})}else{const o=document.querySelector("zonos-link-authentication");null==o||o.scrollIntoView({behavior:"smooth"})}}componentWillLoad(){e.stripe=window.Zonos.stripe,a.step="payment",this.initInvoiceCart(),this.resizeListener(),this.storeUnsubscribeList=[m("clientSecret",(()=>{this.applyStripeTheme()})),I("selectedLocale",(()=>{this.applyStripeTheme()}))],B(`mobile: ${this.isMobile}`)}disconnectedCallback(){p(),u(),this.onChangeLocaleListener(),this.storeUnsubscribeList.forEach((o=>o()))}render(){this.clientSecret=e.clientSecret,e.stripeCustomerSessionClientSecret&&(this.stripeCustomerSessionClientSecret=e.stripeCustomerSessionClientSecret);const o=this.getBaseCurrencySettlementInfo(),{logoUrl:t,theme:c}=O.appearance,r=()=>{const o=`${t}?timestamp=${Date.now()}`;return n("div",{class:"zonos--logo"},o&&n("img",{alt:`${O.organizationName} logo`,src:o}))},l=D(),z=()=>{var o;const s=new URLSearchParams(window.location.search),e=s.get("zonosQaUrl"),t=s.get("zonosDebug"),c=null===(o=S.find((o=>o.code===L.selectedLocale)))||void 0===o?void 0:o.label;return n(i,null,n("zonos-h-stack",{class:"zonos--header-wrapper",spacing:16},n("div",{class:"zonos--logo-wrapper"},r(),l&&n("zonos-badge",{badgeColor:"orange",size:"small"},C("Test mode")),"1"===t&&n("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),e&&n("zonos-badge",{badgeColor:"purple",size:"small"},e)),n("div",{class:"zonos--header-right"},n("zonos-button",{backgroundColor:"gray-0",class:"zonos--header-right-button",onClick:()=>this.toggleLanguageDialog(),variant:"outline"},c,n("zonos-icon",{"aria-label":"Language select",content:'<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>',iconColor:"gray-1200"})),n("div",{class:N(["zonos--invoice-language-dialog",this.showLanguageDialogMobile&&"zonos--invoice-language-dialog-open"])},n("zonos-language-select",{handleOnClose:()=>this.toggleLanguageDialog()})))))};return n(s,{class:N(["zonos--invoice zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"]),"data-theme":c},(()=>this.isOverlayLoading||e.isFetchingSession?null:n("div",{class:"zonos--content"},"finish"!==a.step&&"error"!==a.step&&n(i,null,(this.isMobile||this.isTablet)&&z(),n("div",{class:"zonos--left","data-theme":c},!this.isMobile&&!this.isTablet&&z(),n("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},C("Billing info")),n("zonos-v-stack",{spacing:16},n("zonos-link-authentication",{titleText:""}),n("zonos-address",{titleText:"",type:"billing"})),n("zonos-invoice-payment",{class:N(["zonos--invoice-container"]),continueLoading:this.submitLoading,onContinueClicked:async()=>{await this.handleStripePaymentContinue()}})),n("div",{class:"zonos--right","data-theme":c},!this.isMobile&&n("zonos-invoice-review",{mobile:this.isMobile,tablet:this.isTablet}),n("div",{class:"zonos--order-details-container"},!this.isMobile&&n("zonos-invoice-cart-items",null),this.isMobile&&n("zonos-invoice-order-details",{collapsed:this.collapseReviewMobile,mobile:this.isMobile,onCollapseClicked:()=>{this.collapseReviewMobile=!this.collapseReviewMobile}})),n("div",{class:"flex--wrapper"},!this.isMobile&&n("zonos-v-stack",{spacing:16},n("zonos-invoice-subtotal",null)),!this.isMobile&&!this.isTablet&&n("zonos-invoice-footer",{"data-theme":c,mobile:this.isMobile,tablet:this.isTablet})))),("finish"===a.step||"error"===a.step)&&n("div",{class:"zonos--done","data-theme":c},n("div",{class:"zonos--header"},r()),n("zonos-invoice-finish",{confirmationId:this.confirmationId,overrideNotification:"error"===a.step&&a.error?Object.assign(Object.assign({},a.error),{type:"error"}):void 0,storybookForceStatus:this.storybookPaymentStatusOverride})),(this.isMobile||this.isTablet||"finish"===a.step||"error"===a.step)&&n("zonos-invoice-footer",{"data-theme":c,mobile:this.isMobile,tablet:this.isTablet})))(),o&&n("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:C("Cancel"),dialogConfirmBtnText:C("Pay [orderTotal]",{orderTotal:j({amount:o.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:C("By paying in USD, your card will be charged directly with no currency conversion. However, using a non-USD based card may result in additional currency conversion fees at the bank level."),dialogTitle:C("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:()=>{this.payInUsdConfirmDialogOpen=!1},onConfirmClicked:()=>this.handleStripePaymentContinue()}),n("zonos-loading-overlay",{open:this.isOverlayLoading}))}static get assetsDirs(){return["assets"]}};F.style=".sc-zonos-invoice-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-invoice-h *.sc-zonos-invoice{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-invoice-h img.sc-zonos-invoice{max-width:100%}.sc-zonos-invoice-h dl.sc-zonos-invoice,.sc-zonos-invoice-h dd.sc-zonos-invoice,.sc-zonos-invoice-h h1.sc-zonos-invoice,.sc-zonos-invoice-h h2.sc-zonos-invoice,.sc-zonos-invoice-h h3.sc-zonos-invoice,.sc-zonos-invoice-h h4.sc-zonos-invoice,.sc-zonos-invoice-h h5.sc-zonos-invoice,.sc-zonos-invoice-h h6.sc-zonos-invoice,.sc-zonos-invoice-h hr.sc-zonos-invoice,.sc-zonos-invoice-h figure.sc-zonos-invoice,.sc-zonos-invoice-h p.sc-zonos-invoice,.sc-zonos-invoice-h pre.sc-zonos-invoice{margin:0}.sc-zonos-invoice-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-invoice-h{z-index:2147483647;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;top:0;left:0;width:100%;height:100%;-ms-flex-align:center;align-items:center;background-color:var(--zonos-elements-gray-0)}.sc-zonos-invoice-h *.sc-zonos-invoice{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar{width:10px}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;width:100%;-ms-flex-pack:center;justify-content:center}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{-ms-flex:1;flex:1;padding:56px 80px 60px;max-width:800px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200);overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:32px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{background-color:var(--zonos-elements-gray-0)}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice{width:100%;max-width:1400px;max-height:100%;height:calc(100% - 100px);overflow:hidden;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice .zonos--header.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice .zonos--logo.sc-zonos-invoice{margin-bottom:0}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice zonos-checkout-finish.sc-zonos-invoice{-ms-flex:1;flex:1}.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{max-width:800px}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{padding:0 8px 8px}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice .zonos--payment-error-banner.sc-zonos-invoice{margin-top:24px}.sc-zonos-invoice-h .zonos--right.sc-zonos-invoice{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-invoice-h .zonos--right.sc-zonos-invoice .zonos--order-details-container.sc-zonos-invoice{overflow:auto}.sc-zonos-invoice-h .zonos--wrapper.sc-zonos-invoice{overflow:auto;max-height:100%;position:relative}.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-invoice-h .zonos--logo-wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center;-ms-flex:1;flex:1}.sc-zonos-invoice-h .zonos--logo-wrapper.sc-zonos-invoice>*.sc-zonos-invoice{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-invoice-h .zonos--header-right.sc-zonos-invoice{display:none}.sc-zonos-invoice-h .zonos--logo.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-invoice-h .zonos--logo.sc-zonos-invoice img.sc-zonos-invoice{max-height:70px;-o-object-position:left center;object-position:left center;-o-object-fit:contain;object-fit:contain}.sc-zonos-invoice-h .zonos--invoice-container.sc-zonos-invoice{overflow:visible}.mobile.sc-zonos-invoice-h,.tablet.sc-zonos-invoice-h{min-width:auto}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{padding-bottom:0}}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--review.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--review.sc-zonos-invoice{margin-bottom:0}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--cart-items.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--cart-items.sc-zonos-invoice{margin-top:8px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice zonos-checkout-footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice zonos-checkout-footer.sc-zonos-invoice{-ms-flex-order:3;order:3}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{max-height:100%}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--footer.sc-zonos-invoice{-ms-flex-order:3;order:3}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice{width:auto}.mobile.sc-zonos-invoice-h .zonos--cart-subtotal.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--cart-subtotal.sc-zonos-invoice{margin:0}.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{position:-webkit-sticky;position:sticky;top:0;width:100%;padding:16px;background-color:var(--zonos-elements-gray-0);z-index:3}.mobile.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{max-width:800px;padding:0 16px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{overflow:auto;-ms-flex-pack:unset;justify-content:unset;-ms-flex-align:center;align-items:center;gap:24px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{overflow:visible;width:100%}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{gap:32px}.mobile.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice{margin-top:0}.mobile.sc-zonos-invoice-h zonos-collect-footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h zonos-collect-footer.sc-zonos-invoice{-ms-flex-order:3;order:3;left:0}.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{padding-top:56px;top:-56px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--header-right.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{padding-top:28px;top:-28px}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice{position:fixed;left:0;right:0;bottom:0;-webkit-transform-origin:bottom center;transform-origin:bottom center;width:100vw;background:var(--zonos-elements-surface-color);-webkit-box-shadow:var(--zonos-elements-v3-shadow-xl);box-shadow:var(--zonos-elements-v3-shadow-xl);border-radius:var(--zonos-elements-radius-12);max-width:100vw;max-height:500px;z-index:2147483011;overflow:auto;-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;-ms-scroll-chaining:none;overscroll-behavior:contain}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar{width:10px}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-track{border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.zonos--invoice-language-dialog-open.sc-zonos-invoice{opacity:1;-webkit-transform:scale(1);transform:scale(1)}.iframed.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{-ms-scroll-chaining:chained;overscroll-behavior:auto}";export{F as zonos_invoice}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,d as t,h as o,a as e,g as n}from"./p-_lt63o7c.js";import{t as i}from"./p-CcJF6xhQ.js";import{U as a,w as r,b as l,t as d,J as h,d as c}from"./p-FRWZayxL.js";import{s as p,l as u,C as f,t as m,z}from"./p-clDfq9AL.js";import{z as v,g as y,a as b}from"./p-W82paT5F.js";import{l as g,i as k,s as x}from"./p-DE4a-QD5.js";import{a as w,s as C}from"./p-DnjGkbEy.js";import{c as I}from"./p-BJHSB96f.js";import{l as A}from"./p-BJmZPrZl.js";import{c as E,s as j}from"./p-Cye-evFK.js";import{g as S}from"./p-C_z9WL8a.js";import"./p-BpDCLBwW.js";import"./p-YdrG78th.js";import"./p-nJ6oI8-n.js";const D=s=>{var t,o,e;return[s.name,null===(t=s.address)||void 0===t?void 0:t.line1,null===(o=s.address)||void 0===o?void 0:o.postal_code,null===(e=s.address)||void 0===e?void 0:e.country].map((s=>(s||"").trim().toLowerCase())).join("|")},L=({currentEvent:s,defaultAddress:t})=>{if(!s)return t;const o=(s=>{const{firstName:t,lastName:o}=a({firstName:s.firstName,lastName:s.lastName,name:s.name});return{address:{city:s.address.city,country:s.address.country,line1:s.address.line1,line2:s.address.line2||void 0,postal_code:s.address.postal_code,state:s.address.state},name:(s.name||`${t} ${o}`).trim(),phone:s.phone||void 0}})(s.value),e=D(o);return t.some((s=>D(s)===e))?t:[o,...t]},N=class{constructor(o){s(this,o),this.invalidCharacters=t(this,"invalidCharacters",7),this.taxIdChanged=t(this,"taxIdChanged",7),this.storeUnsubscribeList=[],this.isAutoCompleteAdjusted=!1,this.defaultAddress=[],this.taxIdErrorMessage="",this.shortAddressCodeErrorMessage="",this.stripe=window.Zonos.stripe,this.isDirtyAddress=!1,this.isAddressFilled=!1,this.checkoutSessionId=p.checkoutSessionId,this.prevCountry=null,this.prevPostalCode=null,this.trackingSent=!1,this.prefetchLandedCost=i(r,1e3)}getStripeAddressInstance(){return"billing"===this.type?{stripeAddressElement:l.stripeBillingAddressElement,stripeAddressEventData:l.stripeBillingAddressEventData,stripeElements:l.stripeElementsForBillingAddress}:{stripeAddressElement:l.stripeAddressElement,stripeAddressEventData:l.stripeAddressEventData,stripeElements:l.stripeElements}}updateAddressEventData({event:s,type:t}){"billing"===t?l.stripeBillingAddressEventData=s:l.stripeAddressEventData=s,"shipping"===t&&s.value.address.line1.length&&this.prefetchLandedCost()}isAddressFilledChanged(){p.checkoutSessionId&&this.isAddressFilled&&!this.trackingSent&&"shipping"===this.type&&(this.trackingSent=!0,d({checkoutSessionId:p.checkoutSessionId,eventName:"checkout_customerInfoFilled"}))}updateAddressElement({stripeAddressElement:s,type:t}){"shipping"!==t?l.stripeBillingAddressElement=s:l.stripeAddressElement=s}async watchInitStripe(){this.stripe=window.Zonos.stripe;const{stripeAddressEventData:s,stripeElements:t}=this.getStripeAddressInstance();if(!this.stripe||!t)return void g("Stripe is not initialized. Couldn't load stripe element.");const o=this.defaultAddress.map((s=>Object.assign(Object.assign({},s),{name:s.name,phone:s.phone||void 0}))),e=u.shippingZoneCountries,n=e?Object.values(e).map((s=>s.code)):[],i=new URLSearchParams(window.location.search).has("zonosCheckoutAllCountries"),r="shipping"===this.type?n:[],l=(null==s?void 0:s.value.address.country)||f(r);A(`Stripe country code: ${l}`,"info");const d=t.create("address",{allowedCountries:i?[]:r,contacts:L({currentEvent:s,defaultAddress:o}),defaultValues:{address:Object.assign(Object.assign({},null==s?void 0:s.value.address),{country:l}),firstName:null==s?void 0:s.value.firstName,lastName:null==s?void 0:s.value.lastName,phone:null==s?void 0:s.value.phone},display:{name:"split"},fields:{phone:"always"},mode:this.type,validation:{phone:{required:"always"}}});d.mount(this.el.querySelector(".zonos--address-component")),(null==s?void 0:s.value.address)&&(this.prevCountry=s.value.address.country,this.prevPostalCode=s.value.address.postal_code),d.on("change",(s=>{const t=s.value;if(!this.isDirtyAddress&&t.address.line1.length>=3){if(this.isDirtyAddress=!0,!this.isAutoCompleteAdjusted){const s=this.el.querySelector('iframe[src*="autocomplete-suggestions"]');s&&(s.style.zIndex="3"),this.isAutoCompleteAdjusted=!0}setTimeout((()=>{if(k())this.el.scrollIntoView({behavior:"smooth",block:"end"});else{const s="shipping"===this.type?100:600,t=this.el.closest(".zonos--group"),o=this.el.getBoundingClientRect().top+s;null==t||t.scrollTo({behavior:"smooth",top:o})}}),600)}const{firstName:o,lastName:e}=a({firstName:t.firstName,lastName:t.lastName,name:t.name});this.updateAddressEventData({event:Object.assign(Object.assign({},s),{elementMode:this.type,elementType:"address",value:Object.assign(Object.assign({},t),{firstName:o,lastName:e})}),type:this.type})})),this.updateAddressElement({stripeAddressElement:d,type:this.type})}defaultAddressChanged(s,t){if(JSON.stringify(t)===JSON.stringify(s))return;A("Reset address element when default address property is changed","info",{defaultAddress:this.defaultAddress});const o=this.getStripeAddressInstance().stripeAddressElement;null==o||o.clear(),null==o||o.destroy(),"shipping"===this.type?l.stripeAddressEventData=null:l.stripeBillingAddressEventData=null,this.watchInitStripe()}isInTaxIdCountry(s){return E.includes(s)}renderTaxIdInput(){var s;if("billing"===this.type)return null;const t=null===(s=l.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;if(!t)return null;if(!this.isInTaxIdCountry(t))return null;if(!w({companyName:l.companyName,countryCode:t}))return null;const e=j[t];return o("div",{class:"zonos--tax-id-input"},o("zonos-stripe-input",{inputLabel:m(e.friendlyName),inputPlaceholder:e.placeholder,inputValue:l.taxId||"",isError:!!this.taxIdErrorMessage,onInputChange:s=>{l.taxId=s.detail,this.taxIdChanged.emit(s.detail)}}),this.taxIdErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.taxIdErrorMessage))}renderShortAddressCodeInput(){var s;if("billing"===this.type)return null;const t=null===(s=l.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;return t&&C({countryCode:t})?o("div",{class:"zonos--short-address-code-input"},o("zonos-stripe-input",{inputLabel:m("Short address code"),inputPlaceholder:"RRRD2929",inputValue:l.shortAddressCode||"",isError:!!this.shortAddressCodeErrorMessage,onInputChange:s=>{l.shortAddressCode=s.detail}}),this.shortAddressCodeErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.shortAddressCodeErrorMessage)):null}renderCompanyNameInput(){return("billing"!==this.type||window.Zonos.isCollect||window.Zonos.isInvoice)&&("ENABLED"===v.checkoutSettings.companyFieldsStatus||window.Zonos.isCollect||window.Zonos.isInvoice)?o("zonos-stripe-input",{class:"zonos--company-name-input",inputLabel:m("Company name (optional)"),inputValue:l.companyName,onInputChange:s=>{l.companyName=s.detail}}):null}disconnectedCallback(){const s=this.getStripeAddressInstance().stripeAddressElement;null==s||s.destroy();try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){const s=this.getStripeAddressInstance().stripeAddressEventData;this.isDirtyAddress=!!s&&s.value.address.line1.length>0,this.watchInitStripe(),this.checkoutSessionId=p.checkoutSessionId,this.storeUnsubscribeList=[z("checkoutSessionId",(()=>{this.checkoutSessionId=p.checkoutSessionId})),h("stripeElements",(()=>{"shipping"===this.type&&this.watchInitStripe()})),h("stripeElementsForBillingAddress",(()=>{"billing"===this.type&&this.watchInitStripe()}))]}render(){var s;return this.checkoutSessionId=p.checkoutSessionId,(null===(s=l.stripeAddressEventData)||void 0===s?void 0:s.complete)&&(this.isAddressFilled=!0),o(e,{key:"302dafde973c4bf2d847640d8f0e064d88f350f8",class:I(["zonos--address","zonos--elements",`zonos--${this.type}-address`])},this.titleText&&o("zonos-text",{key:"706204604ad32eed710e38adbe8133b3384044eb",class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("slot",{key:"0edc4c5d6c3ff965be6edbf680acaed892c71a16",name:"below-title"}),this.renderCompanyNameInput(),this.renderTaxIdInput(),this.renderShortAddressCodeInput(),o("div",{key:"6aa6e4e86a76f1081c5af1f2b5f3282dfd91f3c5",class:"zonos--address-component"}))}get el(){return n(this)}static get watchers(){return{checkoutSessionId:[{isAddressFilledChanged:0}],isAddressFilled:[{isAddressFilledChanged:0}],stripe:[{watchInitStripe:0}],defaultAddress:[{defaultAddressChanged:0}]}}};N.style=".sc-zonos-address-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h .zonos--company-name-input.sc-zonos-address,.sc-zonos-address-h .zonos--tax-id-input.sc-zonos-address,.sc-zonos-address-h .zonos--short-address-code-input.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";const B=class{constructor(o){s(this,o),this.confirmClicked=t(this,"confirmClicked",7),this.cancelClicked=t(this,"cancelClicked",7),this.dialogTitle=m("Are you sure?"),this.dialogIntent="info",this.dialogSubtitle=null,this.dialogWidth=350,this.dialogType="confirm",this.isMobile=!1,this.noClickOutside=!1,this.clickOutsideDialogHandler=s=>{s.target!==s.currentTarget||this.noClickOutside||this.closeDialogHandler()}}handleKeyDown(s){"Escape"===s.key&&this.closeDialogHandler()}focusDialog(){this.dialogOpen&&setTimeout((()=>{var s,t;null===(t=null===(s=this.el.shadowRoot)||void 0===s?void 0:s.querySelector(".zonos--backdrop"))||void 0===t||t.focus()}),100)}confirmDialogHandler(){this.dialogOpen&&this.confirmClicked.emit()}closeDialogHandler(){this.dialogOpen&&this.cancelClicked.emit()}renderIcon(){switch(this.dialogIntent){case"info":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-400)"></path>\n <path d="M10.25 10.25a1.75 1.75 0 1 1 2.431 1.613c-.616.26-1.431.885-1.431 1.887a.75.75 0 0 0 1.5 0c0-.053.02-.128.108-.228.092-.104.236-.205.408-.278A3.25 3.25 0 1 0 8.75 10.25a.75.75 0 0 0 1.5 0Zm2.5 5.75a.75.75 0 0 0-1.5 0v.25a.75.75 0 0 0 1.5 0V16Z" fill="currentColor"></path>\n</svg>',iconColor:"blue-800"});case"danger":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-400)"></path>\n <path d="M12.75 9a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V9Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"red-800"});case"warn":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-orange-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M14.46 5.492c-1.014-2.027-3.906-2.027-4.92 0L4.276 16.02c-.914 1.83.416 3.98 2.46 3.98h10.528c2.044 0 3.374-2.151 2.46-3.98L14.46 5.492Z" data-is-secondary-color="true" fill="var(--zonos-elements-orange-400)"></path>\n <path d="M12.75 10a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V10Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"orange-800"})}}getButtonConfirmVariant(){switch(this.dialogIntent){case"warn":return"warning";case"danger":return"danger";default:return"primary"}}render(){this.focusDialog();const s=S(),t=y(v.appearance.theme);return o(e,{key:"9ad8aff8631692fa53ef172869d98e9fbfbdc059",class:I([this.dialogOpen&&"open","zonos--elements"]),"data-dialog-type":this.dialogType,"data-theme":t,style:{"--zonos--border-radius":s,"--zonos--dialog-width":`${this.dialogWidth}px`,"--zonos--font-family":b()}},o("div",{key:"6d7c55b90bfb05890d876a0243558eb9a2e7a772",class:"zonos--backdrop",tabIndex:-1}),o("div",{key:"abf306ddd70cefd64aa6804aeccf700506c175d7",class:I(["zonos--confirm-layout",this.dialogIntent]),onClick:s=>this.clickOutsideDialogHandler(s)},o("div",{key:"dc7e9e6d501872597928603ded57d82c15c26710",class:"zonos--confirm-dialog",onBlur:()=>{this.focusDialog()}},o("div",{key:"5c1fa9ec8b59cba68ccbc5dc36e66e2fdefdeae5",class:"wrapper"},o("div",{key:"0ce48c41c78e393a181fd5e9beeac90622b5c620",class:"icon-wrapper"},this.renderIcon()),o("div",{key:"b42157f8e76de8a60190e384d7d53a36d8051c67",class:"content"},o("div",{key:"bd8eb897f15a6d095df8fbd1803f62a11b9d5d7b",class:"title"},o("zonos-text",{key:"d1c06b89d4917b2366f881dda7da9e1369722126",type:"subheader"},this.dialogTitle)),this.dialogSubtitle&&o("div",{key:"4f1269aaab5ad3965d6ddfc0949341d4f202f296",class:"subtitle"},o("zonos-text",{key:"f784b5dd86ff684e790f27a586e3eeb4ac683884",textColor:"gray-800"},this.dialogSubtitle))),o("div",{key:"e0403a968aee6ff878c9e916e9ff216e2052ab0c",class:"footer"},"confirm"===this.dialogType&&o("zonos-button",{key:"66e34a9d61f677786bfe286f377854c9ebc780ed",backgroundColor:"gray-0",class:"cancel-button",onClick:()=>this.closeDialogHandler(),size:"lg",withBoxShadow:!0},this.dialogCancelBtnText||m("Cancel")),o("zonos-button",{key:"3652507591e3055856a044e191525ea36b6042ca",class:"confirm-button",onClick:()=>this.confirmDialogHandler(),size:"lg",variant:this.getButtonConfirmVariant()},this.dialogConfirmBtnText))))))}static get assetsDirs(){return["assets"]}get el(){return n(this)}};B.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--confirm-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:opacity 0.3s, visibility 0.3s;transition:opacity 0.3s, visibility 0.3s}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--confirm-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color)}:host .zonos--confirm-dialog{position:relative;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;width:var(--zonos--dialog-width);border-radius:var(--zonos--border-radius, 10px);outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;gap:24px}:host .icon-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:40px;width:40px;border-radius:50%;background:var(--zonos-elements-blue-100)}:host .warn .icon-wrapper{background:var(--zonos-elements-orange-100)}:host .danger .icon-wrapper{background:var(--zonos-elements-red-100)}:host .footer{display:-ms-flexbox;display:flex;width:100%;gap:8px}:host .footer zonos-button{-ms-flex:1;flex:1}:host .content{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .content zonos-text{text-align:center}:host(.open) .zonos--confirm-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483009;opacity:0.65}:host(.open) .zonos--confirm-layout{opacity:1;z-index:2147483010;-webkit-transform:scale(1);transform:scale(1)}";const Z=s=>/^[a-zA-Z0-9.%_+-]*@[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z0-9]{2,}$/.test(s),_=class{constructor(o){s(this,o),this.linkAuthenticationChange=t(this,"linkAuthenticationChange",7),this.storeUnsubscribeList=[],this.defaultEmail=null,this.isEmailError=!1,this.stripe=l.stripe,this.isStagingMode=c.isStagingMode,this.clientSecret=l.clientSecret,this.retriesInitializeLink=0,this.setCustomEmailInputToLinkEvent=s=>{const t=Z(s);l.stripeLinkEventData={complete:!!t,elementType:"linkAuthentication",empty:!s,value:{email:s}}},this.handleNormalEmailInput=s=>{var t;this.setCustomEmailInputToLinkEvent(s.detail),null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()}}watchIsStagingMode(){setTimeout((()=>{this.watchInitStripe()}),0)}async watchInitStripe(){if(!this.stripe||!l.stripeElements)return;if(c.isStagingMode||!this.clientSecret)return;const s=this.defaultEmail?{email:this.defaultEmail}:void 0;try{const t=l.stripeLinkElement||l.stripeElements.create("linkAuthentication",{defaultValues:s}),o=this.el.querySelector(".zonos--link-authentication-component");if(!o)return void g("Cannot find container element for linkAuthenticationElement");t.mount(o),t.on("change",(s=>{var t;l.stripeLinkEventData=s,null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()})),l.stripeLinkElement=t,this.retriesInitializeLink=0,this.retriesInitializeLink>11&&(A("Stripe link element initialized","info",{retriesInitializeLink:this.retriesInitializeLink,stripe:this.stripe}),x({endpoint:"stripe-link-authentication-init-long-running",errors:["Stripe link element initialized after 20 retries - 10 seconds"],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}catch(s){s instanceof Error&&(this.retriesInitializeLink++,this.retriesInitializeLink<51&&(await new Promise((s=>setTimeout(s,500))),this.watchInitStripe()),51===this.retriesInitializeLink&&x({endpoint:"stripe-link-authentication-init-error",errors:[s.message],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}}watchDefaultEmail(s,t){var o,e;A("Default email is changed","info",{newDefaultEmail:s,oldDefaultEmail:t}),t!==s&&(s||(l.stripeLinkEventData=null),c.isStagingMode?this.setCustomEmailInputToLinkEvent(s||""):(null===(o=l.stripeLinkElement)||void 0===o||o.clear(),null===(e=l.stripeLinkElement)||void 0===e||e.destroy(),l.stripeLinkElement=null,l.stripeLinkEventData=null,A("Reset stripe link element when default email is changed","info",{defaultEmail:s}),this.watchInitStripe()))}disconnectedCallback(){try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){this.storeUnsubscribeList=[h("stripeElements",(async()=>{this.watchInitStripe()})),h("clientSecret",(async()=>{this.clientSecret=l.clientSecret})),h("stripe",(async()=>{this.stripe=l.stripe}))],this.watchInitStripe(),this.defaultEmail&&this.setCustomEmailInputToLinkEvent(this.defaultEmail)}render(){return this.isStagingMode=c.isStagingMode,this.clientSecret=l.clientSecret,o(e,{class:"zonos--link-authentication zonos--elements",style:{"--zonos--border-radius":S()}},this.titleText&&o("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),(()=>{var s;return c.isStagingMode?o("zonos-stripe-input",{inputLabel:m("Email"),inputValue:this.defaultEmail||(null===(s=l.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"",isError:this.isEmailError,onBlur:()=>{var s;const t=(null===(s=l.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"";if(!t)return;const o=Z(t);this.isEmailError=!o},onInputChange:this.handleNormalEmailInput}):o("div",{class:`zonos--link-authentication-component ${this.isEmailError&&"zonos--input-invalid"}`})})(),this.isEmailError&&o("zonos-text",{textColor:"red-600"},m("Please enter a valid email address.")))}get el(){return n(this)}static get watchers(){return{isStagingMode:[{watchIsStagingMode:0}],stripe:[{watchInitStripe:0}],clientSecret:[{watchInitStripe:0}],defaultEmail:[{watchDefaultEmail:0}]}}};_.style=".sc-zonos-link-authentication-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-link-authentication-h *.sc-zonos-link-authentication{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-link-authentication-h img.sc-zonos-link-authentication{max-width:100%}.sc-zonos-link-authentication-h dl.sc-zonos-link-authentication,.sc-zonos-link-authentication-h dd.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h1.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h2.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h3.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h4.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h5.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h6.sc-zonos-link-authentication,.sc-zonos-link-authentication-h hr.sc-zonos-link-authentication,.sc-zonos-link-authentication-h figure.sc-zonos-link-authentication,.sc-zonos-link-authentication-h p.sc-zonos-link-authentication,.sc-zonos-link-authentication-h pre.sc-zonos-link-authentication{margin:0}.sc-zonos-link-authentication-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-link-authentication-h .zonos--title.sc-zonos-link-authentication{margin-bottom:16px}.sc-zonos-link-authentication-h .zonos--input-invalid.sc-zonos-link-authentication{border:2px solid var(--zonos-elements-red-600);border-radius:var(--zonos--border-radius)}";const O=class{constructor(t){s(this,t),this.open=!1,this.size=40}render(){return o(e,{key:"8cafd99b309b04da5cf1b26b0f0804f4699c06b2",class:I(["zonos--elements",this.open&&"zonos--open"])},o("div",{key:"9ce7ac9b7e6956a5f76fc2105fa7f5d05299fd36",class:"zonos--loading-overlay"},o("zonos-spinner",{key:"4be3a8d471e3aead2e4194c4ecbf66878a7a3f17",size:this.size,spinnerColor:this.spinnerColor})))}};O.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:fixed;inset:0;z-index:2147483010;pointer-events:none;display:block}:host .zonos--loading-overlay{position:fixed;inset:0;width:100vw;height:100vh;background:var(--zonos-elements-backdrop-color);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;opacity:0;visibility:hidden;-webkit-transition:opacity 0.3s ease, visibility 0.3s ease;transition:opacity 0.3s ease, visibility 0.3s ease;z-index:2147483010}:host(.zonos--open){pointer-events:auto}:host(.zonos--open) .zonos--loading-overlay{opacity:0.65;visibility:visible}";export{N as zonos_address,B as zonos_confirm_dialog,_ as zonos_link_authentication,O as zonos_loading_overlay}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as o}from"./p-clDfq9AL.js";const r="gkjqw123",l="Kq93wqw3",v=()=>{var v;return null===(v=o.inclusivePricingConfigurations)||void 0===v?void 0:v.some((o=>{var v,i;return"ENABLED"===(null===(v=o.configurations[r])||void 0===v?void 0:v.status)||"ENABLED"===(null===(i=o.configurations[l])||void 0===i?void 0:i.status)}))};export{r as D,l as T,v as h}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(n,e,r,o){function t(n){return n instanceof r?n:new r((function(e){e(n)}))}return new(r||(r=Promise))((function(r,i){function a(n){try{s(o.next(n))}catch(n){i(n)}}function u(n){try{s(o["throw"](n))}catch(n){i(n)}}function s(n){n.done?r(n.value):t(n.value).then(a,u)}s((o=o.apply(n,e||[])).next())}))};var __generator=this&&this.__generator||function(n,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,t,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(e){return s([n,e])}}function s(u){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(r=0)),r)try{if(o=1,t&&(i=u[0]&2?t["return"]:u[0]?t["throw"]||((i=t["return"])&&i.call(t),0):t.next)&&!(i=i.call(t,u[1])).done)return i;if(t=0,i)u=[u[0]&2,i.value];switch(u[0]){case 0:case 1:i=u;break;case 4:r.label++;return{value:u[1],done:false};case 5:r.label++;t=u[1];u=[0];continue;case 7:u=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1];i=u;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(u);break}if(i[2])r.ops.pop();r.trys.pop();continue}u=e.call(n,r)}catch(n){u=[6,n];t=0}finally{o=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(n,e,r){if(r||arguments.length===2)for(var o=0,t=e.length,i;o<t;o++){if(i||!(o in e)){if(!i)i=Array.prototype.slice.call(e,0,o);i[o]=e[o]}}return n.concat(i||Array.prototype.slice.call(e))};System.register(["./p-BbgqQIHv.system.js"],(function(n){"use strict";var e;return{setters:[function(n){e=n.l}],execute:function(){var r=this;var o=n("l",(function(n){var r=[];for(var o=1;o<arguments.length;o++){r[o-1]=arguments[o]}e.apply(void 0,__spreadArray([n,"error"],r,false))}));var t=n("a",(function(){return window.location.search.includes("zonosStagingMode=1")}));var i=n("g",(function(){var n;return((n=window.Zonos.zonosApiKey)===null||n===void 0?void 0:n.includes("test"))||window.location.search.includes("zonosTestMode=1")}));var a=["cloudflare","vercel"];var u=a[0];var s=n("f",{cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"});var c=s[u];
|
|
2
|
-
/**
|
|
3
|
-
* Next available fallback api type
|
|
4
|
-
*/var d=function(n){if(n===void 0){n=u}var e=a.indexOf(n);var r=a[e+1];if(!r){return null}return r};var l=n("j",(function(n){if(typeof n==="string"){try{
|
|
5
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
6
|
-
var e=JSON.parse(n);return e}catch(n){return null}}return null}));var f=890;var v=n("i",(function(n){return n||window.innerWidth<f}));var w=function(){var n="connection"in window.navigator?// connection is not yet supported in all browsers
|
|
7
|
-
window.navigator.connection:null;var e="mozConnection"in window.navigator?// mozConnection is not yet supported in all browsers
|
|
8
|
-
window.navigator.mozConnection:null;var r="webkitConnection"in window.navigator?// webkitConnection is not yet supported in all browsers
|
|
9
|
-
window.navigator.webkitConnection:null;var o=n||e||r;return o};var p=n("b",(function(){var n="userAgentData"in window.navigator?// userAgentData is not yet supported in all browsers
|
|
10
|
-
window.navigator.userAgentData:null;var e=w();return{connectionDownlink:e===null||e===void 0?void 0:e.downlink,connectionEffectiveType:e===null||e===void 0?void 0:e.effectiveType,connectionRtt:e===null||e===void 0?void 0:e.rtt,connectionSaveData:e===null||e===void 0?void 0:e.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:n&&n.brands.length>0?n:window.navigator.userAgent}}));var h=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"];
|
|
11
|
-
/**
|
|
12
|
-
* Prepares the load time api log for the given API call to send to the server later
|
|
13
|
-
* This function is used to prepare the load time api log for the given API call.
|
|
14
|
-
* It adds the load time api log to the loadTimeApiInfoList.
|
|
15
|
-
*/var b=function(n){var e=n.apiPath,r=n.apiType,o=n.loadTimeInternal,t=n.loadTimeTotal;if(h.includes(e)){return}var i=t-o;
|
|
16
|
-
// No need to record if the browser API load time is negative (cached)
|
|
17
|
-
if(i<0){return}
|
|
18
|
-
// e.g. /api/zonos-elements/log-script-load?zonosDebug=1 -> /api/zonos-elements/log-script-load
|
|
19
|
-
var a=e.split("?")[0]||e;var u=p();var s=typeof u.userAgent==="object"&&u.userAgent.mobile;var c={apiType:r,connectionType:u.connectionEffectiveType,href:a,isHostedCheckout:window.Zonos.isLegacyCheckout,
|
|
20
|
-
// Use the isMobileAgent to determine if the checkout is mobile, if it's not availabe, use the logic from isCheckoutMobile
|
|
21
|
-
isMobile:v(s),loadTimeBrowserApi:i,loadTimeInternal:o,loadTimeTotal:t,metadata:Object.assign({},u),screenHeight:u.screenHeight,screenWidth:u.screenWidth,userAgent:typeof u.userAgent==="string"?u.userAgent:u.userAgent["brands"].map((function(n){return n.brand})).filter((function(n){return!/Not.*A.*Brand.*/.test(n)})).join(",")};window.Zonos.loadTimeApiInfoList.push(c)};
|
|
22
|
-
/**
|
|
23
|
-
* This is the time in milliseconds after release time that we will start sending error logs to the new API
|
|
24
|
-
* @default 1 hour
|
|
25
|
-
*/var y=1*3600*1e3;// 1 hour
|
|
26
|
-
var m=n("s",(function(n){return __awaiter(r,[n],void 0,(function(n){var r,o,t,i,a;var u=n.endpoint,l=n.errors,f=n.metadata,v=n.shouldPostReleaseErrorReporting;return __generator(this,(function(n){e("sendErrorLog","warn",u,f,l);if(v){r=Number(window.Zonos.releaseDate);o=(new Date).getTime();if(o-r>y){return[2/*return*/]}}t="userAgentData"in window.navigator?// userAgentData is not yet supported in all browsers
|
|
27
|
-
window.navigator.userAgentData:null;i={endpoint:u,errors:l,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:t&&t.brands.length>0?t:window.navigator.userAgent},f)};try{
|
|
28
|
-
// use native fetch because in handleFetch also calls sendErrorLog and it will possibly cause circular dependencies issue
|
|
29
|
-
void fetch("".concat(c,"/api/zonos-elements/log-error"),{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(n){a=d();if(!a){return[2/*return*/]}
|
|
30
|
-
// request to the fallback API if the first one fails
|
|
31
|
-
void fetch("".concat(s[a],"/api/zonos-elements/log-error"),{body:JSON.stringify(i),method:"POST"})}return[2/*return*/]}))}))}));var g=undefined&&undefined.__rest||function(n,e){var r={};for(var o in n)if(Object.prototype.hasOwnProperty.call(n,o)&&e.indexOf(o)<0)r[o]=n[o];if(n!=null&&typeof Object.getOwnPropertySymbols==="function")for(var t=0,o=Object.getOwnPropertySymbols(n);t<o.length;t++){if(e.indexOf(o[t])<0&&Object.prototype.propertyIsEnumerable.call(n,o[t]))r[o[t]]=n[o[t]]}return r};var _=function(n){return __awaiter(r,[n],void 0,(function(n){var e,r,o;var t=n.response,i=n.shouldLog,a=i===void 0?true:i,u=n.shouldThrow,s=u===void 0?false:u;return __generator(this,(function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4/*yield*/,t.text()];case 1:e=n.sent();r=l(e);if(!r){throw new Error("Failed to parse content: ".concat(e))}return[2/*return*/,r];case 2:o=n.sent();if(s){throw o}if(a){
|
|
32
|
-
// eslint-disable-next-line
|
|
33
|
-
console.error(o)}return[2/*return*/,null];case 3:return[2/*return*/]}}))}))};var T=function(n){try{
|
|
34
|
-
// encode the string, remove the "=" at the end of the encoded string
|
|
35
|
-
var e=btoa(n).replace(/=/g,"");return e}catch(e){
|
|
36
|
-
// return the reverse string if the encoding failed
|
|
37
|
-
return n.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}};var j=function(n){return __awaiter(r,[n],void 0,(function(n){var e,r,o,t,i,a,c,d,l,f,v,f,w,p,c,h,c;var b=n.basePathType,y=n.options,m=n.path;return __generator(this,(function(n){switch(n.label){case 0:r=window.Zonos.zonosQaUrlApi||s[b]||u;o=r+m;t=new URL(o);i=window.Zonos.cartId?"".concat(window.location.hostname,"-").concat(window.Zonos.cartId):window.location.hostname;t.searchParams.set("zToken",T(i));n.label=1;case 1:n.trys.push([1,3,,4]);return[4/*yield*/,fetch(t.toString(),y)];case 2:e=n.sent();return[3/*break*/,4];case 3:a=n.sent();if(a instanceof Error){return[2/*return*/,{baseUrl:r,errors:[{message:a.message,type:"unknown"}],json:null,response:null,zonosMode:null}]}c="Failed to fetch";return[2/*return*/,{baseUrl:r,errors:[{message:c,type:"unknown"}],json:null,response:null,zonosMode:null}];case 4:d=e.headers.get("Zonos-Mode");l=window.Zonos.zonosQaUrl;
|
|
38
|
-
// We only want to alert once if the user is in preview mode and it's also using production environment
|
|
39
|
-
if(!window.Zonos.modeAlerted&&d&&l){window.Zonos.modeAlerted=true}if(!e.ok)return[3/*break*/,6];return[4/*yield*/,_({response:e})];case 5:f=n.sent();return[2/*return*/,{baseUrl:r,errors:[],json:f,response:e,zonosMode:d}];case 6:v=e.status.toString();n.label=7;case 7:n.trys.push([7,9,,10]);return[4/*yield*/,_({response:e,shouldThrow:true})];case 8:f=n.sent();
|
|
40
|
-
// Parse and access "errors" from the response if possible
|
|
41
|
-
if(f&&"errors"in f&&Array.isArray(f.errors)){w=f.errors;p=w.map((function(n){if(typeof n==="string"){return{message:n,type:v}}return n}));return[2/*return*/,{baseUrl:r,errors:p,json:null,response:e,zonosMode:d}]}c=JSON.stringify(f);return[2/*return*/,{baseUrl:r,errors:[{message:c,type:v}],json:null,response:e,zonosMode:d}];case 9:h=n.sent();c="Unknown error";return[2/*return*/,{baseUrl:r,errors:[{message:"".concat(v,": ").concat(c),type:v}],json:null,response:null,zonosMode:d}];case 10:return[2/*return*/]}}))}))};var k=function(n){return __awaiter(r,[n],void 0,(function(n){var r,o,t,i,a,u,c,f,v,w,p,h,y,_,T,O,z;var A=n.basePathType,S=n.options,M=n.path;return __generator(this,(function(n){switch(n.label){case 0:t=M.startsWith("/api/bigcommerce");i=t?"vercel":A;a=performance.now();return[4/*yield*/,j({basePathType:i,options:S,path:M})];case 1:u=n.sent(),c=u.errors,f=u.response,v=g(u,["errors","response"]);w=performance.now();p=w-a;
|
|
42
|
-
// Send the load time api log
|
|
43
|
-
e("".concat(M," (").concat(p.toFixed(2),"ms)"),"info");h=f===null||f===void 0?void 0:f.headers.get("Zonos-Duration");
|
|
44
|
-
// Only record if the response status is 200, some endpoint will return 200 with error
|
|
45
|
-
if((f===null||f===void 0?void 0:f.status)===200){b({apiPath:M,apiType:i,loadTimeInternal:h?Number(h):0,loadTimeTotal:p})}y=d(i);_=c.find((function(n){var e=n.type;return e==="unknown"}));T=c.find((function(n){var e=n.message;return typeof e==="string"&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted"))}));O=!!_||(f===null||f===void 0?void 0:f.status)===404||(f===null||f===void 0?void 0:f.status)===500;z=
|
|
46
|
-
// If next fallback is available, and the error is unknown (Failed to fetch) or 404 or 500 (server error)
|
|
47
|
-
y&&O;
|
|
48
|
-
// Should log the error if it's unknown error
|
|
49
|
-
if(O&&!T){void m({endpoint:s[i]+M,errors:c.map((function(n){var e=n.message;return"API: ".concat(e)})),metadata:{currentBasePath:i,nextFallbackApiType:y,requestHeaders:S===null||S===void 0?void 0:S.headers,requestPayload:l((r=S===null||S===void 0?void 0:S.body)===null||r===void 0?void 0:r.toString())||((o=S===null||S===void 0?void 0:S.body)===null||o===void 0?void 0:o.toString()),shouldCallFallback:z,status:f===null||f===void 0?void 0:f.status,statusText:f===null||f===void 0?void 0:f.statusText},
|
|
50
|
-
// When the error is unknown, error reporting should be enabled for period of time after release, so we can monitor the error.
|
|
51
|
-
shouldPostReleaseErrorReporting:true})}if(z){e('=== "'.concat(M,'" failed to fetch, trying next fallback ').concat(y));return[2/*return*/,k({basePathType:y,options:S,path:M})]}
|
|
52
|
-
// No more fallbacks, just return the result
|
|
53
|
-
return[2/*return*/,Object.assign({errors:c,response:f},v)]}}))}))};
|
|
54
|
-
/**
|
|
55
|
-
* Fetch request and will request to fallback API when the first one fails
|
|
56
|
-
* @param path Path name of the request (e.g. /api/something/com).
|
|
57
|
-
* @param _opts fetch options
|
|
58
|
-
*/var O=n("h",(function(n,e){return __awaiter(r,void 0,void 0,(function(){var r,o,a,s,c,d;return __generator(this,(function(l){r=g(e||{},[]);o=r.body?JSON.stringify(r.body):undefined;a=r.method||"GET";s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":t()?"1":undefined,"Zonos-Test-Mode":i()?"1":undefined,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},r.headers);
|
|
59
|
-
// filter all underfined headers
|
|
60
|
-
Object.keys(s).forEach((function(n){return s[n]===undefined&&delete s[n]}));c=Object.assign(Object.assign({},r),{body:a==="GET"?undefined:o,headers:s,method:a});d=new URLSearchParams(window.location.search).get("useFallbackApi");return[2/*return*/,k({basePathType:d||u,options:c,path:n})]}))}))}))}}}));
|