@nuskin/ns-product-lib 2.13.0-cx24-51071125.1 → 2.13.0-cx24-51072.1
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 +12 -3
package/package.json
CHANGED
package/src/graph-ql/product.js
CHANGED
@@ -55,7 +55,7 @@ async function getProduct(id, market, locale, config) {
|
|
55
55
|
}
|
56
56
|
|
57
57
|
} catch (e) {
|
58
|
-
console.log(`Unable to fetch product detail for SKU ${id}`
|
58
|
+
console.log(`Unable to fetch product detail for SKU ${id}`);
|
59
59
|
}
|
60
60
|
|
61
61
|
return {
|
@@ -184,7 +184,7 @@ function mapProduct(product, market, locale, config) {
|
|
184
184
|
skuId: product.id,
|
185
185
|
type: kitBundleProducts.type.toUpperCase()
|
186
186
|
},
|
187
|
-
...mapChildSKU(kitBundleProducts
|
187
|
+
...mapChildSKU(kitBundleProducts)
|
188
188
|
];
|
189
189
|
}
|
190
190
|
|
@@ -299,13 +299,22 @@ function mapChildSKU(kitBundleProducts, productSku) {
|
|
299
299
|
}
|
300
300
|
return kitBundleProducts.kitProducts.map((kitProduct) => {
|
301
301
|
const { product } = kitProduct;
|
302
|
+
let defaultVariant;
|
302
303
|
if (personalOffer && personalOffer.active) {
|
303
304
|
const variantSelected = kitProduct.product.variants.filter(v =>
|
304
305
|
v.sku === productWithVariant[0].variantSelected[kitProduct.product.id]
|
305
306
|
)
|
306
307
|
console.log(variantSelected)
|
308
|
+
if (variantSelected[0].sku !== "") {
|
309
|
+
defaultVariant = variantSelected[0]
|
310
|
+
} else {
|
311
|
+
defaultVariant = product.variants[0];
|
312
|
+
}
|
313
|
+
}
|
314
|
+
|
315
|
+
if (!defaultVariant) {
|
316
|
+
defaultVariant = product.variants[0];
|
307
317
|
}
|
308
|
-
const defaultVariant = product.variants[0];
|
309
318
|
return {
|
310
319
|
productId: product.id,
|
311
320
|
skuId: defaultVariant.sku,
|