@nuskin/ns-shop 7.6.2 → 7.7.0-mdigi-6056.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": "7.6.2",
3
+ "version": "7.7.0-mdigi-6056.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": {
@@ -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,8 @@ 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.salesPrice = AccountManager.isLoggedIn()? this.salesPrice() : null;
380
+ retVal.unitPrice = AccountManager.isLoggedIn()? this.unitPrice() : null;
355
381
 
356
382
  return retVal;
357
383
  };