@nuskin/ns-product-lib 2.11.0-cx24-5092.32 → 2.11.0-cx24-5092.34

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [2.11.0-cx24-5092.34](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.33...v2.11.0-cx24-5092.34) (2023-09-19)
2
+
3
+
4
+ ### New
5
+
6
+ * Moving from AEM to CS for EQ markets ([9f649ff](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9f649ff3b0e5f6e076d2bdbf429c24b45e685ff6))
7
+
8
+ # [2.11.0-cx24-5092.33](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.32...v2.11.0-cx24-5092.33) (2023-09-19)
9
+
10
+
11
+ ### New
12
+
13
+ * Moving from AEM to CS for EQ markets ([48df449](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/48df44948eced5679da2d0d268d0c628b620b30a))
14
+
1
15
  # [2.11.0-cx24-5092.32](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.31...v2.11.0-cx24-5092.32) (2023-09-19)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.11.0-cx24-5092.32",
3
+ "version": "2.11.0-cx24-5092.34",
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": {
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  //const { getConfiguration, getCachedConfigurations } = require('@nuskin/configuration-sdk');
3
3
  const axios = require("axios");
4
- //const Product = require("./product");
4
+ const Product = require("./product");
5
5
  const getProductGql = require('./graphQl/query');
6
6
 
7
+
7
8
  const ProductStatus = require("./models/productStatus");
8
9
  const { getEnvironmentFromUrl } = require('@nuskin/ns-common-lib');
9
10
 
@@ -48,7 +49,7 @@ const ProductGraphQL = {
48
49
 
49
50
  let products = [];
50
51
  let mappedResponse = await this.mapResponseToProduct(response.data.data.productById, market, locale, config)
51
- products.push(mappedResponse)
52
+ products.push(new Product(mappedResponse))
52
53
 
53
54
 
54
55
 
@@ -119,7 +120,7 @@ const ProductGraphQL = {
119
120
 
120
121
  mapProductRegular: async function (response, market, locale) {
121
122
  let res = {
122
- "sku": response.variants[0].id,
123
+ "sku": response.variants[0].sku,
123
124
  "globalProductID": response.id,
124
125
  "title": response.variants[0].title,
125
126
  "country": market,
@@ -268,6 +269,17 @@ const ProductGraphQL = {
268
269
  mapProductBundle: async function (response, market, locale) {
269
270
  let res;
270
271
  res = this.mapProductRegular(response.bundle.kitProducts[0].product, market, locale)
272
+ res.priceMap = {
273
+ "WRTL": (response.bundle.totalPrice) ? response.bundle.totalPrice.retail : response.bundle.price.retail,
274
+ "WADW-WRTL": (response.bundle.totalPrice) ? response.bundle.totalPrice.retailSubscription : response.bundle.price.retail,
275
+ "WADR": (response.bundle.totalPrice) ? response.bundle.totalPrice.retailSubscription : response.bundle.price.retailSubscription, //retail ADR (subscription) price
276
+ "RTL": (response.bundle.totalPrice) ? response.bundle.totalPrice.retail : response.bundle.price.retail,
277
+ "WWHL": (response.bundle.totalPrice) ? response.bundle.totalPrice.wholesale : response.bundle.price.wholesale,
278
+ "WADW": (response.bundle.totalPrice) ? response.bundle.totalPrice.wholesaleSubscription : response.bundle.price.wholesaleSubscription,//wholesale ADR (subscription price)
279
+ "WHL": (response.bundle.totalPrice) ? response.bundle.totalPrice.wholesale : response.bundle.price.wholesale
280
+ }
281
+ res.status = this.switchStatusFromEquinox(response.bundle.status.status)
282
+
271
283
  return res;
272
284
  },
273
285
  /**