@nuskin/ns-product-lib 1.5.0-cx24-1810.16 → 1.5.0-cx24-1810.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/productData.js +16 -4
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# [1.5.0-cx24-1810.17](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.5.0-cx24-1810.16...v1.5.0-cx24-1810.17) (2022-08-10)
|
2
|
+
|
3
|
+
|
4
|
+
### New
|
5
|
+
|
6
|
+
* Get Product Data from Equinox (#CX24-1810) ([f3c98a5](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/f3c98a58fd69e157fc8c98c546f7300a0a40cba0)), closes [#CX24-1810](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-1810)
|
7
|
+
* Get Product Data from Equinox (#CX24-1810) ([f219567](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/f219567ab2193d1b0f5d13ff1e09e3dda8735bb4)), closes [#CX24-1810](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-1810)
|
8
|
+
|
1
9
|
# [1.5.0-cx24-1810.16](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.5.0-cx24-1810.15...v1.5.0-cx24-1810.16) (2022-08-04)
|
2
10
|
|
3
11
|
|
package/package.json
CHANGED
package/src/productData.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
const axios = require("axios");
|
3
|
+
const product = require("./product")
|
3
4
|
|
4
5
|
const ProductData = {
|
5
6
|
getProductData: async function (skus, runConfig, marketConfig, isEqEnabled) {
|
@@ -9,15 +10,21 @@ const ProductData = {
|
|
9
10
|
let filter = '{"filters":[{"field":"index_key_skuId","operation":"IN","value":"' +
|
10
11
|
skus.toString() +
|
11
12
|
'"}]}'
|
12
|
-
axios.defaults.withCredentials = true
|
13
|
+
axios.defaults.withCredentials = true;
|
14
|
+
let apiURL = 'https://storefront.api.wts.nuskin.io/';
|
15
|
+
if (marketConfig.mySiteKongURL!="") {
|
16
|
+
apiURL = marketConfig.mySiteKongURL
|
17
|
+
}
|
13
18
|
let productDataResponse = await axios.request({
|
14
19
|
method: 'get',
|
15
|
-
url:
|
20
|
+
url: `${apiURL}/orchestrationservices/storefront/catalogs/search/`,
|
16
21
|
params: {
|
17
22
|
locale: locale,
|
18
23
|
storeId: '406',
|
19
24
|
filter: filter
|
20
|
-
}
|
25
|
+
},
|
26
|
+
headers: this.getProductDataRequestHeaders(marketConfig),
|
27
|
+
responseType: "json"
|
21
28
|
});
|
22
29
|
productResponse = this.eqProductMapper(productDataResponse.data.product)
|
23
30
|
|
@@ -45,10 +52,12 @@ const ProductData = {
|
|
45
52
|
|
46
53
|
eqProductMapper: function (productDataResponse) {
|
47
54
|
let prodArr = [];
|
55
|
+
let prod = [];
|
48
56
|
let count = 0;
|
49
57
|
productDataResponse.forEach((data, index) => {
|
50
58
|
count++
|
51
|
-
|
59
|
+
|
60
|
+
prod = {
|
52
61
|
"sku": data.sku[0].identifier,
|
53
62
|
"globalProductID": data.identifier,
|
54
63
|
"title": data.properties.name,
|
@@ -155,6 +164,9 @@ const ProductData = {
|
|
155
164
|
"restrictedMarkets": [],
|
156
165
|
"addOns": []
|
157
166
|
};
|
167
|
+
let newProduct = new product(prod);
|
168
|
+
prodArr[index] = newProduct;
|
169
|
+
|
158
170
|
});
|
159
171
|
|
160
172
|
let data = {
|