@nuskin/ns-product-lib 2.17.0-cx24-5822.7 → 2.17.0
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 +7 -3
package/package.json
CHANGED
package/src/graph-ql/product.js
CHANGED
@@ -145,12 +145,16 @@ async function getProducts(ids, market, locale, config) {
|
|
145
145
|
|
146
146
|
function mapSkusToProducts(skus , products){
|
147
147
|
const productsData = [];
|
148
|
-
if (products
|
148
|
+
if (products &&
|
149
|
+
products.data &&
|
150
|
+
products.data.productsById &&
|
151
|
+
products.data.productsById.products &&
|
152
|
+
products.data.productsById.products.length) {
|
149
153
|
skus.forEach((sku)=>{
|
150
154
|
const matchedProducts = products.data.productsById.products.filter((product)=>{
|
151
155
|
let matched = false;
|
152
|
-
if(product
|
153
|
-
if(product
|
156
|
+
if(product.id) {matched = product.id === sku;}
|
157
|
+
if(product.variants.length){
|
154
158
|
product.variants.forEach((variant)=>{
|
155
159
|
matched |= variant.sku === sku;
|
156
160
|
});
|