@zonos/elements 1.3.269 → 1.3.272

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/dist/cjs/{cart-87fbbb5a.js → cart-f1374a56.js} +1 -1
  2. package/dist/cjs/{hasInclusivePrice-c86ed1f5.js → hasInclusivePrice-2f1232e3.js} +1 -1
  3. package/dist/cjs/index.cjs.js +7 -7
  4. package/dist/cjs/{invoice-952f32c4.js → invoice-3760bec0.js} +2 -2
  5. package/dist/cjs/{isCollectMobileTablet-1cb21c59.js → isCollectMobileTablet-d5c1a9ea.js} +2 -2
  6. package/dist/cjs/{localization-a969f224.js → localization-503c8477.js} +131 -3
  7. package/dist/cjs/{paypal-cfe1e8e9.js → paypal-5e9b8224.js} +2 -2
  8. package/dist/cjs/{placeTestOrder-613878fb.js → placeTestOrder-d1be2c8e.js} +2 -2
  9. package/dist/cjs/{renderCheckoutCurrency-5a333d29.js → renderCheckoutCurrency-4486b06e.js} +2 -2
  10. package/dist/cjs/zonos-address-display_8.cjs.entry.js +2 -2
  11. package/dist/cjs/zonos-address_4.cjs.entry.js +2 -2
  12. package/dist/cjs/zonos-card_5.cjs.entry.js +3 -3
  13. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +117 -7
  14. package/dist/cjs/zonos-checkout.cjs.entry.js +3 -3
  15. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +2 -2
  16. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +6 -6
  17. package/dist/cjs/zonos-collect.cjs.entry.js +4 -4
  18. package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
  19. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  20. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  21. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
  22. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  23. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +4 -4
  24. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +6 -6
  25. package/dist/cjs/zonos-invoice.cjs.entry.js +4 -4
  26. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  27. package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +3 -3
  28. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +4 -1
  29. package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +1 -1
  30. package/dist/collection/components/main/zonos-controller.js +1 -1
  31. package/dist/collection/components/store/checkout/euWithdrawalRate.js +40 -0
  32. package/dist/collection/components/store/hello/localization.js +3 -1
  33. package/dist/collection/components/store/translationStore/strings.arabic.js +6 -0
  34. package/dist/collection/components/store/translationStore/strings.base.js +6 -0
  35. package/dist/collection/components/store/translationStore/strings.chinese.js +6 -0
  36. package/dist/collection/components/store/translationStore/strings.danish.js +6 -0
  37. package/dist/collection/components/store/translationStore/strings.dutch.js +6 -0
  38. package/dist/collection/components/store/translationStore/strings.french.js +6 -0
  39. package/dist/collection/components/store/translationStore/strings.german.js +6 -0
  40. package/dist/collection/components/store/translationStore/strings.hebrew.js +6 -0
  41. package/dist/collection/components/store/translationStore/strings.indonesian.js +6 -0
  42. package/dist/collection/components/store/translationStore/strings.italian.js +6 -0
  43. package/dist/collection/components/store/translationStore/strings.japanese.js +6 -0
  44. package/dist/collection/components/store/translationStore/strings.korean.js +6 -0
  45. package/dist/collection/components/store/translationStore/strings.norwegian.js +6 -0
  46. package/dist/collection/components/store/translationStore/strings.polish.js +6 -0
  47. package/dist/collection/components/store/translationStore/strings.portuguese.js +6 -0
  48. package/dist/collection/components/store/translationStore/strings.russian.js +6 -0
  49. package/dist/collection/components/store/translationStore/strings.spanish.js +6 -0
  50. package/dist/collection/components/store/translationStore/strings.swedish.js +6 -0
  51. package/dist/collection/components/store/translationStore/strings.turkish.js +6 -0
  52. package/dist/collection/components/store/translationStore/strings.vietnamese.js +6 -0
  53. package/dist/collection/components/utils/checkout/euWithdrawalNotice.js +74 -0
  54. package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js +6 -2
  55. package/dist/collection/types/generated/graphql.internal.types.js +315 -182
  56. package/dist/esm/{cart-663ef7d5.js → cart-1415dcf0.js} +1 -1
  57. package/dist/esm/{hasInclusivePrice-f8bd057d.js → hasInclusivePrice-a3b0f71c.js} +1 -1
  58. package/dist/esm/index.js +7 -7
  59. package/dist/esm/{invoice-db7211a6.js → invoice-117efa2c.js} +2 -2
  60. package/dist/esm/{isCollectMobileTablet-24c912b1.js → isCollectMobileTablet-2c62fdaa.js} +2 -2
  61. package/dist/esm/{localization-dc19e8bb.js → localization-29723d89.js} +130 -4
  62. package/dist/esm/{paypal-cdbe69ef.js → paypal-cb5559d4.js} +2 -2
  63. package/dist/esm/{placeTestOrder-ba67e208.js → placeTestOrder-443376eb.js} +2 -2
  64. package/dist/esm/{renderCheckoutCurrency-fb1cbd28.js → renderCheckoutCurrency-8390b5bf.js} +2 -2
  65. package/dist/esm/zonos-address-display_8.entry.js +2 -2
  66. package/dist/esm/zonos-address_4.entry.js +2 -2
  67. package/dist/esm/zonos-card_5.entry.js +3 -3
  68. package/dist/esm/zonos-cart-items_12.entry.js +118 -8
  69. package/dist/esm/zonos-checkout.entry.js +3 -3
  70. package/dist/esm/zonos-collect-cart-items_3.entry.js +2 -2
  71. package/dist/esm/zonos-collect-finish_6.entry.js +6 -6
  72. package/dist/esm/zonos-collect.entry.js +4 -4
  73. package/dist/esm/zonos-controller.entry.js +2 -2
  74. package/dist/esm/zonos-country-flag.entry.js +1 -1
  75. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  76. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  77. package/dist/esm/zonos-hello.entry.js +1 -1
  78. package/dist/esm/zonos-invoice-cart-items_2.entry.js +4 -4
  79. package/dist/esm/zonos-invoice-finish_5.entry.js +6 -6
  80. package/dist/esm/zonos-invoice.entry.js +4 -4
  81. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  82. package/dist/esm/zonos-policy-consent_2.entry.js +3 -3
  83. package/dist/esm-es5/{cart-663ef7d5.js → cart-1415dcf0.js} +1 -1
  84. package/dist/esm-es5/{hasInclusivePrice-f8bd057d.js → hasInclusivePrice-a3b0f71c.js} +1 -1
  85. package/dist/esm-es5/index.js +1 -1
  86. package/dist/esm-es5/{invoice-db7211a6.js → invoice-117efa2c.js} +1 -1
  87. package/dist/esm-es5/{isCollectMobileTablet-24c912b1.js → isCollectMobileTablet-2c62fdaa.js} +1 -1
  88. package/dist/esm-es5/localization-29723d89.js +1 -0
  89. package/dist/esm-es5/{paypal-cdbe69ef.js → paypal-cb5559d4.js} +1 -1
  90. package/dist/esm-es5/{placeTestOrder-ba67e208.js → placeTestOrder-443376eb.js} +1 -1
  91. package/dist/esm-es5/{renderCheckoutCurrency-fb1cbd28.js → renderCheckoutCurrency-8390b5bf.js} +1 -1
  92. package/dist/esm-es5/zonos-address-display_8.entry.js +1 -1
  93. package/dist/esm-es5/zonos-address_4.entry.js +1 -1
  94. package/dist/esm-es5/zonos-card_5.entry.js +1 -1
  95. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  96. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  97. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  98. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  99. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  100. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  101. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  102. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  103. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  104. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  105. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
  106. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  107. package/dist/esm-es5/zonos-invoice.entry.js +1 -1
  108. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  109. package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
  110. package/dist/scripts/index.d.ts +38 -3
  111. package/dist/scripts/index.js +1 -1
  112. package/dist/scripts/loadZonos.js +1 -1
  113. package/dist/scripts/zonos.js +1 -1
  114. package/dist/types/components/store/checkout/euWithdrawalRate.d.ts +19 -0
  115. package/dist/types/components/store/translationStore/strings.arabic.d.ts +6 -0
  116. package/dist/types/components/store/translationStore/strings.base.d.ts +6 -0
  117. package/dist/types/components/store/translationStore/strings.chinese.d.ts +6 -0
  118. package/dist/types/components/store/translationStore/strings.danish.d.ts +6 -0
  119. package/dist/types/components/store/translationStore/strings.dutch.d.ts +6 -0
  120. package/dist/types/components/store/translationStore/strings.french.d.ts +6 -0
  121. package/dist/types/components/store/translationStore/strings.german.d.ts +6 -0
  122. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +6 -0
  123. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +6 -0
  124. package/dist/types/components/store/translationStore/strings.italian.d.ts +6 -0
  125. package/dist/types/components/store/translationStore/strings.japanese.d.ts +6 -0
  126. package/dist/types/components/store/translationStore/strings.korean.d.ts +6 -0
  127. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +6 -0
  128. package/dist/types/components/store/translationStore/strings.polish.d.ts +6 -0
  129. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +6 -0
  130. package/dist/types/components/store/translationStore/strings.russian.d.ts +6 -0
  131. package/dist/types/components/store/translationStore/strings.spanish.d.ts +6 -0
  132. package/dist/types/components/store/translationStore/strings.swedish.d.ts +6 -0
  133. package/dist/types/components/store/translationStore/strings.turkish.d.ts +6 -0
  134. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +6 -0
  135. package/dist/types/components/utils/checkout/euWithdrawalNotice.d.ts +9 -0
  136. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +8 -3
  137. package/dist/types/types/checkout/CheckoutConfig.d.ts +10 -0
  138. package/dist/types/types/generated/graphql.internal.types.d.ts +396 -218
  139. package/dist/types/types/generated/graphql.internal.types.ts +508 -258
  140. package/dist/types/types/utils/ZonosSettings.d.ts +9 -0
  141. package/dist/zonos-elements/index.esm.js +1 -1
  142. package/dist/zonos-elements/p-0fa932e6.system.js +1 -0
  143. package/dist/zonos-elements/{p-680da401.entry.js → p-15c2dfea.entry.js} +1 -1
  144. package/dist/zonos-elements/{p-d932973f.system.js → p-17c7a727.system.js} +1 -1
  145. package/dist/zonos-elements/{p-09d32e53.system.entry.js → p-18c9565b.system.entry.js} +1 -1
  146. package/dist/zonos-elements/p-24aa6708.js +1 -0
  147. package/dist/zonos-elements/{p-a237429e.entry.js → p-2585034d.entry.js} +1 -1
  148. package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
  149. package/dist/zonos-elements/p-2cda42d5.system.js +1 -0
  150. package/dist/zonos-elements/{p-513e8278.entry.js → p-2d1055d5.entry.js} +1 -1
  151. package/dist/zonos-elements/{p-f5684fc2.system.js → p-318e704a.system.js} +1 -1
  152. package/dist/zonos-elements/{p-699276f2.system.js → p-3b600b89.system.js} +1 -1
  153. package/dist/zonos-elements/{p-9092f655.entry.js → p-3efe0875.entry.js} +1 -1
  154. package/dist/zonos-elements/{p-c62293d5.system.entry.js → p-48f3e2d2.system.entry.js} +1 -1
  155. package/dist/zonos-elements/{p-488c1af1.entry.js → p-4c94cfd3.entry.js} +1 -1
  156. package/dist/zonos-elements/{p-243dda5f.js → p-53b65b80.js} +1 -1
  157. package/dist/zonos-elements/{p-be64a52e.entry.js → p-53be08c8.entry.js} +1 -1
  158. package/dist/zonos-elements/{p-0581cfc9.system.entry.js → p-54a9c772.system.entry.js} +1 -1
  159. package/dist/zonos-elements/p-58521b25.js +1 -0
  160. package/dist/zonos-elements/{p-48ec0b61.system.entry.js → p-5bd47a30.system.entry.js} +1 -1
  161. package/dist/zonos-elements/{p-57b55808.entry.js → p-60f0ff42.entry.js} +1 -1
  162. package/dist/zonos-elements/{p-ba127f51.entry.js → p-6609467e.entry.js} +1 -1
  163. package/dist/zonos-elements/{p-9ea67d63.system.entry.js → p-6b87101d.system.entry.js} +1 -1
  164. package/dist/zonos-elements/{p-8f0bdb87.system.entry.js → p-73730eb9.system.entry.js} +1 -1
  165. package/dist/zonos-elements/{p-82ce355d.system.entry.js → p-7536cf94.system.entry.js} +1 -1
  166. package/dist/zonos-elements/{p-263d14da.system.entry.js → p-792fce17.system.entry.js} +1 -1
  167. package/dist/zonos-elements/p-7ce6b8f7.system.entry.js +1 -0
  168. package/dist/zonos-elements/{p-4af88255.entry.js → p-7d859914.entry.js} +1 -1
  169. package/dist/zonos-elements/{p-accccb9c.entry.js → p-831bcfb6.entry.js} +1 -1
  170. package/dist/zonos-elements/{p-0daed059.system.entry.js → p-9259e19b.system.entry.js} +1 -1
  171. package/dist/zonos-elements/p-93324ee5.entry.js +1 -0
  172. package/dist/zonos-elements/p-99ef86c3.js +1 -0
  173. package/dist/zonos-elements/{p-9a509268.entry.js → p-a956e28f.entry.js} +1 -1
  174. package/dist/zonos-elements/{p-bbef037c.js → p-aa3a7538.js} +1 -1
  175. package/dist/zonos-elements/{p-c4ef873a.system.entry.js → p-aafc2155.system.entry.js} +1 -1
  176. package/dist/zonos-elements/{p-9377b5c2.entry.js → p-b1b7d786.entry.js} +1 -1
  177. package/dist/zonos-elements/{p-84d4f04d.entry.js → p-b375372e.entry.js} +1 -1
  178. package/dist/zonos-elements/{p-8f817a47.system.js → p-b453ae2b.system.js} +1 -1
  179. package/dist/zonos-elements/{p-049fc407.entry.js → p-bd2daace.entry.js} +1 -1
  180. package/dist/zonos-elements/{p-9799193c.entry.js → p-c16c7978.entry.js} +1 -1
  181. package/dist/zonos-elements/{p-44147850.js → p-c425d3d9.js} +1 -1
  182. package/dist/zonos-elements/{p-fc270539.system.entry.js → p-c45df586.system.entry.js} +1 -1
  183. package/dist/zonos-elements/p-c935390d.js +1 -0
  184. package/dist/zonos-elements/{p-1bde60d5.system.entry.js → p-ccc8d669.system.entry.js} +1 -1
  185. package/dist/zonos-elements/{p-cd5444b0.js → p-cdea0f7d.js} +1 -1
  186. package/dist/zonos-elements/{p-8a24701c.system.entry.js → p-d2ba9e3c.system.entry.js} +1 -1
  187. package/dist/zonos-elements/{p-c2023a08.system.js → p-e77dd304.system.js} +1 -1
  188. package/dist/zonos-elements/{p-57c3c68f.entry.js → p-ea91600a.entry.js} +1 -1
  189. package/dist/zonos-elements/{p-882fb843.system.entry.js → p-eb254a96.system.entry.js} +1 -1
  190. package/dist/zonos-elements/{p-7662d32a.system.js → p-eb77dd11.system.js} +1 -1
  191. package/dist/zonos-elements/{p-858103a0.entry.js → p-ee00f232.entry.js} +1 -1
  192. package/dist/zonos-elements/{p-b0ed0fe7.system.entry.js → p-f4be6ce5.system.entry.js} +1 -1
  193. package/dist/zonos-elements/{p-df0c8fb6.system.entry.js → p-f5d9e5e5.system.entry.js} +1 -1
  194. package/dist/zonos-elements/{p-71528303.system.entry.js → p-f98cdb98.system.entry.js} +1 -1
  195. package/dist/zonos-elements/p-fd849c69.system.js +1 -0
  196. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  197. package/package.json +1 -1
  198. package/dist/esm-es5/localization-dc19e8bb.js +0 -1
  199. package/dist/zonos-elements/p-097d7819.js +0 -1
  200. package/dist/zonos-elements/p-2be4335f.js +0 -1
  201. package/dist/zonos-elements/p-33a37c42.system.entry.js +0 -1
  202. package/dist/zonos-elements/p-4b6e367d.system.js +0 -1
  203. package/dist/zonos-elements/p-56711a61.js +0 -1
  204. package/dist/zonos-elements/p-a3a79b2f.system.js +0 -1
  205. package/dist/zonos-elements/p-c5caf47b.system.js +0 -1
  206. package/dist/zonos-elements/p-d437bc28.js +0 -1
  207. package/dist/zonos-elements/p-e05e5825.entry.js +0 -1
@@ -1 +1 @@
1
- import{c as e,z as t}from"./p-701d9a7c.js";import{s as o,t as n,l as r,j as s,f as i,d as a}from"./p-097d7819.js";import{l as d,b as l}from"./p-0a377722.js";import{h as c,l as u,f as m,g as p,a as v,s as h,j as y}from"./p-41dd1cb8.js";import{i as w}from"./p-33d4be28.js";import{g as f}from"./p-3dc3596b.js";const g=async()=>{if(!o.checkoutSessionId)return{errors:[{message:"No checkout session id found"}],json:null};const e=new URLSearchParams;e.set("checkoutSessionId",o.checkoutSessionId);const{errors:t,json:n}=await c(`/api/zonos-elements/get-checkout-session?${e.toString()}`);return{errors:t,json:n}},{reset:b,state:S}=e((()=>({amountToApply:null,appliedAmount:null,availableBalance:null,error:null,isApplying:!1,isEnabled:!1,orderIdCreated:null,remainingBalance:null,useFullBalance:!0}))),C=()=>{b()},O=e=>{d("Store credit balance from session","info",e),S.availableBalance=e},A=async()=>{var e,t;const{errors:o,json:n}=await g();if(o.length||!n)return void u("Failed to refresh store credit balance");const r=null!==(t=null===(e=n.checkoutSession.customerProfile)||void 0===e?void 0:e.storeCreditBalance)&&void 0!==t?t:null;O(r)},I=async()=>{var e;const t=o.checkoutSessionId;if(!t){const e="No checkout session found";return u(e),S.error=e,{error:e,success:!1}}d("Applying store credit","info",{checkoutSessionId:t}),S.isApplying=!0,S.error=null;try{const{errors:o,json:n}=await c("/api/zonos-elements/store-credit/apply",{body:{checkoutSessionId:t},method:"POST"});if(o.length>0||!n){const t=(null===(e=o[0])||void 0===e?void 0:e.message)||"Failed to apply store credit";return u(t),S.error=t,S.isApplying=!1,{error:t,success:!1}}return S.appliedAmount=n.amountApplied,S.remainingBalance=n.remainingBalance,S.isApplying=!1,d("Store credit applied","info",{amountApplied:n.amountApplied,remainingBalance:n.remainingBalance}),{error:null,success:!0}}catch(e){const t=e instanceof Error?e.message:"Failed to apply store credit";return u(t),S.error=t,S.isApplying=!1,{error:t,success:!1}}},k=e=>{S.isEnabled=e,S.error=null,e||(S.amountToApply=null)},N=e=>{if(null===e)return S.amountToApply=null,void(S.error=null);e<=0?S.error="Amount must be greater than zero":null!==S.availableBalance&&e>S.availableBalance?S.error="Amount exceeds available balance":e>Ie.total+(Ie.storeCredit||0)?S.error="Amount exceeds order total":(S.error=null,S.amountToApply=e)},T=e=>{if(S.useFullBalance=e,S.error=null,e&&null!==S.availableBalance){const e=Math.min(S.availableBalance,Ie.total+(Ie.storeCredit||0));S.amountToApply=e}else e||(S.amountToApply=null)},j=()=>S.isEnabled&&null!==S.availableBalance?S.useFullBalance?Math.min(S.availableBalance,Ie.total+(Ie.storeCredit||0)):S.amountToApply||0:0,E=()=>null!==S.amountToApply&&S.amountToApply>0&&Ie.storeCredit>0&&Ie.total<=0,P=async()=>{var e,t,n;const r=o.checkoutSessionId;if(!r){const e="No checkout session found";return u(e),S.error=e,{error:e,orderId:null,success:!1}}d("Creating store credit order","info",{checkoutSessionId:r});try{const{errors:o,json:s}=await c("/api/zonos-elements/store-credit/order-create",{body:{checkoutSessionId:r},method:"POST"});if(o.length>0||!s){const t=(null===(e=o[0])||void 0===e?void 0:e.message)||"Failed to create store credit order";return u(t),S.error=t,{error:t,orderId:null,success:!1}}const i=(null===(n=null===(t=s.checkoutSessionStoreCreditOrderCreate)||void 0===t?void 0:t.order)||void 0===n?void 0:n.id)||null;return S.orderIdCreated=i,d("Store credit order created","info",{orderId:i}),{error:null,orderId:i,success:!0}}catch(e){const t=e instanceof Error?e.message:"Failed to create store credit order";return u(t),S.error=t,{error:t,orderId:null,success:!1}}},D=["termsAndConditions","privacyPolicy","refundPolicy","shippingPolicy","warrantyPolicy"],L={privacyPolicy:"Privacy policy",refundPolicy:"Refund policy",shippingPolicy:"Shipping policy",termsAndConditions:"Terms and conditions",warrantyPolicy:"Warranty policy"},{reset:x,state:R}=e({accepted:!1,acceptedAt:null,locked:!1,showError:!1}),z=()=>{const e=t.checkoutSettings.merchantPolicyLinks;return e?D.reduce(((t,o)=>{var r,s;const i=null===(s=null===(r=e[o])||void 0===r?void 0:r.link)||void 0===s?void 0:s.trim();return i&&/^https?:\/\//i.test(i)?(t.push({key:o,name:n(L[o]),url:i}),t):t}),[]):[]},U=()=>z().length>0,_=({firstName:e,lastName:t,name:o})=>{var n;if(!o&&!e&&!t)return{firstName:"",lastName:""};const r=(null==o?void 0:o.split(/\s+/))||[];return{firstName:(null==e?void 0:e.trim())||(null===(n=r[0])||void 0===n?void 0:n.trim())||"",lastName:(null==t?void 0:t.trim())||r.slice(1).join(" ").trim()||""}},F=({currentAddress:e,translatedAddress:t})=>{var o,n,r,s,i,a;const{city:d,country:l,line1:c,line2:u,postal_code:m,state:p}=e.value.address,v=e.value.name||[e.value.firstName,e.value.lastName].join(" ");return{city:(null===(o=t.city)||void 0===o?void 0:o[d])||d,country:l,line1:(null===(n=t.line1)||void 0===n?void 0:n[c])||c,line2:(null===(r=t.line2)||void 0===r?void 0:r[u||""])||u||"",name:(null===(s=t.name)||void 0===s?void 0:s[v])||v,phone:e.value.phone||"",postal_code:(null===(i=t.postal_code)||void 0===i?void 0:i[m])||m,state:(null===(a=t.state)||void 0===a?void 0:a[p])||p}},B=e=>{var t;const n="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),i=Z.stripeLinkEventData,a=Z.stripeAddressEventData,d=Z.stripeShippingSameAsBilling?Z.stripeAddressEventData:Z.stripeBillingAddressEventData;if(!a||!d)throw new Error("Missing stripe address data");const l=F({currentAddress:a,translatedAddress:Z.translatedAddress.address}),{firstName:c,lastName:u}=_({name:l.name}),m=F({currentAddress:d,translatedAddress:Z.translatedAddress.address}),{firstName:p,lastName:v}=_({name:m.name}),h=s()||"US";return{billingAddress:{addressLine1:m.line1,addressLine2:m.line2||"",city:m.city,country:m.country,postalCode:m.postal_code,state:m.state},billingContact:{firstName:p,lastName:v,phone:m.phone},cartCurrencyCode:null===(t=Ie.items[0])||void 0===t?void 0:t.currencyCode,cartId:e,checkoutSessionCountry:h||r.selectedCountryCode||void 0,checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:Z.companyName,email:null==i?void 0:i.value.email,firstName:c,lastName:u,phone:l.phone},isTest:!!n,landedCostAdjustments:Ie.promoCode?[{amount:0,productId:null,promoCode:Ie.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToShortAddressCode:Z.shortAddressCode,shipToTaxId:Z.taxId,shippingAddress:{addressLine1:l.line1,addressLine2:l.line2,city:l.city,country:l.country,postalCode:l.postal_code,state:l.state}}},J=()=>{const e="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),t=Z.stripeLinkEventData,n=Z.stripeAddressEventData,r=Z.stripeShippingSameAsBilling?Z.stripeAddressEventData:Z.stripeBillingAddressEventData;if(d({stripeAddressData:n,stripeBillingAddressData:r},"info"),!n||!r)throw new Error("Missing stripe address data");const s=F({currentAddress:n,translatedAddress:Z.translatedAddress.address}),{firstName:i,lastName:a}=_({name:s.name}),l=F({currentAddress:r,translatedAddress:Z.translatedAddress.address}),{firstName:c,lastName:u}=_({name:l.name}),m=Ie.adjustments.map((e=>({amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}))),p=Ie.promoCode?[{amount:0,productId:null,promoCode:Ie.promoCode,sku:null,type:"PROMO_CODE"},...m]:m;return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{firstName:c,lastName:u,phone:l.phone},checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:Z.companyName,email:null==t?void 0:t.value.email,firstName:i,lastName:a,phone:s.phone},isTest:e,items:Ie.items,landedCostAdjustments:p,shipToShortAddressCode:Z.shortAddressCode,shipToTaxId:Z.taxId,shippingAddress:{addressLine1:s.line1,addressLine2:s.line2,city:s.city,country:s.country,postalCode:s.postal_code,state:s.state}}};const M=async e=>{const o=window.Zonos.cartId;if(!o)return await(async e=>{var o;const n=t.checkoutSettings.buildLandedCost;if(n){const e=await(async e=>{var t,o,n,r,s;const i=J(),a=await e({billingAddress:i.billingAddress,billingContact:i.billingContact,checkoutSessionId:i.checkoutSessionId,contact:i.contact,landedCostAdjustments:i.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:i.shippingAddress,zonosApiRoute:m.vercel},{promoCode:Ie.promoCode});if(!a||!(null===(t=a.checkoutSessionWorkflow)||void 0===t?void 0:t.length)&&(null===(o=a.errors)||void 0===o?void 0:o.length))throw new Error(`Failed to build landed cost: ${(null===(r=null===(n=null==a?void 0:a.errors)||void 0===n?void 0:n[0])||void 0===r?void 0:r.message)||"Unknown error"}`);const{errors:d,json:l}=await c("/api/zonos-elements/validate-landed-cost",{body:a,headers:{"Content-Type":"application/json"},method:"POST"});if(!l||d.length)throw new Error(`Invalid landed cost object: ${(null===(s=d.find(Boolean))||void 0===s?void 0:s.message)||"Unknown error"}`);return a})(n);return e}const{errors:r,json:s}=await c("/api/zonos-elements/calculate-landed-cost",{body:J(),method:"POST",signal:null==e?void 0:e.signal});if(r.length||!s){if("The user aborted a request."===(null===(o=r[0])||void 0===o?void 0:o.message))throw new Error("The landed cost calculation request was aborted to initiate a new one.");if(r.forEach((e=>{console.warn(`Error calculating landed cost: ${e.message}`)})),!s)throw new Error("Failed to calculate landed cost");return s}return s})(e);const n=await(async({abortController:e,cartId:t})=>{var o,n,r,s,i;const{errors:a,json:d}=await c("/api/zonos-elements/cart-calculate-landed-cost",{body:B(t),method:"POST",signal:null==e?void 0:e.signal});if(a.length||!d){const e="string"==typeof(null===(o=a[0])||void 0===o?void 0:o.message)&&("The user aborted a request."===(null===(n=a[0])||void 0===n?void 0:n.message)||(null===(r=a[0])||void 0===r?void 0:r.message.includes("signal is aborted"))||(null===(s=a[0])||void 0===s?void 0:s.message.includes("The operation was aborted"))||(null===(i=a[0])||void 0===i?void 0:i.message.includes("Fetch is aborted")));throw new Error(e?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost")}return d})({abortController:e,cartId:o}),{cartWorkflow:r}=n,s=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}(n,["cartWorkflow"]);return Object.assign(Object.assign({},s),{itemCreateWorkflow:r.items})},W=async({checkoutSessionId:e,eventName:o,metadata:n})=>{var s,i;const a=Date.now(),d=[...window.Zonos.trackEventLogs];window.Zonos.trackEventLogs.push({checkoutSessionId:e,eventCreated:a,eventName:o});const u=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!(null===(s=window.Zonos)||void 0===s?void 0:s.zonosQaUrl)||!!(null===(i=window.Zonos)||void 0===i?void 0:i.debug);if((p()||v()||u)&&!window.Zonos.zonosConversionTest)return;const m=r.selectedCountryCode,y=t.organizationId;if(!e)return void h({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No checkout session id found`],metadata:{allLogs:l,checkoutSessionId:e,eventName:o,metadata:n,organizationId:y,trackEventLogs:d}});y||h({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No organization id found`],metadata:{allLogs:l,checkoutSessionId:e,eventName:o,metadata:n,organizationId:y,trackEventLogs:d}});const w={checkoutSessionId:e,countryCode:m,eventCreated:a,eventName:o,metadata:Object.assign(Object.assign({},n),{trackEventLogs:d}),organizationId:y};await c("/api/zonos-elements/track-conversion-event",{body:w,method:"POST"})},$=({address:e,invalidAdddressList:t})=>{if(!e)return;if(!t)return;const o={};return t.city&&(o.city=e.city),t.line1&&(o.line1=e.line1),t.line2&&(o.line2=e.line2),t.postal_code&&(o.postal_code=e.postal_code),t.state&&(o.state=e.state),t.name&&(o.name=e.name),Object.keys(o).length?o:void 0},q=e=>e.sort(((e,t)=>e.amount-t.amount)),Y=async()=>{var e;const{errors:t,json:o}=await g();return t.length||!o?(u("Failed to retrieve checkout session info before confirming payment ",t),h({endpoint:"validateCheckoutSession",errors:t.map((e=>e.message)),metadata:{allLogs:l}}),{errorMessage:n("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:!1}):(null===(e=o.checkoutSession.landedCost)||void 0===e?void 0:e.id)?{errorMessage:"",valid:!0}:(u("Landed cost is not found in the checkout session before confirming payment."),h({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:l}}),{errorMessage:n('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:!1})},H=({theme:e})=>{const o={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:t.appearance.fontSizeInputValue?`${t.appearance.fontSizeInputValue}px`:void 0,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:t.appearance.fontSizeInputLabel?`${t.appearance.fontSizeInputLabel}px`:void 0},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};return"DARK"===e?Object.assign(Object.assign({},o),{".Action":Object.assign(Object.assign({},o[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},o[".PickerItem--new"]),{color:"white"})}):o},K=({borderStyle:e,theme:t})=>"DARK"===t?{borderRadius:f({overrideBorderStyle:e}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"}:{borderRadius:f({overrideBorderStyle:e}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"},{onChange:G,reset:V,state:Z}=e((()=>({checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:!1,isFetchingLandedCost:!1,isFetchingSession:!1,partyBillingId:null,partyShippingId:null,shortAddressCode:"",shouldInventoryRefund:!1,shouldRenderPayInUsdButton:!1,skipPaymentIntent:"0"!==new URLSearchParams(window.location.search).get("skipPaymentIntent"),stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:!0,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}))),Q=()=>{window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")},X=e=>{window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))},ee=()=>{const e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return y(e)},te=async e=>{var o,n;const s=Z.clientSecret;if(!Z.stripe)return void d("Skip. Stripe is not initialized");const i=(({clientSecret:e,overrideBorderRadius:o,overridePrimaryColor:n,overrideSecondaryColor:s,overrideTheme:i,paypalEnabled:a})=>{const d=n||t.appearance.colorPrimary,l=s||t.appearance.colorSecondary,c=(window.Zonos.isCollect||window.Zonos.isInvoice?"DARK"===t.appearance.theme:d&&w(d))?"night":"flat",u="DARK"===i?"night":"flat",m=a?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},H({theme:i||"LIGHT"})),theme:i?u:c,variables:Object.assign(Object.assign({},K({borderStyle:o,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:e||void 0,customerSessionClientSecret:Z.stripeCustomerSessionClientSecret||void 0,externalPaymentMethodTypes:[...m],locale:r.selectedLocale}})({clientSecret:s,overrideBorderRadius:null==e?void 0:e.overrideBorderRadius,overridePrimaryColor:null==e?void 0:e.overridePrimaryColor,overrideSecondaryColor:null==e?void 0:e.overrideSecondaryColor,overrideTheme:null==e?void 0:e.overrideTheme,paypalEnabled:null==e?void 0:e.paypalEnabled}),a=JSON.stringify(i)===JSON.stringify(Z.stripeElementsOptions);if(!Z.stripeElements||!Z.stripeElementsForBillingAddress)return Z.stripeElementsForBillingAddress=null===(o=Z.stripe)||void 0===o?void 0:o.elements(i),d("Stripe elements for billing address initialized"),Z.stripeElements=null===(n=Z.stripe)||void 0===n?void 0:n.elements(i),Z.stripeElementsOptions=i,void d("Stripe elements initialized");a||(Z.stripeElements.update(i),Z.stripeElementsForBillingAddress.update(i),Z.stripeElementsOptions=i,Z.stripeElements.fetchUpdates()),d("Stripe elements updated")},oe=()=>{sessionStorage.removeItem("zonos--client-secret"),V(),Z.stripe=window.Zonos.stripe},ne=({address:e,firstName:t,lastName:n,name:r,phone:s})=>{const{firstName:i,lastName:a}=_({firstName:t,lastName:n,name:r});return i&&a||h({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,firstName:t,lastName:n,name:r}}),s||h({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,phone:s}}),{city:e.city,country:e.country,firstName:i,lastName:a,line1:e.line1,line2:e.line2,phone:s||"",postal_code:e.postal_code,state:e.state}},re=async()=>{var e,t,n,r;if(!(null===(e=Z.stripeAddressEventData)||void 0===e?void 0:e.complete)||!Z.stripeShippingSameAsBilling&&!(null===(t=Z.stripeBillingAddressEventData)||void 0===t?void 0:t.complete)||!Z.stripeBillingAddressEventData)return{partiesCreated:!1};if(!Ie.landedCostData)return{partiesCreated:!1};const s=null===(n=Ie.landedCostData.find(Boolean))||void 0===n?void 0:n.landedCost.rootId;if(!s)return h({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}}),{partiesCreated:!1};const i=(()=>{var e,t,o,n,r,s,i,a;const d=null===(e=Ie.partiesData.find((e=>"DESTINATION"===e.type)))||void 0===e?void 0:e.id,l=null===(t=Ie.partiesData.find((e=>"PAYOR"===e.type)))||void 0===t?void 0:t.id;if(!d||!l)return!1;if(Z.partyShippingId!==d||Z.partyBillingId!==l)return!0;const c=JSON.stringify(null===(o=Z.stripeLinkUsedWhenFetchingLC)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=Z.stripeLinkEventData)||void 0===n?void 0:n.value),u=JSON.stringify(null===(r=Z.stripeAddressUsedWhenAsyncAddressUpdate)||void 0===r?void 0:r.value)!==JSON.stringify(null===(s=Z.stripeAddressEventData)||void 0===s?void 0:s.value),m=!Z.stripeShippingSameAsBilling&&JSON.stringify(null===(i=Z.stripeBillingAddressUsedWhenAsyncAddressUpdate)||void 0===i?void 0:i.value)!==JSON.stringify(null===(a=Z.stripeBillingAddressEventData)||void 0===a?void 0:a.value);return c||u||m||Z.taxIdUsedWhenAsyncAddressUpdate!==Z.taxId||Z.companyNameUsedWhenAsyncAddressUpdate!==Z.companyName})();if(!i)return{partiesCreated:!1};const a=ne({address:Z.stripeAddressEventData.value.address,firstName:Z.stripeAddressEventData.value.firstName,lastName:Z.stripeAddressEventData.value.lastName,name:Z.stripeAddressEventData.value.name,phone:Z.stripeAddressEventData.value.phone}),d=Z.stripeShippingSameAsBilling?a:ne({address:Z.stripeBillingAddressEventData.value.address,firstName:Z.stripeBillingAddressEventData.value.firstName,lastName:Z.stripeBillingAddressEventData.value.lastName,name:Z.stripeBillingAddressEventData.value.name,phone:Z.stripeBillingAddressEventData.value.phone}),m="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:p,json:v}=await c("/api/zonos-elements/create-parties",{body:{address:a,billingAddress:d,companyName:Z.companyName,email:(null===(r=Z.stripeLinkEventData)||void 0===r?void 0:r.value.email)||"",isTest:m,rootId:s,shortAddressCode:Z.shortAddressCode,taxId:Z.taxId},method:"POST"});return p.length||!v?(u("Error occurs when creating parties",JSON.stringify(p,null,2)),h({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:p,json:v}}),{partiesCreated:!1}):(Z.companyNameUsedWhenAsyncAddressUpdate=Z.companyName,Z.stripeAddressUsedWhenAsyncAddressUpdate=Z.stripeAddressEventData,Z.stripeBillingAddressUsedWhenAsyncAddressUpdate=Z.stripeBillingAddressEventData,Z.taxIdUsedWhenAsyncAddressUpdate=Z.taxId,Z.partyBillingId=v.billToPartyId,Z.partyShippingId=v.shipToPartyId,Ie.partiesData=Ie.partiesData.map((e=>"DESTINATION"===e.type&&e.id!==v.shipToPartyId?Object.assign(Object.assign({},e),{id:v.shipToPartyId}):"PAYOR"===e.type&&e.id!==v.billToPartyId?Object.assign(Object.assign({},e),{id:v.billToPartyId}):e)),{partiesCreated:!0})},se=e=>({countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}),ie=async e=>{var n,r,s,i;const a=(null==e?void 0:e.retries)||0,l=!!(null==e?void 0:e.applyingPromocode),c=(()=>{var e;const t=Ie.landedCostData&&(null===(e=Ie.landedCostData.find(Boolean))||void 0===e?void 0:e.subtotals.items)!==Ie.subtotal,o=(()=>{var e,t;const o=JSON.stringify(null===(e=Z.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=Z.stripeLinkEventData)||void 0===t?void 0:t.value),n=Z.stripeAddressEventData&&JSON.stringify(se(Z.stripeAddressEventData.value))!==JSON.stringify(Z.stripeAddressUsedWhenFetchingLC),r=!Z.stripeShippingSameAsBilling&&Z.stripeBillingAddressEventData&&JSON.stringify(se(Z.stripeBillingAddressEventData.value))!==JSON.stringify(Z.stripeBillingAddressUsedWhenFetchingLC);return o||n||r})();return d("isPrefetchInfoOutdated","info",{isAddressOutdated:o}),!Ie.landedCostData&&!Z.isFetchingLandedCost||o||t})();if(!(()=>{var e,o,n,r;const s=!!(null===(e=Z.stripeLinkEventData)||void 0===e?void 0:e.complete),i=!!(null===(o=Z.stripeAddressEventData)||void 0===o?void 0:o.complete),a=Z.stripeShippingSameAsBilling?i:!!(null===(n=Z.stripeBillingAddressEventData)||void 0===n?void 0:n.complete),d=(e=>{var o,n;const r=null===(o=t.genericSettings)||void 0===o?void 0:o.countryFields,s=null===(n=t.genericSettings)||void 0===n?void 0:n.stripeCountryFieldLabels;return"stripe"===Ie.addressFormRenderType&&(s&&e in s?s[e]:null)||(r&&e in r?r[e]:null)})((null===(r=Z.stripeAddressEventData)||void 0===r?void 0:r.value.address.country)||"US");return!!(i&&a&&s)||(d&&Z.stripeAddressEventData?s&&Z.stripeAddressEventData.value.firstName&&Z.stripeAddressEventData.value.lastName&&Z.stripeAddressEventData.value.address.line1.length>0&&(!d.stateRequired||d.stateRequired&&Z.stripeAddressEventData.value.address.state.length>0)&&(!d.zipRequired||d.zipRequired&&Z.stripeAddressEventData.value.address.postal_code.length>=3)&&Z.stripeAddressEventData.value.phone&&Z.stripeAddressEventData.value.phone.length>0:i&&a&&s)})())return{isRequestNotReady:!0};if(c&&(null===(n=Z.fetchingLandedCostAbortController)||void 0===n||n.abort(),Z.fetchingLandedCostAbortController=null),!c&&!l)return{isRequestNotReady:!1};a?(Z.isFetchingLandedCost=!1,setTimeout((()=>{Z.isFetchingLandedCost=!0}),300)):Z.isFetchingLandedCost=!0,Z.stripeAddressEventData&&(Z.stripeAddressUsedWhenFetchingLC={countryCode:Z.stripeAddressEventData.value.address.country,postalCode:Z.stripeAddressEventData.value.address.postal_code,state:Z.stripeAddressEventData.value.address.state}),Z.stripeBillingAddressEventData&&(Z.stripeBillingAddressUsedWhenFetchingLC={countryCode:Z.stripeBillingAddressEventData.value.address.country,postalCode:Z.stripeBillingAddressEventData.value.address.postal_code,state:Z.stripeBillingAddressEventData.value.address.state}),Z.stripeLinkEventData&&(Z.stripeLinkUsedWhenFetchingLC=Object.assign({},Z.stripeLinkEventData));try{Je(),await(async()=>{var e;const t=new AbortController;Z.fetchingLandedCostAbortController=t,Je();const{checkoutSessionWorkflow:n,errors:r,itemCreateWorkflow:s,landedCostCalculateWorkflow:i,partyCreateWorkflow:a,shipmentRatingCalculateWorkflow:d}=await M(t);Ie.customQuotingError=(null===(e=null==r?void 0:r.find((e=>{var t;return"CUSTOM"===(null===(t=e.extensions)||void 0===t?void 0:t.ruleMessageType)})))||void 0===e?void 0:e.message)||null,Ie.shippingData=q((null==d?void 0:d.filter(Boolean))||[]),je(s),Z.fetchingLandedCostAbortController=null,Ie.partiesData=(null==a?void 0:a.filter(Boolean))||[],Ie.landedCostData=(null==n?void 0:n.map((e=>{const t=null==i?void 0:i.find((t=>(null==t?void 0:t.id)===e.landedCostId));return t?Object.assign(Object.assign({},e),{landedCost:t}):null})).filter(Boolean))||[],(null==n?void 0:n.length)&&W({checkoutSessionId:o.checkoutSessionId,eventName:"checkout_quoteReceived"});const l=Ie.promoCodeApplied&&!Ie.landedCostData.find((e=>{var t;return null===(t=e.landedCost.appliedAdjustments)||void 0===t?void 0:t.find((e=>"PROMO_CODE"===e.type))}));Ie.promoCodeError=l,l||sessionStorage.setItem("zonos--promo-code",Ie.promoCode)})();const e=null===(r=Ie.shippingData)||void 0===r?void 0:r.find(Boolean),t=null===(s=Ie.landedCostData)||void 0===s?void 0:s.find((t=>t.landedCost.shipmentRating.id===(null==e?void 0:e.id))),n=t?t.subtotals:null;n&&Le({method:(null==t?void 0:t.landedCost.method)||"DDP",subtotals:n})}catch(t){if(Ie.landedCostData=[],Ie.shippingData=[],t instanceof Error&&t.message&&!["The landed cost calculation request was aborted to initiate a new one."].includes(t.message)){if(a<1)return await ie(Object.assign(Object.assign({},e),{retries:(a||0)+1})),{isRequestNotReady:!1};const o=null===(i=Z.stripeAddressEventData)||void 0===i?void 0:i.value;h({endpoint:`Failed to fetch landed cost (${a} retries)`,errors:[t.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:o}})}u(t)}return Z.isFetchingLandedCost=!1,{isRequestNotReady:!1}},ae=async()=>{var e,t;await ie({applyingPromocode:!0}),"payment"===Ie.step&&We(),await re();const o=null===(e=Ie.shippingData)||void 0===e?void 0:e.find(Boolean),n=null===(t=Ie.landedCostData)||void 0===t?void 0:t.find((e=>e.landedCost.id===(null==o?void 0:o.id)));o&&n&&await _e({applySubtotalsOnly:!1,landedCostId:n.landedCostId,selectedShippingOption:o})},de=()=>{Ie.promoCode="",sessionStorage.removeItem("zonos--promo-code"),Ie.promoCodeError=!1,Ie.promoCodeApplied=!1},le=async()=>{"payment"===Ie.step&&We(),de(),await ae()},ce=e=>{let t=[],o=!0;const r=window.Zonos.isCollect,s=window.Zonos.isInvoice;switch(e){case"succeeded":t=[n("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"",n("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")],(r||s)&&(t=[n("Thank you for submitting your payment. We appreciate your prompt attention."),"",n("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]),o=!1;break;case"requires_capture":case"processing":t=[n("Payment processing. We'll update you when payment is received.")],o=!1;break;case"requires_payment_method":t=[n("Payment failed. Please try another payment method.")],r&&(t=[n("Payment failed. Please reload the page and try another payment method.")]);break;case"requires_action":o=!1,t=[n("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")];default:t=[n("Something went wrong.")]}return{isError:o,messages:t}},ue=async()=>{var e,o;const{onInventoryCheck:r}=t.checkoutSettings,s=!!(null===(o=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.metadata.find((e=>"referenceId"===e.key)))||void 0===o?void 0:o.value);if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&s){const{errors:e,json:t}=await c("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"});return e.length||!t?(u("Error occurs when handling inventory refund","warn",JSON.stringify(e)),null):t.available&&204!==t.status?t.available||200===t.status?(Z.shouldInventoryRefund=!0,null):null:n("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")}if("function"!=typeof r)return null;try{return await r({items:Ie.items},{translate:n,zonosApiRoute:m.vercel})}catch(e){const t=e instanceof Error?e.message:"Unknown error";throw h({endpoint:"onInventoryCheck",errors:[`cartId: ${window.Zonos.cartId} - ${t}`],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:Ie.items}}),e}},me=async()=>{var e,t;const o=!!(null===(t=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.metadata.find((e=>"referenceId"===e.key)))||void 0===t?void 0:t.value);window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o&&await c("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})},pe=async({clientSecret:e,storybookForceStatus:t})=>{if(t){const{isError:e,messages:o}=ce(t);return{error:e,messages:o}}const o=e||Z.clientSecret;if(!Z.stripe||!o)return u("Failed to retrieve payment intent. Stripe is not initialized"),{error:!0,message:[n("Something went wrong.")]};const{paymentIntent:r}=await Z.stripe.retrievePaymentIntent(o),s=null==r?void 0:r.status,{isError:i,messages:a}=ce(s);return{amount:null==r?void 0:r.amount,currency:null==r?void 0:r.currency,error:i,messages:a,paymentIntentId:null==r?void 0:r.id,paymentMethod:null==r?void 0:r.payment_method,status:s}},ve=async e=>{var t,r;const s=!!(null===(t=Z.stripePaymentEventData)||void 0===t?void 0:t.complete),i=Z.stripeElements,a=Z.stripe,l=Z.clientSecret;if(Z.customErrorMessage=null,!(null===(r=Ie.selectedLandedCost)||void 0===r?void 0:r.landedCost.id)&&!(null==e?void 0:e.noLandedCostCheck))throw new Error("Attempted to confirm the payment when no landed cost is found in store");const c=await Y();if(!c.valid)throw Z.customErrorMessage=c.errorMessage,new Error(c.errorMessage);const u=o.checkoutSessionId;if(a&&i&&s&&l&&u){const e=new URL(window.location.href);e.searchParams.set("payment_intent_client_secret",l),e.searchParams.set("zonosCheckoutSessionId",u),W({checkoutSessionId:u,eventName:"checkout_paymentInfoCompleted"});const{error:t,paymentIntent:o}=await a.confirmPayment({confirmParams:{return_url:e.toString()},elements:i,redirect:"if_required"});if(d("Payment intent confirmed","info",{error:t,paymentIntent:o}),"requires_action"===(null==o?void 0:o.status))throw new Error(n("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."));if(t){if("card_error"===t.type||"validation_error"===t.type)throw new Error(t.message);if("invalid_request_error"===t.type&&"payment_intent_unexpected_state"===t.code)return;throw new Error("An unexpected error occurred.")}if("requires_payment_method"===o.status)throw new Error(n("Payment failed. Please try another payment method."))}},he=()=>{var e;const t=Ie.items.reduce(((e,t)=>e+t.amount*t.quantity),0),n=o.enabledVariantTestKeys||[];return{adjustmentsAmount:Ie.adjustments.reduce(((e,t)=>e+t.amount),0),cartId:window.Zonos.cartId,currency:(null===(e=Ie.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",customerAuthenticationToken:Ie.customerAuthenticationToken||void 0,isCollect:!!window.Zonos.isCollect,isInvoice:!!window.Zonos.isInvoice,itemsAmount:t,metadata:[{key:"language",value:r.selectedLocale}],presentmentCountryCode:r.selectedCountryCode,skipPaymentIntent:Z.skipPaymentIntent,varianceTestInput:n}},ye=async()=>{var e;if(!o.checkoutSessionId)return h({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:l,cartId:window.Zonos.cartId}}),void De({messages:[n("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:n("Error creating Checkout")});const{errors:t,json:r}=await c("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:o.checkoutSessionId},method:"POST"}),s=null===(e=null==r?void 0:r.checkoutSessionPaymentIntentCreate)||void 0===e?void 0:e.clientSecret;if(t.length||!s)return u("Error occurs when getting payment intent",JSON.stringify(t,null,2)),h({endpoint:"Error creating payment intent",errors:t.map((e=>e.message)),metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,clientSecret:s}}),void De({messages:[n("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:n("Error creating Checkout")});Re(r.checkoutSessionPaymentIntentCreate)},we=async()=>{var e,t;if(!r.targetCurrency)return u("Failed to create checkout session - missing localizationStore.targetCurrency"),!1;Z.isFetchingSession=!0;const o=he();d("Checkout session body","info",o);const{errors:n,json:s}=await c("/api/zonos-elements/create-checkout-session",{body:o,method:"POST"});if(Z.isFetchingSession=!1,n.length||!s){const t=null===(e=n.find((e=>e.message)))||void 0===e?void 0:e.message;if(Array.isArray(t)&&t.some((e=>"Cart is expired."===e.message)))throw new Error("Cart is expired.");return u("Error occurred when creating checkout session",JSON.stringify(n,null,2)),!1}const i=s.checkoutSessionCreate;return Re(i),Le({method:(null===(t=i.landedCost)||void 0===t?void 0:t.method)||"DDP",subtotals:i.subtotals}),d("Exchange rate updated for cart items (checkout session create)","info",Ie.exchangeRate),d("done-init-checkout-session"),!0},fe=async()=>{const e=o.checkoutSessionId;if(!e)return u("Failed to update checkout session base currency"),!1;if("LOCAL"===t.checkoutSettings.allowedSettlementCurrencies)return d('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency'),!0;const{json:n}=await c("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:Z.checkoutSettlementCurrency},method:"POST"}),r=null==n?void 0:n.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;return n&&r===Z.checkoutSettlementCurrency?(d(`Updated checkout session to settlement currency "${r}".`),!0):(u("Failed to update checkout session base currency"),!1)},ge=async({adjustmentsAmount:e,cartId:t,currency:n,id:s,itemsAmount:i,landedCostId:a,presentmentCountryCode:d,storeCreditApplication:l})=>{const m=o.enabledVariantTestKeys||[],{errors:p,json:v}=await c("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:e,billToPartyId:Z.partyBillingId,cartId:t,currency:n,customerAuthenticationToken:Ie.customerAuthenticationToken||void 0,id:s,itemsAmount:i,landedCostId:a,metadata:[{key:"language",value:r.selectedLocale}],presentmentCountryCode:d,shipToPartyId:Z.partyShippingId,skipPaymentIntent:Z.skipPaymentIntent,storeCreditApplication:l,varianceTestInput:m},method:"POST"});return p.length||!v?(u("Error occurs when updating checkout session",JSON.stringify(p,null,2)),{errors:p,json:v}):{errors:[],json:v}},be=async()=>{const e=(()=>{if(!R.accepted)return null;const e=z();return e.length?{key:"merchantPolicyConsent",value:JSON.stringify({acceptedAt:R.acceptedAt||(new Date).toISOString(),locale:r.selectedLocale,policies:e.reduce(((e,t)=>(e[t.key]=t.url,e)),{})})}:null})();if(!e)return{errors:[]};if(!o.checkoutSessionId)return{errors:[]};const{errors:t}=await c("/api/zonos-elements/update-checkout-session-metadata",{body:{id:o.checkoutSessionId,metadata:[e]},method:"POST"});return t.length?(u("Failed to record merchant policy consent on checkout session",JSON.stringify(t,null,2)),{errors:t.map((e=>e.message||"Unknown error"))}):{errors:[]}},Se=({currentAddress:e,translatedAddressResult:t})=>{const o={};if(!t)return o;const{city:n,line1:r,line2:s,name:i,postal_code:a,state:d}=t;return e.city&&n&&(o.city={[e.city]:n}),e.line1&&r&&(o.line1={[e.line1]:r}),e.line2&&s&&(o.line2={[e.line2]:s}),e.postal_code&&a&&(o.postal_code={[e.postal_code]:a}),e.state&&d&&(o.state={[e.state]:d}),e.name&&i&&(o.name={[e.name]:i}),o},Ce=async({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t})=>{var o,n,r,s;const i=(({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:o,stripeBillingAddressEventData:n,stripeShippingSameAsBilling:r})=>{const s=!!(null==o?void 0:o.complete);if(!s||!(r?s:null==n?void 0:n.complete))return null;if(!e&&!t)return null;const i=o.value,a=(null==n?void 0:n.value)||null,{firstName:d,lastName:l}=_({firstName:i.firstName,lastName:i.lastName,name:i.name}),c=`${d} ${l}`,{firstName:u,lastName:m}=_({firstName:null==a?void 0:a.firstName,lastName:null==a?void 0:a.lastName,name:(null==a?void 0:a.name)||""}),p=u&&m?`${u} ${m}`:"",v=i.address,h=null==a?void 0:a.address;return{address:$({address:Object.assign(Object.assign({},v),{name:c}),invalidAdddressList:e}),billingAddress:r?void 0:$({address:h?Object.assign(Object.assign({},h),{name:p}):null,invalidAdddressList:t}),destinationCountry:v.country}})({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:Z.stripeAddressEventData,stripeBillingAddressEventData:Z.stripeBillingAddressEventData,stripeShippingSameAsBilling:Z.stripeShippingSameAsBilling});if(!i)return void(Z.translatedAddress={address:{},billingAddress:{}});const a=(()=>{var e,t,o,n;const r=JSON.stringify(null===(e=Z.stripeAddressUsedWhenValidatingAddress)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=Z.stripeAddressEventData)||void 0===t?void 0:t.value),s=!Z.stripeShippingSameAsBilling&&JSON.stringify(null===(o=Z.stripeBillingAddressEventData)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=Z.stripeBillingAddressUsedWhenValidatingAddress)||void 0===n?void 0:n.value);return r||s})();if(!a)return;const{errors:d,json:l}=await c("/api/zonos-elements/validate-address",{body:i,method:"POST"});if(d.length||!l)return u("Error occurs when translating address to latin",JSON.stringify(d,null,2)),void(Z.translatedAddress={address:{},billingAddress:{}});Z.stripeAddressUsedWhenValidatingAddress=Z.stripeAddressEventData,Z.stripeBillingAddressUsedWhenValidatingAddress=Z.stripeBillingAddressEventData;const m=null===(o=Z.stripeAddressEventData)||void 0===o?void 0:o.value.address,p=null===(n=Z.stripeBillingAddressEventData)||void 0===n?void 0:n.value.address;Z.translatedAddress={address:m?Se({currentAddress:Object.assign(Object.assign({},m),{name:null===(r=Z.stripeAddressEventData)||void 0===r?void 0:r.value.name}),translatedAddressResult:l.address||null}):{},billingAddress:Z.stripeShippingSameAsBilling?{}:Se({currentAddress:Object.assign(Object.assign({},p),{name:null===(s=Z.stripeBillingAddressEventData)||void 0===s?void 0:s.value.name}),translatedAddressResult:l.billingAddress||null})}};G("clientSecret",(e=>{e&&Z.stripe&&sessionStorage.setItem("zonos--client-secret",e),e||sessionStorage.removeItem("zonos--client-secret")}));const{onChange:Oe,reset:Ae,state:Ie}=e((()=>({addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:!1,checkoutTimeoutInterval:null,currency:"USD",customMessage:[],customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:!1,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:!1,isSelectedShippingGuarantee:!1,isStagingMode:v(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:!1,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:!1,step:"customer-info",storeCredit:0,subtotal:0,tabItems:{"customer-info":{index:1,isDone:!1,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:!1,label:"Shipping",value:"shipping"},payment:{index:3,isDone:!1,label:"Payment",value:"payment"}},total:0}))),ke=e=>{switch(e){case"DAYS":return n("days");case"WEEKS":return n("weeks");default:return n("business days")}},Ne=e=>{var t;const o=null===(t=e.shippingProfile)||void 0===t?void 0:t.transitTime;return(null==o?void 0:o.min)&&(null==o?void 0:o.max)&&(null==o?void 0:o.type)?{maxTransit:o.max,minTransit:o.min,unit:ke(o.type)}:null},Te=({item1:e,item2:t})=>!(!e||!t)&&(t.sku&&e.sku&&e.sku===t.sku||t.description&&e.description&&e.description===t.description||e.name&&t.name&&e.name===t.name),je=e=>{d("Checking item restrictions");const t=e.map((e=>{if(!e.restriction)return null;const{restriction:t}=e,o=Ie.items.find((t=>Te({item1:t,item2:e})));return Object.assign(Object.assign({matchedItem:o},e),{restriction:t})})).filter(Boolean);return Ie.restrictedItems=t,Ie.items=Ie.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!!t.find((t=>Te({item1:t,item2:e})))}))),{cartItems:Ie.items,restrictedItems:t}};let Ee=null;const Pe=()=>{o.checkoutSessionId=null,Ee&&(clearTimeout(Ee),Ee=null),C(),Ae()},De=({messages:e,title:t})=>{Pe(),oe(),Ie.step="error",Ie.error={messages:e,title:t}},Le=({dutiesTaxesFeesEstimate:e,method:t,subtotals:o})=>{var n;Ie.exchangeRate=o.exchangeRate,Ie.adjustmentTotal=o.adjustments,Ie.dutiesTaxesFees="DAP"===t?null:o.landedCostTotal,Ie.storeCredit=null!==(n=o.storeCredit)&&void 0!==n?n:0,Ie.subtotal=o.items,Ie.total=o.total,Ie.currency=o.presentmentCurrencyCode,Ie.dutiesTaxesFeesEstimate=e||null},xe=()=>!!Ie.items.filter((e=>e.amount>0)).find((e=>!e.isRestricted)),Re=e=>{var t,n,r,s,c,u,m;Z.clientSecret=e.clientSecret,Z.stripeCustomerSessionClientSecret=e.customerSessionClientSecret,Z.customerProfile=e.customerProfile,Ie.checkoutSession=e,O(null!==(n=null===(t=e.customerProfile)||void 0===t?void 0:t.storeCreditBalance)&&void 0!==n?n:null),e.id||h({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:l,checkoutSession:e}}),e.id&&(o.checkoutSessionId=e.id);const p=i(e.varianceTestResults||[]);a(p);const v=(null===(c=null===(s=null===(r=Ie.checkoutSession)||void 0===r?void 0:r.metadata)||void 0===s?void 0:s.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===c?void 0:c.value)||(null===(m=null===(u=window.Zonos.cartData)||void 0===u?void 0:u.metadata.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===m?void 0:m.value)||null;v&&(d(`Found externalConfirmationPageURL: ${v}`),Ie.externalConfirmationPageURL=v)},ze=async({adjustmentsAmount:e,cartId:t,currency:s,dutiesTaxesFeesEstimate:i,itemsAmount:a,landedCostId:l,shouldInitSessionOnFailure:c})=>{var m;if(l&&Ie.selectedLandedCost&&(Le({dutiesTaxesFeesEstimate:i,method:Ie.landedCostMethod,subtotals:Ie.selectedLandedCost.subtotals}),d("Exchange rate updated for cart items (landed cost subtotal)","info",Ie.exchangeRate)),!o.checkoutSessionId)return d("Could not update cart total without checkout session id","info"),!1;const{errors:p,json:v}=await ge({adjustmentsAmount:e,billToPartyId:Z.partyBillingId,cartId:t,currency:s,id:o.checkoutSessionId,itemsAmount:a,landedCostId:l,presentmentCountryCode:r.selectedCountryCode,shipToPartyId:Z.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});if(p.length>0||!v){if(u("Error occurs when updating checkout session."),c){d("Initiating checkout session on failure","info");const e=await we();return d(`stripeStoreInitCheckoutSession: ${e}`),!!e||(De({messages:[n("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:n("Error creating Checkout")}),!1)}return!1}return l||(Le({method:(null===(m=v.checkoutSessionUpdate.landedCost)||void 0===m?void 0:m.method)||"DDP",subtotals:v.checkoutSessionUpdate.subtotals}),d("Exchange rate updated for cart items (checkout session update)","info",Ie.exchangeRate)),Re(v.checkoutSessionUpdate),!0},Ue=e=>{var o,n,r;return"DAP"===e.method&&(null===(n=null===(o=t.genericSettings)||void 0===o?void 0:o.domesticCountries)||void 0===n?void 0:n.includes((null===(r=Z.stripeAddressEventData)||void 0===r?void 0:r.value.address.country)||"US"))||"DAP"===e.method&&e.remittance.length&&"ZONOS"===e.landedCostGuaranteeCode?"DDP":e.method},_e=async({applySubtotalsOnly:e,landedCostId:n,selectedShippingOption:r})=>{var s,i,a,l,c,u,m,p,v,h,y;d("Updating selected shipping option","info",{landedCostId:n,selectedShippingOption:r}),Ie.selectedShippingOption=r;const w=Ne(Ie.selectedShippingOption);if(w){const{maxTransit:e,minTransit:t,unit:o}=w;Ie.selectedShippingOptionTransitTime=`${t}-${e} ${o}`}else Ie.selectedShippingOptionTransitTime="";const f=null===(s=Ie.landedCostData)||void 0===s?void 0:s.find((e=>e.landedCostId===n));if(Ie.selectedLandedCost=f||null,!f)return!1;const g=((null===(i=f.landedCost.amountSubtotals)||void 0===i?void 0:i.landedCostTotal)||0)*f.subtotals.exchangeRate.rate;g&&d(`DAP quote, using estimate: ${g}`,"info"),Ie.landedCostMethod=Ue(f.landedCost),Ie.shipping=f.subtotals.shipping;const b="ZONOS"===(null===(a=null==f?void 0:f.landedCost)||void 0===a?void 0:a.landedCostGuaranteeCode),S=!!(null===(c=null===(l=null==f?void 0:f.landedCost)||void 0===l?void 0:l.deMinimis)||void 0===c?void 0:c.find((e=>["DUTY","TAX"].includes(e.type)&&"ABOVE"===e.threshold)));Ie.isSelectedShippingAboveDeminimis=S,Ie.isSelectedShippingGuarantee=b;let C=!1;e?(Le({dutiesTaxesFeesEstimate:g,method:Ie.landedCostMethod,subtotals:f.subtotals}),d("Exchange rate updated for cart items (landed cost subtotal)","info",Ie.exchangeRate),C=!0):C=await ze({adjustmentsAmount:Ie.adjustmentTotal,billToPartyId:Z.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:g,landedCostId:null===(u=f.landedCost)||void 0===u?void 0:u.id,shipToPartyId:Z.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});const O=null===(m=Ie.items.find(Boolean))||void 0===m?void 0:m.currencyCode,A=(null===(p=Z.stripeAddressEventData)||void 0===p?void 0:p.value.address.country)||"US";return Z.shouldRenderPayInUsdButton="USD"===O&&"LOCAL_AND_USD"===t.checkoutSettings.allowedSettlementCurrencies&&"USD"!==(null===(v=Ie.checkoutSession)||void 0===v?void 0:v.subtotals.presentmentCurrencyCode)&&!!(null===(y=null===(h=t.genericSettings)||void 0===h?void 0:h.usdSettlementCountryEnabled)||void 0===y?void 0:y.includes(A)),C},Fe=({isPreview:e,sessionTimeout:t})=>{if(e)return;const o=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout"),n=o&&!isNaN(parseInt(o,10))?parseInt(o,10):t;d(`==START CHECKOUT TIMEOUT - ${n}==`),Ie.checkoutTimeoutInterval=setTimeout((()=>{Ie.checkoutSessionTimeoutShow=!0}),n)},Be=()=>{Ie.checkoutTimeoutInterval&&(clearTimeout(Ie.checkoutTimeoutInterval),Ie.checkoutTimeoutInterval=null)},Je=()=>{Ie.items=Ie.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1}))),Ie.restrictedItems=[]},Me=async({adjustments:e,cartItems:t,landedCostId:n,shouldInitSessionOnFailure:r=!0})=>{var s;Ie.adjustments=e,Ie.items=t.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1})));const i=null===(s=t.find(Boolean))||void 0===s?void 0:s.currencyCode,a=t.reduce(((e,t)=>e+t.amount*t.quantity),0),d=e.reduce(((e,t)=>e+t.amount),0);i&&a&&(Ie.currency=i,Z.isFetchingSession=!0,await ze({adjustmentsAmount:d,billToPartyId:Z.partyBillingId,cartId:window.Zonos.cartId,currency:i,dutiesTaxesFeesEstimate:0,itemsAmount:a,landedCostId:n,shipToPartyId:Z.partyShippingId,shouldInitSessionOnFailure:r,varianceTestInput:o.enabledVariantTestKeys||[]}),Z.isFetchingSession=!1)},We=()=>{"shipping"===Ie.step?(Ie.step="customer-info",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{"customer-info":Object.assign(Object.assign({},Ie.tabItems.shipping),{isDone:!1})})):"payment"===Ie.step?(Ie.step="shipping",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{shipping:Object.assign(Object.assign({},Ie.tabItems.shipping),{isDone:!1})})):"finish"===Ie.step&&(Ie.step="payment",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{payment:Object.assign(Object.assign({},Ie.tabItems.payment),{isDone:!1})}))},$e=()=>{"customer-info"===Ie.step?(Ie.step="shipping",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{"customer-info":Object.assign(Object.assign({},Ie.tabItems["customer-info"]),{isDone:!0})})):"shipping"===Ie.step?(Ie.step="payment",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{shipping:Object.assign(Object.assign({},Ie.tabItems.shipping),{isDone:!0})})):"payment"===Ie.step&&(Ie.step="finish")},qe=()=>{Ie.step="customer-info",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{"customer-info":Object.assign(Object.assign({},Ie.tabItems["customer-info"]),{isDone:!1}),payment:Object.assign(Object.assign({},Ie.tabItems.payment),{isDone:!1}),shipping:Object.assign(Object.assign({},Ie.tabItems.shipping),{isDone:!1})}),Ie.selectedShippingOption=null,Ie.isSelectedShippingAboveDeminimis=!1,Ie.isSelectedShippingGuarantee=!1,Ie.selectedShippingOptionTransitTime="",Ie.dutiesTaxesFees=0,Ie.dutiesTaxesFeesEstimate=0,Ie.shipping=0,Ie.total=Ie.subtotal},Ye=()=>{Ee&&clearTimeout(Ee),Ee=setTimeout((()=>{Ee=null,(async()=>{var e,t;if(!o.checkoutSessionId)return void d("Could not update store credit without checkout session id","info");const n=Ie.selectedLandedCost,s=Ie.currency||(null===(e=Ie.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",i=Ie.adjustments.reduce(((e,t)=>e+t.amount),0),a=Ie.items.reduce(((e,t)=>e+t.amount*t.quantity),0),{errors:l,json:c}=await ge({adjustmentsAmount:i,cartId:window.Zonos.cartId,currency:s,id:o.checkoutSessionId,itemsAmount:a,landedCostId:null==n?void 0:n.landedCostId,presentmentCountryCode:r.selectedCountryCode,storeCreditApplication:S.isEnabled&&null!==S.amountToApply?S.useFullBalance?{mode:"FULL"}:{amount:S.amountToApply,mode:"PARTIAL"}:{mode:"NONE"}});l.length>0||!c?u("Error updating checkout session with store credit"):(Le({method:(null===(t=c.checkoutSessionUpdate.landedCost)||void 0===t?void 0:t.method)||"DDP",subtotals:c.checkoutSessionUpdate.subtotals}),Re(c.checkoutSessionUpdate))})()}),300)};export{T as $,Y as A,P as B,ve as C,me as D,R as E,oe as F,Oe as G,G as H,j as I,be as J,ne as K,_e as L,xe as M,ae as N,le as O,de as P,ce as Q,S as R,C as S,Ce as T,_ as U,re as V,Ne as W,Ue as X,q as Y,z as Z,k as _,X as a,Ye as a0,N as a1,A as a2,Z as b,pe as c,Ie as d,Me as e,Pe as f,qe as g,Be as h,te as i,we as j,ye as k,Fe as l,he as m,De as n,Q as o,x as p,Re as q,ie as r,ee as s,W as t,$e as u,U as v,fe as w,ue as x,I as y,E as z}
1
+ import{c as e,z as t}from"./p-701d9a7c.js";import{s as o,t as n,l as r,j as s,f as i,d as a}from"./p-24aa6708.js";import{l as d,b as l}from"./p-0a377722.js";import{h as c,l as u,f as m,g as p,a as v,s as h,j as y}from"./p-41dd1cb8.js";import{i as w}from"./p-33d4be28.js";import{g as f}from"./p-3dc3596b.js";const g=async()=>{if(!o.checkoutSessionId)return{errors:[{message:"No checkout session id found"}],json:null};const e=new URLSearchParams;e.set("checkoutSessionId",o.checkoutSessionId);const{errors:t,json:n}=await c(`/api/zonos-elements/get-checkout-session?${e.toString()}`);return{errors:t,json:n}},{reset:b,state:S}=e((()=>({amountToApply:null,appliedAmount:null,availableBalance:null,error:null,isApplying:!1,isEnabled:!1,orderIdCreated:null,remainingBalance:null,useFullBalance:!0}))),C=()=>{b()},O=e=>{d("Store credit balance from session","info",e),S.availableBalance=e},A=async()=>{var e,t;const{errors:o,json:n}=await g();if(o.length||!n)return void u("Failed to refresh store credit balance");const r=null!==(t=null===(e=n.checkoutSession.customerProfile)||void 0===e?void 0:e.storeCreditBalance)&&void 0!==t?t:null;O(r)},I=async()=>{var e;const t=o.checkoutSessionId;if(!t){const e="No checkout session found";return u(e),S.error=e,{error:e,success:!1}}d("Applying store credit","info",{checkoutSessionId:t}),S.isApplying=!0,S.error=null;try{const{errors:o,json:n}=await c("/api/zonos-elements/store-credit/apply",{body:{checkoutSessionId:t},method:"POST"});if(o.length>0||!n){const t=(null===(e=o[0])||void 0===e?void 0:e.message)||"Failed to apply store credit";return u(t),S.error=t,S.isApplying=!1,{error:t,success:!1}}return S.appliedAmount=n.amountApplied,S.remainingBalance=n.remainingBalance,S.isApplying=!1,d("Store credit applied","info",{amountApplied:n.amountApplied,remainingBalance:n.remainingBalance}),{error:null,success:!0}}catch(e){const t=e instanceof Error?e.message:"Failed to apply store credit";return u(t),S.error=t,S.isApplying=!1,{error:t,success:!1}}},k=e=>{S.isEnabled=e,S.error=null,e||(S.amountToApply=null)},N=e=>{if(null===e)return S.amountToApply=null,void(S.error=null);e<=0?S.error="Amount must be greater than zero":null!==S.availableBalance&&e>S.availableBalance?S.error="Amount exceeds available balance":e>Ie.total+(Ie.storeCredit||0)?S.error="Amount exceeds order total":(S.error=null,S.amountToApply=e)},T=e=>{if(S.useFullBalance=e,S.error=null,e&&null!==S.availableBalance){const e=Math.min(S.availableBalance,Ie.total+(Ie.storeCredit||0));S.amountToApply=e}else e||(S.amountToApply=null)},j=()=>S.isEnabled&&null!==S.availableBalance?S.useFullBalance?Math.min(S.availableBalance,Ie.total+(Ie.storeCredit||0)):S.amountToApply||0:0,E=()=>null!==S.amountToApply&&S.amountToApply>0&&Ie.storeCredit>0&&Ie.total<=0,P=async()=>{var e,t,n;const r=o.checkoutSessionId;if(!r){const e="No checkout session found";return u(e),S.error=e,{error:e,orderId:null,success:!1}}d("Creating store credit order","info",{checkoutSessionId:r});try{const{errors:o,json:s}=await c("/api/zonos-elements/store-credit/order-create",{body:{checkoutSessionId:r},method:"POST"});if(o.length>0||!s){const t=(null===(e=o[0])||void 0===e?void 0:e.message)||"Failed to create store credit order";return u(t),S.error=t,{error:t,orderId:null,success:!1}}const i=(null===(n=null===(t=s.checkoutSessionStoreCreditOrderCreate)||void 0===t?void 0:t.order)||void 0===n?void 0:n.id)||null;return S.orderIdCreated=i,d("Store credit order created","info",{orderId:i}),{error:null,orderId:i,success:!0}}catch(e){const t=e instanceof Error?e.message:"Failed to create store credit order";return u(t),S.error=t,{error:t,orderId:null,success:!1}}},D=["termsAndConditions","privacyPolicy","refundPolicy","shippingPolicy","warrantyPolicy"],L={privacyPolicy:"Privacy policy",refundPolicy:"Refund policy",shippingPolicy:"Shipping policy",termsAndConditions:"Terms and conditions",warrantyPolicy:"Warranty policy"},{reset:x,state:R}=e({accepted:!1,acceptedAt:null,locked:!1,showError:!1}),z=()=>{const e=t.checkoutSettings.merchantPolicyLinks;return e?D.reduce(((t,o)=>{var r,s;const i=null===(s=null===(r=e[o])||void 0===r?void 0:r.link)||void 0===s?void 0:s.trim();return i&&/^https?:\/\//i.test(i)?(t.push({key:o,name:n(L[o]),url:i}),t):t}),[]):[]},U=()=>z().length>0,_=({firstName:e,lastName:t,name:o})=>{var n;if(!o&&!e&&!t)return{firstName:"",lastName:""};const r=(null==o?void 0:o.split(/\s+/))||[];return{firstName:(null==e?void 0:e.trim())||(null===(n=r[0])||void 0===n?void 0:n.trim())||"",lastName:(null==t?void 0:t.trim())||r.slice(1).join(" ").trim()||""}},F=({currentAddress:e,translatedAddress:t})=>{var o,n,r,s,i,a;const{city:d,country:l,line1:c,line2:u,postal_code:m,state:p}=e.value.address,v=e.value.name||[e.value.firstName,e.value.lastName].join(" ");return{city:(null===(o=t.city)||void 0===o?void 0:o[d])||d,country:l,line1:(null===(n=t.line1)||void 0===n?void 0:n[c])||c,line2:(null===(r=t.line2)||void 0===r?void 0:r[u||""])||u||"",name:(null===(s=t.name)||void 0===s?void 0:s[v])||v,phone:e.value.phone||"",postal_code:(null===(i=t.postal_code)||void 0===i?void 0:i[m])||m,state:(null===(a=t.state)||void 0===a?void 0:a[p])||p}},B=e=>{var t;const n="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),i=Z.stripeLinkEventData,a=Z.stripeAddressEventData,d=Z.stripeShippingSameAsBilling?Z.stripeAddressEventData:Z.stripeBillingAddressEventData;if(!a||!d)throw new Error("Missing stripe address data");const l=F({currentAddress:a,translatedAddress:Z.translatedAddress.address}),{firstName:c,lastName:u}=_({name:l.name}),m=F({currentAddress:d,translatedAddress:Z.translatedAddress.address}),{firstName:p,lastName:v}=_({name:m.name}),h=s()||"US";return{billingAddress:{addressLine1:m.line1,addressLine2:m.line2||"",city:m.city,country:m.country,postalCode:m.postal_code,state:m.state},billingContact:{firstName:p,lastName:v,phone:m.phone},cartCurrencyCode:null===(t=Ie.items[0])||void 0===t?void 0:t.currencyCode,cartId:e,checkoutSessionCountry:h||r.selectedCountryCode||void 0,checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:Z.companyName,email:null==i?void 0:i.value.email,firstName:c,lastName:u,phone:l.phone},isTest:!!n,landedCostAdjustments:Ie.promoCode?[{amount:0,productId:null,promoCode:Ie.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToShortAddressCode:Z.shortAddressCode,shipToTaxId:Z.taxId,shippingAddress:{addressLine1:l.line1,addressLine2:l.line2,city:l.city,country:l.country,postalCode:l.postal_code,state:l.state}}},J=()=>{const e="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),t=Z.stripeLinkEventData,n=Z.stripeAddressEventData,r=Z.stripeShippingSameAsBilling?Z.stripeAddressEventData:Z.stripeBillingAddressEventData;if(d({stripeAddressData:n,stripeBillingAddressData:r},"info"),!n||!r)throw new Error("Missing stripe address data");const s=F({currentAddress:n,translatedAddress:Z.translatedAddress.address}),{firstName:i,lastName:a}=_({name:s.name}),l=F({currentAddress:r,translatedAddress:Z.translatedAddress.address}),{firstName:c,lastName:u}=_({name:l.name}),m=Ie.adjustments.map((e=>({amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}))),p=Ie.promoCode?[{amount:0,productId:null,promoCode:Ie.promoCode,sku:null,type:"PROMO_CODE"},...m]:m;return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{firstName:c,lastName:u,phone:l.phone},checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:Z.companyName,email:null==t?void 0:t.value.email,firstName:i,lastName:a,phone:s.phone},isTest:e,items:Ie.items,landedCostAdjustments:p,shipToShortAddressCode:Z.shortAddressCode,shipToTaxId:Z.taxId,shippingAddress:{addressLine1:s.line1,addressLine2:s.line2,city:s.city,country:s.country,postalCode:s.postal_code,state:s.state}}};const M=async e=>{const o=window.Zonos.cartId;if(!o)return await(async e=>{var o;const n=t.checkoutSettings.buildLandedCost;if(n){const e=await(async e=>{var t,o,n,r,s;const i=J(),a=await e({billingAddress:i.billingAddress,billingContact:i.billingContact,checkoutSessionId:i.checkoutSessionId,contact:i.contact,landedCostAdjustments:i.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:i.shippingAddress,zonosApiRoute:m.vercel},{promoCode:Ie.promoCode});if(!a||!(null===(t=a.checkoutSessionWorkflow)||void 0===t?void 0:t.length)&&(null===(o=a.errors)||void 0===o?void 0:o.length))throw new Error(`Failed to build landed cost: ${(null===(r=null===(n=null==a?void 0:a.errors)||void 0===n?void 0:n[0])||void 0===r?void 0:r.message)||"Unknown error"}`);const{errors:d,json:l}=await c("/api/zonos-elements/validate-landed-cost",{body:a,headers:{"Content-Type":"application/json"},method:"POST"});if(!l||d.length)throw new Error(`Invalid landed cost object: ${(null===(s=d.find(Boolean))||void 0===s?void 0:s.message)||"Unknown error"}`);return a})(n);return e}const{errors:r,json:s}=await c("/api/zonos-elements/calculate-landed-cost",{body:J(),method:"POST",signal:null==e?void 0:e.signal});if(r.length||!s){if("The user aborted a request."===(null===(o=r[0])||void 0===o?void 0:o.message))throw new Error("The landed cost calculation request was aborted to initiate a new one.");if(r.forEach((e=>{console.warn(`Error calculating landed cost: ${e.message}`)})),!s)throw new Error("Failed to calculate landed cost");return s}return s})(e);const n=await(async({abortController:e,cartId:t})=>{var o,n,r,s,i;const{errors:a,json:d}=await c("/api/zonos-elements/cart-calculate-landed-cost",{body:B(t),method:"POST",signal:null==e?void 0:e.signal});if(a.length||!d){const e="string"==typeof(null===(o=a[0])||void 0===o?void 0:o.message)&&("The user aborted a request."===(null===(n=a[0])||void 0===n?void 0:n.message)||(null===(r=a[0])||void 0===r?void 0:r.message.includes("signal is aborted"))||(null===(s=a[0])||void 0===s?void 0:s.message.includes("The operation was aborted"))||(null===(i=a[0])||void 0===i?void 0:i.message.includes("Fetch is aborted")));throw new Error(e?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost")}return d})({abortController:e,cartId:o}),{cartWorkflow:r}=n,s=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}(n,["cartWorkflow"]);return Object.assign(Object.assign({},s),{itemCreateWorkflow:r.items})},W=async({checkoutSessionId:e,eventName:o,metadata:n})=>{var s,i;const a=Date.now(),d=[...window.Zonos.trackEventLogs];window.Zonos.trackEventLogs.push({checkoutSessionId:e,eventCreated:a,eventName:o});const u=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!(null===(s=window.Zonos)||void 0===s?void 0:s.zonosQaUrl)||!!(null===(i=window.Zonos)||void 0===i?void 0:i.debug);if((p()||v()||u)&&!window.Zonos.zonosConversionTest)return;const m=r.selectedCountryCode,y=t.organizationId;if(!e)return void h({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No checkout session id found`],metadata:{allLogs:l,checkoutSessionId:e,eventName:o,metadata:n,organizationId:y,trackEventLogs:d}});y||h({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No organization id found`],metadata:{allLogs:l,checkoutSessionId:e,eventName:o,metadata:n,organizationId:y,trackEventLogs:d}});const w={checkoutSessionId:e,countryCode:m,eventCreated:a,eventName:o,metadata:Object.assign(Object.assign({},n),{trackEventLogs:d}),organizationId:y};await c("/api/zonos-elements/track-conversion-event",{body:w,method:"POST"})},$=({address:e,invalidAdddressList:t})=>{if(!e)return;if(!t)return;const o={};return t.city&&(o.city=e.city),t.line1&&(o.line1=e.line1),t.line2&&(o.line2=e.line2),t.postal_code&&(o.postal_code=e.postal_code),t.state&&(o.state=e.state),t.name&&(o.name=e.name),Object.keys(o).length?o:void 0},q=e=>e.sort(((e,t)=>e.amount-t.amount)),Y=async()=>{var e;const{errors:t,json:o}=await g();return t.length||!o?(u("Failed to retrieve checkout session info before confirming payment ",t),h({endpoint:"validateCheckoutSession",errors:t.map((e=>e.message)),metadata:{allLogs:l}}),{errorMessage:n("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:!1}):(null===(e=o.checkoutSession.landedCost)||void 0===e?void 0:e.id)?{errorMessage:"",valid:!0}:(u("Landed cost is not found in the checkout session before confirming payment."),h({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:l}}),{errorMessage:n('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:!1})},H=({theme:e})=>{const o={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:t.appearance.fontSizeInputValue?`${t.appearance.fontSizeInputValue}px`:void 0,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:t.appearance.fontSizeInputLabel?`${t.appearance.fontSizeInputLabel}px`:void 0},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};return"DARK"===e?Object.assign(Object.assign({},o),{".Action":Object.assign(Object.assign({},o[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},o[".PickerItem--new"]),{color:"white"})}):o},K=({borderStyle:e,theme:t})=>"DARK"===t?{borderRadius:f({overrideBorderStyle:e}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"}:{borderRadius:f({overrideBorderStyle:e}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"},{onChange:G,reset:V,state:Z}=e((()=>({checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:!1,isFetchingLandedCost:!1,isFetchingSession:!1,partyBillingId:null,partyShippingId:null,shortAddressCode:"",shouldInventoryRefund:!1,shouldRenderPayInUsdButton:!1,skipPaymentIntent:"0"!==new URLSearchParams(window.location.search).get("skipPaymentIntent"),stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:!0,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}))),Q=()=>{window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")},X=e=>{window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))},ee=()=>{const e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return y(e)},te=async e=>{var o,n;const s=Z.clientSecret;if(!Z.stripe)return void d("Skip. Stripe is not initialized");const i=(({clientSecret:e,overrideBorderRadius:o,overridePrimaryColor:n,overrideSecondaryColor:s,overrideTheme:i,paypalEnabled:a})=>{const d=n||t.appearance.colorPrimary,l=s||t.appearance.colorSecondary,c=(window.Zonos.isCollect||window.Zonos.isInvoice?"DARK"===t.appearance.theme:d&&w(d))?"night":"flat",u="DARK"===i?"night":"flat",m=a?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},H({theme:i||"LIGHT"})),theme:i?u:c,variables:Object.assign(Object.assign({},K({borderStyle:o,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:e||void 0,customerSessionClientSecret:Z.stripeCustomerSessionClientSecret||void 0,externalPaymentMethodTypes:[...m],locale:r.selectedLocale}})({clientSecret:s,overrideBorderRadius:null==e?void 0:e.overrideBorderRadius,overridePrimaryColor:null==e?void 0:e.overridePrimaryColor,overrideSecondaryColor:null==e?void 0:e.overrideSecondaryColor,overrideTheme:null==e?void 0:e.overrideTheme,paypalEnabled:null==e?void 0:e.paypalEnabled}),a=JSON.stringify(i)===JSON.stringify(Z.stripeElementsOptions);if(!Z.stripeElements||!Z.stripeElementsForBillingAddress)return Z.stripeElementsForBillingAddress=null===(o=Z.stripe)||void 0===o?void 0:o.elements(i),d("Stripe elements for billing address initialized"),Z.stripeElements=null===(n=Z.stripe)||void 0===n?void 0:n.elements(i),Z.stripeElementsOptions=i,void d("Stripe elements initialized");a||(Z.stripeElements.update(i),Z.stripeElementsForBillingAddress.update(i),Z.stripeElementsOptions=i,Z.stripeElements.fetchUpdates()),d("Stripe elements updated")},oe=()=>{sessionStorage.removeItem("zonos--client-secret"),V(),Z.stripe=window.Zonos.stripe},ne=({address:e,firstName:t,lastName:n,name:r,phone:s})=>{const{firstName:i,lastName:a}=_({firstName:t,lastName:n,name:r});return i&&a||h({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,firstName:t,lastName:n,name:r}}),s||h({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,phone:s}}),{city:e.city,country:e.country,firstName:i,lastName:a,line1:e.line1,line2:e.line2,phone:s||"",postal_code:e.postal_code,state:e.state}},re=async()=>{var e,t,n,r;if(!(null===(e=Z.stripeAddressEventData)||void 0===e?void 0:e.complete)||!Z.stripeShippingSameAsBilling&&!(null===(t=Z.stripeBillingAddressEventData)||void 0===t?void 0:t.complete)||!Z.stripeBillingAddressEventData)return{partiesCreated:!1};if(!Ie.landedCostData)return{partiesCreated:!1};const s=null===(n=Ie.landedCostData.find(Boolean))||void 0===n?void 0:n.landedCost.rootId;if(!s)return h({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}}),{partiesCreated:!1};const i=(()=>{var e,t,o,n,r,s,i,a;const d=null===(e=Ie.partiesData.find((e=>"DESTINATION"===e.type)))||void 0===e?void 0:e.id,l=null===(t=Ie.partiesData.find((e=>"PAYOR"===e.type)))||void 0===t?void 0:t.id;if(!d||!l)return!1;if(Z.partyShippingId!==d||Z.partyBillingId!==l)return!0;const c=JSON.stringify(null===(o=Z.stripeLinkUsedWhenFetchingLC)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=Z.stripeLinkEventData)||void 0===n?void 0:n.value),u=JSON.stringify(null===(r=Z.stripeAddressUsedWhenAsyncAddressUpdate)||void 0===r?void 0:r.value)!==JSON.stringify(null===(s=Z.stripeAddressEventData)||void 0===s?void 0:s.value),m=!Z.stripeShippingSameAsBilling&&JSON.stringify(null===(i=Z.stripeBillingAddressUsedWhenAsyncAddressUpdate)||void 0===i?void 0:i.value)!==JSON.stringify(null===(a=Z.stripeBillingAddressEventData)||void 0===a?void 0:a.value);return c||u||m||Z.taxIdUsedWhenAsyncAddressUpdate!==Z.taxId||Z.companyNameUsedWhenAsyncAddressUpdate!==Z.companyName})();if(!i)return{partiesCreated:!1};const a=ne({address:Z.stripeAddressEventData.value.address,firstName:Z.stripeAddressEventData.value.firstName,lastName:Z.stripeAddressEventData.value.lastName,name:Z.stripeAddressEventData.value.name,phone:Z.stripeAddressEventData.value.phone}),d=Z.stripeShippingSameAsBilling?a:ne({address:Z.stripeBillingAddressEventData.value.address,firstName:Z.stripeBillingAddressEventData.value.firstName,lastName:Z.stripeBillingAddressEventData.value.lastName,name:Z.stripeBillingAddressEventData.value.name,phone:Z.stripeBillingAddressEventData.value.phone}),m="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:p,json:v}=await c("/api/zonos-elements/create-parties",{body:{address:a,billingAddress:d,companyName:Z.companyName,email:(null===(r=Z.stripeLinkEventData)||void 0===r?void 0:r.value.email)||"",isTest:m,rootId:s,shortAddressCode:Z.shortAddressCode,taxId:Z.taxId},method:"POST"});return p.length||!v?(u("Error occurs when creating parties",JSON.stringify(p,null,2)),h({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:p,json:v}}),{partiesCreated:!1}):(Z.companyNameUsedWhenAsyncAddressUpdate=Z.companyName,Z.stripeAddressUsedWhenAsyncAddressUpdate=Z.stripeAddressEventData,Z.stripeBillingAddressUsedWhenAsyncAddressUpdate=Z.stripeBillingAddressEventData,Z.taxIdUsedWhenAsyncAddressUpdate=Z.taxId,Z.partyBillingId=v.billToPartyId,Z.partyShippingId=v.shipToPartyId,Ie.partiesData=Ie.partiesData.map((e=>"DESTINATION"===e.type&&e.id!==v.shipToPartyId?Object.assign(Object.assign({},e),{id:v.shipToPartyId}):"PAYOR"===e.type&&e.id!==v.billToPartyId?Object.assign(Object.assign({},e),{id:v.billToPartyId}):e)),{partiesCreated:!0})},se=e=>({countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}),ie=async e=>{var n,r,s,i;const a=(null==e?void 0:e.retries)||0,l=!!(null==e?void 0:e.applyingPromocode),c=(()=>{var e;const t=Ie.landedCostData&&(null===(e=Ie.landedCostData.find(Boolean))||void 0===e?void 0:e.subtotals.items)!==Ie.subtotal,o=(()=>{var e,t;const o=JSON.stringify(null===(e=Z.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=Z.stripeLinkEventData)||void 0===t?void 0:t.value),n=Z.stripeAddressEventData&&JSON.stringify(se(Z.stripeAddressEventData.value))!==JSON.stringify(Z.stripeAddressUsedWhenFetchingLC),r=!Z.stripeShippingSameAsBilling&&Z.stripeBillingAddressEventData&&JSON.stringify(se(Z.stripeBillingAddressEventData.value))!==JSON.stringify(Z.stripeBillingAddressUsedWhenFetchingLC);return o||n||r})();return d("isPrefetchInfoOutdated","info",{isAddressOutdated:o}),!Ie.landedCostData&&!Z.isFetchingLandedCost||o||t})();if(!(()=>{var e,o,n,r;const s=!!(null===(e=Z.stripeLinkEventData)||void 0===e?void 0:e.complete),i=!!(null===(o=Z.stripeAddressEventData)||void 0===o?void 0:o.complete),a=Z.stripeShippingSameAsBilling?i:!!(null===(n=Z.stripeBillingAddressEventData)||void 0===n?void 0:n.complete),d=(e=>{var o,n;const r=null===(o=t.genericSettings)||void 0===o?void 0:o.countryFields,s=null===(n=t.genericSettings)||void 0===n?void 0:n.stripeCountryFieldLabels;return"stripe"===Ie.addressFormRenderType&&(s&&e in s?s[e]:null)||(r&&e in r?r[e]:null)})((null===(r=Z.stripeAddressEventData)||void 0===r?void 0:r.value.address.country)||"US");return!!(i&&a&&s)||(d&&Z.stripeAddressEventData?s&&Z.stripeAddressEventData.value.firstName&&Z.stripeAddressEventData.value.lastName&&Z.stripeAddressEventData.value.address.line1.length>0&&(!d.stateRequired||d.stateRequired&&Z.stripeAddressEventData.value.address.state.length>0)&&(!d.zipRequired||d.zipRequired&&Z.stripeAddressEventData.value.address.postal_code.length>=3)&&Z.stripeAddressEventData.value.phone&&Z.stripeAddressEventData.value.phone.length>0:i&&a&&s)})())return{isRequestNotReady:!0};if(c&&(null===(n=Z.fetchingLandedCostAbortController)||void 0===n||n.abort(),Z.fetchingLandedCostAbortController=null),!c&&!l)return{isRequestNotReady:!1};a?(Z.isFetchingLandedCost=!1,setTimeout((()=>{Z.isFetchingLandedCost=!0}),300)):Z.isFetchingLandedCost=!0,Z.stripeAddressEventData&&(Z.stripeAddressUsedWhenFetchingLC={countryCode:Z.stripeAddressEventData.value.address.country,postalCode:Z.stripeAddressEventData.value.address.postal_code,state:Z.stripeAddressEventData.value.address.state}),Z.stripeBillingAddressEventData&&(Z.stripeBillingAddressUsedWhenFetchingLC={countryCode:Z.stripeBillingAddressEventData.value.address.country,postalCode:Z.stripeBillingAddressEventData.value.address.postal_code,state:Z.stripeBillingAddressEventData.value.address.state}),Z.stripeLinkEventData&&(Z.stripeLinkUsedWhenFetchingLC=Object.assign({},Z.stripeLinkEventData));try{Je(),await(async()=>{var e;const t=new AbortController;Z.fetchingLandedCostAbortController=t,Je();const{checkoutSessionWorkflow:n,errors:r,itemCreateWorkflow:s,landedCostCalculateWorkflow:i,partyCreateWorkflow:a,shipmentRatingCalculateWorkflow:d}=await M(t);Ie.customQuotingError=(null===(e=null==r?void 0:r.find((e=>{var t;return"CUSTOM"===(null===(t=e.extensions)||void 0===t?void 0:t.ruleMessageType)})))||void 0===e?void 0:e.message)||null,Ie.shippingData=q((null==d?void 0:d.filter(Boolean))||[]),je(s),Z.fetchingLandedCostAbortController=null,Ie.partiesData=(null==a?void 0:a.filter(Boolean))||[],Ie.landedCostData=(null==n?void 0:n.map((e=>{const t=null==i?void 0:i.find((t=>(null==t?void 0:t.id)===e.landedCostId));return t?Object.assign(Object.assign({},e),{landedCost:t}):null})).filter(Boolean))||[],(null==n?void 0:n.length)&&W({checkoutSessionId:o.checkoutSessionId,eventName:"checkout_quoteReceived"});const l=Ie.promoCodeApplied&&!Ie.landedCostData.find((e=>{var t;return null===(t=e.landedCost.appliedAdjustments)||void 0===t?void 0:t.find((e=>"PROMO_CODE"===e.type))}));Ie.promoCodeError=l,l||sessionStorage.setItem("zonos--promo-code",Ie.promoCode)})();const e=null===(r=Ie.shippingData)||void 0===r?void 0:r.find(Boolean),t=null===(s=Ie.landedCostData)||void 0===s?void 0:s.find((t=>t.landedCost.shipmentRating.id===(null==e?void 0:e.id))),n=t?t.subtotals:null;n&&Le({method:(null==t?void 0:t.landedCost.method)||"DDP",subtotals:n})}catch(t){if(Ie.landedCostData=[],Ie.shippingData=[],t instanceof Error&&t.message&&!["The landed cost calculation request was aborted to initiate a new one."].includes(t.message)){if(a<1)return await ie(Object.assign(Object.assign({},e),{retries:(a||0)+1})),{isRequestNotReady:!1};const o=null===(i=Z.stripeAddressEventData)||void 0===i?void 0:i.value;h({endpoint:`Failed to fetch landed cost (${a} retries)`,errors:[t.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:o}})}u(t)}return Z.isFetchingLandedCost=!1,{isRequestNotReady:!1}},ae=async()=>{var e,t;await ie({applyingPromocode:!0}),"payment"===Ie.step&&We(),await re();const o=null===(e=Ie.shippingData)||void 0===e?void 0:e.find(Boolean),n=null===(t=Ie.landedCostData)||void 0===t?void 0:t.find((e=>e.landedCost.id===(null==o?void 0:o.id)));o&&n&&await _e({applySubtotalsOnly:!1,landedCostId:n.landedCostId,selectedShippingOption:o})},de=()=>{Ie.promoCode="",sessionStorage.removeItem("zonos--promo-code"),Ie.promoCodeError=!1,Ie.promoCodeApplied=!1},le=async()=>{"payment"===Ie.step&&We(),de(),await ae()},ce=e=>{let t=[],o=!0;const r=window.Zonos.isCollect,s=window.Zonos.isInvoice;switch(e){case"succeeded":t=[n("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"",n("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")],(r||s)&&(t=[n("Thank you for submitting your payment. We appreciate your prompt attention."),"",n("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]),o=!1;break;case"requires_capture":case"processing":t=[n("Payment processing. We'll update you when payment is received.")],o=!1;break;case"requires_payment_method":t=[n("Payment failed. Please try another payment method.")],r&&(t=[n("Payment failed. Please reload the page and try another payment method.")]);break;case"requires_action":o=!1,t=[n("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")];default:t=[n("Something went wrong.")]}return{isError:o,messages:t}},ue=async()=>{var e,o;const{onInventoryCheck:r}=t.checkoutSettings,s=!!(null===(o=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.metadata.find((e=>"referenceId"===e.key)))||void 0===o?void 0:o.value);if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&s){const{errors:e,json:t}=await c("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"});return e.length||!t?(u("Error occurs when handling inventory refund","warn",JSON.stringify(e)),null):t.available&&204!==t.status?t.available||200===t.status?(Z.shouldInventoryRefund=!0,null):null:n("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")}if("function"!=typeof r)return null;try{return await r({items:Ie.items},{translate:n,zonosApiRoute:m.vercel})}catch(e){const t=e instanceof Error?e.message:"Unknown error";throw h({endpoint:"onInventoryCheck",errors:[`cartId: ${window.Zonos.cartId} - ${t}`],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:Ie.items}}),e}},me=async()=>{var e,t;const o=!!(null===(t=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.metadata.find((e=>"referenceId"===e.key)))||void 0===t?void 0:t.value);window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o&&await c("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})},pe=async({clientSecret:e,storybookForceStatus:t})=>{if(t){const{isError:e,messages:o}=ce(t);return{error:e,messages:o}}const o=e||Z.clientSecret;if(!Z.stripe||!o)return u("Failed to retrieve payment intent. Stripe is not initialized"),{error:!0,message:[n("Something went wrong.")]};const{paymentIntent:r}=await Z.stripe.retrievePaymentIntent(o),s=null==r?void 0:r.status,{isError:i,messages:a}=ce(s);return{amount:null==r?void 0:r.amount,currency:null==r?void 0:r.currency,error:i,messages:a,paymentIntentId:null==r?void 0:r.id,paymentMethod:null==r?void 0:r.payment_method,status:s}},ve=async e=>{var t,r;const s=!!(null===(t=Z.stripePaymentEventData)||void 0===t?void 0:t.complete),i=Z.stripeElements,a=Z.stripe,l=Z.clientSecret;if(Z.customErrorMessage=null,!(null===(r=Ie.selectedLandedCost)||void 0===r?void 0:r.landedCost.id)&&!(null==e?void 0:e.noLandedCostCheck))throw new Error("Attempted to confirm the payment when no landed cost is found in store");const c=await Y();if(!c.valid)throw Z.customErrorMessage=c.errorMessage,new Error(c.errorMessage);const u=o.checkoutSessionId;if(a&&i&&s&&l&&u){const e=new URL(window.location.href);e.searchParams.set("payment_intent_client_secret",l),e.searchParams.set("zonosCheckoutSessionId",u),W({checkoutSessionId:u,eventName:"checkout_paymentInfoCompleted"});const{error:t,paymentIntent:o}=await a.confirmPayment({confirmParams:{return_url:e.toString()},elements:i,redirect:"if_required"});if(d("Payment intent confirmed","info",{error:t,paymentIntent:o}),"requires_action"===(null==o?void 0:o.status))throw new Error(n("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."));if(t){if("card_error"===t.type||"validation_error"===t.type)throw new Error(t.message);if("invalid_request_error"===t.type&&"payment_intent_unexpected_state"===t.code)return;throw new Error("An unexpected error occurred.")}if("requires_payment_method"===o.status)throw new Error(n("Payment failed. Please try another payment method."))}},he=()=>{var e;const t=Ie.items.reduce(((e,t)=>e+t.amount*t.quantity),0),n=o.enabledVariantTestKeys||[];return{adjustmentsAmount:Ie.adjustments.reduce(((e,t)=>e+t.amount),0),cartId:window.Zonos.cartId,currency:(null===(e=Ie.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",customerAuthenticationToken:Ie.customerAuthenticationToken||void 0,isCollect:!!window.Zonos.isCollect,isInvoice:!!window.Zonos.isInvoice,itemsAmount:t,metadata:[{key:"language",value:r.selectedLocale}],presentmentCountryCode:r.selectedCountryCode,skipPaymentIntent:Z.skipPaymentIntent,varianceTestInput:n}},ye=async()=>{var e;if(!o.checkoutSessionId)return h({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:l,cartId:window.Zonos.cartId}}),void De({messages:[n("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:n("Error creating Checkout")});const{errors:t,json:r}=await c("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:o.checkoutSessionId},method:"POST"}),s=null===(e=null==r?void 0:r.checkoutSessionPaymentIntentCreate)||void 0===e?void 0:e.clientSecret;if(t.length||!s)return u("Error occurs when getting payment intent",JSON.stringify(t,null,2)),h({endpoint:"Error creating payment intent",errors:t.map((e=>e.message)),metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,clientSecret:s}}),void De({messages:[n("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:n("Error creating Checkout")});Re(r.checkoutSessionPaymentIntentCreate)},we=async()=>{var e,t;if(!r.targetCurrency)return u("Failed to create checkout session - missing localizationStore.targetCurrency"),!1;Z.isFetchingSession=!0;const o=he();d("Checkout session body","info",o);const{errors:n,json:s}=await c("/api/zonos-elements/create-checkout-session",{body:o,method:"POST"});if(Z.isFetchingSession=!1,n.length||!s){const t=null===(e=n.find((e=>e.message)))||void 0===e?void 0:e.message;if(Array.isArray(t)&&t.some((e=>"Cart is expired."===e.message)))throw new Error("Cart is expired.");return u("Error occurred when creating checkout session",JSON.stringify(n,null,2)),!1}const i=s.checkoutSessionCreate;return Re(i),Le({method:(null===(t=i.landedCost)||void 0===t?void 0:t.method)||"DDP",subtotals:i.subtotals}),d("Exchange rate updated for cart items (checkout session create)","info",Ie.exchangeRate),d("done-init-checkout-session"),!0},fe=async()=>{const e=o.checkoutSessionId;if(!e)return u("Failed to update checkout session base currency"),!1;if("LOCAL"===t.checkoutSettings.allowedSettlementCurrencies)return d('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency'),!0;const{json:n}=await c("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:Z.checkoutSettlementCurrency},method:"POST"}),r=null==n?void 0:n.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;return n&&r===Z.checkoutSettlementCurrency?(d(`Updated checkout session to settlement currency "${r}".`),!0):(u("Failed to update checkout session base currency"),!1)},ge=async({adjustmentsAmount:e,cartId:t,currency:n,id:s,itemsAmount:i,landedCostId:a,presentmentCountryCode:d,storeCreditApplication:l})=>{const m=o.enabledVariantTestKeys||[],{errors:p,json:v}=await c("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:e,billToPartyId:Z.partyBillingId,cartId:t,currency:n,customerAuthenticationToken:Ie.customerAuthenticationToken||void 0,id:s,itemsAmount:i,landedCostId:a,metadata:[{key:"language",value:r.selectedLocale}],presentmentCountryCode:d,shipToPartyId:Z.partyShippingId,skipPaymentIntent:Z.skipPaymentIntent,storeCreditApplication:l,varianceTestInput:m},method:"POST"});return p.length||!v?(u("Error occurs when updating checkout session",JSON.stringify(p,null,2)),{errors:p,json:v}):{errors:[],json:v}},be=async()=>{const e=(()=>{if(!R.accepted)return null;const e=z();return e.length?{key:"merchantPolicyConsent",value:JSON.stringify({acceptedAt:R.acceptedAt||(new Date).toISOString(),locale:r.selectedLocale,policies:e.reduce(((e,t)=>(e[t.key]=t.url,e)),{})})}:null})();if(!e)return{errors:[]};if(!o.checkoutSessionId)return{errors:[]};const{errors:t}=await c("/api/zonos-elements/update-checkout-session-metadata",{body:{id:o.checkoutSessionId,metadata:[e]},method:"POST"});return t.length?(u("Failed to record merchant policy consent on checkout session",JSON.stringify(t,null,2)),{errors:t.map((e=>e.message||"Unknown error"))}):{errors:[]}},Se=({currentAddress:e,translatedAddressResult:t})=>{const o={};if(!t)return o;const{city:n,line1:r,line2:s,name:i,postal_code:a,state:d}=t;return e.city&&n&&(o.city={[e.city]:n}),e.line1&&r&&(o.line1={[e.line1]:r}),e.line2&&s&&(o.line2={[e.line2]:s}),e.postal_code&&a&&(o.postal_code={[e.postal_code]:a}),e.state&&d&&(o.state={[e.state]:d}),e.name&&i&&(o.name={[e.name]:i}),o},Ce=async({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t})=>{var o,n,r,s;const i=(({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:o,stripeBillingAddressEventData:n,stripeShippingSameAsBilling:r})=>{const s=!!(null==o?void 0:o.complete);if(!s||!(r?s:null==n?void 0:n.complete))return null;if(!e&&!t)return null;const i=o.value,a=(null==n?void 0:n.value)||null,{firstName:d,lastName:l}=_({firstName:i.firstName,lastName:i.lastName,name:i.name}),c=`${d} ${l}`,{firstName:u,lastName:m}=_({firstName:null==a?void 0:a.firstName,lastName:null==a?void 0:a.lastName,name:(null==a?void 0:a.name)||""}),p=u&&m?`${u} ${m}`:"",v=i.address,h=null==a?void 0:a.address;return{address:$({address:Object.assign(Object.assign({},v),{name:c}),invalidAdddressList:e}),billingAddress:r?void 0:$({address:h?Object.assign(Object.assign({},h),{name:p}):null,invalidAdddressList:t}),destinationCountry:v.country}})({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:Z.stripeAddressEventData,stripeBillingAddressEventData:Z.stripeBillingAddressEventData,stripeShippingSameAsBilling:Z.stripeShippingSameAsBilling});if(!i)return void(Z.translatedAddress={address:{},billingAddress:{}});const a=(()=>{var e,t,o,n;const r=JSON.stringify(null===(e=Z.stripeAddressUsedWhenValidatingAddress)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=Z.stripeAddressEventData)||void 0===t?void 0:t.value),s=!Z.stripeShippingSameAsBilling&&JSON.stringify(null===(o=Z.stripeBillingAddressEventData)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=Z.stripeBillingAddressUsedWhenValidatingAddress)||void 0===n?void 0:n.value);return r||s})();if(!a)return;const{errors:d,json:l}=await c("/api/zonos-elements/validate-address",{body:i,method:"POST"});if(d.length||!l)return u("Error occurs when translating address to latin",JSON.stringify(d,null,2)),void(Z.translatedAddress={address:{},billingAddress:{}});Z.stripeAddressUsedWhenValidatingAddress=Z.stripeAddressEventData,Z.stripeBillingAddressUsedWhenValidatingAddress=Z.stripeBillingAddressEventData;const m=null===(o=Z.stripeAddressEventData)||void 0===o?void 0:o.value.address,p=null===(n=Z.stripeBillingAddressEventData)||void 0===n?void 0:n.value.address;Z.translatedAddress={address:m?Se({currentAddress:Object.assign(Object.assign({},m),{name:null===(r=Z.stripeAddressEventData)||void 0===r?void 0:r.value.name}),translatedAddressResult:l.address||null}):{},billingAddress:Z.stripeShippingSameAsBilling?{}:Se({currentAddress:Object.assign(Object.assign({},p),{name:null===(s=Z.stripeBillingAddressEventData)||void 0===s?void 0:s.value.name}),translatedAddressResult:l.billingAddress||null})}};G("clientSecret",(e=>{e&&Z.stripe&&sessionStorage.setItem("zonos--client-secret",e),e||sessionStorage.removeItem("zonos--client-secret")}));const{onChange:Oe,reset:Ae,state:Ie}=e((()=>({addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:!1,checkoutTimeoutInterval:null,currency:"USD",customMessage:[],customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:!1,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:!1,isSelectedShippingGuarantee:!1,isStagingMode:v(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:!1,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:!1,step:"customer-info",storeCredit:0,subtotal:0,tabItems:{"customer-info":{index:1,isDone:!1,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:!1,label:"Shipping",value:"shipping"},payment:{index:3,isDone:!1,label:"Payment",value:"payment"}},total:0}))),ke=e=>{switch(e){case"DAYS":return n("days");case"WEEKS":return n("weeks");default:return n("business days")}},Ne=e=>{var t;const o=null===(t=e.shippingProfile)||void 0===t?void 0:t.transitTime;return(null==o?void 0:o.min)&&(null==o?void 0:o.max)&&(null==o?void 0:o.type)?{maxTransit:o.max,minTransit:o.min,unit:ke(o.type)}:null},Te=({item1:e,item2:t})=>!(!e||!t)&&(t.sku&&e.sku&&e.sku===t.sku||t.description&&e.description&&e.description===t.description||e.name&&t.name&&e.name===t.name),je=e=>{d("Checking item restrictions");const t=e.map((e=>{if(!e.restriction)return null;const{restriction:t}=e,o=Ie.items.find((t=>Te({item1:t,item2:e})));return Object.assign(Object.assign({matchedItem:o},e),{restriction:t})})).filter(Boolean);return Ie.restrictedItems=t,Ie.items=Ie.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!!t.find((t=>Te({item1:t,item2:e})))}))),{cartItems:Ie.items,restrictedItems:t}};let Ee=null;const Pe=()=>{o.checkoutSessionId=null,Ee&&(clearTimeout(Ee),Ee=null),C(),Ae()},De=({messages:e,title:t})=>{Pe(),oe(),Ie.step="error",Ie.error={messages:e,title:t}},Le=({dutiesTaxesFeesEstimate:e,method:t,subtotals:o})=>{var n;Ie.exchangeRate=o.exchangeRate,Ie.adjustmentTotal=o.adjustments,Ie.dutiesTaxesFees="DAP"===t?null:o.landedCostTotal,Ie.storeCredit=null!==(n=o.storeCredit)&&void 0!==n?n:0,Ie.subtotal=o.items,Ie.total=o.total,Ie.currency=o.presentmentCurrencyCode,Ie.dutiesTaxesFeesEstimate=e||null},xe=()=>!!Ie.items.filter((e=>e.amount>0)).find((e=>!e.isRestricted)),Re=e=>{var t,n,r,s,c,u,m;Z.clientSecret=e.clientSecret,Z.stripeCustomerSessionClientSecret=e.customerSessionClientSecret,Z.customerProfile=e.customerProfile,Ie.checkoutSession=e,O(null!==(n=null===(t=e.customerProfile)||void 0===t?void 0:t.storeCreditBalance)&&void 0!==n?n:null),e.id||h({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:l,checkoutSession:e}}),e.id&&(o.checkoutSessionId=e.id);const p=i(e.varianceTestResults||[]);a(p);const v=(null===(c=null===(s=null===(r=Ie.checkoutSession)||void 0===r?void 0:r.metadata)||void 0===s?void 0:s.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===c?void 0:c.value)||(null===(m=null===(u=window.Zonos.cartData)||void 0===u?void 0:u.metadata.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===m?void 0:m.value)||null;v&&(d(`Found externalConfirmationPageURL: ${v}`),Ie.externalConfirmationPageURL=v)},ze=async({adjustmentsAmount:e,cartId:t,currency:s,dutiesTaxesFeesEstimate:i,itemsAmount:a,landedCostId:l,shouldInitSessionOnFailure:c})=>{var m;if(l&&Ie.selectedLandedCost&&(Le({dutiesTaxesFeesEstimate:i,method:Ie.landedCostMethod,subtotals:Ie.selectedLandedCost.subtotals}),d("Exchange rate updated for cart items (landed cost subtotal)","info",Ie.exchangeRate)),!o.checkoutSessionId)return d("Could not update cart total without checkout session id","info"),!1;const{errors:p,json:v}=await ge({adjustmentsAmount:e,billToPartyId:Z.partyBillingId,cartId:t,currency:s,id:o.checkoutSessionId,itemsAmount:a,landedCostId:l,presentmentCountryCode:r.selectedCountryCode,shipToPartyId:Z.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});if(p.length>0||!v){if(u("Error occurs when updating checkout session."),c){d("Initiating checkout session on failure","info");const e=await we();return d(`stripeStoreInitCheckoutSession: ${e}`),!!e||(De({messages:[n("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:n("Error creating Checkout")}),!1)}return!1}return l||(Le({method:(null===(m=v.checkoutSessionUpdate.landedCost)||void 0===m?void 0:m.method)||"DDP",subtotals:v.checkoutSessionUpdate.subtotals}),d("Exchange rate updated for cart items (checkout session update)","info",Ie.exchangeRate)),Re(v.checkoutSessionUpdate),!0},Ue=e=>{var o,n,r;return"DAP"===e.method&&(null===(n=null===(o=t.genericSettings)||void 0===o?void 0:o.domesticCountries)||void 0===n?void 0:n.includes((null===(r=Z.stripeAddressEventData)||void 0===r?void 0:r.value.address.country)||"US"))||"DAP"===e.method&&e.remittance.length&&"ZONOS"===e.landedCostGuaranteeCode?"DDP":e.method},_e=async({applySubtotalsOnly:e,landedCostId:n,selectedShippingOption:r})=>{var s,i,a,l,c,u,m,p,v,h,y;d("Updating selected shipping option","info",{landedCostId:n,selectedShippingOption:r}),Ie.selectedShippingOption=r;const w=Ne(Ie.selectedShippingOption);if(w){const{maxTransit:e,minTransit:t,unit:o}=w;Ie.selectedShippingOptionTransitTime=`${t}-${e} ${o}`}else Ie.selectedShippingOptionTransitTime="";const f=null===(s=Ie.landedCostData)||void 0===s?void 0:s.find((e=>e.landedCostId===n));if(Ie.selectedLandedCost=f||null,!f)return!1;const g=((null===(i=f.landedCost.amountSubtotals)||void 0===i?void 0:i.landedCostTotal)||0)*f.subtotals.exchangeRate.rate;g&&d(`DAP quote, using estimate: ${g}`,"info"),Ie.landedCostMethod=Ue(f.landedCost),Ie.shipping=f.subtotals.shipping;const b="ZONOS"===(null===(a=null==f?void 0:f.landedCost)||void 0===a?void 0:a.landedCostGuaranteeCode),S=!!(null===(c=null===(l=null==f?void 0:f.landedCost)||void 0===l?void 0:l.deMinimis)||void 0===c?void 0:c.find((e=>["DUTY","TAX"].includes(e.type)&&"ABOVE"===e.threshold)));Ie.isSelectedShippingAboveDeminimis=S,Ie.isSelectedShippingGuarantee=b;let C=!1;e?(Le({dutiesTaxesFeesEstimate:g,method:Ie.landedCostMethod,subtotals:f.subtotals}),d("Exchange rate updated for cart items (landed cost subtotal)","info",Ie.exchangeRate),C=!0):C=await ze({adjustmentsAmount:Ie.adjustmentTotal,billToPartyId:Z.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:g,landedCostId:null===(u=f.landedCost)||void 0===u?void 0:u.id,shipToPartyId:Z.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});const O=null===(m=Ie.items.find(Boolean))||void 0===m?void 0:m.currencyCode,A=(null===(p=Z.stripeAddressEventData)||void 0===p?void 0:p.value.address.country)||"US";return Z.shouldRenderPayInUsdButton="USD"===O&&"LOCAL_AND_USD"===t.checkoutSettings.allowedSettlementCurrencies&&"USD"!==(null===(v=Ie.checkoutSession)||void 0===v?void 0:v.subtotals.presentmentCurrencyCode)&&!!(null===(y=null===(h=t.genericSettings)||void 0===h?void 0:h.usdSettlementCountryEnabled)||void 0===y?void 0:y.includes(A)),C},Fe=({isPreview:e,sessionTimeout:t})=>{if(e)return;const o=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout"),n=o&&!isNaN(parseInt(o,10))?parseInt(o,10):t;d(`==START CHECKOUT TIMEOUT - ${n}==`),Ie.checkoutTimeoutInterval=setTimeout((()=>{Ie.checkoutSessionTimeoutShow=!0}),n)},Be=()=>{Ie.checkoutTimeoutInterval&&(clearTimeout(Ie.checkoutTimeoutInterval),Ie.checkoutTimeoutInterval=null)},Je=()=>{Ie.items=Ie.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1}))),Ie.restrictedItems=[]},Me=async({adjustments:e,cartItems:t,landedCostId:n,shouldInitSessionOnFailure:r=!0})=>{var s;Ie.adjustments=e,Ie.items=t.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1})));const i=null===(s=t.find(Boolean))||void 0===s?void 0:s.currencyCode,a=t.reduce(((e,t)=>e+t.amount*t.quantity),0),d=e.reduce(((e,t)=>e+t.amount),0);i&&a&&(Ie.currency=i,Z.isFetchingSession=!0,await ze({adjustmentsAmount:d,billToPartyId:Z.partyBillingId,cartId:window.Zonos.cartId,currency:i,dutiesTaxesFeesEstimate:0,itemsAmount:a,landedCostId:n,shipToPartyId:Z.partyShippingId,shouldInitSessionOnFailure:r,varianceTestInput:o.enabledVariantTestKeys||[]}),Z.isFetchingSession=!1)},We=()=>{"shipping"===Ie.step?(Ie.step="customer-info",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{"customer-info":Object.assign(Object.assign({},Ie.tabItems.shipping),{isDone:!1})})):"payment"===Ie.step?(Ie.step="shipping",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{shipping:Object.assign(Object.assign({},Ie.tabItems.shipping),{isDone:!1})})):"finish"===Ie.step&&(Ie.step="payment",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{payment:Object.assign(Object.assign({},Ie.tabItems.payment),{isDone:!1})}))},$e=()=>{"customer-info"===Ie.step?(Ie.step="shipping",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{"customer-info":Object.assign(Object.assign({},Ie.tabItems["customer-info"]),{isDone:!0})})):"shipping"===Ie.step?(Ie.step="payment",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{shipping:Object.assign(Object.assign({},Ie.tabItems.shipping),{isDone:!0})})):"payment"===Ie.step&&(Ie.step="finish")},qe=()=>{Ie.step="customer-info",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{"customer-info":Object.assign(Object.assign({},Ie.tabItems["customer-info"]),{isDone:!1}),payment:Object.assign(Object.assign({},Ie.tabItems.payment),{isDone:!1}),shipping:Object.assign(Object.assign({},Ie.tabItems.shipping),{isDone:!1})}),Ie.selectedShippingOption=null,Ie.isSelectedShippingAboveDeminimis=!1,Ie.isSelectedShippingGuarantee=!1,Ie.selectedShippingOptionTransitTime="",Ie.dutiesTaxesFees=0,Ie.dutiesTaxesFeesEstimate=0,Ie.shipping=0,Ie.total=Ie.subtotal},Ye=()=>{Ee&&clearTimeout(Ee),Ee=setTimeout((()=>{Ee=null,(async()=>{var e,t;if(!o.checkoutSessionId)return void d("Could not update store credit without checkout session id","info");const n=Ie.selectedLandedCost,s=Ie.currency||(null===(e=Ie.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",i=Ie.adjustments.reduce(((e,t)=>e+t.amount),0),a=Ie.items.reduce(((e,t)=>e+t.amount*t.quantity),0),{errors:l,json:c}=await ge({adjustmentsAmount:i,cartId:window.Zonos.cartId,currency:s,id:o.checkoutSessionId,itemsAmount:a,landedCostId:null==n?void 0:n.landedCostId,presentmentCountryCode:r.selectedCountryCode,storeCreditApplication:S.isEnabled&&null!==S.amountToApply?S.useFullBalance?{mode:"FULL"}:{amount:S.amountToApply,mode:"PARTIAL"}:{mode:"NONE"}});l.length>0||!c?u("Error updating checkout session with store credit"):(Le({method:(null===(t=c.checkoutSessionUpdate.landedCost)||void 0===t?void 0:t.method)||"DDP",subtotals:c.checkoutSessionUpdate.subtotals}),Re(c.checkoutSessionUpdate))})()}),300)};export{T as $,Y as A,P as B,ve as C,me as D,R as E,oe as F,Oe as G,G as H,j as I,be as J,ne as K,_e as L,xe as M,ae as N,le as O,de as P,ce as Q,S as R,C as S,Ce as T,_ as U,re as V,Ne as W,Ue as X,q as Y,z as Z,k as _,X as a,Ye as a0,N as a1,A as a2,Z as b,pe as c,Ie as d,Me as e,Pe as f,qe as g,Be as h,te as i,we as j,ye as k,Fe as l,he as m,De as n,Q as o,x as p,Re as q,ie as r,ee as s,W as t,$e as u,U as v,fe as w,ue as x,I as y,E as z}
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(t,n,e,o){function s(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,a){function i(t){try{c(o.next(t))}catch(t){a(t)}}function r(t){try{c(o["throw"](t))}catch(t){a(t)}}function c(t){t.done?e(t.value):s(t.value).then(i,r)}c((o=o.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},o,s,a,i;return i={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function r(t){return function(n){return c([t,n])}}function c(r){if(o)throw new TypeError("Generator is already executing.");while(i&&(i=0,r[0]&&(e=0)),e)try{if(o=1,s&&(a=r[0]&2?s["return"]:r[0]?s["throw"]||((a=s["return"])&&a.call(s),0):s.next)&&!(a=a.call(s,r[1])).done)return a;if(s=0,a)r=[r[0]&2,a.value];switch(r[0]){case 0:case 1:a=r;break;case 4:e.label++;return{value:r[1],done:false};case 5:e.label++;s=r[1];r=[0];continue;case 7:r=e.ops.pop();e.trys.pop();continue;default:if(!(a=e.trys,a=a.length>0&&a[a.length-1])&&(r[0]===6||r[0]===2)){e=0;continue}if(r[0]===3&&(!a||r[1]>a[0]&&r[1]<a[3])){e.label=r[1];break}if(r[0]===6&&e.label<a[1]){e.label=a[1];a=r;break}if(a&&e.label<a[2]){e.label=a[2];e.ops.push(r);break}if(a[2])e.ops.pop();e.trys.pop();continue}r=n.call(t,e)}catch(t){r=[6,t];s=0}finally{o=a=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(t,n,e){if(e||arguments.length===2)for(var o=0,s=n.length,a;o<s;o++){if(a||!(o in n)){if(!a)a=Array.prototype.slice.call(n,0,o);a[o]=n[o]}}return t.concat(a||Array.prototype.slice.call(n))};System.register(["./p-7261e245.system.js","./p-3e7ee89d.system.js","./p-23e7c655.system.js","./p-14d6542f.system.js","./p-d932973f.system.js","./p-c5caf47b.system.js","./p-01174496.system.js","./p-8f817a47.system.js","./p-d938f42f.system.js","./p-7d9d2407.system.js","./p-5d65be06.system.js","./p-bc919de1.system.js"],(function(t){"use strict";var n,e,o,s,a,i,r,c,h,l,p,f,y,d,m;return{setters:[function(t){n=t.r;e=t.h;o=t.a;s=t.g;a=t.d},function(t){i=t.f},function(t){r=t.c},function(t){c=t.g},function(t){h=t.b;l=t.t},function(t){p=t.s},function(t){f=t.l},function(t){y=t.d;d=t.e},function(t){m=t.l},function(){},function(){},function(){}],execute:function(){var u=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .styled-card{border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));padding:var(--spacing, 24px);text-align:left;background-color:var(--zonos--background-color);overflow:hidden}:host .styled-card hr{margin-left:calc(var(--spacing, 24px) * -1);margin-right:calc(var(--spacing, 24px) * -1)}:host .styled-card .card-header{margin:calc(var(--spacing, 24px) * -1);padding:var(--spacing, 24px);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-bottom:var(--spacing, 24px);border-bottom:var(--zonos-elements-border);height:65px;line-height:65px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host .styled-card .card-header h5{margin-bottom:0;-ms-flex:1;flex:1}:host .styled-card .card-footer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;margin:calc(var(--spacing, 24px) * -1);padding:var(--spacing, 24px);border-top:var(--zonos-elements-border);background:var(--zonos-elements-surface-color-secondary);margin-top:var(--spacing, 24px);border-bottom-left-radius:var(--zonos-elements-radius-8);border-bottom-right-radius:var(--zonos-elements-radius-8);height:var(--footerHeight)}";var g=u;var z=t("zonos_card",function(){function t(t){n(this,t);this.borderRadius=6;this.spacing="24px"}t.prototype.render=function(){var t=this.backgroundColor?"var(--zonos-elements-".concat(this.backgroundColor,")"):"transparent";var n=c({customRoundRadius:"".concat(this.borderRadius,"px"),overrideBorderStyle:"ROUNDED"});return e(o,{key:"ae124207be3fbddbd445d74cdf31085401a09c67",style:{"--zonos--font-family":i()}},e("div",{key:"43fe2ffcb7caa0754c93f6d94898156f5169139b",class:r(["styled-card"]),style:{"--zonos--background-color":t,"--zonos--border-radius":n,padding:this.spacing}},this.label&&e("header",{key:"6839065e2e630a841d6ecd7f03b19a93a988e49a",class:"card-header",style:{padding:this.spacing}},e("zonos-text",{key:"498435bbbb60cc6d1d13a304aad321107bd6feaf",type:"subheader"},this.label),e("h-stack",{key:"4de3f042a72b16be374209b393cb174fc7d1b670",spacing:8},this.actions)),e("slot",{key:"add9dac3d8b9a50c0caa37d245f632c6a5e64d7f"}),(this.footerActions||this.footerContent)&&e("footer",{key:"e83f37ed24b44d9b7316579ee28ea51a3da119d8",class:"card-footer",style:{height:this.footerHeight?"".concat(this.footerHeight,"px"):"auto",padding:this.spacing}},e("div",{key:"685721d5f7f51c99438f4ddf23cf75122db3223c"},this.footerContent),e("h-stack",{key:"61a44c918aea4994c10b16045564b45135296852",spacing:8},this.footerActions))))};return t}());z.style=g;var b='<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19124" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19124)"/>\n</mask>\n<g mask="url(#mask0_3739_19124)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="white" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19124" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n';var x='<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19125" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19125)"/>\n</mask>\n<g mask="url(#mask0_3739_19125)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="black" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19125" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n';var v=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex;position:relative}:host zonos-text{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host svg{width:var(--zonos--width);height:var(--zonos--height)}";var k=v;var w=t("zonos_empty_state_payment",function(){function t(t){n(this,t);this.theme="LIGHT"}t.prototype.render=function(){if(!this.el.shadowRoot){return null}if(this.theme==="DARK"){this.el.shadowRoot.innerHTML=b}else{this.el.shadowRoot.innerHTML=x}return e(o,{class:"zonos--elements",style:{"--zonos--font-family":i(),"--zonos--height":"100%","--zonos--width":"100%"}},e("zonos-text",{type:"semiBoldLabel"},this.emptyStateText))};Object.defineProperty(t.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});return t}());w.style=k;var _=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";var I=_;var j=t("zonos_notification",function(){function t(t){n(this,t);this.notificationArray=[]}t.prototype.showNotification=function(t){return __awaiter(this,void 0,void 0,(function(){var n,e;var o=this;return __generator(this,(function(s){n="id-".concat(Math.random().toString(36).substring(2,9));e=Object.assign(Object.assign({},t),{id:n,timeout:t.timeout||5e3,transitionClass:"",type:t.type||"success"});this.notificationArray=__spreadArray(__spreadArray([],this.notificationArray,true),[e],false);setTimeout((function(){o.updateTransitionClass({id:n,transitionClass:"show"})}),50);setTimeout((function(){o.removeNotification(n)}),e.timeout);return[2]}))}))};t.prototype.updateTransitionClass=function(t){var n=t.id,e=t.transitionClass;this.notificationArray=this.notificationArray.map((function(t){if(t.id===n){return Object.assign(Object.assign({},t),{transitionClass:e})}return t}))};t.prototype.removeNotification=function(t){var n=this;this.updateTransitionClass({id:t,transitionClass:""});setTimeout((function(){n.notificationArray=n.notificationArray.filter((function(n){return n.id!==t}))}),300)};t.prototype.render=function(){var t=this;return e(o,{key:"6a790a39afc037ae56f8a53dc89c3fa899b2d659",class:r(["zonos--elements zonos--notification"]),style:{"--zonos--border-radius":c(),"--zonos--font-family":i()}},e("div",{key:"32245a784f2322fb69a65b491648a30a84b0b3d3",class:"zonos--notification-items"},this.notificationArray.map((function(n){return e("div",{"aria-hidden":"true",class:r(["zonos--notification-item",n.type,n.transitionClass]),key:n.id,onClick:function(){t.removeNotification(n.id)}},e("zonos-text",{textColor:"gray-0"},n.message))}))))};return t}());j.style=I;var S=".sc-zonos-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-payment-h *.sc-zonos-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-payment-h img.sc-zonos-payment{max-width:100%}.sc-zonos-payment-h dl.sc-zonos-payment,.sc-zonos-payment-h dd.sc-zonos-payment,.sc-zonos-payment-h h1.sc-zonos-payment,.sc-zonos-payment-h h2.sc-zonos-payment,.sc-zonos-payment-h h3.sc-zonos-payment,.sc-zonos-payment-h h4.sc-zonos-payment,.sc-zonos-payment-h h5.sc-zonos-payment,.sc-zonos-payment-h h6.sc-zonos-payment,.sc-zonos-payment-h hr.sc-zonos-payment,.sc-zonos-payment-h figure.sc-zonos-payment,.sc-zonos-payment-h p.sc-zonos-payment,.sc-zonos-payment-h pre.sc-zonos-payment{margin:0}.sc-zonos-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-payment-h .zonos--title.sc-zonos-payment{margin-bottom:16px}.sc-zonos-payment-h .zonos--payment-component.sc-zonos-payment{margin-bottom:4px}";var O=S;var U=t("zonos_payment",function(){function t(t){n(this,t);this.stripe=h.stripe;this.stripeElements=h.stripeElements;this.isPaymentInfoFilled=false;this.trackingSent=false}t.prototype.watchIsPaymentInfoFilled=function(){var t;if(this.isPaymentInfoFilled&&!this.trackingSent){var n=p.checkoutSessionId;void l({checkoutSessionId:n,eventName:"checkout_paymentInfoFilled",metadata:{paymentMethod:(t=h.stripePaymentEventData)===null||t===void 0?void 0:t.value.type}});this.trackingSent=true}};t.prototype.watchInitStripe=function(){return __awaiter(this,void 0,void 0,(function(){var t,n,e;var o=this;return __generator(this,(function(s){switch(s.label){case 0:if(!this.stripeElements){return[2]}return[4,this.stripeElements.fetchUpdates()];case 1:s.sent();n=h.stripePaymentElement||this.stripeElements.create("payment",{defaultValues:{billingDetails:{address:{country:(t=h.stripeAddressEventData)===null||t===void 0?void 0:t.value.address.country}}},layout:"tabs"});e=this.el.querySelector(".zonos--payment-component");if(!e){f("Cannot find container element for paymentElement");return[2]}n.mount(e);n.on("change",(function(t){if(t.complete){o.isPaymentInfoFilled=true}h.stripePaymentEventData=t}));h.stripePaymentElement=n;return[2]}}))}))};t.prototype.componentDidLoad=function(){void this.watchInitStripe()};t.prototype.render=function(){return e(o,{key:"6bc25553430c9e23c77a0607ad28dc4c9efa66e6",class:"zonos--payment zonos--elements"},this.titleText&&e("zonos-text",{key:"e4ba3f581697a799e50fe066e7cc922a206af8e5",class:"zonos--title",type:"semiBoldLabel"},this.titleText),e("div",{key:"0247eecadf083f09b67c5f668da845431234750d",class:"zonos--payment-component"}),e("div",{key:"7f63abd0a2c1cbc62f931e44fc44c69b57a4f8ed",class:"zonos--payment-paypal-container"}))};Object.defineProperty(t.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{isPaymentInfoFilled:["watchIsPaymentInfoFilled"],stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return t}());U.style=O;var C=".sc-zonos-paypal-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-paypal-payment-h *.sc-zonos-paypal-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-paypal-payment-h img.sc-zonos-paypal-payment{max-width:100%}.sc-zonos-paypal-payment-h dl.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h dd.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h1.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h2.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h3.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h4.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h5.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h6.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h hr.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h figure.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h p.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h pre.sc-zonos-paypal-payment{margin:0}.sc-zonos-paypal-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-paypal-payment-h{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}";var P=C;var T=t("zonos_paypal_payment",function(){function t(t){n(this,t);this.paypalSessionDone=a(this,"paypalSessionDone",7);this.paypalSessionFail=a(this,"paypalSessionFail",7);this.storeUnsubscribeList=[]}t.prototype.loadPaypal=function(){return __awaiter(this,void 0,void 0,(function(){var t,n;var e=this;return __generator(this,(function(o){if(!window.Zonos.paypal){m("Paypal is not available");return[2]}t=y({onPaypalFail:function(){m("onPaypalFail");e.paypalSessionFail.emit()},onPaypalSessionDone:function(t){var n=t.orderId;m("onPaypalSessionDone","info",{orderId:n});e.paypalSessionDone.emit({orderId:n})}});if(!(t===null||t===void 0?void 0:t.length)){m("There are no paypal buttons available");return[2]}n=this.el.querySelector(".zonos--payment-paypal-container");if(!n){m("Cannot find container element for paypal buttons");return[2]}t.forEach((function(t){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,t.render(n)];case 1:e.sent();return[2]}}))}))}));return[2]}))}))};t.prototype.componentWillLoad=function(){this.storeUnsubscribeList=[d("paypal",this.loadPaypal.bind(this))]};t.prototype.componentDidLoad=function(){void this.loadPaypal()};t.prototype.disconnectedCallback=function(){this.storeUnsubscribeList.forEach((function(t){return t()}))};t.prototype.render=function(){return e(o,{key:"c01e031b29e0089389be2a16e888bd0b7c24dcd8",class:"zonos--paypal-payment zonos--elements"},e("div",{key:"f03c880bde17291f083cfe1f0db6a918f92d720b",class:"zonos--payment-paypal-container"}))};Object.defineProperty(t.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});return t}());T.style=P}}}));
1
+ var __awaiter=this&&this.__awaiter||function(t,n,e,o){function s(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,a){function i(t){try{c(o.next(t))}catch(t){a(t)}}function r(t){try{c(o["throw"](t))}catch(t){a(t)}}function c(t){t.done?e(t.value):s(t.value).then(i,r)}c((o=o.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},o,s,a,i;return i={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function r(t){return function(n){return c([t,n])}}function c(r){if(o)throw new TypeError("Generator is already executing.");while(i&&(i=0,r[0]&&(e=0)),e)try{if(o=1,s&&(a=r[0]&2?s["return"]:r[0]?s["throw"]||((a=s["return"])&&a.call(s),0):s.next)&&!(a=a.call(s,r[1])).done)return a;if(s=0,a)r=[r[0]&2,a.value];switch(r[0]){case 0:case 1:a=r;break;case 4:e.label++;return{value:r[1],done:false};case 5:e.label++;s=r[1];r=[0];continue;case 7:r=e.ops.pop();e.trys.pop();continue;default:if(!(a=e.trys,a=a.length>0&&a[a.length-1])&&(r[0]===6||r[0]===2)){e=0;continue}if(r[0]===3&&(!a||r[1]>a[0]&&r[1]<a[3])){e.label=r[1];break}if(r[0]===6&&e.label<a[1]){e.label=a[1];a=r;break}if(a&&e.label<a[2]){e.label=a[2];e.ops.push(r);break}if(a[2])e.ops.pop();e.trys.pop();continue}r=n.call(t,e)}catch(t){r=[6,t];s=0}finally{o=a=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(t,n,e){if(e||arguments.length===2)for(var o=0,s=n.length,a;o<s;o++){if(a||!(o in n)){if(!a)a=Array.prototype.slice.call(n,0,o);a[o]=n[o]}}return t.concat(a||Array.prototype.slice.call(n))};System.register(["./p-7261e245.system.js","./p-3e7ee89d.system.js","./p-23e7c655.system.js","./p-14d6542f.system.js","./p-17c7a727.system.js","./p-0fa932e6.system.js","./p-01174496.system.js","./p-b453ae2b.system.js","./p-d938f42f.system.js","./p-7d9d2407.system.js","./p-5d65be06.system.js","./p-bc919de1.system.js"],(function(t){"use strict";var n,e,o,s,a,i,r,c,h,l,p,f,y,d,m;return{setters:[function(t){n=t.r;e=t.h;o=t.a;s=t.g;a=t.d},function(t){i=t.f},function(t){r=t.c},function(t){c=t.g},function(t){h=t.b;l=t.t},function(t){p=t.s},function(t){f=t.l},function(t){y=t.d;d=t.e},function(t){m=t.l},function(){},function(){},function(){}],execute:function(){var u=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .styled-card{border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));padding:var(--spacing, 24px);text-align:left;background-color:var(--zonos--background-color);overflow:hidden}:host .styled-card hr{margin-left:calc(var(--spacing, 24px) * -1);margin-right:calc(var(--spacing, 24px) * -1)}:host .styled-card .card-header{margin:calc(var(--spacing, 24px) * -1);padding:var(--spacing, 24px);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-bottom:var(--spacing, 24px);border-bottom:var(--zonos-elements-border);height:65px;line-height:65px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host .styled-card .card-header h5{margin-bottom:0;-ms-flex:1;flex:1}:host .styled-card .card-footer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;margin:calc(var(--spacing, 24px) * -1);padding:var(--spacing, 24px);border-top:var(--zonos-elements-border);background:var(--zonos-elements-surface-color-secondary);margin-top:var(--spacing, 24px);border-bottom-left-radius:var(--zonos-elements-radius-8);border-bottom-right-radius:var(--zonos-elements-radius-8);height:var(--footerHeight)}";var g=u;var z=t("zonos_card",function(){function t(t){n(this,t);this.borderRadius=6;this.spacing="24px"}t.prototype.render=function(){var t=this.backgroundColor?"var(--zonos-elements-".concat(this.backgroundColor,")"):"transparent";var n=c({customRoundRadius:"".concat(this.borderRadius,"px"),overrideBorderStyle:"ROUNDED"});return e(o,{key:"ae124207be3fbddbd445d74cdf31085401a09c67",style:{"--zonos--font-family":i()}},e("div",{key:"43fe2ffcb7caa0754c93f6d94898156f5169139b",class:r(["styled-card"]),style:{"--zonos--background-color":t,"--zonos--border-radius":n,padding:this.spacing}},this.label&&e("header",{key:"6839065e2e630a841d6ecd7f03b19a93a988e49a",class:"card-header",style:{padding:this.spacing}},e("zonos-text",{key:"498435bbbb60cc6d1d13a304aad321107bd6feaf",type:"subheader"},this.label),e("h-stack",{key:"4de3f042a72b16be374209b393cb174fc7d1b670",spacing:8},this.actions)),e("slot",{key:"add9dac3d8b9a50c0caa37d245f632c6a5e64d7f"}),(this.footerActions||this.footerContent)&&e("footer",{key:"e83f37ed24b44d9b7316579ee28ea51a3da119d8",class:"card-footer",style:{height:this.footerHeight?"".concat(this.footerHeight,"px"):"auto",padding:this.spacing}},e("div",{key:"685721d5f7f51c99438f4ddf23cf75122db3223c"},this.footerContent),e("h-stack",{key:"61a44c918aea4994c10b16045564b45135296852",spacing:8},this.footerActions))))};return t}());z.style=g;var b='<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19124" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19124)"/>\n</mask>\n<g mask="url(#mask0_3739_19124)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="white" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19124" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n';var x='<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19125" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19125)"/>\n</mask>\n<g mask="url(#mask0_3739_19125)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="black" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19125" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n';var v=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex;position:relative}:host zonos-text{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host svg{width:var(--zonos--width);height:var(--zonos--height)}";var k=v;var w=t("zonos_empty_state_payment",function(){function t(t){n(this,t);this.theme="LIGHT"}t.prototype.render=function(){if(!this.el.shadowRoot){return null}if(this.theme==="DARK"){this.el.shadowRoot.innerHTML=b}else{this.el.shadowRoot.innerHTML=x}return e(o,{class:"zonos--elements",style:{"--zonos--font-family":i(),"--zonos--height":"100%","--zonos--width":"100%"}},e("zonos-text",{type:"semiBoldLabel"},this.emptyStateText))};Object.defineProperty(t.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});return t}());w.style=k;var _=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";var I=_;var j=t("zonos_notification",function(){function t(t){n(this,t);this.notificationArray=[]}t.prototype.showNotification=function(t){return __awaiter(this,void 0,void 0,(function(){var n,e;var o=this;return __generator(this,(function(s){n="id-".concat(Math.random().toString(36).substring(2,9));e=Object.assign(Object.assign({},t),{id:n,timeout:t.timeout||5e3,transitionClass:"",type:t.type||"success"});this.notificationArray=__spreadArray(__spreadArray([],this.notificationArray,true),[e],false);setTimeout((function(){o.updateTransitionClass({id:n,transitionClass:"show"})}),50);setTimeout((function(){o.removeNotification(n)}),e.timeout);return[2]}))}))};t.prototype.updateTransitionClass=function(t){var n=t.id,e=t.transitionClass;this.notificationArray=this.notificationArray.map((function(t){if(t.id===n){return Object.assign(Object.assign({},t),{transitionClass:e})}return t}))};t.prototype.removeNotification=function(t){var n=this;this.updateTransitionClass({id:t,transitionClass:""});setTimeout((function(){n.notificationArray=n.notificationArray.filter((function(n){return n.id!==t}))}),300)};t.prototype.render=function(){var t=this;return e(o,{key:"6a790a39afc037ae56f8a53dc89c3fa899b2d659",class:r(["zonos--elements zonos--notification"]),style:{"--zonos--border-radius":c(),"--zonos--font-family":i()}},e("div",{key:"32245a784f2322fb69a65b491648a30a84b0b3d3",class:"zonos--notification-items"},this.notificationArray.map((function(n){return e("div",{"aria-hidden":"true",class:r(["zonos--notification-item",n.type,n.transitionClass]),key:n.id,onClick:function(){t.removeNotification(n.id)}},e("zonos-text",{textColor:"gray-0"},n.message))}))))};return t}());j.style=I;var S=".sc-zonos-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-payment-h *.sc-zonos-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-payment-h img.sc-zonos-payment{max-width:100%}.sc-zonos-payment-h dl.sc-zonos-payment,.sc-zonos-payment-h dd.sc-zonos-payment,.sc-zonos-payment-h h1.sc-zonos-payment,.sc-zonos-payment-h h2.sc-zonos-payment,.sc-zonos-payment-h h3.sc-zonos-payment,.sc-zonos-payment-h h4.sc-zonos-payment,.sc-zonos-payment-h h5.sc-zonos-payment,.sc-zonos-payment-h h6.sc-zonos-payment,.sc-zonos-payment-h hr.sc-zonos-payment,.sc-zonos-payment-h figure.sc-zonos-payment,.sc-zonos-payment-h p.sc-zonos-payment,.sc-zonos-payment-h pre.sc-zonos-payment{margin:0}.sc-zonos-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-payment-h .zonos--title.sc-zonos-payment{margin-bottom:16px}.sc-zonos-payment-h .zonos--payment-component.sc-zonos-payment{margin-bottom:4px}";var O=S;var U=t("zonos_payment",function(){function t(t){n(this,t);this.stripe=h.stripe;this.stripeElements=h.stripeElements;this.isPaymentInfoFilled=false;this.trackingSent=false}t.prototype.watchIsPaymentInfoFilled=function(){var t;if(this.isPaymentInfoFilled&&!this.trackingSent){var n=p.checkoutSessionId;void l({checkoutSessionId:n,eventName:"checkout_paymentInfoFilled",metadata:{paymentMethod:(t=h.stripePaymentEventData)===null||t===void 0?void 0:t.value.type}});this.trackingSent=true}};t.prototype.watchInitStripe=function(){return __awaiter(this,void 0,void 0,(function(){var t,n,e;var o=this;return __generator(this,(function(s){switch(s.label){case 0:if(!this.stripeElements){return[2]}return[4,this.stripeElements.fetchUpdates()];case 1:s.sent();n=h.stripePaymentElement||this.stripeElements.create("payment",{defaultValues:{billingDetails:{address:{country:(t=h.stripeAddressEventData)===null||t===void 0?void 0:t.value.address.country}}},layout:"tabs"});e=this.el.querySelector(".zonos--payment-component");if(!e){f("Cannot find container element for paymentElement");return[2]}n.mount(e);n.on("change",(function(t){if(t.complete){o.isPaymentInfoFilled=true}h.stripePaymentEventData=t}));h.stripePaymentElement=n;return[2]}}))}))};t.prototype.componentDidLoad=function(){void this.watchInitStripe()};t.prototype.render=function(){return e(o,{key:"6bc25553430c9e23c77a0607ad28dc4c9efa66e6",class:"zonos--payment zonos--elements"},this.titleText&&e("zonos-text",{key:"e4ba3f581697a799e50fe066e7cc922a206af8e5",class:"zonos--title",type:"semiBoldLabel"},this.titleText),e("div",{key:"0247eecadf083f09b67c5f668da845431234750d",class:"zonos--payment-component"}),e("div",{key:"7f63abd0a2c1cbc62f931e44fc44c69b57a4f8ed",class:"zonos--payment-paypal-container"}))};Object.defineProperty(t.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{isPaymentInfoFilled:["watchIsPaymentInfoFilled"],stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return t}());U.style=O;var C=".sc-zonos-paypal-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-paypal-payment-h *.sc-zonos-paypal-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-paypal-payment-h img.sc-zonos-paypal-payment{max-width:100%}.sc-zonos-paypal-payment-h dl.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h dd.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h1.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h2.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h3.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h4.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h5.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h6.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h hr.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h figure.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h p.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h pre.sc-zonos-paypal-payment{margin:0}.sc-zonos-paypal-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-paypal-payment-h{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}";var P=C;var T=t("zonos_paypal_payment",function(){function t(t){n(this,t);this.paypalSessionDone=a(this,"paypalSessionDone",7);this.paypalSessionFail=a(this,"paypalSessionFail",7);this.storeUnsubscribeList=[]}t.prototype.loadPaypal=function(){return __awaiter(this,void 0,void 0,(function(){var t,n;var e=this;return __generator(this,(function(o){if(!window.Zonos.paypal){m("Paypal is not available");return[2]}t=y({onPaypalFail:function(){m("onPaypalFail");e.paypalSessionFail.emit()},onPaypalSessionDone:function(t){var n=t.orderId;m("onPaypalSessionDone","info",{orderId:n});e.paypalSessionDone.emit({orderId:n})}});if(!(t===null||t===void 0?void 0:t.length)){m("There are no paypal buttons available");return[2]}n=this.el.querySelector(".zonos--payment-paypal-container");if(!n){m("Cannot find container element for paypal buttons");return[2]}t.forEach((function(t){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,t.render(n)];case 1:e.sent();return[2]}}))}))}));return[2]}))}))};t.prototype.componentWillLoad=function(){this.storeUnsubscribeList=[d("paypal",this.loadPaypal.bind(this))]};t.prototype.componentDidLoad=function(){void this.loadPaypal()};t.prototype.disconnectedCallback=function(){this.storeUnsubscribeList.forEach((function(t){return t()}))};t.prototype.render=function(){return e(o,{key:"c01e031b29e0089389be2a16e888bd0b7c24dcd8",class:"zonos--paypal-payment zonos--elements"},e("div",{key:"f03c880bde17291f083cfe1f0db6a918f92d720b",class:"zonos--payment-paypal-container"}))};Object.defineProperty(t.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});return t}());T.style=P}}}));
@@ -1 +1 @@
1
- import{r as o,h as t,a as s}from"./p-ce75b047.js";import{d as e}from"./p-bbef037c.js";import{t as n}from"./p-097d7819.js";import{r as i}from"./p-d437bc28.js";import{c as a}from"./p-b4b7f705.js";import{c as l}from"./p-44147850.js";import{r as c}from"./p-1b8771bb.js";import"./p-701d9a7c.js";import"./p-0a377722.js";import"./p-41dd1cb8.js";import"./p-33d4be28.js";import"./p-3dc3596b.js";const r=class{constructor(t){o(this,t),this.isMobile=!1,this.errorImages=[],this.locale=null}componentWillLoad(){const o=navigator.language;this.locale=o}render(){const o=e.items.filter((o=>!o.isRestricted));return t(s,{key:"55bb132970db23e06698701d7d27e108ff0643e0",class:a(["zonos--invoice-cart-items zonos--elements",this.isMobile&&"mobile"])},t("table",{key:"c9722c17a507ca9fdcb8ca47151d14ba1d74f698",class:"zonos--cart-table"},t("tbody",{key:"d8d318e03bfeefaf687825c6131367e73c0b91ce"},o.map((o=>{var s,e,a,l;const c=null===(e=null===(s=o.attributes)||void 0===s?void 0:s.find((o=>"invoiceId"===o.key||"INVOICE_ID"===o.key)))||void 0===e?void 0:e.value,r=null===(l=null===(a=o.attributes)||void 0===a?void 0:a.find((o=>"invoiceCreatedAt"===o.key)))||void 0===l?void 0:l.value,h=r&&this.locale?new Date(r).toLocaleDateString(this.locale,{day:"numeric",month:"long",year:"numeric"}):null,d=c?`https://dashboard.zonos.com/billing/invoices/${c}`:null;return t("tr",{class:"zonos--invoice-cart-item"},t("td",{class:"zonos--column zonos--cart-item-title"},t("zonos-text",{type:"semiBoldLabel"},n("Invoice:"))),t("td",{class:"zonos--column zonos--cart-item-link"},d&&c&&t("zonos-link",{href:d},c),this.isMobile&&t("zonos-text",{type:"caption"},h)),t("td",{class:"zonos--column zonos--cart-item-created-at"},!this.isMobile&&t("zonos-text",{type:"label"},h)),t("td",{class:"zonos--column zonos--cart-item-price"},t("zonos-text",{type:"label"},i({amount:o.amount,isForeign:!1}))))})))))}static get assetsDirs(){return["assets"]}};r.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--cart-table{width:100%;border:none;border-collapse:collapse;overflow:auto;font-size:var(--zonos-elements-font-size-base)}:host .zonos--cart-table .zonos--column{padding:8px;padding-left:0;font-size:var(--zonos-elements-font-size-base)}:host .zonos--cart-table .zonos--column:last-child{text-align:right;padding-right:0}:host .zonos--cart-table .zonos--column:first-child{padding-left:0;width:50px}:host .zonos--cart-table .zonos--cart-item-link{text-align:left}:host .zonos--cart-table .zonos--cart-item-created-at{text-align:right}:host .zonos--cart-table td{vertical-align:middle}:host .zonos--cart-item-price zonos-text{white-space:nowrap}:host(.mobile) table{margin-top:16px}:host(.mobile) table td{vertical-align:top}";const h=class{constructor(t){o(this,t),this.isMobile=!1}render(){return t(s,{key:"a8d7a91a69c2ea3aeee0788f4d9523e1e65915eb",class:a(["zonos--invoice-subtotal zonos--elements",this.isMobile&&"mobile"])},t("table",{key:"fb299d6ea07b48c099fca14e0c16369bf7b93955",class:"zonos--invoice-table"},t("tr",{key:"5b01748b535af171bed832076fcfeb5308279808",class:"zonos--row zonos--invoice-total"},t("td",{key:"829797e7d5560c6f73b661cdc53b473c57c7ad2f",class:"zonos--column"}),t("td",{key:"cc75308e6470b4fa12182001467e7d2ca7915405",class:"zonos--column zonos--invoice-subtotal-title"},t("zonos-text",{key:"38c9de7d3393a999bc06a7bafe033aefa45ead5c",type:"semiBoldLabel"},n("Payment total"))),t("td",{key:"962069d60839b82e374d3c4aae3b2a6709a82017",class:"zonos--column zonos--invoice-subtotal-price"},c({content:t("zonos-text",{type:"semiBoldLabel"},i({amount:l.amountTotalDue||0,isForeign:!0})),isLoading:l.isFetchingPayorInfo,skeletonHeight:"14px",skeletonWidth:"150px"})))))}static get assetsDirs(){return["assets"]}};h.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:-webkit-sticky;position:sticky;bottom:60px}:host .zonos--invoice-table{width:100%;border:none;border-collapse:collapse;overflow:auto;font-size:var(--zonos-elements-font-size-base)}:host .zonos--invoice-table .zonos--column{padding:8px 8px;vertical-align:top}:host .zonos--invoice-table .zonos--column:last-child{text-align:right;padding-right:0}:host .zonos--invoice-table .zonos--column:first-child{width:60px;max-width:100px}:host .zonos--title-with-icon{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:8px}:host .zonos--invoice-subtotal-price{text-align:right}:host .zonos--invoice-subtotal-price zonos-text{white-space:nowrap}:host .zonos--invoice-total .zonos--column{padding:16px 0}:host .zonos--invoice-total .zonos--invoice-subtotal-title,:host .zonos--invoice-total .zonos--invoice-subtotal-price{border-top:1px solid var(--zonos-elements-gray-200)}:host .zonos--invoice-subtotal-price zonos-text,:host .zonos--invoice-pay-total zonos-text{white-space:nowrap}:host(.mobile){position:relative;bottom:0}";export{r as zonos_invoice_cart_items,h as zonos_invoice_subtotal}
1
+ import{r as o,h as t,a as s}from"./p-ce75b047.js";import{d as e}from"./p-aa3a7538.js";import{t as n}from"./p-24aa6708.js";import{r as i}from"./p-58521b25.js";import{c as a}from"./p-b4b7f705.js";import{c as l}from"./p-c425d3d9.js";import{r as c}from"./p-1b8771bb.js";import"./p-701d9a7c.js";import"./p-0a377722.js";import"./p-41dd1cb8.js";import"./p-33d4be28.js";import"./p-3dc3596b.js";const r=class{constructor(t){o(this,t),this.isMobile=!1,this.errorImages=[],this.locale=null}componentWillLoad(){const o=navigator.language;this.locale=o}render(){const o=e.items.filter((o=>!o.isRestricted));return t(s,{key:"55bb132970db23e06698701d7d27e108ff0643e0",class:a(["zonos--invoice-cart-items zonos--elements",this.isMobile&&"mobile"])},t("table",{key:"c9722c17a507ca9fdcb8ca47151d14ba1d74f698",class:"zonos--cart-table"},t("tbody",{key:"d8d318e03bfeefaf687825c6131367e73c0b91ce"},o.map((o=>{var s,e,a,l;const c=null===(e=null===(s=o.attributes)||void 0===s?void 0:s.find((o=>"invoiceId"===o.key||"INVOICE_ID"===o.key)))||void 0===e?void 0:e.value,r=null===(l=null===(a=o.attributes)||void 0===a?void 0:a.find((o=>"invoiceCreatedAt"===o.key)))||void 0===l?void 0:l.value,h=r&&this.locale?new Date(r).toLocaleDateString(this.locale,{day:"numeric",month:"long",year:"numeric"}):null,d=c?`https://dashboard.zonos.com/billing/invoices/${c}`:null;return t("tr",{class:"zonos--invoice-cart-item"},t("td",{class:"zonos--column zonos--cart-item-title"},t("zonos-text",{type:"semiBoldLabel"},n("Invoice:"))),t("td",{class:"zonos--column zonos--cart-item-link"},d&&c&&t("zonos-link",{href:d},c),this.isMobile&&t("zonos-text",{type:"caption"},h)),t("td",{class:"zonos--column zonos--cart-item-created-at"},!this.isMobile&&t("zonos-text",{type:"label"},h)),t("td",{class:"zonos--column zonos--cart-item-price"},t("zonos-text",{type:"label"},i({amount:o.amount,isForeign:!1}))))})))))}static get assetsDirs(){return["assets"]}};r.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--cart-table{width:100%;border:none;border-collapse:collapse;overflow:auto;font-size:var(--zonos-elements-font-size-base)}:host .zonos--cart-table .zonos--column{padding:8px;padding-left:0;font-size:var(--zonos-elements-font-size-base)}:host .zonos--cart-table .zonos--column:last-child{text-align:right;padding-right:0}:host .zonos--cart-table .zonos--column:first-child{padding-left:0;width:50px}:host .zonos--cart-table .zonos--cart-item-link{text-align:left}:host .zonos--cart-table .zonos--cart-item-created-at{text-align:right}:host .zonos--cart-table td{vertical-align:middle}:host .zonos--cart-item-price zonos-text{white-space:nowrap}:host(.mobile) table{margin-top:16px}:host(.mobile) table td{vertical-align:top}";const h=class{constructor(t){o(this,t),this.isMobile=!1}render(){return t(s,{key:"a8d7a91a69c2ea3aeee0788f4d9523e1e65915eb",class:a(["zonos--invoice-subtotal zonos--elements",this.isMobile&&"mobile"])},t("table",{key:"fb299d6ea07b48c099fca14e0c16369bf7b93955",class:"zonos--invoice-table"},t("tr",{key:"5b01748b535af171bed832076fcfeb5308279808",class:"zonos--row zonos--invoice-total"},t("td",{key:"829797e7d5560c6f73b661cdc53b473c57c7ad2f",class:"zonos--column"}),t("td",{key:"cc75308e6470b4fa12182001467e7d2ca7915405",class:"zonos--column zonos--invoice-subtotal-title"},t("zonos-text",{key:"38c9de7d3393a999bc06a7bafe033aefa45ead5c",type:"semiBoldLabel"},n("Payment total"))),t("td",{key:"962069d60839b82e374d3c4aae3b2a6709a82017",class:"zonos--column zonos--invoice-subtotal-price"},c({content:t("zonos-text",{type:"semiBoldLabel"},i({amount:l.amountTotalDue||0,isForeign:!0})),isLoading:l.isFetchingPayorInfo,skeletonHeight:"14px",skeletonWidth:"150px"})))))}static get assetsDirs(){return["assets"]}};h.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:-webkit-sticky;position:sticky;bottom:60px}:host .zonos--invoice-table{width:100%;border:none;border-collapse:collapse;overflow:auto;font-size:var(--zonos-elements-font-size-base)}:host .zonos--invoice-table .zonos--column{padding:8px 8px;vertical-align:top}:host .zonos--invoice-table .zonos--column:last-child{text-align:right;padding-right:0}:host .zonos--invoice-table .zonos--column:first-child{width:60px;max-width:100px}:host .zonos--title-with-icon{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:8px}:host .zonos--invoice-subtotal-price{text-align:right}:host .zonos--invoice-subtotal-price zonos-text{white-space:nowrap}:host .zonos--invoice-total .zonos--column{padding:16px 0}:host .zonos--invoice-total .zonos--invoice-subtotal-title,:host .zonos--invoice-total .zonos--invoice-subtotal-price{border-top:1px solid var(--zonos-elements-gray-200)}:host .zonos--invoice-subtotal-price zonos-text,:host .zonos--invoice-pay-total zonos-text{white-space:nowrap}:host(.mobile){position:relative;bottom:0}";export{r as zonos_invoice_cart_items,h as zonos_invoice_subtotal}
@@ -1 +1 @@
1
- import{r as s,d as t,h as o,a as e,g as i}from"./p-ce75b047.js";import{t as n}from"./p-3b28fc76.js";import{b as a,t as r,U as l,H as d,r as h,d as c}from"./p-bbef037c.js";import{s as p,x as u,t as f,w as m,l as z}from"./p-097d7819.js";import{z as b,g,f as y}from"./p-701d9a7c.js";import{l as v,i as k,s as x}from"./p-41dd1cb8.js";import{a as w,s as C}from"./p-63a383f4.js";import{c as I}from"./p-b4b7f705.js";import{l as A}from"./p-0a377722.js";import{c as E,s as j}from"./p-6b361d2b.js";import{g as S}from"./p-3dc3596b.js";import"./p-4df08fc4.js";import"./p-33d4be28.js";import"./p-1d42cd20.js";const D=class{constructor(o){s(this,o),this.invalidCharacters=t(this,"invalidCharacters",7),this.taxIdChanged=t(this,"taxIdChanged",7),this.storeUnsubscribeList=[],this.isAutoCompleteAdjusted=!1,this.defaultAddress=[],this.taxIdErrorMessage="",this.shortAddressCodeErrorMessage="",this.stripe=window.Zonos.stripe,this.isDirtyAddress=!1,this.isAddressFilled=!1,this.checkoutSessionId=p.checkoutSessionId,this.prevCountry=null,this.prevPostalCode=null,this.trackingSent=!1,this.prefetchLandedCost=n(h,1e3)}getStripeAddressInstance(){return"billing"===this.type?{stripeAddressElement:a.stripeBillingAddressElement,stripeAddressEventData:a.stripeBillingAddressEventData,stripeElements:a.stripeElementsForBillingAddress}:{stripeAddressElement:a.stripeAddressElement,stripeAddressEventData:a.stripeAddressEventData,stripeElements:a.stripeElements}}updateAddressEventData({event:s,type:t}){"billing"===t?a.stripeBillingAddressEventData=s:a.stripeAddressEventData=s,"shipping"===t&&s.value.address.line1.length&&this.prefetchLandedCost()}isAddressFilledChanged(){p.checkoutSessionId&&this.isAddressFilled&&!this.trackingSent&&"shipping"===this.type&&(this.trackingSent=!0,r({checkoutSessionId:p.checkoutSessionId,eventName:"checkout_customerInfoFilled"}))}updateAddressElement({stripeAddressElement:s,type:t}){"shipping"!==t?a.stripeBillingAddressElement=s:a.stripeAddressElement=s}async watchInitStripe(){this.stripe=window.Zonos.stripe;const{stripeAddressEventData:s,stripeElements:t}=this.getStripeAddressInstance();if(!this.stripe||!t)return void v("Stripe is not initialized. Couldn't load stripe element.");const o=this.defaultAddress.map((s=>Object.assign(Object.assign({},s),{name:s.name,phone:s.phone||void 0}))),e=z.shippingZoneCountries,i=e?Object.values(e).map((s=>s.code)):[],n=new URLSearchParams(window.location.search).has("zonosCheckoutAllCountries"),a="shipping"===this.type?i:[],r=(null==s?void 0:s.value.address.country)||u(a);A(`Stripe country code: ${r}`,"info");const d=t.create("address",{allowedCountries:n?[]:a,contacts:o.length&&!s?this.defaultAddress:[],defaultValues:{address:Object.assign(Object.assign({},null==s?void 0:s.value.address),{country:r}),firstName:null==s?void 0:s.value.firstName,lastName:null==s?void 0:s.value.lastName,phone:null==s?void 0:s.value.phone},display:{name:"split"},fields:{phone:"always"},mode:this.type,validation:{phone:{required:"always"}}});d.mount(this.el.querySelector(".zonos--address-component")),(null==s?void 0:s.value.address)&&(this.prevCountry=s.value.address.country,this.prevPostalCode=s.value.address.postal_code),d.on("change",(s=>{const t=s.value;if(!this.isDirtyAddress&&t.address.line1.length>=3){if(this.isDirtyAddress=!0,!this.isAutoCompleteAdjusted){const s=this.el.querySelector('iframe[src*="autocomplete-suggestions"]');s&&(s.style.zIndex="3"),this.isAutoCompleteAdjusted=!0}setTimeout((()=>{if(k())this.el.scrollIntoView({behavior:"smooth",block:"end"});else{const s="shipping"===this.type?100:600,t=this.el.closest(".zonos--group"),o=this.el.getBoundingClientRect().top+s;null==t||t.scrollTo({behavior:"smooth",top:o})}}),600)}const{firstName:o,lastName:e}=l({firstName:t.firstName,lastName:t.lastName,name:t.name});this.updateAddressEventData({event:Object.assign(Object.assign({},s),{elementMode:this.type,elementType:"address",value:Object.assign(Object.assign({},t),{firstName:o,lastName:e})}),type:this.type})})),this.updateAddressElement({stripeAddressElement:d,type:this.type})}defaultAddressChanged(s,t){if(JSON.stringify(t)===JSON.stringify(s))return;A("Reset address element when default address property is changed","info",{defaultAddress:this.defaultAddress});const o=this.getStripeAddressInstance().stripeAddressElement;null==o||o.clear(),null==o||o.destroy(),"shipping"===this.type?a.stripeAddressEventData=null:a.stripeBillingAddressEventData=null,this.watchInitStripe()}isInTaxIdCountry(s){return E.includes(s)}renderTaxIdInput(){var s;if("billing"===this.type)return null;const t=null===(s=a.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;if(!t)return null;if(!this.isInTaxIdCountry(t))return null;if(!w({companyName:a.companyName,countryCode:t}))return null;const e=j[t];return o("div",{class:"zonos--tax-id-input"},o("zonos-stripe-input",{inputLabel:f(e.friendlyName),inputPlaceholder:e.placeholder,inputValue:a.taxId||"",isError:!!this.taxIdErrorMessage,onInputChange:s=>{a.taxId=s.detail,this.taxIdChanged.emit(s.detail)}}),this.taxIdErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.taxIdErrorMessage))}renderShortAddressCodeInput(){var s;if("billing"===this.type)return null;const t=null===(s=a.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;return t&&C({countryCode:t})?o("div",{class:"zonos--short-address-code-input"},o("zonos-stripe-input",{inputLabel:f("Short address code"),inputPlaceholder:"RRRD2929",inputValue:a.shortAddressCode||"",isError:!!this.shortAddressCodeErrorMessage,onInputChange:s=>{a.shortAddressCode=s.detail}}),this.shortAddressCodeErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.shortAddressCodeErrorMessage)):null}renderCompanyNameInput(){return("billing"!==this.type||window.Zonos.isCollect||window.Zonos.isInvoice)&&("ENABLED"===b.checkoutSettings.companyFieldsStatus||window.Zonos.isCollect||window.Zonos.isInvoice)?o("zonos-stripe-input",{class:"zonos--company-name-input",inputLabel:f("Company name (optional)"),inputValue:a.companyName,onInputChange:s=>{a.companyName=s.detail}}):null}disconnectedCallback(){const s=this.getStripeAddressInstance().stripeAddressElement;null==s||s.destroy();try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){const s=this.getStripeAddressInstance().stripeAddressEventData;this.isDirtyAddress=!!s&&s.value.address.line1.length>0,this.watchInitStripe(),this.checkoutSessionId=p.checkoutSessionId,this.storeUnsubscribeList=[m("checkoutSessionId",(()=>{this.checkoutSessionId=p.checkoutSessionId})),d("stripeElements",(()=>{"shipping"===this.type&&this.watchInitStripe()})),d("stripeElementsForBillingAddress",(()=>{"billing"===this.type&&this.watchInitStripe()}))]}render(){var s;return this.checkoutSessionId=p.checkoutSessionId,(null===(s=a.stripeAddressEventData)||void 0===s?void 0:s.complete)&&(this.isAddressFilled=!0),o(e,{key:"ebba5be32c456e8b71d397db63e666e5d5df1543",class:I(["zonos--address","zonos--elements",`zonos--${this.type}-address`])},this.titleText&&o("zonos-text",{key:"25f15ea17b50ed055eb98b072850296312785b06",class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("slot",{key:"631bc324d1bb96fb9e796b38a6da42ef6ca601a3",name:"below-title"}),this.renderCompanyNameInput(),this.renderTaxIdInput(),this.renderShortAddressCodeInput(),o("div",{key:"25f88c72f8fc9b788b042f2df2f1b8085132f683",class:"zonos--address-component"}))}get el(){return i(this)}static get watchers(){return{checkoutSessionId:["isAddressFilledChanged"],isAddressFilled:["isAddressFilledChanged"],stripe:["watchInitStripe"],defaultAddress:["defaultAddressChanged"]}}};D.style=".sc-zonos-address-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h .zonos--company-name-input.sc-zonos-address,.sc-zonos-address-h .zonos--tax-id-input.sc-zonos-address,.sc-zonos-address-h .zonos--short-address-code-input.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";const L=class{constructor(o){s(this,o),this.confirmClicked=t(this,"confirmClicked",7),this.cancelClicked=t(this,"cancelClicked",7),this.dialogTitle=f("Are you sure?"),this.dialogIntent="info",this.dialogSubtitle=null,this.dialogWidth=350,this.dialogType="confirm",this.isMobile=!1,this.noClickOutside=!1,this.clickOutsideDialogHandler=s=>{s.target!==s.currentTarget||this.noClickOutside||this.closeDialogHandler()}}handleKeyDown(s){"Escape"===s.key&&this.closeDialogHandler()}focusDialog(){this.dialogOpen&&setTimeout((()=>{var s,t;null===(t=null===(s=this.el.shadowRoot)||void 0===s?void 0:s.querySelector(".zonos--backdrop"))||void 0===t||t.focus()}),100)}confirmDialogHandler(){this.dialogOpen&&this.confirmClicked.emit()}closeDialogHandler(){this.dialogOpen&&this.cancelClicked.emit()}renderIcon(){switch(this.dialogIntent){case"info":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-400)"></path>\n <path d="M10.25 10.25a1.75 1.75 0 1 1 2.431 1.613c-.616.26-1.431.885-1.431 1.887a.75.75 0 0 0 1.5 0c0-.053.02-.128.108-.228.092-.104.236-.205.408-.278A3.25 3.25 0 1 0 8.75 10.25a.75.75 0 0 0 1.5 0Zm2.5 5.75a.75.75 0 0 0-1.5 0v.25a.75.75 0 0 0 1.5 0V16Z" fill="currentColor"></path>\n</svg>',iconColor:"blue-800"});case"danger":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-400)"></path>\n <path d="M12.75 9a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V9Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"red-800"});case"warn":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-orange-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M14.46 5.492c-1.014-2.027-3.906-2.027-4.92 0L4.276 16.02c-.914 1.83.416 3.98 2.46 3.98h10.528c2.044 0 3.374-2.151 2.46-3.98L14.46 5.492Z" data-is-secondary-color="true" fill="var(--zonos-elements-orange-400)"></path>\n <path d="M12.75 10a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V10Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"orange-800"})}}getButtonConfirmVariant(){switch(this.dialogIntent){case"warn":return"warning";case"danger":return"danger";default:return"primary"}}render(){this.focusDialog();const s=S(),t=g(b.appearance.theme);return o(e,{key:"459abd25f9719554dc3b4387a660618056909846",class:I([this.dialogOpen&&"open","zonos--elements"]),"data-dialog-type":this.dialogType,"data-theme":t,style:{"--zonos--border-radius":s,"--zonos--dialog-width":`${this.dialogWidth}px`,"--zonos--font-family":y()}},o("div",{key:"f8a3c9bdbad91b046b3579eb140aad74e2784f8d",class:"zonos--backdrop",tabIndex:-1}),o("div",{key:"b41d27616223f89adb523269a3a8b982cd3559c7",class:I(["zonos--confirm-layout",this.dialogIntent]),onClick:s=>this.clickOutsideDialogHandler(s)},o("div",{key:"69e7837a2aaaeea468e4887d14cbb0ea61d5f24a",class:"zonos--confirm-dialog",onBlur:()=>{this.focusDialog()}},o("div",{key:"28ed6e2da0c8c56a00c46df985f21cf74c551894",class:"wrapper"},o("div",{key:"f20b3f00aeaef6fc306766a52607253554005cf4",class:"icon-wrapper"},this.renderIcon()),o("div",{key:"7bb44bb7a880c599a8cc4615df48257fd0f9c19d",class:"content"},o("div",{key:"584603b01b26b5d242f14c67a14d7b092d54b668",class:"title"},o("zonos-text",{key:"028e06e106587778f6da2301ee44727ab1bf487f",type:"subheader"},this.dialogTitle)),this.dialogSubtitle&&o("div",{key:"c986563425dc6130fa154ce3c8e15c2aa03fb6cb",class:"subtitle"},o("zonos-text",{key:"675899ceea2fd2de38ca8f87aa6ca69e4c7d8fc7",textColor:"gray-800"},this.dialogSubtitle))),o("div",{key:"8a034df1cd91f07e870fd6eccebc2f382edf59fb",class:"footer"},"confirm"===this.dialogType&&o("zonos-button",{key:"72e643fff73dabe0d5381e6ffc7f2237ef00f322",backgroundColor:"gray-0",class:"cancel-button",onClick:()=>this.closeDialogHandler(),size:"lg",withBoxShadow:!0},this.dialogCancelBtnText||f("Cancel")),o("zonos-button",{key:"e247f450feef41b44688b937b38df8e061f386a3",class:"confirm-button",onClick:()=>this.confirmDialogHandler(),size:"lg",variant:this.getButtonConfirmVariant()},this.dialogConfirmBtnText))))))}static get assetsDirs(){return["assets"]}get el(){return i(this)}};L.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--confirm-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:opacity 0.3s, visibility 0.3s;transition:opacity 0.3s, visibility 0.3s}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--confirm-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color)}:host .zonos--confirm-dialog{position:relative;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;width:var(--zonos--dialog-width);border-radius:var(--zonos--border-radius, 10px);outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;gap:24px}:host .icon-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:40px;width:40px;border-radius:50%;background:var(--zonos-elements-blue-100)}:host .warn .icon-wrapper{background:var(--zonos-elements-orange-100)}:host .danger .icon-wrapper{background:var(--zonos-elements-red-100)}:host .footer{display:-ms-flexbox;display:flex;width:100%;gap:8px}:host .footer zonos-button{-ms-flex:1;flex:1}:host .content{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .content zonos-text{text-align:center}:host(.open) .zonos--confirm-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483009;opacity:0.65}:host(.open) .zonos--confirm-layout{opacity:1;z-index:2147483010;-webkit-transform:scale(1);transform:scale(1)}";const N=s=>/^[a-zA-Z0-9.%_+-]*@[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z0-9]{2,}$/.test(s),Z=class{constructor(o){s(this,o),this.linkAuthenticationChange=t(this,"linkAuthenticationChange",7),this.storeUnsubscribeList=[],this.defaultEmail=null,this.isEmailError=!1,this.stripe=a.stripe,this.isStagingMode=c.isStagingMode,this.clientSecret=a.clientSecret,this.retriesInitializeLink=0,this.setCustomEmailInputToLinkEvent=s=>{const t=N(s);a.stripeLinkEventData={complete:!!t,elementType:"linkAuthentication",empty:!s,value:{email:s}}},this.handleNormalEmailInput=s=>{var t;this.setCustomEmailInputToLinkEvent(s.detail),null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()}}watchIsStagingMode(){setTimeout((()=>{this.watchInitStripe()}),0)}async watchInitStripe(){if(!this.stripe||!a.stripeElements)return;if(c.isStagingMode||!this.clientSecret)return;const s=this.defaultEmail?{email:this.defaultEmail}:void 0;try{const t=a.stripeLinkElement||a.stripeElements.create("linkAuthentication",{defaultValues:s}),o=this.el.querySelector(".zonos--link-authentication-component");if(!o)return void v("Cannot find container element for linkAuthenticationElement");t.mount(o),t.on("change",(s=>{var t;a.stripeLinkEventData=s,null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()})),a.stripeLinkElement=t,this.retriesInitializeLink=0,this.retriesInitializeLink>11&&(A("Stripe link element initialized","info",{retriesInitializeLink:this.retriesInitializeLink,stripe:this.stripe}),x({endpoint:"stripe-link-authentication-init-long-running",errors:["Stripe link element initialized after 20 retries - 10 seconds"],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}catch(s){s instanceof Error&&(this.retriesInitializeLink++,this.retriesInitializeLink<51&&(await new Promise((s=>setTimeout(s,500))),this.watchInitStripe()),51===this.retriesInitializeLink&&x({endpoint:"stripe-link-authentication-init-error",errors:[s.message],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}}watchDefaultEmail(s,t){var o,e;A("Default email is changed","info",{newDefaultEmail:s,oldDefaultEmail:t}),t!==s&&(s||(a.stripeLinkEventData=null),c.isStagingMode?this.setCustomEmailInputToLinkEvent(s||""):(null===(o=a.stripeLinkElement)||void 0===o||o.clear(),null===(e=a.stripeLinkElement)||void 0===e||e.destroy(),a.stripeLinkElement=null,a.stripeLinkEventData=null,A("Reset stripe link element when default email is changed","info",{defaultEmail:s}),this.watchInitStripe()))}disconnectedCallback(){try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){this.storeUnsubscribeList=[d("stripeElements",(async()=>{this.watchInitStripe()})),d("clientSecret",(async()=>{this.clientSecret=a.clientSecret})),d("stripe",(async()=>{this.stripe=a.stripe}))],this.watchInitStripe(),this.defaultEmail&&this.setCustomEmailInputToLinkEvent(this.defaultEmail)}render(){return this.isStagingMode=c.isStagingMode,this.clientSecret=a.clientSecret,o(e,{class:"zonos--link-authentication zonos--elements",style:{"--zonos--border-radius":S()}},this.titleText&&o("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),(()=>{var s;return c.isStagingMode?o("zonos-stripe-input",{inputLabel:f("Email"),inputValue:this.defaultEmail||(null===(s=a.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"",isError:this.isEmailError,onBlur:()=>{var s;const t=(null===(s=a.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"";if(!t)return;const o=N(t);this.isEmailError=!o},onInputChange:this.handleNormalEmailInput}):o("div",{class:`zonos--link-authentication-component ${this.isEmailError&&"zonos--input-invalid"}`})})(),this.isEmailError&&o("zonos-text",{textColor:"red-600"},f("Please enter a valid email address.")))}get el(){return i(this)}static get watchers(){return{isStagingMode:["watchIsStagingMode"],stripe:["watchInitStripe"],clientSecret:["watchInitStripe"],defaultEmail:["watchDefaultEmail"]}}};Z.style=".sc-zonos-link-authentication-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-link-authentication-h *.sc-zonos-link-authentication{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-link-authentication-h img.sc-zonos-link-authentication{max-width:100%}.sc-zonos-link-authentication-h dl.sc-zonos-link-authentication,.sc-zonos-link-authentication-h dd.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h1.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h2.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h3.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h4.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h5.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h6.sc-zonos-link-authentication,.sc-zonos-link-authentication-h hr.sc-zonos-link-authentication,.sc-zonos-link-authentication-h figure.sc-zonos-link-authentication,.sc-zonos-link-authentication-h p.sc-zonos-link-authentication,.sc-zonos-link-authentication-h pre.sc-zonos-link-authentication{margin:0}.sc-zonos-link-authentication-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-link-authentication-h .zonos--title.sc-zonos-link-authentication{margin-bottom:16px}.sc-zonos-link-authentication-h .zonos--input-invalid.sc-zonos-link-authentication{border:2px solid var(--zonos-elements-red-600);border-radius:var(--zonos--border-radius)}";const B=class{constructor(t){s(this,t),this.open=!1,this.size=40}render(){return o(e,{key:"8216ba7271f4eb12153620d0268fd7b5dea632ad",class:I(["zonos--elements",this.open&&"zonos--open"])},o("div",{key:"ad3ab1b7e51b2de173e1b1a489bce3cdacc798f1",class:"zonos--loading-overlay"},o("zonos-spinner",{key:"dc1dd642825268c01c5df120165a7aec85d121e9",size:this.size,spinnerColor:this.spinnerColor})))}};B.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:fixed;inset:0;z-index:2147483010;pointer-events:none;display:block}:host .zonos--loading-overlay{position:fixed;inset:0;width:100vw;height:100vh;background:var(--zonos-elements-backdrop-color);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;opacity:0;visibility:hidden;-webkit-transition:opacity 0.3s ease, visibility 0.3s ease;transition:opacity 0.3s ease, visibility 0.3s ease;z-index:2147483010}:host(.zonos--open){pointer-events:auto}:host(.zonos--open) .zonos--loading-overlay{opacity:0.65;visibility:visible}";export{D as zonos_address,L as zonos_confirm_dialog,Z as zonos_link_authentication,B as zonos_loading_overlay}
1
+ import{r as s,d as t,h as o,a as e,g as i}from"./p-ce75b047.js";import{t as n}from"./p-3b28fc76.js";import{b as a,t as r,U as l,H as d,r as h,d as c}from"./p-aa3a7538.js";import{s as p,z as u,t as f,y as m,l as z}from"./p-24aa6708.js";import{z as b,g,f as y}from"./p-701d9a7c.js";import{l as v,i as k,s as x}from"./p-41dd1cb8.js";import{a as w,s as C}from"./p-63a383f4.js";import{c as I}from"./p-b4b7f705.js";import{l as A}from"./p-0a377722.js";import{c as E,s as j}from"./p-6b361d2b.js";import{g as S}from"./p-3dc3596b.js";import"./p-4df08fc4.js";import"./p-33d4be28.js";import"./p-1d42cd20.js";const D=class{constructor(o){s(this,o),this.invalidCharacters=t(this,"invalidCharacters",7),this.taxIdChanged=t(this,"taxIdChanged",7),this.storeUnsubscribeList=[],this.isAutoCompleteAdjusted=!1,this.defaultAddress=[],this.taxIdErrorMessage="",this.shortAddressCodeErrorMessage="",this.stripe=window.Zonos.stripe,this.isDirtyAddress=!1,this.isAddressFilled=!1,this.checkoutSessionId=p.checkoutSessionId,this.prevCountry=null,this.prevPostalCode=null,this.trackingSent=!1,this.prefetchLandedCost=n(h,1e3)}getStripeAddressInstance(){return"billing"===this.type?{stripeAddressElement:a.stripeBillingAddressElement,stripeAddressEventData:a.stripeBillingAddressEventData,stripeElements:a.stripeElementsForBillingAddress}:{stripeAddressElement:a.stripeAddressElement,stripeAddressEventData:a.stripeAddressEventData,stripeElements:a.stripeElements}}updateAddressEventData({event:s,type:t}){"billing"===t?a.stripeBillingAddressEventData=s:a.stripeAddressEventData=s,"shipping"===t&&s.value.address.line1.length&&this.prefetchLandedCost()}isAddressFilledChanged(){p.checkoutSessionId&&this.isAddressFilled&&!this.trackingSent&&"shipping"===this.type&&(this.trackingSent=!0,r({checkoutSessionId:p.checkoutSessionId,eventName:"checkout_customerInfoFilled"}))}updateAddressElement({stripeAddressElement:s,type:t}){"shipping"!==t?a.stripeBillingAddressElement=s:a.stripeAddressElement=s}async watchInitStripe(){this.stripe=window.Zonos.stripe;const{stripeAddressEventData:s,stripeElements:t}=this.getStripeAddressInstance();if(!this.stripe||!t)return void v("Stripe is not initialized. Couldn't load stripe element.");const o=this.defaultAddress.map((s=>Object.assign(Object.assign({},s),{name:s.name,phone:s.phone||void 0}))),e=z.shippingZoneCountries,i=e?Object.values(e).map((s=>s.code)):[],n=new URLSearchParams(window.location.search).has("zonosCheckoutAllCountries"),a="shipping"===this.type?i:[],r=(null==s?void 0:s.value.address.country)||u(a);A(`Stripe country code: ${r}`,"info");const d=t.create("address",{allowedCountries:n?[]:a,contacts:o.length&&!s?this.defaultAddress:[],defaultValues:{address:Object.assign(Object.assign({},null==s?void 0:s.value.address),{country:r}),firstName:null==s?void 0:s.value.firstName,lastName:null==s?void 0:s.value.lastName,phone:null==s?void 0:s.value.phone},display:{name:"split"},fields:{phone:"always"},mode:this.type,validation:{phone:{required:"always"}}});d.mount(this.el.querySelector(".zonos--address-component")),(null==s?void 0:s.value.address)&&(this.prevCountry=s.value.address.country,this.prevPostalCode=s.value.address.postal_code),d.on("change",(s=>{const t=s.value;if(!this.isDirtyAddress&&t.address.line1.length>=3){if(this.isDirtyAddress=!0,!this.isAutoCompleteAdjusted){const s=this.el.querySelector('iframe[src*="autocomplete-suggestions"]');s&&(s.style.zIndex="3"),this.isAutoCompleteAdjusted=!0}setTimeout((()=>{if(k())this.el.scrollIntoView({behavior:"smooth",block:"end"});else{const s="shipping"===this.type?100:600,t=this.el.closest(".zonos--group"),o=this.el.getBoundingClientRect().top+s;null==t||t.scrollTo({behavior:"smooth",top:o})}}),600)}const{firstName:o,lastName:e}=l({firstName:t.firstName,lastName:t.lastName,name:t.name});this.updateAddressEventData({event:Object.assign(Object.assign({},s),{elementMode:this.type,elementType:"address",value:Object.assign(Object.assign({},t),{firstName:o,lastName:e})}),type:this.type})})),this.updateAddressElement({stripeAddressElement:d,type:this.type})}defaultAddressChanged(s,t){if(JSON.stringify(t)===JSON.stringify(s))return;A("Reset address element when default address property is changed","info",{defaultAddress:this.defaultAddress});const o=this.getStripeAddressInstance().stripeAddressElement;null==o||o.clear(),null==o||o.destroy(),"shipping"===this.type?a.stripeAddressEventData=null:a.stripeBillingAddressEventData=null,this.watchInitStripe()}isInTaxIdCountry(s){return E.includes(s)}renderTaxIdInput(){var s;if("billing"===this.type)return null;const t=null===(s=a.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;if(!t)return null;if(!this.isInTaxIdCountry(t))return null;if(!w({companyName:a.companyName,countryCode:t}))return null;const e=j[t];return o("div",{class:"zonos--tax-id-input"},o("zonos-stripe-input",{inputLabel:f(e.friendlyName),inputPlaceholder:e.placeholder,inputValue:a.taxId||"",isError:!!this.taxIdErrorMessage,onInputChange:s=>{a.taxId=s.detail,this.taxIdChanged.emit(s.detail)}}),this.taxIdErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.taxIdErrorMessage))}renderShortAddressCodeInput(){var s;if("billing"===this.type)return null;const t=null===(s=a.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;return t&&C({countryCode:t})?o("div",{class:"zonos--short-address-code-input"},o("zonos-stripe-input",{inputLabel:f("Short address code"),inputPlaceholder:"RRRD2929",inputValue:a.shortAddressCode||"",isError:!!this.shortAddressCodeErrorMessage,onInputChange:s=>{a.shortAddressCode=s.detail}}),this.shortAddressCodeErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.shortAddressCodeErrorMessage)):null}renderCompanyNameInput(){return("billing"!==this.type||window.Zonos.isCollect||window.Zonos.isInvoice)&&("ENABLED"===b.checkoutSettings.companyFieldsStatus||window.Zonos.isCollect||window.Zonos.isInvoice)?o("zonos-stripe-input",{class:"zonos--company-name-input",inputLabel:f("Company name (optional)"),inputValue:a.companyName,onInputChange:s=>{a.companyName=s.detail}}):null}disconnectedCallback(){const s=this.getStripeAddressInstance().stripeAddressElement;null==s||s.destroy();try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){const s=this.getStripeAddressInstance().stripeAddressEventData;this.isDirtyAddress=!!s&&s.value.address.line1.length>0,this.watchInitStripe(),this.checkoutSessionId=p.checkoutSessionId,this.storeUnsubscribeList=[m("checkoutSessionId",(()=>{this.checkoutSessionId=p.checkoutSessionId})),d("stripeElements",(()=>{"shipping"===this.type&&this.watchInitStripe()})),d("stripeElementsForBillingAddress",(()=>{"billing"===this.type&&this.watchInitStripe()}))]}render(){var s;return this.checkoutSessionId=p.checkoutSessionId,(null===(s=a.stripeAddressEventData)||void 0===s?void 0:s.complete)&&(this.isAddressFilled=!0),o(e,{key:"ebba5be32c456e8b71d397db63e666e5d5df1543",class:I(["zonos--address","zonos--elements",`zonos--${this.type}-address`])},this.titleText&&o("zonos-text",{key:"25f15ea17b50ed055eb98b072850296312785b06",class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("slot",{key:"631bc324d1bb96fb9e796b38a6da42ef6ca601a3",name:"below-title"}),this.renderCompanyNameInput(),this.renderTaxIdInput(),this.renderShortAddressCodeInput(),o("div",{key:"25f88c72f8fc9b788b042f2df2f1b8085132f683",class:"zonos--address-component"}))}get el(){return i(this)}static get watchers(){return{checkoutSessionId:["isAddressFilledChanged"],isAddressFilled:["isAddressFilledChanged"],stripe:["watchInitStripe"],defaultAddress:["defaultAddressChanged"]}}};D.style=".sc-zonos-address-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h .zonos--company-name-input.sc-zonos-address,.sc-zonos-address-h .zonos--tax-id-input.sc-zonos-address,.sc-zonos-address-h .zonos--short-address-code-input.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";const L=class{constructor(o){s(this,o),this.confirmClicked=t(this,"confirmClicked",7),this.cancelClicked=t(this,"cancelClicked",7),this.dialogTitle=f("Are you sure?"),this.dialogIntent="info",this.dialogSubtitle=null,this.dialogWidth=350,this.dialogType="confirm",this.isMobile=!1,this.noClickOutside=!1,this.clickOutsideDialogHandler=s=>{s.target!==s.currentTarget||this.noClickOutside||this.closeDialogHandler()}}handleKeyDown(s){"Escape"===s.key&&this.closeDialogHandler()}focusDialog(){this.dialogOpen&&setTimeout((()=>{var s,t;null===(t=null===(s=this.el.shadowRoot)||void 0===s?void 0:s.querySelector(".zonos--backdrop"))||void 0===t||t.focus()}),100)}confirmDialogHandler(){this.dialogOpen&&this.confirmClicked.emit()}closeDialogHandler(){this.dialogOpen&&this.cancelClicked.emit()}renderIcon(){switch(this.dialogIntent){case"info":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-400)"></path>\n <path d="M10.25 10.25a1.75 1.75 0 1 1 2.431 1.613c-.616.26-1.431.885-1.431 1.887a.75.75 0 0 0 1.5 0c0-.053.02-.128.108-.228.092-.104.236-.205.408-.278A3.25 3.25 0 1 0 8.75 10.25a.75.75 0 0 0 1.5 0Zm2.5 5.75a.75.75 0 0 0-1.5 0v.25a.75.75 0 0 0 1.5 0V16Z" fill="currentColor"></path>\n</svg>',iconColor:"blue-800"});case"danger":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-400)"></path>\n <path d="M12.75 9a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V9Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"red-800"});case"warn":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-orange-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M14.46 5.492c-1.014-2.027-3.906-2.027-4.92 0L4.276 16.02c-.914 1.83.416 3.98 2.46 3.98h10.528c2.044 0 3.374-2.151 2.46-3.98L14.46 5.492Z" data-is-secondary-color="true" fill="var(--zonos-elements-orange-400)"></path>\n <path d="M12.75 10a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V10Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"orange-800"})}}getButtonConfirmVariant(){switch(this.dialogIntent){case"warn":return"warning";case"danger":return"danger";default:return"primary"}}render(){this.focusDialog();const s=S(),t=g(b.appearance.theme);return o(e,{key:"459abd25f9719554dc3b4387a660618056909846",class:I([this.dialogOpen&&"open","zonos--elements"]),"data-dialog-type":this.dialogType,"data-theme":t,style:{"--zonos--border-radius":s,"--zonos--dialog-width":`${this.dialogWidth}px`,"--zonos--font-family":y()}},o("div",{key:"f8a3c9bdbad91b046b3579eb140aad74e2784f8d",class:"zonos--backdrop",tabIndex:-1}),o("div",{key:"b41d27616223f89adb523269a3a8b982cd3559c7",class:I(["zonos--confirm-layout",this.dialogIntent]),onClick:s=>this.clickOutsideDialogHandler(s)},o("div",{key:"69e7837a2aaaeea468e4887d14cbb0ea61d5f24a",class:"zonos--confirm-dialog",onBlur:()=>{this.focusDialog()}},o("div",{key:"28ed6e2da0c8c56a00c46df985f21cf74c551894",class:"wrapper"},o("div",{key:"f20b3f00aeaef6fc306766a52607253554005cf4",class:"icon-wrapper"},this.renderIcon()),o("div",{key:"7bb44bb7a880c599a8cc4615df48257fd0f9c19d",class:"content"},o("div",{key:"584603b01b26b5d242f14c67a14d7b092d54b668",class:"title"},o("zonos-text",{key:"028e06e106587778f6da2301ee44727ab1bf487f",type:"subheader"},this.dialogTitle)),this.dialogSubtitle&&o("div",{key:"c986563425dc6130fa154ce3c8e15c2aa03fb6cb",class:"subtitle"},o("zonos-text",{key:"675899ceea2fd2de38ca8f87aa6ca69e4c7d8fc7",textColor:"gray-800"},this.dialogSubtitle))),o("div",{key:"8a034df1cd91f07e870fd6eccebc2f382edf59fb",class:"footer"},"confirm"===this.dialogType&&o("zonos-button",{key:"72e643fff73dabe0d5381e6ffc7f2237ef00f322",backgroundColor:"gray-0",class:"cancel-button",onClick:()=>this.closeDialogHandler(),size:"lg",withBoxShadow:!0},this.dialogCancelBtnText||f("Cancel")),o("zonos-button",{key:"e247f450feef41b44688b937b38df8e061f386a3",class:"confirm-button",onClick:()=>this.confirmDialogHandler(),size:"lg",variant:this.getButtonConfirmVariant()},this.dialogConfirmBtnText))))))}static get assetsDirs(){return["assets"]}get el(){return i(this)}};L.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--confirm-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:opacity 0.3s, visibility 0.3s;transition:opacity 0.3s, visibility 0.3s}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--confirm-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color)}:host .zonos--confirm-dialog{position:relative;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;width:var(--zonos--dialog-width);border-radius:var(--zonos--border-radius, 10px);outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;gap:24px}:host .icon-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:40px;width:40px;border-radius:50%;background:var(--zonos-elements-blue-100)}:host .warn .icon-wrapper{background:var(--zonos-elements-orange-100)}:host .danger .icon-wrapper{background:var(--zonos-elements-red-100)}:host .footer{display:-ms-flexbox;display:flex;width:100%;gap:8px}:host .footer zonos-button{-ms-flex:1;flex:1}:host .content{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .content zonos-text{text-align:center}:host(.open) .zonos--confirm-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483009;opacity:0.65}:host(.open) .zonos--confirm-layout{opacity:1;z-index:2147483010;-webkit-transform:scale(1);transform:scale(1)}";const N=s=>/^[a-zA-Z0-9.%_+-]*@[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z0-9]{2,}$/.test(s),Z=class{constructor(o){s(this,o),this.linkAuthenticationChange=t(this,"linkAuthenticationChange",7),this.storeUnsubscribeList=[],this.defaultEmail=null,this.isEmailError=!1,this.stripe=a.stripe,this.isStagingMode=c.isStagingMode,this.clientSecret=a.clientSecret,this.retriesInitializeLink=0,this.setCustomEmailInputToLinkEvent=s=>{const t=N(s);a.stripeLinkEventData={complete:!!t,elementType:"linkAuthentication",empty:!s,value:{email:s}}},this.handleNormalEmailInput=s=>{var t;this.setCustomEmailInputToLinkEvent(s.detail),null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()}}watchIsStagingMode(){setTimeout((()=>{this.watchInitStripe()}),0)}async watchInitStripe(){if(!this.stripe||!a.stripeElements)return;if(c.isStagingMode||!this.clientSecret)return;const s=this.defaultEmail?{email:this.defaultEmail}:void 0;try{const t=a.stripeLinkElement||a.stripeElements.create("linkAuthentication",{defaultValues:s}),o=this.el.querySelector(".zonos--link-authentication-component");if(!o)return void v("Cannot find container element for linkAuthenticationElement");t.mount(o),t.on("change",(s=>{var t;a.stripeLinkEventData=s,null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()})),a.stripeLinkElement=t,this.retriesInitializeLink=0,this.retriesInitializeLink>11&&(A("Stripe link element initialized","info",{retriesInitializeLink:this.retriesInitializeLink,stripe:this.stripe}),x({endpoint:"stripe-link-authentication-init-long-running",errors:["Stripe link element initialized after 20 retries - 10 seconds"],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}catch(s){s instanceof Error&&(this.retriesInitializeLink++,this.retriesInitializeLink<51&&(await new Promise((s=>setTimeout(s,500))),this.watchInitStripe()),51===this.retriesInitializeLink&&x({endpoint:"stripe-link-authentication-init-error",errors:[s.message],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}}watchDefaultEmail(s,t){var o,e;A("Default email is changed","info",{newDefaultEmail:s,oldDefaultEmail:t}),t!==s&&(s||(a.stripeLinkEventData=null),c.isStagingMode?this.setCustomEmailInputToLinkEvent(s||""):(null===(o=a.stripeLinkElement)||void 0===o||o.clear(),null===(e=a.stripeLinkElement)||void 0===e||e.destroy(),a.stripeLinkElement=null,a.stripeLinkEventData=null,A("Reset stripe link element when default email is changed","info",{defaultEmail:s}),this.watchInitStripe()))}disconnectedCallback(){try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){this.storeUnsubscribeList=[d("stripeElements",(async()=>{this.watchInitStripe()})),d("clientSecret",(async()=>{this.clientSecret=a.clientSecret})),d("stripe",(async()=>{this.stripe=a.stripe}))],this.watchInitStripe(),this.defaultEmail&&this.setCustomEmailInputToLinkEvent(this.defaultEmail)}render(){return this.isStagingMode=c.isStagingMode,this.clientSecret=a.clientSecret,o(e,{class:"zonos--link-authentication zonos--elements",style:{"--zonos--border-radius":S()}},this.titleText&&o("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),(()=>{var s;return c.isStagingMode?o("zonos-stripe-input",{inputLabel:f("Email"),inputValue:this.defaultEmail||(null===(s=a.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"",isError:this.isEmailError,onBlur:()=>{var s;const t=(null===(s=a.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"";if(!t)return;const o=N(t);this.isEmailError=!o},onInputChange:this.handleNormalEmailInput}):o("div",{class:`zonos--link-authentication-component ${this.isEmailError&&"zonos--input-invalid"}`})})(),this.isEmailError&&o("zonos-text",{textColor:"red-600"},f("Please enter a valid email address.")))}get el(){return i(this)}static get watchers(){return{isStagingMode:["watchIsStagingMode"],stripe:["watchInitStripe"],clientSecret:["watchInitStripe"],defaultEmail:["watchDefaultEmail"]}}};Z.style=".sc-zonos-link-authentication-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-link-authentication-h *.sc-zonos-link-authentication{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-link-authentication-h img.sc-zonos-link-authentication{max-width:100%}.sc-zonos-link-authentication-h dl.sc-zonos-link-authentication,.sc-zonos-link-authentication-h dd.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h1.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h2.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h3.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h4.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h5.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h6.sc-zonos-link-authentication,.sc-zonos-link-authentication-h hr.sc-zonos-link-authentication,.sc-zonos-link-authentication-h figure.sc-zonos-link-authentication,.sc-zonos-link-authentication-h p.sc-zonos-link-authentication,.sc-zonos-link-authentication-h pre.sc-zonos-link-authentication{margin:0}.sc-zonos-link-authentication-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-link-authentication-h .zonos--title.sc-zonos-link-authentication{margin-bottom:16px}.sc-zonos-link-authentication-h .zonos--input-invalid.sc-zonos-link-authentication{border:2px solid var(--zonos-elements-red-600);border-radius:var(--zonos--border-radius)}";const B=class{constructor(t){s(this,t),this.open=!1,this.size=40}render(){return o(e,{key:"8216ba7271f4eb12153620d0268fd7b5dea632ad",class:I(["zonos--elements",this.open&&"zonos--open"])},o("div",{key:"ad3ab1b7e51b2de173e1b1a489bce3cdacc798f1",class:"zonos--loading-overlay"},o("zonos-spinner",{key:"dc1dd642825268c01c5df120165a7aec85d121e9",size:this.size,spinnerColor:this.spinnerColor})))}};B.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:fixed;inset:0;z-index:2147483010;pointer-events:none;display:block}:host .zonos--loading-overlay{position:fixed;inset:0;width:100vw;height:100vh;background:var(--zonos-elements-backdrop-color);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;opacity:0;visibility:hidden;-webkit-transition:opacity 0.3s ease, visibility 0.3s ease;transition:opacity 0.3s ease, visibility 0.3s ease;z-index:2147483010}:host(.zonos--open){pointer-events:auto}:host(.zonos--open) .zonos--loading-overlay{opacity:0.65;visibility:visible}";export{D as zonos_address,L as zonos_confirm_dialog,Z as zonos_link_authentication,B as zonos_loading_overlay}
@@ -1,4 +1,4 @@
1
- var __awaiter=this&&this.__awaiter||function(n,r,e,t){function o(n){return n instanceof e?n:new e((function(r){r(n)}))}return new(e||(e=Promise))((function(e,i){function a(n){try{c(t.next(n))}catch(n){i(n)}}function u(n){try{c(t["throw"](n))}catch(n){i(n)}}function c(n){n.done?e(n.value):o(n.value).then(a,u)}c((t=t.apply(n,r||[])).next())}))};var __generator=this&&this.__generator||function(n,r){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(n){return function(r){return c([n,r])}}function c(u){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(e=0)),e)try{if(t=1,o&&(i=u[0]&2?o["return"]:u[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;if(o=0,i)u=[u[0]&2,i.value];switch(u[0]){case 0:case 1:i=u;break;case 4:e.label++;return{value:u[1],done:false};case 5:e.label++;o=u[1];u=[0];continue;case 7:u=e.ops.pop();e.trys.pop();continue;default:if(!(i=e.trys,i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){e.label=u[1];break}if(u[0]===6&&e.label<i[1]){e.label=i[1];i=u;break}if(i&&e.label<i[2]){e.label=i[2];e.ops.push(u);break}if(i[2])e.ops.pop();e.trys.pop();continue}u=r.call(n,e)}catch(n){u=[6,n];o=0}finally{t=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-3e7ee89d.system.js","./p-d932973f.system.js","./p-c5caf47b.system.js","./p-01174496.system.js","./p-5d65be06.system.js","./p-d938f42f.system.js","./p-bc919de1.system.js"],(function(n){"use strict";var r,e,t,o,i,a,u,c,s,d,f,l,v,p,y,h,b,w,m,_,j,P,k,g,E,O,I;return{setters:[function(n){r=n.z;e=n.c},function(n){t=n.t;o=n.v;i=n.E;a=n.A;u=n.b;c=n.d;s=n.x;d=n.y;f=n.J;l=n.z;v=n.B;p=n.u;y=n.h;h=n.I},function(n){b=n.t;w=n.s},function(n){m=n.h;_=n.g;j=n.l;P=n.j},function(n){k=n.i},function(n){g=n.l},function(n){E=n.i;O=n.e;I=n.s}],execute:function(){
1
+ var __awaiter=this&&this.__awaiter||function(n,r,e,t){function o(n){return n instanceof e?n:new e((function(r){r(n)}))}return new(e||(e=Promise))((function(e,i){function a(n){try{c(t.next(n))}catch(n){i(n)}}function u(n){try{c(t["throw"](n))}catch(n){i(n)}}function c(n){n.done?e(n.value):o(n.value).then(a,u)}c((t=t.apply(n,r||[])).next())}))};var __generator=this&&this.__generator||function(n,r){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(n){return function(r){return c([n,r])}}function c(u){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(e=0)),e)try{if(t=1,o&&(i=u[0]&2?o["return"]:u[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;if(o=0,i)u=[u[0]&2,i.value];switch(u[0]){case 0:case 1:i=u;break;case 4:e.label++;return{value:u[1],done:false};case 5:e.label++;o=u[1];u=[0];continue;case 7:u=e.ops.pop();e.trys.pop();continue;default:if(!(i=e.trys,i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){e.label=u[1];break}if(u[0]===6&&e.label<i[1]){e.label=i[1];i=u;break}if(i&&e.label<i[2]){e.label=i[2];e.ops.push(u);break}if(i[2])e.ops.pop();e.trys.pop();continue}u=r.call(n,e)}catch(n){u=[6,n];o=0}finally{t=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-3e7ee89d.system.js","./p-17c7a727.system.js","./p-0fa932e6.system.js","./p-01174496.system.js","./p-5d65be06.system.js","./p-d938f42f.system.js","./p-bc919de1.system.js"],(function(n){"use strict";var r,e,t,o,i,a,u,c,s,d,f,l,v,p,y,h,b,w,m,_,j,P,k,g,E,O,I;return{setters:[function(n){r=n.z;e=n.c},function(n){t=n.t;o=n.v;i=n.E;a=n.A;u=n.b;c=n.d;s=n.x;d=n.y;f=n.J;l=n.z;v=n.B;p=n.u;y=n.h;h=n.I},function(n){b=n.t;w=n.s},function(n){m=n.h;_=n.g;j=n.l;P=n.j},function(n){k=n.i},function(n){g=n.l},function(n){E=n.i;O=n.e;I=n.s}],execute:function(){
2
2
  /*!
3
3
  * paypal-js v8.4.2 (2025-09-04T17:21:30.135Z)
4
4
  * Copyright 2020-present, PayPal, Inc. All rights reserved.