@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.
- package/CHANGELOG.md +7 -0
- package/lib/_virtual/_virtual_multi-entry.js +6 -2
- package/lib/_virtual/_virtual_multi-entry.js.map +1 -1
- package/lib/_virtual/_virtual_multi-entry.mjs +6 -2
- package/lib/_virtual/_virtual_multi-entry.mjs.map +1 -1
- package/lib/assets/ai-360.jpg +0 -0
- package/lib/assets/ai-3602.jpg +0 -0
- package/lib/assets/ai-dslr.jpg +0 -0
- package/lib/assets/ai-dslr2.jpg +0 -0
- package/lib/assets/attention.svg +1 -1
- package/lib/assets/attention2.svg +1 -1
- package/lib/assets/compact.svg +1 -1
- package/lib/assets/compact2.svg +1 -1
- package/lib/assets/compact3.svg +1 -0
- package/lib/assets/door-hub-mini.jpg +0 -0
- package/lib/assets/door-hub-mini2.jpg +0 -0
- package/lib/assets/floodlight.svg +1 -1
- package/lib/assets/floodlight2.svg +1 -1
- package/lib/assets/g2-reader.jpg +0 -0
- package/lib/assets/g2-reader2.jpg +0 -0
- package/lib/assets/g3-reader.jpg +0 -0
- package/lib/assets/g3-reader2.jpg +0 -0
- package/lib/assets/g3-starter-kit-pro.jpg +0 -0
- package/lib/assets/g3-starter-kit-pro2.jpg +0 -0
- package/lib/assets/g3-starter-kit.jpg +0 -0
- package/lib/assets/g3-starter-kit2.jpg +0 -0
- package/lib/assets/g4-ptz.jpg +0 -0
- package/lib/assets/g4-ptz2.jpg +0 -0
- package/lib/assets/g5-dome.jpg +0 -0
- package/lib/assets/g5-dome2.jpg +0 -0
- package/lib/assets/g5-ptz.jpg +0 -0
- package/lib/assets/g5-ptz2.jpg +0 -0
- package/lib/assets/globe.svg +1 -1
- package/lib/assets/globe2.svg +1 -1
- package/lib/assets/interior-design.svg +1 -1
- package/lib/assets/interior-design2.svg +1 -1
- package/lib/assets/power.svg +1 -1
- package/lib/assets/power2.svg +1 -1
- package/lib/assets/rack.svg +1 -1
- package/lib/assets/rack2.svg +1 -1
- package/lib/components/Header/Header.js +1 -1
- package/lib/components/Header/Header.mjs +1 -1
- package/lib/components/Header/ProHeader/ProHeader.js +1 -1
- package/lib/components/Header/ProHeader/ProHeader.mjs +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.js +1 -1
- package/lib/components/MicrositeHeader/components/HeaderContent/HeaderContent.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.mjs +2 -2
- package/lib/constants/icons/header/globe.svg.js +1 -1
- package/lib/constants/icons/header/globe.svg.mjs +2 -2
- package/lib/constants/icons/header/index.js +1 -1
- package/lib/constants/icons/header/index.mjs +1 -1
- package/lib/constants/icons/menu/floodlight.svg.js +5 -5
- package/lib/constants/icons/menu/floodlight.svg.mjs +2 -2
- package/lib/constants/icons/menu/index.js +9 -9
- package/lib/constants/icons/menu/index.mjs +3 -3
- package/lib/constants/icons/menu/power.svg.js +5 -5
- package/lib/constants/icons/menu/power.svg.mjs +2 -2
- package/lib/constants/icons/menu/rack.svg.js +5 -5
- package/lib/constants/icons/menu/rack.svg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/Bullet/ai-dslr.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/Bullet/ai-dslr.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DomeTurret/ai-360.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DomeTurret/ai-360.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DomeTurret/g5-dome.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DomeTurret/g5-dome.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DoorAccess/door-hub-mini.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DoorAccess/door-hub-mini.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DoorAccess/g2-reader.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DoorAccess/g2-reader.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DoorAccess/g3-reader.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DoorAccess/g3-reader.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DoorAccess/g3-starter-kit-pro.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DoorAccess/g3-starter-kit-pro.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DoorAccess/g3-starter-kit.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DoorAccess/g3-starter-kit.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/PTZ/g4-ptz.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/PTZ/g4-ptz.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/PTZ/g5-ptz.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/PTZ/g5-ptz.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/compact.svg.js +1 -1
- package/lib/constants/modelCompareData/assets/compact.svg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/floodlight.svg.js +1 -1
- package/lib/constants/modelCompareData/assets/floodlight.svg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/globe.svg.js +1 -1
- package/lib/constants/modelCompareData/assets/globe.svg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/interior-design.svg.js +1 -1
- package/lib/constants/modelCompareData/assets/interior-design.svg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/power.svg.js +1 -1
- package/lib/constants/modelCompareData/assets/power.svg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/bullet/ai-dslr.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/bullet/ai-dslr.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/ai-360.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/ai-360.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/g5-dome.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/g5-dome.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/door-hub-mini.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/door-hub-mini.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g2-reader.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g2-reader.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-reader.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-reader.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-starter-kit-pro.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-starter-kit-pro.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-starter-kit.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-starter-kit.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/ptz/g4-ptz.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/ptz/g4-ptz.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/ptz/g5-ptz.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/ptz/g5-ptz.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/compact.svg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/compact.svg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/compact2.svg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/compact2.svg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/interior-design.svg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/interior-design.svg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/rack.svg.js +1 -1
- package/lib/constants/modelCompareData/assets/rack.svg.mjs +2 -2
- package/lib/constants/modelCompareData/data/product-groups/cameraSecurity/Compact.js +1 -1
- package/lib/constants/modelCompareData/data/product-groups/cameraSecurity/Compact.mjs +1 -1
- package/lib/constants/modelCompareData/data/product-groups/cameraSecurity/InteriorDesign.js +1 -1
- package/lib/constants/modelCompareData/data/product-groups/cameraSecurity/InteriorDesign.mjs +1 -1
- package/lib/constants/modelCompareData/data/product-list-groups/compact.js +1 -1
- package/lib/constants/modelCompareData/data/product-list-groups/compact.mjs +1 -1
- package/lib/constants/modelCompareData/data/product-list-groups/interiorDesign.js +1 -1
- package/lib/constants/modelCompareData/data/product-list-groups/interiorDesign.mjs +1 -1
- package/lib/constants/modelCompareData/data/product-list-groups/productListSwitchingCompact.js +1 -1
- package/lib/constants/modelCompareData/data/product-list-groups/productListSwitchingCompact.mjs +1 -1
- package/lib/constants/modelCompareData/data/products/ai360.js +2 -2
- package/lib/constants/modelCompareData/data/products/ai360.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/aiDslr.js +2 -2
- package/lib/constants/modelCompareData/data/products/aiDslr.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/doorHubMini.js +2 -2
- package/lib/constants/modelCompareData/data/products/doorHubMini.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g2Reader.js +2 -2
- package/lib/constants/modelCompareData/data/products/g2Reader.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g3Reader.js +2 -2
- package/lib/constants/modelCompareData/data/products/g3Reader.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g3StarterKit.js +2 -2
- package/lib/constants/modelCompareData/data/products/g3StarterKit.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g3StarterKitPro.js +2 -2
- package/lib/constants/modelCompareData/data/products/g3StarterKitPro.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g4Ptz.js +2 -2
- package/lib/constants/modelCompareData/data/products/g4Ptz.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g5Dome.js +2 -2
- package/lib/constants/modelCompareData/data/products/g5Dome.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g5Ptz.js +2 -2
- package/lib/constants/modelCompareData/data/products/g5Ptz.mjs +2 -2
- package/lib/constants/modelCompareData/data/properties/accessPowerMethod.js +1 -1
- package/lib/constants/modelCompareData/data/properties/accessPowerMethod.mjs +1 -1
- package/lib/constants/modelCompareData/data/properties/availability.js +1 -1
- package/lib/constants/modelCompareData/data/properties/availability.mjs +1 -1
- package/lib/constants/modelCompareData/data/properties/builtInFloodlight.js +1 -1
- package/lib/constants/modelCompareData/data/properties/builtInFloodlight.mjs +1 -1
- package/lib/constants/modelCompareData/data/properties/dcPowerOutput.js +1 -1
- package/lib/constants/modelCompareData/data/properties/dcPowerOutput.mjs +1 -1
- package/lib/constants/modelCompareData/data/properties/mounting.js +1 -1
- package/lib/constants/modelCompareData/data/properties/mounting.mjs +1 -1
- package/lib/constants/modelCompareData/data/properties/unasPowerMethod.js +1 -1
- package/lib/constants/modelCompareData/data/properties/unasPowerMethod.mjs +1 -1
- package/lib/constants/modelCompareData/data/properties/webMode.js +1 -1
- package/lib/constants/modelCompareData/data/properties/webMode.mjs +1 -1
- package/lib/contexts/MenuContext/mapping.js +3 -3
- package/lib/contexts/MenuContext/mapping.mjs +2 -2
- package/lib/contexts/MicrositeMenuContext/mapping.js +3 -3
- package/lib/contexts/MicrositeMenuContext/mapping.mjs +2 -2
- package/lib/utils/{map.js → KeyMap.js} +1 -1
- package/lib/utils/KeyMap.js.map +1 -0
- package/lib/utils/{map.mjs → KeyMap.mjs} +1 -1
- package/lib/utils/KeyMap.mjs.map +1 -0
- package/lib/utils/index.d.ts +3 -1
- package/lib/utils/index.js +6 -2
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/index.mjs +6 -2
- package/lib/utils/index.mjs.map +1 -1
- package/lib/utils/makeMap.d.ts +44 -0
- package/lib/utils/makeMap.js +28 -0
- package/lib/utils/makeMap.js.map +1 -0
- package/lib/utils/makeMap.mjs +25 -0
- package/lib/utils/makeMap.mjs.map +1 -0
- package/lib/utils/makeSet.d.ts +14 -0
- package/lib/utils/makeSet.js +8 -0
- package/lib/utils/makeSet.js.map +1 -0
- package/lib/utils/makeSet.mjs +7 -0
- package/lib/utils/makeSet.mjs.map +1 -0
- package/lib/utils/makeSet.test.d.ts +1 -0
- package/lib/utils/money/index.d.ts +0 -1
- package/lib/utils/money/index.js +0 -2
- package/lib/utils/money/index.js.map +1 -1
- package/lib/utils/money/index.mjs +0 -1
- package/lib/utils/money/index.mjs.map +1 -1
- package/lib/utils/money/tax.d.ts +3 -6
- package/lib/utils/money/tax.js +10 -3
- package/lib/utils/money/tax.js.map +1 -1
- package/lib/utils/money/tax.mjs +13 -6
- package/lib/utils/money/tax.mjs.map +1 -1
- package/lib/utils/money/tax.private.d.ts +2 -7
- package/lib/utils/money/tax.private.js +6 -21
- package/lib/utils/money/tax.private.js.map +1 -1
- package/lib/utils/money/tax.private.mjs +8 -22
- package/lib/utils/money/tax.private.mjs.map +1 -1
- package/package.json +1 -1
- package/lib/assets/compact22.svg +0 -1
- package/lib/utils/map.js.map +0 -1
- package/lib/utils/map.mjs.map +0 -1
- package/lib/utils/money/allocators/totalAmount.d.ts +0 -17
- package/lib/utils/money/allocators/totalAmount.js +0 -40
- package/lib/utils/money/allocators/totalAmount.js.map +0 -1
- package/lib/utils/money/allocators/totalAmount.mjs +0 -38
- package/lib/utils/money/allocators/totalAmount.mjs.map +0 -1
- /package/lib/utils/{map.d.ts → KeyMap.d.ts} +0 -0
- /package/lib/utils/{map.test.d.ts → KeyMap.test.d.ts} +0 -0
- /package/lib/utils/{money/allocators/totalAmount.test.d.ts → makeMap.test.d.ts} +0 -0
|
@@ -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
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
556
|
+
src: _externalAssets_CtJPud52__default,
|
|
557
557
|
width: 40,
|
|
558
558
|
height: 40
|
|
559
559
|
}
|
|
@@ -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,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,mBACIF,GAAA,CAAA,CAAI;EACd;EAAA;AAAA;AAAA;EAKAG,IAAIF,GAAA,EAA6B;IAC/B,IAAA,CAAK,CAAAR,aAAcQ,GAAG,CAAA;IACtB,OAAO,KAAK,CAAAV,GAAA,CAAKY,GAAA,CAAI,IAAA,CAAK,CAAAX,SAAA,CAAWS,GAAG,CAAC,CAAA;EAC3C;EAAA;AAAA;AAAA;EAKAG,GAAAA,CAAIH,KAAUC,KAAA,EAAoB;IAChC,IAAA,CAAK,CAAAT,aAAcQ,GAAG,CAAA;IACtB,IAAA,CAAK,CAAAV,IAAKa,GAAA,CAAI,IAAA,CAAK,CAAAZ,SAAA,CAAWS,GAAG,GAAGC,KAAK,CAAA;EAC3C;EAAA;AAAA;AAAA;EAKAG,IAAIJ,GAAA,EAAmB;IACrB,IAAA,CAAK,CAAAR,aAAcQ,GAAG,CAAA;IACtB,OAAO,KAAK,CAAAV,GA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C7B,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;"}
|
|
@@ -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,OA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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
|
|
23
|
+
export * as keyMap from "./KeyMap";
|
|
24
|
+
export * as makeMap from "./makeMap";
|
|
25
|
+
export * as makeSet from "./makeSet";
|
package/lib/utils/index.js
CHANGED
|
@@ -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
|
|
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.
|
|
51
|
+
exports.keyMap = KeyMap;
|
|
52
|
+
exports.makeMap = makeMap$1;
|
|
53
|
+
exports.makeSet = makeSet$1;
|
|
50
54
|
//# sourceMappingURL=index.js.map
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/utils/index.mjs
CHANGED
|
@@ -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
|
|
46
|
-
export {
|
|
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
|
package/lib/utils/index.mjs.map
CHANGED
|
@@ -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 @@
|
|
|
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 @@
|
|
|
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 {};
|
package/lib/utils/money/index.js
CHANGED
|
@@ -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":";;;;;;;;;"}
|
package/lib/utils/money/tax.d.ts
CHANGED
|
@@ -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,
|
|
6
|
+
export declare const calculateLineItemTax: ({ itemSummary, taxRate, storeId, }: {
|
|
7
7
|
itemSummary: LineItemSummary;
|
|
8
8
|
taxRate: TaxRate;
|
|
9
|
-
|
|
10
|
-
storeId: StoreId;
|
|
11
|
-
hasTaxIncludedPrice: boolean;
|
|
12
|
-
};
|
|
9
|
+
storeId: StoreId;
|
|
13
10
|
}) => Dino;
|
|
14
|
-
export declare const removeTaxAmount: (
|
|
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
|
*
|
package/lib/utils/money/tax.js
CHANGED
|
@@ -9,11 +9,18 @@ var tax_private = require('./tax.private.js');
|
|
|
9
9
|
const calculateLineItemTax = ({
|
|
10
10
|
itemSummary,
|
|
11
11
|
taxRate,
|
|
12
|
-
|
|
12
|
+
storeId
|
|
13
13
|
}) => {
|
|
14
|
-
return constants.storesWithPerItemTaxRate.has(
|
|
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
|
|
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","rate","toFixedRate","calculateTotalTaxRate","rates","rateSum","reduce","sum","result","assert"],"mappings":";;;;;;;;AA0BO,MAAMA,uBAAuBA,CAAC;EACnCC,WAAA;EACAC,OAAA;EACAC;AACF,CAAA,KAIM;EACJ,OAAOC,kCAAA,CAAyBC,GAAA,CAAIF,OAAO,CAAA,GACvCG,WAAAA,CAAAA,0BAAA,CAA2BL,aAAaC,OAAO,CAAA,GAC/CK,WAAAA,CAAAA,4BAAA,CAA6BN,WAAA,EAAaC,OAAO,CAAA;AACvD,CAAA;AAEO,MAAMM,eAAA,GAAkBA,CAC7BC,oBAAA,EACAP,OAAA,KACG;EACH,MAAMQ,QAAA,GAAWC,SAAAA,CAAAA,WAAWF,oBAAoB,CAAA;EAGhD,MAAMG,YAAYC,SAAAA,CAAAA,KAAA,CAAMC,SAAA,CACtBJ,QAAA,CAASK,MAAA,GAASL,QAAA,CAASK,MAAA,IAAU,CAAA,GAAIb,OAAA,CAAA,CAC3C;EAEA,OAAOc,gBAAA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