@zonos/elements 1.3.109 → 1.3.110

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 (232) hide show
  1. package/dist/cjs/{cart-d25b699a.js → cart-a3eab220.js} +235 -75
  2. package/dist/cjs/createCustomEvent-3e982e57.js +16 -0
  3. package/dist/cjs/index.cjs.js +7 -7
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{paypal-fd423375.js → paypal-ca479c4b.js} +1 -1
  6. package/dist/cjs/zonos-address_7.cjs.entry.js +9 -9
  7. package/dist/cjs/zonos-badge.cjs.entry.js +3 -3
  8. package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
  9. package/dist/cjs/zonos-card.cjs.entry.js +4 -4
  10. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +126 -104
  11. package/dist/cjs/zonos-checkout.cjs.entry.js +6 -6
  12. package/dist/cjs/zonos-collapse.cjs.entry.js +2 -2
  13. package/dist/cjs/zonos-component.cjs.entry.js +1 -1
  14. package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
  15. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  16. package/dist/cjs/zonos-country-select_4.cjs.entry.js +9 -9
  17. package/dist/cjs/zonos-elements.cjs.js +1 -1
  18. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +5 -5
  19. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  20. package/dist/cjs/zonos-input.cjs.entry.js +4 -4
  21. package/dist/cjs/zonos-language-select_2.cjs.entry.js +5 -5
  22. package/dist/cjs/zonos-link.cjs.entry.js +1 -1
  23. package/dist/cjs/zonos-logo.cjs.entry.js +2 -2
  24. package/dist/cjs/zonos-notification_3.cjs.entry.js +5 -5
  25. package/dist/cjs/zonos-toggle.cjs.entry.js +2 -2
  26. package/dist/cjs/zonos-tooltip.cjs.entry.js +2 -2
  27. package/dist/cjs/zonos-v-stack.cjs.entry.js +2 -2
  28. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.css +3 -0
  29. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +108 -86
  30. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-footer/zonos-checkout-footer.js +2 -2
  31. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +2 -2
  32. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +2 -2
  33. package/dist/collection/components/common/zonos-badge/zonos-badge.js +3 -3
  34. package/dist/collection/components/common/zonos-button/zonos-button.js +3 -3
  35. package/dist/collection/components/common/zonos-card/zonos-card.js +4 -4
  36. package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +3 -3
  37. package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +3 -3
  38. package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
  39. package/dist/collection/components/common/zonos-confirm-dialog/zonos-confirm-dialog.js +3 -3
  40. package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +2 -2
  41. package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
  42. package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
  43. package/dist/collection/components/common/zonos-input/zonos-input.js +4 -4
  44. package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
  45. package/dist/collection/components/common/zonos-link/zonos-link.js +1 -1
  46. package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
  47. package/dist/collection/components/common/zonos-rest-state/zonos-rest-state.js +3 -3
  48. package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +2 -2
  49. package/dist/collection/components/common/zonos-toggle/zonos-toggle.js +2 -2
  50. package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
  51. package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
  52. package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +2 -2
  53. package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
  54. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +2 -2
  55. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +4 -4
  56. package/dist/collection/components/main/zonos-controller.js +1 -1
  57. package/dist/collection/components/paypal/zonos-paypal-payment.js +1 -1
  58. package/dist/collection/components/store/checkout/stripe.js +11 -1
  59. package/dist/collection/components/store/translationStore/strings.arabic.js +9 -3
  60. package/dist/collection/components/store/translationStore/strings.base.js +9 -3
  61. package/dist/collection/components/store/translationStore/strings.chinese.js +10 -4
  62. package/dist/collection/components/store/translationStore/strings.danish.js +10 -4
  63. package/dist/collection/components/store/translationStore/strings.dutch.js +10 -4
  64. package/dist/collection/components/store/translationStore/strings.french.js +9 -3
  65. package/dist/collection/components/store/translationStore/strings.german.js +10 -4
  66. package/dist/collection/components/store/translationStore/strings.hebrew.js +10 -4
  67. package/dist/collection/components/store/translationStore/strings.indonesian.js +10 -4
  68. package/dist/collection/components/store/translationStore/strings.italian.js +10 -4
  69. package/dist/collection/components/store/translationStore/strings.japanese.js +10 -4
  70. package/dist/collection/components/store/translationStore/strings.korean.js +10 -4
  71. package/dist/collection/components/store/translationStore/strings.norwegian.js +9 -3
  72. package/dist/collection/components/store/translationStore/strings.polish.js +9 -3
  73. package/dist/collection/components/store/translationStore/strings.portuguese.js +10 -4
  74. package/dist/collection/components/store/translationStore/strings.russian.js +10 -4
  75. package/dist/collection/components/store/translationStore/strings.spanish.js +10 -4
  76. package/dist/collection/components/store/translationStore/strings.swedish.js +10 -4
  77. package/dist/collection/components/store/translationStore/strings.turkish.js +10 -4
  78. package/dist/collection/components/store/translationStore/strings.vietnamese.js +9 -3
  79. package/dist/collection/components/stripe/zonos-address/zonos-address.js +1 -1
  80. package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +1 -1
  81. package/dist/collection/components/stripe/zonos-payment/zonos-payment.css +3 -0
  82. package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
  83. package/dist/esm/{cart-911ba5dd.js → cart-163f4dd9.js} +235 -76
  84. package/dist/esm/createCustomEvent-31a792d3.js +13 -0
  85. package/dist/esm/index.js +7 -7
  86. package/dist/esm/loader.js +1 -1
  87. package/dist/esm/{paypal-04a10fc2.js → paypal-77e8eef2.js} +1 -1
  88. package/dist/esm/zonos-address_7.entry.js +9 -9
  89. package/dist/esm/zonos-badge.entry.js +3 -3
  90. package/dist/esm/zonos-button_3.entry.js +3 -3
  91. package/dist/esm/zonos-card.entry.js +4 -4
  92. package/dist/esm/zonos-cart-items_13.entry.js +125 -103
  93. package/dist/esm/zonos-checkout.entry.js +5 -5
  94. package/dist/esm/zonos-collapse.entry.js +2 -2
  95. package/dist/esm/zonos-component.entry.js +1 -1
  96. package/dist/esm/zonos-controller.entry.js +2 -2
  97. package/dist/esm/zonos-country-flag.entry.js +1 -1
  98. package/dist/esm/zonos-country-select_4.entry.js +9 -9
  99. package/dist/esm/zonos-elements.js +1 -1
  100. package/dist/esm/zonos-hello-dialog.entry.js +5 -5
  101. package/dist/esm/zonos-hello.entry.js +1 -1
  102. package/dist/esm/zonos-input.entry.js +4 -4
  103. package/dist/esm/zonos-language-select_2.entry.js +5 -5
  104. package/dist/esm/zonos-link.entry.js +1 -1
  105. package/dist/esm/zonos-logo.entry.js +2 -2
  106. package/dist/esm/zonos-notification_3.entry.js +5 -5
  107. package/dist/esm/zonos-toggle.entry.js +2 -2
  108. package/dist/esm/zonos-tooltip.entry.js +2 -2
  109. package/dist/esm/zonos-v-stack.entry.js +2 -2
  110. package/dist/esm-es5/cart-163f4dd9.js +1 -0
  111. package/dist/esm-es5/createCustomEvent-31a792d3.js +1 -0
  112. package/dist/esm-es5/index.js +1 -1
  113. package/dist/esm-es5/loader.js +1 -1
  114. package/dist/esm-es5/{paypal-04a10fc2.js → paypal-77e8eef2.js} +1 -1
  115. package/dist/esm-es5/zonos-address_7.entry.js +1 -1
  116. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  117. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  118. package/dist/esm-es5/zonos-card.entry.js +1 -1
  119. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  120. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  121. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  122. package/dist/esm-es5/zonos-component.entry.js +1 -1
  123. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  124. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  125. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  126. package/dist/esm-es5/zonos-elements.js +1 -1
  127. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  128. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  129. package/dist/esm-es5/zonos-input.entry.js +1 -1
  130. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  131. package/dist/esm-es5/zonos-link.entry.js +1 -1
  132. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  133. package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
  134. package/dist/esm-es5/zonos-toggle.entry.js +1 -1
  135. package/dist/esm-es5/zonos-tooltip.entry.js +1 -1
  136. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  137. package/dist/scripts/index.d.ts +0 -5
  138. package/dist/scripts/index.js +1 -1
  139. package/dist/scripts/loadZonos.js +1 -1
  140. package/dist/scripts/zonos.js +1 -1
  141. package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +0 -1
  142. package/dist/types/components/store/checkout/stripe.d.ts +6 -0
  143. package/dist/types/components/store/translationStore/strings.arabic.d.ts +9 -3
  144. package/dist/types/components/store/translationStore/strings.base.d.ts +9 -3
  145. package/dist/types/components/store/translationStore/strings.chinese.d.ts +9 -3
  146. package/dist/types/components/store/translationStore/strings.danish.d.ts +9 -3
  147. package/dist/types/components/store/translationStore/strings.dutch.d.ts +9 -3
  148. package/dist/types/components/store/translationStore/strings.french.d.ts +9 -3
  149. package/dist/types/components/store/translationStore/strings.german.d.ts +9 -3
  150. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +9 -3
  151. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +9 -3
  152. package/dist/types/components/store/translationStore/strings.italian.d.ts +9 -3
  153. package/dist/types/components/store/translationStore/strings.japanese.d.ts +9 -3
  154. package/dist/types/components/store/translationStore/strings.korean.d.ts +9 -3
  155. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +9 -3
  156. package/dist/types/components/store/translationStore/strings.polish.d.ts +9 -3
  157. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +9 -3
  158. package/dist/types/components/store/translationStore/strings.russian.d.ts +9 -3
  159. package/dist/types/components/store/translationStore/strings.spanish.d.ts +9 -3
  160. package/dist/types/components/store/translationStore/strings.swedish.d.ts +9 -3
  161. package/dist/types/components/store/translationStore/strings.turkish.d.ts +9 -3
  162. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +9 -3
  163. package/dist/types/components/store/translationStore.d.ts +1 -1
  164. package/dist/types/types/checkout/CheckoutConfig.d.ts +0 -5
  165. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  166. package/dist/zonos-elements/index.esm.js +1 -1
  167. package/dist/zonos-elements/{p-58832515.entry.js → p-019028d5.entry.js} +1 -1
  168. package/dist/zonos-elements/{p-939d363c.system.entry.js → p-02b1e030.system.entry.js} +1 -1
  169. package/dist/zonos-elements/{p-ba3d2965.entry.js → p-06e3c94f.entry.js} +1 -1
  170. package/dist/zonos-elements/{p-123cabaa.system.entry.js → p-0810568b.system.entry.js} +1 -1
  171. package/dist/zonos-elements/{p-2a1475a4.system.entry.js → p-0a8b6b4a.system.entry.js} +1 -1
  172. package/dist/zonos-elements/{p-eaf09ccb.entry.js → p-0ad85ec6.entry.js} +1 -1
  173. package/dist/zonos-elements/p-110ee9ab.entry.js +1 -0
  174. package/dist/zonos-elements/{p-1e1397fe.entry.js → p-124f5c21.entry.js} +1 -1
  175. package/dist/zonos-elements/{p-796dbada.entry.js → p-1605dd48.entry.js} +1 -1
  176. package/dist/zonos-elements/{p-ee14ba06.system.entry.js → p-189aa06e.system.entry.js} +1 -1
  177. package/dist/zonos-elements/{p-b8850092.entry.js → p-1a0e138c.entry.js} +1 -1
  178. package/dist/zonos-elements/{p-32c29205.system.entry.js → p-1c1ab3c8.system.entry.js} +1 -1
  179. package/dist/zonos-elements/{p-1a9a51bf.entry.js → p-1c7e19f7.entry.js} +1 -1
  180. package/dist/zonos-elements/p-1dcaf64f.js +17 -0
  181. package/dist/zonos-elements/{p-9d678aea.system.js → p-281e9a06.system.js} +1 -1
  182. package/dist/zonos-elements/{p-6927d227.system.entry.js → p-2a0c4426.system.entry.js} +1 -1
  183. package/dist/zonos-elements/{p-84d38e0c.entry.js → p-31acf417.entry.js} +1 -1
  184. package/dist/zonos-elements/{p-bfd73737.system.entry.js → p-3c90f724.system.entry.js} +1 -1
  185. package/dist/zonos-elements/{p-ff7b0d6b.system.entry.js → p-42b0fca8.system.entry.js} +1 -1
  186. package/dist/zonos-elements/{p-9f89f828.system.entry.js → p-42d9d3af.system.entry.js} +1 -1
  187. package/dist/zonos-elements/{p-ae7526a2.system.entry.js → p-442a308c.system.entry.js} +1 -1
  188. package/dist/zonos-elements/{p-24813754.system.entry.js → p-46a71949.system.entry.js} +1 -1
  189. package/dist/zonos-elements/{p-e880ab28.system.js → p-49135023.system.js} +1 -1
  190. package/dist/zonos-elements/p-505f92e7.entry.js +1 -0
  191. package/dist/zonos-elements/{p-8b0feb0e.entry.js → p-58e6386b.entry.js} +1 -1
  192. package/dist/zonos-elements/p-5a011a47.system.js +1 -0
  193. package/dist/zonos-elements/p-605473a3.entry.js +1 -0
  194. package/dist/zonos-elements/p-64372f93.system.js +1 -0
  195. package/dist/zonos-elements/p-7b999a40.js +1 -0
  196. package/dist/zonos-elements/{p-8632c8f1.entry.js → p-8acdac29.entry.js} +1 -1
  197. package/dist/zonos-elements/{p-adbcf21c.entry.js → p-8cafdbc9.entry.js} +1 -1
  198. package/dist/zonos-elements/{p-c4b5f123.entry.js → p-8e6bbf2c.entry.js} +1 -1
  199. package/dist/zonos-elements/{p-76a4a647.system.entry.js → p-8e85c28f.system.entry.js} +1 -1
  200. package/dist/zonos-elements/{p-45323a2f.system.entry.js → p-932cbdd7.system.entry.js} +1 -1
  201. package/dist/zonos-elements/{p-1d15c126.entry.js → p-9d7a79e3.entry.js} +1 -1
  202. package/dist/zonos-elements/{p-c9e8f159.system.entry.js → p-a45bd823.system.entry.js} +1 -1
  203. package/dist/zonos-elements/{p-b7f627ec.system.entry.js → p-ab9af87d.system.entry.js} +1 -1
  204. package/dist/zonos-elements/p-abc6b881.system.entry.js +1 -0
  205. package/dist/zonos-elements/{p-71fe8da9.entry.js → p-b34ccbfd.entry.js} +1 -1
  206. package/dist/zonos-elements/{p-d6de8661.entry.js → p-bcfc229f.entry.js} +1 -1
  207. package/dist/zonos-elements/p-c44f27be.js +1 -0
  208. package/dist/zonos-elements/{p-36eaad7e.entry.js → p-c598b3c5.entry.js} +1 -1
  209. package/dist/zonos-elements/{p-4eb3e354.entry.js → p-c652212b.entry.js} +1 -1
  210. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  211. package/dist/zonos-elements/p-cf69d8c2.system.entry.js +1 -0
  212. package/dist/zonos-elements/{p-489029d9.system.entry.js → p-d3c1ad61.system.entry.js} +1 -1
  213. package/dist/zonos-elements/{p-e5d1d031.system.entry.js → p-d8a45014.system.entry.js} +1 -1
  214. package/dist/zonos-elements/{p-1b1f2e33.system.entry.js → p-e4a69ce9.system.entry.js} +1 -1
  215. package/dist/zonos-elements/{p-0962536e.system.entry.js → p-e5e63927.system.entry.js} +1 -1
  216. package/dist/zonos-elements/{p-4069df3c.entry.js → p-f20b3656.entry.js} +1 -1
  217. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  218. package/package.json +1 -1
  219. package/dist/cjs/createCustomEvent-4ea7b6dc.js +0 -51
  220. package/dist/esm/createCustomEvent-6ba5bcde.js +0 -47
  221. package/dist/esm-es5/cart-911ba5dd.js +0 -1
  222. package/dist/esm-es5/createCustomEvent-6ba5bcde.js +0 -1
  223. package/dist/zonos-elements/p-018a4b36.js +0 -1
  224. package/dist/zonos-elements/p-27188a22.system.entry.js +0 -1
  225. package/dist/zonos-elements/p-39c09f18.system.entry.js +0 -1
  226. package/dist/zonos-elements/p-60303c84.js +0 -1
  227. package/dist/zonos-elements/p-631570f0.system.js +0 -1
  228. package/dist/zonos-elements/p-8d98fed0.entry.js +0 -1
  229. package/dist/zonos-elements/p-a0af6dc1.entry.js +0 -1
  230. package/dist/zonos-elements/p-e2fa7600.entry.js +0 -1
  231. package/dist/zonos-elements/p-e9771827.system.js +0 -1
  232. package/dist/zonos-elements/p-ef9d6106.js +0 -17
@@ -1,17 +0,0 @@
1
- import{z as o,c as r}from"./p-a24da794.js";import{d as e,u as n,t,r as a,h as i}from"./p-60303c84.js";import{h as s,l as c,a as l,j as u}from"./p-970fa103.js";import{t as d}from"./p-032159ed.js";
2
- /*!
3
- * paypal-js v8.1.0 (2024-06-07T16:55:00.122Z)
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 p(o,r){void 0===r&&(r={});var e=document.createElement("script");return e.src=o,Object.keys(r).forEach((function(o){e.setAttribute(o,r[o]),"data-csp-nonce"===o&&e.setAttribute("nonce",r["data-csp-nonce"])})),e}function v(o){return window[o]}function y(o,r){if("object"!=typeof o||null===o)throw new Error("Expected an options object.");var e=o.environment;if(e&&"production"!==e&&"sandbox"!==e)throw new Error('The `environment` option must be either "production" or "sandbox".');if(void 0!==r&&"function"!=typeof r)throw new Error("Expected PromisePonyfill to be a function.")}const f=({backgroundColor1:o,backgroundColor2:r})=>d.readability(o,r)>2.5,w=r=>{const e=o.checkoutSettings.analyticsProviders.find((o=>"GOOGLE_ANALYTICS"===o.type));e&&"DISABLED"!==(null==e?void 0:e.status)&&"function"==typeof window.gtag&&(c("Zonos submits gtag event","log",r),window.gtag("event",r,{}))},{reset:b,state:h}=r((()=>({orderIdCreated:null,paypalButtons:[],paypalClientId:"",paypalErrorMessage:null}))),P=({checkoutSessionId:r,onPaypalFail:c,onPaypalSessionDone:d,overrideBorderRaidus:p,overridePrimaryColor:v})=>({createOrder:async()=>{try{h.paypalErrorMessage=null,e.inventoryCheckErrorMessage=null;try{e.inventoryCheckErrorMessage=await n()}catch(o){e.inventoryCheckErrorMessage=t("Unable to check inventory. Please try again.")}return e.inventoryCheckErrorMessage?"":await(async({checkoutSessionId:o})=>{var r,e;const{errors:n,json:t}=await(async({checkoutSessionId:o})=>{const{errors:r,json:e}=await s("/api/zonos-elements/create-paypal-order",{body:{checkoutSessionId:o},method:"POST"});return{errors:r,json:e}})({checkoutSessionId:o}),a=null===(r=null==t?void 0:t.paypalOrderCreate)||void 0===r?void 0:r.paypalOrderId;if(n.length||!a)throw new Error((null===(e=n.find(Boolean))||void 0===e?void 0:e.message)||"An unexpected error occurred when creating paypal order.");return a})({checkoutSessionId:r})}catch(o){return l("Failed to create paypal order",o),h.paypalErrorMessage=t("Failed to create PayPal order. Please try again, or consider using an alternative method."),null==c||c(),""}},onApprove:async()=>{try{h.paypalErrorMessage=null,w("zonos-checkout-payment-info");const o=await(async({checkoutSessionId:o,paypalMockResponse:r})=>{var e,n;new URL(window.location.href);const{errors:a,json:i}=await(async({checkoutSessionId:o,paypalMockResponse:r})=>{const{errors:e,json:n}=await s("/api/zonos-elements/capture-paypal-order",{body:{checkoutSessionId:o,paypalMockResponse:r},method:"POST"});return{errors:e,json:n}})({checkoutSessionId:o,paypalMockResponse:r}),c=null===(e=null==i?void 0:i.paypalOrderCapture.order)||void 0===e?void 0:e.id;if(a.length||!c)throw new Error((null===(n=a.find(Boolean))||void 0===n?void 0:n.message)||t("An unexpected error occurred when processing PayPal order."));return c})({checkoutSessionId:r,paypalMockResponse:window.Zonos._paypalMockResponse});h.orderIdCreated=o,null==d||d({orderId:o}),a(),i()}catch(o){if(l("==== Failed to capture paypal order",o),o instanceof Error)return(({error:o})=>{var r;const e=u(o.message),n=null===(r=null==e?void 0:e.errors.find(Boolean))||void 0===r?void 0:r.message,a=(null==n?void 0:n.match(/\[(.*?)\] (.*)/i))||[];a||(h.paypalErrorMessage=t("An unexpected error occurred when processing PayPal order."));const i=a[2]||t("An unexpected error occurred when processing PayPal order.");h.paypalErrorMessage=i})({error:o});null==c||c()}},style:{borderRadius:"SHARP"===p?0:10,color:f({backgroundColor1:"#ffc33a",backgroundColor2:v||o.appearance.colorPrimary||""})?"gold":"blue",shape:"rect"}}),m=async({currency:r})=>{var e;if(!(null===(e=o.checkoutSettings.externalPaymentMethods)||void 0===e?void 0:e.find((o=>"PAYPAL"===o.type&&"ENABLED"===o.status))))return void c("=== Paypal is disabled for this store","warn");const n=o.checkoutSettings.externalServiceTokens.find((o=>"PAYPAL_CLIENT_ID"===o.type));if(!n)return void c("Failed to load paypal -- missing paypal publishable key","warn");const t="production"===o.zonosMode&&"LIVE"===o.checkoutSettings.mode?"production":"sandbox";window.Zonos.paypal=await function(o,r){if(void 0===r&&(r=Promise),y(o,r),"undefined"==typeof document)return r.resolve(null);var e=function(o){var r="sandbox"===o.environment?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js";delete o.environment,o.sdkBaseUrl&&(r=o.sdkBaseUrl,delete o.sdkBaseUrl);var e,n,t=o,a=Object.keys(t).filter((function(o){return null!=t[o]&&""!==t[o]})).reduce((function(o,r){var e=t[r].toString();return"data"===(r=r.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(function(o,r){return(r?"-":"")+o.toLowerCase()}))).substring(0,4)||"crossorigin"===r?o.attributes[r]=e:o.queryParams[r]=e,o}),{queryParams:{},attributes:{}}),i=a.queryParams,s=a.attributes;return i["merchant-id"]&&-1!==i["merchant-id"].indexOf(",")&&(s["data-merchant-id"]=i["merchant-id"],i["merchant-id"]="*"),{url:"".concat(r,"?").concat((e=i,n="",Object.keys(e).forEach((function(o){0!==n.length&&(n+="&"),n+=o+"="+e[o]})),n)),attributes:s}}(o),n=e.url,t=e.attributes,a=t["data-namespace"]||"paypal",i=v(a);return t["data-js-sdk-library"]||(t["data-js-sdk-library"]="paypal-js"),function(o,r){var e=document.querySelector('script[src="'.concat(o,'"]'));if(null===e)return null;var n=p(o,r),t=e.cloneNode();if(delete t.dataset.uidAuto,Object.keys(t.dataset).length!==Object.keys(n.dataset).length)return null;var a=!0;return Object.keys(t.dataset).forEach((function(o){t.dataset[o]!==n.dataset[o]&&(a=!1)})),a?e:null}(n,t)&&i?r.resolve(i):function(o,r){void 0===r&&(r=Promise),y(o,r);var e=o.url,n=o.attributes;if("string"!=typeof e||0===e.length)throw new Error("Invalid url.");if(void 0!==n&&"object"!=typeof n)throw new Error("Expected attributes to be an object.");return new r((function(o,r){if("undefined"==typeof document)return o();!function(o){var r=o.onSuccess,e=o.onError,n=p(o.url,o.attributes);n.onerror=e,n.onload=r,document.head.insertBefore(n,document.head.firstElementChild)}({url:e,attributes:n,onSuccess:function(){return o()},onError:function(){var o=new Error('The script "'.concat(e,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return r(o)}})}))}({url:n,attributes:t},r).then((function(){var o=v(a);if(o)return o;throw new Error("The window.".concat(a," global variable is not available."))}))}({clientId:n.token,currency:r,environment:t}),c("==== Paypal script loaded")},k=o=>{var r;const n=window.Zonos.paypal;if(!n)return c("Paypal is not available"),null;const t=e.checkoutSessionId;if(!t)return c("Paypal is not available due to checkoutSessionId is not available"),null;c("==== Loading Paypal buttons"),h.paypalButtons.length&&(h.paypalButtons.forEach((async o=>{await o.close()})),h.paypalButtons=[]);const a=[null===(r=n.FUNDING)||void 0===r?void 0:r.PAYPAL].filter(Boolean);return h.paypalButtons=a.map((r=>{var e;let a=null;try{a=(null===(e=n.Buttons)||void 0===e?void 0:e.call(n,Object.assign(Object.assign({},P(Object.assign({checkoutSessionId:t,fundingSource:r},o))),{fundingSource:r})))||null}catch(o){c(`===== Failed to load paypal's "${r}" button`,"warn",o)}return(null==a?void 0:a.isEligible())?(c(`==== Paypal button ${r} loaded`),a):null})).filter(Boolean),h.paypalButtons},j=()=>{var r,e;return"ENABLED"===(null===(e=null===(r=o.checkoutSettings.externalPaymentMethods)||void 0===r?void 0:r.find((o=>"PAYPAL"===o.type)))||void 0===e?void 0:e.status)||!!h.paypalButtons.length};export{m as a,h as b,b as c,k as d,f as i,j as p,w as s}