@ubnt/store.core 11.28.0 → 11.29.0-custom-tax.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 +13 -0
- package/lib/_virtual/_virtual_multi-entry.js +64 -64
- package/lib/_virtual/_virtual_multi-entry.mjs +64 -64
- package/lib/assets/ai-360.jpg +0 -0
- package/lib/assets/ai-3602.jpg +0 -0
- package/lib/assets/attention.svg +1 -1
- package/lib/assets/attention2.svg +1 -1
- package/lib/assets/door-hub-mini.jpg +0 -0
- package/lib/assets/door-hub-mini2.jpg +0 -0
- package/lib/assets/door-hub.jpg +0 -0
- package/lib/assets/door-hub2.jpg +0 -0
- package/lib/assets/g2-reader.jpg +0 -0
- package/lib/assets/g2-reader2.jpg +0 -0
- package/lib/assets/g3-reader-flex.jpg +0 -0
- package/lib/assets/g3-reader-flex2.jpg +0 -0
- package/lib/assets/g3-reader-pro.jpg +0 -0
- package/lib/assets/g3-reader-pro2.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/g5-dome-ultra.jpg +0 -0
- package/lib/assets/g5-dome-ultra2.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/interior-design.svg +1 -1
- package/lib/assets/interior-design2.svg +1 -1
- package/lib/assets/minus4.svg +1 -1
- package/lib/assets/minus5.svg +1 -1
- package/lib/assets/plus4.svg +1 -1
- package/lib/assets/plus5.svg +1 -1
- package/lib/assets/udr2.jpg +0 -0
- package/lib/assets/udr3.jpg +0 -0
- package/lib/assets/video-recorders.png +0 -0
- 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/InputSections/CounterSection.js +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputSections/CounterSection.mjs +2 -2
- 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/InputCard/assets/minus.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/minus.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/plus.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/plus.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/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.js +2 -2
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/minus.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/minus.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/plus.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/plus.svg.mjs +2 -2
- package/lib/components/index.d.ts +4 -4
- package/lib/components/index.js +64 -64
- package/lib/components/index.mjs +64 -64
- package/lib/constants/modelCompareData/assets/Consoles/bigCompare/udr.jpg.js +5 -5
- package/lib/constants/modelCompareData/assets/Consoles/bigCompare/udr.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/Consoles/udr.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/Consoles/udr.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-ultra.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DomeTurret/g5-dome-ultra.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/door-hub.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DoorAccess/door-hub.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-flex.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DoorAccess/g3-reader-flex.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/DoorAccess/g3-reader-pro.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/DoorAccess/g3-reader-pro.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/PTZ/g5-ptz.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/PTZ/g5-ptz.jpg.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/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-ultra.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/g5-dome-ultra.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/door-hub.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/door-hub.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-flex.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-reader-flex.jpg.mjs +2 -2
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-reader-pro.jpg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-reader-pro.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/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/interior-design.svg.js +1 -1
- package/lib/constants/modelCompareData/assets/product-list-assets/interior-design.svg.mjs +2 -2
- package/lib/constants/modelCompareData/data/DreamMachineConsolev4.js +3 -3
- package/lib/constants/modelCompareData/data/DreamMachineConsolev4.mjs +2 -2
- 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/interiorDesign.js +1 -1
- package/lib/constants/modelCompareData/data/product-list-groups/interiorDesign.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/doorHub.js +2 -2
- package/lib/constants/modelCompareData/data/products/doorHub.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/g3ReaderFlex.js +2 -2
- package/lib/constants/modelCompareData/data/products/g3ReaderFlex.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g3ReaderPro.js +2 -2
- package/lib/constants/modelCompareData/data/products/g3ReaderPro.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/g5Dome.js +2 -2
- package/lib/constants/modelCompareData/data/products/g5Dome.mjs +2 -2
- package/lib/constants/modelCompareData/data/products/g5DomeUltra.js +2 -2
- package/lib/constants/modelCompareData/data/products/g5DomeUltra.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/products/udr.js +1 -1
- package/lib/constants/modelCompareData/data/products/udr.mjs +1 -1
- package/lib/constants/proStoreCategories/mapping/index.js +1 -1
- package/lib/constants/proStoreCategories/mapping/index.js.map +1 -1
- package/lib/constants/proStoreCategories/mapping/index.mjs +1 -1
- package/lib/constants/proStoreCategories/mapping/index.mjs.map +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/ar.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/ar.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/ca.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/ca.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/cs.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/cs.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/da.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/da.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/de.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/de.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/el.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/el.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/en.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/en.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/es-ES.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/es-ES.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/es-MX.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/es-MX.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/fr.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/fr.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/it.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/it.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/ja.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/ja.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/ko.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/ko.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/nl.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/nl.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/no.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/no.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/pl.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/pl.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/pt-BR.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/pt-BR.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/pt-PT.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/pt-PT.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/ru.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/ru.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/sv.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/sv.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/tr.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/tr.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/zh-Hans.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/zh-Hans.json.mjs +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/zh-Hant-TW.json.js +1 -1
- package/lib/contexts/MicrositeMenuContext/translations/zh-Hant-TW.json.mjs +1 -1
- package/lib/utils/money/allocators/totalAmount.d.ts +17 -0
- package/lib/utils/money/allocators/totalAmount.js +40 -0
- package/lib/utils/money/allocators/totalAmount.js.map +1 -0
- package/lib/utils/money/allocators/totalAmount.mjs +38 -0
- package/lib/utils/money/allocators/totalAmount.mjs.map +1 -0
- package/lib/utils/money/allocators/totalAmount.test.d.ts +1 -0
- package/lib/utils/money/index.d.ts +1 -0
- package/lib/utils/money/index.js +2 -0
- package/lib/utils/money/index.js.map +1 -1
- package/lib/utils/money/index.mjs +1 -0
- package/lib/utils/money/index.mjs.map +1 -1
- package/lib/utils/money/tax.d.ts +6 -3
- package/lib/utils/money/tax.js +3 -10
- package/lib/utils/money/tax.js.map +1 -1
- package/lib/utils/money/tax.mjs +6 -13
- package/lib/utils/money/tax.mjs.map +1 -1
- package/lib/utils/money/tax.private.d.ts +7 -2
- package/lib/utils/money/tax.private.js +21 -6
- package/lib/utils/money/tax.private.js.map +1 -1
- package/lib/utils/money/tax.private.mjs +22 -8
- package/lib/utils/money/tax.private.mjs.map +1 -1
- package/package.json +1 -1
- package/lib/components/BackInStock/BackInStock.d.ts +0 -2
- package/lib/components/BackInStock/BackInStock.js +0 -52
- package/lib/components/BackInStock/BackInStock.js.map +0 -1
- package/lib/components/BackInStock/BackInStock.mjs +0 -50
- package/lib/components/BackInStock/BackInStock.mjs.map +0 -1
- package/lib/components/BackInStock/BackInStock.styles.d.ts +0 -13
- package/lib/components/BackInStock/BackInStock.styles.js +0 -53
- package/lib/components/BackInStock/BackInStock.styles.js.map +0 -1
- package/lib/components/BackInStock/BackInStock.styles.mjs +0 -46
- package/lib/components/BackInStock/BackInStock.styles.mjs.map +0 -1
- package/lib/components/BackInStock/BackInStock.types.d.ts +0 -27
- package/lib/components/BackInStock/index.d.ts +0 -1
- package/lib/components/BackInStock/index.js +0 -6
- package/lib/components/BackInStock/index.js.map +0 -1
- package/lib/components/BackInStock/index.mjs +0 -3
- package/lib/components/BackInStock/index.mjs.map +0 -1
|
@@ -121,7 +121,7 @@ var no = {
|
|
|
121
121
|
"menu.label.security.specialDevices.floodlight": "Flomlys",
|
|
122
122
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
123
123
|
"menu.label.security.videoRecorders": "NeXT generasjons NVR",
|
|
124
|
-
"menu.label.security.videoRecorders.description": "
|
|
124
|
+
"menu.label.security.videoRecorders.description": "Hver ramme.<br> Alltid sikker.",
|
|
125
125
|
"menu.label.siteManager": "Site Manager",
|
|
126
126
|
"menu.label.startHere": "Start her",
|
|
127
127
|
"menu.label.startHere.accessoryTech": "Tilbehørsteknologi",
|
|
@@ -116,7 +116,7 @@ var no = {
|
|
|
116
116
|
"menu.label.security.specialDevices.floodlight": "Flomlys",
|
|
117
117
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
118
118
|
"menu.label.security.videoRecorders": "NeXT generasjons NVR",
|
|
119
|
-
"menu.label.security.videoRecorders.description": "
|
|
119
|
+
"menu.label.security.videoRecorders.description": "Hver ramme.<br> Alltid sikker.",
|
|
120
120
|
"menu.label.siteManager": "Site Manager",
|
|
121
121
|
"menu.label.startHere": "Start her",
|
|
122
122
|
"menu.label.startHere.accessoryTech": "Tilbehørsteknologi",
|
|
@@ -121,7 +121,7 @@ var pl = {
|
|
|
121
121
|
"menu.label.security.specialDevices.floodlight": "Reflektor",
|
|
122
122
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
123
123
|
"menu.label.security.videoRecorders": "Rejestrator NVR nowej generacji",
|
|
124
|
-
"menu.label.security.videoRecorders.description": "
|
|
124
|
+
"menu.label.security.videoRecorders.description": "Każda klatka.<br> Zawsze bezpieczne.",
|
|
125
125
|
"menu.label.siteManager": "Kierownik Obiektu",
|
|
126
126
|
"menu.label.startHere": "Zacznij tutaj",
|
|
127
127
|
"menu.label.startHere.accessoryTech": "Technologia Akcesoriów",
|
|
@@ -116,7 +116,7 @@ var pl = {
|
|
|
116
116
|
"menu.label.security.specialDevices.floodlight": "Reflektor",
|
|
117
117
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
118
118
|
"menu.label.security.videoRecorders": "Rejestrator NVR nowej generacji",
|
|
119
|
-
"menu.label.security.videoRecorders.description": "
|
|
119
|
+
"menu.label.security.videoRecorders.description": "Każda klatka.<br> Zawsze bezpieczne.",
|
|
120
120
|
"menu.label.siteManager": "Kierownik Obiektu",
|
|
121
121
|
"menu.label.startHere": "Zacznij tutaj",
|
|
122
122
|
"menu.label.startHere.accessoryTech": "Technologia Akcesoriów",
|
|
@@ -121,7 +121,7 @@ var ptBR = {
|
|
|
121
121
|
"menu.label.security.specialDevices.floodlight": "Holofote",
|
|
122
122
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
123
123
|
"menu.label.security.videoRecorders": "NVR Futurista",
|
|
124
|
-
"menu.label.security.videoRecorders.description": "
|
|
124
|
+
"menu.label.security.videoRecorders.description": "Cada quadro.<br> Sempre seguro.",
|
|
125
125
|
"menu.label.siteManager": "Site Manager",
|
|
126
126
|
"menu.label.startHere": "Comece Aqui",
|
|
127
127
|
"menu.label.startHere.accessoryTech": "Acessórios",
|
|
@@ -116,7 +116,7 @@ var ptBR = {
|
|
|
116
116
|
"menu.label.security.specialDevices.floodlight": "Holofote",
|
|
117
117
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
118
118
|
"menu.label.security.videoRecorders": "NVR Futurista",
|
|
119
|
-
"menu.label.security.videoRecorders.description": "
|
|
119
|
+
"menu.label.security.videoRecorders.description": "Cada quadro.<br> Sempre seguro.",
|
|
120
120
|
"menu.label.siteManager": "Site Manager",
|
|
121
121
|
"menu.label.startHere": "Comece Aqui",
|
|
122
122
|
"menu.label.startHere.accessoryTech": "Acessórios",
|
|
@@ -121,7 +121,7 @@ var ptPT = {
|
|
|
121
121
|
"menu.label.security.specialDevices.floodlight": "Refletor",
|
|
122
122
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
123
123
|
"menu.label.security.videoRecorders": "NVR Futurista",
|
|
124
|
-
"menu.label.security.videoRecorders.description": "
|
|
124
|
+
"menu.label.security.videoRecorders.description": "Cada fotograma.<br> Sempre seguro.",
|
|
125
125
|
"menu.label.siteManager": "Site Manager",
|
|
126
126
|
"menu.label.startHere": "Comece Aqui",
|
|
127
127
|
"menu.label.startHere.accessoryTech": "Acessórios",
|
|
@@ -116,7 +116,7 @@ var ptPT = {
|
|
|
116
116
|
"menu.label.security.specialDevices.floodlight": "Refletor",
|
|
117
117
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
118
118
|
"menu.label.security.videoRecorders": "NVR Futurista",
|
|
119
|
-
"menu.label.security.videoRecorders.description": "
|
|
119
|
+
"menu.label.security.videoRecorders.description": "Cada fotograma.<br> Sempre seguro.",
|
|
120
120
|
"menu.label.siteManager": "Site Manager",
|
|
121
121
|
"menu.label.startHere": "Comece Aqui",
|
|
122
122
|
"menu.label.startHere.accessoryTech": "Acessórios",
|
|
@@ -121,7 +121,7 @@ var ru = {
|
|
|
121
121
|
"menu.label.security.specialDevices.floodlight": "Прожектор",
|
|
122
122
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
123
123
|
"menu.label.security.videoRecorders": "NeXT-Gen NVR",
|
|
124
|
-
"menu.label.security.videoRecorders.description": "
|
|
124
|
+
"menu.label.security.videoRecorders.description": "Каждый кадр.<br> Всегда надежно.",
|
|
125
125
|
"menu.label.siteManager": "Site Manager",
|
|
126
126
|
"menu.label.startHere": "Начать здесь",
|
|
127
127
|
"menu.label.startHere.accessoryTech": "Аксессуарная техника",
|
|
@@ -116,7 +116,7 @@ var ru = {
|
|
|
116
116
|
"menu.label.security.specialDevices.floodlight": "Прожектор",
|
|
117
117
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
118
118
|
"menu.label.security.videoRecorders": "NeXT-Gen NVR",
|
|
119
|
-
"menu.label.security.videoRecorders.description": "
|
|
119
|
+
"menu.label.security.videoRecorders.description": "Каждый кадр.<br> Всегда надежно.",
|
|
120
120
|
"menu.label.siteManager": "Site Manager",
|
|
121
121
|
"menu.label.startHere": "Начать здесь",
|
|
122
122
|
"menu.label.startHere.accessoryTech": "Аксессуарная техника",
|
|
@@ -121,7 +121,7 @@ var sv = {
|
|
|
121
121
|
"menu.label.security.specialDevices.floodlight": "Strålkastare",
|
|
122
122
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
123
123
|
"menu.label.security.videoRecorders": "NeXT generations NVR",
|
|
124
|
-
"menu.label.security.videoRecorders.description": "
|
|
124
|
+
"menu.label.security.videoRecorders.description": "Varje bildruta.<br> Alltid säker.",
|
|
125
125
|
"menu.label.siteManager": "Site Manager",
|
|
126
126
|
"menu.label.startHere": "Börja här",
|
|
127
127
|
"menu.label.startHere.accessoryTech": "Tillbehörsteknik",
|
|
@@ -116,7 +116,7 @@ var sv = {
|
|
|
116
116
|
"menu.label.security.specialDevices.floodlight": "Strålkastare",
|
|
117
117
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
118
118
|
"menu.label.security.videoRecorders": "NeXT generations NVR",
|
|
119
|
-
"menu.label.security.videoRecorders.description": "
|
|
119
|
+
"menu.label.security.videoRecorders.description": "Varje bildruta.<br> Alltid säker.",
|
|
120
120
|
"menu.label.siteManager": "Site Manager",
|
|
121
121
|
"menu.label.startHere": "Börja här",
|
|
122
122
|
"menu.label.startHere.accessoryTech": "Tillbehörsteknik",
|
|
@@ -121,7 +121,7 @@ var tr = {
|
|
|
121
121
|
"menu.label.security.specialDevices.floodlight": "Projektör",
|
|
122
122
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
123
123
|
"menu.label.security.videoRecorders": "Yeni Nesil NeXT NVR",
|
|
124
|
-
"menu.label.security.videoRecorders.description": "
|
|
124
|
+
"menu.label.security.videoRecorders.description": "Her kare. Her zaman güvenli.",
|
|
125
125
|
"menu.label.siteManager": "Site Manager",
|
|
126
126
|
"menu.label.startHere": "Başlangıç Noktası",
|
|
127
127
|
"menu.label.startHere.accessoryTech": "Aksesuar Teknolojisi",
|
|
@@ -116,7 +116,7 @@ var tr = {
|
|
|
116
116
|
"menu.label.security.specialDevices.floodlight": "Projektör",
|
|
117
117
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
118
118
|
"menu.label.security.videoRecorders": "Yeni Nesil NeXT NVR",
|
|
119
|
-
"menu.label.security.videoRecorders.description": "
|
|
119
|
+
"menu.label.security.videoRecorders.description": "Her kare. Her zaman güvenli.",
|
|
120
120
|
"menu.label.siteManager": "Site Manager",
|
|
121
121
|
"menu.label.startHere": "Başlangıç Noktası",
|
|
122
122
|
"menu.label.startHere.accessoryTech": "Aksesuar Teknolojisi",
|
|
@@ -121,7 +121,7 @@ var zhHans = {
|
|
|
121
121
|
"menu.label.security.specialDevices.floodlight": "泛光灯",
|
|
122
122
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
123
123
|
"menu.label.security.videoRecorders": "下一代 NVR",
|
|
124
|
-
"menu.label.security.videoRecorders.description": "
|
|
124
|
+
"menu.label.security.videoRecorders.description": "每一帧。始终安全。",
|
|
125
125
|
"menu.label.siteManager": "站点管理员",
|
|
126
126
|
"menu.label.startHere": "按此开始",
|
|
127
127
|
"menu.label.startHere.accessoryTech": "配件系列",
|
|
@@ -116,7 +116,7 @@ var zhHans = {
|
|
|
116
116
|
"menu.label.security.specialDevices.floodlight": "泛光灯",
|
|
117
117
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
118
118
|
"menu.label.security.videoRecorders": "下一代 NVR",
|
|
119
|
-
"menu.label.security.videoRecorders.description": "
|
|
119
|
+
"menu.label.security.videoRecorders.description": "每一帧。始终安全。",
|
|
120
120
|
"menu.label.siteManager": "站点管理员",
|
|
121
121
|
"menu.label.startHere": "按此开始",
|
|
122
122
|
"menu.label.startHere.accessoryTech": "配件系列",
|
|
@@ -121,7 +121,7 @@ var zhHantTW = {
|
|
|
121
121
|
"menu.label.security.specialDevices.floodlight": "泛光燈",
|
|
122
122
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
123
123
|
"menu.label.security.videoRecorders": "次世代NVR",
|
|
124
|
-
"menu.label.security.videoRecorders.description": "
|
|
124
|
+
"menu.label.security.videoRecorders.description": "每一幀。始終安全。",
|
|
125
125
|
"menu.label.siteManager": "站點管理員",
|
|
126
126
|
"menu.label.startHere": "從這裡開始",
|
|
127
127
|
"menu.label.startHere.accessoryTech": "配件科技",
|
|
@@ -116,7 +116,7 @@ var zhHantTW = {
|
|
|
116
116
|
"menu.label.security.specialDevices.floodlight": "泛光燈",
|
|
117
117
|
"menu.label.security.specialDevices.superLink": "SuperLink",
|
|
118
118
|
"menu.label.security.videoRecorders": "次世代NVR",
|
|
119
|
-
"menu.label.security.videoRecorders.description": "
|
|
119
|
+
"menu.label.security.videoRecorders.description": "每一幀。始終安全。",
|
|
120
120
|
"menu.label.siteManager": "站點管理員",
|
|
121
121
|
"menu.label.startHere": "從這裡開始",
|
|
122
122
|
"menu.label.startHere.accessoryTech": "配件科技",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Currency } from "../../../types";
|
|
2
|
+
import type { Cents, Dino } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Helper class to distribute a total amount across a quantity of items.
|
|
5
|
+
*/
|
|
6
|
+
export declare class TotalAmountAllocator {
|
|
7
|
+
#private;
|
|
8
|
+
constructor({ amount, quantity, currency, }: {
|
|
9
|
+
quantity: number;
|
|
10
|
+
amount: Cents;
|
|
11
|
+
currency: Currency;
|
|
12
|
+
});
|
|
13
|
+
allocate(quantity: number): {
|
|
14
|
+
qtyAllocated: number;
|
|
15
|
+
amount: Dino;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dinero_js = require('dinero.js');
|
|
4
|
+
var errors = require('../../errors.js');
|
|
5
|
+
var misc = require('../misc.js');
|
|
6
|
+
"use strict";
|
|
7
|
+
class TotalAmountAllocator {
|
|
8
|
+
#remainingAmount;
|
|
9
|
+
#remainingQuantity;
|
|
10
|
+
#currency;
|
|
11
|
+
constructor({
|
|
12
|
+
amount,
|
|
13
|
+
quantity,
|
|
14
|
+
currency
|
|
15
|
+
}) {
|
|
16
|
+
this.#remainingAmount = misc.getDinero(amount, currency);
|
|
17
|
+
this.#remainingQuantity = quantity;
|
|
18
|
+
this.#currency = currency;
|
|
19
|
+
}
|
|
20
|
+
allocate(quantity) {
|
|
21
|
+
const quantityToAllocate = Math.min(quantity, this.#remainingQuantity);
|
|
22
|
+
if (quantityToAllocate === 0) {
|
|
23
|
+
return {
|
|
24
|
+
qtyAllocated: 0,
|
|
25
|
+
amount: misc.getDinero(0, this.#currency)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const [allocated, newRemainingAmount] = dinero_js.allocate(this.#remainingAmount, [quantityToAllocate, this.#remainingQuantity - quantityToAllocate]);
|
|
29
|
+
errors.assert(!!allocated, "Couldn't allocate amount");
|
|
30
|
+
errors.assert(!!newRemainingAmount, "Couldn't retrieve remaining amount");
|
|
31
|
+
this.#remainingAmount = newRemainingAmount;
|
|
32
|
+
this.#remainingQuantity -= quantityToAllocate;
|
|
33
|
+
return {
|
|
34
|
+
qtyAllocated: quantityToAllocate,
|
|
35
|
+
amount: allocated
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.TotalAmountAllocator = TotalAmountAllocator;
|
|
40
|
+
//# sourceMappingURL=totalAmount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"totalAmount.js","sources":["../../../../src/utils/money/allocators/totalAmount.ts"],"sourcesContent":["import { allocate } from \"dinero.js\";\n\nimport type { Currency } from \"../../../types\";\nimport { assert } from \"../../errors\";\nimport { getDinero } from \"../misc\";\nimport type { Cents, Dino } from \"../types\";\n\n/**\n * Helper class to distribute a total amount across a quantity of items.\n */\nexport class TotalAmountAllocator {\n #remainingAmount: Dino;\n #remainingQuantity: number;\n #currency: Currency;\n\n constructor({\n amount,\n quantity,\n currency,\n }: {\n quantity: number;\n amount: Cents;\n currency: Currency;\n }) {\n this.#remainingAmount = getDinero(amount, currency);\n this.#remainingQuantity = quantity;\n this.#currency = currency;\n }\n\n allocate(quantity: number): { qtyAllocated: number; amount: Dino } {\n // Normalize quantity to not exceed remaining\n const quantityToAllocate = Math.min(quantity, this.#remainingQuantity);\n\n if (quantityToAllocate === 0) {\n return { qtyAllocated: 0, amount: getDinero(0, this.#currency) };\n }\n\n const [allocated, newRemainingAmount] = allocate(this.#remainingAmount, [\n quantityToAllocate,\n this.#remainingQuantity - quantityToAllocate,\n ]);\n\n assert(!!allocated, \"Couldn't allocate amount\");\n assert(!!newRemainingAmount, \"Couldn't retrieve remaining amount\");\n\n // Update remaining amounts\n this.#remainingAmount = newRemainingAmount;\n this.#remainingQuantity -= quantityToAllocate;\n\n return { qtyAllocated: quantityToAllocate, amount: allocated };\n }\n}\n"],"names":["TotalAmountAllocator","remainingAmount","remainingQuantity","currency","constructor","amount","quantity","getDinero","allocate","quantityToAllocate","Math","min","qtyAllocated","allocated","newRemainingAmount","assert"],"mappings":";;;;;;AAUO,MAAMA,oBAAA,CAAqB;EAChC,CAAAC,eAAA;EACA,CAAAC,iBAAA;EACA,CAAAC,QAAA;EAEAC,WAAAA,CAAY;IACVC,MAAA;IACAC,QAAA;IACAH;EAAA,CACF,EAIG;IACD,IAAA,CAAK,CAAAF,eAAA,GAAmBM,cAAA,CAAUF,MAAA,EAAQF,QAAQ,CAAA;IAClD,IAAA,CAAK,CAAAD,iBAAA,GAAqBI,QAAA;IAC1B,IAAA,CAAK,CAAAH,QAAA,GAAYA,QAAA;EACnB;EAEAK,SAASF,QAAA,EAA0D;IAEjE,MAAMG,kBAAA,GAAqBC,IAAA,CAAKC,GAAA,CAAIL,QAAA,EAAU,KAAK,CAAAJ,iBAAkB,CAAA;IAErE,IAAIO,uBAAuB,CAAA,EAAG;MAC5B,OAAO;QAAEG,cAAc,CAAA;QAAGP,MAAA,EAAQE,IAAAA,CAAAA,UAAU,CAAA,EAAG,IAAA,CAAK,CAAAJ,QAAS;MAAA,CAAE;IACjE;IAEA,MAAM,CAACU,SAAA,EAAWC,kBAAkB,CAAA,GAAIN,SAAAA,CAAAA,QAAA,CAAS,KAAK,CAAAP,eAAA,EAAkB,CACtEQ,kBAAA,EACA,KAAK,CAAAP,iBAAA,GAAqBO,kBAAA,CAC3B,CAAA;IAEDM,aAAA,CAAO,CAAC,CAACF,SAAA,EAAW,0BAA0B,CAAA;IAC9CE,aAAA,CAAO,CAAC,CAACD,kBAAA,EAAoB,oCAAoC,CAAA;IAGjE,IAAA,CAAK,CAAAb,eAAA,GAAmBa,kBAAA;IACxB,IAAA,CAAK,CAAAZ,iBAAA,IAAsBO,kBAAA;IAE3B,OAAO;MAAEG,YAAA,EAAcH,kBAAA;MAAoBJ,MAAA,EAAQQ;IAAA,CAAU;EAC/D;AACF;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { allocate } from 'dinero.js';
|
|
2
|
+
import { assert } from '../../errors.mjs';
|
|
3
|
+
import { getDinero } from '../misc.mjs';
|
|
4
|
+
"use strict";
|
|
5
|
+
class TotalAmountAllocator {
|
|
6
|
+
#remainingAmount;
|
|
7
|
+
#remainingQuantity;
|
|
8
|
+
#currency;
|
|
9
|
+
constructor({
|
|
10
|
+
amount,
|
|
11
|
+
quantity,
|
|
12
|
+
currency
|
|
13
|
+
}) {
|
|
14
|
+
this.#remainingAmount = getDinero(amount, currency);
|
|
15
|
+
this.#remainingQuantity = quantity;
|
|
16
|
+
this.#currency = currency;
|
|
17
|
+
}
|
|
18
|
+
allocate(quantity) {
|
|
19
|
+
const quantityToAllocate = Math.min(quantity, this.#remainingQuantity);
|
|
20
|
+
if (quantityToAllocate === 0) {
|
|
21
|
+
return {
|
|
22
|
+
qtyAllocated: 0,
|
|
23
|
+
amount: getDinero(0, this.#currency)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const [allocated, newRemainingAmount] = allocate(this.#remainingAmount, [quantityToAllocate, this.#remainingQuantity - quantityToAllocate]);
|
|
27
|
+
assert(!!allocated, "Couldn't allocate amount");
|
|
28
|
+
assert(!!newRemainingAmount, "Couldn't retrieve remaining amount");
|
|
29
|
+
this.#remainingAmount = newRemainingAmount;
|
|
30
|
+
this.#remainingQuantity -= quantityToAllocate;
|
|
31
|
+
return {
|
|
32
|
+
qtyAllocated: quantityToAllocate,
|
|
33
|
+
amount: allocated
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export { TotalAmountAllocator };
|
|
38
|
+
//# sourceMappingURL=totalAmount.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"totalAmount.mjs","sources":["../../../../src/utils/money/allocators/totalAmount.ts"],"sourcesContent":["import { allocate } from \"dinero.js\";\n\nimport type { Currency } from \"../../../types\";\nimport { assert } from \"../../errors\";\nimport { getDinero } from \"../misc\";\nimport type { Cents, Dino } from \"../types\";\n\n/**\n * Helper class to distribute a total amount across a quantity of items.\n */\nexport class TotalAmountAllocator {\n #remainingAmount: Dino;\n #remainingQuantity: number;\n #currency: Currency;\n\n constructor({\n amount,\n quantity,\n currency,\n }: {\n quantity: number;\n amount: Cents;\n currency: Currency;\n }) {\n this.#remainingAmount = getDinero(amount, currency);\n this.#remainingQuantity = quantity;\n this.#currency = currency;\n }\n\n allocate(quantity: number): { qtyAllocated: number; amount: Dino } {\n // Normalize quantity to not exceed remaining\n const quantityToAllocate = Math.min(quantity, this.#remainingQuantity);\n\n if (quantityToAllocate === 0) {\n return { qtyAllocated: 0, amount: getDinero(0, this.#currency) };\n }\n\n const [allocated, newRemainingAmount] = allocate(this.#remainingAmount, [\n quantityToAllocate,\n this.#remainingQuantity - quantityToAllocate,\n ]);\n\n assert(!!allocated, \"Couldn't allocate amount\");\n assert(!!newRemainingAmount, \"Couldn't retrieve remaining amount\");\n\n // Update remaining amounts\n this.#remainingAmount = newRemainingAmount;\n this.#remainingQuantity -= quantityToAllocate;\n\n return { qtyAllocated: quantityToAllocate, amount: allocated };\n }\n}\n"],"names":["TotalAmountAllocator","remainingAmount","remainingQuantity","currency","constructor","amount","quantity","getDinero","allocate","quantityToAllocate","Math","min","qtyAllocated","allocated","newRemainingAmount","assert"],"mappings":";;;;AAUO,MAAMA,oBAAA,CAAqB;EAChC,CAAAC,eAAA;EACA,CAAAC,iBAAA;EACA,CAAAC,QAAA;EAEAC,WAAAA,CAAY;IACVC,MAAA;IACAC,QAAA;IACAH;EAAA,CACF,EAIG;IACD,IAAA,CAAK,CAAAF,eAAA,GAAmBM,SAAA,CAAUF,MAAA,EAAQF,QAAQ,CAAA;IAClD,IAAA,CAAK,CAAAD,iBAAA,GAAqBI,QAAA;IAC1B,IAAA,CAAK,CAAAH,QAAA,GAAYA,QAAA;EACnB;EAEAK,SAASF,QAAA,EAA0D;IAEjE,MAAMG,kBAAA,GAAqBC,IAAA,CAAKC,GAAA,CAAIL,QAAA,EAAU,KAAK,CAAAJ,iBAAkB,CAAA;IAErE,IAAIO,uBAAuB,CAAA,EAAG;MAC5B,OAAO;QAAEG,cAAc,CAAA;QAAGP,MAAA,EAAQE,UAAU,CAAA,EAAG,IAAA,CAAK,CAAAJ,QAAS;MAAA,CAAE;IACjE;IAEA,MAAM,CAACU,SAAA,EAAWC,kBAAkB,CAAA,GAAIN,QAAA,CAAS,KAAK,CAAAP,eAAA,EAAkB,CACtEQ,kBAAA,EACA,KAAK,CAAAP,iBAAA,GAAqBO,kBAAA,CAC3B,CAAA;IAEDM,MAAA,CAAO,CAAC,CAACF,SAAA,EAAW,0BAA0B,CAAA;IAC9CE,MAAA,CAAO,CAAC,CAACD,kBAAA,EAAoB,oCAAoC,CAAA;IAGjE,IAAA,CAAK,CAAAb,eAAA,GAAmBa,kBAAA;IACxB,IAAA,CAAK,CAAAZ,iBAAA,IAAsBO,kBAAA;IAE3B,OAAO;MAAEG,YAAA,EAAcH,kBAAA;MAAoBJ,MAAA,EAAQQ;IAAA,CAAU;EAC/D;AACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/utils/money/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
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');
|
|
5
6
|
var constants = require('./constants.js');
|
|
6
7
|
var exchangeRate = require('./exchangeRate.js');
|
|
7
8
|
var format = require('./format.js');
|
|
@@ -12,6 +13,7 @@ require('./types.js');
|
|
|
12
13
|
"use strict";
|
|
13
14
|
exports.FixedAmountAllocator = fixedAmount.FixedAmountAllocator;
|
|
14
15
|
exports.ProductAmountAllocator = productAmount.ProductAmountAllocator;
|
|
16
|
+
exports.TotalAmountAllocator = totalAmount.TotalAmountAllocator;
|
|
15
17
|
exports.EXCHANGE_RATE_DINERO_CURRENCY = constants.EXCHANGE_RATE_DINERO_CURRENCY;
|
|
16
18
|
exports.Round = constants.Round;
|
|
17
19
|
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,5 +1,6 @@
|
|
|
1
1
|
export { FixedAmountAllocator } from './allocators/fixedAmount.mjs';
|
|
2
2
|
export { ProductAmountAllocator } from './allocators/productAmount.mjs';
|
|
3
|
+
export { TotalAmountAllocator } from './allocators/totalAmount.mjs';
|
|
3
4
|
export { EXCHANGE_RATE_DINERO_CURRENCY, Round, TAX_RATE_DINERO_CURRENCY, localizedCurrencyLookup, prettifyPriceLookup, roundToNearestDecimalCent, roundToNearestFull059, roundToNearestHalfUnitCent, roundToNearestValidUiCarePrice, smallestSubunitLookup, storesWithPerItemTaxRate } from './constants.mjs';
|
|
4
5
|
export { invertExchangeRate, toFixedExchangeRate, toSnapshotExchangeRate } from './exchangeRate.mjs';
|
|
5
6
|
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,12 +3,15 @@ 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, options, }: {
|
|
7
7
|
itemSummary: LineItemSummary;
|
|
8
8
|
taxRate: TaxRate;
|
|
9
|
-
|
|
9
|
+
options: {
|
|
10
|
+
storeId: StoreId;
|
|
11
|
+
hasTaxIncludedPrice: boolean;
|
|
12
|
+
};
|
|
10
13
|
}) => Dino;
|
|
11
|
-
export declare const removeTaxAmount: (
|
|
14
|
+
export declare const removeTaxAmount: (amountWithTax: Dino, taxRate: TaxRate) => Dino;
|
|
12
15
|
/**
|
|
13
16
|
* Will return a percentage tax rate from a decimal tax rate (usually returned by DB)
|
|
14
17
|
*
|
package/lib/utils/money/tax.js
CHANGED
|
@@ -9,18 +9,11 @@ var tax_private = require('./tax.private.js');
|
|
|
9
9
|
const calculateLineItemTax = ({
|
|
10
10
|
itemSummary,
|
|
11
11
|
taxRate,
|
|
12
|
-
|
|
12
|
+
options
|
|
13
13
|
}) => {
|
|
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
|
-
});
|
|
14
|
+
return constants.storesWithPerItemTaxRate.has(options.storeId) ? tax_private.calculatePerQtyLineItemTax(itemSummary, taxRate, options) : tax_private.calculateWholeQtyLineItemTax(itemSummary, taxRate, options);
|
|
23
15
|
};
|
|
16
|
+
const removeTaxAmount = (amountWithTax, taxRate) => dinero_js.subtract(amountWithTax, tax_private.getTaxFromFinalAmount(amountWithTax, taxRate));
|
|
24
17
|
const convertDecimalTaxRateToPercentage = taxRate => {
|
|
25
18
|
const dineroObj = decimalTaxRateToDinero(taxRate);
|
|
26
19
|
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 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;;;;;;;"}
|
package/lib/utils/money/tax.mjs
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { subtract, multiply, toUnit, halfEven, dinero } from 'dinero.js';
|
|
2
2
|
import { assert } from '../errors.mjs';
|
|
3
3
|
import { isFloat, toFixedRate } from '../number.mjs';
|
|
4
|
-
import { storesWithPerItemTaxRate,
|
|
5
|
-
import { calculatePerQtyLineItemTax, calculateWholeQtyLineItemTax } from './tax.private.mjs';
|
|
4
|
+
import { storesWithPerItemTaxRate, TAX_RATE_DINERO_CURRENCY } from './constants.mjs';
|
|
5
|
+
import { calculatePerQtyLineItemTax, calculateWholeQtyLineItemTax, getTaxFromFinalAmount } from './tax.private.mjs';
|
|
6
6
|
"use strict";
|
|
7
7
|
const calculateLineItemTax = ({
|
|
8
8
|
itemSummary,
|
|
9
9
|
taxRate,
|
|
10
|
-
|
|
10
|
+
options
|
|
11
11
|
}) => {
|
|
12
|
-
return storesWithPerItemTaxRate.has(storeId) ? calculatePerQtyLineItemTax(itemSummary, taxRate) : calculateWholeQtyLineItemTax(itemSummary, taxRate);
|
|
13
|
-
};
|
|
14
|
-
const removeTaxAmount = (baseAmountWithTaxObj, taxRate) => {
|
|
15
|
-
const snapshot = toSnapshot(baseAmountWithTaxObj);
|
|
16
|
-
const taxAmount = Round.Financial(snapshot.amount - snapshot.amount / (1 + taxRate));
|
|
17
|
-
return dinero({
|
|
18
|
-
...snapshot,
|
|
19
|
-
amount: snapshot.amount - taxAmount
|
|
20
|
-
});
|
|
12
|
+
return storesWithPerItemTaxRate.has(options.storeId) ? calculatePerQtyLineItemTax(itemSummary, taxRate, options) : calculateWholeQtyLineItemTax(itemSummary, taxRate, options);
|
|
21
13
|
};
|
|
14
|
+
const removeTaxAmount = (amountWithTax, taxRate) => subtract(amountWithTax, getTaxFromFinalAmount(amountWithTax, taxRate));
|
|
22
15
|
const convertDecimalTaxRateToPercentage = taxRate => {
|
|
23
16
|
const dineroObj = decimalTaxRateToDinero(taxRate);
|
|
24
17
|
const t = multiply(dineroObj, 100);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tax.mjs","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.mjs","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,wBAAA,CAAyBC,GAAA,CAAIF,OAAA,CAAQG,OAAO,CAAA,GAC/CC,0BAAA,CAA2BN,WAAA,EAAaC,OAAA,EAASC,OAAO,CAAA,GACxDK,4BAAA,CAA6BP,WAAA,EAAaC,SAASC,OAAO,CAAA;AAChE,CAAA;AAEO,MAAMM,eAAA,GAAkBA,CAACC,aAAA,EAAqBR,OAAA,KACnDS,SAASD,aAAA,EAAeE,qBAAA,CAAsBF,aAAA,EAAeR,OAAO,CAAC,CAAA;AAWhE,MAAMW,iCAAA,GACXX,OAAA,IACW;EACX,MAAMY,SAAA,GAAYC,uBAAuBb,OAAO,CAAA;EAChD,MAAMc,CAAA,GAAIC,QAAA,CAASH,SAAA,EAAW,GAAG,CAAA;EACjC,OAAOI,OAAOF,CAAA,EAAG;IACfG,QAAQC,wBAAA,CAAyBC,QAAA;IACjCC,KAAA,EAAOC;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,OAAA,CAAQH,YAAY,CAAA;EAEpB,MAAMI,kBAAkBH,MAAA,CAAOI,QAAA,CAAA,CAE3BL,YAAA,GACAM,KAAKC,GAAA,CAAIX,wBAAA,CAAyBY,MAAMZ,wBAAA,CAAyBC,QAAQ,CAAA,EACzEY,OAAA,CAAQ,CAAC,CAAA,CACb;EACA,OAAOC,MAAA,CAAO;IACZC,MAAA,EAAQP,eAAA;IACRQ,QAAA,EAAUhB;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,WAAA,CAAY,CAACD,IAAA,EAAMnB,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,WAAA,CAAYG,OAAA,EAASvB,wBAAA,CAAyBC,UAAU,IAAI,CAAA;EAC3E0B,MAAA,CAAOD,MAAA,IAAU,GAAG,2BAA2B,CAAA;EAC/CC,MAAA,CAAOD,MAAA,GAAS,GAAG,8BAA8B,CAAA;EACjD,OAAOA,MAAA;AACT,CAAA;"}
|
|
@@ -4,5 +4,10 @@ import type { Dino, LineItemSummary, SingleLineItemSummary, TaxRate } from "./ty
|
|
|
4
4
|
* rate calculations
|
|
5
5
|
*/
|
|
6
6
|
export declare const allocatePerItemTaxableAmount: (itemSummary: LineItemSummary) => SingleLineItemSummary[];
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
7
|
+
export declare const getTaxFromFinalAmount: (amountWithTax: Dino, taxRate: TaxRate) => import("dinero.js").Dinero<number>;
|
|
8
|
+
export declare const calculateWholeQtyLineItemTax: (itemSummary: LineItemSummary, taxRate: TaxRate, options: {
|
|
9
|
+
hasTaxIncludedPrice: boolean;
|
|
10
|
+
}) => Dino;
|
|
11
|
+
export declare const calculatePerQtyLineItemTax: (itemSummary: LineItemSummary, taxRate: TaxRate, options: {
|
|
12
|
+
hasTaxIncludedPrice: boolean;
|
|
13
|
+
}) => Dino;
|
|
@@ -29,23 +29,37 @@ const allocatePerItemTaxableAmount = itemSummary => {
|
|
|
29
29
|
};
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
|
-
const
|
|
33
|
-
if (taxRate === 0) {
|
|
34
|
-
return misc.getDinero(0, itemSummary.currency);
|
|
35
|
-
}
|
|
32
|
+
const calculateTaxOnTaxableAmount = (itemSummary, taxRate) => {
|
|
36
33
|
return dinero_js.dinero({
|
|
37
34
|
amount: constants.Round.Financial(itemSummary.taxableAmount * taxRate),
|
|
38
35
|
currency: misc.getDineroCurrency(itemSummary.currency)
|
|
39
36
|
});
|
|
40
37
|
};
|
|
41
|
-
const
|
|
38
|
+
const getTaxFromFinalAmount = (amountWithTax, taxRate) => {
|
|
39
|
+
const snapshot = dinero_js.toSnapshot(amountWithTax);
|
|
40
|
+
const taxAmount = constants.Round.Financial(snapshot.amount - snapshot.amount / (1 + taxRate));
|
|
41
|
+
return dinero_js.dinero({
|
|
42
|
+
...snapshot,
|
|
43
|
+
amount: taxAmount
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const calculateTaxFromTaxIncludedPrice = (itemSummary, taxRate) => {
|
|
47
|
+
return getTaxFromFinalAmount(misc.getDinero(itemSummary.taxableAmount, itemSummary.currency), taxRate);
|
|
48
|
+
};
|
|
49
|
+
const calculateWholeQtyLineItemTax = (itemSummary, taxRate, options) => {
|
|
50
|
+
if (taxRate === 0) {
|
|
51
|
+
return misc.getDinero(0, itemSummary.currency);
|
|
52
|
+
}
|
|
53
|
+
return options.hasTaxIncludedPrice ? calculateTaxFromTaxIncludedPrice(itemSummary, taxRate) : calculateTaxOnTaxableAmount(itemSummary, taxRate);
|
|
54
|
+
};
|
|
55
|
+
const calculatePerQtyLineItemTax = (itemSummary, taxRate, options) => {
|
|
42
56
|
if (taxRate === 0) {
|
|
43
57
|
return misc.getDinero(0, itemSummary.currency);
|
|
44
58
|
}
|
|
45
59
|
const singleItemSummaries = allocatePerItemTaxableAmount(itemSummary);
|
|
46
60
|
let totalTaxAmount = misc.getDinero(0, itemSummary.currency);
|
|
47
61
|
singleItemSummaries.forEach(itemSummary2 => {
|
|
48
|
-
const taxAmount = calculateWholeQtyLineItemTax(itemSummary2, taxRate);
|
|
62
|
+
const taxAmount = calculateWholeQtyLineItemTax(itemSummary2, taxRate, options);
|
|
49
63
|
totalTaxAmount = dinero_js.add(totalTaxAmount, taxAmount);
|
|
50
64
|
});
|
|
51
65
|
return totalTaxAmount;
|
|
@@ -53,4 +67,5 @@ const calculatePerQtyLineItemTax = (itemSummary, taxRate) => {
|
|
|
53
67
|
exports.allocatePerItemTaxableAmount = allocatePerItemTaxableAmount;
|
|
54
68
|
exports.calculatePerQtyLineItemTax = calculatePerQtyLineItemTax;
|
|
55
69
|
exports.calculateWholeQtyLineItemTax = calculateWholeQtyLineItemTax;
|
|
70
|
+
exports.getTaxFromFinalAmount = getTaxFromFinalAmount;
|
|
56
71
|
//# sourceMappingURL=tax.private.js.map
|