@nuskin/ns-product-lib 2.0.0-cx24-2382.1 → 2.0.0-cx24-2382.4

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,24 @@
1
+ # [2.0.0-cx24-2382.4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.0.0-cx24-2382.3...v2.0.0-cx24-2382.4) (2022-09-08)
2
+
3
+
4
+ ### Update
5
+
6
+ * change the parameters passed to getProductData (CX24-2382) ([7e29c09](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/7e29c09396b44ee9f959e2a461940b5fcc382743))
7
+
8
+ # [2.0.0-cx24-2382.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.0.0-cx24-2382.2...v2.0.0-cx24-2382.3) (2022-09-08)
9
+
10
+
11
+ ### Update
12
+
13
+ * change the parameters passed to getProductData (CX24-2382) ([38deea7](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/38deea72a80b2bac07de35f5fa7e45f091f9f0c6))
14
+
15
+ # [2.0.0-cx24-2382.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.0.0-cx24-2382.1...v2.0.0-cx24-2382.2) (2022-09-07)
16
+
17
+
18
+ ### Update
19
+
20
+ * change the parameters passed to getProductData (CX24-2382) ([ba22522](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/ba225229615599f6884a56fc4fd4c172a2e3d83e))
21
+
1
22
  # [2.0.0-cx24-2382.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.6.0-cx24-2382.1...v2.0.0-cx24-2382.1) (2022-09-06)
2
23
 
3
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.0.0-cx24-2382.1",
3
+ "version": "2.0.0-cx24-2382.4",
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": {
@@ -2,6 +2,17 @@
2
2
  const axios = require('axios');
3
3
  const { getEnvironmentFromUrl } = require('@nuskin/ns-common-lib');
4
4
 
5
+ const url = 'https://graphql.contentstack.com';
6
+ const apiKey = 'blt7d4c4f4a1bf5a819';
7
+ const env = 'public-dev';
8
+ const baseURL = `${url}/stacks/${apiKey}?environment=${env}`;
9
+ const deliveryToken = 'cs74599c107573ea7f6c7a1413';
10
+ const headers = {
11
+ 'access_token': `${deliveryToken}`,
12
+ 'Content-Type': 'application/json'
13
+ };
14
+ const http = axios.create({ baseURL, headers });
15
+
5
16
  /**
6
17
  * getAEMConfig fetches the market config from contentstack.
7
18
  *
@@ -18,7 +29,7 @@ async function getAEMConfig() {
18
29
  const env = getEnvironmentFromUrl('test.nuskin.com');
19
30
  const marketConfig = `market_config_${env}`;
20
31
  const variables = { uid: 'blt52b0b83a89763791' };
21
- const query = `query EquinoxMarketsByUid($uid: String!) {
32
+ const query = `query AemConfigByUid($uid: String!) {
22
33
  aem_config(uid: $uid) {
23
34
  title
24
35
  ${marketConfig} {
@@ -30,7 +41,6 @@ async function getAEMConfig() {
30
41
  }`;
31
42
 
32
43
  const { data } = await contentstackService({
33
- method: 'post',
34
44
  data: { variables, query }
35
45
  });
36
46
 
@@ -74,7 +84,6 @@ async function getEquinoxMarkets() {
74
84
  }`;
75
85
 
76
86
  const { data } = await contentstackService({
77
- method: 'post',
78
87
  data: { variables, query }
79
88
  });
80
89
 
@@ -85,8 +94,6 @@ async function getEquinoxMarkets() {
85
94
  }
86
95
  }
87
96
 
88
-
89
-
90
97
  /**
91
98
  * Contentstack HTTP - axios wrapper for contentstack request
92
99
  *
@@ -94,21 +101,10 @@ async function getEquinoxMarkets() {
94
101
  * @return {Promise<import('axios').AxiosResponse>} Promise that resolves to market_list_eq object
95
102
  */
96
103
  async function contentstackService(config) {
97
- const baseURL = 'https://graphql.contentstack.com';
98
- const deliveryToken = 'cs74599c107573ea7f6c7a1413';
99
- const apiKey = 'blt7d4c4f4a1bf5a819';
100
- const env = 'public-dev';
101
- const defaultUrl = `${baseURL}/stacks/${apiKey}?environment=${env}`;
102
-
103
- config.method = config.method || 'get'
104
- config.url = config.url || defaultUrl
105
- config.headers = {
106
- 'access_token': `${deliveryToken}`,
107
- 'Content-Type': 'application/json'
108
- }
104
+ const data = JSON.parse(JSON.stringify(config.data));
109
105
 
110
106
  try {
111
- const response = await axios(config);
107
+ const response = await http.post('', data);
112
108
  return response.data
113
109
  } catch (error) {
114
110
  console.error(error.response.data.errors);
@@ -54,9 +54,9 @@ const ProductData = {
54
54
 
55
55
  getEquinoxRequestHeaders() {
56
56
  return {
57
- authorization: `Bearer ${localStorage.getItem('equinox-okta-token')}`,
58
- 'Content-Type': 'application/json',
59
- 'x-sk-session-id': localStorage.getItem('x-sk-session-id')
57
+ // authorization: `Bearer ${localStorage.getItem('equinox-okta-token')}`,
58
+ 'Content-Type': 'application/json'
59
+ // 'x-sk-session-id': localStorage.getItem('x-sk-session-id')
60
60
  };
61
61
  },
62
62