@nuskin/ns-product-lib 2.17.2-cx24-7003.1 → 2.17.2-cx24-7003.3

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.2-cx24-7003.1",
3
+ "version": "2.17.2-cx24-7003.3",
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": {
@@ -441,12 +441,12 @@ function mapChildSKU(kitBundleProducts) {
441
441
  const personalOffer = sessionStorage.getItem('personalOffer') ? JSON.parse(sessionStorage.getItem('personalOffer')) : false
442
442
  return kitBundleProducts.kitProducts.map((kitProduct) => {
443
443
  const { product } = kitProduct;
444
- if (product.variants.length > 1 && !personalOffer) {
444
+ if (product.variants.length > 1 && typeof personalOffer === 'object') {
445
445
  return product.variants.map((variant) => {
446
446
  return {
447
447
  productId: product.id,
448
448
  skuId: variant.sku,
449
- type: 'MANDATORY',
449
+ type: variant.isMandatory ? 'MANDATORY' : 'OPTIONAL',
450
450
  skuQuantity: variant.availableQuantity,
451
451
  // eslint-disable-next-line max-len
452
452
  availableChannels: Array.isArray(kitBundleProducts.availableChannels) ? kitBundleProducts.availableChannels.join(',') : kitBundleProducts.availableChannels,
@@ -462,7 +462,7 @@ function mapChildSKU(kitBundleProducts) {
462
462
  return {
463
463
  productId: product.id,
464
464
  skuId: defaultVariant.sku,
465
- type: 'MANDATORY',
465
+ type: kitProduct.isMandatory ? 'MANDATORY' : 'OPTIONAL',
466
466
  skuQuantity: kitProduct.quantity,
467
467
  availableChannels: Array.isArray(kitBundleProducts.availableChannels) ? kitBundleProducts.availableChannels.join(',') : kitBundleProducts.availableChannels,
468
468
  inventory: {