@zonos/elements 1.2.4-alpha.5 → 1.2.4-alpha.7

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 (189) hide show
  1. package/dist/cjs/{cart-3ff38a09.js → cart-90f7c8c0.js} +36 -8
  2. package/dist/cjs/{getBorderRadius-a97a5f75.js → getBorderRadius-bf4a4276.js} +1 -1
  3. package/dist/cjs/{index-20cb112f.js → index-0dcccc22.js} +27 -16
  4. package/dist/cjs/index.cjs.js +6 -6
  5. package/dist/cjs/{isDarkColor-261fcf3d.js → isDarkColor-ff6ff183.js} +1 -1
  6. package/dist/cjs/loader.cjs.js +2 -2
  7. package/dist/cjs/{localization-dcd11e9d.js → localization-9caf3397.js} +27 -7
  8. package/dist/cjs/{submitGtag-08527ddb.js → submitGtag-b141b45d.js} +2 -2
  9. package/dist/cjs/zonos-address_2.cjs.entry.js +6 -6
  10. package/dist/cjs/zonos-badge.cjs.entry.js +2 -2
  11. package/dist/cjs/zonos-banner.cjs.entry.js +2 -2
  12. package/dist/cjs/zonos-button_2.cjs.entry.js +4 -4
  13. package/dist/cjs/zonos-card_2.cjs.entry.js +2 -2
  14. package/dist/cjs/zonos-cart-items_10.cjs.entry.js +50 -8
  15. package/dist/cjs/zonos-checkout.cjs.entry.js +9 -7
  16. package/dist/cjs/zonos-component.cjs.entry.js +1 -1
  17. package/dist/cjs/zonos-controller.cjs.entry.js +8 -8
  18. package/dist/cjs/zonos-country-flag_4.cjs.entry.js +4 -4
  19. package/dist/cjs/zonos-elements.cjs.js +3 -3
  20. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +3 -3
  21. package/dist/cjs/zonos-hello.cjs.entry.js +4 -4
  22. package/dist/cjs/zonos-icon.cjs.entry.js +2 -2
  23. package/dist/cjs/zonos-notification.cjs.entry.js +2 -2
  24. package/dist/cjs/zonos-payment.cjs.entry.js +6 -6
  25. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +3 -3
  26. package/dist/cjs/zonos-text.cjs.entry.js +2 -2
  27. package/dist/cjs/{zonosStore-a0fa5b77.js → zonosStore-b43ef5db.js} +1 -1
  28. package/dist/collection/collection-manifest.json +1 -1
  29. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +48 -2
  30. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +5 -2
  31. package/dist/collection/components/common/zonos-notification/zonos-notification.js +3 -2
  32. package/dist/collection/components/hello/zonos-hello/zonos-hello.js +9 -6
  33. package/dist/collection/components/main/zonos-controller.js +16 -14
  34. package/dist/collection/components/store/checkout/cart.js +1 -1
  35. package/dist/collection/components/store/checkout/stripe.js +3 -2
  36. package/dist/collection/components/utils/api/calculateLandedCost.js +9 -1
  37. package/dist/collection/components/utils/api/checkItemRestrictions.js +1 -1
  38. package/dist/collection/components/utils/api/getCountries.js +1 -1
  39. package/dist/collection/components/utils/api/getCountryLandedCost.js +1 -1
  40. package/dist/collection/components/utils/api/getExchangeRate.js +1 -1
  41. package/dist/collection/components/utils/api/getLocaleMessages.js +1 -1
  42. package/dist/collection/components/utils/api/getLocalization.js +1 -1
  43. package/dist/collection/components/utils/api/getShippingZones.js +1 -1
  44. package/dist/collection/components/utils/api/getZonosSetting.js +1 -1
  45. package/dist/collection/components/utils/api/triggerBuildLandedCost.js +22 -0
  46. package/dist/collection/components/utils/logging/log.js +20 -0
  47. package/dist/collection/types/generated/graphql.customer.types.js +72 -0
  48. package/dist/collection/types/generated/graphql.frontend.types.js +83 -6
  49. package/dist/components/cart.js +33 -5
  50. package/dist/components/localization.js +26 -6
  51. package/dist/components/zonos-checkout-finish2.js +47 -4
  52. package/dist/components/zonos-checkout.js +2 -0
  53. package/dist/components/zonos-controller.js +2 -2
  54. package/dist/components/zonos-hello.js +1 -1
  55. package/dist/esm/{cart-54eab7ab.js → cart-b439be00.js} +36 -8
  56. package/dist/esm/{getBorderRadius-35e8acce.js → getBorderRadius-178a0a05.js} +1 -1
  57. package/dist/esm/{index-3617e24c.js → index-36ff6342.js} +27 -16
  58. package/dist/esm/index.js +6 -6
  59. package/dist/esm/{isDarkColor-44e9e451.js → isDarkColor-416d6047.js} +1 -1
  60. package/dist/esm/loader.js +3 -3
  61. package/dist/esm/{localization-9c80f0f5.js → localization-a51ccbc2.js} +27 -7
  62. package/dist/esm/{submitGtag-7affec95.js → submitGtag-521826a2.js} +2 -2
  63. package/dist/esm/zonos-address_2.entry.js +6 -6
  64. package/dist/esm/zonos-badge.entry.js +2 -2
  65. package/dist/esm/zonos-banner.entry.js +2 -2
  66. package/dist/esm/zonos-button_2.entry.js +4 -4
  67. package/dist/esm/zonos-card_2.entry.js +2 -2
  68. package/dist/esm/zonos-cart-items_10.entry.js +50 -8
  69. package/dist/esm/zonos-checkout.entry.js +9 -7
  70. package/dist/esm/zonos-component.entry.js +1 -1
  71. package/dist/esm/zonos-controller.entry.js +8 -8
  72. package/dist/esm/zonos-country-flag_4.entry.js +4 -4
  73. package/dist/esm/zonos-elements.js +4 -4
  74. package/dist/esm/zonos-hello-dialog.entry.js +3 -3
  75. package/dist/esm/zonos-hello.entry.js +4 -4
  76. package/dist/esm/zonos-icon.entry.js +2 -2
  77. package/dist/esm/zonos-notification.entry.js +2 -2
  78. package/dist/esm/zonos-payment.entry.js +6 -6
  79. package/dist/esm/zonos-shipping-rich-radio.entry.js +3 -3
  80. package/dist/esm/zonos-text.entry.js +2 -2
  81. package/dist/esm/{zonosStore-e0b7a5cf.js → zonosStore-61e74f58.js} +1 -1
  82. package/dist/esm-es5/cart-b439be00.js +1 -0
  83. package/dist/esm-es5/{getBorderRadius-35e8acce.js → getBorderRadius-178a0a05.js} +1 -1
  84. package/dist/esm-es5/index-36ff6342.js +2 -0
  85. package/dist/esm-es5/index.js +1 -1
  86. package/dist/esm-es5/{isDarkColor-44e9e451.js → isDarkColor-416d6047.js} +1 -1
  87. package/dist/esm-es5/loader.js +1 -1
  88. package/dist/esm-es5/{localization-9c80f0f5.js → localization-a51ccbc2.js} +1 -1
  89. package/dist/esm-es5/{submitGtag-7affec95.js → submitGtag-521826a2.js} +1 -1
  90. package/dist/esm-es5/zonos-address_2.entry.js +1 -1
  91. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  92. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  93. package/dist/esm-es5/zonos-button_2.entry.js +1 -1
  94. package/dist/esm-es5/zonos-card_2.entry.js +1 -1
  95. package/dist/esm-es5/zonos-cart-items_10.entry.js +1 -1
  96. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  97. package/dist/esm-es5/zonos-component.entry.js +1 -1
  98. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  99. package/dist/esm-es5/zonos-country-flag_4.entry.js +1 -1
  100. package/dist/esm-es5/zonos-elements.js +1 -1
  101. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  102. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  103. package/dist/esm-es5/zonos-icon.entry.js +1 -1
  104. package/dist/esm-es5/zonos-notification.entry.js +1 -1
  105. package/dist/esm-es5/zonos-payment.entry.js +1 -1
  106. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  107. package/dist/esm-es5/zonos-text.entry.js +1 -1
  108. package/dist/esm-es5/{zonosStore-e0b7a5cf.js → zonosStore-61e74f58.js} +1 -1
  109. package/dist/scripts/loadZonos.js +23 -3
  110. package/dist/scripts/zonos.js +23 -3
  111. package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +5 -1
  112. package/dist/types/components/store/checkout/stripe.d.ts +1 -0
  113. package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
  114. package/dist/types/components/utils/api/triggerBuildLandedCost.d.ts +5 -0
  115. package/dist/types/components/utils/changeDeepProperty.d.ts +1 -1
  116. package/dist/types/components/utils/changeDeepPropertyAtIndex.d.ts +1 -1
  117. package/dist/types/types/checkout/CheckoutConfig.d.ts +3 -1
  118. package/dist/types/types/generated/graphql.customer.types.d.ts +230 -7
  119. package/dist/types/types/generated/graphql.customer.types.ts +281 -7
  120. package/dist/types/types/generated/graphql.frontend.types.d.ts +222 -11
  121. package/dist/types/types/generated/graphql.frontend.types.ts +377 -11
  122. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  123. package/dist/zonos-elements/index.esm.js +1 -1
  124. package/dist/zonos-elements/{p-426a5999.system.entry.js → p-06fb9d1f.system.entry.js} +1 -1
  125. package/dist/zonos-elements/{p-77a7929b.js → p-089ba905.js} +1 -1
  126. package/dist/zonos-elements/{p-17bc1266.js → p-1685c8df.js} +1 -1
  127. package/dist/zonos-elements/p-18904b7c.system.js +2 -0
  128. package/dist/zonos-elements/{p-b8d11094.entry.js → p-1d4a970b.entry.js} +1 -1
  129. package/dist/zonos-elements/{p-80ba24a8.system.js → p-24eed2a8.system.js} +1 -1
  130. package/dist/zonos-elements/{p-bec21999.system.js → p-24fbe845.system.js} +1 -1
  131. package/dist/zonos-elements/{p-55f1da18.entry.js → p-2801d868.entry.js} +1 -1
  132. package/dist/zonos-elements/{p-1dbaf24b.system.entry.js → p-2f43da39.system.entry.js} +1 -1
  133. package/dist/zonos-elements/p-33137e7d.system.entry.js +1 -0
  134. package/dist/zonos-elements/{p-e3c617a4.js → p-3c6988d7.js} +1 -1
  135. package/dist/zonos-elements/p-3cea383b.system.entry.js +1 -0
  136. package/dist/zonos-elements/{p-86580e70.system.entry.js → p-47390db7.system.entry.js} +1 -1
  137. package/dist/zonos-elements/p-4846796a.js +1 -0
  138. package/dist/zonos-elements/p-494c77a7.entry.js +1 -0
  139. package/dist/zonos-elements/{p-00c99619.entry.js → p-49f09b91.entry.js} +1 -1
  140. package/dist/zonos-elements/{p-7c3ea8c6.system.entry.js → p-4a15c5c7.system.entry.js} +1 -1
  141. package/dist/zonos-elements/{p-c8fcaddc.system.entry.js → p-4bee0bff.system.entry.js} +1 -1
  142. package/dist/zonos-elements/{p-3eb33ba6.entry.js → p-4d93275c.entry.js} +1 -1
  143. package/dist/zonos-elements/{p-472c97b6.entry.js → p-4ed71bd7.entry.js} +1 -1
  144. package/dist/zonos-elements/{p-8bbad467.js → p-55f49f1e.js} +1 -1
  145. package/dist/zonos-elements/{p-114d8a14.system.entry.js → p-560aa686.system.entry.js} +1 -1
  146. package/dist/zonos-elements/{p-0362c416.entry.js → p-639396bb.entry.js} +1 -1
  147. package/dist/zonos-elements/{p-3c64448f.system.entry.js → p-67154df2.system.entry.js} +1 -1
  148. package/dist/zonos-elements/{p-9dbbacd9.entry.js → p-684ed483.entry.js} +1 -1
  149. package/dist/zonos-elements/{p-c743e43f.entry.js → p-89c210d6.entry.js} +1 -1
  150. package/dist/zonos-elements/{p-9232db22.system.js → p-8c48b75e.system.js} +1 -1
  151. package/dist/zonos-elements/{p-40e68452.system.entry.js → p-8c5595d9.system.entry.js} +1 -1
  152. package/dist/zonos-elements/{p-263c1639.entry.js → p-938803f4.entry.js} +1 -1
  153. package/dist/zonos-elements/p-956efa27.js +2 -0
  154. package/dist/zonos-elements/{p-8858537d.entry.js → p-a0e36ed3.entry.js} +1 -1
  155. package/dist/zonos-elements/{p-b5bc4851.entry.js → p-a376a37f.entry.js} +1 -1
  156. package/dist/zonos-elements/{p-1d4b6d59.system.js → p-a504f64f.system.js} +1 -1
  157. package/dist/zonos-elements/p-afe26069.entry.js +1 -0
  158. package/dist/zonos-elements/{p-81da740f.system.entry.js → p-b4601210.system.entry.js} +1 -1
  159. package/dist/zonos-elements/{p-46d935ea.system.js → p-b51de536.system.js} +1 -1
  160. package/dist/zonos-elements/{p-84447396.entry.js → p-b6148206.entry.js} +1 -1
  161. package/dist/zonos-elements/{p-643eeb24.system.js → p-b85be1ab.system.js} +1 -1
  162. package/dist/zonos-elements/{p-06ec9556.system.entry.js → p-c9348bb0.system.entry.js} +1 -1
  163. package/dist/zonos-elements/p-d2217f09.system.js +1 -0
  164. package/dist/zonos-elements/{p-7bd0ab43.system.entry.js → p-d856a200.system.entry.js} +1 -1
  165. package/dist/zonos-elements/{p-754bdfdb.system.js → p-da060b1c.system.js} +1 -1
  166. package/dist/zonos-elements/{p-6f6d24da.entry.js → p-e1f6ab97.entry.js} +1 -1
  167. package/dist/zonos-elements/{p-3a7546f0.system.entry.js → p-e5ae22a9.system.entry.js} +1 -1
  168. package/dist/zonos-elements/{p-4c0f4461.system.entry.js → p-e98be2d0.system.entry.js} +1 -1
  169. package/dist/zonos-elements/p-e9b832c5.entry.js +1 -0
  170. package/dist/zonos-elements/p-eb392924.entry.js +1 -0
  171. package/dist/zonos-elements/{p-de3db699.system.entry.js → p-f141519c.system.entry.js} +1 -1
  172. package/dist/zonos-elements/{p-39ae023c.system.entry.js → p-f367f2fe.system.entry.js} +1 -1
  173. package/dist/zonos-elements/p-ff95f098.js +1 -0
  174. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  175. package/dist/zonos-elements/zonos-elements.js +1 -1
  176. package/package.json +7 -6
  177. package/dist/esm-es5/cart-54eab7ab.js +0 -1
  178. package/dist/esm-es5/index-3617e24c.js +0 -2
  179. package/dist/zonos-elements/p-07c900e2.entry.js +0 -1
  180. package/dist/zonos-elements/p-197e4528.entry.js +0 -1
  181. package/dist/zonos-elements/p-3379ee13.js +0 -1
  182. package/dist/zonos-elements/p-35035961.entry.js +0 -1
  183. package/dist/zonos-elements/p-3ab985c6.entry.js +0 -1
  184. package/dist/zonos-elements/p-7aab4cf0.system.js +0 -1
  185. package/dist/zonos-elements/p-887e2f9a.system.entry.js +0 -1
  186. package/dist/zonos-elements/p-bec05c21.system.js +0 -2
  187. package/dist/zonos-elements/p-c1f4349c.system.entry.js +0 -1
  188. package/dist/zonos-elements/p-cf8aaa17.js +0 -2
  189. package/dist/zonos-elements/p-e1de2a1f.js +0 -1
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const zonosStore = require('./zonosStore-a0fa5b77.js');
4
- const localization = require('./localization-dcd11e9d.js');
5
- const isDarkColor = require('./isDarkColor-261fcf3d.js');
6
- const getBorderRadius = require('./getBorderRadius-a97a5f75.js');
3
+ const zonosStore = require('./zonosStore-b43ef5db.js');
4
+ const localization = require('./localization-9caf3397.js');
5
+ const isDarkColor = require('./isDarkColor-ff6ff183.js');
6
+ const getBorderRadius = require('./getBorderRadius-bf4a4276.js');
7
7
 
8
8
  const prepCalculateLandedCost = () => {
9
9
  // maybe we don't need email now for prefetch the landed cost
@@ -34,9 +34,36 @@ const prepCalculateLandedCost = () => {
34
34
  };
35
35
  };
36
36
 
37
+ const triggerBuildLandedCost = async (buildLandedCost) => {
38
+ var _a;
39
+ const data = prepCalculateLandedCost();
40
+ const landedCost = await buildLandedCost(data.checkoutSessionId, data.contact, data.shippingAddress);
41
+ if (!landedCost) {
42
+ throw new Error('Failed to build landed cost');
43
+ }
44
+ // Validate the landed cost object to make sure the returned value from buildLandedCost has a valid schema
45
+ const { errors, json } = await localization.handleFetch(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/validate-landed-cost`, {
46
+ body: landedCost,
47
+ headers: {
48
+ 'Content-Type': 'application/json',
49
+ },
50
+ method: 'POST',
51
+ });
52
+ if (!json || errors.length) {
53
+ throw new Error(`Invalid landed cost object: ${((_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message) || 'Unknown error'}`);
54
+ }
55
+ return landedCost;
56
+ };
57
+
37
58
  const calculateLandedCost = async (abortController) => {
59
+ // If buildLandedCost callback is supplied, use that instead of our regular request to '/calculate-landed-cost'
60
+ const buildLandedCost = zonosStore.zonosStore.checkoutSettings.buildLandedCost;
61
+ if (buildLandedCost) {
62
+ const json = await triggerBuildLandedCost(buildLandedCost);
63
+ return json;
64
+ }
38
65
  // request to get landed cost info
39
- const url = `${"https://v1.route.js.zonos.com"}/api/calculate-landed-cost`;
66
+ const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/calculate-landed-cost`;
40
67
  const { errors, json } = await localization.handleFetch(url, {
41
68
  body: prepCalculateLandedCost(),
42
69
  method: 'POST',
@@ -91,6 +118,7 @@ const { onChange: onChange$1, reset: reset$1, state: stripeStore, } = zonosStore
91
118
  stripeAddressElement: null,
92
119
  stripeAddressEventData: null,
93
120
  stripeAddressUsedWhenFetchingLC: null,
121
+ stripeBillingAddressElement: null,
94
122
  stripeElements: null,
95
123
  stripeElementsOptions: null,
96
124
  stripeLinkElement: null,
@@ -336,7 +364,7 @@ const stripeStoreInitCheckoutSession = async () => {
336
364
  return false;
337
365
  }
338
366
  stripeStore.isFetchingSession = true;
339
- const { errors, json } = await localization.handleFetch(`${"https://v1.route.js.zonos.com"}/api/create-checkout-session`, {
367
+ const { errors, json } = await localization.handleFetch(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/create-checkout-session`, {
340
368
  body: {
341
369
  currency: ((_a = cartStore.items.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode) || '',
342
370
  itemsAmount: total,
@@ -364,7 +392,7 @@ const stripeStoreInitCheckoutSession = async () => {
364
392
  const stripeStoreUpdateCheckoutSession = async ({ currency, id, itemsAmount, landedCostId, presentmentCountryCode, }) => {
365
393
  // No need to set loading state here because this function will be called under the hood to update
366
394
  // landed cost id for the section.
367
- const { errors, json } = await localization.handleFetch(`${"https://v1.route.js.zonos.com"}/api/update-checkout-session`, {
395
+ const { errors, json } = await localization.handleFetch(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/update-checkout-session`, {
368
396
  body: {
369
397
  currency,
370
398
  id,
@@ -476,7 +504,7 @@ const cartStoreReCalculateTotal = async ({ currency, itemsAmount, landedCostId,
476
504
  }
477
505
  // update checkout session
478
506
  if (!cartStore.checkoutSessionId) {
479
- localization.logError('Could update cart total without checkout session id');
507
+ localization.logError('Could not update cart total without checkout session id');
480
508
  return false;
481
509
  }
482
510
  const { json } = await stripeStoreUpdateCheckoutSession({
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const zonosStore = require('./zonosStore-a0fa5b77.js');
3
+ const zonosStore = require('./zonosStore-b43ef5db.js');
4
4
 
5
5
  /**
6
6
  * Get the border radius for the elements based on the style
@@ -655,6 +655,9 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
655
655
  }
656
656
  }
657
657
  }
658
+ // This needs to always happen so we can hide nodes that are projected
659
+ // to another component but don't end up in a slot
660
+ elm['s-hn'] = hostTagName;
658
661
  return elm;
659
662
  };
660
663
  /**
@@ -779,8 +782,9 @@ const removeVnodes = (vnodes, startIdx, endIdx) => {
779
782
  * @param oldCh the old children of the parent node
780
783
  * @param newVNode the new VNode which will replace the parent
781
784
  * @param newCh the new children of the parent node
785
+ * @param isInitialRender whether or not this is the first render of the vdom
782
786
  */
783
- const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
787
+ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = false) => {
784
788
  let oldStartIdx = 0;
785
789
  let newStartIdx = 0;
786
790
  let idxInOld = 0;
@@ -807,25 +811,25 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
807
811
  else if (newEndVnode == null) {
808
812
  newEndVnode = newCh[--newEndIdx];
809
813
  }
810
- else if (isSameVnode(oldStartVnode, newStartVnode)) {
814
+ else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
811
815
  // if the start nodes are the same then we should patch the new VNode
812
816
  // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
813
817
  // indices to reflect that. We don't need to move any DOM Nodes around
814
818
  // since things are matched up in order.
815
- patch(oldStartVnode, newStartVnode);
819
+ patch(oldStartVnode, newStartVnode, isInitialRender);
816
820
  oldStartVnode = oldCh[++oldStartIdx];
817
821
  newStartVnode = newCh[++newStartIdx];
818
822
  }
819
- else if (isSameVnode(oldEndVnode, newEndVnode)) {
823
+ else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
820
824
  // likewise, if the end nodes are the same we patch new onto old and
821
825
  // decrement our end indices, and also likewise in this case we don't
822
826
  // need to move any DOM Nodes.
823
- patch(oldEndVnode, newEndVnode);
827
+ patch(oldEndVnode, newEndVnode, isInitialRender);
824
828
  oldEndVnode = oldCh[--oldEndIdx];
825
829
  newEndVnode = newCh[--newEndIdx];
826
830
  }
827
- else if (isSameVnode(oldStartVnode, newEndVnode)) {
828
- patch(oldStartVnode, newEndVnode);
831
+ else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
832
+ patch(oldStartVnode, newEndVnode, isInitialRender);
829
833
  // We need to move the element for `oldStartVnode` into a position which
830
834
  // will be appropriate for `newEndVnode`. For this we can use
831
835
  // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
@@ -847,8 +851,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
847
851
  oldStartVnode = oldCh[++oldStartIdx];
848
852
  newEndVnode = newCh[--newEndIdx];
849
853
  }
850
- else if (isSameVnode(oldEndVnode, newStartVnode)) {
851
- patch(oldEndVnode, newStartVnode);
854
+ else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
855
+ patch(oldEndVnode, newStartVnode, isInitialRender);
852
856
  // We've already checked above if `oldStartVnode` and `newStartVnode` are
853
857
  // the same node, so since we're here we know that they are not. Thus we
854
858
  // can move the element for `oldEndVnode` _before_ the element for
@@ -885,7 +889,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
885
889
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
886
890
  }
887
891
  else {
888
- patch(elmToMove, newStartVnode);
892
+ patch(elmToMove, newStartVnode, isInitialRender);
889
893
  // invalidate the matching old node so that we won't try to update it
890
894
  // again later on
891
895
  oldCh[idxInOld] = undefined;
@@ -936,16 +940,22 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
936
940
  *
937
941
  * @param leftVNode the first VNode to check
938
942
  * @param rightVNode the second VNode to check
943
+ * @param isInitialRender whether or not this is the first render of the vdom
939
944
  * @returns whether they're equal or not
940
945
  */
941
- const isSameVnode = (leftVNode, rightVNode) => {
946
+ const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
942
947
  // compare if two vnode to see if they're "technically" the same
943
948
  // need to have the same element tag, and same key to be the same
944
949
  if (leftVNode.$tag$ === rightVNode.$tag$) {
945
- // this will be set if components in the build have `key` attrs set on them
946
- {
950
+ // this will be set if JSX tags in the build have `key` attrs set on them
951
+ // we only want to check this if we're not on the first render since on
952
+ // first render `leftVNode.$key$` will always be `null`, so we can be led
953
+ // astray and, for instance, accidentally delete a DOM node that we want to
954
+ // keep around.
955
+ if (!isInitialRender) {
947
956
  return leftVNode.$key$ === rightVNode.$key$;
948
957
  }
958
+ return true;
949
959
  }
950
960
  return false;
951
961
  };
@@ -956,8 +966,9 @@ const isSameVnode = (leftVNode, rightVNode) => {
956
966
  *
957
967
  * @param oldVNode an old VNode whose DOM element and children we want to update
958
968
  * @param newVNode a new VNode representing an updated version of the old one
969
+ * @param isInitialRender whether or not this is the first render of the vdom
959
970
  */
960
- const patch = (oldVNode, newVNode) => {
971
+ const patch = (oldVNode, newVNode, isInitialRender = false) => {
961
972
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
962
973
  const oldChildren = oldVNode.$children$;
963
974
  const newChildren = newVNode.$children$;
@@ -982,7 +993,7 @@ const patch = (oldVNode, newVNode) => {
982
993
  if (oldChildren !== null && newChildren !== null) {
983
994
  // looks like there's child vnodes for both the old and new vnodes
984
995
  // so we need to call `updateChildren` to reconcile them
985
- updateChildren(elm, oldChildren, newVNode, newChildren);
996
+ updateChildren(elm, oldChildren, newVNode, newChildren, isInitialRender);
986
997
  }
987
998
  else if (newChildren !== null) {
988
999
  // no old child vnodes, but there are new child vnodes to add
@@ -1072,7 +1083,7 @@ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1072
1083
  scopeId = hostElm['s-sc'];
1073
1084
  }
1074
1085
  // synchronous patch
1075
- patch(oldVNode, rootVnode);
1086
+ patch(oldVNode, rootVnode, isInitialLoad);
1076
1087
  };
1077
1088
  const attachToAncestor = (hostRef, ancestorComponent) => {
1078
1089
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const cart = require('./cart-3ff38a09.js');
6
- require('./zonosStore-a0fa5b77.js');
7
- require('./index-20cb112f.js');
8
- require('./localization-dcd11e9d.js');
9
- require('./isDarkColor-261fcf3d.js');
10
- require('./getBorderRadius-a97a5f75.js');
5
+ const cart = require('./cart-90f7c8c0.js');
6
+ require('./zonosStore-b43ef5db.js');
7
+ require('./index-0dcccc22.js');
8
+ require('./localization-9caf3397.js');
9
+ require('./isDarkColor-ff6ff183.js');
10
+ require('./getBorderRadius-bf4a4276.js');
11
11
 
12
12
 
13
13
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const zonosStore = require('./zonosStore-a0fa5b77.js');
3
+ const zonosStore = require('./zonosStore-b43ef5db.js');
4
4
 
5
5
  var tinycolor = zonosStore.createCommonjsModule(function (module, exports) {
6
6
  // This file is autogenerated. It's used to publish CJS to npm.
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-20cb112f.js');
5
+ const index = require('./index-0dcccc22.js');
6
6
 
7
7
  const defineCustomElements = (win, options) => {
8
8
  if (typeof window === 'undefined') return undefined;
9
- return index.bootstrapLazy([["zonos-text.cjs",[[1,"zonos-text",{"class":[1],"color":[1],"size":[1],"type":[1],"weight":[2],"content":[1],"ready":[32]}]]],["zonos-checkout.cjs",[[2,"zonos-checkout",{"appearanceSettingsOverride":[16],"preview":[4],"mobile":[4],"defaultAddress":[16],"forceDialogOpen":[4,"force-dialog-open"],"open":[32],"stripe":[32],"submitLoading":[32],"paymentError":[32],"collapseReviewMobile":[32],"isAttachError":[32],"isMobile":[32],"zonosReviewRef":[32],"storybookPaymentStatusOverride":[32],"closeDialogHandler":[64],"init":[64],"setToFinishStep":[64]},[[16,"zonos--init-cart-info","initCartInfoHandler"],[9,"resize","handleWindowResize"]],{"appearanceSettingsOverride":["appearanceSettingsOverrideChanged"],"mobile":["handleMobileChange"]}]]],["zonos-hello.cjs",[[1,"zonos-hello",{"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettingsOverride":[16],"showPeekMessage":[32],"zonosStoreHelloSettings":[32],"showDialog":[32],"peekMessage":[32],"initialUrl":[32],"allRestrictedItems":[32],"allFoundProducts":[32],"productsOnPage":[32],"displayCurrency":[64],"convertAndFormat":[64],"convert":[64],"format":[64]},[[9,"resize","handleResize"]]]]],["zonos-controller.cjs",[[1,"zonos-controller",{"config":[16],"zonosApiKey":[1,"zonos-api-key"],"initCheckoutElement":[64],"setupGoogleFont":[64],"showNotification":[64],"overrideConfig":[64],"overrideCountry":[64],"getAppearanceSetting":[64]}]]],["zonos-component.cjs",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["zonos-country-flag_4.cjs",[[1,"zonos-country-select",{"closeCountrySelect":[16],"inputValue":[32]}],[1,"zonos-hello-dialog-footer",{"appearanceSettings":[16],"setShowCountrySelect":[16]}],[1,"zonos-custom-message",{"icon":[1],"message":[1]}],[1,"zonos-country-flag",{"class":[1],"countryCode":[1,"country-code"],"size":[2]}]]],["zonos-hello-dialog.cjs",[[1,"zonos-hello-dialog",{"isOpen":[4,"is-open"],"setIsOpen":[16],"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettings":[16],"restrictedItems":[16],"welcomeMessage":[32],"showCountrySelect":[32]},[[4,"click","globalClickHandler"]],{"isOpen":["isOpenHandler"]}]]],["zonos-notification.cjs",[[1,"zonos-notification",{"class":[1],"notificationArray":[32],"showNotification":[64]}]]],["zonos-badge.cjs",[[1,"zonos-badge",{"bold":[4],"color":[1],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"rounded":[4],"class":[1]}]]],["zonos-payment.cjs",[[2,"zonos-payment",{"titleText":[1,"title-text"],"stripe":[32],"stripeElements":[32]},null,{"stripeElements":["watchInitStripe"],"stripe":["watchInitStripe"]}]]],["zonos-shipping-rich-radio.cjs",[[1,"zonos-shipping-rich-radio",{"items":[16],"borderColor":[1,"border-color"],"borderStyle":[1,"border-style"],"theme":[1],"selectedItem":[32]}]]],["zonos-address_2.cjs",[[2,"zonos-address",{"type":[1],"titleText":[1,"title-text"],"defaultAddress":[16],"stripe":[32]},null,{"stripe":["watchInitStripe"]}],[2,"zonos-link-authentication",{"titleText":[1,"title-text"],"stripe":[32]},null,{"stripe":["watchInitStripe"]}]]],["zonos-banner.cjs",[[1,"zonos-banner",{"bannerTitle":[1,"banner-title"],"intent":[1],"class":[1],"hasContent":[32]}]]],["zonos-card_2.cjs",[[1,"zonos-card",{"actions":[16],"class":[1],"footerActions":[16],"footerContent":[16],"footerHeight":[2,"footer-height"],"label":[16],"spacing":[1]}],[1,"zonos-v-stack",{"spacing":[2],"class":[1]}]]],["zonos-icon.cjs",[[1,"zonos-icon",{"autoHeight":[4,"auto-height"],"color":[1],"content":[1],"size":[2]}]]],["zonos-button_2.cjs",[[1,"zonos-button",{"class":[1],"color":[1],"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"],"noPaddingLeft":[4,"no-padding-left"],"noPaddingRight":[4,"no-padding-right"],"loading":[4],"theme":[1],"hasIcon":[32],"hasContent":[32]},[[2,"click","clickHandler"]],{"icon":["iconChangeHandler"]}],[1,"zonos-spinner",{"size":[2],"color":[1]}]]],["zonos-cart-items_10.cjs",[[2,"zonos-checkout-payment",{"paymentError":[4,"payment-error"],"submitBtnType":[1,"submit-btn-type"],"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"disabled":[32]},null,{"disabled":["watchFormComplete"]}],[2,"zonos-customer-info",{"continueLoading":[4,"continue-loading"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"defaultAddress":[16],"disabled":[32]},null,{"disabled":["watchFormComplete"]}],[2,"zonos-shipping",{"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"submitBtnType":[1,"submit-btn-type"],"selectedShippingMethod":[32],"disabled":[32]},null,{"disabled":["watchFormComplete"]}],[1,"zonos-checkout-finish",{"borderRadius":[1,"border-radius"],"storybookForceStatus":[1,"storybook-force-status"],"overrideNotification":[16],"isLoading":[32],"notificationType":[32],"notificationTitle":[32],"notificationMessages":[32]}],[1,"zonos-cart-subtotal"],[1,"zonos-dialog",{"open":[4],"headerText":[1,"header-text"],"width":[1],"height":[1],"noHeader":[4,"no-header"],"noBodyPadding":[4,"no-body-padding"],"noBorder":[4,"no-border"],"footerRightAction":[16],"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"]]],[1,"zonos-review",{"mobile":[4],"collapsed":[4],"isMobile":[32]},[[9,"resize","handleWindowResize"]]],[1,"zonos-cart-items",{"errorImages":[32]}],[1,"zonos-collapse",{"collapsed":[4],"collapseSize":[2,"collapse-size"],"height":[32]}],[1,"zonos-logo",{"theme":[1],"width":[1],"class":[1]}]]]], options);
9
+ return index.bootstrapLazy([["zonos-text.cjs",[[1,"zonos-text",{"class":[1],"color":[1],"size":[1],"type":[1],"weight":[2],"content":[1],"ready":[32]}]]],["zonos-checkout.cjs",[[2,"zonos-checkout",{"appearanceSettingsOverride":[16],"preview":[4],"mobile":[4],"defaultAddress":[16],"forceDialogOpen":[4,"force-dialog-open"],"open":[32],"stripe":[32],"submitLoading":[32],"paymentError":[32],"collapseReviewMobile":[32],"isAttachError":[32],"isMobile":[32],"zonosReviewRef":[32],"storybookPaymentStatusOverride":[32],"closeDialogHandler":[64],"init":[64],"setToFinishStep":[64]},[[16,"zonos--init-cart-info","initCartInfoHandler"],[9,"resize","handleWindowResize"]],{"appearanceSettingsOverride":["appearanceSettingsOverrideChanged"],"mobile":["handleMobileChange"]}]]],["zonos-hello.cjs",[[1,"zonos-hello",{"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettingsOverride":[16],"showPeekMessage":[32],"zonosStoreHelloSettings":[32],"showDialog":[32],"peekMessage":[32],"initialUrl":[32],"allRestrictedItems":[32],"allFoundProducts":[32],"productsOnPage":[32],"displayCurrency":[64],"convertAndFormat":[64],"convert":[64],"format":[64]},[[9,"resize","handleResize"]]]]],["zonos-controller.cjs",[[1,"zonos-controller",{"config":[16],"zonosApiKey":[1,"zonos-api-key"],"initCheckoutElement":[64],"setupGoogleFont":[64],"showNotification":[64],"overrideConfig":[64],"overrideCountry":[64],"getAppearanceSetting":[64]}]]],["zonos-component.cjs",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["zonos-country-flag_4.cjs",[[1,"zonos-country-select",{"closeCountrySelect":[16],"inputValue":[32]}],[1,"zonos-hello-dialog-footer",{"appearanceSettings":[16],"setShowCountrySelect":[16]}],[1,"zonos-custom-message",{"icon":[1],"message":[1]}],[1,"zonos-country-flag",{"class":[1],"countryCode":[1,"country-code"],"size":[2]}]]],["zonos-hello-dialog.cjs",[[1,"zonos-hello-dialog",{"isOpen":[4,"is-open"],"setIsOpen":[16],"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettings":[16],"restrictedItems":[16],"welcomeMessage":[32],"showCountrySelect":[32]},[[4,"click","globalClickHandler"]],{"isOpen":["isOpenHandler"]}]]],["zonos-notification.cjs",[[1,"zonos-notification",{"class":[1],"notificationArray":[32],"showNotification":[64]}]]],["zonos-badge.cjs",[[1,"zonos-badge",{"bold":[4],"color":[1],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"rounded":[4],"class":[1]}]]],["zonos-payment.cjs",[[2,"zonos-payment",{"titleText":[1,"title-text"],"stripe":[32],"stripeElements":[32]},null,{"stripeElements":["watchInitStripe"],"stripe":["watchInitStripe"]}]]],["zonos-shipping-rich-radio.cjs",[[1,"zonos-shipping-rich-radio",{"items":[16],"borderColor":[1,"border-color"],"borderStyle":[1,"border-style"],"theme":[1],"selectedItem":[32]}]]],["zonos-address_2.cjs",[[2,"zonos-address",{"type":[1],"titleText":[1,"title-text"],"defaultAddress":[16],"stripe":[32]},null,{"stripe":["watchInitStripe"]}],[2,"zonos-link-authentication",{"titleText":[1,"title-text"],"stripe":[32]},null,{"stripe":["watchInitStripe"]}]]],["zonos-banner.cjs",[[1,"zonos-banner",{"bannerTitle":[1,"banner-title"],"intent":[1],"class":[1],"hasContent":[32]}]]],["zonos-card_2.cjs",[[1,"zonos-card",{"actions":[16],"class":[1],"footerActions":[16],"footerContent":[16],"footerHeight":[2,"footer-height"],"label":[16],"spacing":[1]}],[1,"zonos-v-stack",{"spacing":[2],"class":[1]}]]],["zonos-icon.cjs",[[1,"zonos-icon",{"autoHeight":[4,"auto-height"],"color":[1],"content":[1],"size":[2]}]]],["zonos-button_2.cjs",[[1,"zonos-button",{"class":[1],"color":[1],"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"],"noPaddingLeft":[4,"no-padding-left"],"noPaddingRight":[4,"no-padding-right"],"loading":[4],"theme":[1],"hasIcon":[32],"hasContent":[32]},[[2,"click","clickHandler"]],{"icon":["iconChangeHandler"]}],[1,"zonos-spinner",{"size":[2],"color":[1]}]]],["zonos-cart-items_10.cjs",[[2,"zonos-checkout-payment",{"paymentError":[4,"payment-error"],"submitBtnType":[1,"submit-btn-type"],"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"disabled":[32]},null,{"disabled":["watchFormComplete"]}],[2,"zonos-customer-info",{"continueLoading":[4,"continue-loading"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"defaultAddress":[16],"disabled":[32]},null,{"disabled":["watchFormComplete"]}],[2,"zonos-shipping",{"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"submitBtnType":[1,"submit-btn-type"],"selectedShippingMethod":[32],"disabled":[32]},null,{"disabled":["watchFormComplete"]}],[1,"zonos-checkout-finish",{"borderRadius":[1,"border-radius"],"storybookForceStatus":[1,"storybook-force-status"],"overrideNotification":[16],"isLoading":[32],"notificationType":[32],"notificationTitle":[32],"notificationMessages":[32],"order":[32]}],[1,"zonos-cart-subtotal"],[1,"zonos-dialog",{"open":[4],"headerText":[1,"header-text"],"width":[1],"height":[1],"noHeader":[4,"no-header"],"noBodyPadding":[4,"no-body-padding"],"noBorder":[4,"no-border"],"footerRightAction":[16],"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"]]],[1,"zonos-review",{"mobile":[4],"collapsed":[4],"isMobile":[32]},[[9,"resize","handleWindowResize"]]],[1,"zonos-cart-items",{"errorImages":[32]}],[1,"zonos-collapse",{"collapsed":[4],"collapseSize":[2,"collapse-size"],"height":[32]}],[1,"zonos-logo",{"theme":[1],"width":[1],"class":[1]}]]]], options);
10
10
  };
11
11
 
12
12
  exports.setNonce = index.setNonce;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const zonosStore = require('./zonosStore-a0fa5b77.js');
3
+ const zonosStore = require('./zonosStore-b43ef5db.js');
4
4
 
5
5
  const stringsArabic = {
6
6
  'Above de minimis threshold for': {
@@ -3194,7 +3194,7 @@ const handleFetch = async (url, _opts) => {
3194
3194
 
3195
3195
  const getCountries = async () => {
3196
3196
  try {
3197
- const { errors, json } = await handleFetch(`${"https://v1.route.js.zonos.com"}/api/get-countries`, {
3197
+ const { errors, json } = await handleFetch(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/get-countries`, {
3198
3198
  method: 'GET',
3199
3199
  });
3200
3200
  if (errors.length || !json) {
@@ -3217,7 +3217,7 @@ const getCountryLandedCost = async (countryCode) => {
3217
3217
  if (!countryCode) {
3218
3218
  return null;
3219
3219
  }
3220
- const url = `${"https://v1.route.js.zonos.com"}/api/country-landed-cost/${countryCode}`;
3220
+ const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/country-landed-cost/${countryCode}`;
3221
3221
  const { errors, json } = await handleFetch(url);
3222
3222
  if (errors.length || !json) {
3223
3223
  logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
@@ -3232,7 +3232,7 @@ const getExchangeRate = async ({ country, isGuaranteed, sourceCurrency, targetCu
3232
3232
  if (sourceCurrency === targetCurrency && !isGuaranteed) {
3233
3233
  return { exchangeRate: null, maxAge: null };
3234
3234
  }
3235
- const url = `${"https://v1.route.js.zonos.com"}/api/exchange-rates?sourceCurrency=${sourceCurrency}&targetCurrency=${targetCurrency}&isGuaranteed=${isGuaranteed}&country=${country}}`;
3235
+ const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/exchange-rates?sourceCurrency=${sourceCurrency}&targetCurrency=${targetCurrency}&isGuaranteed=${isGuaranteed}&country=${country}`;
3236
3236
  const { errors, json } = await handleFetch(url);
3237
3237
  if (errors.length || !json) {
3238
3238
  logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
@@ -3249,7 +3249,7 @@ const getExchangeRate = async ({ country, isGuaranteed, sourceCurrency, targetCu
3249
3249
 
3250
3250
  const getLocaleMessages = async ({ countryCode, localeTo, storeId, }) => {
3251
3251
  var _a;
3252
- const url = `${"https://v1.route.js.zonos.com"}/api/locale-messages?countryCode=${countryCode}&storeId=${storeId}&localeTo=${localeTo}`;
3252
+ const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/locale-messages?countryCode=${countryCode}&storeId=${storeId}&localeTo=${localeTo}`;
3253
3253
  const { errors, json } = await handleFetch(url);
3254
3254
  if (errors.length || !json) {
3255
3255
  // eslint-disable-next-line no-console
@@ -3271,7 +3271,7 @@ const getLocalization = async () => {
3271
3271
  // load and use country from session storage when zCountry query param is not present
3272
3272
  const countryLoadedSession = window.sessionStorage.getItem('zonos--country');
3273
3273
  const zCountry = getZCountryUrlParam(currentUrl.searchParams) || countryLoadedSession;
3274
- const localizationUrl = new URL(`${"https://v1.route.js.zonos.com"}/api/localization`);
3274
+ const localizationUrl = new URL(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/localization`);
3275
3275
  if (zCountry) {
3276
3276
  localizationUrl.searchParams.set('zCountry', zCountry);
3277
3277
  }
@@ -3294,7 +3294,7 @@ const getLocalization = async () => {
3294
3294
 
3295
3295
  const getShippingZones = async () => {
3296
3296
  var _a, _b;
3297
- const url = `${"https://v1.route.js.zonos.com"}/api/shipping-zones`;
3297
+ const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/shipping-zones`;
3298
3298
  const { errors, json } = await handleFetch(url);
3299
3299
  if (errors.length || !json) {
3300
3300
  logError(`Error fetching shipping zones: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
@@ -3372,10 +3372,30 @@ const isValidSelector = (selector) => {
3372
3372
  };
3373
3373
 
3374
3374
  const log = (message, type, ...additionalInfo) => {
3375
+ var _a;
3375
3376
  // if type is error and debug is false, do not log
3376
3377
  if (!window.Zonos.debug) {
3377
3378
  return;
3378
3379
  }
3380
+ let loggingIframe = document.querySelector('iframe#zonos---debug-logging-iframe');
3381
+ if (!loggingIframe) {
3382
+ // add a hidden iframe
3383
+ loggingIframe = document.createElement('iframe');
3384
+ loggingIframe.id = 'zonos---debug-logging-iframe';
3385
+ loggingIframe.style.display = 'none';
3386
+ loggingIframe.style.opacity = '0';
3387
+ loggingIframe.style.position = 'absolute';
3388
+ loggingIframe.style.top = '-9999px';
3389
+ loggingIframe.style.left = '-9999px';
3390
+ loggingIframe.style.width = '1px';
3391
+ loggingIframe.style.height = '1px';
3392
+ loggingIframe.style.border = 'none';
3393
+ loggingIframe.style.overflow = 'hidden';
3394
+ loggingIframe.style.visibility = 'hidden';
3395
+ document.body.appendChild(loggingIframe);
3396
+ }
3397
+ // use the logging iframe's console to log just in case the console is disabled (overriden) by the site owner
3398
+ const console = ((_a = loggingIframe.contentWindow) === null || _a === void 0 ? void 0 : _a.window.console) || window.console;
3379
3399
  switch (type) {
3380
3400
  case 'warn':
3381
3401
  // eslint-disable-next-line no-console
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const zonosStore = require('./zonosStore-a0fa5b77.js');
4
- const localization = require('./localization-dcd11e9d.js');
3
+ const zonosStore = require('./zonosStore-b43ef5db.js');
4
+ const localization = require('./localization-9caf3397.js');
5
5
 
6
6
  const checkoutBreakpoint = 890;
7
7
  const isCheckoutMobile = (isMobile) => {
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-20cb112f.js');
6
- const cart = require('./cart-3ff38a09.js');
7
- const localization = require('./localization-dcd11e9d.js');
8
- require('./zonosStore-a0fa5b77.js');
9
- require('./isDarkColor-261fcf3d.js');
10
- require('./getBorderRadius-a97a5f75.js');
5
+ const index = require('./index-0dcccc22.js');
6
+ const cart = require('./cart-90f7c8c0.js');
7
+ const localization = require('./localization-9caf3397.js');
8
+ require('./zonosStore-b43ef5db.js');
9
+ require('./isDarkColor-ff6ff183.js');
10
+ require('./getBorderRadius-bf4a4276.js');
11
11
 
12
12
  const zonosAddressCss = ".sc-zonos-address-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:var(--amino-space-16)}";
13
13
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-20cb112f.js');
6
- const zonosStore = require('./zonosStore-a0fa5b77.js');
5
+ const index = require('./index-0dcccc22.js');
6
+ const zonosStore = require('./zonosStore-b43ef5db.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
8
 
9
9
  const zonosBadgeCss = ":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .zonos--badge-content{display:-ms-flexbox;display:flex;gap:var(--amino-space-8);font-size:var(--amino-font-size-s);padding:4px 8px;text-align:center;border-radius:var(--amino-radius-6);background-color:var(--amino-gray-100);color:var(--amino-gray-800);-ms-flex-align:center;align-items:center}:host p{font-weight:600;line-height:16px}:host .icon-right svg{-ms-flex-order:2;order:2}:host .small{padding:2px 8px}:host .rounded{border-radius:20px}:host .bold{background-color:var(--amino-gray-600);color:var(--amino-gray-100)}:host .blue{background-color:var(--amino-blue-100);color:var(--amino-blue-800)}:host .blue.bold{background-color:var(--amino-blue-600);color:var(--amino-blue-100)}:host .green{background-color:var(--amino-green-100);color:var(--amino-green-800)}:host .green.bold{background-color:var(--amino-green-600);color:var(--amino-green-100)}:host .red{background-color:var(--amino-red-100);color:var(--amino-red-800)}:host .red.bold{background-color:var(--amino-red-600);color:var(--amino-red-100)}:host .orange{background-color:var(--amino-orange-100);color:var(--amino-orange-800)}:host .orange.bold{background-color:var(--amino-orange-600);color:var(--amino-orange-100)}:host .purple{background-color:var(--amino-purple-100);color:var(--amino-purple-800)}:host .purple.bold{background-color:var(--amino-purple-600);color:var(--amino-purple-100)}:host .cyan{background-color:var(--amino-cyan-100);color:var(--amino-cyan-800)}:host .cyan.bold{background-color:var(--amino-cyan-600);color:var(--amino-cyan-100)}";
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-20cb112f.js');
6
- const zonosStore = require('./zonosStore-a0fa5b77.js');
5
+ const index = require('./index-0dcccc22.js');
6
+ const zonosStore = require('./zonosStore-b43ef5db.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
8
 
9
9
  const zonosBannerCss = ":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{border-radius:var(--amino-radius-10);padding:var(--amino-space-16);background:var(--amino-gray-100)}:host .zonos--container{display:grid;-ms-flex-align:center;align-items:center;grid-template-areas:\"icon header\" \". content\";grid-template-columns:32px auto 0}:host .zonos--icon-wrapper{grid-area:icon;display:-ms-flexbox;display:flex;justify-self:start}:host .zonos--header-wrapper{margin-top:var(--amino-space-0);grid-area:header}:host .zonos--content-wrapper{grid-area:content;margin-top:var(--amino-space-4)}:host(.info){background-color:var(--amino-blue-100);border:1px solid var(--amino-blue-200)}:host(.success){background-color:var(--amino-green-100);border:1px solid var(--amino-green-200)}:host(.error){background-color:var(--amino-red-100);border:1px solid var(--amino-red-200)}:host(.warning){background-color:var(--amino-orange-100);border:1px solid var(--amino-orange-200)}";
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-20cb112f.js');
6
- const zonosStore = require('./zonosStore-a0fa5b77.js');
5
+ const index = require('./index-0dcccc22.js');
6
+ const zonosStore = require('./zonosStore-b43ef5db.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
- const getBorderRadius = require('./getBorderRadius-a97a5f75.js');
8
+ const getBorderRadius = require('./getBorderRadius-bf4a4276.js');
9
9
  const isColorVariable = require('./isColorVariable-41cacd82.js');
10
- const isDarkColor = require('./isDarkColor-261fcf3d.js');
10
+ const isDarkColor = require('./isDarkColor-ff6ff183.js');
11
11
 
12
12
  /**
13
13
  * Get theme for button text based on background color
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-20cb112f.js');
6
- const zonosStore = require('./zonosStore-a0fa5b77.js');
5
+ const index = require('./index-0dcccc22.js');
6
+ const zonosStore = require('./zonosStore-b43ef5db.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
8
 
9
9
  const zonosCardCss = ":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .styled-card{border:var(--amino-border);border-radius:var(--amino-radius-6);padding:var(--spacing, var(--amino-space-24));text-align:left}:host .styled-card hr{margin-left:calc(var(--spacing, var(--amino-space-24)) * -1);margin-right:calc(var(--spacing, var(--amino-space-24)) * -1)}:host .styled-card .card-header{margin:calc(var(--spacing, var(--amino-space-24)) * -1);padding:var(--spacing, var(--amino-space-24));display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-bottom:var(--spacing, var(--amino-space-24));border-bottom:var(--amino-border);height:65px;line-height:65px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host .styled-card .card-header h5{margin-bottom:0;-ms-flex:1;flex:1}:host .styled-card .card-footer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;margin:calc(var(--spacing, var(--amino-space-24)) * -1);padding:var(--spacing, var(--amino-space-24));border-top:var(--amino-border);background:var(--amino-surface-color-secondary);margin-top:var(--spacing, var(--amino-space-24));border-bottom-left-radius:var(--amino-radius-8);border-bottom-right-radius:var(--amino-radius-8);height:var(--footerHeight)}";
@@ -2,14 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-20cb112f.js');
6
- const cart = require('./cart-3ff38a09.js');
7
- const localization = require('./localization-dcd11e9d.js');
8
- const getBorderRadius = require('./getBorderRadius-a97a5f75.js');
9
- const submitGtag = require('./submitGtag-08527ddb.js');
10
- const zonosStore = require('./zonosStore-a0fa5b77.js');
5
+ const index = require('./index-0dcccc22.js');
6
+ const cart = require('./cart-90f7c8c0.js');
7
+ const localization = require('./localization-9caf3397.js');
8
+ const getBorderRadius = require('./getBorderRadius-bf4a4276.js');
9
+ const submitGtag = require('./submitGtag-b141b45d.js');
10
+ const zonosStore = require('./zonosStore-b43ef5db.js');
11
11
  const classes = require('./classes-b7918f56.js');
12
- require('./isDarkColor-261fcf3d.js');
12
+ require('./isDarkColor-ff6ff183.js');
13
13
 
14
14
  const formatCurrency = ({ amount, currency, showCurrencyText, }) => showCurrencyText
15
15
  ? `${new Intl.NumberFormat('en-US', {
@@ -105,6 +105,36 @@ const ZonosCheckoutFinish = class {
105
105
  constructor(hostRef) {
106
106
  index.registerInstance(this, hostRef);
107
107
  this.closeClick = index.createEvent(this, "closeClick", 7);
108
+ this.pullOrder = async () => {
109
+ var _a, _b;
110
+ const baseUrl = "https://v1.route.js.zonos.com";
111
+ const checkoutSessionId = cart.cartStore.checkoutSessionId;
112
+ const { errors, json } = await localization.handleFetch(`${baseUrl}/api/zonos-elements/get-order?checkoutSessionId=${checkoutSessionId}`);
113
+ if (errors.length || !(json === null || json === void 0 ? void 0 : json.id)) {
114
+ return null;
115
+ }
116
+ // TODO: This method of triggering /success for BigCommerce is for MVP. Remove when eventRegistry is fixed to handle by webhooks
117
+ if (window.Zonos.isBigCommerce) {
118
+ const orderId = json === null || json === void 0 ? void 0 : json.id;
119
+ const storeHash = (_b = (_a = json === null || json === void 0 ? void 0 : json.metadata) === null || _a === void 0 ? void 0 : _a.find(x => (x === null || x === void 0 ? void 0 : x.key) === 'storeHash')) === null || _b === void 0 ? void 0 : _b.value;
120
+ if (!orderId || !storeHash) {
121
+ return localization.logError('Unable to trigger BigCommerce /success: Missing orderId or storeHash');
122
+ }
123
+ void localization.handleFetch(`${baseUrl}/api/bigcommerce/success?orderId=${orderId}&storeHash=${storeHash}`);
124
+ }
125
+ return json;
126
+ };
127
+ this.getPullOrder = async (attempts = 0) => {
128
+ const order = await this.pullOrder();
129
+ if (order) {
130
+ this.order = order;
131
+ }
132
+ else if (!order && attempts < 5) {
133
+ // Wait for 1 second before the next attempt
134
+ await new Promise(resolve => setTimeout(resolve, 1000));
135
+ await this.getPullOrder(attempts + 1);
136
+ }
137
+ };
108
138
  this.checkPaymentStatus = async () => {
109
139
  this.isLoading = true;
110
140
  const clientSecret = new URLSearchParams(window.location.search).get('payment_intent_client_secret') || cart.stripeStore.clientSecret;
@@ -130,6 +160,10 @@ const ZonosCheckoutFinish = class {
130
160
  });
131
161
  document.dispatchEvent(successEvent);
132
162
  }
163
+ // Attempt to pull the order details from the graph every second on 5 attempts
164
+ if (this.notificationType === 'success') {
165
+ void this.getPullOrder();
166
+ }
133
167
  }
134
168
  cart.stripeStoreReset();
135
169
  this.isLoading = false;
@@ -144,6 +178,7 @@ const ZonosCheckoutFinish = class {
144
178
  this.notificationType = 'success';
145
179
  this.notificationTitle = '';
146
180
  this.notificationMessages = [];
181
+ this.order = null;
147
182
  }
148
183
  componentDidLoad() {
149
184
  if (this.overrideNotification) {
@@ -157,9 +192,16 @@ const ZonosCheckoutFinish = class {
157
192
  void this.checkPaymentStatus();
158
193
  }
159
194
  render() {
195
+ // TODO: Keeping this code for when we have a UI for order details
196
+ // const orderTotal = this.order?.amountSubtotals
197
+ // ? Object.values(this.order.amountSubtotals).reduce((a, b) => a + b, 0)
198
+ // : 0;
199
+ // const totalItems = this.order?.items?.reduce((acc, item) => {
200
+ // return acc + item.quantity;
201
+ // }, 0);
160
202
  return (index.h(index.Host, { class: "zonos--checkout-finish zonos--elements", style: {
161
203
  '--border-radius': getBorderRadius.getBorderRadius(this.borderRadius),
162
- } }, this.isLoading && (index.h("div", { class: "loading-wrapper" }, index.h("zonos-spinner", null))), !this.isLoading && (index.h("div", { class: "zonos--group" }, this.notificationType === 'success' ? (index.h("zonos-icon", { color: 'blue-800', content: SuccessIcon, size: 50 })) : (index.h("zonos-icon", { color: 'red-800', content: RemoveIcon$1, size: 50 })), index.h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), index.h("zonos-text", null, this.notificationMessages.map(message => (index.h(index.Fragment, null, message, index.h("br", null))))), index.h("zonos-button", { onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, localization.translate('Keep shopping'))))));
204
+ } }, this.isLoading && (index.h("div", { class: "loading-wrapper" }, index.h("zonos-spinner", null))), !this.isLoading && (index.h(index.Fragment, null, index.h("div", { class: "zonos--group" }, this.notificationType === 'success' ? (index.h("zonos-icon", { color: 'blue-800', content: SuccessIcon, size: 50 })) : (index.h("zonos-icon", { color: 'red-800', content: RemoveIcon$1, size: 50 })), index.h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), index.h("zonos-text", null, this.notificationMessages.map(message => (index.h(index.Fragment, null, message, index.h("br", null))))), index.h("zonos-button", { onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, localization.translate('Keep shopping')))))));
163
205
  }
164
206
  static get assetsDirs() { return ["assets"]; }
165
207
  };
@@ -2,14 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-20cb112f.js');
6
- const cart = require('./cart-3ff38a09.js');
7
- const localization = require('./localization-dcd11e9d.js');
8
- const zonosStore = require('./zonosStore-a0fa5b77.js');
9
- const submitGtag = require('./submitGtag-08527ddb.js');
5
+ const index = require('./index-0dcccc22.js');
6
+ const cart = require('./cart-90f7c8c0.js');
7
+ const localization = require('./localization-9caf3397.js');
8
+ const zonosStore = require('./zonosStore-b43ef5db.js');
9
+ const submitGtag = require('./submitGtag-b141b45d.js');
10
10
  const classes = require('./classes-b7918f56.js');
11
- const getBorderRadius = require('./getBorderRadius-a97a5f75.js');
12
- const isDarkColor = require('./isDarkColor-261fcf3d.js');
11
+ const getBorderRadius = require('./getBorderRadius-bf4a4276.js');
12
+ const isDarkColor = require('./isDarkColor-ff6ff183.js');
13
13
 
14
14
  const LeftArrow = `<svg color="var(--amino-gray-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M9.707 16.707a1 1 0 0 1-1.414 0l-3.647-3.646a1.5 1.5 0 0 1 0-2.122l3.647-3.646a1 1 0 0 1 1.414 1.414L7.414 11H19a1 1 0 1 1 0 2H7.414l2.293 2.293a1 1 0 0 1 0 1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>`;
15
15
 
@@ -295,6 +295,8 @@ const ZonosCheckout = class {
295
295
  // Update the URL without query parameters
296
296
  window.history.replaceState({}, document.title, cleanUrl);
297
297
  this.open = false;
298
+ // Reload the page
299
+ window.location.reload();
298
300
  }
299
301
  async handleBackClick() {
300
302
  // close the modal if back button is clicked on customer info step
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-20cb112f.js');
5
+ const index = require('./index-0dcccc22.js');
6
6
 
7
7
  function format(first, middle, last) {
8
8
  return ((first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : ''));