@zonos/elements 1.3.50 → 1.3.52

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 (208) hide show
  1. package/dist/cjs/CheckoutConfig-65376e00.js +40 -0
  2. package/dist/cjs/{cart-688d674d.js → cart-61a8983d.js} +238 -370
  3. package/dist/cjs/{createCustomEvent-01bacaea.js → createCustomEvent-228027b5.js} +3 -2
  4. package/dist/cjs/handleFetch-842c95b0.js +322 -0
  5. package/dist/cjs/index.cjs.js +75 -35
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/{paypal-ce1516ba.js → paypal-f1eb6621.js} +16 -16
  8. package/dist/cjs/zonos-address_8.cjs.entry.js +4 -4
  9. package/dist/cjs/{zonos-cart-items_12.cjs.entry.js → zonos-badge_13.cjs.entry.js} +41 -9
  10. package/dist/cjs/zonos-checkout.cjs.entry.js +75 -174
  11. package/dist/cjs/zonos-controller.cjs.entry.js +27 -25
  12. package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
  13. package/dist/cjs/zonos-country-select_4.cjs.entry.js +2 -2
  14. package/dist/cjs/zonos-elements.cjs.js +1 -1
  15. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
  16. package/dist/cjs/zonos-hello.cjs.entry.js +11 -11
  17. package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
  18. package/dist/cjs/zonos-notification_3.cjs.entry.js +9 -9
  19. package/dist/cjs/zonos-tooltip.cjs.entry.js +27 -0
  20. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +5 -2
  21. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +44 -20
  22. package/dist/collection/components/store/checkout/cart.js +14 -2
  23. package/dist/collection/components/store/checkout/stripe.js +9 -4
  24. package/dist/collection/components/store/translationStore/strings.arabic.js +3 -3
  25. package/dist/collection/components/store/translationStore/strings.base.js +3 -3
  26. package/dist/collection/components/store/translationStore/strings.chinese.js +3 -3
  27. package/dist/collection/components/store/translationStore/strings.danish.js +3 -3
  28. package/dist/collection/components/store/translationStore/strings.dutch.js +3 -3
  29. package/dist/collection/components/store/translationStore/strings.french.js +3 -3
  30. package/dist/collection/components/store/translationStore/strings.german.js +3 -3
  31. package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -3
  32. package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -3
  33. package/dist/collection/components/store/translationStore/strings.italian.js +3 -3
  34. package/dist/collection/components/store/translationStore/strings.japanese.js +3 -3
  35. package/dist/collection/components/store/translationStore/strings.korean.js +3 -3
  36. package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -3
  37. package/dist/collection/components/store/translationStore/strings.polish.js +3 -3
  38. package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -3
  39. package/dist/collection/components/store/translationStore/strings.russian.js +3 -3
  40. package/dist/collection/components/store/translationStore/strings.spanish.js +3 -3
  41. package/dist/collection/components/store/translationStore/strings.swedish.js +3 -3
  42. package/dist/collection/components/store/translationStore/strings.turkish.js +3 -3
  43. package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -3
  44. package/dist/collection/components/utils/api/buildCartItemsByTempCart.js +14 -14
  45. package/dist/collection/components/utils/api/calculateLandedCostNormalized.js +28 -0
  46. package/dist/collection/components/utils/api/cartCalculateLandedCost.js +19 -0
  47. package/dist/collection/components/utils/api/prepCalculateLandedCost.js +65 -0
  48. package/dist/collection/components/utils/api/triggerBuildLandedCost.js +2 -2
  49. package/dist/collection/components/utils/checkout/initCheckout.js +4 -2
  50. package/dist/collection/components/utils/handleFetch.js +6 -1
  51. package/dist/collection/environment.js +1 -1
  52. package/dist/collection/scripts/_getNextFallbackUrl.js +1 -0
  53. package/dist/collection/scripts/_getTempCartById.js +14 -0
  54. package/dist/collection/scripts/_zonosBase.js +39 -10
  55. package/dist/collection/scripts/cart/_getCartIdFromParam.js +9 -0
  56. package/dist/collection/scripts/cart/_setupCartData.js +18 -0
  57. package/dist/collection/types/checkout/CheckoutConfig.js +2 -1
  58. package/dist/collection/types/generated/graphql.customer.types.js +12 -0
  59. package/dist/collection/utils/formattedCloudflareApiUrl.js +8 -2
  60. package/dist/collection/utils/generateCloudflareDeployUrl.js +3 -0
  61. package/dist/esm/CheckoutConfig-57350b28.js +36 -0
  62. package/dist/esm/{cart-4f300fcb.js → cart-45d2861f.js} +194 -323
  63. package/dist/esm/{createCustomEvent-c5ed9070.js → createCustomEvent-3fcc948a.js} +2 -1
  64. package/dist/esm/handleFetch-37cea185.js +315 -0
  65. package/dist/esm/index.js +56 -17
  66. package/dist/esm/loader.js +1 -1
  67. package/dist/esm/{paypal-70caf283.js → paypal-ee310945.js} +2 -2
  68. package/dist/esm/zonos-address_8.entry.js +2 -2
  69. package/dist/esm/{zonos-cart-items_12.entry.js → zonos-badge_13.entry.js} +40 -9
  70. package/dist/esm/zonos-checkout.entry.js +61 -160
  71. package/dist/esm/zonos-controller.entry.js +6 -4
  72. package/dist/esm/zonos-country-flag.entry.js +2 -2
  73. package/dist/esm/zonos-country-select_4.entry.js +2 -2
  74. package/dist/esm/zonos-elements.js +1 -1
  75. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  76. package/dist/esm/zonos-hello.entry.js +2 -2
  77. package/dist/esm/zonos-language-select_2.entry.js +2 -2
  78. package/dist/esm/zonos-notification_3.entry.js +3 -3
  79. package/dist/esm/zonos-tooltip.entry.js +23 -0
  80. package/dist/esm-es5/CheckoutConfig-57350b28.js +1 -0
  81. package/dist/esm-es5/cart-45d2861f.js +1 -0
  82. package/dist/esm-es5/{createCustomEvent-c5ed9070.js → createCustomEvent-3fcc948a.js} +1 -1
  83. package/dist/esm-es5/handleFetch-37cea185.js +1 -0
  84. package/dist/esm-es5/index.js +1 -1
  85. package/dist/esm-es5/loader.js +1 -1
  86. package/dist/esm-es5/{paypal-70caf283.js → paypal-ee310945.js} +1 -1
  87. package/dist/esm-es5/zonos-address_8.entry.js +1 -1
  88. package/dist/esm-es5/zonos-badge_13.entry.js +1 -0
  89. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  90. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  91. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  92. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  93. package/dist/esm-es5/zonos-elements.js +1 -1
  94. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  95. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  96. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  97. package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
  98. package/dist/esm-es5/zonos-tooltip.entry.js +1 -0
  99. package/dist/scripts/index.d.ts +74 -87
  100. package/dist/scripts/index.js +1 -1
  101. package/dist/scripts/loadZonos.js +1 -1
  102. package/dist/scripts/zonos.js +1 -1
  103. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +0 -2
  104. package/dist/types/components/store/checkout/cart.d.ts +13 -3
  105. package/dist/types/components/store/checkout/stripe.d.ts +3 -1
  106. package/dist/types/components/store/translationStore/strings.arabic.d.ts +3 -3
  107. package/dist/types/components/store/translationStore/strings.base.d.ts +3 -3
  108. package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -3
  109. package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -3
  110. package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -3
  111. package/dist/types/components/store/translationStore/strings.french.d.ts +3 -3
  112. package/dist/types/components/store/translationStore/strings.german.d.ts +3 -3
  113. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -3
  114. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -3
  115. package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -3
  116. package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -3
  117. package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -3
  118. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -3
  119. package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -3
  120. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -3
  121. package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -3
  122. package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -3
  123. package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -3
  124. package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -3
  125. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -3
  126. package/dist/types/components/store/translationStore.d.ts +1 -1
  127. package/dist/types/components/utils/api/buildCartItemsByTempCart.d.ts +8 -3
  128. package/dist/types/components/utils/api/calculateLandedCostNormalized.d.ts +2 -0
  129. package/dist/types/components/utils/api/cartCalculateLandedCost.d.ts +5 -0
  130. package/dist/types/components/utils/api/prepCalculateLandedCost.d.ts +5 -1
  131. package/dist/types/components/utils/checkout/getIsTestMode.d.ts +1 -1
  132. package/dist/types/scripts/_getNextFallbackUrl.d.ts +1 -0
  133. package/dist/types/scripts/_getTempCartById.d.ts +8 -0
  134. package/dist/types/scripts/_zonosBase.d.ts +15 -12
  135. package/dist/types/scripts/cart/_getCartIdFromParam.d.ts +4 -0
  136. package/dist/types/scripts/cart/_setupCartData.d.ts +7 -0
  137. package/dist/types/types/checkout/CheckoutConfig.d.ts +18 -3
  138. package/dist/types/types/checkout/api/CalculateLandedCostRequest.d.ts +42 -1
  139. package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +37 -0
  140. package/dist/types/types/generated/graphql.customer.types.d.ts +249 -2
  141. package/dist/types/types/generated/graphql.customer.types.ts +251 -3
  142. package/dist/types/utils/formattedCloudflareApiUrl.d.ts +2 -2
  143. package/dist/zonos-elements/index.esm.js +1 -1
  144. package/dist/zonos-elements/p-042c466d.system.entry.js +1 -0
  145. package/dist/zonos-elements/p-10cb0064.entry.js +1 -0
  146. package/dist/zonos-elements/{p-fe198a6c.entry.js → p-259ccf8d.entry.js} +1 -1
  147. package/dist/zonos-elements/p-2a47d2cc.system.entry.js +1 -0
  148. package/dist/zonos-elements/{p-89b1f4a5.entry.js → p-31eb835c.entry.js} +1 -1
  149. package/dist/zonos-elements/{p-4849604d.entry.js → p-36360905.entry.js} +1 -1
  150. package/dist/zonos-elements/{p-322600aa.system.entry.js → p-3703b814.system.entry.js} +1 -1
  151. package/dist/zonos-elements/p-4146feec.js +1 -0
  152. package/dist/zonos-elements/p-446c8f02.system.entry.js +1 -0
  153. package/dist/zonos-elements/{p-31905b60.system.js → p-5590f90c.system.js} +1 -1
  154. package/dist/zonos-elements/p-588396df.js +1 -0
  155. package/dist/zonos-elements/{p-124e3426.js → p-6e59c6e4.js} +2 -2
  156. package/dist/zonos-elements/p-6eedc3f8.entry.js +1 -0
  157. package/dist/zonos-elements/p-747eed39.entry.js +1 -0
  158. package/dist/zonos-elements/{p-d1cd0a5f.system.entry.js → p-8228e87c.system.entry.js} +1 -1
  159. package/dist/zonos-elements/p-827868e6.entry.js +1 -0
  160. package/dist/zonos-elements/{p-a67578ae.entry.js → p-88005b94.entry.js} +1 -1
  161. package/dist/zonos-elements/p-895fdefb.js +1 -0
  162. package/dist/zonos-elements/p-8f7773b0.system.js +1 -0
  163. package/dist/zonos-elements/{p-480a6094.entry.js → p-8fa49d94.entry.js} +1 -1
  164. package/dist/zonos-elements/p-a74a7afa.system.js +1 -0
  165. package/dist/zonos-elements/p-b1861e64.system.js +1 -0
  166. package/dist/zonos-elements/{p-ec31cd17.system.entry.js → p-b842b96a.system.entry.js} +1 -1
  167. package/dist/zonos-elements/{p-1719bedd.entry.js → p-bb186075.entry.js} +1 -1
  168. package/dist/zonos-elements/{p-8af4a9e7.system.entry.js → p-c008648a.system.entry.js} +1 -1
  169. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  170. package/dist/zonos-elements/{p-22e8d4ad.system.entry.js → p-cd4ad1be.system.entry.js} +1 -1
  171. package/dist/zonos-elements/{p-e7e73693.system.entry.js → p-d62e6bb0.system.entry.js} +1 -1
  172. package/dist/zonos-elements/{p-40d52dd6.system.entry.js → p-dc12f30a.system.entry.js} +1 -1
  173. package/dist/zonos-elements/p-eb2aedd0.js +1 -0
  174. package/dist/zonos-elements/{p-ceb8b836.system.js → p-f124e459.system.js} +2 -2
  175. package/dist/zonos-elements/p-f527cd5b.entry.js +1 -0
  176. package/dist/zonos-elements/p-f826b979.system.entry.js +1 -0
  177. package/dist/zonos-elements/p-f87a635b.system.js +1 -0
  178. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  179. package/package.json +2 -1
  180. package/dist/cjs/logError-4e2f2020.js +0 -58
  181. package/dist/cjs/zonos-badge_2.cjs.entry.js +0 -57
  182. package/dist/collection/components/utils/api/tempCartItem/getAttributes.js +0 -66
  183. package/dist/collection/components/utils/api/tempCartItem/getMeasurements.js +0 -58
  184. package/dist/esm/logError-c456c092.js +0 -55
  185. package/dist/esm/zonos-badge_2.entry.js +0 -52
  186. package/dist/esm-es5/cart-4f300fcb.js +0 -1
  187. package/dist/esm-es5/logError-c456c092.js +0 -1
  188. package/dist/esm-es5/zonos-badge_2.entry.js +0 -1
  189. package/dist/esm-es5/zonos-cart-items_12.entry.js +0 -1
  190. package/dist/types/components/utils/api/tempCartItem/getAttributes.d.ts +0 -11
  191. package/dist/types/components/utils/api/tempCartItem/getMeasurements.d.ts +0 -7
  192. package/dist/types/types/checkout/api/TempCart.d.ts +0 -80
  193. package/dist/zonos-elements/p-00f219bd.entry.js +0 -1
  194. package/dist/zonos-elements/p-05dff37f.js +0 -1
  195. package/dist/zonos-elements/p-1f2db2ff.entry.js +0 -1
  196. package/dist/zonos-elements/p-2018969a.js +0 -1
  197. package/dist/zonos-elements/p-27f2e8af.system.entry.js +0 -1
  198. package/dist/zonos-elements/p-4452dddc.entry.js +0 -1
  199. package/dist/zonos-elements/p-47c72c50.system.entry.js +0 -1
  200. package/dist/zonos-elements/p-595d406e.entry.js +0 -1
  201. package/dist/zonos-elements/p-5beccdce.system.entry.js +0 -1
  202. package/dist/zonos-elements/p-6013e370.entry.js +0 -1
  203. package/dist/zonos-elements/p-63db40b9.system.js +0 -1
  204. package/dist/zonos-elements/p-6ab615e6.system.js +0 -1
  205. package/dist/zonos-elements/p-81540fd6.system.js +0 -1
  206. package/dist/zonos-elements/p-d709ad28.system.entry.js +0 -1
  207. package/dist/zonos-elements/p-eaa335e1.js +0 -1
  208. /package/dist/collection/types/checkout/api/{TempCart.js → NormalizedTempCart.js} +0 -0
@@ -1,5 +1,6 @@
1
- import { x as handleFetch, e as cartStore, l as localizationStore } from './cart-4f300fcb.js';
1
+ import { d as cartStore, l as localizationStore } from './cart-45d2861f.js';
2
2
  import { z as zonosStore } from './zonosStore-473f4654.js';
3
+ import { h as handleFetch } from './handleFetch-37cea185.js';
3
4
 
4
5
  const trackConversionEvent = async (eventName, metadata) => {
5
6
  var _a, _b;
@@ -0,0 +1,315 @@
1
+ const log = (message, type, ...additionalInfo) => {
2
+ var _a, _b;
3
+ const isDebug = !!((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.debug) ||
4
+ !!window.location.search.match(/\?.*(&*)zonosDebug=1/);
5
+ // if debug is false, do not log
6
+ if (!isDebug) {
7
+ // log errors to the console if the type is error
8
+ if (type === 'error') {
9
+ // eslint-disable-next-line no-console
10
+ console.error(message, ...additionalInfo);
11
+ }
12
+ return;
13
+ }
14
+ let loggingIframe = document.querySelector('iframe#zonos---debug-logging-iframe');
15
+ if (!loggingIframe) {
16
+ // add a hidden iframe
17
+ loggingIframe = document.createElement('iframe');
18
+ loggingIframe.id = 'zonos---debug-logging-iframe';
19
+ loggingIframe.style.display = 'none';
20
+ loggingIframe.style.opacity = '0';
21
+ loggingIframe.style.position = 'absolute';
22
+ loggingIframe.style.top = '-9999px';
23
+ loggingIframe.style.left = '-9999px';
24
+ loggingIframe.style.width = '1px';
25
+ loggingIframe.style.height = '1px';
26
+ loggingIframe.style.border = 'none';
27
+ loggingIframe.style.overflow = 'hidden';
28
+ loggingIframe.style.visibility = 'hidden';
29
+ document.body.appendChild(loggingIframe);
30
+ }
31
+ // use the logging iframe's console to log just in case the console is disabled (overriden) by the site owner
32
+ const zConsole = ((_b = loggingIframe.contentWindow) === null || _b === void 0 ? void 0 : _b.window.console) || window.console;
33
+ switch (type) {
34
+ case 'warn':
35
+ zConsole.warn(message, ...additionalInfo);
36
+ break;
37
+ case 'info':
38
+ zConsole.info(message, ...additionalInfo);
39
+ break;
40
+ case 'error':
41
+ zConsole.error(message, ...additionalInfo);
42
+ break;
43
+ default:
44
+ zConsole.groupCollapsed(message, ...additionalInfo);
45
+ zConsole.trace();
46
+ zConsole.groupEnd();
47
+ break;
48
+ }
49
+ };
50
+
51
+ const logError = (message, ...rest) => {
52
+ log(message, 'error', ...rest);
53
+ };
54
+
55
+ const fallbackApiType = ['cloudflare', 'vercel'];
56
+ const MAIN_BASE_API_TYPE = fallbackApiType[0];
57
+ const fallbackApiList = {
58
+ cloudflare: "https://route.elements.zonos.com",
59
+ vercel: "https://v1.route.js.zonos.com",
60
+ };
61
+ const MAIN_BASE_API = fallbackApiList[MAIN_BASE_API_TYPE];
62
+ /**
63
+ * Next available fallback api type
64
+ */
65
+ const getNextFallbackApiType = (currentApiType = MAIN_BASE_API_TYPE) => {
66
+ const currentIndex = fallbackApiType.indexOf(currentApiType);
67
+ const nextFallbackApiType = fallbackApiType[currentIndex + 1];
68
+ if (!nextFallbackApiType) {
69
+ return null;
70
+ }
71
+ return nextFallbackApiType;
72
+ };
73
+
74
+ const jsonParse = (_data) => {
75
+ if (typeof _data === 'string') {
76
+ try {
77
+ // eslint-disable-next-line no-restricted-syntax
78
+ const json = JSON.parse(_data);
79
+ return json;
80
+ }
81
+ catch (_error) {
82
+ return null;
83
+ }
84
+ }
85
+ return null;
86
+ };
87
+
88
+ /**
89
+ * This is the time in milliseconds after release time that we will start sending error logs to the new API
90
+ * @default 1 hour
91
+ */
92
+ const postReleaseReportingDuration = 1 * 3600 * 1000; // 1 hour
93
+ const sendErrorLog = async ({ endpoint, errors, metadata, shouldPostReleaseErrorReporting, }) => {
94
+ if (shouldPostReleaseErrorReporting) {
95
+ // We only want to report errors that happened if current time is less than 2 hours after release time
96
+ const releaseTime = Number(window.Zonos.releaseDate);
97
+ const currentTime = new Date().getTime();
98
+ if (currentTime - releaseTime > postReleaseReportingDuration) {
99
+ return;
100
+ }
101
+ }
102
+ const userAgentData = 'userAgentData' in window.navigator
103
+ ? // userAgentData is not yet supported in all browsers
104
+ window.navigator.userAgentData
105
+ : null;
106
+ const errorObject = {
107
+ endpoint,
108
+ errors,
109
+ metadata: Object.assign({ href: window.location.href, userAgent: userAgentData && userAgentData.brands.length > 0
110
+ ? userAgentData
111
+ : window.navigator.userAgent }, metadata),
112
+ };
113
+ try {
114
+ // use native fetch because in handleFetch also calls sendErrorLog and it will possibly cause circular dependencies issue
115
+ void fetch(`${MAIN_BASE_API}/api/zonos-elements/log-error`, {
116
+ body: JSON.stringify(errorObject),
117
+ method: 'POST',
118
+ });
119
+ }
120
+ catch (_err) {
121
+ const nextFallbackApi = getNextFallbackApiType();
122
+ if (!nextFallbackApi) {
123
+ return;
124
+ }
125
+ // request to the fallback API if the first one fails
126
+ void fetch(`${fallbackApiList[nextFallbackApi]}/api/zonos-elements/log-error`, {
127
+ body: JSON.stringify(errorObject),
128
+ method: 'POST',
129
+ });
130
+ }
131
+ };
132
+
133
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
134
+ var t = {};
135
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
136
+ t[p] = s[p];
137
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
138
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
139
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
140
+ t[p[i]] = s[p[i]];
141
+ }
142
+ return t;
143
+ };
144
+ const getResponseBody = async ({ response, shouldLog = true, shouldThrow = false, }) => {
145
+ try {
146
+ const json = await response.json();
147
+ return json;
148
+ }
149
+ catch (e) {
150
+ if (shouldThrow) {
151
+ throw e;
152
+ }
153
+ if (shouldLog) {
154
+ // eslint-disable-next-line
155
+ console.error(e);
156
+ }
157
+ return null;
158
+ }
159
+ };
160
+ const encodeString = (text) => {
161
+ try {
162
+ // encode the string, remove the "=" at the end of the encoded string
163
+ const encodedString = btoa(text).replace(/=/g, '');
164
+ return encodedString;
165
+ }
166
+ catch (error) {
167
+ // return the reverse string if the encoding failed
168
+ return text
169
+ .replace(/[^A-Za-z0-9]/g, '')
170
+ .split('')
171
+ .reverse()
172
+ .join('');
173
+ }
174
+ };
175
+ const handleRequest = async ({ basePathType, options, path, }) => {
176
+ let response;
177
+ // fallback to the main base API if the passed in base path is not available
178
+ const baseUrl = fallbackApiList[basePathType] || MAIN_BASE_API_TYPE;
179
+ const url = baseUrl + path;
180
+ // adding random encoded token to the url so that the request will be cached differently for each store
181
+ const modifiedUrl = new URL(url);
182
+ modifiedUrl.searchParams.set('zToken', encodeString(window.location.hostname));
183
+ try {
184
+ response = await fetch(modifiedUrl.toString(), options);
185
+ }
186
+ catch (e) {
187
+ if (e instanceof Error) {
188
+ return {
189
+ baseUrl,
190
+ errors: [{ message: e.message, type: 'unknown' }],
191
+ json: null,
192
+ response: null,
193
+ zonosMode: null,
194
+ };
195
+ }
196
+ const message = 'Fail to fetch';
197
+ return {
198
+ baseUrl,
199
+ errors: [{ message, type: 'unknown' }],
200
+ json: null,
201
+ response: null,
202
+ zonosMode: null,
203
+ };
204
+ }
205
+ const zonosMode = response.headers.get('Zonos-Mode');
206
+ const usingZonosPreview = window.Zonos.zonosQaUrl;
207
+ // We only want to alert once if the user is in preview mode and it's also using production environment
208
+ if (!window.Zonos.modeAlerted && zonosMode && usingZonosPreview) {
209
+ window.Zonos.modeAlerted = true;
210
+ }
211
+ if (response.ok) {
212
+ const data = await getResponseBody({ response });
213
+ return {
214
+ baseUrl,
215
+ errors: [],
216
+ json: data,
217
+ response,
218
+ zonosMode,
219
+ };
220
+ }
221
+ const status = response.status.toString();
222
+ try {
223
+ const data = await getResponseBody({
224
+ response,
225
+ shouldThrow: true,
226
+ });
227
+ const message = JSON.stringify(data);
228
+ return {
229
+ baseUrl,
230
+ errors: [{ message, type: status }],
231
+ json: null,
232
+ response,
233
+ zonosMode,
234
+ };
235
+ }
236
+ catch (e) {
237
+ const message = 'Unknown error';
238
+ return {
239
+ baseUrl,
240
+ errors: [{ message: `${status}: ${message}`, type: status }],
241
+ json: null,
242
+ response: null,
243
+ zonosMode,
244
+ };
245
+ }
246
+ };
247
+ const handleRequestWithFallback = async ({ basePathType: _basePathType, options, path, }) => {
248
+ var _a, _b;
249
+ // use vercel API if the path is `/api/bigcommerce`
250
+ const isBigcommerceEndpoint = path.startsWith('/api/bigcommerce');
251
+ const basePathType = isBigcommerceEndpoint
252
+ ? 'vercel'
253
+ : _basePathType;
254
+ const _c = await handleRequest({
255
+ basePathType,
256
+ options,
257
+ path,
258
+ }), { errors, response } = _c, rest = __rest(_c, ["errors", "response"]);
259
+ const nextFallbackApiType = getNextFallbackApiType(basePathType);
260
+ const unknownError = errors.find(({ type }) => type === 'unknown');
261
+ const isUnknownError = !!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404;
262
+ const shouldCallFallback =
263
+ // If next fallback is available, and the error is unknown (fail to fetch) or 404
264
+ nextFallbackApiType && isUnknownError;
265
+ // Should log the error if it's unknown error
266
+ if (isUnknownError) {
267
+ void sendErrorLog({
268
+ endpoint: fallbackApiList[basePathType] + path,
269
+ errors: errors.map(({ message }) => message),
270
+ metadata: {
271
+ currentBasePath: basePathType,
272
+ nextFallbackApiType,
273
+ requestHeaders: options === null || options === void 0 ? void 0 : options.headers,
274
+ requestPayload: jsonParse((_a = options === null || options === void 0 ? void 0 : options.body) === null || _a === void 0 ? void 0 : _a.toString()) || ((_b = options === null || options === void 0 ? void 0 : options.body) === null || _b === void 0 ? void 0 : _b.toString()),
275
+ status: response === null || response === void 0 ? void 0 : response.status,
276
+ statusText: response === null || response === void 0 ? void 0 : response.statusText,
277
+ },
278
+ // When the error is unknown, error reporting should be enabled for period of time after release, so we can monitor the error.
279
+ shouldPostReleaseErrorReporting: true,
280
+ });
281
+ }
282
+ if (shouldCallFallback) {
283
+ log(`=== "${path}" failed to fetch, trying next fallback ${nextFallbackApiType}`);
284
+ return handleRequestWithFallback({
285
+ basePathType: nextFallbackApiType,
286
+ options,
287
+ path,
288
+ });
289
+ }
290
+ // No more fallbacks, just return the result
291
+ return Object.assign({ errors, response }, rest);
292
+ };
293
+ /**
294
+ * Fetch request and will request to fallback API when the first one fails
295
+ * @param path Path name of the request (e.g. /api/something/com).
296
+ * @param _opts fetch options
297
+ */
298
+ const handleFetch = async (path, _opts) => {
299
+ const opts = __rest(_opts || {}, []);
300
+ const body = opts.body ? JSON.stringify(opts.body) : undefined;
301
+ const method = opts.method || 'GET';
302
+ // headers content type
303
+ const headers = Object.assign({ 'Content-Type': 'application/json', 'Zonos-Is-BigCommerce': window.Zonos.isBigCommerce.toString(), 'Zonos-Referer': window.location.hostname, 'Zonos-Version': window.Zonos.version, credentialtoken: window.Zonos.zonosApiKey || 'Empty credential token from zonos-elements' }, opts.headers);
304
+ const options = Object.assign(Object.assign({}, opts), { body: method === 'GET' ? undefined : body, headers,
305
+ method });
306
+ // This is for testing fallback API, set fallback API type to start with
307
+ const useFallbackApi = new URLSearchParams(window.location.search).get('useFallbackApi');
308
+ return handleRequestWithFallback({
309
+ basePathType: useFallbackApi || MAIN_BASE_API_TYPE,
310
+ options,
311
+ path,
312
+ });
313
+ };
314
+
315
+ export { logError as a, fallbackApiList as f, handleFetch as h, jsonParse as j, log as l, sendErrorLog as s };
package/dist/esm/index.js CHANGED
@@ -1,4 +1,6 @@
1
- import { l as log, a as logError } from './logError-c456c092.js';
1
+ import { l as log, a as logError } from './handleFetch-37cea185.js';
2
+ import { s as setupCartData, c as checkoutHiddenBtnSelector } from './CheckoutConfig-57350b28.js';
3
+ export { c as checkoutHiddenBtnSelector, d as domesticRedirectedBtnSelector } from './CheckoutConfig-57350b28.js';
2
4
 
3
5
  /**
4
6
  * Get the load version and url based on the loadScriptSrc and version
@@ -37,6 +39,7 @@ const checkIfLoadVersionDomain = ({ loadScriptSrc }) => {
37
39
  };
38
40
 
39
41
  const fallbackList = ['jsdelivr', 'cdnjs', 'unpkg', 'vercel'];
42
+ const MAIN_LOAD_CDN_TYPE = 'jsdelivr';
40
43
  /**
41
44
  * Get the next cdn type in the fallback list
42
45
  * @param currentCdnType The current cdn type that want to get the next fallback url
@@ -90,7 +93,7 @@ const getZonosQaUrl = () => {
90
93
  return null;
91
94
  }
92
95
  const qaUrl = extractZonosQaUrl(window.location.href);
93
- const cdnUrl = "https://v1.3.50.js.zonos.com";
96
+ const cdnUrl = "https://v1.3.52.js.zonos.com";
94
97
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
95
98
  if (!qaUrl &&
96
99
  (cdnUrl.includes('test.') ||
@@ -247,6 +250,16 @@ const zonosLoadStripe = async (...args) => {
247
250
  return stripePromise.then(maybeStripe => initStripe(maybeStripe, args, startTime));
248
251
  };
249
252
 
253
+ const TEMP_CART_ID_QUERY_PARAM = 'tempCartUUID';
254
+ /**
255
+ * Simple function to get the cart id from the query param.
256
+ */
257
+ const getCartIdFromQueryParam = () => {
258
+ const urlParams = new URLSearchParams(window.location.search);
259
+ const cartId = urlParams.get(TEMP_CART_ID_QUERY_PARAM);
260
+ return cartId;
261
+ };
262
+
250
263
  var _a;
251
264
  /**
252
265
  * Get the load version and url based on the loadScriptSrc, if the domain that used to load `zonos.js` is in white listed domains, use currentLoadScriptUrl as the load url instead, if zonosQaUrl exists, it would also fall under the white listed domain
@@ -264,11 +277,10 @@ const zonosLoadUrl = (() => {
264
277
  }
265
278
  return null;
266
279
  })();
267
- const ZONOS_URL = "https://v1.3.50.js.zonos.com";
268
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.50";
269
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.50";
270
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.50";
271
- const MAIN_LOAD_CDN_TYPE = 'jsdelivr';
280
+ const ZONOS_URL = "https://v1.3.52.js.zonos.com";
281
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.52";
282
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.52";
283
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.52";
272
284
  const INTER_FONT_URL = 'https://rsms.me';
273
285
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
274
286
  const INTER_FONT_REGEX = /^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;
@@ -283,30 +295,58 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
283
295
  !!window.location.search.match(/\?.*(&*)zonosConversionTest/);
284
296
  Zonos._paypalMockResponse = null;
285
297
  Zonos.isBigCommerce = false;
286
- Zonos.releaseDate = "1726504733366";
298
+ Zonos.releaseDate = "1726602626855";
299
+ Zonos.isLegacyCheckout = false;
287
300
  /**
288
301
  * By default, the package will load from npm
289
302
  */
290
303
  Zonos.isNpm = true;
291
304
  Zonos.zonosQaUrl = null;
292
- Zonos.version = `v${"1.3.50"}`;
305
+ Zonos.version = `v${"1.3.52"}`;
293
306
  Zonos.modeAlerted = false;
294
- Zonos.tempCartData = null;
307
+ Zonos.cartData = null;
295
308
  Zonos.paypal = null;
296
309
  Zonos.getCurrentTimestamp = () => new Date().getTime();
297
310
  Zonos.zonosController = null;
298
311
  Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSettings, onCountryChange, overrideCurrencyFormat, storeId, zonosApiKey, }) => {
312
+ _a.cartId = getCartIdFromQueryParam();
299
313
  if (_a.doneInit) {
300
314
  // do nothing if zonos is already initializeds
301
315
  return;
302
316
  }
303
317
  log(`====== ZONOS DEBUG MODE: on (${_a.version}) ======`);
304
- if (!zonosApiKey) {
305
- logError('Missing Zonos API key');
306
- return;
307
- }
308
318
  _a.zonosApiKey = zonosApiKey;
309
319
  _a.storeId = storeId;
320
+ if (_a.isNpm) {
321
+ log('====== ZONOS LOADING FROM NPM ======');
322
+ // zonosApiKey is required if tempCartUUID in query params are not provided
323
+ if (!zonosApiKey && !_a.cartId) {
324
+ logError('Zonos API key is required unless `tempCartUUID` is provided in url query params.');
325
+ return;
326
+ }
327
+ /**
328
+ * This is mainly for user that integrates Zonos with npm
329
+ * If cartUUID is provided in query param and cartData is not available, get and initialize cart data to prepare to open checkout right away
330
+ */
331
+ if (!_a.cartData && _a.cartId) {
332
+ log('Initialize cart data');
333
+ const params = await setupCartData(_a.cartId);
334
+ if (!params) {
335
+ logError('Failed to get cart data');
336
+ return;
337
+ }
338
+ _a.cartData = params.cartData;
339
+ _a.zonosApiKey = params.zonosApiKey;
340
+ }
341
+ }
342
+ // inject hidden button to body to trigger checkout right away if we have cartData
343
+ if (_a.cartId && _a.cartData) {
344
+ log('Cart data is available, inject hidden button and trigger checkout');
345
+ const hiddenButton = document.createElement('button');
346
+ hiddenButton.style.display = 'none';
347
+ hiddenButton.id = `${checkoutHiddenBtnSelector}`;
348
+ document.body.appendChild(hiddenButton);
349
+ }
310
350
  log('init zonos');
311
351
  // inject zonos cdn
312
352
  _a.injectZonosCdn();
@@ -324,7 +364,6 @@ Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSett
324
364
  onCountryChange,
325
365
  overrideCurrencyFormat,
326
366
  },
327
- zonosApiKey,
328
367
  });
329
368
  _a.doneInit = true;
330
369
  };
@@ -396,7 +435,7 @@ Zonos.disablePlaceOrderButtons = ({ autoEnable = true, config, disable, placeOrd
396
435
  }
397
436
  }
398
437
  };
399
- Zonos.injectController = ({ config, zonosApiKey, }) => {
438
+ Zonos.injectController = ({ config, }) => {
400
439
  var _b;
401
440
  if (document.querySelector('zonos-controller')) {
402
441
  return;
@@ -424,7 +463,7 @@ Zonos.injectController = ({ config, zonosApiKey, }) => {
424
463
  }
425
464
  const zonosController = document.createElement('zonos-controller');
426
465
  zonosController.config = config;
427
- zonosController.zonosApiKey = zonosApiKey;
466
+ zonosController.zonosApiKey = _a.zonosApiKey || '';
428
467
  zonosController.addEventListener('stripeInitEvent', async (event) => {
429
468
  const { detail } = event;
430
469
  log('loading Stripe');
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-0f993ce5.js';
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
7
7
  await globalScripts();
8
- return bootstrapLazy([["zonos-checkout",[[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],"domesticRedirectedBtnSelector":[32],"legacyCheckoutHiddenBtnSelector":[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",[[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",[[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",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["zonos-link",[[1,"zonos-link",{"href":[1],"rel":[1],"target":[1],"linkTitle":[1,"link-title"]}]]],["zonos-logo",[[1,"zonos-logo",{"theme":[1],"width":[1]}]]],["zonos-text",[[1,"zonos-text",{"textColor":[1,"text-color"],"size":[1],"type":[1],"weight":[2],"ready":[32]}]]],["zonos-hello-dialog",[[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",[[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-badge_2",[[1,"zonos-badge",{"bold":[4],"badgeColor":[1,"badge-color"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"rounded":[4]}],[1,"zonos-tooltip",{"label":[1],"subtitle":[1],"showTooltip":[32]}]]],["zonos-input",[[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-card",[[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-notification_3",[[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-banner",[[1,"zonos-banner",{"bannerTitle":[1,"banner-title"],"intent":[1],"hasContent":[32]}]]],["zonos-country-flag",[[1,"zonos-country-flag",{"countryCode":[1,"country-code"],"size":[2]}]]],["zonos-v-stack",[[1,"zonos-v-stack",{"spacing":[2]}]]],["zonos-button_3",[[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-language-select_2",[[1,"zonos-language-select",{"handleOnClose":[16]}],[1,"zonos-select-dialog-header",{"handleOnClose":[16],"label":[1]}]]],["zonos-country-select_4",[[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-address_8",[[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-cart-items_12",[[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-cart-subtotal"],[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-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-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);
8
+ return bootstrapLazy([["zonos-checkout",[[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",[[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",[[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",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["zonos-link",[[1,"zonos-link",{"href":[1],"rel":[1],"target":[1],"linkTitle":[1,"link-title"]}]]],["zonos-logo",[[1,"zonos-logo",{"theme":[1],"width":[1]}]]],["zonos-text",[[1,"zonos-text",{"textColor":[1,"text-color"],"size":[1],"type":[1],"weight":[2],"ready":[32]}]]],["zonos-tooltip",[[1,"zonos-tooltip",{"label":[1],"subtitle":[1],"showTooltip":[32]}]]],["zonos-card",[[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",[[1,"zonos-banner",{"bannerTitle":[1,"banner-title"],"intent":[1],"hasContent":[32]}]]],["zonos-v-stack",[[1,"zonos-v-stack",{"spacing":[2]}]]],["zonos-language-select_2",[[1,"zonos-language-select",{"handleOnClose":[16]}],[1,"zonos-select-dialog-header",{"handleOnClose":[16],"label":[1]}]]],["zonos-country-select_4",[[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",[[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",[[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",[[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",[[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",[[1,"zonos-country-flag",{"countryCode":[1,"country-code"],"size":[2]}]]],["zonos-button_3",[[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",[[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",[[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);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };
@@ -1,7 +1,7 @@
1
1
  import { z as zonosStore, c as createStore } from './zonosStore-473f4654.js';
2
- import { x as handleFetch, e as cartStore, r as stripeStoreHandleInventoryCheck, t as translate, q as cartStoreNextStep, j as cartStoreClearCheckoutInterval, y as jsonParse } from './cart-4f300fcb.js';
2
+ import { d as cartStore, q as stripeStoreHandleInventoryCheck, t as translate, p as cartStoreNextStep, h as cartStoreClearCheckoutInterval } from './cart-45d2861f.js';
3
+ import { h as handleFetch, l as log, a as logError, j as jsonParse } from './handleFetch-37cea185.js';
3
4
  import { t as tinycolor } from './isDarkColor-c927f77d.js';
4
- import { l as log, a as logError } from './logError-c456c092.js';
5
5
 
6
6
  /*!
7
7
  * paypal-js v8.1.0 (2024-06-07T16:55:00.122Z)
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, d as getElement } from './index-86b8247e.js';
2
- import { k as stripeStore, l as localizationStore, t as translate } from './cart-4f300fcb.js';
2
+ import { j as stripeStore, l as localizationStore, t as translate } from './cart-45d2861f.js';
3
3
  import { i as isCheckoutMobile } from './isCheckoutMobile-8846dccb.js';
4
- import { a as logError } from './logError-c456c092.js';
4
+ import { a as logError } from './handleFetch-37cea185.js';
5
5
  import { i as isTextContainsNonLatinChars, c as containsNonLatinChars } from './containsNonLatinChars-2d8810c3.js';
6
6
  import { z as zonosStore, d as zonosStoreFontFamily } from './zonosStore-473f4654.js';
7
7
  import { c as classes } from './classes-0d95c529.js';