@nuskin/ns-product-lib 2.5.0-cx24-2179.2.2 → 2.5.0-cx24-2179.2.4

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [2.5.0-cx24-2179.2.4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.3...v2.5.0-cx24-2179.2.4) (2022-12-05)
2
+
3
+
4
+ ### New
5
+
6
+ * added eq promoion bypass for setPriceAndPvFromType v2 (#CX24-2179) ([25bde9a](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/25bde9a8e19b1e4e44e37457dfb087e0a6212ee1)), closes [#CX24-2179](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2179)
7
+
8
+ # [2.5.0-cx24-2179.2.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.2...v2.5.0-cx24-2179.2.3) (2022-12-05)
9
+
10
+
11
+ ### New
12
+
13
+ * added eq promoion bypass for setPriceAndPvFromType (#CX24-2179) ([716cefc](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/716cefc2a2522287e017709a8b2cfef5a7ce5e07)), closes [#CX24-2179](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2179)
14
+
1
15
  # [2.5.0-cx24-2179.2.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.1...v2.5.0-cx24-2179.2.2) (2022-12-05)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.5.0-cx24-2179.2.2",
3
+ "version": "2.5.0-cx24-2179.2.4",
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": {
package/src/product.js CHANGED
@@ -225,20 +225,21 @@ const Product = function(productData) {
225
225
  }
226
226
  };
227
227
 
228
- this.setPriceAndPvFromType = function(_priceType, _activeEvents = null) {
228
+ this.setPriceAndPvFromType = function(_priceType, _activeEvents = null, option = {}) {
229
229
  // WARNING: priceType needs to be handled client-side
230
230
  // const priceType = ConfigService.getMarketConfig().showWholeSalePricing && !AccountManager.isLoggedIn()
231
231
  // ? PriceType.WWHL
232
232
  // : (_priceType ? _priceType : this.priceType),
233
233
  const priceType = _priceType ? _priceType : this.priceType;
234
234
  const eventPricing = getEventPricing(this, priceType, _activeEvents);
235
+ console.log({context: 'NsProductLib.setPriceAndPvFromType', eventPricing: eventPricing});
235
236
 
236
237
  let changed = false;
237
- if (
238
+ if ((
238
239
  !this.price ||
239
240
  priceType !== this.priceType ||
240
241
  this.eventName !== eventPricing.eventName
241
- ) {
242
+ ) && !option.isEqPromotion) {
242
243
  this.setPrice(eventPricing.price || this.getPricing(priceType));
243
244
  this.setCv(eventPricing.cv || this.getCvWithType(priceType));
244
245
  this.setPv(eventPricing.pv || this.getPvWithType(priceType));
@@ -247,6 +248,15 @@ const Product = function(productData) {
247
248
  changed = true;
248
249
  }
249
250
 
251
+ if (option.isEqPromotion) {
252
+ //retain product.price as original price
253
+ this.setPrice(eventPricing.price || this.getPricing(priceType));
254
+ this.setCv(this.getCvWithType(priceType));
255
+ this.setPv(this.getPvWithType(priceType));
256
+ this.priceType = priceType;
257
+ changed = true;
258
+ }
259
+
250
260
  this.variantSkus().forEach((variantSku) => {
251
261
  if (
252
262
  this.variants[variantSku].setPriceAndPvFromType(