@nuskin/ns-product-lib 2.14.4-cx15-10535.1 → 2.14.5

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.14.4-cx15-10535.1",
3
+ "version": "2.14.5",
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": {
@@ -19,24 +19,34 @@
19
19
  "license": "ISC",
20
20
  "homepage": "https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/blob/master/README.md",
21
21
  "devDependencies": {
22
+ "@nuskin/configuration-sdk": "2.3.2",
23
+ "@nuskin/ns-common-lib": "1.4.7",
24
+ "@nuskin/ns-util": "4.5.3",
25
+ "axios": ">=1.6.5",
22
26
  "axios-mock-adapter": "1.21.2",
23
- "eslint": "5.16.0",
24
- "eslint-config-google": "0.14.0",
25
- "eslint-config-prettier": "4.1.0",
26
- "eslint-plugin-json": "2.1.1",
27
- "eslint-plugin-prettier": "3.1.2",
28
- "jest": "29.2.2",
29
- "jest-environment-jsdom": "29.2.2",
27
+ "eslint": "^8.56.0",
28
+ "eslint-config-google": "^0.14.0",
29
+ "eslint-config-prettier": "^9.1.0",
30
+ "eslint-plugin-json": "^3.1.0",
31
+ "eslint-plugin-prettier": "^5.1.3",
32
+ "jest": "29.7.0",
33
+ "jest-environment-jsdom": "29.7.0",
30
34
  "jest-sonar-reporter": "2.0.0",
31
35
  "prettier": "1.19.1"
32
36
  },
37
+ "peerDependencies": {
38
+ "@nuskin/configuration-sdk": "2.x",
39
+ "@nuskin/ns-common-lib": "1.x",
40
+ "@nuskin/ns-util": "4.x",
41
+ "axios": ">=1.6.5"
42
+ },
33
43
  "dependencies": {
34
- "@nuskin/configuration-sdk": "^2.3.2",
35
- "@nuskin/ns-common-lib": "^1.4.7",
36
- "@nuskin/ns-util": "^4.5.3",
37
- "axios": "0.27.2",
38
44
  "qs": "6.11.0"
39
45
  },
46
+ "resolutions": {
47
+ "word-wrap": "1.2.4",
48
+ "follow-redirects": "1.15.4"
49
+ },
40
50
  "files": [
41
51
  "src/"
42
52
  ]
@@ -5,7 +5,7 @@ const config = require('./environment');
5
5
 
6
6
  // contentstack HTTP service
7
7
  const platform = usePlatformSpecificVariables();
8
- const http = axios.create({ baseURL: platform.baseURL, headers: platform.headers });
8
+ const http = (axios.create || axios.default.create)({ baseURL: platform.baseURL, headers: platform.headers });
9
9
 
10
10
  // usePlatformVariables returns an object with platform-specific values; defaults to Lambda environment
11
11
  function usePlatformSpecificVariables() {
@@ -7,7 +7,7 @@
7
7
  * @returns {number}
8
8
  */
9
9
  function backOrderDate(product) {
10
- if (product.inventoryProperties && product.inventoryProperties.hasOwnProperty('expectedBackOrderAvailabilityDate')) {
10
+ if (product.inventoryProperties && product.inventoryProperties.expectedBackOrderAvailabilityDate) {
11
11
  return product.inventoryProperties.expectedBackOrderAvailabilityDate;
12
12
  }
13
13
 
@@ -15,7 +15,7 @@ function mapVariantProperties(properties = {}) {
15
15
  model.title = mapTitle(properties.title);
16
16
  model.scanQualifiedCount = mapScanQualifiedCount(properties.scanQualifiedCount);
17
17
  model.division = mapDivision(properties.division);
18
- model.isExclusive = mapIsExclusive('false',);
18
+ model.isExclusive = mapIsExclusive('false');
19
19
  model.imageURL = mapImageURL(properties.imageURL);
20
20
  model.customerTypes = mapCustomerTypes(properties.customerTypes);
21
21
  model.ingredients = mapIngredients(properties.ingredients);
package/src/product.js CHANGED
@@ -448,7 +448,7 @@ const Product = function (productData) {
448
448
  };
449
449
 
450
450
  this.isBase = function () {
451
- return this.sku.substring(2, 4) === "55" && this.variantSkus().length > 0;
451
+ return this.sku.substring(2, 4) === "55";
452
452
  };
453
453
 
454
454
  this.isVariant = function () {
@@ -144,8 +144,10 @@ const ProductData = {
144
144
  * @returns {number} qty
145
145
  */
146
146
  getAvailableQty: function (inventory) {
147
- if (!inventory || (!inventory.hasOwnProperty('backOrdered')
148
- || !inventory.hasOwnProperty('atpQty') || !inventory.hasOwnProperty('backOrderedQty'))) {
147
+ if (!inventory || (!Object.prototype.hasOwnProperty.call(inventory, 'backOrdered')
148
+ || !Object.prototype.hasOwnProperty.call(inventory, 'atpQty')
149
+ || !Object.prototype.hasOwnProperty.call(inventory, 'backOrderedQty'))
150
+ ) {
149
151
  return 0;
150
152
  }
151
153