@nuskin/ns-product-lib 1.5.0-cx24-1810.14 → 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 CHANGED
@@ -1,3 +1,25 @@
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
+
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)
10
+
11
+
12
+ ### New
13
+
14
+ * 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)
15
+
16
+ # [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)
17
+
18
+
19
+ ### New
20
+
21
+ * Get Product Data from Equinox (#CX24-1810) ([a0979fe](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/a0979feb655a99991a3bc08c3e9251c1638bd072)), 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.14](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.5.0-cx24-1810.13...v1.5.0-cx24-1810.14) (2022-08-01)
2
24
 
3
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "1.5.0-cx24-1810.14",
3
+ "version": "1.5.0-cx24-1810.17",
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": {
@@ -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: 'https://storefront.api.wts.nuskin.io/orchestrationservices/storefront/catalogs/search/',
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
 
@@ -44,9 +51,13 @@ const ProductData = {
44
51
  }, */
45
52
 
46
53
  eqProductMapper: function (productDataResponse) {
47
- let prodArr = []
54
+ let prodArr = [];
55
+ let prod = [];
56
+ let count = 0;
48
57
  productDataResponse.forEach((data, index) => {
49
- prodArr[index] = {
58
+ count++
59
+
60
+ prod = {
50
61
  "sku": data.sku[0].identifier,
51
62
  "globalProductID": data.identifier,
52
63
  "title": data.properties.name,
@@ -141,7 +152,8 @@ const ProductData = {
141
152
  "eventName": null,
142
153
  "sizeWeight": "120 capsules",
143
154
  "nettoWeight": "",
144
- "variants": {},
155
+ "variants": {
156
+ },
145
157
  "searchScore": 0,
146
158
  "isExclusive": false,
147
159
  "marketAttributes": {
@@ -152,15 +164,21 @@ const ProductData = {
152
164
  "restrictedMarkets": [],
153
165
  "addOns": []
154
166
  };
167
+ let newProduct = new product(prod);
168
+ prodArr[index] = newProduct;
169
+
155
170
  });
156
171
 
157
172
  let data = {
158
- products: prodArr
173
+ products: prodArr,
174
+ count: count
159
175
  };
160
176
  return {
161
- "status": 200,
162
- "messages": [],
163
- "data": data
177
+ data: {
178
+ "status": 200,
179
+ "messages": [],
180
+ "data": data
181
+ }
164
182
  }
165
183
 
166
184
  },