@ubnt/store.core 11.28.0-custom-tax.1 → 11.28.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 (219) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/lib/_virtual/_virtual_multi-entry.js +6 -2
  3. package/lib/_virtual/_virtual_multi-entry.js.map +1 -1
  4. package/lib/_virtual/_virtual_multi-entry.mjs +6 -2
  5. package/lib/_virtual/_virtual_multi-entry.mjs.map +1 -1
  6. package/lib/assets/ai-360.jpg +0 -0
  7. package/lib/assets/ai-3602.jpg +0 -0
  8. package/lib/assets/ai-dslr.jpg +0 -0
  9. package/lib/assets/ai-dslr2.jpg +0 -0
  10. package/lib/assets/attention.svg +1 -1
  11. package/lib/assets/attention2.svg +1 -1
  12. package/lib/assets/compact.svg +1 -1
  13. package/lib/assets/compact2.svg +1 -1
  14. package/lib/assets/compact3.svg +1 -0
  15. package/lib/assets/door-hub-mini.jpg +0 -0
  16. package/lib/assets/door-hub-mini2.jpg +0 -0
  17. package/lib/assets/floodlight.svg +1 -1
  18. package/lib/assets/floodlight2.svg +1 -1
  19. package/lib/assets/g2-reader.jpg +0 -0
  20. package/lib/assets/g2-reader2.jpg +0 -0
  21. package/lib/assets/g3-reader.jpg +0 -0
  22. package/lib/assets/g3-reader2.jpg +0 -0
  23. package/lib/assets/g3-starter-kit-pro.jpg +0 -0
  24. package/lib/assets/g3-starter-kit-pro2.jpg +0 -0
  25. package/lib/assets/g3-starter-kit.jpg +0 -0
  26. package/lib/assets/g3-starter-kit2.jpg +0 -0
  27. package/lib/assets/g4-ptz.jpg +0 -0
  28. package/lib/assets/g4-ptz2.jpg +0 -0
  29. package/lib/assets/g5-dome.jpg +0 -0
  30. package/lib/assets/g5-dome2.jpg +0 -0
  31. package/lib/assets/g5-ptz.jpg +0 -0
  32. package/lib/assets/g5-ptz2.jpg +0 -0
  33. package/lib/assets/globe.svg +1 -1
  34. package/lib/assets/globe2.svg +1 -1
  35. package/lib/assets/interior-design.svg +1 -1
  36. package/lib/assets/interior-design2.svg +1 -1
  37. package/lib/assets/power.svg +1 -1
  38. package/lib/assets/power2.svg +1 -1
  39. package/lib/assets/rack.svg +1 -1
  40. package/lib/assets/rack2.svg +1 -1
  41. package/lib/components/Header/Header.js +1 -1
  42. package/lib/components/Header/Header.mjs +1 -1
  43. package/lib/components/Header/ProHeader/ProHeader.js +1 -1
  44. package/lib/components/Header/ProHeader/ProHeader.mjs +1 -1
  45. package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.js +1 -1
  46. package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.mjs +1 -1
  47. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.js +1 -1
  48. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.mjs +1 -1
  49. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.js +1 -1
  50. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.mjs +2 -2
  51. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.js +1 -1
  52. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.mjs +1 -1
  53. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.js +1 -1
  54. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.mjs +2 -2
  55. package/lib/constants/icons/header/globe.svg.js +1 -1
  56. package/lib/constants/icons/header/globe.svg.mjs +2 -2
  57. package/lib/constants/icons/header/index.js +1 -1
  58. package/lib/constants/icons/header/index.mjs +1 -1
  59. package/lib/constants/icons/menu/floodlight.svg.js +5 -5
  60. package/lib/constants/icons/menu/floodlight.svg.mjs +2 -2
  61. package/lib/constants/icons/menu/index.js +9 -9
  62. package/lib/constants/icons/menu/index.mjs +3 -3
  63. package/lib/constants/icons/menu/power.svg.js +5 -5
  64. package/lib/constants/icons/menu/power.svg.mjs +2 -2
  65. package/lib/constants/icons/menu/rack.svg.js +5 -5
  66. package/lib/constants/icons/menu/rack.svg.mjs +2 -2
  67. package/lib/constants/modelCompareData/assets/Bullet/ai-dslr.jpg.js +1 -1
  68. package/lib/constants/modelCompareData/assets/Bullet/ai-dslr.jpg.mjs +2 -2
  69. package/lib/constants/modelCompareData/assets/DomeTurret/ai-360.jpg.js +1 -1
  70. package/lib/constants/modelCompareData/assets/DomeTurret/ai-360.jpg.mjs +2 -2
  71. package/lib/constants/modelCompareData/assets/DomeTurret/g5-dome.jpg.js +1 -1
  72. package/lib/constants/modelCompareData/assets/DomeTurret/g5-dome.jpg.mjs +2 -2
  73. package/lib/constants/modelCompareData/assets/DoorAccess/door-hub-mini.jpg.js +1 -1
  74. package/lib/constants/modelCompareData/assets/DoorAccess/door-hub-mini.jpg.mjs +2 -2
  75. package/lib/constants/modelCompareData/assets/DoorAccess/g2-reader.jpg.js +1 -1
  76. package/lib/constants/modelCompareData/assets/DoorAccess/g2-reader.jpg.mjs +2 -2
  77. package/lib/constants/modelCompareData/assets/DoorAccess/g3-reader.jpg.js +1 -1
  78. package/lib/constants/modelCompareData/assets/DoorAccess/g3-reader.jpg.mjs +2 -2
  79. package/lib/constants/modelCompareData/assets/DoorAccess/g3-starter-kit-pro.jpg.js +1 -1
  80. package/lib/constants/modelCompareData/assets/DoorAccess/g3-starter-kit-pro.jpg.mjs +2 -2
  81. package/lib/constants/modelCompareData/assets/DoorAccess/g3-starter-kit.jpg.js +1 -1
  82. package/lib/constants/modelCompareData/assets/DoorAccess/g3-starter-kit.jpg.mjs +2 -2
  83. package/lib/constants/modelCompareData/assets/PTZ/g4-ptz.jpg.js +1 -1
  84. package/lib/constants/modelCompareData/assets/PTZ/g4-ptz.jpg.mjs +2 -2
  85. package/lib/constants/modelCompareData/assets/PTZ/g5-ptz.jpg.js +1 -1
  86. package/lib/constants/modelCompareData/assets/PTZ/g5-ptz.jpg.mjs +2 -2
  87. package/lib/constants/modelCompareData/assets/compact.svg.js +1 -1
  88. package/lib/constants/modelCompareData/assets/compact.svg.mjs +2 -2
  89. package/lib/constants/modelCompareData/assets/floodlight.svg.js +1 -1
  90. package/lib/constants/modelCompareData/assets/floodlight.svg.mjs +2 -2
  91. package/lib/constants/modelCompareData/assets/globe.svg.js +1 -1
  92. package/lib/constants/modelCompareData/assets/globe.svg.mjs +2 -2
  93. package/lib/constants/modelCompareData/assets/interior-design.svg.js +1 -1
  94. package/lib/constants/modelCompareData/assets/interior-design.svg.mjs +2 -2
  95. package/lib/constants/modelCompareData/assets/power.svg.js +1 -1
  96. package/lib/constants/modelCompareData/assets/power.svg.mjs +2 -2
  97. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/bullet/ai-dslr.jpg.js +1 -1
  98. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/bullet/ai-dslr.jpg.mjs +2 -2
  99. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/ai-360.jpg.js +1 -1
  100. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/ai-360.jpg.mjs +2 -2
  101. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/g5-dome.jpg.js +1 -1
  102. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/g5-dome.jpg.mjs +2 -2
  103. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/door-hub-mini.jpg.js +1 -1
  104. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/door-hub-mini.jpg.mjs +2 -2
  105. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g2-reader.jpg.js +1 -1
  106. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g2-reader.jpg.mjs +2 -2
  107. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-reader.jpg.js +1 -1
  108. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-reader.jpg.mjs +2 -2
  109. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-starter-kit-pro.jpg.js +1 -1
  110. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-starter-kit-pro.jpg.mjs +2 -2
  111. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-starter-kit.jpg.js +1 -1
  112. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-starter-kit.jpg.mjs +2 -2
  113. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/ptz/g4-ptz.jpg.js +1 -1
  114. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/ptz/g4-ptz.jpg.mjs +2 -2
  115. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/ptz/g5-ptz.jpg.js +1 -1
  116. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/ptz/g5-ptz.jpg.mjs +2 -2
  117. package/lib/constants/modelCompareData/assets/product-list-assets/compact.svg.js +1 -1
  118. package/lib/constants/modelCompareData/assets/product-list-assets/compact.svg.mjs +2 -2
  119. package/lib/constants/modelCompareData/assets/product-list-assets/compact2.svg.js +1 -1
  120. package/lib/constants/modelCompareData/assets/product-list-assets/compact2.svg.mjs +2 -2
  121. package/lib/constants/modelCompareData/assets/product-list-assets/interior-design.svg.js +1 -1
  122. package/lib/constants/modelCompareData/assets/product-list-assets/interior-design.svg.mjs +2 -2
  123. package/lib/constants/modelCompareData/assets/rack.svg.js +1 -1
  124. package/lib/constants/modelCompareData/assets/rack.svg.mjs +2 -2
  125. package/lib/constants/modelCompareData/data/product-groups/cameraSecurity/Compact.js +1 -1
  126. package/lib/constants/modelCompareData/data/product-groups/cameraSecurity/Compact.mjs +1 -1
  127. package/lib/constants/modelCompareData/data/product-groups/cameraSecurity/InteriorDesign.js +1 -1
  128. package/lib/constants/modelCompareData/data/product-groups/cameraSecurity/InteriorDesign.mjs +1 -1
  129. package/lib/constants/modelCompareData/data/product-list-groups/compact.js +1 -1
  130. package/lib/constants/modelCompareData/data/product-list-groups/compact.mjs +1 -1
  131. package/lib/constants/modelCompareData/data/product-list-groups/interiorDesign.js +1 -1
  132. package/lib/constants/modelCompareData/data/product-list-groups/interiorDesign.mjs +1 -1
  133. package/lib/constants/modelCompareData/data/product-list-groups/productListSwitchingCompact.js +1 -1
  134. package/lib/constants/modelCompareData/data/product-list-groups/productListSwitchingCompact.mjs +1 -1
  135. package/lib/constants/modelCompareData/data/products/ai360.js +2 -2
  136. package/lib/constants/modelCompareData/data/products/ai360.mjs +2 -2
  137. package/lib/constants/modelCompareData/data/products/aiDslr.js +2 -2
  138. package/lib/constants/modelCompareData/data/products/aiDslr.mjs +2 -2
  139. package/lib/constants/modelCompareData/data/products/doorHubMini.js +2 -2
  140. package/lib/constants/modelCompareData/data/products/doorHubMini.mjs +2 -2
  141. package/lib/constants/modelCompareData/data/products/g2Reader.js +2 -2
  142. package/lib/constants/modelCompareData/data/products/g2Reader.mjs +2 -2
  143. package/lib/constants/modelCompareData/data/products/g3Reader.js +2 -2
  144. package/lib/constants/modelCompareData/data/products/g3Reader.mjs +2 -2
  145. package/lib/constants/modelCompareData/data/products/g3StarterKit.js +2 -2
  146. package/lib/constants/modelCompareData/data/products/g3StarterKit.mjs +2 -2
  147. package/lib/constants/modelCompareData/data/products/g3StarterKitPro.js +2 -2
  148. package/lib/constants/modelCompareData/data/products/g3StarterKitPro.mjs +2 -2
  149. package/lib/constants/modelCompareData/data/products/g4Ptz.js +2 -2
  150. package/lib/constants/modelCompareData/data/products/g4Ptz.mjs +2 -2
  151. package/lib/constants/modelCompareData/data/products/g5Dome.js +2 -2
  152. package/lib/constants/modelCompareData/data/products/g5Dome.mjs +2 -2
  153. package/lib/constants/modelCompareData/data/products/g5Ptz.js +2 -2
  154. package/lib/constants/modelCompareData/data/products/g5Ptz.mjs +2 -2
  155. package/lib/constants/modelCompareData/data/properties/accessPowerMethod.js +1 -1
  156. package/lib/constants/modelCompareData/data/properties/accessPowerMethod.mjs +1 -1
  157. package/lib/constants/modelCompareData/data/properties/availability.js +1 -1
  158. package/lib/constants/modelCompareData/data/properties/availability.mjs +1 -1
  159. package/lib/constants/modelCompareData/data/properties/builtInFloodlight.js +1 -1
  160. package/lib/constants/modelCompareData/data/properties/builtInFloodlight.mjs +1 -1
  161. package/lib/constants/modelCompareData/data/properties/dcPowerOutput.js +1 -1
  162. package/lib/constants/modelCompareData/data/properties/dcPowerOutput.mjs +1 -1
  163. package/lib/constants/modelCompareData/data/properties/mounting.js +1 -1
  164. package/lib/constants/modelCompareData/data/properties/mounting.mjs +1 -1
  165. package/lib/constants/modelCompareData/data/properties/unasPowerMethod.js +1 -1
  166. package/lib/constants/modelCompareData/data/properties/unasPowerMethod.mjs +1 -1
  167. package/lib/constants/modelCompareData/data/properties/webMode.js +1 -1
  168. package/lib/constants/modelCompareData/data/properties/webMode.mjs +1 -1
  169. package/lib/contexts/MenuContext/mapping.js +3 -3
  170. package/lib/contexts/MenuContext/mapping.mjs +2 -2
  171. package/lib/contexts/MicrositeMenuContext/mapping.js +3 -3
  172. package/lib/contexts/MicrositeMenuContext/mapping.mjs +2 -2
  173. package/lib/utils/{map.js → KeyMap.js} +1 -1
  174. package/lib/utils/KeyMap.js.map +1 -0
  175. package/lib/utils/{map.mjs → KeyMap.mjs} +1 -1
  176. package/lib/utils/KeyMap.mjs.map +1 -0
  177. package/lib/utils/index.d.ts +3 -1
  178. package/lib/utils/index.js +6 -2
  179. package/lib/utils/index.js.map +1 -1
  180. package/lib/utils/index.mjs +6 -2
  181. package/lib/utils/index.mjs.map +1 -1
  182. package/lib/utils/makeMap.d.ts +44 -0
  183. package/lib/utils/makeMap.js +28 -0
  184. package/lib/utils/makeMap.js.map +1 -0
  185. package/lib/utils/makeMap.mjs +25 -0
  186. package/lib/utils/makeMap.mjs.map +1 -0
  187. package/lib/utils/makeSet.d.ts +14 -0
  188. package/lib/utils/makeSet.js +8 -0
  189. package/lib/utils/makeSet.js.map +1 -0
  190. package/lib/utils/makeSet.mjs +7 -0
  191. package/lib/utils/makeSet.mjs.map +1 -0
  192. package/lib/utils/makeSet.test.d.ts +1 -0
  193. package/lib/utils/money/index.d.ts +0 -1
  194. package/lib/utils/money/index.js +0 -2
  195. package/lib/utils/money/index.js.map +1 -1
  196. package/lib/utils/money/index.mjs +0 -1
  197. package/lib/utils/money/index.mjs.map +1 -1
  198. package/lib/utils/money/tax.d.ts +3 -6
  199. package/lib/utils/money/tax.js +10 -3
  200. package/lib/utils/money/tax.js.map +1 -1
  201. package/lib/utils/money/tax.mjs +13 -6
  202. package/lib/utils/money/tax.mjs.map +1 -1
  203. package/lib/utils/money/tax.private.d.ts +2 -7
  204. package/lib/utils/money/tax.private.js +6 -21
  205. package/lib/utils/money/tax.private.js.map +1 -1
  206. package/lib/utils/money/tax.private.mjs +8 -22
  207. package/lib/utils/money/tax.private.mjs.map +1 -1
  208. package/package.json +1 -1
  209. package/lib/assets/compact22.svg +0 -1
  210. package/lib/utils/map.js.map +0 -1
  211. package/lib/utils/map.mjs.map +0 -1
  212. package/lib/utils/money/allocators/totalAmount.d.ts +0 -17
  213. package/lib/utils/money/allocators/totalAmount.js +0 -40
  214. package/lib/utils/money/allocators/totalAmount.js.map +0 -1
  215. package/lib/utils/money/allocators/totalAmount.mjs +0 -38
  216. package/lib/utils/money/allocators/totalAmount.mjs.map +0 -1
  217. /package/lib/utils/{map.d.ts → KeyMap.d.ts} +0 -0
  218. /package/lib/utils/{map.test.d.ts → KeyMap.test.d.ts} +0 -0
  219. /package/lib/utils/{money/allocators/totalAmount.test.d.ts → makeMap.test.d.ts} +0 -0
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  require('../../assets/floodlight.svg.js');
4
- var icon = require("../../../../assets/floodlight2.svg");
4
+ var icon = require("../../../../assets/floodlight.svg");
5
5
  function _interopDefault(e) {
6
6
  return e && e.__esModule ? e : {
7
7
  default: e
@@ -1,5 +1,5 @@
1
1
  import '../../assets/floodlight.svg.mjs';
2
- import icon__default from "../../../../assets/floodlight2.svg";
2
+ import icon__default from "../../../../assets/floodlight.svg";
3
3
  "use strict";
4
4
  const builtInFloodlight = {
5
5
  id: "builtInFloodlight",
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  require('../../assets/power.svg.js');
4
- var icon = require("../../../../assets/power2.svg");
4
+ var icon = require("../../../../assets/power.svg");
5
5
  function _interopDefault(e) {
6
6
  return e && e.__esModule ? e : {
7
7
  default: e
@@ -1,5 +1,5 @@
1
1
  import '../../assets/power.svg.mjs';
2
- import icon__default from "../../../../assets/power2.svg";
2
+ import icon__default from "../../../../assets/power.svg";
3
3
  "use strict";
4
4
  const dcPowerOutput = {
5
5
  id: "dcPowerOutput",
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  require('../../assets/rack.svg.js');
4
- var icon = require("../../../../assets/rack2.svg");
4
+ var icon = require("../../../../assets/rack.svg");
5
5
  function _interopDefault(e) {
6
6
  return e && e.__esModule ? e : {
7
7
  default: e
@@ -1,5 +1,5 @@
1
1
  import '../../assets/rack.svg.mjs';
2
- import icon__default from "../../../../assets/rack2.svg";
2
+ import icon__default from "../../../../assets/rack.svg";
3
3
  "use strict";
4
4
  const mounting = {
5
5
  id: "mounting",
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  require('../../assets/power.svg.js');
4
- var icon = require("../../../../assets/power2.svg");
4
+ var icon = require("../../../../assets/power.svg");
5
5
  function _interopDefault(e) {
6
6
  return e && e.__esModule ? e : {
7
7
  default: e
@@ -1,5 +1,5 @@
1
1
  import '../../assets/power.svg.mjs';
2
- import icon__default from "../../../../assets/power2.svg";
2
+ import icon__default from "../../../../assets/power.svg";
3
3
  "use strict";
4
4
  const unasPowerMethod = {
5
5
  id: "unasPowerMethod",
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  require('../../assets/globe.svg.js');
4
- var icon = require("../../../../assets/globe2.svg");
4
+ var icon = require("../../../../assets/globe.svg");
5
5
  function _interopDefault(e) {
6
6
  return e && e.__esModule ? e : {
7
7
  default: e
@@ -1,5 +1,5 @@
1
1
  import '../../assets/globe.svg.mjs';
2
- import icon__default from "../../../../assets/globe2.svg";
2
+ import icon__default from "../../../../assets/globe.svg";
3
3
  "use strict";
4
4
  const webMode = {
5
5
  id: "webMode",
@@ -56,7 +56,7 @@ var _externalAssets_D7iijHbw = require("../../assets/powerAmp.svg");
56
56
  var _externalAssets_CSNKwvWT = require("../../assets/unas.svg");
57
57
  var _externalAssets_D37k8sgh = require("../../assets/powerTech.svg");
58
58
  var _externalAssets_6$HKdBjs = require("../../assets/cabling.svg");
59
- var _externalAssets_DLRZMdvL = require("../../assets/rack.svg");
59
+ var _externalAssets_BFVOBxjM = require("../../assets/rack2.svg");
60
60
  var _externalAssets_DRzhtlf4 = require("../../assets/storage.svg");
61
61
  var _externalAssets_BUjasMxx = require("../../assets/internetSolutions.svg");
62
62
  var _externalAssets_BM8zMoz6 = require("../../assets/specificConsoles.svg");
@@ -117,7 +117,7 @@ var _externalAssets_D7iijHbw__default = /*#__PURE__*/_interopDefault(_externalAs
117
117
  var _externalAssets_CSNKwvWT__default = /*#__PURE__*/_interopDefault(_externalAssets_CSNKwvWT);
118
118
  var _externalAssets_D37k8sgh__default = /*#__PURE__*/_interopDefault(_externalAssets_D37k8sgh);
119
119
  var _externalAssets_6$HKdBjs__default = /*#__PURE__*/_interopDefault(_externalAssets_6$HKdBjs);
120
- var _externalAssets_DLRZMdvL__default = /*#__PURE__*/_interopDefault(_externalAssets_DLRZMdvL);
120
+ var _externalAssets_BFVOBxjM__default = /*#__PURE__*/_interopDefault(_externalAssets_BFVOBxjM);
121
121
  var _externalAssets_DRzhtlf4__default = /*#__PURE__*/_interopDefault(_externalAssets_DRzhtlf4);
122
122
  var _externalAssets_BUjasMxx__default = /*#__PURE__*/_interopDefault(_externalAssets_BUjasMxx);
123
123
  var _externalAssets_BM8zMoz6__default = /*#__PURE__*/_interopDefault(_externalAssets_BM8zMoz6);
@@ -604,7 +604,7 @@ const NAVIGATION_MAPPING = {
604
604
  id: "installations",
605
605
  label: "Installations",
606
606
  icon: {
607
- src: _externalAssets_DLRZMdvL__default["default"],
607
+ src: _externalAssets_BFVOBxjM__default["default"],
608
608
  width: 41,
609
609
  height: 38
610
610
  },
@@ -54,7 +54,7 @@ import _externalAssets_D7iijHbw__default from "../../assets/powerAmp.svg";
54
54
  import _externalAssets_CSNKwvWT__default from "../../assets/unas.svg";
55
55
  import _externalAssets_D37k8sgh__default from "../../assets/powerTech.svg";
56
56
  import _externalAssets_6$HKdBjs__default from "../../assets/cabling.svg";
57
- import _externalAssets_DLRZMdvL__default from "../../assets/rack.svg";
57
+ import _externalAssets_BFVOBxjM__default from "../../assets/rack2.svg";
58
58
  import _externalAssets_DRzhtlf4__default from "../../assets/storage.svg";
59
59
  import _externalAssets_BUjasMxx__default from "../../assets/internetSolutions.svg";
60
60
  import _externalAssets_BM8zMoz6__default from "../../assets/specificConsoles.svg";
@@ -541,7 +541,7 @@ const NAVIGATION_MAPPING = {
541
541
  id: "installations",
542
542
  label: "Installations",
543
543
  icon: {
544
- src: _externalAssets_DLRZMdvL__default,
544
+ src: _externalAssets_BFVOBxjM__default,
545
545
  width: 41,
546
546
  height: 38
547
547
  },
@@ -49,7 +49,7 @@ var _externalAssets_BJ4JezH6 = require("../../assets/doorbells.svg");
49
49
  var _externalAssets_TWdDoFCP = require("../../assets/compact-cameras.svg");
50
50
  var _externalAssets_B4KkF36C = require("../../assets/ai-enhancements.svg");
51
51
  var _externalAssets_CgJ1WmE4 = require("../../assets/superlink.svg");
52
- var _externalAssets_D9OBvcup = require("../../assets/floodlight.svg");
52
+ var _externalAssets_CtJPud52 = require("../../assets/floodlight2.svg");
53
53
  var _externalAssets_C_DozlA4 = require("../../assets/camera-special-devices.png");
54
54
  var _externalAssets_h17pgRRZ = require("../../assets/special-devices.svg");
55
55
  var _externalAssets_2tUH2ymR = require("../../assets/video-recorders.png");
@@ -144,7 +144,7 @@ var _externalAssets_BJ4JezH6__default = /*#__PURE__*/_interopDefault(_externalAs
144
144
  var _externalAssets_TWdDoFCP__default = /*#__PURE__*/_interopDefault(_externalAssets_TWdDoFCP);
145
145
  var _externalAssets_B4KkF36C__default = /*#__PURE__*/_interopDefault(_externalAssets_B4KkF36C);
146
146
  var _externalAssets_CgJ1WmE4__default = /*#__PURE__*/_interopDefault(_externalAssets_CgJ1WmE4);
147
- var _externalAssets_D9OBvcup__default = /*#__PURE__*/_interopDefault(_externalAssets_D9OBvcup);
147
+ var _externalAssets_CtJPud52__default = /*#__PURE__*/_interopDefault(_externalAssets_CtJPud52);
148
148
  var _externalAssets_C_DozlA4__default = /*#__PURE__*/_interopDefault(_externalAssets_C_DozlA4);
149
149
  var _externalAssets_h17pgRRZ__default = /*#__PURE__*/_interopDefault(_externalAssets_h17pgRRZ);
150
150
  var _externalAssets_2tUH2ymR__default = /*#__PURE__*/_interopDefault(_externalAssets_2tUH2ymR);
@@ -650,7 +650,7 @@ const SHARED_MENU_ITEMS = [{
650
650
  label: "menu.label.security.specialDevices.floodlight",
651
651
  url: [mapping.SiteId.Ui, "/physical-security/special-devices/floodlight"],
652
652
  icon: {
653
- src: _externalAssets_D9OBvcup__default["default"],
653
+ src: _externalAssets_CtJPud52__default["default"],
654
654
  width: 40,
655
655
  height: 40
656
656
  }
@@ -47,7 +47,7 @@ import _externalAssets_BJ4JezH6__default from "../../assets/doorbells.svg";
47
47
  import _externalAssets_TWdDoFCP__default from "../../assets/compact-cameras.svg";
48
48
  import _externalAssets_B4KkF36C__default from "../../assets/ai-enhancements.svg";
49
49
  import _externalAssets_CgJ1WmE4__default from "../../assets/superlink.svg";
50
- import _externalAssets_D9OBvcup__default from "../../assets/floodlight.svg";
50
+ import _externalAssets_CtJPud52__default from "../../assets/floodlight2.svg";
51
51
  import _externalAssets_C_DozlA4__default from "../../assets/camera-special-devices.png";
52
52
  import _externalAssets_h17pgRRZ__default from "../../assets/special-devices.svg";
53
53
  import _externalAssets_2tUH2ymR__default from "../../assets/video-recorders.png";
@@ -553,7 +553,7 @@ const SHARED_MENU_ITEMS = [{
553
553
  label: "menu.label.security.specialDevices.floodlight",
554
554
  url: [SiteId.Ui, "/physical-security/special-devices/floodlight"],
555
555
  icon: {
556
- src: _externalAssets_D9OBvcup__default,
556
+ src: _externalAssets_CtJPud52__default,
557
557
  width: 40,
558
558
  height: 40
559
559
  }
@@ -94,4 +94,4 @@ class KeyMap {
94
94
  }
95
95
  }
96
96
  exports.KeyMap = KeyMap;
97
- //# sourceMappingURL=map.js.map
97
+ //# sourceMappingURL=KeyMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyMap.js","sources":["../../src/utils/KeyMap.ts"],"sourcesContent":["import { createArrayFromInterfaceKeys } from \"./array\";\n\n/**\n * Type-safe key parser that ensures all properties of the key are used\n */\nexport type KeyParser<Key> = (key: Key) => string;\n\n/**\n * Type-safe KeyMap implementation with compile-time validation\n */\nexport class KeyMap<Key, Value> {\n #map: Map<string, Value>;\n #keyParser: KeyParser<Key>;\n #keyValidator: (key: Key) => void;\n\n constructor(\n parser: KeyParser<Key>,\n entries?: readonly (readonly [Key, Value])[] | null | undefined,\n validator?: (key: Key) => void,\n ) {\n this.#keyParser = parser;\n this.#keyValidator = validator || (() => {});\n this.#map = Array.isArray(entries)\n ? new Map(\n entries.map(([key, value]) => {\n this.#keyValidator(key);\n return [this.#keyParser(key), value];\n }),\n )\n : new Map();\n }\n\n /**\n * Get a value by key with runtime validation\n */\n get(key: Key): Value | undefined {\n this.#keyValidator(key);\n return this.#map.get(this.#keyParser(key));\n }\n\n /**\n * Set a value by key with runtime validation\n */\n set(key: Key, value: Value): void {\n this.#keyValidator(key);\n this.#map.set(this.#keyParser(key), value);\n }\n\n /**\n * Check if a key exists with runtime validation\n */\n has(key: Key): boolean {\n this.#keyValidator(key);\n return this.#map.has(this.#keyParser(key));\n }\n\n /**\n * Get all values\n */\n values(): IterableIterator<Value> {\n return this.#map.values();\n }\n\n /**\n * Get all keys (returns stringified keys)\n */\n keys(): IterableIterator<string> {\n return this.#map.keys();\n }\n\n /**\n * Get all entries (returns stringified keys)\n */\n entries(): IterableIterator<[string, Value]> {\n return this.#map.entries();\n }\n\n /**\n * Get the size of the map\n */\n get size(): number {\n return this.#map.size;\n }\n\n /**\n * Clear all entries\n */\n clear(): void {\n this.#map.clear();\n }\n\n /**\n * Delete an entry by key\n */\n delete(key: Key): boolean {\n this.#keyValidator(key);\n return this.#map.delete(this.#keyParser(key));\n }\n\n /**\n * Create a KeyMap for database composite keys with automatic validation\n */\n static createForCompositeKey<\n Key extends Record<string, string | number>,\n Value,\n >(\n keyFieldObject: Record<keyof Key, true>,\n entries?: readonly (readonly [Key, Value])[] | null | undefined,\n ): KeyMap<Key, Value> {\n const keyFields = createArrayFromInterfaceKeys(keyFieldObject);\n\n const parser: KeyParser<Key> = (key) => {\n return keyFields.map((field) => String(key[field])).join(\"_\");\n };\n\n const validator = (key: Key) => {\n for (const field of keyFields) {\n if (!(field in key)) {\n throw new Error(`Missing required key field: ${String(field)}`);\n }\n if (key[field] == null) {\n throw new Error(\n `Key field ${String(field)} cannot be null or undefined`,\n );\n }\n }\n };\n\n return new KeyMap(parser, entries, validator);\n }\n}\n"],"names":["KeyMap","map","keyParser","keyValidator","constructor","parser","entries","validator","Array","isArray","Map","key","value","get","set","has","values","keys","size","clear","delete","createForCompositeKey","keyFieldObject","keyFields","createArrayFromInterfaceKeys","field","String","join","Error"],"mappings":";;;;AAUO,MAAMA,MAAA,CAAmB;EAC9B,CAAAC,GAAA;EACA,CAAAC,SAAA;EACA,CAAAC,YAAA;EAEAC,WAAAA,CACEC,MAAA,EACAC,OAAA,EACAC,SAAA,EACA;IACA,IAAA,CAAK,CAAAL,SAAA,GAAaG,MAAA;IAClB,IAAA,CAAK,CAAAF,YAAA,GAAgBI,cAAc,MAAM,CAAC,CAAA,CAAA;IAC1C,IAAA,C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@@ -92,4 +92,4 @@ class KeyMap {
92
92
  }
93
93
  }
94
94
  export { KeyMap };
95
- //# sourceMappingURL=map.mjs.map
95
+ //# sourceMappingURL=KeyMap.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyMap.mjs","sources":["../../src/utils/KeyMap.ts"],"sourcesContent":["import { createArrayFromInterfaceKeys } from \"./array\";\n\n/**\n * Type-safe key parser that ensures all properties of the key are used\n */\nexport type KeyParser<Key> = (key: Key) => string;\n\n/**\n * Type-safe KeyMap implementation with compile-time validation\n */\nexport class KeyMap<Key, Value> {\n #map: Map<string, Value>;\n #keyParser: KeyParser<Key>;\n #keyValidator: (key: Key) => void;\n\n constructor(\n parser: KeyParser<Key>,\n entries?: readonly (readonly [Key, Value])[] | null | undefined,\n validator?: (key: Key) => void,\n ) {\n this.#keyParser = parser;\n this.#keyValidator = validator || (() => {});\n this.#map = Array.isArray(entries)\n ? new Map(\n entries.map(([key, value]) => {\n this.#keyValidator(key);\n return [this.#keyParser(key), value];\n }),\n )\n : new Map();\n }\n\n /**\n * Get a value by key with runtime validation\n */\n get(key: Key): Value | undefined {\n this.#keyValidator(key);\n return this.#map.get(this.#keyParser(key));\n }\n\n /**\n * Set a value by key with runtime validation\n */\n set(key: Key, value: Value): void {\n this.#keyValidator(key);\n this.#map.set(this.#keyParser(key), value);\n }\n\n /**\n * Check if a key exists with runtime validation\n */\n has(key: Key): boolean {\n this.#keyValidator(key);\n return this.#map.has(this.#keyParser(key));\n }\n\n /**\n * Get all values\n */\n values(): IterableIterator<Value> {\n return this.#map.values();\n }\n\n /**\n * Get all keys (returns stringified keys)\n */\n keys(): IterableIterator<string> {\n return this.#map.keys();\n }\n\n /**\n * Get all entries (returns stringified keys)\n */\n entries(): IterableIterator<[string, Value]> {\n return this.#map.entries();\n }\n\n /**\n * Get the size of the map\n */\n get size(): number {\n return this.#map.size;\n }\n\n /**\n * Clear all entries\n */\n clear(): void {\n this.#map.clear();\n }\n\n /**\n * Delete an entry by key\n */\n delete(key: Key): boolean {\n this.#keyValidator(key);\n return this.#map.delete(this.#keyParser(key));\n }\n\n /**\n * Create a KeyMap for database composite keys with automatic validation\n */\n static createForCompositeKey<\n Key extends Record<string, string | number>,\n Value,\n >(\n keyFieldObject: Record<keyof Key, true>,\n entries?: readonly (readonly [Key, Value])[] | null | undefined,\n ): KeyMap<Key, Value> {\n const keyFields = createArrayFromInterfaceKeys(keyFieldObject);\n\n const parser: KeyParser<Key> = (key) => {\n return keyFields.map((field) => String(key[field])).join(\"_\");\n };\n\n const validator = (key: Key) => {\n for (const field of keyFields) {\n if (!(field in key)) {\n throw new Error(`Missing required key field: ${String(field)}`);\n }\n if (key[field] == null) {\n throw new Error(\n `Key field ${String(field)} cannot be null or undefined`,\n );\n }\n }\n };\n\n return new KeyMap(parser, entries, validator);\n }\n}\n"],"names":["KeyMap","map","keyParser","keyValidator","constructor","parser","entries","validator","Array","isArray","Map","key","value","get","set","has","values","keys","size","clear","delete","createForCompositeKey","keyFieldObject","keyFields","createArrayFromInterfaceKeys","field","String","join","Error"],"mappings":";;AAUO,MAAMA,MAAA,CAAmB;EAC9B,CAAAC,GAAA;EACA,CAAAC,SAAA;EACA,CAAAC,YAAA;EAEAC,WAAAA,CACEC,MAAA,EACAC,OAAA,EACAC,SAAA,EACA;IACA,IAAA,CAAK,CAAAL,SAAA,GAAaG,MAAA;IAClB,IAAA,CAAK,CAAAF,YAAA,GAAgBI,cAAc,MAAM,CAAC,CAAA,CAAA;IAC1C,IAAA,CAAK,CAAAN,GAAA,GAAOO,KAAA,CAAMC,OAAA,CAAQH,OAAO,IAC7B,IAAII,GAAA,CACFJ,QAAQL,GAAA,CAAI,CAAC,CAACU,GAAA,EAAKC,KAAK,CAAA,KAAM;MAC5B,IAAA,CAAK,CAAAT,aAAcQ,GAAG,CAAA;MACtB,OAAO,CAAC,IAAA,CAAK,CAAAT,SAAA,CAAWS,GAAG,GAAGC,KAAK,CAAA;IACrC,CAAC,CAAA,CACH,GAAA,m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;IACxB,IAAA,CAAK,CAAAR,aAAcQ,GAAG,CAAA;IACtB,OAAO,KAAK,CAAAV,GAAA,CAAKmB,MAAA,CAAO,IAAA,CAAK,CAAAlB,SAAA,CAAWS,GAAG,CAAC,CAAA;EAC9C;EAAA;AAAA;AAAA;EAKA,OAAOU,qBAAAA,CAILC,cAAA,EACAhB,OAAA,EACoB;IACpB,MAAMiB,SAAA,GAAYC,6BAA6BF,cAAc,CAAA;IAE7D,MAAMjB,MAAA,GAA0BM,GAAA,IAAQ;MACtC,OAAOY,SAAA,CAAUtB,GAAA,CAAKwB,KAAA,IAAUC,MAAA,CAAOf,GAAA,CAAIc,KAAK,CAAC,CAAC,CAAA,CAAEE,IAAA,CAAK,GAAG,CAAA;IAC9D,CAAA;IAEA,MAAMpB,SAAA,GAAaI,GAAA,IAAa;MAC9B,KAAA,MAAWc,SAASF,SAAA,EAAW;QAC7B,IAAI,EAAEE,SAASd,GAAA,CAAA,EAAM;UACnB,MAAM,IAAIiB,KAAA,CAAM,+BAA+BF,MAAA,CAAOD,KAAK,CAAC,EAAE,CAAA;QAChE;QACA,IAAId,GAAA,CAAIc,KAAK,CAAA,IAAK,IAAA,EAAM;UACtB,MAAM,IAAIG,KAAA,CACR,aAAaF,MAAA,CAAOD,KAAK,CAAC,8BAAA,CAC5B;QACF;MACF;IACF,CAAA;IAEA,OAAO,IAAIzB,MAAA,CAAOK,MAAA,EAAQC,OAAA,EAASC,SAAS,CAAA;EAC9C;AACF;"}
@@ -20,4 +20,6 @@ export * as styles from "./styles";
20
20
  export * as storeId from "./storeId";
21
21
  export * as blackFriday from "./blackFriday";
22
22
  export * as sales from "./sales";
23
- export * as map from "./map";
23
+ export * as keyMap from "./KeyMap";
24
+ export * as makeMap from "./makeMap";
25
+ export * as makeSet from "./makeSet";
@@ -22,7 +22,9 @@ var styles$1 = require('./styles.js');
22
22
  var storeId$1 = require('./storeId.js');
23
23
  var blackFriday$1 = require('./blackFriday.js');
24
24
  var sales$1 = require('./sales.js');
25
- var map$1 = require('./map.js');
25
+ var KeyMap = require('./KeyMap.js');
26
+ var makeMap$1 = require('./makeMap.js');
27
+ var makeSet$1 = require('./makeSet.js');
26
28
  "use strict";
27
29
  exports.url = url$1;
28
30
  exports.money = index;
@@ -46,5 +48,7 @@ exports.styles = styles$1;
46
48
  exports.storeId = storeId$1;
47
49
  exports.blackFriday = blackFriday$1;
48
50
  exports.sales = sales$1;
49
- exports.map = map$1;
51
+ exports.keyMap = KeyMap;
52
+ exports.makeMap = makeMap$1;
53
+ exports.makeSet = makeSet$1;
50
54
  //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -42,7 +42,11 @@ import * as blackFriday$1 from './blackFriday.mjs';
42
42
  export { blackFriday$1 as blackFriday };
43
43
  import * as sales$1 from './sales.mjs';
44
44
  export { sales$1 as sales };
45
- import * as map$1 from './map.mjs';
46
- export { map$1 as map };
45
+ import * as KeyMap from './KeyMap.mjs';
46
+ export { KeyMap as keyMap };
47
+ import * as makeMap$1 from './makeMap.mjs';
48
+ export { makeMap$1 as makeMap };
49
+ import * as makeSet$1 from './makeSet.mjs';
50
+ export { makeSet$1 as makeSet };
47
51
  "use strict";
48
52
  //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Creates a Map from a plain object.
3
+ *
4
+ * @url https://www.builder.io/blog/maps
5
+ *
6
+ * @example
7
+ * ```
8
+ * const map = makeMap({a: 1, b: 2, c: 3})
9
+ * expect(map).toBe(new Map([["a", 1], ["b", 2], ["c", 3]]))
10
+ * ```
11
+ */
12
+ export declare const makeMap: <V = unknown>(obj: Record<string, V>) => Map<string, V>;
13
+ /**
14
+ * Converts an array of objects to a Map of arrays, using a specified key from each
15
+ * object as the Map key. Multiple objects with the same key value will be grouped together.
16
+ *
17
+ * @param array - The array of objects to convert
18
+ * @param keyField - The field name to use as the Map key (must be a key of T)
19
+ * @returns A Map where keys are the values of the specified field and values
20
+ * are arrays of the original objects that share that key
21
+ *
22
+ * @example
23
+ * ```
24
+ * const map = makeMapCollectionBy([{key: "a", val: 1}, {key: "a", val: 2}, {key: "c", val: 3}], "key")
25
+ * expect(map).toBe(new Map([["a", [{key: "a", val: 1}, {key: "a", val: 2}]], ["c", [{key: "c", val: 3}]]]))
26
+ * ```
27
+ */
28
+ export declare function makeMapCollectionBy<T, K extends keyof T>(array: T[], keyField: K): Map<T[K], T[]>;
29
+ /**
30
+ * Converts an array of objects to a Map, using a specified key from each
31
+ * object as the Map key.
32
+ *
33
+ * @param array - The array of objects to convert
34
+ * @param keyField - The field name to use as the Map key (must be a key of T)
35
+ * @returns A Map where keys are the values of the specified field and values
36
+ * are the original objects
37
+ *
38
+ * @example
39
+ * ```
40
+ * const map = makeMapBy([{key: "a", val: 1}, {key: "b", val: 2}, {key: "c", val: 3}], "key")
41
+ * expect(map).toBe(new Map([["a", {key: "a", val: 1}], ["b", {key: "b", val: 2}], ["c", {key: "c", val: 3}]]))
42
+ * ```
43
+ */
44
+ export declare function makeMapBy<T, K extends keyof T>(array: T[], keyField: K): Map<T[K], T>;
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+ "use strict";
3
+
4
+ const makeMap = obj => new Map(Object.entries(obj));
5
+ function makeMapCollectionBy(array, keyField) {
6
+ const map = /* @__PURE__ */new Map();
7
+ for (const item of array) {
8
+ const key = item[keyField];
9
+ const existing = map.get(key);
10
+ if (existing) {
11
+ existing.push(item);
12
+ } else {
13
+ map.set(key, [item]);
14
+ }
15
+ }
16
+ return map;
17
+ }
18
+ function makeMapBy(array, keyField) {
19
+ const map = /* @__PURE__ */new Map();
20
+ for (const item of array) {
21
+ map.set(item[keyField], item);
22
+ }
23
+ return map;
24
+ }
25
+ exports.makeMap = makeMap;
26
+ exports.makeMapBy = makeMapBy;
27
+ exports.makeMapCollectionBy = makeMapCollectionBy;
28
+ //# sourceMappingURL=makeMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeMap.js","sources":["../../src/utils/makeMap.ts"],"sourcesContent":["/**\n * Creates a Map from a plain object.\n *\n * @url https://www.builder.io/blog/maps\n *\n * @example\n * ```\n * const map = makeMap({a: 1, b: 2, c: 3})\n * expect(map).toBe(new Map([[\"a\", 1], [\"b\", 2], [\"c\", 3]]))\n * ```\n */\nexport const makeMap = <V = unknown>(obj: Record<string, V>) =>\n new Map<string, V>(Object.entries(obj));\n\n/**\n * Converts an array of objects to a Map of arrays, using a specified key from each\n * object as the Map key. Multiple objects with the same key value will be grouped together.\n *\n * @param array - The array of objects to convert\n * @param keyField - The field name to use as the Map key (must be a key of T)\n * @returns A Map where keys are the values of the specified field and values\n * are arrays of the original objects that share that key\n *\n * @example\n * ```\n * const map = makeMapCollectionBy([{key: \"a\", val: 1}, {key: \"a\", val: 2}, {key: \"c\", val: 3}], \"key\")\n * expect(map).toBe(new Map([[\"a\", [{key: \"a\", val: 1}, {key: \"a\", val: 2}]], [\"c\", [{key: \"c\", val: 3}]]]))\n * ```\n */\nexport function makeMapCollectionBy<T, K extends keyof T>(\n array: T[],\n keyField: K,\n): Map<T[K], T[]> {\n const map = new Map<T[K], T[]>();\n\n for (const item of array) {\n const key = item[keyField];\n const existing = map.get(key);\n\n if (existing) {\n existing.push(item);\n } else {\n map.set(key, [item]);\n }\n }\n\n return map;\n}\n\n/**\n * Converts an array of objects to a Map, using a specified key from each\n * object as the Map key.\n *\n * @param array - The array of objects to convert\n * @param keyField - The field name to use as the Map key (must be a key of T)\n * @returns A Map where keys are the values of the specified field and values\n * are the original objects\n *\n * @example\n * ```\n * const map = makeMapBy([{key: \"a\", val: 1}, {key: \"b\", val: 2}, {key: \"c\", val: 3}], \"key\")\n * expect(map).toBe(new Map([[\"a\", {key: \"a\", val: 1}], [\"b\", {key: \"b\", val: 2}], [\"c\", {key: \"c\", val: 3}]]))\n * ```\n */\nexport function makeMapBy<T, K extends keyof T>(\n array: T[],\n keyField: K,\n): Map<T[K], T> {\n const map = new Map<T[K], T>();\n\n for (const item of array) {\n map.set(item[keyField], item);\n }\n\n return map;\n}\n"],"names":["makeMap","obj","Map","Object","entries","makeMapCollectionBy","array","keyField","map","item","key","existing","get","push","set","makeMapBy"],"mappings":";;;AAWO,MAAMA,OAAA,GAAwBC,GAAA,IACnC,IAAIC,IAAeC,MAAA,CAAOC,OAAA,CAAQH,GAAG,CAAC,CAAA;AAiBjC,SAASI,mBAAAA,CACdC,OACAC,QAAA,EACgB;EAChB,MAAMC,GAAA,GAAA,mBAAUN,GAAA,CAAA,CAAe;EAE/B,KAAA,MAAWO,QAAQH,KAAA,EAAO;IACxB,MAAMI,GAAA,GAAMD,KAAKF,QAAQ,CAAA;IACzB,MAAMI,QAAA,GAAWH,GAAA,CAAII,GAAA,CAAIF,GAAG,CAAA;IAE5B,IAAIC,QAAA,EAAU;MACZA,QAAA,CAASE,KAAKJ,IAAI,CAAA;IACpB,CAAA,MAAO;MACLD,GAAA,CAAIM,GAAA,CAAIJ,GAAA,EAAK,CAACD,IAAI,CAAC,CAAA;IACrB;EACF;EAEA,OAAOD,GAAA;AACT;AAiBO,SAASO,SAAAA,CACdT,OACAC,QAAA,EACc;EACd,MAAMC,GAAA,GAAA,mBAAUN,GAAA,CAAA,CAAa;EAE7B,KAAA,MAAWO,QAAQH,KAAA,EAAO;IACxBE,GAAA,CAAIM,GAAA,CAAIL,IAAA,CAAKF,QAAQ,CAAA,EAAGE,IAAI,CAAA;EAC9B;EAEA,OAAOD,GAAA;AACT;;;"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ const makeMap = obj => new Map(Object.entries(obj));
4
+ function makeMapCollectionBy(array, keyField) {
5
+ const map = /* @__PURE__ */new Map();
6
+ for (const item of array) {
7
+ const key = item[keyField];
8
+ const existing = map.get(key);
9
+ if (existing) {
10
+ existing.push(item);
11
+ } else {
12
+ map.set(key, [item]);
13
+ }
14
+ }
15
+ return map;
16
+ }
17
+ function makeMapBy(array, keyField) {
18
+ const map = /* @__PURE__ */new Map();
19
+ for (const item of array) {
20
+ map.set(item[keyField], item);
21
+ }
22
+ return map;
23
+ }
24
+ export { makeMap, makeMapBy, makeMapCollectionBy };
25
+ //# sourceMappingURL=makeMap.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeMap.mjs","sources":["../../src/utils/makeMap.ts"],"sourcesContent":["/**\n * Creates a Map from a plain object.\n *\n * @url https://www.builder.io/blog/maps\n *\n * @example\n * ```\n * const map = makeMap({a: 1, b: 2, c: 3})\n * expect(map).toBe(new Map([[\"a\", 1], [\"b\", 2], [\"c\", 3]]))\n * ```\n */\nexport const makeMap = <V = unknown>(obj: Record<string, V>) =>\n new Map<string, V>(Object.entries(obj));\n\n/**\n * Converts an array of objects to a Map of arrays, using a specified key from each\n * object as the Map key. Multiple objects with the same key value will be grouped together.\n *\n * @param array - The array of objects to convert\n * @param keyField - The field name to use as the Map key (must be a key of T)\n * @returns A Map where keys are the values of the specified field and values\n * are arrays of the original objects that share that key\n *\n * @example\n * ```\n * const map = makeMapCollectionBy([{key: \"a\", val: 1}, {key: \"a\", val: 2}, {key: \"c\", val: 3}], \"key\")\n * expect(map).toBe(new Map([[\"a\", [{key: \"a\", val: 1}, {key: \"a\", val: 2}]], [\"c\", [{key: \"c\", val: 3}]]]))\n * ```\n */\nexport function makeMapCollectionBy<T, K extends keyof T>(\n array: T[],\n keyField: K,\n): Map<T[K], T[]> {\n const map = new Map<T[K], T[]>();\n\n for (const item of array) {\n const key = item[keyField];\n const existing = map.get(key);\n\n if (existing) {\n existing.push(item);\n } else {\n map.set(key, [item]);\n }\n }\n\n return map;\n}\n\n/**\n * Converts an array of objects to a Map, using a specified key from each\n * object as the Map key.\n *\n * @param array - The array of objects to convert\n * @param keyField - The field name to use as the Map key (must be a key of T)\n * @returns A Map where keys are the values of the specified field and values\n * are the original objects\n *\n * @example\n * ```\n * const map = makeMapBy([{key: \"a\", val: 1}, {key: \"b\", val: 2}, {key: \"c\", val: 3}], \"key\")\n * expect(map).toBe(new Map([[\"a\", {key: \"a\", val: 1}], [\"b\", {key: \"b\", val: 2}], [\"c\", {key: \"c\", val: 3}]]))\n * ```\n */\nexport function makeMapBy<T, K extends keyof T>(\n array: T[],\n keyField: K,\n): Map<T[K], T> {\n const map = new Map<T[K], T>();\n\n for (const item of array) {\n map.set(item[keyField], item);\n }\n\n return map;\n}\n"],"names":["makeMap","obj","Map","Object","entries","makeMapCollectionBy","array","keyField","map","item","key","existing","get","push","set","makeMapBy"],"mappings":";;AAWO,MAAMA,OAAA,GAAwBC,GAAA,IACnC,IAAIC,IAAeC,MAAA,CAAOC,OAAA,CAAQH,GAAG,CAAC,CAAA;AAiBjC,SAASI,mBAAAA,CACdC,OACAC,QAAA,EACgB;EAChB,MAAMC,GAAA,GAAA,mBAAUN,GAAA,CAAA,CAAe;EAE/B,KAAA,MAAWO,QAAQH,KAAA,EAAO;IACxB,MAAMI,GAAA,GAAMD,KAAKF,QAAQ,CAAA;IACzB,MAAMI,QAAA,GAAWH,GAAA,CAAII,GAAA,CAAIF,GAAG,CAAA;IAE5B,IAAIC,QAAA,EAAU;MACZA,QAAA,CAASE,KAAKJ,IAAI,CAAA;IACpB,CAAA,MAAO;MACLD,GAAA,CAAIM,GAAA,CAAIJ,GAAA,EAAK,CAACD,IAAI,CAAC,CAAA;IACrB;EACF;EAEA,OAAOD,GAAA;AACT;AAiBO,SAASO,SAAAA,CACdT,OACAC,QAAA,EACc;EACd,MAAMC,GAAA,GAAA,mBAAUN,GAAA,CAAA,CAAa;EAE7B,KAAA,MAAWO,QAAQH,KAAA,EAAO;IACxBE,GAAA,CAAIM,GAAA,CAAIL,IAAA,CAAKF,QAAQ,CAAA,EAAGE,IAAI,CAAA;EAC9B;EAEA,OAAOD,GAAA;AACT;"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Creates a Set containing unique values extracted from a specified field of objects in an array.
3
+ *
4
+ * @param array - The array of objects to extract values from
5
+ * @param keyField - The field name to extract values from (must be a key of T)
6
+ * @returns A Set containing unique values from the specified field
7
+ *
8
+ * @example
9
+ * ```
10
+ * const set = makeSetOf([{key: "a", val: 1}, {key: "b", val: 2}, {key: "a", val: 3}], "key")
11
+ * expect(set).toBe(new Set(["a", "b"]))
12
+ * ```
13
+ */
14
+ export declare const makeSetOf: <T, K extends keyof T>(array: T[], keyField: K) => Set<T[K]>;
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+ "use strict";
3
+
4
+ const makeSetOf = (array, keyField) => {
5
+ return new Set(array.map(item => item[keyField]));
6
+ };
7
+ exports.makeSetOf = makeSetOf;
8
+ //# sourceMappingURL=makeSet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeSet.js","sources":["../../src/utils/makeSet.ts"],"sourcesContent":["/**\n * Creates a Set containing unique values extracted from a specified field of objects in an array.\n *\n * @param array - The array of objects to extract values from\n * @param keyField - The field name to extract values from (must be a key of T)\n * @returns A Set containing unique values from the specified field\n *\n * @example\n * ```\n * const set = makeSetOf([{key: \"a\", val: 1}, {key: \"b\", val: 2}, {key: \"a\", val: 3}], \"key\")\n * expect(set).toBe(new Set([\"a\", \"b\"]))\n * ```\n */\nexport const makeSetOf = <T, K extends keyof T>(\n array: T[],\n keyField: K,\n): Set<T[K]> => {\n return new Set(array.map((item) => item[keyField]));\n};\n"],"names":["makeSetOf","array","keyField","Set","map","item"],"mappings":";;;AAaO,MAAMA,SAAA,GAAYA,CACvBC,KAAA,EACAC,QAAA,KACc;EACd,OAAO,IAAIC,IAAIF,KAAA,CAAMG,GAAA,CAAKC,IAAA,IAASA,IAAA,CAAKH,QAAQ,CAAC,CAAC,CAAA;AACpD,CAAA;"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ const makeSetOf = (array, keyField) => {
4
+ return new Set(array.map(item => item[keyField]));
5
+ };
6
+ export { makeSetOf };
7
+ //# sourceMappingURL=makeSet.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeSet.mjs","sources":["../../src/utils/makeSet.ts"],"sourcesContent":["/**\n * Creates a Set containing unique values extracted from a specified field of objects in an array.\n *\n * @param array - The array of objects to extract values from\n * @param keyField - The field name to extract values from (must be a key of T)\n * @returns A Set containing unique values from the specified field\n *\n * @example\n * ```\n * const set = makeSetOf([{key: \"a\", val: 1}, {key: \"b\", val: 2}, {key: \"a\", val: 3}], \"key\")\n * expect(set).toBe(new Set([\"a\", \"b\"]))\n * ```\n */\nexport const makeSetOf = <T, K extends keyof T>(\n array: T[],\n keyField: K,\n): Set<T[K]> => {\n return new Set(array.map((item) => item[keyField]));\n};\n"],"names":["makeSetOf","array","keyField","Set","map","item"],"mappings":";;AAaO,MAAMA,SAAA,GAAYA,CACvBC,KAAA,EACAC,QAAA,KACc;EACd,OAAO,IAAIC,IAAIF,KAAA,CAAMG,GAAA,CAAKC,IAAA,IAASA,IAAA,CAAKH,QAAQ,CAAC,CAAC,CAAA;AACpD,CAAA;"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,5 @@
1
1
  export * from "./allocators/fixedAmount";
2
2
  export * from "./allocators/productAmount";
3
- export * from "./allocators/totalAmount";
4
3
  export * from "./constants";
5
4
  export * from "./exchangeRate";
6
5
  export * from "./format";
@@ -2,7 +2,6 @@
2
2
 
3
3
  var fixedAmount = require('./allocators/fixedAmount.js');
4
4
  var productAmount = require('./allocators/productAmount.js');
5
- var totalAmount = require('./allocators/totalAmount.js');
6
5
  var constants = require('./constants.js');
7
6
  var exchangeRate = require('./exchangeRate.js');
8
7
  var format = require('./format.js');
@@ -13,7 +12,6 @@ require('./types.js');
13
12
  "use strict";
14
13
  exports.FixedAmountAllocator = fixedAmount.FixedAmountAllocator;
15
14
  exports.ProductAmountAllocator = productAmount.ProductAmountAllocator;
16
- exports.TotalAmountAllocator = totalAmount.TotalAmountAllocator;
17
15
  exports.EXCHANGE_RATE_DINERO_CURRENCY = constants.EXCHANGE_RATE_DINERO_CURRENCY;
18
16
  exports.Round = constants.Round;
19
17
  exports.TAX_RATE_DINERO_CURRENCY = constants.TAX_RATE_DINERO_CURRENCY;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,5 @@
1
1
  export { FixedAmountAllocator } from './allocators/fixedAmount.mjs';
2
2
  export { ProductAmountAllocator } from './allocators/productAmount.mjs';
3
- export { TotalAmountAllocator } from './allocators/totalAmount.mjs';
4
3
  export { EXCHANGE_RATE_DINERO_CURRENCY, Round, TAX_RATE_DINERO_CURRENCY, localizedCurrencyLookup, prettifyPriceLookup, roundToNearestDecimalCent, roundToNearestFull059, roundToNearestHalfUnitCent, roundToNearestValidUiCarePrice, smallestSubunitLookup, storesWithPerItemTaxRate } from './constants.mjs';
5
4
  export { invertExchangeRate, toFixedExchangeRate, toSnapshotExchangeRate } from './exchangeRate.mjs';
6
5
  export { formatPrice, formatPriceRaw, getLocalizedCurrency, prettifyTotal } from './format.mjs';
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -3,15 +3,12 @@ import type { Dino, LineItemSummary, TaxRate } from "./types";
3
3
  /**
4
4
  * Function to calculate the tax amount for a given line item depending on the store's tax rate calculation strategy
5
5
  */
6
- export declare const calculateLineItemTax: ({ itemSummary, taxRate, options, }: {
6
+ export declare const calculateLineItemTax: ({ itemSummary, taxRate, storeId, }: {
7
7
  itemSummary: LineItemSummary;
8
8
  taxRate: TaxRate;
9
- options: {
10
- storeId: StoreId;
11
- hasTaxIncludedPrice: boolean;
12
- };
9
+ storeId: StoreId;
13
10
  }) => Dino;
14
- export declare const removeTaxAmount: (amountWithTax: Dino, taxRate: TaxRate) => Dino;
11
+ export declare const removeTaxAmount: (baseAmountWithTaxObj: Dino, taxRate: TaxRate) => import("dinero.js").Dinero<number>;
15
12
  /**
16
13
  * Will return a percentage tax rate from a decimal tax rate (usually returned by DB)
17
14
  *
@@ -9,11 +9,18 @@ var tax_private = require('./tax.private.js');
9
9
  const calculateLineItemTax = ({
10
10
  itemSummary,
11
11
  taxRate,
12
- options
12
+ storeId
13
13
  }) => {
14
- return constants.storesWithPerItemTaxRate.has(options.storeId) ? tax_private.calculatePerQtyLineItemTax(itemSummary, taxRate, options) : tax_private.calculateWholeQtyLineItemTax(itemSummary, taxRate, options);
14
+ return constants.storesWithPerItemTaxRate.has(storeId) ? tax_private.calculatePerQtyLineItemTax(itemSummary, taxRate) : tax_private.calculateWholeQtyLineItemTax(itemSummary, taxRate);
15
+ };
16
+ const removeTaxAmount = (baseAmountWithTaxObj, taxRate) => {
17
+ const snapshot = dinero_js.toSnapshot(baseAmountWithTaxObj);
18
+ const taxAmount = constants.Round.Financial(snapshot.amount - snapshot.amount / (1 + taxRate));
19
+ return dinero_js.dinero({
20
+ ...snapshot,
21
+ amount: snapshot.amount - taxAmount
22
+ });
15
23
  };
16
- const removeTaxAmount = (amountWithTax, taxRate) => dinero_js.subtract(amountWithTax, tax_private.getTaxFromFinalAmount(amountWithTax, taxRate));
17
24
  const convertDecimalTaxRateToPercentage = taxRate => {
18
25
  const dineroObj = decimalTaxRateToDinero(taxRate);
19
26
  const t = dinero_js.multiply(dineroObj, 100);
@@ -1 +1 @@
1
- {"version":3,"file":"tax.js","sources":["../../../src/utils/money/tax.ts"],"sourcesContent":["import {\n dinero,\n // FIXME: move usage to rounding\n halfEven,\n multiply,\n subtract,\n toUnit,\n} from \"dinero.js\";\n\nimport type { StoreId } from \"../../types\";\nimport { assert } from \"../errors\";\nimport { isFloat, toFixedRate } from \"../number\";\nimport {\n storesWithPerItemTaxRate,\n TAX_RATE_DINERO_CURRENCY,\n} from \"./constants\";\nimport {\n calculatePerQtyLineItemTax,\n calculateWholeQtyLineItemTax,\n getTaxFromFinalAmount,\n} from \"./tax.private\";\nimport type { Dino, LineItemSummary, TaxRate } from \"./types\";\n\n/**\n * Function to calculate the tax amount for a given line item depending on the store's tax rate calculation strategy\n */\nexport const calculateLineItemTax = ({\n itemSummary,\n taxRate,\n options,\n}: {\n itemSummary: LineItemSummary;\n taxRate: TaxRate;\n options: { storeId: StoreId; hasTaxIncludedPrice: boolean };\n}): Dino => {\n return storesWithPerItemTaxRate.has(options.storeId)\n ? calculatePerQtyLineItemTax(itemSummary, taxRate, options)\n : calculateWholeQtyLineItemTax(itemSummary, taxRate, options);\n};\n\nexport const removeTaxAmount = (amountWithTax: Dino, taxRate: TaxRate): Dino =>\n subtract(amountWithTax, getTaxFromFinalAmount(amountWithTax, taxRate));\n\n/**\n * Will return a percentage tax rate from a decimal tax rate (usually returned by DB)\n *\n * Use for math-related calculations ONLY! Use `formatDecimalTaxRate` for display purposes e.g. invoices.\n *\n * @example convertDecimalTaxRateToPercentage(\"0.01\") // 1\n * @example convertDecimalTaxRateToPercentage(\"0.1023\") // 10.23\n * @example convertDecimalTaxRateToPercentage(\"0.12345678\") // 12.345678\n */\nexport const convertDecimalTaxRateToPercentage = (\n taxRate: string | number,\n): number => {\n const dineroObj = decimalTaxRateToDinero(taxRate);\n const t = multiply(dineroObj, 100);\n return toUnit(t, {\n digits: TAX_RATE_DINERO_CURRENCY.exponent,\n round: halfEven,\n });\n};\n\nexport const decimalTaxRateToDinero = (taxRate: string | number): Dino => {\n const parsedNumber =\n typeof taxRate === \"number\" ? taxRate : Number.parseFloat(taxRate);\n isFloat(parsedNumber);\n\n const parsedNumberInt = Number.parseInt(\n (\n parsedNumber *\n Math.pow(TAX_RATE_DINERO_CURRENCY.base, TAX_RATE_DINERO_CURRENCY.exponent)\n ).toFixed(0),\n );\n return dinero({\n amount: parsedNumberInt,\n currency: TAX_RATE_DINERO_CURRENCY,\n });\n};\n\n/**\n * Will return a percentage string from a decimal tax rate (usually returned by DB).\n *\n * Use for display purposes e.g. invoices.\n *\n * @example formatDecimalTaxRate(\"0.01\") // \"1%\"\n * @example formatDecimalTaxRate(\"0.1023\") // \"10.23%\"\n * @example formatDecimalTaxRate(\"0.12345678\") // \"12.345678%\"\n */\nexport const formatDecimalTaxRate = <TaxRateFloat extends string | number>(\n taxRate: TaxRateFloat,\n): `${number}%` => {\n return `${convertDecimalTaxRateToPercentage(taxRate)}%`;\n};\n\nexport const stringTaxRateToFloat = (rate: string): number =>\n toFixedRate(+rate, TAX_RATE_DINERO_CURRENCY.exponent, true);\n\n/**\n * Calculate total Tax(LV: \"PVN\") for country, which consists of multiple tax entries\n * Returning fixed to ${TAX_RATE_DINERO_CURRENCY.exponent} 4 decimal places, to for example 0.2100 represent 21.00%\n */\nexport const calculateTotalTaxRate = (rates: number[]): number => {\n const rateSum = rates.reduce((sum, rate) => sum + rate, 0);\n const result = toFixedRate(rateSum, TAX_RATE_DINERO_CURRENCY.exponent, true);\n assert(result >= 0, \"Tax rate must be positive\");\n assert(result < 1, \"Tax rate must be less than 1\");\n return result;\n};\n"],"names":["calculateLineItemTax","itemSummary","taxRate","options","storesWithPerItemTaxRate","has","storeId","calculatePerQtyLineItemTax","calculateWholeQtyLineItemTax","removeTaxAmount","amountWithTax","subtract","getTaxFromFinalAmount","convertDecimalTaxRateToPercentage","dineroObj","decimalTaxRateToDinero","t","multiply","toUnit","digits","TAX_RATE_DINERO_CURRENCY","exponent","round","halfEven","parsedNumber","Number","parseFloat","isFloat","parsedNumberInt","parseInt","Math","pow","base","toFixed","dinero","amount","currency","formatDecimalTaxRate","stringTaxRateToFloat","rate","toFixedRate","calculateTotalTaxRate","rates","rateSum","reduce","sum","result","assert"],"mappings":";;;;;;;;AA0BO,MAAMA,uBAAuBA,CAAC;EACnCC,WAAA;EACAC,OAAA;EACAC;AACF,CAAA,KAIY;EACV,OAAOC,SAAAA,CAAAA,wBAAA,CAAyBC,GAAA,CAAIF,OAAA,CAAQG,OAAO,CAAA,GAC/CC,WAAAA,CAAAA,0BAAA,CAA2BN,WAAA,EAAaC,OAAA,EAASC,OAAO,CAAA,GACxDK,WAAAA,CAAAA,4BAAA,CAA6BP,WAAA,EAAaC,SAASC,OAAO,CAAA;AAChE,CAAA;AAEO,MAAMM,eAAA,GAAkBA,CAACC,aAAA,EAAqBR,OAAA,KACnDS,SAAAA,CAAAA,SAASD,aAAA,EAAeE,WAAAA,CAAAA,qBAAA,CAAsBF,aAAA,EAAeR,OAAO,CAAC,CAAA;AAWhE,MAAMW,iCAAA,GACXX,OAAA,IACW;EACX,MAAMY,SAAA,GAAYC,uBAAuBb,OAAO,CAAA;EAChD,MAAMc,CAAA,GAAIC,SAAAA,CAAAA,QAAA,CAASH,SAAA,EAAW,GAAG,CAAA;EACjC,OAAOI,SAAAA,CAAAA,OAAOF,CAAA,EAAG;IACfG,QAAQC,SAAAA,CAAAA,wBAAA,CAAyBC,QAAA;IACjCC,KAAA,EAAOC,SAAAA,CAAAA;EAAA,CACR,CAAA;AACH,CAAA;AAEO,MAAMR,sBAAA,GAA0Bb,OAAA,IAAmC;EACxE,MAAMsB,eACJ,OAAOtB,OAAA,KAAY,WAAWA,OAAA,GAAUuB,MAAA,CAAOC,WAAWxB,OAAO,CAAA;EACnEyB,MAAAA,CAAAA,OAAA,CAAQH,YAAY,CAAA;EAEpB,MAAMI,kBAAkBH,MAAA,CAAOI,QAAA,CAAA,CAE3BL,YAAA,GACAM,KAAKC,GAAA,CAAIX,SAAAA,CAAAA,wBAAA,CAAyBY,MAAMZ,kCAAA,CAAyBC,QAAQ,CAAA,EACzEY,OAAA,CAAQ,CAAC,CAAA,CACb;EACA,OAAOC,gBAAA,CAAO;IACZC,MAAA,EAAQP,eAAA;IACRQ,QAAA,EAAUhB,SAAAA,CAAAA;EAAA,CACX,CAAA;AACH,CAAA;AAWO,MAAMiB,oBAAA,GACXnC,OAAA,IACiB;EACjB,OAAO,GAAGW,iCAAA,CAAkCX,OAAO,CAAC,GAAA;AACtD,CAAA;AAEO,MAAMoC,oBAAA,GAAwBC,IAAA,IACnCC,MAAAA,CAAAA,WAAA,CAAY,CAACD,IAAA,EAAMnB,SAAAA,CAAAA,wBAAA,CAAyBC,UAAU,IAAI,CAAA;AAMrD,MAAMoB,qBAAA,GAAyBC,KAAA,IAA4B;EAChE,MAAMC,OAAA,GAAUD,MAAME,MAAA,CAAO,CAACC,KAAKN,IAAA,KAASM,GAAA,GAAMN,MAAM,CAAC,CAAA;EACzD,MAAMO,MAAA,GAASN,MAAAA,CAAAA,WAAA,CAAYG,OAAA,EAASvB,SAAAA,CAAAA,wBAAA,CAAyBC,UAAU,IAAI,CAAA;EAC3E0B,aAAA,CAAOD,MAAA,IAAU,GAAG,2BAA2B,CAAA;EAC/CC,aAAA,CAAOD,MAAA,GAAS,GAAG,8BAA8B,CAAA;EACjD,OAAOA,MAAA;AACT,CAAA;;;;;;;"}
1
+ {"version":3,"file":"tax.js","sources":["../../../src/utils/money/tax.ts"],"sourcesContent":["import {\n dinero,\n // FIXME: move usage to rounding\n halfEven,\n multiply,\n toSnapshot,\n toUnit,\n} from \"dinero.js\";\n\nimport type { StoreId } from \"../../types\";\nimport { assert } from \"../errors\";\nimport { isFloat, toFixedRate } from \"../number\";\nimport {\n Round,\n storesWithPerItemTaxRate,\n TAX_RATE_DINERO_CURRENCY,\n} from \"./constants\";\nimport {\n calculatePerQtyLineItemTax,\n calculateWholeQtyLineItemTax,\n} from \"./tax.private\";\nimport type { Dino, LineItemSummary, TaxRate } from \"./types\";\n\n/**\n * Function to calculate the tax amount for a given line item depending on the store's tax rate calculation strategy\n */\nexport const calculateLineItemTax = ({\n itemSummary,\n taxRate,\n storeId,\n}: {\n itemSummary: LineItemSummary;\n taxRate: TaxRate;\n storeId: StoreId;\n}) => {\n return storesWithPerItemTaxRate.has(storeId)\n ? calculatePerQtyLineItemTax(itemSummary, taxRate)\n : calculateWholeQtyLineItemTax(itemSummary, taxRate);\n};\n\nexport const removeTaxAmount = (\n baseAmountWithTaxObj: Dino,\n taxRate: TaxRate,\n) => {\n const snapshot = toSnapshot(baseAmountWithTaxObj);\n\n // Calculate the tax amount and apply rounding on it so that behavior for reverse process is consistent\n const taxAmount = Round.Financial(\n snapshot.amount - snapshot.amount / (1 + taxRate),\n );\n\n return dinero({\n ...snapshot,\n amount: snapshot.amount - taxAmount,\n });\n};\n\n/**\n * Will return a percentage tax rate from a decimal tax rate (usually returned by DB)\n *\n * Use for math-related calculations ONLY! Use `formatDecimalTaxRate` for display purposes e.g. invoices.\n *\n * @example convertDecimalTaxRateToPercentage(\"0.01\") // 1\n * @example convertDecimalTaxRateToPercentage(\"0.1023\") // 10.23\n * @example convertDecimalTaxRateToPercentage(\"0.12345678\") // 12.345678\n */\nexport const convertDecimalTaxRateToPercentage = (\n taxRate: string | number,\n): number => {\n const dineroObj = decimalTaxRateToDinero(taxRate);\n const t = multiply(dineroObj, 100);\n return toUnit(t, {\n digits: TAX_RATE_DINERO_CURRENCY.exponent,\n round: halfEven,\n });\n};\n\nexport const decimalTaxRateToDinero = (taxRate: string | number): Dino => {\n const parsedNumber =\n typeof taxRate === \"number\" ? taxRate : Number.parseFloat(taxRate);\n isFloat(parsedNumber);\n\n const parsedNumberInt = Number.parseInt(\n (\n parsedNumber *\n Math.pow(TAX_RATE_DINERO_CURRENCY.base, TAX_RATE_DINERO_CURRENCY.exponent)\n ).toFixed(0),\n );\n return dinero({\n amount: parsedNumberInt,\n currency: TAX_RATE_DINERO_CURRENCY,\n });\n};\n\n/**\n * Will return a percentage string from a decimal tax rate (usually returned by DB).\n *\n * Use for display purposes e.g. invoices.\n *\n * @example formatDecimalTaxRate(\"0.01\") // \"1%\"\n * @example formatDecimalTaxRate(\"0.1023\") // \"10.23%\"\n * @example formatDecimalTaxRate(\"0.12345678\") // \"12.345678%\"\n */\nexport const formatDecimalTaxRate = <TaxRateFloat extends string | number>(\n taxRate: TaxRateFloat,\n): `${number}%` => {\n return `${convertDecimalTaxRateToPercentage(taxRate)}%`;\n};\n\nexport const stringTaxRateToFloat = (rate: string): number =>\n toFixedRate(+rate, TAX_RATE_DINERO_CURRENCY.exponent, true);\n\n/**\n * Calculate total Tax(LV: \"PVN\") for country, which consists of multiple tax entries\n * Returning fixed to ${TAX_RATE_DINERO_CURRENCY.exponent} 4 decimal places, to for example 0.2100 represent 21.00%\n */\nexport const calculateTotalTaxRate = (rates: number[]): number => {\n const rateSum = rates.reduce((sum, rate) => sum + rate, 0);\n const result = toFixedRate(rateSum, TAX_RATE_DINERO_CURRENCY.exponent, true);\n assert(result >= 0, \"Tax rate must be positive\");\n assert(result < 1, \"Tax rate must be less than 1\");\n return result;\n};\n"],"names":["calculateLineItemTax","itemSummary","taxRate","storeId","storesWithPerItemTaxRate","has","calculatePerQtyLineItemTax","calculateWholeQtyLineItemTax","removeTaxAmount","baseAmountWithTaxObj","snapshot","toSnapshot","taxAmount","Round","Financial","amount","dinero","convertDecimalTaxRateToPercentage","dineroObj","decimalTaxRateToDinero","t","multiply","toUnit","digits","TAX_RATE_DINERO_CURRENCY","exponent","round","halfEven","parsedNumber","Number","parseFloat","isFloat","parsedNumberInt","parseInt","Math","pow","base","toFixed","currency","formatDecimalTaxRate","stringTaxRateToFloat","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