@nuskin/ns-product-lib 2.21.2-mdigi-9080.1 → 2.21.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/package.json +1 -1
- package/src/graph-ql/product.js +4 -4
package/package.json
CHANGED
package/src/graph-ql/product.js
CHANGED
|
@@ -70,7 +70,7 @@ async function getProducts(ids, market, locale, config) {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
const okta = typeof sessionStorage !== 'undefined' ? parseOktaObject(sessionStorage.oktaTokens) : null;
|
|
73
|
-
|
|
73
|
+
let finalIds= ids;
|
|
74
74
|
try {
|
|
75
75
|
const uniqueProduct = getUniqueProduct()
|
|
76
76
|
const productsList = uniqueProduct && uniqueProduct.products ? uniqueProduct.products : [];
|
|
@@ -78,7 +78,7 @@ async function getProducts(ids, market, locale, config) {
|
|
|
78
78
|
.map(item => item && item.sku ? item.sku : null)
|
|
79
79
|
.filter(Boolean)
|
|
80
80
|
.map(String);
|
|
81
|
-
|
|
81
|
+
finalIds = idValue.length ? idValue : ids;
|
|
82
82
|
console.log("the value is of Id is ...... "+idValue)
|
|
83
83
|
const data = await productLib.getProductsById(
|
|
84
84
|
finalIds, market, locale,
|
|
@@ -86,7 +86,7 @@ async function getProducts(ids, market, locale, config) {
|
|
|
86
86
|
config.graphqlUrl.includes('test') ? 'test' : config.graphqlUrl.includes('dev') ? 'dev' : 'prod'
|
|
87
87
|
);
|
|
88
88
|
if (data && data.products) {
|
|
89
|
-
const mappedProducts = mapSkusToProducts(
|
|
89
|
+
const mappedProducts = mapSkusToProducts(finalIds,data.products);
|
|
90
90
|
//use to get default variant based on requested sku
|
|
91
91
|
for (const {sku, product} of mappedProducts) {
|
|
92
92
|
config.sku = sku;
|
|
@@ -96,7 +96,7 @@ async function getProducts(ids, market, locale, config) {
|
|
|
96
96
|
productsData.count = productsData.products.length;
|
|
97
97
|
}
|
|
98
98
|
} catch (e) {
|
|
99
|
-
console.log(`Unable to fetch products details for SKUs ${
|
|
99
|
+
console.log(`Unable to fetch products details for SKUs ${finalIds}`);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
return {
|