@ubnt/store.core 9.2.0-money.3 → 9.2.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 (410) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/lib/assets/efg.jpg +0 -0
  3. package/lib/assets/efg.svg +5 -0
  4. package/lib/assets/efgStacked.svg +3 -0
  5. package/lib/assets/gatewayEnterprise.jpg +0 -0
  6. package/lib/assets/gatewayLite.jpg +0 -0
  7. package/lib/assets/gatewayMax.jpg +0 -0
  8. package/lib/assets/gatewayProfessional.jpg +0 -0
  9. package/lib/assets/minus4.svg +8 -8
  10. package/lib/assets/minus5.svg +8 -8
  11. package/lib/assets/nextAi.svg +11 -0
  12. package/lib/assets/plus5.svg +9 -9
  13. package/lib/assets/plus6.svg +9 -9
  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/Header/ProHeader/ProHeader.styles.js +2 -0
  21. package/lib/components/Header/ProHeader/ProHeader.styles.js.map +1 -1
  22. package/lib/components/Header/ProHeader/ProHeader.styles.mjs +3 -1
  23. package/lib/components/Header/ProHeader/ProHeader.styles.mjs.map +1 -1
  24. package/lib/components/LandingPagePro/LandingPagePro.d.ts +0 -3
  25. package/lib/components/LandingPagePro/LandingPagePro.js +3 -3
  26. package/lib/components/LandingPagePro/LandingPagePro.js.map +1 -1
  27. package/lib/components/LandingPagePro/LandingPagePro.mjs +2 -2
  28. package/lib/components/LandingPagePro/LandingPagePro.mjs.map +1 -1
  29. package/lib/components/MicrositeHero/MicrositeHero.d.ts +1 -1
  30. package/lib/components/MicrositeHero/MicrositeHero.js +8 -2
  31. package/lib/components/MicrositeHero/MicrositeHero.js.map +1 -1
  32. package/lib/components/MicrositeHero/MicrositeHero.mjs +9 -3
  33. package/lib/components/MicrositeHero/MicrositeHero.mjs.map +1 -1
  34. package/lib/components/MicrositeHero/MicrositeHero.styles.d.ts +1 -0
  35. package/lib/components/MicrositeHero/MicrositeHero.styles.js +21 -5
  36. package/lib/components/MicrositeHero/MicrositeHero.styles.js.map +1 -1
  37. package/lib/components/MicrositeHero/MicrositeHero.styles.mjs +21 -6
  38. package/lib/components/MicrositeHero/MicrositeHero.styles.mjs.map +1 -1
  39. package/lib/components/MicrositeHero/MicrositeHero.types.d.ts +2 -0
  40. package/lib/components/MicrositeHero/MicrositeHero.types.js.map +1 -1
  41. package/lib/components/MicrositeHero/MicrositeHero.types.mjs.map +1 -1
  42. package/lib/components/ModelCompareV3/ModelCompareV3.types.d.ts +4 -1
  43. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/efg.jpg.js +27 -0
  44. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/efg.jpg.js.map +1 -0
  45. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/efg.jpg.mjs +3 -0
  46. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/efg.jpg.mjs.map +1 -0
  47. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmPro.jpg.js +5 -5
  48. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmPro.jpg.mjs +2 -2
  49. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProMax.jpg.js +5 -5
  50. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProMax.jpg.mjs +2 -2
  51. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProSpecial.jpg.js +5 -5
  52. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProSpecial.jpg.mjs +2 -2
  53. package/lib/components/ModelCompareV3/assets/Consoles/udmPro.jpg.js +1 -1
  54. package/lib/components/ModelCompareV3/assets/Consoles/udmPro.jpg.mjs +2 -2
  55. package/lib/components/ModelCompareV3/assets/Consoles/udmProMax.jpg.js +1 -1
  56. package/lib/components/ModelCompareV3/assets/Consoles/udmProMax.jpg.mjs +2 -2
  57. package/lib/components/ModelCompareV3/assets/Consoles/udmProSpecial.jpg.js +1 -1
  58. package/lib/components/ModelCompareV3/assets/Consoles/udmProSpecial.jpg.mjs +2 -2
  59. package/lib/components/ModelCompareV3/assets/Gateways/gatewayEnterprise.jpg.js +27 -0
  60. package/lib/components/ModelCompareV3/assets/Gateways/gatewayEnterprise.jpg.js.map +1 -0
  61. package/lib/components/ModelCompareV3/assets/Gateways/gatewayEnterprise.jpg.mjs +3 -0
  62. package/lib/components/ModelCompareV3/assets/Gateways/gatewayEnterprise.jpg.mjs.map +1 -0
  63. package/lib/components/ModelCompareV3/assets/nextAi.svg.js +27 -0
  64. package/lib/components/ModelCompareV3/assets/nextAi.svg.js.map +1 -0
  65. package/lib/components/ModelCompareV3/assets/nextAi.svg.mjs +3 -0
  66. package/lib/components/ModelCompareV3/assets/nextAi.svg.mjs.map +1 -0
  67. package/lib/components/ModelCompareV3/data/CloudGateways.js +17 -11
  68. package/lib/components/ModelCompareV3/data/CloudGateways.js.map +1 -1
  69. package/lib/components/ModelCompareV3/data/CloudGateways.mjs +14 -8
  70. package/lib/components/ModelCompareV3/data/CloudGateways.mjs.map +1 -1
  71. package/lib/components/ModelCompareV3/data/Gateway.js +10 -7
  72. package/lib/components/ModelCompareV3/data/Gateway.js.map +1 -1
  73. package/lib/components/ModelCompareV3/data/Gateway.mjs +10 -7
  74. package/lib/components/ModelCompareV3/data/Gateway.mjs.map +1 -1
  75. package/lib/components/ModelCompareV3/data/products/aggregation.js +1 -1
  76. package/lib/components/ModelCompareV3/data/products/aggregation.js.map +1 -1
  77. package/lib/components/ModelCompareV3/data/products/aggregation.mjs +1 -1
  78. package/lib/components/ModelCompareV3/data/products/aggregation.mjs.map +1 -1
  79. package/lib/components/ModelCompareV3/data/products/efg.d.ts +2 -0
  80. package/lib/components/ModelCompareV3/data/products/efg.js +133 -0
  81. package/lib/components/ModelCompareV3/data/products/efg.js.map +1 -0
  82. package/lib/components/ModelCompareV3/data/products/efg.mjs +123 -0
  83. package/lib/components/ModelCompareV3/data/products/efg.mjs.map +1 -0
  84. package/lib/components/ModelCompareV3/data/products/enterprise24PoE.js +1 -1
  85. package/lib/components/ModelCompareV3/data/products/enterprise24PoE.js.map +1 -1
  86. package/lib/components/ModelCompareV3/data/products/enterprise24PoE.mjs +1 -1
  87. package/lib/components/ModelCompareV3/data/products/enterprise24PoE.mjs.map +1 -1
  88. package/lib/components/ModelCompareV3/data/products/enterprise48PoE.js +1 -1
  89. package/lib/components/ModelCompareV3/data/products/enterprise48PoE.js.map +1 -1
  90. package/lib/components/ModelCompareV3/data/products/enterprise48PoE.mjs +1 -1
  91. package/lib/components/ModelCompareV3/data/products/enterprise48PoE.mjs.map +1 -1
  92. package/lib/components/ModelCompareV3/data/products/enterpriseXG24.js +1 -1
  93. package/lib/components/ModelCompareV3/data/products/enterpriseXG24.js.map +1 -1
  94. package/lib/components/ModelCompareV3/data/products/enterpriseXG24.mjs +1 -1
  95. package/lib/components/ModelCompareV3/data/products/enterpriseXG24.mjs.map +1 -1
  96. package/lib/components/ModelCompareV3/data/products/express.js +8 -0
  97. package/lib/components/ModelCompareV3/data/products/express.js.map +1 -1
  98. package/lib/components/ModelCompareV3/data/products/express.mjs +8 -0
  99. package/lib/components/ModelCompareV3/data/products/express.mjs.map +1 -1
  100. package/lib/components/ModelCompareV3/data/products/gatewayEnterprise.d.ts +2 -0
  101. package/lib/components/ModelCompareV3/data/products/gatewayEnterprise.js +87 -0
  102. package/lib/components/ModelCompareV3/data/products/gatewayEnterprise.js.map +1 -0
  103. package/lib/components/ModelCompareV3/data/products/gatewayEnterprise.mjs +79 -0
  104. package/lib/components/ModelCompareV3/data/products/gatewayEnterprise.mjs.map +1 -0
  105. package/lib/components/ModelCompareV3/data/products/gatewayLite.js +8 -7
  106. package/lib/components/ModelCompareV3/data/products/gatewayLite.js.map +1 -1
  107. package/lib/components/ModelCompareV3/data/products/gatewayLite.mjs +8 -7
  108. package/lib/components/ModelCompareV3/data/products/gatewayLite.mjs.map +1 -1
  109. package/lib/components/ModelCompareV3/data/products/gatewayMax.js +5 -5
  110. package/lib/components/ModelCompareV3/data/products/gatewayMax.js.map +1 -1
  111. package/lib/components/ModelCompareV3/data/products/gatewayMax.mjs +5 -5
  112. package/lib/components/ModelCompareV3/data/products/gatewayMax.mjs.map +1 -1
  113. package/lib/components/ModelCompareV3/data/products/gatewayProfessional.js +12 -11
  114. package/lib/components/ModelCompareV3/data/products/gatewayProfessional.js.map +1 -1
  115. package/lib/components/ModelCompareV3/data/products/gatewayProfessional.mjs +12 -11
  116. package/lib/components/ModelCompareV3/data/products/gatewayProfessional.mjs.map +1 -1
  117. package/lib/components/ModelCompareV3/data/products/missionCritical.js +1 -1
  118. package/lib/components/ModelCompareV3/data/products/missionCritical.js.map +1 -1
  119. package/lib/components/ModelCompareV3/data/products/missionCritical.mjs +1 -1
  120. package/lib/components/ModelCompareV3/data/products/missionCritical.mjs.map +1 -1
  121. package/lib/components/ModelCompareV3/data/products/professional24.js +1 -1
  122. package/lib/components/ModelCompareV3/data/products/professional24.js.map +1 -1
  123. package/lib/components/ModelCompareV3/data/products/professional24.mjs +1 -1
  124. package/lib/components/ModelCompareV3/data/products/professional24.mjs.map +1 -1
  125. package/lib/components/ModelCompareV3/data/products/professional24PoE.js +1 -1
  126. package/lib/components/ModelCompareV3/data/products/professional24PoE.js.map +1 -1
  127. package/lib/components/ModelCompareV3/data/products/professional24PoE.mjs +1 -1
  128. package/lib/components/ModelCompareV3/data/products/professional24PoE.mjs.map +1 -1
  129. package/lib/components/ModelCompareV3/data/products/professional48.js +1 -1
  130. package/lib/components/ModelCompareV3/data/products/professional48.js.map +1 -1
  131. package/lib/components/ModelCompareV3/data/products/professional48.mjs +1 -1
  132. package/lib/components/ModelCompareV3/data/products/professional48.mjs.map +1 -1
  133. package/lib/components/ModelCompareV3/data/products/professional48PoE.js +1 -1
  134. package/lib/components/ModelCompareV3/data/products/professional48PoE.js.map +1 -1
  135. package/lib/components/ModelCompareV3/data/products/professional48PoE.mjs +1 -1
  136. package/lib/components/ModelCompareV3/data/products/professional48PoE.mjs.map +1 -1
  137. package/lib/components/ModelCompareV3/data/products/professionalMax24.js +1 -1
  138. package/lib/components/ModelCompareV3/data/products/professionalMax24.js.map +1 -1
  139. package/lib/components/ModelCompareV3/data/products/professionalMax24.mjs +1 -1
  140. package/lib/components/ModelCompareV3/data/products/professionalMax24.mjs.map +1 -1
  141. package/lib/components/ModelCompareV3/data/products/professionalMax24PoE.js +1 -1
  142. package/lib/components/ModelCompareV3/data/products/professionalMax24PoE.js.map +1 -1
  143. package/lib/components/ModelCompareV3/data/products/professionalMax24PoE.mjs +1 -1
  144. package/lib/components/ModelCompareV3/data/products/professionalMax24PoE.mjs.map +1 -1
  145. package/lib/components/ModelCompareV3/data/products/professionalMax48.js +1 -1
  146. package/lib/components/ModelCompareV3/data/products/professionalMax48.js.map +1 -1
  147. package/lib/components/ModelCompareV3/data/products/professionalMax48.mjs +1 -1
  148. package/lib/components/ModelCompareV3/data/products/professionalMax48.mjs.map +1 -1
  149. package/lib/components/ModelCompareV3/data/products/professionalMax48PoE.js +1 -1
  150. package/lib/components/ModelCompareV3/data/products/professionalMax48PoE.js.map +1 -1
  151. package/lib/components/ModelCompareV3/data/products/professionalMax48PoE.mjs +1 -1
  152. package/lib/components/ModelCompareV3/data/products/professionalMax48PoE.mjs.map +1 -1
  153. package/lib/components/ModelCompareV3/data/products/standard16PoE.js +1 -1
  154. package/lib/components/ModelCompareV3/data/products/standard16PoE.js.map +1 -1
  155. package/lib/components/ModelCompareV3/data/products/standard16PoE.mjs +1 -1
  156. package/lib/components/ModelCompareV3/data/products/standard16PoE.mjs.map +1 -1
  157. package/lib/components/ModelCompareV3/data/products/standard24.js +1 -1
  158. package/lib/components/ModelCompareV3/data/products/standard24.js.map +1 -1
  159. package/lib/components/ModelCompareV3/data/products/standard24.mjs +1 -1
  160. package/lib/components/ModelCompareV3/data/products/standard24.mjs.map +1 -1
  161. package/lib/components/ModelCompareV3/data/products/standard24PoE.js +1 -1
  162. package/lib/components/ModelCompareV3/data/products/standard24PoE.js.map +1 -1
  163. package/lib/components/ModelCompareV3/data/products/standard24PoE.mjs +1 -1
  164. package/lib/components/ModelCompareV3/data/products/standard24PoE.mjs.map +1 -1
  165. package/lib/components/ModelCompareV3/data/products/standard48.js +1 -1
  166. package/lib/components/ModelCompareV3/data/products/standard48.js.map +1 -1
  167. package/lib/components/ModelCompareV3/data/products/standard48.mjs +1 -1
  168. package/lib/components/ModelCompareV3/data/products/standard48.mjs.map +1 -1
  169. package/lib/components/ModelCompareV3/data/products/standard48PoE.js +1 -1
  170. package/lib/components/ModelCompareV3/data/products/standard48PoE.js.map +1 -1
  171. package/lib/components/ModelCompareV3/data/products/standard48PoE.mjs +1 -1
  172. package/lib/components/ModelCompareV3/data/products/standard48PoE.mjs.map +1 -1
  173. package/lib/components/ModelCompareV3/data/products/switchesEnterprise.js +1 -1
  174. package/lib/components/ModelCompareV3/data/products/switchesEnterprise.js.map +1 -1
  175. package/lib/components/ModelCompareV3/data/products/switchesEnterprise.mjs +1 -1
  176. package/lib/components/ModelCompareV3/data/products/switchesEnterprise.mjs.map +1 -1
  177. package/lib/components/ModelCompareV3/data/products/switchesProfessional.js +1 -1
  178. package/lib/components/ModelCompareV3/data/products/switchesProfessional.js.map +1 -1
  179. package/lib/components/ModelCompareV3/data/products/switchesProfessional.mjs +1 -1
  180. package/lib/components/ModelCompareV3/data/products/switchesProfessional.mjs.map +1 -1
  181. package/lib/components/ModelCompareV3/data/products/switchesProfessionalMax.js +1 -1
  182. package/lib/components/ModelCompareV3/data/products/switchesProfessionalMax.js.map +1 -1
  183. package/lib/components/ModelCompareV3/data/products/switchesProfessionalMax.mjs +1 -1
  184. package/lib/components/ModelCompareV3/data/products/switchesProfessionalMax.mjs.map +1 -1
  185. package/lib/components/ModelCompareV3/data/products/switchesStandard.js +1 -1
  186. package/lib/components/ModelCompareV3/data/products/switchesStandard.js.map +1 -1
  187. package/lib/components/ModelCompareV3/data/products/switchesStandard.mjs +1 -1
  188. package/lib/components/ModelCompareV3/data/products/switchesStandard.mjs.map +1 -1
  189. package/lib/components/ModelCompareV3/data/products/ucgMax.js +7 -0
  190. package/lib/components/ModelCompareV3/data/products/ucgMax.js.map +1 -1
  191. package/lib/components/ModelCompareV3/data/products/ucgMax.mjs +7 -0
  192. package/lib/components/ModelCompareV3/data/products/ucgMax.mjs.map +1 -1
  193. package/lib/components/ModelCompareV3/data/products/ucgUltra.js +8 -0
  194. package/lib/components/ModelCompareV3/data/products/ucgUltra.js.map +1 -1
  195. package/lib/components/ModelCompareV3/data/products/ucgUltra.mjs +8 -0
  196. package/lib/components/ModelCompareV3/data/products/ucgUltra.mjs.map +1 -1
  197. package/lib/components/ModelCompareV3/data/products/udmPro.js +10 -2
  198. package/lib/components/ModelCompareV3/data/products/udmPro.js.map +1 -1
  199. package/lib/components/ModelCompareV3/data/products/udmPro.mjs +10 -2
  200. package/lib/components/ModelCompareV3/data/products/udmPro.mjs.map +1 -1
  201. package/lib/components/ModelCompareV3/data/products/udmProMax.js +10 -3
  202. package/lib/components/ModelCompareV3/data/products/udmProMax.js.map +1 -1
  203. package/lib/components/ModelCompareV3/data/products/udmProMax.mjs +10 -3
  204. package/lib/components/ModelCompareV3/data/products/udmProMax.mjs.map +1 -1
  205. package/lib/components/ModelCompareV3/data/products/udmProSpecial.js +10 -2
  206. package/lib/components/ModelCompareV3/data/products/udmProSpecial.js.map +1 -1
  207. package/lib/components/ModelCompareV3/data/products/udmProSpecial.mjs +10 -2
  208. package/lib/components/ModelCompareV3/data/products/udmProSpecial.mjs.map +1 -1
  209. package/lib/components/ModelCompareV3/data/products/udr.js +8 -0
  210. package/lib/components/ModelCompareV3/data/products/udr.js.map +1 -1
  211. package/lib/components/ModelCompareV3/data/products/udr.mjs +8 -0
  212. package/lib/components/ModelCompareV3/data/products/udr.mjs.map +1 -1
  213. package/lib/components/ModelCompareV3/data/products/udw.js +8 -0
  214. package/lib/components/ModelCompareV3/data/products/udw.js.map +1 -1
  215. package/lib/components/ModelCompareV3/data/products/udw.mjs +8 -0
  216. package/lib/components/ModelCompareV3/data/products/udw.mjs.map +1 -1
  217. package/lib/components/ModelCompareV3/data/properties/index.d.ts +2 -0
  218. package/lib/components/ModelCompareV3/data/properties/index.js +4 -0
  219. package/lib/components/ModelCompareV3/data/properties/index.js.map +1 -1
  220. package/lib/components/ModelCompareV3/data/properties/index.mjs +2 -0
  221. package/lib/components/ModelCompareV3/data/properties/index.mjs.map +1 -1
  222. package/lib/components/ModelCompareV3/data/properties/nextAiInspection.d.ts +2 -0
  223. package/lib/components/ModelCompareV3/data/properties/nextAiInspection.js +19 -0
  224. package/lib/components/ModelCompareV3/data/properties/nextAiInspection.js.map +1 -0
  225. package/lib/components/ModelCompareV3/data/properties/nextAiInspection.mjs +11 -0
  226. package/lib/components/ModelCompareV3/data/properties/nextAiInspection.mjs.map +1 -0
  227. package/lib/components/ModelCompareV3/translations/en.json.js +21 -36
  228. package/lib/components/ModelCompareV3/translations/en.json.js.map +1 -1
  229. package/lib/components/ModelCompareV3/translations/en.json.mjs +21 -36
  230. package/lib/components/ModelCompareV3/translations/en.json.mjs.map +1 -1
  231. package/lib/components/ModelCompareV3/translations/useModelCompareTranslation.d.ts +2 -2
  232. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputSections/CounterSection.js +2 -2
  233. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputSections/CounterSection.mjs +2 -2
  234. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/minus.svg.js +1 -1
  235. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/minus.svg.mjs +2 -2
  236. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/plus.svg.js +1 -1
  237. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/plus.svg.mjs +2 -2
  238. package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.js +2 -2
  239. package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.mjs +2 -2
  240. package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/minus.svg.js +1 -1
  241. package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/minus.svg.mjs +2 -2
  242. package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/plus.svg.js +1 -1
  243. package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/plus.svg.mjs +2 -2
  244. package/lib/constants/icons/menu/efg.svg.js +27 -0
  245. package/lib/constants/icons/menu/efg.svg.js.map +1 -0
  246. package/lib/constants/icons/menu/efg.svg.mjs +3 -0
  247. package/lib/constants/icons/menu/efg.svg.mjs.map +1 -0
  248. package/lib/constants/icons/menu/efgStacked.svg.js +27 -0
  249. package/lib/constants/icons/menu/efgStacked.svg.js.map +1 -0
  250. package/lib/constants/icons/menu/efgStacked.svg.mjs +3 -0
  251. package/lib/constants/icons/menu/efgStacked.svg.mjs.map +1 -0
  252. package/lib/constants/icons/menu/index.d.ts +2 -0
  253. package/lib/constants/icons/menu/index.js +18 -0
  254. package/lib/constants/icons/menu/index.js.map +1 -1
  255. package/lib/constants/icons/menu/index.mjs +4 -0
  256. package/lib/constants/icons/menu/index.mjs.map +1 -1
  257. package/lib/constants/icons/options/colors/black.svg.js +5 -5
  258. package/lib/constants/icons/options/colors/index.js +3 -3
  259. package/lib/constants/icons/options/styles/black.svg.js +5 -5
  260. package/lib/constants/icons/options/styles/index.js +3 -3
  261. package/lib/constants/optionIcons.js +6 -6
  262. package/lib/constants/optionIcons.mjs +4 -4
  263. package/lib/constants/proStoreCategories/mapping/index.d.ts +13 -12
  264. package/lib/constants/proStoreCategories/mapping/index.js +5 -0
  265. package/lib/constants/proStoreCategories/mapping/index.js.map +1 -1
  266. package/lib/constants/proStoreCategories/mapping/index.mjs +5 -0
  267. package/lib/constants/proStoreCategories/mapping/index.mjs.map +1 -1
  268. package/lib/constants/proStoreCategories/mapping/unifi.d.ts +1 -0
  269. package/lib/constants/proStoreCategories/mapping/unifi.js +1 -0
  270. package/lib/constants/proStoreCategories/mapping/unifi.js.map +1 -1
  271. package/lib/constants/proStoreCategories/mapping/unifi.mjs +1 -0
  272. package/lib/constants/proStoreCategories/mapping/unifi.mjs.map +1 -1
  273. package/lib/constants/proStoreCategories/translations/ar.json.js +29 -24
  274. package/lib/constants/proStoreCategories/translations/ar.json.js.map +1 -1
  275. package/lib/constants/proStoreCategories/translations/ar.json.mjs +29 -25
  276. package/lib/constants/proStoreCategories/translations/ar.json.mjs.map +1 -1
  277. package/lib/constants/proStoreCategories/translations/de.json.js +29 -24
  278. package/lib/constants/proStoreCategories/translations/de.json.js.map +1 -1
  279. package/lib/constants/proStoreCategories/translations/de.json.mjs +29 -25
  280. package/lib/constants/proStoreCategories/translations/de.json.mjs.map +1 -1
  281. package/lib/constants/proStoreCategories/translations/el.json.js +29 -24
  282. package/lib/constants/proStoreCategories/translations/el.json.js.map +1 -1
  283. package/lib/constants/proStoreCategories/translations/el.json.mjs +29 -25
  284. package/lib/constants/proStoreCategories/translations/el.json.mjs.map +1 -1
  285. package/lib/constants/proStoreCategories/translations/en.json.js +20 -19
  286. package/lib/constants/proStoreCategories/translations/en.json.js.map +1 -1
  287. package/lib/constants/proStoreCategories/translations/en.json.mjs +20 -19
  288. package/lib/constants/proStoreCategories/translations/en.json.mjs.map +1 -1
  289. package/lib/constants/proStoreCategories/translations/es.json.js +29 -24
  290. package/lib/constants/proStoreCategories/translations/es.json.js.map +1 -1
  291. package/lib/constants/proStoreCategories/translations/es.json.mjs +29 -25
  292. package/lib/constants/proStoreCategories/translations/es.json.mjs.map +1 -1
  293. package/lib/constants/proStoreCategories/translations/fr.json.js +29 -24
  294. package/lib/constants/proStoreCategories/translations/fr.json.js.map +1 -1
  295. package/lib/constants/proStoreCategories/translations/fr.json.mjs +29 -25
  296. package/lib/constants/proStoreCategories/translations/fr.json.mjs.map +1 -1
  297. package/lib/constants/proStoreCategories/translations/it.json.js +29 -24
  298. package/lib/constants/proStoreCategories/translations/it.json.js.map +1 -1
  299. package/lib/constants/proStoreCategories/translations/it.json.mjs +29 -25
  300. package/lib/constants/proStoreCategories/translations/it.json.mjs.map +1 -1
  301. package/lib/constants/proStoreCategories/translations/ja.json.js +29 -24
  302. package/lib/constants/proStoreCategories/translations/ja.json.js.map +1 -1
  303. package/lib/constants/proStoreCategories/translations/ja.json.mjs +29 -25
  304. package/lib/constants/proStoreCategories/translations/ja.json.mjs.map +1 -1
  305. package/lib/constants/proStoreCategories/translations/pt-BR.json.js +29 -24
  306. package/lib/constants/proStoreCategories/translations/pt-BR.json.js.map +1 -1
  307. package/lib/constants/proStoreCategories/translations/pt-BR.json.mjs +29 -25
  308. package/lib/constants/proStoreCategories/translations/pt-BR.json.mjs.map +1 -1
  309. package/lib/constants/proStoreCategories/translations/zh-Hans.json.js +29 -24
  310. package/lib/constants/proStoreCategories/translations/zh-Hans.json.js.map +1 -1
  311. package/lib/constants/proStoreCategories/translations/zh-Hans.json.mjs +29 -25
  312. package/lib/constants/proStoreCategories/translations/zh-Hans.json.mjs.map +1 -1
  313. package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.js +29 -24
  314. package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.js.map +1 -1
  315. package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.mjs +29 -25
  316. package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.mjs.map +1 -1
  317. package/lib/contexts/MenuContext/mapping.js +14 -0
  318. package/lib/contexts/MenuContext/mapping.js.map +1 -1
  319. package/lib/contexts/MenuContext/mapping.mjs +13 -0
  320. package/lib/contexts/MenuContext/mapping.mjs.map +1 -1
  321. package/lib/types/constants.d.ts +5 -1
  322. package/lib/types/constants.js +1 -0
  323. package/lib/types/constants.js.map +1 -1
  324. package/lib/types/constants.mjs +1 -0
  325. package/lib/types/constants.mjs.map +1 -1
  326. package/lib/utils/address.d.ts +2 -2
  327. package/lib/utils/address.js +8 -5
  328. package/lib/utils/address.js.map +1 -1
  329. package/lib/utils/address.mjs +8 -5
  330. package/lib/utils/address.mjs.map +1 -1
  331. package/lib/utils/money/constants.d.ts +25 -56
  332. package/lib/utils/money/constants.js +7 -68
  333. package/lib/utils/money/constants.js.map +1 -1
  334. package/lib/utils/money/constants.mjs +7 -66
  335. package/lib/utils/money/constants.mjs.map +1 -1
  336. package/lib/utils/money/format.d.ts +5 -10
  337. package/lib/utils/money/format.js +14 -22
  338. package/lib/utils/money/format.js.map +1 -1
  339. package/lib/utils/money/format.mjs +16 -23
  340. package/lib/utils/money/format.mjs.map +1 -1
  341. package/lib/utils/money/index.d.ts +1 -5
  342. package/lib/utils/money/index.js +8 -27
  343. package/lib/utils/money/index.js.map +1 -1
  344. package/lib/utils/money/index.mjs +4 -9
  345. package/lib/utils/money/index.mjs.map +1 -1
  346. package/lib/utils/money/misc.d.ts +28 -68
  347. package/lib/utils/money/misc.js +64 -35
  348. package/lib/utils/money/misc.js.map +1 -1
  349. package/lib/utils/money/misc.mjs +43 -32
  350. package/lib/utils/money/misc.mjs.map +1 -1
  351. package/lib/utils/money/tax.d.ts +2 -38
  352. package/lib/utils/money/tax.js +10 -46
  353. package/lib/utils/money/tax.js.map +1 -1
  354. package/lib/utils/money/tax.mjs +11 -42
  355. package/lib/utils/money/tax.mjs.map +1 -1
  356. package/lib/utils/money/types.d.ts +3 -64
  357. package/lib/utils/number.d.ts +1 -1
  358. package/lib/utils/number.js +1 -1
  359. package/lib/utils/number.js.map +1 -1
  360. package/lib/utils/number.mjs +1 -1
  361. package/lib/utils/number.mjs.map +1 -1
  362. package/lib/utils/validations/stateRegistrationNumberSuperRefinement.js +1 -0
  363. package/lib/utils/validations/stateRegistrationNumberSuperRefinement.js.map +1 -1
  364. package/lib/utils/validations/stateRegistrationNumberSuperRefinement.mjs +1 -0
  365. package/lib/utils/validations/stateRegistrationNumberSuperRefinement.mjs.map +1 -1
  366. package/lib/utils/validations/taxIdSuperRefinement.js +1 -0
  367. package/lib/utils/validations/taxIdSuperRefinement.js.map +1 -1
  368. package/lib/utils/validations/taxIdSuperRefinement.mjs +1 -0
  369. package/lib/utils/validations/taxIdSuperRefinement.mjs.map +1 -1
  370. package/lib/utils/validations.d.ts +15 -0
  371. package/lib/utils/validations.js +23 -0
  372. package/lib/utils/validations.js.map +1 -0
  373. package/lib/utils/validations.mjs +21 -0
  374. package/lib/utils/validations.mjs.map +1 -0
  375. package/package.json +1 -1
  376. package/lib/utils/money/allocators/fixedAmount.d.ts +0 -26
  377. package/lib/utils/money/allocators/fixedAmount.js +0 -55
  378. package/lib/utils/money/allocators/fixedAmount.js.map +0 -1
  379. package/lib/utils/money/allocators/fixedAmount.mjs +0 -53
  380. package/lib/utils/money/allocators/fixedAmount.mjs.map +0 -1
  381. package/lib/utils/money/allocators/index.d.ts +0 -1
  382. package/lib/utils/money/allocators/index.js +0 -6
  383. package/lib/utils/money/allocators/index.js.map +0 -1
  384. package/lib/utils/money/allocators/index.mjs +0 -3
  385. package/lib/utils/money/allocators/index.mjs.map +0 -1
  386. package/lib/utils/money/dinero.d.ts +0 -5
  387. package/lib/utils/money/dinero.js +0 -101
  388. package/lib/utils/money/dinero.js.map +0 -1
  389. package/lib/utils/money/dinero.mjs +0 -3
  390. package/lib/utils/money/dinero.mjs.map +0 -1
  391. package/lib/utils/money/exchangeRate.d.ts +0 -30
  392. package/lib/utils/money/exchangeRate.js +0 -27
  393. package/lib/utils/money/exchangeRate.js.map +0 -1
  394. package/lib/utils/money/exchangeRate.mjs +0 -23
  395. package/lib/utils/money/exchangeRate.mjs.map +0 -1
  396. package/lib/utils/money/misc.private.d.ts +0 -23
  397. package/lib/utils/money/misc.private.js +0 -46
  398. package/lib/utils/money/misc.private.js.map +0 -1
  399. package/lib/utils/money/misc.private.mjs +0 -21
  400. package/lib/utils/money/misc.private.mjs.map +0 -1
  401. package/lib/utils/money/shipping.d.ts +0 -5
  402. package/lib/utils/money/shipping.js +0 -8
  403. package/lib/utils/money/shipping.js.map +0 -1
  404. package/lib/utils/money/shipping.mjs +0 -6
  405. package/lib/utils/money/shipping.mjs.map +0 -1
  406. package/lib/utils/money/tax.private.d.ts +0 -17
  407. package/lib/utils/money/tax.private.js +0 -65
  408. package/lib/utils/money/tax.private.js.map +0 -1
  409. package/lib/utils/money/tax.private.mjs +0 -60
  410. package/lib/utils/money/tax.private.mjs.map +0 -1
@@ -1,65 +0,0 @@
1
- 'use strict';
2
-
3
- var dinero_js = require('dinero.js');
4
- var errors = require('../errors.js');
5
- var fixedAmount = require('./allocators/fixedAmount.js');
6
- var misc = require('./misc.js');
7
- "use strict";
8
- const taxRateToDineroAllocation = taxRate => {
9
- if (taxRate <= 0 || taxRate >= 1) {
10
- throw new RangeError("Unsupported rate, expected in range of 0>rate<1");
11
- }
12
- const rateScale = String(taxRate).split(".")[1]?.length;
13
- errors.assert(rateScale !== void 0, "rateScale is undefined");
14
- const rateInt = Math.round(taxRate * Math.pow(10, rateScale));
15
- return [rateInt, Math.pow(10, rateScale) - rateInt];
16
- };
17
- const allocatePerItemTaxableAmount = itemSummary => {
18
- if (itemSummary.quantity === 1) {
19
- return [itemSummary];
20
- }
21
- const preDiscountAmount = dinero_js.add(misc.getDinero(itemSummary.taxableAmount, itemSummary.currency), misc.getDinero(itemSummary.discountAmount, itemSummary.currency));
22
- const allocator = new fixedAmount.FixedAmountAllocator({
23
- initialAllocateAmount: itemSummary.discountAmount,
24
- initialTotalAmount: misc.amount(preDiscountAmount),
25
- currency: itemSummary.currency
26
- });
27
- return Array.from({
28
- length: itemSummary.quantity
29
- }, () => {
30
- const discountAllocatedAmount = allocator.allocate(itemSummary.itemPrice, itemSummary.currency);
31
- const taxableAmount = dinero_js.subtract(misc.getDinero(itemSummary.itemPrice, itemSummary.currency), discountAllocatedAmount);
32
- return {
33
- itemPrice: itemSummary.itemPrice,
34
- taxableAmount: misc.amount(taxableAmount),
35
- discountAmount: misc.amount(discountAllocatedAmount),
36
- currency: itemSummary.currency,
37
- quantity: 1
38
- };
39
- });
40
- };
41
- const calculateWholeQtyLineItemTax = (itemSummary, taxRate) => {
42
- if (taxRate === 0) {
43
- return misc.getDinero(0, itemSummary.currency);
44
- }
45
- const [taxAmount] = dinero_js.allocate(misc.getDinero(itemSummary.taxableAmount, itemSummary.currency), taxRateToDineroAllocation(taxRate));
46
- errors.assert(taxAmount !== void 0, "taxAmount is undefined");
47
- return taxAmount;
48
- };
49
- const calculatePerQtyLineItemTax = (itemSummary, taxRate) => {
50
- if (taxRate === 0) {
51
- return misc.getDinero(0, itemSummary.currency);
52
- }
53
- const singleItemSummaries = allocatePerItemTaxableAmount(itemSummary);
54
- let totalTaxAmount = misc.getDinero(0, itemSummary.currency);
55
- singleItemSummaries.forEach(itemSummary2 => {
56
- const taxAmount = calculateWholeQtyLineItemTax(itemSummary2, taxRate);
57
- totalTaxAmount = dinero_js.add(totalTaxAmount, taxAmount);
58
- });
59
- return totalTaxAmount;
60
- };
61
- exports.allocatePerItemTaxableAmount = allocatePerItemTaxableAmount;
62
- exports.calculatePerQtyLineItemTax = calculatePerQtyLineItemTax;
63
- exports.calculateWholeQtyLineItemTax = calculateWholeQtyLineItemTax;
64
- exports.taxRateToDineroAllocation = taxRateToDineroAllocation;
65
- //# sourceMappingURL=tax.private.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tax.private.js","sources":["../../../src/utils/money/tax.private.ts"],"sourcesContent":["// #############################################################################\n// Internal helper functions not for consumption outside of store.core!\n// Wrote as separate files so that they can be easily unit tested without exposing them\n// #############################################################################\nimport type { Dinero } from \"dinero.js\";\nimport { add, allocate, subtract } from \"dinero.js\";\n\nimport { assert } from \"../errors\";\nimport { FixedAmountAllocator } from \"./allocators/fixedAmount\";\nimport { amount, getDinero } from \"./misc\";\nimport type {\n Cents,\n LineItemSummary,\n SingleLineItemSummary,\n TaxRate,\n} from \"./types\";\n\n/**\n * Private helper to convert a floating number to a dinero friendly allocation integer pair\n * @see https://v2.dinerojs.com/docs/api/mutations/allocate\n * @example\n * taxRateToDineroAllocation(0.1) // [1, 9]\n * taxRateToDineroAllocation(0.5) // [5, 5]\n */\nexport const taxRateToDineroAllocation = (\n taxRate: TaxRate,\n): [number, number] => {\n if (taxRate <= 0 || taxRate >= 1) {\n throw new RangeError(\"Unsupported rate, expected in range of 0>rate<1\");\n }\n\n // Get the scale of the rate\n const rateScale = String(taxRate).split(\".\")[1]?.length;\n assert(rateScale !== undefined, \"rateScale is undefined\");\n\n // Convert to integers\n const rateInt = Math.round(taxRate * Math.pow(10, rateScale));\n return [rateInt, Math.pow(10, rateScale) - rateInt];\n};\n\n/**\n * Reverse engineer the taxable amount from \"whole item\" taxable amount into \"per item\" taxable amount for custom tax\n * rate calculations\n */\nexport const allocatePerItemTaxableAmount = (\n itemSummary: LineItemSummary,\n): SingleLineItemSummary[] => {\n /**\n * If the item quantity is 1, we can just return the item summary as is\n */\n if (itemSummary.quantity === 1) {\n return [itemSummary as SingleLineItemSummary];\n }\n\n // Reverse engineer price before discount\n const preDiscountAmount = add(\n getDinero(itemSummary.taxableAmount, itemSummary.currency),\n getDinero(itemSummary.discountAmount, itemSummary.currency),\n );\n\n const allocator = new FixedAmountAllocator({\n initialAllocateAmount: itemSummary.discountAmount,\n initialTotalAmount: amount(preDiscountAmount),\n currency: itemSummary.currency,\n });\n\n // Iterate over the amount of qty to reverse engineer the discount price\n return Array.from({ length: itemSummary.quantity }, () => {\n const discountAllocatedAmount = allocator.allocate(\n itemSummary.itemPrice,\n itemSummary.currency,\n );\n\n const taxableAmount = subtract(\n getDinero(itemSummary.itemPrice, itemSummary.currency),\n discountAllocatedAmount,\n );\n\n return {\n itemPrice: itemSummary.itemPrice,\n taxableAmount: amount(taxableAmount),\n discountAmount: amount(discountAllocatedAmount),\n currency: itemSummary.currency,\n quantity: 1,\n } as SingleLineItemSummary;\n });\n};\n\nexport const calculateWholeQtyLineItemTax = (\n itemSummary: LineItemSummary,\n taxRate: TaxRate,\n): Dinero<Cents> => {\n // Nothing to calculate\n if (taxRate === 0) {\n return getDinero(0, itemSummary.currency);\n }\n\n /**\n * FIXME: look into approach with multiply and different scale for control over rounding, currently we just inherit\n * what dinero gives us which cause unexpected rounding issue\n */\n const [taxAmount] = allocate(\n getDinero(itemSummary.taxableAmount, itemSummary.currency),\n taxRateToDineroAllocation(taxRate),\n );\n\n assert(taxAmount !== undefined, \"taxAmount is undefined\");\n return taxAmount;\n};\n\nexport const calculatePerQtyLineItemTax = (\n itemSummary: LineItemSummary,\n taxRate: TaxRate,\n): Dinero<Cents> => {\n // Nothing to calculate\n if (taxRate === 0) {\n return getDinero(0, itemSummary.currency);\n }\n\n // Split the item summary into per individual item qty summaries\n const singleItemSummaries = allocatePerItemTaxableAmount(itemSummary);\n\n // Calculate individual item qty tax and sum them up\n let totalTaxAmount = getDinero(0, itemSummary.currency);\n\n singleItemSummaries.forEach((itemSummary) => {\n // Probably a bit confusing at first, but calling the whole qty tax calculation function here as we can safely use\n // it as item summary is always a single item summary here\n const taxAmount = calculateWholeQtyLineItemTax(itemSummary, taxRate);\n totalTaxAmount = add(totalTaxAmount, taxAmount);\n });\n\n return totalTaxAmount;\n};\n"],"names":["taxRateToDineroAllocation","taxRate","RangeError","rateScale","String","split","length","assert","rateInt","Math","round","pow","allocatePerItemTaxableAmount","itemSummary","quantity","preDiscountAmount","add","getDinero","taxableAmount","currency","discountAmount","allocator","FixedAmountAllocator","initialAllocateAmount","initialTotalAmount","amount","Array","from","discountAllocatedAmount","allocate","itemPrice","subtract","calculateWholeQtyLineItemTax","taxAmount","calculatePerQtyLineItemTax","singleItemSummaries","totalTaxAmount","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B,IAAA;IAGrC,MAAAoB,SAAA,GAAYD,4BAA6BnB,CAAAA,YAAAA,EAAaZ,OAAO,CAAA;IAClDmC,cAAA,GAAApB,SAAA,CAAAA,GAAA,CAAIoB,gBAAgBH,SAAS,CAAA;EAAA,CAC/C,CAAA;EAEM,OAAAG,cAAA;AACT,CAAA;;;;"}
@@ -1,60 +0,0 @@
1
- import { add, subtract, allocate } from 'dinero.js';
2
- import { assert } from '../errors.mjs';
3
- import { FixedAmountAllocator } from './allocators/fixedAmount.mjs';
4
- import { getDinero, amount } from './misc.mjs';
5
- "use strict";
6
- const taxRateToDineroAllocation = taxRate => {
7
- if (taxRate <= 0 || taxRate >= 1) {
8
- throw new RangeError("Unsupported rate, expected in range of 0>rate<1");
9
- }
10
- const rateScale = String(taxRate).split(".")[1]?.length;
11
- assert(rateScale !== void 0, "rateScale is undefined");
12
- const rateInt = Math.round(taxRate * Math.pow(10, rateScale));
13
- return [rateInt, Math.pow(10, rateScale) - rateInt];
14
- };
15
- const allocatePerItemTaxableAmount = itemSummary => {
16
- if (itemSummary.quantity === 1) {
17
- return [itemSummary];
18
- }
19
- const preDiscountAmount = add(getDinero(itemSummary.taxableAmount, itemSummary.currency), getDinero(itemSummary.discountAmount, itemSummary.currency));
20
- const allocator = new FixedAmountAllocator({
21
- initialAllocateAmount: itemSummary.discountAmount,
22
- initialTotalAmount: amount(preDiscountAmount),
23
- currency: itemSummary.currency
24
- });
25
- return Array.from({
26
- length: itemSummary.quantity
27
- }, () => {
28
- const discountAllocatedAmount = allocator.allocate(itemSummary.itemPrice, itemSummary.currency);
29
- const taxableAmount = subtract(getDinero(itemSummary.itemPrice, itemSummary.currency), discountAllocatedAmount);
30
- return {
31
- itemPrice: itemSummary.itemPrice,
32
- taxableAmount: amount(taxableAmount),
33
- discountAmount: amount(discountAllocatedAmount),
34
- currency: itemSummary.currency,
35
- quantity: 1
36
- };
37
- });
38
- };
39
- const calculateWholeQtyLineItemTax = (itemSummary, taxRate) => {
40
- if (taxRate === 0) {
41
- return getDinero(0, itemSummary.currency);
42
- }
43
- const [taxAmount] = allocate(getDinero(itemSummary.taxableAmount, itemSummary.currency), taxRateToDineroAllocation(taxRate));
44
- assert(taxAmount !== void 0, "taxAmount is undefined");
45
- return taxAmount;
46
- };
47
- const calculatePerQtyLineItemTax = (itemSummary, taxRate) => {
48
- if (taxRate === 0) {
49
- return getDinero(0, itemSummary.currency);
50
- }
51
- const singleItemSummaries = allocatePerItemTaxableAmount(itemSummary);
52
- let totalTaxAmount = getDinero(0, itemSummary.currency);
53
- singleItemSummaries.forEach(itemSummary2 => {
54
- const taxAmount = calculateWholeQtyLineItemTax(itemSummary2, taxRate);
55
- totalTaxAmount = add(totalTaxAmount, taxAmount);
56
- });
57
- return totalTaxAmount;
58
- };
59
- export { allocatePerItemTaxableAmount, calculatePerQtyLineItemTax, calculateWholeQtyLineItemTax, taxRateToDineroAllocation };
60
- //# sourceMappingURL=tax.private.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tax.private.mjs","sources":["../../../src/utils/money/tax.private.ts"],"sourcesContent":["// #############################################################################\n// Internal helper functions not for consumption outside of store.core!\n// Wrote as separate files so that they can be easily unit tested without exposing them\n// #############################################################################\nimport type { Dinero } from \"dinero.js\";\nimport { add, allocate, subtract } from \"dinero.js\";\n\nimport { assert } from \"../errors\";\nimport { FixedAmountAllocator } from \"./allocators/fixedAmount\";\nimport { amount, getDinero } from \"./misc\";\nimport type {\n Cents,\n LineItemSummary,\n SingleLineItemSummary,\n TaxRate,\n} from \"./types\";\n\n/**\n * Private helper to convert a floating number to a dinero friendly allocation integer pair\n * @see https://v2.dinerojs.com/docs/api/mutations/allocate\n * @example\n * taxRateToDineroAllocation(0.1) // [1, 9]\n * taxRateToDineroAllocation(0.5) // [5, 5]\n */\nexport const taxRateToDineroAllocation = (\n taxRate: TaxRate,\n): [number, number] => {\n if (taxRate <= 0 || taxRate >= 1) {\n throw new RangeError(\"Unsupported rate, expected in range of 0>rate<1\");\n }\n\n // Get the scale of the rate\n const rateScale = String(taxRate).split(\".\")[1]?.length;\n assert(rateScale !== undefined, \"rateScale is undefined\");\n\n // Convert to integers\n const rateInt = Math.round(taxRate * Math.pow(10, rateScale));\n return [rateInt, Math.pow(10, rateScale) - rateInt];\n};\n\n/**\n * Reverse engineer the taxable amount from \"whole item\" taxable amount into \"per item\" taxable amount for custom tax\n * rate calculations\n */\nexport const allocatePerItemTaxableAmount = (\n itemSummary: LineItemSummary,\n): SingleLineItemSummary[] => {\n /**\n * If the item quantity is 1, we can just return the item summary as is\n */\n if (itemSummary.quantity === 1) {\n return [itemSummary as SingleLineItemSummary];\n }\n\n // Reverse engineer price before discount\n const preDiscountAmount = add(\n getDinero(itemSummary.taxableAmount, itemSummary.currency),\n getDinero(itemSummary.discountAmount, itemSummary.currency),\n );\n\n const allocator = new FixedAmountAllocator({\n initialAllocateAmount: itemSummary.discountAmount,\n initialTotalAmount: amount(preDiscountAmount),\n currency: itemSummary.currency,\n });\n\n // Iterate over the amount of qty to reverse engineer the discount price\n return Array.from({ length: itemSummary.quantity }, () => {\n const discountAllocatedAmount = allocator.allocate(\n itemSummary.itemPrice,\n itemSummary.currency,\n );\n\n const taxableAmount = subtract(\n getDinero(itemSummary.itemPrice, itemSummary.currency),\n discountAllocatedAmount,\n );\n\n return {\n itemPrice: itemSummary.itemPrice,\n taxableAmount: amount(taxableAmount),\n discountAmount: amount(discountAllocatedAmount),\n currency: itemSummary.currency,\n quantity: 1,\n } as SingleLineItemSummary;\n });\n};\n\nexport const calculateWholeQtyLineItemTax = (\n itemSummary: LineItemSummary,\n taxRate: TaxRate,\n): Dinero<Cents> => {\n // Nothing to calculate\n if (taxRate === 0) {\n return getDinero(0, itemSummary.currency);\n }\n\n /**\n * FIXME: look into approach with multiply and different scale for control over rounding, currently we just inherit\n * what dinero gives us which cause unexpected rounding issue\n */\n const [taxAmount] = allocate(\n getDinero(itemSummary.taxableAmount, itemSummary.currency),\n taxRateToDineroAllocation(taxRate),\n );\n\n assert(taxAmount !== undefined, \"taxAmount is undefined\");\n return taxAmount;\n};\n\nexport const calculatePerQtyLineItemTax = (\n itemSummary: LineItemSummary,\n taxRate: TaxRate,\n): Dinero<Cents> => {\n // Nothing to calculate\n if (taxRate === 0) {\n return getDinero(0, itemSummary.currency);\n }\n\n // Split the item summary into per individual item qty summaries\n const singleItemSummaries = allocatePerItemTaxableAmount(itemSummary);\n\n // Calculate individual item qty tax and sum them up\n let totalTaxAmount = getDinero(0, itemSummary.currency);\n\n singleItemSummaries.forEach((itemSummary) => {\n // Probably a bit confusing at first, but calling the whole qty tax calculation function here as we can safely use\n // it as item summary is always a single item summary here\n const taxAmount = calculateWholeQtyLineItemTax(itemSummary, taxRate);\n totalTaxAmount = add(totalTaxAmount, taxAmount);\n });\n\n return totalTaxAmount;\n};\n"],"names":["taxRateToDineroAllocation","taxRate","RangeError","rateScale","String","split","length","assert","rateInt","Math","round","pow","allocatePerItemTaxableAmount","itemSummary","quantity","preDiscountAmount","add","getDinero","taxableAmount","currency","discountAmount","allocator","FixedAmountAllocator","initialAllocateAmount","initialTotalAmount","amount","Array","from","discountAllocatedAmount","allocate","itemPrice","subtract","calculateWholeQtyLineItemTax","taxAmount","calculatePerQtyLineItemTax","singleItemSummaries","totalTaxAmount","forEach"],"mappings":";;;;;AAwBa,MAAAA,yBAAA,GACXC,OACqB,IAAA;EACjB,IAAAA,OAAA,IAAW,CAAK,IAAAA,OAAA,IAAW,CAAG,EAAA;IAC1B,MAAA,IAAIC,WAAW,iDAAiD,CAAA;EACxE;EAGM,MAAAC,SAAA,GAAYC,OAAOH,OAAO,CAAA,CAAEI,MAAM,GAAG,CAAA,CAAE,CAAC,CAAG,EAAAC,MAAA;EAC1CC,MAAA,CAAAJ,SAAA,KAAc,QAAW,wBAAwB,CAAA;EAGlD,MAAAK,OAAA,GAAUC,KAAKC,KAAM,CAAAT,OAAA,GAAUQ,KAAKE,GAAI,CAAA,EAAA,EAAIR,SAAS,CAAC,CAAA;EAC5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