@nuskin/ns-shop 6.13.0 → 6.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-shop",
3
- "version": "6.13.0",
3
+ "version": "6.13.1",
4
4
  "description": "The description that will amaze and astound your audience when they read it",
5
5
  "main": "src/shop.js",
6
6
  "scripts": {
@@ -155,7 +155,7 @@ async function addBundleToEquinoxCart(productBundleSkus = [], products = [], ava
155
155
  "properties": productItem.properties ? productItem.properties : { "categoryId": "antiaging" }
156
156
  }
157
157
 
158
- bundleItem = _assembleChildSkus(bundleItem, { product: productItem });
158
+ bundleItem = _assembleChildSkus(bundleItem, { product: productItem , sku: skuToAdd });
159
159
  bundleItem = _assembleAdrProperties(bundleItem, { product: productItem });
160
160
 
161
161
  if (productItem.inventory === "BACKORDER") {
@@ -343,18 +343,23 @@ function _assembleChildSkus(requestData, options) {
343
343
  && Array.isArray(options.product.childSkus)
344
344
  && options.product.childSkus.length > 0) {
345
345
  requestData.skus = options.product.childSkus.map((cs) => {
346
- const variantSelectedId = (personalOffer != null && productWithVariant.length > 0) ? Object.keys(productWithVariant[0].variantSelected)[0] : null
347
- const childSku = (personalOffer != null && variantSelectedId !== null && variantSelectedId === cs.productId && config.MySite_graphql_active) ? {
348
- productId: cs.productId,
349
- skuId: productWithVariant[0].variantSelected[variantSelectedId],
350
- type: cs.type,
351
- availableChannels: cs.availableChannels
352
- } : {
353
- productId: cs.productId,
354
- skuId: cs.skuId,
355
- type: cs.type,
356
- availableChannels: cs.availableChannels
346
+ let selectedVariants = null;
347
+ if(personalOffer != null && productWithVariant.length > 0 && productWithVariant[0].variantSelected){
348
+ selectedVariants = productWithVariant[0].variantSelected;
357
349
  }
350
+ const childSku =
351
+ (personalOffer != null && selectedVariants && selectedVariants[cs.productId] && config.MySite_graphql_active)
352
+ ? {
353
+ productId: cs.productId,
354
+ skuId: selectedVariants[cs.productId],
355
+ type: cs.type,
356
+ availableChannels: cs.availableChannels
357
+ } : {
358
+ productId: cs.productId,
359
+ skuId: cs.skuId,
360
+ type: cs.type,
361
+ availableChannels: cs.availableChannels
362
+ }
358
363
  if (cs.inventory) {
359
364
  childSku.skuQuantity = cs.skuQuantity;
360
365
  childSku.backOrdered = cs.inventory.backOrdered;