@nuskin/ns-product-lib 2.11.0-cx24-5092.17 → 2.11.0-cx24-5092.18

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # [2.11.0-cx24-5092.18](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.17...v2.11.0-cx24-5092.18) (2023-09-14)
2
+
3
+
4
+ ### New
5
+
6
+ * Moving from AEM to CS for EQ markets ([fbcefec](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/fbcefec2c6ffee1f3b043281027f882da704502a))
7
+ * Moving from AEM to CS for EQ markets ([4f10a1a](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/4f10a1a88ace28ab3a8e45f8212d67534737a6a3))
8
+
1
9
  # [2.11.0-cx24-5092.17](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.16...v2.11.0-cx24-5092.17) (2023-09-14)
2
10
 
3
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.11.0-cx24-5092.17",
3
+ "version": "2.11.0-cx24-5092.18",
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": {
@@ -31,13 +31,9 @@ const ProductData = {
31
31
  graphQLResponse = await ProductGraphQL.getProductFromGraphQL(skus[0], market, locale)
32
32
  console.log(graphQLResponse)
33
33
  return graphQLResponse;
34
+ } else {
35
+ return await this.getProductFromLegacy(skus, localeMarket);
34
36
  }
35
-
36
- if (graphQLResponse) {
37
- return await this.getProductFromEquinox(skus, localeMarket, config);
38
- }
39
-
40
- return await this.getProductFromLegacy(skus, localeMarket);
41
37
  },
42
38
 
43
39
  getProductFromEquinox: async function (skus, locale, config) {
@@ -37,34 +37,32 @@ const ProductGraphQL = {
37
37
  operationName: "getProduct",
38
38
  useContentSource: "CS"
39
39
  }
40
- try {
41
- const response = await axios.request({
42
- method: 'post',
43
- url: url,
44
- data: payload,
45
- responseType: 'json'
46
- });
47
40
 
48
- return {
41
+ const response = await axios.request({
42
+ method: 'post',
43
+ url: url,
44
+ data: payload,
45
+ responseType: 'json'
46
+ });
47
+
48
+ console.log(response.data)
49
+ let products = [];
50
+ products.push(this.mapResponseToProduct(response.data.data.productById))
51
+
52
+ return {
53
+ data: {
54
+ "status": 200,
55
+ "messages": [],
49
56
  data: {
50
- "status": 200,
51
- "messages": [],
52
- data: {
53
- count: 1,
54
- products: [this.mapResponseToProduct(response.data.data.productById)]
55
- }
57
+ count: 1,
58
+ products: products
56
59
  }
57
60
  }
58
- } catch (e) {
59
- return {
60
- status: 404,
61
- messages: ["Error getting product details in Contentstack"],
62
- data: { count: 0, products: [] }
63
- };
64
61
  }
65
62
 
66
63
 
67
64
 
65
+
68
66
  },
69
67
 
70
68
  getProductPromotions: async function (sku, productId, config, locale) {