@nuskin/ns-product-lib 2.9.0-cx24-4091.1 → 2.9.0-mysitedomainfix.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +18 -3
- package/package.json +4 -4
- package/src/productData.js +14 -6
package/CHANGELOG.md
CHANGED
@@ -1,9 +1,24 @@
|
|
1
|
-
# [2.9.0-
|
1
|
+
# [2.9.0-mysitedomainfix.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.9.0-cx24-4460.1...v2.9.0-mysitedomainfix.1) (2023-06-20)
|
2
2
|
|
3
3
|
|
4
|
-
###
|
4
|
+
### Fix
|
5
|
+
|
6
|
+
* added the logic to change the domain using the shopping context. ([91449cb](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/91449cb1463eaacb0bc80ba4308c4c8fb6ace777))
|
7
|
+
* changing the equinox api domain so that it stays on the same domain as the mysite domain ([b3e672a](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/b3e672a4dae57012cf61d9a1f4454eaab674c3e7))
|
8
|
+
* 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))
|
9
|
+
|
10
|
+
### Release
|
11
|
+
|
12
|
+
* Automated changes by GitLab pipeline [skip ci] ([679e474](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/679e474ad639ca2cf57652acc8fe71db85fac6fc))
|
13
|
+
* Automated changes by GitLab pipeline [skip ci] ([5500a55](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/5500a550253e487b79045a9b5f5403bc93c3ee5a))
|
14
|
+
|
15
|
+
# [2.9.0-cx24-4460.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.8.0...v2.9.0-cx24-4460.1) (2023-06-20)
|
16
|
+
|
17
|
+
|
18
|
+
### New
|
5
19
|
|
6
|
-
*
|
20
|
+
* Change API Base URLs for My Site ([fb2e309](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/fb2e30953e6e9089da20ac367bad9bf63300a89c))
|
21
|
+
* Change API Base URLs for My Site ([1f9ba11](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/1f9ba11f63ef85e9a444e39080e9277a41fa004d))
|
7
22
|
|
8
23
|
# [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)
|
9
24
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nuskin/ns-product-lib",
|
3
|
-
"version": "2.9.0-
|
3
|
+
"version": "2.9.0-mysitedomainfix.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": {
|
@@ -19,21 +19,21 @@
|
|
19
19
|
"license": "ISC",
|
20
20
|
"homepage": "https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/blob/master/README.md",
|
21
21
|
"devDependencies": {
|
22
|
+
"@babel/preset-env": "^7.22.5",
|
22
23
|
"axios-mock-adapter": "1.21.2",
|
23
24
|
"eslint": "5.16.0",
|
24
25
|
"eslint-config-google": "0.14.0",
|
25
26
|
"eslint-config-prettier": "4.1.0",
|
26
27
|
"eslint-plugin-json": "2.1.1",
|
27
28
|
"eslint-plugin-prettier": "3.1.2",
|
28
|
-
"jest": "29.
|
29
|
+
"jest": "29.5.0",
|
29
30
|
"jest-environment-jsdom": "29.2.2",
|
30
31
|
"jest-sonar-reporter": "2.0.0",
|
31
32
|
"prettier": "1.19.1"
|
32
33
|
},
|
33
34
|
"dependencies": {
|
34
|
-
"@nuskin/configuration-sdk": "2.2.
|
35
|
+
"@nuskin/configuration-sdk": "2.2.3",
|
35
36
|
"@nuskin/ns-common-lib": "1.4.5",
|
36
|
-
"@nuskin/ns-util": "4.3.2",
|
37
37
|
"axios": "0.27.2",
|
38
38
|
"qs": "6.11.0"
|
39
39
|
},
|
package/src/productData.js
CHANGED
@@ -57,6 +57,10 @@ const ProductData = {
|
|
57
57
|
searchEquinoxProduct: async function (skus, locale, config) {
|
58
58
|
let skuFilter = [];
|
59
59
|
|
60
|
+
if (window && window.aem && window.aem.ShoppingContext && window.aem.ShoppingContext.getShoppingContext().context === 'storefront') {
|
61
|
+
config.API_Base_URLs = config.MySite_API_Base_URLs
|
62
|
+
}
|
63
|
+
|
60
64
|
if (Array.isArray(skus)) {
|
61
65
|
skus.forEach((sku) => {
|
62
66
|
skuFilter.push(`index_key_productId="${sku}" OR index_key_skuId="${sku}"`)
|
@@ -68,7 +72,7 @@ const ProductData = {
|
|
68
72
|
|
69
73
|
const filter = skuFilter.join(" OR ")
|
70
74
|
|
71
|
-
const url = `${config.
|
75
|
+
const url = `${config.MySite_API_Base_URLs}/orchestrationservices/storefront/catalogs/search/`;
|
72
76
|
const href = `${url}?filter='\\\\''${encodeURI(filter)}'\\''`;
|
73
77
|
axios.interceptors.response.use((res) => res, productNotFoundInterceptor);
|
74
78
|
const response = await axios.request({
|
@@ -364,8 +368,9 @@ const ProductData = {
|
|
364
368
|
let variants = {};
|
365
369
|
let product = (productData.type && productData.type === "kit") ? productData : productData.sku[count];
|
366
370
|
let imageURL = product.properties.imageURL ? product.properties.imageURL : '';
|
367
|
-
let thumbnailImage = imageURL ? imageURL + '?width=40' : ''
|
368
|
-
|
371
|
+
let thumbnailImage = imageURL ? imageURL + '?width=40' : '';
|
372
|
+
let productTitle = productData.properties.name;
|
373
|
+
let productSku = product.identifier
|
369
374
|
|
370
375
|
if (productData.sku && productData.sku.length > 1) {
|
371
376
|
// exclude base product from variants
|
@@ -373,6 +378,9 @@ const ProductData = {
|
|
373
378
|
variants[variant.identifier] = this.eqProductVariantMapper(variant);
|
374
379
|
return variant;
|
375
380
|
});
|
381
|
+
const productArr = productData.sku.filter(p => p.default === true)
|
382
|
+
productTitle = productArr[0].properties.name;
|
383
|
+
productSku = productArr[0].identifier
|
376
384
|
}
|
377
385
|
|
378
386
|
const {
|
@@ -394,9 +402,9 @@ const ProductData = {
|
|
394
402
|
product.availableQuantity = mapAvailableQuantity(product);
|
395
403
|
product = {
|
396
404
|
...product,
|
397
|
-
"sku":
|
405
|
+
"sku": productSku,
|
398
406
|
"globalProductID": productData.identifier,
|
399
|
-
"title":
|
407
|
+
"title": productTitle,
|
400
408
|
"country": product.properties.market,
|
401
409
|
"language": "en",
|
402
410
|
"shortDescr": productData.properties.description,
|
@@ -513,7 +521,7 @@ const ProductData = {
|
|
513
521
|
};
|
514
522
|
},
|
515
523
|
|
516
|
-
mapEquinoxSKUExists: function(exists) {
|
524
|
+
mapEquinoxSKUExists: function (exists) {
|
517
525
|
// this could be avoided if only we are using response mapper
|
518
526
|
// for equinox products that exists.
|
519
527
|
// @todo: clean-up
|