@nuskin/ns-product-lib 2.8.0 → 2.8.1
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 +7 -0
- package/package.json +1 -1
- package/src/productData.js +9 -5
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [2.8.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.8.0...v2.8.1) (2023-05-23)
|
2
|
+
|
3
|
+
|
4
|
+
### Fix
|
5
|
+
|
6
|
+
* Multiple variants add to cart not adding correct sku ([968ed05](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/968ed055b5f5024579ac256f26c0d58ba409fcb9))
|
7
|
+
|
1
8
|
# [2.8.0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.1...v2.8.0) (2023-05-02)
|
2
9
|
|
3
10
|
|
package/package.json
CHANGED
package/src/productData.js
CHANGED
@@ -364,8 +364,9 @@ const ProductData = {
|
|
364
364
|
let variants = {};
|
365
365
|
let product = (productData.type && productData.type === "kit") ? productData : productData.sku[count];
|
366
366
|
let imageURL = product.properties.imageURL ? product.properties.imageURL : '';
|
367
|
-
let thumbnailImage = imageURL ? imageURL + '?width=40' : ''
|
368
|
-
|
367
|
+
let thumbnailImage = imageURL ? imageURL + '?width=40' : '';
|
368
|
+
let productTitle = productData.properties.name;
|
369
|
+
let productSku = product.identifier
|
369
370
|
|
370
371
|
if (productData.sku && productData.sku.length > 1) {
|
371
372
|
// exclude base product from variants
|
@@ -373,6 +374,9 @@ const ProductData = {
|
|
373
374
|
variants[variant.identifier] = this.eqProductVariantMapper(variant);
|
374
375
|
return variant;
|
375
376
|
});
|
377
|
+
const productArr = productData.sku.filter(p => p.default === true)
|
378
|
+
productTitle = productArr[0].properties.name;
|
379
|
+
productSku = productArr[0].identifier
|
376
380
|
}
|
377
381
|
|
378
382
|
const {
|
@@ -394,9 +398,9 @@ const ProductData = {
|
|
394
398
|
product.availableQuantity = mapAvailableQuantity(product);
|
395
399
|
product = {
|
396
400
|
...product,
|
397
|
-
"sku":
|
401
|
+
"sku": productSku,
|
398
402
|
"globalProductID": productData.identifier,
|
399
|
-
"title":
|
403
|
+
"title": productTitle,
|
400
404
|
"country": product.properties.market,
|
401
405
|
"language": "en",
|
402
406
|
"shortDescr": productData.properties.description,
|
@@ -513,7 +517,7 @@ const ProductData = {
|
|
513
517
|
};
|
514
518
|
},
|
515
519
|
|
516
|
-
mapEquinoxSKUExists: function(exists) {
|
520
|
+
mapEquinoxSKUExists: function (exists) {
|
517
521
|
// this could be avoided if only we are using response mapper
|
518
522
|
// for equinox products that exists.
|
519
523
|
// @todo: clean-up
|