@zonos/elements 1.3.249 → 1.3.250

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 (242) hide show
  1. package/dist/cjs/{cart-eca56521.js → cart-fcd1359c.js} +318 -19
  2. package/dist/cjs/{hasInclusivePrice-e7d67b45.js → hasInclusivePrice-745a8f29.js} +1 -1
  3. package/dist/cjs/index.cjs.js +7 -7
  4. package/dist/cjs/{invoice-918f2c2b.js → invoice-f040e147.js} +2 -2
  5. package/dist/cjs/{isCollectMobileTablet-89911215.js → isCollectMobileTablet-cf92852e.js} +2 -2
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/{localization-878ef681.js → localization-523b793a.js} +660 -0
  8. package/dist/cjs/{paypal-6acca678.js → paypal-8c98c0a1.js} +29 -2
  9. package/dist/cjs/{placeTestOrder-f1c1e939.js → placeTestOrder-9b1e09f0.js} +2 -2
  10. package/dist/cjs/{renderCheckoutCurrency-d9590e81.js → renderCheckoutCurrency-94b6e51d.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 +52 -3
  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 +52 -1
  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 +33 -0
  46. package/dist/collection/components/store/translationStore/strings.base.js +33 -0
  47. package/dist/collection/components/store/translationStore/strings.chinese.js +33 -0
  48. package/dist/collection/components/store/translationStore/strings.danish.js +33 -0
  49. package/dist/collection/components/store/translationStore/strings.dutch.js +33 -0
  50. package/dist/collection/components/store/translationStore/strings.french.js +33 -0
  51. package/dist/collection/components/store/translationStore/strings.german.js +33 -0
  52. package/dist/collection/components/store/translationStore/strings.hebrew.js +33 -0
  53. package/dist/collection/components/store/translationStore/strings.indonesian.js +33 -0
  54. package/dist/collection/components/store/translationStore/strings.italian.js +33 -0
  55. package/dist/collection/components/store/translationStore/strings.japanese.js +33 -0
  56. package/dist/collection/components/store/translationStore/strings.korean.js +33 -0
  57. package/dist/collection/components/store/translationStore/strings.norwegian.js +33 -0
  58. package/dist/collection/components/store/translationStore/strings.polish.js +33 -0
  59. package/dist/collection/components/store/translationStore/strings.portuguese.js +33 -0
  60. package/dist/collection/components/store/translationStore/strings.russian.js +33 -0
  61. package/dist/collection/components/store/translationStore/strings.spanish.js +33 -0
  62. package/dist/collection/components/store/translationStore/strings.swedish.js +33 -0
  63. package/dist/collection/components/store/translationStore/strings.turkish.js +33 -0
  64. package/dist/collection/components/store/translationStore/strings.vietnamese.js +33 -0
  65. package/dist/collection/types/generated/graphql.internal.types.js +589 -0
  66. package/dist/esm/{cart-efb30253.js → cart-6e465f7b.js} +309 -21
  67. package/dist/esm/{hasInclusivePrice-565ddbe5.js → hasInclusivePrice-c49d384d.js} +1 -1
  68. package/dist/esm/index.js +7 -7
  69. package/dist/esm/{invoice-0e462fcc.js → invoice-d416ba65.js} +2 -2
  70. package/dist/esm/{isCollectMobileTablet-0bcba25a.js → isCollectMobileTablet-48040572.js} +2 -2
  71. package/dist/esm/loader.js +1 -1
  72. package/dist/esm/{localization-c1aff677.js → localization-f4a7fb5a.js} +660 -0
  73. package/dist/esm/{paypal-06b67be0.js → paypal-6af6b978.js} +29 -2
  74. package/dist/esm/{placeTestOrder-6c9a6c8a.js → placeTestOrder-d19ac166.js} +2 -2
  75. package/dist/esm/{renderCheckoutCurrency-910fea67.js → renderCheckoutCurrency-c8aa8e7e.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 +52 -3
  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-6e465f7b.js +1 -0
  97. package/dist/esm-es5/hasInclusivePrice-c49d384d.js +1 -0
  98. package/dist/esm-es5/index.js +1 -1
  99. package/dist/esm-es5/{invoice-0e462fcc.js → invoice-d416ba65.js} +1 -1
  100. package/dist/esm-es5/{isCollectMobileTablet-0bcba25a.js → isCollectMobileTablet-48040572.js} +1 -1
  101. package/dist/esm-es5/loader.js +1 -1
  102. package/dist/esm-es5/localization-f4a7fb5a.js +1 -0
  103. package/dist/esm-es5/paypal-6af6b978.js +17 -0
  104. package/dist/esm-es5/{placeTestOrder-6c9a6c8a.js → placeTestOrder-d19ac166.js} +1 -1
  105. package/dist/esm-es5/{renderCheckoutCurrency-910fea67.js → renderCheckoutCurrency-c8aa8e7e.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 +58 -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/store/checkout/cart.d.ts +8 -1
  133. package/dist/types/components/store/checkout/storeCredit.d.ts +111 -0
  134. package/dist/types/components/store/checkout/stripe.d.ts +1 -1
  135. package/dist/types/components/store/translationStore/strings.arabic.d.ts +33 -0
  136. package/dist/types/components/store/translationStore/strings.base.d.ts +33 -0
  137. package/dist/types/components/store/translationStore/strings.chinese.d.ts +33 -0
  138. package/dist/types/components/store/translationStore/strings.danish.d.ts +33 -0
  139. package/dist/types/components/store/translationStore/strings.dutch.d.ts +33 -0
  140. package/dist/types/components/store/translationStore/strings.french.d.ts +33 -0
  141. package/dist/types/components/store/translationStore/strings.german.d.ts +33 -0
  142. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +33 -0
  143. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +33 -0
  144. package/dist/types/components/store/translationStore/strings.italian.d.ts +33 -0
  145. package/dist/types/components/store/translationStore/strings.japanese.d.ts +33 -0
  146. package/dist/types/components/store/translationStore/strings.korean.d.ts +33 -0
  147. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +33 -0
  148. package/dist/types/components/store/translationStore/strings.polish.d.ts +33 -0
  149. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +33 -0
  150. package/dist/types/components/store/translationStore/strings.russian.d.ts +33 -0
  151. package/dist/types/components/store/translationStore/strings.spanish.d.ts +33 -0
  152. package/dist/types/components/store/translationStore/strings.swedish.d.ts +33 -0
  153. package/dist/types/components/store/translationStore/strings.turkish.d.ts +33 -0
  154. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +33 -0
  155. package/dist/types/components.d.ts +21 -0
  156. package/dist/types/types/checkout/api/CheckoutSession.d.ts +9 -1
  157. package/dist/types/types/generated/graphql.internal.types.d.ts +713 -4
  158. package/dist/types/types/generated/graphql.internal.types.ts +956 -4
  159. package/dist/zonos-elements/index.esm.js +1 -1
  160. package/dist/zonos-elements/{p-456c0e52.js → p-13ed3789.js} +1 -1
  161. package/dist/zonos-elements/{p-0a2abbab.system.entry.js → p-17fbfda0.system.entry.js} +1 -1
  162. package/dist/zonos-elements/{p-8a424412.entry.js → p-1b56814d.entry.js} +1 -1
  163. package/dist/zonos-elements/p-1e6509d7.js +1 -0
  164. package/dist/zonos-elements/{p-3ad2a9a3.system.entry.js → p-1f63615f.system.entry.js} +1 -1
  165. package/dist/zonos-elements/p-2435f196.entry.js +1 -0
  166. package/dist/zonos-elements/{p-4d4b7faa.entry.js → p-26848428.entry.js} +1 -1
  167. package/dist/zonos-elements/p-28d62fc8.system.entry.js +1 -0
  168. package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
  169. package/dist/zonos-elements/p-2b7ef406.system.js +18 -0
  170. package/dist/zonos-elements/{p-54c95926.entry.js → p-3827041d.entry.js} +1 -1
  171. package/dist/zonos-elements/{p-321d2963.js → p-48228d76.js} +1 -1
  172. package/dist/zonos-elements/p-4d5932ac.system.entry.js +1 -0
  173. package/dist/zonos-elements/{p-4d081ce8.entry.js → p-59fe8416.entry.js} +1 -1
  174. package/dist/zonos-elements/{p-101226f3.system.entry.js → p-5ca50862.system.entry.js} +1 -1
  175. package/dist/zonos-elements/{p-36bea5d5.system.entry.js → p-5fceccc3.system.entry.js} +1 -1
  176. package/dist/zonos-elements/p-64ad0854.entry.js +1 -0
  177. package/dist/zonos-elements/{p-c87d3d50.system.js → p-65892fa7.system.js} +1 -1
  178. package/dist/zonos-elements/{p-b9a4430c.entry.js → p-66e1dc55.entry.js} +1 -1
  179. package/dist/zonos-elements/{p-09110bb7.system.entry.js → p-7042c6da.system.entry.js} +1 -1
  180. package/dist/zonos-elements/p-741e07e1.system.entry.js +1 -0
  181. package/dist/zonos-elements/{p-0aeba2c7.system.js → p-77113201.system.js} +1 -1
  182. package/dist/zonos-elements/{p-6d37f669.entry.js → p-77c0a02b.entry.js} +1 -1
  183. package/dist/zonos-elements/{p-a75b3efc.system.entry.js → p-85529818.system.entry.js} +1 -1
  184. package/dist/zonos-elements/p-8f1ab25c.system.entry.js +1 -0
  185. package/dist/zonos-elements/{p-1b5f89d5.system.js → p-90b8c428.system.js} +1 -1
  186. package/dist/zonos-elements/p-997b7eef.js +1 -0
  187. package/dist/zonos-elements/{p-4c087a8e.system.entry.js → p-9bc5e944.system.entry.js} +1 -1
  188. package/dist/zonos-elements/p-9c6917ab.system.js +1 -0
  189. package/dist/zonos-elements/{p-358dfb9e.entry.js → p-9d64783a.entry.js} +1 -1
  190. package/dist/zonos-elements/{p-1f1bf95c.system.entry.js → p-9f49e35a.system.entry.js} +1 -1
  191. package/dist/zonos-elements/{p-3ece0f96.system.entry.js → p-a026b5ad.system.entry.js} +1 -1
  192. package/dist/zonos-elements/{p-4a395eea.system.entry.js → p-a1a3657e.system.entry.js} +1 -1
  193. package/dist/zonos-elements/{p-079bc009.system.entry.js → p-a1b0e9a5.system.entry.js} +1 -1
  194. package/dist/zonos-elements/p-a6a401e5.system.entry.js +1 -0
  195. package/dist/zonos-elements/{p-302b7105.system.entry.js → p-b07da3e8.system.entry.js} +1 -1
  196. package/dist/zonos-elements/{p-f31fbbf0.entry.js → p-b08bf843.entry.js} +1 -1
  197. package/dist/zonos-elements/p-b334c76c.entry.js +1 -0
  198. package/dist/zonos-elements/{p-bc6b33fa.entry.js → p-b9581a92.entry.js} +1 -1
  199. package/dist/zonos-elements/p-c30a155e.js +1 -0
  200. package/dist/zonos-elements/{p-9c64ca98.system.entry.js → p-cad67b10.system.entry.js} +1 -1
  201. package/dist/zonos-elements/p-cc78c9d4.js +17 -0
  202. package/dist/zonos-elements/{p-5eaa0de1.entry.js → p-d2301d8a.entry.js} +1 -1
  203. package/dist/zonos-elements/p-d46484aa.entry.js +1 -0
  204. package/dist/zonos-elements/{p-b589f621.system.entry.js → p-d634f954.system.entry.js} +1 -1
  205. package/dist/zonos-elements/p-df316670.system.js +1 -0
  206. package/dist/zonos-elements/p-e331a235.js +1 -0
  207. package/dist/zonos-elements/p-e4d58bd7.js +1 -0
  208. package/dist/zonos-elements/{p-8d1efd7b.entry.js → p-e9ca4447.entry.js} +1 -1
  209. package/dist/zonos-elements/{p-c9e3bc98.system.js → p-f0855df3.system.js} +1 -1
  210. package/dist/zonos-elements/{p-06e2bc14.entry.js → p-f25e7f5a.entry.js} +1 -1
  211. package/dist/zonos-elements/{p-b360ee5b.entry.js → p-f4cc124f.entry.js} +1 -1
  212. package/dist/zonos-elements/{p-bd004403.system.js → p-fa0139c3.system.js} +1 -1
  213. package/dist/zonos-elements/{p-8b206982.system.js → p-fa5767c3.system.js} +1 -1
  214. package/dist/zonos-elements/{p-26718a78.entry.js → p-fbfaa4f9.entry.js} +1 -1
  215. package/dist/zonos-elements/p-fe6cc354.entry.js +1 -0
  216. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  217. package/package.json +1 -1
  218. package/dist/cjs/zonos-toggle.cjs.entry.js +0 -35
  219. package/dist/esm/zonos-toggle.entry.js +0 -31
  220. package/dist/esm-es5/cart-efb30253.js +0 -1
  221. package/dist/esm-es5/hasInclusivePrice-565ddbe5.js +0 -1
  222. package/dist/esm-es5/localization-c1aff677.js +0 -1
  223. package/dist/esm-es5/paypal-06b67be0.js +0 -17
  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-127e0395.js +0 -17
  228. package/dist/zonos-elements/p-197d9b23.system.entry.js +0 -1
  229. package/dist/zonos-elements/p-25dd58f8.system.entry.js +0 -1
  230. package/dist/zonos-elements/p-445072f8.js +0 -1
  231. package/dist/zonos-elements/p-507f00d2.js +0 -1
  232. package/dist/zonos-elements/p-5fd0cd66.system.js +0 -1
  233. package/dist/zonos-elements/p-661cd4ce.system.entry.js +0 -1
  234. package/dist/zonos-elements/p-777e0a81.entry.js +0 -1
  235. package/dist/zonos-elements/p-7e77b055.system.entry.js +0 -1
  236. package/dist/zonos-elements/p-80524eac.entry.js +0 -1
  237. package/dist/zonos-elements/p-9eea270b.entry.js +0 -1
  238. package/dist/zonos-elements/p-c4e358f2.js +0 -1
  239. package/dist/zonos-elements/p-cda52300.js +0 -1
  240. package/dist/zonos-elements/p-d233ef0d.entry.js +0 -1
  241. package/dist/zonos-elements/p-f8f7d491.js +0 -1
  242. package/dist/zonos-elements/p-fc0aa91e.system.js +0 -18
@@ -1,17 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(r,e,t,o){function n(r){return r instanceof t?r:new t((function(e){e(r)}))}return new(t||(t=Promise))((function(t,a){function i(r){try{c(o.next(r))}catch(r){a(r)}}function u(r){try{c(o["throw"](r))}catch(r){a(r)}}function c(r){r.done?t(r.value):n(r.value).then(i,u)}c((o=o.apply(r,e||[])).next())}))};var __generator=this&&this.__generator||function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},o,n,a,i;return i={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function u(r){return function(e){return c([r,e])}}function c(u){if(o)throw new TypeError("Generator is already executing.");while(i&&(i=0,u[0]&&(t=0)),t)try{if(o=1,n&&(a=u[0]&2?n["return"]:u[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,u[1])).done)return a;if(n=0,a)u=[u[0]&2,a.value];switch(u[0]){case 0:case 1:a=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;n=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(a=t.trys,a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1];a=u;break}if(a&&t.label<a[2]){t.label=a[2];t.ops.push(u);break}if(a[2])t.ops.pop();t.trys.pop();continue}u=e.call(r,t)}catch(r){u=[6,r];n=0}finally{o=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};import{c as createStore,z as zonosStore}from"./zonosStore-5242a58d.js";import{t as trackConversionEvent,A as validateCheckoutSession,b as stripeStore,d as cartStore,v as stripeStoreHandleInventoryCheck,r as cartStoreNextStep,h as cartStoreClearCheckoutInterval}from"./cart-efb30253.js";import{t as translate,s as storageStore}from"./localization-c1aff677.js";import{h as handleFetch,l as logError,j as jsonParse}from"./handleFetch-a844cac1.js";import{i as isContrastColor}from"./isContrastColor-c17e83c9.js";import{l as log}from"./VarianceTest-572cecf5.js";import{s as submitGtag}from"./submitGtag-13de9f1f.js";
2
- /*!
3
- * paypal-js v8.4.2 (2025-09-04T17:21:30.135Z)
4
- * Copyright 2020-present, PayPal, Inc. All rights reserved.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */function __rest(r,e){var t={};for(var o in r)if(Object.prototype.hasOwnProperty.call(r,o)&&e.indexOf(o)<0)t[o]=r[o];if(r!=null&&typeof Object.getOwnPropertySymbols==="function")for(var n=0,o=Object.getOwnPropertySymbols(r);n<o.length;n++){if(e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(r,o[n]))t[o[n]]=r[o[n]]}return t}typeof SuppressedError==="function"?SuppressedError:function(r,e,t){var o=new Error(t);return o.name="SuppressedError",o.error=r,o.suppressed=e,o};function findScript(r,e){var t=document.querySelector('script[src="'.concat(r,'"]'));if(t===null)return null;var o=createScriptElement(r,e);var n=t.cloneNode();delete n.dataset.uidAuto;if(Object.keys(n.dataset).length!==Object.keys(o.dataset).length){return null}var a=true;Object.keys(n.dataset).forEach((function(r){if(n.dataset[r]!==o.dataset[r]){a=false}}));return a?t:null}function insertScriptElement(r){var e=r.url,t=r.attributes,o=r.onSuccess,n=r.onError;var a=createScriptElement(e,t);a.onerror=n;a.onload=o;document.head.insertBefore(a,document.head.firstElementChild)}function processOptions(r){var e=r.sdkBaseUrl,t=r.environment,o=__rest(r,["sdkBaseUrl","environment"]);var n=e||processSdkBaseUrl(t);var a=o;var i=Object.keys(a).filter((function(r){return typeof a[r]!=="undefined"&&a[r]!==null&&a[r]!==""})).reduce((function(r,e){var t=a[e].toString();e=camelCaseToKebabCase(e);if(e.substring(0,4)==="data"||e==="crossorigin"){r.attributes[e]=t}else{r.queryParams[e]=t}return r}),{queryParams:{},attributes:{}}),u=i.queryParams,c=i.attributes;if(u["merchant-id"]&&u["merchant-id"].indexOf(",")!==-1){c["data-merchant-id"]=u["merchant-id"];u["merchant-id"]="*"}return{url:"".concat(n,"?").concat(objectToQueryString(u)),attributes:c}}function camelCaseToKebabCase(r){var e=function(r,e){return(e?"-":"")+r.toLowerCase()};return r.replace(/[A-Z]+(?![a-z])|[A-Z]/g,e)}function objectToQueryString(r){var e="";Object.keys(r).forEach((function(t){if(e.length!==0)e+="&";e+=t+"="+r[t]}));return e}function processSdkBaseUrl(r){return r==="sandbox"?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js"}function createScriptElement(r,e){if(e===void 0){e={}}var t=document.createElement("script");t.src=r;Object.keys(e).forEach((function(r){t.setAttribute(r,e[r]);if(r==="data-csp-nonce"){t.setAttribute("nonce",e["data-csp-nonce"])}}));return t}function loadScript(r,e){if(e===void 0){e=Promise}validateArguments(r,e);if(typeof document==="undefined")return e.resolve(null);var t=processOptions(r),o=t.url,n=t.attributes;var a=n["data-namespace"]||"paypal";var i=getPayPalWindowNamespace(a);if(!n["data-js-sdk-library"]){n["data-js-sdk-library"]="paypal-js"}if(findScript(o,n)&&i){return e.resolve(i)}return loadCustomScript({url:o,attributes:n},e).then((function(){var r=getPayPalWindowNamespace(a);if(r){return r}throw new Error("The window.".concat(a," global variable is not available."))}))}function loadCustomScript(r,e){if(e===void 0){e=Promise}validateArguments(r,e);var t=r.url,o=r.attributes;if(typeof t!=="string"||t.length===0){throw new Error("Invalid url.")}if(typeof o!=="undefined"&&typeof o!=="object"){throw new Error("Expected attributes to be an object.")}return new e((function(r,e){if(typeof document==="undefined")return r();insertScriptElement({url:t,attributes:o,onSuccess:function(){return r()},onError:function(){var r=new Error('The script "'.concat(t,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return e(r)}})}))}function getPayPalWindowNamespace(r){return window[r]}function validateArguments(r,e){if(typeof r!=="object"||r===null){throw new Error("Expected an options object.")}var t=r.environment;if(t&&t!=="production"&&t!=="sandbox"){throw new Error('The `environment` option must be either "production" or "sandbox".')}if(typeof e!=="undefined"&&typeof e!=="function"){throw new Error("Expected PromisePonyfill to be a function.")}}var paypalCaptureOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o;var n=r.checkoutSessionId,a=r.paypalMockResponse;return __generator(this,(function(r){switch(r.label){case 0:return[4,handleFetch("/api/zonos-elements/capture-paypal-order",{body:{checkoutSessionId:n,paypalMockResponse:a},method:"POST"})];case 1:e=r.sent(),t=e.errors,o=e.json;return[2,{errors:t,json:o}]}}))}))};var paypalCreateOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o;var n=r.checkoutSessionId,a=r.intent;return __generator(this,(function(r){switch(r.label){case 0:return[4,handleFetch("/api/zonos-elements/create-paypal-order",{body:{checkoutSessionId:n,intent:a},method:"POST"})];case 1:e=r.sent(),t=e.errors,o=e.json;return[2,{errors:t,json:o}]}}))}))};var _c=createStore((function(){return{intent:"capture",orderIdCreated:null,paypal:null,paypalButtons:[],paypalClientId:"",paypalErrorMessage:null}})),paypalStoreOnChange=_c.onChange,paypalStoreReset=_c.reset,paypalStore=_c.state;var paypalStoreCreaterOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o,n,a,i,u;var c=r.checkoutSessionId;return __generator(this,(function(r){switch(r.label){case 0:o=paypalStore.intent.toUpperCase();return[4,paypalCreateOrder({checkoutSessionId:c,intent:o})];case 1:n=r.sent(),a=n.errors,i=n.json;u=(e=i===null||i===void 0?void 0:i.paypalOrderCreate)===null||e===void 0?void 0:e.paypalOrderId;if(a.length||!u){throw new Error(((t=a.find(Boolean))===null||t===void 0?void 0:t.message)||"An unexpected error occurred when creating paypal order.")}return[2,u]}}))}))};var paypalStoreCaptureOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o,n,a,i;var u=r.checkoutSessionId,c=r.paypalMockResponse;return __generator(this,(function(r){switch(r.label){case 0:return[4,paypalCaptureOrder({checkoutSessionId:u,paypalMockResponse:c})];case 1:o=r.sent(),n=o.errors,a=o.json;i=(e=a===null||a===void 0?void 0:a.paypalOrderCapture.order)===null||e===void 0?void 0:e.id;if(n.length||!i){throw new Error(((t=n.find(Boolean))===null||t===void 0?void 0:t.message)||translate("An unexpected error occurred when processing PayPal order."))}return[2,i]}}))}))};var paypalErrorHandler=function(r){var e=r.error;var t;var o=jsonParse(e.message);var n=(t=o===null||o===void 0?void 0:o.errors.find(Boolean))===null||t===void 0?void 0:t.message;var a=(n===null||n===void 0?void 0:n.match(/\[(.*?)\] (.*)/i))||[];if(!a){paypalStore.paypalErrorMessage=translate("An unexpected error occurred when processing PayPal order.")}var i=a[2]||translate("An unexpected error occurred when processing PayPal order.");paypalStore.paypalErrorMessage=i};var paypalButtonOptions=function(r){var e=r.checkoutSessionId,t=r.onPaypalFail,o=r.onPaypalSessionDone,n=r.overrideBorderRaidus,a=r.overridePrimaryColor;var i=a||zonosStore.appearance.colorPrimary;var u="#ffc33a";var c=isContrastColor({backgroundColor1:u,backgroundColor2:i||""});return{createOrder:function(){return __awaiter(void 0,void 0,void 0,(function(){var r,o,n,a,i;return __generator(this,(function(u){switch(u.label){case 0:void trackConversionEvent({checkoutSessionId:e,eventName:"checkout_paymentInfoCompleted",metadata:{paymentMethod:"paypal"}});return[4,validateCheckoutSession()];case 1:r=u.sent();if(!r.valid){paypalStore.paypalErrorMessage=r.errorMessage;stripeStore.hasPaymentError=false;stripeStore.customErrorMessage=null;submitGtag({event:"zonos-checkout-payment-fail",metadata:{checkoutSessionId:e}});t===null||t===void 0?void 0:t();return[2,""]}u.label=2;case 2:u.trys.push([2,8,,9]);paypalStore.paypalErrorMessage=null;cartStore.inventoryCheckErrorMessage=null;u.label=3;case 3:u.trys.push([3,5,,6]);o=cartStore;return[4,stripeStoreHandleInventoryCheck()];case 4:o.inventoryCheckErrorMessage=u.sent();return[3,6];case 5:n=u.sent();cartStore.inventoryCheckErrorMessage=translate("Unable to check inventory. Please try again.");return[3,6];case 6:if(cartStore.inventoryCheckErrorMessage){return[2,""]}return[4,paypalStoreCreaterOrder({checkoutSessionId:e})];case 7:a=u.sent();return[2,a];case 8:i=u.sent();logError("Failed to create paypal order",i);paypalStore.paypalErrorMessage=translate("Failed to create PayPal order. Please try again, or consider using an alternative method.");stripeStore.hasPaymentError=false;stripeStore.customErrorMessage=null;submitGtag({event:"zonos-checkout-payment-fail",metadata:{checkoutSessionId:e}});t===null||t===void 0?void 0:t();return[2,""];case 9:return[2]}}))}))},onApprove:function(r,n){return __awaiter(void 0,void 0,void 0,(function(){var r,n;return __generator(this,(function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);paypalStore.paypalErrorMessage=null;submitGtag({event:"zonos-checkout-payment-info",metadata:{checkoutSessionId:e,paymentMethod:"paypal"}});return[4,paypalStoreCaptureOrder({checkoutSessionId:e,paypalMockResponse:window.Zonos._paypalMockResponse})];case 1:r=a.sent();paypalStore.orderIdCreated=r;o===null||o===void 0?void 0:o({orderId:r});cartStoreNextStep();cartStoreClearCheckoutInterval();return[3,3];case 2:n=a.sent();logError("==== Failed to capture paypal order",n);if(n instanceof Error){return[2,paypalErrorHandler({error:n})]}t===null||t===void 0?void 0:t();return[3,3];case 3:return[2]}}))}))},style:{borderRadius:n==="SHARP"?0:10,color:c?"gold":"blue",shape:"rect"}}};var paypalStoreResetButtons=function(){if(!paypalStore.paypalButtons.length){return}paypalStore.paypalButtons.forEach((function(r){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,r.close()];case 1:e.sent();return[2]}}))}))}));paypalStore.paypalButtons=[]};var paypalInitScript=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o,n,a,i;var u=r.currency;return __generator(this,(function(r){switch(r.label){case 0:t=!!((e=zonosStore.checkoutSettings.externalPaymentMethods)===null||e===void 0?void 0:e.find((function(r){return r.type==="PAYPAL"&&r.status==="ENABLED"})));if(!t){log("=== Paypal is disabled for this store","warn");return[2]}o=zonosStore.checkoutSettings.externalServiceTokens.find((function(r){return r.type==="PAYPAL_CLIENT_ID"}));if(!o){log("Failed to load paypal -- missing paypal publishable key","warn");return[2]}n=(!zonosStore.zonosMode||zonosStore.zonosMode==="production")&&zonosStore.checkoutSettings.mode==="LIVE"?"production":"sandbox";a=zonosStore.checkoutSettings.captureDelay&&zonosStore.checkoutSettings.captureDelay>0;paypalStore.intent=a?"authorize":"capture";log("==== Paypal order intent","info",paypalStore.intent);i=window.Zonos;return[4,loadScript({clientId:o.token,currency:u,environment:n,intent:paypalStore.intent})];case 1:i.paypal=r.sent();paypalStore.paypal=window.Zonos.paypal;log("==== Paypal script loaded");return[2]}}))}))};var paypalStoreInitButtons=function(r){var e;var t=window.Zonos.paypal;if(!t){log("Paypal is not available");return null}var o=storageStore.checkoutSessionId;if(!o){log("Paypal is not available due to checkoutSessionId is not available");return null}log("==== Loading Paypal buttons");paypalStoreResetButtons();var n=[(e=t.FUNDING)===null||e===void 0?void 0:e.PAYPAL].filter(Boolean);paypalStore.paypalButtons=n.map((function(e){var n;var a=null;try{a=((n=t.Buttons)===null||n===void 0?void 0:n.call(t,Object.assign(Object.assign({},paypalButtonOptions(Object.assign({checkoutSessionId:o,fundingSource:e},r))),{fundingSource:e})))||null}catch(r){log("===== Failed to load paypal's \"".concat(e,'" button'),"warn",r)}if(a===null||a===void 0?void 0:a.isEligible()){log("==== Paypal button ".concat(e," loaded"));return a}return null})).filter(Boolean);return paypalStore.paypalButtons};var paypalStoreHasPaypalEnabled=function(){var r,e;var t=((e=(r=zonosStore.checkoutSettings.externalPaymentMethods)===null||r===void 0?void 0:r.find((function(r){return r.type==="PAYPAL"})))===null||e===void 0?void 0:e.status)==="ENABLED";return t||!!paypalStore.paypalButtons.length};export{paypalStore as a,paypalInitScript as b,paypalStoreReset as c,paypalStoreInitButtons as d,paypalStoreOnChange as e,paypalStoreHasPaypalEnabled as p};