@nuskin/ns-product-lib 2.4.0 → 2.4.1-cx12-5910.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/contentstack/contentstack.js +12 -1
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [2.4.1-cx12-5910.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.4.0...v2.4.1-cx12-5910.1) (2022-10-26)
|
2
|
+
|
3
|
+
|
4
|
+
### Fix
|
5
|
+
|
6
|
+
* try catch block for generating env (#CX12-5910) ([86930c3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/86930c31a70bfe35a5136bc338ec618e04d860eb)), closes [#CX12-5910](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX12-5910)
|
7
|
+
|
1
8
|
# [2.4.0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.3.0...v2.4.0) (2022-10-26)
|
2
9
|
|
3
10
|
|
package/package.json
CHANGED
@@ -3,8 +3,19 @@ const axios = require('axios');
|
|
3
3
|
const { getEnvironmentFromUrl } = require('@nuskin/ns-common-lib');
|
4
4
|
const config = require('./environment');
|
5
5
|
|
6
|
+
let env = 'unknown';
|
7
|
+
|
8
|
+
// ns-product-lib should be multi-platform compatible i.e. lambda, web, or react native etc.
|
9
|
+
try {
|
10
|
+
env = getEnvironmentFromUrl(window.location.host);
|
11
|
+
} catch (error) {
|
12
|
+
console.log("getting env from url not supported. window is likely unavailable:");
|
13
|
+
console.log("Name: ", error.name);
|
14
|
+
console.log("Message: ", error.message);
|
15
|
+
console.log("Stack Trace: ", error.stack);
|
16
|
+
}
|
17
|
+
|
6
18
|
// contentstack HTTP service
|
7
|
-
const env = getEnvironmentFromUrl(window.location.host);
|
8
19
|
const envConfig = config.getCredentials(env);
|
9
20
|
const baseURL = `${envConfig.url}/stacks/${envConfig.apiKey}?environment=${envConfig.env}`;
|
10
21
|
const headers = {
|