@nuskin/ns-product-lib 2.7.1-cx24-3684.2 → 2.7.1-cx24-4055.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +26 -4
- package/package.json +2 -2
- package/src/product.js +6 -3
- package/src/productData.js +34 -32
package/CHANGELOG.md
CHANGED
@@ -1,16 +1,38 @@
|
|
1
|
-
## [2.7.1-cx24-
|
1
|
+
## [2.7.1-cx24-4055.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.0...v2.7.1-cx24-4055.1) (2023-05-05)
|
2
2
|
|
3
3
|
|
4
4
|
### Fix
|
5
5
|
|
6
|
-
*
|
6
|
+
* Multiple variants not showing properly ([97c649b](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/97c649beb1b004c2946c6114d049de7a06ad2eb1))
|
7
7
|
|
8
|
-
|
8
|
+
# [2.8.0-cx24-3705.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.8.0-cx24-3705.1...v2.8.0-cx24-3705.2) (2023-04-14)
|
9
|
+
|
10
|
+
|
11
|
+
### Update
|
12
|
+
|
13
|
+
* setting correct title if multiple variants ([583e74d](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/583e74d41acc7213cd86a48df9076a453da8bb93))
|
14
|
+
|
15
|
+
# [2.8.0-cx24-3705.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.0...v2.8.0-cx24-3705.1) (2023-04-14)
|
16
|
+
|
17
|
+
|
18
|
+
### Update
|
19
|
+
|
20
|
+
* setting correct title if multiple variants ([9574804](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9574804094f65261ff45c9658ba4e4d4baf0bdf2))
|
21
|
+
|
22
|
+
## [2.7.1-cx24-3879.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.1-cx24-3879.1...v2.7.1-cx24-3879.2) (2023-04-13)
|
23
|
+
|
24
|
+
|
25
|
+
### Fix
|
26
|
+
|
27
|
+
* Payload for subscription products are missing when added to cart from MySite homepage ([20b0ed2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/20b0ed2661b4d213147cef9e77d268b167b49421))
|
28
|
+
|
29
|
+
## [2.7.1-cx24-3879.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.0...v2.7.1-cx24-3879.1) (2023-04-13)
|
9
30
|
|
10
31
|
|
11
32
|
### Fix
|
12
33
|
|
13
|
-
*
|
34
|
+
* Payload for subscription products are missing when added to cart from MySite homepage ([7b7ac3b](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/7b7ac3bd7c0b196aa9a7e97e885f7e296ef7e97d))
|
35
|
+
* Payload for subscription products are missing when added to cart from MySite homepage ([d49957f](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/d49957f44d9ce6b6469b0bc94bc8f8050d00f35a))
|
14
36
|
|
15
37
|
# [2.7.0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.2...v2.7.0) (2023-04-05)
|
16
38
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nuskin/ns-product-lib",
|
3
|
-
"version": "2.7.1-cx24-
|
3
|
+
"version": "2.7.1-cx24-4055.1",
|
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": {
|
@@ -33,7 +33,7 @@
|
|
33
33
|
"dependencies": {
|
34
34
|
"@nuskin/configuration-sdk": "2.2.3",
|
35
35
|
"@nuskin/ns-common-lib": "1.4.5",
|
36
|
-
"@nuskin/ns-util": "4.2
|
36
|
+
"@nuskin/ns-util": "4.3.2",
|
37
37
|
"axios": "0.27.2",
|
38
38
|
"qs": "6.11.0"
|
39
39
|
},
|
package/src/product.js
CHANGED
@@ -75,7 +75,7 @@ const Product = function (productData) {
|
|
75
75
|
//equinox inventory / stock label
|
76
76
|
//@example "IN STOCK"
|
77
77
|
this.inventory = "";
|
78
|
-
|
78
|
+
|
79
79
|
// equinox specific properties
|
80
80
|
this.equinoxProductId = "";
|
81
81
|
this.properties = {};
|
@@ -262,7 +262,6 @@ const Product = function (productData) {
|
|
262
262
|
|
263
263
|
if (option.isEqPromotion) {
|
264
264
|
//retain product.price as original price
|
265
|
-
this.setPrice(this.getPricing(priceType));
|
266
265
|
this.setCv(this.getCvWithType(priceType));
|
267
266
|
this.setPv(this.getPvWithType(priceType));
|
268
267
|
this.priceType = priceType;
|
@@ -338,7 +337,11 @@ const Product = function (productData) {
|
|
338
337
|
return this.addCvWithType(csvKey, productStatus.csv[csvKey]);
|
339
338
|
}, this);
|
340
339
|
}
|
341
|
-
|
340
|
+
//only remap the orderTypes for legacy (which we'll know when equinoxProductId is blank)
|
341
|
+
if(this.equinoxProductId == "") {
|
342
|
+
this.orderTypes = ProductUtils.mergeOrderTypes(this.orderTypes, productStatus.orderType);
|
343
|
+
}
|
344
|
+
|
342
345
|
if (productStatus.childSkus) {
|
343
346
|
this.childSkus = productStatus.childSkus;
|
344
347
|
}
|
package/src/productData.js
CHANGED
@@ -48,11 +48,11 @@ const ProductData = {
|
|
48
48
|
},
|
49
49
|
|
50
50
|
/**
|
51
|
-
*
|
52
|
-
* @param {string[]} skus
|
53
|
-
* @param {string} locale
|
54
|
-
* @param {ConfigMap} config
|
55
|
-
* @returns
|
51
|
+
*
|
52
|
+
* @param {string[]} skus
|
53
|
+
* @param {string} locale
|
54
|
+
* @param {ConfigMap} config
|
55
|
+
* @returns
|
56
56
|
*/
|
57
57
|
searchEquinoxProduct: async function (skus, locale, config) {
|
58
58
|
let skuFilter = [];
|
@@ -129,18 +129,17 @@ const ProductData = {
|
|
129
129
|
* @param {*} eqVariant
|
130
130
|
* @returns Array<Product>
|
131
131
|
*/
|
132
|
-
eqProductVariantMapper: function (eqVariant) {
|
132
|
+
eqProductVariantMapper: function (eqVariant, product) {
|
133
133
|
|
134
134
|
let imageURL = eqVariant.properties.imageURL ? eqVariant.properties.imageURL : '';
|
135
135
|
let thumbnailImage = imageURL ? imageURL + '?width=40' : ''
|
136
136
|
|
137
137
|
|
138
|
-
const { eventName, eventLabels, computedPrice, defaultProductPrice, CVPrice, PVPrice } = this.getEqProductPromotions(
|
139
|
-
const productPrice = eventName ? defaultProductPrice :
|
140
|
-
const discountedPrice = eventName ? computedPrice :
|
141
|
-
const productCVPrice = eventName ? CVPrice :
|
142
|
-
const productPVPrice = eventName ? PVPrice :
|
143
|
-
const wholeSalePrice = eventName ? defaultProductPrice : eqVariant.priceFacets["Wholesale Price"];
|
138
|
+
const { eventName, eventLabels, computedPrice, defaultProductPrice, CVPrice, PVPrice } = this.getEqProductPromotions(product);
|
139
|
+
const productPrice = eventName ? defaultProductPrice : product.priceFacets["Regular Price"];
|
140
|
+
const discountedPrice = eventName ? computedPrice : product.priceFacets["Regular Price"];
|
141
|
+
const productCVPrice = eventName ? CVPrice : product.priceFacets.CV;
|
142
|
+
const productPVPrice = eventName ? PVPrice : product.priceFacets.PV;
|
144
143
|
|
145
144
|
return {
|
146
145
|
"sku": eqVariant.identifier,
|
@@ -253,12 +252,12 @@ const ProductData = {
|
|
253
252
|
"price": discountedPrice,
|
254
253
|
"priceMap": {
|
255
254
|
"WRTL": productPrice,
|
256
|
-
"WADW-WRTL":
|
257
|
-
"WADR":
|
258
|
-
"RTL":
|
259
|
-
"WWHL":
|
260
|
-
"WADW":
|
261
|
-
"WHL":
|
255
|
+
"WADW-WRTL": product.priceFacets["Regular Price"],
|
256
|
+
"WADR": product.priceFacets["Regular Price"],
|
257
|
+
"RTL": product.priceFacets["Regular Price"],
|
258
|
+
"WWHL": product.priceFacets["Wholesale Price"],
|
259
|
+
"WADW": product.priceFacets["Wholesale Price"],
|
260
|
+
"WHL": product.priceFacets["Wholesale Price"]
|
262
261
|
},
|
263
262
|
"cvMap": {
|
264
263
|
"WWHL": productCVPrice,
|
@@ -365,14 +364,19 @@ const ProductData = {
|
|
365
364
|
let product = (productData.type && productData.type === "kit") ? productData : productData.sku[count];
|
366
365
|
let imageURL = product.properties.imageURL ? product.properties.imageURL : '';
|
367
366
|
let thumbnailImage = imageURL ? imageURL + '?width=40' : ''
|
368
|
-
|
367
|
+
let productTitle = productData.properties.name
|
369
368
|
|
370
369
|
if (productData.sku && productData.sku.length > 1) {
|
371
370
|
// exclude base product from variants
|
371
|
+
const productArr = productData.sku.filter(p => p.default === true)
|
372
|
+
productTitle = productArr[0].properties.name;
|
373
|
+
product = productArr[0]
|
372
374
|
productData.sku.filter(v => v.identifier.substring(2, 4) !== "55").map(variant => {
|
373
|
-
variants[variant.identifier] = this.eqProductVariantMapper(variant);
|
375
|
+
variants[variant.identifier] = this.eqProductVariantMapper(variant, product);
|
374
376
|
return variant;
|
375
377
|
});
|
378
|
+
|
379
|
+
|
376
380
|
}
|
377
381
|
|
378
382
|
const {
|
@@ -384,11 +388,9 @@ const ProductData = {
|
|
384
388
|
PVPrice
|
385
389
|
} = this.getEqProductPromotions(product);
|
386
390
|
const productPrice = eventName ? defaultProductPrice : product.priceFacets["Regular Price"];
|
387
|
-
const discountedPrice = eventName ? computedPrice : product.priceFacets["
|
391
|
+
const discountedPrice = eventName ? computedPrice : product.priceFacets["Regular Price"];
|
388
392
|
const productCVPrice = eventName ? CVPrice : product.priceFacets.CV;
|
389
393
|
const productPVPrice = eventName ? PVPrice : product.priceFacets.PV;
|
390
|
-
const wholeSalePrice = eventName ? defaultProductPrice : product.priceFacets["Wholesale Price"];
|
391
|
-
|
392
394
|
|
393
395
|
product.childSkus = await this.fetchChildSkus(product);
|
394
396
|
product.availableQuantity = mapAvailableQuantity(product);
|
@@ -396,7 +398,7 @@ const ProductData = {
|
|
396
398
|
...product,
|
397
399
|
"sku": product.identifier,
|
398
400
|
"globalProductID": productData.identifier,
|
399
|
-
"title":
|
401
|
+
"title": productTitle,
|
400
402
|
"country": product.properties.market,
|
401
403
|
"language": "en",
|
402
404
|
"shortDescr": productData.properties.description,
|
@@ -432,13 +434,13 @@ const ProductData = {
|
|
432
434
|
"priceType": "WRTL",
|
433
435
|
"price": discountedPrice,
|
434
436
|
"priceMap": {
|
435
|
-
"WRTL": productPrice,
|
436
|
-
"WADW-WRTL":
|
437
|
-
"WADR":
|
438
|
-
"RTL":
|
439
|
-
"WADW":
|
440
|
-
"WHL":
|
441
|
-
"WWHL":
|
437
|
+
"WRTL": productPrice,
|
438
|
+
"WADW-WRTL": product.priceFacets["Regular Price"],
|
439
|
+
"WADR": product.priceFacets["Regular Price"],
|
440
|
+
"RTL": product.priceFacets["Regular Price"],
|
441
|
+
"WADW": product.priceFacets["Wholesale Price"],
|
442
|
+
"WHL": product.priceFacets["Wholesale Price"],
|
443
|
+
"WWHL": product.priceFacets["Wholesale Price"]
|
442
444
|
},
|
443
445
|
"cvMap": {
|
444
446
|
"WWHL": productCVPrice,
|
@@ -513,7 +515,7 @@ const ProductData = {
|
|
513
515
|
};
|
514
516
|
},
|
515
517
|
|
516
|
-
mapEquinoxSKUExists: function(exists) {
|
518
|
+
mapEquinoxSKUExists: function (exists) {
|
517
519
|
// this could be avoided if only we are using response mapper
|
518
520
|
// for equinox products that exists.
|
519
521
|
// @todo: clean-up
|