@nuskin/ns-product-lib 2.9.0-cx24-4460.1 → 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 +24 -4
- package/package.json +1 -1
- package/src/productData.js +29 -13
package/CHANGELOG.md
CHANGED
@@ -1,10 +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
|
+
|
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)
|
7
|
+
|
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)
|
9
|
+
|
10
|
+
|
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
|
5
26
|
|
6
|
-
*
|
7
|
-
* 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))
|
8
28
|
|
9
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)
|
10
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,7 +74,7 @@ const ProductData = {
|
|
68
74
|
|
69
75
|
const filter = skuFilter.join(" OR ")
|
70
76
|
|
71
|
-
const url = `${config.
|
77
|
+
const url = `${config.API_Base_URLs}/orchestrationservices/storefront/catalogs/search/`;
|
72
78
|
const href = `${url}?filter='\\\\''${encodeURI(filter)}'\\''`;
|
73
79
|
axios.interceptors.response.use((res) => res, productNotFoundInterceptor);
|
74
80
|
const response = await axios.request({
|
@@ -78,7 +84,7 @@ const ProductData = {
|
|
78
84
|
locale,
|
79
85
|
storeId: config.store_id
|
80
86
|
},
|
81
|
-
headers: this.getEquinoxRequestHeaders(),
|
87
|
+
headers: this.getEquinoxRequestHeaders({shoppingContext}),
|
82
88
|
responseType: 'json',
|
83
89
|
withCredentials: true
|
84
90
|
});
|
@@ -87,10 +93,16 @@ const ProductData = {
|
|
87
93
|
return response;
|
88
94
|
},
|
89
95
|
|
90
|
-
getEquinoxRequestHeaders() {
|
91
|
-
|
96
|
+
getEquinoxRequestHeaders(option) {
|
97
|
+
const header = {
|
92
98
|
'Content-Type': 'application/json'
|
93
|
-
}
|
99
|
+
}
|
100
|
+
|
101
|
+
if (option.shoppingContext && option.shoppingContext.overrides) {
|
102
|
+
header.showwholesalepricing = option.shoppingContext.overrides.showWholeSalePricing;
|
103
|
+
}
|
104
|
+
|
105
|
+
return header;
|
94
106
|
},
|
95
107
|
|
96
108
|
getProductFromLegacy: async function (skus, locale) {
|
@@ -254,10 +266,10 @@ const ProductData = {
|
|
254
266
|
"priceMap": {
|
255
267
|
"WRTL": productPrice,
|
256
268
|
"WADW-WRTL": productPrice,
|
257
|
-
"WADR": productPrice,
|
269
|
+
"WADR": productPrice, //retail ADR (subscription) price
|
258
270
|
"RTL": productPrice,
|
259
271
|
"WWHL": wholeSalePrice,
|
260
|
-
"WADW":
|
272
|
+
"WADW": discountedPrice,//wholesale ADR (subscription price)
|
261
273
|
"WHL": wholeSalePrice
|
262
274
|
},
|
263
275
|
"cvMap": {
|
@@ -364,8 +376,9 @@ const ProductData = {
|
|
364
376
|
let variants = {};
|
365
377
|
let product = (productData.type && productData.type === "kit") ? productData : productData.sku[count];
|
366
378
|
let imageURL = product.properties.imageURL ? product.properties.imageURL : '';
|
367
|
-
let thumbnailImage = imageURL ? imageURL + '?width=40' : ''
|
368
|
-
|
379
|
+
let thumbnailImage = imageURL ? imageURL + '?width=40' : '';
|
380
|
+
let productTitle = productData.properties.name;
|
381
|
+
let productSku = product.identifier
|
369
382
|
|
370
383
|
if (productData.sku && productData.sku.length > 1) {
|
371
384
|
// exclude base product from variants
|
@@ -373,6 +386,9 @@ const ProductData = {
|
|
373
386
|
variants[variant.identifier] = this.eqProductVariantMapper(variant);
|
374
387
|
return variant;
|
375
388
|
});
|
389
|
+
const productArr = productData.sku.filter(p => p.default === true)
|
390
|
+
productTitle = productArr[0].properties.name;
|
391
|
+
productSku = productArr[0].identifier
|
376
392
|
}
|
377
393
|
|
378
394
|
const {
|
@@ -394,9 +410,9 @@ const ProductData = {
|
|
394
410
|
product.availableQuantity = mapAvailableQuantity(product);
|
395
411
|
product = {
|
396
412
|
...product,
|
397
|
-
"sku":
|
413
|
+
"sku": productSku,
|
398
414
|
"globalProductID": productData.identifier,
|
399
|
-
"title":
|
415
|
+
"title": productTitle,
|
400
416
|
"country": product.properties.market,
|
401
417
|
"language": "en",
|
402
418
|
"shortDescr": productData.properties.description,
|
@@ -434,9 +450,9 @@ const ProductData = {
|
|
434
450
|
"priceMap": {
|
435
451
|
"WRTL": productPrice, //regular | retail price
|
436
452
|
"WADW-WRTL": productPrice,
|
437
|
-
"WADR": productPrice,
|
453
|
+
"WADR": productPrice, //retail ADR (subscription price)
|
438
454
|
"RTL": productPrice,
|
439
|
-
"WADW":
|
455
|
+
"WADW": discountedPrice,//wholesale ADR (subscription price)
|
440
456
|
"WHL": wholeSalePrice,
|
441
457
|
"WWHL": wholeSalePrice
|
442
458
|
},
|