@nuskin/ns-product-lib 2.19.1-cx24-70222.1 → 2.19.1-pur-816.1
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/graph-ql/product.js +4 -12
- package/src/product.js +3 -0
package/package.json
CHANGED
package/src/graph-ql/product.js
CHANGED
@@ -106,21 +106,14 @@ async function getProducts(ids, market, locale, config) {
|
|
106
106
|
* @param {any} products
|
107
107
|
*/
|
108
108
|
|
109
|
-
function mapSkusToProducts(skus
|
110
|
-
let newProducts = products.data.productsById.products.filter((n) => {
|
111
|
-
return n.id != null
|
112
|
-
})
|
109
|
+
function mapSkusToProducts(skus, products){
|
113
110
|
const productsData = [];
|
114
|
-
if (products &&
|
115
|
-
products.data &&
|
116
|
-
products.data.productsById &&
|
117
|
-
products.data.productsById.products &&
|
118
|
-
products.data.productsById.products.length) {
|
111
|
+
if (products && products.length) {
|
119
112
|
skus.forEach((sku)=>{
|
120
|
-
const matchedProducts =
|
113
|
+
const matchedProducts = products.filter((product)=>{
|
121
114
|
let matched = false;
|
122
115
|
if(product.id) {matched = product.id === sku;}
|
123
|
-
if(product.variants.length){
|
116
|
+
if(product.variants && product.variants.length){
|
124
117
|
product.variants.forEach((variant)=>{
|
125
118
|
matched |= variant.sku === sku;
|
126
119
|
});
|
@@ -136,7 +129,6 @@ function mapSkusToProducts(skus , products){
|
|
136
129
|
|
137
130
|
}
|
138
131
|
|
139
|
-
|
140
132
|
/**
|
141
133
|
*
|
142
134
|
* Map product data to be product card consumable structure *
|
package/src/product.js
CHANGED
@@ -31,6 +31,7 @@ const Product = function (productData) {
|
|
31
31
|
this.sizeWeight = "";
|
32
32
|
this.nettoWeight = "";
|
33
33
|
this.productLabels = {};
|
34
|
+
this.dangerousGoods = false;
|
34
35
|
this.count = "";
|
35
36
|
this.flavor = "";
|
36
37
|
this.shade = "";
|
@@ -514,6 +515,7 @@ const Product = function (productData) {
|
|
514
515
|
retData.scanQualified = this.scanQualified;
|
515
516
|
retData.availableQuantity = this.availableQuantity;
|
516
517
|
retData.maxQuantity = this.maxQuantity;
|
518
|
+
retData.dangerousGoods = this.dangerousGoods;
|
517
519
|
retData.points = this.points;
|
518
520
|
retData.cv = this.cv;
|
519
521
|
retData.pv = this.pv;
|
@@ -600,6 +602,7 @@ const Product = function (productData) {
|
|
600
602
|
this.shortDescr = data.shortDescr;
|
601
603
|
this.longDescr = data.longDescr;
|
602
604
|
this.isExclusive = isTrue(data.isExclusive);
|
605
|
+
this.dangerousGoods = data.dangerousGoods === true;
|
603
606
|
|
604
607
|
// WARNING: Browser Detection will need to be handled in the client
|
605
608
|
// if (!BrowserDetection.isEdge() && !BrowserDetection.isFirefox()) {
|