@nuskin/ns-shop 7.8.1 → 7.9.0-6056-insider.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-shop",
3
- "version": "7.8.1",
3
+ "version": "7.9.0-6056-insider.2",
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": {
package/src/cart/cart.js CHANGED
@@ -1414,7 +1414,11 @@ 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
+ 'taxonomy': flatItem.taxonomy,
1419
+ 'sales_price': flatItem.salesPrice,
1420
+ 'unit_price': flatItem.unitPrice,
1421
+ 'product_image_url': flatItem.product_image_url
1418
1422
  });
1419
1423
 
1420
1424
  function getCartInfo(options) {
@@ -293,6 +293,30 @@ export default function CartItem(cartItemData) {
293
293
  return this.product.marketAttributes;
294
294
  }
295
295
 
296
+ this.unitPrice = 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.salesPrice = 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,10 @@ 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.taxonomy = this.product.title ? this.product.title.split(' ')[0] : '';
381
+ retVal.salesPrice = AccountManager.isLoggedIn()? this.salesPrice() : null;
382
+ retVal.unitPrice = AccountManager.isLoggedIn()? this.unitPrice() : null;
355
383
 
356
384
  return retVal;
357
385
  };