@nuskin/ns-product-lib 2.9.2 → 2.9.3
Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## [2.9.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.9.2...v2.9.3) (2023-08-03)
|
2
|
+
|
3
|
+
|
4
|
+
### Fix
|
5
|
+
|
6
|
+
* backorder Qty for single product and kits (#CX24-4771) ([23715f2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/23715f22728edef2f5936405e7d567e44a2a8cf8)), closes [#CX24-4771](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-4771)
|
7
|
+
* backorder Qty for single product and kits (#CX24-4771) ([98f44ec](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/98f44ec2eb1013bb484feeda6b27d111971e3e16)), closes [#CX24-4771](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-4771)
|
8
|
+
|
9
|
+
### Release
|
10
|
+
|
11
|
+
* Automated changes by GitLab pipeline [skip ci] ([fb7c96c](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/fb7c96c18c1994526a584ff0ad2da24daf013646))
|
12
|
+
|
1
13
|
## [2.9.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.9.1...v2.9.2) (2023-07-31)
|
2
14
|
|
3
15
|
|
package/package.json
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
*/
|
6
6
|
function availableQuantity(product) {
|
7
7
|
if (product.inventoryProperties) {
|
8
|
-
return product.inventoryProperties.atpQty;
|
8
|
+
return product.inventoryProperties.backOrdered ? product.inventoryProperties.backOrderedQty : product.inventoryProperties.atpQty;
|
9
9
|
}
|
10
10
|
|
11
11
|
if (product.childSkus && product.childSkus.length > 0) {
|
12
12
|
const quantities = product.childSkus
|
13
13
|
.filter(cs => cs.inventory !== undefined)
|
14
|
-
.map(cs => cs.inventory.atpQty);
|
14
|
+
.map(cs => cs.inventory.backOrdered ? cs.inventory.backOrderedQty : cs.inventory.atpQty);
|
15
15
|
|
16
16
|
return Math.min(...quantities);
|
17
17
|
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
/**
|
2
2
|
* childSKU maps a product variant. Used mainly in subscription.
|
3
3
|
*
|
4
|
-
* @param {import('.').KitSKUQuantity[]} kits
|
5
|
-
* @param {import('.').EquinoxNormalProduct} product
|
4
|
+
* @param {import('.').KitSKUQuantity[]} kits
|
5
|
+
* @param {import('.').EquinoxNormalProduct} product
|
6
6
|
*/
|
7
7
|
function childSKU(kits, product) {
|
8
8
|
const sku = product.sku.filter(sku => sku.default)[0];
|
@@ -23,7 +23,8 @@ function childSKU(kits, product) {
|
|
23
23
|
availableChannels: sku.properties.availableChannels,
|
24
24
|
inventory: {
|
25
25
|
atpQty: sku.inventoryProperties.atpQty,
|
26
|
-
backOrdered: sku.inventoryProperties.backOrdered
|
26
|
+
backOrdered: sku.inventoryProperties.backOrdered,
|
27
|
+
backOrderedQty: sku.inventoryProperties.backOrderedQty
|
27
28
|
}
|
28
29
|
}
|
29
30
|
}
|
package/src/productData.js
CHANGED
@@ -143,7 +143,6 @@ const ProductData = {
|
|
143
143
|
* @returns {number} qty
|
144
144
|
*/
|
145
145
|
getAvailableQty: function(inventory) {
|
146
|
-
// const inventory = Object.create(inventoryProperties);
|
147
146
|
if (!inventory || (!inventory.hasOwnProperty('backOrdered')
|
148
147
|
|| !inventory.hasOwnProperty('atpQty') || !inventory.hasOwnProperty('backOrderedQty'))) {
|
149
148
|
return 0;
|
@@ -519,7 +518,7 @@ const ProductData = {
|
|
519
518
|
},
|
520
519
|
"restrictedMarkets": [],
|
521
520
|
"addOns": [],
|
522
|
-
"inventory": product.inventory || "", //inventory label
|
521
|
+
"inventory": product.inventory || product.properties.inventoryStatus || "", //inventory label,
|
523
522
|
"equinoxProductId": productData.identifier,
|
524
523
|
"properties": product.properties,
|
525
524
|
equinox: {
|