@ubnt/store.core 9.18.0-alpha.9 → 9.18.0

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 (469) hide show
  1. package/CHANGELOG.md +1 -197
  2. package/lib/_virtual/_virtual_multi-entry.js +12 -27
  3. package/lib/_virtual/_virtual_multi-entry.js.map +1 -1
  4. package/lib/_virtual/_virtual_multi-entry.mjs +10 -14
  5. package/lib/_virtual/_virtual_multi-entry.mjs.map +1 -1
  6. package/lib/{components/ResourceCalculatorV1/assets/consoles/ucg-max.png.js → assets/icons/menu/icon-globe.svg.js} +6 -6
  7. package/lib/assets/icons/menu/icon-globe.svg.js.map +1 -0
  8. package/lib/assets/icons/menu/icon-globe.svg.mjs +3 -0
  9. package/lib/assets/icons/menu/icon-globe.svg.mjs.map +1 -0
  10. package/lib/assets/ucgMax.jpg +0 -0
  11. package/lib/assets/ucgMax2.jpg +0 -0
  12. package/lib/assets/ucgUltra.jpg +0 -0
  13. package/lib/assets/ucgUltra2.jpg +0 -0
  14. package/lib/assets/udmPro.jpg +0 -0
  15. package/lib/assets/udmPro2.jpg +0 -0
  16. package/lib/assets/udmProMax.jpg +0 -0
  17. package/lib/assets/udmProMax2.jpg +0 -0
  18. package/lib/assets/udmProSpecial.jpg +0 -0
  19. package/lib/assets/udmProSpecial2.jpg +0 -0
  20. package/lib/components/CategoryTabs/CategoryTabs.styles.d.ts +1 -1
  21. package/lib/components/CategoryTabs/CategoryTabs.styles.js +3 -2
  22. package/lib/components/CategoryTabs/CategoryTabs.styles.js.map +1 -1
  23. package/lib/components/CategoryTabs/CategoryTabs.styles.mjs +3 -2
  24. package/lib/components/CategoryTabs/CategoryTabs.styles.mjs.map +1 -1
  25. package/lib/components/Compare/Compare.styles.d.ts +5 -5
  26. package/lib/components/Container/Container.d.ts +1 -1
  27. package/lib/components/Container/Container.js +3 -4
  28. package/lib/components/Container/Container.js.map +1 -1
  29. package/lib/components/Container/Container.mjs +4 -5
  30. package/lib/components/Container/Container.mjs.map +1 -1
  31. package/lib/components/Header/AccountMenu/AccountMenu.js +1 -11
  32. package/lib/components/Header/AccountMenu/AccountMenu.js.map +1 -1
  33. package/lib/components/Header/AccountMenu/AccountMenu.mjs +3 -13
  34. package/lib/components/Header/AccountMenu/AccountMenu.mjs.map +1 -1
  35. package/lib/components/Header/Header.js +6 -6
  36. package/lib/components/Header/Header.js.map +1 -1
  37. package/lib/components/Header/Header.mjs +6 -6
  38. package/lib/components/Header/Header.mjs.map +1 -1
  39. package/lib/components/Header/Header.styles.d.ts +2 -2
  40. package/lib/components/Header/Header.types.d.ts +4 -12
  41. package/lib/components/Header/Header.types.js +1 -2
  42. package/lib/components/Header/Header.types.js.map +1 -1
  43. package/lib/components/Header/Header.types.mjs +1 -2
  44. package/lib/components/Header/Header.types.mjs.map +1 -1
  45. package/lib/components/Header/MenuItem/MenuItem.styles.d.ts +1 -1
  46. package/lib/components/Header/MenuItem/MenuItem.styles.js +3 -3
  47. package/lib/components/Header/MenuItem/MenuItem.styles.js.map +1 -1
  48. package/lib/components/Header/MenuItem/MenuItem.styles.mjs +3 -3
  49. package/lib/components/Header/MenuItem/MenuItem.styles.mjs.map +1 -1
  50. package/lib/components/Header/MenuItem/MenuItem.types.d.ts +0 -1
  51. package/lib/components/Header/Navigation/MicrositeMenu/MicrositeMenu.styles.d.ts +1 -1
  52. package/lib/components/Header/Navigation/MobileMenu/MobileMenu.styles.d.ts +1 -1
  53. package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.d.ts +1 -1
  54. package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.js +95 -92
  55. package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.js.map +1 -1
  56. package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.mjs +95 -92
  57. package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.mjs.map +1 -1
  58. package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.styles.d.ts +0 -9
  59. package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.styles.js +1 -15
  60. package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.styles.js.map +1 -1
  61. package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.styles.mjs +2 -13
  62. package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.styles.mjs.map +1 -1
  63. package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.types.d.ts +4 -10
  64. package/lib/components/Header/ProHeader/ProHeader.d.ts +4 -3
  65. package/lib/components/Header/ProHeader/ProHeader.js +120 -247
  66. package/lib/components/Header/ProHeader/ProHeader.js.map +1 -1
  67. package/lib/components/Header/ProHeader/ProHeader.mjs +124 -249
  68. package/lib/components/Header/ProHeader/ProHeader.mjs.map +1 -1
  69. package/lib/components/Header/ProHeader/ProHeader.styles.d.ts +1 -4
  70. package/lib/components/Header/ProHeader/ProHeader.styles.js +17 -23
  71. package/lib/components/Header/ProHeader/ProHeader.styles.js.map +1 -1
  72. package/lib/components/Header/ProHeader/ProHeader.styles.mjs +18 -21
  73. package/lib/components/Header/ProHeader/ProHeader.styles.mjs.map +1 -1
  74. package/lib/components/Header/translations/ar.json.js +1 -4
  75. package/lib/components/Header/translations/ar.json.js.map +1 -1
  76. package/lib/components/Header/translations/ar.json.mjs +2 -4
  77. package/lib/components/Header/translations/ar.json.mjs.map +1 -1
  78. package/lib/components/Header/translations/de.json.js +1 -4
  79. package/lib/components/Header/translations/de.json.js.map +1 -1
  80. package/lib/components/Header/translations/de.json.mjs +2 -4
  81. package/lib/components/Header/translations/de.json.mjs.map +1 -1
  82. package/lib/components/Header/translations/el.json.js +1 -4
  83. package/lib/components/Header/translations/el.json.js.map +1 -1
  84. package/lib/components/Header/translations/el.json.mjs +2 -4
  85. package/lib/components/Header/translations/el.json.mjs.map +1 -1
  86. package/lib/components/Header/translations/en.json.js +1 -4
  87. package/lib/components/Header/translations/en.json.js.map +1 -1
  88. package/lib/components/Header/translations/en.json.mjs +2 -4
  89. package/lib/components/Header/translations/en.json.mjs.map +1 -1
  90. package/lib/components/Header/translations/es.json.js +1 -4
  91. package/lib/components/Header/translations/es.json.js.map +1 -1
  92. package/lib/components/Header/translations/es.json.mjs +2 -4
  93. package/lib/components/Header/translations/es.json.mjs.map +1 -1
  94. package/lib/components/Header/translations/fr.json.js +1 -4
  95. package/lib/components/Header/translations/fr.json.js.map +1 -1
  96. package/lib/components/Header/translations/fr.json.mjs +2 -4
  97. package/lib/components/Header/translations/fr.json.mjs.map +1 -1
  98. package/lib/components/Header/translations/it.json.js +1 -4
  99. package/lib/components/Header/translations/it.json.js.map +1 -1
  100. package/lib/components/Header/translations/it.json.mjs +2 -4
  101. package/lib/components/Header/translations/it.json.mjs.map +1 -1
  102. package/lib/components/Header/translations/ja.json.js +1 -4
  103. package/lib/components/Header/translations/ja.json.js.map +1 -1
  104. package/lib/components/Header/translations/ja.json.mjs +2 -4
  105. package/lib/components/Header/translations/ja.json.mjs.map +1 -1
  106. package/lib/components/Header/translations/pt-BR.json.js +1 -4
  107. package/lib/components/Header/translations/pt-BR.json.js.map +1 -1
  108. package/lib/components/Header/translations/pt-BR.json.mjs +2 -4
  109. package/lib/components/Header/translations/pt-BR.json.mjs.map +1 -1
  110. package/lib/components/Header/translations/zh-Hans.json.js +1 -4
  111. package/lib/components/Header/translations/zh-Hans.json.js.map +1 -1
  112. package/lib/components/Header/translations/zh-Hans.json.mjs +2 -4
  113. package/lib/components/Header/translations/zh-Hans.json.mjs.map +1 -1
  114. package/lib/components/Header/translations/zh-Hant-TW.json.js +1 -4
  115. package/lib/components/Header/translations/zh-Hant-TW.json.js.map +1 -1
  116. package/lib/components/Header/translations/zh-Hant-TW.json.mjs +2 -4
  117. package/lib/components/Header/translations/zh-Hant-TW.json.mjs.map +1 -1
  118. package/lib/components/Hero/Hero.styles.d.ts +2 -2
  119. package/lib/components/HeroFadeGallery/HeroFadeGallery.styles.d.ts +1 -1
  120. package/lib/components/HowToUseSection/HowToUseSection.styles.d.ts +2 -2
  121. package/lib/components/LandingPagePro/LandingPagePro.d.ts +0 -3
  122. package/lib/components/LandingPagePro/LandingPagePro.js +3 -3
  123. package/lib/components/LandingPagePro/LandingPagePro.js.map +1 -1
  124. package/lib/components/LandingPagePro/LandingPagePro.mjs +2 -2
  125. package/lib/components/LandingPagePro/LandingPagePro.mjs.map +1 -1
  126. package/lib/components/LandingPagePro/LandingPagePro.styles.d.ts +1 -1
  127. package/lib/components/LayoutRenderer/LayoutRenderer.styles.d.ts +1 -1
  128. package/lib/components/LayoutRendererV1/LayoutRenderer.styles.d.ts +3 -3
  129. package/lib/components/LayoutRendererV2/LayoutRenderer.styles.d.ts +3 -3
  130. package/lib/components/MicrositeSectionWrap/MicrositeSectionWrap.styles.d.ts +1 -1
  131. package/lib/components/ModelCompareV3/ModelCompareV3.types.d.ts +0 -1
  132. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgMax.jpg.js +5 -5
  133. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgMax.jpg.mjs +2 -2
  134. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgUltra.jpg.js +5 -5
  135. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgUltra.jpg.mjs +2 -2
  136. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmPro.jpg.js +5 -5
  137. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmPro.jpg.mjs +2 -2
  138. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProMax.jpg.js +5 -5
  139. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProMax.jpg.mjs +2 -2
  140. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProSpecial.jpg.js +5 -5
  141. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProSpecial.jpg.mjs +2 -2
  142. package/lib/components/ModelCompareV3/assets/Consoles/ucgMax.jpg.js +1 -1
  143. package/lib/components/ModelCompareV3/assets/Consoles/ucgMax.jpg.mjs +2 -2
  144. package/lib/components/ModelCompareV3/assets/Consoles/ucgUltra.jpg.js +1 -1
  145. package/lib/components/ModelCompareV3/assets/Consoles/ucgUltra.jpg.mjs +2 -2
  146. package/lib/components/ModelCompareV3/assets/Consoles/udmPro.jpg.js +1 -1
  147. package/lib/components/ModelCompareV3/assets/Consoles/udmPro.jpg.mjs +2 -2
  148. package/lib/components/ModelCompareV3/assets/Consoles/udmProMax.jpg.js +1 -1
  149. package/lib/components/ModelCompareV3/assets/Consoles/udmProMax.jpg.mjs +2 -2
  150. package/lib/components/ModelCompareV3/assets/Consoles/udmProSpecial.jpg.js +1 -1
  151. package/lib/components/ModelCompareV3/assets/Consoles/udmProSpecial.jpg.mjs +2 -2
  152. package/lib/components/ModelCompareV3/data/CloudGateways.js +15 -15
  153. package/lib/components/ModelCompareV3/data/CloudGateways.mjs +10 -10
  154. package/lib/components/ModelCompareV3/data/VideoRecorders.js +2 -3
  155. package/lib/components/ModelCompareV3/data/VideoRecorders.js.map +1 -1
  156. package/lib/components/ModelCompareV3/data/VideoRecorders.mjs +2 -3
  157. package/lib/components/ModelCompareV3/data/VideoRecorders.mjs.map +1 -1
  158. package/lib/components/ModelCompareV3/data/products/ucgMax.js +1 -1
  159. package/lib/components/ModelCompareV3/data/products/ucgMax.mjs +1 -1
  160. package/lib/components/ModelCompareV3/data/products/ucgUltra.js +1 -1
  161. package/lib/components/ModelCompareV3/data/products/ucgUltra.mjs +1 -1
  162. package/lib/components/ModelCompareV3/data/products/udmPro.js +1 -1
  163. package/lib/components/ModelCompareV3/data/products/udmPro.mjs +1 -1
  164. package/lib/components/ModelCompareV3/data/products/udmProMax.js +1 -1
  165. package/lib/components/ModelCompareV3/data/products/udmProMax.mjs +1 -1
  166. package/lib/components/ModelCompareV3/data/products/udmProSpecial.js +1 -1
  167. package/lib/components/ModelCompareV3/data/products/udmProSpecial.mjs +1 -1
  168. package/lib/components/ModelCompareV3/translations/ar.json.js +107 -743
  169. package/lib/components/ModelCompareV3/translations/ar.json.js.map +1 -1
  170. package/lib/components/ModelCompareV3/translations/ar.json.mjs +107 -743
  171. package/lib/components/ModelCompareV3/translations/ar.json.mjs.map +1 -1
  172. package/lib/components/ModelCompareV3/translations/de.json.js +106 -742
  173. package/lib/components/ModelCompareV3/translations/de.json.js.map +1 -1
  174. package/lib/components/ModelCompareV3/translations/de.json.mjs +106 -742
  175. package/lib/components/ModelCompareV3/translations/de.json.mjs.map +1 -1
  176. package/lib/components/ModelCompareV3/translations/el.json.js +106 -742
  177. package/lib/components/ModelCompareV3/translations/el.json.js.map +1 -1
  178. package/lib/components/ModelCompareV3/translations/el.json.mjs +106 -742
  179. package/lib/components/ModelCompareV3/translations/el.json.mjs.map +1 -1
  180. package/lib/components/ModelCompareV3/translations/en.json.js +0 -6
  181. package/lib/components/ModelCompareV3/translations/en.json.js.map +1 -1
  182. package/lib/components/ModelCompareV3/translations/en.json.mjs +0 -6
  183. package/lib/components/ModelCompareV3/translations/en.json.mjs.map +1 -1
  184. package/lib/components/ModelCompareV3/translations/es.json.js +106 -742
  185. package/lib/components/ModelCompareV3/translations/es.json.js.map +1 -1
  186. package/lib/components/ModelCompareV3/translations/es.json.mjs +106 -742
  187. package/lib/components/ModelCompareV3/translations/es.json.mjs.map +1 -1
  188. package/lib/components/ModelCompareV3/translations/fr.json.js +106 -742
  189. package/lib/components/ModelCompareV3/translations/fr.json.js.map +1 -1
  190. package/lib/components/ModelCompareV3/translations/fr.json.mjs +106 -742
  191. package/lib/components/ModelCompareV3/translations/fr.json.mjs.map +1 -1
  192. package/lib/components/ModelCompareV3/translations/it.json.js +106 -742
  193. package/lib/components/ModelCompareV3/translations/it.json.js.map +1 -1
  194. package/lib/components/ModelCompareV3/translations/it.json.mjs +106 -742
  195. package/lib/components/ModelCompareV3/translations/it.json.mjs.map +1 -1
  196. package/lib/components/ModelCompareV3/translations/ja.json.js +106 -742
  197. package/lib/components/ModelCompareV3/translations/ja.json.js.map +1 -1
  198. package/lib/components/ModelCompareV3/translations/ja.json.mjs +106 -742
  199. package/lib/components/ModelCompareV3/translations/ja.json.mjs.map +1 -1
  200. package/lib/components/ModelCompareV3/translations/pt-BR.json.js +106 -742
  201. package/lib/components/ModelCompareV3/translations/pt-BR.json.js.map +1 -1
  202. package/lib/components/ModelCompareV3/translations/pt-BR.json.mjs +106 -742
  203. package/lib/components/ModelCompareV3/translations/pt-BR.json.mjs.map +1 -1
  204. package/lib/components/ModelCompareV3/translations/useModelCompareTranslation.d.ts +2 -2
  205. package/lib/components/ModelCompareV3/translations/zh-Hans.json.js +106 -742
  206. package/lib/components/ModelCompareV3/translations/zh-Hans.json.js.map +1 -1
  207. package/lib/components/ModelCompareV3/translations/zh-Hans.json.mjs +106 -742
  208. package/lib/components/ModelCompareV3/translations/zh-Hans.json.mjs.map +1 -1
  209. package/lib/components/ModelCompareV3/translations/zh-Hant-TW.json.js +106 -742
  210. package/lib/components/ModelCompareV3/translations/zh-Hant-TW.json.js.map +1 -1
  211. package/lib/components/ModelCompareV3/translations/zh-Hant-TW.json.mjs +106 -742
  212. package/lib/components/ModelCompareV3/translations/zh-Hant-TW.json.mjs.map +1 -1
  213. package/lib/components/ProductSectionNavigation/ProductSectionNavigation.styles.d.ts +1 -1
  214. package/lib/components/ProductSectionNavigationV2/ProductSectionNavigation.styles.d.ts +1 -1
  215. package/lib/components/ProductTechSpecs/ProductTechSpecs.styles.d.ts +1 -1
  216. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.js +17 -313
  217. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.js.map +1 -1
  218. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.mjs +17 -311
  219. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.mjs.map +1 -1
  220. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.d.ts +2 -3
  221. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.js +0 -2
  222. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.js.map +1 -1
  223. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.mjs +0 -2
  224. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.mjs.map +1 -1
  225. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.js +34 -120
  226. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.js.map +1 -1
  227. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.mjs +34 -120
  228. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.mjs.map +1 -1
  229. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.styles.d.ts +2 -16
  230. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.styles.js +12 -54
  231. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.styles.js.map +1 -1
  232. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.styles.mjs +11 -50
  233. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.styles.mjs.map +1 -1
  234. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/assets/ArrowLeftPrimary.svg.js +5 -5
  235. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/assets/ArrowRightPrimary.svg.js +5 -5
  236. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.js +1 -1
  237. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.js.map +1 -1
  238. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.mjs +1 -1
  239. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.mjs.map +1 -1
  240. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.js +0 -2
  241. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.js.map +1 -1
  242. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.mjs +0 -2
  243. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.mjs.map +1 -1
  244. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/useComputeResourceCalculator.js +1 -1
  245. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/useComputeResourceCalculator.js.map +1 -1
  246. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/useComputeResourceCalculator.mjs +1 -1
  247. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/useComputeResourceCalculator.mjs.map +1 -1
  248. package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.js +2 -2
  249. package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.js.map +1 -1
  250. package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.mjs +2 -2
  251. package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.mjs.map +1 -1
  252. package/lib/components/ResourceCalculatorV1/ResourceCalculator.js +2 -1
  253. package/lib/components/ResourceCalculatorV1/ResourceCalculator.js.map +1 -1
  254. package/lib/components/ResourceCalculatorV1/ResourceCalculator.mjs +2 -1
  255. package/lib/components/ResourceCalculatorV1/ResourceCalculator.mjs.map +1 -1
  256. package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/HorizontalOptionSelect.d.ts +1 -1
  257. package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/HorizontalOptionSelect.js +1 -3
  258. package/lib/components/ResourceCalculatorV1/components/HorizontalOptionSelect/HorizontalOptionSelect.js.map +1 -0
  259. package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/HorizontalOptionSelect.mjs +1 -3
  260. package/lib/components/ResourceCalculatorV1/components/HorizontalOptionSelect/HorizontalOptionSelect.mjs.map +1 -0
  261. package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/HorizontalOptionSelect.styles.d.ts +0 -1
  262. package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/HorizontalOptionSelect.styles.js +7 -10
  263. package/lib/components/ResourceCalculatorV1/components/HorizontalOptionSelect/HorizontalOptionSelect.styles.js.map +1 -0
  264. package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/HorizontalOptionSelect.styles.mjs +7 -10
  265. package/lib/components/ResourceCalculatorV1/components/HorizontalOptionSelect/HorizontalOptionSelect.styles.mjs.map +1 -0
  266. package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/HorizontalOptionSelect.types.d.ts +0 -1
  267. package/lib/components/ResourceCalculatorV1/components/index.d.ts +1 -0
  268. package/lib/components/ResourceCalculatorV1/components/index.js +5 -0
  269. package/lib/components/{Header/Navigation/ProMenu → ResourceCalculatorV1/components}/index.js.map +1 -1
  270. package/lib/components/ResourceCalculatorV1/components/index.mjs +3 -0
  271. package/lib/components/ResourceCalculatorV1/translations/en.json.js +4 -6
  272. package/lib/components/ResourceCalculatorV1/translations/en.json.js.map +1 -1
  273. package/lib/components/ResourceCalculatorV1/translations/en.json.mjs +4 -6
  274. package/lib/components/ResourceCalculatorV1/translations/en.json.mjs.map +1 -1
  275. package/lib/components/ResourceCalculatorV1/translations/useResourceCalculatorTranslation.d.ts +2 -2
  276. package/lib/components/index.d.ts +0 -1
  277. package/lib/components/index.js +0 -2
  278. package/lib/components/index.js.map +1 -1
  279. package/lib/components/index.mjs +0 -2
  280. package/lib/components/index.mjs.map +1 -1
  281. package/lib/constants/icons/options/colors/black.svg.js +5 -5
  282. package/lib/constants/icons/options/colors/index.js +3 -3
  283. package/lib/constants/icons/options/styles/black.svg.js +5 -5
  284. package/lib/constants/icons/options/styles/index.js +3 -3
  285. package/lib/constants/optionIcons.js +6 -6
  286. package/lib/constants/optionIcons.mjs +4 -4
  287. package/lib/constants/proStoreCategories/mapping/index.d.ts +0 -1
  288. package/lib/constants/proStoreCategories/mapping/index.js +10 -15
  289. package/lib/constants/proStoreCategories/mapping/index.js.map +1 -1
  290. package/lib/constants/proStoreCategories/mapping/index.mjs +10 -15
  291. package/lib/constants/proStoreCategories/mapping/index.mjs.map +1 -1
  292. package/lib/constants/proStoreCategories/mapping/unifi.d.ts +1 -2
  293. package/lib/constants/proStoreCategories/mapping/unifi.js +0 -1
  294. package/lib/constants/proStoreCategories/mapping/unifi.js.map +1 -1
  295. package/lib/constants/proStoreCategories/mapping/unifi.mjs +0 -1
  296. package/lib/constants/proStoreCategories/mapping/unifi.mjs.map +1 -1
  297. package/lib/constants/proStoreCategories/translations/en.json.js +0 -3
  298. package/lib/constants/proStoreCategories/translations/en.json.js.map +1 -1
  299. package/lib/constants/proStoreCategories/translations/en.json.mjs +1 -3
  300. package/lib/constants/proStoreCategories/translations/en.json.mjs.map +1 -1
  301. package/lib/constants/proStoreCategories/translations/fr.json.js +1 -1
  302. package/lib/constants/proStoreCategories/translations/fr.json.mjs +1 -1
  303. package/lib/constants/proStoreCategories/translations/zh-Hans.json.js +1 -1
  304. package/lib/constants/proStoreCategories/translations/zh-Hans.json.mjs +1 -1
  305. package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.js +1 -1
  306. package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.mjs +1 -1
  307. package/lib/constants/theme.js +0 -4
  308. package/lib/constants/theme.js.map +1 -1
  309. package/lib/constants/theme.mjs +0 -4
  310. package/lib/constants/theme.mjs.map +1 -1
  311. package/lib/contexts/MenuContext/context.js +1 -1
  312. package/lib/contexts/MenuContext/context.js.map +1 -1
  313. package/lib/contexts/MenuContext/context.mjs +1 -1
  314. package/lib/contexts/MenuContext/context.mjs.map +1 -1
  315. package/lib/helpers/index.d.ts +0 -1
  316. package/lib/helpers/index.js +0 -11
  317. package/lib/helpers/index.js.map +1 -1
  318. package/lib/helpers/index.mjs +0 -1
  319. package/lib/helpers/index.mjs.map +1 -1
  320. package/lib/helpers/ux.d.ts +1 -9
  321. package/lib/helpers/ux.js +0 -15
  322. package/lib/helpers/ux.js.map +1 -1
  323. package/lib/helpers/ux.mjs +1 -15
  324. package/lib/helpers/ux.mjs.map +1 -1
  325. package/lib/types/index.d.ts +0 -1
  326. package/lib/types/index.js +0 -2
  327. package/lib/types/index.js.map +1 -1
  328. package/lib/types/index.mjs +0 -1
  329. package/lib/types/index.mjs.map +1 -1
  330. package/lib/utils/array.d.ts +0 -4
  331. package/lib/utils/array.js +0 -10
  332. package/lib/utils/array.js.map +1 -1
  333. package/lib/utils/array.mjs +1 -10
  334. package/lib/utils/array.mjs.map +1 -1
  335. package/lib/utils/money/constants.d.ts +25 -56
  336. package/lib/utils/money/constants.js +7 -72
  337. package/lib/utils/money/constants.js.map +1 -1
  338. package/lib/utils/money/constants.mjs +7 -70
  339. package/lib/utils/money/constants.mjs.map +1 -1
  340. package/lib/utils/money/format.d.ts +5 -10
  341. package/lib/utils/money/format.js +14 -22
  342. package/lib/utils/money/format.js.map +1 -1
  343. package/lib/utils/money/format.mjs +16 -23
  344. package/lib/utils/money/format.mjs.map +1 -1
  345. package/lib/utils/money/index.d.ts +1 -4
  346. package/lib/utils/money/index.js +8 -26
  347. package/lib/utils/money/index.js.map +1 -1
  348. package/lib/utils/money/index.mjs +4 -8
  349. package/lib/utils/money/index.mjs.map +1 -1
  350. package/lib/utils/money/misc.d.ts +28 -68
  351. package/lib/utils/money/misc.js +64 -35
  352. package/lib/utils/money/misc.js.map +1 -1
  353. package/lib/utils/money/misc.mjs +43 -32
  354. package/lib/utils/money/misc.mjs.map +1 -1
  355. package/lib/utils/money/tax.d.ts +2 -38
  356. package/lib/utils/money/tax.js +10 -46
  357. package/lib/utils/money/tax.js.map +1 -1
  358. package/lib/utils/money/tax.mjs +11 -42
  359. package/lib/utils/money/tax.mjs.map +1 -1
  360. package/lib/utils/money/types.d.ts +3 -78
  361. package/lib/utils/number.d.ts +1 -1
  362. package/lib/utils/number.js +1 -1
  363. package/lib/utils/number.js.map +1 -1
  364. package/lib/utils/number.mjs +1 -1
  365. package/lib/utils/number.mjs.map +1 -1
  366. package/lib/utils/validations.d.ts +15 -0
  367. package/lib/utils/validations.js +23 -0
  368. package/lib/utils/validations.js.map +1 -0
  369. package/lib/utils/validations.mjs +21 -0
  370. package/lib/utils/validations.mjs.map +1 -0
  371. package/package.json +1 -1
  372. package/lib/assets/efg.png +0 -0
  373. package/lib/assets/envr.png +0 -0
  374. package/lib/assets/icon-location-pin.svg +0 -5
  375. package/lib/assets/icons/menu/icon-location-pin.svg.js +0 -27
  376. package/lib/assets/icons/menu/icon-location-pin.svg.js.map +0 -1
  377. package/lib/assets/icons/menu/icon-location-pin.svg.mjs +0 -3
  378. package/lib/assets/icons/menu/icon-location-pin.svg.mjs.map +0 -1
  379. package/lib/assets/ucg-max.png +0 -0
  380. package/lib/components/Header/Navigation/ProMenu/ProMenu.d.ts +0 -2
  381. package/lib/components/Header/Navigation/ProMenu/ProMenu.js +0 -103
  382. package/lib/components/Header/Navigation/ProMenu/ProMenu.js.map +0 -1
  383. package/lib/components/Header/Navigation/ProMenu/ProMenu.mjs +0 -81
  384. package/lib/components/Header/Navigation/ProMenu/ProMenu.mjs.map +0 -1
  385. package/lib/components/Header/Navigation/ProMenu/ProMenu.styles.d.ts +0 -23
  386. package/lib/components/Header/Navigation/ProMenu/ProMenu.styles.js +0 -121
  387. package/lib/components/Header/Navigation/ProMenu/ProMenu.styles.js.map +0 -1
  388. package/lib/components/Header/Navigation/ProMenu/ProMenu.styles.mjs +0 -106
  389. package/lib/components/Header/Navigation/ProMenu/ProMenu.styles.mjs.map +0 -1
  390. package/lib/components/Header/Navigation/ProMenu/ProMenu.types.d.ts +0 -12
  391. package/lib/components/Header/Navigation/ProMenu/index.d.ts +0 -1
  392. package/lib/components/Header/Navigation/ProMenu/index.js +0 -6
  393. package/lib/components/Header/Navigation/ProMenu/index.mjs +0 -3
  394. package/lib/components/HorizontalOptionSelect/HorizontalOptionSelect.js.map +0 -1
  395. package/lib/components/HorizontalOptionSelect/HorizontalOptionSelect.mjs.map +0 -1
  396. package/lib/components/HorizontalOptionSelect/HorizontalOptionSelect.styles.js.map +0 -1
  397. package/lib/components/HorizontalOptionSelect/HorizontalOptionSelect.styles.mjs.map +0 -1
  398. package/lib/components/ModelCompareV3/assets/envr.png.js +0 -27
  399. package/lib/components/ModelCompareV3/assets/envr.png.js.map +0 -1
  400. package/lib/components/ModelCompareV3/assets/envr.png.mjs +0 -3
  401. package/lib/components/ModelCompareV3/assets/envr.png.mjs.map +0 -1
  402. package/lib/components/ModelCompareV3/data/products/envr.d.ts +0 -2
  403. package/lib/components/ModelCompareV3/data/products/envr.js +0 -97
  404. package/lib/components/ModelCompareV3/data/products/envr.js.map +0 -1
  405. package/lib/components/ModelCompareV3/data/products/envr.mjs +0 -89
  406. package/lib/components/ModelCompareV3/data/products/envr.mjs.map +0 -1
  407. package/lib/components/ResourceCalculatorV1/assets/consoles/efg.png.js +0 -27
  408. package/lib/components/ResourceCalculatorV1/assets/consoles/efg.png.js.map +0 -1
  409. package/lib/components/ResourceCalculatorV1/assets/consoles/efg.png.mjs +0 -3
  410. package/lib/components/ResourceCalculatorV1/assets/consoles/efg.png.mjs.map +0 -1
  411. package/lib/components/ResourceCalculatorV1/assets/consoles/ucg-max.png.js.map +0 -1
  412. package/lib/components/ResourceCalculatorV1/assets/consoles/ucg-max.png.mjs +0 -3
  413. package/lib/components/ResourceCalculatorV1/assets/consoles/ucg-max.png.mjs.map +0 -1
  414. package/lib/helpers/product.d.ts +0 -87
  415. package/lib/helpers/product.js +0 -346
  416. package/lib/helpers/product.js.map +0 -1
  417. package/lib/helpers/product.mjs +0 -335
  418. package/lib/helpers/product.mjs.map +0 -1
  419. package/lib/types/product.d.ts +0 -87
  420. package/lib/types/product.js +0 -14
  421. package/lib/types/product.js.map +0 -1
  422. package/lib/types/product.mjs +0 -13
  423. package/lib/types/product.mjs.map +0 -1
  424. package/lib/utils/money/allocators/fixedAmount.d.ts +0 -26
  425. package/lib/utils/money/allocators/fixedAmount.js +0 -52
  426. package/lib/utils/money/allocators/fixedAmount.js.map +0 -1
  427. package/lib/utils/money/allocators/fixedAmount.mjs +0 -50
  428. package/lib/utils/money/allocators/fixedAmount.mjs.map +0 -1
  429. package/lib/utils/money/allocators/index.d.ts +0 -2
  430. package/lib/utils/money/allocators/index.js +0 -8
  431. package/lib/utils/money/allocators/index.js.map +0 -1
  432. package/lib/utils/money/allocators/index.mjs +0 -4
  433. package/lib/utils/money/allocators/index.mjs.map +0 -1
  434. package/lib/utils/money/allocators/productAmount.d.ts +0 -13
  435. package/lib/utils/money/allocators/productAmount.js +0 -98
  436. package/lib/utils/money/allocators/productAmount.js.map +0 -1
  437. package/lib/utils/money/allocators/productAmount.mjs +0 -96
  438. package/lib/utils/money/allocators/productAmount.mjs.map +0 -1
  439. package/lib/utils/money/exchangeRate.d.ts +0 -31
  440. package/lib/utils/money/exchangeRate.js +0 -27
  441. package/lib/utils/money/exchangeRate.js.map +0 -1
  442. package/lib/utils/money/exchangeRate.mjs +0 -23
  443. package/lib/utils/money/exchangeRate.mjs.map +0 -1
  444. package/lib/utils/money/misc.private.d.ts +0 -23
  445. package/lib/utils/money/misc.private.js +0 -46
  446. package/lib/utils/money/misc.private.js.map +0 -1
  447. package/lib/utils/money/misc.private.mjs +0 -21
  448. package/lib/utils/money/misc.private.mjs.map +0 -1
  449. package/lib/utils/money/shipping.d.ts +0 -5
  450. package/lib/utils/money/shipping.js +0 -8
  451. package/lib/utils/money/shipping.js.map +0 -1
  452. package/lib/utils/money/shipping.mjs +0 -6
  453. package/lib/utils/money/shipping.mjs.map +0 -1
  454. package/lib/utils/money/tax.private.d.ts +0 -17
  455. package/lib/utils/money/tax.private.js +0 -65
  456. package/lib/utils/money/tax.private.js.map +0 -1
  457. package/lib/utils/money/tax.private.mjs +0 -60
  458. package/lib/utils/money/tax.private.mjs.map +0 -1
  459. package/lib/utils/productSort.d.ts +0 -41
  460. package/lib/utils/productSort.js +0 -67
  461. package/lib/utils/productSort.js.map +0 -1
  462. package/lib/utils/productSort.mjs +0 -60
  463. package/lib/utils/productSort.mjs.map +0 -1
  464. /package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/index.d.ts +0 -0
  465. /package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/index.js +0 -0
  466. /package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/index.js.map +0 -0
  467. /package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/index.mjs +0 -0
  468. /package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/index.mjs.map +0 -0
  469. /package/lib/components/{Header/Navigation/ProMenu → ResourceCalculatorV1/components}/index.mjs.map +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ux.mjs","sources":["../../src/helpers/ux.ts"],"sourcesContent":["import type { FlattenSimpleInterpolation } from \"styled-components\";\n\nconst SCROLL_INTO_VIEW_DEFAULT_DURATION = 600;\n\n/**\n * Same as `window.scrollTo` but allows custom duration\n *\n * ! The scroll action won't be replaced if called multiple times\n * ? Instead `useScrollToY` hook will do that if needed\n */\nexport const scrollToY = (targetY: number, duration: number) => {\n let start: number;\n let previousTimeStamp: number;\n const initY = window.scrollY;\n const limit =\n document.documentElement.scrollHeight -\n document.documentElement.clientHeight;\n\n function step(timestamp: number) {\n start === undefined && (start = timestamp);\n const elapsed = timestamp - start;\n const progress = (timestamp - start) / duration;\n\n if (previousTimeStamp !== timestamp) {\n window.scroll({\n top: ((targetY > limit ? limit : targetY) - initY) * progress + initY,\n });\n }\n\n if (elapsed < duration) {\n previousTimeStamp = timestamp;\n window.requestAnimationFrame(step);\n } else {\n window.scroll({\n top: targetY,\n });\n }\n }\n\n window.requestAnimationFrame(step);\n};\n\n/**\n * Scrolls to the element on the page\n *\n * ! This will scroll the entire page, do not use for inline scrolling\n *\n * @todo use Element.scrollIntoView() or Element.scrollIntoViewIfNeeded() when it's fully supported\n */\nexport const scrollIntoView = (\n element: Element | null,\n duration = SCROLL_INTO_VIEW_DEFAULT_DURATION,\n) => {\n if (typeof window === \"undefined\") return;\n if (!element) return;\n\n // Get scroll y target position\n const elementWindowY = element.getBoundingClientRect().top + window.scrollY;\n // Scroll to the element minus one third of the window height (so that it's at an optimal eye level)\n const y = elementWindowY - window.innerHeight * (1 / 3);\n\n // Animate\n scrollToY(y, duration);\n};\n\n/**\n * For use in styled components to reduce switch noise\n *\n * @deprecated Let's replace this with native switches - if ain't broke...\n * @example styledSwitch(variableWithMultipleCases, {\n * whenValueIsX: css`background: red;`,\n * whenValueIsY: css`background: blue;`,\n * })\n */\nexport function styledSwitch<K extends string>(\n value: K,\n cases: Record<K, FlattenSimpleInterpolation | string>,\n) {\n return cases[value];\n}\n\n/**\n * Get true page offset Y summing own and all parent offsets\n */\nexport const getTrueOffsetY = (el: HTMLElement) => {\n let offset = el.offsetTop;\n\n if (el.parentElement) {\n offset += getTrueOffsetY(el.parentElement);\n }\n\n return offset;\n};\n\n/**\n * Get true element width and height, including all margins and paddings.\n * Uses computed styles, and supports only margins that use px.\n */\nexport const getTrueSize = (\n el: HTMLElement,\n): { width: number; height: number } => {\n if (typeof window === \"undefined\") {\n return { width: 0, height: 0 };\n }\n\n const style = window.getComputedStyle(el);\n const px = (value: string): number =>\n /^[0-9]+px$/.test(value) ? parseFloat(value) : 0;\n\n return {\n width: el.offsetWidth + px(style.marginLeft) + px(style.marginRight),\n height: el.offsetHeight + px(style.marginTop) + px(style.marginBottom),\n };\n};\n"],"names":["SCROLL_INTO_VIEW_DEFAULT_DURATION","scrollToY","targetY","duration","start","previousTimeStamp","initY","window","scrollY","limit","document","documentElement","scrollHeight","clientHeight","step","timestamp","elapsed","progress","scroll","top","requestAnimationFrame","scrollIntoView","element","elementWindowY","getBoundingClientRect","y","innerHeight","styledSwitch","value","cases","getTrueOffsetY","el","offset","offsetTop","parentElement","getTrueSize","width","height","style","getComputedStyle","px","test","parseFloat","offsetWidth","marginLeft","marginRight","offsetHeight","marginTop","marginBottom"],"mappings":";;AAEA,MAAMA,iCAAoC,GAAA,GAAA;AAQ7B,MAAAC,SAAA,GAAYA,CAACC,OAAA,EAAiBC,QAAqB,KAAA;EAC1D,IAAAC,KAAA;EACA,IAAAC,iBAAA;EACJ,MAAMC,QAAQC,MAAO,CAAAC,OAAA;EACrB,MAAMC,KACJ,GAAAC,QAAA,CAASC,eAAgB,CAAAC,YAAA,GACzBF,SAASC,eAAgB,CAAAE,YAAA;EAE3B,SAASC,KAAKC,SAAmB,EAAA;IAC/BX,KAAA,KAAU,WAAcA,KAAQ,GAAAW,SAAA,CAAA;IAChC,MAAMC,UAAUD,SAAY,GAAAX,KAAA;IACtB,MAAAa,QAAA,GAAA,CAAYF,YAAYX,KAAS,IAAAD,QAAA;IAEvC,IAAIE,sBAAsBU,SAAW,EAAA;MACnCR,MAAA,CAAOW,MAAO,CAAA;QACZC,OAAOjB,OAAU,GAAAO,KAAA,GAAQA,KAAQ,GAAAP,OAAA,IAAWI,SAASW,QAAW,GAAAX;MAAA,C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,CAAA,GAAIc,UAAW,CAAAd,KAAK,CAAI,GAAA,CAAA;EAE1C,OAAA;IACLQ,KAAA,EAAOL,GAAGY,WAAc,GAAAH,EAAA,CAAGF,MAAMM,UAAU,CAAA,GAAIJ,EAAG,CAAAF,KAAA,CAAMO,WAAW,CAAA;IACnER,MAAA,EAAQN,GAAGe,YAAe,GAAAN,EAAA,CAAGF,MAAMS,SAAS,CAAA,GAAIP,EAAG,CAAAF,KAAA,CAAMU,YAAY;EAAA,CACvE;AACF,CAAA;"}
1
+ {"version":3,"file":"ux.mjs","sources":["../../src/helpers/ux.ts"],"sourcesContent":["import type { FlattenSimpleInterpolation } from \"styled-components\";\n\nconst SCROLL_INTO_VIEW_DEFAULT_DURATION = 600;\n\n/**\n * Same as `window.scrollTo` but allows custom duration\n *\n * ! The scroll action won't be replaced if called multiple times\n * ? Instead `useScrollToY` hook will do that if needed\n */\nexport const scrollToY = (targetY: number, duration: number) => {\n let start: number;\n let previousTimeStamp: number;\n const initY = window.scrollY;\n const limit =\n document.documentElement.scrollHeight -\n document.documentElement.clientHeight;\n\n function step(timestamp: number) {\n start === undefined && (start = timestamp);\n const elapsed = timestamp - start;\n const progress = (timestamp - start) / duration;\n\n if (previousTimeStamp !== timestamp) {\n window.scroll({\n top: ((targetY > limit ? limit : targetY) - initY) * progress + initY,\n });\n }\n\n if (elapsed < duration) {\n previousTimeStamp = timestamp;\n window.requestAnimationFrame(step);\n } else {\n window.scroll({\n top: targetY,\n });\n }\n }\n\n window.requestAnimationFrame(step);\n};\n\n/**\n * Scrolls to the element on the page\n *\n * ! This will scroll the entire page, do not use for inline scrolling\n *\n * @todo use Element.scrollIntoView() or Element.scrollIntoViewIfNeeded() when it's fully supported\n */\nexport const scrollIntoView = (\n element: Element | null,\n duration = SCROLL_INTO_VIEW_DEFAULT_DURATION,\n) => {\n if (typeof window === \"undefined\") return;\n if (!element) return;\n\n // Get scroll y target position\n const elementWindowY = element.getBoundingClientRect().top + window.scrollY;\n // Scroll to the element minus one third of the window height (so that it's at an optimal eye level)\n const y = elementWindowY - window.innerHeight * (1 / 3);\n\n // Animate\n scrollToY(y, duration);\n};\n\n/**\n * For use in styled components to reduce switch noise\n *\n * @deprecated Let's replace this with native switches - if ain't broke...\n * @example styledSwitch(variableWithMultipleCases, {\n * whenValueIsX: css`background: red;`,\n * whenValueIsY: css`background: blue;`,\n * })\n */\nexport function styledSwitch(\n value: string,\n cases: Record<string, FlattenSimpleInterpolation | string>,\n) {\n return cases[value];\n}\n\n/**\n * Get true page offset Y summing own and all parent offsets\n */\nexport const getTrueOffsetY = (el: HTMLElement) => {\n let offset = el.offsetTop;\n\n if (el.parentElement) {\n offset += getTrueOffsetY(el.parentElement);\n }\n\n return offset;\n};\n"],"names":["SCROLL_INTO_VIEW_DEFAULT_DURATION","scrollToY","targetY","duration","start","previousTimeStamp","initY","window","scrollY","limit","document","documentElement","scrollHeight","clientHeight","step","timestamp","elapsed","progress","scroll","top","requestAnimationFrame","scrollIntoView","element","elementWindowY","getBoundingClientRect","y","innerHeight","styledSwitch","value","cases","getTrueOffsetY","el","offset","offsetTop","parentElement"],"mappings":";;AAEA,MAAMA,iCAAoC,GAAA,GAAA;AAQ7B,MAAAC,SAAA,GAAYA,CAACC,OAAA,EAAiBC,QAAqB,KAAA;EAC1D,IAAAC,KAAA;EACA,IAAAC,iBAAA;EACJ,MAAMC,QAAQC,MAAO,CAAAC,OAAA;EACrB,MAAMC,KACJ,GAAAC,QAAA,CAASC,eAAgB,CAAAC,YAAA,GACzBF,SAASC,eAAgB,CAAAE,YAAA;EAE3B,SAASC,KAAKC,SAAmB,EAAA;IAC/BX,KAAA,KAAU,WAAcA,KAAQ,GAAAW,SAAA,CAAA;IAChC,MAAMC,UAAUD,SAAY,GAAAX,KAAA;IACtB,MAAAa,QAAA,GAAA,CAAYF,YAAYX,KAAS,IAAAD,QAAA;IAEvC,IAAIE,sBAAsBU,SAAW,EAAA;MACnCR,MAAA,CAAOW,MAAO,CAAA;QACZC,OAAOjB,OAAU,GAAAO,KAAA,GAAQA,KAAQ,GAAAP,OAAA,IAAWI,SAASW,QAAW,GAAAX;MAAA,CACjE,CAAA;IACH;IAEA,IAAIU,UAAUb,QAAU,EAAA;MACFE,iBAAA,GAAAU,SAAA;MACpBR,MAAA,CAAOa,sBAAsBN,IAAI,CAAA;IAAA,CAC5B,MAAA;MACLP,MAAA,CAAOW,MAAO,CAAA;QACZC,GAAK,EAAAjB;MAAA,CACN,CAAA;IACH;EACF;EAEAK,MAAA,CAAOa,sBAAsBN,IAAI,CAAA;AACnC,CAAA;AASO,MAAMO,cAAiB,GAAAA,CAC5BC,OACA,EAAAnB,QAAA,GAAWH,iCACR,KAAA;EACC,IAAA,OAAOO,WAAW,WAAa,EAAA;EACnC,IAAI,CAACe,OAAS,EAAA;EAGd,MAAMC,cAAiB,GAAAD,OAAA,CAAQE,qBAAsB,CAAA,CAAA,CAAEL,MAAMZ,MAAO,CAAAC,OAAA;EAEpE,MAAMiB,CAAI,GAAAF,cAAA,GAAiBhB,MAAO,CAAAmB,WAAA,IAAe,CAAI,GAAA,CAAA,CAAA;EAGrDzB,SAAA,CAAUwB,GAAGtB,QAAQ,CAAA;AACvB,CAAA;AAWgB,SAAAwB,YAAAA,CACdC,OACAC,KACA,EAAA;EACA,OAAOA,MAAMD,KAAK,CAAA;AACpB;AAKa,MAAAE,cAAA,GAAkBC,EAAoB,IAAA;EACjD,IAAIC,SAASD,EAAG,CAAAE,SAAA;EAEhB,IAAIF,GAAGG,aAAe,EAAA;IACVF,MAAA,IAAAF,cAAA,CAAeC,GAAGG,aAAa,CAAA;EAC3C;EAEO,OAAAF,MAAA;AACT,CAAA;"}
@@ -3,4 +3,3 @@ export * from "./constants";
3
3
  export * from "./generated";
4
4
  export * from "./object";
5
5
  export * from "./utils";
6
- export * from "./product";
@@ -5,7 +5,6 @@ var constants = require('./constants.js');
5
5
  var generated = require('./generated.js');
6
6
  require('./object.js');
7
7
  require('./utils.js');
8
- var product = require('./product.js');
9
8
  "use strict";
10
9
  exports.AddressUsageType = constants.AddressUsageType;
11
10
  exports.Language = constants.Language;
@@ -19,5 +18,4 @@ exports.Unit = generated.Unit;
19
18
  exports.UnitSystem = generated.UnitSystem;
20
19
  exports.UserAssignedCountryCode = generated.UserAssignedCountryCode;
21
20
  exports.ValidateTaxStatus = generated.ValidateTaxStatus;
22
- exports.DisplayProductStatus = product.DisplayProductStatus;
23
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
@@ -3,6 +3,5 @@ export { AddressUsageType, Language } from './constants.mjs';
3
3
  export { AddressType, CountryCode, Currency, GlobalStoreId, ProductLine, StoreId, Unit, UnitSystem, UserAssignedCountryCode, ValidateTaxStatus } from './generated.mjs';
4
4
  import './object.mjs';
5
5
  import './utils.mjs';
6
- export { DisplayProductStatus } from './product.mjs';
7
6
  "use strict";
8
7
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -28,7 +28,3 @@ export declare const arraySafeIndexFind: <T>(array: T[], index: number) => T | u
28
28
  * Normalise sort result to be in range of -1 to 1 so that we can easily combine multiple sorts
29
29
  */
30
30
  export declare const normalizeSortResult: (sortResult: number) => number;
31
- /**
32
- * Combine multiple sort functions into one
33
- */
34
- export declare const combineSorts: <T>(sorts: ((a: T, b: T) => number)[]) => ((a: T, b: T) => number);
@@ -24,19 +24,9 @@ const arraySafeIndexFind = (array, index) => {
24
24
  return array[safeIndex];
25
25
  };
26
26
  const normalizeSortResult = sortResult => number.clamp(sortResult, -1, 1);
27
- const combineSorts = sorts => (a, b) => {
28
- for (const sort of sorts) {
29
- const result = sort(a, b);
30
- if (result !== 0) {
31
- return result;
32
- }
33
- }
34
- return 0;
35
- };
36
27
  exports.areEqualArrays = areEqualArrays;
37
28
  exports.arraySafeIndex = arraySafeIndex;
38
29
  exports.arraySafeIndexFind = arraySafeIndexFind;
39
- exports.combineSorts = combineSorts;
40
30
  exports.dedupe = dedupe;
41
31
  exports.ensureArray = ensureArray;
42
32
  exports.normalizeSortResult = normalizeSortResult;
@@ -1 +1 @@
1
- {"version":3,"file":"array.js","sources":["../../src/utils/array.ts"],"sourcesContent":["import { clamp } from \"./number\";\n\n/**\n * Make sure the element is an array\n * If it's not, make it an array of one element\n */\nexport function ensureArray<T>(value: T | T[]): T[] {\n return Array.isArray(value) ? value : [value];\n}\n\n/**\n * Utility to quickly remove duplicates from an array.\n *\n * Similar to lodash's `uniq`, but doesn't require lodash as dependency.\n */\nexport const dedupe = <T>(arr: T[]) => [...new Set(arr)];\n\n/**\n * Utility function check if given arrays contain same elements (regardless the order)\n *\n * @example\n * areArraysEqual([1, 2, 3], [3, 2, 1]) // true\n * areArraysEqual([1, 2, 3], [3, 2, 1, 4]) // false\n */\nexport const areEqualArrays = (a: string[], b: string[]): boolean => {\n if (a.length !== b.length) {\n return false;\n }\n if (!a.every((el) => b.includes(el))) {\n return false;\n }\n return !b.every((el) => a.includes(el)) ? false : true;\n};\n\n/**\n * Function to get array index by positive and negative wrap-around offsets\n *\n * @see https://dirask.com/posts/JavaScript-positive-and-negative-around-index-wrapping-overlapping-to-address-items-in-array-pVyrnD\n */\nexport const arraySafeIndex = <T>(array: T[], index: number): number => {\n const indexSize = array.length;\n\n return ((index % indexSize) + indexSize) % indexSize;\n};\n\nexport const arraySafeIndexFind = <T>(\n array: T[],\n index: number,\n): T | undefined => {\n const safeIndex = arraySafeIndex(array, index);\n\n return array[safeIndex];\n};\n\n/**\n * Normalise sort result to be in range of -1 to 1 so that we can easily combine multiple sorts\n */\nexport const normalizeSortResult = (sortResult: number): number =>\n clamp(sortResult, -1, 1);\n\n/**\n * Combine multiple sort functions into one\n */\nexport const combineSorts =\n <T>(sorts: ((a: T, b: T) => number)[]): ((a: T, b: T) => number) =>\n (a, b) => {\n for (const sort of sorts) {\n const result = sort(a, b);\n\n if (result !== 0) {\n return result;\n }\n }\n\n return 0;\n };\n"],"names":["ensureArray","value","Array","isArray","dedupe","arr","Set","areEqualArrays","a","b","length","every","el","includes","arraySafeIndex","array","index","indexSize","arraySafeIndexFind","safeIndex","normalizeSortResult","sortResult","clamp","combineSorts","sorts","sort","result"],"mappings":";;;;AAMO,SAASA,YAAeC,KAAqB,EAAA;EAClD,OAAOC,MAAMC,OAAQ,CAAAF,KAAK,CAAI,GAAAA,KAAA,GAAQ,CAACA,KAAK,CAAA;AAC9C;AAOa,MAAAG,MAAA,GAAaC,GAAa,IAAA,CAAC,GAAG,IAAIC,GAAA,CAAID,GAAG,CAAC,CAAA;AAS1C,MAAAE,cAAA,GAAiBA,CAACC,CAAA,EAAaC,CAAyB,KAAA;EAC/D,IAAAD,CAAA,CAAEE,MAAW,KAAAD,CAAA,CAAEC,MAAQ,EAAA;IAClB,OAAA,KAAA;EACT;EACI,IAAA,CAACF,EAAEG,KAAM,CAACC,MAAOH,CAAE,CAAAI,QAAA,CAASD,EAAE,CAAC,CAAG,EAAA;IAC7B,OAAA,KAAA;EACT;EACO,OAAA,CAACH,CAAE,CAAAE,KAAA,CAAOC,EAAA,IAAOJ,EAAEK,QAAS,CAAAD,EAAE,CAAC,CAAA,GAAI,KAAQ,GAAA,IAAA;AACpD,CAAA;AAOa,MAAAE,cAAA,GAAiBA,CAAIC,KAAA,EAAYC,KAA0B,KAAA;EACtE,MAAMC,YAAYF,KAAM,CAAAL,MAAA;EAEf,OAAA,CAAAM,KAAA,GAAQC,YAAaA,SAAa,IAAAA,SAAA;AAC7C,CAAA;AAEa,MAAAC,kBAAA,GAAqBA,CAChCH,KAAA,EACAC,KACkB,KAAA;EACZ,MAAAG,SAAA,GAAYL,cAAe,CAAAC,KAAA,EAAOC,KAAK,CAAA;EAE7C,OAAOD,MAAMI,SAAS,CAAA;AACxB,CAAA;AAKO,MAAMC,sBAAuBC,UAAA,IAClCC,MAAAA,CAAAA,KAAM,CAAAD,UAAA,EAAY,IAAI,CAAC,CAAA;AAKlB,MAAME,YACX,GAAIC,KACJ,IAAA,CAAChB,GAAGC,CAAM,KAAA;EACR,KAAA,MAAWgB,QAAQD,KAAO,EAAA;IAClB,MAAAE,MAAA,GAASD,IAAK,CAAAjB,CAAA,EAAGC,CAAC,CAAA;IAExB,IAAIiB,WAAW,CAAG,EAAA;MACT,OAAAA,MAAA;IACT;EACF;EAEO,OAAA,CAAA;AACT,CAAA;;;;;;;"}
1
+ {"version":3,"file":"array.js","sources":["../../src/utils/array.ts"],"sourcesContent":["import { clamp } from \"./number\";\n\n/**\n * Make sure the element is an array\n * If it's not, make it an array of one element\n */\nexport function ensureArray<T>(value: T | T[]): T[] {\n return Array.isArray(value) ? value : [value];\n}\n\n/**\n * Utility to quickly remove duplicates from an array.\n *\n * Similar to lodash's `uniq`, but doesn't require lodash as dependency.\n */\nexport const dedupe = <T>(arr: T[]) => [...new Set(arr)];\n\n/**\n * Utility function check if given arrays contain same elements (regardless the order)\n *\n * @example\n * areArraysEqual([1, 2, 3], [3, 2, 1]) // true\n * areArraysEqual([1, 2, 3], [3, 2, 1, 4]) // false\n */\nexport const areEqualArrays = (a: string[], b: string[]): boolean => {\n if (a.length !== b.length) {\n return false;\n }\n if (!a.every((el) => b.includes(el))) {\n return false;\n }\n return !b.every((el) => a.includes(el)) ? false : true;\n};\n\n/**\n * Function to get array index by positive and negative wrap-around offsets\n *\n * @see https://dirask.com/posts/JavaScript-positive-and-negative-around-index-wrapping-overlapping-to-address-items-in-array-pVyrnD\n */\nexport const arraySafeIndex = <T>(array: T[], index: number): number => {\n const indexSize = array.length;\n\n return ((index % indexSize) + indexSize) % indexSize;\n};\n\nexport const arraySafeIndexFind = <T>(\n array: T[],\n index: number,\n): T | undefined => {\n const safeIndex = arraySafeIndex(array, index);\n\n return array[safeIndex];\n};\n\n/**\n * Normalise sort result to be in range of -1 to 1 so that we can easily combine multiple sorts\n */\nexport const normalizeSortResult = (sortResult: number): number =>\n clamp(sortResult, -1, 1);\n"],"names":["ensureArray","value","Array","isArray","dedupe","arr","Set","areEqualArrays","a","b","length","every","el","includes","arraySafeIndex","array","index","indexSize","arraySafeIndexFind","safeIndex","normalizeSortResult","sortResult","clamp"],"mappings":";;;;AAMO,SAASA,YAAeC,KAAqB,EAAA;EAClD,OAAOC,MAAMC,OAAQ,CAAAF,KAAK,CAAI,GAAAA,KAAA,GAAQ,CAACA,KAAK,CAAA;AAC9C;AAOa,MAAAG,MAAA,GAAaC,GAAa,IAAA,CAAC,GAAG,IAAIC,GAAA,CAAID,GAAG,CAAC,CAAA;AAS1C,MAAAE,cAAA,GAAiBA,CAACC,CAAA,EAAaC,CAAyB,KAAA;EAC/D,IAAAD,CAAA,CAAEE,MAAW,KAAAD,CAAA,CAAEC,MAAQ,EAAA;IAClB,OAAA,KAAA;EACT;EACI,IAAA,CAACF,EAAEG,KAAM,CAACC,MAAOH,CAAE,CAAAI,QAAA,CAASD,EAAE,CAAC,CAAG,EAAA;IAC7B,OAAA,KAAA;EACT;EACO,OAAA,CAACH,CAAE,CAAAE,KAAA,CAAOC,EAAA,IAAOJ,EAAEK,QAAS,CAAAD,EAAE,CAAC,CAAA,GAAI,KAAQ,GAAA,IAAA;AACpD,CAAA;AAOa,MAAAE,cAAA,GAAiBA,CAAIC,KAAA,EAAYC,KAA0B,KAAA;EACtE,MAAMC,YAAYF,KAAM,CAAAL,MAAA;EAEf,OAAA,CAAAM,KAAA,GAAQC,YAAaA,SAAa,IAAAA,SAAA;AAC7C,CAAA;AAEa,MAAAC,kBAAA,GAAqBA,CAChCH,KAAA,EACAC,KACkB,KAAA;EACZ,MAAAG,SAAA,GAAYL,cAAe,CAAAC,KAAA,EAAOC,KAAK,CAAA;EAE7C,OAAOD,MAAMI,SAAS,CAAA;AACxB,CAAA;AAKO,MAAMC,sBAAuBC,UAAA,IAClCC,MAAAA,CAAAA,KAAM,CAAAD,UAAA,EAAY,IAAI,CAAC,CAAA;;;;;;"}
@@ -22,14 +22,5 @@ const arraySafeIndexFind = (array, index) => {
22
22
  return array[safeIndex];
23
23
  };
24
24
  const normalizeSortResult = sortResult => clamp(sortResult, -1, 1);
25
- const combineSorts = sorts => (a, b) => {
26
- for (const sort of sorts) {
27
- const result = sort(a, b);
28
- if (result !== 0) {
29
- return result;
30
- }
31
- }
32
- return 0;
33
- };
34
- export { areEqualArrays, arraySafeIndex, arraySafeIndexFind, combineSorts, dedupe, ensureArray, normalizeSortResult };
25
+ export { areEqualArrays, arraySafeIndex, arraySafeIndexFind, dedupe, ensureArray, normalizeSortResult };
35
26
  //# sourceMappingURL=array.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"array.mjs","sources":["../../src/utils/array.ts"],"sourcesContent":["import { clamp } from \"./number\";\n\n/**\n * Make sure the element is an array\n * If it's not, make it an array of one element\n */\nexport function ensureArray<T>(value: T | T[]): T[] {\n return Array.isArray(value) ? value : [value];\n}\n\n/**\n * Utility to quickly remove duplicates from an array.\n *\n * Similar to lodash's `uniq`, but doesn't require lodash as dependency.\n */\nexport const dedupe = <T>(arr: T[]) => [...new Set(arr)];\n\n/**\n * Utility function check if given arrays contain same elements (regardless the order)\n *\n * @example\n * areArraysEqual([1, 2, 3], [3, 2, 1]) // true\n * areArraysEqual([1, 2, 3], [3, 2, 1, 4]) // false\n */\nexport const areEqualArrays = (a: string[], b: string[]): boolean => {\n if (a.length !== b.length) {\n return false;\n }\n if (!a.every((el) => b.includes(el))) {\n return false;\n }\n return !b.every((el) => a.includes(el)) ? false : true;\n};\n\n/**\n * Function to get array index by positive and negative wrap-around offsets\n *\n * @see https://dirask.com/posts/JavaScript-positive-and-negative-around-index-wrapping-overlapping-to-address-items-in-array-pVyrnD\n */\nexport const arraySafeIndex = <T>(array: T[], index: number): number => {\n const indexSize = array.length;\n\n return ((index % indexSize) + indexSize) % indexSize;\n};\n\nexport const arraySafeIndexFind = <T>(\n array: T[],\n index: number,\n): T | undefined => {\n const safeIndex = arraySafeIndex(array, index);\n\n return array[safeIndex];\n};\n\n/**\n * Normalise sort result to be in range of -1 to 1 so that we can easily combine multiple sorts\n */\nexport const normalizeSortResult = (sortResult: number): number =>\n clamp(sortResult, -1, 1);\n\n/**\n * Combine multiple sort functions into one\n */\nexport const combineSorts =\n <T>(sorts: ((a: T, b: T) => number)[]): ((a: T, b: T) => number) =>\n (a, b) => {\n for (const sort of sorts) {\n const result = sort(a, b);\n\n if (result !== 0) {\n return result;\n }\n }\n\n return 0;\n };\n"],"names":["ensureArray","value","Array","isArray","dedupe","arr","Set","areEqualArrays","a","b","length","every","el","includes","arraySafeIndex","array","index","indexSize","arraySafeIndexFind","safeIndex","normalizeSortResult","sortResult","clamp","combineSorts","sorts","sort","result"],"mappings":";;AAMO,SAASA,YAAeC,KAAqB,EAAA;EAClD,OAAOC,MAAMC,OAAQ,CAAAF,KAAK,CAAI,GAAAA,KAAA,GAAQ,CAACA,KAAK,CAAA;AAC9C;AAOa,MAAAG,MAAA,GAAaC,GAAa,IAAA,CAAC,GAAG,IAAIC,GAAA,CAAID,GAAG,CAAC,CAAA;AAS1C,MAAAE,cAAA,GAAiBA,CAACC,CAAA,EAAaC,CAAyB,KAAA;EAC/D,IAAAD,CAAA,CAAEE,MAAW,KAAAD,CAAA,CAAEC,MAAQ,EAAA;IAClB,OAAA,KAAA;EACT;EACI,IAAA,CAACF,EAAEG,KAAM,CAACC,MAAOH,CAAE,CAAAI,QAAA,CAASD,EAAE,CAAC,CAAG,EAAA;IAC7B,OAAA,KAAA;EACT;EACO,OAAA,CAACH,CAAE,CAAAE,KAAA,CAAOC,EAAA,IAAOJ,EAAEK,QAAS,CAAAD,EAAE,CAAC,CAAA,GAAI,KAAQ,GAAA,IAAA;AACpD,CAAA;AAOa,MAAAE,cAAA,GAAiBA,CAAIC,KAAA,EAAYC,KAA0B,KAAA;EACtE,MAAMC,YAAYF,KAAM,CAAAL,MAAA;EAEf,OAAA,CAAAM,KAAA,GAAQC,YAAaA,SAAa,IAAAA,SAAA;AAC7C,CAAA;AAEa,MAAAC,kBAAA,GAAqBA,CAChCH,KAAA,EACAC,KACkB,KAAA;EACZ,MAAAG,SAAA,GAAYL,cAAe,CAAAC,KAAA,EAAOC,KAAK,CAAA;EAE7C,OAAOD,MAAMI,SAAS,CAAA;AACxB,CAAA;AAKO,MAAMC,sBAAuBC,UAAA,IAClCC,KAAM,CAAAD,UAAA,EAAY,IAAI,CAAC,CAAA;AAKlB,MAAME,YACX,GAAIC,KACJ,IAAA,CAAChB,GAAGC,CAAM,KAAA;EACR,KAAA,MAAWgB,QAAQD,KAAO,EAAA;IAClB,MAAAE,MAAA,GAASD,IAAK,CAAAjB,CAAA,EAAGC,CAAC,CAAA;IAExB,IAAIiB,WAAW,CAAG,EAAA;MACT,OAAAA,MAAA;IACT;EACF;EAEO,OAAA,CAAA;AACT,CAAA;"}
1
+ {"version":3,"file":"array.mjs","sources":["../../src/utils/array.ts"],"sourcesContent":["import { clamp } from \"./number\";\n\n/**\n * Make sure the element is an array\n * If it's not, make it an array of one element\n */\nexport function ensureArray<T>(value: T | T[]): T[] {\n return Array.isArray(value) ? value : [value];\n}\n\n/**\n * Utility to quickly remove duplicates from an array.\n *\n * Similar to lodash's `uniq`, but doesn't require lodash as dependency.\n */\nexport const dedupe = <T>(arr: T[]) => [...new Set(arr)];\n\n/**\n * Utility function check if given arrays contain same elements (regardless the order)\n *\n * @example\n * areArraysEqual([1, 2, 3], [3, 2, 1]) // true\n * areArraysEqual([1, 2, 3], [3, 2, 1, 4]) // false\n */\nexport const areEqualArrays = (a: string[], b: string[]): boolean => {\n if (a.length !== b.length) {\n return false;\n }\n if (!a.every((el) => b.includes(el))) {\n return false;\n }\n return !b.every((el) => a.includes(el)) ? false : true;\n};\n\n/**\n * Function to get array index by positive and negative wrap-around offsets\n *\n * @see https://dirask.com/posts/JavaScript-positive-and-negative-around-index-wrapping-overlapping-to-address-items-in-array-pVyrnD\n */\nexport const arraySafeIndex = <T>(array: T[], index: number): number => {\n const indexSize = array.length;\n\n return ((index % indexSize) + indexSize) % indexSize;\n};\n\nexport const arraySafeIndexFind = <T>(\n array: T[],\n index: number,\n): T | undefined => {\n const safeIndex = arraySafeIndex(array, index);\n\n return array[safeIndex];\n};\n\n/**\n * Normalise sort result to be in range of -1 to 1 so that we can easily combine multiple sorts\n */\nexport const normalizeSortResult = (sortResult: number): number =>\n clamp(sortResult, -1, 1);\n"],"names":["ensureArray","value","Array","isArray","dedupe","arr","Set","areEqualArrays","a","b","length","every","el","includes","arraySafeIndex","array","index","indexSize","arraySafeIndexFind","safeIndex","normalizeSortResult","sortResult","clamp"],"mappings":";;AAMO,SAASA,YAAeC,KAAqB,EAAA;EAClD,OAAOC,MAAMC,OAAQ,CAAAF,KAAK,CAAI,GAAAA,KAAA,GAAQ,CAACA,KAAK,CAAA;AAC9C;AAOa,MAAAG,MAAA,GAAaC,GAAa,IAAA,CAAC,GAAG,IAAIC,GAAA,CAAID,GAAG,CAAC,CAAA;AAS1C,MAAAE,cAAA,GAAiBA,CAACC,CAAA,EAAaC,CAAyB,KAAA;EAC/D,IAAAD,CAAA,CAAEE,MAAW,KAAAD,CAAA,CAAEC,MAAQ,EAAA;IAClB,OAAA,KAAA;EACT;EACI,IAAA,CAACF,EAAEG,KAAM,CAACC,MAAOH,CAAE,CAAAI,QAAA,CAASD,EAAE,CAAC,CAAG,EAAA;IAC7B,OAAA,KAAA;EACT;EACO,OAAA,CAACH,CAAE,CAAAE,KAAA,CAAOC,EAAA,IAAOJ,EAAEK,QAAS,CAAAD,EAAE,CAAC,CAAA,GAAI,KAAQ,GAAA,IAAA;AACpD,CAAA;AAOa,MAAAE,cAAA,GAAiBA,CAAIC,KAAA,EAAYC,KAA0B,KAAA;EACtE,MAAMC,YAAYF,KAAM,CAAAL,MAAA;EAEf,OAAA,CAAAM,KAAA,GAAQC,YAAaA,SAAa,IAAAA,SAAA;AAC7C,CAAA;AAEa,MAAAC,kBAAA,GAAqBA,CAChCH,KAAA,EACAC,KACkB,KAAA;EACZ,MAAAG,SAAA,GAAYL,cAAe,CAAAC,KAAA,EAAOC,KAAK,CAAA;EAE7C,OAAOD,MAAMI,SAAS,CAAA;AACxB,CAAA;AAKO,MAAMC,sBAAuBC,UAAA,IAClCC,KAAM,CAAAD,UAAA,EAAY,IAAI,CAAC,CAAA;"}
@@ -1,68 +1,37 @@
1
- import { Currency, StoreId } from "../../types";
2
- import type { LocalizedCurrency, RoundingFn } from "./types";
3
- export declare const Round: {
4
- /**
5
- * ⚠️ Instead of using Math.round, we HAVE to use this method to round the financial numbers everywhere where we CAN'T
6
- * deal with dinero.js (Dinero.js should be the priority). But often for converting from API requests we have to
7
- * normalise the values so we use this method.
8
- *
9
- * It just a re-export of the dinero.js halfEven (a.k.a bankers rounding) method which is the default rounding method.
10
- * @see https://github.com/dinerojs/dinero.js/blob/main/packages/core/src/round/halfEven.ts
11
- * @see
12
- *
13
- * Compared to Math.round (arithmetic rounding) it differentiates that it changes the `.5` round up or down behaviour based on if the rounded
14
- * number would be an even number. So 1.5 would round to 2 while 2.5 would round to 2.
15
- * See the youtube link below for a brief exclamation on why it's important to use this method over regular rounding (half-up):
16
- * https://youtu.be/yuRdYlZvs1E
17
- *
18
- * If you really want to get knee-deep in the rounding subject, you can read the following:
19
- * https://en.wikipedia.org/wiki/Rounding#Round_half_toward_zero
20
- */
21
- Financial: import("@dinero.js/core").RoundingMode;
22
- Shipping: import("@dinero.js/core").RoundingMode;
23
- Prettify: import("@dinero.js/core").RoundingMode;
24
- Subunit: import("@dinero.js/core").RoundingMode;
25
- };
1
+ import { Currency } from "../../types";
2
+ import type { CurrencyObj } from "./types";
26
3
  /**
27
4
  * Mapping of how prices should be rounded down to "whole numbers" after certain threshold
28
5
  */
29
6
  export declare const prettifyPriceLookup: Map<string, number>;
30
7
  /**
31
- * Map of dinero code to subunit digit count.
8
+ * Map of currencycode to subunit digit count.
32
9
  */
33
- export declare const smallestSubunitLookup: Map<string, [number, RoundingFn]>;
10
+ export declare const smallestSubunitLookup: Map<string, [number, (value: number) => number]>;
34
11
  /**
35
- * Precompiled list for faster currency and locale lookups
12
+ * Mapping of maximum price filter
13
+ * TODO: Add all possible currencies
36
14
  */
37
- export declare const localizedCurrencyLookup: Map<Currency, LocalizedCurrency>;
15
+ export declare const maximumPriceFilterLookup: Map<string, number>;
38
16
  /**
39
- * List of stores that require calculating per single item qty and then combining them to get the total tax amount for a
40
- * single line. Rest of the stores inherit default behavior that tax calculated on whole line item
17
+ * ⚠️ Instead of using Math.round, we HAVE to use this method to round the financial numbers everywhere where we CAN'T
18
+ * deal with dinero.js (Dinero.js should be the priority). But often for converting from API requests we have to
19
+ * normalise the values so we use this method.
20
+ *
21
+ * It just a re-export of the dinero.js halfEven (a.k.a bankers rounding) method which is the default rounding method.
22
+ * @see https://github.com/dinerojs/dinero.js/blob/main/packages/core/src/round/halfEven.ts
23
+ * @see
24
+ *
25
+ * Compared to Math.round (arithmetic rounding) it differentiates that it changes the `.5` round up or down behaviour based on if the rounded
26
+ * number would be an even number. So 1.5 would round to 2 while 2.5 would round to 2.
27
+ * See the youtube link below for a brief exclamation on why it's important to use this method over regular rounding (half-up):
28
+ * https://youtu.be/yuRdYlZvs1E
29
+ *
30
+ * If you really want to get knee-deep in the rounding subject, you can read the following:
31
+ * https://en.wikipedia.org/wiki/Rounding#Round_half_toward_zero
41
32
  */
42
- export declare const storesWithPerItemTaxRate: Set<StoreId>;
33
+ export declare const financialRound: import("@dinero.js/core").RoundingMode;
43
34
  /**
44
- * Dinero currency option block for working with tax rates within dinero
35
+ * Precompiled list for faster currency and locale lookups
45
36
  */
46
- export declare const TAX_RATE_DINERO_CURRENCY: {
47
- base: number;
48
- /**
49
- * We expect the tax rate to be in the range of 0..1
50
- * 0 --> 0%
51
- * 1 --> 100%
52
- * 0.21 --> 21%
53
- * 0.2169 --> 21.69%
54
- * 0.12345678 --> 12.345678%
55
- * !!! Don't change as this value is tied to store.backend DB schema !!!
56
- */
57
- exponent: number;
58
- code: string;
59
- };
60
- export declare const EXCHANGE_RATE_DINERO_CURRENCY: {
61
- base: number;
62
- /**
63
- * We support having certain decimal places for exchange rates
64
- * !!! Don't change as this value is tied to store.backend DB schema !!!
65
- */
66
- exponent: number;
67
- code: string;
68
- };
37
+ export declare const currencyObjLookup: Map<Currency, CurrencyObj>;
@@ -5,33 +5,6 @@ var dinero_js = require('dinero.js');
5
5
  require('../../types/index.js');
6
6
  var generated = require('../../types/generated.js');
7
7
  "use strict";
8
- const Round = {
9
- /**
10
- * ⚠️ Instead of using Math.round, we HAVE to use this method to round the financial numbers everywhere where we CAN'T
11
- * deal with dinero.js (Dinero.js should be the priority). But often for converting from API requests we have to
12
- * normalise the values so we use this method.
13
- *
14
- * It just a re-export of the dinero.js halfEven (a.k.a bankers rounding) method which is the default rounding method.
15
- * @see https://github.com/dinerojs/dinero.js/blob/main/packages/core/src/round/halfEven.ts
16
- * @see
17
- *
18
- * Compared to Math.round (arithmetic rounding) it differentiates that it changes the `.5` round up or down behaviour based on if the rounded
19
- * number would be an even number. So 1.5 would round to 2 while 2.5 would round to 2.
20
- * See the youtube link below for a brief exclamation on why it's important to use this method over regular rounding (half-up):
21
- * https://youtu.be/yuRdYlZvs1E
22
- *
23
- * If you really want to get knee-deep in the rounding subject, you can read the following:
24
- * https://en.wikipedia.org/wiki/Rounding#Round_half_toward_zero
25
- */
26
- Financial: dinero_js.halfEven,
27
- // TODO: maybe we should have separate rounding functions depending on the input value?
28
- // Reading from wiki "Round half toward zero" is better if the value is already "normalized to cents"
29
- // But the "Round half to even" seems better for when working with float like values
30
- // financialRound = Math.round;
31
- Shipping: dinero_js.down,
32
- Prettify: dinero_js.down,
33
- Subunit: dinero_js.halfUp
34
- };
35
8
  const prettifyPriceLookup = /* @__PURE__ */new Map([[currencies.USD.code, 20], [currencies.CAD.code, 20], [currencies.EUR.code, 20], [currencies.GBP.code, 20], [currencies.AED.code, 50],
36
9
  // Approximately every price above ~1.1 usd will be rounded in ZAR
37
10
  [currencies.ZAR.code, 20]]);
@@ -39,8 +12,10 @@ const smallestSubunitLookup = /* @__PURE__ */new Map([
39
12
  /**
40
13
  * TWD does not use subunits at all in day to day transactions.
41
14
  */
42
- [currencies.TWD.code, [0, Round.Subunit]]]);
43
- const localizedCurrencyLookup = /* @__PURE__ */new Map([[generated.Currency.Aed, {
15
+ [currencies.TWD.code, [0, dinero_js.halfUp]]]);
16
+ const maximumPriceFilterLookup = /* @__PURE__ */new Map([[currencies.CAD.code, 7e4], [currencies.EUR.code, 7e4], [currencies.AED.code, 7e4]]);
17
+ const financialRound = dinero_js.halfEven;
18
+ const currencyObjLookup = /* @__PURE__ */new Map([[generated.Currency.Aed, {
44
19
  currency: currencies.AED,
45
20
  locale: "ar-AE"
46
21
  }], [generated.Currency.Bgn, {
@@ -111,49 +86,9 @@ const localizedCurrencyLookup = /* @__PURE__ */new Map([[generated.Currency.Aed,
111
86
  currency: currencies.MXN,
112
87
  locale: "es-MX"
113
88
  }]]);
114
- const storesWithPerItemTaxRate = /* @__PURE__ */new Set([
115
- // #############################################################################
116
- // Stores with custom tax rates
117
- // #############################################################################
118
- generated.StoreId.Br, generated.StoreId.Tw
119
- // #############################################################################
120
- // Stores with Avalara, but will have custom company codes to treat
121
- // FIXME: as PR is rushed we where able to test stores avalara custom codes that enable logic that calculates tax
122
- // "per quantity", so for now disabling this logic and only applying to store with custom tax rates
123
- // #############################################################################
124
- // StoreId.Jp,
125
- // StoreId.Sg,
126
- ]);
127
- const TAX_RATE_DINERO_CURRENCY = {
128
- base: 10,
129
- /**
130
- * We expect the tax rate to be in the range of 0..1
131
- * 0 --> 0%
132
- * 1 --> 100%
133
- * 0.21 --> 21%
134
- * 0.2169 --> 21.69%
135
- * 0.12345678 --> 12.345678%
136
- * !!! Don't change as this value is tied to store.backend DB schema !!!
137
- */
138
- exponent: 8,
139
- code: ""
140
- // Not important
141
- };
142
- const EXCHANGE_RATE_DINERO_CURRENCY = {
143
- base: 10,
144
- /**
145
- * We support having certain decimal places for exchange rates
146
- * !!! Don't change as this value is tied to store.backend DB schema !!!
147
- */
148
- exponent: 6,
149
- code: ""
150
- // Not important
151
- };
152
- exports.EXCHANGE_RATE_DINERO_CURRENCY = EXCHANGE_RATE_DINERO_CURRENCY;
153
- exports.Round = Round;
154
- exports.TAX_RATE_DINERO_CURRENCY = TAX_RATE_DINERO_CURRENCY;
155
- exports.localizedCurrencyLookup = localizedCurrencyLookup;
89
+ exports.currencyObjLookup = currencyObjLookup;
90
+ exports.financialRound = financialRound;
91
+ exports.maximumPriceFilterLookup = maximumPriceFilterLookup;
156
92
  exports.prettifyPriceLookup = prettifyPriceLookup;
157
93
  exports.smallestSubunitLookup = smallestSubunitLookup;
158
- exports.storesWithPerItemTaxRate = storesWithPerItemTaxRate;
159
94
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../src/utils/money/constants.ts"],"sourcesContent":["import {\n AED,\n BGN,\n BRL,\n CAD,\n CHF,\n CZK,\n DKK,\n EUR,\n GBP,\n HRK,\n HUF,\n INR,\n JPY,\n MXN,\n NOK,\n PLN,\n RON,\n SEK,\n SGD,\n TWD,\n USD,\n ZAR,\n} from \"@dinero.js/currencies\";\nimport { down, halfEven, halfUp } from \"dinero.js\";\n\nimport { Currency, StoreId } from \"../../types\";\nimport type {\n Cents,\n DinoCurrency,\n LocalizedCurrency,\n RoundingFn,\n} from \"./types\";\n\n// #############################################################################\n// Constants\n// #############################################################################\n\nexport const Round = {\n /**\n * ⚠️ Instead of using Math.round, we HAVE to use this method to round the financial numbers everywhere where we CAN'T\n * deal with dinero.js (Dinero.js should be the priority). But often for converting from API requests we have to\n * normalise the values so we use this method.\n *\n * It just a re-export of the dinero.js halfEven (a.k.a bankers rounding) method which is the default rounding method.\n * @see https://github.com/dinerojs/dinero.js/blob/main/packages/core/src/round/halfEven.ts\n * @see\n *\n * Compared to Math.round (arithmetic rounding) it differentiates that it changes the `.5` round up or down behaviour based on if the rounded\n * number would be an even number. So 1.5 would round to 2 while 2.5 would round to 2.\n * See the youtube link below for a brief exclamation on why it's important to use this method over regular rounding (half-up):\n * https://youtu.be/yuRdYlZvs1E\n *\n * If you really want to get knee-deep in the rounding subject, you can read the following:\n * https://en.wikipedia.org/wiki/Rounding#Round_half_toward_zero\n */\n Financial: halfEven,\n // TODO: maybe we should have separate rounding functions depending on the input value?\n // Reading from wiki \"Round half toward zero\" is better if the value is already \"normalized to cents\"\n // But the \"Round half to even\" seems better for when working with float like values\n // financialRound = Math.round;\n Shipping: down,\n Prettify: down,\n Subunit: halfUp,\n} satisfies Record<string, RoundingFn>;\n\n/**\n * Mapping of how prices should be rounded down to \"whole numbers\" after certain threshold\n */\nexport const prettifyPriceLookup = new Map([\n [USD.code, 20],\n [CAD.code, 20],\n [EUR.code, 20],\n [GBP.code, 20],\n [AED.code, 50],\n // Approximately every price above ~1.1 usd will be rounded in ZAR\n [ZAR.code, 20],\n]);\n\n/**\n * Map of dinero code to subunit digit count.\n */\nexport const smallestSubunitLookup = new Map<string, [Cents, RoundingFn]>([\n /**\n * TWD does not use subunits at all in day to day transactions.\n */\n [TWD.code, [0, Round.Subunit]],\n]);\n\n/**\n * Precompiled list for faster currency and locale lookups\n */\nexport const localizedCurrencyLookup = new Map<Currency, LocalizedCurrency>([\n [Currency.Aed, { currency: AED, locale: \"ar-AE\" }],\n [Currency.Bgn, { currency: BGN, locale: \"bg-BG\" }],\n [Currency.Cad, { currency: CAD, locale: \"en-CA\" }],\n [Currency.Chf, { currency: CHF, locale: \"it-CH\" }],\n [Currency.Czk, { currency: CZK, locale: \"cs-CZ\" }],\n [Currency.Dkk, { currency: DKK, locale: \"da-DK\" }],\n [Currency.Eur, { currency: EUR, locale: \"de-DE\" }],\n [Currency.Gbp, { currency: GBP, locale: \"en-GB\" }],\n [Currency.Hrk, { currency: HRK, locale: \"hr-HR\" }],\n [Currency.Huf, { currency: HUF, locale: \"hu-HU\" }],\n [Currency.Nok, { currency: NOK, locale: \"no-NO\" }],\n [Currency.Pln, { currency: PLN, locale: \"pl-PL\" }],\n [Currency.Ron, { currency: RON, locale: \"ro-RO\" }],\n [Currency.Sek, { currency: SEK, locale: \"sv-SE\" }],\n [Currency.Usd, { currency: USD, locale: \"en-US\" }],\n [Currency.Zar, { currency: ZAR, locale: \"en-ZA\" }],\n [Currency.Inr, { currency: INR, locale: \"en-IN\" }],\n [Currency.Sgd, { currency: SGD, locale: \"en-SG\" }],\n [Currency.Brl, { currency: BRL, locale: \"pt-BR\" }],\n // NOTE: en-JP Doesn't exist\n [Currency.Jpy, { currency: JPY, locale: \"en-JP\" }],\n // NOTE: en-TW Doesn't exist\n [Currency.Twd, { currency: TWD, locale: \"en-TW\" }],\n [Currency.Mxn, { currency: MXN, locale: \"es-MX\" }],\n]);\n\n// #############################################################################\n// Tax Rate\n// #############################################################################\n/**\n * List of stores that require calculating per single item qty and then combining them to get the total tax amount for a\n * single line. Rest of the stores inherit default behavior that tax calculated on whole line item\n */\nexport const storesWithPerItemTaxRate = new Set([\n // #############################################################################\n // Stores with custom tax rates\n // #############################################################################\n StoreId.Br,\n StoreId.Tw,\n // #############################################################################\n // Stores with Avalara, but will have custom company codes to treat\n // FIXME: as PR is rushed we where able to test stores avalara custom codes that enable logic that calculates tax\n // \"per quantity\", so for now disabling this logic and only applying to store with custom tax rates\n // #############################################################################\n // StoreId.Jp,\n // StoreId.Sg,\n]);\n\n/**\n * Dinero currency option block for working with tax rates within dinero\n */\nexport const TAX_RATE_DINERO_CURRENCY = {\n base: 10,\n /**\n * We expect the tax rate to be in the range of 0..1\n * 0 --> 0%\n * 1 --> 100%\n * 0.21 --> 21%\n * 0.2169 --> 21.69%\n * 0.12345678 --> 12.345678%\n * !!! Don't change as this value is tied to store.backend DB schema !!!\n */\n exponent: 8,\n code: \"\", // Not important\n} satisfies DinoCurrency;\n\n// #############################################################################\n// Exchange Rate\n// #############################################################################\n\nexport const EXCHANGE_RATE_DINERO_CURRENCY = {\n base: 10,\n /**\n * We support having certain decimal places for exchange rates\n * !!! Don't change as this value is tied to store.backend DB schema !!!\n */\n exponent: 6,\n code: \"\", // Not important\n} satisfies DinoCurrency;\n"],"names":["Round","Financial","halfEven","Shipping","down","Prettify","Subunit","halfUp","prettifyPriceLookup","Map","USD","code","CAD","EUR","GBP","AED","ZAR","smallestSubunitLookup","TWD","localizedCurrencyLookup","Currency","Aed","currency","locale","Bgn","BGN","Cad","Chf","CHF","Czk","CZK","Dkk","DKK","Eur","Gbp","Hrk","HRK","Huf","HUF","Nok","NOK","Pln","PLN","Ron","RON","Sek","SEK","Usd","Zar","Inr","INR","Sgd","SGD","Brl","BRL","Jpy","JPY","Twd","Mxn","MXN","storesWithPerItemTaxRate","Set","StoreId","Br","Tw","TAX_RATE_DINERO_CURRENCY","base","exponent","EXCHANGE_RATE_DINERO_CURRENCY"],"mappings":";;;;;;;AAsCO,MAAMA,KAAQ,GAAA;EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAkBnBC,SAAW,EAAAC,SAAA,CAAAA,QAAA;EAAA;EAAA;EAAA;EAAA;EAKXC,QAAU,EAAAC,SAAA,CAAAA,IAAA;EACVC,QAAU,EAAAD,SAAA,CAAAA,IAAA;EACVE,OAAS,EAAAC,SAAA,CAAAA;AACX,CAAA;AAKa,MAAAC,mBAAA,GAAA,mBAA0BC,GAAI,CAAA,CACzC,CAACC,UAAI,CAAAA,GAAA,CAAAC,IAAA,EAAM,EAAE,CAAA,EACb,CAACC,UAAI,CAAAA,GAAA,CAAAD,IAAA,EAAM,EAAE,CAAA,EACb,CAACE,UAAI,CAAAA,GAAA,CAAAF,IAAA,EAAM,EAAE,CAAA,EACb,CAACG,UAAI,CAAAA,GAAA,CAAAH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,CAACH,SAAAA,CAAAA,SAASiC,GAAK,EAAA;EAAE/B,UAAUgC,UAAAA,CAAAA,GAAK;EAAA/B,MAAA,EAAQ;CAAS,CAAA;AAAA;AAEjD,CAACH,SAAAA,CAAAA,SAASmC,GAAK,EAAA;EAAEjC,UAAUkC,UAAAA,CAAAA,GAAK;EAAAjC,MAAA,EAAQ;CAAS,CAAA;AAAA;AAEjD,CAACH,SAAAA,CAAAA,SAASqC,GAAK,EAAA;EAAEnC,UAAUJ,UAAAA,CAAAA,GAAK;EAAAK,MAAA,EAAQ;CAAS,CAAA,EACjD,CAACH,SAAAA,CAAAA,SAASsC,GAAK,EAAA;EAAEpC,UAAUqC,UAAAA,CAAAA,GAAK;EAAApC,MAAA,EAAQ;CAAS,CAAA,CAClD,CAAA;AASY,MAAAqC,wBAAA,GAAA,mBAA+BC,GAAI,CAAA;AAAA;AAAA;AAAA;AAI9CC,SAAAA,CAAAA,OAAQ,CAAAC,EAAA,EACRD,SAAAA,CAAAA,OAAQ,CAAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAQT,CAAA;AAKM,MAAMC,wBAA2B,GAAA;EACtCC,IAAM,EAAA,EAAA;EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAUNC,QAAU,EAAA,CAAA;EACVxD,IAAM,EAAA;EAAA;AACR,CAAA;AAMO,MAAMyD,6BAAgC,GAAA;EAC3CF,IAAM,EAAA,EAAA;EAAA;AAAA;AAAA;AAAA;EAKNC,QAAU,EAAA,CAAA;EACVxD,IAAM,EAAA;EAAA;AACR,CAAA;;;;;;;"}
1
+ {"version":3,"file":"constants.js","sources":["../../../src/utils/money/constants.ts"],"sourcesContent":["import {\n AED,\n BGN,\n BRL,\n CAD,\n CHF,\n CZK,\n DKK,\n EUR,\n GBP,\n HRK,\n HUF,\n INR,\n JPY,\n MXN,\n NOK,\n PLN,\n RON,\n SEK,\n SGD,\n TWD,\n USD,\n ZAR,\n} from \"@dinero.js/currencies\";\nimport { halfEven, halfUp } from \"dinero.js\";\n\nimport { Currency } from \"../../types\";\nimport type { CurrencyObj } from \"./types\";\n\n// #############################################################################\n// Constants\n// #############################################################################\n\n/**\n * Mapping of how prices should be rounded down to \"whole numbers\" after certain threshold\n */\nexport const prettifyPriceLookup = new Map([\n [USD.code, 20],\n [CAD.code, 20],\n [EUR.code, 20],\n [GBP.code, 20],\n [AED.code, 50],\n // Approximately every price above ~1.1 usd will be rounded in ZAR\n [ZAR.code, 20],\n]);\n\n/**\n * Map of currencycode to subunit digit count.\n */\nexport const smallestSubunitLookup = new Map<\n string,\n [number, (value: number) => number]\n>([\n /**\n * TWD does not use subunits at all in day to day transactions.\n */\n [TWD.code, [0, halfUp]],\n]);\n\n/**\n * Mapping of maximum price filter\n * TODO: Add all possible currencies\n */\nexport const maximumPriceFilterLookup = new Map([\n [CAD.code, 70000],\n [EUR.code, 70000],\n [AED.code, 70000],\n]);\n\n/**\n * ⚠️ Instead of using Math.round, we HAVE to use this method to round the financial numbers everywhere where we CAN'T\n * deal with dinero.js (Dinero.js should be the priority). But often for converting from API requests we have to\n * normalise the values so we use this method.\n *\n * It just a re-export of the dinero.js halfEven (a.k.a bankers rounding) method which is the default rounding method.\n * @see https://github.com/dinerojs/dinero.js/blob/main/packages/core/src/round/halfEven.ts\n * @see\n *\n * Compared to Math.round (arithmetic rounding) it differentiates that it changes the `.5` round up or down behaviour based on if the rounded\n * number would be an even number. So 1.5 would round to 2 while 2.5 would round to 2.\n * See the youtube link below for a brief exclamation on why it's important to use this method over regular rounding (half-up):\n * https://youtu.be/yuRdYlZvs1E\n *\n * If you really want to get knee-deep in the rounding subject, you can read the following:\n * https://en.wikipedia.org/wiki/Rounding#Round_half_toward_zero\n */\nexport const financialRound = halfEven;\n// TODO: maybe we should have separate rounding functions depending on the input value?\n// Reading from wiki \"Round half toward zero\" is better if the value is already \"normalized to cents\"\n// But the \"Round half to even\" seems better for when working with float like values\n// export const financialRound = Math.round;\n\n/**\n * Precompiled list for faster currency and locale lookups\n */\nexport const currencyObjLookup = new Map<Currency, CurrencyObj>([\n [Currency.Aed, { currency: AED, locale: \"ar-AE\" }],\n [Currency.Bgn, { currency: BGN, locale: \"bg-BG\" }],\n [Currency.Cad, { currency: CAD, locale: \"en-CA\" }],\n [Currency.Chf, { currency: CHF, locale: \"it-CH\" }],\n [Currency.Czk, { currency: CZK, locale: \"cs-CZ\" }],\n [Currency.Dkk, { currency: DKK, locale: \"da-DK\" }],\n [Currency.Eur, { currency: EUR, locale: \"de-DE\" }],\n [Currency.Gbp, { currency: GBP, locale: \"en-GB\" }],\n [Currency.Hrk, { currency: HRK, locale: \"hr-HR\" }],\n [Currency.Huf, { currency: HUF, locale: \"hu-HU\" }],\n [Currency.Nok, { currency: NOK, locale: \"no-NO\" }],\n [Currency.Pln, { currency: PLN, locale: \"pl-PL\" }],\n [Currency.Ron, { currency: RON, locale: \"ro-RO\" }],\n [Currency.Sek, { currency: SEK, locale: \"sv-SE\" }],\n [Currency.Usd, { currency: USD, locale: \"en-US\" }],\n [Currency.Zar, { currency: ZAR, locale: \"en-ZA\" }],\n [Currency.Inr, { currency: INR, locale: \"en-IN\" }],\n [Currency.Sgd, { currency: SGD, locale: \"en-SG\" }],\n [Currency.Brl, { currency: BRL, locale: \"pt-BR\" }],\n // NOTE: en-JP Doesn't exist\n [Currency.Jpy, { currency: JPY, locale: \"en-JP\" }],\n // NOTE: en-TW Doesn't exist\n [Currency.Twd, { currency: TWD, locale: \"en-TW\" }],\n [Currency.Mxn, { currency: MXN, locale: \"es-MX\" }],\n]);\n"],"names":["prettifyPriceLookup","Map","USD","code","CAD","EUR","GBP","AED","ZAR","smallestSubunitLookup","TWD","halfUp","maximumPriceFilterLookup","financialRound","halfEven","currencyObjLookup","Currency","Aed","currency","locale","Bgn","BGN","Cad","Chf","CHF","Czk","CZK","Dkk","DKK","Eur","Gbp","Hrk","HRK","Huf","HUF","Nok","NOK","Pln","PLN","Ron","RON","Sek","S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F, NOK, PLN, RON, SEK, INR, SGD, BRL, JPY, MXN } from '@dinero.js/currencies';
2
- import { halfEven, down, halfUp } from 'dinero.js';
2
+ import { halfUp, halfEven } from 'dinero.js';
3
3
  import '../../types/index.mjs';
4
- import { Currency, StoreId } from '../../types/generated.mjs';
4
+ import { Currency } from '../../types/generated.mjs';
5
5
  "use strict";
6
- const Round = {
7
- /**
8
- * ⚠️ Instead of using Math.round, we HAVE to use this method to round the financial numbers everywhere where we CAN'T
9
- * deal with dinero.js (Dinero.js should be the priority). But often for converting from API requests we have to
10
- * normalise the values so we use this method.
11
- *
12
- * It just a re-export of the dinero.js halfEven (a.k.a bankers rounding) method which is the default rounding method.
13
- * @see https://github.com/dinerojs/dinero.js/blob/main/packages/core/src/round/halfEven.ts
14
- * @see
15
- *
16
- * Compared to Math.round (arithmetic rounding) it differentiates that it changes the `.5` round up or down behaviour based on if the rounded
17
- * number would be an even number. So 1.5 would round to 2 while 2.5 would round to 2.
18
- * See the youtube link below for a brief exclamation on why it's important to use this method over regular rounding (half-up):
19
- * https://youtu.be/yuRdYlZvs1E
20
- *
21
- * If you really want to get knee-deep in the rounding subject, you can read the following:
22
- * https://en.wikipedia.org/wiki/Rounding#Round_half_toward_zero
23
- */
24
- Financial: halfEven,
25
- // TODO: maybe we should have separate rounding functions depending on the input value?
26
- // Reading from wiki "Round half toward zero" is better if the value is already "normalized to cents"
27
- // But the "Round half to even" seems better for when working with float like values
28
- // financialRound = Math.round;
29
- Shipping: down,
30
- Prettify: down,
31
- Subunit: halfUp
32
- };
33
6
  const prettifyPriceLookup = /* @__PURE__ */new Map([[USD.code, 20], [CAD.code, 20], [EUR.code, 20], [GBP.code, 20], [AED.code, 50],
34
7
  // Approximately every price above ~1.1 usd will be rounded in ZAR
35
8
  [ZAR.code, 20]]);
@@ -37,8 +10,10 @@ const smallestSubunitLookup = /* @__PURE__ */new Map([
37
10
  /**
38
11
  * TWD does not use subunits at all in day to day transactions.
39
12
  */
40
- [TWD.code, [0, Round.Subunit]]]);
41
- const localizedCurrencyLookup = /* @__PURE__ */new Map([[Currency.Aed, {
13
+ [TWD.code, [0, halfUp]]]);
14
+ const maximumPriceFilterLookup = /* @__PURE__ */new Map([[CAD.code, 7e4], [EUR.code, 7e4], [AED.code, 7e4]]);
15
+ const financialRound = halfEven;
16
+ const currencyObjLookup = /* @__PURE__ */new Map([[Currency.Aed, {
42
17
  currency: AED,
43
18
  locale: "ar-AE"
44
19
  }], [Currency.Bgn, {
@@ -109,43 +84,5 @@ const localizedCurrencyLookup = /* @__PURE__ */new Map([[Currency.Aed, {
109
84
  currency: MXN,
110
85
  locale: "es-MX"
111
86
  }]]);
112
- const storesWithPerItemTaxRate = /* @__PURE__ */new Set([
113
- // #############################################################################
114
- // Stores with custom tax rates
115
- // #############################################################################
116
- StoreId.Br, StoreId.Tw
117
- // #############################################################################
118
- // Stores with Avalara, but will have custom company codes to treat
119
- // FIXME: as PR is rushed we where able to test stores avalara custom codes that enable logic that calculates tax
120
- // "per quantity", so for now disabling this logic and only applying to store with custom tax rates
121
- // #############################################################################
122
- // StoreId.Jp,
123
- // StoreId.Sg,
124
- ]);
125
- const TAX_RATE_DINERO_CURRENCY = {
126
- base: 10,
127
- /**
128
- * We expect the tax rate to be in the range of 0..1
129
- * 0 --> 0%
130
- * 1 --> 100%
131
- * 0.21 --> 21%
132
- * 0.2169 --> 21.69%
133
- * 0.12345678 --> 12.345678%
134
- * !!! Don't change as this value is tied to store.backend DB schema !!!
135
- */
136
- exponent: 8,
137
- code: ""
138
- // Not important
139
- };
140
- const EXCHANGE_RATE_DINERO_CURRENCY = {
141
- base: 10,
142
- /**
143
- * We support having certain decimal places for exchange rates
144
- * !!! Don't change as this value is tied to store.backend DB schema !!!
145
- */
146
- exponent: 6,
147
- code: ""
148
- // Not important
149
- };
150
- export { EXCHANGE_RATE_DINERO_CURRENCY, Round, TAX_RATE_DINERO_CURRENCY, localizedCurrencyLookup, prettifyPriceLookup, smallestSubunitLookup, storesWithPerItemTaxRate };
87
+ export { currencyObjLookup, financialRound, maximumPriceFilterLookup, prettifyPriceLookup, smallestSubunitLookup };
151
88
  //# sourceMappingURL=constants.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.mjs","sources":["../../../src/utils/money/constants.ts"],"sourcesContent":["import {\n AED,\n BGN,\n BRL,\n CAD,\n CHF,\n CZK,\n DKK,\n EUR,\n GBP,\n HRK,\n HUF,\n INR,\n JPY,\n MXN,\n NOK,\n PLN,\n RON,\n SEK,\n SGD,\n TWD,\n USD,\n ZAR,\n} from \"@dinero.js/currencies\";\nimport { down, halfEven, halfUp } from \"dinero.js\";\n\nimport { Currency, StoreId } from \"../../types\";\nimport type {\n Cents,\n DinoCurrency,\n LocalizedCurrency,\n RoundingFn,\n} from \"./types\";\n\n// #############################################################################\n// Constants\n// #############################################################################\n\nexport const Round = {\n /**\n * ⚠️ Instead of using Math.round, we HAVE to use this method to round the financial numbers everywhere where we CAN'T\n * deal with dinero.js (Dinero.js should be the priority). But often for converting from API requests we have to\n * normalise the values so we use this method.\n *\n * It just a re-export of the dinero.js halfEven (a.k.a bankers rounding) method which is the default rounding method.\n * @see https://github.com/dinerojs/dinero.js/blob/main/packages/core/src/round/halfEven.ts\n * @see\n *\n * Compared to Math.round (arithmetic rounding) it differentiates that it changes the `.5` round up or down behaviour based on if the rounded\n * number would be an even number. So 1.5 would round to 2 while 2.5 would round to 2.\n * See the youtube link below for a brief exclamation on why it's important to use this method over regular rounding (half-up):\n * https://youtu.be/yuRdYlZvs1E\n *\n * If you really want to get knee-deep in the rounding subject, you can read the following:\n * https://en.wikipedia.org/wiki/Rounding#Round_half_toward_zero\n */\n Financial: halfEven,\n // TODO: maybe we should have separate rounding functions depending on the input value?\n // Reading from wiki \"Round half toward zero\" is better if the value is already \"normalized to cents\"\n // But the \"Round half to even\" seems better for when working with float like values\n // financialRound = Math.round;\n Shipping: down,\n Prettify: down,\n Subunit: halfUp,\n} satisfies Record<string, RoundingFn>;\n\n/**\n * Mapping of how prices should be rounded down to \"whole numbers\" after certain threshold\n */\nexport const prettifyPriceLookup = new Map([\n [USD.code, 20],\n [CAD.code, 20],\n [EUR.code, 20],\n [GBP.code, 20],\n [AED.code, 50],\n // Approximately every price above ~1.1 usd will be rounded in ZAR\n [ZAR.code, 20],\n]);\n\n/**\n * Map of dinero code to subunit digit count.\n */\nexport const smallestSubunitLookup = new Map<string, [Cents, RoundingFn]>([\n /**\n * TWD does not use subunits at all in day to day transactions.\n */\n [TWD.code, [0, Round.Subunit]],\n]);\n\n/**\n * Precompiled list for faster currency and locale lookups\n */\nexport const localizedCurrencyLookup = new Map<Currency, LocalizedCurrency>([\n [Currency.Aed, { currency: AED, locale: \"ar-AE\" }],\n [Currency.Bgn, { currency: BGN, locale: \"bg-BG\" }],\n [Currency.Cad, { currency: CAD, locale: \"en-CA\" }],\n [Currency.Chf, { currency: CHF, locale: \"it-CH\" }],\n [Currency.Czk, { currency: CZK, locale: \"cs-CZ\" }],\n [Currency.Dkk, { currency: DKK, locale: \"da-DK\" }],\n [Currency.Eur, { currency: EUR, locale: \"de-DE\" }],\n [Currency.Gbp, { currency: GBP, locale: \"en-GB\" }],\n [Currency.Hrk, { currency: HRK, locale: \"hr-HR\" }],\n [Currency.Huf, { currency: HUF, locale: \"hu-HU\" }],\n [Currency.Nok, { currency: NOK, locale: \"no-NO\" }],\n [Currency.Pln, { currency: PLN, locale: \"pl-PL\" }],\n [Currency.Ron, { currency: RON, locale: \"ro-RO\" }],\n [Currency.Sek, { currency: SEK, locale: \"sv-SE\" }],\n [Currency.Usd, { currency: USD, locale: \"en-US\" }],\n [Currency.Zar, { currency: ZAR, locale: \"en-ZA\" }],\n [Currency.Inr, { currency: INR, locale: \"en-IN\" }],\n [Currency.Sgd, { currency: SGD, locale: \"en-SG\" }],\n [Currency.Brl, { currency: BRL, locale: \"pt-BR\" }],\n // NOTE: en-JP Doesn't exist\n [Currency.Jpy, { currency: JPY, locale: \"en-JP\" }],\n // NOTE: en-TW Doesn't exist\n [Currency.Twd, { currency: TWD, locale: \"en-TW\" }],\n [Currency.Mxn, { currency: MXN, locale: \"es-MX\" }],\n]);\n\n// #############################################################################\n// Tax Rate\n// #############################################################################\n/**\n * List of stores that require calculating per single item qty and then combining them to get the total tax amount for a\n * single line. Rest of the stores inherit default behavior that tax calculated on whole line item\n */\nexport const storesWithPerItemTaxRate = new Set([\n // #############################################################################\n // Stores with custom tax rates\n // #############################################################################\n StoreId.Br,\n StoreId.Tw,\n // #############################################################################\n // Stores with Avalara, but will have custom company codes to treat\n // FIXME: as PR is rushed we where able to test stores avalara custom codes that enable logic that calculates tax\n // \"per quantity\", so for now disabling this logic and only applying to store with custom tax rates\n // #############################################################################\n // StoreId.Jp,\n // StoreId.Sg,\n]);\n\n/**\n * Dinero currency option block for working with tax rates within dinero\n */\nexport const TAX_RATE_DINERO_CURRENCY = {\n base: 10,\n /**\n * We expect the tax rate to be in the range of 0..1\n * 0 --> 0%\n * 1 --> 100%\n * 0.21 --> 21%\n * 0.2169 --> 21.69%\n * 0.12345678 --> 12.345678%\n * !!! Don't change as this value is tied to store.backend DB schema !!!\n */\n exponent: 8,\n code: \"\", // Not important\n} satisfies DinoCurrency;\n\n// #############################################################################\n// Exchange Rate\n// #############################################################################\n\nexport const EXCHANGE_RATE_DINERO_CURRENCY = {\n base: 10,\n /**\n * We support having certain decimal places for exchange rates\n * !!! Don't change as this value is tied to store.backend DB schema !!!\n */\n exponent: 6,\n code: \"\", // Not important\n} satisfies DinoCurrency;\n"],"names":["Round","Financial","halfEven","Shipping","down","Prettify","Subunit","halfUp","prettifyPriceLookup","Map","USD","code","CAD","EUR","GBP","AED","ZAR","smallestSubunitLookup","TWD","localizedCurrencyLookup","Currency","Aed","currency","locale","Bgn","BGN","Cad","Chf","CHF","Czk","CZK","Dkk","DKK","Eur","Gbp","Hrk","HRK","Huf","HUF","Nok","NOK","Pln","PLN","Ron","RON","Sek","SEK","Usd","Zar","Inr","INR","Sgd","SGD","Brl","BRL","Jpy","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U8B,GAAK;EAAA7B,MAAA,EAAQ;CAAS,CAAA,EACjD,CAACH,SAASiC,GAAK,EAAA;EAAE/B,UAAUgC,GAAK;EAAA/B,MAAA,EAAQ;CAAS,CAAA;AAAA;AAEjD,CAACH,SAASmC,GAAK,EAAA;EAAEjC,UAAUkC,GAAK;EAAAjC,MAAA,EAAQ;CAAS,CAAA;AAAA;AAEjD,CAACH,SAASqC,GAAK,EAAA;EAAEnC,UAAUJ,GAAK;EAAAK,MAAA,EAAQ;CAAS,CAAA,EACjD,CAACH,SAASsC,GAAK,EAAA;EAAEpC,UAAUqC,GAAK;EAAApC,MAAA,EAAQ;CAAS,CAAA,CAClD,CAAA;AASY,MAAAqC,wBAAA,GAAA,mBAA+BC,GAAI,CAAA;AAAA;AAAA;AAAA;AAI9CC,OAAQ,CAAAC,EAAA,EACRD,OAAQ,CAAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAQT,CAAA;AAKM,MAAMC,wBAA2B,GAAA;EACtCC,IAAM,EAAA,EAAA;EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAUNC,QAAU,EAAA,CAAA;EACVxD,IAAM,EAAA;EAAA;AACR,CAAA;AAMO,MAAMyD,6BAAgC,GAAA;EAC3CF,IAAM,EAAA,EAAA;EAAA;AAAA;AAAA;AAAA;EAKNC,QAAU,EAAA,CAAA;EACVxD,IAAM,EAAA;EAAA;AACR,CAAA;"}
1
+ {"version":3,"file":"constants.mjs","sources":["../../../src/utils/money/constants.ts"],"sourcesContent":["import {\n AED,\n BGN,\n BRL,\n CAD,\n CHF,\n CZK,\n DKK,\n EUR,\n GBP,\n HRK,\n HUF,\n INR,\n JPY,\n MXN,\n NOK,\n PLN,\n RON,\n SEK,\n SGD,\n TWD,\n USD,\n ZAR,\n} from \"@dinero.js/currencies\";\nimport { halfEven, halfUp } from \"dinero.js\";\n\nimport { Currency } from \"../../types\";\nimport type { CurrencyObj } from \"./types\";\n\n// #############################################################################\n// Constants\n// #############################################################################\n\n/**\n * Mapping of how prices should be rounded down to \"whole numbers\" after certain threshold\n */\nexport const prettifyPriceLookup = new Map([\n [USD.code, 20],\n [CAD.code, 20],\n [EUR.code, 20],\n [GBP.code, 20],\n [AED.code, 50],\n // Approximately every price above ~1.1 usd will be rounded in ZAR\n [ZAR.code, 20],\n]);\n\n/**\n * Map of currencycode to subunit digit count.\n */\nexport const smallestSubunitLookup = new Map<\n string,\n [number, (value: number) => number]\n>([\n /**\n * TWD does not use subunits at all in day to day transactions.\n */\n [TWD.code, [0, halfUp]],\n]);\n\n/**\n * Mapping of maximum price filter\n * TODO: Add all possible currencies\n */\nexport const maximumPriceFilterLookup = new Map([\n [CAD.code, 70000],\n [EUR.code, 70000],\n [AED.code, 70000],\n]);\n\n/**\n * ⚠️ Instead of using Math.round, we HAVE to use this method to round the financial numbers everywhere where we CAN'T\n * deal with dinero.js (Dinero.js should be the priority). But often for converting from API requests we have to\n * normalise the values so we use this method.\n *\n * It just a re-export of the dinero.js halfEven (a.k.a bankers rounding) method which is the default rounding method.\n * @see https://github.com/dinerojs/dinero.js/blob/main/packages/core/src/round/halfEven.ts\n * @see\n *\n * Compared to Math.round (arithmetic rounding) it differentiates that it changes the `.5` round up or down behaviour based on if the rounded\n * number would be an even number. So 1.5 would round to 2 while 2.5 would round to 2.\n * See the youtube link below for a brief exclamation on why it's important to use this method over regular rounding (half-up):\n * https://youtu.be/yuRdYlZvs1E\n *\n * If you really want to get knee-deep in the rounding subject, you can read the following:\n * https://en.wikipedia.org/wiki/Rounding#Round_half_toward_zero\n */\nexport const financialRound = halfEven;\n// TODO: maybe we should have separate rounding functions depending on the input value?\n// Reading from wiki \"Round half toward zero\" is better if the value is already \"normalized to cents\"\n// But the \"Round half to even\" seems better for when working with float like values\n// export const financialRound = Math.round;\n\n/**\n * Precompiled list for faster currency and locale lookups\n */\nexport const currencyObjLookup = new Map<Currency, CurrencyObj>([\n [Currency.Aed, { currency: AED, locale: \"ar-AE\" }],\n [Currency.Bgn, { currency: BGN, locale: \"bg-BG\" }],\n [Currency.Cad, { currency: CAD, locale: \"en-CA\" }],\n [Currency.Chf, { currency: CHF, locale: \"it-CH\" }],\n [Currency.Czk, { currency: CZK, locale: \"cs-CZ\" }],\n [Currency.Dkk, { currency: DKK, locale: \"da-DK\" }],\n [Currency.Eur, { currency: EUR, locale: \"de-DE\" }],\n [Currency.Gbp, { currency: GBP, locale: \"en-GB\" }],\n [Currency.Hrk, { currency: HRK, locale: \"hr-HR\" }],\n [Currency.Huf, { currency: HUF, locale: \"hu-HU\" }],\n [Currency.Nok, { currency: NOK, locale: \"no-NO\" }],\n [Currency.Pln, { currency: PLN, locale: \"pl-PL\" }],\n [Currency.Ron, { currency: RON, locale: \"ro-RO\" }],\n [Currency.Sek, { currency: SEK, locale: \"sv-SE\" }],\n [Currency.Usd, { currency: USD, locale: \"en-US\" }],\n [Currency.Zar, { currency: ZAR, locale: \"en-ZA\" }],\n [Currency.Inr, { currency: INR, locale: \"en-IN\" }],\n [Currency.Sgd, { currency: SGD, locale: \"en-SG\" }],\n [Currency.Brl, { currency: BRL, locale: \"pt-BR\" }],\n // NOTE: en-JP Doesn't exist\n [Currency.Jpy, { currency: JPY, locale: \"en-JP\" }],\n // NOTE: en-TW Doesn't exist\n [Currency.Twd, { currency: TWD, locale: \"en-TW\" }],\n [Currency.Mxn, { currency: MXN, locale: \"es-MX\" }],\n]);\n"],"names":["prettifyPriceLookup","Map","USD","code","CAD","EUR","GBP","AED","ZAR","smallestSubunitLookup","TWD","halfUp","maximumPriceFilterLookup","financialRound","halfEven","currencyObjLookup","Currency","Aed","currency","locale","Bgn","BGN","Cad","Chf","CHF","Czk","CZK","Dkk","DKK","Eur","Gbp","Hrk","HRK","Huf","HUF","Nok","NOK","Pln","PLN","Ron","RON","Sek","SEK","Usd","Zar","Inr","INR","Sgd","SGD","Brl","BRL","Jpy","JPY","Twd","Mxn","MXN"],"mappings":";;;;;AAoCa,MAAAA,mBA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,UAAUkC,GAAK;EAAAjC,MAAA,EAAQ;CAAS,CAAA;AAAA;AAEjD,CAACH,SAASqC,GAAK,EAAA;EAAEnC,UAAUR,GAAK;EAAAS,MAAA,EAAQ;CAAS,CAAA,EACjD,CAACH,SAASsC,GAAK,EAAA;EAAEpC,UAAUqC,GAAK;EAAApC,MAAA,EAAQ;CAAS,CAAA,CAClD,CAAA;"}
@@ -1,10 +1,11 @@
1
+ import type { Dinero } from "dinero.js";
1
2
  import type { Currency, Nullish } from "../../types";
2
- import type { Dino, LocalizedCurrency, Money } from "./types";
3
- export declare const getLocalizedCurrency: (currencyCode: Nullish<Currency>) => LocalizedCurrency | undefined;
3
+ import type { Money } from "./misc";
4
+ import type { CurrencyObj } from "./types";
5
+ export declare const getCurrencyObj: (currencyCode: Nullish<Currency>) => CurrencyObj | undefined;
4
6
  export type FormatPriceOptions = {
5
7
  /**
6
8
  * Optionally remove trailing zeroes (only if all of them are 0)
7
- * @default false
8
9
  * @example
9
10
  * "420,66 €" => "420,66 €"
10
11
  * "420,60 €" => "420,60 €"
@@ -17,7 +18,6 @@ export type FormatPriceOptions = {
17
18
  *
18
19
  * ! Only use for display purposes where monetary precision is not required!
19
20
  *
20
- * @default false
21
21
  * @example
22
22
  * "420,66 €" => "420 €"
23
23
  * "420,60 €" => "420 €"
@@ -34,15 +34,10 @@ export type FormatPriceOptions = {
34
34
  * @deprecated Use `formatPrice` instead as this functions is for INTERNAL USE ONLY! (function not actual deprecated,
35
35
  * just marked so it discourages usage of it)
36
36
  */
37
- export declare function formatPriceRaw(dinero: Dino, locale: string, options?: FormatPriceOptions): string;
37
+ export declare function formatPriceRaw(dineroObject: Dinero<number>, locale: string, options?: FormatPriceOptions): string;
38
38
  /**
39
39
  * Currency formatter based on dinero currency types and browser internationalizing functions
40
40
  *
41
41
  * In reality just a wrapper around `formatPriceRaw` that does the real formatting
42
42
  */
43
43
  export declare const formatPrice: (money: Money, options?: FormatPriceOptions) => string;
44
- /**
45
- * Prettify numbers depending on the currency using rounding down.
46
- * ! Should only be used to prettify storefront product prices after currency conversion but nothing else !
47
- */
48
- export declare const prettifyTotal: (total: Dino) => Dino;