@zonos/elements 1.3.18-alpha.2 → 1.3.18-alpha.3
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/README.md +341 -96
- package/dist/cjs/{cart-941a31dd.js → cart-5468dfd1.js} +29 -84
- package/dist/cjs/index.cjs.js +624 -0
- package/dist/cjs/logError-4e2f2020.js +58 -0
- package/dist/cjs/{submitGtag-9210b4fe.js → submitGtag-127a220f.js} +3 -2
- package/dist/cjs/zonos-address_8.cjs.entry.js +13 -12
- package/dist/cjs/zonos-badge_2.cjs.entry.js +3 -3
- package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
- package/dist/cjs/zonos-card_2.cjs.entry.js +7 -6
- package/dist/cjs/zonos-cart-items_11.cjs.entry.js +11 -10
- package/dist/cjs/zonos-checkout.cjs.entry.js +15 -14
- package/dist/cjs/zonos-controller.cjs.entry.js +25 -20
- package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -1
- package/dist/cjs/zonos-country-select_3.cjs.entry.js +6 -5
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -1
- package/dist/cjs/zonos-hello.cjs.entry.js +10 -9
- package/dist/cjs/zonos-input.cjs.entry.js +4 -4
- package/dist/cjs/zonos-link.cjs.entry.js +1 -1
- package/dist/cjs/zonos-payment.cjs.entry.js +3 -2
- package/dist/collection/__mocks__/zonos-url/index.js +1 -0
- package/dist/collection/__tests__/build-utils/urlCheckOne.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +4 -9
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +3 -3
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +3 -3
- package/dist/collection/components/common/zonos-badge/zonos-badge.js +3 -3
- package/dist/collection/components/common/zonos-button/zonos-button.js +3 -3
- package/dist/collection/components/common/zonos-card/zonos-card.js +3 -3
- package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +3 -3
- package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +3 -3
- package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
- package/dist/collection/components/common/zonos-confirm-dialog/zonos-confirm-dialog.js +3 -3
- package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +2 -2
- package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
- package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
- package/dist/collection/components/common/zonos-input/zonos-input.js +4 -4
- package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
- package/dist/collection/components/common/{component-template/zonos-link → zonos-link}/zonos-link.js +1 -1
- package/dist/collection/components/main/zonos-controller.js +10 -6
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +3 -3
- package/dist/collection/environment.js +0 -2
- package/dist/collection/index.js +1 -0
- package/dist/collection/scripts/_extractZonosQaUrl.js +26 -0
- package/dist/collection/scripts/_getZonosQaUrl.js +40 -0
- package/dist/collection/scripts/{loadStripe.js → _loadStripe.js} +1 -1
- package/dist/collection/scripts/{zonosBase.js → _zonosBase.js} +29 -6
- package/dist/collection/scripts/index.js +2 -0
- package/dist/collection/types/generated/graphql.customer.types.js +1 -0
- package/dist/collection/types/generated/graphql.frontend.types.js +1 -0
- package/dist/esm/{cart-cc593c2b.js → cart-63d120e1.js} +2 -55
- package/dist/esm/index.js +621 -0
- package/dist/esm/logError-c456c092.js +55 -0
- package/dist/esm/{submitGtag-e50f903f.js → submitGtag-35bb3945.js} +2 -1
- package/dist/esm/zonos-address_8.entry.js +11 -10
- package/dist/esm/zonos-badge_2.entry.js +3 -3
- package/dist/esm/zonos-button_3.entry.js +3 -3
- package/dist/esm/zonos-card_2.entry.js +7 -6
- package/dist/esm/zonos-cart-items_11.entry.js +11 -10
- package/dist/esm/zonos-checkout.entry.js +3 -2
- package/dist/esm/zonos-controller.entry.js +8 -3
- package/dist/esm/zonos-country-flag.entry.js +2 -1
- package/dist/esm/zonos-country-select_3.entry.js +6 -5
- package/dist/esm/zonos-hello-dialog.entry.js +2 -1
- package/dist/esm/zonos-hello.entry.js +2 -1
- package/dist/esm/zonos-input.entry.js +4 -4
- package/dist/esm/zonos-link.entry.js +1 -1
- package/dist/esm/zonos-payment.entry.js +2 -1
- package/dist/esm-es5/cart-63d120e1.js +1 -0
- package/dist/esm-es5/index.js +1 -0
- package/dist/esm-es5/logError-c456c092.js +1 -0
- package/dist/esm-es5/submitGtag-35bb3945.js +1 -0
- package/dist/esm-es5/zonos-address_8.entry.js +1 -1
- package/dist/esm-es5/zonos-badge_2.entry.js +1 -1
- package/dist/esm-es5/zonos-button_3.entry.js +1 -1
- package/dist/esm-es5/zonos-card_2.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_11.entry.js +1 -1
- 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_3.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-link.entry.js +1 -1
- package/dist/esm-es5/zonos-payment.entry.js +1 -1
- package/dist/scripts/index.d.ts +3908 -0
- package/dist/scripts/index.js +1 -0
- package/dist/scripts/loadZonos.d.ts +3954 -0
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +5 -7
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +2 -2
- package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +2 -2
- package/dist/types/components/main/zonos-controller.d.ts +1 -1
- package/dist/types/components/store/checkout/stripe.d.ts +1 -1
- package/dist/types/components/store/zonosStore.d.ts +1 -1
- package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +2 -2
- package/dist/types/components/utils/styles.d.ts +1 -0
- package/dist/types/components.d.ts +22 -14
- package/dist/types/index.d.ts +1 -0
- package/dist/types/scripts/_extractZonosQaUrl.d.ts +11 -0
- package/dist/types/scripts/_getZonosQaUrl.d.ts +4 -0
- package/dist/types/scripts/{loadStripe.d.ts → _loadStripe.d.ts} +1 -1
- package/dist/types/scripts/{zonosBase.d.ts → _zonosBase.d.ts} +36 -2
- package/dist/types/scripts/index.d.ts +2 -0
- package/dist/types/types/checkout/CheckoutConfig.d.ts +5 -0
- package/dist/types/types/checkout/api/CalculateLandedCostRequest.d.ts +9 -0
- package/dist/types/types/generated/graphql.customer.types.d.ts +1 -0
- package/dist/types/types/generated/graphql.customer.types.ts +3 -0
- package/dist/types/types/generated/graphql.frontend.types.d.ts +1 -0
- package/dist/types/types/generated/graphql.frontend.types.ts +1 -0
- package/dist/types/types/global.d.ts +1 -1
- package/dist/zonos-elements/index.esm.js +1 -0
- package/dist/zonos-elements/p-023c764c.system.entry.js +1 -0
- package/dist/zonos-elements/p-06b6ce37.system.entry.js +1 -0
- package/dist/zonos-elements/p-07c53d83.entry.js +1 -0
- package/dist/zonos-elements/{p-9aab3ad7.entry.js → p-0d5b5bcc.entry.js} +1 -1
- package/dist/zonos-elements/p-200b661c.entry.js +1 -0
- package/dist/zonos-elements/p-3b66df06.system.entry.js +1 -0
- package/dist/zonos-elements/{p-020a9b86.entry.js → p-3ba8838a.entry.js} +1 -1
- package/dist/zonos-elements/p-428c034a.entry.js +1 -0
- package/dist/zonos-elements/p-43b2d28d.system.entry.js +1 -0
- package/dist/zonos-elements/p-47a42a30.js +1 -0
- package/dist/zonos-elements/{p-d0bc8902.system.entry.js → p-4f72bfee.system.entry.js} +1 -1
- package/dist/zonos-elements/p-4fc1459c.entry.js +1 -0
- package/dist/zonos-elements/p-4fca8fd5.system.entry.js +1 -0
- package/dist/zonos-elements/{p-9e9c318b.entry.js → p-58fc8ec1.entry.js} +1 -1
- package/dist/zonos-elements/p-63db40b9.system.js +1 -0
- package/dist/zonos-elements/{p-c20e5430.entry.js → p-6cb9812b.entry.js} +1 -1
- package/dist/zonos-elements/p-6df1fc3a.system.entry.js +1 -0
- package/dist/zonos-elements/p-6f6f160d.entry.js +1 -0
- package/dist/zonos-elements/p-7c78e340.entry.js +1 -0
- package/dist/zonos-elements/p-808fa731.js +1 -0
- package/dist/zonos-elements/p-80f174b9.system.js +1 -0
- package/dist/zonos-elements/p-85f3d13f.system.js +1 -0
- package/dist/zonos-elements/p-8aeb0629.entry.js +1 -0
- package/dist/zonos-elements/p-9288fd21.system.entry.js +1 -0
- package/dist/zonos-elements/p-98ad4ab3.system.entry.js +1 -0
- package/dist/zonos-elements/p-b1567fa3.system.entry.js +1 -0
- package/dist/zonos-elements/p-b81562f5.entry.js +1 -0
- package/dist/zonos-elements/{p-96b8c9ba.system.entry.js → p-bdfa3705.system.entry.js} +1 -1
- package/dist/zonos-elements/p-cfae51c1.system.js +1 -0
- package/dist/zonos-elements/p-d6eb260c.entry.js +1 -0
- package/dist/zonos-elements/p-dc40a60c.entry.js +1 -0
- package/dist/zonos-elements/{p-3e26d7b3.system.entry.js → p-dda78e8e.system.entry.js} +1 -1
- package/dist/zonos-elements/p-de405d7e.system.entry.js +1 -0
- package/dist/zonos-elements/p-e0bf9666.system.js +1 -1
- package/dist/zonos-elements/p-eaa335e1.js +1 -0
- package/dist/zonos-elements/{p-e13bfbda.system.entry.js → p-ed3524ae.system.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +4 -2
- package/dist/components/ILanguage.js +0 -24
- package/dist/components/classes.js +0 -12
- package/dist/components/containsNonLatinChars.js +0 -21
- package/dist/components/formatCurrency.js +0 -11
- package/dist/components/getBorderRadius.js +0 -18
- package/dist/components/index.d.ts +0 -33
- package/dist/components/index.js +0 -1
- package/dist/components/isCheckoutMobile.js +0 -6
- package/dist/components/isColorVariable.js +0 -14
- package/dist/components/isDarkColor.js +0 -1199
- package/dist/components/stripe.js +0 -1691
- package/dist/components/submitGtag.js +0 -19
- package/dist/components/trackConversionEvent.js +0 -37
- package/dist/components/translationStore.js +0 -5611
- package/dist/components/zonos-address-display.d.ts +0 -11
- package/dist/components/zonos-address-display.js +0 -6
- package/dist/components/zonos-address-display2.js +0 -64
- package/dist/components/zonos-address-form.d.ts +0 -11
- package/dist/components/zonos-address-form.js +0 -6
- package/dist/components/zonos-address-form2.js +0 -84
- package/dist/components/zonos-address-update-dialog.d.ts +0 -11
- package/dist/components/zonos-address-update-dialog.js +0 -6
- package/dist/components/zonos-address-update-dialog2.js +0 -264
- package/dist/components/zonos-address.d.ts +0 -11
- package/dist/components/zonos-address.js +0 -6
- package/dist/components/zonos-address2.js +0 -176
- package/dist/components/zonos-badge.d.ts +0 -11
- package/dist/components/zonos-badge.js +0 -6
- package/dist/components/zonos-badge2.js +0 -61
- package/dist/components/zonos-banner.d.ts +0 -11
- package/dist/components/zonos-banner.js +0 -6
- package/dist/components/zonos-banner2.js +0 -95
- package/dist/components/zonos-button.d.ts +0 -11
- package/dist/components/zonos-button.js +0 -6
- package/dist/components/zonos-button2.js +0 -186
- package/dist/components/zonos-card.d.ts +0 -11
- package/dist/components/zonos-card.js +0 -6
- package/dist/components/zonos-card2.js +0 -57
- package/dist/components/zonos-cart-items.d.ts +0 -11
- package/dist/components/zonos-cart-items.js +0 -6
- package/dist/components/zonos-cart-items2.js +0 -57
- package/dist/components/zonos-cart-restricted-items.d.ts +0 -11
- package/dist/components/zonos-cart-restricted-items.js +0 -6
- package/dist/components/zonos-cart-restricted-items2.js +0 -135
- package/dist/components/zonos-cart-subtotal.d.ts +0 -11
- package/dist/components/zonos-cart-subtotal.js +0 -6
- package/dist/components/zonos-cart-subtotal2.js +0 -91
- package/dist/components/zonos-checkbox.d.ts +0 -11
- package/dist/components/zonos-checkbox.js +0 -6
- package/dist/components/zonos-checkbox2.js +0 -96
- package/dist/components/zonos-checkout-finish.d.ts +0 -11
- package/dist/components/zonos-checkout-finish.js +0 -6
- package/dist/components/zonos-checkout-finish2.js +0 -246
- package/dist/components/zonos-checkout-footer.d.ts +0 -11
- package/dist/components/zonos-checkout-footer.js +0 -6
- package/dist/components/zonos-checkout-footer2.js +0 -125
- package/dist/components/zonos-checkout-payment.d.ts +0 -11
- package/dist/components/zonos-checkout-payment.js +0 -6
- package/dist/components/zonos-checkout-payment2.js +0 -104
- package/dist/components/zonos-checkout-progress-tabs.d.ts +0 -11
- package/dist/components/zonos-checkout-progress-tabs.js +0 -6
- package/dist/components/zonos-checkout-progress-tabs2.js +0 -138
- package/dist/components/zonos-checkout.d.ts +0 -11
- package/dist/components/zonos-checkout.js +0 -1051
- package/dist/components/zonos-collapse.d.ts +0 -11
- package/dist/components/zonos-collapse.js +0 -6
- package/dist/components/zonos-collapse2.js +0 -78
- package/dist/components/zonos-component.d.ts +0 -11
- package/dist/components/zonos-component.js +0 -48
- package/dist/components/zonos-confirm-dialog.d.ts +0 -11
- package/dist/components/zonos-confirm-dialog.js +0 -6
- package/dist/components/zonos-confirm-dialog2.js +0 -161
- package/dist/components/zonos-controller.d.ts +0 -11
- package/dist/components/zonos-controller.js +0 -309
- package/dist/components/zonos-country-flag.d.ts +0 -11
- package/dist/components/zonos-country-flag.js +0 -6
- package/dist/components/zonos-country-flag2.js +0 -54
- package/dist/components/zonos-country-select.d.ts +0 -11
- package/dist/components/zonos-country-select.js +0 -6
- package/dist/components/zonos-country-select2.js +0 -1891
- package/dist/components/zonos-custom-message.d.ts +0 -11
- package/dist/components/zonos-custom-message.js +0 -6
- package/dist/components/zonos-custom-message2.js +0 -72
- package/dist/components/zonos-customer-info.d.ts +0 -11
- package/dist/components/zonos-customer-info.js +0 -6
- package/dist/components/zonos-customer-info2.js +0 -316
- package/dist/components/zonos-dialog.d.ts +0 -11
- package/dist/components/zonos-dialog.js +0 -6
- package/dist/components/zonos-dialog2.js +0 -136
- package/dist/components/zonos-hello-dialog-footer.d.ts +0 -11
- package/dist/components/zonos-hello-dialog-footer.js +0 -6
- package/dist/components/zonos-hello-dialog-footer2.js +0 -83
- package/dist/components/zonos-hello-dialog.d.ts +0 -11
- package/dist/components/zonos-hello-dialog.js +0 -6
- package/dist/components/zonos-hello-dialog2.js +0 -305
- package/dist/components/zonos-hello.d.ts +0 -11
- package/dist/components/zonos-hello.js +0 -879
- package/dist/components/zonos-icon.d.ts +0 -11
- package/dist/components/zonos-icon.js +0 -6
- package/dist/components/zonos-icon2.js +0 -55
- package/dist/components/zonos-input.d.ts +0 -11
- package/dist/components/zonos-input.js +0 -6
- package/dist/components/zonos-input2.js +0 -78
- package/dist/components/zonos-language-select.d.ts +0 -11
- package/dist/components/zonos-language-select.js +0 -6
- package/dist/components/zonos-language-select2.js +0 -88
- package/dist/components/zonos-link-authentication.d.ts +0 -11
- package/dist/components/zonos-link-authentication.js +0 -6
- package/dist/components/zonos-link-authentication2.js +0 -80
- package/dist/components/zonos-link.d.ts +0 -11
- package/dist/components/zonos-link.js +0 -43
- package/dist/components/zonos-logo.d.ts +0 -11
- package/dist/components/zonos-logo.js +0 -49
- package/dist/components/zonos-notification.d.ts +0 -11
- package/dist/components/zonos-notification.js +0 -6
- package/dist/components/zonos-notification2.js +0 -92
- package/dist/components/zonos-payment.d.ts +0 -11
- package/dist/components/zonos-payment.js +0 -6
- package/dist/components/zonos-payment2.js +0 -77
- package/dist/components/zonos-review.d.ts +0 -11
- package/dist/components/zonos-review.js +0 -6
- package/dist/components/zonos-review2.js +0 -89
- package/dist/components/zonos-select-dialog-header.d.ts +0 -11
- package/dist/components/zonos-select-dialog-header.js +0 -6
- package/dist/components/zonos-select-dialog-header2.js +0 -71
- package/dist/components/zonos-shipping-rich-radio.d.ts +0 -11
- package/dist/components/zonos-shipping-rich-radio.js +0 -6
- package/dist/components/zonos-shipping-rich-radio2.js +0 -88
- package/dist/components/zonos-shipping.d.ts +0 -11
- package/dist/components/zonos-shipping.js +0 -6
- package/dist/components/zonos-shipping2.js +0 -159
- package/dist/components/zonos-spinner.d.ts +0 -11
- package/dist/components/zonos-spinner.js +0 -6
- package/dist/components/zonos-spinner2.js +0 -43
- package/dist/components/zonos-text.d.ts +0 -11
- package/dist/components/zonos-text.js +0 -6
- package/dist/components/zonos-text2.js +0 -182
- package/dist/components/zonos-tooltip.d.ts +0 -11
- package/dist/components/zonos-tooltip.js +0 -6
- package/dist/components/zonos-tooltip2.js +0 -48
- package/dist/components/zonos-v-stack.d.ts +0 -11
- package/dist/components/zonos-v-stack.js +0 -6
- package/dist/components/zonos-v-stack2.js +0 -38
- package/dist/components/zonosStore.js +0 -2881
- package/dist/esm-es5/cart-cc593c2b.js +0 -1
- package/dist/esm-es5/submitGtag-e50f903f.js +0 -1
- package/dist/scripts/checkIfLoadVersionDomain.js +0 -1
- package/dist/scripts/extractZonosQaUrl.js +0 -1
- package/dist/scripts/getTempCartById.js +0 -1
- package/dist/scripts/loadStripe.js +0 -1
- package/dist/scripts/stripe.js +0 -1
- package/dist/scripts/zonosBase.js +0 -1
- package/dist/zonos-elements/p-04030a48.entry.js +0 -1
- package/dist/zonos-elements/p-0e892292.entry.js +0 -1
- package/dist/zonos-elements/p-0fac99e7.entry.js +0 -1
- package/dist/zonos-elements/p-1795c760.system.entry.js +0 -1
- package/dist/zonos-elements/p-24ac1c6f.entry.js +0 -1
- package/dist/zonos-elements/p-26a60a6e.entry.js +0 -1
- package/dist/zonos-elements/p-32744531.entry.js +0 -1
- package/dist/zonos-elements/p-35ac375a.system.entry.js +0 -1
- package/dist/zonos-elements/p-3bc88c3c.system.entry.js +0 -1
- package/dist/zonos-elements/p-4caaaaeb.system.entry.js +0 -1
- package/dist/zonos-elements/p-50ea2036.system.js +0 -1
- package/dist/zonos-elements/p-5e783394.entry.js +0 -1
- package/dist/zonos-elements/p-6366e7e3.entry.js +0 -1
- package/dist/zonos-elements/p-7c8ee4b9.system.entry.js +0 -1
- package/dist/zonos-elements/p-80ea85b8.entry.js +0 -1
- package/dist/zonos-elements/p-8da16d53.system.js +0 -1
- package/dist/zonos-elements/p-98a0b694.system.entry.js +0 -1
- package/dist/zonos-elements/p-b98cdf39.system.entry.js +0 -1
- package/dist/zonos-elements/p-d7b8c1c1.system.entry.js +0 -1
- package/dist/zonos-elements/p-dd0fd351.entry.js +0 -1
- package/dist/zonos-elements/p-e015cb0e.js +0 -1
- package/dist/zonos-elements/p-e1fbd05d.system.entry.js +0 -1
- package/dist/zonos-elements/p-e553dd19.js +0 -1
- package/dist/zonos-elements/p-e6fa0ebc.system.js +0 -1
- package/dist/zonos-elements/p-f6546bf4.system.entry.js +0 -1
- /package/dist/collection/components/common/{component-template/zonos-link → zonos-link}/zonos-link.css +0 -0
- /package/dist/collection/scripts/{checkIfLoadVersionDomain.js → _checkIfLoadVersionDomain.js} +0 -0
- /package/dist/collection/scripts/{stripe.js → _stripe.js} +0 -0
- /package/dist/types/components/common/{component-template/zonos-link → zonos-link}/zonos-link.d.ts +0 -0
- /package/dist/types/scripts/{checkIfLoadVersionDomain.d.ts → _checkIfLoadVersionDomain.d.ts} +0 -0
- /package/dist/types/scripts/{stripe.d.ts → _stripe.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,101 +1,346 @@
|
|
|
1
|
-
# Zonos Component UI
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
# Zonos Component UI Introduction
|
|
2
|
+
This project offers web components designed primarily for Zonos Checkout, Zonos Hello, and other Zonos products, with a focus on React and Next.js integration. Although not yet tested with other JavaScript libraries and frameworks, the implementation principles for React and Next.js can be adapted for use with other frameworks. For more information about Zonos products, please visit the official [Zonos website](https://zonos.com).
|
|
3
|
+
|
|
4
|
+
# Table of content
|
|
5
|
+
- [Zonos Component UI Introduction](#zonos-component-ui-introduction)
|
|
6
|
+
- [Table of content](#table-of-content)
|
|
7
|
+
- [Prerequisites](#prerequisites)
|
|
8
|
+
- [Installation](#installation)
|
|
9
|
+
- [Brief `Zonos.init` base configuration explanation:](#brief-zonosinit-base-configuration-explanation)
|
|
10
|
+
- [CDN](#cdn)
|
|
11
|
+
- [CDN when to use:](#cdn-when-to-use)
|
|
12
|
+
- [CDN usage:](#cdn-usage)
|
|
13
|
+
- [Npm](#npm)
|
|
14
|
+
- [Npm when to use:](#npm-when-to-use)
|
|
15
|
+
- [Npm usage:](#npm-usage)
|
|
16
|
+
- [API references](#api-references)
|
|
17
|
+
- [Zonos instance definition](#zonos-instance-definition)
|
|
18
|
+
- [Single file definition for Zonos instance](#single-file-definition-for-zonos-instance)
|
|
19
|
+
- [Zonos.init - checkoutSettings available configurations](#zonosinit---checkoutsettings-available-configurations)
|
|
20
|
+
- [Zonos.init - helloSettings available configurations](#zonosinit---hellosettings-available-configurations)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# Prerequisites
|
|
24
|
+
- Node.js (v18 or higher)
|
|
25
|
+
- An API key for Zonos Checkout/Hello (please contact our [support team](https://zonos.com/contact-support) for more information)
|
|
26
|
+
|
|
27
|
+
# Installation
|
|
28
|
+
There are two ways to initialize Zonos: via custom integration using a CDN or through npm installation.
|
|
29
|
+
|
|
30
|
+
**Note**: All methods below are only using the base configuration to have the Checkout and Hello up and running. For a more secure way to build your cart, please check out our [docs](https://zonos.com/docs/global-ecommerce/integration/integrating-new-checkout/custom-integration#set-up-zonos-checkout) for more information.
|
|
31
|
+
|
|
32
|
+
## Brief `Zonos.init` base configuration explanation:
|
|
33
|
+
- `checkoutSettings.buildCartDetail`: This callback function retrieves cart item information from your web platform. It should return an array of cart item objects. For the expected type definition, please refer to the [`buildCartDetail`](./dist/types/types/checkout/CheckoutConfig.d.ts) and the [cart item](./dist/types/components/store/checkout/cart.d.ts) files.
|
|
34
|
+
- `checkoutSettings.placeOrderButtonSelector`: This is used to find all matching selectors and attach an event to trigger the Checkout process. While you can configure this in our Zonos dashboard, it's recommended to set it here so that Zonos can disable your Checkout place order button while loading.
|
|
35
|
+
- `zonosApiKey`: An API key for Zonos Checkout/Hello (please contact our [support team](https://zonos.com/contact-support) for more information).
|
|
36
|
+
- `storeId`: Store id that your checkout would associate with (please contact our [support team](https://zonos.com/contact-support) for more information).
|
|
37
|
+
|
|
38
|
+
## CDN
|
|
39
|
+
|
|
40
|
+
### CDN when to use:
|
|
41
|
+
This is suitable for you if you:
|
|
42
|
+
- Use any non-JavaScript frameworks (e.g., PHP, Java, C#).
|
|
43
|
+
- Have a static site with pure HTML, CSS, and JavaScript.
|
|
44
|
+
- Do not need type references in the project.
|
|
45
|
+
- Prefer to use a CDN even if you are using a JavaScript framework (e.g., React, Vue, Next.js).
|
|
46
|
+
- Want to quickly test how Zonos functions on your site (e.g., easily drop the script snippet into the Console tab in your browser's developer tools).
|
|
47
|
+
|
|
48
|
+
### CDN usage:
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
- For non-JavaScript frameworks:
|
|
52
|
+
<details>
|
|
53
|
+
<summary>Copy and paste the following into your HTML or the "Console" tab of your browser's developer tool</summary>
|
|
54
|
+
|
|
55
|
+
Put the `<script>` tag below into the `<head>` tag of your HTML:
|
|
56
|
+
```html
|
|
57
|
+
<script>
|
|
58
|
+
(async function () {
|
|
59
|
+
const zonosElementsUrl = 'https://js.zonos.com';
|
|
60
|
+
const timestamp = new Date().getTime();
|
|
61
|
+
const zonosScript = document.querySelector(
|
|
62
|
+
`script[src*="${zonosElementsUrl}/dist/scripts/loadZonos.js"]`,
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
if (!zonosScript) {
|
|
66
|
+
const script = document.createElement('script');
|
|
67
|
+
script.src = `${zonosElementsUrl}/dist/scripts/loadZonos.js?timestamp=${timestamp}`;
|
|
68
|
+
script.addEventListener(
|
|
69
|
+
'load',
|
|
70
|
+
() => {
|
|
71
|
+
const getCartItems = async () => {
|
|
72
|
+
const yourServerUrl = "https://your-server.com/api/get-cart-items";
|
|
73
|
+
const response = await fetch(yourServerUrl);
|
|
74
|
+
const json = await response.json();
|
|
75
|
+
return json;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// Initialize Zonos with your store's settings.
|
|
79
|
+
// Replace '<%= placeOrderButtonSelector %>', '<%= storeId %>', and '<%= credentialToken %>'
|
|
80
|
+
// with your actual values.
|
|
81
|
+
void window.Zonos.init({
|
|
82
|
+
checkoutSettings: {
|
|
83
|
+
buildCartDetail: async () => {
|
|
84
|
+
const allItems = getCartItems();
|
|
85
|
+
return allItems;
|
|
86
|
+
},
|
|
87
|
+
placeOrderButtonSelector: '<%= placeOrderButtonSelector %>',
|
|
88
|
+
},
|
|
89
|
+
storeId: Number('<%= storeId %>'), // Contact support for this information.
|
|
90
|
+
zonosApiKey: '<%= credentialToken %>', // Contact support for this information
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
false,
|
|
94
|
+
);
|
|
95
|
+
document.head.appendChild(script);
|
|
96
|
+
}
|
|
97
|
+
})();
|
|
98
|
+
</script>
|
|
47
99
|
```
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
100
|
+
</details>
|
|
101
|
+
<br>
|
|
102
|
+
|
|
103
|
+
- For React, Next.js:
|
|
104
|
+
- Create a typescript file and import `@zonos/elements` to define types definition for `window` interface
|
|
105
|
+
<details>
|
|
106
|
+
<summary>Code example</summary>
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import "@zonos/elements";
|
|
110
|
+
```
|
|
111
|
+
</details>
|
|
112
|
+
<br>
|
|
113
|
+
- Create a `ContextProvider`
|
|
114
|
+
<details>
|
|
115
|
+
<summary>Code example</summary>
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
'use client';
|
|
119
|
+
import { type ReactNode, createContext, useMemo, useState } from 'react';
|
|
120
|
+
|
|
121
|
+
import Script from 'next/script';
|
|
122
|
+
|
|
123
|
+
type ZonosScriptProps = {
|
|
124
|
+
scriptLoaded: boolean;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const ZonosScriptContext = createContext<ZonosScriptProps>({
|
|
128
|
+
scriptLoaded: false,
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
export const ZonosScriptContextProvider = ({
|
|
132
|
+
children,
|
|
133
|
+
}: {
|
|
134
|
+
children: ReactNode;
|
|
135
|
+
}) => {
|
|
136
|
+
const [scriptLoaded, setScriptLoaded] = useState(false);
|
|
137
|
+
|
|
138
|
+
const context: ZonosScriptProps = {
|
|
139
|
+
scriptLoaded,
|
|
140
|
+
};
|
|
141
|
+
const timestamp = useMemo(() => Date.now(), []);
|
|
142
|
+
return (
|
|
143
|
+
<ZonosScriptContext.Provider value={context}>
|
|
144
|
+
<Script
|
|
145
|
+
onLoad={() => setScriptLoaded(true)}
|
|
146
|
+
src={`https://js.zonos.com/dist/scripts/loadZonos.js?timestamp=${timestamp}`}
|
|
147
|
+
/>
|
|
148
|
+
{children}
|
|
149
|
+
</ZonosScriptContext.Provider>
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
```
|
|
153
|
+
</details>
|
|
154
|
+
<br>
|
|
155
|
+
|
|
156
|
+
- Wrap `ZonosScriptContextProvider` into root of your `layout.tsx`
|
|
157
|
+
<details>
|
|
158
|
+
<summary>Code example</summary>
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
export default function Layout({ children }:{ children: ReactNode}) {
|
|
162
|
+
return (
|
|
163
|
+
<ZonosScriptContextProvider>
|
|
164
|
+
<main>
|
|
165
|
+
{children}
|
|
166
|
+
</main>
|
|
167
|
+
</ZonosScriptContextProvider>
|
|
168
|
+
)
|
|
169
|
+
}
|
|
55
170
|
```
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
171
|
+
</details>
|
|
172
|
+
<br>
|
|
173
|
+
|
|
174
|
+
- Create a hook named `useZonosScript.ts` to use the context easier
|
|
175
|
+
<details>
|
|
176
|
+
<summary>Code example</summary>
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
import { useContext } from 'react';
|
|
180
|
+
|
|
181
|
+
import { ZonosScriptContext } from 'src/components/ZonosScriptContext';
|
|
182
|
+
|
|
183
|
+
export const useZonosScript = () => useContext(ZonosScriptContext);
|
|
62
184
|
```
|
|
63
|
-
|
|
185
|
+
</details>
|
|
186
|
+
<br>
|
|
187
|
+
- Create component called `ZonosLayoutSetup.tsx` to initialize `Zonos`.
|
|
188
|
+
<details>
|
|
189
|
+
<summary>Code example</summary>
|
|
190
|
+
|
|
191
|
+
```typescript
|
|
192
|
+
'use client';
|
|
193
|
+
import { type ReactNode, useEffect } from 'react';
|
|
194
|
+
|
|
195
|
+
import { useZonosScript } from 'src/utils/hooks/useZonosScript';
|
|
196
|
+
|
|
197
|
+
export const ZonosLayoutSetup = ({ children }: { children: ReactNode }) => {
|
|
198
|
+
const { scriptLoaded } = useZonosScript();
|
|
199
|
+
|
|
200
|
+
useEffect(() => {
|
|
201
|
+
// Only initialize Zonos when zonos script is fully loaded.
|
|
202
|
+
if (!scriptLoaded) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const getCartItems = async () => {
|
|
206
|
+
const yourServerUrl = "https://your-server.com/api/get-cart-items";
|
|
207
|
+
const response = await fetch(yourServerUrl);
|
|
208
|
+
const json = await response.json();
|
|
209
|
+
return json;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
// Initialize Zonos with your store's settings.
|
|
213
|
+
// Replace '<%= placeOrderButtonSelector %>', '<%= storeId %>', and '<%= credentialToken %>'
|
|
214
|
+
// with your actual values.
|
|
215
|
+
void window.Zonos.init({
|
|
216
|
+
checkoutSettings: {
|
|
217
|
+
buildCartDetail: async () => {
|
|
218
|
+
const allItems = getCartItems();
|
|
219
|
+
return allItems;
|
|
220
|
+
},
|
|
221
|
+
placeOrderButtonSelector: '<%= placeOrderButtonSelector %>',
|
|
222
|
+
},
|
|
223
|
+
storeId: Number('<%= storeId %>'), // Contact support for this information.
|
|
224
|
+
zonosApiKey: '<%= credentialToken %>', // Contact support for this information
|
|
225
|
+
});
|
|
226
|
+
}, [scriptLoaded]);
|
|
227
|
+
|
|
228
|
+
return children;
|
|
229
|
+
};
|
|
230
|
+
```
|
|
231
|
+
</details>
|
|
232
|
+
<br>
|
|
233
|
+
|
|
234
|
+
- Put component `ZonosLayoutSetup.tsx` right under `ZonosScriptContextProvider`
|
|
235
|
+
<details>
|
|
236
|
+
<summary>Code example</summary>
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
export default function Layout({ children }:{ children: ReactNode}) {
|
|
240
|
+
return (
|
|
241
|
+
<ZonosScriptContextProvider>
|
|
242
|
+
<ZonosLayoutSetup>
|
|
243
|
+
<main>
|
|
244
|
+
{children}
|
|
245
|
+
</main>
|
|
246
|
+
</ZonosLayoutSetup>
|
|
247
|
+
</ZonosScriptContextProvider>
|
|
248
|
+
)
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
</details>
|
|
252
|
+
<br>
|
|
253
|
+
- For javascript framework that's not React, Next.js:
|
|
254
|
+
- Create a typescript file and import `@zonos/elements` to define types definition for `window` interface. You will have access to `window.Zonos` through out of your project if you are using typescript.
|
|
255
|
+
<details>
|
|
256
|
+
<summary>Code example</summary>
|
|
257
|
+
|
|
258
|
+
```typescript
|
|
259
|
+
import "@zonos/elements";
|
|
260
|
+
```
|
|
261
|
+
</details>
|
|
262
|
+
<br>
|
|
263
|
+
|
|
264
|
+
## Npm
|
|
265
|
+
### Npm when to use:
|
|
266
|
+
This method is ideal if you are using TypeScript with modern JavaScript frameworks, particularly React and Next.js. It provides strong typing for the window.Zonos.init function, making setup easier and enabling auto-completion in TypeScript-enabled environments.
|
|
267
|
+
|
|
268
|
+
### Npm usage:
|
|
269
|
+
Install `@zonos/elements`:
|
|
270
|
+
|
|
271
|
+
| Package Manager | Command |
|
|
272
|
+
|-----------------|-------------------------------|
|
|
273
|
+
| pnpm | `pnpm add @zonos/elements` |
|
|
274
|
+
| npm | `npm install @zonos/elements` |
|
|
275
|
+
| yarn | `yarn add @zonos/elements` |
|
|
276
|
+
|
|
277
|
+
<br>
|
|
278
|
+
|
|
279
|
+
React, Next.js:
|
|
280
|
+
- Create a component called `ZonosLayoutSetup.tsx`
|
|
281
|
+
<details>
|
|
282
|
+
<summary>Code example</summary>
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
'use client';
|
|
286
|
+
import { type ReactNode, useEffect } from 'react';
|
|
287
|
+
|
|
288
|
+
import { Zonos } from '@zonos/elements';
|
|
289
|
+
|
|
290
|
+
import { useZonosScript } from 'src/utils/hooks/useZonosScript';
|
|
291
|
+
|
|
292
|
+
export const ZonosLayoutSetup = ({ children }: { children: ReactNode }) => {
|
|
293
|
+
useEffect(() => {
|
|
294
|
+
// Initialize Zonos into `window` API.
|
|
295
|
+
window.Zonos = Zonos;
|
|
296
|
+
|
|
297
|
+
const getCartItems = async () => {
|
|
298
|
+
const yourServerUrl = "https://your-server.com/api/get-cart-items";
|
|
299
|
+
const response = await fetch(yourServerUrl);
|
|
300
|
+
const json = await response.json();
|
|
301
|
+
return json;
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
// Initialize Zonos
|
|
306
|
+
void window.Zonos.init({
|
|
307
|
+
checkoutSettings: {
|
|
308
|
+
buildCartDetail: async () => {
|
|
309
|
+
const allItems = getCartItems();
|
|
310
|
+
return allItems;
|
|
311
|
+
},
|
|
312
|
+
placeOrderButtonSelector: '<%= placeOrderButtonSelector %>',
|
|
313
|
+
},
|
|
314
|
+
storeId: Number('<%= storeId %>'), // Contact support for this information.
|
|
315
|
+
zonosApiKey: '<%= credentialToken %>', // Contact support for this information
|
|
316
|
+
});
|
|
317
|
+
}, [scriptLoaded]);
|
|
318
|
+
|
|
319
|
+
return children;
|
|
320
|
+
};
|
|
64
321
|
```
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
322
|
+
</details>
|
|
323
|
+
<br>
|
|
324
|
+
|
|
325
|
+
- Put component `ZonosLayoutSetup.tsx` at top level of your `layout.tsx`
|
|
326
|
+
<details>
|
|
327
|
+
<summary>Code example</summary>
|
|
328
|
+
|
|
329
|
+
```typescript
|
|
330
|
+
export default function Layout({ children }:{ children: ReactNode}) {
|
|
331
|
+
return (
|
|
332
|
+
<ZonosLayoutSetup>
|
|
333
|
+
<main>
|
|
334
|
+
{children}
|
|
335
|
+
</main>
|
|
336
|
+
</ZonosLayoutSetup>
|
|
337
|
+
)
|
|
338
|
+
}
|
|
69
339
|
```
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
### Merging strategy
|
|
78
|
-
The github action would bump the version conditionally on qa and main branch merged event.
|
|
79
|
-
+ qa branch merge flow: Only bump, publish version and create CDN when the version has alpha word.
|
|
80
|
-
+ main branch merge flow: Create a branch against qa and run pnpm version:[patch|major|minor], have it merged to qa, it would not trigger the publish version and create CDN until the changes on qa get merged to main.
|
|
81
|
-
|
|
82
|
-
### Steps
|
|
83
|
-
1. Each PR against qa will need to be prerelease pumped by running pnpm version:alpha.
|
|
84
|
-
2. PR get merged to qa will trigger the github action to publish to npm with alpha tag and create a cdn domain alpha.js.zonos.com - alpha cdn doesn’t need to be versioned, so that when rolling back, the changes will be affected right away.
|
|
85
|
-
3. The release process would happen on qa. If we want to release, a new branch named build/v1.x.x will need to be checkout from qa. Bump the version (major, minor or patch), and then merge to qa.
|
|
86
|
-
4. Create a new branch with the same name build/v1.x.xoff of main, pull from qa and just create PR and merge to main.
|
|
87
|
-
5. PR get merged to `main` will trigger the github action to publish to npm with major, minor or patch tag and create a cdn domain v1.2.3.js.zonos.com.
|
|
88
|
-
|
|
89
|
-
### Bumping version rule of thumbs
|
|
90
|
-
Below is scenario when to bump version:
|
|
91
|
-
- Alpha:
|
|
92
|
-
- If you need to have types change in zonos-elements and want to use that types in the dashboard (for example: add a new function into instance Zonos). Bump alpha would result pushing new version to npm, then dashboard can install and use it.
|
|
93
|
-
- If we want to have a domain with pinned version to use (v1.2.3-alpha.1.js.zonos.com) and not gonna be used directly with major pin domain (v1.js.zonos.com)
|
|
94
|
-
**Note: If you merge changes with alpha version to main, new release domain will not be generated.**
|
|
95
|
-
- Patch:
|
|
96
|
-
- Any bug fix and small api changes
|
|
97
|
-
- Minor:
|
|
98
|
-
- Architecture changes but doesn't take too much effort to move store to newer version
|
|
99
|
-
- Big API refactor
|
|
100
|
-
- Major:
|
|
101
|
-
- A lot of stores are using zonos-elements stably and have new breaking changes would lead to breaking chain for all stores
|
|
340
|
+
</details>
|
|
341
|
+
|
|
342
|
+
# API references
|
|
343
|
+
### [Zonos instance definition](./dist/types/scripts/_zonosBase.d.ts)
|
|
344
|
+
### [Single file definition for Zonos instance](./dist/scripts/index.d.ts)
|
|
345
|
+
### [Zonos.init - checkoutSettings available configurations](./dist/types/types/checkout/CheckoutConfig.d.ts)
|
|
346
|
+
### [Zonos.init - helloSettings available configurations](./dist/types/types/hello/HelloConfig.d.ts)
|