@zonos/elements 1.3.249 → 1.3.251

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 (244) hide show
  1. package/dist/cjs/{cart-eca56521.js → cart-77640463.js} +318 -19
  2. package/dist/cjs/{hasInclusivePrice-e7d67b45.js → hasInclusivePrice-e93c64fd.js} +1 -1
  3. package/dist/cjs/index.cjs.js +7 -7
  4. package/dist/cjs/{invoice-918f2c2b.js → invoice-211ef96c.js} +2 -2
  5. package/dist/cjs/{isCollectMobileTablet-89911215.js → isCollectMobileTablet-14fb5ab4.js} +2 -2
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/{localization-878ef681.js → localization-be7afc1b.js} +780 -0
  8. package/dist/cjs/{paypal-6acca678.js → paypal-c61ef042.js} +29 -2
  9. package/dist/cjs/{placeTestOrder-f1c1e939.js → placeTestOrder-0f7477c8.js} +2 -2
  10. package/dist/cjs/{renderCheckoutCurrency-d9590e81.js → renderCheckoutCurrency-1ac02803.js} +2 -2
  11. package/dist/cjs/{zonos-address-display_9.cjs.entry.js → zonos-address-display_8.cjs.entry.js} +3 -79
  12. package/dist/cjs/zonos-address_4.cjs.entry.js +2 -2
  13. package/dist/cjs/zonos-card_5.cjs.entry.js +3 -3
  14. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +74 -20
  15. package/dist/cjs/zonos-checkbox_2.cjs.entry.js +113 -0
  16. package/dist/cjs/zonos-checkout.cjs.entry.js +79 -4
  17. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +2 -2
  18. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +6 -6
  19. package/dist/cjs/zonos-collect.cjs.entry.js +4 -4
  20. package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
  21. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  22. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  23. package/dist/cjs/zonos-elements.cjs.js +1 -1
  24. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
  25. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  26. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +4 -4
  27. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +6 -6
  28. package/dist/cjs/zonos-invoice.cjs.entry.js +4 -4
  29. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  30. package/dist/cjs/zonos-store-credit.cjs.entry.js +113 -0
  31. package/dist/collection/collection-manifest.json +1 -0
  32. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +3 -0
  33. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +49 -4
  34. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +18 -10
  35. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-store-credit/assets/StoreCreditIcon.svg +3 -0
  36. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-store-credit/zonos-store-credit.css +139 -0
  37. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-store-credit/zonos-store-credit.js +137 -0
  38. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +81 -3
  39. package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +1 -1
  40. package/dist/collection/components/main/zonos-controller.js +1 -1
  41. package/dist/collection/components/store/checkout/cart.js +62 -4
  42. package/dist/collection/components/store/checkout/paypal.js +28 -0
  43. package/dist/collection/components/store/checkout/storeCredit.js +237 -0
  44. package/dist/collection/components/store/checkout/stripe.js +2 -1
  45. package/dist/collection/components/store/translationStore/strings.arabic.js +39 -0
  46. package/dist/collection/components/store/translationStore/strings.base.js +39 -0
  47. package/dist/collection/components/store/translationStore/strings.chinese.js +39 -0
  48. package/dist/collection/components/store/translationStore/strings.danish.js +39 -0
  49. package/dist/collection/components/store/translationStore/strings.dutch.js +39 -0
  50. package/dist/collection/components/store/translationStore/strings.french.js +39 -0
  51. package/dist/collection/components/store/translationStore/strings.german.js +39 -0
  52. package/dist/collection/components/store/translationStore/strings.hebrew.js +39 -0
  53. package/dist/collection/components/store/translationStore/strings.indonesian.js +39 -0
  54. package/dist/collection/components/store/translationStore/strings.italian.js +39 -0
  55. package/dist/collection/components/store/translationStore/strings.japanese.js +39 -0
  56. package/dist/collection/components/store/translationStore/strings.korean.js +39 -0
  57. package/dist/collection/components/store/translationStore/strings.norwegian.js +39 -0
  58. package/dist/collection/components/store/translationStore/strings.polish.js +39 -0
  59. package/dist/collection/components/store/translationStore/strings.portuguese.js +39 -0
  60. package/dist/collection/components/store/translationStore/strings.russian.js +39 -0
  61. package/dist/collection/components/store/translationStore/strings.spanish.js +39 -0
  62. package/dist/collection/components/store/translationStore/strings.swedish.js +39 -0
  63. package/dist/collection/components/store/translationStore/strings.turkish.js +39 -0
  64. package/dist/collection/components/store/translationStore/strings.vietnamese.js +39 -0
  65. package/dist/collection/types/generated/graphql.internal.types.js +589 -0
  66. package/dist/esm/{cart-efb30253.js → cart-394c9ddb.js} +309 -21
  67. package/dist/esm/{hasInclusivePrice-565ddbe5.js → hasInclusivePrice-f0322e1c.js} +1 -1
  68. package/dist/esm/index.js +7 -7
  69. package/dist/esm/{invoice-0e462fcc.js → invoice-5ae81ae5.js} +2 -2
  70. package/dist/esm/{isCollectMobileTablet-0bcba25a.js → isCollectMobileTablet-15b668d6.js} +2 -2
  71. package/dist/esm/loader.js +1 -1
  72. package/dist/esm/{localization-c1aff677.js → localization-0ebc8356.js} +780 -0
  73. package/dist/esm/{paypal-06b67be0.js → paypal-b6fa3ec3.js} +29 -2
  74. package/dist/esm/{placeTestOrder-6c9a6c8a.js → placeTestOrder-5756cbc3.js} +2 -2
  75. package/dist/esm/{renderCheckoutCurrency-910fea67.js → renderCheckoutCurrency-5f3e06ea.js} +2 -2
  76. package/dist/esm/{zonos-address-display_9.entry.js → zonos-address-display_8.entry.js} +4 -79
  77. package/dist/esm/zonos-address_4.entry.js +2 -2
  78. package/dist/esm/zonos-card_5.entry.js +3 -3
  79. package/dist/esm/zonos-cart-items_12.entry.js +74 -20
  80. package/dist/esm/zonos-checkbox_2.entry.js +108 -0
  81. package/dist/esm/zonos-checkout.entry.js +79 -4
  82. package/dist/esm/zonos-collect-cart-items_3.entry.js +2 -2
  83. package/dist/esm/zonos-collect-finish_6.entry.js +6 -6
  84. package/dist/esm/zonos-collect.entry.js +4 -4
  85. package/dist/esm/zonos-controller.entry.js +2 -2
  86. package/dist/esm/zonos-country-flag.entry.js +1 -1
  87. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  88. package/dist/esm/zonos-elements.js +1 -1
  89. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  90. package/dist/esm/zonos-hello.entry.js +1 -1
  91. package/dist/esm/zonos-invoice-cart-items_2.entry.js +4 -4
  92. package/dist/esm/zonos-invoice-finish_5.entry.js +6 -6
  93. package/dist/esm/zonos-invoice.entry.js +4 -4
  94. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  95. package/dist/esm/zonos-store-credit.entry.js +109 -0
  96. package/dist/esm-es5/cart-394c9ddb.js +1 -0
  97. package/dist/esm-es5/{hasInclusivePrice-565ddbe5.js → hasInclusivePrice-f0322e1c.js} +1 -1
  98. package/dist/esm-es5/index.js +1 -1
  99. package/dist/esm-es5/{invoice-0e462fcc.js → invoice-5ae81ae5.js} +1 -1
  100. package/dist/esm-es5/{isCollectMobileTablet-0bcba25a.js → isCollectMobileTablet-15b668d6.js} +1 -1
  101. package/dist/esm-es5/loader.js +1 -1
  102. package/dist/esm-es5/localization-0ebc8356.js +1 -0
  103. package/dist/esm-es5/{paypal-06b67be0.js → paypal-b6fa3ec3.js} +2 -2
  104. package/dist/esm-es5/{placeTestOrder-6c9a6c8a.js → placeTestOrder-5756cbc3.js} +1 -1
  105. package/dist/esm-es5/{renderCheckoutCurrency-910fea67.js → renderCheckoutCurrency-5f3e06ea.js} +1 -1
  106. package/dist/esm-es5/zonos-address-display_8.entry.js +1 -0
  107. package/dist/esm-es5/zonos-address_4.entry.js +1 -1
  108. package/dist/esm-es5/zonos-card_5.entry.js +1 -1
  109. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  110. package/dist/esm-es5/zonos-checkbox_2.entry.js +1 -0
  111. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  112. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  113. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  114. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  115. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  116. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  117. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  118. package/dist/esm-es5/zonos-elements.js +1 -1
  119. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  120. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  121. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
  122. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  123. package/dist/esm-es5/zonos-invoice.entry.js +1 -1
  124. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  125. package/dist/esm-es5/zonos-store-credit.entry.js +1 -0
  126. package/dist/scripts/index.d.ts +68 -1
  127. package/dist/scripts/index.js +1 -1
  128. package/dist/scripts/loadZonos.js +1 -1
  129. package/dist/scripts/zonos.js +1 -1
  130. package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +1 -0
  131. package/dist/types/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-store-credit/zonos-store-credit.d.ts +17 -0
  132. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +5 -0
  133. package/dist/types/components/store/checkout/cart.d.ts +8 -1
  134. package/dist/types/components/store/checkout/storeCredit.d.ts +111 -0
  135. package/dist/types/components/store/checkout/stripe.d.ts +1 -1
  136. package/dist/types/components/store/translationStore/strings.arabic.d.ts +39 -0
  137. package/dist/types/components/store/translationStore/strings.base.d.ts +39 -0
  138. package/dist/types/components/store/translationStore/strings.chinese.d.ts +39 -0
  139. package/dist/types/components/store/translationStore/strings.danish.d.ts +39 -0
  140. package/dist/types/components/store/translationStore/strings.dutch.d.ts +39 -0
  141. package/dist/types/components/store/translationStore/strings.french.d.ts +39 -0
  142. package/dist/types/components/store/translationStore/strings.german.d.ts +39 -0
  143. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +39 -0
  144. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +39 -0
  145. package/dist/types/components/store/translationStore/strings.italian.d.ts +39 -0
  146. package/dist/types/components/store/translationStore/strings.japanese.d.ts +39 -0
  147. package/dist/types/components/store/translationStore/strings.korean.d.ts +39 -0
  148. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +39 -0
  149. package/dist/types/components/store/translationStore/strings.polish.d.ts +39 -0
  150. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +39 -0
  151. package/dist/types/components/store/translationStore/strings.russian.d.ts +39 -0
  152. package/dist/types/components/store/translationStore/strings.spanish.d.ts +39 -0
  153. package/dist/types/components/store/translationStore/strings.swedish.d.ts +39 -0
  154. package/dist/types/components/store/translationStore/strings.turkish.d.ts +39 -0
  155. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +39 -0
  156. package/dist/types/components.d.ts +21 -0
  157. package/dist/types/types/checkout/api/CheckoutSession.d.ts +9 -1
  158. package/dist/types/types/generated/graphql.internal.types.d.ts +713 -4
  159. package/dist/types/types/generated/graphql.internal.types.ts +956 -4
  160. package/dist/types/types/utils/ZonosSettings.d.ts +4 -0
  161. package/dist/zonos-elements/index.esm.js +1 -1
  162. package/dist/zonos-elements/{p-1f1bf95c.system.entry.js → p-07ca3347.system.entry.js} +1 -1
  163. package/dist/zonos-elements/p-09d7a5cb.system.js +18 -0
  164. package/dist/zonos-elements/p-0af96b5b.system.entry.js +1 -0
  165. package/dist/zonos-elements/{p-9c64ca98.system.entry.js → p-0da3cc62.system.entry.js} +1 -1
  166. package/dist/zonos-elements/p-0dd5a4b8.system.js +1 -0
  167. package/dist/zonos-elements/{p-4d4b7faa.entry.js → p-1162b685.entry.js} +1 -1
  168. package/dist/zonos-elements/{p-4d081ce8.entry.js → p-11d6de1a.entry.js} +1 -1
  169. package/dist/zonos-elements/p-1282495f.system.js +1 -0
  170. package/dist/zonos-elements/p-13041752.js +1 -0
  171. package/dist/zonos-elements/{p-1b5f89d5.system.js → p-27fad55a.system.js} +1 -1
  172. package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
  173. package/dist/zonos-elements/p-29f7950c.js +17 -0
  174. package/dist/zonos-elements/p-2b118454.js +1 -0
  175. package/dist/zonos-elements/{p-26718a78.entry.js → p-2bdc2206.entry.js} +1 -1
  176. package/dist/zonos-elements/{p-b360ee5b.entry.js → p-2c2e5ee6.entry.js} +1 -1
  177. package/dist/zonos-elements/{p-bd004403.system.js → p-2c9c750e.system.js} +1 -1
  178. package/dist/zonos-elements/{p-c9e3bc98.system.js → p-321e7920.system.js} +1 -1
  179. package/dist/zonos-elements/p-3d757163.entry.js +1 -0
  180. package/dist/zonos-elements/{p-456c0e52.js → p-4f23732f.js} +1 -1
  181. package/dist/zonos-elements/{p-321d2963.js → p-57b27c60.js} +1 -1
  182. package/dist/zonos-elements/{p-6d37f669.entry.js → p-615b5d13.entry.js} +1 -1
  183. package/dist/zonos-elements/p-620ba943.js +1 -0
  184. package/dist/zonos-elements/p-785111e7.entry.js +1 -0
  185. package/dist/zonos-elements/p-7b294762.system.entry.js +1 -0
  186. package/dist/zonos-elements/p-7fde2d8a.entry.js +1 -0
  187. package/dist/zonos-elements/p-8abeab5a.entry.js +1 -0
  188. package/dist/zonos-elements/{p-4a395eea.system.entry.js → p-8dfa0bb8.system.entry.js} +1 -1
  189. package/dist/zonos-elements/{p-06e2bc14.entry.js → p-8efb79ab.entry.js} +1 -1
  190. package/dist/zonos-elements/p-8f1ab25c.system.entry.js +1 -0
  191. package/dist/zonos-elements/{p-358dfb9e.entry.js → p-920d9189.entry.js} +1 -1
  192. package/dist/zonos-elements/p-92d91395.system.entry.js +1 -0
  193. package/dist/zonos-elements/{p-b9a4430c.entry.js → p-95f7f2a0.entry.js} +1 -1
  194. package/dist/zonos-elements/{p-f31fbbf0.entry.js → p-97fb5ad5.entry.js} +1 -1
  195. package/dist/zonos-elements/{p-bc6b33fa.entry.js → p-9ff90151.entry.js} +1 -1
  196. package/dist/zonos-elements/{p-4c087a8e.system.entry.js → p-a0ac3ca2.system.entry.js} +1 -1
  197. package/dist/zonos-elements/{p-09110bb7.system.entry.js → p-a1e23675.system.entry.js} +1 -1
  198. package/dist/zonos-elements/{p-36bea5d5.system.entry.js → p-a5adc047.system.entry.js} +1 -1
  199. package/dist/zonos-elements/{p-101226f3.system.entry.js → p-a5fb864a.system.entry.js} +1 -1
  200. package/dist/zonos-elements/{p-54c95926.entry.js → p-a95ac160.entry.js} +1 -1
  201. package/dist/zonos-elements/p-ac353826.js +1 -0
  202. package/dist/zonos-elements/{p-b589f621.system.entry.js → p-b37a85f0.system.entry.js} +1 -1
  203. package/dist/zonos-elements/{p-302b7105.system.entry.js → p-b49b8da4.system.entry.js} +1 -1
  204. package/dist/zonos-elements/{p-8d1efd7b.entry.js → p-bdaf2a38.entry.js} +1 -1
  205. package/dist/zonos-elements/{p-3ad2a9a3.system.entry.js → p-c1ae7391.system.entry.js} +1 -1
  206. package/dist/zonos-elements/{p-a75b3efc.system.entry.js → p-c2121663.system.entry.js} +1 -1
  207. package/dist/zonos-elements/{p-c87d3d50.system.js → p-c52b917b.system.js} +1 -1
  208. package/dist/zonos-elements/{p-0a2abbab.system.entry.js → p-c6047442.system.entry.js} +1 -1
  209. package/dist/zonos-elements/p-ca19a10a.js +1 -0
  210. package/dist/zonos-elements/p-cf69bcc4.system.js +1 -0
  211. package/dist/zonos-elements/{p-3ece0f96.system.entry.js → p-d65cfa9b.system.entry.js} +1 -1
  212. package/dist/zonos-elements/{p-5eaa0de1.entry.js → p-d8610393.entry.js} +1 -1
  213. package/dist/zonos-elements/p-daaaa8f1.system.entry.js +1 -0
  214. package/dist/zonos-elements/{p-8a424412.entry.js → p-efa69c89.entry.js} +1 -1
  215. package/dist/zonos-elements/p-fbccfa3e.system.js +1 -0
  216. package/dist/zonos-elements/{p-079bc009.system.entry.js → p-fce715f1.system.entry.js} +1 -1
  217. package/dist/zonos-elements/p-fe6cc354.entry.js +1 -0
  218. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  219. package/package.json +1 -1
  220. package/dist/cjs/zonos-toggle.cjs.entry.js +0 -35
  221. package/dist/esm/zonos-toggle.entry.js +0 -31
  222. package/dist/esm-es5/cart-efb30253.js +0 -1
  223. package/dist/esm-es5/localization-c1aff677.js +0 -1
  224. package/dist/esm-es5/zonos-address-display_9.entry.js +0 -1
  225. package/dist/esm-es5/zonos-toggle.entry.js +0 -1
  226. package/dist/zonos-elements/p-096182f0.system.js +0 -1
  227. package/dist/zonos-elements/p-0aeba2c7.system.js +0 -1
  228. package/dist/zonos-elements/p-127e0395.js +0 -17
  229. package/dist/zonos-elements/p-197d9b23.system.entry.js +0 -1
  230. package/dist/zonos-elements/p-25dd58f8.system.entry.js +0 -1
  231. package/dist/zonos-elements/p-445072f8.js +0 -1
  232. package/dist/zonos-elements/p-507f00d2.js +0 -1
  233. package/dist/zonos-elements/p-5fd0cd66.system.js +0 -1
  234. package/dist/zonos-elements/p-661cd4ce.system.entry.js +0 -1
  235. package/dist/zonos-elements/p-777e0a81.entry.js +0 -1
  236. package/dist/zonos-elements/p-7e77b055.system.entry.js +0 -1
  237. package/dist/zonos-elements/p-80524eac.entry.js +0 -1
  238. package/dist/zonos-elements/p-8b206982.system.js +0 -1
  239. package/dist/zonos-elements/p-9eea270b.entry.js +0 -1
  240. package/dist/zonos-elements/p-c4e358f2.js +0 -1
  241. package/dist/zonos-elements/p-cda52300.js +0 -1
  242. package/dist/zonos-elements/p-d233ef0d.entry.js +0 -1
  243. package/dist/zonos-elements/p-f8f7d491.js +0 -1
  244. package/dist/zonos-elements/p-fc0aa91e.system.js +0 -18
@@ -602,7 +602,7 @@ export class ZonosController {
602
602
  "signature": "(countryCode: CountryCode) => Promise<void>",
603
603
  "parameters": [{
604
604
  "name": "countryCode",
605
- "type": "\"AD\" | \"AE\" | \"AF\" | \"AG\" | \"AI\" | \"AL\" | \"AM\" | \"AO\" | \"AQ\" | \"AR\" | \"AS\" | \"AT\" | \"AU\" | \"AW\" | \"AX\" | \"AZ\" | \"BA\" | \"BB\" | \"BD\" | \"BE\" | \"BF\" | \"BG\" | \"BH\" | \"BI\" | \"BJ\" | \"BL\" | \"BM\" | \"BN\" | \"BO\" | \"BQ\" | \"BR\" | \"BS\" | \"BT\" | \"BV\" | \"BW\" | \"BY\" | \"BZ\" | \"CA\" | \"CC\" | \"CD\" | \"CF\" | \"CG\" | \"CH\" | \"CI\" | \"CK\" | \"CL\" | \"CM\" | \"CN\" | \"CO\" | \"CR\" | \"CU\" | \"CV\" | \"CW\" | \"CX\" | \"CY\" | \"CZ\" | \"DE\" | \"DJ\" | \"DK\" | \"DM\" | \"DO\" | \"DZ\" | \"EC\" | \"EE\" | \"EG\" | \"EH\" | \"ER\" | \"ES\" | \"ET\" | \"FI\" | \"FJ\" | \"FK\" | \"FM\" | \"FO\" | \"FR\" | \"GA\" | \"GB\" | \"GD\" | \"GE\" | \"GF\" | \"GG\" | \"GH\" | \"GI\" | \"GL\" | \"GM\" | \"GN\" | \"GP\" | \"GQ\" | \"GR\" | \"GS\" | \"GT\" | \"GU\" | \"GW\" | \"GY\" | \"HK\" | \"HM\" | \"HN\" | \"HR\" | \"HT\" | \"HU\" | \"IC\" | \"ID\" | \"IE\" | \"IL\" | \"IM\" | \"IN\" | \"IO\" | \"IQ\" | \"IR\" | \"IS\" | \"IT\" | \"JE\" | \"JM\" | \"JO\" | \"JP\" | \"KE\" | \"KG\" | \"KH\" | \"KI\" | \"KM\" | \"KN\" | \"KP\" | \"KR\" | \"KW\" | \"KY\" | \"KZ\" | \"LA\" | \"LB\" | \"LC\" | \"LI\" | \"LK\" | \"LR\" | \"LS\" | \"LT\" | \"LU\" | \"LV\" | \"LY\" | \"MA\" | \"MC\" | \"MD\" | \"ME\" | \"MF\" | \"MG\" | \"MH\" | \"MK\" | \"ML\" | \"MM\" | \"MN\" | \"MO\" | \"MP\" | \"MQ\" | \"MR\" | \"MS\" | \"MT\" | \"MU\" | \"MV\" | \"MW\" | \"MX\" | \"MY\" | \"MZ\" | \"NA\" | \"NC\" | \"NE\" | \"NF\" | \"NG\" | \"NI\" | \"NL\" | \"NO\" | \"NP\" | \"NR\" | \"NU\" | \"NZ\" | \"OM\" | \"PA\" | \"PE\" | \"PF\" | \"PG\" | \"PH\" | \"PK\" | \"PL\" | \"PM\" | \"PN\" | \"PR\" | \"PS\" | \"PT\" | \"PW\" | \"PY\" | \"QA\" | \"RE\" | \"RO\" | \"RS\" | \"RU\" | \"RW\" | \"SA\" | \"SB\" | \"SC\" | \"SD\" | \"SE\" | \"SG\" | \"SH\" | \"SI\" | \"SJ\" | \"SK\" | \"SL\" | \"SM\" | \"SN\" | \"SO\" | \"SR\" | \"SS\" | \"ST\" | \"SV\" | \"SX\" | \"SY\" | \"SZ\" | \"TC\" | \"TD\" | \"TF\" | \"TG\" | \"TH\" | \"TJ\" | \"TK\" | \"TL\" | \"TM\" | \"TN\" | \"TO\" | \"TR\" | \"TT\" | \"TV\" | \"TW\" | \"TZ\" | \"UA\" | \"UG\" | \"UM\" | \"US\" | \"UY\" | \"UZ\" | \"VA\" | \"VC\" | \"VE\" | \"VG\" | \"VI\" | \"VN\" | \"VU\" | \"WF\" | \"WS\" | \"YE\" | \"YT\" | \"ZA\" | \"ZM\" | \"ZW\"",
605
+ "type": "\"CC\" | \"TO\" | \"AD\" | \"AE\" | \"AF\" | \"AG\" | \"AI\" | \"AL\" | \"AM\" | \"AO\" | \"AQ\" | \"AR\" | \"AS\" | \"AT\" | \"AU\" | \"AW\" | \"AX\" | \"AZ\" | \"BA\" | \"BB\" | \"BD\" | \"BE\" | \"BF\" | \"BG\" | \"BH\" | \"BI\" | \"BJ\" | \"BL\" | \"BM\" | \"BN\" | \"BO\" | \"BQ\" | \"BR\" | \"BS\" | \"BT\" | \"BV\" | \"BW\" | \"BY\" | \"BZ\" | \"CA\" | \"CD\" | \"CF\" | \"CG\" | \"CH\" | \"CI\" | \"CK\" | \"CL\" | \"CM\" | \"CN\" | \"CO\" | \"CR\" | \"CU\" | \"CV\" | \"CW\" | \"CX\" | \"CY\" | \"CZ\" | \"DE\" | \"DJ\" | \"DK\" | \"DM\" | \"DO\" | \"DZ\" | \"EC\" | \"EE\" | \"EG\" | \"EH\" | \"ER\" | \"ES\" | \"ET\" | \"FI\" | \"FJ\" | \"FK\" | \"FM\" | \"FO\" | \"FR\" | \"GA\" | \"GB\" | \"GD\" | \"GE\" | \"GF\" | \"GG\" | \"GH\" | \"GI\" | \"GL\" | \"GM\" | \"GN\" | \"GP\" | \"GQ\" | \"GR\" | \"GS\" | \"GT\" | \"GU\" | \"GW\" | \"GY\" | \"HK\" | \"HM\" | \"HN\" | \"HR\" | \"HT\" | \"HU\" | \"IC\" | \"ID\" | \"IE\" | \"IL\" | \"IM\" | \"IN\" | \"IO\" | \"IQ\" | \"IR\" | \"IS\" | \"IT\" | \"JE\" | \"JM\" | \"JO\" | \"JP\" | \"KE\" | \"KG\" | \"KH\" | \"KI\" | \"KM\" | \"KN\" | \"KP\" | \"KR\" | \"KW\" | \"KY\" | \"KZ\" | \"LA\" | \"LB\" | \"LC\" | \"LI\" | \"LK\" | \"LR\" | \"LS\" | \"LT\" | \"LU\" | \"LV\" | \"LY\" | \"MA\" | \"MC\" | \"MD\" | \"ME\" | \"MF\" | \"MG\" | \"MH\" | \"MK\" | \"ML\" | \"MM\" | \"MN\" | \"MO\" | \"MP\" | \"MQ\" | \"MR\" | \"MS\" | \"MT\" | \"MU\" | \"MV\" | \"MW\" | \"MX\" | \"MY\" | \"MZ\" | \"NA\" | \"NC\" | \"NE\" | \"NF\" | \"NG\" | \"NI\" | \"NL\" | \"NO\" | \"NP\" | \"NR\" | \"NU\" | \"NZ\" | \"OM\" | \"PA\" | \"PE\" | \"PF\" | \"PG\" | \"PH\" | \"PK\" | \"PL\" | \"PM\" | \"PN\" | \"PR\" | \"PS\" | \"PT\" | \"PW\" | \"PY\" | \"QA\" | \"RE\" | \"RO\" | \"RS\" | \"RU\" | \"RW\" | \"SA\" | \"SB\" | \"SC\" | \"SD\" | \"SE\" | \"SG\" | \"SH\" | \"SI\" | \"SJ\" | \"SK\" | \"SL\" | \"SM\" | \"SN\" | \"SO\" | \"SR\" | \"SS\" | \"ST\" | \"SV\" | \"SX\" | \"SY\" | \"SZ\" | \"TC\" | \"TD\" | \"TF\" | \"TG\" | \"TH\" | \"TJ\" | \"TK\" | \"TL\" | \"TM\" | \"TN\" | \"TR\" | \"TT\" | \"TV\" | \"TW\" | \"TZ\" | \"UA\" | \"UG\" | \"UM\" | \"US\" | \"UY\" | \"UZ\" | \"VA\" | \"VC\" | \"VE\" | \"VG\" | \"VI\" | \"VN\" | \"VU\" | \"WF\" | \"WS\" | \"YE\" | \"YT\" | \"ZA\" | \"ZM\" | \"ZW\"",
606
606
  "docs": ""
607
607
  }],
608
608
  "references": {
@@ -1,4 +1,5 @@
1
1
  import { createStore } from "@stencil/store";
2
+ import { storeCreditStoreGetInput, storeCreditStoreReset, storeCreditStoreSetBalanceFromSession, } from "./storeCredit";
2
3
  import { stripeStore, stripeStoreInitCheckoutSession, stripeStoreReset, stripeStoreUpdateCheckoutSession, } from "./stripe";
3
4
  import { localizationStore } from "../hello/localization";
4
5
  import { storageStore, storageStoreSetEnabledVariantTestKeys, } from "../storageStore";
@@ -46,6 +47,7 @@ const { onChange: cartStoreOnChange, reset, state: cartStore, } = createStore(()
46
47
  shippingData: null,
47
48
  shouldHideDiscountInput: false,
48
49
  step: 'customer-info',
50
+ storeCredit: 0,
49
51
  subtotal: 0,
50
52
  tabItems: {
51
53
  'customer-info': {
@@ -134,8 +136,16 @@ const cartStoreCheckItemRestrictions = (itemsWorkflow) => {
134
136
  restrictedItems: mappedRestrictedItems,
135
137
  };
136
138
  };
139
+ let storeCreditUpdateTimeout = null;
137
140
  const cartStoreReset = () => {
138
141
  storageStore.checkoutSessionId = null;
142
+ // clear pending store credit debounce timer
143
+ if (storeCreditUpdateTimeout) {
144
+ clearTimeout(storeCreditUpdateTimeout);
145
+ storeCreditUpdateTimeout = null;
146
+ }
147
+ // reset store credit store
148
+ storeCreditStoreReset();
139
149
  // reset cart store
140
150
  reset();
141
151
  };
@@ -149,11 +159,13 @@ const cartStoreUpdateToErrorState = ({ messages, title, }) => {
149
159
  };
150
160
  };
151
161
  const cartStoreApplySubtotals = ({ dutiesTaxesFeesEstimate, method, subtotals, }) => {
162
+ var _a;
152
163
  // update exchange rate so we can use it to display cart items
153
164
  cartStore.exchangeRate = subtotals.exchangeRate;
154
165
  cartStore.adjustmentTotal = subtotals.adjustments;
155
166
  cartStore.dutiesTaxesFees =
156
167
  method === 'DAP' ? null : subtotals.landedCostTotal;
168
+ cartStore.storeCredit = (_a = subtotals.storeCredit) !== null && _a !== void 0 ? _a : 0;
157
169
  cartStore.subtotal = subtotals.items;
158
170
  cartStore.total = subtotals.total;
159
171
  cartStore.currency = subtotals.presentmentCurrencyCode;
@@ -170,13 +182,15 @@ const cartStoreHasOneEligibleItem = () => {
170
182
  return !!checkItems.find(item => !item.isRestricted);
171
183
  };
172
184
  const cartStoreSetCheckoutSession = (checkoutSession) => {
173
- var _a, _b, _c, _d, _e;
185
+ var _a, _b, _c, _d, _e, _f, _g;
174
186
  // update stripe store with updated information
175
187
  stripeStore.clientSecret = checkoutSession.clientSecret;
176
188
  stripeStore.stripeCustomerSessionClientSecret =
177
189
  checkoutSession.customerSessionClientSecret;
178
190
  stripeStore.customerProfile = checkoutSession.customerProfile;
179
191
  cartStore.checkoutSession = checkoutSession;
192
+ // Populate store credit balance from checkout session customer profile
193
+ storeCreditStoreSetBalanceFromSession((_b = (_a = checkoutSession.customerProfile) === null || _a === void 0 ? void 0 : _a.storeCreditBalance) !== null && _b !== void 0 ? _b : null);
180
194
  if (!checkoutSession.id) {
181
195
  // Log error to track down the issue
182
196
  void sendErrorLog({
@@ -196,10 +210,10 @@ const cartStoreSetCheckoutSession = (checkoutSession) => {
196
210
  const availableSelectedVariantTestKeys = filterValidTests(checkoutSession.varianceTestResults || []);
197
211
  storageStoreSetEnabledVariantTestKeys(availableSelectedVariantTestKeys);
198
212
  // Check if there is a redirect URL in the metadata to override
199
- const externalConfirmationPageURL = ((_c = (_b = (_a = cartStore.checkoutSession) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'externalConfirmationPageURL')) === null || _c === void 0 ? void 0 : _c.value) ||
213
+ const externalConfirmationPageURL = ((_e = (_d = (_c = cartStore.checkoutSession) === null || _c === void 0 ? void 0 : _c.metadata) === null || _d === void 0 ? void 0 : _d.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'externalConfirmationPageURL')) === null || _e === void 0 ? void 0 : _e.value) ||
200
214
  (
201
215
  // Sometimes externalConfirmationPageURL is not in checkoutSession create/update, check if there is a redirect URL in the cart metadata to override
202
- (_e = (_d = window.Zonos.cartData) === null || _d === void 0 ? void 0 : _d.metadata.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'externalConfirmationPageURL')) === null || _e === void 0 ? void 0 : _e.value) ||
216
+ (_g = (_f = window.Zonos.cartData) === null || _f === void 0 ? void 0 : _f.metadata.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'externalConfirmationPageURL')) === null || _g === void 0 ? void 0 : _g.value) ||
203
217
  null;
204
218
  if (externalConfirmationPageURL) {
205
219
  log(`Found externalConfirmationPageURL: ${externalConfirmationPageURL}`);
@@ -470,4 +484,48 @@ const cartStoreResetTabItems = () => {
470
484
  cartStore.tabItems = Object.assign(Object.assign({}, cartStore.tabItems), { 'customer-info': Object.assign(Object.assign({}, cartStore.tabItems['customer-info']), { isDone: false }), payment: Object.assign(Object.assign({}, cartStore.tabItems.payment), { isDone: false }), shipping: Object.assign(Object.assign({}, cartStore.tabItems.shipping), { isDone: false }) });
471
485
  cartStoreResetSelectedShippingOption();
472
486
  };
473
- export { cartStore, cartStoreApplySubtotals, cartStoreCheckItemRestrictions, cartStoreClearCheckoutInterval, cartStoreGetMethod, cartStoreGetShippingTransitInfo, cartStoreHasOneEligibleItem, cartStoreNextStep, cartStoreOnChange, cartStorePreviousStep, cartStoreReCalculateTotal, cartStoreReset, cartStoreResetCartItems, cartStoreResetTabItems, cartStoreSetCheckoutSession, cartStoreStartCheckoutInterval, cartStoreUpdateItems, cartStoreUpdateSelectedShippingOption, cartStoreUpdateToErrorState, };
487
+ const cartStoreUpdateStoreCreditImmediate = async () => {
488
+ var _a, _b;
489
+ if (!storageStore.checkoutSessionId) {
490
+ log('Could not update store credit without checkout session id', 'info');
491
+ return;
492
+ }
493
+ const selectedLandedCost = cartStore.selectedLandedCost;
494
+ const currency = cartStore.currency || ((_a = cartStore.items.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode) || '';
495
+ const adjustmentsAmount = cartStore.adjustments.reduce((prev, adj) => prev + adj.amount, 0);
496
+ const itemsAmount = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
497
+ const { errors, json } = await stripeStoreUpdateCheckoutSession({
498
+ adjustmentsAmount,
499
+ cartId: window.Zonos.cartId,
500
+ currency,
501
+ id: storageStore.checkoutSessionId,
502
+ itemsAmount,
503
+ landedCostId: selectedLandedCost === null || selectedLandedCost === void 0 ? void 0 : selectedLandedCost.landedCostId,
504
+ presentmentCountryCode: localizationStore.selectedCountryCode,
505
+ storeCreditApplication: storeCreditStoreGetInput(),
506
+ });
507
+ if (errors.length > 0 || !json) {
508
+ logError('Error updating checkout session with store credit');
509
+ return;
510
+ }
511
+ // Apply updated subtotals from the response
512
+ cartStoreApplySubtotals({
513
+ method: ((_b = json.checkoutSessionUpdate.landedCost) === null || _b === void 0 ? void 0 : _b.method) || 'DDP',
514
+ subtotals: json.checkoutSessionUpdate.subtotals,
515
+ });
516
+ cartStoreSetCheckoutSession(json.checkoutSessionUpdate);
517
+ };
518
+ /**
519
+ * Update the checkout session with the current store credit selection.
520
+ * Debounced to prevent multiple rapid requests when store changes cascade.
521
+ */
522
+ const cartStoreUpdateStoreCredit = () => {
523
+ if (storeCreditUpdateTimeout) {
524
+ clearTimeout(storeCreditUpdateTimeout);
525
+ }
526
+ storeCreditUpdateTimeout = setTimeout(() => {
527
+ storeCreditUpdateTimeout = null;
528
+ void cartStoreUpdateStoreCreditImmediate();
529
+ }, 300);
530
+ };
531
+ export { cartStore, cartStoreApplySubtotals, cartStoreCheckItemRestrictions, cartStoreClearCheckoutInterval, cartStoreGetMethod, cartStoreGetShippingTransitInfo, cartStoreHasOneEligibleItem, cartStoreNextStep, cartStoreOnChange, cartStorePreviousStep, cartStoreReCalculateTotal, cartStoreReset, cartStoreResetCartItems, cartStoreResetTabItems, cartStoreSetCheckoutSession, cartStoreStartCheckoutInterval, cartStoreUpdateItems, cartStoreUpdateSelectedShippingOption, cartStoreUpdateStoreCredit, cartStoreUpdateToErrorState, };
@@ -1,6 +1,7 @@
1
1
  import { loadScript, } from "@paypal/paypal-js";
2
2
  import { createStore } from "@stencil/store";
3
3
  import { cartStore, cartStoreClearCheckoutInterval, cartStoreNextStep, } from "./cart";
4
+ import { storeCreditStoreApplyCredit, storeCreditStoreCoversFullAmount, storeCreditStoreCreateOrder, storeCreditStoreGetEffectiveAmount, } from "./storeCredit";
4
5
  import { stripeStore, stripeStoreHandleInventoryCheck, } from "./stripe";
5
6
  import { storageStore } from "../storageStore";
6
7
  import { translate } from "../translationStore";
@@ -121,6 +122,33 @@ const paypalButtonOptions = ({ checkoutSessionId, onPaypalFail, onPaypalSessionD
121
122
  if (cartStore.inventoryCheckErrorMessage) {
122
123
  return '';
123
124
  }
125
+ // Apply store credit if customer has selected an amount
126
+ const storeCreditAmount = storeCreditStoreGetEffectiveAmount();
127
+ if (storeCreditAmount > 0) {
128
+ const storeCreditResult = await storeCreditStoreApplyCredit();
129
+ if (!storeCreditResult.success) {
130
+ paypalStore.paypalErrorMessage =
131
+ storeCreditResult.error ||
132
+ translate('Unable to apply store credit. Please try again.');
133
+ onPaypalFail === null || onPaypalFail === void 0 ? void 0 : onPaypalFail();
134
+ return '';
135
+ }
136
+ }
137
+ // If store credit covers the full order, create order directly
138
+ if (storeCreditStoreCoversFullAmount()) {
139
+ const orderResult = await storeCreditStoreCreateOrder();
140
+ if (!orderResult.success) {
141
+ paypalStore.paypalErrorMessage =
142
+ orderResult.error ||
143
+ translate('Unable to place order with store credit. Please try again.');
144
+ onPaypalFail === null || onPaypalFail === void 0 ? void 0 : onPaypalFail();
145
+ return '';
146
+ }
147
+ onPaypalSessionDone === null || onPaypalSessionDone === void 0 ? void 0 : onPaypalSessionDone({ orderId: orderResult.orderId || '' });
148
+ cartStoreNextStep();
149
+ cartStoreClearCheckoutInterval();
150
+ return '';
151
+ }
124
152
  const paypalOrderId = await paypalStoreCreaterOrder({
125
153
  checkoutSessionId,
126
154
  });
@@ -0,0 +1,237 @@
1
+ import { createStore } from "@stencil/store";
2
+ import { cartStore } from "./cart";
3
+ import { storageStore } from "../storageStore";
4
+ import { getCheckoutSession } from "../../utils/api/getCheckoutSession";
5
+ import { handleFetch } from "../../utils/handleFetch";
6
+ import { log } from "../../utils/logging/log";
7
+ import { logError } from "../../utils/logging/logError";
8
+ const { onChange: storeCreditStoreOnChange, reset, state: storeCreditStore, } = createStore(() => ({
9
+ amountToApply: null,
10
+ appliedAmount: null,
11
+ availableBalance: null,
12
+ error: null,
13
+ isApplying: false,
14
+ isEnabled: false,
15
+ orderIdCreated: null,
16
+ remainingBalance: null,
17
+ useFullBalance: true,
18
+ }));
19
+ /**
20
+ * Reset store credit store to initial state
21
+ */
22
+ const storeCreditStoreReset = () => {
23
+ reset();
24
+ };
25
+ /**
26
+ * Set the available balance from the checkout session's customerProfile.storeCreditBalance
27
+ */
28
+ const storeCreditStoreSetBalanceFromSession = (balance) => {
29
+ log('Store credit balance from session', 'info', balance);
30
+ storeCreditStore.availableBalance = balance;
31
+ };
32
+ /**
33
+ * Re-fetch the store credit balance from the checkout session.
34
+ * Called when the payment step loads to ensure the balance is fresh.
35
+ */
36
+ const storeCreditStoreRefreshBalance = async () => {
37
+ var _a, _b;
38
+ const { errors, json } = await getCheckoutSession();
39
+ if (errors.length || !json) {
40
+ logError('Failed to refresh store credit balance');
41
+ return;
42
+ }
43
+ const balance = (_b = (_a = json.checkoutSession.customerProfile) === null || _a === void 0 ? void 0 : _a.storeCreditBalance) !== null && _b !== void 0 ? _b : null;
44
+ storeCreditStoreSetBalanceFromSession(balance);
45
+ };
46
+ /**
47
+ * Apply store credit to the checkout session.
48
+ * This must be called BEFORE payment confirmation.
49
+ * The amount/mode are already set via checkout session update with storeCreditApplication.
50
+ */
51
+ const storeCreditStoreApplyCredit = async () => {
52
+ var _a;
53
+ const checkoutSessionId = storageStore.checkoutSessionId;
54
+ if (!checkoutSessionId) {
55
+ const error = 'No checkout session found';
56
+ logError(error);
57
+ storeCreditStore.error = error;
58
+ return { error, success: false };
59
+ }
60
+ log('Applying store credit', 'info', { checkoutSessionId });
61
+ storeCreditStore.isApplying = true;
62
+ storeCreditStore.error = null;
63
+ try {
64
+ const { errors, json } = await handleFetch('/api/zonos-elements/store-credit/apply', {
65
+ body: {
66
+ checkoutSessionId,
67
+ },
68
+ method: 'POST',
69
+ });
70
+ if (errors.length > 0 || !json) {
71
+ const errorMessage = ((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.message) || 'Failed to apply store credit';
72
+ logError(errorMessage);
73
+ storeCreditStore.error = errorMessage;
74
+ storeCreditStore.isApplying = false;
75
+ return { error: errorMessage, success: false };
76
+ }
77
+ storeCreditStore.appliedAmount = json.amountApplied;
78
+ storeCreditStore.remainingBalance = json.remainingBalance;
79
+ storeCreditStore.isApplying = false;
80
+ log('Store credit applied', 'info', {
81
+ amountApplied: json.amountApplied,
82
+ remainingBalance: json.remainingBalance,
83
+ });
84
+ return { error: null, success: true };
85
+ }
86
+ catch (e) {
87
+ const errorMessage = e instanceof Error ? e.message : 'Failed to apply store credit';
88
+ logError(errorMessage);
89
+ storeCreditStore.error = errorMessage;
90
+ storeCreditStore.isApplying = false;
91
+ return { error: errorMessage, success: false };
92
+ }
93
+ };
94
+ /**
95
+ * Enable or disable store credit usage.
96
+ * When enabling, defaults to full balance mode.
97
+ * When disabling, clears the amount.
98
+ */
99
+ const storeCreditStoreSetEnabled = (enabled) => {
100
+ storeCreditStore.isEnabled = enabled;
101
+ storeCreditStore.error = null;
102
+ if (!enabled) {
103
+ storeCreditStore.amountToApply = null;
104
+ }
105
+ };
106
+ /**
107
+ * Set the amount of store credit to apply
108
+ * Validates against available balance and cart total
109
+ */
110
+ const storeCreditStoreSetAmount = (amount) => {
111
+ if (amount === null) {
112
+ storeCreditStore.amountToApply = null;
113
+ storeCreditStore.error = null;
114
+ return;
115
+ }
116
+ // Validate amount
117
+ if (amount <= 0) {
118
+ storeCreditStore.error = 'Amount must be greater than zero';
119
+ return;
120
+ }
121
+ if (storeCreditStore.availableBalance !== null &&
122
+ amount > storeCreditStore.availableBalance) {
123
+ storeCreditStore.error = 'Amount exceeds available balance';
124
+ return;
125
+ }
126
+ const orderTotal = cartStore.total + (cartStore.storeCredit || 0);
127
+ if (amount > orderTotal) {
128
+ storeCreditStore.error = 'Amount exceeds order total';
129
+ return;
130
+ }
131
+ storeCreditStore.error = null;
132
+ storeCreditStore.amountToApply = amount;
133
+ };
134
+ /**
135
+ * Toggle whether to use full balance or custom amount.
136
+ * When switching to custom mode, clears the applied amount so the user
137
+ * must explicitly apply via the Apply button.
138
+ */
139
+ const storeCreditStoreSetUseFullBalance = (useFullBalance) => {
140
+ storeCreditStore.useFullBalance = useFullBalance;
141
+ storeCreditStore.error = null;
142
+ if (useFullBalance && storeCreditStore.availableBalance !== null) {
143
+ const orderTotal = cartStore.total + (cartStore.storeCredit || 0);
144
+ const maxAmount = Math.min(storeCreditStore.availableBalance, orderTotal);
145
+ storeCreditStore.amountToApply = maxAmount;
146
+ }
147
+ else if (!useFullBalance) {
148
+ storeCreditStore.amountToApply = null;
149
+ }
150
+ };
151
+ /**
152
+ * Get the storeCreditApplication input for checkout session update.
153
+ * Sends mode: 'NONE' when store credit is not being used to clear any
154
+ * previously applied store credit on the backend.
155
+ */
156
+ const storeCreditStoreGetInput = () => {
157
+ if (!storeCreditStore.isEnabled || storeCreditStore.amountToApply === null) {
158
+ return { mode: 'NONE' };
159
+ }
160
+ if (storeCreditStore.useFullBalance) {
161
+ return { mode: 'FULL' };
162
+ }
163
+ return {
164
+ amount: storeCreditStore.amountToApply,
165
+ mode: 'PARTIAL',
166
+ };
167
+ };
168
+ /**
169
+ * Get the effective amount to apply based on settings
170
+ */
171
+ const storeCreditStoreGetEffectiveAmount = () => {
172
+ if (!storeCreditStore.isEnabled ||
173
+ storeCreditStore.availableBalance === null) {
174
+ return 0;
175
+ }
176
+ if (storeCreditStore.useFullBalance) {
177
+ return Math.min(storeCreditStore.availableBalance, cartStore.total + (cartStore.storeCredit || 0));
178
+ }
179
+ return storeCreditStore.amountToApply || 0;
180
+ };
181
+ /**
182
+ * Check whether the effective store credit amount covers the full order total.
183
+ * When true, the Stripe/PayPal payment flow should be skipped and
184
+ * `storeCreditStoreCreateOrder` should be used instead.
185
+ *
186
+ * Relies on the backend's computed `cartStore.total` (remaining amount to pay
187
+ * after store credit) rather than a client-side comparison, which avoids issues
188
+ * with currency mismatches or rounding.
189
+ */
190
+ const storeCreditStoreCoversFullAmount = () => {
191
+ // Only consider full coverage after the backend has confirmed store credit
192
+ // was applied (cartStore.storeCredit > 0) and the remaining total is 0.
193
+ return (storeCreditStore.amountToApply !== null &&
194
+ storeCreditStore.amountToApply > 0 &&
195
+ cartStore.storeCredit > 0 &&
196
+ cartStore.total <= 0);
197
+ };
198
+ /**
199
+ * Create an order paid entirely by store credit.
200
+ * Should only be called when `storeCreditStoreCoversFullAmount()` is true.
201
+ */
202
+ const storeCreditStoreCreateOrder = async () => {
203
+ var _a, _b, _c;
204
+ const checkoutSessionId = storageStore.checkoutSessionId;
205
+ if (!checkoutSessionId) {
206
+ const error = 'No checkout session found';
207
+ logError(error);
208
+ storeCreditStore.error = error;
209
+ return { error, orderId: null, success: false };
210
+ }
211
+ log('Creating store credit order', 'info', { checkoutSessionId });
212
+ try {
213
+ const { errors, json } = await handleFetch('/api/zonos-elements/store-credit/order-create', {
214
+ body: {
215
+ checkoutSessionId,
216
+ },
217
+ method: 'POST',
218
+ });
219
+ if (errors.length > 0 || !json) {
220
+ const errorMessage = ((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.message) || 'Failed to create store credit order';
221
+ logError(errorMessage);
222
+ storeCreditStore.error = errorMessage;
223
+ return { error: errorMessage, orderId: null, success: false };
224
+ }
225
+ const orderId = ((_c = (_b = json.checkoutSessionStoreCreditOrderCreate) === null || _b === void 0 ? void 0 : _b.order) === null || _c === void 0 ? void 0 : _c.id) || null;
226
+ storeCreditStore.orderIdCreated = orderId;
227
+ log('Store credit order created', 'info', { orderId });
228
+ return { error: null, orderId, success: true };
229
+ }
230
+ catch (e) {
231
+ const errorMessage = e instanceof Error ? e.message : 'Failed to create store credit order';
232
+ logError(errorMessage);
233
+ storeCreditStore.error = errorMessage;
234
+ return { error: errorMessage, orderId: null, success: false };
235
+ }
236
+ };
237
+ export { storeCreditStore, storeCreditStoreApplyCredit, storeCreditStoreCoversFullAmount, storeCreditStoreCreateOrder, storeCreditStoreGetEffectiveAmount, storeCreditStoreGetInput, storeCreditStoreOnChange, storeCreditStoreRefreshBalance, storeCreditStoreReset, storeCreditStoreSetAmount, storeCreditStoreSetBalanceFromSession, storeCreditStoreSetEnabled, storeCreditStoreSetUseFullBalance, };
@@ -1025,7 +1025,7 @@ const stripeStoreUpdateCheckoutSessionBaseCurrency = async () => {
1025
1025
  /**
1026
1026
  * Update checkout session. Use for updating amount with landed cost id, or update session when cart items change
1027
1027
  */
1028
- const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, currency, id, itemsAmount, landedCostId, presentmentCountryCode, }) => {
1028
+ const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, currency, id, itemsAmount, landedCostId, presentmentCountryCode, storeCreditApplication, }) => {
1029
1029
  const varianceTestInput = storageStore.enabledVariantTestKeys || [];
1030
1030
  // No need to set loading state here because this function will be called under the hood to update
1031
1031
  // landed cost id for the section.
@@ -1048,6 +1048,7 @@ const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, cur
1048
1048
  presentmentCountryCode,
1049
1049
  shipToPartyId: stripeStore.partyShippingId,
1050
1050
  skipPaymentIntent: stripeStore.skipPaymentIntent,
1051
+ storeCreditApplication,
1051
1052
  varianceTestInput,
1052
1053
  },
1053
1054
  method: 'POST',
@@ -44,18 +44,27 @@ export const stringsArabic = {
44
44
  'Adresa vulytsi': {
45
45
  value: 'عنوان الشارع',
46
46
  },
47
+ 'Amount to apply: [amount]': {
48
+ value: 'Amount to apply: [amount]',
49
+ },
47
50
  'An unexpected error occurred when processing PayPal order.': {
48
51
  value: 'حدث خطأ غير متوقع عند معالجة طلب PayPal.',
49
52
  },
50
53
  Apply: {
51
54
  value: 'تطبيق',
52
55
  },
56
+ 'Apply full balance': {
57
+ value: 'Apply full balance',
58
+ },
53
59
  'Are you sure?': {
54
60
  value: 'هل أنت متأكد؟',
55
61
  },
56
62
  Area: {
57
63
  value: 'منطقة',
58
64
  },
65
+ 'Available balance: [amount]': {
66
+ value: 'Available balance: [amount]',
67
+ },
59
68
  Back: {
60
69
  value: 'رجوع',
61
70
  },
@@ -224,6 +233,9 @@ export const stringsArabic = {
224
233
  Emirate: {
225
234
  value: 'إمارة',
226
235
  },
236
+ 'Enter amount': {
237
+ value: 'Enter amount',
238
+ },
227
239
  'Error creating Checkout': {
228
240
  value: 'خطأ في إنشاء جلسة الخروج',
229
241
  },
@@ -347,6 +359,9 @@ export const stringsArabic = {
347
359
  'No shipping methods found - try editing your address or contacting support if the error persists': {
348
360
  value: 'لم يتم العثور على طرق شحن - جرب تحرير عنوانك أو الاتصال بالدعم إذا استمر الخطأ',
349
361
  },
362
+ 'No store credit available': {
363
+ value: 'No store credit available',
364
+ },
350
365
  'Nothing due at delivery': {
351
366
  value: 'لا شيء مستحق عند التسليم',
352
367
  },
@@ -413,6 +428,9 @@ export const stringsArabic = {
413
428
  'Phone number': {
414
429
  value: 'رقم الهاتف',
415
430
  },
431
+ 'Place order': {
432
+ value: 'تقديم الطلب',
433
+ },
416
434
  'Place test order': {
417
435
  value: 'إجراء طلب اختبار',
418
436
  },
@@ -569,6 +587,12 @@ export const stringsArabic = {
569
587
  'State/Province/Region/Prefecture': {
570
588
  value: 'ولاية/مقاطعة/منطقة/محافظة',
571
589
  },
590
+ 'Store credit': {
591
+ value: 'Store credit',
592
+ },
593
+ 'Store credit covers your full order': {
594
+ value: 'يغطي رصيد المتجر طلبك بالكامل',
595
+ },
572
596
  'Street address': {
573
597
  value: 'عنوان الشارع',
574
598
  },
@@ -656,12 +680,18 @@ export const stringsArabic = {
656
680
  Ulica: {
657
681
  value: 'شارع',
658
682
  },
683
+ 'Unable to apply store credit. Please try again.': {
684
+ value: 'Unable to apply store credit. Please try again.',
685
+ },
659
686
  'Unable to check inventory. Please try again.': {
660
687
  value: 'تعذر التحقق من المخزون. حاول مرة أخرى.',
661
688
  },
662
689
  'Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.': {
663
690
  value: 'غير قادر على إتمام الدفع بعملة [currency]. يرجى المحاولة مرة أخرى أو اختيار عملة مختلفة. إذا استمرت المشكلة، اتصل بفريق الدعم لدينا للحصول على المساعدة.',
664
691
  },
692
+ 'Unable to place order with store credit. Please try again.': {
693
+ value: 'تعذر إتمام الطلب باستخدام رصيد المتجر. يرجى المحاولة مرة أخرى.',
694
+ },
665
695
  'Unable to retrieve the checkout session at the moment. Please try again or contact our support team.': {
666
696
  value: 'غير قادر على استرداد جلسة الدفع في الوقت الحالي. يرجى المحاولة مرة أخرى أو الاتصال بفريق الدعم لدينا.',
667
697
  },
@@ -674,6 +704,9 @@ export const stringsArabic = {
674
704
  'Update your address': {
675
705
  value: 'قم بتحديث عنوانك',
676
706
  },
707
+ 'Use store credit': {
708
+ value: 'Use store credit',
709
+ },
677
710
  'View GAA Form.': {
678
711
  value: 'عرض نموذج GAA.',
679
712
  },
@@ -686,6 +719,9 @@ export const stringsArabic = {
686
719
  "We couldn't complete your payment. Please verify the payment details and try again.": {
687
720
  value: 'تعذر علينا اكمال الدفع. يرجى التحقق من تفاصيل الدفع وإعادة المحاولة.',
688
721
  },
722
+ 'We detected that you are shipping to a domestic address.': {
723
+ value: 'لقد اكتشفنا أنك تقوم بالشحن إلى عنوان محلي.',
724
+ },
689
725
  'We detected that you are shipping to an international address.': {
690
726
  value: 'لقد اكتشفنا أنك تقوم بالشحن إلى عنوان دولي.',
691
727
  },
@@ -713,6 +749,9 @@ export const stringsArabic = {
713
749
  "You will be redirected back to the merchant's site in a few seconds.": {
714
750
  value: 'سيتم إعادة توجيهك إلى موقع التاجر في غضون ثوانٍ قليلة.',
715
751
  },
752
+ 'You will be redirected to domestic checkout shortly.': {
753
+ value: 'سيتم إعادة توجيهك إلى الخروج المحلي قريبًا.',
754
+ },
716
755
  'You will be redirected to international checkout shortly.': {
717
756
  value: 'سيتم إعادة توجيهك إلى الخروج الدولي قريبًا.',
718
757
  },