@nuskin/ns-product-lib 2.15.1 → 2.15.2-cx24-6768.1

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.15.1",
3
+ "version": "2.15.2-cx24-6768.1",
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": {
@@ -351,19 +351,23 @@ function mapChildSKU(kitBundleProducts) {
351
351
 
352
352
  return kitBundleProducts.kitProducts.map((kitProduct) => {
353
353
  const { product } = kitProduct;
354
- const defaultVariant = product.variants[0];
355
- return {
356
- productId: product.id,
357
- skuId: defaultVariant.sku,
358
- type: 'MANDATORY',
359
- skuQuantity: kitProduct.quantity,
360
- availableChannels: Array.isArray(kitBundleProducts.availableChannels) ? kitBundleProducts.availableChannels.join(',') : kitBundleProducts.availableChannels,
361
- inventory: {
362
- atpQty: defaultVariant.availableQuantity,
363
- backOrdered: defaultVariant.status.isBackordered,
364
- backOrderedQty: defaultVariant.availableQuantity
365
- }
354
+ const arr1 = []
355
+ for (const variant of product.variants) {
356
+ arr1.push({
357
+ productId: product.id,
358
+ skuId: variant.sku,
359
+ type: 'MANDATORY',
360
+ skuQuantity: variant.availableQuantity,
361
+ // eslint-disable-next-line max-len
362
+ availableChannels: Array.isArray(kitBundleProducts.availableChannels) ? kitBundleProducts.availableChannels.join(',') : kitBundleProducts.availableChannels,
363
+ inventory: {
364
+ atpQty: variant.availableQuantity,
365
+ backOrdered: variant.status.isBackordered,
366
+ backOrderedQty: variant.availableQuantity
367
+ }
368
+ })
366
369
  }
370
+ return Object.assign({}, arr1)
367
371
  });
368
372
  }
369
373