@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.19.1-cx24-70222.1",
3
+ "version": "2.19.1-cx24-70222.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": {
@@ -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.data.productsById.products.filter((n) => {
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;