@zonos/elements 1.3.223 → 1.3.225
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-bec00ea8.js +91 -0
- package/dist/cjs/{cart-3a2a062c.js → cart-af017ac3.js} +41 -40
- package/dist/cjs/{debounce-465a4328.js → debounce-2c9f3f1e.js} +1 -1
- package/dist/cjs/{getBorderRadius-1b5e33cf.js → getBorderRadius-c7d9f676.js} +1 -1
- package/dist/cjs/{handleFetch-45f35cac.js → handleFetch-954f30e1.js} +5 -82
- package/dist/cjs/index.cjs.js +40 -37
- package/dist/cjs/{isDarkColor-428965f4.js → isDarkColor-994c38e4.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{localization-12e7e934.js → localization-21030292.js} +82 -24
- package/dist/cjs/{paypal-a1377508.js → paypal-2b22f0f5.js} +17 -16
- package/dist/cjs/{placeTestOrder-6fcce33e.js → placeTestOrder-9cde1ca4.js} +3 -3
- package/dist/cjs/{renderFallback-39ba034b.js → renderFallback-9300dbaf.js} +8 -7
- package/dist/cjs/{translationStore-951ed4b4.js → translationStore-ce2c700d.js} +1 -1
- package/dist/cjs/{updateCheckoutSessionAttributes-c0853fdd.js → updateCheckoutSessionAttributes-a4899e90.js} +2 -2
- package/dist/cjs/zonos-address_11.cjs.entry.js +54 -33
- package/dist/cjs/zonos-badge.cjs.entry.js +2 -2
- package/dist/cjs/zonos-banner_2.cjs.entry.js +3 -3
- package/dist/cjs/zonos-button_3.cjs.entry.js +4 -4
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +25 -25
- package/dist/cjs/zonos-checkout.cjs.entry.js +68 -67
- package/dist/cjs/zonos-collapse.cjs.entry.js +2 -2
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +8 -8
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +19 -19
- package/dist/cjs/zonos-collect.cjs.entry.js +20 -20
- package/dist/cjs/zonos-confirm-dialog_2.cjs.entry.js +4 -4
- package/dist/cjs/zonos-controller.cjs.entry.js +40 -39
- package/dist/cjs/zonos-country-flag.cjs.entry.js +5 -5
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +6 -6
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +14 -14
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +5 -5
- package/dist/cjs/zonos-hello.cjs.entry.js +12 -12
- package/dist/cjs/zonos-input.cjs.entry.js +3 -3
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +5 -5
- package/dist/cjs/zonos-logo.cjs.entry.js +2 -2
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +3 -3
- package/dist/cjs/zonos-stripe-input.cjs.entry.js +5 -5
- package/dist/cjs/zonos-text.cjs.entry.js +2 -2
- package/dist/cjs/zonos-toggle.cjs.entry.js +2 -2
- package/dist/cjs/zonos-v-stack.cjs.entry.js +2 -2
- package/dist/cjs/{zonosStore-f8ee56aa.js → zonosStore-5d489c65.js} +8 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +4 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +1 -0
- package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.css +1 -0
- package/dist/collection/components/main/zonos-controller.js +1 -1
- package/dist/collection/components/store/hello/localization.js +12 -9
- package/dist/collection/components/store/zonosStore.js +8 -1
- package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +41 -18
- package/dist/collection/components/utils/api/getZonosSettings.js +2 -0
- package/dist/collection/components/utils/hello/currencyConversion/currencyDisplay.js +2 -0
- package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js +5 -0
- package/dist/collection/components/utils/logging/sendLoadCheckoutFacadeLog.js +1 -1
- package/dist/collection/components/utils/logging/sendLoadNativeCheckoutLog.js +1 -1
- package/dist/collection/scripts/_zonosBase.js +3 -0
- package/dist/collection/types/generated/graphql.internal.types.js +3 -0
- package/dist/collection/utils/performBlurCurrency.js +50 -0
- package/dist/esm/VarianceTest-572cecf5.js +86 -0
- package/dist/esm/{cart-7f06662c.js → cart-11b87221.js} +7 -6
- package/dist/esm/{debounce-c34d1270.js → debounce-f081e4d8.js} +1 -1
- package/dist/esm/{getBorderRadius-87593ff4.js → getBorderRadius-6281d902.js} +1 -1
- package/dist/esm/{handleFetch-99218189.js → handleFetch-a844cac1.js} +2 -76
- package/dist/esm/index.js +13 -9
- package/dist/esm/{isDarkColor-1f58b6be.js → isDarkColor-83e0c27e.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{localization-192886e4.js → localization-9320a65d.js} +71 -13
- package/dist/esm/{paypal-53f1b4a1.js → paypal-338a4350.js} +7 -6
- package/dist/esm/{placeTestOrder-95cbb623.js → placeTestOrder-d28f33c2.js} +3 -3
- package/dist/esm/{renderFallback-6352363c.js → renderFallback-28ef3364.js} +5 -4
- package/dist/esm/{translationStore-fb98a08d.js → translationStore-7eebaa41.js} +1 -1
- package/dist/esm/{updateCheckoutSessionAttributes-92f42882.js → updateCheckoutSessionAttributes-160720f6.js} +2 -2
- package/dist/esm/zonos-address_11.entry.js +47 -26
- package/dist/esm/zonos-badge.entry.js +2 -2
- package/dist/esm/zonos-banner_2.entry.js +3 -3
- package/dist/esm/zonos-button_3.entry.js +4 -4
- package/dist/esm/zonos-cart-items_12.entry.js +12 -12
- package/dist/esm/zonos-checkout.entry.js +15 -14
- package/dist/esm/zonos-collapse.entry.js +2 -2
- package/dist/esm/zonos-collect-cart-items_3.entry.js +8 -8
- package/dist/esm/zonos-collect-finish_6.entry.js +11 -11
- package/dist/esm/zonos-collect.entry.js +10 -10
- package/dist/esm/zonos-confirm-dialog_2.entry.js +4 -4
- package/dist/esm/zonos-controller.entry.js +10 -9
- package/dist/esm/zonos-country-flag.entry.js +5 -5
- package/dist/esm/zonos-country-select_4.entry.js +6 -6
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-empty-state-payment_4.entry.js +9 -9
- package/dist/esm/zonos-hello-dialog.entry.js +5 -5
- package/dist/esm/zonos-hello.entry.js +6 -6
- package/dist/esm/zonos-input.entry.js +3 -3
- package/dist/esm/zonos-language-select_2.entry.js +5 -5
- package/dist/esm/zonos-logo.entry.js +2 -2
- package/dist/esm/zonos-shipping-rich-radio.entry.js +3 -3
- package/dist/esm/zonos-stripe-input.entry.js +5 -5
- package/dist/esm/zonos-text.entry.js +2 -2
- package/dist/esm/zonos-toggle.entry.js +2 -2
- package/dist/esm/zonos-v-stack.entry.js +2 -2
- package/dist/esm/{zonosStore-c456b933.js → zonosStore-e3d0493a.js} +8 -2
- package/dist/esm-es5/VarianceTest-572cecf5.js +1 -0
- package/dist/esm-es5/cart-11b87221.js +1 -0
- package/dist/esm-es5/{debounce-c34d1270.js → debounce-f081e4d8.js} +1 -1
- package/dist/esm-es5/{getBorderRadius-87593ff4.js → getBorderRadius-6281d902.js} +1 -1
- package/dist/esm-es5/handleFetch-a844cac1.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{isDarkColor-1f58b6be.js → isDarkColor-83e0c27e.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/localization-9320a65d.js +1 -0
- package/dist/esm-es5/{paypal-53f1b4a1.js → paypal-338a4350.js} +2 -2
- package/dist/esm-es5/{placeTestOrder-95cbb623.js → placeTestOrder-d28f33c2.js} +1 -1
- package/dist/esm-es5/renderFallback-28ef3364.js +1 -0
- package/dist/esm-es5/{translationStore-fb98a08d.js → translationStore-7eebaa41.js} +1 -1
- package/dist/esm-es5/{updateCheckoutSessionAttributes-92f42882.js → updateCheckoutSessionAttributes-160720f6.js} +1 -1
- 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_2.entry.js +1 -1
- package/dist/esm-es5/zonos-button_3.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
- 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-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 +1 -1
- package/dist/esm-es5/zonos-confirm-dialog_2.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-v-stack.entry.js +1 -1
- package/dist/esm-es5/zonosStore-e3d0493a.js +1 -0
- package/dist/scripts/blurCurrencyOnInit.js +1 -0
- package/dist/scripts/index.d.ts +38 -6
- 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/stripe/zonos-link-authentication/zonos-link-authentication.d.ts +1 -0
- package/dist/types/scripts/_zonosBase.d.ts +8 -3
- package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +7 -3
- package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +2 -2
- package/dist/types/types/generated/graphql.internal.types.d.ts +13 -2
- package/dist/types/types/generated/graphql.internal.types.ts +13 -2
- package/dist/types/types/global.d.ts +8 -0
- package/dist/types/types/utils/ZonosSettings.d.ts +8 -2
- package/dist/types/utils/performBlurCurrency.d.ts +2 -0
- package/dist/zonos-elements/base.css +1 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-01174496.system.js +1 -0
- package/dist/zonos-elements/p-0260fd13.js +1 -0
- package/dist/zonos-elements/{p-e970f2aa.system.entry.js → p-04c1dc63.system.entry.js} +1 -1
- package/dist/zonos-elements/p-0a377722.js +1 -0
- package/dist/zonos-elements/p-0a92e3fd.entry.js +1 -0
- package/dist/zonos-elements/{p-8350937d.system.entry.js → p-0b6a3a09.system.entry.js} +1 -1
- package/dist/zonos-elements/p-0d82e1fd.entry.js +1 -0
- package/dist/zonos-elements/{p-a7485913.system.js → p-0ec82d78.system.js} +2 -2
- package/dist/zonos-elements/{p-2b9c124d.js → p-0ffd710e.js} +1 -1
- package/dist/zonos-elements/p-112c6453.system.js +1 -0
- package/dist/zonos-elements/{p-62fa680d.system.js → p-182da73f.system.js} +1 -1
- package/dist/zonos-elements/p-1868a283.entry.js +1 -0
- package/dist/zonos-elements/{p-ba18c5f5.system.entry.js → p-1a67ae71.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-520bd291.system.entry.js → p-1b9cc0e2.system.entry.js} +1 -1
- package/dist/zonos-elements/p-1c5ba523.js +1 -0
- package/dist/zonos-elements/p-1ef793d0.entry.js +1 -0
- package/dist/zonos-elements/{p-0ed63ce0.system.js → p-23c46dfa.system.js} +1 -1
- package/dist/zonos-elements/{p-e7f8595f.system.js → p-24e26a2c.system.js} +1 -1
- package/dist/zonos-elements/p-252fa1da.entry.js +1 -0
- package/dist/zonos-elements/{p-53b46925.entry.js → p-2616ba72.entry.js} +1 -1
- package/dist/zonos-elements/p-2657f099.system.entry.js +1 -0
- package/dist/zonos-elements/{p-7d2d2c94.entry.js → p-2dc38ef3.entry.js} +1 -1
- package/dist/zonos-elements/{p-12ce9746.system.entry.js → p-360d7101.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-19f25feb.system.entry.js → p-375994d1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-ee6f8c02.system.entry.js → p-38f42f10.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4637f365.system.entry.js → p-4004c838.system.entry.js} +1 -1
- package/dist/zonos-elements/p-41dd1cb8.js +1 -0
- package/dist/zonos-elements/{p-e63b8b24.system.js → p-433d76b4.system.js} +1 -1
- package/dist/zonos-elements/{p-a77ed1b9.entry.js → p-4523b982.entry.js} +1 -1
- package/dist/zonos-elements/{p-fc27467b.entry.js → p-4ce3489a.entry.js} +1 -1
- package/dist/zonos-elements/{p-a61a9b65.system.entry.js → p-4da7b6a8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-7b56e345.js → p-4dfe97ad.js} +2 -2
- package/dist/zonos-elements/{p-cd1ebef9.system.js → p-57413c34.system.js} +1 -1
- package/dist/zonos-elements/p-5c43ecdf.system.entry.js +1 -0
- package/dist/zonos-elements/{p-9fdd3264.system.entry.js → p-5f7a9b69.system.entry.js} +1 -1
- package/dist/zonos-elements/p-6092af05.entry.js +1 -0
- package/dist/zonos-elements/{p-9b062dfb.entry.js → p-67787bd4.entry.js} +1 -1
- package/dist/zonos-elements/{p-7c4e7651.entry.js → p-6bab9096.entry.js} +1 -1
- package/dist/zonos-elements/p-6d423364.entry.js +1 -0
- package/dist/zonos-elements/p-725605f6.system.js +1 -0
- package/dist/zonos-elements/p-7af39c98.js +1 -0
- package/dist/zonos-elements/{p-7f7abdf2.system.entry.js → p-7cee0e68.system.entry.js} +1 -1
- package/dist/zonos-elements/p-7eb8e2d4.js +1 -0
- package/dist/zonos-elements/p-81b357f7.system.js +1 -1
- package/dist/zonos-elements/p-820ad058.js +1 -0
- package/dist/zonos-elements/{p-5e3d2bd2.system.entry.js → p-873b6185.system.entry.js} +1 -1
- package/dist/zonos-elements/p-89c5164b.system.js +1 -0
- package/dist/zonos-elements/p-9a09dad4.entry.js +1 -0
- package/dist/zonos-elements/{p-245f6ad4.system.entry.js → p-9e03a145.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-0ae53ff0.js → p-a199bb13.js} +1 -1
- package/dist/zonos-elements/p-ae3e4f2b.entry.js +1 -0
- package/dist/zonos-elements/{p-567f7de7.entry.js → p-b4bf2f03.entry.js} +1 -1
- package/dist/zonos-elements/p-b5b3f908.system.js +1 -0
- package/dist/zonos-elements/{p-a5b0a636.entry.js → p-b658c28a.entry.js} +1 -1
- package/dist/zonos-elements/{p-de626806.system.entry.js → p-b6ef4a5e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4f8563ad.system.entry.js → p-b91df44b.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e8accbef.system.entry.js → p-ba334962.system.entry.js} +1 -1
- package/dist/zonos-elements/p-bccd49d7.system.entry.js +1 -0
- package/dist/zonos-elements/p-bdeb20cb.js +1 -0
- package/dist/zonos-elements/{p-a95d2034.system.entry.js → p-bfc0fc85.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c4b3c878.entry.js → p-c81f6387.entry.js} +1 -1
- package/dist/zonos-elements/{p-efa6203f.entry.js → p-c998e4ed.entry.js} +1 -1
- package/dist/zonos-elements/{p-9396059b.entry.js → p-cb0e6468.entry.js} +1 -1
- package/dist/zonos-elements/{p-421dfb66.system.entry.js → p-cb11d11b.system.entry.js} +1 -1
- package/dist/zonos-elements/p-cc599cd9.entry.js +1 -0
- package/dist/zonos-elements/{p-14f9bc8c.entry.js → p-d2f7ea09.entry.js} +1 -1
- package/dist/zonos-elements/{p-0c0fda23.js → p-d42b5113.js} +1 -1
- package/dist/zonos-elements/{p-00423fa0.system.js → p-d531b524.system.js} +1 -1
- package/dist/zonos-elements/p-d938f42f.system.js +1 -0
- package/dist/zonos-elements/{p-f4fa8720.entry.js → p-d96545ae.entry.js} +1 -1
- package/dist/zonos-elements/{p-eb6a35ce.system.entry.js → p-dc56b469.system.entry.js} +1 -1
- package/dist/zonos-elements/p-dde6f7fd.system.entry.js +1 -0
- package/dist/zonos-elements/{p-45d288d0.system.entry.js → p-e00e5d64.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8194fcd8.entry.js → p-e60b988c.entry.js} +1 -1
- package/dist/zonos-elements/{p-56e0ed65.js → p-e688e493.js} +1 -1
- package/dist/zonos-elements/p-e9ecb07e.system.js +1 -0
- package/dist/zonos-elements/{p-295d9c07.system.entry.js → p-f548807d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e7b05da2.entry.js → p-f912e9c3.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.css +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +4 -3
- package/dist/cjs/VarianceTest-0cb1e118.js +0 -12
- package/dist/esm/VarianceTest-fef2d958.js +0 -10
- package/dist/esm-es5/VarianceTest-fef2d958.js +0 -1
- package/dist/esm-es5/cart-7f06662c.js +0 -1
- package/dist/esm-es5/handleFetch-99218189.js +0 -1
- package/dist/esm-es5/localization-192886e4.js +0 -1
- package/dist/esm-es5/renderFallback-6352363c.js +0 -1
- package/dist/esm-es5/zonosStore-c456b933.js +0 -1
- package/dist/zonos-elements/p-04a01cb1.js +0 -1
- package/dist/zonos-elements/p-062430f9.system.js +0 -1
- package/dist/zonos-elements/p-0e28207a.js +0 -1
- package/dist/zonos-elements/p-1cd1da90.system.js +0 -1
- package/dist/zonos-elements/p-2131fa8b.entry.js +0 -1
- package/dist/zonos-elements/p-30432622.system.entry.js +0 -1
- package/dist/zonos-elements/p-366ea017.entry.js +0 -1
- package/dist/zonos-elements/p-3f3c92db.system.entry.js +0 -1
- package/dist/zonos-elements/p-4a3abbf2.js +0 -1
- package/dist/zonos-elements/p-4d9ad3b1.system.entry.js +0 -1
- package/dist/zonos-elements/p-4dcbbd60.js +0 -1
- package/dist/zonos-elements/p-5a2dd041.system.js +0 -1
- package/dist/zonos-elements/p-640a6898.system.js +0 -1
- package/dist/zonos-elements/p-6afbbe66.entry.js +0 -1
- package/dist/zonos-elements/p-6cfe66fe.entry.js +0 -1
- package/dist/zonos-elements/p-6f6573a5.system.js +0 -1
- package/dist/zonos-elements/p-7ce093aa.js +0 -1
- package/dist/zonos-elements/p-9d863a3b.system.js +0 -1
- package/dist/zonos-elements/p-a435931e.system.entry.js +0 -1
- package/dist/zonos-elements/p-a8a312b2.js +0 -1
- package/dist/zonos-elements/p-a9b3cfe1.entry.js +0 -1
- package/dist/zonos-elements/p-abcefd25.entry.js +0 -1
- package/dist/zonos-elements/p-b76db2ac.js +0 -1
- package/dist/zonos-elements/p-bbf48b31.entry.js +0 -1
- package/dist/zonos-elements/p-bdf183a3.entry.js +0 -1
- package/dist/zonos-elements/p-d1b415cd.entry.js +0 -1
- package/dist/zonos-elements/p-d2098bef.entry.js +0 -1
- package/dist/zonos-elements/p-da200c19.system.js +0 -1
- package/dist/zonos-elements/p-df0cbde4.js +0 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const startTime = performance.now();
|
|
4
|
+
const allLogs = [];
|
|
5
|
+
const getElapsedTime = () => {
|
|
6
|
+
const elapsedTime = performance.now() - startTime;
|
|
7
|
+
const elapsedTimePretty =
|
|
8
|
+
// format the time to seconds if over 1 second
|
|
9
|
+
elapsedTime > 1000
|
|
10
|
+
? `${(elapsedTime / 1000).toFixed(2)}s`
|
|
11
|
+
: `${elapsedTime.toFixed(2)}ms`;
|
|
12
|
+
return { elapsedTime, elapsedTimePretty };
|
|
13
|
+
};
|
|
14
|
+
const prepInfo = (info) => {
|
|
15
|
+
if (typeof info === 'string') {
|
|
16
|
+
return info;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const infoToJson = JSON.stringify(info);
|
|
20
|
+
return infoToJson;
|
|
21
|
+
}
|
|
22
|
+
catch (_a) {
|
|
23
|
+
if (info && typeof info.toString === 'function') {
|
|
24
|
+
const infoToString = info.toString();
|
|
25
|
+
return infoToString;
|
|
26
|
+
}
|
|
27
|
+
return 'Unable to stringify info';
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const log = (message, type, ..._additionalInfo) => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
const { elapsedTimePretty } = getElapsedTime();
|
|
33
|
+
const additionalInfo = [`(${elapsedTimePretty})`, ..._additionalInfo];
|
|
34
|
+
const preppedInfo = additionalInfo.map(prepInfo).join(' ');
|
|
35
|
+
allLogs.push([type, message, preppedInfo].filter(Boolean).join(' '));
|
|
36
|
+
const isDebug = !!((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.debug) ||
|
|
37
|
+
!!window.location.search.match(/\?.*(&*)zonosDebug=1/);
|
|
38
|
+
// if debug is false, do not log
|
|
39
|
+
if (!isDebug) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
let loggingIframe = document.querySelector('iframe#zonos---debug-logging-iframe');
|
|
43
|
+
if (!loggingIframe) {
|
|
44
|
+
// add a hidden iframe
|
|
45
|
+
loggingIframe = document.createElement('iframe');
|
|
46
|
+
loggingIframe.id = 'zonos---debug-logging-iframe';
|
|
47
|
+
loggingIframe.style.display = 'none';
|
|
48
|
+
loggingIframe.style.opacity = '0';
|
|
49
|
+
loggingIframe.style.position = 'absolute';
|
|
50
|
+
loggingIframe.style.top = '-9999px';
|
|
51
|
+
loggingIframe.style.left = '-9999px';
|
|
52
|
+
loggingIframe.style.width = '1px';
|
|
53
|
+
loggingIframe.style.height = '1px';
|
|
54
|
+
loggingIframe.style.border = 'none';
|
|
55
|
+
loggingIframe.style.overflow = 'hidden';
|
|
56
|
+
loggingIframe.style.visibility = 'hidden';
|
|
57
|
+
document.body.appendChild(loggingIframe);
|
|
58
|
+
}
|
|
59
|
+
// use the logging iframe's console to log just in case the console is disabled (overridden) by the site owner
|
|
60
|
+
const zConsole = ((_b = loggingIframe.contentWindow) === null || _b === void 0 ? void 0 : _b.window.console) || window.console;
|
|
61
|
+
switch (type) {
|
|
62
|
+
case 'warn':
|
|
63
|
+
zConsole.warn(message, ...additionalInfo);
|
|
64
|
+
break;
|
|
65
|
+
case 'info':
|
|
66
|
+
zConsole.info(message, ...additionalInfo);
|
|
67
|
+
break;
|
|
68
|
+
case 'error':
|
|
69
|
+
zConsole.error(message, ...additionalInfo);
|
|
70
|
+
break;
|
|
71
|
+
default:
|
|
72
|
+
zConsole.groupCollapsed(message, ...additionalInfo);
|
|
73
|
+
zConsole.trace();
|
|
74
|
+
zConsole.groupEnd();
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const availableTestKeys = {
|
|
80
|
+
hosted_vs_native: {
|
|
81
|
+
availableVariants: ['hosted', 'native'],
|
|
82
|
+
},
|
|
83
|
+
test_A_B: {
|
|
84
|
+
availableVariants: ['A', 'B'],
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
exports.allLogs = allLogs;
|
|
89
|
+
exports.availableTestKeys = availableTestKeys;
|
|
90
|
+
exports.getElapsedTime = getElapsedTime;
|
|
91
|
+
exports.log = log;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const zonosStore = require('./zonosStore-
|
|
4
|
-
const localization = require('./localization-
|
|
5
|
-
const translationStore = require('./translationStore-
|
|
6
|
-
const handleFetch = require('./handleFetch-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
3
|
+
const zonosStore = require('./zonosStore-5d489c65.js');
|
|
4
|
+
const localization = require('./localization-21030292.js');
|
|
5
|
+
const translationStore = require('./translationStore-ce2c700d.js');
|
|
6
|
+
const handleFetch = require('./handleFetch-954f30e1.js');
|
|
7
|
+
const VarianceTest = require('./VarianceTest-bec00ea8.js');
|
|
8
|
+
const isDarkColor = require('./isDarkColor-994c38e4.js');
|
|
9
|
+
const getBorderRadius = require('./getBorderRadius-c7d9f676.js');
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Extract first name and last name from the name string
|
|
@@ -134,7 +135,7 @@ const prepCalculateLandedCost = () => {
|
|
|
134
135
|
const stripeBillingAddressData = stripeStore.stripeShippingSameAsBilling
|
|
135
136
|
? stripeStore.stripeAddressEventData
|
|
136
137
|
: stripeStore.stripeBillingAddressEventData;
|
|
137
|
-
|
|
138
|
+
VarianceTest.log({ stripeAddressData, stripeBillingAddressData }, 'info');
|
|
138
139
|
if (!stripeAddressData || !stripeBillingAddressData) {
|
|
139
140
|
throw new Error('Missing stripe address data');
|
|
140
141
|
}
|
|
@@ -354,7 +355,7 @@ const trackConversionEvent = async ({ checkoutSessionId, eventName, metadata, })
|
|
|
354
355
|
endpoint: 'trackConversionEventMetric',
|
|
355
356
|
errors: [`Event "${eventName}" - No checkout session id found`],
|
|
356
357
|
metadata: {
|
|
357
|
-
allLogs:
|
|
358
|
+
allLogs: VarianceTest.allLogs,
|
|
358
359
|
checkoutSessionId,
|
|
359
360
|
eventName,
|
|
360
361
|
metadata,
|
|
@@ -370,7 +371,7 @@ const trackConversionEvent = async ({ checkoutSessionId, eventName, metadata, })
|
|
|
370
371
|
endpoint: 'trackConversionEventMetric',
|
|
371
372
|
errors: [`Event "${eventName}" - No organization id found`],
|
|
372
373
|
metadata: {
|
|
373
|
-
allLogs:
|
|
374
|
+
allLogs: VarianceTest.allLogs,
|
|
374
375
|
checkoutSessionId,
|
|
375
376
|
eventName,
|
|
376
377
|
metadata,
|
|
@@ -530,7 +531,7 @@ const validateCheckoutSession = async () => {
|
|
|
530
531
|
void handleFetch.sendErrorLog({
|
|
531
532
|
endpoint: 'validateCheckoutSession',
|
|
532
533
|
errors: errors.map(error => error.message),
|
|
533
|
-
metadata: { allLogs:
|
|
534
|
+
metadata: { allLogs: VarianceTest.allLogs },
|
|
534
535
|
});
|
|
535
536
|
return {
|
|
536
537
|
errorMessage: translationStore.translate('Unable to retrieve the checkout session at the moment. Please try again or contact our support team.'),
|
|
@@ -543,7 +544,7 @@ const validateCheckoutSession = async () => {
|
|
|
543
544
|
void handleFetch.sendErrorLog({
|
|
544
545
|
endpoint: 'validateCheckoutSession',
|
|
545
546
|
errors: ['No landed cost found before confirming payment'],
|
|
546
|
-
metadata: { allLogs:
|
|
547
|
+
metadata: { allLogs: VarianceTest.allLogs },
|
|
547
548
|
});
|
|
548
549
|
return {
|
|
549
550
|
errorMessage: translationStore.translate('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),
|
|
@@ -740,7 +741,7 @@ const initStripeElements = async (props) => {
|
|
|
740
741
|
var _a, _b;
|
|
741
742
|
const clientSecret = stripeStore.clientSecret;
|
|
742
743
|
if (!stripeStore.stripe) {
|
|
743
|
-
|
|
744
|
+
VarianceTest.log('Skip. Stripe is not initialized');
|
|
744
745
|
return;
|
|
745
746
|
}
|
|
746
747
|
const stripeOptions = getStripeOptions({
|
|
@@ -759,12 +760,12 @@ const initStripeElements = async (props) => {
|
|
|
759
760
|
// init stripe elements for billing address
|
|
760
761
|
stripeStore.stripeElementsForBillingAddress =
|
|
761
762
|
(_a = stripeStore.stripe) === null || _a === void 0 ? void 0 : _a.elements(stripeOptions);
|
|
762
|
-
|
|
763
|
+
VarianceTest.log('Stripe elements for billing address initialized');
|
|
763
764
|
// init stripe elements if it doesn't exist
|
|
764
765
|
stripeStore.stripeElements = (_b = stripeStore.stripe) === null || _b === void 0 ? void 0 : _b.elements(stripeOptions);
|
|
765
766
|
// save stripe elements options for later comparison
|
|
766
767
|
stripeStore.stripeElementsOptions = stripeOptions;
|
|
767
|
-
|
|
768
|
+
VarianceTest.log('Stripe elements initialized');
|
|
768
769
|
return;
|
|
769
770
|
}
|
|
770
771
|
if (!isSameOptions) {
|
|
@@ -776,7 +777,7 @@ const initStripeElements = async (props) => {
|
|
|
776
777
|
stripeStore.stripeElementsOptions = stripeOptions;
|
|
777
778
|
void stripeStore.stripeElements.fetchUpdates();
|
|
778
779
|
}
|
|
779
|
-
|
|
780
|
+
VarianceTest.log('Stripe elements updated');
|
|
780
781
|
};
|
|
781
782
|
const stripeStoreReset = () => {
|
|
782
783
|
// clean clientSecret so that we can start the new one.
|
|
@@ -821,7 +822,7 @@ const stripeStoreBuildAddressForPartyCreate = ({ address, firstName, lastName, n
|
|
|
821
822
|
endpoint: 'PARTY_CREATE_NO_NAME_FOUND',
|
|
822
823
|
errors: ['No name found'],
|
|
823
824
|
metadata: {
|
|
824
|
-
allLogs:
|
|
825
|
+
allLogs: VarianceTest.allLogs,
|
|
825
826
|
cartId: window.Zonos.cartId,
|
|
826
827
|
checkoutSessionId: localization.storageStore.checkoutSessionId,
|
|
827
828
|
firstName,
|
|
@@ -835,7 +836,7 @@ const stripeStoreBuildAddressForPartyCreate = ({ address, firstName, lastName, n
|
|
|
835
836
|
endpoint: 'PARTY_CREATE_NO_PHONE_FOUND',
|
|
836
837
|
errors: ['No phone found'],
|
|
837
838
|
metadata: {
|
|
838
|
-
allLogs:
|
|
839
|
+
allLogs: VarianceTest.allLogs,
|
|
839
840
|
cartId: window.Zonos.cartId,
|
|
840
841
|
checkoutSessionId: localization.storageStore.checkoutSessionId,
|
|
841
842
|
phone,
|
|
@@ -877,7 +878,7 @@ const stripeStoreAsyncAddressUpdate = async () => {
|
|
|
877
878
|
endpoint: 'PF_NO_SELECTED_LANDED_COST',
|
|
878
879
|
errors: ['No selected landed cost'],
|
|
879
880
|
metadata: {
|
|
880
|
-
allLogs:
|
|
881
|
+
allLogs: VarianceTest.allLogs,
|
|
881
882
|
cartId: window.Zonos.cartId,
|
|
882
883
|
checkoutSessionId: localization.storageStore.checkoutSessionId,
|
|
883
884
|
},
|
|
@@ -927,7 +928,7 @@ const stripeStoreAsyncAddressUpdate = async () => {
|
|
|
927
928
|
endpoint: 'PF_PARTY_CREATE_FAILED',
|
|
928
929
|
errors: ['Failed to create parties'],
|
|
929
930
|
metadata: {
|
|
930
|
-
allLogs:
|
|
931
|
+
allLogs: VarianceTest.allLogs,
|
|
931
932
|
cartId: window.Zonos.cartId,
|
|
932
933
|
checkoutSessionId: localization.storageStore.checkoutSessionId,
|
|
933
934
|
errors,
|
|
@@ -982,7 +983,7 @@ const isPrefetchInfoOutdated = () => {
|
|
|
982
983
|
((_a = cartStore.landedCostData.find(Boolean)) === null || _a === void 0 ? void 0 : _a.subtotals.items) !==
|
|
983
984
|
cartStore.subtotal;
|
|
984
985
|
const isAddressOutdated = checkIsAddressOutdatedForLCPrefetch();
|
|
985
|
-
|
|
986
|
+
VarianceTest.log('isPrefetchInfoOutdated', 'info', {
|
|
986
987
|
isAddressOutdated,
|
|
987
988
|
});
|
|
988
989
|
return (
|
|
@@ -1426,7 +1427,7 @@ const stripeStoreConfirmPayment = async (props) => {
|
|
|
1426
1427
|
elements: stripeElements,
|
|
1427
1428
|
redirect: 'if_required',
|
|
1428
1429
|
});
|
|
1429
|
-
|
|
1430
|
+
VarianceTest.log('Payment intent confirmed', 'info', { error, paymentIntent });
|
|
1430
1431
|
if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === 'requires_action') {
|
|
1431
1432
|
throw new Error(translationStore.translate('Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.'));
|
|
1432
1433
|
}
|
|
@@ -1480,7 +1481,7 @@ const stripeStoreGetPaymentIntent = async () => {
|
|
|
1480
1481
|
endpoint: 'Error creating payment intent',
|
|
1481
1482
|
errors: ['No checkout session id found when retrieving payment intent'],
|
|
1482
1483
|
metadata: {
|
|
1483
|
-
allLogs:
|
|
1484
|
+
allLogs: VarianceTest.allLogs,
|
|
1484
1485
|
cartId: window.Zonos.cartId,
|
|
1485
1486
|
},
|
|
1486
1487
|
});
|
|
@@ -1506,7 +1507,7 @@ const stripeStoreGetPaymentIntent = async () => {
|
|
|
1506
1507
|
endpoint: 'Error creating payment intent',
|
|
1507
1508
|
errors: errors.map(error => error.message),
|
|
1508
1509
|
metadata: {
|
|
1509
|
-
allLogs:
|
|
1510
|
+
allLogs: VarianceTest.allLogs,
|
|
1510
1511
|
cartId: window.Zonos.cartId,
|
|
1511
1512
|
checkoutSessionId: localization.storageStore.checkoutSessionId,
|
|
1512
1513
|
clientSecret,
|
|
@@ -1535,7 +1536,7 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
1535
1536
|
}
|
|
1536
1537
|
stripeStore.isFetchingSession = true;
|
|
1537
1538
|
const body = getCheckoutSessionBody();
|
|
1538
|
-
|
|
1539
|
+
VarianceTest.log('Checkout session body', 'info', body);
|
|
1539
1540
|
const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/create-checkout-session', {
|
|
1540
1541
|
body,
|
|
1541
1542
|
method: 'POST',
|
|
@@ -1558,8 +1559,8 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
1558
1559
|
method: ((_b = result.landedCost) === null || _b === void 0 ? void 0 : _b.method) || 'DDP',
|
|
1559
1560
|
subtotals: result.subtotals,
|
|
1560
1561
|
});
|
|
1561
|
-
|
|
1562
|
-
|
|
1562
|
+
VarianceTest.log('Exchange rate updated for cart items (checkout session create)', 'info', cartStore.exchangeRate);
|
|
1563
|
+
VarianceTest.log('done-init-checkout-session');
|
|
1563
1564
|
return true;
|
|
1564
1565
|
};
|
|
1565
1566
|
const stripeStoreUpdateCheckoutSessionBaseCurrency = async () => {
|
|
@@ -1571,7 +1572,7 @@ const stripeStoreUpdateCheckoutSessionBaseCurrency = async () => {
|
|
|
1571
1572
|
}
|
|
1572
1573
|
// Only update checkout session currency if setting is enabled
|
|
1573
1574
|
if (zonosStore.zonosStore.checkoutSettings.allowedSettlementCurrencies === 'LOCAL') {
|
|
1574
|
-
|
|
1575
|
+
VarianceTest.log('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency');
|
|
1575
1576
|
return true;
|
|
1576
1577
|
}
|
|
1577
1578
|
const { json } = await handleFetch.handleFetch('/api/zonos-elements/update-checkout-session-base-currency', {
|
|
@@ -1588,7 +1589,7 @@ const stripeStoreUpdateCheckoutSessionBaseCurrency = async () => {
|
|
|
1588
1589
|
handleFetch.logError('Failed to update checkout session base currency');
|
|
1589
1590
|
return false;
|
|
1590
1591
|
}
|
|
1591
|
-
|
|
1592
|
+
VarianceTest.log(`Updated checkout session to settlement currency "${settlementCurrencyCode}".`);
|
|
1592
1593
|
return true;
|
|
1593
1594
|
};
|
|
1594
1595
|
/**
|
|
@@ -1862,7 +1863,7 @@ const getMatchItem = ({ item1, item2, }) => {
|
|
|
1862
1863
|
* Check and set restricted items in cart
|
|
1863
1864
|
*/
|
|
1864
1865
|
const cartStoreCheckItemRestrictions = (itemsWorkflow) => {
|
|
1865
|
-
|
|
1866
|
+
VarianceTest.log('Checking item restrictions');
|
|
1866
1867
|
const mappedRestrictedItems = itemsWorkflow
|
|
1867
1868
|
.map(item => {
|
|
1868
1869
|
if (!item.restriction) {
|
|
@@ -1930,7 +1931,7 @@ const cartStoreSetCheckoutSession = (checkoutSession) => {
|
|
|
1930
1931
|
endpoint: 'cartStoreSetCheckoutSession',
|
|
1931
1932
|
errors: ['Missing checkout session id in checkout session'],
|
|
1932
1933
|
metadata: {
|
|
1933
|
-
allLogs:
|
|
1934
|
+
allLogs: VarianceTest.allLogs,
|
|
1934
1935
|
checkoutSession,
|
|
1935
1936
|
},
|
|
1936
1937
|
});
|
|
@@ -1949,7 +1950,7 @@ const cartStoreSetCheckoutSession = (checkoutSession) => {
|
|
|
1949
1950
|
(_e = (_d = window.Zonos.cartData) === null || _d === void 0 ? void 0 : _d.metadata.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'externalConfirmationPageURL')) === null || _e === void 0 ? void 0 : _e.value) ||
|
|
1950
1951
|
null;
|
|
1951
1952
|
if (externalConfirmationPageURL) {
|
|
1952
|
-
|
|
1953
|
+
VarianceTest.log(`Found externalConfirmationPageURL: ${externalConfirmationPageURL}`);
|
|
1953
1954
|
cartStore.externalConfirmationPageURL = externalConfirmationPageURL;
|
|
1954
1955
|
}
|
|
1955
1956
|
};
|
|
@@ -1963,11 +1964,11 @@ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency,
|
|
|
1963
1964
|
method: cartStore.landedCostMethod,
|
|
1964
1965
|
subtotals,
|
|
1965
1966
|
});
|
|
1966
|
-
|
|
1967
|
+
VarianceTest.log('Exchange rate updated for cart items (landed cost subtotal)', 'info', cartStore.exchangeRate);
|
|
1967
1968
|
}
|
|
1968
1969
|
// update checkout session
|
|
1969
1970
|
if (!localization.storageStore.checkoutSessionId) {
|
|
1970
|
-
|
|
1971
|
+
VarianceTest.log('Could not update cart total without checkout session id', 'info');
|
|
1971
1972
|
return false;
|
|
1972
1973
|
}
|
|
1973
1974
|
const { errors, json } = await stripeStoreUpdateCheckoutSession({
|
|
@@ -1985,9 +1986,9 @@ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency,
|
|
|
1985
1986
|
if (errors.length > 0 || !json) {
|
|
1986
1987
|
handleFetch.logError('Error occurs when updating checkout session.');
|
|
1987
1988
|
if (shouldInitSessionOnFailure) {
|
|
1988
|
-
|
|
1989
|
+
VarianceTest.log('Initiating checkout session on failure', 'info');
|
|
1989
1990
|
const success = await stripeStoreInitCheckoutSession();
|
|
1990
|
-
|
|
1991
|
+
VarianceTest.log(`stripeStoreInitCheckoutSession: ${success}`);
|
|
1991
1992
|
if (!success) {
|
|
1992
1993
|
cartStoreUpdateToErrorState({
|
|
1993
1994
|
messages: [
|
|
@@ -2008,7 +2009,7 @@ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency,
|
|
|
2008
2009
|
method: ((_a = json.checkoutSessionUpdate.landedCost) === null || _a === void 0 ? void 0 : _a.method) || 'DDP',
|
|
2009
2010
|
subtotals: json.checkoutSessionUpdate.subtotals,
|
|
2010
2011
|
});
|
|
2011
|
-
|
|
2012
|
+
VarianceTest.log('Exchange rate updated for cart items (checkout session update)', 'info', cartStore.exchangeRate);
|
|
2012
2013
|
}
|
|
2013
2014
|
cartStoreSetCheckoutSession(json.checkoutSessionUpdate);
|
|
2014
2015
|
return true;
|
|
@@ -2032,7 +2033,7 @@ const cartStoreGetMethod = (landedCost) => {
|
|
|
2032
2033
|
};
|
|
2033
2034
|
const cartStoreUpdateSelectedShippingOption = async ({ applySubtotalsOnly, landedCostId, selectedShippingOption, }) => {
|
|
2034
2035
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
2035
|
-
|
|
2036
|
+
VarianceTest.log('Updating selected shipping option', 'info', {
|
|
2036
2037
|
landedCostId,
|
|
2037
2038
|
selectedShippingOption,
|
|
2038
2039
|
});
|
|
@@ -2059,7 +2060,7 @@ const cartStoreUpdateSelectedShippingOption = async ({ applySubtotalsOnly, lande
|
|
|
2059
2060
|
const exchangeRate = selectedLandedCost.subtotals.exchangeRate.rate;
|
|
2060
2061
|
const dutiesTaxesFeesEstimate = landedCostAmount * exchangeRate;
|
|
2061
2062
|
if (dutiesTaxesFeesEstimate) {
|
|
2062
|
-
|
|
2063
|
+
VarianceTest.log(`DAP quote, using estimate: ${dutiesTaxesFeesEstimate}`, 'info');
|
|
2063
2064
|
}
|
|
2064
2065
|
cartStore.landedCostMethod = cartStoreGetMethod(selectedLandedCost.landedCost);
|
|
2065
2066
|
// update shipping value and dutiesTaxFees on selectedShippingOption change
|
|
@@ -2082,7 +2083,7 @@ const cartStoreUpdateSelectedShippingOption = async ({ applySubtotalsOnly, lande
|
|
|
2082
2083
|
method: cartStore.landedCostMethod,
|
|
2083
2084
|
subtotals,
|
|
2084
2085
|
});
|
|
2085
|
-
|
|
2086
|
+
VarianceTest.log('Exchange rate updated for cart items (landed cost subtotal)', 'info', cartStore.exchangeRate);
|
|
2086
2087
|
updateCalculateStatus = true;
|
|
2087
2088
|
}
|
|
2088
2089
|
else {
|
|
@@ -2121,7 +2122,7 @@ const cartStoreStartCheckoutInterval = ({ isPreview, sessionTimeout, }) => {
|
|
|
2121
2122
|
timeoutQuery && !isNaN(parseInt(timeoutQuery, 10))
|
|
2122
2123
|
? parseInt(timeoutQuery, 10)
|
|
2123
2124
|
: sessionTimeout;
|
|
2124
|
-
|
|
2125
|
+
VarianceTest.log(`==START CHECKOUT TIMEOUT - ${timeout}==`);
|
|
2125
2126
|
cartStore.checkoutTimeoutInterval = setTimeout(() => {
|
|
2126
2127
|
cartStore.checkoutSessionTimeoutShow = true;
|
|
2127
2128
|
}, timeout);
|
|
@@ -1,83 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const allLogs = [];
|
|
5
|
-
const getElapsedTime = () => {
|
|
6
|
-
const elapsedTime = performance.now() - startTime;
|
|
7
|
-
const elapsedTimePretty =
|
|
8
|
-
// format the time to seconds if over 1 second
|
|
9
|
-
elapsedTime > 1000
|
|
10
|
-
? `${(elapsedTime / 1000).toFixed(2)}s`
|
|
11
|
-
: `${elapsedTime.toFixed(2)}ms`;
|
|
12
|
-
return { elapsedTime, elapsedTimePretty };
|
|
13
|
-
};
|
|
14
|
-
const prepInfo = (info) => {
|
|
15
|
-
if (typeof info === 'string') {
|
|
16
|
-
return info;
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
const infoToJson = JSON.stringify(info);
|
|
20
|
-
return infoToJson;
|
|
21
|
-
}
|
|
22
|
-
catch (_a) {
|
|
23
|
-
if (info && typeof info.toString === 'function') {
|
|
24
|
-
const infoToString = info.toString();
|
|
25
|
-
return infoToString;
|
|
26
|
-
}
|
|
27
|
-
return 'Unable to stringify info';
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const log = (message, type, ..._additionalInfo) => {
|
|
31
|
-
var _a, _b;
|
|
32
|
-
const { elapsedTimePretty } = getElapsedTime();
|
|
33
|
-
const additionalInfo = [`(${elapsedTimePretty})`, ..._additionalInfo];
|
|
34
|
-
const preppedInfo = additionalInfo.map(prepInfo).join(' ');
|
|
35
|
-
allLogs.push([type, message, preppedInfo].filter(Boolean).join(' '));
|
|
36
|
-
const isDebug = !!((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.debug) ||
|
|
37
|
-
!!window.location.search.match(/\?.*(&*)zonosDebug=1/);
|
|
38
|
-
// if debug is false, do not log
|
|
39
|
-
if (!isDebug) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
let loggingIframe = document.querySelector('iframe#zonos---debug-logging-iframe');
|
|
43
|
-
if (!loggingIframe) {
|
|
44
|
-
// add a hidden iframe
|
|
45
|
-
loggingIframe = document.createElement('iframe');
|
|
46
|
-
loggingIframe.id = 'zonos---debug-logging-iframe';
|
|
47
|
-
loggingIframe.style.display = 'none';
|
|
48
|
-
loggingIframe.style.opacity = '0';
|
|
49
|
-
loggingIframe.style.position = 'absolute';
|
|
50
|
-
loggingIframe.style.top = '-9999px';
|
|
51
|
-
loggingIframe.style.left = '-9999px';
|
|
52
|
-
loggingIframe.style.width = '1px';
|
|
53
|
-
loggingIframe.style.height = '1px';
|
|
54
|
-
loggingIframe.style.border = 'none';
|
|
55
|
-
loggingIframe.style.overflow = 'hidden';
|
|
56
|
-
loggingIframe.style.visibility = 'hidden';
|
|
57
|
-
document.body.appendChild(loggingIframe);
|
|
58
|
-
}
|
|
59
|
-
// use the logging iframe's console to log just in case the console is disabled (overridden) by the site owner
|
|
60
|
-
const zConsole = ((_b = loggingIframe.contentWindow) === null || _b === void 0 ? void 0 : _b.window.console) || window.console;
|
|
61
|
-
switch (type) {
|
|
62
|
-
case 'warn':
|
|
63
|
-
zConsole.warn(message, ...additionalInfo);
|
|
64
|
-
break;
|
|
65
|
-
case 'info':
|
|
66
|
-
zConsole.info(message, ...additionalInfo);
|
|
67
|
-
break;
|
|
68
|
-
case 'error':
|
|
69
|
-
zConsole.error(message, ...additionalInfo);
|
|
70
|
-
break;
|
|
71
|
-
default:
|
|
72
|
-
zConsole.groupCollapsed(message, ...additionalInfo);
|
|
73
|
-
zConsole.trace();
|
|
74
|
-
zConsole.groupEnd();
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
3
|
+
const VarianceTest = require('./VarianceTest-bec00ea8.js');
|
|
78
4
|
|
|
79
5
|
const logError = (message, ...rest) => {
|
|
80
|
-
log(message, 'error', ...rest);
|
|
6
|
+
VarianceTest.log(message, 'error', ...rest);
|
|
81
7
|
};
|
|
82
8
|
|
|
83
9
|
const getIsStagingMode = () => window.location.search.includes('zonosStagingMode=1');
|
|
@@ -215,7 +141,7 @@ const prepLoadTimeApiLog = ({ apiPath, apiType, loadTimeInternal, loadTimeTotal,
|
|
|
215
141
|
*/
|
|
216
142
|
const postReleaseReportingDuration = 1 * 3600 * 1000; // 1 hour
|
|
217
143
|
const sendErrorLog = async ({ endpoint, errors, metadata, shouldPostReleaseErrorReporting, }) => {
|
|
218
|
-
log('sendErrorLog', 'warn', endpoint, metadata, errors);
|
|
144
|
+
VarianceTest.log('sendErrorLog', 'warn', endpoint, metadata, errors);
|
|
219
145
|
if (shouldPostReleaseErrorReporting) {
|
|
220
146
|
// We only want to report errors that happened if current time is less than 2 hours after release time
|
|
221
147
|
const releaseTime = Number(window.Zonos.releaseDate);
|
|
@@ -415,7 +341,7 @@ const handleRequestWithFallback = async ({ basePathType: _basePathType, options,
|
|
|
415
341
|
const endTime = performance.now();
|
|
416
342
|
const duration = endTime - startTime;
|
|
417
343
|
// Send the load time api log
|
|
418
|
-
log(`${path} (${duration.toFixed(2)}ms)`, 'info');
|
|
344
|
+
VarianceTest.log(`${path} (${duration.toFixed(2)}ms)`, 'info');
|
|
419
345
|
// No need to send the load time api log for the log-script-load endpoint
|
|
420
346
|
const internalDuration = response === null || response === void 0 ? void 0 : response.headers.get('Zonos-Duration');
|
|
421
347
|
// Only record if the response status is 200, some endpoint will return 200 with error
|
|
@@ -456,7 +382,7 @@ const handleRequestWithFallback = async ({ basePathType: _basePathType, options,
|
|
|
456
382
|
});
|
|
457
383
|
}
|
|
458
384
|
if (shouldCallFallback) {
|
|
459
|
-
log(`=== "${path}" failed to fetch, trying next fallback ${nextFallbackApiType}`);
|
|
385
|
+
VarianceTest.log(`=== "${path}" failed to fetch, trying next fallback ${nextFallbackApiType}`);
|
|
460
386
|
return handleRequestWithFallback({
|
|
461
387
|
basePathType: nextFallbackApiType,
|
|
462
388
|
options,
|
|
@@ -490,15 +416,12 @@ const handleFetch = async (path, _opts) => {
|
|
|
490
416
|
});
|
|
491
417
|
};
|
|
492
418
|
|
|
493
|
-
exports.allLogs = allLogs;
|
|
494
419
|
exports.fallbackApiList = fallbackApiList;
|
|
495
420
|
exports.getAdditionalLogMetadata = getAdditionalLogMetadata;
|
|
496
|
-
exports.getElapsedTime = getElapsedTime;
|
|
497
421
|
exports.getIsStagingMode = getIsStagingMode;
|
|
498
422
|
exports.getIsTestMode = getIsTestMode;
|
|
499
423
|
exports.handleFetch = handleFetch;
|
|
500
424
|
exports.isCheckoutMobile = isCheckoutMobile;
|
|
501
425
|
exports.jsonParse = jsonParse;
|
|
502
|
-
exports.log = log;
|
|
503
426
|
exports.logError = logError;
|
|
504
427
|
exports.sendErrorLog = sendErrorLog;
|