@nuskin/product-components 3.19.1 → 3.19.2-mdigi-9080.2
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/.releaserc +1 -1
- package/docs/CHANGELOG.md +1 -1
- package/mixins/NsProductMixin.js +44 -0
- package/package.json +1 -1
package/.releaserc
CHANGED
package/docs/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
## [3.19.
|
|
1
|
+
## [3.19.2-mdigi-9080.2](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.19.2-mdigi-9080.1...v3.19.2-mdigi-9080.2) (2025-12-15)
|
package/mixins/NsProductMixin.js
CHANGED
|
@@ -350,6 +350,16 @@ const NsProductMixin = {
|
|
|
350
350
|
},
|
|
351
351
|
methods: {
|
|
352
352
|
async init() {
|
|
353
|
+
const uniqueProduct = this.getUniqueProduct();
|
|
354
|
+
const productsList = Array.isArray(uniqueProduct.products)
|
|
355
|
+
? uniqueProduct.products
|
|
356
|
+
: [];
|
|
357
|
+
const idValue = productsList
|
|
358
|
+
.map(item => item.sku)
|
|
359
|
+
.filter(Boolean)
|
|
360
|
+
.map(String);
|
|
361
|
+
this.active = idValue.length ? idValue : this.sku;
|
|
362
|
+
console.log("the value is of Id is ...... " + this.sku);
|
|
353
363
|
this.setTranslations();
|
|
354
364
|
await this.$nextTick();
|
|
355
365
|
|
|
@@ -1612,6 +1622,40 @@ const NsProductMixin = {
|
|
|
1612
1622
|
});
|
|
1613
1623
|
}
|
|
1614
1624
|
return text || "";
|
|
1625
|
+
},
|
|
1626
|
+
|
|
1627
|
+
deepEqual(varientValue, variantData) {
|
|
1628
|
+
return JSON.stringify(varientValue) === JSON.stringify(variantData);
|
|
1629
|
+
},
|
|
1630
|
+
|
|
1631
|
+
getUniqueProduct() {
|
|
1632
|
+
if (
|
|
1633
|
+
typeof sessionStorage === "undefined" ||
|
|
1634
|
+
!sessionStorage.getItem("personalOffer")
|
|
1635
|
+
) {
|
|
1636
|
+
return { products: [] };
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
const variantCheck = JSON.parse(
|
|
1640
|
+
sessionStorage.getItem("personalOffer")
|
|
1641
|
+
) || { products: [] };
|
|
1642
|
+
|
|
1643
|
+
if (!variantCheck.products || !Array.isArray(variantCheck.products)) {
|
|
1644
|
+
return { products: [] };
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
const unique = [];
|
|
1648
|
+
variantCheck.products.forEach(product => {
|
|
1649
|
+
const exists = unique.some(
|
|
1650
|
+
u =>
|
|
1651
|
+
u.sku === product.sku &&
|
|
1652
|
+
this.deepEqual(u.variantSelected, product.variantSelected)
|
|
1653
|
+
);
|
|
1654
|
+
if (!exists) {
|
|
1655
|
+
unique.push(product);
|
|
1656
|
+
}
|
|
1657
|
+
});
|
|
1658
|
+
return { products: unique };
|
|
1615
1659
|
}
|
|
1616
1660
|
}
|
|
1617
1661
|
};
|