@nuskin/ns-product-lib 1.5.0-cx24-1810.15 → 1.5.0-cx24-1810.18
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 +22 -0
- package/package.json +1 -1
- package/src/productData.js +20 -7
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
# [1.5.0-cx24-1810.18](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.5.0-cx24-1810.17...v1.5.0-cx24-1810.18) (2022-08-10)
|
2
|
+
|
3
|
+
|
4
|
+
### New
|
5
|
+
|
6
|
+
* Get Product Data from Equinox (#CX24-1810) ([e891f07](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/e891f07e19ece0b3b23f4b6dd8e4d9d9a68fbeea)), closes [#CX24-1810](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-1810)
|
7
|
+
|
8
|
+
# [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)
|
9
|
+
|
10
|
+
|
11
|
+
### New
|
12
|
+
|
13
|
+
* 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)
|
14
|
+
* 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)
|
15
|
+
|
16
|
+
# [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)
|
17
|
+
|
18
|
+
|
19
|
+
### New
|
20
|
+
|
21
|
+
* Get Product Data from Equinox (#CX24-1810) ([70fa10c](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/70fa10c66f7409adcc6ee92421904f1fd9cdc88e)), closes [#CX24-1810](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-1810)
|
22
|
+
|
1
23
|
# [1.5.0-cx24-1810.15](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.5.0-cx24-1810.14...v1.5.0-cx24-1810.15) (2022-08-04)
|
2
24
|
|
3
25
|
|
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,18 @@ 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/';
|
13
15
|
let productDataResponse = await axios.request({
|
14
16
|
method: 'get',
|
15
|
-
url:
|
17
|
+
url: `${apiURL}/orchestrationservices/storefront/catalogs/search/`,
|
16
18
|
params: {
|
17
19
|
locale: locale,
|
18
20
|
storeId: '406',
|
19
21
|
filter: filter
|
20
|
-
}
|
22
|
+
},
|
23
|
+
headers: this.getProductDataRequestHeaders(marketConfig),
|
24
|
+
responseType: "json"
|
21
25
|
});
|
22
26
|
productResponse = this.eqProductMapper(productDataResponse.data.product)
|
23
27
|
|
@@ -44,9 +48,13 @@ const ProductData = {
|
|
44
48
|
}, */
|
45
49
|
|
46
50
|
eqProductMapper: function (productDataResponse) {
|
47
|
-
let prodArr = []
|
51
|
+
let prodArr = [];
|
52
|
+
let prod = [];
|
53
|
+
let count = 0;
|
48
54
|
productDataResponse.forEach((data, index) => {
|
49
|
-
|
55
|
+
count++
|
56
|
+
|
57
|
+
prod = {
|
50
58
|
"sku": data.sku[0].identifier,
|
51
59
|
"globalProductID": data.identifier,
|
52
60
|
"title": data.properties.name,
|
@@ -141,7 +149,8 @@ const ProductData = {
|
|
141
149
|
"eventName": null,
|
142
150
|
"sizeWeight": "120 capsules",
|
143
151
|
"nettoWeight": "",
|
144
|
-
"variants": {
|
152
|
+
"variants": {
|
153
|
+
},
|
145
154
|
"searchScore": 0,
|
146
155
|
"isExclusive": false,
|
147
156
|
"marketAttributes": {
|
@@ -152,10 +161,14 @@ const ProductData = {
|
|
152
161
|
"restrictedMarkets": [],
|
153
162
|
"addOns": []
|
154
163
|
};
|
164
|
+
let newProduct = new product(prod);
|
165
|
+
prodArr[index] = newProduct;
|
166
|
+
|
155
167
|
});
|
156
168
|
|
157
169
|
let data = {
|
158
|
-
products: prodArr
|
170
|
+
products: prodArr,
|
171
|
+
count: count
|
159
172
|
};
|
160
173
|
return {
|
161
174
|
data: {
|