@zonos/elements 1.2.4-alpha.1 → 1.2.4-alpha.10

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 (282) hide show
  1. package/README.md +15 -1
  2. package/dist/cjs/{cart-4ddc2af5.js → cart-90f7c8c0.js} +36 -8
  3. package/dist/cjs/{getBorderRadius-a97a5f75.js → getBorderRadius-bf4a4276.js} +1 -1
  4. package/dist/cjs/{index-20cb112f.js → index-0dcccc22.js} +27 -16
  5. package/dist/cjs/index.cjs.js +6 -6
  6. package/dist/cjs/{isDarkColor-261fcf3d.js → isDarkColor-ff6ff183.js} +1 -1
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/cjs/{localization-11360fed.js → localization-9caf3397.js} +46 -8
  9. package/dist/cjs/{submitGtag-bb093547.js → submitGtag-b141b45d.js} +2 -2
  10. package/dist/cjs/zonos-address_2.cjs.entry.js +8 -8
  11. package/dist/cjs/zonos-badge.cjs.entry.js +3 -3
  12. package/dist/cjs/zonos-banner.cjs.entry.js +3 -3
  13. package/dist/cjs/zonos-button_2.cjs.entry.js +6 -6
  14. package/dist/cjs/zonos-card_2.cjs.entry.js +4 -4
  15. package/dist/cjs/zonos-cart-items_10.cjs.entry.js +60 -18
  16. package/dist/cjs/zonos-checkout.cjs.entry.js +10 -8
  17. package/dist/cjs/zonos-component.cjs.entry.js +2 -2
  18. package/dist/cjs/zonos-controller.cjs.entry.js +12 -12
  19. package/dist/cjs/zonos-country-flag_4.cjs.entry.js +8 -8
  20. package/dist/cjs/zonos-elements.cjs.js +3 -3
  21. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +4 -4
  22. package/dist/cjs/zonos-hello.cjs.entry.js +5 -5
  23. package/dist/cjs/zonos-icon.cjs.entry.js +3 -3
  24. package/dist/cjs/zonos-notification.cjs.entry.js +3 -3
  25. package/dist/cjs/zonos-payment.cjs.entry.js +7 -7
  26. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +4 -4
  27. package/dist/cjs/zonos-text.cjs.entry.js +3 -3
  28. package/dist/cjs/{zonosStore-a0fa5b77.js → zonosStore-b43ef5db.js} +1 -1
  29. package/dist/collection/collection-manifest.json +1 -1
  30. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.css +1 -0
  31. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.css +1 -0
  32. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.css +1 -0
  33. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +48 -2
  34. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.css +1 -0
  35. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +1 -0
  36. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +5 -2
  37. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.css +1 -0
  38. package/dist/collection/components/checkout/zonos-checkout/zonos-review/zonos-review.css +1 -0
  39. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.css +1 -0
  40. package/dist/collection/components/common/zonos-badge/zonos-badge.css +1 -0
  41. package/dist/collection/components/common/zonos-banner/zonos-banner.css +1 -0
  42. package/dist/collection/components/common/zonos-button/zonos-button.css +1 -0
  43. package/dist/collection/components/common/zonos-card/zonos-card.css +1 -0
  44. package/dist/collection/components/common/zonos-collapse/zonos-collapse.css +1 -0
  45. package/dist/collection/components/common/zonos-country-flag/zonos-country-flag.css +1 -0
  46. package/dist/collection/components/common/zonos-country-select/zonos-country-select.css +1 -0
  47. package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.css +1 -0
  48. package/dist/collection/components/common/zonos-dialog/zonos-dialog.css +1 -0
  49. package/dist/collection/components/common/zonos-icon/zonos-icon.css +1 -0
  50. package/dist/collection/components/common/zonos-logo/zonos-logo.css +1 -0
  51. package/dist/collection/components/common/zonos-notification/zonos-notification.css +1 -0
  52. package/dist/collection/components/common/zonos-notification/zonos-notification.js +3 -2
  53. package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.css +1 -0
  54. package/dist/collection/components/common/zonos-spinner/zonos-spinner.css +1 -0
  55. package/dist/collection/components/common/zonos-text/zonos-text.css +1 -0
  56. package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.css +1 -0
  57. package/dist/collection/components/component-template/zonos-component/zonos-component.css +1 -0
  58. package/dist/collection/components/hello/zonos-hello/zonos-hello.css +1 -0
  59. package/dist/collection/components/hello/zonos-hello/zonos-hello.js +9 -6
  60. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.css +1 -0
  61. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.css +1 -0
  62. package/dist/collection/components/main/zonos-controller.css +1 -0
  63. package/dist/collection/components/main/zonos-controller.js +18 -16
  64. package/dist/collection/components/store/checkout/cart.js +1 -1
  65. package/dist/collection/components/store/checkout/stripe.js +3 -2
  66. package/dist/collection/components/stripe/zonos-address/zonos-address.css +1 -0
  67. package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.css +1 -0
  68. package/dist/collection/components/stripe/zonos-payment/zonos-payment.css +1 -0
  69. package/dist/collection/components/utils/api/calculateLandedCost.js +9 -1
  70. package/dist/collection/components/utils/api/checkItemRestrictions.js +1 -1
  71. package/dist/collection/components/utils/api/getCountries.js +1 -1
  72. package/dist/collection/components/utils/api/getCountryLandedCost.js +1 -1
  73. package/dist/collection/components/utils/api/getExchangeRate.js +1 -1
  74. package/dist/collection/components/utils/api/getLocaleMessages.js +1 -1
  75. package/dist/collection/components/utils/api/getLocalization.js +1 -1
  76. package/dist/collection/components/utils/api/getShippingZones.js +1 -1
  77. package/dist/collection/components/utils/api/{getZonosSetting.js → getZonosSettings.js} +3 -3
  78. package/dist/collection/components/utils/api/triggerBuildLandedCost.js +22 -0
  79. package/dist/collection/components/utils/handleFetch.js +19 -1
  80. package/dist/collection/components/utils/logging/log.js +20 -0
  81. package/dist/collection/environment.js +11 -10
  82. package/dist/collection/scripts/zonos.js +53 -0
  83. package/dist/collection/types/generated/graphql.customer.types.js +89 -0
  84. package/dist/collection/types/generated/graphql.frontend.types.js +80 -6
  85. package/dist/components/cart.js +33 -5
  86. package/dist/components/localization.js +45 -7
  87. package/dist/components/zonos-address2.js +1 -1
  88. package/dist/components/zonos-badge2.js +1 -1
  89. package/dist/components/zonos-banner2.js +1 -1
  90. package/dist/components/zonos-button2.js +1 -1
  91. package/dist/components/zonos-card2.js +1 -1
  92. package/dist/components/zonos-cart-items2.js +1 -1
  93. package/dist/components/zonos-cart-subtotal2.js +1 -1
  94. package/dist/components/zonos-checkout-finish2.js +48 -5
  95. package/dist/components/zonos-checkout-payment2.js +1 -1
  96. package/dist/components/zonos-checkout.js +3 -1
  97. package/dist/components/zonos-collapse2.js +1 -1
  98. package/dist/components/zonos-component.js +1 -1
  99. package/dist/components/zonos-controller.js +6 -6
  100. package/dist/components/zonos-country-flag2.js +1 -1
  101. package/dist/components/zonos-country-select2.js +1 -1
  102. package/dist/components/zonos-custom-message2.js +1 -1
  103. package/dist/components/zonos-customer-info2.js +1 -1
  104. package/dist/components/zonos-dialog2.js +1 -1
  105. package/dist/components/zonos-hello-dialog-footer2.js +1 -1
  106. package/dist/components/zonos-hello-dialog2.js +1 -1
  107. package/dist/components/zonos-hello.js +2 -2
  108. package/dist/components/zonos-icon2.js +1 -1
  109. package/dist/components/zonos-link-authentication2.js +1 -1
  110. package/dist/components/zonos-logo2.js +1 -1
  111. package/dist/components/zonos-notification2.js +1 -1
  112. package/dist/components/zonos-payment2.js +1 -1
  113. package/dist/components/zonos-review2.js +1 -1
  114. package/dist/components/zonos-shipping-rich-radio2.js +1 -1
  115. package/dist/components/zonos-shipping2.js +1 -1
  116. package/dist/components/zonos-spinner2.js +1 -1
  117. package/dist/components/zonos-text2.js +1 -1
  118. package/dist/components/zonos-v-stack2.js +1 -1
  119. package/dist/esm/{cart-cd87f476.js → cart-b439be00.js} +36 -8
  120. package/dist/esm/{getBorderRadius-35e8acce.js → getBorderRadius-178a0a05.js} +1 -1
  121. package/dist/esm/{index-3617e24c.js → index-36ff6342.js} +27 -16
  122. package/dist/esm/index.js +6 -6
  123. package/dist/esm/{isDarkColor-44e9e451.js → isDarkColor-416d6047.js} +1 -1
  124. package/dist/esm/loader.js +3 -3
  125. package/dist/esm/{localization-f573428e.js → localization-a51ccbc2.js} +46 -8
  126. package/dist/esm/{submitGtag-75af52be.js → submitGtag-521826a2.js} +2 -2
  127. package/dist/esm/zonos-address_2.entry.js +8 -8
  128. package/dist/esm/zonos-badge.entry.js +3 -3
  129. package/dist/esm/zonos-banner.entry.js +3 -3
  130. package/dist/esm/zonos-button_2.entry.js +6 -6
  131. package/dist/esm/zonos-card_2.entry.js +4 -4
  132. package/dist/esm/zonos-cart-items_10.entry.js +60 -18
  133. package/dist/esm/zonos-checkout.entry.js +10 -8
  134. package/dist/esm/zonos-component.entry.js +2 -2
  135. package/dist/esm/zonos-controller.entry.js +12 -12
  136. package/dist/esm/zonos-country-flag_4.entry.js +8 -8
  137. package/dist/esm/zonos-elements.js +4 -4
  138. package/dist/esm/zonos-hello-dialog.entry.js +4 -4
  139. package/dist/esm/zonos-hello.entry.js +5 -5
  140. package/dist/esm/zonos-icon.entry.js +3 -3
  141. package/dist/esm/zonos-notification.entry.js +3 -3
  142. package/dist/esm/zonos-payment.entry.js +7 -7
  143. package/dist/esm/zonos-shipping-rich-radio.entry.js +4 -4
  144. package/dist/esm/zonos-text.entry.js +3 -3
  145. package/dist/esm/{zonosStore-e0b7a5cf.js → zonosStore-61e74f58.js} +1 -1
  146. package/dist/esm-es5/cart-b439be00.js +1 -0
  147. package/dist/esm-es5/{getBorderRadius-35e8acce.js → getBorderRadius-178a0a05.js} +1 -1
  148. package/dist/esm-es5/index-36ff6342.js +2 -0
  149. package/dist/esm-es5/index.js +1 -1
  150. package/dist/esm-es5/{isDarkColor-44e9e451.js → isDarkColor-416d6047.js} +1 -1
  151. package/dist/esm-es5/loader.js +1 -1
  152. package/dist/esm-es5/{localization-f573428e.js → localization-a51ccbc2.js} +1 -1
  153. package/dist/esm-es5/{submitGtag-75af52be.js → submitGtag-521826a2.js} +1 -1
  154. package/dist/esm-es5/zonos-address_2.entry.js +1 -1
  155. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  156. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  157. package/dist/esm-es5/zonos-button_2.entry.js +1 -1
  158. package/dist/esm-es5/zonos-card_2.entry.js +1 -1
  159. package/dist/esm-es5/zonos-cart-items_10.entry.js +1 -1
  160. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  161. package/dist/esm-es5/zonos-component.entry.js +1 -1
  162. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  163. package/dist/esm-es5/zonos-country-flag_4.entry.js +1 -1
  164. package/dist/esm-es5/zonos-elements.js +1 -1
  165. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  166. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  167. package/dist/esm-es5/zonos-icon.entry.js +1 -1
  168. package/dist/esm-es5/zonos-notification.entry.js +1 -1
  169. package/dist/esm-es5/zonos-payment.entry.js +1 -1
  170. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  171. package/dist/esm-es5/zonos-text.entry.js +1 -1
  172. package/dist/esm-es5/{zonosStore-e0b7a5cf.js → zonosStore-61e74f58.js} +1 -1
  173. package/dist/scripts/loadZonos.js +76 -3
  174. package/dist/scripts/zonos.js +76 -3
  175. package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +5 -1
  176. package/dist/types/components/store/checkout/stripe.d.ts +1 -0
  177. package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
  178. package/dist/types/components/utils/api/{getZonosSetting.d.ts → getZonosSettings.d.ts} +1 -1
  179. package/dist/types/components/utils/api/triggerBuildLandedCost.d.ts +5 -0
  180. package/dist/types/components/utils/changeDeepProperty.d.ts +1 -1
  181. package/dist/types/components/utils/changeDeepPropertyAtIndex.d.ts +1 -1
  182. package/dist/types/scripts/zonos.d.ts +1 -0
  183. package/dist/types/types/checkout/CheckoutConfig.d.ts +3 -1
  184. package/dist/types/types/generated/graphql.customer.types.d.ts +254 -7
  185. package/dist/types/types/generated/graphql.customer.types.ts +310 -7
  186. package/dist/types/types/generated/graphql.frontend.types.d.ts +210 -11
  187. package/dist/types/types/generated/graphql.frontend.types.ts +358 -11
  188. package/dist/types/types/global.d.ts +12 -0
  189. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  190. package/dist/zonos-elements/index.esm.js +1 -1
  191. package/dist/zonos-elements/p-06fb9d1f.system.entry.js +1 -0
  192. package/dist/zonos-elements/{p-77a7929b.js → p-089ba905.js} +1 -1
  193. package/dist/zonos-elements/{p-39a5e8e0.js → p-1685c8df.js} +1 -1
  194. package/dist/zonos-elements/p-18904b7c.system.js +2 -0
  195. package/dist/zonos-elements/p-1d4a970b.entry.js +1 -0
  196. package/dist/zonos-elements/{p-80ba24a8.system.js → p-24eed2a8.system.js} +1 -1
  197. package/dist/zonos-elements/{p-bec21999.system.js → p-24fbe845.system.js} +1 -1
  198. package/dist/zonos-elements/p-2801d868.entry.js +1 -0
  199. package/dist/zonos-elements/p-2a307c55.system.entry.js +1 -0
  200. package/dist/zonos-elements/p-2f43da39.system.entry.js +1 -0
  201. package/dist/zonos-elements/{p-1f8b684a.js → p-3c6988d7.js} +1 -1
  202. package/dist/zonos-elements/p-3cea383b.system.entry.js +1 -0
  203. package/dist/zonos-elements/p-47390db7.system.entry.js +1 -0
  204. package/dist/zonos-elements/p-4846796a.js +1 -0
  205. package/dist/zonos-elements/p-494c77a7.entry.js +1 -0
  206. package/dist/zonos-elements/p-49f09b91.entry.js +1 -0
  207. package/dist/zonos-elements/p-4a15c5c7.system.entry.js +1 -0
  208. package/dist/zonos-elements/p-4bee0bff.system.entry.js +1 -0
  209. package/dist/zonos-elements/p-4d93275c.entry.js +1 -0
  210. package/dist/zonos-elements/p-4ed71bd7.entry.js +1 -0
  211. package/dist/zonos-elements/{p-8bbad467.js → p-55f49f1e.js} +1 -1
  212. package/dist/zonos-elements/p-560aa686.system.entry.js +1 -0
  213. package/dist/zonos-elements/p-639396bb.entry.js +1 -0
  214. package/dist/zonos-elements/p-67154df2.system.entry.js +1 -0
  215. package/dist/zonos-elements/p-67aec665.entry.js +1 -0
  216. package/dist/zonos-elements/p-684ed483.entry.js +1 -0
  217. package/dist/zonos-elements/p-89c210d6.entry.js +1 -0
  218. package/dist/zonos-elements/{p-0175125e.system.js → p-8c48b75e.system.js} +1 -1
  219. package/dist/zonos-elements/p-8c5595d9.system.entry.js +1 -0
  220. package/dist/zonos-elements/p-938803f4.entry.js +1 -0
  221. package/dist/zonos-elements/p-956efa27.js +2 -0
  222. package/dist/zonos-elements/{p-e694312d.entry.js → p-a0e36ed3.entry.js} +1 -1
  223. package/dist/zonos-elements/p-a376a37f.entry.js +1 -0
  224. package/dist/zonos-elements/{p-534dcbd4.system.js → p-a504f64f.system.js} +1 -1
  225. package/dist/zonos-elements/p-afe26069.entry.js +1 -0
  226. package/dist/zonos-elements/p-b4601210.system.entry.js +1 -0
  227. package/dist/zonos-elements/{p-779621e4.system.js → p-b51de536.system.js} +1 -1
  228. package/dist/zonos-elements/p-b6148206.entry.js +1 -0
  229. package/dist/zonos-elements/{p-643eeb24.system.js → p-b85be1ab.system.js} +1 -1
  230. package/dist/zonos-elements/p-c9348bb0.system.entry.js +1 -0
  231. package/dist/zonos-elements/p-d2217f09.system.js +1 -0
  232. package/dist/zonos-elements/p-d856a200.system.entry.js +1 -0
  233. package/dist/zonos-elements/{p-754bdfdb.system.js → p-da060b1c.system.js} +1 -1
  234. package/dist/zonos-elements/{p-08298e74.entry.js → p-e1f6ab97.entry.js} +1 -1
  235. package/dist/zonos-elements/p-e5ae22a9.system.entry.js +1 -0
  236. package/dist/zonos-elements/p-e98be2d0.system.entry.js +1 -0
  237. package/dist/zonos-elements/p-e9b832c5.entry.js +1 -0
  238. package/dist/zonos-elements/p-f141519c.system.entry.js +1 -0
  239. package/dist/zonos-elements/p-f367f2fe.system.entry.js +1 -0
  240. package/dist/zonos-elements/p-ff95f098.js +1 -0
  241. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  242. package/dist/zonos-elements/zonos-elements.js +1 -1
  243. package/package.json +7 -6
  244. package/dist/esm-es5/cart-cd87f476.js +0 -1
  245. package/dist/esm-es5/index-3617e24c.js +0 -2
  246. package/dist/zonos-elements/p-03923a86.system.entry.js +0 -1
  247. package/dist/zonos-elements/p-1bddc7ca.system.entry.js +0 -1
  248. package/dist/zonos-elements/p-2228b050.entry.js +0 -1
  249. package/dist/zonos-elements/p-2466df77.entry.js +0 -1
  250. package/dist/zonos-elements/p-29b993c2.system.entry.js +0 -1
  251. package/dist/zonos-elements/p-2a32dc0a.system.entry.js +0 -1
  252. package/dist/zonos-elements/p-2a666084.entry.js +0 -1
  253. package/dist/zonos-elements/p-2f1e9192.system.entry.js +0 -1
  254. package/dist/zonos-elements/p-44ddebe4.system.entry.js +0 -1
  255. package/dist/zonos-elements/p-4e8b5d86.system.entry.js +0 -1
  256. package/dist/zonos-elements/p-5a41b5fd.entry.js +0 -1
  257. package/dist/zonos-elements/p-5d0eceaa.entry.js +0 -1
  258. package/dist/zonos-elements/p-62ccb686.entry.js +0 -1
  259. package/dist/zonos-elements/p-660a588b.entry.js +0 -1
  260. package/dist/zonos-elements/p-6affe5cc.entry.js +0 -1
  261. package/dist/zonos-elements/p-72ea628d.system.js +0 -1
  262. package/dist/zonos-elements/p-7a15d841.entry.js +0 -1
  263. package/dist/zonos-elements/p-7a81ccb5.system.entry.js +0 -1
  264. package/dist/zonos-elements/p-83d100b8.entry.js +0 -1
  265. package/dist/zonos-elements/p-8ebc3ca5.system.entry.js +0 -1
  266. package/dist/zonos-elements/p-9c78d0ca.entry.js +0 -1
  267. package/dist/zonos-elements/p-9ef86de7.entry.js +0 -1
  268. package/dist/zonos-elements/p-ab46cee9.system.entry.js +0 -1
  269. package/dist/zonos-elements/p-b0268bc5.entry.js +0 -1
  270. package/dist/zonos-elements/p-b4db1620.entry.js +0 -1
  271. package/dist/zonos-elements/p-bec05c21.system.js +0 -2
  272. package/dist/zonos-elements/p-c299049e.js +0 -1
  273. package/dist/zonos-elements/p-cd4f8e13.system.entry.js +0 -1
  274. package/dist/zonos-elements/p-ceb2cd7b.system.entry.js +0 -1
  275. package/dist/zonos-elements/p-cf4545ed.system.entry.js +0 -1
  276. package/dist/zonos-elements/p-cf8aaa17.js +0 -2
  277. package/dist/zonos-elements/p-dc9b318c.system.entry.js +0 -1
  278. package/dist/zonos-elements/p-dcf64928.system.entry.js +0 -1
  279. package/dist/zonos-elements/p-e1de2a1f.js +0 -1
  280. package/dist/zonos-elements/p-ec26fe57.entry.js +0 -1
  281. package/dist/zonos-elements/p-f8198015.system.entry.js +0 -1
  282. package/dist/zonos-elements/p-fcd4fc66.system.entry.js +0 -1
@@ -1,6 +1,7 @@
1
1
  :host {
2
2
  font-family: var(--font-family, Inter), Inter;
3
3
  display: block;
4
+ white-space: normal;
4
5
  }
5
6
  :host * {
6
7
  font-family: var(--font-family, Inter), Inter;
@@ -1,6 +1,7 @@
1
1
  :host {
2
2
  font-family: var(--font-family, Inter), Inter;
3
3
  display: block;
4
+ white-space: normal;
4
5
  }
5
6
  :host * {
6
7
  font-family: var(--font-family, Inter), Inter;
@@ -1,6 +1,7 @@
1
1
  :host {
2
2
  font-family: var(--font-family, Inter), Inter;
3
3
  display: block;
4
+ white-space: normal;
4
5
  }
5
6
  :host * {
6
7
  font-family: var(--font-family, Inter), Inter;
@@ -1,6 +1,7 @@
1
1
  :host {
2
2
  font-family: var(--font-family, Inter), Inter;
3
3
  display: block;
4
+ white-space: normal;
4
5
  }
5
6
  :host * {
6
7
  font-family: var(--font-family, Inter), Inter;
@@ -1,6 +1,7 @@
1
1
  :host {
2
2
  font-family: var(--font-family, Inter), Inter;
3
3
  display: block;
4
+ white-space: normal;
4
5
  }
5
6
  :host * {
6
7
  font-family: var(--font-family, Inter), Inter;
@@ -1,6 +1,7 @@
1
1
  :host {
2
2
  font-family: var(--font-family, Inter), Inter;
3
3
  display: block;
4
+ white-space: normal;
4
5
  }
5
6
  :host * {
6
7
  font-family: var(--font-family, Inter), Inter;
@@ -396,8 +396,9 @@ export class ZonosHello {
396
396
  "complexType": {
397
397
  "signature": "(value: number) => Promise<void>",
398
398
  "parameters": [{
399
- "tags": [],
400
- "text": ""
399
+ "name": "value",
400
+ "type": "number",
401
+ "docs": ""
401
402
  }],
402
403
  "references": {
403
404
  "Promise": {
@@ -419,8 +420,9 @@ export class ZonosHello {
419
420
  "complexType": {
420
421
  "signature": "(value: number) => Promise<void>",
421
422
  "parameters": [{
422
- "tags": [],
423
- "text": ""
423
+ "name": "value",
424
+ "type": "number",
425
+ "docs": ""
424
426
  }],
425
427
  "references": {
426
428
  "Promise": {
@@ -442,8 +444,9 @@ export class ZonosHello {
442
444
  "complexType": {
443
445
  "signature": "(value: number) => Promise<void>",
444
446
  "parameters": [{
445
- "tags": [],
446
- "text": ""
447
+ "name": "value",
448
+ "type": "number",
449
+ "docs": ""
447
450
  }],
448
451
  "references": {
449
452
  "Promise": {
@@ -1,6 +1,7 @@
1
1
  :host {
2
2
  font-family: var(--font-family, Inter), Inter;
3
3
  display: block;
4
+ white-space: normal;
4
5
  }
5
6
  :host * {
6
7
  font-family: var(--font-family, Inter), Inter;
@@ -1,6 +1,7 @@
1
1
  :host {
2
2
  font-family: var(--font-family, Inter), Inter;
3
3
  display: block;
4
+ white-space: normal;
4
5
  }
5
6
  :host * {
6
7
  font-family: var(--font-family, Inter), Inter;
@@ -1,6 +1,7 @@
1
1
  :host {
2
2
  font-family: var(--font-family, Inter), Inter;
3
3
  display: block;
4
+ white-space: normal;
4
5
  }
5
6
  :host * {
6
7
  font-family: var(--font-family, Inter), Inter;
@@ -2,7 +2,7 @@ import { h, Host, } from "@stencil/core";
2
2
  import { stripeStore } from "../store/checkout/stripe";
3
3
  import { initLocalizationStore, localizationStoreUpdateSelectedCountryCode, } from "../store/hello/localization";
4
4
  import { zonosStore, zonosStoreFontFamily, zonosStoreInitSetting, } from "../store/zonosStore";
5
- import { getZonosSetting } from "../utils/api/getZonosSetting";
5
+ import { getZonosSettings } from "../utils/api/getZonosSettings";
6
6
  import { initCheckout } from "../utils/checkout/initCheckout";
7
7
  import { handleFetch } from "../utils/handleFetch";
8
8
  import { initHello } from "../utils/hello/initHello";
@@ -94,7 +94,7 @@ export class ZonosController {
94
94
  zonosStore.appearance = Object.assign(Object.assign({}, zonosStore.appearance), { fontFamily: overrideFont });
95
95
  }
96
96
  const routeUrl = process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL;
97
- const { errors, json } = await handleFetch(`${routeUrl}/api/get-font-detail?family=${fontSelected}`);
97
+ const { errors, json } = await handleFetch(`${routeUrl}/api/zonos-elements/get-font-detail?family=${fontSelected}`);
98
98
  if (errors.length > 0 || !json) {
99
99
  log(`Failed to load font ${fontSelected}`, 'warn');
100
100
  return;
@@ -113,7 +113,7 @@ export class ZonosController {
113
113
  // running with scope async function to avoid blocking the main thread
114
114
  (async () => {
115
115
  var _a, _b;
116
- const { errors, json } = await getZonosSetting();
116
+ const { errors, json } = await getZonosSettings();
117
117
  if (((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.type.toString()) === '403') {
118
118
  log('Failed to load zonos settings. This domain may not have access', 'warn');
119
119
  return;
@@ -273,8 +273,9 @@ export class ZonosController {
273
273
  "complexType": {
274
274
  "signature": "(stripe: Stripe) => Promise<void>",
275
275
  "parameters": [{
276
- "tags": [],
277
- "text": ""
276
+ "name": "stripe",
277
+ "type": "Stripe",
278
+ "docs": ""
278
279
  }],
279
280
  "references": {
280
281
  "Promise": {
@@ -298,8 +299,9 @@ export class ZonosController {
298
299
  "complexType": {
299
300
  "signature": "(overrideFont?: string) => Promise<void>",
300
301
  "parameters": [{
301
- "tags": [],
302
- "text": ""
302
+ "name": "overrideFont",
303
+ "type": "string | undefined",
304
+ "docs": ""
303
305
  }],
304
306
  "references": {
305
307
  "Promise": {
@@ -318,8 +320,9 @@ export class ZonosController {
318
320
  "complexType": {
319
321
  "signature": "(notification: NotificationInit) => Promise<void>",
320
322
  "parameters": [{
321
- "tags": [],
322
- "text": ""
323
+ "name": "notification",
324
+ "type": "{ message: string; timeout?: number | undefined; type?: \"error\" | \"success\" | \"warning\" | undefined; }",
325
+ "docs": ""
323
326
  }],
324
327
  "references": {
325
328
  "Promise": {
@@ -343,11 +346,9 @@ export class ZonosController {
343
346
  "complexType": {
344
347
  "signature": "(config: LoadZonosParamsConfig) => Promise<void>",
345
348
  "parameters": [{
346
- "tags": [{
347
- "name": "param",
348
- "text": "config config that need to override the default setting"
349
- }],
350
- "text": "config that need to override the default setting"
349
+ "name": "config",
350
+ "type": "{ appearance?: Partial<AppearanceConfig> | undefined; checkoutSettings?: Partial<CheckoutConfig> | undefined; currencyConverter?: CurrencyConverter | undefined; helloSettings?: Partial<HelloConfig> | undefined; onlineStoreSettings?: Partial<OnlineStoreConfig> | undefined; }",
351
+ "docs": "config that need to override the default setting"
351
352
  }],
352
353
  "references": {
353
354
  "Promise": {
@@ -374,8 +375,9 @@ export class ZonosController {
374
375
  "complexType": {
375
376
  "signature": "(countryCode: CountryCode) => Promise<void>",
376
377
  "parameters": [{
377
- "tags": [],
378
- "text": ""
378
+ "name": "countryCode",
379
+ "type": "\"CI\" | \"AD\" | \"AE\" | \"AF\" | \"AG\" | \"AI\" | \"AL\" | \"AM\" | \"AO\" | \"AQ\" | \"AR\" | \"AS\" | \"AT\" | \"AU\" | \"AW\" | \"AX\" | \"AZ\" | \"BA\" | \"BB\" | \"BD\" | \"BE\" | \"BF\" | \"BG\" | \"BH\" | \"BI\" | \"BJ\" | \"BL\" | \"BM\" | \"BN\" | \"BO\" | \"BQ\" | \"BR\" | \"BS\" | \"BT\" | \"BV\" | \"BW\" | \"BY\" | \"BZ\" | \"CA\" | \"CC\" | \"CD\" | \"CF\" | \"CG\" | \"CH\" | \"CK\" | \"CL\" | \"CM\" | \"CN\" | \"CO\" | \"CR\" | \"CU\" | \"CV\" | \"CW\" | \"CX\" | \"CY\" | \"CZ\" | \"DE\" | \"DJ\" | \"DK\" | \"DM\" | \"DO\" | \"DZ\" | \"EC\" | \"EE\" | \"EG\" | \"EH\" | \"ER\" | \"ES\" | \"ET\" | \"FI\" | \"FJ\" | \"FK\" | \"FM\" | \"FO\" | \"FR\" | \"GA\" | \"GB\" | \"GD\" | \"GE\" | \"GF\" | \"GG\" | \"GH\" | \"GI\" | \"GL\" | \"GM\" | \"GN\" | \"GP\" | \"GQ\" | \"GR\" | \"GS\" | \"GT\" | \"GU\" | \"GW\" | \"GY\" | \"HK\" | \"HM\" | \"HN\" | \"HR\" | \"HT\" | \"HU\" | \"IC\" | \"ID\" | \"IE\" | \"IL\" | \"IM\" | \"IN\" | \"IO\" | \"IQ\" | \"IR\" | \"IS\" | \"IT\" | \"JE\" | \"JM\" | \"JO\" | \"JP\" | \"KE\" | \"KG\" | \"KH\" | \"KI\" | \"KM\" | \"KN\" | \"KP\" | \"KR\" | \"KW\" | \"KY\" | \"KZ\" | \"LA\" | \"LB\" | \"LC\" | \"LI\" | \"LK\" | \"LR\" | \"LS\" | \"LT\" | \"LU\" | \"LV\" | \"LY\" | \"MA\" | \"MC\" | \"MD\" | \"ME\" | \"MF\" | \"MG\" | \"MH\" | \"MK\" | \"ML\" | \"MM\" | \"MN\" | \"MO\" | \"MP\" | \"MQ\" | \"MR\" | \"MS\" | \"MT\" | \"MU\" | \"MV\" | \"MW\" | \"MX\" | \"MY\" | \"MZ\" | \"NA\" | \"NC\" | \"NE\" | \"NF\" | \"NG\" | \"NI\" | \"NL\" | \"NO\" | \"NP\" | \"NR\" | \"NU\" | \"NZ\" | \"OM\" | \"PA\" | \"PE\" | \"PF\" | \"PG\" | \"PH\" | \"PK\" | \"PL\" | \"PM\" | \"PN\" | \"PR\" | \"PS\" | \"PT\" | \"PW\" | \"PY\" | \"QA\" | \"RE\" | \"RO\" | \"RS\" | \"RU\" | \"RW\" | \"SA\" | \"SB\" | \"SC\" | \"SD\" | \"SE\" | \"SG\" | \"SH\" | \"SI\" | \"SJ\" | \"SK\" | \"SL\" | \"SM\" | \"SN\" | \"SO\" | \"SR\" | \"SS\" | \"ST\" | \"SV\" | \"SX\" | \"SY\" | \"SZ\" | \"TC\" | \"TD\" | \"TF\" | \"TG\" | \"TH\" | \"TJ\" | \"TK\" | \"TL\" | \"TM\" | \"TN\" | \"TO\" | \"TR\" | \"TT\" | \"TV\" | \"TW\" | \"TZ\" | \"UA\" | \"UG\" | \"UM\" | \"US\" | \"UY\" | \"UZ\" | \"VA\" | \"VC\" | \"VE\" | \"VG\" | \"VI\" | \"VN\" | \"VU\" | \"WF\" | \"WS\" | \"YE\" | \"YT\" | \"ZA\" | \"ZM\" | \"ZW\"",
380
+ "docs": ""
379
381
  }],
380
382
  "references": {
381
383
  "Promise": {
@@ -80,7 +80,7 @@ const cartStoreReCalculateTotal = async ({ currency, itemsAmount, landedCostId,
80
80
  }
81
81
  // update checkout session
82
82
  if (!cartStore.checkoutSessionId) {
83
- logError('Could update cart total without checkout session id');
83
+ logError('Could not update cart total without checkout session id');
84
84
  return false;
85
85
  }
86
86
  const { json } = await stripeStoreUpdateCheckoutSession({
@@ -19,6 +19,7 @@ const { onChange, reset, state: stripeStore, } = createStore(() => ({
19
19
  stripeAddressElement: null,
20
20
  stripeAddressEventData: null,
21
21
  stripeAddressUsedWhenFetchingLC: null,
22
+ stripeBillingAddressElement: null,
22
23
  stripeElements: null,
23
24
  stripeElementsOptions: null,
24
25
  stripeLinkElement: null,
@@ -264,7 +265,7 @@ const stripeStoreInitCheckoutSession = async () => {
264
265
  return false;
265
266
  }
266
267
  stripeStore.isFetchingSession = true;
267
- const { errors, json } = await handleFetch(`${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/create-checkout-session`, {
268
+ const { errors, json } = await handleFetch(`${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/zonos-elements/create-checkout-session`, {
268
269
  body: {
269
270
  currency: ((_a = cartStore.items.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode) || '',
270
271
  itemsAmount: total,
@@ -292,7 +293,7 @@ const stripeStoreInitCheckoutSession = async () => {
292
293
  const stripeStoreUpdateCheckoutSession = async ({ currency, id, itemsAmount, landedCostId, presentmentCountryCode, }) => {
293
294
  // No need to set loading state here because this function will be called under the hood to update
294
295
  // landed cost id for the section.
295
- const { errors, json } = await handleFetch(`${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/update-checkout-session`, {
296
+ const { errors, json } = await handleFetch(`${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/zonos-elements/update-checkout-session`, {
296
297
  body: {
297
298
  currency,
298
299
  id,
@@ -1,6 +1,7 @@
1
1
  :host {
2
2
  font-family: var(--font-family, Inter), Inter;
3
3
  display: block;
4
+ white-space: normal;
4
5
  }
5
6
  :host * {
6
7
  font-family: var(--font-family, Inter), Inter;
@@ -1,6 +1,7 @@
1
1
  :host {
2
2
  font-family: var(--font-family, Inter), Inter;
3
3
  display: block;
4
+ white-space: normal;
4
5
  }
5
6
  :host * {
6
7
  font-family: var(--font-family, Inter), Inter;
@@ -1,6 +1,7 @@
1
1
  :host {
2
2
  font-family: var(--font-family, Inter), Inter;
3
3
  display: block;
4
+ white-space: normal;
4
5
  }
5
6
  :host * {
6
7
  font-family: var(--font-family, Inter), Inter;
@@ -1,8 +1,16 @@
1
+ import { zonosStore } from "../../store/zonosStore";
1
2
  import { prepCalculateLandedCost } from "./prepCalculateLandedCost";
3
+ import { triggerBuildLandedCost } from "./triggerBuildLandedCost";
2
4
  import { handleFetch } from "../handleFetch";
3
5
  export const calculateLandedCost = async (abortController) => {
6
+ // If buildLandedCost callback is supplied, use that instead of our regular request to '/calculate-landed-cost'
7
+ const buildLandedCost = zonosStore.checkoutSettings.buildLandedCost;
8
+ if (buildLandedCost) {
9
+ const json = await triggerBuildLandedCost(buildLandedCost);
10
+ return json;
11
+ }
4
12
  // request to get landed cost info
5
- const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/calculate-landed-cost`;
13
+ const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/zonos-elements/calculate-landed-cost`;
6
14
  const { errors, json } = await handleFetch(url, {
7
15
  body: prepCalculateLandedCost(),
8
16
  method: 'POST',
@@ -2,7 +2,7 @@ import { handleFetch } from "../handleFetch";
2
2
  import { logError } from "../logging/logError";
3
3
  export const checkItemRestrictions = async ({ items, shipFrom, shipTo, }) => {
4
4
  var _a;
5
- const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/check-item-restrictions`;
5
+ const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/zonos-elements/check-item-restrictions`;
6
6
  const body = {
7
7
  items,
8
8
  shipFrom,
@@ -1,7 +1,7 @@
1
1
  import { handleFetch } from "../handleFetch";
2
2
  export const getCountries = async () => {
3
3
  try {
4
- const { errors, json } = await handleFetch(`${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/get-countries`, {
4
+ const { errors, json } = await handleFetch(`${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/zonos-elements/get-countries`, {
5
5
  method: 'GET',
6
6
  });
7
7
  if (errors.length || !json) {
@@ -5,7 +5,7 @@ export const getCountryLandedCost = async (countryCode) => {
5
5
  if (!countryCode) {
6
6
  return null;
7
7
  }
8
- const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/country-landed-cost/${countryCode}`;
8
+ const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/zonos-elements/country-landed-cost/${countryCode}`;
9
9
  const { errors, json } = await handleFetch(url);
10
10
  if (errors.length || !json) {
11
11
  logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
@@ -6,7 +6,7 @@ export const getExchangeRate = async ({ country, isGuaranteed, sourceCurrency, t
6
6
  if (sourceCurrency === targetCurrency && !isGuaranteed) {
7
7
  return { exchangeRate: null, maxAge: null };
8
8
  }
9
- const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/exchange-rates?sourceCurrency=${sourceCurrency}&targetCurrency=${targetCurrency}&isGuaranteed=${isGuaranteed}&country=${country}}`;
9
+ const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/zonos-elements/exchange-rates?sourceCurrency=${sourceCurrency}&targetCurrency=${targetCurrency}&isGuaranteed=${isGuaranteed}&country=${country}`;
10
10
  const { errors, json } = await handleFetch(url);
11
11
  if (errors.length || !json) {
12
12
  logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
@@ -1,7 +1,7 @@
1
1
  import { handleFetch } from "../handleFetch";
2
2
  export const getLocaleMessages = async ({ countryCode, localeTo, storeId, }) => {
3
3
  var _a;
4
- const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/locale-messages?countryCode=${countryCode}&storeId=${storeId}&localeTo=${localeTo}`;
4
+ const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/zonos-elements/locale-messages?countryCode=${countryCode}&storeId=${storeId}&localeTo=${localeTo}`;
5
5
  const { errors, json } = await handleFetch(url);
6
6
  if (errors.length || !json) {
7
7
  // eslint-disable-next-line no-console
@@ -6,7 +6,7 @@ export const getLocalization = async () => {
6
6
  // load and use country from session storage when zCountry query param is not present
7
7
  const countryLoadedSession = window.sessionStorage.getItem('zonos--country');
8
8
  const zCountry = getZCountryUrlParam(currentUrl.searchParams) || countryLoadedSession;
9
- const localizationUrl = new URL(`${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/localization`);
9
+ const localizationUrl = new URL(`${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/zonos-elements/localization`);
10
10
  if (zCountry) {
11
11
  localizationUrl.searchParams.set('zCountry', zCountry);
12
12
  }
@@ -2,7 +2,7 @@ import { handleFetch } from "../handleFetch";
2
2
  import { logError } from "../logging/logError";
3
3
  export const getShippingZones = async () => {
4
4
  var _a, _b;
5
- const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/shipping-zones`;
5
+ const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/zonos-elements/shipping-zones`;
6
6
  const { errors, json } = await handleFetch(url);
7
7
  if (errors.length || !json) {
8
8
  logError(`Error fetching shipping zones: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
@@ -1,10 +1,10 @@
1
1
  import { handleFetch } from "../handleFetch";
2
2
  import { logError } from "../logging/logError";
3
- export const getZonosSetting = async () => {
4
- const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/zonos-setting`;
3
+ export const getZonosSettings = async () => {
4
+ const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/zonos-elements/zonos-settings`;
5
5
  const { errors, json } = await handleFetch(url);
6
6
  if (errors.length) {
7
- logError(`Error occurs when getting zonos settings. If this is not an unauthorized error, it will use user setting or default setting`);
7
+ logError(`Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings`);
8
8
  return { errors, json: null };
9
9
  }
10
10
  return { errors: [], json };
@@ -0,0 +1,22 @@
1
+ import { prepCalculateLandedCost } from "./prepCalculateLandedCost";
2
+ import { handleFetch } from "../handleFetch";
3
+ export const triggerBuildLandedCost = async (buildLandedCost) => {
4
+ var _a;
5
+ const data = prepCalculateLandedCost();
6
+ const landedCost = await buildLandedCost(data.checkoutSessionId, data.contact, data.shippingAddress);
7
+ if (!landedCost) {
8
+ throw new Error('Failed to build landed cost');
9
+ }
10
+ // Validate the landed cost object to make sure the returned value from buildLandedCost has a valid schema
11
+ const { errors, json } = await handleFetch(`${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/zonos-elements/validate-landed-cost`, {
12
+ body: landedCost,
13
+ headers: {
14
+ 'Content-Type': 'application/json',
15
+ },
16
+ method: 'POST',
17
+ });
18
+ if (!json || errors.length) {
19
+ throw new Error(`Invalid landed cost object: ${((_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message) || 'Unknown error'}`);
20
+ }
21
+ return landedCost;
22
+ };
@@ -88,13 +88,31 @@ const handleRequest = async (url, options) => {
88
88
  };
89
89
  }
90
90
  };
91
+ function encodeString(text) {
92
+ try {
93
+ // encode the string, remove the "=" at the end of the encoded string
94
+ const encodedString = btoa(text).replace(/=/g, '');
95
+ return encodedString;
96
+ }
97
+ catch (error) {
98
+ // return the reverse string if the encoding failed
99
+ return text
100
+ .replace(/[^A-Za-z0-9]/g, '')
101
+ .split('')
102
+ .reverse()
103
+ .join('');
104
+ }
105
+ }
91
106
  export const handleFetch = async (url, _opts) => {
92
107
  const opts = __rest(_opts || {}, []);
93
108
  const body = opts.body ? JSON.stringify(opts.body) : undefined;
94
109
  const method = opts.method || 'GET';
110
+ // adding credentialtoken to the url so that the request will be cached differently for each store
111
+ const modifiedUrl = new URL(url);
112
+ modifiedUrl.searchParams.set('zToken', encodeString(window.location.hostname));
95
113
  // headers content type
96
114
  const headers = Object.assign({ 'Content-Type': 'application/json', 'Zonos-Is-BigCommerce': window.Zonos.isBigCommerce.toString(), 'Zonos-Referer': window.location.hostname, 'Zonos-Version': window.Zonos.version, credentialtoken: window.Zonos.zonosApiKey }, opts.headers);
97
115
  const options = Object.assign(Object.assign({}, opts), { body: method === 'GET' ? undefined : body, headers,
98
116
  method });
99
- return handleRequest(url, options);
117
+ return handleRequest(modifiedUrl.toString(), options);
100
118
  };
@@ -1,8 +1,28 @@
1
1
  export const log = (message, type, ...additionalInfo) => {
2
+ var _a;
2
3
  // if type is error and debug is false, do not log
3
4
  if (!window.Zonos.debug) {
4
5
  return;
5
6
  }
7
+ let loggingIframe = document.querySelector('iframe#zonos---debug-logging-iframe');
8
+ if (!loggingIframe) {
9
+ // add a hidden iframe
10
+ loggingIframe = document.createElement('iframe');
11
+ loggingIframe.id = 'zonos---debug-logging-iframe';
12
+ loggingIframe.style.display = 'none';
13
+ loggingIframe.style.opacity = '0';
14
+ loggingIframe.style.position = 'absolute';
15
+ loggingIframe.style.top = '-9999px';
16
+ loggingIframe.style.left = '-9999px';
17
+ loggingIframe.style.width = '1px';
18
+ loggingIframe.style.height = '1px';
19
+ loggingIframe.style.border = 'none';
20
+ loggingIframe.style.overflow = 'hidden';
21
+ loggingIframe.style.visibility = 'hidden';
22
+ document.body.appendChild(loggingIframe);
23
+ }
24
+ // use the logging iframe's console to log just in case the console is disabled (overriden) by the site owner
25
+ const console = ((_a = loggingIframe.contentWindow) === null || _a === void 0 ? void 0 : _a.window.console) || window.console;
6
26
  switch (type) {
7
27
  case 'warn':
8
28
  // eslint-disable-next-line no-console
@@ -36,11 +36,19 @@ export const formattedUrl = ({ branchName, inCI: _inCI, inVercel: _inVercel, isV
36
36
  // url: zonos-elements-serverless-git-something
37
37
  domainOnlyUrl.includes('serverless-git');
38
38
  if (branchName === 'qa' && isServerless) {
39
- // qa branch for the API is not versioned, should always use the latest version
40
- return `https://${domainOnlyUrl}`;
39
+ // qa branch for the API is not versioned, should always has alpha prefix
40
+ return `https://alpha.${domainOnlyUrl}`;
41
41
  }
42
- // only run this in Vercel (not production and alpha/qa branch)
42
+ const isTest =
43
+ // url: test.js.zonos.com
44
+ domainOnlyUrl.includes('test.') ||
45
+ // url: zonos-elements-test-git-something
46
+ domainOnlyUrl.includes('test-git') ||
47
+ // url: something.preview.js.zonos.com (this is only applicable on preview deployment of `zonos-elements` and `zonos-elements-test`)
48
+ domainOnlyUrl.includes('preview.js.zonos.com');
49
+ // always use vercel url if in vercel env, non-production branch (not qa or main branch) or the domain using is a test url
43
50
  if ((_isVercelPreview && !isProdBranch) ||
51
+ isTest ||
44
52
  (_inVercel && type === 'vercel-git')) {
45
53
  // use vercel branch_url instead of the production url
46
54
  if (!branchName) {
@@ -52,13 +60,6 @@ export const formattedUrl = ({ branchName, inCI: _inCI, inVercel: _inVercel, isV
52
60
  domainOnlyUrl.includes('storybook.js') ||
53
61
  // url: zonos-elements-storybook-git-something
54
62
  domainOnlyUrl.includes('storybook-git');
55
- const isTest =
56
- // url: test.js.zonos.com
57
- domainOnlyUrl.includes('test.') ||
58
- // url: zonos-elements-test-git-something
59
- domainOnlyUrl.includes('test-git') ||
60
- // url: something.preview.js.zonos.com (this is only applicable on preview deployment of `zonos-elements` and `zonos-elements-test`)
61
- domainOnlyUrl.includes('preview.js.zonos.com');
62
63
  const projectName = isStorybook
63
64
  ? 'zonos-elements-storybook'
64
65
  : isServerless
@@ -63,6 +63,8 @@ Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSett
63
63
  }
64
64
  _a.zonosApiKey = zonosApiKey;
65
65
  log('init zonos');
66
+ // add sentry to the project
67
+ _a.injectSentryScript();
66
68
  // inject zonos cdn
67
69
  _a.injectZonosCdn();
68
70
  // inject css for zonos elements
@@ -160,6 +162,56 @@ Zonos.injectController = ({ config, zonosApiKey, }) => {
160
162
  _a.zonosController = zonosController;
161
163
  log('Zonos controller injected!');
162
164
  };
165
+ Zonos.injectSentryScript = () => {
166
+ const scriptUrl = 'https://browser.sentry-cdn.com/7.88.0/bundle.tracing.min.js';
167
+ const findScript = () => {
168
+ const script = document.querySelector(`script[src="${scriptUrl}"]`);
169
+ return !!script;
170
+ };
171
+ if (findScript()) {
172
+ // eslint-disable-next-line no-console
173
+ log('Sentry script already exists in the document', 'warn');
174
+ return;
175
+ }
176
+ const headOrBody = document.head || document.body;
177
+ // init zonos elements when the zonosKey is valid
178
+ // inject esmodule cdn for zonos elements
179
+ const script = document.createElement('script');
180
+ script.crossOrigin = 'anonymous';
181
+ script.src = scriptUrl;
182
+ script.integrity =
183
+ 'sha384-z/aQww1Fr6Mes0MO/2wlzQd2nXBCdDcKPXDTsMDMNPgTGRPqii3a4bzH79I+Vo8l';
184
+ script.setAttribute('data-lazy', 'no');
185
+ script.onerror = () => {
186
+ logError(`Failed to load ${script.src}`);
187
+ };
188
+ script.onload = () => {
189
+ var _b;
190
+ (_b = window.Sentry) === null || _b === void 0 ? void 0 : _b.init({
191
+ denyUrls: [
192
+ // Facebook flakiness
193
+ /graph\.facebook\.com/i,
194
+ // Facebook blocked
195
+ /connect\.facebook\.net\/en_US\/all\.js/i,
196
+ // Woopra flakiness
197
+ /eatdifferent\.com\.woopra-ns\.com/i,
198
+ /static\.woopra\.com\/js\/woopra\.js/i,
199
+ // Chrome extensions
200
+ /extensions\//i,
201
+ /^chrome:\/\//i,
202
+ /^chrome-extension:\/\//i,
203
+ // Other plugins
204
+ /webappstoolbarba\.texthelp\.com\//i,
205
+ /metrics\.itunes\.apple\.com\.edgesuite\.net\//i,
206
+ /dev.elements.zonos.com/i,
207
+ /js.zonos.com/,
208
+ ],
209
+ dsn: 'https://19168bd05af0e2e0e7520ad58953e4f2@o446983.ingest.sentry.io/4506400622837760',
210
+ release: `zonos-elements@${_a.version}`,
211
+ });
212
+ };
213
+ headOrBody.appendChild(script);
214
+ };
163
215
  Zonos.injectScript = ({ fallBackDomain, isModule, scriptDomain, theRestUrl, }) => {
164
216
  const fullScriptUrl = `${scriptDomain}/${theRestUrl}`;
165
217
  const findScript = () => {
@@ -182,6 +234,7 @@ Zonos.injectScript = ({ fallBackDomain, isModule, scriptDomain, theRestUrl, }) =
182
234
  script.noModule = true;
183
235
  }
184
236
  script.src = fullScriptUrl;
237
+ script.crossOrigin = 'anonymous';
185
238
  script.onerror = () => {
186
239
  // only fallback if the stylesheetDomain is versioned. (https://v1.2.3.something.com || https://v1.something.com)
187
240
  const isVersioned = /\/\/v\d+\./g.test(scriptDomain);