@nuskin/ns-product-lib 2.21.3 → 2.21.4
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/package.json +1 -1
- package/src/product.js +5 -1
- package/src/productData.js +1 -3
package/package.json
CHANGED
package/src/product.js
CHANGED
|
@@ -450,6 +450,10 @@ const Product = function (productData) {
|
|
|
450
450
|
return this.custTypes.includes("30");
|
|
451
451
|
};
|
|
452
452
|
|
|
453
|
+
this.isBase = function () {
|
|
454
|
+
return this.variantSkus().length > 0;
|
|
455
|
+
};
|
|
456
|
+
|
|
453
457
|
this.isVariant = function () {
|
|
454
458
|
return this.baseSku.length > 0 && this.variantSkus().length === 0;
|
|
455
459
|
};
|
|
@@ -575,7 +579,7 @@ const Product = function (productData) {
|
|
|
575
579
|
this.thumbnail = ProductUtils.applyBaseUrl(this.thumbnail, baseUrl);
|
|
576
580
|
this.fullImage = ProductUtils.applyBaseUrl(this.fullImage, baseUrl);
|
|
577
581
|
|
|
578
|
-
if (this.
|
|
582
|
+
if (this.isBase()) {
|
|
579
583
|
for (const variantSku in this.variants) {
|
|
580
584
|
const variant = this.variants[variantSku];
|
|
581
585
|
variant.setBaseUrl(baseUrl);
|
package/src/productData.js
CHANGED
|
@@ -426,10 +426,8 @@ const ProductData = {
|
|
|
426
426
|
let productSku = product.identifier
|
|
427
427
|
|
|
428
428
|
if (productData.sku && productData.sku.length > 1) {
|
|
429
|
-
|
|
430
|
-
productData.sku.filter(v => !v.default).map(variant => {
|
|
429
|
+
productData.sku.forEach(variant => {
|
|
431
430
|
variants[variant.identifier] = this.eqProductVariantMapper(variant);
|
|
432
|
-
return variant;
|
|
433
431
|
});
|
|
434
432
|
const productArr = productData.sku.filter(p => p.default === true)
|
|
435
433
|
productTitle = productArr[0].properties.name;
|