@nuskin/ns-product-lib 2.13.0-cx24-5107.3 → 2.13.0-cx24-5107.5

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # [2.13.0-cx24-5107.5](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.13.0-cx24-5107.4...v2.13.0-cx24-5107.5) (2023-09-28)
2
+
3
+
4
+ ### Fix
5
+
6
+ * single variant ([3464822](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/3464822e8b3cbdba7ba576ff19247becb00e8a73))
7
+
8
+ # [2.13.0-cx24-5107.4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.13.0-cx24-5107.3...v2.13.0-cx24-5107.4) (2023-09-28)
9
+
10
+
11
+ ### Fix
12
+
13
+ * data structure issue ([e262ff6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/e262ff66889e28159a68bd7f6916a4bed5fe191c))
14
+ * productData ([fdf13c9](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/fdf13c9634c93a0413163cda297f2080457dad43))
15
+
1
16
  # [2.13.0-cx24-5107.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.13.0-cx24-5107.2...v2.13.0-cx24-5107.3) (2023-09-28)
2
17
 
3
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.13.0-cx24-5107.3",
3
+ "version": "2.13.0-cx24-5107.5",
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": {
@@ -49,8 +49,9 @@ async function getProduct(id, market, locale, config) {
49
49
 
50
50
  try {
51
51
  const { data } = await graphQlHttpRequest(payload);
52
- if (data.productById) {
53
- const product = mapProduct(data.productById, market, locale, config);
52
+
53
+ if (data && data.data && data.data.productById) {
54
+ const product = mapProduct(data.data.productById, market, locale, config);
54
55
  productData.products.push(new Product(product));
55
56
  }
56
57
  } catch (e) {
@@ -160,7 +161,9 @@ function mapProduct(product, market, locale, config) {
160
161
 
161
162
  }
162
163
 
163
- if (variants) {
164
+ //map only if it is normal product
165
+ if (product.variants && !kitBundleProducts) {
166
+ console.log(variants);
164
167
  productDetail.variants = mapVariants(product);
165
168
  }
166
169
 
@@ -189,8 +192,8 @@ function mapProduct(product, market, locale, config) {
189
192
  */
190
193
  function mapVariants(product) {
191
194
 
192
- //return if it is not multi variant
193
- if (!product.variants || (product.variants && product.variants.length === 1)) {
195
+ //return if it has no variant
196
+ if (!product.variants) {
194
197
  return [];
195
198
  }
196
199
 
@@ -251,7 +254,7 @@ function mapVariants(product) {
251
254
  "personalOffer": false,
252
255
  "savedEventName": '',
253
256
  "salesLabel": '',
254
- "eventName": '',
257
+ "eventName": null,
255
258
  "sizeWeight": '',
256
259
  "nettoWeight": "",
257
260
  "searchScore": 0,
@@ -272,7 +275,7 @@ function mapVariants(product) {
272
275
  */
273
276
  function getPromotions(config) {
274
277
  console.log(`config `, config);
275
- return 'event-name';
278
+ return null;
276
279
  }
277
280
 
278
281
  /**