@zonos/elements 1.3.51 → 1.3.53

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 (207) hide show
  1. package/dist/cjs/CheckoutConfig-65376e00.js +40 -0
  2. package/dist/cjs/{cart-546d1602.js → cart-61a8983d.js} +238 -375
  3. package/dist/cjs/{createCustomEvent-9b91480b.js → createCustomEvent-228027b5.js} +3 -2
  4. package/dist/cjs/handleFetch-842c95b0.js +322 -0
  5. package/dist/cjs/index.cjs.js +75 -35
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/{paypal-83f49f9a.js → paypal-f1eb6621.js} +16 -16
  8. package/dist/cjs/zonos-address_8.cjs.entry.js +4 -4
  9. package/dist/cjs/{zonos-cart-items_12.cjs.entry.js → zonos-badge_13.cjs.entry.js} +41 -9
  10. package/dist/cjs/zonos-checkout.cjs.entry.js +75 -174
  11. package/dist/cjs/zonos-controller.cjs.entry.js +29 -27
  12. package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
  13. package/dist/cjs/zonos-country-select_4.cjs.entry.js +2 -2
  14. package/dist/cjs/zonos-elements.cjs.js +1 -1
  15. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
  16. package/dist/cjs/zonos-hello.cjs.entry.js +11 -11
  17. package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
  18. package/dist/cjs/zonos-notification_3.cjs.entry.js +9 -9
  19. package/dist/cjs/zonos-tooltip.cjs.entry.js +27 -0
  20. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +5 -2
  21. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +44 -20
  22. package/dist/collection/components/main/zonos-controller.js +2 -2
  23. package/dist/collection/components/store/checkout/cart.js +14 -2
  24. package/dist/collection/components/store/checkout/stripe.js +9 -4
  25. package/dist/collection/components/store/translationStore/strings.arabic.js +3 -3
  26. package/dist/collection/components/store/translationStore/strings.base.js +3 -3
  27. package/dist/collection/components/store/translationStore/strings.chinese.js +3 -3
  28. package/dist/collection/components/store/translationStore/strings.danish.js +3 -3
  29. package/dist/collection/components/store/translationStore/strings.dutch.js +3 -3
  30. package/dist/collection/components/store/translationStore/strings.french.js +3 -3
  31. package/dist/collection/components/store/translationStore/strings.german.js +3 -3
  32. package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -3
  33. package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -3
  34. package/dist/collection/components/store/translationStore/strings.italian.js +3 -3
  35. package/dist/collection/components/store/translationStore/strings.japanese.js +3 -3
  36. package/dist/collection/components/store/translationStore/strings.korean.js +3 -3
  37. package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -3
  38. package/dist/collection/components/store/translationStore/strings.polish.js +3 -3
  39. package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -3
  40. package/dist/collection/components/store/translationStore/strings.russian.js +3 -3
  41. package/dist/collection/components/store/translationStore/strings.spanish.js +3 -3
  42. package/dist/collection/components/store/translationStore/strings.swedish.js +3 -3
  43. package/dist/collection/components/store/translationStore/strings.turkish.js +3 -3
  44. package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -3
  45. package/dist/collection/components/utils/api/buildCartItemsByTempCart.js +14 -14
  46. package/dist/collection/components/utils/api/calculateLandedCostNormalized.js +28 -0
  47. package/dist/collection/components/utils/api/cartCalculateLandedCost.js +19 -0
  48. package/dist/collection/components/utils/api/prepCalculateLandedCost.js +65 -0
  49. package/dist/collection/components/utils/checkout/initCheckout.js +4 -2
  50. package/dist/collection/environment.js +1 -1
  51. package/dist/collection/scripts/_getNextFallbackUrl.js +1 -0
  52. package/dist/collection/scripts/_getTempCartById.js +14 -0
  53. package/dist/collection/scripts/_zonosBase.js +39 -10
  54. package/dist/collection/scripts/cart/_getCartIdFromParam.js +9 -0
  55. package/dist/collection/scripts/cart/_setupCartData.js +18 -0
  56. package/dist/collection/types/checkout/CheckoutConfig.js +2 -1
  57. package/dist/collection/types/generated/graphql.customer.types.js +12 -0
  58. package/dist/collection/utils/formattedCloudflareApiUrl.js +8 -2
  59. package/dist/collection/utils/generateCloudflareDeployUrl.js +3 -0
  60. package/dist/esm/CheckoutConfig-57350b28.js +36 -0
  61. package/dist/esm/{cart-51529af2.js → cart-45d2861f.js} +193 -327
  62. package/dist/esm/{createCustomEvent-b8bbdf5e.js → createCustomEvent-3fcc948a.js} +2 -1
  63. package/dist/esm/handleFetch-37cea185.js +315 -0
  64. package/dist/esm/index.js +56 -17
  65. package/dist/esm/loader.js +1 -1
  66. package/dist/esm/{paypal-905325d0.js → paypal-ee310945.js} +2 -2
  67. package/dist/esm/zonos-address_8.entry.js +2 -2
  68. package/dist/esm/{zonos-cart-items_12.entry.js → zonos-badge_13.entry.js} +40 -9
  69. package/dist/esm/zonos-checkout.entry.js +61 -160
  70. package/dist/esm/zonos-controller.entry.js +8 -6
  71. package/dist/esm/zonos-country-flag.entry.js +2 -2
  72. package/dist/esm/zonos-country-select_4.entry.js +2 -2
  73. package/dist/esm/zonos-elements.js +1 -1
  74. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  75. package/dist/esm/zonos-hello.entry.js +2 -2
  76. package/dist/esm/zonos-language-select_2.entry.js +2 -2
  77. package/dist/esm/zonos-notification_3.entry.js +3 -3
  78. package/dist/esm/zonos-tooltip.entry.js +23 -0
  79. package/dist/esm-es5/CheckoutConfig-57350b28.js +1 -0
  80. package/dist/esm-es5/cart-45d2861f.js +1 -0
  81. package/dist/esm-es5/{createCustomEvent-b8bbdf5e.js → createCustomEvent-3fcc948a.js} +1 -1
  82. package/dist/esm-es5/handleFetch-37cea185.js +1 -0
  83. package/dist/esm-es5/index.js +1 -1
  84. package/dist/esm-es5/loader.js +1 -1
  85. package/dist/esm-es5/{paypal-905325d0.js → paypal-ee310945.js} +1 -1
  86. package/dist/esm-es5/zonos-address_8.entry.js +1 -1
  87. package/dist/esm-es5/zonos-badge_13.entry.js +1 -0
  88. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  89. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  90. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  91. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  92. package/dist/esm-es5/zonos-elements.js +1 -1
  93. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  94. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  95. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  96. package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
  97. package/dist/esm-es5/zonos-tooltip.entry.js +1 -0
  98. package/dist/scripts/index.d.ts +74 -87
  99. package/dist/scripts/index.js +1 -1
  100. package/dist/scripts/loadZonos.js +1 -1
  101. package/dist/scripts/zonos.js +1 -1
  102. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +0 -2
  103. package/dist/types/components/store/checkout/cart.d.ts +13 -3
  104. package/dist/types/components/store/checkout/stripe.d.ts +3 -1
  105. package/dist/types/components/store/translationStore/strings.arabic.d.ts +3 -3
  106. package/dist/types/components/store/translationStore/strings.base.d.ts +3 -3
  107. package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -3
  108. package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -3
  109. package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -3
  110. package/dist/types/components/store/translationStore/strings.french.d.ts +3 -3
  111. package/dist/types/components/store/translationStore/strings.german.d.ts +3 -3
  112. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -3
  113. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -3
  114. package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -3
  115. package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -3
  116. package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -3
  117. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -3
  118. package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -3
  119. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -3
  120. package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -3
  121. package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -3
  122. package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -3
  123. package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -3
  124. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -3
  125. package/dist/types/components/store/translationStore.d.ts +1 -1
  126. package/dist/types/components/utils/api/buildCartItemsByTempCart.d.ts +8 -3
  127. package/dist/types/components/utils/api/calculateLandedCostNormalized.d.ts +2 -0
  128. package/dist/types/components/utils/api/cartCalculateLandedCost.d.ts +5 -0
  129. package/dist/types/components/utils/api/prepCalculateLandedCost.d.ts +5 -1
  130. package/dist/types/components/utils/checkout/getIsTestMode.d.ts +1 -1
  131. package/dist/types/scripts/_getNextFallbackUrl.d.ts +1 -0
  132. package/dist/types/scripts/_getTempCartById.d.ts +8 -0
  133. package/dist/types/scripts/_zonosBase.d.ts +15 -12
  134. package/dist/types/scripts/cart/_getCartIdFromParam.d.ts +4 -0
  135. package/dist/types/scripts/cart/_setupCartData.d.ts +7 -0
  136. package/dist/types/types/checkout/CheckoutConfig.d.ts +18 -3
  137. package/dist/types/types/checkout/api/CalculateLandedCostRequest.d.ts +42 -1
  138. package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +37 -0
  139. package/dist/types/types/generated/graphql.customer.types.d.ts +249 -2
  140. package/dist/types/types/generated/graphql.customer.types.ts +251 -3
  141. package/dist/types/utils/formattedCloudflareApiUrl.d.ts +2 -2
  142. package/dist/zonos-elements/index.esm.js +1 -1
  143. package/dist/zonos-elements/p-01f0b13d.entry.js +1 -0
  144. package/dist/zonos-elements/p-042c466d.system.entry.js +1 -0
  145. package/dist/zonos-elements/p-10cb0064.entry.js +1 -0
  146. package/dist/zonos-elements/p-217e1aa1.system.entry.js +1 -0
  147. package/dist/zonos-elements/{p-5e56828a.entry.js → p-259ccf8d.entry.js} +1 -1
  148. package/dist/zonos-elements/p-2a47d2cc.system.entry.js +1 -0
  149. package/dist/zonos-elements/{p-ffd76226.entry.js → p-31eb835c.entry.js} +1 -1
  150. package/dist/zonos-elements/{p-58d9803d.entry.js → p-36360905.entry.js} +1 -1
  151. package/dist/zonos-elements/{p-1828a4ff.system.entry.js → p-3703b814.system.entry.js} +1 -1
  152. package/dist/zonos-elements/p-4146feec.js +1 -0
  153. package/dist/zonos-elements/p-446c8f02.system.entry.js +1 -0
  154. package/dist/zonos-elements/{p-2c323311.system.js → p-5590f90c.system.js} +1 -1
  155. package/dist/zonos-elements/p-588396df.js +1 -0
  156. package/dist/zonos-elements/{p-aa5d669b.js → p-6e59c6e4.js} +2 -2
  157. package/dist/zonos-elements/p-6eedc3f8.entry.js +1 -0
  158. package/dist/zonos-elements/p-747eed39.entry.js +1 -0
  159. package/dist/zonos-elements/{p-00100b17.system.entry.js → p-8228e87c.system.entry.js} +1 -1
  160. package/dist/zonos-elements/p-827868e6.entry.js +1 -0
  161. package/dist/zonos-elements/{p-cc7a4fca.entry.js → p-88005b94.entry.js} +1 -1
  162. package/dist/zonos-elements/p-895fdefb.js +1 -0
  163. package/dist/zonos-elements/p-8f7773b0.system.js +1 -0
  164. package/dist/zonos-elements/{p-9a0401fd.entry.js → p-8fa49d94.entry.js} +1 -1
  165. package/dist/zonos-elements/p-a74a7afa.system.js +1 -0
  166. package/dist/zonos-elements/{p-8473f99a.system.entry.js → p-b842b96a.system.entry.js} +1 -1
  167. package/dist/zonos-elements/{p-9e976332.entry.js → p-bb186075.entry.js} +1 -1
  168. package/dist/zonos-elements/{p-b1a8b874.system.entry.js → p-c008648a.system.entry.js} +1 -1
  169. package/dist/zonos-elements/p-c22bac78.system.js +1 -0
  170. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  171. package/dist/zonos-elements/{p-6b42fa1b.system.entry.js → p-cd4ad1be.system.entry.js} +1 -1
  172. package/dist/zonos-elements/{p-59e85369.system.entry.js → p-d62e6bb0.system.entry.js} +1 -1
  173. package/dist/zonos-elements/{p-496e040f.system.entry.js → p-dc12f30a.system.entry.js} +1 -1
  174. package/dist/zonos-elements/p-eb2aedd0.js +1 -0
  175. package/dist/zonos-elements/{p-c89859cf.system.js → p-f124e459.system.js} +2 -2
  176. package/dist/zonos-elements/p-f87a635b.system.js +1 -0
  177. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  178. package/package.json +1 -1
  179. package/dist/cjs/logError-4e2f2020.js +0 -58
  180. package/dist/cjs/zonos-badge_2.cjs.entry.js +0 -57
  181. package/dist/collection/components/utils/api/tempCartItem/getAttributes.js +0 -66
  182. package/dist/collection/components/utils/api/tempCartItem/getMeasurements.js +0 -58
  183. package/dist/esm/logError-c456c092.js +0 -55
  184. package/dist/esm/zonos-badge_2.entry.js +0 -52
  185. package/dist/esm-es5/cart-51529af2.js +0 -1
  186. package/dist/esm-es5/logError-c456c092.js +0 -1
  187. package/dist/esm-es5/zonos-badge_2.entry.js +0 -1
  188. package/dist/esm-es5/zonos-cart-items_12.entry.js +0 -1
  189. package/dist/types/components/utils/api/tempCartItem/getAttributes.d.ts +0 -11
  190. package/dist/types/components/utils/api/tempCartItem/getMeasurements.d.ts +0 -7
  191. package/dist/types/types/checkout/api/TempCart.d.ts +0 -80
  192. package/dist/zonos-elements/p-101c41bf.entry.js +0 -1
  193. package/dist/zonos-elements/p-3c4eec63.system.entry.js +0 -1
  194. package/dist/zonos-elements/p-47945026.system.entry.js +0 -1
  195. package/dist/zonos-elements/p-47c72c50.system.entry.js +0 -1
  196. package/dist/zonos-elements/p-4e77ed65.system.entry.js +0 -1
  197. package/dist/zonos-elements/p-6013e370.entry.js +0 -1
  198. package/dist/zonos-elements/p-63db40b9.system.js +0 -1
  199. package/dist/zonos-elements/p-8b8ef484.entry.js +0 -1
  200. package/dist/zonos-elements/p-b57d24f2.entry.js +0 -1
  201. package/dist/zonos-elements/p-ba0289f9.entry.js +0 -1
  202. package/dist/zonos-elements/p-c8a3303b.js +0 -1
  203. package/dist/zonos-elements/p-d413cd13.js +0 -1
  204. package/dist/zonos-elements/p-e758ec31.system.js +0 -1
  205. package/dist/zonos-elements/p-eaa335e1.js +0 -1
  206. package/dist/zonos-elements/p-fcfde531.system.js +0 -1
  207. /package/dist/collection/types/checkout/api/{TempCart.js → NormalizedTempCart.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { c as createStore, z as zonosStore } from './zonosStore-473f4654.js';
2
- import { l as log, a as logError } from './logError-c456c092.js';
2
+ import { h as handleFetch, a as logError, l as log, f as fallbackApiList, j as jsonParse } from './handleFetch-37cea185.js';
3
3
  import { i as isDarkColor } from './isDarkColor-c927f77d.js';
4
4
  import { g as getBorderRadius } from './getBorderRadius-23398fc6.js';
5
5
 
@@ -73,6 +73,9 @@ const stringsArabic = {
73
73
  'Delivery options': {
74
74
  value: 'خيارات التوصيل',
75
75
  },
76
+ Discounts: {
77
+ value: 'خصومات',
78
+ },
76
79
  "Don't close": {
77
80
  value: 'لا تغلق',
78
81
  },
@@ -151,9 +154,6 @@ const stringsArabic = {
151
154
  'Nothing due at the door': {
152
155
  value: 'لا شيء مستحق عند الباب',
153
156
  },
154
- 'Order is over the de minimis threshold for both duty and tax': {
155
- value: 'الطلبية أعلى من الحد الأدنى لكل من الرسوم والضرائب',
156
- },
157
157
  'Order total': {
158
158
  value: 'إجمالي الطلبية',
159
159
  },
@@ -427,6 +427,9 @@ const stringsBase = {
427
427
  'Delivery options': {
428
428
  value: 'Delivery options',
429
429
  },
430
+ Discounts: {
431
+ value: 'Discounts',
432
+ },
430
433
  "Don't close": {
431
434
  value: "Don't close",
432
435
  },
@@ -505,9 +508,6 @@ const stringsBase = {
505
508
  'Nothing due at the door': {
506
509
  value: 'Nothing due at the door',
507
510
  },
508
- 'Order is over the de minimis threshold for both duty and tax': {
509
- value: 'Order is over the de minimis threshold for both duty and tax',
510
- },
511
511
  'Order total': {
512
512
  value: 'Order total',
513
513
  },
@@ -781,6 +781,9 @@ const stringsChinese = {
781
781
  'Delivery options': {
782
782
  value: '送货选项',
783
783
  },
784
+ Discounts: {
785
+ value: '折扣',
786
+ },
784
787
  "Don't close": {
785
788
  value: '不要关',
786
789
  },
@@ -859,9 +862,6 @@ const stringsChinese = {
859
862
  'Nothing due at the door': {
860
863
  value: '门口无需付款',
861
864
  },
862
- 'Order is over the de minimis threshold for both duty and tax': {
863
- value: '订单超过关税和税款的最低征税门槛',
864
- },
865
865
  'Order total': {
866
866
  value: '订单总计',
867
867
  },
@@ -1135,6 +1135,9 @@ const stringsDanish = {
1135
1135
  'Delivery options': {
1136
1136
  value: 'Leveringsmuligheder',
1137
1137
  },
1138
+ Discounts: {
1139
+ value: 'Rabat',
1140
+ },
1138
1141
  "Don't close": {
1139
1142
  value: 'Luk ikke',
1140
1143
  },
@@ -1213,9 +1216,6 @@ const stringsDanish = {
1213
1216
  'Nothing due at the door': {
1214
1217
  value: 'Intet at betale ved døren',
1215
1218
  },
1216
- 'Order is over the de minimis threshold for both duty and tax': {
1217
- value: 'Ordre er over de minimis-grænsen for både told og skat',
1218
- },
1219
1219
  'Order total': {
1220
1220
  value: 'Ordresum',
1221
1221
  },
@@ -1489,6 +1489,9 @@ const stringsDutch = {
1489
1489
  'Delivery options': {
1490
1490
  value: 'Bezorgopties',
1491
1491
  },
1492
+ Discounts: {
1493
+ value: 'Kortingen',
1494
+ },
1492
1495
  "Don't close": {
1493
1496
  value: 'Niet sluiten',
1494
1497
  },
@@ -1567,9 +1570,6 @@ const stringsDutch = {
1567
1570
  'Nothing due at the door': {
1568
1571
  value: 'Niets te betalen aan de deur',
1569
1572
  },
1570
- 'Order is over the de minimis threshold for both duty and tax': {
1571
- value: 'Bestelling overschrijdt de minimale drempel voor zowel heffing als belasting',
1572
- },
1573
1573
  'Order total': {
1574
1574
  value: 'Totaal bestelling',
1575
1575
  },
@@ -1843,6 +1843,9 @@ const stringsFrench = {
1843
1843
  'Delivery options': {
1844
1844
  value: 'Options de livraison',
1845
1845
  },
1846
+ Discounts: {
1847
+ value: 'Réductions',
1848
+ },
1846
1849
  "Don't close": {
1847
1850
  value: 'Ne pas fermer',
1848
1851
  },
@@ -1921,9 +1924,6 @@ const stringsFrench = {
1921
1924
  'Nothing due at the door': {
1922
1925
  value: 'Rien à payer à la porte',
1923
1926
  },
1924
- 'Order is over the de minimis threshold for both duty and tax': {
1925
- value: 'La commande dépasse le seuil de minimis pour les droits et les taxes',
1926
- },
1927
1927
  'Order total': {
1928
1928
  value: 'Total de la commande',
1929
1929
  },
@@ -2197,6 +2197,9 @@ const stringsGerman = {
2197
2197
  'Delivery options': {
2198
2198
  value: 'Lieferoptionen',
2199
2199
  },
2200
+ Discounts: {
2201
+ value: 'Rabatte',
2202
+ },
2200
2203
  "Don't close": {
2201
2204
  value: 'Nicht schließen',
2202
2205
  },
@@ -2275,9 +2278,6 @@ const stringsGerman = {
2275
2278
  'Nothing due at the door': {
2276
2279
  value: 'An der Tür nichts zu bezahlen',
2277
2280
  },
2278
- 'Order is over the de minimis threshold for both duty and tax': {
2279
- value: 'Bestellung überschreitet Mindestgrenze sowohl für Zoll als auch Steuer',
2280
- },
2281
2281
  'Order total': {
2282
2282
  value: 'Bestellsumme',
2283
2283
  },
@@ -2551,6 +2551,9 @@ const stringsHebrew = {
2551
2551
  'Delivery options': {
2552
2552
  value: 'אפשרויות משלוח',
2553
2553
  },
2554
+ Discounts: {
2555
+ value: 'הנחות',
2556
+ },
2554
2557
  "Don't close": {
2555
2558
  value: 'אל תסגור',
2556
2559
  },
@@ -2629,9 +2632,6 @@ const stringsHebrew = {
2629
2632
  'Nothing due at the door': {
2630
2633
  value: 'אין כלום לשלם בדלת',
2631
2634
  },
2632
- 'Order is over the de minimis threshold for both duty and tax': {
2633
- value: 'ההזמנה חורגת מסף המינימום גם למכס וגם למס',
2634
- },
2635
2635
  'Order total': {
2636
2636
  value: 'סה"כ ההזמנה',
2637
2637
  },
@@ -2905,6 +2905,9 @@ const stringsIndonesian = {
2905
2905
  'Delivery options': {
2906
2906
  value: 'Opsi pengiriman',
2907
2907
  },
2908
+ Discounts: {
2909
+ value: 'Diskon',
2910
+ },
2908
2911
  "Don't close": {
2909
2912
  value: 'Jangan tutup',
2910
2913
  },
@@ -2983,9 +2986,6 @@ const stringsIndonesian = {
2983
2986
  'Nothing due at the door': {
2984
2987
  value: 'Tidak ada yang harus dibayar di pintu',
2985
2988
  },
2986
- 'Order is over the de minimis threshold for both duty and tax': {
2987
- value: 'Pesanan melebihi ambang batas de minimis untuk bea masuk dan pajak',
2988
- },
2989
2989
  'Order total': {
2990
2990
  value: 'Total pesanan',
2991
2991
  },
@@ -3259,6 +3259,9 @@ const stringsItalian = {
3259
3259
  'Delivery options': {
3260
3260
  value: 'Opzioni di consegna',
3261
3261
  },
3262
+ Discounts: {
3263
+ value: 'Sconti',
3264
+ },
3262
3265
  "Don't close": {
3263
3266
  value: 'Non chiudere',
3264
3267
  },
@@ -3337,9 +3340,6 @@ const stringsItalian = {
3337
3340
  'Nothing due at the door': {
3338
3341
  value: 'Nulla da pagare alla porta',
3339
3342
  },
3340
- 'Order is over the de minimis threshold for both duty and tax': {
3341
- value: "L'ordine supera la soglia di minimis sia per i dazi che per le tasse",
3342
- },
3343
3343
  'Order total': {
3344
3344
  value: 'Totale ordine',
3345
3345
  },
@@ -3613,6 +3613,9 @@ const stringsJapanese = {
3613
3613
  'Delivery options': {
3614
3614
  value: '配送オプション',
3615
3615
  },
3616
+ Discounts: {
3617
+ value: '割引',
3618
+ },
3616
3619
  "Don't close": {
3617
3620
  value: '閉めないでください',
3618
3621
  },
@@ -3691,9 +3694,6 @@ const stringsJapanese = {
3691
3694
  'Nothing due at the door': {
3692
3695
  value: 'ドアでの支払いはありません',
3693
3696
  },
3694
- 'Order is over the de minimis threshold for both duty and tax': {
3695
- value: '注文が関税と税金のデミニマス閾値を超えています',
3696
- },
3697
3697
  'Order total': {
3698
3698
  value: 'ご注文合計',
3699
3699
  },
@@ -3967,6 +3967,9 @@ const stringsKorean = {
3967
3967
  'Delivery options': {
3968
3968
  value: '배송 옵션',
3969
3969
  },
3970
+ Discounts: {
3971
+ value: '할인',
3972
+ },
3970
3973
  "Don't close": {
3971
3974
  value: '닫지 마세요',
3972
3975
  },
@@ -4045,9 +4048,6 @@ const stringsKorean = {
4045
4048
  'Nothing due at the door': {
4046
4049
  value: '문 앞에 납부할 것이 없습니다',
4047
4050
  },
4048
- 'Order is over the de minimis threshold for both duty and tax': {
4049
- value: '주문 금액이 관세와 세금의 최저 임계값을 초과합니다',
4050
- },
4051
4051
  'Order total': {
4052
4052
  value: '주문 총액',
4053
4053
  },
@@ -4321,6 +4321,9 @@ const stringsNorwegian = {
4321
4321
  'Delivery options': {
4322
4322
  value: 'Leveringsalternativer',
4323
4323
  },
4324
+ Discounts: {
4325
+ value: 'Rabatter',
4326
+ },
4324
4327
  "Don't close": {
4325
4328
  value: 'Ikke lukk',
4326
4329
  },
@@ -4399,9 +4402,6 @@ const stringsNorwegian = {
4399
4402
  'Nothing due at the door': {
4400
4403
  value: 'Ingenting å betale ved døren',
4401
4404
  },
4402
- 'Order is over the de minimis threshold for both duty and tax': {
4403
- value: 'Bestillingen er over minstegrensen for både avgift og skatt',
4404
- },
4405
4405
  'Order total': {
4406
4406
  value: 'Totalt beløp',
4407
4407
  },
@@ -4675,6 +4675,9 @@ const stringsPolish = {
4675
4675
  'Delivery options': {
4676
4676
  value: 'Opcje dostawy',
4677
4677
  },
4678
+ Discounts: {
4679
+ value: 'Zniżki',
4680
+ },
4678
4681
  "Don't close": {
4679
4682
  value: 'Nie zamykaj',
4680
4683
  },
@@ -4753,9 +4756,6 @@ const stringsPolish = {
4753
4756
  'Nothing due at the door': {
4754
4757
  value: 'Nic do zapłacenia przy drzwiach',
4755
4758
  },
4756
- 'Order is over the de minimis threshold for both duty and tax': {
4757
- value: 'Zamówienie przekracza próg minimalny zarówno dla cła, jak i podatku',
4758
- },
4759
4759
  'Order total': {
4760
4760
  value: 'Łączna kwota zamówienia',
4761
4761
  },
@@ -5029,6 +5029,9 @@ const stringsPortuguese = {
5029
5029
  'Delivery options': {
5030
5030
  value: 'Opções de entrega',
5031
5031
  },
5032
+ Discounts: {
5033
+ value: 'Descontos',
5034
+ },
5032
5035
  "Don't close": {
5033
5036
  value: 'Não fechar',
5034
5037
  },
@@ -5107,9 +5110,6 @@ const stringsPortuguese = {
5107
5110
  'Nothing due at the door': {
5108
5111
  value: 'Nada a pagar na porta',
5109
5112
  },
5110
- 'Order is over the de minimis threshold for both duty and tax': {
5111
- value: 'O pedido ultrapassa o limite de isenção tanto para impostos quanto para taxas',
5112
- },
5113
5113
  'Order total': {
5114
5114
  value: 'Total do pedido',
5115
5115
  },
@@ -5383,6 +5383,9 @@ const stringsRussian = {
5383
5383
  'Delivery options': {
5384
5384
  value: 'Варианты доставки',
5385
5385
  },
5386
+ Discounts: {
5387
+ value: 'Скидки',
5388
+ },
5386
5389
  "Don't close": {
5387
5390
  value: 'Не закрывайте',
5388
5391
  },
@@ -5461,9 +5464,6 @@ const stringsRussian = {
5461
5464
  'Nothing due at the door': {
5462
5465
  value: 'На двери ничего не должно',
5463
5466
  },
5464
- 'Order is over the de minimis threshold for both duty and tax': {
5465
- value: 'Заказ превышает минимальный порог как для пошлины, так и для налога',
5466
- },
5467
5467
  'Order total': {
5468
5468
  value: 'Итого',
5469
5469
  },
@@ -5737,6 +5737,9 @@ const stringsSpanish = {
5737
5737
  'Delivery options': {
5738
5738
  value: 'Opciones de entrega',
5739
5739
  },
5740
+ Discounts: {
5741
+ value: 'Descuentos',
5742
+ },
5740
5743
  "Don't close": {
5741
5744
  value: 'No cerrar',
5742
5745
  },
@@ -5815,9 +5818,6 @@ const stringsSpanish = {
5815
5818
  'Nothing due at the door': {
5816
5819
  value: 'Nada debido en la puerta',
5817
5820
  },
5818
- 'Order is over the de minimis threshold for both duty and tax': {
5819
- value: 'El pedido supera el umbral mínimo tanto para impuestos como para aranceles',
5820
- },
5821
5821
  'Order total': {
5822
5822
  value: 'Total del pedido',
5823
5823
  },
@@ -6091,6 +6091,9 @@ const stringsSwedish = {
6091
6091
  'Delivery options': {
6092
6092
  value: 'Leveransalternativ',
6093
6093
  },
6094
+ Discounts: {
6095
+ value: 'Rabatter',
6096
+ },
6094
6097
  "Don't close": {
6095
6098
  value: 'Stäng inte',
6096
6099
  },
@@ -6169,9 +6172,6 @@ const stringsSwedish = {
6169
6172
  'Nothing due at the door': {
6170
6173
  value: 'Ingenting att betala vid dörren',
6171
6174
  },
6172
- 'Order is over the de minimis threshold for both duty and tax': {
6173
- value: 'Beställningen överstiger minimibeloppet för både tull och skatt',
6174
- },
6175
6175
  'Order total': {
6176
6176
  value: 'Totalt belopp för beställningen',
6177
6177
  },
@@ -6445,6 +6445,9 @@ const stringsTurkish = {
6445
6445
  'Delivery options': {
6446
6446
  value: 'Teslimat seçenekleri',
6447
6447
  },
6448
+ Discounts: {
6449
+ value: 'İndirimler',
6450
+ },
6448
6451
  "Don't close": {
6449
6452
  value: 'Kapatma',
6450
6453
  },
@@ -6523,9 +6526,6 @@ const stringsTurkish = {
6523
6526
  'Nothing due at the door': {
6524
6527
  value: 'Kapıda ödenecek bir şey yok',
6525
6528
  },
6526
- 'Order is over the de minimis threshold for both duty and tax': {
6527
- value: 'Sipariş hem gümrük hem vergi için minimum sınırın üzerinde',
6528
- },
6529
6529
  'Order total': {
6530
6530
  value: 'Sipariş toplamı',
6531
6531
  },
@@ -6799,6 +6799,9 @@ const stringsVietnamese = {
6799
6799
  'Delivery options': {
6800
6800
  value: 'Tùy chọn giao hàng',
6801
6801
  },
6802
+ Discounts: {
6803
+ value: 'Giảm giá',
6804
+ },
6802
6805
  "Don't close": {
6803
6806
  value: 'Đừng đóng',
6804
6807
  },
@@ -6877,9 +6880,6 @@ const stringsVietnamese = {
6877
6880
  'Nothing due at the door': {
6878
6881
  value: 'Không có gì phải trả tại cửa',
6879
6882
  },
6880
- 'Order is over the de minimis threshold for both duty and tax': {
6881
- value: 'Đơn hàng vượt ngưỡng miễn thuế cho cả thuế nhập khẩu và thuế',
6882
- },
6883
6883
  'Order total': {
6884
6884
  value: 'Tổng đơn hàng',
6885
6885
  },
@@ -7171,266 +7171,6 @@ const translate = (...[key, replacement]) => {
7171
7171
  return ((_b = translationStore.translatedChunks[key]) === null || _b === void 0 ? void 0 : _b.value) || key;
7172
7172
  };
7173
7173
 
7174
- const fallbackApiType = ['cloudflare', 'vercel'];
7175
- const MAIN_BASE_API_TYPE = fallbackApiType[0];
7176
- const fallbackApiList = {
7177
- cloudflare: "https://route.elements.zonos.com",
7178
- vercel: "https://v1.route.js.zonos.com",
7179
- };
7180
- const MAIN_BASE_API = fallbackApiList[MAIN_BASE_API_TYPE];
7181
- /**
7182
- * Next available fallback api type
7183
- */
7184
- const getNextFallbackApiType = (currentApiType = MAIN_BASE_API_TYPE) => {
7185
- const currentIndex = fallbackApiType.indexOf(currentApiType);
7186
- const nextFallbackApiType = fallbackApiType[currentIndex + 1];
7187
- if (!nextFallbackApiType) {
7188
- return null;
7189
- }
7190
- return nextFallbackApiType;
7191
- };
7192
-
7193
- const jsonParse = (_data) => {
7194
- if (typeof _data === 'string') {
7195
- try {
7196
- // eslint-disable-next-line no-restricted-syntax
7197
- const json = JSON.parse(_data);
7198
- return json;
7199
- }
7200
- catch (_error) {
7201
- return null;
7202
- }
7203
- }
7204
- return null;
7205
- };
7206
-
7207
- /**
7208
- * This is the time in milliseconds after release time that we will start sending error logs to the new API
7209
- * @default 1 hour
7210
- */
7211
- const postReleaseReportingDuration = 1 * 3600 * 1000; // 1 hour
7212
- const sendErrorLog = async ({ endpoint, errors, metadata, shouldPostReleaseErrorReporting, }) => {
7213
- if (shouldPostReleaseErrorReporting) {
7214
- // We only want to report errors that happened if current time is less than 2 hours after release time
7215
- const releaseTime = Number(window.Zonos.releaseDate);
7216
- const currentTime = new Date().getTime();
7217
- if (currentTime - releaseTime > postReleaseReportingDuration) {
7218
- return;
7219
- }
7220
- }
7221
- const userAgentData = 'userAgentData' in window.navigator
7222
- ? // userAgentData is not yet supported in all browsers
7223
- window.navigator.userAgentData
7224
- : null;
7225
- const errorObject = {
7226
- endpoint,
7227
- errors,
7228
- metadata: Object.assign({ href: window.location.href, userAgent: userAgentData && userAgentData.brands.length > 0
7229
- ? userAgentData
7230
- : window.navigator.userAgent }, metadata),
7231
- };
7232
- try {
7233
- // use native fetch because in handleFetch also calls sendErrorLog and it will possibly cause circular dependencies issue
7234
- void fetch(`${MAIN_BASE_API}/api/zonos-elements/log-error`, {
7235
- body: JSON.stringify(errorObject),
7236
- method: 'POST',
7237
- });
7238
- }
7239
- catch (_err) {
7240
- const nextFallbackApi = getNextFallbackApiType();
7241
- if (!nextFallbackApi) {
7242
- return;
7243
- }
7244
- // request to the fallback API if the first one fails
7245
- void fetch(`${fallbackApiList[nextFallbackApi]}/api/zonos-elements/log-error`, {
7246
- body: JSON.stringify(errorObject),
7247
- method: 'POST',
7248
- });
7249
- }
7250
- };
7251
-
7252
- var __rest = (undefined && undefined.__rest) || function (s, e) {
7253
- var t = {};
7254
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
7255
- t[p] = s[p];
7256
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7257
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7258
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
7259
- t[p[i]] = s[p[i]];
7260
- }
7261
- return t;
7262
- };
7263
- const getResponseBody = async ({ response, shouldLog = true, shouldThrow = false, }) => {
7264
- try {
7265
- const json = await response.json();
7266
- return json;
7267
- }
7268
- catch (e) {
7269
- if (shouldThrow) {
7270
- throw e;
7271
- }
7272
- if (shouldLog) {
7273
- // eslint-disable-next-line
7274
- console.error(e);
7275
- }
7276
- return null;
7277
- }
7278
- };
7279
- const encodeString = (text) => {
7280
- try {
7281
- // encode the string, remove the "=" at the end of the encoded string
7282
- const encodedString = btoa(text).replace(/=/g, '');
7283
- return encodedString;
7284
- }
7285
- catch (error) {
7286
- // return the reverse string if the encoding failed
7287
- return text
7288
- .replace(/[^A-Za-z0-9]/g, '')
7289
- .split('')
7290
- .reverse()
7291
- .join('');
7292
- }
7293
- };
7294
- const handleRequest = async ({ basePathType, options, path, }) => {
7295
- let response;
7296
- // fallback to the main base API if the passed in base path is not available
7297
- const baseUrl = fallbackApiList[basePathType] || MAIN_BASE_API_TYPE;
7298
- const url = baseUrl + path;
7299
- // adding random encoded token to the url so that the request will be cached differently for each store
7300
- const modifiedUrl = new URL(url);
7301
- modifiedUrl.searchParams.set('zToken', encodeString(window.location.hostname));
7302
- try {
7303
- response = await fetch(modifiedUrl.toString(), options);
7304
- }
7305
- catch (e) {
7306
- if (e instanceof Error) {
7307
- return {
7308
- baseUrl,
7309
- errors: [{ message: e.message, type: 'unknown' }],
7310
- json: null,
7311
- response: null,
7312
- zonosMode: null,
7313
- };
7314
- }
7315
- const message = 'Fail to fetch';
7316
- return {
7317
- baseUrl,
7318
- errors: [{ message, type: 'unknown' }],
7319
- json: null,
7320
- response: null,
7321
- zonosMode: null,
7322
- };
7323
- }
7324
- const zonosMode = response.headers.get('Zonos-Mode');
7325
- const usingZonosPreview = window.Zonos.zonosQaUrl;
7326
- // We only want to alert once if the user is in preview mode and it's also using production environment
7327
- if (!window.Zonos.modeAlerted && zonosMode && usingZonosPreview) {
7328
- window.Zonos.modeAlerted = true;
7329
- }
7330
- if (response.ok) {
7331
- const data = await getResponseBody({ response });
7332
- return {
7333
- baseUrl,
7334
- errors: [],
7335
- json: data,
7336
- response,
7337
- zonosMode,
7338
- };
7339
- }
7340
- const status = response.status.toString();
7341
- try {
7342
- const data = await getResponseBody({
7343
- response,
7344
- shouldThrow: true,
7345
- });
7346
- const message = JSON.stringify(data);
7347
- return {
7348
- baseUrl,
7349
- errors: [{ message, type: status }],
7350
- json: null,
7351
- response,
7352
- zonosMode,
7353
- };
7354
- }
7355
- catch (e) {
7356
- const message = 'Unknown error';
7357
- return {
7358
- baseUrl,
7359
- errors: [{ message: `${status}: ${message}`, type: status }],
7360
- json: null,
7361
- response: null,
7362
- zonosMode,
7363
- };
7364
- }
7365
- };
7366
- const handleRequestWithFallback = async ({ basePathType: _basePathType, options, path, }) => {
7367
- var _a, _b;
7368
- // use vercel API if the path is `/api/bigcommerce`
7369
- const isBigcommerceEndpoint = path.startsWith('/api/bigcommerce');
7370
- const basePathType = isBigcommerceEndpoint
7371
- ? 'vercel'
7372
- : _basePathType;
7373
- const _c = await handleRequest({
7374
- basePathType,
7375
- options,
7376
- path,
7377
- }), { errors, response } = _c, rest = __rest(_c, ["errors", "response"]);
7378
- const nextFallbackApiType = getNextFallbackApiType(basePathType);
7379
- const unknownError = errors.find(({ type }) => type === 'unknown');
7380
- const isUnknownError = !!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404;
7381
- const shouldCallFallback =
7382
- // If next fallback is available, and the error is unknown (fail to fetch) or 404
7383
- nextFallbackApiType && isUnknownError;
7384
- // Should log the error if it's unknown error
7385
- if (isUnknownError) {
7386
- void sendErrorLog({
7387
- endpoint: fallbackApiList[basePathType] + path,
7388
- errors: errors.map(({ message }) => message),
7389
- metadata: {
7390
- currentBasePath: basePathType,
7391
- nextFallbackApiType,
7392
- requestHeaders: options === null || options === void 0 ? void 0 : options.headers,
7393
- requestPayload: jsonParse((_a = options === null || options === void 0 ? void 0 : options.body) === null || _a === void 0 ? void 0 : _a.toString()) || ((_b = options === null || options === void 0 ? void 0 : options.body) === null || _b === void 0 ? void 0 : _b.toString()),
7394
- status: response === null || response === void 0 ? void 0 : response.status,
7395
- statusText: response === null || response === void 0 ? void 0 : response.statusText,
7396
- },
7397
- // When the error is unknown, error reporting should be enabled for period of time after release, so we can monitor the error.
7398
- shouldPostReleaseErrorReporting: true,
7399
- });
7400
- }
7401
- if (shouldCallFallback) {
7402
- log(`=== "${path}" failed to fetch, trying next fallback ${nextFallbackApiType}`);
7403
- return handleRequestWithFallback({
7404
- basePathType: nextFallbackApiType,
7405
- options,
7406
- path,
7407
- });
7408
- }
7409
- // No more fallbacks, just return the result
7410
- return Object.assign({ errors, response }, rest);
7411
- };
7412
- /**
7413
- * Fetch request and will request to fallback API when the first one fails
7414
- * @param path Path name of the request (e.g. /api/something/com).
7415
- * @param _opts fetch options
7416
- */
7417
- const handleFetch = async (path, _opts) => {
7418
- const opts = __rest(_opts || {}, []);
7419
- const body = opts.body ? JSON.stringify(opts.body) : undefined;
7420
- const method = opts.method || 'GET';
7421
- // headers content type
7422
- const headers = Object.assign({ 'Content-Type': 'application/json', 'Zonos-Is-BigCommerce': window.Zonos.isBigCommerce.toString(), 'Zonos-Referer': window.location.hostname, 'Zonos-Version': window.Zonos.version, credentialtoken: window.Zonos.zonosApiKey || 'Empty credential token from zonos-elements' }, opts.headers);
7423
- const options = Object.assign(Object.assign({}, opts), { body: method === 'GET' ? undefined : body, headers,
7424
- method });
7425
- // This is for testing fallback API, set fallback API type to start with
7426
- const useFallbackApi = new URLSearchParams(window.location.search).get('useFallbackApi');
7427
- return handleRequestWithFallback({
7428
- basePathType: useFallbackApi || MAIN_BASE_API_TYPE,
7429
- options,
7430
- path,
7431
- });
7432
- };
7433
-
7434
7174
  const getCountries = async () => {
7435
7175
  try {
7436
7176
  const { errors, json } = await handleFetch('/api/zonos-elements/get-countries', {
@@ -8043,6 +7783,71 @@ const getTranslatedAddress = ({ currentAddress, translatedAddress, }) => {
8043
7783
  state: ((_f = translatedAddress.state) === null || _f === void 0 ? void 0 : _f[state]) || state,
8044
7784
  };
8045
7785
  };
7786
+ /**
7787
+ * Similar to prepCalculateLandedCost except it only uses
7788
+ */
7789
+ const prepCartCalculateLandedCost = (cartId) => {
7790
+ var _a;
7791
+ // maybe we don't need email now for prefetch the landed cost
7792
+ const stripeLinkData = stripeStore.stripeLinkEventData;
7793
+ const stripeAddressData = stripeStore.stripeAddressEventData;
7794
+ const stripeBillingAddressData = stripeStore.stripeShippingSameAsBilling
7795
+ ? stripeStore.stripeAddressEventData
7796
+ : stripeStore.stripeBillingAddressEventData;
7797
+ if (!(stripeAddressData === null || stripeAddressData === void 0 ? void 0 : stripeAddressData.complete) || !(stripeBillingAddressData === null || stripeBillingAddressData === void 0 ? void 0 : stripeBillingAddressData.complete)) {
7798
+ throw new Error('Missing stripe address data');
7799
+ }
7800
+ // Attempt to get translated address if available
7801
+ const translatedShippingAddress = getTranslatedAddress({
7802
+ currentAddress: stripeAddressData,
7803
+ translatedAddress: stripeStore.translatedAddress.address,
7804
+ });
7805
+ const shippingFirstName = translatedShippingAddress.name.split(' ')[0] || '';
7806
+ const shippingLastName = translatedShippingAddress.name.split(' ').splice(1).join(' ') || '';
7807
+ const translatedBillingAddress = getTranslatedAddress({
7808
+ currentAddress: stripeBillingAddressData,
7809
+ translatedAddress: stripeStore.translatedAddress.address,
7810
+ });
7811
+ const billingFirstName = translatedBillingAddress.name.split(' ')[0] || '';
7812
+ const billingLastName = translatedBillingAddress.name.split(' ').splice(1).join(' ') || '';
7813
+ return {
7814
+ billingAddress: {
7815
+ addressLine1: translatedBillingAddress.line1,
7816
+ addressLine2: translatedBillingAddress.line2 || '',
7817
+ city: translatedBillingAddress.city,
7818
+ country: translatedBillingAddress.country,
7819
+ postalCode: translatedBillingAddress.postal_code,
7820
+ state: translatedBillingAddress.state,
7821
+ },
7822
+ billingContact: {
7823
+ // firstName and lastName should be valid now since stripe only mark
7824
+ // the address as complete when both fields are filled.
7825
+ firstName: billingFirstName,
7826
+ lastName: billingLastName,
7827
+ phone: translatedBillingAddress.phone,
7828
+ },
7829
+ // Use the first item's currency code
7830
+ cartCurrencyCode: (_a = cartStore.items[0]) === null || _a === void 0 ? void 0 : _a.currencyCode,
7831
+ cartId,
7832
+ checkoutSessionId: cartStore.checkoutSessionId || '',
7833
+ contact: {
7834
+ email: stripeLinkData === null || stripeLinkData === void 0 ? void 0 : stripeLinkData.value.email,
7835
+ // firstName and lastName should be valid now since stripe only mark
7836
+ // the address as complete when both fields are filled.
7837
+ firstName: shippingFirstName,
7838
+ lastName: shippingLastName,
7839
+ phone: translatedShippingAddress.phone,
7840
+ },
7841
+ shippingAddress: {
7842
+ addressLine1: translatedShippingAddress.line1,
7843
+ addressLine2: translatedShippingAddress.line2,
7844
+ city: translatedShippingAddress.city,
7845
+ country: translatedShippingAddress.country,
7846
+ postalCode: translatedShippingAddress.postal_code,
7847
+ state: translatedShippingAddress.state,
7848
+ },
7849
+ };
7850
+ };
8046
7851
  const prepCalculateLandedCost = () => {
8047
7852
  // maybe we don't need email now for prefetch the landed cost
8048
7853
  const stripeLinkData = stripeStore.stripeLinkEventData;
@@ -8155,6 +7960,50 @@ const calculateLandedCost = async (abortController) => {
8155
7960
  return json;
8156
7961
  };
8157
7962
 
7963
+ const cartCalculateLandedCost = async ({ abortController, cartId, }) => {
7964
+ var _a;
7965
+ // request to get landed cost info
7966
+ const { errors, json } = await handleFetch('/api/zonos-elements/cart-calculate-landed-cost', {
7967
+ body: prepCartCalculateLandedCost(cartId),
7968
+ method: 'POST',
7969
+ signal: abortController === null || abortController === void 0 ? void 0 : abortController.signal,
7970
+ });
7971
+ if (errors.length || !json) {
7972
+ const isAbortedRequest = ((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.message) === 'The user aborted a request.';
7973
+ const errorMessage = isAbortedRequest
7974
+ ? 'The landed cost calculation request was aborted to initiate a new one.'
7975
+ : 'Failed to calculate landed cost';
7976
+ throw new Error(errorMessage);
7977
+ }
7978
+ return json;
7979
+ };
7980
+
7981
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
7982
+ var t = {};
7983
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
7984
+ t[p] = s[p];
7985
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7986
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7987
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
7988
+ t[p[i]] = s[p[i]];
7989
+ }
7990
+ return t;
7991
+ };
7992
+ const calculateLandedCostNormalized = async (abortController) => {
7993
+ const cartId = window.Zonos.cartId;
7994
+ // Calculate landed cost as usual if no cartId is available
7995
+ if (!cartId) {
7996
+ const landedCostResult = await calculateLandedCost(abortController);
7997
+ return landedCostResult;
7998
+ }
7999
+ // Calculate landed cost using cartId
8000
+ const _a = await cartCalculateLandedCost({
8001
+ abortController,
8002
+ cartId,
8003
+ }), { cartWorkflow } = _a, rest = __rest(_a, ["cartWorkflow"]);
8004
+ return Object.assign(Object.assign({}, rest), { itemCreateWorkflow: cartWorkflow.items });
8005
+ };
8006
+
8158
8007
  /**
8159
8008
  * This function generates an object that contains the fields of an address that have invalid characters.
8160
8009
  *
@@ -8495,13 +8344,13 @@ const stripeStorePrefetchLandedCost = async () => {
8495
8344
  stripeStore.fetchingLandedCostAbordController = abortController;
8496
8345
  // Reset cart items to non-restricted state and restricted item list
8497
8346
  cartStoreResetCartItems();
8498
- const { checkoutSessionWorkflow, itemCreateWorkflow, landedCostCalculateWorkflow, shipmentRatingCalculateWorkflow, } = await calculateLandedCost(abortController);
8347
+ const { checkoutSessionWorkflow, itemCreateWorkflow, landedCostCalculateWorkflow, shipmentRatingCalculateWorkflow, } = await calculateLandedCostNormalized(abortController);
8499
8348
  // reset abort controller after we are done
8500
8349
  stripeStore.fetchingLandedCostAbordController = null;
8501
8350
  // update cart store with landed cost info
8502
8351
  cartStore.landedCostData =
8503
8352
  (checkoutSessionWorkflow === null || checkoutSessionWorkflow === void 0 ? void 0 : checkoutSessionWorkflow.map(checkoutSession => {
8504
- const foundLandedCost = landedCostCalculateWorkflow === null || landedCostCalculateWorkflow === void 0 ? void 0 : landedCostCalculateWorkflow.find(item => { var _a; return (item === null || item === void 0 ? void 0 : item.id) === ((_a = checkoutSession.landedCost) === null || _a === void 0 ? void 0 : _a.id); });
8353
+ const foundLandedCost = landedCostCalculateWorkflow === null || landedCostCalculateWorkflow === void 0 ? void 0 : landedCostCalculateWorkflow.find(item => (item === null || item === void 0 ? void 0 : item.id) === checkoutSession.landedCostId);
8505
8354
  if (!foundLandedCost) {
8506
8355
  return null;
8507
8356
  }
@@ -8519,6 +8368,7 @@ const stripeStorePrefetchLandedCost = async () => {
8519
8368
  if (subtotals) {
8520
8369
  // prefetch landed cost will not update shipping and taxes since we haven't selected shipping method yet
8521
8370
  cartStoreApplySubtotals({
8371
+ adjustments: subtotals.adjustments,
8522
8372
  exchangeRate: subtotals.exchangeRate,
8523
8373
  items: subtotals.items,
8524
8374
  landedCostTotal: 0,
@@ -8659,6 +8509,8 @@ const stripeStoreInitCheckoutSession = async () => {
8659
8509
  stripeStore.isFetchingSession = true;
8660
8510
  const { errors, json } = await handleFetch('/api/zonos-elements/create-checkout-session', {
8661
8511
  body: {
8512
+ adjustmentAmount: cartStore.adjustments.reduce((prev, adj) => prev + adj.amount, 0),
8513
+ cartId: window.Zonos.cartId,
8662
8514
  currency: ((_a = cartStore.items.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode) || '',
8663
8515
  itemsAmount: total,
8664
8516
  metadata: [{ key: 'language', value: localizationStore.selectedLocale }],
@@ -8683,11 +8535,13 @@ const stripeStoreInitCheckoutSession = async () => {
8683
8535
  /**
8684
8536
  * Update checkout session. Use for updating amount with landed cost id, or update session when cart items change
8685
8537
  */
8686
- const stripeStoreUpdateCheckoutSession = async ({ currency, id, itemsAmount, landedCostId, presentmentCountryCode, }) => {
8538
+ const stripeStoreUpdateCheckoutSession = async ({ adjustmentAmount, cartId, currency, id, itemsAmount, landedCostId, presentmentCountryCode, }) => {
8687
8539
  // No need to set loading state here because this function will be called under the hood to update
8688
8540
  // landed cost id for the section.
8689
8541
  const { errors, json } = await handleFetch('/api/zonos-elements/update-checkout-session', {
8690
8542
  body: {
8543
+ adjustmentAmount,
8544
+ cartId,
8691
8545
  currency,
8692
8546
  id,
8693
8547
  itemsAmount,
@@ -8848,6 +8702,8 @@ const getDaysDifference = (targetDate) => {
8848
8702
  };
8849
8703
 
8850
8704
  const { onChange, reset, state: cartStore, } = createStore(() => ({
8705
+ adjustmentTotal: 0,
8706
+ adjustments: [],
8851
8707
  checkoutSessionId: sessionStorage.getItem('zonos--checkout-session-id') || null,
8852
8708
  checkoutSessionTimeoutShow: false,
8853
8709
  checkoutTimeoutInterval: null,
@@ -8968,6 +8824,7 @@ const cartStoreUpdateToErrorState = ({ messages, title, }) => {
8968
8824
  const cartStoreApplySubtotals = (subtotals) => {
8969
8825
  // update exchange rate so we can use it to display cart items
8970
8826
  cartStore.exchangeRate = subtotals.exchangeRate;
8827
+ cartStore.adjustmentTotal = subtotals.adjustments;
8971
8828
  cartStore.dutiesTaxFees = subtotals.landedCostTotal;
8972
8829
  cartStore.subtotal = subtotals.items;
8973
8830
  cartStore.total = subtotals.total;
@@ -8983,7 +8840,7 @@ const cartStoreHasOneEligibleItem = () => {
8983
8840
  // if there is no item restricted found => all items are restricted
8984
8841
  return !!checkItems.find(item => !item.isRestricted);
8985
8842
  };
8986
- const cartStoreReCalculateTotal = async ({ currency, itemsAmount, landedCostId, }) => {
8843
+ const cartStoreReCalculateTotal = async ({ adjustmentAmount, cartId, currency, itemsAmount, landedCostId, }) => {
8987
8844
  if (landedCostId && cartStore.selectedLandedCost) {
8988
8845
  // update cart total right away if we have landed cost id to avoid order total flickering
8989
8846
  const subtotals = cartStore.selectedLandedCost.subtotals;
@@ -8996,6 +8853,8 @@ const cartStoreReCalculateTotal = async ({ currency, itemsAmount, landedCostId,
8996
8853
  return false;
8997
8854
  }
8998
8855
  const { errors, json } = await stripeStoreUpdateCheckoutSession({
8856
+ adjustmentAmount,
8857
+ cartId,
8999
8858
  currency,
9000
8859
  id: cartStore.checkoutSessionId,
9001
8860
  itemsAmount,
@@ -9052,6 +8911,8 @@ const cartStoreUpdateSelectedShippingOption = async (selectedShippingOption) =>
9052
8911
  cartStore.isSelectedShippingGuarantee = isGuarantee;
9053
8912
  // update session with selected landed cost
9054
8913
  const updateCalulateStatus = await cartStoreReCalculateTotal({
8914
+ adjustmentAmount: cartStore.adjustmentTotal,
8915
+ cartId: window.Zonos.cartId,
9055
8916
  landedCostId: (_e = selectedLandedCost.landedCost) === null || _e === void 0 ? void 0 : _e.id,
9056
8917
  });
9057
8918
  return updateCalulateStatus;
@@ -9091,13 +8952,16 @@ const cartStoreResetCartItems = () => {
9091
8952
  cartStore.items = cartStore.items.map(item => (Object.assign(Object.assign({}, item), { isRestricted: false })));
9092
8953
  cartStore.restrictedItems = [];
9093
8954
  };
9094
- const cartStoreUpdateItems = async (cartItems) => {
8955
+ const cartStoreUpdateItems = async ({ adjustments, cartItems, }) => {
9095
8956
  var _a;
8957
+ // Update adjustments and items
8958
+ cartStore.adjustments = adjustments;
9096
8959
  cartStore.items = getCartItemToUse(cartItems);
9097
8960
  const currency = (_a = cartItems.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode;
9098
8961
  const total = cartItems.reduce((amt, item) => {
9099
8962
  return amt + item.amount * item.quantity;
9100
8963
  }, 0);
8964
+ const adjustmenTotal = adjustments.reduce((amt, adjustment) => amt + adjustment.amount, 0);
9101
8965
  if (!currency || !total) {
9102
8966
  // do nothing if we can't get currency or total
9103
8967
  return;
@@ -9106,6 +8970,8 @@ const cartStoreUpdateItems = async (cartItems) => {
9106
8970
  // set loading state here because this is first load checkout session when we already have checkout session id stored
9107
8971
  stripeStore.isFetchingSession = true;
9108
8972
  await cartStoreReCalculateTotal({
8973
+ adjustmentAmount: adjustmenTotal,
8974
+ cartId: window.Zonos.cartId,
9109
8975
  currency: currency,
9110
8976
  itemsAmount: total,
9111
8977
  });
@@ -9143,4 +9009,4 @@ const cartStoreResetTabItems = () => {
9143
9009
  cartStoreResetSelectedShippingOption();
9144
9010
  };
9145
9011
 
9146
- export { initLocalizationStore as A, getZCountryUrlParam as B, setZCountryUrlParam as C, currencyDisplay as D, currencyConvertAndFormat as E, currencyConvert as F, currencyFormat as G, cartStoreHasOneEligibleItem as H, stripeStoreRetrievePayment as I, stripeStoreMessageBasedOnStatus as J, stripeStoreTranslateAddressToLatin as K, cartStoreUpdateSelectedShippingOption as L, cartStoreGetShippingTransitInfo as M, localizationStoreUpdateSelectedLocale as N, localizationStoreUpdateSelectedCountryCode as a, stripeStoreCleanupDomesticShippingSession as b, sendErrorLog as c, stripeStoreSaveDomesticShippingSession as d, cartStore as e, cartStoreUpdateItems as f, cartStoreReset as g, cartStoreResetTabItems as h, initStripeElements as i, cartStoreClearCheckoutInterval as j, stripeStore as k, localizationStore as l, stripeStoreInitCheckoutSession as m, cartStoreStartCheckoutInterval as n, cartStoreUpdateToErrorState as o, stripeStorePrefetchLandedCost as p, cartStoreNextStep as q, stripeStoreHandleInventoryCheck as r, stripeStoreGetDomesticShippingSession as s, translate as t, stripeStoreConfirmPayment as u, stripeStoreReset as v, localizationStoreOnUpdate as w, handleFetch as x, jsonParse as y, isValidSelector as z };
9012
+ export { currencyDisplay as A, currencyConvertAndFormat as B, currencyConvert as C, currencyFormat as D, cartStoreHasOneEligibleItem as E, stripeStoreRetrievePayment as F, stripeStoreMessageBasedOnStatus as G, stripeStoreTranslateAddressToLatin as H, cartStoreUpdateSelectedShippingOption as I, cartStoreGetShippingTransitInfo as J, localizationStoreUpdateSelectedLocale as K, localizationStoreUpdateSelectedCountryCode as a, stripeStoreCleanupDomesticShippingSession as b, stripeStoreSaveDomesticShippingSession as c, cartStore as d, cartStoreUpdateItems as e, cartStoreReset as f, cartStoreResetTabItems as g, cartStoreClearCheckoutInterval as h, initStripeElements as i, stripeStore as j, stripeStoreInitCheckoutSession as k, localizationStore as l, cartStoreStartCheckoutInterval as m, cartStoreUpdateToErrorState as n, stripeStorePrefetchLandedCost as o, cartStoreNextStep as p, stripeStoreHandleInventoryCheck as q, stripeStoreConfirmPayment as r, stripeStoreGetDomesticShippingSession as s, translate as t, stripeStoreReset as u, localizationStoreOnUpdate as v, isValidSelector as w, initLocalizationStore as x, getZCountryUrlParam as y, setZCountryUrlParam as z };