@nuskin/ns-product-lib 2.17.6 → 2.17.7-cx24-7022.2

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.17.6",
3
+ "version": "2.17.7-cx24-7022.2",
4
4
  "description": "This project contains shared Product models and code between the backend and frontend.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -124,7 +124,7 @@ async function getProducts(ids, market, locale, config) {
124
124
  });
125
125
  productsData.count = productsData.products.length;
126
126
  } catch (e) {
127
- console.log(`Unable to fetch products details for SKUs ${ids}`);
127
+ console.log(`Unable to fetch products details for SKUs ${ids} ${e}`);
128
128
  }
129
129
 
130
130
  return {
@@ -144,13 +144,16 @@ async function getProducts(ids, market, locale, config) {
144
144
  */
145
145
 
146
146
  function mapSkusToProducts(skus , products){
147
+ let newSkus = skus.filter((n) => {
148
+ return n.id != null
149
+ })
147
150
  const productsData = [];
148
151
  if (products &&
149
152
  products.data &&
150
153
  products.data.productsById &&
151
154
  products.data.productsById.products &&
152
155
  products.data.productsById.products.length) {
153
- skus.forEach((sku)=>{
156
+ newSkus.forEach((sku)=>{
154
157
  const matchedProducts = products.data.productsById.products.filter((product)=>{
155
158
  let matched = false;
156
159
  if(product.id) {matched = product.id === sku;}