@nuskin/ns-product-lib 2.19.1-cx24-70222.1 → 2.19.1-cx24-70222.2
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 +3 -6
package/package.json
CHANGED
package/src/graph-ql/product.js
CHANGED
@@ -76,6 +76,7 @@ async function getProducts(ids, market, locale, config) {
|
|
76
76
|
null, 1, okta,
|
77
77
|
config.graphqlUrl.includes('test') ? 'test' : config.graphqlUrl.includes('dev') ? 'dev' : 'prod'
|
78
78
|
);
|
79
|
+
console.log(ids)
|
79
80
|
if (data && data.products) {
|
80
81
|
const mappedProducts = mapSkusToProducts(ids,data.products);
|
81
82
|
//use to get default variant based on requested sku
|
@@ -107,15 +108,11 @@ async function getProducts(ids, market, locale, config) {
|
|
107
108
|
*/
|
108
109
|
|
109
110
|
function mapSkusToProducts(skus , products){
|
110
|
-
let newProducts = products.
|
111
|
+
let newProducts = products.filter((n) => {
|
111
112
|
return n.id != null
|
112
113
|
})
|
113
114
|
const productsData = [];
|
114
|
-
if (products &&
|
115
|
-
products.data &&
|
116
|
-
products.data.productsById &&
|
117
|
-
products.data.productsById.products &&
|
118
|
-
products.data.productsById.products.length) {
|
115
|
+
if (products && products.length) {
|
119
116
|
skus.forEach((sku)=>{
|
120
117
|
const matchedProducts = newProducts.filter((product)=>{
|
121
118
|
let matched = false;
|