@zonos/elements 1.3.18-alpha.2 → 1.3.18-alpha.3

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 (334) hide show
  1. package/README.md +341 -96
  2. package/dist/cjs/{cart-941a31dd.js → cart-5468dfd1.js} +29 -84
  3. package/dist/cjs/index.cjs.js +624 -0
  4. package/dist/cjs/logError-4e2f2020.js +58 -0
  5. package/dist/cjs/{submitGtag-9210b4fe.js → submitGtag-127a220f.js} +3 -2
  6. package/dist/cjs/zonos-address_8.cjs.entry.js +13 -12
  7. package/dist/cjs/zonos-badge_2.cjs.entry.js +3 -3
  8. package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
  9. package/dist/cjs/zonos-card_2.cjs.entry.js +7 -6
  10. package/dist/cjs/zonos-cart-items_11.cjs.entry.js +11 -10
  11. package/dist/cjs/zonos-checkout.cjs.entry.js +15 -14
  12. package/dist/cjs/zonos-controller.cjs.entry.js +25 -20
  13. package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -1
  14. package/dist/cjs/zonos-country-select_3.cjs.entry.js +6 -5
  15. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -1
  16. package/dist/cjs/zonos-hello.cjs.entry.js +10 -9
  17. package/dist/cjs/zonos-input.cjs.entry.js +4 -4
  18. package/dist/cjs/zonos-link.cjs.entry.js +1 -1
  19. package/dist/cjs/zonos-payment.cjs.entry.js +3 -2
  20. package/dist/collection/__mocks__/zonos-url/index.js +1 -0
  21. package/dist/collection/__tests__/build-utils/urlCheckOne.js +1 -1
  22. package/dist/collection/collection-manifest.json +1 -1
  23. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +4 -9
  24. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +3 -3
  25. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +3 -3
  26. package/dist/collection/components/common/zonos-badge/zonos-badge.js +3 -3
  27. package/dist/collection/components/common/zonos-button/zonos-button.js +3 -3
  28. package/dist/collection/components/common/zonos-card/zonos-card.js +3 -3
  29. package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +3 -3
  30. package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +3 -3
  31. package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
  32. package/dist/collection/components/common/zonos-confirm-dialog/zonos-confirm-dialog.js +3 -3
  33. package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +2 -2
  34. package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
  35. package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
  36. package/dist/collection/components/common/zonos-input/zonos-input.js +4 -4
  37. package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
  38. package/dist/collection/components/common/{component-template/zonos-link → zonos-link}/zonos-link.js +1 -1
  39. package/dist/collection/components/main/zonos-controller.js +10 -6
  40. package/dist/collection/components/stripe/zonos-address/zonos-address.js +3 -3
  41. package/dist/collection/environment.js +0 -2
  42. package/dist/collection/index.js +1 -0
  43. package/dist/collection/scripts/_extractZonosQaUrl.js +26 -0
  44. package/dist/collection/scripts/_getZonosQaUrl.js +40 -0
  45. package/dist/collection/scripts/{loadStripe.js → _loadStripe.js} +1 -1
  46. package/dist/collection/scripts/{zonosBase.js → _zonosBase.js} +29 -6
  47. package/dist/collection/scripts/index.js +2 -0
  48. package/dist/collection/types/generated/graphql.customer.types.js +1 -0
  49. package/dist/collection/types/generated/graphql.frontend.types.js +1 -0
  50. package/dist/esm/{cart-cc593c2b.js → cart-63d120e1.js} +2 -55
  51. package/dist/esm/index.js +621 -0
  52. package/dist/esm/logError-c456c092.js +55 -0
  53. package/dist/esm/{submitGtag-e50f903f.js → submitGtag-35bb3945.js} +2 -1
  54. package/dist/esm/zonos-address_8.entry.js +11 -10
  55. package/dist/esm/zonos-badge_2.entry.js +3 -3
  56. package/dist/esm/zonos-button_3.entry.js +3 -3
  57. package/dist/esm/zonos-card_2.entry.js +7 -6
  58. package/dist/esm/zonos-cart-items_11.entry.js +11 -10
  59. package/dist/esm/zonos-checkout.entry.js +3 -2
  60. package/dist/esm/zonos-controller.entry.js +8 -3
  61. package/dist/esm/zonos-country-flag.entry.js +2 -1
  62. package/dist/esm/zonos-country-select_3.entry.js +6 -5
  63. package/dist/esm/zonos-hello-dialog.entry.js +2 -1
  64. package/dist/esm/zonos-hello.entry.js +2 -1
  65. package/dist/esm/zonos-input.entry.js +4 -4
  66. package/dist/esm/zonos-link.entry.js +1 -1
  67. package/dist/esm/zonos-payment.entry.js +2 -1
  68. package/dist/esm-es5/cart-63d120e1.js +1 -0
  69. package/dist/esm-es5/index.js +1 -0
  70. package/dist/esm-es5/logError-c456c092.js +1 -0
  71. package/dist/esm-es5/submitGtag-35bb3945.js +1 -0
  72. package/dist/esm-es5/zonos-address_8.entry.js +1 -1
  73. package/dist/esm-es5/zonos-badge_2.entry.js +1 -1
  74. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  75. package/dist/esm-es5/zonos-card_2.entry.js +1 -1
  76. package/dist/esm-es5/zonos-cart-items_11.entry.js +1 -1
  77. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  78. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  79. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  80. package/dist/esm-es5/zonos-country-select_3.entry.js +1 -1
  81. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  82. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  83. package/dist/esm-es5/zonos-input.entry.js +1 -1
  84. package/dist/esm-es5/zonos-link.entry.js +1 -1
  85. package/dist/esm-es5/zonos-payment.entry.js +1 -1
  86. package/dist/scripts/index.d.ts +3908 -0
  87. package/dist/scripts/index.js +1 -0
  88. package/dist/scripts/loadZonos.d.ts +3954 -0
  89. package/dist/scripts/loadZonos.js +1 -1
  90. package/dist/scripts/zonos.js +1 -1
  91. package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +5 -7
  92. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +2 -2
  93. package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +2 -2
  94. package/dist/types/components/main/zonos-controller.d.ts +1 -1
  95. package/dist/types/components/store/checkout/stripe.d.ts +1 -1
  96. package/dist/types/components/store/zonosStore.d.ts +1 -1
  97. package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +2 -2
  98. package/dist/types/components/utils/styles.d.ts +1 -0
  99. package/dist/types/components.d.ts +22 -14
  100. package/dist/types/index.d.ts +1 -0
  101. package/dist/types/scripts/_extractZonosQaUrl.d.ts +11 -0
  102. package/dist/types/scripts/_getZonosQaUrl.d.ts +4 -0
  103. package/dist/types/scripts/{loadStripe.d.ts → _loadStripe.d.ts} +1 -1
  104. package/dist/types/scripts/{zonosBase.d.ts → _zonosBase.d.ts} +36 -2
  105. package/dist/types/scripts/index.d.ts +2 -0
  106. package/dist/types/types/checkout/CheckoutConfig.d.ts +5 -0
  107. package/dist/types/types/checkout/api/CalculateLandedCostRequest.d.ts +9 -0
  108. package/dist/types/types/generated/graphql.customer.types.d.ts +1 -0
  109. package/dist/types/types/generated/graphql.customer.types.ts +3 -0
  110. package/dist/types/types/generated/graphql.frontend.types.d.ts +1 -0
  111. package/dist/types/types/generated/graphql.frontend.types.ts +1 -0
  112. package/dist/types/types/global.d.ts +1 -1
  113. package/dist/zonos-elements/index.esm.js +1 -0
  114. package/dist/zonos-elements/p-023c764c.system.entry.js +1 -0
  115. package/dist/zonos-elements/p-06b6ce37.system.entry.js +1 -0
  116. package/dist/zonos-elements/p-07c53d83.entry.js +1 -0
  117. package/dist/zonos-elements/{p-9aab3ad7.entry.js → p-0d5b5bcc.entry.js} +1 -1
  118. package/dist/zonos-elements/p-200b661c.entry.js +1 -0
  119. package/dist/zonos-elements/p-3b66df06.system.entry.js +1 -0
  120. package/dist/zonos-elements/{p-020a9b86.entry.js → p-3ba8838a.entry.js} +1 -1
  121. package/dist/zonos-elements/p-428c034a.entry.js +1 -0
  122. package/dist/zonos-elements/p-43b2d28d.system.entry.js +1 -0
  123. package/dist/zonos-elements/p-47a42a30.js +1 -0
  124. package/dist/zonos-elements/{p-d0bc8902.system.entry.js → p-4f72bfee.system.entry.js} +1 -1
  125. package/dist/zonos-elements/p-4fc1459c.entry.js +1 -0
  126. package/dist/zonos-elements/p-4fca8fd5.system.entry.js +1 -0
  127. package/dist/zonos-elements/{p-9e9c318b.entry.js → p-58fc8ec1.entry.js} +1 -1
  128. package/dist/zonos-elements/p-63db40b9.system.js +1 -0
  129. package/dist/zonos-elements/{p-c20e5430.entry.js → p-6cb9812b.entry.js} +1 -1
  130. package/dist/zonos-elements/p-6df1fc3a.system.entry.js +1 -0
  131. package/dist/zonos-elements/p-6f6f160d.entry.js +1 -0
  132. package/dist/zonos-elements/p-7c78e340.entry.js +1 -0
  133. package/dist/zonos-elements/p-808fa731.js +1 -0
  134. package/dist/zonos-elements/p-80f174b9.system.js +1 -0
  135. package/dist/zonos-elements/p-85f3d13f.system.js +1 -0
  136. package/dist/zonos-elements/p-8aeb0629.entry.js +1 -0
  137. package/dist/zonos-elements/p-9288fd21.system.entry.js +1 -0
  138. package/dist/zonos-elements/p-98ad4ab3.system.entry.js +1 -0
  139. package/dist/zonos-elements/p-b1567fa3.system.entry.js +1 -0
  140. package/dist/zonos-elements/p-b81562f5.entry.js +1 -0
  141. package/dist/zonos-elements/{p-96b8c9ba.system.entry.js → p-bdfa3705.system.entry.js} +1 -1
  142. package/dist/zonos-elements/p-cfae51c1.system.js +1 -0
  143. package/dist/zonos-elements/p-d6eb260c.entry.js +1 -0
  144. package/dist/zonos-elements/p-dc40a60c.entry.js +1 -0
  145. package/dist/zonos-elements/{p-3e26d7b3.system.entry.js → p-dda78e8e.system.entry.js} +1 -1
  146. package/dist/zonos-elements/p-de405d7e.system.entry.js +1 -0
  147. package/dist/zonos-elements/p-e0bf9666.system.js +1 -1
  148. package/dist/zonos-elements/p-eaa335e1.js +1 -0
  149. package/dist/zonos-elements/{p-e13bfbda.system.entry.js → p-ed3524ae.system.entry.js} +1 -1
  150. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  151. package/package.json +4 -2
  152. package/dist/components/ILanguage.js +0 -24
  153. package/dist/components/classes.js +0 -12
  154. package/dist/components/containsNonLatinChars.js +0 -21
  155. package/dist/components/formatCurrency.js +0 -11
  156. package/dist/components/getBorderRadius.js +0 -18
  157. package/dist/components/index.d.ts +0 -33
  158. package/dist/components/index.js +0 -1
  159. package/dist/components/isCheckoutMobile.js +0 -6
  160. package/dist/components/isColorVariable.js +0 -14
  161. package/dist/components/isDarkColor.js +0 -1199
  162. package/dist/components/stripe.js +0 -1691
  163. package/dist/components/submitGtag.js +0 -19
  164. package/dist/components/trackConversionEvent.js +0 -37
  165. package/dist/components/translationStore.js +0 -5611
  166. package/dist/components/zonos-address-display.d.ts +0 -11
  167. package/dist/components/zonos-address-display.js +0 -6
  168. package/dist/components/zonos-address-display2.js +0 -64
  169. package/dist/components/zonos-address-form.d.ts +0 -11
  170. package/dist/components/zonos-address-form.js +0 -6
  171. package/dist/components/zonos-address-form2.js +0 -84
  172. package/dist/components/zonos-address-update-dialog.d.ts +0 -11
  173. package/dist/components/zonos-address-update-dialog.js +0 -6
  174. package/dist/components/zonos-address-update-dialog2.js +0 -264
  175. package/dist/components/zonos-address.d.ts +0 -11
  176. package/dist/components/zonos-address.js +0 -6
  177. package/dist/components/zonos-address2.js +0 -176
  178. package/dist/components/zonos-badge.d.ts +0 -11
  179. package/dist/components/zonos-badge.js +0 -6
  180. package/dist/components/zonos-badge2.js +0 -61
  181. package/dist/components/zonos-banner.d.ts +0 -11
  182. package/dist/components/zonos-banner.js +0 -6
  183. package/dist/components/zonos-banner2.js +0 -95
  184. package/dist/components/zonos-button.d.ts +0 -11
  185. package/dist/components/zonos-button.js +0 -6
  186. package/dist/components/zonos-button2.js +0 -186
  187. package/dist/components/zonos-card.d.ts +0 -11
  188. package/dist/components/zonos-card.js +0 -6
  189. package/dist/components/zonos-card2.js +0 -57
  190. package/dist/components/zonos-cart-items.d.ts +0 -11
  191. package/dist/components/zonos-cart-items.js +0 -6
  192. package/dist/components/zonos-cart-items2.js +0 -57
  193. package/dist/components/zonos-cart-restricted-items.d.ts +0 -11
  194. package/dist/components/zonos-cart-restricted-items.js +0 -6
  195. package/dist/components/zonos-cart-restricted-items2.js +0 -135
  196. package/dist/components/zonos-cart-subtotal.d.ts +0 -11
  197. package/dist/components/zonos-cart-subtotal.js +0 -6
  198. package/dist/components/zonos-cart-subtotal2.js +0 -91
  199. package/dist/components/zonos-checkbox.d.ts +0 -11
  200. package/dist/components/zonos-checkbox.js +0 -6
  201. package/dist/components/zonos-checkbox2.js +0 -96
  202. package/dist/components/zonos-checkout-finish.d.ts +0 -11
  203. package/dist/components/zonos-checkout-finish.js +0 -6
  204. package/dist/components/zonos-checkout-finish2.js +0 -246
  205. package/dist/components/zonos-checkout-footer.d.ts +0 -11
  206. package/dist/components/zonos-checkout-footer.js +0 -6
  207. package/dist/components/zonos-checkout-footer2.js +0 -125
  208. package/dist/components/zonos-checkout-payment.d.ts +0 -11
  209. package/dist/components/zonos-checkout-payment.js +0 -6
  210. package/dist/components/zonos-checkout-payment2.js +0 -104
  211. package/dist/components/zonos-checkout-progress-tabs.d.ts +0 -11
  212. package/dist/components/zonos-checkout-progress-tabs.js +0 -6
  213. package/dist/components/zonos-checkout-progress-tabs2.js +0 -138
  214. package/dist/components/zonos-checkout.d.ts +0 -11
  215. package/dist/components/zonos-checkout.js +0 -1051
  216. package/dist/components/zonos-collapse.d.ts +0 -11
  217. package/dist/components/zonos-collapse.js +0 -6
  218. package/dist/components/zonos-collapse2.js +0 -78
  219. package/dist/components/zonos-component.d.ts +0 -11
  220. package/dist/components/zonos-component.js +0 -48
  221. package/dist/components/zonos-confirm-dialog.d.ts +0 -11
  222. package/dist/components/zonos-confirm-dialog.js +0 -6
  223. package/dist/components/zonos-confirm-dialog2.js +0 -161
  224. package/dist/components/zonos-controller.d.ts +0 -11
  225. package/dist/components/zonos-controller.js +0 -309
  226. package/dist/components/zonos-country-flag.d.ts +0 -11
  227. package/dist/components/zonos-country-flag.js +0 -6
  228. package/dist/components/zonos-country-flag2.js +0 -54
  229. package/dist/components/zonos-country-select.d.ts +0 -11
  230. package/dist/components/zonos-country-select.js +0 -6
  231. package/dist/components/zonos-country-select2.js +0 -1891
  232. package/dist/components/zonos-custom-message.d.ts +0 -11
  233. package/dist/components/zonos-custom-message.js +0 -6
  234. package/dist/components/zonos-custom-message2.js +0 -72
  235. package/dist/components/zonos-customer-info.d.ts +0 -11
  236. package/dist/components/zonos-customer-info.js +0 -6
  237. package/dist/components/zonos-customer-info2.js +0 -316
  238. package/dist/components/zonos-dialog.d.ts +0 -11
  239. package/dist/components/zonos-dialog.js +0 -6
  240. package/dist/components/zonos-dialog2.js +0 -136
  241. package/dist/components/zonos-hello-dialog-footer.d.ts +0 -11
  242. package/dist/components/zonos-hello-dialog-footer.js +0 -6
  243. package/dist/components/zonos-hello-dialog-footer2.js +0 -83
  244. package/dist/components/zonos-hello-dialog.d.ts +0 -11
  245. package/dist/components/zonos-hello-dialog.js +0 -6
  246. package/dist/components/zonos-hello-dialog2.js +0 -305
  247. package/dist/components/zonos-hello.d.ts +0 -11
  248. package/dist/components/zonos-hello.js +0 -879
  249. package/dist/components/zonos-icon.d.ts +0 -11
  250. package/dist/components/zonos-icon.js +0 -6
  251. package/dist/components/zonos-icon2.js +0 -55
  252. package/dist/components/zonos-input.d.ts +0 -11
  253. package/dist/components/zonos-input.js +0 -6
  254. package/dist/components/zonos-input2.js +0 -78
  255. package/dist/components/zonos-language-select.d.ts +0 -11
  256. package/dist/components/zonos-language-select.js +0 -6
  257. package/dist/components/zonos-language-select2.js +0 -88
  258. package/dist/components/zonos-link-authentication.d.ts +0 -11
  259. package/dist/components/zonos-link-authentication.js +0 -6
  260. package/dist/components/zonos-link-authentication2.js +0 -80
  261. package/dist/components/zonos-link.d.ts +0 -11
  262. package/dist/components/zonos-link.js +0 -43
  263. package/dist/components/zonos-logo.d.ts +0 -11
  264. package/dist/components/zonos-logo.js +0 -49
  265. package/dist/components/zonos-notification.d.ts +0 -11
  266. package/dist/components/zonos-notification.js +0 -6
  267. package/dist/components/zonos-notification2.js +0 -92
  268. package/dist/components/zonos-payment.d.ts +0 -11
  269. package/dist/components/zonos-payment.js +0 -6
  270. package/dist/components/zonos-payment2.js +0 -77
  271. package/dist/components/zonos-review.d.ts +0 -11
  272. package/dist/components/zonos-review.js +0 -6
  273. package/dist/components/zonos-review2.js +0 -89
  274. package/dist/components/zonos-select-dialog-header.d.ts +0 -11
  275. package/dist/components/zonos-select-dialog-header.js +0 -6
  276. package/dist/components/zonos-select-dialog-header2.js +0 -71
  277. package/dist/components/zonos-shipping-rich-radio.d.ts +0 -11
  278. package/dist/components/zonos-shipping-rich-radio.js +0 -6
  279. package/dist/components/zonos-shipping-rich-radio2.js +0 -88
  280. package/dist/components/zonos-shipping.d.ts +0 -11
  281. package/dist/components/zonos-shipping.js +0 -6
  282. package/dist/components/zonos-shipping2.js +0 -159
  283. package/dist/components/zonos-spinner.d.ts +0 -11
  284. package/dist/components/zonos-spinner.js +0 -6
  285. package/dist/components/zonos-spinner2.js +0 -43
  286. package/dist/components/zonos-text.d.ts +0 -11
  287. package/dist/components/zonos-text.js +0 -6
  288. package/dist/components/zonos-text2.js +0 -182
  289. package/dist/components/zonos-tooltip.d.ts +0 -11
  290. package/dist/components/zonos-tooltip.js +0 -6
  291. package/dist/components/zonos-tooltip2.js +0 -48
  292. package/dist/components/zonos-v-stack.d.ts +0 -11
  293. package/dist/components/zonos-v-stack.js +0 -6
  294. package/dist/components/zonos-v-stack2.js +0 -38
  295. package/dist/components/zonosStore.js +0 -2881
  296. package/dist/esm-es5/cart-cc593c2b.js +0 -1
  297. package/dist/esm-es5/submitGtag-e50f903f.js +0 -1
  298. package/dist/scripts/checkIfLoadVersionDomain.js +0 -1
  299. package/dist/scripts/extractZonosQaUrl.js +0 -1
  300. package/dist/scripts/getTempCartById.js +0 -1
  301. package/dist/scripts/loadStripe.js +0 -1
  302. package/dist/scripts/stripe.js +0 -1
  303. package/dist/scripts/zonosBase.js +0 -1
  304. package/dist/zonos-elements/p-04030a48.entry.js +0 -1
  305. package/dist/zonos-elements/p-0e892292.entry.js +0 -1
  306. package/dist/zonos-elements/p-0fac99e7.entry.js +0 -1
  307. package/dist/zonos-elements/p-1795c760.system.entry.js +0 -1
  308. package/dist/zonos-elements/p-24ac1c6f.entry.js +0 -1
  309. package/dist/zonos-elements/p-26a60a6e.entry.js +0 -1
  310. package/dist/zonos-elements/p-32744531.entry.js +0 -1
  311. package/dist/zonos-elements/p-35ac375a.system.entry.js +0 -1
  312. package/dist/zonos-elements/p-3bc88c3c.system.entry.js +0 -1
  313. package/dist/zonos-elements/p-4caaaaeb.system.entry.js +0 -1
  314. package/dist/zonos-elements/p-50ea2036.system.js +0 -1
  315. package/dist/zonos-elements/p-5e783394.entry.js +0 -1
  316. package/dist/zonos-elements/p-6366e7e3.entry.js +0 -1
  317. package/dist/zonos-elements/p-7c8ee4b9.system.entry.js +0 -1
  318. package/dist/zonos-elements/p-80ea85b8.entry.js +0 -1
  319. package/dist/zonos-elements/p-8da16d53.system.js +0 -1
  320. package/dist/zonos-elements/p-98a0b694.system.entry.js +0 -1
  321. package/dist/zonos-elements/p-b98cdf39.system.entry.js +0 -1
  322. package/dist/zonos-elements/p-d7b8c1c1.system.entry.js +0 -1
  323. package/dist/zonos-elements/p-dd0fd351.entry.js +0 -1
  324. package/dist/zonos-elements/p-e015cb0e.js +0 -1
  325. package/dist/zonos-elements/p-e1fbd05d.system.entry.js +0 -1
  326. package/dist/zonos-elements/p-e553dd19.js +0 -1
  327. package/dist/zonos-elements/p-e6fa0ebc.system.js +0 -1
  328. package/dist/zonos-elements/p-f6546bf4.system.entry.js +0 -1
  329. /package/dist/collection/components/common/{component-template/zonos-link → zonos-link}/zonos-link.css +0 -0
  330. /package/dist/collection/scripts/{checkIfLoadVersionDomain.js → _checkIfLoadVersionDomain.js} +0 -0
  331. /package/dist/collection/scripts/{stripe.js → _stripe.js} +0 -0
  332. /package/dist/types/components/common/{component-template/zonos-link → zonos-link}/zonos-link.d.ts +0 -0
  333. /package/dist/types/scripts/{checkIfLoadVersionDomain.d.ts → _checkIfLoadVersionDomain.d.ts} +0 -0
  334. /package/dist/types/scripts/{stripe.d.ts → _stripe.d.ts} +0 -0
package/README.md CHANGED
@@ -1,101 +1,346 @@
1
- # Zonos Component UI for Stripe elements
2
-
3
- ## Project build architecture:
4
- - `/src/components` (**Will be bundled with Stencil**): stencil web component, separate folder into 4 types:
5
- - `main`: component that will receive custom configuration from users, do all of the script and css injection into consumer page and also control how other components will show/hide by using stencil `store`.
6
- - `checkout`: main components that will handle zonos checkout
7
- - `hello`: main components that will handle zonos hello (currently holding the component placeholder)
8
- - `store`: this is state management amongs all of the components.
9
- - `stripe`: the folder that will hold all of the stripe wrapper web components
10
- - `utils`: folders that will hold all of the necessary utilities for all of the components in stencil
11
- - `components.d.ts`: generated typed component that will have global types for all web components
12
- - `/src/scripts` (**Will be bundled with regular rollup**): scripts that will be bundled into cdn and init global utility function when consumer inject cdn into their page. Consumer then can use to init zonos elements.
13
- - `/src/scripts/demo`: base scripts for the demo. `setup.ts` is for how to setup configuration and `customer-site-interaction.ts` is just base interaction for website (add to cart behavior).
14
- - `/src/styled`: folder that will hold all of the styling related for all web components
15
- - `variables`: scss variables that will be used throughout the web components application (better to just have scss variables and should not have css)
16
- - `css`: folder that will hold all of the global css (this will be generated and inject into `<head>` consumer site)
17
- - Have environment `t3` setup, but currently it's only being used in `rollup` and `stencil` config for build time checking. It may be will remove this in the future if we don't have any severless api or api using related (right now using just native `process.env`, and have the rollup env plugin to transfer that env into actual value when building.
18
- - separate tsconfig for each bundling:
19
- - `tsconfig`: will include all folders to have all of the intellisense throughout the project.
20
- - `tsconfig.build`: stencil building process
21
- - `tsconfig.demo-script`: script for demo script
22
- - `tsconfig.scripts`: rollup bundling for loading script.
23
-
24
- ## Developing/Release process
25
- **IMPORTANT: Be careful when updating the API. Changes, such as modifications to the API path or parameter requirements (like field name changes or making parameters optional or mandatory), could disrupt older versions of zonos-elements. To prevent this, consider keeping the existing endpoint and introducing a new one with the updates. This approach applies to both endpoint path changes and parameter updates. Gradually phase out the old endpoint once all lower CDN versions have migrated.**
26
-
27
- ### Deprecating APIs Guide
28
- In our `demo-app`, we treat the API as version-less because it relies on other components (like the customer-graph and front-end graph), and GraphQL does not offer a straightforward method to version queries and mutations. Given this, versioning our API currently seems unnecessary. However, we've devised a strategy for deprecating APIs, acknowledging that it might not be the optimal solution available:
29
- 1. Changing Endpoint Paths:
30
- - When an endpoint's path changes, we recommend a structured approach to mark the old endpoint as deprecated:
31
- - Create a `(deprecated)` folder next to the updated endpoint's directory.
32
- - Within `(deprecated)`, create a subfolder named after the current version on the main branch.
33
- - Move the original endpoint's directory to this new version-named folder.
34
- Ex: If we update the endpoint from `/api/zonos-elements/calculate-landed-cost` to `/api/zonos-elements/calculate-super-landed-cost`, the directory structure would look like this:
35
- ```
36
- └── zonos-elements
37
- ├── (deprecated)
38
- │ └── (v1.2.3)
39
- │ └── calculate-landed-cost
40
- │ ├── CalculateLandedCost.graphql.customer.ts
41
- │ ├── FulfillmentCenters.graphql.customer.ts
42
- │ └── route.ts
43
- ├── calculate-super-landed-cost
44
- │ ├── CalculateLandedCost.graphql.customer.ts
45
- │ ├── FulfillmentCenters.graphql.customer.ts
46
- │ └── route.ts
1
+ # Zonos Component UI Introduction
2
+ This project offers web components designed primarily for Zonos Checkout, Zonos Hello, and other Zonos products, with a focus on React and Next.js integration. Although not yet tested with other JavaScript libraries and frameworks, the implementation principles for React and Next.js can be adapted for use with other frameworks. For more information about Zonos products, please visit the official [Zonos website](https://zonos.com).
3
+
4
+ # Table of content
5
+ - [Zonos Component UI Introduction](#zonos-component-ui-introduction)
6
+ - [Table of content](#table-of-content)
7
+ - [Prerequisites](#prerequisites)
8
+ - [Installation](#installation)
9
+ - [Brief `Zonos.init` base configuration explanation:](#brief-zonosinit-base-configuration-explanation)
10
+ - [CDN](#cdn)
11
+ - [CDN when to use:](#cdn-when-to-use)
12
+ - [CDN usage:](#cdn-usage)
13
+ - [Npm](#npm)
14
+ - [Npm when to use:](#npm-when-to-use)
15
+ - [Npm usage:](#npm-usage)
16
+ - [API references](#api-references)
17
+ - [Zonos instance definition](#zonos-instance-definition)
18
+ - [Single file definition for Zonos instance](#single-file-definition-for-zonos-instance)
19
+ - [Zonos.init - checkoutSettings available configurations](#zonosinit---checkoutsettings-available-configurations)
20
+ - [Zonos.init - helloSettings available configurations](#zonosinit---hellosettings-available-configurations)
21
+
22
+
23
+ # Prerequisites
24
+ - Node.js (v18 or higher)
25
+ - An API key for Zonos Checkout/Hello (please contact our [support team](https://zonos.com/contact-support) for more information)
26
+
27
+ # Installation
28
+ There are two ways to initialize Zonos: via custom integration using a CDN or through npm installation.
29
+
30
+ **Note**: All methods below are only using the base configuration to have the Checkout and Hello up and running. For a more secure way to build your cart, please check out our [docs](https://zonos.com/docs/global-ecommerce/integration/integrating-new-checkout/custom-integration#set-up-zonos-checkout) for more information.
31
+
32
+ ## Brief `Zonos.init` base configuration explanation:
33
+ - `checkoutSettings.buildCartDetail`: This callback function retrieves cart item information from your web platform. It should return an array of cart item objects. For the expected type definition, please refer to the [`buildCartDetail`](./dist/types/types/checkout/CheckoutConfig.d.ts) and the [cart item](./dist/types/components/store/checkout/cart.d.ts) files.
34
+ - `checkoutSettings.placeOrderButtonSelector`: This is used to find all matching selectors and attach an event to trigger the Checkout process. While you can configure this in our Zonos dashboard, it's recommended to set it here so that Zonos can disable your Checkout place order button while loading.
35
+ - `zonosApiKey`: An API key for Zonos Checkout/Hello (please contact our [support team](https://zonos.com/contact-support) for more information).
36
+ - `storeId`: Store id that your checkout would associate with (please contact our [support team](https://zonos.com/contact-support) for more information).
37
+
38
+ ## CDN
39
+
40
+ ### CDN when to use:
41
+ This is suitable for you if you:
42
+ - Use any non-JavaScript frameworks (e.g., PHP, Java, C#).
43
+ - Have a static site with pure HTML, CSS, and JavaScript.
44
+ - Do not need type references in the project.
45
+ - Prefer to use a CDN even if you are using a JavaScript framework (e.g., React, Vue, Next.js).
46
+ - Want to quickly test how Zonos functions on your site (e.g., easily drop the script snippet into the Console tab in your browser's developer tools).
47
+
48
+ ### CDN usage:
49
+
50
+
51
+ - For non-JavaScript frameworks:
52
+ <details>
53
+ <summary>Copy and paste the following into your HTML or the "Console" tab of your browser's developer tool</summary>
54
+
55
+ Put the `<script>` tag below into the `<head>` tag of your HTML:
56
+ ```html
57
+ <script>
58
+ (async function () {
59
+ const zonosElementsUrl = 'https://js.zonos.com';
60
+ const timestamp = new Date().getTime();
61
+ const zonosScript = document.querySelector(
62
+ `script[src*="${zonosElementsUrl}/dist/scripts/loadZonos.js"]`,
63
+ );
64
+
65
+ if (!zonosScript) {
66
+ const script = document.createElement('script');
67
+ script.src = `${zonosElementsUrl}/dist/scripts/loadZonos.js?timestamp=${timestamp}`;
68
+ script.addEventListener(
69
+ 'load',
70
+ () => {
71
+ const getCartItems = async () => {
72
+ const yourServerUrl = "https://your-server.com/api/get-cart-items";
73
+ const response = await fetch(yourServerUrl);
74
+ const json = await response.json();
75
+ return json;
76
+ };
77
+
78
+ // Initialize Zonos with your store's settings.
79
+ // Replace '<%= placeOrderButtonSelector %>', '<%= storeId %>', and '<%= credentialToken %>'
80
+ // with your actual values.
81
+ void window.Zonos.init({
82
+ checkoutSettings: {
83
+ buildCartDetail: async () => {
84
+ const allItems = getCartItems();
85
+ return allItems;
86
+ },
87
+ placeOrderButtonSelector: '<%= placeOrderButtonSelector %>',
88
+ },
89
+ storeId: Number('<%= storeId %>'), // Contact support for this information.
90
+ zonosApiKey: '<%= credentialToken %>', // Contact support for this information
91
+ });
92
+ },
93
+ false,
94
+ );
95
+ document.head.appendChild(script);
96
+ }
97
+ })();
98
+ </script>
47
99
  ```
48
- - This folder can be removed once no stores are using a version at or below the deprecated version.
49
- 1. Parameter requirement changes (optional, mandatory and removal) and API response structure changes
50
- - For changes in parameter requirements (whether making them optional, mandatory, or removing them), follow these steps:
51
- - Create a new markdown file named after the `current version on the main branch` within the endpoint's directory.
52
- - In this markdown file, detail the changes required, such as fields becoming optional, mandatory, or being removed.
53
- **Note: When updating endpoint responses, it is okay to add new return fields, but removing fields (update mutation/query returns) may cause issues if an old version is expecting and using that old field from the response**
54
- Ex:
100
+ </details>
101
+ <br>
102
+
103
+ - For React, Next.js:
104
+ - Create a typescript file and import `@zonos/elements` to define types definition for `window` interface
105
+ <details>
106
+ <summary>Code example</summary>
107
+
108
+ ```typescript
109
+ import "@zonos/elements";
110
+ ```
111
+ </details>
112
+ <br>
113
+ - Create a `ContextProvider`
114
+ <details>
115
+ <summary>Code example</summary>
116
+
117
+ ```typescript
118
+ 'use client';
119
+ import { type ReactNode, createContext, useMemo, useState } from 'react';
120
+
121
+ import Script from 'next/script';
122
+
123
+ type ZonosScriptProps = {
124
+ scriptLoaded: boolean;
125
+ };
126
+
127
+ export const ZonosScriptContext = createContext<ZonosScriptProps>({
128
+ scriptLoaded: false,
129
+ });
130
+
131
+ export const ZonosScriptContextProvider = ({
132
+ children,
133
+ }: {
134
+ children: ReactNode;
135
+ }) => {
136
+ const [scriptLoaded, setScriptLoaded] = useState(false);
137
+
138
+ const context: ZonosScriptProps = {
139
+ scriptLoaded,
140
+ };
141
+ const timestamp = useMemo(() => Date.now(), []);
142
+ return (
143
+ <ZonosScriptContext.Provider value={context}>
144
+ <Script
145
+ onLoad={() => setScriptLoaded(true)}
146
+ src={`https://js.zonos.com/dist/scripts/loadZonos.js?timestamp=${timestamp}`}
147
+ />
148
+ {children}
149
+ </ZonosScriptContext.Provider>
150
+ );
151
+ };
152
+ ```
153
+ </details>
154
+ <br>
155
+
156
+ - Wrap `ZonosScriptContextProvider` into root of your `layout.tsx`
157
+ <details>
158
+ <summary>Code example</summary>
159
+
160
+ ```typescript
161
+ export default function Layout({ children }:{ children: ReactNode}) {
162
+ return (
163
+ <ZonosScriptContextProvider>
164
+ <main>
165
+ {children}
166
+ </main>
167
+ </ZonosScriptContextProvider>
168
+ )
169
+ }
55
170
  ```
56
- └── zonos-elements
57
- ├── calculate-super-landed-cost
58
- │ ├── CalculateLandedCost.graphql.customer.ts
59
- │ ├── FulfillmentCenters.graphql.customer.ts
60
- │ ├── v1.2.3.md
61
- │ └── route.ts
171
+ </details>
172
+ <br>
173
+
174
+ - Create a hook named `useZonosScript.ts` to use the context easier
175
+ <details>
176
+ <summary>Code example</summary>
177
+
178
+ ```typescript
179
+ import { useContext } from 'react';
180
+
181
+ import { ZonosScriptContext } from 'src/components/ZonosScriptContext';
182
+
183
+ export const useZonosScript = () => useContext(ZonosScriptContext);
62
184
  ```
63
- In `v1.2.3.md`, you might have:
185
+ </details>
186
+ <br>
187
+ - Create component called `ZonosLayoutSetup.tsx` to initialize `Zonos`.
188
+ <details>
189
+ <summary>Code example</summary>
190
+
191
+ ```typescript
192
+ 'use client';
193
+ import { type ReactNode, useEffect } from 'react';
194
+
195
+ import { useZonosScript } from 'src/utils/hooks/useZonosScript';
196
+
197
+ export const ZonosLayoutSetup = ({ children }: { children: ReactNode }) => {
198
+ const { scriptLoaded } = useZonosScript();
199
+
200
+ useEffect(() => {
201
+ // Only initialize Zonos when zonos script is fully loaded.
202
+ if (!scriptLoaded) {
203
+ return;
204
+ }
205
+ const getCartItems = async () => {
206
+ const yourServerUrl = "https://your-server.com/api/get-cart-items";
207
+ const response = await fetch(yourServerUrl);
208
+ const json = await response.json();
209
+ return json;
210
+ };
211
+
212
+ // Initialize Zonos with your store's settings.
213
+ // Replace '<%= placeOrderButtonSelector %>', '<%= storeId %>', and '<%= credentialToken %>'
214
+ // with your actual values.
215
+ void window.Zonos.init({
216
+ checkoutSettings: {
217
+ buildCartDetail: async () => {
218
+ const allItems = getCartItems();
219
+ return allItems;
220
+ },
221
+ placeOrderButtonSelector: '<%= placeOrderButtonSelector %>',
222
+ },
223
+ storeId: Number('<%= storeId %>'), // Contact support for this information.
224
+ zonosApiKey: '<%= credentialToken %>', // Contact support for this information
225
+ });
226
+ }, [scriptLoaded]);
227
+
228
+ return children;
229
+ };
230
+ ```
231
+ </details>
232
+ <br>
233
+
234
+ - Put component `ZonosLayoutSetup.tsx` right under `ZonosScriptContextProvider`
235
+ <details>
236
+ <summary>Code example</summary>
237
+
238
+ ```typescript
239
+ export default function Layout({ children }:{ children: ReactNode}) {
240
+ return (
241
+ <ZonosScriptContextProvider>
242
+ <ZonosLayoutSetup>
243
+ <main>
244
+ {children}
245
+ </main>
246
+ </ZonosLayoutSetup>
247
+ </ZonosScriptContextProvider>
248
+ )
249
+ }
250
+ ```
251
+ </details>
252
+ <br>
253
+ - For javascript framework that's not React, Next.js:
254
+ - Create a typescript file and import `@zonos/elements` to define types definition for `window` interface. You will have access to `window.Zonos` through out of your project if you are using typescript.
255
+ <details>
256
+ <summary>Code example</summary>
257
+
258
+ ```typescript
259
+ import "@zonos/elements";
260
+ ```
261
+ </details>
262
+ <br>
263
+
264
+ ## Npm
265
+ ### Npm when to use:
266
+ This method is ideal if you are using TypeScript with modern JavaScript frameworks, particularly React and Next.js. It provides strong typing for the window.Zonos.init function, making setup easier and enabling auto-completion in TypeScript-enabled environments.
267
+
268
+ ### Npm usage:
269
+ Install `@zonos/elements`:
270
+
271
+ | Package Manager | Command |
272
+ |-----------------|-------------------------------|
273
+ | pnpm | `pnpm add @zonos/elements` |
274
+ | npm | `npm install @zonos/elements` |
275
+ | yarn | `yarn add @zonos/elements` |
276
+
277
+ <br>
278
+
279
+ React, Next.js:
280
+ - Create a component called `ZonosLayoutSetup.tsx`
281
+ <details>
282
+ <summary>Code example</summary>
283
+
284
+ ```typescript
285
+ 'use client';
286
+ import { type ReactNode, useEffect } from 'react';
287
+
288
+ import { Zonos } from '@zonos/elements';
289
+
290
+ import { useZonosScript } from 'src/utils/hooks/useZonosScript';
291
+
292
+ export const ZonosLayoutSetup = ({ children }: { children: ReactNode }) => {
293
+ useEffect(() => {
294
+ // Initialize Zonos into `window` API.
295
+ window.Zonos = Zonos;
296
+
297
+ const getCartItems = async () => {
298
+ const yourServerUrl = "https://your-server.com/api/get-cart-items";
299
+ const response = await fetch(yourServerUrl);
300
+ const json = await response.json();
301
+ return json;
302
+ };
303
+
304
+
305
+ // Initialize Zonos
306
+ void window.Zonos.init({
307
+ checkoutSettings: {
308
+ buildCartDetail: async () => {
309
+ const allItems = getCartItems();
310
+ return allItems;
311
+ },
312
+ placeOrderButtonSelector: '<%= placeOrderButtonSelector %>',
313
+ },
314
+ storeId: Number('<%= storeId %>'), // Contact support for this information.
315
+ zonosApiKey: '<%= credentialToken %>', // Contact support for this information
316
+ });
317
+ }, [scriptLoaded]);
318
+
319
+ return children;
320
+ };
64
321
  ```
65
- ---
66
- + Keep and make `storeId` optional, and add `zonosStoreId` (Change field name `storeId` to `zonosStoreId`)
67
- + Make the `storeId` to accept both type `string` and `number` (Change field type of `storeId` from `string` to `number`)
68
- + Make the field `storeSetting` optional (Remove `storeSetting` field)
322
+ </details>
323
+ <br>
324
+
325
+ - Put component `ZonosLayoutSetup.tsx` at top level of your `layout.tsx`
326
+ <details>
327
+ <summary>Code example</summary>
328
+
329
+ ```typescript
330
+ export default function Layout({ children }:{ children: ReactNode}) {
331
+ return (
332
+ <ZonosLayoutSetup>
333
+ <main>
334
+ {children}
335
+ </main>
336
+ </ZonosLayoutSetup>
337
+ )
338
+ }
69
339
  ```
70
- - Update the current (non-deprecated) endpoint based on the notes in the `.md` file when all stores have moved past the deprecated version and remove that file when all are done.
71
- Ex:
72
- - For file changes, if the changes made were:
73
- - Change field type `storeId` from `string` to `number` ==> take `string` off of the union type (string | number), just leave `number`.
74
- - Change field name `storeId` to `zonosStoreId` ==> delete `storeId` field.
75
- - Remove `storeSetting` ==> remove the optional field `storeSetting`.
76
-
77
- ### Merging strategy
78
- The github action would bump the version conditionally on qa and main branch merged event.
79
- + qa branch merge flow: Only bump, publish version and create CDN when the version has alpha word.
80
- + main branch merge flow: Create a branch against qa and run pnpm version:[patch|major|minor], have it merged to qa, it would not trigger the publish version and create CDN until the changes on qa get merged to main.
81
-
82
- ### Steps
83
- 1. Each PR against qa will need to be prerelease pumped by running pnpm version:alpha.
84
- 2. PR get merged to qa will trigger the github action to publish to npm with alpha tag and create a cdn domain alpha.js.zonos.com - alpha cdn doesn’t need to be versioned, so that when rolling back, the changes will be affected right away.
85
- 3. The release process would happen on qa. If we want to release, a new branch named build/v1.x.x will need to be checkout from qa. Bump the version (major, minor or patch), and then merge to qa.
86
- 4. Create a new branch with the same name build/v1.x.xoff of main, pull from qa and just create PR and merge to main.
87
- 5. PR get merged to `main` will trigger the github action to publish to npm with major, minor or patch tag and create a cdn domain v1.2.3.js.zonos.com.
88
-
89
- ### Bumping version rule of thumbs
90
- Below is scenario when to bump version:
91
- - Alpha:
92
- - If you need to have types change in zonos-elements and want to use that types in the dashboard (for example: add a new function into instance Zonos). Bump alpha would result pushing new version to npm, then dashboard can install and use it.
93
- - If we want to have a domain with pinned version to use (v1.2.3-alpha.1.js.zonos.com) and not gonna be used directly with major pin domain (v1.js.zonos.com)
94
- **Note: If you merge changes with alpha version to main, new release domain will not be generated.**
95
- - Patch:
96
- - Any bug fix and small api changes
97
- - Minor:
98
- - Architecture changes but doesn't take too much effort to move store to newer version
99
- - Big API refactor
100
- - Major:
101
- - A lot of stores are using zonos-elements stably and have new breaking changes would lead to breaking chain for all stores
340
+ </details>
341
+
342
+ # API references
343
+ ### [Zonos instance definition](./dist/types/scripts/_zonosBase.d.ts)
344
+ ### [Single file definition for Zonos instance](./dist/scripts/index.d.ts)
345
+ ### [Zonos.init - checkoutSettings available configurations](./dist/types/types/checkout/CheckoutConfig.d.ts)
346
+ ### [Zonos.init - helloSettings available configurations](./dist/types/types/hello/HelloConfig.d.ts)