@nuskin/ns-product-lib 2.5.0-cx24-2179.2.1 → 2.5.0-cx24-2179.2.3

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.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)
2
+
3
+
4
+ ### New
5
+
6
+ * 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)
7
+
8
+ # [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)
9
+
10
+
11
+ ### New
12
+
13
+ * added eq promotion support- debug sales event (#CX24-2179) ([992a2cf](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/992a2cfb178b3e12a6b8a0229ae5f6f607fb41d3)), 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.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.4.2-CX24.2.1...v2.5.0-cx24-2179.2.1) (2022-12-02)
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.1",
3
+ "version": "2.5.0-cx24-2179.2.3",
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,7 +225,7 @@ 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
@@ -234,11 +234,11 @@ const Product = function(productData) {
234
234
  const eventPricing = getEventPricing(this, priceType, _activeEvents);
235
235
 
236
236
  let changed = false;
237
- if (
237
+ if ((
238
238
  !this.price ||
239
239
  priceType !== this.priceType ||
240
240
  this.eventName !== eventPricing.eventName
241
- ) {
241
+ ) && !option.isEqPromotion) {
242
242
  this.setPrice(eventPricing.price || this.getPricing(priceType));
243
243
  this.setCv(eventPricing.cv || this.getCvWithType(priceType));
244
244
  this.setPv(eventPricing.pv || this.getPvWithType(priceType));
@@ -247,6 +247,14 @@ const Product = function(productData) {
247
247
  changed = true;
248
248
  }
249
249
 
250
+ if (option.isEqPromotion) {
251
+ //retain product.price as original price
252
+ this.setCv(this.getCvWithType(priceType));
253
+ this.setPv(this.getPvWithType(priceType));
254
+ this.priceType = priceType;
255
+ changed = true;
256
+ }
257
+
250
258
  this.variantSkus().forEach((variantSku) => {
251
259
  if (
252
260
  this.variants[variantSku].setPriceAndPvFromType(
@@ -361,8 +361,9 @@ const ProductData = {
361
361
  };
362
362
  let newProduct = new Product(prod);
363
363
  return newProduct
364
- })
364
+ });
365
365
 
366
+ console.log({context: "NsProductLib.eqProductMapper", product: prodArr});
366
367
  let data = {
367
368
  products: this._sortProductsBySku(skus, prodArr),
368
369
  count: productDataResponse.length