@nuskin/ns-product-lib 2.5.0-CX24.3.1 → 2.5.0-CX24.3.2
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +107 -0
- package/package.json +2 -1
- package/src/contentstack/contentstack.js +0 -1
- package/src/product.js +4 -0
- package/src/productData.js +18 -13
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,110 @@
|
|
1
|
+
# [2.5.0-CX24.3.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-CX24.3.1...v2.5.0-CX24.3.2) (2022-12-20)
|
2
|
+
|
3
|
+
|
4
|
+
### Fix
|
5
|
+
|
6
|
+
* Slow response of add-to-cart button function for Equinox Cart ([14394b2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/14394b299afbd53254a3ec053ad41e68ed526dfe))
|
7
|
+
* Unit Tests ([ace52c6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/ace52c6418991d0263a1e1f8d99901e724abf923))
|
8
|
+
|
9
|
+
### Update
|
10
|
+
|
11
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([6934570](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/69345701e6b44754ffeb648ead56f0288aadeb16))
|
12
|
+
|
13
|
+
# [2.5.0-cx24-2931.1.12](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2931.1.11...v2.5.0-cx24-2931.1.12) (2022-12-15)
|
14
|
+
|
15
|
+
|
16
|
+
### Update
|
17
|
+
|
18
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([407402f](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/407402fbcfb3a782dec95b5ff1038c1fb3fe31ca))
|
19
|
+
|
20
|
+
# [2.5.0-cx24-2931.1.11](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2931.1.10...v2.5.0-cx24-2931.1.11) (2022-12-14)
|
21
|
+
|
22
|
+
|
23
|
+
### Update
|
24
|
+
|
25
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([fc2010c](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/fc2010cdf7dfb7ecd53940d64e94f43c045135c5))
|
26
|
+
|
27
|
+
# [2.5.0-cx24-2931.1.10](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2931.1.9...v2.5.0-cx24-2931.1.10) (2022-12-14)
|
28
|
+
|
29
|
+
|
30
|
+
### Update
|
31
|
+
|
32
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([73cd345](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/73cd3459f0d3a4486a6b7798bdb1dab0231e7c5a))
|
33
|
+
|
34
|
+
# [2.5.0-cx24-2931.1.9](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2931.1.8...v2.5.0-cx24-2931.1.9) (2022-12-14)
|
35
|
+
|
36
|
+
|
37
|
+
### Update
|
38
|
+
|
39
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([24096f4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/24096f46bc77881ca7273b10d9fbef85757d2d92))
|
40
|
+
|
41
|
+
# [2.5.0-cx24-2931.1.8](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2931.1.7...v2.5.0-cx24-2931.1.8) (2022-12-14)
|
42
|
+
|
43
|
+
|
44
|
+
### Update
|
45
|
+
|
46
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([2f1a466](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/2f1a466c39ea57e095e8de53cd4651aa2cf6cc8d))
|
47
|
+
|
48
|
+
# [2.5.0-cx24-2931.1.7](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2931.1.6...v2.5.0-cx24-2931.1.7) (2022-12-14)
|
49
|
+
|
50
|
+
|
51
|
+
### Update
|
52
|
+
|
53
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([f54271c](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/f54271c59f12f0eefb20a7ced67efe7058f079a3))
|
54
|
+
|
55
|
+
# [2.5.0-cx24-2931.1.6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2931.1.5...v2.5.0-cx24-2931.1.6) (2022-12-14)
|
56
|
+
|
57
|
+
|
58
|
+
### Update
|
59
|
+
|
60
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([527d80f](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/527d80fee9396e87cf1e92c223790c33bcba681f))
|
61
|
+
|
62
|
+
# [2.5.0-cx24-2931.1.5](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2931.1.4...v2.5.0-cx24-2931.1.5) (2022-12-14)
|
63
|
+
|
64
|
+
|
65
|
+
### New
|
66
|
+
|
67
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([0373219](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/03732199ae3864b9d690b58523011598187356ea))
|
68
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([34b6954](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/34b6954dcd751a390ee2395fe1a3ca42481affc8))
|
69
|
+
|
70
|
+
### Update
|
71
|
+
|
72
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([6cf3a1d](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/6cf3a1d38cc0af3affade68d441a30a4b9dc7789))
|
73
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([11655c4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/11655c46484aa6e6e359522c707c64f496755976))
|
74
|
+
|
75
|
+
# [2.5.0-cx24-2931.1.4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2931.1.3...v2.5.0-cx24-2931.1.4) (2022-12-14)
|
76
|
+
|
77
|
+
|
78
|
+
### Update
|
79
|
+
|
80
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([9abdf43](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9abdf4326fa55692045f5a3cc91f5725afe94cb2))
|
81
|
+
|
82
|
+
# [2.5.0-cx24-2931.1.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2931.1.2...v2.5.0-cx24-2931.1.3) (2022-12-14)
|
83
|
+
|
84
|
+
|
85
|
+
### Update
|
86
|
+
|
87
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([0f4bf7d](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/0f4bf7dfb6e1c3c6d6b0c00fd08cca3c1920cbec))
|
88
|
+
|
89
|
+
# [2.5.0-cx24-2931.1.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2931.1.1...v2.5.0-cx24-2931.1.2) (2022-12-14)
|
90
|
+
|
91
|
+
|
92
|
+
### Update
|
93
|
+
|
94
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([73acfe8](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/73acfe8c8aac29e11367f329889956b857460d72))
|
95
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([65c81f5](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/65c81f5486712690f9cda8faf4e2264238009e82))
|
96
|
+
|
97
|
+
# [2.5.0-cx24-2931.1.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-CX24.3.1...v2.5.0-cx24-2931.1.1) (2022-12-13)
|
98
|
+
|
99
|
+
|
100
|
+
### Update
|
101
|
+
|
102
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([e8931ac](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/e8931aca51591c59b401c4c386f23c8f7d4c5a90))
|
103
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([4a1949a](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/4a1949a20213478994ff51e4b035f52271b7a840))
|
104
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([9a0c9cb](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9a0c9cb75a39cd1b77bd6272ac573d4f9b628975))
|
105
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([622c608](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/622c60867b07f0fccd316423cba1500a8470e9e2))
|
106
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([c276e62](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/c276e6223953cf72b791887274a5f11d218696e0))
|
107
|
+
|
1
108
|
# [2.5.0-CX24.3.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.3.1) (2022-12-06)
|
2
109
|
|
3
110
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nuskin/ns-product-lib",
|
3
|
-
"version": "2.5.0-CX24.3.
|
3
|
+
"version": "2.5.0-CX24.3.2",
|
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": {
|
@@ -31,6 +31,7 @@
|
|
31
31
|
"prettier": "1.19.1"
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
|
+
"@nuskin/configuration-sdk": "1.0.1",
|
34
35
|
"@nuskin/ns-common-lib": "1.4.5",
|
35
36
|
"@nuskin/ns-util": "3.107.0",
|
36
37
|
"axios": "0.27.2",
|
@@ -21,7 +21,6 @@ function usePlatformSpecificVariables() {
|
|
21
21
|
}
|
22
22
|
|
23
23
|
function useWebEnvironment() {
|
24
|
-
console.log('web');
|
25
24
|
const env = getEnvironmentFromUrl(window.location.host);
|
26
25
|
const envConfig = config.getCredentials(env);
|
27
26
|
const baseURL = `${envConfig.url}/stacks/${envConfig.apiKey}?environment=${envConfig.env}`;
|
package/src/product.js
CHANGED
@@ -75,6 +75,7 @@ const Product = function(productData) {
|
|
75
75
|
//equinox inventory / stock label
|
76
76
|
//@example "IN STOCK"
|
77
77
|
this.inventory = "";
|
78
|
+
this.equinoxProductId = "";
|
78
79
|
|
79
80
|
this.setMarketAttributes = function(productStatus) {
|
80
81
|
if (productStatus.marketAttributes) {
|
@@ -532,6 +533,7 @@ const Product = function(productData) {
|
|
532
533
|
retData.restrictedMarkets = this.restrictedMarkets;
|
533
534
|
retData.addOns = this.addOns;
|
534
535
|
retData.inventory = this.inventory;
|
536
|
+
retData.equinoxProductId = this.equinoxProductId;
|
535
537
|
|
536
538
|
return retData;
|
537
539
|
};
|
@@ -671,6 +673,8 @@ const Product = function(productData) {
|
|
671
673
|
if (data.agelocme) {
|
672
674
|
this.agelocme = new Agelocme(data.agelocme);
|
673
675
|
}
|
676
|
+
|
677
|
+
this.equinoxProductId = data.equinoxProductId;
|
674
678
|
}
|
675
679
|
};
|
676
680
|
|
package/src/productData.js
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
"use strict";
|
2
|
+
const { getConfiguration } = require('@nuskin/configuration-sdk');
|
3
|
+
// import { ConfigService } from '@nuskin/ns-util';
|
2
4
|
const axios = require("axios");
|
3
5
|
const contentstack = require('./contentstack/contentstack');
|
4
6
|
const Product = require("./product");
|
@@ -15,28 +17,30 @@ const ProductData = {
|
|
15
17
|
const localeMarket = `${locale}_${market}`;
|
16
18
|
|
17
19
|
if (isEquinoxEnabled) {
|
18
|
-
|
19
|
-
|
20
|
-
if (marketConfig !== null) {
|
21
|
-
return await this.getProductFromEquinox(skus, localeMarket, marketConfig.store_id);
|
22
|
-
}
|
20
|
+
return await this.getProductFromEquinox(skus, localeMarket);
|
23
21
|
}
|
24
22
|
|
25
23
|
return await this.getProductFromLegacy(skus, localeMarket);
|
26
24
|
},
|
27
|
-
|
28
|
-
getProductFromEquinox: async function (skus, locale
|
29
|
-
const
|
25
|
+
|
26
|
+
getProductFromEquinox: async function (skus, locale) {
|
27
|
+
const config = (await getConfiguration({
|
28
|
+
configMapNames: ['Equinox_Markets'],
|
29
|
+
country: locale.split('_')[1],
|
30
|
+
environment: 'test',
|
31
|
+
clientId: '735b1eb810304bba966af0891ab54053'
|
32
|
+
})).Equinox_Markets;
|
33
|
+
const filter = `{"filters": [{"field": "index_key_skuId","operation": "IN", "value": "${skus.toString()}"}]}`;
|
30
34
|
axios.defaults.withCredentials = true;
|
31
35
|
|
32
|
-
const url =
|
36
|
+
const url = `${config.API_Base_URLs}/orchestrationservices/storefront/catalogs/search/`;
|
33
37
|
const href = `${url}?filter=${encodeURI(filter)}`;
|
34
38
|
const response = await axios.request({
|
35
39
|
method: 'get',
|
36
40
|
url: href,
|
37
41
|
params: {
|
38
42
|
locale,
|
39
|
-
storeId:
|
43
|
+
storeId: config.store_id
|
40
44
|
},
|
41
45
|
headers: this.getEquinoxRequestHeaders(),
|
42
46
|
responseType: 'json'
|
@@ -198,7 +202,8 @@ const ProductData = {
|
|
198
202
|
"earn": true
|
199
203
|
},
|
200
204
|
"restrictedMarkets": [],
|
201
|
-
"addOns": []
|
205
|
+
"addOns": [],
|
206
|
+
"equinoxProductId": eqVariant.identifier
|
202
207
|
};
|
203
208
|
},
|
204
209
|
|
@@ -356,8 +361,8 @@ const ProductData = {
|
|
356
361
|
},
|
357
362
|
"restrictedMarkets": [],
|
358
363
|
"addOns": [],
|
359
|
-
"inventory": data.sku[count].inventory || "" //inventory label
|
360
|
-
|
364
|
+
"inventory": data.sku[count].inventory || "", //inventory label
|
365
|
+
"equinoxProductId": data.identifier
|
361
366
|
};
|
362
367
|
let newProduct = new Product(prod);
|
363
368
|
return newProduct
|