@zonos/elements 1.3.242 → 1.3.244

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 (191) hide show
  1. package/dist/cjs/{cart-4246c004.js → cart-52cf3366.js} +3 -1
  2. package/dist/cjs/{hasInclusivePrice-ac0440e7.js → hasInclusivePrice-dbb82df8.js} +1 -1
  3. package/dist/cjs/index.cjs.js +7 -7
  4. package/dist/cjs/{invoice-d9655e9e.js → invoice-972f1ab3.js} +2 -2
  5. package/dist/cjs/{isCollectMobileTablet-65da8408.js → isCollectMobileTablet-fd11246c.js} +2 -2
  6. package/dist/cjs/{localization-ec5a6780.js → localization-b1075a8c.js} +60 -0
  7. package/dist/cjs/{paypal-a3921278.js → paypal-e339cc8c.js} +2 -2
  8. package/dist/cjs/{placeTestOrder-907b981d.js → placeTestOrder-3dfbe3d6.js} +2 -2
  9. package/dist/cjs/{renderCheckoutCurrency-5fe59d60.js → renderCheckoutCurrency-55056c97.js} +2 -2
  10. package/dist/cjs/zonos-address-display_9.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 +19 -6
  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/collection/components/store/translationStore/strings.arabic.js +3 -0
  28. package/dist/collection/components/store/translationStore/strings.base.js +3 -0
  29. package/dist/collection/components/store/translationStore/strings.chinese.js +3 -0
  30. package/dist/collection/components/store/translationStore/strings.danish.js +3 -0
  31. package/dist/collection/components/store/translationStore/strings.dutch.js +3 -0
  32. package/dist/collection/components/store/translationStore/strings.french.js +3 -0
  33. package/dist/collection/components/store/translationStore/strings.german.js +3 -0
  34. package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -0
  35. package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -0
  36. package/dist/collection/components/store/translationStore/strings.italian.js +3 -0
  37. package/dist/collection/components/store/translationStore/strings.japanese.js +3 -0
  38. package/dist/collection/components/store/translationStore/strings.korean.js +3 -0
  39. package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -0
  40. package/dist/collection/components/store/translationStore/strings.polish.js +3 -0
  41. package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -0
  42. package/dist/collection/components/store/translationStore/strings.russian.js +3 -0
  43. package/dist/collection/components/store/translationStore/strings.spanish.js +3 -0
  44. package/dist/collection/components/store/translationStore/strings.swedish.js +3 -0
  45. package/dist/collection/components/store/translationStore/strings.turkish.js +3 -0
  46. package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -0
  47. package/dist/collection/components/utils/api/triggerBuildLandedCost.js +3 -0
  48. package/dist/collection/components/utils/taxIdValidationResult.js +13 -0
  49. package/dist/esm/{cart-697f78dc.js → cart-7f4704dc.js} +3 -1
  50. package/dist/esm/{hasInclusivePrice-f41e52b8.js → hasInclusivePrice-3958ed11.js} +1 -1
  51. package/dist/esm/index.js +7 -7
  52. package/dist/esm/{invoice-50918381.js → invoice-d3d256fb.js} +2 -2
  53. package/dist/esm/{isCollectMobileTablet-2e7b4f01.js → isCollectMobileTablet-27693de5.js} +2 -2
  54. package/dist/esm/{localization-ee8bb238.js → localization-401ec6d4.js} +60 -0
  55. package/dist/esm/{paypal-b3299b37.js → paypal-61270b79.js} +2 -2
  56. package/dist/esm/{placeTestOrder-245f2030.js → placeTestOrder-c2180600.js} +2 -2
  57. package/dist/esm/{renderCheckoutCurrency-9404ed70.js → renderCheckoutCurrency-dea06d44.js} +2 -2
  58. package/dist/esm/zonos-address-display_9.entry.js +2 -2
  59. package/dist/esm/zonos-address_4.entry.js +2 -2
  60. package/dist/esm/zonos-card_5.entry.js +3 -3
  61. package/dist/esm/zonos-cart-items_12.entry.js +19 -6
  62. package/dist/esm/zonos-checkout.entry.js +3 -3
  63. package/dist/esm/zonos-collect-cart-items_3.entry.js +2 -2
  64. package/dist/esm/zonos-collect-finish_6.entry.js +6 -6
  65. package/dist/esm/zonos-collect.entry.js +4 -4
  66. package/dist/esm/zonos-controller.entry.js +2 -2
  67. package/dist/esm/zonos-country-flag.entry.js +1 -1
  68. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  69. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  70. package/dist/esm/zonos-hello.entry.js +1 -1
  71. package/dist/esm/zonos-invoice-cart-items_2.entry.js +4 -4
  72. package/dist/esm/zonos-invoice-finish_5.entry.js +6 -6
  73. package/dist/esm/zonos-invoice.entry.js +4 -4
  74. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  75. package/dist/esm-es5/cart-7f4704dc.js +1 -0
  76. package/dist/esm-es5/{hasInclusivePrice-f41e52b8.js → hasInclusivePrice-3958ed11.js} +1 -1
  77. package/dist/esm-es5/index.js +1 -1
  78. package/dist/esm-es5/{invoice-50918381.js → invoice-d3d256fb.js} +1 -1
  79. package/dist/esm-es5/{isCollectMobileTablet-2e7b4f01.js → isCollectMobileTablet-27693de5.js} +1 -1
  80. package/dist/esm-es5/localization-401ec6d4.js +1 -0
  81. package/dist/esm-es5/{paypal-b3299b37.js → paypal-61270b79.js} +1 -1
  82. package/dist/esm-es5/{placeTestOrder-245f2030.js → placeTestOrder-c2180600.js} +1 -1
  83. package/dist/esm-es5/{renderCheckoutCurrency-9404ed70.js → renderCheckoutCurrency-dea06d44.js} +1 -1
  84. package/dist/esm-es5/zonos-address-display_9.entry.js +1 -1
  85. package/dist/esm-es5/zonos-address_4.entry.js +1 -1
  86. package/dist/esm-es5/zonos-card_5.entry.js +1 -1
  87. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  88. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  89. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  90. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  91. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  92. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  93. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  94. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  95. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  96. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  97. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
  98. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  99. package/dist/esm-es5/zonos-invoice.entry.js +1 -1
  100. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  101. package/dist/scripts/index.d.ts +3 -0
  102. package/dist/scripts/index.js +1 -1
  103. package/dist/scripts/loadZonos.js +1 -1
  104. package/dist/scripts/zonos.js +1 -1
  105. package/dist/types/components/store/translationStore/strings.arabic.d.ts +3 -0
  106. package/dist/types/components/store/translationStore/strings.base.d.ts +3 -0
  107. package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -0
  108. package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -0
  109. package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -0
  110. package/dist/types/components/store/translationStore/strings.french.d.ts +3 -0
  111. package/dist/types/components/store/translationStore/strings.german.d.ts +3 -0
  112. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -0
  113. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -0
  114. package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -0
  115. package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -0
  116. package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -0
  117. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -0
  118. package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -0
  119. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -0
  120. package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -0
  121. package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -0
  122. package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -0
  123. package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -0
  124. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -0
  125. package/dist/types/components/utils/api/triggerBuildLandedCost.d.ts +3 -1
  126. package/dist/types/components/utils/taxIdValidationResult.d.ts +1 -1
  127. package/dist/zonos-elements/index.esm.js +1 -1
  128. package/dist/zonos-elements/{p-cfb2b5c7.entry.js → p-0aada8ab.entry.js} +1 -1
  129. package/dist/zonos-elements/{p-635b8da9.entry.js → p-1216cfb3.entry.js} +1 -1
  130. package/dist/zonos-elements/{p-ee5d5203.system.entry.js → p-133e9ce7.system.entry.js} +1 -1
  131. package/dist/zonos-elements/p-1d91e5d1.entry.js +1 -0
  132. package/dist/zonos-elements/p-21fb6b39.js +1 -0
  133. package/dist/zonos-elements/{p-1864fc4e.entry.js → p-2601538e.entry.js} +1 -1
  134. package/dist/zonos-elements/p-276faa43.js +1 -0
  135. package/dist/zonos-elements/{p-8432de4c.system.entry.js → p-2889a485.system.entry.js} +1 -1
  136. package/dist/zonos-elements/{p-1023a77d.js → p-288aab46.js} +1 -1
  137. package/dist/zonos-elements/{p-bdf49bed.entry.js → p-291b85f7.entry.js} +1 -1
  138. package/dist/zonos-elements/{p-1c54c3db.system.entry.js → p-367c13db.system.entry.js} +1 -1
  139. package/dist/zonos-elements/{p-1db4ae37.system.entry.js → p-38bdbdcc.system.entry.js} +1 -1
  140. package/dist/zonos-elements/{p-5aff8a31.system.entry.js → p-3b1898bc.system.entry.js} +1 -1
  141. package/dist/zonos-elements/{p-7e51fe84.system.entry.js → p-3f078bf5.system.entry.js} +1 -1
  142. package/dist/zonos-elements/{p-13b3a9bd.entry.js → p-3f46d83e.entry.js} +1 -1
  143. package/dist/zonos-elements/{p-ea0289e8.system.js → p-415c2a90.system.js} +1 -1
  144. package/dist/zonos-elements/{p-29bb70e0.entry.js → p-4bd8a16c.entry.js} +1 -1
  145. package/dist/zonos-elements/{p-fc783723.entry.js → p-4d7b82b5.entry.js} +1 -1
  146. package/dist/zonos-elements/{p-457a2957.system.js → p-515cff20.system.js} +1 -1
  147. package/dist/zonos-elements/{p-633017f0.system.entry.js → p-5be33a13.system.entry.js} +1 -1
  148. package/dist/zonos-elements/{p-b34553d8.entry.js → p-5f956a0d.entry.js} +1 -1
  149. package/dist/zonos-elements/{p-90e10b7e.system.entry.js → p-6b9b7cfb.system.entry.js} +1 -1
  150. package/dist/zonos-elements/p-74e258ff.system.js +1 -0
  151. package/dist/zonos-elements/{p-9ab32f9b.entry.js → p-7521549c.entry.js} +1 -1
  152. package/dist/zonos-elements/p-775c1122.system.js +1 -0
  153. package/dist/zonos-elements/{p-f7e6c1b5.system.entry.js → p-78c8bb58.system.entry.js} +1 -1
  154. package/dist/zonos-elements/p-85430ec1.js +1 -0
  155. package/dist/zonos-elements/{p-689ce3eb.system.entry.js → p-8d2e24a4.system.entry.js} +1 -1
  156. package/dist/zonos-elements/{p-e1ed7c4a.system.entry.js → p-8dc7d82f.system.entry.js} +1 -1
  157. package/dist/zonos-elements/p-95524f54.js +1 -0
  158. package/dist/zonos-elements/{p-5feb3750.system.entry.js → p-95703417.system.entry.js} +1 -1
  159. package/dist/zonos-elements/{p-3318ba9e.system.entry.js → p-993723c2.system.entry.js} +1 -1
  160. package/dist/zonos-elements/{p-8159d0f8.js → p-a0a62b7e.js} +2 -2
  161. package/dist/zonos-elements/{p-fecf66da.entry.js → p-a3411f20.entry.js} +1 -1
  162. package/dist/zonos-elements/{p-949c9d2a.entry.js → p-a53d3d46.entry.js} +1 -1
  163. package/dist/zonos-elements/{p-5216584e.system.js → p-a556ec07.system.js} +1 -1
  164. package/dist/zonos-elements/p-a6489088.js +1 -0
  165. package/dist/zonos-elements/{p-1af042d1.js → p-a79f3685.js} +1 -1
  166. package/dist/zonos-elements/{p-036e6a72.system.js → p-acc0eee3.system.js} +1 -1
  167. package/dist/zonos-elements/{p-28077dd4.entry.js → p-ba228769.entry.js} +1 -1
  168. package/dist/zonos-elements/p-c2442878.system.js +1 -1
  169. package/dist/zonos-elements/{p-b90f346f.system.entry.js → p-c62b6741.system.entry.js} +1 -1
  170. package/dist/zonos-elements/{p-ea1d5802.entry.js → p-c708f7e9.entry.js} +1 -1
  171. package/dist/zonos-elements/{p-ce48f579.system.entry.js → p-c88cd318.system.entry.js} +1 -1
  172. package/dist/zonos-elements/{p-343dee8b.system.js → p-d1effb76.system.js} +1 -1
  173. package/dist/zonos-elements/{p-b526a41e.system.js → p-e0809901.system.js} +1 -1
  174. package/dist/zonos-elements/{p-67414f66.system.js → p-e7543082.system.js} +1 -1
  175. package/dist/zonos-elements/{p-bfc09897.entry.js → p-e90e9584.entry.js} +1 -1
  176. package/dist/zonos-elements/{p-9a67d4f2.entry.js → p-ebef34e3.entry.js} +1 -1
  177. package/dist/zonos-elements/{p-b9974182.system.entry.js → p-f6c6b6d3.system.entry.js} +1 -1
  178. package/dist/zonos-elements/{p-a04c7b1e.entry.js → p-faae5eca.entry.js} +1 -1
  179. package/dist/zonos-elements/{p-75813a38.system.entry.js → p-fe699cc5.system.entry.js} +1 -1
  180. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  181. package/package.json +1 -1
  182. package/dist/esm-es5/cart-697f78dc.js +0 -1
  183. package/dist/esm-es5/localization-ee8bb238.js +0 -1
  184. package/dist/zonos-elements/p-258407c6.js +0 -1
  185. package/dist/zonos-elements/p-2aa284e6.js +0 -1
  186. package/dist/zonos-elements/p-2dd9b3e0.entry.js +0 -1
  187. package/dist/zonos-elements/p-6dc9b9e5.js +0 -1
  188. package/dist/zonos-elements/p-752dae00.system.js +0 -1
  189. package/dist/zonos-elements/p-bcdf1cba.js +0 -1
  190. package/dist/zonos-elements/p-d9b96ce6.system.js +0 -1
  191. package/dist/zonos-elements/p-fab5f272.js +0 -1
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,o,r){function n(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,i){function l(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r["throw"](e))}catch(e){i(e)}}function c(e){e.done?o(e.value):n(e.value).then(l,a)}c((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,n,i,l;return l={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function a(e){return function(t){return c([e,t])}}function c(a){if(r)throw new TypeError("Generator is already executing.");while(l&&(l=0,a[0]&&(o=0)),o)try{if(r=1,n&&(i=a[0]&2?n["return"]:a[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;if(n=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;n=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1];i=a;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(a);break}if(i[2])o.ops.pop();o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e];n=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{c as createStore,z as zonosStore}from"./zonosStore-b434e436.js";import{b as stripeStore,C as stripeStoreBuildAddressForPartyCreate,d as cartStore,D as cartStoreUpdateSelectedShippingOption}from"./cart-697f78dc.js";import{s as storageStore}from"./localization-ee8bb238.js";import{h as handleFetch,s as sendErrorLog,l as logError}from"./handleFetch-a844cac1.js";import{b as allLogs}from"./VarianceTest-572cecf5.js";var _k=createStore((function(){return{amountDutyTaxFeeTotal:null,amountTotalPaid:null,isFetchingShippingInfo:true,landedCostShortId:null,originCompanyName:null,partyBillingId:null,shippingAddress:null}})),collectStoreReset=_k.reset,collectStore=_k.state;var collectStoreInitShippingInfo=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,o,r,n,i,l,a,c,s,d,u,p,S;var f=e.landedCostId,v=e.retries,h=v===void 0?5:v;return __generator(this,(function(e){switch(e.label){case 0:collectStore.isFetchingShippingInfo=true;return[4,handleFetch("/api/zonos-elements/collect/get-shipping-info-by-lc-id",{body:{landedCostId:f},method:"POST"})];case 1:d=e.sent();if(!d.errors.length)return[3,4];if(!(h>0))return[3,3];return[4,new Promise((function(e){return setTimeout(e,1e3)}))];case 2:e.sent();return[2,collectStoreInitShippingInfo({landedCostId:f,retries:h-1})];case 3:return[2,null];case 4:collectStore.landedCostShortId=((t=d.json)===null||t===void 0?void 0:t.landedCostShortId)||null;collectStore.isFetchingShippingInfo=false;collectStore.shippingAddress=((o=d.json)===null||o===void 0?void 0:o.shipping)||null;u=(r=cartStore.checkoutSession)===null||r===void 0?void 0:r.landedCost;p=(n=cartStore.checkoutSession)===null||n===void 0?void 0:n.subtotals;S=(((i=u===null||u===void 0?void 0:u.amountSubtotals)===null||i===void 0?void 0:i.shipping)||0)+(((l=u===null||u===void 0?void 0:u.amountSubtotals)===null||l===void 0?void 0:l.items)||0);collectStore.amountTotalPaid=S*(((a=p===null||p===void 0?void 0:p.exchangeRate)===null||a===void 0?void 0:a.rate)||1);collectStore.amountDutyTaxFeeTotal=((p===null||p===void 0?void 0:p.duties)||0)+((p===null||p===void 0?void 0:p.taxes)||0)+((p===null||p===void 0?void 0:p.fees)||0);collectStore.originCompanyName=((s=(c=d.json)===null||c===void 0?void 0:c.origin)===null||s===void 0?void 0:s.companyName)||null;if(collectStore.amountTotalPaid===0){void sendErrorLog({endpoint:"COLLECT_NO_TOTAL_PAID",errors:[],metadata:{landedCostId:f,organizationId:zonosStore.organizationId}})}return[2]}}))}))};var collectStoreAsyncAddressUpdate=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,o,r,n,i,l,a,c,s;return __generator(this,(function(d){switch(d.label){case 0:if(!((e=stripeStore.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){return[2,{partiesCreated:false}]}n=(o=(t=cartStore.checkoutSession)===null||t===void 0?void 0:t.landedCost)===null||o===void 0?void 0:o.rootId;if(!n){void sendErrorLog({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId}});return[2,{partiesCreated:false}]}if(!storageStore.checkoutSessionId){void sendErrorLog({endpoint:"COLLECT_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,landedCostRootId:n}});return[2,{partiesCreated:false}]}i=stripeStoreBuildAddressForPartyCreate({address:stripeStore.stripeBillingAddressEventData.value.address,firstName:stripeStore.stripeBillingAddressEventData.value.firstName,lastName:stripeStore.stripeBillingAddressEventData.value.lastName,name:stripeStore.stripeBillingAddressEventData.value.name,phone:stripeStore.stripeBillingAddressEventData.value.phone});l=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,handleFetch("/api/zonos-elements/create-billing-party",{body:{billingAddress:i,checkoutSessionId:storageStore.checkoutSessionId,companyName:stripeStore.companyName,email:((r=stripeStore.stripeLinkEventData)===null||r===void 0?void 0:r.value.email)||"",isTest:l,rootId:n},method:"POST"})];case 1:a=d.sent(),c=a.errors,s=a.json;if(c.length||!s){logError("Error occurs when creating billing party",JSON.stringify(c,null,2));void sendErrorLog({endpoint:"COLLECT_BILLING_PARTY_CREATE_FAILED",errors:["[COLLECT] Failed to create billing party"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,errors:c,json:s}});return[2,{partiesCreated:false}]}collectStore.partyBillingId=s.billToPartyId;return[2,{partiesCreated:true}]}}))}))};var collectStoreUpdateSelectedShippingOption=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t;return __generator(this,(function(o){t=e.landedCost;if(!t){return[2,false]}cartStore.landedCostData=[Object.assign(Object.assign({},e),{landedCost:Object.assign({},t),landedCostId:t.id})];return[2,cartStoreUpdateSelectedShippingOption({applySubtotalsOnly:true,landedCostId:t.id,selectedShippingOption:t.shipmentRating})]}))}))};var collectTabletBreakpoint=1024;var collectMobileBreakpoint=768;var isCollectTablet=function(e){return e||window.innerWidth<collectTabletBreakpoint&&window.innerWidth>=collectMobileBreakpoint};var isCollectMobile=function(e){return e||window.innerWidth<collectMobileBreakpoint};export{isCollectTablet as a,collectStoreInitShippingInfo as b,collectStoreUpdateSelectedShippingOption as c,collectStoreAsyncAddressUpdate as d,collectStore as e,isCollectMobile as i};
1
+ var __awaiter=this&&this.__awaiter||function(e,t,o,r){function n(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,i){function l(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r["throw"](e))}catch(e){i(e)}}function c(e){e.done?o(e.value):n(e.value).then(l,a)}c((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,n,i,l;return l={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function a(e){return function(t){return c([e,t])}}function c(a){if(r)throw new TypeError("Generator is already executing.");while(l&&(l=0,a[0]&&(o=0)),o)try{if(r=1,n&&(i=a[0]&2?n["return"]:a[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;if(n=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;n=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1];i=a;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(a);break}if(i[2])o.ops.pop();o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e];n=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{c as createStore,z as zonosStore}from"./zonosStore-b434e436.js";import{b as stripeStore,C as stripeStoreBuildAddressForPartyCreate,d as cartStore,D as cartStoreUpdateSelectedShippingOption}from"./cart-7f4704dc.js";import{s as storageStore}from"./localization-401ec6d4.js";import{h as handleFetch,s as sendErrorLog,l as logError}from"./handleFetch-a844cac1.js";import{b as allLogs}from"./VarianceTest-572cecf5.js";var _k=createStore((function(){return{amountDutyTaxFeeTotal:null,amountTotalPaid:null,isFetchingShippingInfo:true,landedCostShortId:null,originCompanyName:null,partyBillingId:null,shippingAddress:null}})),collectStoreReset=_k.reset,collectStore=_k.state;var collectStoreInitShippingInfo=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,o,r,n,i,l,a,c,s,d,u,p,S;var f=e.landedCostId,v=e.retries,h=v===void 0?5:v;return __generator(this,(function(e){switch(e.label){case 0:collectStore.isFetchingShippingInfo=true;return[4,handleFetch("/api/zonos-elements/collect/get-shipping-info-by-lc-id",{body:{landedCostId:f},method:"POST"})];case 1:d=e.sent();if(!d.errors.length)return[3,4];if(!(h>0))return[3,3];return[4,new Promise((function(e){return setTimeout(e,1e3)}))];case 2:e.sent();return[2,collectStoreInitShippingInfo({landedCostId:f,retries:h-1})];case 3:return[2,null];case 4:collectStore.landedCostShortId=((t=d.json)===null||t===void 0?void 0:t.landedCostShortId)||null;collectStore.isFetchingShippingInfo=false;collectStore.shippingAddress=((o=d.json)===null||o===void 0?void 0:o.shipping)||null;u=(r=cartStore.checkoutSession)===null||r===void 0?void 0:r.landedCost;p=(n=cartStore.checkoutSession)===null||n===void 0?void 0:n.subtotals;S=(((i=u===null||u===void 0?void 0:u.amountSubtotals)===null||i===void 0?void 0:i.shipping)||0)+(((l=u===null||u===void 0?void 0:u.amountSubtotals)===null||l===void 0?void 0:l.items)||0);collectStore.amountTotalPaid=S*(((a=p===null||p===void 0?void 0:p.exchangeRate)===null||a===void 0?void 0:a.rate)||1);collectStore.amountDutyTaxFeeTotal=((p===null||p===void 0?void 0:p.duties)||0)+((p===null||p===void 0?void 0:p.taxes)||0)+((p===null||p===void 0?void 0:p.fees)||0);collectStore.originCompanyName=((s=(c=d.json)===null||c===void 0?void 0:c.origin)===null||s===void 0?void 0:s.companyName)||null;if(collectStore.amountTotalPaid===0){void sendErrorLog({endpoint:"COLLECT_NO_TOTAL_PAID",errors:[],metadata:{landedCostId:f,organizationId:zonosStore.organizationId}})}return[2]}}))}))};var collectStoreAsyncAddressUpdate=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,o,r,n,i,l,a,c,s;return __generator(this,(function(d){switch(d.label){case 0:if(!((e=stripeStore.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){return[2,{partiesCreated:false}]}n=(o=(t=cartStore.checkoutSession)===null||t===void 0?void 0:t.landedCost)===null||o===void 0?void 0:o.rootId;if(!n){void sendErrorLog({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId}});return[2,{partiesCreated:false}]}if(!storageStore.checkoutSessionId){void sendErrorLog({endpoint:"COLLECT_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,landedCostRootId:n}});return[2,{partiesCreated:false}]}i=stripeStoreBuildAddressForPartyCreate({address:stripeStore.stripeBillingAddressEventData.value.address,firstName:stripeStore.stripeBillingAddressEventData.value.firstName,lastName:stripeStore.stripeBillingAddressEventData.value.lastName,name:stripeStore.stripeBillingAddressEventData.value.name,phone:stripeStore.stripeBillingAddressEventData.value.phone});l=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,handleFetch("/api/zonos-elements/create-billing-party",{body:{billingAddress:i,checkoutSessionId:storageStore.checkoutSessionId,companyName:stripeStore.companyName,email:((r=stripeStore.stripeLinkEventData)===null||r===void 0?void 0:r.value.email)||"",isTest:l,rootId:n},method:"POST"})];case 1:a=d.sent(),c=a.errors,s=a.json;if(c.length||!s){logError("Error occurs when creating billing party",JSON.stringify(c,null,2));void sendErrorLog({endpoint:"COLLECT_BILLING_PARTY_CREATE_FAILED",errors:["[COLLECT] Failed to create billing party"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,errors:c,json:s}});return[2,{partiesCreated:false}]}collectStore.partyBillingId=s.billToPartyId;return[2,{partiesCreated:true}]}}))}))};var collectStoreUpdateSelectedShippingOption=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t;return __generator(this,(function(o){t=e.landedCost;if(!t){return[2,false]}cartStore.landedCostData=[Object.assign(Object.assign({},e),{landedCost:Object.assign({},t),landedCostId:t.id})];return[2,cartStoreUpdateSelectedShippingOption({applySubtotalsOnly:true,landedCostId:t.id,selectedShippingOption:t.shipmentRating})]}))}))};var collectTabletBreakpoint=1024;var collectMobileBreakpoint=768;var isCollectTablet=function(e){return e||window.innerWidth<collectTabletBreakpoint&&window.innerWidth>=collectMobileBreakpoint};var isCollectMobile=function(e){return e||window.innerWidth<collectMobileBreakpoint};export{isCollectTablet as a,collectStoreInitShippingInfo as b,collectStoreUpdateSelectedShippingOption as c,collectStoreAsyncAddressUpdate as d,collectStore as e,isCollectMobile as i};