@ubnt/store.core 9.6.0-alpha.9 → 9.7.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/lib/assets/attention.svg +5 -5
  3. package/lib/assets/attention2.svg +5 -5
  4. package/lib/assets/minus4.svg +8 -8
  5. package/lib/assets/minus5.svg +8 -8
  6. package/lib/assets/pause.svg +3 -3
  7. package/lib/assets/pause2.svg +3 -3
  8. package/lib/assets/plus2.svg +4 -1
  9. package/lib/assets/plus3.svg +1 -4
  10. package/lib/assets/plus5.svg +9 -9
  11. package/lib/assets/plus6.svg +9 -9
  12. package/lib/assets/ucgMax.jpg +0 -0
  13. package/lib/assets/ucgMax2.jpg +0 -0
  14. package/lib/assets/ucgUltra.jpg +0 -0
  15. package/lib/assets/ucgUltra2.jpg +0 -0
  16. package/lib/assets/udmProMax.jpg +0 -0
  17. package/lib/assets/udmProMax2.jpg +0 -0
  18. package/lib/components/FeaturesSection_deprecated/AllFeaturesButton/AllFeaturesButton.js +1 -1
  19. package/lib/components/FeaturesSection_deprecated/AllFeaturesButton/AllFeaturesButton.mjs +1 -1
  20. package/lib/components/FeaturesSection_deprecated/assets/plus.svg.js +1 -1
  21. package/lib/components/FeaturesSection_deprecated/assets/plus.svg.mjs +2 -2
  22. package/lib/components/Header/CartModalV2/Item/Item.js +3 -3
  23. package/lib/components/Header/CartModalV2/Item/Item.mjs +2 -2
  24. package/lib/components/MicrositeVideoSlideshow/MicrositeVideoSlideshow.js +1 -1
  25. package/lib/components/MicrositeVideoSlideshow/MicrositeVideoSlideshow.mjs +1 -1
  26. package/lib/components/MicrositeVideoSlideshow/assets/pause.svg.js +1 -1
  27. package/lib/components/MicrositeVideoSlideshow/assets/pause.svg.mjs +2 -2
  28. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgMax.jpg.js +5 -5
  29. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgMax.jpg.mjs +2 -2
  30. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgUltra.jpg.js +5 -5
  31. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgUltra.jpg.mjs +2 -2
  32. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProMax.jpg.js +5 -5
  33. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProMax.jpg.mjs +2 -2
  34. package/lib/components/ModelCompareV3/assets/Consoles/ucgMax.jpg.js +1 -1
  35. package/lib/components/ModelCompareV3/assets/Consoles/ucgMax.jpg.mjs +2 -2
  36. package/lib/components/ModelCompareV3/assets/Consoles/ucgUltra.jpg.js +1 -1
  37. package/lib/components/ModelCompareV3/assets/Consoles/ucgUltra.jpg.mjs +2 -2
  38. package/lib/components/ModelCompareV3/assets/Consoles/udmProMax.jpg.js +1 -1
  39. package/lib/components/ModelCompareV3/assets/Consoles/udmProMax.jpg.mjs +2 -2
  40. package/lib/components/ModelCompareV3/data/CloudGateways.js +9 -9
  41. package/lib/components/ModelCompareV3/data/CloudGateways.mjs +6 -6
  42. package/lib/components/ModelCompareV3/data/products/ucgMax.js +1 -1
  43. package/lib/components/ModelCompareV3/data/products/ucgMax.mjs +1 -1
  44. package/lib/components/ModelCompareV3/data/products/ucgUltra.js +1 -1
  45. package/lib/components/ModelCompareV3/data/products/ucgUltra.mjs +1 -1
  46. package/lib/components/ModelCompareV3/data/products/udmProMax.js +1 -1
  47. package/lib/components/ModelCompareV3/data/products/udmProMax.mjs +1 -1
  48. package/lib/components/ModelCompareV3/translations/en.json.js +2 -2
  49. package/lib/components/ModelCompareV3/translations/en.json.mjs +2 -2
  50. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.js +1 -1
  51. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.mjs +1 -1
  52. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputSections/CounterSection.js +2 -2
  53. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputSections/CounterSection.mjs +2 -2
  54. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.js +1 -1
  55. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.mjs +2 -2
  56. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/minus.svg.js +1 -1
  57. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/minus.svg.mjs +2 -2
  58. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/plus.svg.js +1 -1
  59. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/plus.svg.mjs +2 -2
  60. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.js +1 -1
  61. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.mjs +1 -1
  62. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.js +1 -1
  63. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.mjs +2 -2
  64. package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.js +2 -2
  65. package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.mjs +2 -2
  66. package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/minus.svg.js +1 -1
  67. package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/minus.svg.mjs +2 -2
  68. package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/plus.svg.js +1 -1
  69. package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/plus.svg.mjs +2 -2
  70. package/lib/components/ScrollWrapper/ScrollWrapper.js +6 -7
  71. package/lib/components/ScrollWrapper/ScrollWrapper.js.map +1 -1
  72. package/lib/components/ScrollWrapper/ScrollWrapper.mjs +6 -7
  73. package/lib/components/ScrollWrapper/ScrollWrapper.mjs.map +1 -1
  74. package/lib/components/Tooltip/Tooltip.js +16 -2
  75. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  76. package/lib/components/Tooltip/Tooltip.mjs +17 -3
  77. package/lib/components/Tooltip/Tooltip.mjs.map +1 -1
  78. package/lib/components/Tooltip/Tooltip.styles.d.ts +1 -0
  79. package/lib/components/Tooltip/Tooltip.styles.js +6 -0
  80. package/lib/components/Tooltip/Tooltip.styles.js.map +1 -1
  81. package/lib/components/Tooltip/Tooltip.styles.mjs +6 -1
  82. package/lib/components/Tooltip/Tooltip.styles.mjs.map +1 -1
  83. package/lib/components/VideoPlayerNew/VideoPlayer.js +1 -1
  84. package/lib/components/VideoPlayerNew/VideoPlayer.mjs +1 -1
  85. package/lib/components/VideoPlayerNew/assets/pause.svg.js +1 -1
  86. package/lib/components/VideoPlayerNew/assets/pause.svg.mjs +2 -2
  87. package/lib/constants/icons/generic/index.js +3 -3
  88. package/lib/constants/icons/generic/index.mjs +1 -1
  89. package/lib/constants/icons/generic/plus.svg.js +5 -5
  90. package/lib/constants/icons/generic/plus.svg.mjs +2 -2
  91. package/lib/utils/money/allocators/productAmount.d.ts +5 -9
  92. package/lib/utils/money/allocators/productAmount.js +64 -23
  93. package/lib/utils/money/allocators/productAmount.js.map +1 -1
  94. package/lib/utils/money/allocators/productAmount.mjs +64 -23
  95. package/lib/utils/money/allocators/productAmount.mjs.map +1 -1
  96. package/lib/utils/money/types.d.ts +6 -2
  97. package/package.json +19 -19
@@ -1 +1 @@
1
- {"version":3,"file":"productAmount.js","sources":["../../../../src/utils/money/allocators/productAmount.ts"],"sourcesContent":["import type { Currency } from \"../../../types\";\nimport { amount } from \"../misc\";\nimport type { Cents, FullLineItemSummary } from \"../types\";\nimport { FixedAmountAllocator } from \"./fixedAmount\";\n\n/**\n * Helper class to distribute a total amount for a product\n */\nexport class ProductAmountAllocator {\n itemPrice: Cents;\n currency: Currency;\n quantity: number;\n discountAmount: FixedAmountAllocator;\n taxableAmount: FixedAmountAllocator;\n tax: FixedAmountAllocator;\n total: FixedAmountAllocator;\n\n constructor(productSummary: FullLineItemSummary) {\n const currency = productSummary.currency;\n\n /**\n * Somewhat hackish, just need a stable price that can easily divide later by quantity\n */\n const priceForAllocation =\n productSummary.itemPrice * productSummary.quantity;\n\n this.itemPrice = productSummary.itemPrice;\n this.currency = currency;\n this.quantity = productSummary.quantity;\n this.discountAmount = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.discountAmount,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n this.taxableAmount = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.taxableAmount,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n this.tax = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.tax,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n this.total = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.total,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n }\n\n allocateQty(quantity: number): FullLineItemSummary {\n // Calculate remaining allocatable quantity\n let quantityNormalized = Math.max(quantity, 0);\n quantityNormalized =\n this.quantity - quantityNormalized >= 0 ? quantityNormalized : 0;\n\n // Adjust remaining qty\n this.quantity = Math.max(this.quantity - quantityNormalized, 0);\n\n // How big of a slice of the total price we need to allocate\n const itemQuantityPrice = this.itemPrice * quantityNormalized;\n\n return {\n itemPrice: this.itemPrice,\n currency: this.currency,\n quantity: quantityNormalized,\n discountAmount: amount(\n this.discountAmount.allocate(itemQuantityPrice, this.currency),\n ),\n taxableAmount: amount(\n this.taxableAmount.allocate(itemQuantityPrice, this.currency),\n ),\n tax: amount(this.tax.allocate(itemQuantityPrice, this.currency)),\n total: amount(this.total.allocate(itemQuantityPrice, this.currency)),\n } satisfies FullLineItemSummary;\n }\n}\n"],"names":["ProductAmountAllocator","constructor","productSummary","__publicField","currency","priceForAllocation","itemPrice","quantity","discountAmount","FixedAmountAllocator","initialAllocateAmount","initialTotalAmount","taxableAmount","tax","total","allocateQty","quantityNormalized","Math","max","itemQuantityPrice","amount","allocate"],"mappings":";;;;;;;;;;;;;;;;AAQO,MAAMA,sBAAuB,CAAA;EASlCC,YAAYC,cAAqC,EAAA;IARjDC,aAAA,CAAA,IAAA,EAAA,WAAA,CAAA;IACAA,aAAA,CAAA,IAAA,EAAA,UAAA,CAAA;IACAA,aAAA,CAAA,IAAA,EAAA,UAAA,CAAA;IACAA,aAAA,CAAA,IAAA,EAAA,gBAAA,CAAA;IACAA,aAAA,CAAA,IAAA,EAAA,eAAA,CAAA;IACAA,aAAA,CAAA,IAAA,EAAA,KAAA,CAAA;IACAA,aAAA,CAAA,IAAA,EAAA,OAAA,CAAA;IAGE,MAAMC,WAAWF,cAAe,CAAAE,QAAA;IAK1B,MAAAC,kBAAA,GACJH,cAAe,CAAAI,SAAA,GAAYJ,cAAe,CAAAK,QAAA;IAE5C,IAAA,CAAKD,YAAYJ,cAAe,CAAAI,SAAA;IAChC,IAAA,CAAKF,QAAW,GAAAA,QAAA;IAChB,IAAA,CAAKG,WAAWL,cAAe,CAAAK,QAAA;IAC1B,IAAA,CAAAC,cAAA,GAAiB,IAAIC,gCAAqB,CAAA;MAC7CC,uBAAuBR,cAAe,CAAAM,cAAA;MACtCG,kBAAoB,EAAAN,kBAAA;MACpBD;IAAA,CACD,CAAA;IACI,IAAA,CAAAQ,aAAA,GAAgB,IAAIH,gCAAqB,CAAA;MAC5CC,uBAAuBR,cAAe,CAAAU,aAAA;MACtCD,kBAAoB,EAAAN,kBAAA;MACpBD;IAAA,CACD,CAAA;IACI,IAAA,CAAAS,GAAA,GAAM,IAAIJ,gCAAqB,CAAA;MAClCC,uBAAuBR,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../../src/utils/money/allocators/productAmount.ts"],"sourcesContent":["import type { Currency } from \"../../../types\";\nimport { amount } from \"../misc\";\nimport type { Cents, FullLineItemSummary } from \"../types\";\nimport { FixedAmountAllocator } from \"./fixedAmount\";\n\n/**\n * Helper class to distribute a total amount for a product\n */\nexport class ProductAmountAllocator {\n // #############################################################################\n // Fixed values\n // #############################################################################\n readonly #itemPrice: Cents;\n readonly #currency: Currency;\n // #############################################################################\n /**\n * Remaining quantity to allocate\n */\n quantity: number;\n // #############################################################################\n // Specific amount allocators\n // #############################################################################\n #subtotal: FixedAmountAllocator;\n #discountAmount: FixedAmountAllocator;\n #taxableAmount: FixedAmountAllocator;\n #tax: FixedAmountAllocator;\n #total: FixedAmountAllocator;\n\n constructor(productSummary: FullLineItemSummary) {\n const currency = productSummary.currency;\n\n /**\n * Somewhat hackish, just need a stable price that can easily divide later by quantity\n */\n const priceForAllocation =\n productSummary.itemPrice * productSummary.quantity;\n\n this.#itemPrice = productSummary.itemPrice;\n this.#currency = currency;\n this.quantity = productSummary.quantity;\n this.#subtotal = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.subtotal,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n this.#discountAmount = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.discountAmount,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n this.#taxableAmount = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.taxableAmount,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n this.#tax = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.tax,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n this.#total = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.total,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n }\n\n allocateQty(quantity: number): FullLineItemSummary {\n // Calculate remaining allocatable quantity\n let quantityNormalized = Math.max(quantity, 0);\n quantityNormalized =\n this.quantity - quantityNormalized >= 0 ? quantityNormalized : 0;\n\n // Adjust remaining qty\n this.quantity = Math.max(this.quantity - quantityNormalized, 0);\n\n // How big of a slice of the total price we need to allocate\n const itemQuantityPrice = this.#itemPrice * quantityNormalized;\n\n return {\n itemPrice: this.#itemPrice,\n currency: this.#currency,\n quantity: quantityNormalized,\n subtotal: amount(\n this.#subtotal.allocate(itemQuantityPrice, this.#currency),\n ),\n discountAmount: amount(\n this.#discountAmount.allocate(itemQuantityPrice, this.#currency),\n ),\n taxableAmount: amount(\n this.#taxableAmount.allocate(itemQuantityPrice, this.#currency),\n ),\n tax: amount(this.#tax.allocate(itemQuantityPrice, this.#currency)),\n total: amount(this.#total.allocate(itemQuantityPrice, this.#currency)),\n } satisfies FullLineItemSummary;\n }\n}\n"],"names":["_itemPrice","_currency","_subtotal","_discountAmount","_taxableAmount","_tax","_total","ProductAmountAllocator","constructor","productSummary","__privateAdd","__publicField","currency","priceForAllocation","itemPrice","quantity","__privateSet","FixedAmountAllocator","initialAllocateAmount","subtotal","initialTotalAmount","discountAmount","taxableAmount","tax","total","allocateQty","quantityNormalized","Math","max","itemQuantityPrice","__privateGet","amount","allocate","WeakMap"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,EAAAC,SAAA,EAAAC,SAAA,EAAAC,eAAA,EAAAC,cAAA,EAAAC,IAAA,EAAAC,MAAA;AAQO,MAAMC,sBAAuB,CAAA;EAoBlCC,YAAYC,cAAqC,EAAA;IAhBjD;IAAA;IAAA;IAAAC,YAAA,CAAA,IAAA,EAASV,UAAT,EAAA,KAAA,CAAA,CAAA;IACAU,YAAA,CAAA,IAAA,EAAST,SAAT,EAAA,KAAA,CAAA,CAAA;IAKA;IAAA;AAAA;AAAA;IAAAU,aAAA,CAAA,IAAA,EAAA,UAAA,CAAA;IAIA;IAAA;IAAA;IAAAD,YAAA,CAAA,IAAA,EAAAR,SAAA,EAAA,KAAA,CAAA,CAAA;IACAQ,YAAA,CAAA,IAAA,EAAAP,eAAA,EAAA,KAAA,CAAA,CAAA;IACAO,YAA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,CAAA,CAAO0B,SAASH,iBAAmB,EAAAC,YAAA,CAAA,IAAA,EAAK7B,UAAS,CAAC;IAAA,CACvE;EACF;AACF;AApFWD,UAAA,GAAA,IAAAiC,OAAA,CAAA,CAAA;AACAhC,SAAA,GAAA,IAAAgC,OAAA,CAAA,CAAA;AAST/B,SAAA,GAAA,IAAA+B,OAAA,CAAA,CAAA;AACA9B,eAAA,GAAA,IAAA8B,OAAA,CAAA,CAAA;AACA7B,cAAA,GAAA,IAAA6B,OAAA,CAAA,CAAA;AACA5B,IAAA,GAAA,IAAA4B,OAAA,CAAA,CAAA;AACA3B,MAAA,GAAA,IAAA2B,OAAA,CAAA,CAAA;"}
@@ -12,56 +12,97 @@ var __publicField = (obj, key, value) => {
12
12
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
13
13
  return value;
14
14
  };
15
+ var __accessCheck = (obj, member, msg) => {
16
+ if (!member.has(obj)) throw TypeError("Cannot " + msg);
17
+ };
18
+ var __privateGet = (obj, member, getter) => {
19
+ __accessCheck(obj, member, "read from private field");
20
+ return getter ? getter.call(obj) : member.get(obj);
21
+ };
22
+ var __privateAdd = (obj, member, value) => {
23
+ if (member.has(obj)) throw TypeError("Cannot add the same private member more than once");
24
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
25
+ };
26
+ var __privateSet = (obj, member, value, setter) => {
27
+ __accessCheck(obj, member, "write to private field");
28
+ setter ? setter.call(obj, value) : member.set(obj, value);
29
+ return value;
30
+ };
31
+ var _itemPrice, _currency, _subtotal, _discountAmount, _taxableAmount, _tax, _total;
15
32
  class ProductAmountAllocator {
16
33
  constructor(productSummary) {
17
- __publicField(this, "itemPrice");
18
- __publicField(this, "currency");
34
+ // #############################################################################
35
+ // Fixed values
36
+ // #############################################################################
37
+ __privateAdd(this, _itemPrice, void 0);
38
+ __privateAdd(this, _currency, void 0);
39
+ // #############################################################################
40
+ /**
41
+ * Remaining quantity to allocate
42
+ */
19
43
  __publicField(this, "quantity");
20
- __publicField(this, "discountAmount");
21
- __publicField(this, "taxableAmount");
22
- __publicField(this, "tax");
23
- __publicField(this, "total");
44
+ // #############################################################################
45
+ // Specific amount allocators
46
+ // #############################################################################
47
+ __privateAdd(this, _subtotal, void 0);
48
+ __privateAdd(this, _discountAmount, void 0);
49
+ __privateAdd(this, _taxableAmount, void 0);
50
+ __privateAdd(this, _tax, void 0);
51
+ __privateAdd(this, _total, void 0);
24
52
  const currency = productSummary.currency;
25
53
  const priceForAllocation = productSummary.itemPrice * productSummary.quantity;
26
- this.itemPrice = productSummary.itemPrice;
27
- this.currency = currency;
54
+ __privateSet(this, _itemPrice, productSummary.itemPrice);
55
+ __privateSet(this, _currency, currency);
28
56
  this.quantity = productSummary.quantity;
29
- this.discountAmount = new FixedAmountAllocator({
57
+ __privateSet(this, _subtotal, new FixedAmountAllocator({
58
+ initialAllocateAmount: productSummary.subtotal,
59
+ initialTotalAmount: priceForAllocation,
60
+ currency
61
+ }));
62
+ __privateSet(this, _discountAmount, new FixedAmountAllocator({
30
63
  initialAllocateAmount: productSummary.discountAmount,
31
64
  initialTotalAmount: priceForAllocation,
32
65
  currency
33
- });
34
- this.taxableAmount = new FixedAmountAllocator({
66
+ }));
67
+ __privateSet(this, _taxableAmount, new FixedAmountAllocator({
35
68
  initialAllocateAmount: productSummary.taxableAmount,
36
69
  initialTotalAmount: priceForAllocation,
37
70
  currency
38
- });
39
- this.tax = new FixedAmountAllocator({
71
+ }));
72
+ __privateSet(this, _tax, new FixedAmountAllocator({
40
73
  initialAllocateAmount: productSummary.tax,
41
74
  initialTotalAmount: priceForAllocation,
42
75
  currency
43
- });
44
- this.total = new FixedAmountAllocator({
76
+ }));
77
+ __privateSet(this, _total, new FixedAmountAllocator({
45
78
  initialAllocateAmount: productSummary.total,
46
79
  initialTotalAmount: priceForAllocation,
47
80
  currency
48
- });
81
+ }));
49
82
  }
50
83
  allocateQty(quantity) {
51
84
  let quantityNormalized = Math.max(quantity, 0);
52
85
  quantityNormalized = this.quantity - quantityNormalized >= 0 ? quantityNormalized : 0;
53
86
  this.quantity = Math.max(this.quantity - quantityNormalized, 0);
54
- const itemQuantityPrice = this.itemPrice * quantityNormalized;
87
+ const itemQuantityPrice = __privateGet(this, _itemPrice) * quantityNormalized;
55
88
  return {
56
- itemPrice: this.itemPrice,
57
- currency: this.currency,
89
+ itemPrice: __privateGet(this, _itemPrice),
90
+ currency: __privateGet(this, _currency),
58
91
  quantity: quantityNormalized,
59
- discountAmount: amount(this.discountAmount.allocate(itemQuantityPrice, this.currency)),
60
- taxableAmount: amount(this.taxableAmount.allocate(itemQuantityPrice, this.currency)),
61
- tax: amount(this.tax.allocate(itemQuantityPrice, this.currency)),
62
- total: amount(this.total.allocate(itemQuantityPrice, this.currency))
92
+ subtotal: amount(__privateGet(this, _subtotal).allocate(itemQuantityPrice, __privateGet(this, _currency))),
93
+ discountAmount: amount(__privateGet(this, _discountAmount).allocate(itemQuantityPrice, __privateGet(this, _currency))),
94
+ taxableAmount: amount(__privateGet(this, _taxableAmount).allocate(itemQuantityPrice, __privateGet(this, _currency))),
95
+ tax: amount(__privateGet(this, _tax).allocate(itemQuantityPrice, __privateGet(this, _currency))),
96
+ total: amount(__privateGet(this, _total).allocate(itemQuantityPrice, __privateGet(this, _currency)))
63
97
  };
64
98
  }
65
99
  }
100
+ _itemPrice = new WeakMap();
101
+ _currency = new WeakMap();
102
+ _subtotal = new WeakMap();
103
+ _discountAmount = new WeakMap();
104
+ _taxableAmount = new WeakMap();
105
+ _tax = new WeakMap();
106
+ _total = new WeakMap();
66
107
  export { ProductAmountAllocator };
67
108
  //# sourceMappingURL=productAmount.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"productAmount.mjs","sources":["../../../../src/utils/money/allocators/productAmount.ts"],"sourcesContent":["import type { Currency } from \"../../../types\";\nimport { amount } from \"../misc\";\nimport type { Cents, FullLineItemSummary } from \"../types\";\nimport { FixedAmountAllocator } from \"./fixedAmount\";\n\n/**\n * Helper class to distribute a total amount for a product\n */\nexport class ProductAmountAllocator {\n itemPrice: Cents;\n currency: Currency;\n quantity: number;\n discountAmount: FixedAmountAllocator;\n taxableAmount: FixedAmountAllocator;\n tax: FixedAmountAllocator;\n total: FixedAmountAllocator;\n\n constructor(productSummary: FullLineItemSummary) {\n const currency = productSummary.currency;\n\n /**\n * Somewhat hackish, just need a stable price that can easily divide later by quantity\n */\n const priceForAllocation =\n productSummary.itemPrice * productSummary.quantity;\n\n this.itemPrice = productSummary.itemPrice;\n this.currency = currency;\n this.quantity = productSummary.quantity;\n this.discountAmount = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.discountAmount,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n this.taxableAmount = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.taxableAmount,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n this.tax = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.tax,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n this.total = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.total,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n }\n\n allocateQty(quantity: number): FullLineItemSummary {\n // Calculate remaining allocatable quantity\n let quantityNormalized = Math.max(quantity, 0);\n quantityNormalized =\n this.quantity - quantityNormalized >= 0 ? quantityNormalized : 0;\n\n // Adjust remaining qty\n this.quantity = Math.max(this.quantity - quantityNormalized, 0);\n\n // How big of a slice of the total price we need to allocate\n const itemQuantityPrice = this.itemPrice * quantityNormalized;\n\n return {\n itemPrice: this.itemPrice,\n currency: this.currency,\n quantity: quantityNormalized,\n discountAmount: amount(\n this.discountAmount.allocate(itemQuantityPrice, this.currency),\n ),\n taxableAmount: amount(\n this.taxableAmount.allocate(itemQuantityPrice, this.currency),\n ),\n tax: amount(this.tax.allocate(itemQuantityPrice, this.currency)),\n total: amount(this.total.allocate(itemQuantityPrice, this.currency)),\n } satisfies FullLineItemSummary;\n }\n}\n"],"names":["ProductAmountAllocator","constructor","productSummary","__publicField","currency","priceForAllocation","itemPrice","quantity","discountAmount","FixedAmountAllocator","initialAllocateAmount","initialTotalAmount","taxableAmount","tax","total","allocateQty","quantityNormalized","Math","max","itemQuantityPrice","amount","allocate"],"mappings":";;;;;;;;;;;;;;AAQO,MAAMA,sBAAuB,CAAA;EASlCC,YAAYC,cAAqC,EAAA;IARjDC,aAAA,CAAA,IAAA,EAAA,WAAA,CAAA;IACAA,aAAA,CAAA,IAAA,EAAA,UAAA,CAAA;IACAA,aAAA,CAAA,IAAA,EAAA,UAAA,CAAA;IACAA,aAAA,CAAA,IAAA,EAAA,gBAAA,CAAA;IACAA,aAAA,CAAA,IAAA,EAAA,eAAA,CAAA;IACAA,aAAA,CAAA,IAAA,EAAA,KAAA,CAAA;IACAA,aAAA,CAAA,IAAA,EAAA,OAAA,CAAA;IAGE,MAAMC,WAAWF,cAAe,CAAAE,QAAA;IAK1B,MAAAC,kBAAA,GACJH,cAAe,CAAAI,SAAA,GAAYJ,cAAe,CAAAK,QAAA;IAE5C,IAAA,CAAKD,YAAYJ,cAAe,CAAAI,SAAA;IAChC,IAAA,CAAKF,QAAW,GAAAA,QAAA;IAChB,IAAA,CAAKG,WAAWL,cAAe,CAAAK,QAAA;IAC1B,IAAA,CAAAC,cAAA,GAAiB,IAAIC,oBAAqB,CAAA;MAC7CC,uBAAuBR,cAAe,CAAAM,cAAA;MACtCG,kBAAoB,EAAAN,kBAAA;MACpBD;IAAA,CACD,CAAA;IACI,IAAA,CAAAQ,aAAA,GAAgB,IAAIH,oBAAqB,CAAA;MAC5CC,uBAAuBR,cAAe,CAAAU,aAAA;MACtCD,kBAAoB,EAAAN,kBAAA;MACpBD;IAAA,CACD,CAAA;IACI,IAAA,CAAAS,GAAA,GAAM,IAAIJ,oBAAqB,CAAA;MAClCC,uBAAuBR,cAAe,CAAAW,GAAA;MACtCF,kBAAoB,EAAAN,kBAAA;MACpBD;IAAA,CACD,CAAA;IACI,IAAA,CAAAU,KAAA,GAAQ,IAAIL,oBAAqB,CAAA;MACpCC,uBAAuBR,cAAe,CAAAY,KAAA;MACtCH,kBAAoB,EAAAN,kBAAA;MACpBD;IAAA,CACD,CAAA;EACH;EAEAW,YAAYR,QAAuC,EAAA;IAEjD,IAAIS,kBAAqB,GAAAC,IAAA,CAAKC,GAAI,CAAAX,QAAA,EAAU,CAAC,CAAA;IAC7CS,kBAAA,GACE,IAAK,CAAAT,QAAA,GAAWS,kBAAsB,IAAA,CAAA,GAAIA,kBAAqB,GAAA,CAAA;IAGjE,IAAA,CAAKT,WAAWU,IAAK,CAAAC,GAAA,CAAI,IAAK,CAAAX,QAAA,GAAWS,oBAAoB,CAAC,CAAA;IAGxD,MAAAG,iBAAA,GAAoB,KAAKb,SAAY,GAAAU,kBAAA;IAEpC,OAAA;MACLV,WAAW,IAAK,CAAAA,SAAA;MAChBF,UAAU,IAAK,CAAAA,QAAA;MACfG,QAAU,EAAAS,kBAAA;MACVR,cAAgB,EAAAY,MAAA,CACd,IAAK,CAAAZ,cAAA,CAAea,QAAS,CAAAF,iBAAA,EAAmB,KAAKf,QAAQ,CAC/D,CAAA;MACAQ,aAAe,EAAAQ,MAAA,CACb,IAAK,CAAAR,aAAA,CAAcS,QAAS,CAAAF,iBAAA,EAAmB,KAAKf,QAAQ,CAC9D,CAAA;MACAS,GAAA,EAAKO,OAAO,IAAK,CAAAP,GAAA,CAAIQ,SAASF,iBAAmB,EAAA,IAAA,CAAKf,QAAQ,CAAC,CAAA;MAC/DU,KAAA,EAAOM,OAAO,IAAK,CAAAN,KAAA,CAAMO,SAASF,iBAAmB,EAAA,IAAA,CAAKf,QAAQ,CAAC;IAAA,CACrE;EACF;AACF;"}
1
+ {"version":3,"file":"productAmount.mjs","sources":["../../../../src/utils/money/allocators/productAmount.ts"],"sourcesContent":["import type { Currency } from \"../../../types\";\nimport { amount } from \"../misc\";\nimport type { Cents, FullLineItemSummary } from \"../types\";\nimport { FixedAmountAllocator } from \"./fixedAmount\";\n\n/**\n * Helper class to distribute a total amount for a product\n */\nexport class ProductAmountAllocator {\n // #############################################################################\n // Fixed values\n // #############################################################################\n readonly #itemPrice: Cents;\n readonly #currency: Currency;\n // #############################################################################\n /**\n * Remaining quantity to allocate\n */\n quantity: number;\n // #############################################################################\n // Specific amount allocators\n // #############################################################################\n #subtotal: FixedAmountAllocator;\n #discountAmount: FixedAmountAllocator;\n #taxableAmount: FixedAmountAllocator;\n #tax: FixedAmountAllocator;\n #total: FixedAmountAllocator;\n\n constructor(productSummary: FullLineItemSummary) {\n const currency = productSummary.currency;\n\n /**\n * Somewhat hackish, just need a stable price that can easily divide later by quantity\n */\n const priceForAllocation =\n productSummary.itemPrice * productSummary.quantity;\n\n this.#itemPrice = productSummary.itemPrice;\n this.#currency = currency;\n this.quantity = productSummary.quantity;\n this.#subtotal = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.subtotal,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n this.#discountAmount = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.discountAmount,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n this.#taxableAmount = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.taxableAmount,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n this.#tax = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.tax,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n this.#total = new FixedAmountAllocator({\n initialAllocateAmount: productSummary.total,\n initialTotalAmount: priceForAllocation,\n currency,\n });\n }\n\n allocateQty(quantity: number): FullLineItemSummary {\n // Calculate remaining allocatable quantity\n let quantityNormalized = Math.max(quantity, 0);\n quantityNormalized =\n this.quantity - quantityNormalized >= 0 ? quantityNormalized : 0;\n\n // Adjust remaining qty\n this.quantity = Math.max(this.quantity - quantityNormalized, 0);\n\n // How big of a slice of the total price we need to allocate\n const itemQuantityPrice = this.#itemPrice * quantityNormalized;\n\n return {\n itemPrice: this.#itemPrice,\n currency: this.#currency,\n quantity: quantityNormalized,\n subtotal: amount(\n this.#subtotal.allocate(itemQuantityPrice, this.#currency),\n ),\n discountAmount: amount(\n this.#discountAmount.allocate(itemQuantityPrice, this.#currency),\n ),\n taxableAmount: amount(\n this.#taxableAmount.allocate(itemQuantityPrice, this.#currency),\n ),\n tax: amount(this.#tax.allocate(itemQuantityPrice, this.#currency)),\n total: amount(this.#total.allocate(itemQuantityPrice, this.#currency)),\n } satisfies FullLineItemSummary;\n }\n}\n"],"names":["_itemPrice","_currency","_subtotal","_discountAmount","_taxableAmount","_tax","_total","ProductAmountAllocator","constructor","productSummary","__privateAdd","__publicField","currency","priceForAllocation","itemPrice","quantity","__privateSet","FixedAmountAllocator","initialAllocateAmount","subtotal","initialTotalAmount","discountAmount","taxableAmount","tax","total","allocateQty","quantityNormalized","Math","max","itemQuantityPrice","__privateGet","amount","allocate","WeakMap"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,EAAAC,SAAA,EAAAC,SAAA,EAAAC,eAAA,EAAAC,cAAA,EAAAC,IAAA,EAAAC,MAAA;AAQO,MAAMC,sBAAuB,CAAA;EAoBlCC,YAAYC,cAAqC,EAAA;IAhBjD;IAAA;IAAA;IAAAC,YAAA,CAAA,IAAA,EAASV,UAAT,EAAA,KAAA,CAAA,CAAA;IACAU,YAAA,CAAA,IAAA,EAAST,SAAT,EAAA,KAAA,CAAA,CAAA;IAKA;IAAA;AAAA;AAAA;IAAAU,aAAA,CAAA,IAAA,EAAA,UAAA,CAAA;IAIA;IAAA;IAAA;IAAAD,YAAA,CAAA,IAAA,EAAAR,SAAA,EAAA,KAAA,CAAA,CAAA;IACAQ,YAAA,CAAA,IAAA,EAAAP,eAAA,EAAA,KAAA,CAAA,CAAA;IACAO,YAAA,CAAA,IAAA,EAAAN,cAAA,EAAA,KAAA,CAAA,CAAA;IACAM,YAAA,CAAA,IAAA,EAAAL,IAAA,EAAA,KAAA,CAAA,CAAA;IACAK,YAAA,CAAA,IAAA,EAAAJ,MAAA,EAAA,KAAA,CAAA,CAAA;IAGE,MAA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AA,CAAA;AACA9B,eAAA,GAAA,IAAA8B,OAAA,CAAA,CAAA;AACA7B,cAAA,GAAA,IAAA6B,OAAA,CAAA,CAAA;AACA5B,IAAA,GAAA,IAAA4B,OAAA,CAAA,CAAA;AACA3B,MAAA,GAAA,IAAA2B,OAAA,CAAA,CAAA;"}
@@ -58,7 +58,7 @@ export interface LineItemSummary {
58
58
  */
59
59
  discountAmount: Cents;
60
60
  /**
61
- * (itemPrice * quantity) - discountAmount
61
+ * subtotal - discountAmount
62
62
  */
63
63
  taxableAmount: Cents;
64
64
  }
@@ -70,12 +70,16 @@ export interface SingleLineItemSummary extends LineItemSummary {
70
70
  quantity: 1;
71
71
  }
72
72
  export interface FullLineItemSummary extends LineItemSummary {
73
+ /**
74
+ * Total price for the given item quantity. Calculated by `(itemPrice * quantity)`
75
+ */
76
+ subtotal: Cents;
73
77
  /**
74
78
  * Total tax amount for the given item quantity.
75
79
  */
76
80
  tax: Cents;
77
81
  /**
78
- * Total price for the given item quantity. Calculated by `(itemPrice * quantity) - discountAmount + tax`
82
+ * Total price for the given item quantity. Calculated by `subtotal - discountAmount + tax`
79
83
  */
80
84
  total: Cents;
81
85
  }
package/package.json CHANGED
@@ -1,22 +1,4 @@
1
1
  {
2
- "name": "@ubnt/store.core",
3
- "version": "9.6.0-alpha.9",
4
- "description": "",
5
- "sideEffects": false,
6
- "scripts": {
7
- "build": "rollup -c && tsc --emitDeclarationOnly",
8
- "build:watch": "nodemon --config ./nodemon.json",
9
- "lint:tsc": "tsc --project ./tsconfig.json",
10
- "prepublishOnly": "npm run build",
11
- "storybook": "start-storybook -p 6008 --no-open",
12
- "storybook:build": "build-storybook",
13
- "test": "echo 'Hi from @ubnt/store.core 👋'"
14
- },
15
- "keywords": [],
16
- "files": [
17
- "lib",
18
- "CHANGELOG.md"
19
- ],
20
2
  "dependencies": {
21
3
  "adm-zip": "0.5.14",
22
4
  "axios": "1.7.2",
@@ -24,6 +6,7 @@
24
6
  "terser": "5.31.1",
25
7
  "tldts": "6.1.31"
26
8
  },
9
+ "description": "",
27
10
  "devDependencies": {
28
11
  "@rollup/plugin-commonjs": "26.0.1",
29
12
  "@rollup/plugin-json": "6.1.0",
@@ -58,6 +41,12 @@
58
41
  "sass-loader": "14.2.1",
59
42
  "style-loader": "4.0.0"
60
43
  },
44
+ "files": [
45
+ "lib",
46
+ "CHANGELOG.md"
47
+ ],
48
+ "keywords": [],
49
+ "name": "@ubnt/store.core",
61
50
  "peerDependencies": {
62
51
  "@dinero.js/currencies": "2.0.0-alpha.8",
63
52
  "@faker-js/faker": "^7.6.0",
@@ -103,5 +92,16 @@
103
92
  "styled-components": {
104
93
  "optional": true
105
94
  }
106
- }
95
+ },
96
+ "scripts": {
97
+ "build": "rollup -c && tsc --emitDeclarationOnly",
98
+ "build:watch": "nodemon --config ./nodemon.json",
99
+ "lint:tsc": "tsc --project ./tsconfig.json",
100
+ "prepublishOnly": "npm run build",
101
+ "storybook": "start-storybook -p 6008 --no-open",
102
+ "storybook:build": "build-storybook",
103
+ "test": "echo 'Hi from @ubnt/store.core 👋'"
104
+ },
105
+ "sideEffects": false,
106
+ "version": "9.7.0-alpha.0"
107
107
  }