@nuskin/ns-product-lib 2.13.1 → 2.13.2-cx24-511910.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.1",
3
+ "version": "2.13.2-cx24-511910.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": {
@@ -7,24 +7,7 @@ const mapBackOrderDate = require('./backOrderDate');
7
7
  * @param {import('.').EquinoxNormalProduct} product
8
8
  */
9
9
  function childSKUBundle(kits, product) {
10
- let sku;
11
- let personalOffer = JSON.parse(sessionStorage.getItem('personalOffer'))
12
- if (personalOffer.active) {
13
- //get the products with variants selected
14
- const productWithVariant = personalOffer.products.filter((sku) => sku.variantSelected !== null)[0]
15
- if (productWithVariant !== null) {
16
- sku = product.sku.filter((sku) => {
17
- console.log('Checking sku ' + sku.identifier + ` ` + product.identifier)
18
- return sku.identifier === productWithVariant.variantSelected[product.identifier]
19
- })[0]
20
- }
21
- if (!sku) {
22
- sku = product.sku.filter(sku => sku.default)[0];
23
- }
24
- } else {
25
- sku = product.sku.filter(sku => sku.default)[0];
26
- }
27
-
10
+ const sku = product.sku.filter(sku => sku.default)[0];
28
11
 
29
12
  if (!sku) {
30
13
  throw Error('Unable to find the default SKU for product ' + product.identifier);
@@ -290,9 +290,11 @@ function mapChildSKU(kitBundleProducts, productSku) {
290
290
  if (!kitBundleProducts || !kitBundleProducts.kitProducts) {
291
291
  return [];
292
292
  }
293
- let personalOffer = JSON.parse(sessionStorage.getItem('personalOffer'))
294
293
  let productWithVariant;
295
- if (personalOffer && personalOffer.active) {
294
+ let personalOffer = {};
295
+
296
+ personalOffer = JSON.parse(sessionStorage.getItem('personalOffer'))
297
+ if (personalOffer !== null && personalOffer.active) {
296
298
  productWithVariant = personalOffer.products.filter((sku) =>
297
299
  sku.type === 'bundle' && sku.variantSelected !== null && sku.sku === productSku
298
300
  )