@nuskin/ns-product-lib 2.11.0-cx24-5092.25 → 2.11.0-cx24-5092.26

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [2.11.0-cx24-5092.26](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.25...v2.11.0-cx24-5092.26) (2023-09-18)
2
+
3
+
4
+ ### New
5
+
6
+ * Moving from AEM to CS for EQ markets ([cb2a5b3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/cb2a5b3087fb6ee00e5bcd0b95ae67c16eaf7b1d))
7
+
1
8
  # [2.11.0-cx24-5092.25](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.24...v2.11.0-cx24-5092.25) (2023-09-18)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.11.0-cx24-5092.25",
3
+ "version": "2.11.0-cx24-5092.26",
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": {
@@ -11,6 +11,7 @@ const { getEnvironmentFromUrl } = require('@nuskin/ns-common-lib');
11
11
 
12
12
 
13
13
 
14
+
14
15
  const ProductGraphQL = {
15
16
  getProductGraphqlUrl: function () {
16
17
  const env = getEnvironmentFromUrl(window.location.host);
@@ -99,16 +100,18 @@ const ProductGraphQL = {
99
100
  },
100
101
 
101
102
  mapResponseToProduct: async function (response, market, locale, config) {
102
- console.log('RESPONSE ' + JSON.stringify(response))
103
+ //console.log('RESPONSE ' + JSON.stringify(response))
103
104
  let res;
104
105
  if (response.variants.length >= 1) {
105
106
  res = await this.mapProductRegular(response, market, locale, config)
106
107
  }
107
108
  if (response.bundles) {
108
- //nothing to do yet
109
+ res = await this.mapProductBundle(response, market.locale, config)
109
110
  }
110
111
 
111
- const promotions = await this.getProductPromotions(response.variants[0].sku, response.variants[0].id, config, locale)
112
+ const productID = (response.id) ? response.id : response.variants[0].id
113
+
114
+ const promotions = await this.getProductPromotions(response.variants[0].sku, productID, config, locale)
112
115
  console.log(promotions)
113
116
  return res;
114
117
  },
@@ -263,9 +266,7 @@ const ProductGraphQL = {
263
266
  },
264
267
  mapProductBundle: async function (response, market, locale) {
265
268
  let res;
266
- response.bundle.kitProducts.forEach((product) => {
267
- res = this.mapProductRegular(product, market, locale)
268
- })
269
+ res = this.mapProductRegular(response.bundles.kitProducts[0].product, market, locale)
269
270
  return res;
270
271
  },
271
272
  /**