@zonos/elements 1.3.51 → 1.3.53
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/CheckoutConfig-65376e00.js +40 -0
- package/dist/cjs/{cart-546d1602.js → cart-61a8983d.js} +238 -375
- package/dist/cjs/{createCustomEvent-9b91480b.js → createCustomEvent-228027b5.js} +3 -2
- package/dist/cjs/handleFetch-842c95b0.js +322 -0
- package/dist/cjs/index.cjs.js +75 -35
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{paypal-83f49f9a.js → paypal-f1eb6621.js} +16 -16
- package/dist/cjs/zonos-address_8.cjs.entry.js +4 -4
- package/dist/cjs/{zonos-cart-items_12.cjs.entry.js → zonos-badge_13.cjs.entry.js} +41 -9
- package/dist/cjs/zonos-checkout.cjs.entry.js +75 -174
- package/dist/cjs/zonos-controller.cjs.entry.js +29 -27
- package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello.cjs.entry.js +11 -11
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
- package/dist/cjs/zonos-notification_3.cjs.entry.js +9 -9
- package/dist/cjs/zonos-tooltip.cjs.entry.js +27 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +5 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +44 -20
- package/dist/collection/components/main/zonos-controller.js +2 -2
- package/dist/collection/components/store/checkout/cart.js +14 -2
- package/dist/collection/components/store/checkout/stripe.js +9 -4
- package/dist/collection/components/store/translationStore/strings.arabic.js +3 -3
- package/dist/collection/components/store/translationStore/strings.base.js +3 -3
- package/dist/collection/components/store/translationStore/strings.chinese.js +3 -3
- package/dist/collection/components/store/translationStore/strings.danish.js +3 -3
- package/dist/collection/components/store/translationStore/strings.dutch.js +3 -3
- package/dist/collection/components/store/translationStore/strings.french.js +3 -3
- package/dist/collection/components/store/translationStore/strings.german.js +3 -3
- package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -3
- package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -3
- package/dist/collection/components/store/translationStore/strings.italian.js +3 -3
- package/dist/collection/components/store/translationStore/strings.japanese.js +3 -3
- package/dist/collection/components/store/translationStore/strings.korean.js +3 -3
- package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -3
- package/dist/collection/components/store/translationStore/strings.polish.js +3 -3
- package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -3
- package/dist/collection/components/store/translationStore/strings.russian.js +3 -3
- package/dist/collection/components/store/translationStore/strings.spanish.js +3 -3
- package/dist/collection/components/store/translationStore/strings.swedish.js +3 -3
- package/dist/collection/components/store/translationStore/strings.turkish.js +3 -3
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -3
- package/dist/collection/components/utils/api/buildCartItemsByTempCart.js +14 -14
- package/dist/collection/components/utils/api/calculateLandedCostNormalized.js +28 -0
- package/dist/collection/components/utils/api/cartCalculateLandedCost.js +19 -0
- package/dist/collection/components/utils/api/prepCalculateLandedCost.js +65 -0
- package/dist/collection/components/utils/checkout/initCheckout.js +4 -2
- package/dist/collection/environment.js +1 -1
- package/dist/collection/scripts/_getNextFallbackUrl.js +1 -0
- package/dist/collection/scripts/_getTempCartById.js +14 -0
- package/dist/collection/scripts/_zonosBase.js +39 -10
- package/dist/collection/scripts/cart/_getCartIdFromParam.js +9 -0
- package/dist/collection/scripts/cart/_setupCartData.js +18 -0
- package/dist/collection/types/checkout/CheckoutConfig.js +2 -1
- package/dist/collection/types/generated/graphql.customer.types.js +12 -0
- package/dist/collection/utils/formattedCloudflareApiUrl.js +8 -2
- package/dist/collection/utils/generateCloudflareDeployUrl.js +3 -0
- package/dist/esm/CheckoutConfig-57350b28.js +36 -0
- package/dist/esm/{cart-51529af2.js → cart-45d2861f.js} +193 -327
- package/dist/esm/{createCustomEvent-b8bbdf5e.js → createCustomEvent-3fcc948a.js} +2 -1
- package/dist/esm/handleFetch-37cea185.js +315 -0
- package/dist/esm/index.js +56 -17
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{paypal-905325d0.js → paypal-ee310945.js} +2 -2
- package/dist/esm/zonos-address_8.entry.js +2 -2
- package/dist/esm/{zonos-cart-items_12.entry.js → zonos-badge_13.entry.js} +40 -9
- package/dist/esm/zonos-checkout.entry.js +61 -160
- package/dist/esm/zonos-controller.entry.js +8 -6
- package/dist/esm/zonos-country-flag.entry.js +2 -2
- package/dist/esm/zonos-country-select_4.entry.js +2 -2
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +2 -2
- package/dist/esm/zonos-hello.entry.js +2 -2
- package/dist/esm/zonos-language-select_2.entry.js +2 -2
- package/dist/esm/zonos-notification_3.entry.js +3 -3
- package/dist/esm/zonos-tooltip.entry.js +23 -0
- package/dist/esm-es5/CheckoutConfig-57350b28.js +1 -0
- package/dist/esm-es5/cart-45d2861f.js +1 -0
- package/dist/esm-es5/{createCustomEvent-b8bbdf5e.js → createCustomEvent-3fcc948a.js} +1 -1
- package/dist/esm-es5/handleFetch-37cea185.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{paypal-905325d0.js → paypal-ee310945.js} +1 -1
- package/dist/esm-es5/zonos-address_8.entry.js +1 -1
- package/dist/esm-es5/zonos-badge_13.entry.js +1 -0
- package/dist/esm-es5/zonos-checkout.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-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
- package/dist/esm-es5/zonos-tooltip.entry.js +1 -0
- package/dist/scripts/index.d.ts +74 -87
- 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 +0 -2
- package/dist/types/components/store/checkout/cart.d.ts +13 -3
- package/dist/types/components/store/checkout/stripe.d.ts +3 -1
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.base.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.french.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.german.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -3
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -3
- package/dist/types/components/store/translationStore.d.ts +1 -1
- package/dist/types/components/utils/api/buildCartItemsByTempCart.d.ts +8 -3
- package/dist/types/components/utils/api/calculateLandedCostNormalized.d.ts +2 -0
- package/dist/types/components/utils/api/cartCalculateLandedCost.d.ts +5 -0
- package/dist/types/components/utils/api/prepCalculateLandedCost.d.ts +5 -1
- package/dist/types/components/utils/checkout/getIsTestMode.d.ts +1 -1
- package/dist/types/scripts/_getNextFallbackUrl.d.ts +1 -0
- package/dist/types/scripts/_getTempCartById.d.ts +8 -0
- package/dist/types/scripts/_zonosBase.d.ts +15 -12
- package/dist/types/scripts/cart/_getCartIdFromParam.d.ts +4 -0
- package/dist/types/scripts/cart/_setupCartData.d.ts +7 -0
- package/dist/types/types/checkout/CheckoutConfig.d.ts +18 -3
- package/dist/types/types/checkout/api/CalculateLandedCostRequest.d.ts +42 -1
- package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +37 -0
- package/dist/types/types/generated/graphql.customer.types.d.ts +249 -2
- package/dist/types/types/generated/graphql.customer.types.ts +251 -3
- package/dist/types/utils/formattedCloudflareApiUrl.d.ts +2 -2
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-01f0b13d.entry.js +1 -0
- package/dist/zonos-elements/p-042c466d.system.entry.js +1 -0
- package/dist/zonos-elements/p-10cb0064.entry.js +1 -0
- package/dist/zonos-elements/p-217e1aa1.system.entry.js +1 -0
- package/dist/zonos-elements/{p-5e56828a.entry.js → p-259ccf8d.entry.js} +1 -1
- package/dist/zonos-elements/p-2a47d2cc.system.entry.js +1 -0
- package/dist/zonos-elements/{p-ffd76226.entry.js → p-31eb835c.entry.js} +1 -1
- package/dist/zonos-elements/{p-58d9803d.entry.js → p-36360905.entry.js} +1 -1
- package/dist/zonos-elements/{p-1828a4ff.system.entry.js → p-3703b814.system.entry.js} +1 -1
- package/dist/zonos-elements/p-4146feec.js +1 -0
- package/dist/zonos-elements/p-446c8f02.system.entry.js +1 -0
- package/dist/zonos-elements/{p-2c323311.system.js → p-5590f90c.system.js} +1 -1
- package/dist/zonos-elements/p-588396df.js +1 -0
- package/dist/zonos-elements/{p-aa5d669b.js → p-6e59c6e4.js} +2 -2
- package/dist/zonos-elements/p-6eedc3f8.entry.js +1 -0
- package/dist/zonos-elements/p-747eed39.entry.js +1 -0
- package/dist/zonos-elements/{p-00100b17.system.entry.js → p-8228e87c.system.entry.js} +1 -1
- package/dist/zonos-elements/p-827868e6.entry.js +1 -0
- package/dist/zonos-elements/{p-cc7a4fca.entry.js → p-88005b94.entry.js} +1 -1
- package/dist/zonos-elements/p-895fdefb.js +1 -0
- package/dist/zonos-elements/p-8f7773b0.system.js +1 -0
- package/dist/zonos-elements/{p-9a0401fd.entry.js → p-8fa49d94.entry.js} +1 -1
- package/dist/zonos-elements/p-a74a7afa.system.js +1 -0
- package/dist/zonos-elements/{p-8473f99a.system.entry.js → p-b842b96a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-9e976332.entry.js → p-bb186075.entry.js} +1 -1
- package/dist/zonos-elements/{p-b1a8b874.system.entry.js → p-c008648a.system.entry.js} +1 -1
- package/dist/zonos-elements/p-c22bac78.system.js +1 -0
- package/dist/zonos-elements/p-c78dd680.system.js +1 -1
- package/dist/zonos-elements/{p-6b42fa1b.system.entry.js → p-cd4ad1be.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-59e85369.system.entry.js → p-d62e6bb0.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-496e040f.system.entry.js → p-dc12f30a.system.entry.js} +1 -1
- package/dist/zonos-elements/p-eb2aedd0.js +1 -0
- package/dist/zonos-elements/{p-c89859cf.system.js → p-f124e459.system.js} +2 -2
- package/dist/zonos-elements/p-f87a635b.system.js +1 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/logError-4e2f2020.js +0 -58
- package/dist/cjs/zonos-badge_2.cjs.entry.js +0 -57
- package/dist/collection/components/utils/api/tempCartItem/getAttributes.js +0 -66
- package/dist/collection/components/utils/api/tempCartItem/getMeasurements.js +0 -58
- package/dist/esm/logError-c456c092.js +0 -55
- package/dist/esm/zonos-badge_2.entry.js +0 -52
- package/dist/esm-es5/cart-51529af2.js +0 -1
- package/dist/esm-es5/logError-c456c092.js +0 -1
- package/dist/esm-es5/zonos-badge_2.entry.js +0 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +0 -1
- package/dist/types/components/utils/api/tempCartItem/getAttributes.d.ts +0 -11
- package/dist/types/components/utils/api/tempCartItem/getMeasurements.d.ts +0 -7
- package/dist/types/types/checkout/api/TempCart.d.ts +0 -80
- package/dist/zonos-elements/p-101c41bf.entry.js +0 -1
- package/dist/zonos-elements/p-3c4eec63.system.entry.js +0 -1
- package/dist/zonos-elements/p-47945026.system.entry.js +0 -1
- package/dist/zonos-elements/p-47c72c50.system.entry.js +0 -1
- package/dist/zonos-elements/p-4e77ed65.system.entry.js +0 -1
- package/dist/zonos-elements/p-6013e370.entry.js +0 -1
- package/dist/zonos-elements/p-63db40b9.system.js +0 -1
- package/dist/zonos-elements/p-8b8ef484.entry.js +0 -1
- package/dist/zonos-elements/p-b57d24f2.entry.js +0 -1
- package/dist/zonos-elements/p-ba0289f9.entry.js +0 -1
- package/dist/zonos-elements/p-c8a3303b.js +0 -1
- package/dist/zonos-elements/p-d413cd13.js +0 -1
- package/dist/zonos-elements/p-e758ec31.system.js +0 -1
- package/dist/zonos-elements/p-eaa335e1.js +0 -1
- package/dist/zonos-elements/p-fcfde531.system.js +0 -1
- /package/dist/collection/types/checkout/api/{TempCart.js → NormalizedTempCart.js} +0 -0
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["zonos-checkout.cjs",[[2,"zonos-checkout",{"appearanceSettingsOverride":[16],"preview":[4],"mobile":[4],"defaultAddress":[16],"forceDialogOpen":[4,"force-dialog-open"],"open":[32],"stripe":[32],"submitLoading":[32],"collapseReviewMobile":[32],"isAttachError":[32],"isMobile":[32],"zonosReviewRef":[32],"storybookPaymentStatusOverride":[32],"
|
|
22
|
+
return index.bootstrapLazy([["zonos-checkout.cjs",[[2,"zonos-checkout",{"appearanceSettingsOverride":[16],"preview":[4],"mobile":[4],"defaultAddress":[16],"forceDialogOpen":[4,"force-dialog-open"],"open":[32],"stripe":[32],"submitLoading":[32],"collapseReviewMobile":[32],"isAttachError":[32],"isMobile":[32],"zonosReviewRef":[32],"storybookPaymentStatusOverride":[32],"isLegacyCheckout":[32],"confirmDialogOpen":[32],"inventoryCheckErrorMessage":[32],"closeDialogHandler":[64],"init":[64],"setToFinishStep":[64]},[[16,"zonos--init-cart-info","initCartInfoHandler"],[4,"keydown","handleKeyPress"],[9,"resize","handleWindowResize"]],{"appearanceSettingsOverride":["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],"mobile":["handleMobileChange"],"defaultAddress":["handleAddressChange"]}]]],["zonos-hello.cjs",[[1,"zonos-hello",{"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettingsOverride":[16],"showPeekMessage":[32],"zonosStoreHelloSettings":[32],"showDialog":[32],"peekMessage":[32],"initialUrl":[32],"allRestrictedItems":[32],"allFoundProducts":[32],"productsOnPage":[32],"isHelloWidgetRendered":[32],"isMobile":[32],"getCountryList":[64],"displayCurrency":[64],"convertAndFormat":[64],"convert":[64],"format":[64],"openHelloDialog":[64]},[[9,"resize","handleResize"]],{"appearanceSettingsOverride":["handleAppearanceSettingsOverrideChange"]}]]],["zonos-controller.cjs",[[1,"zonos-controller",{"config":[16],"zonosApiKey":[1,"zonos-api-key"],"initCheckoutElement":[64],"setupGoogleFont":[64],"showNotification":[64],"reset":[64],"overrideConfig":[64],"overrideCountry":[64],"getAppearanceSetting":[64],"updateOrganizationName":[64]},[[8,"locationchange","handleLocationChange"]]]]],["zonos-component.cjs",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["zonos-link.cjs",[[1,"zonos-link",{"href":[1],"rel":[1],"target":[1],"linkTitle":[1,"link-title"]}]]],["zonos-logo.cjs",[[1,"zonos-logo",{"theme":[1],"width":[1]}]]],["zonos-text.cjs",[[1,"zonos-text",{"textColor":[1,"text-color"],"size":[1],"type":[1],"weight":[2],"ready":[32]}]]],["zonos-tooltip.cjs",[[1,"zonos-tooltip",{"label":[1],"subtitle":[1],"showTooltip":[32]}]]],["zonos-card.cjs",[[1,"zonos-card",{"actions":[16],"backgroundColor":[1,"background-color"],"borderRadius":[2,"border-radius"],"footerActions":[16],"footerContent":[16],"footerHeight":[2,"footer-height"],"label":[16],"spacing":[1]}]]],["zonos-banner.cjs",[[1,"zonos-banner",{"bannerTitle":[1,"banner-title"],"intent":[1],"hasContent":[32]}]]],["zonos-v-stack.cjs",[[1,"zonos-v-stack",{"spacing":[2]}]]],["zonos-language-select_2.cjs",[[1,"zonos-language-select",{"handleOnClose":[16]}],[1,"zonos-select-dialog-header",{"handleOnClose":[16],"label":[1]}]]],["zonos-country-select_4.cjs",[[1,"zonos-country-select",{"handleOnClose":[16],"inputValue":[32]}],[1,"zonos-hello-dialog-footer",{"appearanceSettings":[16],"setShowCountrySelect":[16],"setShowLanguageSelect":[16]}],[1,"zonos-custom-message",{"icon":[1],"message":[1]}],[2,"zonos-virtual-scroll",{"renderItem":[16],"itemWidth":[2,"item-width"],"fallbackItemHeight":[2,"fallback-item-height"],"itemHeights":[16],"container":[32],"scrollTop":[32],"totalHeight":[32]},null,{"itemHeights":["updateTotalHeight"],"fallbackItemHeight":["updateTotalHeight"]}]]],["zonos-hello-dialog.cjs",[[1,"zonos-hello-dialog",{"isOpen":[4,"is-open"],"setIsOpen":[16],"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettings":[16],"restrictedItems":[16],"welcomeMessage":[32],"showCountrySelect":[32],"showLanguageSelect":[32]},[[4,"click","globalClickHandler"]],{"isOpen":["isOpenHandler"]}]]],["zonos-shipping-rich-radio.cjs",[[1,"zonos-shipping-rich-radio",{"items":[16],"borderColor":[1,"border-color"],"borderStyle":[1,"border-style"],"theme":[1],"initialSelectedValue":[8,"initial-selected-value"],"selectedItem":[32]}]]],["zonos-input.cjs",[[1,"zonos-input",{"inputValue":[1,"input-value"],"inputLabel":[1,"input-label"],"inputSize":[1,"input-size"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"inputPlaceholder":[1,"input-placeholder"],"value":[32]},null,{"inputValue":["onInputValueChange"]}]]],["zonos-notification_3.cjs",[[2,"zonos-payment",{"titleText":[1,"title-text"],"stripe":[32],"stripeElements":[32]},null,{"stripeElements":["watchInitStripe"],"stripe":["watchInitStripe"]}],[2,"zonos-paypal-payment"],[1,"zonos-notification",{"notificationArray":[32],"showNotification":[64]}]]],["zonos-country-flag.cjs",[[1,"zonos-country-flag",{"countryCode":[1,"country-code"],"size":[2]}]]],["zonos-button_3.cjs",[[17,"zonos-button",{"buttonColor":[1,"button-color"],"backgroundColor":[1,"background-color"],"borderStyle":[1,"border-style"],"isDisabled":[4,"is-disabled"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"variant":[1],"noBackground":[4,"no-background"],"withBoxShadow":[4,"with-box-shadow"],"noPaddingLeft":[4,"no-padding-left"],"noPaddingRight":[4,"no-padding-right"],"loading":[4],"justifyContent":[1,"justify-content"],"theme":[1],"hasIcon":[32],"hasContent":[32]},[[2,"click","clickHandler"]],{"icon":["iconChangeHandler"]}],[1,"zonos-spinner",{"size":[2],"spinnerColor":[1,"spinner-color"]}],[1,"zonos-icon",{"autoHeight":[4,"auto-height"],"iconColor":[1,"icon-color"],"content":[1],"size":[2]}]]],["zonos-address_8.cjs",[[1,"zonos-address-update-dialog",{"continueLoading":[4,"continue-loading"],"dialogLoading":[4,"dialog-loading"],"dialogOpen":[4,"dialog-open"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"shippingAddress":[16],"billingAddress":[16],"translatedShippingAddress":[16],"translatedBillingAddress":[16],"showErrorBanner":[32],"translatedShippingAddressState":[32],"translatedBillingAddressState":[32]},null,{"translatedShippingAddress":["watchTranslatedShippingAddress"],"translatedBillingAddress":["watchTranslatedBillingAddress"]}],[2,"zonos-address",{"type":[1],"titleText":[1,"title-text"],"defaultAddress":[16],"stripe":[32],"isDirtyAddress":[32]},null,{"stripe":["watchInitStripe"]}],[1,"zonos-checkbox",{"backgroundColor":[1,"background-color"],"label":[1],"isChecked":[4,"is-checked"],"isDisabled":[4,"is-disabled"],"size":[2],"fontSize":[1,"font-size"],"borderStyle":[1,"border-style"]},[[1,"click","onClick"]]],[2,"zonos-link-authentication",{"titleText":[1,"title-text"],"defaultEmail":[1,"default-email"],"stripe":[32]},null,{"stripe":["watchInitStripe"]}],[1,"zonos-dialog",{"open":[4],"headerText":[1,"header-text"],"width":[1],"height":[1],"minHeight":[1,"min-height"],"noHeader":[4,"no-header"],"noBodyPadding":[4,"no-body-padding"],"noBorder":[4,"no-border"],"borderStyle":[1,"border-style"],"noCloseButton":[4,"no-close-button"],"noClickOutside":[4,"no-click-outside"],"mobile":[4],"isLoading":[4,"is-loading"],"isMobile":[32]},[[9,"resize","handleWindowResize"],[4,"keydown","handleKeyDown"]]],[1,"zonos-address-display",{"currentAddress":[16],"addressType":[1,"address-type"]}],[1,"zonos-address-form",{"currentAddress":[16],"translatedAddress":[16],"addressType":[1,"address-type"],"localAddress":[32]},null,{"translatedAddress":["watchCurrentAddress"]}],[1,"zonos-collapse",{"collapsed":[4],"collapseSize":[2,"collapse-size"],"height":[32],"iframe":[32]}]]],["zonos-badge_13.cjs",[[2,"zonos-customer-info",{"continueLoading":[4,"continue-loading"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"defaultAddress":[16],"showErrorBanner":[32],"shippingCountry":[32],"isCheckingForRestrictedItems":[32],"isValidatingAddress":[32],"invalidShippingCharacterList":[32],"invalidBillingCharacterList":[32],"openAddressValidationDialog":[32]}],[2,"zonos-checkout-payment",{"submitBtnType":[1,"submit-btn-type"],"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"showErrorBanner":[32]}],[1,"zonos-checkout-footer",{"mobile":[4],"dataTheme":[1,"data-theme"],"showLanguageDialog":[32],"isMobile":[32]},[[4,"click","handleGlobalClick"]],{"mobile":["handleMobileChange"]}],[2,"zonos-shipping",{"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"submitBtnType":[1,"submit-btn-type"],"selectedShippingMethod":[32],"isSelecting":[32],"showErrorBanner":[32],"serviceLevels":[32]}],[1,"zonos-cart-restricted-items",{"hide":[4],"errorImages":[32],"internalCollapsed":[32],"firstRender":[32]}],[1,"zonos-checkout-finish",{"borderRadius":[1,"border-radius"],"storybookForceStatus":[1,"storybook-force-status"],"overrideNotification":[16],"isLoading":[32],"notificationType":[32],"notificationTitle":[32],"notificationMessages":[32],"notificationActionText":[32],"order":[32]}],[1,"zonos-confirm-dialog",{"dialogTitle":[1,"dialog-title"],"dialogIntent":[1,"dialog-intent"],"dialogSubtitle":[1,"dialog-subtitle"],"submitBtnColor":[1,"submit-btn-color"],"dialogConfirmBtnText":[1,"dialog-confirm-btn-text"],"dialogCancelBtnText":[1,"dialog-cancel-btn-text"],"dialogType":[1,"dialog-type"],"isMobile":[4,"is-mobile"],"dialogOpen":[4,"dialog-open"],"noClickOutside":[4,"no-click-outside"]},[[4,"keydown","handleKeyDown"]]],[1,"zonos-cart-subtotal"],[1,"zonos-checkout-progress-tabs",{"tabColor":[1,"tab-color"],"backgroundColor":[1,"background-color"],"setTabItems":[64],"setTabSelected":[64]}],[1,"zonos-review",{"mobile":[4],"collapsed":[4],"isMobile":[32]},[[9,"resize","handleWindowResize"]]],[1,"zonos-badge",{"bold":[4],"badgeColor":[1,"badge-color"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"rounded":[4]}],[1,"zonos-cart-items",{"errorImages":[32]}],[1,"zonos-rest-state",{"restStateSubtitle":[1,"rest-state-subtitle"],"restStateTitle":[1,"rest-state-title"],"restStateType":[1,"rest-state-type"],"isErrorImageLoad":[32]}]]]], options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-61a8983d.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-67139f0e.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
|
|
10
10
|
const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
|
|
11
|
-
require('./
|
|
11
|
+
require('./handleFetch-842c95b0.js');
|
|
12
12
|
require('./isDarkColor-7a056d05.js');
|
|
13
13
|
require('./getBorderRadius-a6a3b35e.js');
|
|
14
14
|
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
6
|
const zonosStore = require('./zonosStore-67139f0e.js');
|
|
7
|
-
const cart = require('./cart-
|
|
7
|
+
const cart = require('./cart-61a8983d.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
|
-
const
|
|
9
|
+
const handleFetch = require('./handleFetch-842c95b0.js');
|
|
10
10
|
const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
|
|
11
11
|
require('./isDarkColor-7a056d05.js');
|
|
12
12
|
require('./getBorderRadius-a6a3b35e.js');
|
|
@@ -370,9 +370,9 @@ const checkItemRestrictions = async ({ items, shipFrom, shipTo, }) => {
|
|
|
370
370
|
shipFrom,
|
|
371
371
|
shipTo,
|
|
372
372
|
};
|
|
373
|
-
const { errors, json } = await
|
|
373
|
+
const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/check-item-restrictions', { body, method: 'POST' });
|
|
374
374
|
if (errors.length || !json) {
|
|
375
|
-
|
|
375
|
+
handleFetch.logError(`Error fetching item restrictions: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
|
|
376
376
|
return [];
|
|
377
377
|
}
|
|
378
378
|
return json.filter(Boolean);
|
|
@@ -384,7 +384,7 @@ const detectItemRestrictions = async (newProducts) => {
|
|
|
384
384
|
}
|
|
385
385
|
const { selectedCountryCode } = cart.localizationStore;
|
|
386
386
|
if (!selectedCountryCode) {
|
|
387
|
-
|
|
387
|
+
handleFetch.logError('Hello Could not check item restrictions - No country code selected');
|
|
388
388
|
return [];
|
|
389
389
|
}
|
|
390
390
|
const items = newProducts.map(product => ({
|
|
@@ -430,7 +430,7 @@ const getProductsOnPage = () => {
|
|
|
430
430
|
var _a, _b;
|
|
431
431
|
const { productAddToCartElementSelector, productDescriptionElementSelector, productTitleElementSelector, restrictionBehavior, } = zonosStore.zonosStore.helloSettings;
|
|
432
432
|
if (!productTitleElementSelector || !productDescriptionElementSelector) {
|
|
433
|
-
|
|
433
|
+
handleFetch.logError(`Hello Could not check item restrictions - must provide title and description selectors.`);
|
|
434
434
|
}
|
|
435
435
|
const titleNodes = (productTitleElementSelector &&
|
|
436
436
|
cart.isValidSelector(productTitleElementSelector) &&
|
|
@@ -442,7 +442,7 @@ const getProductsOnPage = () => {
|
|
|
442
442
|
[];
|
|
443
443
|
if (titleNodes.length !== descriptionNodes.length) {
|
|
444
444
|
// If the title and description selectors don't match, kill item restrictions altogether
|
|
445
|
-
|
|
445
|
+
handleFetch.logError('Hello Could not check item restrictions - Title and description selectors do not match');
|
|
446
446
|
return [];
|
|
447
447
|
}
|
|
448
448
|
const shouldDisableCart = restrictionBehavior === 'RESTRICT_AND_BLOCK';
|
|
@@ -453,7 +453,7 @@ const getProductsOnPage = () => {
|
|
|
453
453
|
[];
|
|
454
454
|
if (shouldDisableCart && cartButtonNodes.length !== descriptionNodes.length) {
|
|
455
455
|
// If the "add to cart" selectors don't match, log the error and continue
|
|
456
|
-
|
|
456
|
+
handleFetch.logError('Hello could not disable "Add to cart" buttons - Title and add to cart selectors do not match');
|
|
457
457
|
}
|
|
458
458
|
const mergedElements = [];
|
|
459
459
|
for (let i = 0; i < titleNodes.length; i++) {
|
|
@@ -640,7 +640,7 @@ const ZonosHello = class {
|
|
|
640
640
|
const { showForCountries } = zonosStore.zonosStore.helloSettings;
|
|
641
641
|
if (showLog) {
|
|
642
642
|
if (!cart.localizationStore.isShippableCountry) {
|
|
643
|
-
|
|
643
|
+
handleFetch.log(`Hello: not shippable country - Show for countries: ${showForCountries}`);
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
646
|
// if localization is loaded and the localization is not a shippable country, keep the original click event
|
|
@@ -698,7 +698,7 @@ const ZonosHello = class {
|
|
|
698
698
|
return;
|
|
699
699
|
}
|
|
700
700
|
if (!cart.localizationStore.exchangeRate) {
|
|
701
|
-
|
|
701
|
+
handleFetch.log('Could not display currency. Exchange rate and format data is not available.', 'warn');
|
|
702
702
|
return;
|
|
703
703
|
}
|
|
704
704
|
cart.currencyDisplay();
|
|
@@ -805,7 +805,7 @@ const ZonosHello = class {
|
|
|
805
805
|
var _a, _b;
|
|
806
806
|
const isExcludedUrl = (_a = zonosStore.zonosStore.helloSettings.excludedUrlPatterns) === null || _a === void 0 ? void 0 : _a.some(pattern => new RegExp(pattern).test(window.location.href));
|
|
807
807
|
if (isExcludedUrl) {
|
|
808
|
-
|
|
808
|
+
handleFetch.log('Hello is excluded on this url', 'warn');
|
|
809
809
|
return null;
|
|
810
810
|
}
|
|
811
811
|
const { selectedCountryCode, targetCurrency } = cart.localizationStore;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-61a8983d.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-67139f0e.js');
|
|
8
8
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
9
|
-
require('./
|
|
9
|
+
require('./handleFetch-842c95b0.js');
|
|
10
10
|
require('./isDarkColor-7a056d05.js');
|
|
11
11
|
require('./getBorderRadius-a6a3b35e.js');
|
|
12
12
|
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
6
|
const zonosStore = require('./zonosStore-67139f0e.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
|
-
const cart = require('./cart-
|
|
9
|
-
const
|
|
10
|
-
const paypal = require('./paypal-
|
|
8
|
+
const cart = require('./cart-61a8983d.js');
|
|
9
|
+
const handleFetch = require('./handleFetch-842c95b0.js');
|
|
10
|
+
const paypal = require('./paypal-f1eb6621.js');
|
|
11
11
|
require('./isDarkColor-7a056d05.js');
|
|
12
12
|
require('./getBorderRadius-a6a3b35e.js');
|
|
13
13
|
|
|
@@ -95,7 +95,7 @@ const ZonosPayment = class {
|
|
|
95
95
|
});
|
|
96
96
|
const paymentElementContainer = this.el.querySelector('.zonos--payment-component');
|
|
97
97
|
if (!paymentElementContainer) {
|
|
98
|
-
|
|
98
|
+
handleFetch.logError('Cannot find container element for paymentElement');
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
101
|
paymentElement.mount(paymentElementContainer);
|
|
@@ -131,27 +131,27 @@ const ZonosPaypalPayment = class {
|
|
|
131
131
|
}
|
|
132
132
|
async loadPaypal() {
|
|
133
133
|
if (!window.Zonos.paypal) {
|
|
134
|
-
|
|
134
|
+
handleFetch.log('Paypal is not available');
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
137
|
// Init paypal store buttons
|
|
138
138
|
const paypalButtons = paypal.paypalStoreInitButtons({
|
|
139
139
|
onPaypalFail: () => {
|
|
140
|
-
|
|
140
|
+
handleFetch.log('onPaypalFail');
|
|
141
141
|
this.paypalSessionFail.emit();
|
|
142
142
|
},
|
|
143
143
|
onPaypalSessionDone: ({ orderId }) => {
|
|
144
|
-
|
|
144
|
+
handleFetch.log('onPaypalSessionDone', 'info', { orderId });
|
|
145
145
|
this.paypalSessionDone.emit({ orderId });
|
|
146
146
|
},
|
|
147
147
|
});
|
|
148
148
|
if (!(paypalButtons === null || paypalButtons === void 0 ? void 0 : paypalButtons.length)) {
|
|
149
|
-
|
|
149
|
+
handleFetch.log('There are no paypal buttons available');
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
152
|
const container = this.el.querySelector('.zonos--payment-paypal-container');
|
|
153
153
|
if (!container) {
|
|
154
|
-
|
|
154
|
+
handleFetch.log('Cannot find container element for paypal buttons');
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
157
|
// render paypal buttons
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-d56e0a8b.js');
|
|
6
|
+
const classes = require('./classes-b7918f56.js');
|
|
7
|
+
|
|
8
|
+
const zonosTooltipCss = ":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--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--tooltip{position:relative}:host .zonos--tooltip .zonos--tooltip-content{position:absolute;bottom:100%;left:0;width:-webkit-max-content;width:-moz-max-content;width:max-content;padding:12px;background-color:var(--zonos-elements-gray-1200);opacity:0;-webkit-transform:scale(0);transform:scale(0);-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out;-webkit-transform-origin:bottom left;transform-origin:bottom left;border-radius:var(--zonos-elements-radius-4);z-index:100;-webkit-box-shadow:var(--zonos-elements-v3-shadow-large);box-shadow:var(--zonos-elements-v3-shadow-large)}:host .zonos--tooltip .zonos--tooltip-content.zonos--show-tooltip{opacity:1;-webkit-transform:scale(1);transform:scale(1)}";
|
|
9
|
+
const ZonosTooltipStyle0 = zonosTooltipCss;
|
|
10
|
+
|
|
11
|
+
const ZonosTooltip = class {
|
|
12
|
+
constructor(hostRef) {
|
|
13
|
+
index.registerInstance(this, hostRef);
|
|
14
|
+
this.label = '';
|
|
15
|
+
this.subtitle = '';
|
|
16
|
+
this.showTooltip = false;
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
return (index.h(index.Host, { key: '24f3b1f73cc320540ab3700213004c267ea04658', class: "zonos--elements" }, index.h("div", { key: '7f52acf90cb5b9f1fd5efdc4fedc4d61a893a646', class: "zonos--tooltip", onMouseEnter: () => (this.showTooltip = true), onMouseLeave: () => (this.showTooltip = false) }, index.h("slot", { key: '1871529e8b75c44a71bf1f5bc9e60b81bbc598d2' }), index.h("div", { key: 'c0b9c9c1b3fef5f766d2bad4c5bea48f3d6bbb6f', class: classes.classes([
|
|
20
|
+
this.showTooltip && 'zonos--show-tooltip',
|
|
21
|
+
'zonos--tooltip-content',
|
|
22
|
+
]) }, index.h("zonos-text", { key: '3b106cb439877dffa101f15fb01aff980a64c7cb', size: "s", textColor: "gray-0", type: "boldLabel" }, this.label), index.h("zonos-text", { key: 'c0005051e6e1b614b7739718e1a262f6043d56f5', size: "xs", textColor: "gray-0" }, this.subtitle)))));
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
ZonosTooltip.style = ZonosTooltipStyle0;
|
|
26
|
+
|
|
27
|
+
exports.zonos_tooltip = ZonosTooltip;
|
|
@@ -25,12 +25,15 @@ export class ZonosCartSubtotal {
|
|
|
25
25
|
amount: cartStore.shipping,
|
|
26
26
|
currency: cartStore.currency,
|
|
27
27
|
})
|
|
28
|
-
: '-')), showDutyTaxesInfo && (h("tr", { class: "zonos--row zonos--cart-duties" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("div", { class: "zonos--title-with-icon" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Duties, taxes, and fees')), h("zonos-tooltip", { label: translate('Nothing due at the door') }, h("zonos-icon", { "aria-label": "Learn more about duties, taxes, and fees", content: InfoIcon, size: 16 })))
|
|
28
|
+
: '-')), showDutyTaxesInfo && (h("tr", { class: "zonos--row zonos--cart-duties" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("div", { class: "zonos--title-with-icon" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Duties, taxes, and fees')), h("zonos-tooltip", { label: translate('Nothing due at the door') }, h("zonos-icon", { "aria-label": "Learn more about duties, taxes, and fees", content: InfoIcon, size: 16 })))), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, h("div", { class: "zonos--cart-duty-tax-price" }, cartStore.dutiesTaxFees
|
|
29
29
|
? currencyFormat({
|
|
30
30
|
amount: cartStore.dutiesTaxFees,
|
|
31
31
|
currency: cartStore.currency,
|
|
32
32
|
})
|
|
33
|
-
: '-', cartStore.
|
|
33
|
+
: '-')))), !!cartStore.adjustmentTotal && (h("tr", { class: "zonos--row zonos--cart-duties" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("div", { class: "zonos--title-with-icon" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Discounts')))), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, h("zonos-text", { type: "semiBoldLabel" }, currencyFormat({
|
|
34
|
+
amount: cartStore.adjustmentTotal,
|
|
35
|
+
currency: cartStore.currency,
|
|
36
|
+
}))))), h("tr", { class: "zonos--row zonos--cart-pay-total" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Order total'))), h("td", { class: "zonos--column" }, h("zonos-text", { type: "semiBoldLabel" }, currencyFormat({
|
|
34
37
|
amount: total,
|
|
35
38
|
currency: cartStore.currency,
|
|
36
39
|
})))))));
|
|
@@ -19,6 +19,8 @@ import { log } from "../../utils/logging/log";
|
|
|
19
19
|
import { logError } from "../../utils/logging/logError";
|
|
20
20
|
import { mergeConfig } from "../../utils/mergeConfig";
|
|
21
21
|
import { submitGtag } from "../../utils/submitGtag";
|
|
22
|
+
import { setupCartData } from "../../../scripts/cart/_setupCartData";
|
|
23
|
+
import { checkoutHiddenBtnSelector, domesticRedirectedBtnSelector, } from "../../../types/checkout/CheckoutConfig";
|
|
22
24
|
/** These assets neet to be in relative path as https://www.npmjs.com/package/stencil-inline-svg suggested */
|
|
23
25
|
// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
|
|
24
26
|
import MessageIcon from "./assets/MessageIcon.svg";
|
|
@@ -68,9 +70,7 @@ export class ZonosCheckout {
|
|
|
68
70
|
this.isMobile = false;
|
|
69
71
|
this.zonosReviewRef = undefined;
|
|
70
72
|
this.storybookPaymentStatusOverride = undefined;
|
|
71
|
-
this.
|
|
72
|
-
this.legacyCheckoutHiddenBtnSelector = '#legacy-checkout-hidden-button';
|
|
73
|
-
this.isLegacyCheckout = false;
|
|
73
|
+
this.isLegacyCheckout = window.Zonos.isLegacyCheckout;
|
|
74
74
|
this.confirmDialogOpen = false;
|
|
75
75
|
this.inventoryCheckErrorMessage = null;
|
|
76
76
|
}
|
|
@@ -79,7 +79,10 @@ export class ZonosCheckout {
|
|
|
79
79
|
*/
|
|
80
80
|
async initCartInfoHandler(e) {
|
|
81
81
|
const cartItems = e.detail;
|
|
82
|
-
void cartStoreUpdateItems(
|
|
82
|
+
void cartStoreUpdateItems({
|
|
83
|
+
adjustments: cartStore.adjustments,
|
|
84
|
+
cartItems,
|
|
85
|
+
});
|
|
83
86
|
}
|
|
84
87
|
async handleKeyPress(e) {
|
|
85
88
|
if (e.key === 'Escape') {
|
|
@@ -121,9 +124,24 @@ export class ZonosCheckout {
|
|
|
121
124
|
}
|
|
122
125
|
async buildCartAndInit() {
|
|
123
126
|
// if tempCartUUID is provided, use it instead of buildCartDetail
|
|
124
|
-
if (window.Zonos.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
+
if (window.Zonos.cartData) {
|
|
128
|
+
log('tempCartUUID is provided, start building cart');
|
|
129
|
+
const { adjustments, cartItems } = buildCartItemsByTempCart(window.Zonos.cartData);
|
|
130
|
+
await cartStoreUpdateItems({ adjustments, cartItems });
|
|
131
|
+
}
|
|
132
|
+
// if createCartId is provided, use it to build cart. Merchant will provide create a cart from their server side and give the cart id to us.
|
|
133
|
+
else if (typeof zonosStore.checkoutSettings.createCartId === 'function') {
|
|
134
|
+
log('"createCartId" is provided, start building cart');
|
|
135
|
+
const cartId = await zonosStore.checkoutSettings.createCartId();
|
|
136
|
+
window.Zonos.cartId = cartId;
|
|
137
|
+
const cartResult = await setupCartData(cartId);
|
|
138
|
+
const cartData = cartResult === null || cartResult === void 0 ? void 0 : cartResult.cartData;
|
|
139
|
+
if (!cartData) {
|
|
140
|
+
logError('Fail to build cart, please try again.');
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const { adjustments, cartItems } = buildCartItemsByTempCart(cartData);
|
|
144
|
+
await cartStoreUpdateItems({ adjustments, cartItems });
|
|
127
145
|
}
|
|
128
146
|
else if (zonosStore.checkoutSettings.buildCartDetail &&
|
|
129
147
|
localizationStore.selectedCountryCode) {
|
|
@@ -132,7 +150,7 @@ export class ZonosCheckout {
|
|
|
132
150
|
countryCode: localizationStore.selectedCountryCode,
|
|
133
151
|
currencyCode: localizationStore.targetCurrency,
|
|
134
152
|
});
|
|
135
|
-
await cartStoreUpdateItems(cartItems);
|
|
153
|
+
await cartStoreUpdateItems({ adjustments: [], cartItems });
|
|
136
154
|
}
|
|
137
155
|
// if client secret doesn't exist, request a new one.
|
|
138
156
|
if (!stripeStore.clientSecret) {
|
|
@@ -152,12 +170,20 @@ export class ZonosCheckout {
|
|
|
152
170
|
attachCheckout() {
|
|
153
171
|
const buttonAnchorSelector = zonosStore.checkoutSettings.placeOrderButtonSelector;
|
|
154
172
|
log(`attach checkout ${buttonAnchorSelector}`);
|
|
155
|
-
if (
|
|
173
|
+
// allow to load checkout if cartData is ready (Checkout can be loaded right awaiy if tempCartUUID is in the URL)
|
|
174
|
+
if (!buttonAnchorSelector && !window.Zonos.cartData) {
|
|
156
175
|
// do nothing if button element is not found
|
|
157
176
|
return;
|
|
158
177
|
}
|
|
178
|
+
const selectors = [
|
|
179
|
+
buttonAnchorSelector,
|
|
180
|
+
// hidden button for domestic redirected
|
|
181
|
+
`#${domesticRedirectedBtnSelector}`,
|
|
182
|
+
// hidden button for legacy checkout facade
|
|
183
|
+
`#${checkoutHiddenBtnSelector}`,
|
|
184
|
+
].filter(Boolean);
|
|
159
185
|
// also attach event to hidden button if user was redirected with shipping address session
|
|
160
|
-
const buttonAnchorElements = document.querySelectorAll(
|
|
186
|
+
const buttonAnchorElements = document.querySelectorAll(selectors.join(','));
|
|
161
187
|
// only attach event once, and looping through all of the button elements
|
|
162
188
|
buttonAnchorElements.forEach(button => {
|
|
163
189
|
const isEventAttached = button.getAttribute('data-zonos-checkout-attached');
|
|
@@ -213,15 +239,15 @@ export class ZonosCheckout {
|
|
|
213
239
|
}
|
|
214
240
|
button.setAttribute('data-zonos-checkout-attached', 'true');
|
|
215
241
|
// if this button is the hidden button, trigger the click event
|
|
216
|
-
if (button.matches(
|
|
242
|
+
if (button.matches(domesticRedirectedBtnSelector)) {
|
|
217
243
|
button.dispatchEvent(createCustomEvent('click'));
|
|
218
244
|
// cleanup shipping session after button is clicked
|
|
219
245
|
stripeStoreCleanupDomesticShippingSession();
|
|
220
246
|
// remove the button after it's clicked
|
|
221
247
|
button.remove();
|
|
222
248
|
}
|
|
223
|
-
|
|
224
|
-
|
|
249
|
+
// For legacy checkout facade and in case the cart is provided in the query param, open Checkout right away
|
|
250
|
+
if (button.matches(`#${checkoutHiddenBtnSelector}`)) {
|
|
225
251
|
// trigger the click event on the button
|
|
226
252
|
button.dispatchEvent(createCustomEvent('click'));
|
|
227
253
|
button.remove();
|
|
@@ -283,7 +309,7 @@ export class ZonosCheckout {
|
|
|
283
309
|
this.stripe = window.Zonos.stripe;
|
|
284
310
|
// check if bigcommerce, if user enters the shipping address that's in the shipping zone at bigcommerce checkout
|
|
285
311
|
watchBigcommerceDomesticCheckout({
|
|
286
|
-
domesticRedirectedBtnSelector:
|
|
312
|
+
domesticRedirectedBtnSelector: domesticRedirectedBtnSelector,
|
|
287
313
|
onShippingAddressSessionFound: shippingAddressSession => {
|
|
288
314
|
// prefilled the default address if shipping address session is found for checkout on open
|
|
289
315
|
this.defaultAddress = {
|
|
@@ -304,7 +330,7 @@ export class ZonosCheckout {
|
|
|
304
330
|
/**
|
|
305
331
|
* When temp cart data is available, set default address if exist
|
|
306
332
|
*/
|
|
307
|
-
if (window.Zonos
|
|
333
|
+
if (window.Zonos) {
|
|
308
334
|
this.useLegacyQueryParam();
|
|
309
335
|
}
|
|
310
336
|
// only init checkout if visitor's country is in the shipping zones.
|
|
@@ -430,9 +456,9 @@ export class ZonosCheckout {
|
|
|
430
456
|
// reset cart store
|
|
431
457
|
cartStoreReset();
|
|
432
458
|
// redirect to vendor store url if this is legacy checkout.
|
|
433
|
-
if (
|
|
434
|
-
const
|
|
435
|
-
window.location.href =
|
|
459
|
+
if (window.Zonos.isLegacyCheckout && window.Zonos.cartData) {
|
|
460
|
+
const storeBaseUrl = window.Zonos.cartData.storeBaseUrl;
|
|
461
|
+
window.location.href = storeBaseUrl;
|
|
436
462
|
return;
|
|
437
463
|
}
|
|
438
464
|
// reset url
|
|
@@ -705,8 +731,6 @@ export class ZonosCheckout {
|
|
|
705
731
|
"isMobile": {},
|
|
706
732
|
"zonosReviewRef": {},
|
|
707
733
|
"storybookPaymentStatusOverride": {},
|
|
708
|
-
"domesticRedirectedBtnSelector": {},
|
|
709
|
-
"legacyCheckoutHiddenBtnSelector": {},
|
|
710
734
|
"isLegacyCheckout": {},
|
|
711
735
|
"confirmDialogOpen": {},
|
|
712
736
|
"inventoryCheckErrorMessage": {}
|
|
@@ -55,7 +55,7 @@ export class ZonosController {
|
|
|
55
55
|
searchParams.set('family', fontSelected);
|
|
56
56
|
const { errors, json } = await handleFetch(`/api/zonos-elements/get-font-detail?${searchParams.toString()}`);
|
|
57
57
|
// Keep using Inter font, font in the setting maybe outdated and not found in google font, API will return Inter font instead
|
|
58
|
-
if (errors.length > 0 || !json) {
|
|
58
|
+
if (errors.length > 0 || !(json === null || json === void 0 ? void 0 : json.fontUrl)) {
|
|
59
59
|
log(`Failed to load font ${fontSelected}`, 'warn');
|
|
60
60
|
zonosStore.appearance = Object.assign(Object.assign({}, zonosStore.appearance), { fontFamily: 'Inter' });
|
|
61
61
|
return;
|
|
@@ -195,7 +195,7 @@ export class ZonosController {
|
|
|
195
195
|
zonosStore.organizationName = organizationName;
|
|
196
196
|
}
|
|
197
197
|
render() {
|
|
198
|
-
return h(Host, { key: '
|
|
198
|
+
return h(Host, { key: '4d7d784a50ebcb61ee4658198f3dcf756daf8d70', class: "zonos--elements" });
|
|
199
199
|
}
|
|
200
200
|
static get is() { return "zonos-controller"; }
|
|
201
201
|
static get encapsulation() { return "shadow"; }
|
|
@@ -7,6 +7,8 @@ import { getDaysDifference } from "../../utils/getDaysDifference";
|
|
|
7
7
|
import { log } from "../../utils/logging/log";
|
|
8
8
|
import { logError } from "../../utils/logging/logError";
|
|
9
9
|
const { onChange, reset, state: cartStore, } = createStore(() => ({
|
|
10
|
+
adjustmentTotal: 0,
|
|
11
|
+
adjustments: [],
|
|
10
12
|
checkoutSessionId: sessionStorage.getItem('zonos--checkout-session-id') || null,
|
|
11
13
|
checkoutSessionTimeoutShow: false,
|
|
12
14
|
checkoutTimeoutInterval: null,
|
|
@@ -127,6 +129,7 @@ const cartStoreUpdateToErrorState = ({ messages, title, }) => {
|
|
|
127
129
|
const cartStoreApplySubtotals = (subtotals) => {
|
|
128
130
|
// update exchange rate so we can use it to display cart items
|
|
129
131
|
cartStore.exchangeRate = subtotals.exchangeRate;
|
|
132
|
+
cartStore.adjustmentTotal = subtotals.adjustments;
|
|
130
133
|
cartStore.dutiesTaxFees = subtotals.landedCostTotal;
|
|
131
134
|
cartStore.subtotal = subtotals.items;
|
|
132
135
|
cartStore.total = subtotals.total;
|
|
@@ -142,7 +145,7 @@ const cartStoreHasOneEligibleItem = () => {
|
|
|
142
145
|
// if there is no item restricted found => all items are restricted
|
|
143
146
|
return !!checkItems.find(item => !item.isRestricted);
|
|
144
147
|
};
|
|
145
|
-
const cartStoreReCalculateTotal = async ({ currency, itemsAmount, landedCostId, }) => {
|
|
148
|
+
const cartStoreReCalculateTotal = async ({ adjustmentAmount, cartId, currency, itemsAmount, landedCostId, }) => {
|
|
146
149
|
if (landedCostId && cartStore.selectedLandedCost) {
|
|
147
150
|
// update cart total right away if we have landed cost id to avoid order total flickering
|
|
148
151
|
const subtotals = cartStore.selectedLandedCost.subtotals;
|
|
@@ -155,6 +158,8 @@ const cartStoreReCalculateTotal = async ({ currency, itemsAmount, landedCostId,
|
|
|
155
158
|
return false;
|
|
156
159
|
}
|
|
157
160
|
const { errors, json } = await stripeStoreUpdateCheckoutSession({
|
|
161
|
+
adjustmentAmount,
|
|
162
|
+
cartId,
|
|
158
163
|
currency,
|
|
159
164
|
id: cartStore.checkoutSessionId,
|
|
160
165
|
itemsAmount,
|
|
@@ -211,6 +216,8 @@ const cartStoreUpdateSelectedShippingOption = async (selectedShippingOption) =>
|
|
|
211
216
|
cartStore.isSelectedShippingGuarantee = isGuarantee;
|
|
212
217
|
// update session with selected landed cost
|
|
213
218
|
const updateCalulateStatus = await cartStoreReCalculateTotal({
|
|
219
|
+
adjustmentAmount: cartStore.adjustmentTotal,
|
|
220
|
+
cartId: window.Zonos.cartId,
|
|
214
221
|
landedCostId: (_e = selectedLandedCost.landedCost) === null || _e === void 0 ? void 0 : _e.id,
|
|
215
222
|
});
|
|
216
223
|
return updateCalulateStatus;
|
|
@@ -250,13 +257,16 @@ const cartStoreResetCartItems = () => {
|
|
|
250
257
|
cartStore.items = cartStore.items.map(item => (Object.assign(Object.assign({}, item), { isRestricted: false })));
|
|
251
258
|
cartStore.restrictedItems = [];
|
|
252
259
|
};
|
|
253
|
-
const cartStoreUpdateItems = async (cartItems) => {
|
|
260
|
+
const cartStoreUpdateItems = async ({ adjustments, cartItems, }) => {
|
|
254
261
|
var _a;
|
|
262
|
+
// Update adjustments and items
|
|
263
|
+
cartStore.adjustments = adjustments;
|
|
255
264
|
cartStore.items = getCartItemToUse(cartItems);
|
|
256
265
|
const currency = (_a = cartItems.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode;
|
|
257
266
|
const total = cartItems.reduce((amt, item) => {
|
|
258
267
|
return amt + item.amount * item.quantity;
|
|
259
268
|
}, 0);
|
|
269
|
+
const adjustmenTotal = adjustments.reduce((amt, adjustment) => amt + adjustment.amount, 0);
|
|
260
270
|
if (!currency || !total) {
|
|
261
271
|
// do nothing if we can't get currency or total
|
|
262
272
|
return;
|
|
@@ -265,6 +275,8 @@ const cartStoreUpdateItems = async (cartItems) => {
|
|
|
265
275
|
// set loading state here because this is first load checkout session when we already have checkout session id stored
|
|
266
276
|
stripeStore.isFetchingSession = true;
|
|
267
277
|
await cartStoreReCalculateTotal({
|
|
278
|
+
adjustmentAmount: adjustmenTotal,
|
|
279
|
+
cartId: window.Zonos.cartId,
|
|
268
280
|
currency: currency,
|
|
269
281
|
itemsAmount: total,
|
|
270
282
|
});
|
|
@@ -3,7 +3,7 @@ import { cartStore, cartStoreApplySubtotals, cartStoreCheckItemRestrictions, car
|
|
|
3
3
|
import { localizationStore } from "../hello/localization";
|
|
4
4
|
import { translate } from "../translationStore";
|
|
5
5
|
import { zonosStore } from "../zonosStore";
|
|
6
|
-
import {
|
|
6
|
+
import { calculateLandedCostNormalized } from "../../utils/api/calculateLandedCostNormaliz";
|
|
7
7
|
import { buildTranslateRequestBody } from "../../utils/checkout/buildTranslateRequestBody";
|
|
8
8
|
import { handleFetch } from "../../utils/handleFetch";
|
|
9
9
|
import { isDarkColor } from "../../utils/isDarkColor";
|
|
@@ -196,13 +196,13 @@ const stripeStorePrefetchLandedCost = async () => {
|
|
|
196
196
|
stripeStore.fetchingLandedCostAbordController = abortController;
|
|
197
197
|
// Reset cart items to non-restricted state and restricted item list
|
|
198
198
|
cartStoreResetCartItems();
|
|
199
|
-
const { checkoutSessionWorkflow, itemCreateWorkflow, landedCostCalculateWorkflow, shipmentRatingCalculateWorkflow, } = await
|
|
199
|
+
const { checkoutSessionWorkflow, itemCreateWorkflow, landedCostCalculateWorkflow, shipmentRatingCalculateWorkflow, } = await calculateLandedCostNormalized(abortController);
|
|
200
200
|
// reset abort controller after we are done
|
|
201
201
|
stripeStore.fetchingLandedCostAbordController = null;
|
|
202
202
|
// update cart store with landed cost info
|
|
203
203
|
cartStore.landedCostData =
|
|
204
204
|
(checkoutSessionWorkflow === null || checkoutSessionWorkflow === void 0 ? void 0 : checkoutSessionWorkflow.map(checkoutSession => {
|
|
205
|
-
const foundLandedCost = landedCostCalculateWorkflow === null || landedCostCalculateWorkflow === void 0 ? void 0 : landedCostCalculateWorkflow.find(item =>
|
|
205
|
+
const foundLandedCost = landedCostCalculateWorkflow === null || landedCostCalculateWorkflow === void 0 ? void 0 : landedCostCalculateWorkflow.find(item => (item === null || item === void 0 ? void 0 : item.id) === checkoutSession.landedCostId);
|
|
206
206
|
if (!foundLandedCost) {
|
|
207
207
|
return null;
|
|
208
208
|
}
|
|
@@ -220,6 +220,7 @@ const stripeStorePrefetchLandedCost = async () => {
|
|
|
220
220
|
if (subtotals) {
|
|
221
221
|
// prefetch landed cost will not update shipping and taxes since we haven't selected shipping method yet
|
|
222
222
|
cartStoreApplySubtotals({
|
|
223
|
+
adjustments: subtotals.adjustments,
|
|
223
224
|
exchangeRate: subtotals.exchangeRate,
|
|
224
225
|
items: subtotals.items,
|
|
225
226
|
landedCostTotal: 0,
|
|
@@ -360,6 +361,8 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
360
361
|
stripeStore.isFetchingSession = true;
|
|
361
362
|
const { errors, json } = await handleFetch('/api/zonos-elements/create-checkout-session', {
|
|
362
363
|
body: {
|
|
364
|
+
adjustmentAmount: cartStore.adjustments.reduce((prev, adj) => prev + adj.amount, 0),
|
|
365
|
+
cartId: window.Zonos.cartId,
|
|
363
366
|
currency: ((_a = cartStore.items.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode) || '',
|
|
364
367
|
itemsAmount: total,
|
|
365
368
|
metadata: [{ key: 'language', value: localizationStore.selectedLocale }],
|
|
@@ -384,11 +387,13 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
384
387
|
/**
|
|
385
388
|
* Update checkout session. Use for updating amount with landed cost id, or update session when cart items change
|
|
386
389
|
*/
|
|
387
|
-
const stripeStoreUpdateCheckoutSession = async ({ currency, id, itemsAmount, landedCostId, presentmentCountryCode, }) => {
|
|
390
|
+
const stripeStoreUpdateCheckoutSession = async ({ adjustmentAmount, cartId, currency, id, itemsAmount, landedCostId, presentmentCountryCode, }) => {
|
|
388
391
|
// No need to set loading state here because this function will be called under the hood to update
|
|
389
392
|
// landed cost id for the section.
|
|
390
393
|
const { errors, json } = await handleFetch('/api/zonos-elements/update-checkout-session', {
|
|
391
394
|
body: {
|
|
395
|
+
adjustmentAmount,
|
|
396
|
+
cartId,
|
|
392
397
|
currency,
|
|
393
398
|
id,
|
|
394
399
|
itemsAmount,
|
|
@@ -68,6 +68,9 @@ export const stringsArabic = {
|
|
|
68
68
|
'Delivery options': {
|
|
69
69
|
value: 'خيارات التوصيل',
|
|
70
70
|
},
|
|
71
|
+
Discounts: {
|
|
72
|
+
value: 'خصومات',
|
|
73
|
+
},
|
|
71
74
|
"Don't close": {
|
|
72
75
|
value: 'لا تغلق',
|
|
73
76
|
},
|
|
@@ -146,9 +149,6 @@ export const stringsArabic = {
|
|
|
146
149
|
'Nothing due at the door': {
|
|
147
150
|
value: 'لا شيء مستحق عند الباب',
|
|
148
151
|
},
|
|
149
|
-
'Order is over the de minimis threshold for both duty and tax': {
|
|
150
|
-
value: 'الطلبية أعلى من الحد الأدنى لكل من الرسوم والضرائب',
|
|
151
|
-
},
|
|
152
152
|
'Order total': {
|
|
153
153
|
value: 'إجمالي الطلبية',
|
|
154
154
|
},
|