@nuskin/ns-product-lib 2.10.0 → 2.10.1

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.10.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.10.0...v2.10.1) (2023-08-31)
2
+
3
+
4
+ ### Fix
5
+
6
+ * [EQ] backOrderDate is not showing in MySite/PO product card (#CX24-4922) ([99e54dd](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/99e54dd58f8e6f2509d50b1440b94a097ae406c4)), closes [#CX24-4922](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-4922)
7
+
1
8
  # [2.10.0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.9.3...v2.10.0) (2023-08-09)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.10.0",
3
+ "version": "2.10.1",
4
4
  "description": "This project contains shared Product models and code between the backend and frontend.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -0,0 +1,18 @@
1
+
2
+
3
+ /**
4
+ * backOrderDate returns backorder date if product inventory status is BACKORDER.
5
+ * @param {import('./').Product} product
6
+ * @param {*} product
7
+ * @returns {number}
8
+ */
9
+ function backOrderDate(product) {
10
+ if (product.inventoryProperties && product.inventoryProperties.hasOwnProperty('expectedBackOrderAvailabilityDate')) {
11
+ return product.inventoryProperties.expectedBackOrderAvailabilityDate;
12
+ }
13
+
14
+ return 0;
15
+ }
16
+
17
+
18
+ module.exports = backOrderDate;
@@ -198,11 +198,13 @@
198
198
  * @property {string} sku
199
199
  * @property {number} qty
200
200
  */
201
+ const backOrderDate = require('./backOrderDate');
201
202
  const availableQuantity = require('./availableQuantity');
202
203
  const childSKU = require('./childSKU');
203
204
  const childSKUBundles = require('./childSKUBundles');
204
205
 
205
206
  module.exports = {
207
+ mapBackOrderDate: backOrderDate,
206
208
  mapAvailableQuantity: availableQuantity,
207
209
  mapChildSKU: childSKU,
208
210
  mapChildSKUBundle: childSKUBundles
@@ -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 { mapAvailableQuantity, mapChildSKU, mapChildSKUBundle } = require('./equinox-helpers');
8
+ const { mapBackOrderDate, mapAvailableQuantity, mapChildSKU, mapChildSKUBundle } = require('./equinox-helpers');
9
9
  const { productNotFoundInterceptor } = require('./equinox-helpers/interceptors');
10
10
 
11
11
  const productTypes = {
@@ -140,6 +140,7 @@ const ProductData = {
140
140
  * Get available product quantity
141
141
  * If backOrdered === true, use backOrderedQty
142
142
  * else use atpQty
143
+ * @todo deprecate this and try using equinox-helpers/availableQuantity.js
143
144
  * @param {obj} inventory
144
145
  * @returns {number} qty
145
146
  */
@@ -306,7 +307,7 @@ const ProductData = {
306
307
  "orderTypes": this._setOrderType(eqVariant.properties),
307
308
  "custTypes": this.switchCustType(eqVariant.properties.customerTypes),
308
309
  "division": eqVariant.properties.division,
309
- "backOrderDate": null,
310
+ "backOrderDate": mapBackOrderDate(eqVariant),
310
311
  "locallyProduced": false,
311
312
  "agelocme": null,
312
313
  "count": "",
@@ -491,7 +492,7 @@ const ProductData = {
491
492
  "orderTypes": this._setOrderType(product.properties),
492
493
  "custTypes": this.switchCustType(product.properties.customerTypes),
493
494
  "division": productData.properties.division,
494
- "backOrderDate": null,
495
+ "backOrderDate": mapBackOrderDate(product),
495
496
  "locallyProduced": false,
496
497
  "agelocme": null,
497
498
  "count": "",