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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
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
+
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)
10
+
11
+
12
+ ### New
13
+
14
+ * Moving from AEM to CS for EQ markets ([a55c20f](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/a55c20fbd26268215a6d79bc43b818704730c1b3))
15
+ * Moving from AEM to CS for EQ markets ([b58bab6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/b58bab6b7ef78e0444a3f918afc844772de832f8))
16
+
1
17
  # [2.11.0-cx24-5092.16](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.15...v2.11.0-cx24-5092.16) (2023-09-14)
2
18
 
3
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.11.0-cx24-5092.16",
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": {
@@ -28,16 +28,12 @@ const ProductData = {
28
28
 
29
29
  const config = (await getConfiguration(['Equinox_Markets'])).Equinox_Markets;
30
30
  if (config.active) {
31
- graphQLResponse = await ProductGraphQL.getProductFromGraphQL(skus[0], market, locale, config)
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) {
@@ -27,7 +27,7 @@ const ProductGraphQL = {
27
27
  return "https://www.nuskin.com/product-api/graphql";
28
28
  }
29
29
  },
30
- getProductFromGraphQL: async function (id, market, locale, config) {
30
+ getProductFromGraphQL: async function (id, market, locale) {
31
31
 
32
32
 
33
33
  const url = this.getProductGraphqlUrl();
@@ -37,37 +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
- const productId = response.data.data.productById.id
48
- const sku = response.data.data.productById.variants[0].sku
49
- const promotionResponse = await this.getProductPromotions(sku, productId, config, locale)
50
- console.log(JSON.stringify(promotionResponse))
51
- return {
40
+
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": [],
52
56
  data: {
53
- "status": 200,
54
- "messages": [],
55
- data: {
56
- count: 1,
57
- products: [this.mapResponseToProduct(response.data.data.productById)]
58
- }
57
+ count: 1,
58
+ products: products
59
59
  }
60
60
  }
61
- } catch (e) {
62
- return {
63
- status: 404,
64
- messages: ["Error getting product details in Contentstack"],
65
- data: { count: 0, products: [] }
66
- };
67
61
  }
68
62
 
69
63
 
70
64
 
65
+
71
66
  },
72
67
 
73
68
  getProductPromotions: async function (sku, productId, config, locale) {