@zonos/elements 1.3.82 → 1.3.83

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.
Files changed (158) hide show
  1. package/dist/cjs/{cart-ba540c8e.js → cart-4de3faca.js} +455 -16
  2. package/dist/cjs/{createCustomEvent-1fd24ad8.js → createCustomEvent-65331eae.js} +1 -1
  3. package/dist/cjs/index.cjs.js +7 -7
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{paypal-6bbe55a7.js → paypal-370b3a10.js} +1 -1
  6. package/dist/cjs/{zonos-address_8.cjs.entry.js → zonos-address_7.cjs.entry.js} +1 -56
  7. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +99 -29
  8. package/dist/cjs/zonos-checkout.cjs.entry.js +4 -4
  9. package/dist/cjs/zonos-collapse.cjs.entry.js +62 -0
  10. package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
  11. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  12. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  13. package/dist/cjs/zonos-elements.cjs.js +1 -1
  14. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
  15. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  16. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  17. package/dist/cjs/zonos-notification_3.cjs.entry.js +2 -2
  18. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +1 -11
  19. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +17 -6
  20. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +3 -1
  21. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/assets/ChevronUpIcon.svg +23 -0
  22. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.css +55 -9
  23. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +57 -16
  24. package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.js +20 -27
  25. package/dist/collection/components/store/checkout/cart.js +29 -11
  26. package/dist/collection/components/store/checkout/stripe.js +2 -2
  27. package/dist/collection/components/store/translationStore/strings.arabic.js +21 -0
  28. package/dist/collection/components/store/translationStore/strings.base.js +21 -0
  29. package/dist/collection/components/store/translationStore/strings.chinese.js +21 -0
  30. package/dist/collection/components/store/translationStore/strings.danish.js +21 -0
  31. package/dist/collection/components/store/translationStore/strings.dutch.js +21 -0
  32. package/dist/collection/components/store/translationStore/strings.french.js +22 -1
  33. package/dist/collection/components/store/translationStore/strings.german.js +22 -1
  34. package/dist/collection/components/store/translationStore/strings.hebrew.js +22 -1
  35. package/dist/collection/components/store/translationStore/strings.indonesian.js +21 -0
  36. package/dist/collection/components/store/translationStore/strings.italian.js +21 -0
  37. package/dist/collection/components/store/translationStore/strings.japanese.js +21 -0
  38. package/dist/collection/components/store/translationStore/strings.korean.js +21 -0
  39. package/dist/collection/components/store/translationStore/strings.norwegian.js +21 -0
  40. package/dist/collection/components/store/translationStore/strings.polish.js +21 -0
  41. package/dist/collection/components/store/translationStore/strings.portuguese.js +21 -0
  42. package/dist/collection/components/store/translationStore/strings.russian.js +22 -1
  43. package/dist/collection/components/store/translationStore/strings.spanish.js +21 -0
  44. package/dist/collection/components/store/translationStore/strings.swedish.js +21 -0
  45. package/dist/collection/components/store/translationStore/strings.turkish.js +21 -0
  46. package/dist/collection/components/store/translationStore/strings.vietnamese.js +21 -0
  47. package/dist/collection/components/utils/checkout/{sortServiceLevelOptions.js → sortServiceLevelOptionsByAmount.js} +1 -1
  48. package/dist/esm/{cart-7df78f9f.js → cart-bdc45f59.js} +455 -17
  49. package/dist/esm/{createCustomEvent-fcec608e.js → createCustomEvent-4db13122.js} +1 -1
  50. package/dist/esm/index.js +7 -7
  51. package/dist/esm/loader.js +1 -1
  52. package/dist/esm/{paypal-a27aad03.js → paypal-1b29d424.js} +1 -1
  53. package/dist/esm/{zonos-address_8.entry.js → zonos-address_7.entry.js} +2 -56
  54. package/dist/esm/zonos-cart-items_12.entry.js +99 -29
  55. package/dist/esm/zonos-checkout.entry.js +4 -4
  56. package/dist/esm/zonos-collapse.entry.js +58 -0
  57. package/dist/esm/zonos-controller.entry.js +1 -1
  58. package/dist/esm/zonos-country-flag.entry.js +1 -1
  59. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  60. package/dist/esm/zonos-elements.js +1 -1
  61. package/dist/esm/zonos-hello-dialog.entry.js +1 -1
  62. package/dist/esm/zonos-hello.entry.js +1 -1
  63. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  64. package/dist/esm/zonos-notification_3.entry.js +2 -2
  65. package/dist/esm/zonos-shipping-rich-radio.entry.js +1 -11
  66. package/dist/esm-es5/cart-bdc45f59.js +1 -0
  67. package/dist/esm-es5/{createCustomEvent-fcec608e.js → createCustomEvent-4db13122.js} +1 -1
  68. package/dist/esm-es5/index.js +1 -1
  69. package/dist/esm-es5/loader.js +1 -1
  70. package/dist/esm-es5/{paypal-a27aad03.js → paypal-1b29d424.js} +1 -1
  71. package/dist/esm-es5/{zonos-address_8.entry.js → zonos-address_7.entry.js} +1 -1
  72. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  73. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  74. package/dist/esm-es5/zonos-collapse.entry.js +1 -0
  75. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  76. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  77. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  78. package/dist/esm-es5/zonos-elements.js +1 -1
  79. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  80. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  81. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  82. package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
  83. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  84. package/dist/scripts/index.d.ts +499 -496
  85. package/dist/scripts/index.js +1 -1
  86. package/dist/scripts/loadZonos.js +1 -1
  87. package/dist/scripts/zonos.js +1 -1
  88. package/dist/types/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.d.ts +4 -1
  89. package/dist/types/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.d.ts +2 -6
  90. package/dist/types/components/store/checkout/cart.d.ts +9 -7
  91. package/dist/types/components/store/translationStore/strings.arabic.d.ts +21 -0
  92. package/dist/types/components/store/translationStore/strings.base.d.ts +21 -0
  93. package/dist/types/components/store/translationStore/strings.chinese.d.ts +21 -0
  94. package/dist/types/components/store/translationStore/strings.danish.d.ts +21 -0
  95. package/dist/types/components/store/translationStore/strings.dutch.d.ts +21 -0
  96. package/dist/types/components/store/translationStore/strings.french.d.ts +21 -0
  97. package/dist/types/components/store/translationStore/strings.german.d.ts +21 -0
  98. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +21 -0
  99. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +21 -0
  100. package/dist/types/components/store/translationStore/strings.italian.d.ts +21 -0
  101. package/dist/types/components/store/translationStore/strings.japanese.d.ts +21 -0
  102. package/dist/types/components/store/translationStore/strings.korean.d.ts +21 -0
  103. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +21 -0
  104. package/dist/types/components/store/translationStore/strings.polish.d.ts +21 -0
  105. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +21 -0
  106. package/dist/types/components/store/translationStore/strings.russian.d.ts +21 -0
  107. package/dist/types/components/store/translationStore/strings.spanish.d.ts +21 -0
  108. package/dist/types/components/store/translationStore/strings.swedish.d.ts +21 -0
  109. package/dist/types/components/store/translationStore/strings.turkish.d.ts +21 -0
  110. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +21 -0
  111. package/dist/types/components/store/translationStore.d.ts +1 -1
  112. package/dist/types/components/utils/checkout/{sortServiceLevelOptions.d.ts → sortServiceLevelOptionsByAmount.d.ts} +1 -1
  113. package/dist/types/components.d.ts +10 -8
  114. package/dist/zonos-elements/assets/ChevronUpIcon.svg +23 -1
  115. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  116. package/dist/zonos-elements/index.esm.js +1 -1
  117. package/dist/zonos-elements/{p-270cc182.system.entry.js → p-00bb8221.system.entry.js} +1 -1
  118. package/dist/zonos-elements/{p-b09c3702.entry.js → p-017bf338.entry.js} +1 -1
  119. package/dist/zonos-elements/{p-2d2edb5a.system.entry.js → p-01d11845.system.entry.js} +1 -1
  120. package/dist/zonos-elements/p-0cc8c6a3.system.js +1 -0
  121. package/dist/zonos-elements/{p-43e2de45.system.entry.js → p-2140ccb4.system.entry.js} +1 -1
  122. package/dist/zonos-elements/{p-4e06a2bb.system.entry.js → p-2183128a.system.entry.js} +1 -1
  123. package/dist/zonos-elements/p-278d61ed.js +1 -0
  124. package/dist/zonos-elements/p-2b60faf8.entry.js +1 -0
  125. package/dist/zonos-elements/{p-8dd38974.entry.js → p-3347e142.entry.js} +1 -1
  126. package/dist/zonos-elements/{p-4097a25b.system.entry.js → p-3457c5e8.system.entry.js} +1 -1
  127. package/dist/zonos-elements/p-4abca0e9.system.entry.js +1 -0
  128. package/dist/zonos-elements/{p-15651b06.system.js → p-4ec7afc5.system.js} +1 -1
  129. package/dist/zonos-elements/{p-bf84416a.entry.js → p-5fb337a0.entry.js} +1 -1
  130. package/dist/zonos-elements/{p-a4cdd4f2.entry.js → p-6aa35f18.entry.js} +1 -1
  131. package/dist/zonos-elements/{p-cfd53396.entry.js → p-771e2623.entry.js} +1 -1
  132. package/dist/zonos-elements/{p-acabfc47.js → p-7cc5e325.js} +1 -1
  133. package/dist/zonos-elements/p-7f3aeb53.system.entry.js +1 -0
  134. package/dist/zonos-elements/p-844ec9f9.system.entry.js +1 -0
  135. package/dist/zonos-elements/p-9931bea7.system.entry.js +1 -0
  136. package/dist/zonos-elements/{p-cd17565d.entry.js → p-9b911f6f.entry.js} +1 -1
  137. package/dist/zonos-elements/{p-59806a8e.system.entry.js → p-9cfa3736.system.entry.js} +1 -1
  138. package/dist/zonos-elements/{p-957b1c1b.system.js → p-a1fa0a1c.system.js} +1 -1
  139. package/dist/zonos-elements/{p-df83e30b.entry.js → p-a34f0674.entry.js} +1 -1
  140. package/dist/zonos-elements/{p-4683797b.system.js → p-a6cff57f.system.js} +1 -1
  141. package/dist/zonos-elements/{p-112a969c.entry.js → p-b0303b0e.entry.js} +1 -1
  142. package/dist/zonos-elements/{p-2c5e2163.entry.js → p-c6350880.entry.js} +1 -1
  143. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  144. package/dist/zonos-elements/{p-2024313c.js → p-ce41cbde.js} +1 -1
  145. package/dist/zonos-elements/p-cec3e1ed.entry.js +1 -0
  146. package/dist/zonos-elements/{p-d48f3bd3.system.entry.js → p-e3df5ff6.system.entry.js} +1 -1
  147. package/dist/zonos-elements/{p-5d4bde9c.system.entry.js → p-f1d043ad.system.entry.js} +1 -1
  148. package/dist/zonos-elements/p-f1e452e1.entry.js +1 -0
  149. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  150. package/package.json +1 -1
  151. package/dist/esm-es5/cart-7df78f9f.js +0 -1
  152. package/dist/zonos-elements/p-85600e22.system.entry.js +0 -1
  153. package/dist/zonos-elements/p-8fd6ae63.js +0 -1
  154. package/dist/zonos-elements/p-a1c5c1a2.entry.js +0 -1
  155. package/dist/zonos-elements/p-aa899bf7.entry.js +0 -1
  156. package/dist/zonos-elements/p-cffe7cc8.system.entry.js +0 -1
  157. package/dist/zonos-elements/p-e7eb0a92.system.js +0 -1
  158. package/dist/zonos-elements/p-f4667002.system.entry.js +0 -1
@@ -950,131 +950,446 @@ type GetOrderQuery = {
950
950
  } | null;
951
951
  };
952
952
 
953
- type CustomEventMap = {
954
- legacyCheckoutError: string;
955
- 'zonos-checkout-success': {
956
- message: string;
957
- };
953
+ type TabItem = {
954
+ index: number;
955
+ isDone: boolean;
956
+ label: 'Customer' | 'Delivery' | 'Payment';
957
+ value: 'customer-info' | 'shipping' | 'payment';
958
958
  };
959
-
960
- declare const envClientSchema: z.ZodObject<{
961
- NEXT_PUBLIC_FLAG_URL: z.ZodString;
962
- NEXT_PUBLIC_RELEASE_DATE: z.ZodString;
963
- NEXT_PUBLIC_ZONOS_API_KEY: z.ZodString;
964
- NEXT_PUBLIC_ZONOS_CDNJS_CDN_URL: z.ZodString;
965
- NEXT_PUBLIC_ZONOS_CDN_URL: z.ZodString;
966
- NEXT_PUBLIC_ZONOS_CLOUDFLARE_URL: z.ZodString;
967
- NEXT_PUBLIC_ZONOS_JS_DELIVR_CDN_URL: z.ZodString;
968
- NEXT_PUBLIC_ZONOS_PACKAGE_VERSION: z.ZodString;
969
- NEXT_PUBLIC_ZONOS_ROUTE_URL: z.ZodString;
970
- NEXT_PUBLIC_ZONOS_UNPKG_CDN_URL: z.ZodString;
971
- }, "strip", z.ZodTypeAny, {
972
- NEXT_PUBLIC_FLAG_URL: string;
973
- NEXT_PUBLIC_RELEASE_DATE: string;
974
- NEXT_PUBLIC_ZONOS_API_KEY: string;
975
- NEXT_PUBLIC_ZONOS_CDNJS_CDN_URL: string;
976
- NEXT_PUBLIC_ZONOS_CDN_URL: string;
977
- NEXT_PUBLIC_ZONOS_CLOUDFLARE_URL: string;
978
- NEXT_PUBLIC_ZONOS_JS_DELIVR_CDN_URL: string;
979
- NEXT_PUBLIC_ZONOS_PACKAGE_VERSION: string;
980
- NEXT_PUBLIC_ZONOS_ROUTE_URL: string;
981
- NEXT_PUBLIC_ZONOS_UNPKG_CDN_URL: string;
982
- }, {
983
- NEXT_PUBLIC_FLAG_URL: string;
984
- NEXT_PUBLIC_RELEASE_DATE: string;
985
- NEXT_PUBLIC_ZONOS_API_KEY: string;
986
- NEXT_PUBLIC_ZONOS_CDNJS_CDN_URL: string;
987
- NEXT_PUBLIC_ZONOS_CDN_URL: string;
988
- NEXT_PUBLIC_ZONOS_CLOUDFLARE_URL: string;
989
- NEXT_PUBLIC_ZONOS_JS_DELIVR_CDN_URL: string;
990
- NEXT_PUBLIC_ZONOS_PACKAGE_VERSION: string;
991
- NEXT_PUBLIC_ZONOS_ROUTE_URL: string;
992
- NEXT_PUBLIC_ZONOS_UNPKG_CDN_URL: string;
993
- }>;
994
- interface Env extends z.infer<typeof envClientSchema> {
995
- }
996
-
997
- /* eslint-disable no-relative-import-paths/no-relative-import-paths */
998
-
999
- declare global {
1000
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
1001
- interface Document {
1002
- addEventListener<K extends keyof CustomEventMap>(
1003
- type: K,
1004
- listener: (this: Document, ev: CustomEvent<CustomEventMap[K]>) => void,
1005
- ): void;
1006
- }
1007
-
1008
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
1009
- interface Window {
1010
- Sentry?: {
1011
- init: (config: BrowserOptions) => void;
1012
- };
1013
- Stripe?: StripeConstructor;
1014
- Zonos: Zonos;
1015
- /**
1016
- * A flag to determine if the current page is a BigCommerce page
1017
- */
1018
- bcConfig?: unknown;
1019
- /**
1020
- * A flag to determine if the current page is a BigCommerce page
1021
- */
1022
- stencilBootstrap?: unknown;
1023
- sentryOnLoad?: () => void;
1024
- }
1025
-
1026
- namespace NodeJS {
1027
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
1028
- interface ProcessEnv extends Env {}
1029
- }
1030
- }
1031
-
1032
- type TranslatedText = {
1033
- [key: string]: string;
959
+ type TabItems = Record<TabItem['value'], TabItem>;
960
+ type ItemMeasurement = {
961
+ /** Indicates what type of `Measurement`, e.g. weight, specific dim unit. */
962
+ type: ItemMeasurementType;
963
+ /** Indicates the `Measurement` units to be used. */
964
+ unitOfMeasure: ItemUnitOfMeasure;
965
+ /** The `Measurement` value. */
966
+ value: number;
1034
967
  };
1035
- type EnteredInfo = {
1036
- city: string;
1037
- country: CountryCode;
1038
- email: string;
1039
- line1: string;
1040
- line2: string;
968
+ type CartItem = {
969
+ amount: number;
970
+ attributes?: {
971
+ key: string;
972
+ value: string;
973
+ }[];
974
+ countryOfOrigin?: CountryCode;
975
+ currencyCode: CurrencyCode;
976
+ description?: string;
977
+ hsCode?: string;
978
+ imageUrl?: string;
979
+ itemType?: ItemType;
980
+ measurements?: ItemMeasurement[];
981
+ metadata?: {
982
+ key: string;
983
+ value: string;
984
+ }[];
1041
985
  name: string;
1042
- phone: string;
1043
- postal_code: string;
1044
- state: string;
986
+ productId?: string;
987
+ quantity: number;
988
+ sku?: string;
1045
989
  };
1046
- type ValidateAddressFields = Omit<StripeAddressElementChangeEvent['value']['address'], 'country'> & {
1047
- name: string;
990
+
991
+ type CalculateLandedCostAdjustmentInput = {
992
+ amount: number;
993
+ productId: string | null;
994
+ promoCode?: string | null;
995
+ sku: string | null;
996
+ type: LandedCostAdjustmentType;
1048
997
  };
1049
- type TranslatedAddressObject = {
1050
- [key in keyof ValidateAddressFields]?: TranslatedText;
998
+ type CalculateLandedCostRequest = {
999
+ billingAddress: {
1000
+ addressLine1: string;
1001
+ addressLine2?: string | undefined;
1002
+ city: string;
1003
+ country: CountryCode;
1004
+ postalCode: string;
1005
+ state: string;
1006
+ };
1007
+ billingContact: {
1008
+ firstName: string;
1009
+ lastName: string;
1010
+ phone: string;
1011
+ };
1012
+ checkoutSessionId: string;
1013
+ contact: {
1014
+ email?: string;
1015
+ firstName: string;
1016
+ lastName: string;
1017
+ phone: string;
1018
+ };
1019
+ items: CartItem[];
1020
+ landedCostAdjustments?: CalculateLandedCostAdjustmentInput[];
1021
+ metadata?: {
1022
+ key: string;
1023
+ value: string;
1024
+ }[];
1025
+ shippingAddress: {
1026
+ addressLine1: string;
1027
+ addressLine2?: string | undefined;
1028
+ city: string;
1029
+ country: CountryCode;
1030
+ postalCode: string;
1031
+ state: string;
1032
+ };
1051
1033
  };
1052
1034
 
1053
- type SubmitEventData = {
1054
- billingAddress: Record<keyof TranslatedAddressObject, string> | null;
1055
- shippingAddress: Record<keyof TranslatedAddressObject, string>;
1035
+ type BuildLandedCostParams = {
1036
+ billingAddress: CalculateLandedCostRequest['billingAddress'];
1037
+ billingContact: CalculateLandedCostRequest['billingContact'];
1038
+ checkoutSessionId: string;
1039
+ contact: CalculateLandedCostRequest['contact'];
1040
+ landedCostAdjustments?: CalculateLandedCostRequest['landedCostAdjustments'];
1041
+ shippingAddress: CalculateLandedCostRequest['shippingAddress'];
1042
+ zonosApiRoute: string;
1056
1043
  };
1044
+ type BuildLandedCostResponse = (CalculateLandedCostMutation & {
1045
+ errors?: {
1046
+ message: string;
1047
+ }[];
1048
+ }) | null;
1057
1049
 
1058
- declare const colorPrefixes: readonly ["blue", "cyan", "green", "orange", "purple", "red", "gray", "glass"];
1059
- declare const colorContrasts: readonly ["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000"];
1060
- type ColorContrast = (typeof colorContrasts)[number];
1061
- type ColorPrefix = (typeof colorPrefixes)[number];
1062
- type Color = 'gray-0' | 'gray-50' | 'glass-0' | 'glass-50' | `${ColorPrefix}-${ColorContrast}` | 'gray-1100' | 'gray-1200' | 'glass-1100' | 'glass-1200';
1063
- declare const checkboxColorPrefix: readonly ["blue", "cyan", "green", "orange", "purple", "red", "gray"];
1064
- type CheckboxColorPrefix = (typeof checkboxColorPrefix)[number];
1065
-
1066
- type BannerIntent = 'default' | 'error' | 'success' | 'warning' | 'info';
1050
+ type ZonosOrder = GetOrderQuery['order'];
1067
1051
 
1068
- declare const textOptions: {
1069
- readonly pageHeader: {
1070
- readonly label: "Page Header (3XL) · 34px (2.125rem)";
1071
- readonly size: "3xl";
1072
- readonly tag: "h2";
1073
- readonly weight: 900;
1052
+ type BuildCardDetailParams = {
1053
+ countryCode: CountryCode;
1054
+ currencyCode: CurrencyCode;
1055
+ };
1056
+ type CheckoutConfig = {
1057
+ /**
1058
+ * Validate address to allow specific character sets
1059
+ * @default ALL
1060
+ */
1061
+ allowedCharacterSets?: 'ALL' | 'LATIN';
1062
+ analyticsProviders: Array<{
1063
+ status: AnalyticsProviderStatus;
1064
+ type: AnalyticsProviderType;
1065
+ }>;
1066
+ /**
1067
+ * @default false - when false, we disable the place order button until the script is loaded
1068
+ * @note if set to true, we will not enable or disable the place order button
1069
+ */
1070
+ disablePlaceOrderButtonActivation?: boolean;
1071
+ externalPaymentMethods: Array<{
1072
+ status: ExternalPaymentMethodStatus;
1073
+ type: ExternalPaymentMethodType;
1074
+ }> | null;
1075
+ externalServiceTokens: {
1076
+ token: string;
1077
+ type: ExternalServiceTokenType;
1078
+ }[];
1079
+ /**
1080
+ * Test mode for checkout (sandbox or production)
1081
+ * @default TEST
1082
+ */
1083
+ mode: Mode;
1084
+ orderNotifications: {
1085
+ abandonedCart: {
1086
+ delay: number;
1087
+ discountPercent: number;
1088
+ status: {
1089
+ active: NotificationActiveStatus;
1090
+ sendCopiesTo: Array<string>;
1091
+ };
1092
+ };
1093
+ orderCancelled: {
1094
+ active: NotificationActiveStatus;
1095
+ sendCopiesTo: Array<string>;
1096
+ };
1097
+ orderConfirmation: {
1098
+ active: NotificationActiveStatus;
1099
+ sendCopiesTo: Array<string>;
1100
+ } | null;
1101
+ orderShipped: {
1102
+ active: NotificationActiveStatus;
1103
+ sendCopiesTo: Array<string>;
1104
+ };
1074
1105
  };
1075
- readonly secondaryPageHeader: {
1076
- readonly label: "Secondary Page Header (3XL) • 34px, 500 \"Medium\"";
1077
- readonly size: "3xl";
1106
+ organization: string;
1107
+ placeOrderButtonSelector: string | null;
1108
+ /**
1109
+ * @param subscriptionStatus subscription status for checkout, checkout only available if subscription status is ENABLED and visibility status is ENABLED
1110
+ *
1111
+ * **NOTE: this value can't be overridden in Zonos.init**
1112
+ */
1113
+ subscriptionStatus: CheckoutSubscriptionStatus;
1114
+ successBehavior: CheckoutSuccessBehavior;
1115
+ /**
1116
+ * The success page action text for checkout.
1117
+ * @note Default text supports translation automatically, but any custom text will not be translated.
1118
+ */
1119
+ successPageActionText?: string;
1120
+ /**
1121
+ * The success page subtitle text for checkout. Each item in the array will appear on a new line.
1122
+ * @note Default text supports translation automatically, but any custom text will not be translated.
1123
+ */
1124
+ successPageSubtitleText?: string[];
1125
+ /**
1126
+ * The success page title text for checkout.
1127
+ * @note Default text supports translation automatically, but any custom text will not be translated.
1128
+ */
1129
+ successPageTitleText?: string;
1130
+ successRedirectUrl: string;
1131
+ visibilityStatus: CheckoutVisibilityStatus;
1132
+ /**
1133
+ * Cart info callback for checkout (optional),
1134
+ * @deprecated
1135
+ * @note
1136
+ * This function is deprecated in favor of new API `createCartId`
1137
+ * @note will attempt to use cart data if available
1138
+ * User can dispatch an event 'zonos--init-cart-info' to update the cart
1139
+ * @example
1140
+ * const initEvent = new CustomEvent<CartItem[]>('zonos--init-cart-info', {
1141
+ * detail: cartItems,
1142
+ * });
1143
+ * document.body.dispatchEvent(initEvent);
1144
+ * @returns {object[]} - object with the the item info to be added to cart:
1145
+ * - amount: number;
1146
+ * - countryOfOrigin?: string;
1147
+ * - currencyCode: string;
1148
+ * - description?: string;
1149
+ * - hsCode?: string;
1150
+ * - imageUrl?: string;
1151
+ * - name: string;
1152
+ * - productId?: string;
1153
+ * - quantity: number;
1154
+ */
1155
+ buildCartDetail?: (params: BuildCardDetailParams) => Promise<CartItem[]>;
1156
+ /**
1157
+ * Calculate landed cost callback for checkout (optional)
1158
+ * @deprecated
1159
+ * @note
1160
+ * This function is deprecated in favor of new API `createCartId`
1161
+ * @note will attempt to use cart data if available
1162
+ */
1163
+ buildLandedCost?: (params: BuildLandedCostParams) => Promise<BuildLandedCostResponse>;
1164
+ /**
1165
+ * Callback that returns the cart id from `cartCreate` mutation.
1166
+ * @note
1167
+ * The mutation `cartCreate` is preferred to be called in the server side
1168
+ * @returns string - Cart ID
1169
+ */
1170
+ createCartId?: () => Promise<string> | string;
1171
+ /**
1172
+ * Callback trigger when the checkout is closed
1173
+ */
1174
+ onClose?: () => void;
1175
+ /**
1176
+ * This callback is optional. If provided, it will be called right before the payment is processed.
1177
+ * @param items - The cart items.
1178
+ * @returns {string | null} - The error message to display to the user. If the message is empty or null, the payment will proceed.
1179
+ * @example
1180
+ * onInventoryCheck: async ({ items }) => {
1181
+ * // Check if all items are available from the server. If the fetch is throwing an error, we will show a generic error message "Unable to check inventory. Please try again.".
1182
+ * const itemsInfo = await fetch('https://yourserver.com/api/get-available-items', {
1183
+ * method: 'POST',
1184
+ * body: JSON.stringify({ items }),
1185
+ * });
1186
+ * const items = await itemsInfo.json();
1187
+ * // Filter out unavailable items.
1188
+ * const unavailableItems = items.filter(item => !item.available);
1189
+ * if (unavailableItems.length) {
1190
+ * // Display an error message to the user.
1191
+ * return `The following items are not available: ${unavailableItems.map(item => item.name).join(', ')}`;
1192
+ * }
1193
+ * // Proceed with the payment if you return an empty string or null.
1194
+ * return '';
1195
+ * }
1196
+ */
1197
+ onInventoryCheck?: (params: {
1198
+ items: CartItem[];
1199
+ }) => Promise<string | null>;
1200
+ /**
1201
+ * Callback trigger when payment succeeds
1202
+ */
1203
+ onOrderSuccess?: (props: {
1204
+ zonosApiRoute: string;
1205
+ zonosOrder: ZonosOrder;
1206
+ }) => Promise<void>;
1207
+ };
1208
+
1209
+ type CountryOverrideBehavior = 'URL_PARAM' | 'SESSION';
1210
+ type ShowForCountries = 'ALL' | 'ONLY_SHIPPABLE' | CountryCode[];
1211
+ type ShowCountryList = 'ALL' | 'ONLY_SHIPPABLE' | CountryCode[];
1212
+ type HelloConfig = {
1213
+ anchorElementSelector: string;
1214
+ cartUrlPattern: string | null;
1215
+ /**
1216
+ * The behavior to use when determining the country to use for the user.
1217
+ * @default 'URL_PARAM'
1218
+ */
1219
+ countryOverrideBehavior?: CountryOverrideBehavior;
1220
+ currencyBehavior: HelloCurrencyBehavior;
1221
+ currencyElementSelector: string;
1222
+ desktopLocation?: HelloMobileLocation | null;
1223
+ excludedUrlPatterns: Array<string>;
1224
+ homepageUrlPattern: string | null;
1225
+ mobileLocation: HelloMobileLocation | null;
1226
+ mode: Mode;
1227
+ organization: string;
1228
+ peekMessageBehavior: HelloPeekMessageBehavior;
1229
+ peekMessageDelay: number;
1230
+ productAddToCartElementSelector: string | null;
1231
+ productDescriptionElementSelector: string | null;
1232
+ productDetailUrlPattern: string | null;
1233
+ productListUrlPattern: string | null;
1234
+ productTitleElementSelector: string | null;
1235
+ restrictionBehavior: HelloRestrictionBehavior;
1236
+ /**
1237
+ * The countries to include in the country list dropdown of the Hello widget.
1238
+ * @default ONLY_SHIPPABLE
1239
+ */
1240
+ showCountryList?: ShowCountryList;
1241
+ /**
1242
+ * The countries to show the widget for.
1243
+ * @default ONLY_SHIPPABLE
1244
+ */
1245
+ showForCountries?: ShowForCountries;
1246
+ visibilityStatus?: 'ENABLED' | 'DISABLED';
1247
+ /**
1248
+ * Callback function to run after the Hello widget has been initialized. This should be triggered only once when hello is attached to the DOM.
1249
+ * **Note**: If hello is detached from the DOM and reattached, this callback will be called again.
1250
+ * @param params - The parameters containing the country code and currency code that hello is initialized with.
1251
+ */
1252
+ onInitSuccess?: (params: {
1253
+ countryCode: CountryCode;
1254
+ currencyCode: CurrencyCode;
1255
+ }) => Promise<void>;
1256
+ };
1257
+
1258
+ type AppearanceConfig = {
1259
+ colorPrimary?: string;
1260
+ colorSecondary?: string;
1261
+ fontFamily: string;
1262
+ logoUrl: string;
1263
+ style: ElementsUiStyle;
1264
+ theme: ElementsUiTheme;
1265
+ zonosAttribution: ZonosAttribution | null;
1266
+ };
1267
+
1268
+ type CustomEventMap = {
1269
+ legacyCheckoutError: string;
1270
+ 'zonos-checkout-success': {
1271
+ message: string;
1272
+ };
1273
+ };
1274
+
1275
+ declare const envClientSchema: z.ZodObject<{
1276
+ NEXT_PUBLIC_FLAG_URL: z.ZodString;
1277
+ NEXT_PUBLIC_RELEASE_DATE: z.ZodString;
1278
+ NEXT_PUBLIC_ZONOS_API_KEY: z.ZodString;
1279
+ NEXT_PUBLIC_ZONOS_CDNJS_CDN_URL: z.ZodString;
1280
+ NEXT_PUBLIC_ZONOS_CDN_URL: z.ZodString;
1281
+ NEXT_PUBLIC_ZONOS_CLOUDFLARE_URL: z.ZodString;
1282
+ NEXT_PUBLIC_ZONOS_JS_DELIVR_CDN_URL: z.ZodString;
1283
+ NEXT_PUBLIC_ZONOS_PACKAGE_VERSION: z.ZodString;
1284
+ NEXT_PUBLIC_ZONOS_ROUTE_URL: z.ZodString;
1285
+ NEXT_PUBLIC_ZONOS_UNPKG_CDN_URL: z.ZodString;
1286
+ }, "strip", z.ZodTypeAny, {
1287
+ NEXT_PUBLIC_FLAG_URL: string;
1288
+ NEXT_PUBLIC_RELEASE_DATE: string;
1289
+ NEXT_PUBLIC_ZONOS_API_KEY: string;
1290
+ NEXT_PUBLIC_ZONOS_CDNJS_CDN_URL: string;
1291
+ NEXT_PUBLIC_ZONOS_CDN_URL: string;
1292
+ NEXT_PUBLIC_ZONOS_CLOUDFLARE_URL: string;
1293
+ NEXT_PUBLIC_ZONOS_JS_DELIVR_CDN_URL: string;
1294
+ NEXT_PUBLIC_ZONOS_PACKAGE_VERSION: string;
1295
+ NEXT_PUBLIC_ZONOS_ROUTE_URL: string;
1296
+ NEXT_PUBLIC_ZONOS_UNPKG_CDN_URL: string;
1297
+ }, {
1298
+ NEXT_PUBLIC_FLAG_URL: string;
1299
+ NEXT_PUBLIC_RELEASE_DATE: string;
1300
+ NEXT_PUBLIC_ZONOS_API_KEY: string;
1301
+ NEXT_PUBLIC_ZONOS_CDNJS_CDN_URL: string;
1302
+ NEXT_PUBLIC_ZONOS_CDN_URL: string;
1303
+ NEXT_PUBLIC_ZONOS_CLOUDFLARE_URL: string;
1304
+ NEXT_PUBLIC_ZONOS_JS_DELIVR_CDN_URL: string;
1305
+ NEXT_PUBLIC_ZONOS_PACKAGE_VERSION: string;
1306
+ NEXT_PUBLIC_ZONOS_ROUTE_URL: string;
1307
+ NEXT_PUBLIC_ZONOS_UNPKG_CDN_URL: string;
1308
+ }>;
1309
+ interface Env extends z.infer<typeof envClientSchema> {
1310
+ }
1311
+
1312
+ /* eslint-disable no-relative-import-paths/no-relative-import-paths */
1313
+
1314
+ declare global {
1315
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
1316
+ interface Document {
1317
+ addEventListener<K extends keyof CustomEventMap>(
1318
+ type: K,
1319
+ listener: (this: Document, ev: CustomEvent<CustomEventMap[K]>) => void,
1320
+ ): void;
1321
+ }
1322
+
1323
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
1324
+ interface Window {
1325
+ Sentry?: {
1326
+ init: (config: BrowserOptions) => void;
1327
+ };
1328
+ Stripe?: StripeConstructor;
1329
+ Zonos: Zonos;
1330
+ /**
1331
+ * A flag to determine if the current page is a BigCommerce page
1332
+ */
1333
+ bcConfig?: unknown;
1334
+ /**
1335
+ * A flag to determine if the current page is a BigCommerce page
1336
+ */
1337
+ stencilBootstrap?: unknown;
1338
+ sentryOnLoad?: () => void;
1339
+ }
1340
+
1341
+ namespace NodeJS {
1342
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
1343
+ interface ProcessEnv extends Env {}
1344
+ }
1345
+ }
1346
+
1347
+ type TranslatedText = {
1348
+ [key: string]: string;
1349
+ };
1350
+ type EnteredInfo = {
1351
+ city: string;
1352
+ country: CountryCode;
1353
+ email: string;
1354
+ line1: string;
1355
+ line2: string;
1356
+ name: string;
1357
+ phone: string;
1358
+ postal_code: string;
1359
+ state: string;
1360
+ };
1361
+ type ValidateAddressFields = Omit<StripeAddressElementChangeEvent['value']['address'], 'country'> & {
1362
+ name: string;
1363
+ };
1364
+ type TranslatedAddressObject = {
1365
+ [key in keyof ValidateAddressFields]?: TranslatedText;
1366
+ };
1367
+
1368
+ type SubmitEventData = {
1369
+ billingAddress: Record<keyof TranslatedAddressObject, string> | null;
1370
+ shippingAddress: Record<keyof TranslatedAddressObject, string>;
1371
+ };
1372
+
1373
+ declare const colorPrefixes: readonly ["blue", "cyan", "green", "orange", "purple", "red", "gray", "glass"];
1374
+ declare const colorContrasts: readonly ["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000"];
1375
+ type ColorContrast = (typeof colorContrasts)[number];
1376
+ type ColorPrefix = (typeof colorPrefixes)[number];
1377
+ type Color = 'gray-0' | 'gray-50' | 'glass-0' | 'glass-50' | `${ColorPrefix}-${ColorContrast}` | 'gray-1100' | 'gray-1200' | 'glass-1100' | 'glass-1200';
1378
+ declare const checkboxColorPrefix: readonly ["blue", "cyan", "green", "orange", "purple", "red", "gray"];
1379
+ type CheckboxColorPrefix = (typeof checkboxColorPrefix)[number];
1380
+
1381
+ type BannerIntent = 'default' | 'error' | 'success' | 'warning' | 'info';
1382
+
1383
+ declare const textOptions: {
1384
+ readonly pageHeader: {
1385
+ readonly label: "Page Header (3XL) · 34px (2.125rem)";
1386
+ readonly size: "3xl";
1387
+ readonly tag: "h2";
1388
+ readonly weight: 900;
1389
+ };
1390
+ readonly secondaryPageHeader: {
1391
+ readonly label: "Secondary Page Header (3XL) • 34px, 500 \"Medium\"";
1392
+ readonly size: "3xl";
1078
1393
  readonly tag: "h2";
1079
1394
  readonly weight: 500;
1080
1395
  };
@@ -1162,6 +1477,20 @@ type Size = TextOptions[keyof TextOptions]['size'];
1162
1477
  type Type = keyof TextOptions;
1163
1478
  type FontWeight = TextOptions[keyof TextOptions]['weight'];
1164
1479
 
1480
+ type StripeStoreContactOption = {
1481
+ address: {
1482
+ city: string;
1483
+ country: string;
1484
+ line1: string;
1485
+ line2?: string;
1486
+ postal_code: string;
1487
+ state: string;
1488
+ };
1489
+ email: string;
1490
+ name: string;
1491
+ phone?: string;
1492
+ };
1493
+
1165
1494
  type NotificationInit = {
1166
1495
  message: string;
1167
1496
  /**
@@ -1224,6 +1553,7 @@ type ShippingRichRadioItem = {
1224
1553
  caption?: string;
1225
1554
  label: string;
1226
1555
  landedCostId: string;
1556
+ method: IncotermCode;
1227
1557
  price: string;
1228
1558
  shipmentRatingId: string;
1229
1559
  sublabel?: string;
@@ -2119,14 +2449,15 @@ declare namespace Components {
2119
2449
  * Override border color of the radio item
2120
2450
  */
2121
2451
  "borderStyle"?: ElementsUiStyle;
2122
- /**
2123
- * Initial selected value
2124
- */
2125
- "initialSelectedValue"?: string | number;
2126
2452
  /**
2127
2453
  * List of items to display
2128
2454
  */
2129
2455
  "items": ShippingRichRadioItem[];
2456
+ /**
2457
+ * Selected item
2458
+ * @default {null|firstItem}
2459
+ */
2460
+ "selectedItem": ShippingRichRadioItem | null;
2130
2461
  /**
2131
2462
  * Theme of the radio item
2132
2463
  */
@@ -3653,10 +3984,6 @@ declare namespace LocalJSX {
3653
3984
  * Override border color of the radio item
3654
3985
  */
3655
3986
  "borderStyle"?: ElementsUiStyle;
3656
- /**
3657
- * Initial selected value
3658
- */
3659
- "initialSelectedValue"?: string | number;
3660
3987
  /**
3661
3988
  * List of items to display
3662
3989
  */
@@ -3665,6 +3992,11 @@ declare namespace LocalJSX {
3665
3992
  * Event emitted when an item is selected
3666
3993
  */
3667
3994
  "onRadioSelected"?: (event: ZonosShippingRichRadioCustomEvent<ShippingRichRadioItem>) => void;
3995
+ /**
3996
+ * Selected item
3997
+ * @default {null|firstItem}
3998
+ */
3999
+ "selectedItem"?: ShippingRichRadioItem | null;
3668
4000
  /**
3669
4001
  * Theme of the radio item
3670
4002
  */
@@ -3838,390 +4170,61 @@ declare module "@stencil/core" {
3838
4170
  "zonos-logo": LocalJSX.ZonosLogo & JSXBase.HTMLAttributes<HTMLZonosLogoElement>;
3839
4171
  "zonos-notification": LocalJSX.ZonosNotification & JSXBase.HTMLAttributes<HTMLZonosNotificationElement>;
3840
4172
  "zonos-payment": LocalJSX.ZonosPayment & JSXBase.HTMLAttributes<HTMLZonosPaymentElement>;
3841
- "zonos-paypal-payment": LocalJSX.ZonosPaypalPayment & JSXBase.HTMLAttributes<HTMLZonosPaypalPaymentElement>;
3842
- "zonos-rest-state": LocalJSX.ZonosRestState & JSXBase.HTMLAttributes<HTMLZonosRestStateElement>;
3843
- "zonos-review": LocalJSX.ZonosReview & JSXBase.HTMLAttributes<HTMLZonosReviewElement>;
3844
- "zonos-select-dialog-header": LocalJSX.ZonosSelectDialogHeader & JSXBase.HTMLAttributes<HTMLZonosSelectDialogHeaderElement>;
3845
- "zonos-shipping": LocalJSX.ZonosShipping & JSXBase.HTMLAttributes<HTMLZonosShippingElement>;
3846
- "zonos-shipping-rich-radio": LocalJSX.ZonosShippingRichRadio & JSXBase.HTMLAttributes<HTMLZonosShippingRichRadioElement>;
3847
- "zonos-spinner": LocalJSX.ZonosSpinner & JSXBase.HTMLAttributes<HTMLZonosSpinnerElement>;
3848
- "zonos-text": LocalJSX.ZonosText & JSXBase.HTMLAttributes<HTMLZonosTextElement>;
3849
- "zonos-tooltip": LocalJSX.ZonosTooltip & JSXBase.HTMLAttributes<HTMLZonosTooltipElement>;
3850
- "zonos-v-stack": LocalJSX.ZonosVStack & JSXBase.HTMLAttributes<HTMLZonosVStackElement>;
3851
- /**
3852
- * The idea is from
3853
- * @ref https://github.com/beenotung/stencil-virtual-scroll/blob/master/src/components/virtual-scroll-list/virtual-scroll-list.scss
3854
- * @ref https://github.dev/ionic-team/ionic-framework/blob/v6.7.5/core/src/components/virtual-scroll/virtual-scroll.tsx
3855
- */
3856
- "zonos-virtual-scroll": LocalJSX.ZonosVirtualScroll & JSXBase.HTMLAttributes<HTMLZonosVirtualScrollElement>;
3857
- }
3858
- }
3859
- }
3860
-
3861
- type CalculateLandedCostAdjustmentInput = {
3862
- amount: number;
3863
- productId: string | null;
3864
- promoCode?: string | null;
3865
- sku: string | null;
3866
- type: LandedCostAdjustmentType;
3867
- };
3868
- type CalculateLandedCostRequest = {
3869
- billingAddress: {
3870
- addressLine1: string;
3871
- addressLine2?: string | undefined;
3872
- city: string;
3873
- country: CountryCode;
3874
- postalCode: string;
3875
- state: string;
3876
- };
3877
- billingContact: {
3878
- firstName: string;
3879
- lastName: string;
3880
- phone: string;
3881
- };
3882
- checkoutSessionId: string;
3883
- contact: {
3884
- email?: string;
3885
- firstName: string;
3886
- lastName: string;
3887
- phone: string;
3888
- };
3889
- items: CartItem[];
3890
- landedCostAdjustments?: CalculateLandedCostAdjustmentInput[];
3891
- metadata?: {
3892
- key: string;
3893
- value: string;
3894
- }[];
3895
- shippingAddress: {
3896
- addressLine1: string;
3897
- addressLine2?: string | undefined;
3898
- city: string;
3899
- country: CountryCode;
3900
- postalCode: string;
3901
- state: string;
3902
- };
3903
- };
3904
-
3905
- type NormalizedTempCartItem = {
3906
- amount: number;
3907
- attributes: {
3908
- key: string;
3909
- value: string;
3910
- }[];
3911
- countryOfOrigin: CountryCode | null;
3912
- currencyCode: CurrencyCode;
3913
- description: string | null;
3914
- id: string;
3915
- imageUrl: string | null;
3916
- itemType: ItemType | null;
3917
- measurements: {
3918
- type: ItemMeasurementType;
3919
- unitOfMeasure: ItemUnitOfMeasure;
3920
- value: number;
3921
- }[];
3922
- name: string | null;
3923
- productId: string | null;
3924
- quantity: number;
3925
- sku: string | null;
3926
- };
3927
- type NormalizedTempCart = {
3928
- adjustments: {
3929
- amount: number;
3930
- currencyCode: CurrencyCode;
3931
- description: string;
3932
- productId: string | null;
3933
- sku: string | null;
3934
- type: CartAdjustmentType;
3935
- }[];
3936
- credentialToken: string;
3937
- items: NormalizedTempCartItem[];
3938
- storeBaseUrl: string;
3939
- storeId: number;
3940
- };
3941
-
3942
- type CountryOverrideBehavior = 'URL_PARAM' | 'SESSION';
3943
- type ShowForCountries = 'ALL' | 'ONLY_SHIPPABLE' | CountryCode[];
3944
- type ShowCountryList = 'ALL' | 'ONLY_SHIPPABLE' | CountryCode[];
3945
- type HelloConfig = {
3946
- anchorElementSelector: string;
3947
- cartUrlPattern: string | null;
3948
- /**
3949
- * The behavior to use when determining the country to use for the user.
3950
- * @default 'URL_PARAM'
3951
- */
3952
- countryOverrideBehavior?: CountryOverrideBehavior;
3953
- currencyBehavior: HelloCurrencyBehavior;
3954
- currencyElementSelector: string;
3955
- desktopLocation?: HelloMobileLocation | null;
3956
- excludedUrlPatterns: Array<string>;
3957
- homepageUrlPattern: string | null;
3958
- mobileLocation: HelloMobileLocation | null;
3959
- mode: Mode;
3960
- organization: string;
3961
- peekMessageBehavior: HelloPeekMessageBehavior;
3962
- peekMessageDelay: number;
3963
- productAddToCartElementSelector: string | null;
3964
- productDescriptionElementSelector: string | null;
3965
- productDetailUrlPattern: string | null;
3966
- productListUrlPattern: string | null;
3967
- productTitleElementSelector: string | null;
3968
- restrictionBehavior: HelloRestrictionBehavior;
3969
- /**
3970
- * The countries to include in the country list dropdown of the Hello widget.
3971
- * @default ONLY_SHIPPABLE
3972
- */
3973
- showCountryList?: ShowCountryList;
3974
- /**
3975
- * The countries to show the widget for.
3976
- * @default ONLY_SHIPPABLE
3977
- */
3978
- showForCountries?: ShowForCountries;
3979
- visibilityStatus?: 'ENABLED' | 'DISABLED';
3980
- /**
3981
- * Callback function to run after the Hello widget has been initialized. This should be triggered only once when hello is attached to the DOM.
3982
- * **Note**: If hello is detached from the DOM and reattached, this callback will be called again.
3983
- * @param params - The parameters containing the country code and currency code that hello is initialized with.
3984
- */
3985
- onInitSuccess?: (params: {
3986
- countryCode: CountryCode;
3987
- currencyCode: CurrencyCode;
3988
- }) => Promise<void>;
3989
- };
3990
-
3991
- type StripeStoreContactOption = {
3992
- address: {
3993
- city: string;
3994
- country: string;
3995
- line1: string;
3996
- line2?: string;
3997
- postal_code: string;
3998
- state: string;
3999
- };
4000
- email: string;
4001
- name: string;
4002
- phone?: string;
4003
- };
4173
+ "zonos-paypal-payment": LocalJSX.ZonosPaypalPayment & JSXBase.HTMLAttributes<HTMLZonosPaypalPaymentElement>;
4174
+ "zonos-rest-state": LocalJSX.ZonosRestState & JSXBase.HTMLAttributes<HTMLZonosRestStateElement>;
4175
+ "zonos-review": LocalJSX.ZonosReview & JSXBase.HTMLAttributes<HTMLZonosReviewElement>;
4176
+ "zonos-select-dialog-header": LocalJSX.ZonosSelectDialogHeader & JSXBase.HTMLAttributes<HTMLZonosSelectDialogHeaderElement>;
4177
+ "zonos-shipping": LocalJSX.ZonosShipping & JSXBase.HTMLAttributes<HTMLZonosShippingElement>;
4178
+ "zonos-shipping-rich-radio": LocalJSX.ZonosShippingRichRadio & JSXBase.HTMLAttributes<HTMLZonosShippingRichRadioElement>;
4179
+ "zonos-spinner": LocalJSX.ZonosSpinner & JSXBase.HTMLAttributes<HTMLZonosSpinnerElement>;
4180
+ "zonos-text": LocalJSX.ZonosText & JSXBase.HTMLAttributes<HTMLZonosTextElement>;
4181
+ "zonos-tooltip": LocalJSX.ZonosTooltip & JSXBase.HTMLAttributes<HTMLZonosTooltipElement>;
4182
+ "zonos-v-stack": LocalJSX.ZonosVStack & JSXBase.HTMLAttributes<HTMLZonosVStackElement>;
4183
+ /**
4184
+ * The idea is from
4185
+ * @ref https://github.com/beenotung/stencil-virtual-scroll/blob/master/src/components/virtual-scroll-list/virtual-scroll-list.scss
4186
+ * @ref https://github.dev/ionic-team/ionic-framework/blob/v6.7.5/core/src/components/virtual-scroll/virtual-scroll.tsx
4187
+ */
4188
+ "zonos-virtual-scroll": LocalJSX.ZonosVirtualScroll & JSXBase.HTMLAttributes<HTMLZonosVirtualScrollElement>;
4189
+ }
4190
+ }
4191
+ }
4004
4192
 
4005
- type TabItem = {
4006
- index: number;
4007
- isDone: boolean;
4008
- label: 'Customer' | 'Delivery' | 'Payment';
4009
- value: 'customer-info' | 'shipping' | 'payment';
4010
- };
4011
- type TabItems = Record<TabItem['value'], TabItem>;
4012
- type ItemMeasurement = {
4013
- /** Indicates what type of `Measurement`, e.g. weight, specific dim unit. */
4014
- type: ItemMeasurementType;
4015
- /** Indicates the `Measurement` units to be used. */
4016
- unitOfMeasure: ItemUnitOfMeasure;
4017
- /** The `Measurement` value. */
4018
- value: number;
4019
- };
4020
- type CartItem = {
4193
+ type NormalizedTempCartItem = {
4021
4194
  amount: number;
4022
- attributes?: {
4195
+ attributes: {
4023
4196
  key: string;
4024
4197
  value: string;
4025
4198
  }[];
4026
- countryOfOrigin?: CountryCode;
4199
+ countryOfOrigin: CountryCode | null;
4027
4200
  currencyCode: CurrencyCode;
4028
- description?: string;
4029
- hsCode?: string;
4030
- imageUrl?: string;
4031
- itemType?: ItemType;
4032
- measurements?: ItemMeasurement[];
4033
- metadata?: {
4034
- key: string;
4035
- value: string;
4201
+ description: string | null;
4202
+ id: string;
4203
+ imageUrl: string | null;
4204
+ itemType: ItemType | null;
4205
+ measurements: {
4206
+ type: ItemMeasurementType;
4207
+ unitOfMeasure: ItemUnitOfMeasure;
4208
+ value: number;
4036
4209
  }[];
4037
- name: string;
4038
- productId?: string;
4210
+ name: string | null;
4211
+ productId: string | null;
4039
4212
  quantity: number;
4040
- sku?: string;
4041
- };
4042
-
4043
- type BuildLandedCostParams = {
4044
- billingAddress: CalculateLandedCostRequest['billingAddress'];
4045
- billingContact: CalculateLandedCostRequest['billingContact'];
4046
- checkoutSessionId: string;
4047
- contact: CalculateLandedCostRequest['contact'];
4048
- landedCostAdjustments?: CalculateLandedCostRequest['landedCostAdjustments'];
4049
- shippingAddress: CalculateLandedCostRequest['shippingAddress'];
4050
- zonosApiRoute: string;
4051
- };
4052
- type BuildLandedCostResponse = (CalculateLandedCostMutation & {
4053
- errors?: {
4054
- message: string;
4055
- }[];
4056
- }) | null;
4057
-
4058
- type ZonosOrder = GetOrderQuery['order'];
4059
-
4060
- type BuildCardDetailParams = {
4061
- countryCode: CountryCode;
4062
- currencyCode: CurrencyCode;
4213
+ sku: string | null;
4063
4214
  };
4064
- type CheckoutConfig = {
4065
- /**
4066
- * Validate address to allow specific character sets
4067
- * @default ALL
4068
- */
4069
- allowedCharacterSets?: 'ALL' | 'LATIN';
4070
- analyticsProviders: Array<{
4071
- status: AnalyticsProviderStatus;
4072
- type: AnalyticsProviderType;
4073
- }>;
4074
- /**
4075
- * @default false - when false, we disable the place order button until the script is loaded
4076
- * @note if set to true, we will not enable or disable the place order button
4077
- */
4078
- disablePlaceOrderButtonActivation?: boolean;
4079
- externalPaymentMethods: Array<{
4080
- status: ExternalPaymentMethodStatus;
4081
- type: ExternalPaymentMethodType;
4082
- }> | null;
4083
- externalServiceTokens: {
4084
- token: string;
4085
- type: ExternalServiceTokenType;
4215
+ type NormalizedTempCart = {
4216
+ adjustments: {
4217
+ amount: number;
4218
+ currencyCode: CurrencyCode;
4219
+ description: string;
4220
+ productId: string | null;
4221
+ sku: string | null;
4222
+ type: CartAdjustmentType;
4086
4223
  }[];
4087
- /**
4088
- * Test mode for checkout (sandbox or production)
4089
- * @default TEST
4090
- */
4091
- mode: Mode;
4092
- orderNotifications: {
4093
- abandonedCart: {
4094
- delay: number;
4095
- discountPercent: number;
4096
- status: {
4097
- active: NotificationActiveStatus;
4098
- sendCopiesTo: Array<string>;
4099
- };
4100
- };
4101
- orderCancelled: {
4102
- active: NotificationActiveStatus;
4103
- sendCopiesTo: Array<string>;
4104
- };
4105
- orderConfirmation: {
4106
- active: NotificationActiveStatus;
4107
- sendCopiesTo: Array<string>;
4108
- } | null;
4109
- orderShipped: {
4110
- active: NotificationActiveStatus;
4111
- sendCopiesTo: Array<string>;
4112
- };
4113
- };
4114
- organization: string;
4115
- placeOrderButtonSelector: string | null;
4116
- /**
4117
- * @param subscriptionStatus subscription status for checkout, checkout only available if subscription status is ENABLED and visibility status is ENABLED
4118
- *
4119
- * **NOTE: this value can't be overridden in Zonos.init**
4120
- */
4121
- subscriptionStatus: CheckoutSubscriptionStatus;
4122
- successBehavior: CheckoutSuccessBehavior;
4123
- /**
4124
- * The success page action text for checkout.
4125
- * @note Default text supports translation automatically, but any custom text will not be translated.
4126
- */
4127
- successPageActionText?: string;
4128
- /**
4129
- * The success page subtitle text for checkout. Each item in the array will appear on a new line.
4130
- * @note Default text supports translation automatically, but any custom text will not be translated.
4131
- */
4132
- successPageSubtitleText?: string[];
4133
- /**
4134
- * The success page title text for checkout.
4135
- * @note Default text supports translation automatically, but any custom text will not be translated.
4136
- */
4137
- successPageTitleText?: string;
4138
- successRedirectUrl: string;
4139
- visibilityStatus: CheckoutVisibilityStatus;
4140
- /**
4141
- * Cart info callback for checkout (optional),
4142
- * @deprecated
4143
- * @note
4144
- * This function is deprecated in favor of new API `createCartId`
4145
- * @note will attempt to use cart data if available
4146
- * User can dispatch an event 'zonos--init-cart-info' to update the cart
4147
- * @example
4148
- * const initEvent = new CustomEvent<CartItem[]>('zonos--init-cart-info', {
4149
- * detail: cartItems,
4150
- * });
4151
- * document.body.dispatchEvent(initEvent);
4152
- * @returns {object[]} - object with the the item info to be added to cart:
4153
- * - amount: number;
4154
- * - countryOfOrigin?: string;
4155
- * - currencyCode: string;
4156
- * - description?: string;
4157
- * - hsCode?: string;
4158
- * - imageUrl?: string;
4159
- * - name: string;
4160
- * - productId?: string;
4161
- * - quantity: number;
4162
- */
4163
- buildCartDetail?: (params: BuildCardDetailParams) => Promise<CartItem[]>;
4164
- /**
4165
- * Calculate landed cost callback for checkout (optional)
4166
- * @deprecated
4167
- * @note
4168
- * This function is deprecated in favor of new API `createCartId`
4169
- * @note will attempt to use cart data if available
4170
- */
4171
- buildLandedCost?: (params: BuildLandedCostParams) => Promise<BuildLandedCostResponse>;
4172
- /**
4173
- * Callback that returns the cart id from `cartCreate` mutation.
4174
- * @note
4175
- * The mutation `cartCreate` is preferred to be called in the server side
4176
- * @returns string - Cart ID
4177
- */
4178
- createCartId?: () => Promise<string> | string;
4179
- /**
4180
- * Callback trigger when the checkout is closed
4181
- */
4182
- onClose?: () => void;
4183
- /**
4184
- * This callback is optional. If provided, it will be called right before the payment is processed.
4185
- * @param items - The cart items.
4186
- * @returns {string | null} - The error message to display to the user. If the message is empty or null, the payment will proceed.
4187
- * @example
4188
- * onInventoryCheck: async ({ items }) => {
4189
- * // Check if all items are available from the server. If the fetch is throwing an error, we will show a generic error message "Unable to check inventory. Please try again.".
4190
- * const itemsInfo = await fetch('https://yourserver.com/api/get-available-items', {
4191
- * method: 'POST',
4192
- * body: JSON.stringify({ items }),
4193
- * });
4194
- * const items = await itemsInfo.json();
4195
- * // Filter out unavailable items.
4196
- * const unavailableItems = items.filter(item => !item.available);
4197
- * if (unavailableItems.length) {
4198
- * // Display an error message to the user.
4199
- * return `The following items are not available: ${unavailableItems.map(item => item.name).join(', ')}`;
4200
- * }
4201
- * // Proceed with the payment if you return an empty string or null.
4202
- * return '';
4203
- * }
4204
- */
4205
- onInventoryCheck?: (params: {
4206
- items: CartItem[];
4207
- }) => Promise<string | null>;
4208
- /**
4209
- * Callback trigger when payment succeeds
4210
- */
4211
- onOrderSuccess?: (props: {
4212
- zonosApiRoute: string;
4213
- zonosOrder: ZonosOrder;
4214
- }) => Promise<void>;
4215
- };
4216
-
4217
- type AppearanceConfig = {
4218
- colorPrimary?: string;
4219
- colorSecondary?: string;
4220
- fontFamily: string;
4221
- logoUrl: string;
4222
- style: ElementsUiStyle;
4223
- theme: ElementsUiTheme;
4224
- zonosAttribution: ZonosAttribution | null;
4224
+ credentialToken: string;
4225
+ items: NormalizedTempCartItem[];
4226
+ storeBaseUrl: string;
4227
+ storeId: number;
4225
4228
  };
4226
4229
 
4227
4230
  /**