@zonos/elements 1.3.201 → 1.3.203
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/VarianceTest-0cb1e118.js +12 -0
- package/dist/cjs/cart-0d91ad0b.js +1955 -0
- package/dist/cjs/{debounce-d393fafe.js → debounce-94e1b7ff.js} +1 -1
- package/dist/cjs/{getBorderRadius-3d0a563e.js → getBorderRadius-8d3b1049.js} +1 -1
- package/dist/cjs/index.cjs.js +10 -8
- package/dist/cjs/{isDarkColor-92a10a85.js → isDarkColor-bcf49625.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{cart-e73cde62.js → localization-2f17c95f.js} +74 -1941
- package/dist/cjs/{paypal-39bbbd1a.js → paypal-9953115b.js} +10 -9
- package/dist/cjs/zonos-address_11.cjs.entry.js +98 -72
- package/dist/cjs/zonos-badge.cjs.entry.js +2 -1
- package/dist/cjs/zonos-banner.cjs.entry.js +2 -1
- package/dist/cjs/zonos-button_3.cjs.entry.js +4 -3
- package/dist/cjs/zonos-card.cjs.entry.js +3 -2
- package/dist/cjs/{zonos-cart-items_13.cjs.entry.js → zonos-cart-items_14.cjs.entry.js} +105 -82
- package/dist/cjs/zonos-checkout.cjs.entry.js +395 -50
- package/dist/cjs/zonos-collapse.cjs.entry.js +2 -1
- package/dist/cjs/zonos-component.cjs.entry.js +1 -1
- package/dist/cjs/zonos-controller.cjs.entry.js +13 -11
- package/dist/cjs/zonos-country-flag.cjs.entry.js +4 -5
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +13 -13
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +10 -8
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +41 -42
- package/dist/cjs/zonos-hello.cjs.entry.js +30 -31
- package/dist/cjs/zonos-input.cjs.entry.js +3 -2
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +8 -9
- package/dist/cjs/zonos-logo.cjs.entry.js +4 -3
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +3 -2
- package/dist/cjs/zonos-stripe-input.cjs.entry.js +8 -7
- package/dist/cjs/zonos-text.cjs.entry.js +2 -1
- package/dist/cjs/zonos-toggle.cjs.entry.js +4 -3
- package/dist/cjs/zonos-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/zonos-v-stack.cjs.entry.js +4 -3
- package/dist/cjs/{zonosStore-c466b127.js → zonosStore-9264749e.js} +15 -5
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +18 -17
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +235 -15
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +3 -3
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +9 -4
- package/dist/collection/components/common/zonos-loading-overlay/zonos-loading-overlay.css +62 -0
- package/dist/collection/components/common/zonos-loading-overlay/zonos-loading-overlay.js +90 -0
- package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
- package/dist/collection/components/common/zonos-rest-state/zonos-rest-state.js +3 -3
- package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +2 -2
- package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +4 -4
- package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +5 -5
- package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.js +5 -5
- package/dist/collection/components/common/zonos-toggle/zonos-toggle.js +2 -2
- package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
- package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
- package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +2 -2
- package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +2 -2
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +4 -4
- package/dist/collection/components/main/zonos-controller.js +3 -3
- package/dist/collection/components/paypal/zonos-paypal-payment.js +1 -1
- package/dist/collection/components/store/checkout/cart.js +28 -18
- package/dist/collection/components/store/checkout/paypal.js +2 -1
- package/dist/collection/components/store/checkout/stripe.js +16 -11
- package/dist/collection/components/store/hello/localization.js +5 -5
- package/dist/collection/components/store/storageStore.js +32 -0
- package/dist/collection/components/store/zonosStore.js +12 -6
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +18 -6
- package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +2 -2
- package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +19 -7
- package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +3 -3
- package/dist/collection/components/utils/api/getCheckoutSession.js +3 -3
- package/dist/collection/components/utils/api/placeTestOrder.js +2 -1
- package/dist/collection/components/utils/api/prepCalculateLandedCost.js +3 -2
- package/dist/collection/components/utils/api/selectVarianceTest.js +20 -0
- package/dist/collection/components/utils/buildCartUrl.js +44 -0
- package/dist/collection/components/utils/getLegacyQueryParams.js +42 -0
- package/dist/collection/components/utils/varianceTest/filterExpiredTests.js +6 -0
- package/dist/collection/components/utils/varianceTest/filterValidTests.js +23 -0
- package/dist/collection/components/utils/varianceTest/getSelectedTestVariant.js +6 -0
- package/dist/collection/components/utils/varianceTest/hasAtLeastOneAvailableTestKey.js +14 -0
- package/dist/collection/components/utils/varianceTest/isInAvailableTestKey.js +4 -0
- package/dist/collection/components/utils/varianceTest/isTestEnabled.js +4 -0
- package/dist/collection/components/utils/varianceTest/isTestKeysAllVariantSelected.js +6 -0
- package/dist/collection/components/utils/varianceTest/mergeTest.js +13 -0
- package/dist/collection/scripts/_getZonosQaUrl.js +2 -2
- package/dist/collection/types/checkout/api/VarianceTest.js +8 -0
- package/dist/collection/types/generated/graphql.internal.types.js +26 -7
- package/dist/collection/types/index.js +1 -0
- package/dist/esm/VarianceTest-fef2d958.js +10 -0
- package/dist/esm/cart-db61eb95.js +1918 -0
- package/dist/esm/{debounce-a2121722.js → debounce-3a9f27a0.js} +1 -1
- package/dist/esm/{getBorderRadius-413e97eb.js → getBorderRadius-78b28b4d.js} +1 -1
- package/dist/esm/index.js +9 -8
- package/dist/esm/{isDarkColor-4c7b2ffc.js → isDarkColor-31dd7dff.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{cart-f79c8021.js → localization-bf7224aa.js} +70 -1907
- package/dist/esm/{paypal-6d4667d1.js → paypal-2e0ffb07.js} +5 -4
- package/dist/esm/zonos-address_11.entry.js +54 -28
- package/dist/esm/zonos-badge.entry.js +2 -1
- package/dist/esm/zonos-banner.entry.js +2 -1
- package/dist/esm/zonos-button_3.entry.js +4 -3
- package/dist/esm/zonos-card.entry.js +3 -2
- package/dist/esm/{zonos-cart-items_13.entry.js → zonos-cart-items_14.entry.js} +54 -32
- package/dist/esm/zonos-checkout.entry.js +363 -18
- package/dist/esm/zonos-collapse.entry.js +2 -1
- package/dist/esm/zonos-component.entry.js +1 -1
- package/dist/esm/zonos-controller.entry.js +8 -6
- package/dist/esm/zonos-country-flag.entry.js +3 -4
- package/dist/esm/zonos-country-select_4.entry.js +8 -8
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-empty-state-payment_4.entry.js +10 -8
- package/dist/esm/zonos-hello-dialog.entry.js +7 -8
- package/dist/esm/zonos-hello.entry.js +4 -5
- package/dist/esm/zonos-input.entry.js +3 -2
- package/dist/esm/zonos-language-select_2.entry.js +5 -6
- package/dist/esm/zonos-logo.entry.js +4 -3
- package/dist/esm/zonos-shipping-rich-radio.entry.js +3 -2
- package/dist/esm/zonos-stripe-input.entry.js +8 -7
- package/dist/esm/zonos-text.entry.js +2 -1
- package/dist/esm/zonos-toggle.entry.js +4 -3
- package/dist/esm/zonos-tooltip.entry.js +2 -2
- package/dist/esm/zonos-v-stack.entry.js +4 -3
- package/dist/esm/{zonosStore-cdabc848.js → zonosStore-d10a829f.js} +15 -5
- package/dist/esm-es5/VarianceTest-fef2d958.js +1 -0
- package/dist/esm-es5/cart-db61eb95.js +1 -0
- package/dist/esm-es5/{debounce-a2121722.js → debounce-3a9f27a0.js} +1 -1
- package/dist/esm-es5/{getBorderRadius-413e97eb.js → getBorderRadius-78b28b4d.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{isDarkColor-4c7b2ffc.js → isDarkColor-31dd7dff.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/localization-bf7224aa.js +1 -0
- package/dist/esm-es5/{paypal-6d4667d1.js → paypal-2e0ffb07.js} +2 -2
- package/dist/esm-es5/zonos-address_11.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.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_14.entry.js +1 -0
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-collapse.entry.js +1 -1
- package/dist/esm-es5/zonos-component.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-input.entry.js +1 -1
- 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-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-toggle.entry.js +1 -1
- package/dist/esm-es5/zonos-tooltip.entry.js +1 -1
- package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
- package/dist/esm-es5/zonosStore-d10a829f.js +1 -0
- package/dist/scripts/index.d.ts +844 -766
- 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-checkout.d.ts +16 -0
- package/dist/types/components/common/zonos-loading-overlay/zonos-loading-overlay.d.ts +16 -0
- package/dist/types/components/store/checkout/cart.d.ts +5 -2
- package/dist/types/components/store/checkout/stripe.d.ts +2 -2
- package/dist/types/components/store/hello/localization.d.ts +2 -2
- package/dist/types/components/store/storageStore.d.ts +13 -0
- package/dist/types/components/store/zonosStore.d.ts +7 -2
- package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +2 -0
- package/dist/types/components/stripe/zonos-custom-address/zonos-custom-address.d.ts +2 -0
- package/dist/types/components/utils/api/selectVarianceTest.d.ts +6 -0
- package/dist/types/components/utils/buildCartUrl.d.ts +10 -0
- package/dist/types/components/utils/getLegacyQueryParams.d.ts +2 -0
- package/dist/types/components/utils/varianceTest/filterExpiredTests.d.ts +2 -0
- package/dist/types/components/utils/varianceTest/filterValidTests.d.ts +9 -0
- package/dist/types/components/utils/varianceTest/getSelectedTestVariant.d.ts +2 -0
- package/dist/types/components/utils/varianceTest/hasAtLeastOneAvailableTestKey.d.ts +8 -0
- package/dist/types/components/utils/varianceTest/isInAvailableTestKey.d.ts +2 -0
- package/dist/types/components/utils/varianceTest/isTestEnabled.d.ts +2 -0
- package/dist/types/components/utils/varianceTest/isTestKeysAllVariantSelected.d.ts +9 -0
- package/dist/types/components/utils/varianceTest/mergeTest.d.ts +5 -0
- package/dist/types/components.d.ts +51 -0
- package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +7 -0
- package/dist/types/types/checkout/CheckoutConfig.d.ts +13 -1
- package/dist/types/types/checkout/api/CheckoutSession.d.ts +7 -0
- package/dist/types/types/checkout/api/VarianceTest.d.ts +30 -0
- package/dist/types/types/generated/graphql.internal.types.d.ts +206 -22
- package/dist/types/types/generated/graphql.internal.types.ts +235 -19
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/utils/ZonosSettings.d.ts +7 -6
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-609c32a3.system.entry.js → p-01987cb2.system.entry.js} +1 -1
- package/dist/zonos-elements/p-04a01cb1.js +1 -0
- package/dist/zonos-elements/p-04b43dd5.entry.js +1 -0
- package/dist/zonos-elements/{p-7d5d89f2.system.js → p-0693422b.system.js} +2 -2
- package/dist/zonos-elements/p-06f25f75.entry.js +1 -0
- package/dist/zonos-elements/p-0c62cfb3.entry.js +1 -0
- package/dist/zonos-elements/{p-7831b52c.system.entry.js → p-1dcdb65f.system.entry.js} +1 -1
- package/dist/zonos-elements/p-25970cb8.system.entry.js +1 -0
- package/dist/zonos-elements/p-26a634a5.system.entry.js +1 -0
- package/dist/zonos-elements/p-27987298.system.entry.js +1 -0
- package/dist/zonos-elements/p-2bb8ca7d.system.entry.js +1 -0
- package/dist/zonos-elements/p-2f70d0eb.entry.js +1 -0
- package/dist/zonos-elements/p-3284f459.system.entry.js +1 -0
- package/dist/zonos-elements/{p-13796f98.js → p-3d82a352.js} +1 -1
- package/dist/zonos-elements/p-411b8e10.entry.js +1 -0
- package/dist/zonos-elements/p-452070af.system.entry.js +1 -0
- package/dist/zonos-elements/p-45ebc788.entry.js +1 -0
- package/dist/zonos-elements/p-4c81112f.entry.js +1 -0
- package/dist/zonos-elements/p-4efa8187.js +1 -0
- package/dist/zonos-elements/p-5170bc41.entry.js +1 -0
- package/dist/zonos-elements/p-54cdc47f.system.entry.js +1 -0
- package/dist/zonos-elements/p-5a2dd041.system.js +1 -0
- package/dist/zonos-elements/p-5c74e5c9.system.entry.js +1 -0
- package/dist/zonos-elements/p-5d0f7364.system.js +1 -0
- package/dist/zonos-elements/p-6b6a9dd6.system.js +1 -0
- package/dist/zonos-elements/p-715d0f59.system.entry.js +1 -0
- package/dist/zonos-elements/{p-b8d87932.js → p-72f37935.js} +1 -1
- package/dist/zonos-elements/p-7ae5cd60.entry.js +1 -0
- package/dist/zonos-elements/p-7cd09f1f.system.js +1 -0
- package/dist/zonos-elements/p-80bbd9c0.system.entry.js +1 -0
- package/dist/zonos-elements/p-851c642e.system.entry.js +1 -0
- package/dist/zonos-elements/{p-4300d944.entry.js → p-8d870d4c.entry.js} +1 -1
- package/dist/zonos-elements/p-9af5e93a.entry.js +1 -0
- package/dist/zonos-elements/{p-5de59662.js → p-a9307caa.js} +2 -2
- package/dist/zonos-elements/p-aa1193bc.entry.js +1 -0
- package/dist/zonos-elements/p-ab176281.system.entry.js +1 -0
- package/dist/zonos-elements/p-bc8bda92.entry.js +1 -0
- package/dist/zonos-elements/p-be5afc91.system.entry.js +1 -0
- package/dist/zonos-elements/p-c291bac1.entry.js +1 -0
- package/dist/zonos-elements/p-c3d2422e.entry.js +1 -0
- package/dist/zonos-elements/{p-f28eb1dd.system.js → p-c50b3100.system.js} +1 -1
- package/dist/zonos-elements/p-c5fcbc92.system.entry.js +1 -0
- package/dist/zonos-elements/p-c767242b.entry.js +1 -0
- package/dist/zonos-elements/p-c9aa902e.system.entry.js +1 -0
- package/dist/zonos-elements/p-cb823c4d.system.js +1 -0
- package/dist/zonos-elements/p-cdd3087f.system.entry.js +1 -0
- package/dist/zonos-elements/p-d2165441.system.entry.js +1 -0
- package/dist/zonos-elements/{p-d422ad1d.system.js → p-d42dfd32.system.js} +1 -1
- package/dist/zonos-elements/p-d46349d3.system.entry.js +1 -0
- package/dist/zonos-elements/{p-b2241919.entry.js → p-d6a10007.entry.js} +1 -1
- package/dist/zonos-elements/p-d99d9e00.js +1 -0
- package/dist/zonos-elements/p-db025dfc.system.entry.js +1 -0
- package/dist/zonos-elements/p-dcd6acd4.system.entry.js +1 -0
- package/dist/zonos-elements/p-dd1cfa74.entry.js +1 -0
- package/dist/zonos-elements/p-df4c46a6.entry.js +1 -0
- package/dist/zonos-elements/p-dfd1ba1d.entry.js +1 -0
- package/dist/zonos-elements/{p-4593324c.js → p-e26c9e83.js} +1 -1
- package/dist/zonos-elements/p-e68d5219.entry.js +1 -0
- package/dist/zonos-elements/p-ea6d87a1.system.js +1 -1
- package/dist/zonos-elements/p-ef3e05e5.system.js +1 -0
- package/dist/zonos-elements/p-f255e822.js +1 -0
- package/dist/zonos-elements/p-f655ec36.entry.js +1 -0
- package/dist/zonos-elements/{p-e91b244c.entry.js → p-f891d470.entry.js} +1 -1
- package/dist/zonos-elements/p-f8d0d488.system.entry.js +1 -0
- package/dist/zonos-elements/{p-240ee490.system.entry.js → p-fbe36bc8.system.entry.js} +1 -1
- package/dist/zonos-elements/p-fcc2e712.entry.js +1 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-f79c8021.js +0 -1
- package/dist/esm-es5/zonos-cart-items_13.entry.js +0 -1
- package/dist/esm-es5/zonosStore-cdabc848.js +0 -1
- package/dist/zonos-elements/p-0302a254.entry.js +0 -1
- package/dist/zonos-elements/p-06ed3582.system.js +0 -1
- package/dist/zonos-elements/p-147ca395.entry.js +0 -1
- package/dist/zonos-elements/p-1998d8b3.entry.js +0 -1
- package/dist/zonos-elements/p-1eddec23.entry.js +0 -1
- package/dist/zonos-elements/p-20030bf5.system.js +0 -1
- package/dist/zonos-elements/p-24a2e899.system.entry.js +0 -1
- package/dist/zonos-elements/p-264f46a5.entry.js +0 -1
- package/dist/zonos-elements/p-2882b9f4.entry.js +0 -1
- package/dist/zonos-elements/p-2c915112.system.entry.js +0 -1
- package/dist/zonos-elements/p-327aebf5.entry.js +0 -1
- package/dist/zonos-elements/p-33488109.system.entry.js +0 -1
- package/dist/zonos-elements/p-337fab4e.js +0 -1
- package/dist/zonos-elements/p-3ddecaa4.system.entry.js +0 -1
- package/dist/zonos-elements/p-48f70043.system.entry.js +0 -1
- package/dist/zonos-elements/p-49a31b14.system.entry.js +0 -1
- package/dist/zonos-elements/p-4cd867d5.js +0 -1
- package/dist/zonos-elements/p-55711b80.system.entry.js +0 -1
- package/dist/zonos-elements/p-578bf5d7.entry.js +0 -1
- package/dist/zonos-elements/p-5c061a35.entry.js +0 -1
- package/dist/zonos-elements/p-6096c1c5.entry.js +0 -1
- package/dist/zonos-elements/p-65a8f19d.entry.js +0 -1
- package/dist/zonos-elements/p-6adc6e27.entry.js +0 -1
- package/dist/zonos-elements/p-6cd9b6a1.system.entry.js +0 -1
- package/dist/zonos-elements/p-79070ee6.entry.js +0 -1
- package/dist/zonos-elements/p-7bb9c330.entry.js +0 -1
- package/dist/zonos-elements/p-82aa4f9f.system.entry.js +0 -1
- package/dist/zonos-elements/p-8540f3e2.system.entry.js +0 -1
- package/dist/zonos-elements/p-8a9d4605.system.entry.js +0 -1
- package/dist/zonos-elements/p-932bed54.system.entry.js +0 -1
- package/dist/zonos-elements/p-94e3e50d.system.entry.js +0 -1
- package/dist/zonos-elements/p-9f6dd86a.entry.js +0 -1
- package/dist/zonos-elements/p-a64ab131.system.entry.js +0 -1
- package/dist/zonos-elements/p-aac95779.system.entry.js +0 -1
- package/dist/zonos-elements/p-ad3c5358.entry.js +0 -1
- package/dist/zonos-elements/p-af6af82e.system.js +0 -1
- package/dist/zonos-elements/p-b66b3306.system.entry.js +0 -1
- package/dist/zonos-elements/p-b6afcf3f.system.entry.js +0 -1
- package/dist/zonos-elements/p-b8d91f99.entry.js +0 -1
- package/dist/zonos-elements/p-c770044a.system.entry.js +0 -1
- package/dist/zonos-elements/p-d4842d10.system.entry.js +0 -1
- package/dist/zonos-elements/p-d6c3aec8.system.entry.js +0 -1
- package/dist/zonos-elements/p-daf73a4c.system.js +0 -1
- package/dist/zonos-elements/p-de388ea0.entry.js +0 -1
- package/dist/zonos-elements/p-e14d89de.entry.js +0 -1
- package/dist/zonos-elements/p-f6e587bb.entry.js +0 -1
- package/dist/zonos-elements/p-f818bdf5.entry.js +0 -1
- package/dist/zonos-elements/p-fce6bffe.system.entry.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(r,e,t,o){function n(r){return r instanceof t?r:new t((function(e){e(r)}))}return new(t||(t=Promise))((function(t,a){function i(r){try{c(o.next(r))}catch(r){a(r)}}function u(r){try{c(o["throw"](r))}catch(r){a(r)}}function c(r){r.done?t(r.value):n(r.value).then(i,u)}c((o=o.apply(r,e||[])).next())}))};var __generator=this&&this.__generator||function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},o,n,a,i;return i={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function u(r){return function(e){return c([r,e])}}function c(u){if(o)throw new TypeError("Generator is already executing.");while(i&&(i=0,u[0]&&(t=0)),t)try{if(o=1,n&&(a=u[0]&2?n["return"]:u[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,u[1])).done)return a;if(n=0,a)u=[u[0]&2,a.value];switch(u[0]){case 0:case 1:a=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;n=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(a=t.trys,a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1];a=u;break}if(a&&t.label<a[2]){t.label=a[2];t.ops.push(u);break}if(a[2])t.ops.pop();t.trys.pop();continue}u=e.call(r,t)}catch(r){u=[6,r];n=0}finally{o=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};import{z as zonosStore,c as createStore}from"./zonosStore-
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(r,e,t,o){function n(r){return r instanceof t?r:new t((function(e){e(r)}))}return new(t||(t=Promise))((function(t,a){function i(r){try{c(o.next(r))}catch(r){a(r)}}function u(r){try{c(o["throw"](r))}catch(r){a(r)}}function c(r){r.done?t(r.value):n(r.value).then(i,u)}c((o=o.apply(r,e||[])).next())}))};var __generator=this&&this.__generator||function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},o,n,a,i;return i={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function u(r){return function(e){return c([r,e])}}function c(u){if(o)throw new TypeError("Generator is already executing.");while(i&&(i=0,u[0]&&(t=0)),t)try{if(o=1,n&&(a=u[0]&2?n["return"]:u[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,u[1])).done)return a;if(n=0,a)u=[u[0]&2,a.value];switch(u[0]){case 0:case 1:a=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;n=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(a=t.trys,a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1];a=u;break}if(a&&t.label<a[2]){t.label=a[2];t.ops.push(u);break}if(a[2])t.ops.pop();t.trys.pop();continue}u=e.call(r,t)}catch(r){u=[6,r];n=0}finally{o=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};import{z as zonosStore,c as createStore}from"./zonosStore-d10a829f.js";import{t as trackConversionEvent,z as validateCheckoutSession,d as stripeStore,e as cartStore,v as stripeStoreHandleInventoryCheck,r as cartStoreNextStep,j as cartStoreClearCheckoutInterval}from"./cart-db61eb95.js";import{t as translate,s as storageStore}from"./localization-bf7224aa.js";import{h as handleFetch,l as log,b as logError,j as jsonParse}from"./handleFetch-621e45bc.js";import{t as tinycolor}from"./isDarkColor-31dd7dff.js";
|
|
2
2
|
/*!
|
|
3
3
|
* paypal-js v8.1.0 (2024-06-07T16:55:00.122Z)
|
|
4
4
|
* Copyright 2020-present, PayPal, Inc. All rights reserved.
|
|
@@ -14,4 +14,4 @@ var __awaiter=this&&this.__awaiter||function(r,e,t,o){function n(r){return r ins
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/function findScript(r,e){var t=document.querySelector('script[src="'.concat(r,'"]'));if(t===null)return null;var o=createScriptElement(r,e);var n=t.cloneNode();delete n.dataset.uidAuto;if(Object.keys(n.dataset).length!==Object.keys(o.dataset).length){return null}var a=true;Object.keys(n.dataset).forEach((function(r){if(n.dataset[r]!==o.dataset[r]){a=false}}));return a?t:null}function insertScriptElement(r){var e=r.url,t=r.attributes,o=r.onSuccess,n=r.onError;var a=createScriptElement(e,t);a.onerror=n;a.onload=o;document.head.insertBefore(a,document.head.firstElementChild)}function processOptions(r){var e=r.environment;var t=e==="sandbox"?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js";delete r.environment;if(r.sdkBaseUrl){t=r.sdkBaseUrl;delete r.sdkBaseUrl}var o=r;var n=Object.keys(o).filter((function(r){return typeof o[r]!=="undefined"&&o[r]!==null&&o[r]!==""})).reduce((function(r,e){var t=o[e].toString();e=camelCaseToKebabCase(e);if(e.substring(0,4)==="data"||e==="crossorigin"){r.attributes[e]=t}else{r.queryParams[e]=t}return r}),{queryParams:{},attributes:{}}),a=n.queryParams,i=n.attributes;if(a["merchant-id"]&&a["merchant-id"].indexOf(",")!==-1){i["data-merchant-id"]=a["merchant-id"];a["merchant-id"]="*"}return{url:"".concat(t,"?").concat(objectToQueryString(a)),attributes:i}}function camelCaseToKebabCase(r){var e=function(r,e){return(e?"-":"")+r.toLowerCase()};return r.replace(/[A-Z]+(?![a-z])|[A-Z]/g,e)}function objectToQueryString(r){var e="";Object.keys(r).forEach((function(t){if(e.length!==0)e+="&";e+=t+"="+r[t]}));return e}function createScriptElement(r,e){if(e===void 0){e={}}var t=document.createElement("script");t.src=r;Object.keys(e).forEach((function(r){t.setAttribute(r,e[r]);if(r==="data-csp-nonce"){t.setAttribute("nonce",e["data-csp-nonce"])}}));return t}function loadScript(r,e){if(e===void 0){e=Promise}validateArguments(r,e);if(typeof document==="undefined")return e.resolve(null);var t=processOptions(r),o=t.url,n=t.attributes;var a=n["data-namespace"]||"paypal";var i=getPayPalWindowNamespace(a);if(!n["data-js-sdk-library"]){n["data-js-sdk-library"]="paypal-js"}if(findScript(o,n)&&i){return e.resolve(i)}return loadCustomScript({url:o,attributes:n},e).then((function(){var r=getPayPalWindowNamespace(a);if(r){return r}throw new Error("The window.".concat(a," global variable is not available."))}))}function loadCustomScript(r,e){if(e===void 0){e=Promise}validateArguments(r,e);var t=r.url,o=r.attributes;if(typeof t!=="string"||t.length===0){throw new Error("Invalid url.")}if(typeof o!=="undefined"&&typeof o!=="object"){throw new Error("Expected attributes to be an object.")}return new e((function(r,e){if(typeof document==="undefined")return r();insertScriptElement({url:t,attributes:o,onSuccess:function(){return r()},onError:function(){var r=new Error('The script "'.concat(t,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return e(r)}})}))}function getPayPalWindowNamespace(r){return window[r]}function validateArguments(r,e){if(typeof r!=="object"||r===null){throw new Error("Expected an options object.")}var t=r.environment;if(t&&t!=="production"&&t!=="sandbox"){throw new Error('The `environment` option must be either "production" or "sandbox".')}if(typeof e!=="undefined"&&typeof e!=="function"){throw new Error("Expected PromisePonyfill to be a function.")}}var paypalCaptureOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o;var n=r.checkoutSessionId,a=r.paypalMockResponse;return __generator(this,(function(r){switch(r.label){case 0:return[4,handleFetch("/api/zonos-elements/capture-paypal-order",{body:{checkoutSessionId:n,paypalMockResponse:a},method:"POST"})];case 1:e=r.sent(),t=e.errors,o=e.json;return[2,{errors:t,json:o}]}}))}))};var paypalCreateOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o;var n=r.checkoutSessionId,a=r.intent;return __generator(this,(function(r){switch(r.label){case 0:return[4,handleFetch("/api/zonos-elements/create-paypal-order",{body:{checkoutSessionId:n,intent:a},method:"POST"})];case 1:e=r.sent(),t=e.errors,o=e.json;return[2,{errors:t,json:o}]}}))}))};var isContrastColor=function(r){var e=r.backgroundColor1,t=r.backgroundColor2;var o=tinycolor.readability(e,t);return o>2.5};var submitGtag=function(r){var e=zonosStore.checkoutSettings.analyticsProviders.find((function(r){return r.type==="GOOGLE_ANALYTICS"}));if(!e||(e===null||e===void 0?void 0:e.status)==="DISABLED"){return}if(typeof window.gtag==="function"){log("Zonos submits gtag event","log",r);window.gtag("event",r,{})}};var _c=createStore((function(){return{intent:"capture",orderIdCreated:null,paypalButtons:[],paypalClientId:"",paypalErrorMessage:null}})),paypalStoreReset=_c.reset,paypalStore=_c.state;var paypalStoreCreaterOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o,n,a,i,u;var c=r.checkoutSessionId;return __generator(this,(function(r){switch(r.label){case 0:o=paypalStore.intent.toUpperCase();return[4,paypalCreateOrder({checkoutSessionId:c,intent:o})];case 1:n=r.sent(),a=n.errors,i=n.json;u=(e=i===null||i===void 0?void 0:i.paypalOrderCreate)===null||e===void 0?void 0:e.paypalOrderId;if(a.length||!u){throw new Error(((t=a.find(Boolean))===null||t===void 0?void 0:t.message)||"An unexpected error occurred when creating paypal order.")}return[2,u]}}))}))};var paypalStoreCaptureOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o,n,a,i;var u=r.checkoutSessionId,c=r.paypalMockResponse;return __generator(this,(function(r){switch(r.label){case 0:return[4,paypalCaptureOrder({checkoutSessionId:u,paypalMockResponse:c})];case 1:o=r.sent(),n=o.errors,a=o.json;i=(e=a===null||a===void 0?void 0:a.paypalOrderCapture.order)===null||e===void 0?void 0:e.id;if(n.length||!i){throw new Error(((t=n.find(Boolean))===null||t===void 0?void 0:t.message)||translate("An unexpected error occurred when processing PayPal order."))}return[2,i]}}))}))};var paypalErrorHandler=function(r){var e=r.error;var t;var o=jsonParse(e.message);var n=(t=o===null||o===void 0?void 0:o.errors.find(Boolean))===null||t===void 0?void 0:t.message;var a=(n===null||n===void 0?void 0:n.match(/\[(.*?)\] (.*)/i))||[];if(!a){paypalStore.paypalErrorMessage=translate("An unexpected error occurred when processing PayPal order.")}var i=a[2]||translate("An unexpected error occurred when processing PayPal order.");paypalStore.paypalErrorMessage=i};var paypalButtonOptions=function(r){var e=r.checkoutSessionId,t=r.onPaypalFail,o=r.onPaypalSessionDone,n=r.overrideBorderRaidus,a=r.overridePrimaryColor;var i=a||zonosStore.appearance.colorPrimary;var u="#ffc33a";var c=isContrastColor({backgroundColor1:u,backgroundColor2:i||""});return{createOrder:function(){return __awaiter(void 0,void 0,void 0,(function(){var r,o,n,a,i;return __generator(this,(function(u){switch(u.label){case 0:void trackConversionEvent({checkoutSessionId:e,eventName:"checkout_paymentInfoCompleted",metadata:{paymentMethod:"paypal"}});return[4,validateCheckoutSession()];case 1:r=u.sent();if(!r.valid){paypalStore.paypalErrorMessage=r.errorMessage;stripeStore.hasPaymentError=false;stripeStore.customErrorMessage=null;t===null||t===void 0?void 0:t();return[2,""]}u.label=2;case 2:u.trys.push([2,8,,9]);paypalStore.paypalErrorMessage=null;cartStore.inventoryCheckErrorMessage=null;u.label=3;case 3:u.trys.push([3,5,,6]);o=cartStore;return[4,stripeStoreHandleInventoryCheck()];case 4:o.inventoryCheckErrorMessage=u.sent();return[3,6];case 5:n=u.sent();cartStore.inventoryCheckErrorMessage=translate("Unable to check inventory. Please try again.");return[3,6];case 6:if(cartStore.inventoryCheckErrorMessage){return[2,""]}return[4,paypalStoreCreaterOrder({checkoutSessionId:e})];case 7:a=u.sent();return[2,a];case 8:i=u.sent();logError("Failed to create paypal order",i);paypalStore.paypalErrorMessage=translate("Failed to create PayPal order. Please try again, or consider using an alternative method.");stripeStore.hasPaymentError=false;stripeStore.customErrorMessage=null;t===null||t===void 0?void 0:t();return[2,""];case 9:return[2]}}))}))},onApprove:function(r,n){return __awaiter(void 0,void 0,void 0,(function(){var r,n;return __generator(this,(function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);paypalStore.paypalErrorMessage=null;submitGtag("zonos-checkout-payment-info");return[4,paypalStoreCaptureOrder({checkoutSessionId:e,paypalMockResponse:window.Zonos._paypalMockResponse})];case 1:r=a.sent();paypalStore.orderIdCreated=r;o===null||o===void 0?void 0:o({orderId:r});cartStoreNextStep();cartStoreClearCheckoutInterval();return[3,3];case 2:n=a.sent();logError("==== Failed to capture paypal order",n);if(n instanceof Error){return[2,paypalErrorHandler({error:n})]}t===null||t===void 0?void 0:t();return[3,3];case 3:return[2]}}))}))},style:{borderRadius:n==="SHARP"?0:10,color:c?"gold":"blue",shape:"rect"}}};var paypalStoreResetButtons=function(){if(!paypalStore.paypalButtons.length){return}paypalStore.paypalButtons.forEach((function(r){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,r.close()];case 1:e.sent();return[2]}}))}))}));paypalStore.paypalButtons=[]};var paypalInitScript=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o,n,a,i;var u=r.currency;return __generator(this,(function(r){switch(r.label){case 0:t=!!((e=zonosStore.checkoutSettings.externalPaymentMethods)===null||e===void 0?void 0:e.find((function(r){return r.type==="PAYPAL"&&r.status==="ENABLED"})));if(!t){log("=== Paypal is disabled for this store","warn");return[2]}o=zonosStore.checkoutSettings.externalServiceTokens.find((function(r){return r.type==="PAYPAL_CLIENT_ID"}));if(!o){log("Failed to load paypal -- missing paypal publishable key","warn");return[2]}n=(!zonosStore.zonosMode||zonosStore.zonosMode==="production")&&zonosStore.checkoutSettings.mode==="LIVE"?"production":"sandbox";a=zonosStore.checkoutSettings.captureDelay&&zonosStore.checkoutSettings.captureDelay>0;paypalStore.intent=a?"authorize":"capture";log("==== Paypal order intent","info",paypalStore.intent);i=window.Zonos;return[4,loadScript({clientId:o.token,currency:u,environment:n,intent:paypalStore.intent})];case 1:i.paypal=r.sent();log("==== Paypal script loaded");return[2]}}))}))};var paypalStoreInitButtons=function(r){var e;var t=window.Zonos.paypal;if(!t){log("Paypal is not available");return null}var o=cartStore.checkoutSessionId;if(!o){log("Paypal is not available due to checkoutSessionId is not available");return null}log("==== Loading Paypal buttons");paypalStoreResetButtons();var n=[(e=t.FUNDING)===null||e===void 0?void 0:e.PAYPAL].filter(Boolean);paypalStore.paypalButtons=n.map((function(e){var n;var a=null;try{a=((n=t.Buttons)===null||n===void 0?void 0:n.call(t,Object.assign(Object.assign({},paypalButtonOptions(Object.assign({checkoutSessionId:o,fundingSource:e},r))),{fundingSource:e})))||null}catch(r){log("===== Failed to load paypal's \"".concat(e,'" button'),"warn",r)}if(a===null||a===void 0?void 0:a.isEligible()){log("==== Paypal button ".concat(e," loaded"));return a}return null})).filter(Boolean);return paypalStore.paypalButtons};var paypalStoreHasPaypalEnabled=function(){var r,e;var t=((e=(r=zonosStore.checkoutSettings.externalPaymentMethods)===null||r===void 0?void 0:r.find((function(r){return r.type==="PAYPAL"})))===null||e===void 0?void 0:e.status)==="ENABLED";return t||!!paypalStore.paypalButtons.length};export{paypalInitScript as a,paypalStore as b,paypalStoreReset as c,paypalStoreInitButtons as d,isContrastColor as i,paypalStoreHasPaypalEnabled as p,submitGtag as s};
|
|
17
|
+
*/function findScript(r,e){var t=document.querySelector('script[src="'.concat(r,'"]'));if(t===null)return null;var o=createScriptElement(r,e);var n=t.cloneNode();delete n.dataset.uidAuto;if(Object.keys(n.dataset).length!==Object.keys(o.dataset).length){return null}var a=true;Object.keys(n.dataset).forEach((function(r){if(n.dataset[r]!==o.dataset[r]){a=false}}));return a?t:null}function insertScriptElement(r){var e=r.url,t=r.attributes,o=r.onSuccess,n=r.onError;var a=createScriptElement(e,t);a.onerror=n;a.onload=o;document.head.insertBefore(a,document.head.firstElementChild)}function processOptions(r){var e=r.environment;var t=e==="sandbox"?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js";delete r.environment;if(r.sdkBaseUrl){t=r.sdkBaseUrl;delete r.sdkBaseUrl}var o=r;var n=Object.keys(o).filter((function(r){return typeof o[r]!=="undefined"&&o[r]!==null&&o[r]!==""})).reduce((function(r,e){var t=o[e].toString();e=camelCaseToKebabCase(e);if(e.substring(0,4)==="data"||e==="crossorigin"){r.attributes[e]=t}else{r.queryParams[e]=t}return r}),{queryParams:{},attributes:{}}),a=n.queryParams,i=n.attributes;if(a["merchant-id"]&&a["merchant-id"].indexOf(",")!==-1){i["data-merchant-id"]=a["merchant-id"];a["merchant-id"]="*"}return{url:"".concat(t,"?").concat(objectToQueryString(a)),attributes:i}}function camelCaseToKebabCase(r){var e=function(r,e){return(e?"-":"")+r.toLowerCase()};return r.replace(/[A-Z]+(?![a-z])|[A-Z]/g,e)}function objectToQueryString(r){var e="";Object.keys(r).forEach((function(t){if(e.length!==0)e+="&";e+=t+"="+r[t]}));return e}function createScriptElement(r,e){if(e===void 0){e={}}var t=document.createElement("script");t.src=r;Object.keys(e).forEach((function(r){t.setAttribute(r,e[r]);if(r==="data-csp-nonce"){t.setAttribute("nonce",e["data-csp-nonce"])}}));return t}function loadScript(r,e){if(e===void 0){e=Promise}validateArguments(r,e);if(typeof document==="undefined")return e.resolve(null);var t=processOptions(r),o=t.url,n=t.attributes;var a=n["data-namespace"]||"paypal";var i=getPayPalWindowNamespace(a);if(!n["data-js-sdk-library"]){n["data-js-sdk-library"]="paypal-js"}if(findScript(o,n)&&i){return e.resolve(i)}return loadCustomScript({url:o,attributes:n},e).then((function(){var r=getPayPalWindowNamespace(a);if(r){return r}throw new Error("The window.".concat(a," global variable is not available."))}))}function loadCustomScript(r,e){if(e===void 0){e=Promise}validateArguments(r,e);var t=r.url,o=r.attributes;if(typeof t!=="string"||t.length===0){throw new Error("Invalid url.")}if(typeof o!=="undefined"&&typeof o!=="object"){throw new Error("Expected attributes to be an object.")}return new e((function(r,e){if(typeof document==="undefined")return r();insertScriptElement({url:t,attributes:o,onSuccess:function(){return r()},onError:function(){var r=new Error('The script "'.concat(t,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return e(r)}})}))}function getPayPalWindowNamespace(r){return window[r]}function validateArguments(r,e){if(typeof r!=="object"||r===null){throw new Error("Expected an options object.")}var t=r.environment;if(t&&t!=="production"&&t!=="sandbox"){throw new Error('The `environment` option must be either "production" or "sandbox".')}if(typeof e!=="undefined"&&typeof e!=="function"){throw new Error("Expected PromisePonyfill to be a function.")}}var paypalCaptureOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o;var n=r.checkoutSessionId,a=r.paypalMockResponse;return __generator(this,(function(r){switch(r.label){case 0:return[4,handleFetch("/api/zonos-elements/capture-paypal-order",{body:{checkoutSessionId:n,paypalMockResponse:a},method:"POST"})];case 1:e=r.sent(),t=e.errors,o=e.json;return[2,{errors:t,json:o}]}}))}))};var paypalCreateOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o;var n=r.checkoutSessionId,a=r.intent;return __generator(this,(function(r){switch(r.label){case 0:return[4,handleFetch("/api/zonos-elements/create-paypal-order",{body:{checkoutSessionId:n,intent:a},method:"POST"})];case 1:e=r.sent(),t=e.errors,o=e.json;return[2,{errors:t,json:o}]}}))}))};var isContrastColor=function(r){var e=r.backgroundColor1,t=r.backgroundColor2;var o=tinycolor.readability(e,t);return o>2.5};var submitGtag=function(r){var e=zonosStore.checkoutSettings.analyticsProviders.find((function(r){return r.type==="GOOGLE_ANALYTICS"}));if(!e||(e===null||e===void 0?void 0:e.status)==="DISABLED"){return}if(typeof window.gtag==="function"){log("Zonos submits gtag event","log",r);window.gtag("event",r,{})}};var _c=createStore((function(){return{intent:"capture",orderIdCreated:null,paypalButtons:[],paypalClientId:"",paypalErrorMessage:null}})),paypalStoreReset=_c.reset,paypalStore=_c.state;var paypalStoreCreaterOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o,n,a,i,u;var c=r.checkoutSessionId;return __generator(this,(function(r){switch(r.label){case 0:o=paypalStore.intent.toUpperCase();return[4,paypalCreateOrder({checkoutSessionId:c,intent:o})];case 1:n=r.sent(),a=n.errors,i=n.json;u=(e=i===null||i===void 0?void 0:i.paypalOrderCreate)===null||e===void 0?void 0:e.paypalOrderId;if(a.length||!u){throw new Error(((t=a.find(Boolean))===null||t===void 0?void 0:t.message)||"An unexpected error occurred when creating paypal order.")}return[2,u]}}))}))};var paypalStoreCaptureOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o,n,a,i;var u=r.checkoutSessionId,c=r.paypalMockResponse;return __generator(this,(function(r){switch(r.label){case 0:return[4,paypalCaptureOrder({checkoutSessionId:u,paypalMockResponse:c})];case 1:o=r.sent(),n=o.errors,a=o.json;i=(e=a===null||a===void 0?void 0:a.paypalOrderCapture.order)===null||e===void 0?void 0:e.id;if(n.length||!i){throw new Error(((t=n.find(Boolean))===null||t===void 0?void 0:t.message)||translate("An unexpected error occurred when processing PayPal order."))}return[2,i]}}))}))};var paypalErrorHandler=function(r){var e=r.error;var t;var o=jsonParse(e.message);var n=(t=o===null||o===void 0?void 0:o.errors.find(Boolean))===null||t===void 0?void 0:t.message;var a=(n===null||n===void 0?void 0:n.match(/\[(.*?)\] (.*)/i))||[];if(!a){paypalStore.paypalErrorMessage=translate("An unexpected error occurred when processing PayPal order.")}var i=a[2]||translate("An unexpected error occurred when processing PayPal order.");paypalStore.paypalErrorMessage=i};var paypalButtonOptions=function(r){var e=r.checkoutSessionId,t=r.onPaypalFail,o=r.onPaypalSessionDone,n=r.overrideBorderRaidus,a=r.overridePrimaryColor;var i=a||zonosStore.appearance.colorPrimary;var u="#ffc33a";var c=isContrastColor({backgroundColor1:u,backgroundColor2:i||""});return{createOrder:function(){return __awaiter(void 0,void 0,void 0,(function(){var r,o,n,a,i;return __generator(this,(function(u){switch(u.label){case 0:void trackConversionEvent({checkoutSessionId:e,eventName:"checkout_paymentInfoCompleted",metadata:{paymentMethod:"paypal"}});return[4,validateCheckoutSession()];case 1:r=u.sent();if(!r.valid){paypalStore.paypalErrorMessage=r.errorMessage;stripeStore.hasPaymentError=false;stripeStore.customErrorMessage=null;t===null||t===void 0?void 0:t();return[2,""]}u.label=2;case 2:u.trys.push([2,8,,9]);paypalStore.paypalErrorMessage=null;cartStore.inventoryCheckErrorMessage=null;u.label=3;case 3:u.trys.push([3,5,,6]);o=cartStore;return[4,stripeStoreHandleInventoryCheck()];case 4:o.inventoryCheckErrorMessage=u.sent();return[3,6];case 5:n=u.sent();cartStore.inventoryCheckErrorMessage=translate("Unable to check inventory. Please try again.");return[3,6];case 6:if(cartStore.inventoryCheckErrorMessage){return[2,""]}return[4,paypalStoreCreaterOrder({checkoutSessionId:e})];case 7:a=u.sent();return[2,a];case 8:i=u.sent();logError("Failed to create paypal order",i);paypalStore.paypalErrorMessage=translate("Failed to create PayPal order. Please try again, or consider using an alternative method.");stripeStore.hasPaymentError=false;stripeStore.customErrorMessage=null;t===null||t===void 0?void 0:t();return[2,""];case 9:return[2]}}))}))},onApprove:function(r,n){return __awaiter(void 0,void 0,void 0,(function(){var r,n;return __generator(this,(function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);paypalStore.paypalErrorMessage=null;submitGtag("zonos-checkout-payment-info");return[4,paypalStoreCaptureOrder({checkoutSessionId:e,paypalMockResponse:window.Zonos._paypalMockResponse})];case 1:r=a.sent();paypalStore.orderIdCreated=r;o===null||o===void 0?void 0:o({orderId:r});cartStoreNextStep();cartStoreClearCheckoutInterval();return[3,3];case 2:n=a.sent();logError("==== Failed to capture paypal order",n);if(n instanceof Error){return[2,paypalErrorHandler({error:n})]}t===null||t===void 0?void 0:t();return[3,3];case 3:return[2]}}))}))},style:{borderRadius:n==="SHARP"?0:10,color:c?"gold":"blue",shape:"rect"}}};var paypalStoreResetButtons=function(){if(!paypalStore.paypalButtons.length){return}paypalStore.paypalButtons.forEach((function(r){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,r.close()];case 1:e.sent();return[2]}}))}))}));paypalStore.paypalButtons=[]};var paypalInitScript=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o,n,a,i;var u=r.currency;return __generator(this,(function(r){switch(r.label){case 0:t=!!((e=zonosStore.checkoutSettings.externalPaymentMethods)===null||e===void 0?void 0:e.find((function(r){return r.type==="PAYPAL"&&r.status==="ENABLED"})));if(!t){log("=== Paypal is disabled for this store","warn");return[2]}o=zonosStore.checkoutSettings.externalServiceTokens.find((function(r){return r.type==="PAYPAL_CLIENT_ID"}));if(!o){log("Failed to load paypal -- missing paypal publishable key","warn");return[2]}n=(!zonosStore.zonosMode||zonosStore.zonosMode==="production")&&zonosStore.checkoutSettings.mode==="LIVE"?"production":"sandbox";a=zonosStore.checkoutSettings.captureDelay&&zonosStore.checkoutSettings.captureDelay>0;paypalStore.intent=a?"authorize":"capture";log("==== Paypal order intent","info",paypalStore.intent);i=window.Zonos;return[4,loadScript({clientId:o.token,currency:u,environment:n,intent:paypalStore.intent})];case 1:i.paypal=r.sent();log("==== Paypal script loaded");return[2]}}))}))};var paypalStoreInitButtons=function(r){var e;var t=window.Zonos.paypal;if(!t){log("Paypal is not available");return null}var o=storageStore.checkoutSessionId;if(!o){log("Paypal is not available due to checkoutSessionId is not available");return null}log("==== Loading Paypal buttons");paypalStoreResetButtons();var n=[(e=t.FUNDING)===null||e===void 0?void 0:e.PAYPAL].filter(Boolean);paypalStore.paypalButtons=n.map((function(e){var n;var a=null;try{a=((n=t.Buttons)===null||n===void 0?void 0:n.call(t,Object.assign(Object.assign({},paypalButtonOptions(Object.assign({checkoutSessionId:o,fundingSource:e},r))),{fundingSource:e})))||null}catch(r){log("===== Failed to load paypal's \"".concat(e,'" button'),"warn",r)}if(a===null||a===void 0?void 0:a.isEligible()){log("==== Paypal button ".concat(e," loaded"));return a}return null})).filter(Boolean);return paypalStore.paypalButtons};var paypalStoreHasPaypalEnabled=function(){var r,e;var t=((e=(r=zonosStore.checkoutSettings.externalPaymentMethods)===null||r===void 0?void 0:r.find((function(r){return r.type==="PAYPAL"})))===null||e===void 0?void 0:e.status)==="ENABLED";return t||!!paypalStore.paypalButtons.length};export{paypalInitScript as a,paypalStore as b,paypalStoreReset as c,paypalStoreInitButtons as d,isContrastColor as i,paypalStoreHasPaypalEnabled as p,submitGtag as s};
|