@zonos/elements 1.3.206 → 1.3.208

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 (200) hide show
  1. package/dist/cjs/{CheckoutConfig-4afc683b.js → CheckoutConfig-27c82f94.js} +19 -0
  2. package/dist/cjs/{cart-3d961c6e.js → cart-47c17ebf.js} +1 -25
  3. package/dist/cjs/index.cjs.js +28 -8
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{localization-ff33875b.js → localization-e9089be5.js} +1 -0
  6. package/dist/cjs/{paypal-dee5c109.js → paypal-3a803d21.js} +2 -2
  7. package/dist/cjs/updateCheckoutSessionAttributes-d0332530.js +50 -0
  8. package/dist/cjs/zonos-address_11.cjs.entry.js +2 -2
  9. package/dist/cjs/zonos-cart-items_14.cjs.entry.js +13 -14
  10. package/dist/cjs/zonos-checkout.cjs.entry.js +47 -15
  11. package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
  12. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  13. package/dist/cjs/zonos-country-select_4.cjs.entry.js +94 -46
  14. package/dist/cjs/zonos-elements.cjs.js +1 -1
  15. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +3 -3
  16. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
  17. package/dist/cjs/zonos-hello.cjs.entry.js +11 -2
  18. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  19. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +43 -12
  20. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +9 -12
  21. package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.css +9 -2
  22. package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +129 -59
  23. package/dist/collection/components/hello/zonos-hello/zonos-hello.js +10 -1
  24. package/dist/collection/components/store/checkout/stripe.js +0 -24
  25. package/dist/collection/components/store/hello/localization.js +1 -0
  26. package/dist/collection/components/utils/api/updateCheckoutSessionAttributes.js +46 -0
  27. package/dist/collection/components/utils/checkout/getAbandonedCartRenewTokenValue.js +17 -0
  28. package/dist/collection/scripts/_getCartInfoById.js +3 -0
  29. package/dist/collection/types/checkout/api/CheckoutSession.js +14 -1
  30. package/dist/collection/types/common-ui/VirtualScroll.js +1 -0
  31. package/dist/collection/types/generated/graphql.frontend.types.js +2 -0
  32. package/dist/collection/types/generated/graphql.internal.types.js +18 -0
  33. package/dist/esm/{CheckoutConfig-eb7d6954.js → CheckoutConfig-724d7bae.js} +19 -1
  34. package/dist/esm/{cart-5835676d.js → cart-5b417c0d.js} +4 -28
  35. package/dist/esm/{debounce-eaee3a94.js → debounce-7ebfa15b.js} +1 -1
  36. package/dist/esm/{getBorderRadius-b18c924f.js → getBorderRadius-174305ff.js} +1 -1
  37. package/dist/esm/index.js +27 -10
  38. package/dist/esm/{isDarkColor-d8bb8659.js → isDarkColor-915b06b8.js} +1 -1
  39. package/dist/esm/loader.js +1 -1
  40. package/dist/esm/{localization-4c7f64e8.js → localization-669a1714.js} +2 -1
  41. package/dist/esm/{paypal-b4f106be.js → paypal-3a0cf86b.js} +4 -4
  42. package/dist/esm/updateCheckoutSessionAttributes-183ca6c1.js +48 -0
  43. package/dist/esm/zonos-address_11.entry.js +6 -6
  44. package/dist/esm/zonos-badge.entry.js +1 -1
  45. package/dist/esm/zonos-banner.entry.js +1 -1
  46. package/dist/esm/zonos-button_3.entry.js +3 -3
  47. package/dist/esm/zonos-card.entry.js +2 -2
  48. package/dist/esm/zonos-cart-items_14.entry.js +16 -17
  49. package/dist/esm/zonos-checkout.entry.js +50 -18
  50. package/dist/esm/zonos-collapse.entry.js +1 -1
  51. package/dist/esm/zonos-controller.entry.js +5 -5
  52. package/dist/esm/zonos-country-flag.entry.js +2 -2
  53. package/dist/esm/zonos-country-select_4.entry.js +96 -48
  54. package/dist/esm/zonos-elements.js +1 -1
  55. package/dist/esm/zonos-empty-state-payment_4.entry.js +6 -6
  56. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  57. package/dist/esm/zonos-hello.entry.js +13 -4
  58. package/dist/esm/zonos-input.entry.js +2 -2
  59. package/dist/esm/zonos-language-select_2.entry.js +2 -2
  60. package/dist/esm/zonos-logo.entry.js +1 -1
  61. package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
  62. package/dist/esm/zonos-stripe-input.entry.js +3 -3
  63. package/dist/esm/zonos-text.entry.js +1 -1
  64. package/dist/esm/zonos-toggle.entry.js +1 -1
  65. package/dist/esm/zonos-v-stack.entry.js +1 -1
  66. package/dist/esm/{zonosStore-1e015fa5.js → zonosStore-504a7030.js} +1 -1
  67. package/dist/esm-es5/CheckoutConfig-724d7bae.js +1 -0
  68. package/dist/esm-es5/{cart-5835676d.js → cart-5b417c0d.js} +1 -1
  69. package/dist/esm-es5/{debounce-eaee3a94.js → debounce-7ebfa15b.js} +1 -1
  70. package/dist/esm-es5/{getBorderRadius-b18c924f.js → getBorderRadius-174305ff.js} +1 -1
  71. package/dist/esm-es5/index.js +1 -1
  72. package/dist/esm-es5/{isDarkColor-d8bb8659.js → isDarkColor-915b06b8.js} +1 -1
  73. package/dist/esm-es5/loader.js +1 -1
  74. package/dist/esm-es5/{localization-4c7f64e8.js → localization-669a1714.js} +1 -1
  75. package/dist/esm-es5/{paypal-b4f106be.js → paypal-3a0cf86b.js} +1 -1
  76. package/dist/esm-es5/updateCheckoutSessionAttributes-183ca6c1.js +1 -0
  77. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  78. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  79. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  80. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  81. package/dist/esm-es5/zonos-card.entry.js +1 -1
  82. package/dist/esm-es5/zonos-cart-items_14.entry.js +1 -1
  83. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  84. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  85. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  86. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  87. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  88. package/dist/esm-es5/zonos-elements.js +1 -1
  89. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  90. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  91. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  92. package/dist/esm-es5/zonos-input.entry.js +1 -1
  93. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  94. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  95. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  96. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  97. package/dist/esm-es5/zonos-text.entry.js +1 -1
  98. package/dist/esm-es5/zonos-toggle.entry.js +1 -1
  99. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  100. package/dist/esm-es5/{zonosStore-1e015fa5.js → zonosStore-504a7030.js} +1 -1
  101. package/dist/scripts/index.d.ts +32 -28
  102. package/dist/scripts/index.js +1 -1
  103. package/dist/scripts/loadZonos.js +1 -1
  104. package/dist/scripts/zonos.js +1 -1
  105. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +2 -0
  106. package/dist/types/components/common/zonos-virtual-scroll/zonos-virtual-scroll.d.ts +49 -12
  107. package/dist/types/components/hello/zonos-hello/zonos-hello.d.ts +2 -0
  108. package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
  109. package/dist/types/components/utils/api/updateCheckoutSessionAttributes.d.ts +7 -0
  110. package/dist/types/components/utils/checkout/getAbandonedCartRenewTokenValue.d.ts +1 -0
  111. package/dist/types/components.d.ts +30 -28
  112. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +1 -0
  113. package/dist/types/types/checkout/api/CheckoutSession.d.ts +14 -0
  114. package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +2 -0
  115. package/dist/types/types/common-ui/VirtualScroll.d.ts +1 -0
  116. package/dist/types/types/generated/graphql.frontend.types.d.ts +3 -1
  117. package/dist/types/types/generated/graphql.frontend.types.ts +3 -1
  118. package/dist/types/types/generated/graphql.internal.types.d.ts +47 -0
  119. package/dist/types/types/generated/graphql.internal.types.ts +88 -0
  120. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  121. package/dist/zonos-elements/index.esm.js +1 -1
  122. package/dist/zonos-elements/{p-265af369.system.entry.js → p-02463cc1.system.entry.js} +1 -1
  123. package/dist/zonos-elements/{p-eca09508.system.entry.js → p-066afca1.system.entry.js} +1 -1
  124. package/dist/zonos-elements/{p-74bcb5cc.entry.js → p-0731fbba.entry.js} +1 -1
  125. package/dist/zonos-elements/{p-bab19e2a.entry.js → p-07905246.entry.js} +1 -1
  126. package/dist/zonos-elements/p-0794c530.entry.js +1 -0
  127. package/dist/zonos-elements/{p-019f8637.entry.js → p-081fa4a8.entry.js} +1 -1
  128. package/dist/zonos-elements/{p-1327b935.system.js → p-0d908c15.system.js} +1 -1
  129. package/dist/zonos-elements/p-0f368368.system.js +1 -0
  130. package/dist/zonos-elements/p-0fb14108.entry.js +1 -0
  131. package/dist/zonos-elements/{p-93aeba62.system.entry.js → p-1530f958.system.entry.js} +1 -1
  132. package/dist/zonos-elements/{p-2866fd29.system.entry.js → p-160da12a.system.entry.js} +1 -1
  133. package/dist/zonos-elements/{p-c4e0f49a.system.entry.js → p-1b3e92ea.system.entry.js} +1 -1
  134. package/dist/zonos-elements/{p-4cb8b87f.system.entry.js → p-1f706fc9.system.entry.js} +1 -1
  135. package/dist/zonos-elements/p-2d4e0280.entry.js +1 -0
  136. package/dist/zonos-elements/{p-abe218ab.system.entry.js → p-39039ab7.system.entry.js} +1 -1
  137. package/dist/zonos-elements/p-39428328.system.js +1 -0
  138. package/dist/zonos-elements/p-3d6f6367.system.entry.js +1 -0
  139. package/dist/zonos-elements/p-3ee44728.system.js +1 -1
  140. package/dist/zonos-elements/{p-f9664811.js → p-40a2a649.js} +1 -1
  141. package/dist/zonos-elements/p-40a4c8a2.system.js +1 -0
  142. package/dist/zonos-elements/{p-c666d557.system.js → p-4451a598.system.js} +1 -1
  143. package/dist/zonos-elements/{p-ed20f2f7.js → p-4bf54953.js} +1 -1
  144. package/dist/zonos-elements/{p-abc83d01.entry.js → p-4f04b499.entry.js} +1 -1
  145. package/dist/zonos-elements/{p-f4d741de.system.entry.js → p-51d596a0.system.entry.js} +1 -1
  146. package/dist/zonos-elements/p-5539386e.system.entry.js +1 -0
  147. package/dist/zonos-elements/{p-1bc09abe.system.entry.js → p-5c772fab.system.entry.js} +1 -1
  148. package/dist/zonos-elements/{p-42a9557f.entry.js → p-5d909d3d.entry.js} +1 -1
  149. package/dist/zonos-elements/{p-e337fa88.js → p-5f2a2ca7.js} +1 -1
  150. package/dist/zonos-elements/{p-f8bfc320.system.entry.js → p-63ca1242.system.entry.js} +1 -1
  151. package/dist/zonos-elements/{p-0c4c8d63.entry.js → p-67f807bc.entry.js} +1 -1
  152. package/dist/zonos-elements/{p-3196bf98.entry.js → p-6b406abd.entry.js} +1 -1
  153. package/dist/zonos-elements/{p-9b8a5372.entry.js → p-6be43ba8.entry.js} +1 -1
  154. package/dist/zonos-elements/p-6c991320.entry.js +1 -0
  155. package/dist/zonos-elements/{p-469ccc66.system.entry.js → p-7e346632.system.entry.js} +1 -1
  156. package/dist/zonos-elements/{p-91c996d3.system.js → p-7f568108.system.js} +1 -1
  157. package/dist/zonos-elements/{p-858b7908.system.entry.js → p-803e59d2.system.entry.js} +1 -1
  158. package/dist/zonos-elements/{p-666164d9.system.js → p-91553cf0.system.js} +1 -1
  159. package/dist/zonos-elements/{p-1ad099ec.system.entry.js → p-963fa567.system.entry.js} +1 -1
  160. package/dist/zonos-elements/{p-4fb88ebc.system.entry.js → p-a09bdd20.system.entry.js} +1 -1
  161. package/dist/zonos-elements/{p-edcfb3a3.js → p-a158b406.js} +1 -1
  162. package/dist/zonos-elements/{p-3afc27ef.entry.js → p-a3a8ba10.entry.js} +1 -1
  163. package/dist/zonos-elements/p-a4d995a2.system.js +1 -0
  164. package/dist/zonos-elements/{p-719e14a8.system.entry.js → p-a63bac79.system.entry.js} +1 -1
  165. package/dist/zonos-elements/{p-22cb6880.system.entry.js → p-a958c4f0.system.entry.js} +1 -1
  166. package/dist/zonos-elements/{p-7777d85f.system.entry.js → p-ab6efb03.system.entry.js} +1 -1
  167. package/dist/zonos-elements/p-b2d81c98.js +1 -0
  168. package/dist/zonos-elements/{p-16678764.js → p-b3fa7f19.js} +1 -1
  169. package/dist/zonos-elements/{p-658936c9.js → p-b7a5b367.js} +2 -2
  170. package/dist/zonos-elements/{p-848e08e8.entry.js → p-bb850bb7.entry.js} +1 -1
  171. package/dist/zonos-elements/{p-4e9c8f9e.system.js → p-c5455a34.system.js} +1 -1
  172. package/dist/zonos-elements/{p-41c1d7c4.entry.js → p-c607d026.entry.js} +1 -1
  173. package/dist/zonos-elements/p-c740353c.js +1 -0
  174. package/dist/zonos-elements/{p-eb2560b6.system.entry.js → p-cd376c7a.system.entry.js} +1 -1
  175. package/dist/zonos-elements/{p-5616b304.entry.js → p-d096d7f2.entry.js} +1 -1
  176. package/dist/zonos-elements/{p-e0587eeb.entry.js → p-d1a31577.entry.js} +1 -1
  177. package/dist/zonos-elements/{p-9fa17353.js → p-d35d17f3.js} +1 -1
  178. package/dist/zonos-elements/{p-9e9ac7a2.system.js → p-d5bdbbb3.system.js} +1 -1
  179. package/dist/zonos-elements/{p-18149db1.entry.js → p-da304b78.entry.js} +1 -1
  180. package/dist/zonos-elements/{p-12cd9d3a.entry.js → p-e1c2b8f8.entry.js} +1 -1
  181. package/dist/zonos-elements/p-ea30d92d.system.entry.js +1 -0
  182. package/dist/zonos-elements/{p-47e2cd31.entry.js → p-ef594c0c.entry.js} +1 -1
  183. package/dist/zonos-elements/p-f1f3a846.entry.js +1 -0
  184. package/dist/zonos-elements/{p-30778fde.system.entry.js → p-f49834d4.system.entry.js} +1 -1
  185. package/dist/zonos-elements/{p-b21b0330.entry.js → p-fc3a6495.entry.js} +1 -1
  186. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  187. package/package.json +1 -1
  188. package/dist/esm-es5/CheckoutConfig-eb7d6954.js +0 -1
  189. package/dist/zonos-elements/p-051e0e48.entry.js +0 -1
  190. package/dist/zonos-elements/p-3505e4c4.entry.js +0 -1
  191. package/dist/zonos-elements/p-3a50124e.entry.js +0 -1
  192. package/dist/zonos-elements/p-3f1a2d31.js +0 -1
  193. package/dist/zonos-elements/p-5e1b2654.system.js +0 -1
  194. package/dist/zonos-elements/p-a2b55d11.entry.js +0 -1
  195. package/dist/zonos-elements/p-aafcd40f.system.entry.js +0 -1
  196. package/dist/zonos-elements/p-b922c441.system.js +0 -1
  197. package/dist/zonos-elements/p-ba027b70.system.entry.js +0 -1
  198. package/dist/zonos-elements/p-d5f7f7e6.system.js +0 -1
  199. package/dist/zonos-elements/p-dbd23bea.entry.js +0 -1
  200. package/dist/zonos-elements/p-ea88baa9.system.entry.js +0 -1
@@ -1,67 +1,117 @@
1
1
  import { h, Host } from "@stencil/core";
2
+ import { classes } from "../../utils/classes";
2
3
  /**
3
- * The idea is from
4
+ * Virtual scroll component for efficiently rendering large lists
5
+ *
6
+ * The idea is from:
4
7
  * @ref https://github.com/beenotung/stencil-virtual-scroll/blob/master/src/components/virtual-scroll-list/virtual-scroll-list.scss
5
8
  * @ref https://github.dev/ionic-team/ionic-framework/blob/v6.7.5/core/src/components/virtual-scroll/virtual-scroll.tsx
6
9
  */
7
10
  export class ZonosVirtualScroll {
8
11
  constructor() {
12
+ /**
13
+ * Buffer size in pixels for pre-rendering items outside viewport
14
+ * @default 100
15
+ */
16
+ this.buffer = 100;
17
+ /**
18
+ * Current scroll position
19
+ */
9
20
  this.scrollTop = 0;
10
- this.totalHeight = 1;
11
- this.scrollListener = (_ev) => {
12
- this.scrollTop = this.ele.scrollTop;
21
+ /**
22
+ * Total height of all items combined
23
+ */
24
+ this.totalHeight = 0;
25
+ /**
26
+ * Client dimensions of the scroll container
27
+ */
28
+ this.containerDimensions = {
29
+ height: 0,
30
+ width: 0,
31
+ };
32
+ /**
33
+ * Update container dimensions when element size changes
34
+ */
35
+ this.updateContainerDimensions = () => {
36
+ this.containerDimensions = {
37
+ height: this.element.clientHeight,
38
+ width: this.element.clientWidth,
39
+ };
40
+ };
41
+ /**
42
+ * Handle scroll events
43
+ */
44
+ this.handleScroll = () => {
45
+ this.scrollTop = this.element.scrollTop;
13
46
  };
14
47
  }
48
+ /**
49
+ * Watch for changes in item heights or fallback height and recalculate total height
50
+ */
15
51
  updateTotalHeight() {
16
- this.totalHeight = this.itemHeights.reduce((acc, height) => acc + (height || this.fallbackItemHeight), 0);
52
+ this.totalHeight = this.itemHeights.reduce((accumulator, height) => accumulator + (height || this.fallbackItemHeight), 0);
53
+ }
54
+ /**
55
+ * Calculate which items should be rendered based on current scroll position
56
+ */
57
+ getVisibleItems() {
58
+ const { width: containerWidth } = this.containerDimensions;
59
+ const visibleItems = [];
60
+ let accumulatedHeight = 0;
61
+ const itemCount = this.itemHeights.length;
62
+ for (let index = 0; index < itemCount; index++) {
63
+ const itemHeight = this.itemHeights[index] || this.fallbackItemHeight;
64
+ // Skip items that are above the viewport (with buffer)
65
+ if (this.scrollTop > accumulatedHeight + itemHeight + this.buffer) {
66
+ accumulatedHeight += itemHeight;
67
+ continue;
68
+ }
69
+ // Stop rendering items that are below the viewport (with buffer)
70
+ if (this.scrollTop + this.containerDimensions.height <
71
+ accumulatedHeight - this.buffer) {
72
+ break;
73
+ }
74
+ const itemElement = (h("div", { class: classes(['item']), key: `virtual-item-${index}`, style: {
75
+ height: `${itemHeight}px`,
76
+ transform: `translateY(${accumulatedHeight}px)`,
77
+ width: this.itemWidth
78
+ ? `${this.itemWidth}px`
79
+ : `${containerWidth}px`,
80
+ } }, this.renderItem(index)));
81
+ visibleItems.push({
82
+ element: itemElement,
83
+ index,
84
+ });
85
+ accumulatedHeight += itemHeight;
86
+ }
87
+ return visibleItems;
17
88
  }
89
+ /**
90
+ * Component lifecycle - setup event listeners and initial calculations
91
+ */
18
92
  connectedCallback() {
19
- this.ele.addEventListener('scroll', this.scrollListener);
93
+ this.element.addEventListener('scroll', this.handleScroll);
94
+ window.addEventListener('resize', this.updateContainerDimensions);
95
+ // Initial setup
20
96
  this.updateTotalHeight();
97
+ this.updateContainerDimensions();
21
98
  }
99
+ /**
100
+ * Component lifecycle - cleanup event listeners
101
+ */
22
102
  disconnectedCallback() {
23
- this.ele.removeEventListener('scroll', this.scrollListener);
103
+ this.element.removeEventListener('scroll', this.handleScroll);
104
+ window.removeEventListener('resize', this.updateContainerDimensions);
24
105
  }
25
106
  render() {
26
- const W = this.ele.clientWidth;
27
- const H = this.ele.clientHeight;
28
- const heights = this.itemHeights;
29
- const fallbackItemHeight = this.fallbackItemHeight;
30
- const N = this.itemHeights.length;
31
- const scrollTop = this.scrollTop;
32
- const children = [];
33
- let accHeight = 0;
34
- // buffer for pre-rendering for item outside of viewport
35
- const buffer = 100;
36
- for (let i = 0; i < N; i++) {
37
- const itemHeight = heights[i] || fallbackItemHeight;
38
- if (scrollTop > accHeight + itemHeight + buffer) {
39
- accHeight += itemHeight;
40
- continue; // this item is above the viewport
41
- }
42
- if (scrollTop + H < accHeight - buffer) {
43
- break; // this item is below the viewport
44
- }
45
- const x = 0;
46
- const y = accHeight;
47
- children.push(h("div", { class: "item", style: {
48
- height: `${itemHeight}px`,
49
- transform: `translate(${x}px,${y}px)`,
50
- width: this.itemWidth ? `${this.itemWidth}px` : `${W}px`,
51
- } }, this.renderItem(i)));
52
- accHeight += itemHeight;
53
- }
54
- return (h(Host, { key: '6ccfd807912b51223f249543b66552e945859a1a' }, h("div", { key: '21f05d8e9082b54f484badc6e52c3006068df401',
55
- // to capture scroll action
56
- class: "scroller", style: {
107
+ const { width: containerWidth } = this.containerDimensions;
108
+ const visibleItems = this.getVisibleItems();
109
+ return (h(Host, { key: 'ef009c7cd2e654ea2dd3d67675f221229f924ec0', class: classes(['zonos--virtual-scroll']) }, h("div", { key: 'a2831fb8251cb27b3d814e8c493e8303ac04ff1c', class: classes(['scroller']), style: {
57
110
  height: `${this.totalHeight}px`,
58
- width: `${W}px`,
59
- } }), h("div", { key: '3935dc009877c002047f41de3caeeb16e2d7c08d',
60
- // to display items
61
- class: "item-container", ref: el => (this.container = el), style: {
111
+ width: `${containerWidth}px`,
112
+ } }), h("div", { key: 'e36052e45224c89860b469b939898aa9861181a8', class: classes(['item-container']), style: {
62
113
  height: `${this.totalHeight}px`,
63
- left: `${-W}px`,
64
- } }, children)));
114
+ } }, visibleItems.map(({ element }) => element))));
65
115
  }
66
116
  static get is() { return "zonos-virtual-scroll"; }
67
117
  static get encapsulation() { return "scoped"; }
@@ -81,16 +131,13 @@ export class ZonosVirtualScroll {
81
131
  "type": "unknown",
82
132
  "mutable": false,
83
133
  "complexType": {
84
- "original": "(\n itemIndex: number,\n ) =>\n | HTMLElement\n | Promise<HTMLElement>\n | HTMLElement[]\n | Promise<HTMLElement[]>\n | Promise<HTMLElement>[]",
134
+ "original": "VirtualScrollRenderItem",
85
135
  "resolved": "(itemIndex: number) => HTMLElement | HTMLElement[] | Promise<HTMLElement> | Promise<HTMLElement[]> | Promise<HTMLElement>[]",
86
136
  "references": {
87
- "HTMLElement": {
88
- "location": "global",
89
- "id": "global::HTMLElement"
90
- },
91
- "Promise": {
92
- "location": "global",
93
- "id": "global::Promise"
137
+ "VirtualScrollRenderItem": {
138
+ "location": "import",
139
+ "path": "src/types/common-ui/VirtualScroll",
140
+ "id": "src/types/common-ui/VirtualScroll.ts::VirtualScrollRenderItem"
94
141
  }
95
142
  }
96
143
  },
@@ -98,7 +145,7 @@ export class ZonosVirtualScroll {
98
145
  "optional": false,
99
146
  "docs": {
100
147
  "tags": [],
101
- "text": "Render item"
148
+ "text": "Function to render each item in the virtual scroll"
102
149
  },
103
150
  "getter": false,
104
151
  "setter": false
@@ -115,7 +162,7 @@ export class ZonosVirtualScroll {
115
162
  "optional": true,
116
163
  "docs": {
117
164
  "tags": [],
118
- "text": "Width of each item"
165
+ "text": "Width of each item in pixels"
119
166
  },
120
167
  "getter": false,
121
168
  "setter": false,
@@ -134,7 +181,7 @@ export class ZonosVirtualScroll {
134
181
  "optional": false,
135
182
  "docs": {
136
183
  "tags": [],
137
- "text": "Height that is used as a fallback if height is not provided"
184
+ "text": "Fallback height used when specific item height is not provided"
138
185
  },
139
186
  "getter": false,
140
187
  "setter": false,
@@ -153,21 +200,44 @@ export class ZonosVirtualScroll {
153
200
  "optional": false,
154
201
  "docs": {
155
202
  "tags": [],
156
- "text": "Heights list of each item"
203
+ "text": "Array of heights for each item in pixels"
157
204
  },
158
205
  "getter": false,
159
206
  "setter": false
207
+ },
208
+ "buffer": {
209
+ "type": "number",
210
+ "mutable": false,
211
+ "complexType": {
212
+ "original": "number",
213
+ "resolved": "number",
214
+ "references": {}
215
+ },
216
+ "required": false,
217
+ "optional": false,
218
+ "docs": {
219
+ "tags": [{
220
+ "name": "default",
221
+ "text": "100"
222
+ }],
223
+ "text": "Buffer size in pixels for pre-rendering items outside viewport"
224
+ },
225
+ "getter": false,
226
+ "setter": false,
227
+ "attribute": "buffer",
228
+ "reflect": false,
229
+ "defaultValue": "100"
160
230
  }
161
231
  };
162
232
  }
163
233
  static get states() {
164
234
  return {
165
- "container": {},
166
235
  "scrollTop": {},
167
- "totalHeight": {}
236
+ "totalHeight": {},
237
+ "containerDimensions": {}
168
238
  };
169
239
  }
170
- static get elementRef() { return "ele"; }
240
+ static get elementRef() { return "element"; }
171
241
  static get watchers() {
172
242
  return [{
173
243
  "propName": "itemHeights",
@@ -143,19 +143,23 @@ export class ZonosHello {
143
143
  }
144
144
  }, 1000);
145
145
  this.watchProductCountChange = () => {
146
+ var _a;
146
147
  const observer = new MutationObserver(this.handleProductCountChange);
147
148
  observer.observe(document.body, {
148
149
  childList: true,
149
150
  subtree: true,
150
151
  });
152
+ (_a = this.observerWatcher) === null || _a === void 0 ? void 0 : _a.push(observer);
151
153
  };
152
154
  this.watchPriceChange = () => {
155
+ var _a;
153
156
  const observer = new MutationObserver(() => void this.displayCurrency());
154
157
  observer.observe(document.body, {
155
158
  attributes: true,
156
159
  childList: true,
157
160
  subtree: true,
158
161
  });
162
+ (_a = this.observerWatcher) === null || _a === void 0 ? void 0 : _a.push(observer);
159
163
  };
160
164
  this.updateHelloOnPageChange = () => {
161
165
  // If the product count changes on the same url (loading more products), update the peek message and item restrictions
@@ -240,6 +244,11 @@ export class ZonosHello {
240
244
  }
241
245
  }, 100);
242
246
  }
247
+ disconnectedCallback() {
248
+ var _a;
249
+ // disconnect all observers
250
+ (_a = this.observerWatcher) === null || _a === void 0 ? void 0 : _a.forEach(observer => observer.disconnect());
251
+ }
243
252
  /**
244
253
  * This method will trigger the currency conversion and display the converted value
245
254
  * @returns void
@@ -391,7 +400,7 @@ export class ZonosHello {
391
400
  shouldFloat && 'zonos--hello-widget-float',
392
401
  ]), onClick: () => {
393
402
  void this.changeShowDialog(!this.showDialog);
394
- }, onMouseEnter: () => this.enableShowPeekMessage(), onMouseLeave: () => (this.showPeekMessage = false), ref: el => el && (this.helloRef = el) }, h("zonos-text", { class: "zonos--hello-message" }, this.peekMessage), selectedCountryCode && (h("div", { class: "zonos--hello-country-flag-wrapper" }, h("zonos-country-flag", { class: "zonos--hello-country-flag", countryCode: selectedCountryCode })))), h("div", { class: classes([
403
+ }, onMouseEnter: () => this.enableShowPeekMessage(), onMouseLeave: () => (this.showPeekMessage = false), ref: el => el && (this.helloRef = el), type: "button" }, h("zonos-text", { class: "zonos--hello-message" }, this.peekMessage), selectedCountryCode && (h("div", { class: "zonos--hello-country-flag-wrapper" }, h("zonos-country-flag", { class: "zonos--hello-country-flag", countryCode: selectedCountryCode })))), h("div", { class: classes([
395
404
  'zonos--hello-dialog-wrapper',
396
405
  this.mobileLocationOverride &&
397
406
  'zonos--hello-dialog-wrapper-mobile-override',
@@ -600,18 +600,6 @@ export const getCheckoutSessionBody = () => {
600
600
  key: 'language',
601
601
  value: localizationStore.selectedLocale,
602
602
  },
603
- {
604
- key: 'appVersion',
605
- value: window.Zonos.version,
606
- },
607
- {
608
- key: 'appVersionNpmIntegration',
609
- value: window.Zonos.isNpm ? '1' : '0',
610
- },
611
- {
612
- key: 'legacyCheckoutFacade',
613
- value: window.Zonos.isLegacyCheckout ? '1' : '0',
614
- },
615
603
  ],
616
604
  presentmentCountryCode: localizationStore.selectedCountryCode,
617
605
  skipPaymentIntent: stripeStore.skipPaymentIntent,
@@ -759,18 +747,6 @@ const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, cur
759
747
  key: 'language',
760
748
  value: localizationStore.selectedLocale,
761
749
  },
762
- {
763
- key: 'appVersion',
764
- value: window.Zonos.version,
765
- },
766
- {
767
- key: 'appVersionNpmIntegration',
768
- value: window.Zonos.isNpm ? '1' : '0',
769
- },
770
- {
771
- key: 'legacyCheckoutFacade',
772
- value: window.Zonos.isLegacyCheckout ? '1' : '0',
773
- },
774
750
  ],
775
751
  presentmentCountryCode,
776
752
  skipPaymentIntent: stripeStore.skipPaymentIntent,
@@ -203,6 +203,7 @@ const updateCheckoutSessionLanguage = async () => {
203
203
  body: {
204
204
  id: storageStore.checkoutSessionId,
205
205
  metadata: [
206
+ // This is being used from the backend to determine the language of the checkout session
206
207
  {
207
208
  key: 'language',
208
209
  value: localizationStore.selectedLocale,
@@ -0,0 +1,46 @@
1
+ import debounce from "lodash/debounce";
2
+ import { handleFetch } from "../handleFetch";
3
+ import { logError } from "../logging/logError";
4
+ const attributesToUpdate = {};
5
+ // Store debounced functions per session to ensure proper debouncing
6
+ const debouncedFunctions = {};
7
+ const createDebouncedFetch = (sessionId) => {
8
+ return debounce(async () => {
9
+ var _a, _b;
10
+ // Get latest attributes from the map
11
+ const latestAttributes = Array.from(((_a = attributesToUpdate[sessionId]) === null || _a === void 0 ? void 0 : _a.entries()) || []).map(([key, value]) => ({ key, value }));
12
+ const { errors, json } = await handleFetch('/api/zonos-elements/update-checkout-session-attributes', {
13
+ body: {
14
+ attributes: latestAttributes,
15
+ id: sessionId,
16
+ },
17
+ method: 'POST',
18
+ });
19
+ if (errors.length) {
20
+ logError('Error updating checkout session attributes', errors);
21
+ return { success: false };
22
+ }
23
+ (_b = attributesToUpdate[sessionId]) === null || _b === void 0 ? void 0 : _b.clear();
24
+ return { success: !!(json === null || json === void 0 ? void 0 : json.success) };
25
+ }, 1000, { maxWait: 5000 });
26
+ };
27
+ export const updateCheckoutSessionAttributes = async ({ attributes, checkoutSessionId, }) => {
28
+ // Merge the new attributes with the attributes in the list, if key exist, override it
29
+ // init the map if not exist
30
+ attributesToUpdate[checkoutSessionId] || (attributesToUpdate[checkoutSessionId] = new Map());
31
+ attributes.forEach(attribute => {
32
+ var _a;
33
+ if (attribute.value) {
34
+ (_a = attributesToUpdate[checkoutSessionId]) === null || _a === void 0 ? void 0 : _a.set(attribute.key, attribute.value);
35
+ }
36
+ });
37
+ if (!attributes.length) {
38
+ return;
39
+ }
40
+ // Get or create the debounced function for this session
41
+ if (!debouncedFunctions[checkoutSessionId]) {
42
+ debouncedFunctions[checkoutSessionId] =
43
+ createDebouncedFetch(checkoutSessionId);
44
+ }
45
+ return debouncedFunctions[checkoutSessionId]();
46
+ };
@@ -0,0 +1,17 @@
1
+ export const getAbandonedCartRenewTokenValue = () => {
2
+ const validityToken = new URLSearchParams(window.location.search).get('validityToken');
3
+ // check if validityToken length is base64 encoded
4
+ if (!validityToken ||
5
+ !/^[A-Za-z0-9+/]+={0,2}$/.test(validityToken) ||
6
+ validityToken.length % 4 !== 0) {
7
+ return null;
8
+ }
9
+ try {
10
+ // check if it can be decoded
11
+ atob(validityToken);
12
+ return validityToken;
13
+ }
14
+ catch (_a) {
15
+ return null;
16
+ }
17
+ };
@@ -1,10 +1,12 @@
1
1
  import { getGenericSettingsOverride } from "../components/utils/api/getGenericSettingsOverride";
2
+ import { getAbandonedCartRenewTokenValue } from "../components/utils/checkout/getAbandonedCartRenewTokenValue";
2
3
  import { getIsTestMode } from "../components/utils/checkout/getIsTestMode";
3
4
  import { handleFetch } from "../components/utils/handleFetch";
4
5
  import { log } from "../components/utils/logging/log";
5
6
  export const getCartInfoById = async ({ cartId, retries, }) => {
6
7
  const isTestMode = getIsTestMode();
7
8
  const overrideSettings = getGenericSettingsOverride();
9
+ const renewCartExpirationToken = getAbandonedCartRenewTokenValue() || undefined;
8
10
  const params = new URLSearchParams();
9
11
  if (overrideSettings.overrideShouldEnabledCustomAddress) {
10
12
  params.set('overrideShouldEnabledCustomAddress', overrideSettings.overrideShouldEnabledCustomAddress);
@@ -12,6 +14,7 @@ export const getCartInfoById = async ({ cartId, retries, }) => {
12
14
  const { errors, json, zonosMode } = await handleFetch(`/api/zonos-elements/get-cart?${params.toString()}`, {
13
15
  body: {
14
16
  isTestMode,
17
+ renewCartExpirationToken,
15
18
  tempCartUUID: cartId,
16
19
  },
17
20
  headers: {
@@ -1 +1,14 @@
1
- export {};
1
+ export const checkoutSessionMutableAttributeKeys = [
2
+ 'ZONOS_FORM_TYPE_USING',
3
+ 'APP_VERSION',
4
+ 'APP_VERSION_NPM_INTEGRATION',
5
+ 'LEGACY_CHECKOUT_FACADE',
6
+ ];
7
+ export const checkoutSessionImmutableAttributeKeys = [
8
+ 'ORDER_DUPLICATION_CONSENT',
9
+ 'WITH_ABANDONED_CART_TOKEN',
10
+ ];
11
+ export const checkoutSessionAttributeKeys = [
12
+ ...checkoutSessionMutableAttributeKeys,
13
+ ...checkoutSessionImmutableAttributeKeys,
14
+ ];
@@ -0,0 +1 @@
1
+ export {};
@@ -3,7 +3,9 @@ export const cursorOrdering = {
3
3
  Desc: 'DESC',
4
4
  };
5
5
  export const errorProjectNameEnum = {
6
+ Conductor: 'conductor',
6
7
  Dashboard: 'dashboard',
8
+ DashboardExpo: 'dashboard_expo',
7
9
  Elements: 'elements',
8
10
  ZonosCom: 'zonos_com',
9
11
  };
@@ -2732,6 +2732,12 @@ export const usageRecordTypeCode = {
2732
2732
  OrderComplete: 'ORDER_COMPLETE',
2733
2733
  OrderTransactionInvoicing: 'ORDER_TRANSACTION_INVOICING',
2734
2734
  };
2735
+ export const userAccessLevel = {
2736
+ Admin: 'ADMIN',
2737
+ Custom: 'CUSTOM',
2738
+ Member: 'MEMBER',
2739
+ None: 'NONE',
2740
+ };
2735
2741
  export const visibilityCode = {
2736
2742
  Hide: 'HIDE',
2737
2743
  Optional: 'OPTIONAL',
@@ -2877,6 +2883,9 @@ export function getSdk(client, withWrapper = defaultWrapper) {
2877
2883
  checkoutSessionUpdate(variables, requestHeaders) {
2878
2884
  return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'checkoutSessionUpdate', 'mutation');
2879
2885
  },
2886
+ checkoutSessionUpdateAttributes(variables, requestHeaders) {
2887
+ return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'checkoutSessionUpdateAttributes', 'mutation');
2888
+ },
2880
2889
  checkoutSessionUpdateMetadata(variables, requestHeaders) {
2881
2890
  return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'checkoutSessionUpdateMetadata', 'mutation');
2882
2891
  },
@@ -2904,6 +2913,9 @@ export function getSdk(client, withWrapper = defaultWrapper) {
2904
2913
  getCheckoutSession(variables, requestHeaders) {
2905
2914
  return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'getCheckoutSession', 'query');
2906
2915
  },
2916
+ getCheckoutSessionAttributes(variables, requestHeaders) {
2917
+ return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'getCheckoutSessionAttributes', 'query');
2918
+ },
2907
2919
  getInclusivePriceSettingByCountry(variables, requestHeaders) {
2908
2920
  return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'getInclusivePriceSettingByCountry', 'query');
2909
2921
  },
@@ -2922,6 +2934,9 @@ export function getSdk(client, withWrapper = defaultWrapper) {
2922
2934
  helloSettings(variables, requestHeaders) {
2923
2935
  return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'helloSettings', 'query');
2924
2936
  },
2937
+ landedCostSettings(variables, requestHeaders) {
2938
+ return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'landedCostSettings', 'query');
2939
+ },
2925
2940
  onlineStoreSettings(variables, requestHeaders) {
2926
2941
  return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'onlineStoreSettings', 'query');
2927
2942
  },
@@ -2952,6 +2967,9 @@ export function getSdk(client, withWrapper = defaultWrapper) {
2952
2967
  removeTrackingNumber(variables, requestHeaders) {
2953
2968
  return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'removeTrackingNumber', 'mutation');
2954
2969
  },
2970
+ renewCartExpirationToken(variables, requestHeaders) {
2971
+ return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'renewCartExpirationToken', 'mutation');
2972
+ },
2955
2973
  selectCheckoutVarianceTest(variables, requestHeaders) {
2956
2974
  return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'selectCheckoutVarianceTest', 'mutation');
2957
2975
  },
@@ -1,3 +1,21 @@
1
+ const getAbandonedCartRenewTokenValue = () => {
2
+ const validityToken = new URLSearchParams(window.location.search).get('validityToken');
3
+ // check if validityToken length is base64 encoded
4
+ if (!validityToken ||
5
+ !/^[A-Za-z0-9+/]+={0,2}$/.test(validityToken) ||
6
+ validityToken.length % 4 !== 0) {
7
+ return null;
8
+ }
9
+ try {
10
+ // check if it can be decoded
11
+ atob(validityToken);
12
+ return validityToken;
13
+ }
14
+ catch (_a) {
15
+ return null;
16
+ }
17
+ };
18
+
1
19
  const baseRe = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/;
2
20
  const uuidRe = new RegExp(`^${baseRe.source}$`);
3
21
  const cartUuidRe = new RegExp(`^cart_${baseRe.source}$`);
@@ -29,4 +47,4 @@ const checkoutHiddenBtnSelector = 'zonos--checkout-hidden-button';
29
47
  const checkoutHiddenInternationalBtnSelector = 'zonos--checkout-hidden-international-button';
30
48
  const domesticRedirectedBtnSelector = 'zonos--domestic-redirected-checkout-button';
31
49
 
32
- export { _getIsValidCartId as _, checkoutHiddenInternationalBtnSelector as a, checkoutHiddenBtnSelector as c, domesticRedirectedBtnSelector as d };
50
+ export { _getIsValidCartId as _, checkoutHiddenInternationalBtnSelector as a, checkoutHiddenBtnSelector as c, domesticRedirectedBtnSelector as d, getAbandonedCartRenewTokenValue as g };
@@ -1,8 +1,8 @@
1
- import { z as zonosStore, c as createStore } from './zonosStore-1e015fa5.js';
2
- import { s as storageStore, l as localizationStore, t as translate, f as filterValidTests, b as storageStoreSetEnabledVariantTestKeys } from './localization-4c7f64e8.js';
1
+ import { z as zonosStore, c as createStore } from './zonosStore-504a7030.js';
2
+ import { s as storageStore, l as localizationStore, t as translate, f as filterValidTests, b as storageStoreSetEnabledVariantTestKeys } from './localization-669a1714.js';
3
3
  import { l as log, f as fallbackApiList, h as handleFetch, g as getIsTestMode, a as getIsStagingMode, s as sendErrorLog, d as allLogs, b as logError, j as jsonParse } from './handleFetch-621e45bc.js';
4
- import { i as isDarkColor } from './isDarkColor-d8bb8659.js';
5
- import { g as getBorderRadius } from './getBorderRadius-b18c924f.js';
4
+ import { i as isDarkColor } from './isDarkColor-915b06b8.js';
5
+ import { g as getBorderRadius } from './getBorderRadius-174305ff.js';
6
6
 
7
7
  /**
8
8
  * Extract value from translated object
@@ -1175,18 +1175,6 @@ const getCheckoutSessionBody = () => {
1175
1175
  key: 'language',
1176
1176
  value: localizationStore.selectedLocale,
1177
1177
  },
1178
- {
1179
- key: 'appVersion',
1180
- value: window.Zonos.version,
1181
- },
1182
- {
1183
- key: 'appVersionNpmIntegration',
1184
- value: window.Zonos.isNpm ? '1' : '0',
1185
- },
1186
- {
1187
- key: 'legacyCheckoutFacade',
1188
- value: window.Zonos.isLegacyCheckout ? '1' : '0',
1189
- },
1190
1178
  ],
1191
1179
  presentmentCountryCode: localizationStore.selectedCountryCode,
1192
1180
  skipPaymentIntent: stripeStore.skipPaymentIntent,
@@ -1334,18 +1322,6 @@ const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, cur
1334
1322
  key: 'language',
1335
1323
  value: localizationStore.selectedLocale,
1336
1324
  },
1337
- {
1338
- key: 'appVersion',
1339
- value: window.Zonos.version,
1340
- },
1341
- {
1342
- key: 'appVersionNpmIntegration',
1343
- value: window.Zonos.isNpm ? '1' : '0',
1344
- },
1345
- {
1346
- key: 'legacyCheckoutFacade',
1347
- value: window.Zonos.isLegacyCheckout ? '1' : '0',
1348
- },
1349
1325
  ],
1350
1326
  presentmentCountryCode,
1351
1327
  skipPaymentIntent: stripeStore.skipPaymentIntent,
@@ -1,4 +1,4 @@
1
- import { _ as _root, e as _baseGetTag, i as isObjectLike_1, f as isObject_1 } from './zonosStore-1e015fa5.js';
1
+ import { _ as _root, b as _baseGetTag, i as isObjectLike_1, d as isObject_1 } from './zonosStore-504a7030.js';
2
2
 
3
3
  var root = _root;
4
4
 
@@ -1,4 +1,4 @@
1
- import { z as zonosStore } from './zonosStore-1e015fa5.js';
1
+ import { z as zonosStore } from './zonosStore-504a7030.js';
2
2
 
3
3
  /**
4
4
  * Get the border radius for the elements based on the style