@nuskin/ns-product-lib 2.11.0-cx24-5092.12 → 2.11.0-cx24-5092.14

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,18 @@
1
+ # [2.11.0-cx24-5092.14](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.13...v2.11.0-cx24-5092.14) (2023-09-13)
2
+
3
+
4
+ ### New
5
+
6
+ * Moving from AEM to CS for EQ markets ([ce951e1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/ce951e13a6200fa8bdd17baecbc914c51167eeb2))
7
+
8
+ # [2.11.0-cx24-5092.13](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.12...v2.11.0-cx24-5092.13) (2023-09-13)
9
+
10
+
11
+ ### New
12
+
13
+ * Moving from AEM to CS for EQ markets ([fbad8f9](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/fbad8f951e9f40427de8b8538909d5d932770b6f))
14
+ * Moving from AEM to CS for EQ markets ([952d737](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/952d737b55c705f7d88c1ad6beff87a82bc9d314))
15
+
1
16
  # [2.11.0-cx24-5092.12](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.11...v2.11.0-cx24-5092.12) (2023-09-13)
2
17
 
3
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.11.0-cx24-5092.12",
3
+ "version": "2.11.0-cx24-5092.14",
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": {
@@ -24,19 +24,15 @@ const ProductData = {
24
24
  */
25
25
  getProductData: async function (skus, locale, market) {
26
26
  const localeMarket = `${locale}_${market}`;
27
-
27
+ let graphQLResponse;
28
28
 
29
29
  const config = (await getConfiguration(['Equinox_Markets'])).Equinox_Markets;
30
- skus.forEach((sku) => {
31
- const graphQLResponse = ProductGraphQL.getProductFromGraphQL(sku, market, locale)
30
+ if (config.active) {
31
+ graphQLResponse = ProductGraphQL.getProductFromGraphQL(skus[0], market, locale)
32
32
  return graphQLResponse;
33
+ }
33
34
 
34
- })
35
-
36
-
37
-
38
-
39
- if (config.active) {
35
+ if (graphQLResponse) {
40
36
  return await this.getProductFromEquinox(skus, localeMarket, config);
41
37
  }
42
38
 
@@ -2,7 +2,8 @@
2
2
  //const { getConfiguration, getCachedConfigurations } = require('@nuskin/configuration-sdk');
3
3
  const axios = require("axios");
4
4
  //const Product = require("./product");
5
- const getProductGql = require('./graphQl/query')
5
+ const getProductGql = require('./graphQl/query');
6
+
6
7
  const ProductStatus = require("./models/productStatus");
7
8
  const { getEnvironmentFromUrl } = require('@nuskin/ns-common-lib');
8
9
 
@@ -28,6 +29,7 @@ const ProductGraphQL = {
28
29
  },
29
30
  getProductFromGraphQL: async function (id, market, locale) {
30
31
 
32
+
31
33
  const url = this.getProductGraphqlUrl();
32
34
  const payload = {
33
35
  query: getProductGql,
@@ -46,7 +48,10 @@ const ProductGraphQL = {
46
48
  data: {
47
49
  "status": 200,
48
50
  "messages": [],
49
- "data": this.mapResponseToProduct(response.data.data.productById)
51
+ data: {
52
+ count: 1,
53
+ products: [this.mapResponseToProduct(response.data.data.productById)]
54
+ }
50
55
  }
51
56
  }
52
57
  } catch (e) {