@nuskin/ns-product-lib 2.9.0-cx24-4460.2 → 2.9.0-cx24-4377.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +20 -8
- package/package.json +1 -1
- package/src/productData.js +29 -16
package/CHANGELOG.md
CHANGED
@@ -1,18 +1,30 @@
|
|
1
|
-
# [2.9.0-cx24-
|
1
|
+
# [2.9.0-cx24-4377.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.8.3-cx24-4377.1...v2.9.0-cx24-4377.1) (2023-07-03)
|
2
2
|
|
3
3
|
|
4
|
-
###
|
4
|
+
### Update
|
5
5
|
|
6
|
-
*
|
7
|
-
* Change API Base URLs for My Site ([5621d64](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/5621d64be86d75c91837e11ca8f4267c49707971))
|
6
|
+
* added showWholesalePrice in the header for product search (#CX24-4377) ([dc18916](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/dc189169241eb869caf69407767c7a6ab3c18438)), closes [#CX24-4377](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-4377)
|
8
7
|
|
9
|
-
|
8
|
+
## [2.8.3-cx24-4377.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.8.2...v2.8.3-cx24-4377.1) (2023-06-27)
|
10
9
|
|
11
10
|
|
12
|
-
###
|
11
|
+
### Fix
|
12
|
+
|
13
|
+
* adr promotion pricing (#CX24-4377) ([c1ea833](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/c1ea833d5b80da366e3dd0bd45cefcb18d096a34)), closes [#CX24-4377](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-4377)
|
14
|
+
|
15
|
+
## [2.8.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.8.1...v2.8.2) (2023-06-21)
|
16
|
+
|
17
|
+
|
18
|
+
### Fix
|
19
|
+
|
20
|
+
* added shopping context checking ([8714953](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/8714953113f4f1970cacd4f4f6b59ecc61e767eb))
|
21
|
+
|
22
|
+
## [2.8.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.8.0...v2.8.1) (2023-05-23)
|
23
|
+
|
24
|
+
|
25
|
+
### Fix
|
13
26
|
|
14
|
-
*
|
15
|
-
* Change API Base URLs for My Site ([1f9ba11](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/1f9ba11f63ef85e9a444e39080e9277a41fa004d))
|
27
|
+
* Multiple variants add to cart not adding correct sku ([968ed05](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/968ed055b5f5024579ac256f26c0d58ba409fcb9))
|
16
28
|
|
17
29
|
# [2.8.0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.1...v2.8.0) (2023-05-02)
|
18
30
|
|
package/package.json
CHANGED
package/src/productData.js
CHANGED
@@ -57,6 +57,12 @@ const ProductData = {
|
|
57
57
|
searchEquinoxProduct: async function (skus, locale, config) {
|
58
58
|
let skuFilter = [];
|
59
59
|
|
60
|
+
const shoppingContext = window && window.aem && window.aem.ShoppingContext && window.aem.ShoppingContext.getShoppingContext();
|
61
|
+
|
62
|
+
if ((shoppingContext && shoppingContext.context === 'storefront') || window.location.hostname.includes(".mynuskin.com")) {
|
63
|
+
config.API_Base_URLs = config.MySite_API_Base_URLs
|
64
|
+
}
|
65
|
+
|
60
66
|
if (Array.isArray(skus)) {
|
61
67
|
skus.forEach((sku) => {
|
62
68
|
skuFilter.push(`index_key_productId="${sku}" OR index_key_skuId="${sku}"`)
|
@@ -68,10 +74,7 @@ const ProductData = {
|
|
68
74
|
|
69
75
|
const filter = skuFilter.join(" OR ")
|
70
76
|
|
71
|
-
|
72
|
-
if (window && window.aem && window.aem.ShoppingContext && window.aem.ShoppingContext.getShoppingContext().context === 'storefront') {
|
73
|
-
url = `${config.MySite_API_Base_URLs}/orchestrationservices/storefront/catalogs/search/`;
|
74
|
-
}
|
77
|
+
const url = `${config.API_Base_URLs}/orchestrationservices/storefront/catalogs/search/`;
|
75
78
|
const href = `${url}?filter='\\\\''${encodeURI(filter)}'\\''`;
|
76
79
|
axios.interceptors.response.use((res) => res, productNotFoundInterceptor);
|
77
80
|
const response = await axios.request({
|
@@ -81,7 +84,7 @@ const ProductData = {
|
|
81
84
|
locale,
|
82
85
|
storeId: config.store_id
|
83
86
|
},
|
84
|
-
headers: this.getEquinoxRequestHeaders(),
|
87
|
+
headers: this.getEquinoxRequestHeaders({shoppingContext}),
|
85
88
|
responseType: 'json',
|
86
89
|
withCredentials: true
|
87
90
|
});
|
@@ -90,10 +93,16 @@ const ProductData = {
|
|
90
93
|
return response;
|
91
94
|
},
|
92
95
|
|
93
|
-
getEquinoxRequestHeaders() {
|
94
|
-
|
96
|
+
getEquinoxRequestHeaders(option) {
|
97
|
+
const header = {
|
95
98
|
'Content-Type': 'application/json'
|
96
|
-
}
|
99
|
+
}
|
100
|
+
|
101
|
+
if (option.shoppingContext && option.shoppingContext.overrides) {
|
102
|
+
header.showwholesalepricing = option.shoppingContext.overrides.showWholeSalePricing;
|
103
|
+
}
|
104
|
+
|
105
|
+
return header;
|
97
106
|
},
|
98
107
|
|
99
108
|
getProductFromLegacy: async function (skus, locale) {
|
@@ -257,10 +266,10 @@ const ProductData = {
|
|
257
266
|
"priceMap": {
|
258
267
|
"WRTL": productPrice,
|
259
268
|
"WADW-WRTL": productPrice,
|
260
|
-
"WADR": productPrice,
|
269
|
+
"WADR": productPrice, //retail ADR (subscription) price
|
261
270
|
"RTL": productPrice,
|
262
271
|
"WWHL": wholeSalePrice,
|
263
|
-
"WADW":
|
272
|
+
"WADW": discountedPrice,//wholesale ADR (subscription price)
|
264
273
|
"WHL": wholeSalePrice
|
265
274
|
},
|
266
275
|
"cvMap": {
|
@@ -367,8 +376,9 @@ const ProductData = {
|
|
367
376
|
let variants = {};
|
368
377
|
let product = (productData.type && productData.type === "kit") ? productData : productData.sku[count];
|
369
378
|
let imageURL = product.properties.imageURL ? product.properties.imageURL : '';
|
370
|
-
let thumbnailImage = imageURL ? imageURL + '?width=40' : ''
|
371
|
-
|
379
|
+
let thumbnailImage = imageURL ? imageURL + '?width=40' : '';
|
380
|
+
let productTitle = productData.properties.name;
|
381
|
+
let productSku = product.identifier
|
372
382
|
|
373
383
|
if (productData.sku && productData.sku.length > 1) {
|
374
384
|
// exclude base product from variants
|
@@ -376,6 +386,9 @@ const ProductData = {
|
|
376
386
|
variants[variant.identifier] = this.eqProductVariantMapper(variant);
|
377
387
|
return variant;
|
378
388
|
});
|
389
|
+
const productArr = productData.sku.filter(p => p.default === true)
|
390
|
+
productTitle = productArr[0].properties.name;
|
391
|
+
productSku = productArr[0].identifier
|
379
392
|
}
|
380
393
|
|
381
394
|
const {
|
@@ -397,9 +410,9 @@ const ProductData = {
|
|
397
410
|
product.availableQuantity = mapAvailableQuantity(product);
|
398
411
|
product = {
|
399
412
|
...product,
|
400
|
-
"sku":
|
413
|
+
"sku": productSku,
|
401
414
|
"globalProductID": productData.identifier,
|
402
|
-
"title":
|
415
|
+
"title": productTitle,
|
403
416
|
"country": product.properties.market,
|
404
417
|
"language": "en",
|
405
418
|
"shortDescr": productData.properties.description,
|
@@ -437,9 +450,9 @@ const ProductData = {
|
|
437
450
|
"priceMap": {
|
438
451
|
"WRTL": productPrice, //regular | retail price
|
439
452
|
"WADW-WRTL": productPrice,
|
440
|
-
"WADR": productPrice,
|
453
|
+
"WADR": productPrice, //retail ADR (subscription price)
|
441
454
|
"RTL": productPrice,
|
442
|
-
"WADW":
|
455
|
+
"WADW": discountedPrice,//wholesale ADR (subscription price)
|
443
456
|
"WHL": wholeSalePrice,
|
444
457
|
"WWHL": wholeSalePrice
|
445
458
|
},
|