@nuskin/ns-product-lib 2.6.0-cx24-3372.2 → 2.6.0-cx24-3372.3

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.6.0-cx24-3372.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.0-cx24-3372.2...v2.6.0-cx24-3372.3) (2023-03-02)
2
+
3
+
4
+ ### Fix
5
+
6
+ * Kit mapping ([af76396](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/af76396940d95988bbcfad73fc047381945847bb))
7
+
1
8
  # [2.6.0-cx24-3372.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.0-cx24-3372.1...v2.6.0-cx24-3372.2) (2023-03-01)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.6.0-cx24-3372.2",
3
+ "version": "2.6.0-cx24-3372.3",
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": {
@@ -331,7 +331,8 @@ const ProductData = {
331
331
  let variants = {};
332
332
 
333
333
  let prodArr = productDataResponse.map((data) => {
334
- let imageURL = data.sku[count].properties.imageURL;
334
+ let product = (data.type && data.type === "kit") ? data : data.sku[count];
335
+ let imageURL = product.properties.imageURL;
335
336
  const regex = /\d+.\d+/
336
337
  let thumbnailImage = ''
337
338
 
@@ -354,15 +355,15 @@ const ProductData = {
354
355
  eventLabels,
355
356
  computedPrice,
356
357
  defaultProductPrice
357
- } = this.getEqProductPromotions(data.sku[count]);
358
- const productPrice = eventName ? defaultProductPrice : data.sku[count].priceFacets["Regular Price"];
359
- const discountedPrice = eventName ? computedPrice : data.sku[count].priceFacets["Regular Price"];
358
+ } = this.getEqProductPromotions(product);
359
+ const productPrice = eventName ? defaultProductPrice : product.priceFacets["Regular Price"];
360
+ const discountedPrice = eventName ? computedPrice : product.priceFacets["Regular Price"];
360
361
 
361
362
  prod = {
362
- "sku": data.sku[count].identifier,
363
+ "sku": product.identifier,
363
364
  "globalProductID": data.identifier,
364
365
  "title": data.properties.name,
365
- "country": data.sku[count].properties.market,
366
+ "country": product.properties.market,
366
367
  "language": "en",
367
368
  "shortDescr": data.properties.description,
368
369
  "longDescr": data.properties.productDetailsDescription,
@@ -379,7 +380,7 @@ const ProductData = {
379
380
  "ingredients": data.properties.ingredients,
380
381
  "benefits": data.properties.benefits,
381
382
  "usage": data.properties.usage,
382
- "resources": data.sku[count].properties.resources,
383
+ "resources": product.properties.resources,
383
384
  "videos": "",
384
385
  "movie": "",
385
386
  "youtube": "",
@@ -390,48 +391,48 @@ const ProductData = {
390
391
  }
391
392
  ],
392
393
  "scanQualified": data.properties.scanQualifiedCount,
393
- "availableQuantity": data.sku[count].inventoryProperties.atpQty,
394
+ "availableQuantity": product.inventoryProperties.atpQty,
394
395
  "maxQuantity": 999,
395
396
  "points": "",
396
- "cv": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : '',
397
- "pv": data.sku[count].priceFacets.PV,
397
+ "cv": (product.priceFacets.CV) ? product.priceFacets.CV : '',
398
+ "pv": product.priceFacets.PV,
398
399
  "priceType": "WRTL",
399
400
  "price": discountedPrice,
400
401
  "priceMap": {
401
402
  "WRTL": productPrice,
402
- "WADW-WRTL": data.sku[count].priceFacets["Regular Price"],
403
- "WADR": data.sku[count].priceFacets["Regular Price"],
404
- "RTL": data.sku[count].priceFacets["Regular Price"],
405
- "WADW": data.sku[count].priceFacets["Wholesale Price"],
406
- "WHL": data.sku[count].priceFacets["Wholesale Price"],
407
- "WWHL": data.sku[count].priceFacets["Wholesale Price"]
403
+ "WADW-WRTL": product.priceFacets["Regular Price"],
404
+ "WADR": product.priceFacets["Regular Price"],
405
+ "RTL": product.priceFacets["Regular Price"],
406
+ "WADW": product.priceFacets["Wholesale Price"],
407
+ "WHL": product.priceFacets["Wholesale Price"],
408
+ "WWHL": product.priceFacets["Wholesale Price"]
408
409
  },
409
410
  "cvMap": {
410
- "WWHL": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : '',
411
- "WADW": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : '',
412
- "WHL": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : ''
411
+ "WWHL": (product.priceFacets.CV) ? product.priceFacets.CV : '',
412
+ "WADW": (product.priceFacets.CV) ? product.priceFacets.CV : '',
413
+ "WHL": (product.priceFacets.CV) ? product.priceFacets.CV : ''
413
414
  },
414
415
  "pvMap": {
415
- "WWHL": data.sku[count].priceFacets.PV,
416
- "WADW": data.sku[count].priceFacets.PV,
417
- "WHL": data.sku[count].priceFacets.PV
416
+ "WWHL": product.priceFacets.PV,
417
+ "WADW": product.priceFacets.PV,
418
+ "WHL": product.priceFacets.PV
418
419
  },
419
- "orderTypes": this._setOrderType(data.sku[count].properties),
420
+ "orderTypes": this._setOrderType(product.properties),
420
421
  "childSkus": [],
421
- "custTypes": this.switchCustType(data.sku[count].properties.customerTypes),
422
+ "custTypes": this.switchCustType(product.properties.customerTypes),
422
423
  "division": data.properties.division,
423
424
  "backOrderDate": null,
424
425
  "locallyProduced": false,
425
426
  "agelocme": null,
426
427
  "count": "",
427
428
  "flavor": "",
428
- "size": data.sku[count].properties.size,
429
+ "size": product.properties.size,
429
430
  "shade": "",
430
- "status": this.switchStatusFromEquinox(data.sku[count].properties.productStatus),
431
+ "status": this.switchStatusFromEquinox(product.properties.productStatus),
431
432
  "variantType": "Other",
432
- "variantDropdownLabel": data.sku[count].properties.variantLabel || "",
433
+ "variantDropdownLabel": product.properties.variantLabel || "",
433
434
  "variantDropdownPlaceholder": "Select Type",
434
- "variantsLabel": data.sku[count].properties.variantLabel || "",
435
+ "variantsLabel": product.properties.variantLabel || "",
435
436
  "groupOffer": false,
436
437
  "personalOffer": false,
437
438
  "savedEventName": eventName,
@@ -441,7 +442,7 @@ const ProductData = {
441
442
  "nettoWeight": "",
442
443
  "variants": variants,
443
444
  "searchScore": 0,
444
- "isExclusive": data.sku[count].properties.isExclusive || false,
445
+ "isExclusive": product.properties.isExclusive || false,
445
446
  "marketAttributes": {
446
447
  "discount": true,
447
448
  "redeem": true,
@@ -449,7 +450,7 @@ const ProductData = {
449
450
  },
450
451
  "restrictedMarkets": [],
451
452
  "addOns": [],
452
- "inventory": data.sku[count].inventory || "", //inventory label
453
+ "inventory": product.inventory || "", //inventory label
453
454
  "equinoxProductId": data.identifier
454
455
  };
455
456
  let newProduct = new Product(prod);