@nuskin/ns-shop 7.6.3-mdigi-4997.1 → 7.7.0-mdigi-6056.2
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 +1 -1
- package/src/cart/cart.js +4 -1
- package/src/cart/cartItem.js +27 -0
- package/src/cart/equinoxCartService.js +13 -13
package/package.json
CHANGED
package/src/cart/cart.js
CHANGED
|
@@ -1414,7 +1414,10 @@ export default function Cart(cartData) {
|
|
|
1414
1414
|
'name': flatItem.title,
|
|
1415
1415
|
'id': flatItem.sku,
|
|
1416
1416
|
'price': flatItem.price,
|
|
1417
|
-
'quantity': Math.abs(diffQty)
|
|
1417
|
+
'quantity': Math.abs(diffQty),
|
|
1418
|
+
'sales_price': flatItem.salesPrice,
|
|
1419
|
+
'unit_price': flatItem.unitPrice,
|
|
1420
|
+
'product_image_url': flatItem.fullImage
|
|
1418
1421
|
});
|
|
1419
1422
|
|
|
1420
1423
|
function getCartInfo(options) {
|
package/src/cart/cartItem.js
CHANGED
|
@@ -293,6 +293,30 @@ export default function CartItem(cartItemData) {
|
|
|
293
293
|
return this.product.marketAttributes;
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
+
this.salesPrice = function () {
|
|
297
|
+
if (AccountManager.isCustomer() || AccountManager.isPreferredCustomer()) {
|
|
298
|
+
return this.product.priceMap.RTL;
|
|
299
|
+
} else if (AccountManager.isDistributor()) {
|
|
300
|
+
return this.product.priceMap.WHL;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
this.unitPrice = function () {
|
|
305
|
+
if (AccountManager.isCustomer() || AccountManager.isPreferredCustomer()) {
|
|
306
|
+
if (this.product.priceType.WADR) {
|
|
307
|
+
return this.product.priceMap.WADR;
|
|
308
|
+
} else {
|
|
309
|
+
return this.product.priceMap.RTL;
|
|
310
|
+
}
|
|
311
|
+
} else if (AccountManager.isDistributor()) {
|
|
312
|
+
if (this.product.priceType.WADR) {
|
|
313
|
+
return this.product.priceMap.WADW;
|
|
314
|
+
} else {
|
|
315
|
+
return this.product.priceMap.WHL;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
296
320
|
this.toFlatJson = function() {
|
|
297
321
|
let retVal = {};
|
|
298
322
|
|
|
@@ -352,6 +376,9 @@ export default function CartItem(cartItemData) {
|
|
|
352
376
|
retVal.size = this.product.size;
|
|
353
377
|
retVal.variants = this.product.variants;
|
|
354
378
|
retVal.marketAttributes = this.product.marketAttributes;
|
|
379
|
+
retVal.product_image_url = this.product.fullImage;
|
|
380
|
+
retVal.salesPrice = AccountManager.isLoggedIn()? this.salesPrice() : null;
|
|
381
|
+
retVal.unitPrice = AccountManager.isLoggedIn()? this.unitPrice() : null;
|
|
355
382
|
|
|
356
383
|
return retVal;
|
|
357
384
|
};
|
|
@@ -395,7 +395,7 @@ function _assembleChildSkus(requestData, options) {
|
|
|
395
395
|
if (personalOffer !== null) {
|
|
396
396
|
personalOffer = JSON.parse(personalOffer);
|
|
397
397
|
productWithVariant = personalOffer.products.filter((sku) =>
|
|
398
|
-
sku.type
|
|
398
|
+
sku.type === 'bundle' && sku.variantSelected !== null && sku.sku === productSku
|
|
399
399
|
)
|
|
400
400
|
}
|
|
401
401
|
|
|
@@ -411,18 +411,18 @@ function _assembleChildSkus(requestData, options) {
|
|
|
411
411
|
}
|
|
412
412
|
if (personalOffer != null && selectedVariants && cs.skuId != selectedVariants[cs.productId] && (cs.type !== "BUNDLE" && cs.type !== "OPTIONAL")) return null
|
|
413
413
|
const childSku =
|
|
414
|
-
(personalOffer != null && selectedVariants && selectedVariants[cs.productId] && config
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
414
|
+
(personalOffer != null && selectedVariants && selectedVariants[cs.productId] && config.MySite_graphql_active)
|
|
415
|
+
? {
|
|
416
|
+
productId: cs.productId,
|
|
417
|
+
skuId: selectedVariants[cs.productId],
|
|
418
|
+
type: cs.type,
|
|
419
|
+
availableChannels: cs.availableChannels
|
|
420
|
+
} : {
|
|
421
|
+
productId: cs.productId,
|
|
422
|
+
skuId: cs.skuId,
|
|
423
|
+
type: cs.type,
|
|
424
|
+
availableChannels: cs.availableChannels
|
|
425
|
+
}
|
|
426
426
|
if (cs.inventory) {
|
|
427
427
|
childSku.skuQuantity = cs.skuQuantity;
|
|
428
428
|
childSku.backOrdered = cs.inventory.backOrdered;
|