@nuskin/ns-product-lib 2.6.0-cx24-3464.13 → 2.6.0-cx24-3464.14
Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# [2.6.0-cx24-3464.14](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.0-cx24-3464.13...v2.6.0-cx24-3464.14) (2023-03-11)
|
2
|
+
|
3
|
+
|
4
|
+
### Update
|
5
|
+
|
6
|
+
* get child skus to be used for add-to-cart #CX24-3464 ([2ca95d0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/2ca95d0a0f4280ad01d5a39673806d307b185c5b)), closes [#CX24-3464](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3464)
|
7
|
+
|
1
8
|
# [2.6.0-cx24-3464.13](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.0-cx24-3464.12...v2.6.0-cx24-3464.13) (2023-03-11)
|
2
9
|
|
3
10
|
|
package/package.json
CHANGED
@@ -9,7 +9,10 @@ function mapAvailableQuantity(product) {
|
|
9
9
|
}
|
10
10
|
|
11
11
|
if (product.childSkus && product.childSkus.length > 0) {
|
12
|
-
const quantities = product.childSkus
|
12
|
+
const quantities = product.childSkus
|
13
|
+
.filter(cs => cs.inventory !== undefined)
|
14
|
+
.map(cs => cs.inventory.atpQty);
|
15
|
+
|
13
16
|
return Math.min(...quantities);
|
14
17
|
}
|
15
18
|
|
@@ -11,7 +11,7 @@
|
|
11
11
|
* @property {string} type
|
12
12
|
* @property {number} skuQuantity
|
13
13
|
* @property {string} availableChannels
|
14
|
-
* @property {Inventory} inventory
|
14
|
+
* @property {Inventory} [inventory]
|
15
15
|
*
|
16
16
|
* @typedef Inventory
|
17
17
|
* @type {object}
|
@@ -21,5 +21,5 @@
|
|
21
21
|
const availableQuantity = require('./availableQuantity');
|
22
22
|
|
23
23
|
module.exports = {
|
24
|
-
availableQuantity
|
24
|
+
mapAvailableQuantity: availableQuantity
|
25
25
|
};
|
package/src/productData.js
CHANGED
@@ -5,7 +5,7 @@ const contentstack = require('./contentstack/contentstack');
|
|
5
5
|
const Product = require("./product");
|
6
6
|
const CustomerTypes = require('./models/customerTypes');
|
7
7
|
const ProductStatus = require("./models/productStatus");
|
8
|
-
const {
|
8
|
+
const { mapAvailableQuantity } = require('./equinox-helpers');
|
9
9
|
|
10
10
|
const productTypes = {
|
11
11
|
kit: 'kit'
|
@@ -378,7 +378,10 @@ const ProductData = {
|
|
378
378
|
const productPrice = eventName ? defaultProductPrice : product.priceFacets["Regular Price"];
|
379
379
|
const discountedPrice = eventName ? computedPrice : product.priceFacets["Regular Price"];
|
380
380
|
|
381
|
+
product.childSkus = await this.fetchChildSkus(product);
|
382
|
+
product.availableQuantity = mapAvailableQuantity(product);
|
381
383
|
product = {
|
384
|
+
...product,
|
382
385
|
"sku": product.identifier,
|
383
386
|
"globalProductID": productData.identifier,
|
384
387
|
"title": productData.properties.name,
|
@@ -410,7 +413,6 @@ const ProductData = {
|
|
410
413
|
}
|
411
414
|
],
|
412
415
|
"scanQualified": productData.properties.scanQualifiedCount,
|
413
|
-
"availableQuantity": availableQuantity(product),
|
414
416
|
"maxQuantity": 999,
|
415
417
|
"points": "",
|
416
418
|
"cv": (product.priceFacets.CV) ? product.priceFacets.CV : '',
|
@@ -437,7 +439,6 @@ const ProductData = {
|
|
437
439
|
"WHL": product.priceFacets.PV
|
438
440
|
},
|
439
441
|
"orderTypes": this._setOrderType(product.properties),
|
440
|
-
childSkus: await this.fetchChildSkus(product),
|
441
442
|
"custTypes": this.switchCustType(product.properties.customerTypes),
|
442
443
|
"division": productData.properties.division,
|
443
444
|
"backOrderDate": null,
|