@nuskin/ns-product-lib 2.13.2-cx24-511910.3 → 2.13.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.13.2-cx24-511910.3",
3
+ "version": "2.13.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": {
@@ -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, product.id)
187
+ ...mapChildSKU(kitBundleProducts)
188
188
  ];
189
189
  }
190
190
 
@@ -286,37 +286,14 @@ function mapVariants(product) {
286
286
  * @param {*} kitBundleProducts
287
287
  * @returns {array} kitBundleProducts
288
288
  */
289
- function mapChildSKU(kitBundleProducts, productSku) {
289
+ function mapChildSKU(kitBundleProducts) {
290
290
  if (!kitBundleProducts || !kitBundleProducts.kitProducts) {
291
291
  return [];
292
292
  }
293
- let productWithVariant;
294
- let personalOffer = {};
295
-
296
- personalOffer = JSON.parse(sessionStorage.getItem('personalOffer'))
297
- if (personalOffer !== null && personalOffer.active) {
298
- productWithVariant = personalOffer.products.filter((sku) =>
299
- sku.type === 'bundle' && sku.variantSelected !== null && sku.sku === productSku
300
- )
301
- }
293
+
302
294
  return kitBundleProducts.kitProducts.map((kitProduct) => {
303
295
  const { product } = kitProduct;
304
- let defaultVariant;
305
- if (personalOffer && personalOffer.active) {
306
- const variantSelected = kitProduct.product.variants.filter(v =>
307
- v.sku === productWithVariant[0].variantSelected[kitProduct.product.id]
308
- )
309
- console.log(variantSelected)
310
- if (variantSelected[0].sku !== "") {
311
- defaultVariant = variantSelected[0]
312
- } else {
313
- defaultVariant = product.variants[0];
314
- }
315
- }
316
-
317
- if (!defaultVariant) {
318
- defaultVariant = product.variants[0];
319
- }
296
+ const defaultVariant = product.variants[0];
320
297
  return {
321
298
  productId: product.id,
322
299
  skuId: defaultVariant.sku,