@zonos/elements 1.3.20 → 1.3.22

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 (187) hide show
  1. package/dist/cjs/{cart-921f0a47.js → cart-f963b239.js} +69 -30
  2. package/dist/cjs/{getBorderRadius-9ad763e1.js → getBorderRadius-332422ab.js} +1 -1
  3. package/dist/cjs/index.cjs.js +5 -4
  4. package/dist/cjs/{isDarkColor-3d021ecc.js → isDarkColor-3ddf6511.js} +1 -1
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/{submitGtag-71790233.js → submitGtag-8d562ad4.js} +2 -2
  7. package/dist/cjs/zonos-address_8.cjs.entry.js +4 -4
  8. package/dist/cjs/zonos-badge_2.cjs.entry.js +1 -1
  9. package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
  10. package/dist/cjs/zonos-button_3.cjs.entry.js +82 -43
  11. package/dist/cjs/zonos-card_2.cjs.entry.js +4 -4
  12. package/dist/cjs/zonos-cart-items_11.cjs.entry.js +19 -29
  13. package/dist/cjs/zonos-checkout.cjs.entry.js +11 -7
  14. package/dist/cjs/zonos-controller.cjs.entry.js +4 -4
  15. package/dist/cjs/zonos-country-flag.cjs.entry.js +4 -4
  16. package/dist/cjs/zonos-country-select_3.cjs.entry.js +11 -9
  17. package/dist/cjs/zonos-elements.cjs.js +1 -1
  18. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +12 -12
  19. package/dist/cjs/zonos-hello.cjs.entry.js +10 -6
  20. package/dist/cjs/zonos-input.cjs.entry.js +2 -2
  21. package/dist/cjs/zonos-logo.cjs.entry.js +1 -1
  22. package/dist/cjs/zonos-notification.cjs.entry.js +1 -1
  23. package/dist/cjs/zonos-payment.cjs.entry.js +4 -4
  24. package/dist/cjs/zonos-select-dialog-header_2.cjs.entry.js +1 -1
  25. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +2 -2
  26. package/dist/cjs/zonos-text.cjs.entry.js +1 -2
  27. package/dist/cjs/{zonosStore-1063de5e.js → zonosStore-768d6ca0.js} +2 -1
  28. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.css +7 -0
  29. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.js +4 -4
  30. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-restricted-items/zonos-cart-restricted-items.js +2 -2
  31. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.css +7 -0
  32. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +5 -5
  33. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +2 -2
  34. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +6 -2
  35. package/dist/collection/components/checkout/zonos-checkout/zonos-review/zonos-review.js +2 -2
  36. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +3 -3
  37. package/dist/collection/components/common/zonos-button/zonos-button.css +7 -2
  38. package/dist/collection/components/common/zonos-button/zonos-button.js +74 -39
  39. package/dist/collection/components/common/zonos-text/zonos-text.js +0 -18
  40. package/dist/collection/components/hello/zonos-hello/zonos-hello.js +6 -3
  41. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +8 -5
  42. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +8 -8
  43. package/dist/collection/components/main/zonos-controller.js +2 -2
  44. package/dist/collection/components/store/hello/localization.js +2 -2
  45. package/dist/collection/components/store/zonosStore.js +3 -2
  46. package/dist/collection/components/utils/api/getExchangeRate.js +20 -5
  47. package/dist/collection/components/utils/hello/currencyConversion/currencyConvertAndFormat.js +1 -1
  48. package/dist/collection/components/utils/hello/currencyConversion/currencyDisplay.js +1 -1
  49. package/dist/collection/components/utils/hello/currencyConversion/currencyFormat.js +32 -17
  50. package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js +12 -2
  51. package/dist/collection/components/utils/isElementUsingDarkTheme.js +5 -0
  52. package/dist/collection/scripts/_zonosBase.js +2 -1
  53. package/dist/esm/{cart-d3c98a81.js → cart-efecbea6.js} +69 -30
  54. package/dist/esm/{getBorderRadius-393bf797.js → getBorderRadius-a2e46e26.js} +1 -1
  55. package/dist/esm/index.js +5 -4
  56. package/dist/esm/{isDarkColor-454ec221.js → isDarkColor-69ed8e39.js} +1 -1
  57. package/dist/esm/loader.js +1 -1
  58. package/dist/esm/{submitGtag-acdb8bd7.js → submitGtag-a7b8a86e.js} +2 -2
  59. package/dist/esm/zonos-address_8.entry.js +4 -4
  60. package/dist/esm/zonos-badge_2.entry.js +1 -1
  61. package/dist/esm/zonos-banner.entry.js +1 -1
  62. package/dist/esm/zonos-button_3.entry.js +82 -43
  63. package/dist/esm/zonos-card_2.entry.js +4 -4
  64. package/dist/esm/zonos-cart-items_11.entry.js +19 -29
  65. package/dist/esm/zonos-checkout.entry.js +11 -7
  66. package/dist/esm/zonos-controller.entry.js +4 -4
  67. package/dist/esm/zonos-country-flag.entry.js +4 -4
  68. package/dist/esm/zonos-country-select_3.entry.js +11 -9
  69. package/dist/esm/zonos-elements.js +1 -1
  70. package/dist/esm/zonos-hello-dialog.entry.js +12 -12
  71. package/dist/esm/zonos-hello.entry.js +10 -6
  72. package/dist/esm/zonos-input.entry.js +2 -2
  73. package/dist/esm/zonos-logo.entry.js +1 -1
  74. package/dist/esm/zonos-notification.entry.js +1 -1
  75. package/dist/esm/zonos-payment.entry.js +4 -4
  76. package/dist/esm/zonos-select-dialog-header_2.entry.js +1 -1
  77. package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
  78. package/dist/esm/zonos-text.entry.js +1 -2
  79. package/dist/esm/{zonosStore-0ce57f37.js → zonosStore-93da32b4.js} +2 -1
  80. package/dist/esm-es5/{cart-d3c98a81.js → cart-efecbea6.js} +1 -1
  81. package/dist/esm-es5/{getBorderRadius-393bf797.js → getBorderRadius-a2e46e26.js} +1 -1
  82. package/dist/esm-es5/index.js +1 -1
  83. package/dist/esm-es5/{isDarkColor-454ec221.js → isDarkColor-69ed8e39.js} +1 -1
  84. package/dist/esm-es5/loader.js +1 -1
  85. package/dist/esm-es5/{submitGtag-acdb8bd7.js → submitGtag-a7b8a86e.js} +1 -1
  86. package/dist/esm-es5/zonos-address_8.entry.js +1 -1
  87. package/dist/esm-es5/zonos-badge_2.entry.js +1 -1
  88. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  89. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  90. package/dist/esm-es5/zonos-card_2.entry.js +1 -1
  91. package/dist/esm-es5/zonos-cart-items_11.entry.js +1 -1
  92. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  93. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  94. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  95. package/dist/esm-es5/zonos-country-select_3.entry.js +1 -1
  96. package/dist/esm-es5/zonos-elements.js +1 -1
  97. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  98. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  99. package/dist/esm-es5/zonos-input.entry.js +1 -1
  100. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  101. package/dist/esm-es5/zonos-notification.entry.js +1 -1
  102. package/dist/esm-es5/zonos-payment.entry.js +1 -1
  103. package/dist/esm-es5/zonos-select-dialog-header_2.entry.js +1 -1
  104. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  105. package/dist/esm-es5/zonos-text.entry.js +1 -1
  106. package/dist/esm-es5/{zonosStore-0ce57f37.js → zonosStore-93da32b4.js} +1 -1
  107. package/dist/scripts/index.d.ts +29 -13
  108. package/dist/scripts/index.js +1 -1
  109. package/dist/scripts/loadZonos.js +1 -1
  110. package/dist/scripts/zonos.js +1 -1
  111. package/dist/types/components/common/zonos-button/zonos-button.d.ts +1 -0
  112. package/dist/types/components/common/zonos-text/zonos-text.d.ts +0 -4
  113. package/dist/types/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.d.ts +1 -0
  114. package/dist/types/components/store/hello/localization.d.ts +2 -2
  115. package/dist/types/components/store/zonosStore.d.ts +6 -2
  116. package/dist/types/components/utils/api/getExchangeRate.d.ts +9 -10
  117. package/dist/types/components/utils/api/triggerBuildLandedCost.d.ts +3 -3
  118. package/dist/types/components/utils/hello/currencyConversion/currencyFormat.d.ts +5 -1
  119. package/dist/types/components/utils/isElementUsingDarkTheme.d.ts +1 -0
  120. package/dist/types/components.d.ts +0 -8
  121. package/dist/types/scripts/_zonosBase.d.ts +21 -1
  122. package/dist/types/types/checkout/CheckoutConfig.d.ts +7 -3
  123. package/dist/zonos-elements/index.esm.js +1 -1
  124. package/dist/zonos-elements/p-102c670d.entry.js +1 -0
  125. package/dist/zonos-elements/{p-3668f365.entry.js → p-13940c52.entry.js} +1 -1
  126. package/dist/zonos-elements/{p-0e6fe6c8.system.entry.js → p-140bb400.system.entry.js} +1 -1
  127. package/dist/zonos-elements/{p-15c903ff.js → p-18432252.js} +1 -1
  128. package/dist/zonos-elements/{p-f03b33ec.system.entry.js → p-1e07c616.system.entry.js} +1 -1
  129. package/dist/zonos-elements/{p-42a7a726.system.entry.js → p-20ab8daf.system.entry.js} +1 -1
  130. package/dist/zonos-elements/{p-fc2f3e2a.system.entry.js → p-2641f474.system.entry.js} +1 -1
  131. package/dist/zonos-elements/{p-c15b36c1.system.entry.js → p-283aa6f9.system.entry.js} +1 -1
  132. package/dist/zonos-elements/{p-3c97c44d.entry.js → p-298b5d95.entry.js} +1 -1
  133. package/dist/zonos-elements/p-2d3940dc.entry.js +1 -0
  134. package/dist/zonos-elements/{p-d1b8dcd8.system.entry.js → p-33f83b9a.system.entry.js} +1 -1
  135. package/dist/zonos-elements/{p-b13e630b.js → p-348adf28.js} +1 -1
  136. package/dist/zonos-elements/p-36f8a3df.system.js +1 -0
  137. package/dist/zonos-elements/{p-b9ed8a66.system.entry.js → p-3bee1a04.system.entry.js} +1 -1
  138. package/dist/zonos-elements/p-49061c5d.entry.js +1 -0
  139. package/dist/zonos-elements/{p-b202a015.entry.js → p-57d70603.entry.js} +1 -1
  140. package/dist/zonos-elements/{p-d18990b0.entry.js → p-5b7438ef.entry.js} +1 -1
  141. package/dist/zonos-elements/p-5ca32f4f.entry.js +1 -0
  142. package/dist/zonos-elements/p-5edc4f18.system.entry.js +1 -0
  143. package/dist/zonos-elements/p-678daa20.system.entry.js +1 -0
  144. package/dist/zonos-elements/{p-14bea5e6.system.entry.js → p-68e3ef26.system.entry.js} +1 -1
  145. package/dist/zonos-elements/{p-9da3b3b3.system.entry.js → p-6e717c40.system.entry.js} +1 -1
  146. package/dist/zonos-elements/{p-2d3e3735.js → p-795a3ed5.js} +1 -1
  147. package/dist/zonos-elements/{p-67373528.entry.js → p-7d2fc0fd.entry.js} +1 -1
  148. package/dist/zonos-elements/{p-1406d696.system.entry.js → p-85a49fb8.system.entry.js} +1 -1
  149. package/dist/zonos-elements/{p-3115e7a7.system.js → p-884b41a8.system.js} +1 -1
  150. package/dist/zonos-elements/p-8a65433a.entry.js +1 -0
  151. package/dist/zonos-elements/{p-d03e101b.system.entry.js → p-8df58197.system.entry.js} +1 -1
  152. package/dist/zonos-elements/{p-d5feef4c.js → p-95ffff25.js} +1 -1
  153. package/dist/zonos-elements/{p-ebb36e4d.entry.js → p-968df90a.entry.js} +1 -1
  154. package/dist/zonos-elements/{p-23393abc.system.entry.js → p-9a299a98.system.entry.js} +1 -1
  155. package/dist/zonos-elements/{p-ce4c48f6.entry.js → p-a20f6ba3.entry.js} +1 -1
  156. package/dist/zonos-elements/{p-f0afca6c.system.js → p-a52afd83.system.js} +1 -1
  157. package/dist/zonos-elements/{p-0a4f341b.entry.js → p-bbe5d0f0.entry.js} +1 -1
  158. package/dist/zonos-elements/{p-dd02f2eb.entry.js → p-c0f0edbe.entry.js} +1 -1
  159. package/dist/zonos-elements/{p-971e73c3.system.entry.js → p-c2328652.system.entry.js} +1 -1
  160. package/dist/zonos-elements/{p-474cb030.entry.js → p-c53f7199.entry.js} +1 -1
  161. package/dist/zonos-elements/{p-8f3f1a1b.system.js → p-c7360a6c.system.js} +1 -1
  162. package/dist/zonos-elements/{p-72191005.system.entry.js → p-c77c056d.system.entry.js} +1 -1
  163. package/dist/zonos-elements/{p-bfe6f84f.system.entry.js → p-d0a2b1ba.system.entry.js} +1 -1
  164. package/dist/zonos-elements/{p-f16b80a3.system.js → p-d0c53fba.system.js} +1 -1
  165. package/dist/zonos-elements/p-d6f829c2.entry.js +1 -0
  166. package/dist/zonos-elements/{p-2c57097c.entry.js → p-d8255adf.entry.js} +1 -1
  167. package/dist/zonos-elements/{p-824e1e83.system.js → p-dafc6260.system.js} +1 -1
  168. package/dist/zonos-elements/{p-eb6ddb2f.js → p-df267420.js} +1 -1
  169. package/dist/zonos-elements/p-e0bf9666.system.js +1 -1
  170. package/dist/zonos-elements/{p-f4c921f8.entry.js → p-e5f7ff0f.entry.js} +1 -1
  171. package/dist/zonos-elements/{p-75d52d98.system.entry.js → p-e625f68d.system.entry.js} +1 -1
  172. package/dist/zonos-elements/{p-b925e897.system.entry.js → p-ecaed308.system.entry.js} +1 -1
  173. package/dist/zonos-elements/p-edfb5021.entry.js +1 -0
  174. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  175. package/package.json +4 -1
  176. package/dist/collection/components/utils/formatCurrency.js +0 -9
  177. package/dist/types/components/utils/formatCurrency.d.ts +0 -5
  178. package/dist/zonos-elements/p-14da9ed0.entry.js +0 -1
  179. package/dist/zonos-elements/p-2d08c612.system.js +0 -1
  180. package/dist/zonos-elements/p-3edcbb56.entry.js +0 -1
  181. package/dist/zonos-elements/p-5968c6ad.entry.js +0 -1
  182. package/dist/zonos-elements/p-59913049.entry.js +0 -1
  183. package/dist/zonos-elements/p-957301d0.system.entry.js +0 -1
  184. package/dist/zonos-elements/p-9e4b35d4.system.entry.js +0 -1
  185. package/dist/zonos-elements/p-d79e83bd.entry.js +0 -1
  186. package/dist/zonos-elements/p-eb765228.entry.js +0 -1
  187. package/dist/zonos-elements/p-f3a6de62.entry.js +0 -1
@@ -2759,7 +2759,7 @@ const mergeConfig = (defaultObj, fetchedObj, ...overrideObj) => {
2759
2759
  return merge_1.apply(null, overrideArgs);
2760
2760
  };
2761
2761
 
2762
- const { reset, state: zonosStore } = createStore(() => ({
2762
+ const { dispose: zonosStoreDispose, reset, state: zonosStore, } = createStore(() => ({
2763
2763
  appearance: {
2764
2764
  colorPrimary: 'white',
2765
2765
  fontFamily: 'Inter',
@@ -2878,6 +2878,7 @@ const zonosStoreInitSetting = ({ overrideSettings, zonosSettings, }) => {
2878
2878
  zonosStore.storeId = ((_d = (_c = zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.organization) === null || _c === void 0 ? void 0 : _c.references) === null || _d === void 0 ? void 0 : _d.storeId) || null;
2879
2879
  zonosStore.currencyConverter = overrideSettings === null || overrideSettings === void 0 ? void 0 : overrideSettings.currencyConverter;
2880
2880
  zonosStore.onCountryChange = overrideSettings === null || overrideSettings === void 0 ? void 0 : overrideSettings.onCountryChange;
2881
+ zonosStore.overrideCurrencyFormat = overrideSettings === null || overrideSettings === void 0 ? void 0 : overrideSettings.overrideCurrencyFormat;
2881
2882
  };
2882
2883
  const zonosStoreFontFamily = () => {
2883
2884
  const fontFamily = zonosStore.appearance.fontFamily || 'Inter';
@@ -48,6 +48,13 @@
48
48
  :host .zonos--cart-table .zonos--column:first-child {
49
49
  width: 60px;
50
50
  }
51
+ :host .zonos--cart-table td {
52
+ vertical-align: top;
53
+ }
54
+ :host .zonos--cart-item-price zonos-text {
55
+ white-space: nowrap;
56
+ }
51
57
  :host img {
52
58
  min-width: 40px;
59
+ margin-top: 6px;
53
60
  }
@@ -1,6 +1,6 @@
1
1
  import { getAssetPath, h, Host } from "@stencil/core";
2
2
  import { cartStore } from "../../../store/checkout/cart";
3
- import { formatCurrency } from "../../../utils/formatCurrency";
3
+ import { currencyFormat } from "../../../utils/hello/currencyConversion/currencyFormat";
4
4
  export class ZonosCartItems {
5
5
  constructor() {
6
6
  this.errorImages = [];
@@ -10,14 +10,14 @@ export class ZonosCartItems {
10
10
  const emptyItemImg = getAssetPath('./assets/empty-item.jpeg');
11
11
  const rate = ((_a = cartStore.exchangeRate) === null || _a === void 0 ? void 0 : _a.rate) || 1;
12
12
  const nonRestrictedItems = cartStore.items.filter(item => !item.isRestricted);
13
- return (h(Host, { key: '2dc2189f79fe59260a9fcd8a61142ab628ff7f57', class: "zonos--cart-items zonos--elements" }, h("table", { key: 'd354007fffb5afa397038f319571e83c3fb3ad65', class: "zonos--cart-table" }, h("tbody", { key: '5f31a21b612495ee583650cbd71614cc10a799cc' }, nonRestrictedItems.map(item => {
13
+ return (h(Host, { key: '054ea5ed2f86b2d802dd89fe77e010cb2a1a574d', class: "zonos--cart-items zonos--elements" }, h("table", { key: '6fcd4c1f30ba1d438a7ef8831ae6475171aa2f79', class: "zonos--cart-table" }, h("tbody", { key: 'd82fea259e5f70e43979512e86759b167c7cece8' }, nonRestrictedItems.map(item => {
14
14
  const itemImg = item.imageUrl;
15
15
  return (h("tr", { class: "zonos--cart-item" }, h("td", { class: "zonos--column zonos--cart-item-image" }, itemImg && !this.errorImages.includes(itemImg) ? (h("img", { alt: item.name, onError: () => {
16
16
  this.errorImages = [...this.errorImages, itemImg];
17
17
  }, src: item.imageUrl, style: {
18
18
  'min-width': '40px',
19
- }, width: 40 })) : (h("img", { alt: item.name, src: emptyItemImg, width: 40 }))), h("td", { class: "zonos--column zonos--cart-item-name" }, h("zonos-text", { type: "label" }, item.name)), h("td", { class: "zonos--column zonos--cart-item-price" }, h("zonos-text", { type: "semiBoldLabel" }, formatCurrency({
20
- amount: item.amount * item.quantity * rate,
19
+ }, width: 40 })) : (h("img", { alt: item.name, src: emptyItemImg, width: 40 }))), h("td", { class: "zonos--column zonos--cart-item-name" }, h("zonos-text", { type: "label" }, item.name)), h("td", { class: "zonos--column zonos--cart-item-price" }, h("zonos-text", { type: "semiBoldLabel" }, currencyFormat({
20
+ amount: item.amount * rate * item.quantity,
21
21
  currency: cartStore.currency,
22
22
  })))));
23
23
  })))));
@@ -2,7 +2,7 @@ import { getAssetPath, h, Host } from "@stencil/core";
2
2
  import { cartStore, cartStoreHasOneEligibleItem, } from "../../../store/checkout/cart";
3
3
  import { translate } from "../../../store/translationStore";
4
4
  import { classes } from "../../../utils/classes";
5
- import { formatCurrency } from "../../../utils/formatCurrency";
5
+ import { currencyFormat } from "../../../utils/hello/currencyConversion/currencyFormat";
6
6
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
7
7
  import ChevronUpIcon from "./assets/ChevronUpIcon.svg";
8
8
  export class ZonosCartRestrictedItems {
@@ -50,7 +50,7 @@ export class ZonosCartRestrictedItems {
50
50
  this.errorImages = [...this.errorImages, itemImg];
51
51
  }, src: itemImg, style: {
52
52
  'min-width': '40px',
53
- }, width: 40 })) : (h("img", { alt: item.name || `Restricted item ${index + 1}`, src: emptyItemImg, width: 40 }))), h("td", { class: "zonos--column zonos--cart-item-name" }, h("zonos-text", { type: "label" }, ((_b = item.matchedItem) === null || _b === void 0 ? void 0 : _b.name) || item.name), h("zonos-text", { type: "caption" }, item.restriction.reason)), h("td", { class: "zonos--column zonos--cart-item-price" }, h("zonos-text", { type: "semiBoldLabel" }, formatCurrency({
53
+ }, width: 40 })) : (h("img", { alt: item.name || `Restricted item ${index + 1}`, src: emptyItemImg, width: 40 }))), h("td", { class: "zonos--column zonos--cart-item-name" }, h("zonos-text", { type: "label" }, ((_b = item.matchedItem) === null || _b === void 0 ? void 0 : _b.name) || item.name), h("zonos-text", { type: "caption" }, item.restriction.reason)), h("td", { class: "zonos--column zonos--cart-item-price" }, h("zonos-text", { type: "semiBoldLabel" }, currencyFormat({
54
54
  amount: item.amount * item.quantity * rate,
55
55
  currency: cartStore.currency,
56
56
  })))));
@@ -65,4 +65,11 @@
65
65
  }
66
66
  :host .zonos--cart-subtotal-price {
67
67
  text-align: right;
68
+ }
69
+ :host .zonos--cart-subtotal-price zonos-text {
70
+ white-space: nowrap;
71
+ }
72
+ :host .zonos--cart-subtotal-price zonos-text,
73
+ :host .zonos--cart-pay-total zonos-text {
74
+ white-space: nowrap;
68
75
  }
@@ -1,7 +1,7 @@
1
1
  import { Fragment, h, Host } from "@stencil/core";
2
2
  import { cartStore, cartStoreHasOneEligibleItem, } from "../../../store/checkout/cart";
3
3
  import { translate } from "../../../store/translationStore";
4
- import { formatCurrency } from "../../../utils/formatCurrency";
4
+ import { currencyFormat } from "../../../utils/hello/currencyConversion/currencyFormat";
5
5
  // These assets neet to be in relative path as https://www.npmjs.com/package/stencil-inline-svg suggested
6
6
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
7
7
  import InfoIcon from "./assets/InfoIcon.svg";
@@ -17,20 +17,20 @@ export class ZonosCartSubtotal {
17
17
  }
18
18
  return (h(Fragment, null, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, cartStore.selectedShippingOption.displayName), cartStore.selectedShippingOptionTransitTime && (h("zonos-text", { class: "zonos--caption", type: "caption" }, cartStore.selectedShippingOptionTransitTime, ' ', translate('business days')))));
19
19
  };
20
- return (h(Host, { class: "zonos--cart-subtotal zonos--elements" }, h("table", { class: "zonos--cart-table" }, h("tr", { class: "zonos--row zonos--cart-subtotal" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("zonos-text", { type: "semiBoldLabel" }, translate('Cart subtotal'))), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, h("zonos-text", { type: "semiBoldLabel" }, formatCurrency({
20
+ return (h(Host, { class: "zonos--cart-subtotal zonos--elements" }, h("table", { class: "zonos--cart-table" }, h("tr", { class: "zonos--row zonos--cart-subtotal" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("zonos-text", { type: "semiBoldLabel" }, translate('Cart subtotal'))), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, h("zonos-text", { type: "semiBoldLabel" }, currencyFormat({
21
21
  amount: subtotal,
22
22
  currency: cartStore.currency,
23
23
  })))), h("tr", { class: "zonos--row zonos--cart-shipping" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column zonos--cart-subtotal-title" }, renderShippingInfo()), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, cartStore.shipping
24
- ? formatCurrency({
24
+ ? currencyFormat({
25
25
  amount: cartStore.shipping,
26
26
  currency: cartStore.currency,
27
27
  })
28
28
  : '-')), showDutyTaxesInfo && (h("tr", { class: "zonos--row zonos--cart-duties" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("div", { class: "zonos--title-with-icon" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Duties, taxes, and fees')), h("zonos-tooltip", { label: translate('Nothing due at the door') }, h("zonos-icon", { "aria-label": "Learn more about duties, taxes, and fees", content: InfoIcon, size: 16 }))), !!cartStore.isSelectedShippingAboveDeminimis && (h("zonos-text", { textColor: "gray-800", type: "body" }, translate('Order is over the de minimis threshold for both duty and tax')))), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, h("div", { class: "zonos--cart-duty-tax-price" }, cartStore.dutiesTaxFees
29
- ? formatCurrency({
29
+ ? currencyFormat({
30
30
  amount: cartStore.dutiesTaxFees,
31
31
  currency: cartStore.currency,
32
32
  })
33
- : '-', cartStore.isSelectedShippingGuarantee && (h("zonos-badge", null, translate('Guaranteed'))))))), h("tr", { class: "zonos--row zonos--cart-pay-total" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Order total'))), h("td", { class: "zonos--column" }, h("zonos-text", { type: "semiBoldLabel" }, formatCurrency({
33
+ : '-', cartStore.isSelectedShippingGuarantee && (h("zonos-badge", null, translate('Guaranteed'))))))), h("tr", { class: "zonos--row zonos--cart-pay-total" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Order total'))), h("td", { class: "zonos--column" }, h("zonos-text", { type: "semiBoldLabel" }, currencyFormat({
34
34
  amount: total,
35
35
  currency: cartStore.currency,
36
36
  })))))));
@@ -2,7 +2,7 @@ import { h, Host, } from "@stencil/core";
2
2
  import { cartStore } from "../../../store/checkout/cart";
3
3
  import { stripeStore } from "../../../store/checkout/stripe";
4
4
  import { translate } from "../../../store/translationStore";
5
- import { formatCurrency } from "../../../utils/formatCurrency";
5
+ import { currencyFormat } from "../../../utils/hello/currencyConversion/currencyFormat";
6
6
  import { submitGtag } from "../../../utils/submitGtag";
7
7
  export class ZonosCheckoutPayment {
8
8
  constructor() {
@@ -38,7 +38,7 @@ export class ZonosCheckoutPayment {
38
38
  }
39
39
  return (h(Host, { class: "zonos--checkout-payment zonos--elements" }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Payment method')), this.showErrorBanner && (h("zonos-banner", { class: "zonos--error-banner", intent: "error" }, translate('Missing required fields. Make sure all fields are completed.'))), this.paymentError && (h("zonos-banner", { class: "zonos--payment-error-banner", intent: "error" }, translate("We couldn't complete your payment. Please verify the payment details and try again."))), h("zonos-payment", null), h("div", { class: "zonos--group-btn" }, h("zonos-button", { backgroundColor: this.submitBtnColor, loading: this.continueLoading, onClick: () => this.continueClickHandler(), size: "lg",
40
40
  // use primary type when on mobile mode
41
- variant: this.submitBtnType }, "Pay", ' ', formatCurrency({
41
+ variant: this.submitBtnType }, "Pay", ' ', currencyFormat({
42
42
  amount: cartStore.total,
43
43
  currency: cartStore.currency,
44
44
  }))))));
@@ -119,9 +119,13 @@ export class ZonosCheckout {
119
119
  const tempCartData = buildCartItemsByTempCart(window.Zonos.tempCartData);
120
120
  await cartStoreUpdateItems(tempCartData);
121
121
  }
122
- else if (zonosStore.checkoutSettings.buildCartDetail) {
122
+ else if (zonosStore.checkoutSettings.buildCartDetail &&
123
+ localizationStore.selectedCountryCode) {
123
124
  log('build cart detail');
124
- const cartItems = await zonosStore.checkoutSettings.buildCartDetail();
125
+ const cartItems = await zonosStore.checkoutSettings.buildCartDetail({
126
+ countryCode: localizationStore.selectedCountryCode,
127
+ currencyCode: localizationStore.targetCurrency,
128
+ });
125
129
  await cartStoreUpdateItems(cartItems);
126
130
  }
127
131
  // if client secret doesn't exist, request a new one.
@@ -4,7 +4,7 @@ import { translate } from "../../../store/translationStore";
4
4
  import { zonosStore } from "../../../store/zonosStore";
5
5
  import { isCheckoutMobile } from "../../../utils/checkout/isCheckoutMobile";
6
6
  import { classes } from "../../../utils/classes";
7
- import { formatCurrency } from "../../../utils/formatCurrency";
7
+ import { currencyFormat } from "../../../utils/hello/currencyConversion/currencyFormat";
8
8
  /** These assets neet to be in relative path as https://www.npmjs.com/package/stencil-inline-svg suggested */
9
9
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
10
10
  import ChevronDownIcon from "./assets/ChevronDownIcon.svg";
@@ -42,7 +42,7 @@ export class ZonosReview {
42
42
  return (h(Host, { class: classes([
43
43
  'zonos--review zonos--elements',
44
44
  this.isMobile && 'mobile',
45
- ]) }, h("div", { class: "zonos--title" }, h("zonos-text", { textColor: titleTextColor, type: titleTextType }, translate('Pay'), " ", zonosStore.organizationName), renderCollapseIcon()), h("div", { class: "zonos--total-pay" }, h("zonos-text", { type: totalTextType }, formatCurrency({
45
+ ]) }, h("div", { class: "zonos--title" }, h("zonos-text", { textColor: titleTextColor, type: titleTextType }, translate('Pay'), " ", zonosStore.organizationName), renderCollapseIcon()), h("div", { class: "zonos--total-pay" }, h("zonos-text", { type: totalTextType }, currencyFormat({
46
46
  amount: total,
47
47
  currency: cartStore.currency,
48
48
  })))));
@@ -3,7 +3,7 @@ import { cartStore, cartStoreGetShippingTransitInfo, cartStoreUpdateSelectedShip
3
3
  import { translate } from "../../../store/translationStore";
4
4
  import { trackConversionEvent } from "../../../utils/api/trackConversionEvent";
5
5
  import { sortServiceLevelOptions } from "../../../utils/checkout/sortServiceLevelOptions";
6
- import { formatCurrency } from "../../../utils/formatCurrency";
6
+ import { currencyFormat } from "../../../utils/hello/currencyConversion/currencyFormat";
7
7
  import { submitGtag } from "../../../utils/submitGtag";
8
8
  export class ZonosShipping {
9
9
  constructor() {
@@ -67,7 +67,7 @@ export class ZonosShipping {
67
67
  amount: shippingAmount,
68
68
  caption,
69
69
  label: item.displayName,
70
- price: formatCurrency({
70
+ price: currencyFormat({
71
71
  amount: shippingAmount,
72
72
  currency: cartStore.currency,
73
73
  }),
@@ -108,7 +108,7 @@ export class ZonosShipping {
108
108
  if (this.showErrorBanner) {
109
109
  this.showErrorBanner = !this.handleValidate();
110
110
  }
111
- return (h(Host, { key: '7d55ffefe3cb926587a9b2d6617d732b52cf1a82', class: "zonos--shipping zonos--elements" }, h("div", { key: 'dfe3d7d7e0be1857a428c7c3dff5a60f45e2c843', class: "zonos--group" }, h("zonos-text", { key: 'dccf7b24862e88ee3ab8914b04a4ee02f02324fb', class: "zonos--title", type: "semiBoldSubheader" }, translate('Delivery options')), this.showErrorBanner && !!((_a = this.serviceLevels) === null || _a === void 0 ? void 0 : _a.length) && (h("zonos-banner", { key: 'c343522911e886a2365b795a9b95b17acbfa59c8', class: "zonos--error-banner", intent: "error" }, translate('No shipping method selected'))), h("zonos-text", { key: '83c873c95e5b7466cfba997a4385ea55771f2571', class: "zonos--shipping-method-title", type: "semiBoldLabel" }, translate('Shipping method')), !((_b = this.serviceLevels) === null || _b === void 0 ? void 0 : _b.length) ? (h("zonos-banner", { bannerTitle: translate('No shipping methods found - please review and update your address details by selecting the "Customer" tab above. If you continue to encounter issues, contact our support team for assistance.'), intent: "error" })) : (h("zonos-shipping-rich-radio", { initialSelectedValue: (_c = this.selectedShippingMethod) === null || _c === void 0 ? void 0 : _c.value, items: this.serviceLevels, onRadioSelected: e => this.handleRadioSelected(e) })), h("div", { key: 'c7dd64a8d84fa04629010d20010e89ea51c3b634', class: "zonos--group-btn" }, h("zonos-button", { key: '8d5ec0f9896be564ab659affd578939eff1c62dc', backgroundColor: this.submitBtnColor, loading: this.continueLoading || this.isSelecting, onClick: () => this.continueClickHandler(), size: "lg",
111
+ return (h(Host, { key: '11734c7c14a3a63e733a7fa4f2e202bf3b069fd4', class: "zonos--shipping zonos--elements" }, h("div", { key: 'ac22237e620e0b65c9b3920d57373207f991d926', class: "zonos--group" }, h("zonos-text", { key: 'ee4c12ab90bcd029027284d00ab304ea4dd5a71a', class: "zonos--title", type: "semiBoldSubheader" }, translate('Delivery options')), this.showErrorBanner && !!((_a = this.serviceLevels) === null || _a === void 0 ? void 0 : _a.length) && (h("zonos-banner", { key: '4b641aaf9270a8bf022d66878096768fe2956e4a', class: "zonos--error-banner", intent: "error" }, translate('No shipping method selected'))), h("zonos-text", { key: '6b29f4338c0920040599cdf01154b43d274ecfed', class: "zonos--shipping-method-title", type: "semiBoldLabel" }, translate('Shipping method')), !((_b = this.serviceLevels) === null || _b === void 0 ? void 0 : _b.length) ? (h("zonos-banner", { bannerTitle: translate('No shipping methods found - please review and update your address details by selecting the "Customer" tab above. If you continue to encounter issues, contact our support team for assistance.'), intent: "error" })) : (h("zonos-shipping-rich-radio", { initialSelectedValue: (_c = this.selectedShippingMethod) === null || _c === void 0 ? void 0 : _c.value, items: this.serviceLevels, onRadioSelected: e => this.handleRadioSelected(e) })), h("div", { key: '7b649c6c3da3c8023edc177077679bc2f397a91f', class: "zonos--group-btn" }, h("zonos-button", { key: '18181ad177d5beb7cdd8a3d0e437b332dd20f669', backgroundColor: this.submitBtnColor, loading: this.continueLoading || this.isSelecting, onClick: () => this.continueClickHandler(), size: "lg",
112
112
  // use primary type when on mobile mode
113
113
  variant: this.submitBtnType }, translate('Go to payment'))))));
114
114
  }
@@ -240,10 +240,15 @@
240
240
  outline: none;
241
241
  }
242
242
  :host button:not(.override-background).subtle:not([disabled]):hover {
243
- background: var(--zonos-elements-gray-500);
244
- color: var(--zonos-elements-gray-0);
243
+ background: var(--zonos-elements-gray-900);
245
244
  }
246
245
  :host button:not(.override-background).subtle:not([disabled]):active {
246
+ background: var(--zonos-elements-gray-800);
247
+ }
248
+ :host button:not(.override-background).subtle:not([disabled]).dark-hover-subtle:hover {
249
+ background: var(--zonos-elements-gray-100);
250
+ }
251
+ :host button:not(.override-background).subtle:not([disabled]).dark-hover-subtle:active {
247
252
  background: var(--zonos-elements-gray-200);
248
253
  }
249
254
  :host button:not(.override-background).subtle:focus {
@@ -5,6 +5,7 @@ import { getBorderRadius } from "../../utils/getBorderRadius";
5
5
  import { getButtonTheme } from "../../utils/getButtonTheme";
6
6
  import { isColorVariable } from "../../utils/isColorVariable";
7
7
  import { isDarkColor } from "../../utils/isDarkColor";
8
+ import { isElementUsingDarkTheme } from "../../utils/isElementUsingDarkTheme";
8
9
  import { styles } from "../../utils/styles";
9
10
  export class ZonosButton {
10
11
  constructor() {
@@ -15,6 +16,69 @@ export class ZonosButton {
15
16
  this.hasContent = true;
16
17
  };
17
18
  this.getColorVarProperty = (color) => color.replace('var(', '').replace(')', '');
19
+ this.getButtonStyle = () => {
20
+ /**
21
+ * If the parent component pass in the variant prop with `undefined` value, it would not re-assign the `undefined` value with the default value.
22
+ * So need to re-assign the variant prop with the default value if the value is `undefined` here.
23
+ */
24
+ const variant = this.variant || 'standard';
25
+ // use the variable if it's a color variable, otherwise use the color
26
+ const color = this.buttonColor && isColorVariable(this.buttonColor)
27
+ ? `var(--zonos-elements-${this.buttonColor})`
28
+ : this.buttonColor;
29
+ const actualTextColor = window
30
+ .getComputedStyle(this.ele)
31
+ .getPropertyValue(this.getColorVarProperty(color || '')) ||
32
+ color ||
33
+ '';
34
+ /**
35
+ * Determine if the button should use dark hover subtle
36
+ * If variable = LIGHT && text color = LIGHT, use white hover subtle
37
+ * If variable = LIGHT && text color = DARK, use dark hover subtle
38
+ * If variable = DARK && text color = LIGHT, use dark hover subtle (invert hover color)
39
+ * If variable = DARK && text color = DARK, use white hover subtle (invert hover color)
40
+ */
41
+ const isLightVariable = !isElementUsingDarkTheme(this.ele);
42
+ const isTextLight = !isDarkColor(actualTextColor);
43
+ const useDarkHoverSubtle = (isLightVariable && !isTextLight) || (!isLightVariable && isTextLight);
44
+ switch (variant) {
45
+ case 'subtle': {
46
+ // Background color is not used for subtle variant
47
+ return {
48
+ color,
49
+ useDarkHoverSubtle,
50
+ };
51
+ }
52
+ default: {
53
+ // use the variable if it's a color variable, otherwise use the color
54
+ const backgroundColor = this.backgroundColor && isColorVariable(this.backgroundColor)
55
+ ? `var(--zonos-elements-${this.backgroundColor})`
56
+ : this.backgroundColor;
57
+ // use override background if it exists, otherwise use color from setting
58
+ const overrideBackground = backgroundColor || zonosStore.appearance.colorSecondary;
59
+ const backgroundActualColor = overrideBackground &&
60
+ isColorVariable(this.getColorVarProperty(overrideBackground))
61
+ ? window
62
+ .getComputedStyle(this.ele)
63
+ .getPropertyValue(this.getColorVarProperty(overrideBackground))
64
+ : overrideBackground;
65
+ // set contrast color if background color is dark for all variants except subtle
66
+ const contrastColor = this.variant !== 'subtle' &&
67
+ backgroundActualColor &&
68
+ isDarkColor(backgroundActualColor)
69
+ ? 'white'
70
+ : color;
71
+ return {
72
+ backgroundColor: overrideBackground,
73
+ color: contrastColor,
74
+ spinnerColor: backgroundActualColor && isDarkColor(backgroundActualColor)
75
+ ? 'white'
76
+ : 'black',
77
+ useDarkHoverSubtle,
78
+ };
79
+ }
80
+ }
81
+ };
18
82
  this.buttonColor = undefined;
19
83
  this.backgroundColor = undefined;
20
84
  this.borderStyle = undefined;
@@ -48,48 +112,20 @@ export class ZonosButton {
48
112
  this.iconChangeHandler();
49
113
  }
50
114
  render() {
115
+ const { backgroundColor, color, spinnerColor, useDarkHoverSubtle } = this.getButtonStyle();
51
116
  const disabled = this.loading || this.isDisabled;
52
- /**
53
- * If the parent component pass in the variant prop with `undefined` value, it would not re-assign the `undefined` value with the default value.
54
- * So need to re-assign the variant prop with the default value if the value is `undefined` here.
55
- */
56
117
  const variant = this.variant || 'standard';
57
- // use the variable if it's a color variable, otherwise use the color
58
- const backgroundColor = this.backgroundColor && isColorVariable(this.backgroundColor)
59
- ? `var(--zonos-elements-${this.backgroundColor})`
60
- : this.backgroundColor;
61
- // use override background if it exists, otherwise use color from setting
62
- const overrideBackground = backgroundColor || zonosStore.appearance.colorSecondary;
63
- // only set theme for button to change text color if variant is standard and override background is set
64
- const buttonTheme = variant === 'standard' ? getButtonTheme(overrideBackground) : undefined;
118
+ // // only set theme for button to change text color if variant is standard and override background is set
119
+ const buttonTheme = variant === 'standard' ? getButtonTheme(backgroundColor) : undefined;
65
120
  const borderStyle = getBorderRadius({
66
121
  overrideBorderStyle: this.borderStyle,
67
122
  });
68
- const backgroundActualColor = overrideBackground &&
69
- isColorVariable(this.getColorVarProperty(overrideBackground))
70
- ? window
71
- .getComputedStyle(this.ele)
72
- .getPropertyValue(this.getColorVarProperty(overrideBackground))
73
- : overrideBackground;
74
- // use the variable if it's a color variable, otherwise use the color
75
- const color = this.buttonColor && isColorVariable(this.buttonColor)
76
- ? `var(--zonos-elements-${this.buttonColor})`
77
- : this.buttonColor;
78
- // set contrast color if background color is dark for all variants except subtle
79
- const contrastColor = this.variant !== 'subtle' &&
80
- backgroundActualColor &&
81
- isDarkColor(backgroundActualColor)
82
- ? 'white'
83
- : color;
84
- const spinnerColor = backgroundActualColor && isDarkColor(backgroundActualColor)
85
- ? 'white'
86
- : 'black';
87
- return (h(Host, { key: '00d085d600a759366f4a2de8617d81831c0ce16b', class: classes(['zonos--elements']), "data-theme": this.theme || buttonTheme, disabled: disabled, style: styles({
88
- '--background-color': overrideBackground,
123
+ return (h(Host, { key: 'a07724884592f96388174eb751bc3349391e2bf6', class: classes(['zonos--elements']), "data-theme": this.theme || buttonTheme, disabled: disabled, style: styles({
124
+ '--background-color': backgroundColor,
89
125
  '--border-radius': borderStyle,
90
- '--color': contrastColor,
126
+ '--color': color,
91
127
  '--font-family': zonosStoreFontFamily(),
92
- }) }, h("button", { key: 'b79ffdb0212630598e95f07059bb3b41049cff47', class: classes([
128
+ }) }, h("button", { key: 'd34d62c7582abdb6aee6a1ec7fefb89bcc7a31ac', class: classes([
93
129
  this.hasIcon && 'has-icon',
94
130
  this.hasContent && 'has-content',
95
131
  this.noBackground && 'no-background',
@@ -97,13 +133,12 @@ export class ZonosButton {
97
133
  this.noPaddingRight && 'no-padding-right',
98
134
  this.iconRight && 'icon-right',
99
135
  this.withBoxShadow && 'with-box-shadow',
136
+ useDarkHoverSubtle && 'dark-hover-subtle',
100
137
  variant,
101
138
  this.size,
102
139
  // only override background if variant is set to standard
103
- overrideBackground &&
104
- variant === 'standard' &&
105
- 'override-background',
106
- ]), disabled: disabled }, this.loading && (h("div", { key: '4462430185736b45b11bd18f08d1e3c6177f192f', class: "zonos--spinner-wrapper" }, h("zonos-spinner", { key: 'c866ff989b95929e8d6a44d950dc943531f1dc0c', size: 16, spinnerColor: spinnerColor }))), !this.loading && !this.iconRight && this.icon, h("slot", { key: 'a57d0b3924eef51bf3938261c8d823e9d8aa0206', onSlotchange: this.handleSlotChange }), !this.loading && this.iconRight && this.icon)));
140
+ backgroundColor && variant === 'standard' && 'override-background',
141
+ ]), disabled: disabled }, this.loading && (h("div", { key: 'aaa929d205d5a4cec679f3ee7ef6097801dc69d0', class: "zonos--spinner-wrapper" }, h("zonos-spinner", { key: '372b0a8504ecb0af54c7f68a67d6ad400bb13173', size: 16, spinnerColor: spinnerColor }))), !this.loading && !this.iconRight && this.icon, h("slot", { key: '0eefacfb7af58abf8049fd72180ba82f09ef9a34', onSlotchange: this.handleSlotChange }), !this.loading && this.iconRight && this.icon)));
107
142
  }
108
143
  static get is() { return "zonos-button"; }
109
144
  static get encapsulation() { return "shadow"; }
@@ -9,7 +9,6 @@ export class ZonosText {
9
9
  this.size = undefined;
10
10
  this.type = 'body';
11
11
  this.weight = undefined;
12
- this.content = undefined;
13
12
  this.ready = false;
14
13
  }
15
14
  componentDidRender() {
@@ -157,23 +156,6 @@ export class ZonosText {
157
156
  },
158
157
  "attribute": "weight",
159
158
  "reflect": false
160
- },
161
- "content": {
162
- "type": "string",
163
- "mutable": false,
164
- "complexType": {
165
- "original": "string",
166
- "resolved": "string | undefined",
167
- "references": {}
168
- },
169
- "required": false,
170
- "optional": true,
171
- "docs": {
172
- "tags": [],
173
- "text": "The tag to use for the text"
174
- },
175
- "attribute": "content",
176
- "reflect": false
177
159
  }
178
160
  };
179
161
  }
@@ -15,7 +15,6 @@ import { getProductsOnPage } from "../../utils/hello/getProductsOnPage";
15
15
  import { getZCountryUrlParam } from "../../utils/hello/getZCountryUrlParam";
16
16
  import { setZCountryUrlParam } from "../../utils/hello/setZCountryUrlParam";
17
17
  import { log } from "../../utils/logging/log";
18
- import { logError } from "../../utils/logging/logError";
19
18
  import { mergeConfig } from "../../utils/mergeConfig";
20
19
  const PEEK_MESSAGE_CLOSE_DELAY_MS = 3000;
21
20
  const RESIZE_DEBOUNCE_DELAY_MS = 500;
@@ -215,8 +214,12 @@ export class ZonosHello {
215
214
  * @returns void
216
215
  */
217
216
  async displayCurrency() {
217
+ if (zonosStore.helloSettings.currencyBehavior === 'DISABLED') {
218
+ // do nothing if currency behavior is disabled
219
+ return;
220
+ }
218
221
  if (!localizationStore.exchangeRate) {
219
- logError('Could not display currency. Exchange rate and format data is not available.');
222
+ log('Could not display currency. Exchange rate and format data is not available.', 'warn');
220
223
  return;
221
224
  }
222
225
  currencyDisplay();
@@ -240,7 +243,7 @@ export class ZonosHello {
240
243
  * @returns number
241
244
  */
242
245
  async format(value) {
243
- return currencyFormat(value);
246
+ return currencyFormat({ amount: value });
244
247
  }
245
248
  /**
246
249
  * This method show the hello dialog
@@ -1,6 +1,7 @@
1
1
  import { h, Host } from "@stencil/core";
2
2
  import { localizationStore } from "../../../store/hello/localization";
3
3
  import { isDarkColor } from "../../../utils/isDarkColor";
4
+ // import { isElementUsingDarkTheme } from 'src/components/utils/isElementUsingDarkTheme';
4
5
  import { languages } from "../../../../types/ILanguage";
5
6
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
6
7
  import Globe from "./assets/globe.svg";
@@ -13,13 +14,14 @@ export class ZonosHelloDialogFooter {
13
14
  this.setShowLanguageSelect = () => { };
14
15
  }
15
16
  render() {
16
- var _a, _b, _c;
17
+ var _a, _b;
17
18
  const primaryColor = (_a = this.appearanceSettings) === null || _a === void 0 ? void 0 : _a.colorPrimary;
18
- const footerTheme = primaryColor && isDarkColor(primaryColor) ? 'DARK' : 'LIGHT';
19
19
  const language = (_b = languages.find(x => x.code === localizationStore.selectedLocale)) === null || _b === void 0 ? void 0 : _b.translatedLabel;
20
- return (h(Host, { key: '714c0ccdaab553158a4990e24e471e0a0be64655', class: "zonos--elements" }, h("div", { key: '4c177b9120aee7ccdc242bb656399e1597b35f28', class: "zonos--hello-dialog-footer", "data-theme": footerTheme, style: {
21
- '--primary-color': (_c = this.appearanceSettings) === null || _c === void 0 ? void 0 : _c.colorPrimary,
22
- } }, h("a", { key: 'cb2b3ffb8a637825c76d4b33d71fa38d20a19220', href: "https://zonos.com", target: "_blank", title: "Zonos website" }, h("zonos-icon", { key: 'affb176b938a399d51ccb6ae4fb5906e31ea2ff0', "aria-label": "Zonos Logo", autoHeight: true, content: ZonosIcon, iconColor: "gray-1200", size: 108 })), h("div", { key: '4aa0ce039d196d804b26df7e2b8608252da2a478', class: "zonos--hello-locale-wrapper" }, h("zonos-button", { key: '088259ecd3d2271fb9a4042126886c7f4fe3a9ba', buttonColor: "gray-1200", icon: h("zonos-icon", { "aria-label": "Open language select", content: Globe, iconColor: "gray-1200" }), onClick: () => this.setShowLanguageSelect(true), variant: "subtle" }, language), h("zonos-button", { key: 'e20dcd573266b53341e9f21bab3b34672d4d96a1', buttonColor: "gray-1200", icon: h("zonos-country-flag", { "aria-label": "Open country select", class: "zonos--footer-country-flag", countryCode: localizationStore.selectedCountryCode }), onClick: () => this.setShowCountrySelect(true), variant: "subtle" }, localizationStore.selectedCountryCode)))));
20
+ // Only use gray-0 (white) when the background color is dark (apply inverted color if the element is using dark theme variable)
21
+ const mainColor = primaryColor && isDarkColor(primaryColor) ? 'white' : 'black';
22
+ return (h(Host, { key: '056e6cead0dd21acc085689ea850ba4a53f67bf9', class: "zonos--elements" }, h("div", { key: '00f61e795abc81d6e2f0be7e64eeae298248b34e', class: "zonos--hello-dialog-footer", style: {
23
+ '--primary-color': primaryColor,
24
+ } }, h("a", { key: '79235722e7f4caaeac2d2a400665603e07b14614', href: "https://zonos.com", target: "_blank", title: "Zonos website" }, h("zonos-icon", { key: '7a92af7024dfc3e21de1a0789623b1c1fdb8a33e', "aria-label": "Zonos Logo", autoHeight: true, content: ZonosIcon, iconColor: mainColor, size: 108 })), h("div", { key: '04d44adc9941688bc7ae7bef0ea8c9d26a33a401', class: "zonos--hello-locale-wrapper" }, h("zonos-button", { key: 'b9f3debc0c965f1ebd8745cb020c10f6e8c17285', buttonColor: mainColor, icon: h("zonos-icon", { "aria-label": "Open language select", content: Globe, iconColor: mainColor }), onClick: () => this.setShowLanguageSelect(true), variant: "subtle" }, language), h("zonos-button", { key: 'cc3ec6a8ece0ed8e94a85ec3a7a38c3c87fbf95e', buttonColor: mainColor, icon: h("zonos-country-flag", { "aria-label": "Open country select", class: "zonos--footer-country-flag", countryCode: localizationStore.selectedCountryCode }), onClick: () => this.setShowCountrySelect(true), variant: "subtle" }, localizationStore.selectedCountryCode)))));
23
25
  }
24
26
  static get is() { return "zonos-hello-dialog-footer"; }
25
27
  static get encapsulation() { return "shadow"; }
@@ -100,4 +102,5 @@ export class ZonosHelloDialogFooter {
100
102
  }
101
103
  };
102
104
  }
105
+ static get elementRef() { return "ele"; }
103
106
  }
@@ -48,7 +48,7 @@ export class ZonosHelloDialog {
48
48
  const { countryLandedCost } = localizationStore;
49
49
  // Our Robby API spells deminimis wrong here
50
50
  const dutyDeminimis = (countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.dutyDeminimus)
51
- ? currencyFormat(countryLandedCost.dutyDeminimus)
51
+ ? currencyFormat({ amount: countryLandedCost.dutyDeminimus })
52
52
  : null;
53
53
  // If deminimis is undefined or null, assume it's $0
54
54
  return dutyDeminimis
@@ -59,7 +59,7 @@ export class ZonosHelloDialog {
59
59
  const { countryLandedCost } = localizationStore;
60
60
  // Our Robby API spells deminimis wrong here
61
61
  const taxDeminimis = (countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.vatTaxDeminimus)
62
- ? currencyFormat(countryLandedCost.vatTaxDeminimus)
62
+ ? currencyFormat({ amount: countryLandedCost.vatTaxDeminimus })
63
63
  : null;
64
64
  return taxDeminimis
65
65
  ? `${translate('Spend')} ${taxDeminimis} ${translate('tax free')}`
@@ -73,19 +73,19 @@ export class ZonosHelloDialog {
73
73
  const dutyDeminimis = landedCost.dutyDeminimus;
74
74
  return translate('Orders to ${countryName} must be over ${threshold} to ship.', {
75
75
  countryName: 'United Kingdom',
76
- threshold: currencyFormat(dutyDeminimis),
76
+ threshold: currencyFormat({ amount: dutyDeminimis }),
77
77
  });
78
78
  };
79
79
  this.getAustraliaDutyTaxMessage = (landedCost) => {
80
80
  return translate('${percentage} GST due on any order above ${threshold}.', {
81
81
  percentage: `${landedCost.vatTaxRate * 100}%`,
82
- threshold: currencyFormat(landedCost.vatTaxDeminimus),
82
+ threshold: currencyFormat({ amount: landedCost.vatTaxDeminimus }),
83
83
  });
84
84
  };
85
85
  this.getNewZealandDutyTaxMessge = (landedCost) => {
86
86
  return translate('${percentage} GST due on any order above ${threshold} along with an import entry transaction fee and MPI levy.', {
87
87
  percentage: `${landedCost.vatTaxRate * 100}%`,
88
- threshold: currencyFormat(landedCost.vatTaxDeminimus),
88
+ threshold: currencyFormat({ amount: landedCost.vatTaxDeminimus }),
89
89
  });
90
90
  };
91
91
  /**
@@ -149,17 +149,17 @@ export class ZonosHelloDialog {
149
149
  const defaultMessage = formatStringWithLinks(defaultMessageStr);
150
150
  const currentPage = this.getCurrentPageEnum();
151
151
  const filteredMessages = customMessages.filter(x => x.pageName === currentPage);
152
- return (h(Host, { key: 'e6432c897bf4f7c60e69f3e4e4c356be11e61842', class: "zonos--elements" }, h("div", { key: 'd18df4158ffb6be5037251a9a665739fee6a0755', "aria-hidden": "true", class: classes([
152
+ return (h(Host, { key: 'ec64ed364328acba99227ccb40371ff6b7e0c1e2', class: "zonos--elements" }, h("div", { key: '441d4a9ae4274b0fffbd22771b8f1ffe3839230a', "aria-hidden": "true", class: classes([
153
153
  'zonos--hello-dialog',
154
154
  animateLeft && 'zonos--hello-dialog-animate-from-left',
155
155
  animateFromBottom && 'zonos--hello-dialog-animate-from-bottom',
156
156
  !!this.mobileLocationOverride &&
157
157
  'zonos--hello-dialog-mobile-override',
158
158
  this.isOpen && 'zonos--hello-dialog-open',
159
- ]), ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (h("div", { key: '1266216272683cb9f7086190686551df57ad8741' }, h("div", { key: 'ab2cb53cd0cc4c33002ae19925e8c32ebf94e426', class: "zonos--hello-dialog-content" }, h("zonos-button", { key: '9d973abe25de4a7e18f3bf588b6f0247b8edc96d', class: "zonos--close-button", icon: h("zonos-icon", { "aria-label": "Close Zonos Hello dialog", content: RemoveIcon }), noBackground: true, onClick: () => this.setIsOpen(false) }), h("zonos-v-stack", { key: 'cb8eb025500c0a4eed79e690e67edc418dc6c1e1', spacing: 24 }, h("zonos-country-flag", { key: '3ceddaa0d44d9c0779124a7ea199cf12a763d82c', class: "zonos--hello-country-flag", countryCode: selectedCountryCode }), h("zonos-v-stack", { key: 'd49da8684213be9ceb686428343247d0387e61e5', class: "zonos--hello-dialog-header", spacing: 4 }, h("zonos-text", { key: '1edc2747b7760479916276ddcaf3461cc5678461', type: "boldSubheader" }, welcomeMessage), h("zonos-text", { key: 'fbb00b765b4a29230db98253c72c320e02a5fccf', innerHTML: defaultMessage, textColor: "gray-800" })), h("zonos-v-stack", { key: '0614fbd574c7832e6dee73b3e26c659c2679b714', spacing: 8 }, this.restrictedItems.map(item => {
159
+ ]), ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (h("div", { key: '9d53c5dd06b5f1b1a0800bfdaee9615e851b3338' }, h("div", { key: '43b424d7d115ead896f0ce743d60db1775468ada', class: "zonos--hello-dialog-content" }, h("zonos-button", { key: '2dacf61dfd6976de8a37f63697a927b00c70500c', class: "zonos--close-button", icon: h("zonos-icon", { "aria-label": "Close Zonos Hello dialog", content: RemoveIcon }), noBackground: true, onClick: () => this.setIsOpen(false) }), h("zonos-v-stack", { key: '75d1b83b6e7bcefe592bd90e1fbcfd97154f0b4c', spacing: 24 }, h("zonos-country-flag", { key: '051019e1d01cc12d38d82c5c1d2765b280cf87e4', class: "zonos--hello-country-flag", countryCode: selectedCountryCode }), h("zonos-v-stack", { key: '4dd4f2bb7b8f88fcdb8c27ebaca86bbaa4f8459a', class: "zonos--hello-dialog-header", spacing: 4 }, h("zonos-text", { key: '33a2430d344b0613fda2597e5e8d52e852398a3c', type: "boldSubheader" }, welcomeMessage), h("zonos-text", { key: '5e0785c9e190be41d5c1b22736a73031de0f0a8b', innerHTML: defaultMessage, textColor: "gray-800" })), h("zonos-v-stack", { key: '460c1914c7f91ad7d3495e77f2f0de412e0d2f78', spacing: 8 }, this.restrictedItems.map(item => {
160
160
  var _a;
161
161
  return item && (h("zonos-banner", { bannerTitle: item.name, intent: "error" }, (_a = item.itemRestrictions) === null || _a === void 0 ? void 0 : _a.map(x => (h("zonos-text", { textColor: "red-800" }, x === null || x === void 0 ? void 0 : x.note)))));
162
- }), h("zonos-card", { key: '05ec570de14760e8a07d9bfa7a0fca6def3bfe4b', spacing: "12px" }, h("zonos-v-stack", { key: '9b5c301c737c784bd4e7738080fe90dfc0c82bb5', spacing: 12 }, h("div", { key: '5c3691d22fefcab028c4836d2ce774609789e9f3', class: "zonos--flex-message" }, h("zonos-icon", { key: '9a498a80b3c3652f9aec2e409d30acd09b983397', "aria-label": "Duty de minimis", content: ImportIcon }), h("zonos-text", { key: 'c7b0323a0f4704a5ee29b4275cab60e7390f1f9a' }, dutyDeMinimisMessage)), h("div", { key: '5910f4b782a28777fb6fa41ae9399dfae3a8cee8', class: "zonos--flex-message" }, h("zonos-icon", { key: 'ed57f0c4e985332568c0197506ba6b07c2da5b34', "aria-label": "Tax de minimis", content: MoneyIcon }), h("zonos-text", { key: '72727be7a47c98b2b6105532d3370fbc05bfca3e' }, taxDeMinimisMessage)), additionalInformation && (h("div", { key: 'f802df72c31a9031ae737a2d2b461482354d21d8', class: "zonos--flex-message" }, h("zonos-icon", { key: '66ac284793d67089e46671aff79691f025abbc31', "aria-label": "Low value order shipping restriction", content: BagIcon }), h("zonos-text", { key: '9931ab1b57336d4d4326d8f52975566638340e01' }, additionalInformation))))), filteredMessages.map(x => (h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), h("zonos-hello-dialog-footer", { key: '81576154c1db509ea3a9f8dfbe0dfb811f49b495', appearanceSettings: this.appearanceSettings, setShowCountrySelect: value => this.setShowCountrySelect(value), setShowLanguageSelect: value => this.setShowLanguageSelect(value) }))), this.showCountrySelect && (h("div", { key: 'e9109f275db0fbd9baca229af1004de0497753d8' }, h("zonos-country-select", { key: '8ac0328e65ae7346ebe024e7bd735afdd506d120', handleOnClose: () => this.setShowCountrySelect(false) }))), this.showLanguageSelect && (h("div", { key: '5ea929a6f391b6f00d0da0e462239bff5f0550d2' }, h("zonos-language-select", { key: 'f59d0da0cb849f1bfe77184d10a713ef6b25f225', handleOnClose: () => this.setShowLanguageSelect(false) }))))));
162
+ }), h("zonos-card", { key: '290e82532fc85421c08c0049755f2d03de5f4848', spacing: "12px" }, h("zonos-v-stack", { key: 'de37e3b7c156a952ff4906463f4e57c0e384af18', spacing: 12 }, h("div", { key: '3ce588bffccb7c41d5043d813fb6b9b0043d4fab', class: "zonos--flex-message" }, h("zonos-icon", { key: '3c955c3aa1a27566e503188a4a4f495c2daed5b1', "aria-label": "Duty de minimis", content: ImportIcon }), h("zonos-text", { key: '8b283197b31e82a8c15eff248e1ab55b28eba3d2' }, dutyDeMinimisMessage)), h("div", { key: '720af84433106750661c5d2e847c58ba673ee71c', class: "zonos--flex-message" }, h("zonos-icon", { key: '036e93ccbdafd6c6e911cc978f331c84ee542c73', "aria-label": "Tax de minimis", content: MoneyIcon }), h("zonos-text", { key: 'ca33772a3fce849a35536502d95ca81d3e9b29cb' }, taxDeMinimisMessage)), additionalInformation && (h("div", { key: '254ac11735d2e3f5b3804d58c22847414df19753', class: "zonos--flex-message" }, h("zonos-icon", { key: '28d85fa72b8d0754ba5f1633f17bd0caf78abe36', "aria-label": "Low value order shipping restriction", content: BagIcon }), h("zonos-text", { key: '6ff2d5231f7fd942c0ff7b3391589984f5d0e7d2' }, additionalInformation))))), filteredMessages.map(x => (h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), h("zonos-hello-dialog-footer", { key: '4d6593ce36f883bb538970008aa75ba3338654e5', appearanceSettings: this.appearanceSettings, setShowCountrySelect: value => this.setShowCountrySelect(value), setShowLanguageSelect: value => this.setShowLanguageSelect(value) }))), this.showCountrySelect && (h("div", { key: '66362e6aac0c8d9b5fe922c3af4d74642ff6fe8a' }, h("zonos-country-select", { key: '53fc96743eb427f76e6c658b1b3541f43afab25a', handleOnClose: () => this.setShowCountrySelect(false) }))), this.showLanguageSelect && (h("div", { key: 'e4cc485d4574d11b5759e485be18e3e2cb0af966' }, h("zonos-language-select", { key: '579c3018f84fedf257253b6db0b0c172908662e2', handleOnClose: () => this.setShowLanguageSelect(false) }))))));
163
163
  }
164
164
  static get is() { return "zonos-hello-dialog"; }
165
165
  static get encapsulation() { return "shadow"; }
@@ -199,7 +199,7 @@ export class ZonosController {
199
199
  "mutable": false,
200
200
  "complexType": {
201
201
  "original": "LoadZonosParamsConfig",
202
- "resolved": "{ appearance?: Partial<AppearanceConfig> | undefined; checkoutSettings?: Partial<CheckoutConfig> | undefined; currencyConverter?: CurrencyConverter | undefined; helloSettings?: Partial<HelloConfig> | undefined; onCountryChange?: ((props: { countryCode: CountryCode; currencyCode: CurrencyCode; }) => void) | undefined; }",
202
+ "resolved": "{ appearance?: Partial<AppearanceConfig> | undefined; checkoutSettings?: Partial<CheckoutConfig> | undefined; currencyConverter?: CurrencyConverter | undefined; helloSettings?: Partial<HelloConfig> | undefined; overrideCurrencyFormat?: { currencyDisplay?: \"symbol\" | \"name\" | \"code\" | \"narrowSymbol\" | undefined; } | ((params: { amount: number; countryCode: CurrencyCode; }) => string) | undefined; onCountryChange?: ((props: { countryCode: CountryCode; currencyCode: CurrencyCode; }) => void) | undefined; }",
203
203
  "references": {
204
204
  "LoadZonosParamsConfig": {
205
205
  "location": "import",
@@ -332,7 +332,7 @@ export class ZonosController {
332
332
  "signature": "(config: LoadZonosParamsConfig) => Promise<void>",
333
333
  "parameters": [{
334
334
  "name": "config",
335
- "type": "{ appearance?: Partial<AppearanceConfig> | undefined; checkoutSettings?: Partial<CheckoutConfig> | undefined; currencyConverter?: CurrencyConverter | undefined; helloSettings?: Partial<HelloConfig> | undefined; onCountryChange?: ((props: { countryCode: CountryCode; currencyCode: CurrencyCode; }) => void) | undefined; }",
335
+ "type": "{ appearance?: Partial<AppearanceConfig> | undefined; checkoutSettings?: Partial<CheckoutConfig> | undefined; currencyConverter?: CurrencyConverter | undefined; helloSettings?: Partial<HelloConfig> | undefined; overrideCurrencyFormat?: { currencyDisplay?: \"symbol\" | \"name\" | \"code\" | \"narrowSymbol\" | undefined; } | ((params: { amount: number; countryCode: CurrencyCode; }) => string) | undefined; onCountryChange?: ((props: { countryCode: CountryCode; currencyCode: CurrencyCode; }) => void) | undefined; }",
336
336
  "docs": "config that need to override the default setting"
337
337
  }],
338
338
  "references": {
@@ -14,7 +14,7 @@ import { getCurrencyCode } from "../../utils/hello/currencyConversion/getCurrenc
14
14
  import { setZCountryUrlParam } from "../../utils/hello/setZCountryUrlParam";
15
15
  import { log } from "../../utils/logging/log";
16
16
  import { logError } from "../../utils/logging/logError";
17
- const { onChange: localizationStoreOnUpdate, state: localizationStore } = createStore({
17
+ const { dispose: localizationDispose, onChange: localizationStoreOnUpdate, state: localizationStore, } = createStore({
18
18
  countryLandedCost: null,
19
19
  customMessages: [],
20
20
  exchangeRate: null,
@@ -181,4 +181,4 @@ const localizationStoreUpdateSelectedLocale = (newSelectedLocale) => {
181
181
  translationStoreUpdateLanguage(newSelectedLocale);
182
182
  void updateCheckoutSessionLanguage();
183
183
  };
184
- export { initLocalizationStore, localizationStore, localizationStoreOnUpdate, localizationStoreUpdateSelectedCountryCode, localizationStoreUpdateSelectedLocale, };
184
+ export { initLocalizationStore, localizationDispose, localizationStore, localizationStoreOnUpdate, localizationStoreUpdateSelectedCountryCode, localizationStoreUpdateSelectedLocale, };