@nuskin/ns-product-lib 2.5.0-cx24-2179.2.16 → 2.5.0-cx24-refactor.1

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [2.5.0-cx24-refactor.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.17...v2.5.0-cx24-refactor.1) (2023-01-26)
2
+
3
+
4
+ ### Update
5
+
6
+ * refactoring getConfiguration ([76c54aa](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/76c54aa7b3a9a81c56e701314e6515edac451fe2))
7
+
8
+ # [2.5.0-cx24-2179.2.17](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.16...v2.5.0-cx24-2179.2.17) (2023-01-24)
9
+
10
+
11
+ ### Fix
12
+
13
+ * undefined value of the URL (CX24-3122,CX24-3234) ([e6a9a9d](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/e6a9a9de118d2bdfa921a48d1c15f7b2a413e32b))
14
+
1
15
  # [2.5.0-cx24-2179.2.16](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.15...v2.5.0-cx24-2179.2.16) (2023-01-24)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.5.0-cx24-2179.2.16",
3
+ "version": "2.5.0-cx24-refactor.1",
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": {
@@ -6,6 +6,8 @@ const contentstack = require('./contentstack/contentstack');
6
6
  const Product = require("./product");
7
7
  const CustomerTypes = require('./models/customerTypes');
8
8
  const ProductStatus = require("./models/productStatus");
9
+ const { getEnvironmentFromUrl } = require('@nuskin/ns-common-lib');
10
+
9
11
  /** @type {*} */
10
12
  const ProductData = {
11
13
  /**
@@ -16,16 +18,20 @@ const ProductData = {
16
18
  */
17
19
  getProductData: async function (skus, locale, market, isEquinoxEnabled = false) {
18
20
  const localeMarket = `${locale}_${market}`;
19
-
21
+ let env = 'test';
22
+ if (typeof window !== 'undefined') {
23
+ env = getEnvironmentFromUrl(window.location.host);
24
+ }
25
+ console.log(`ENV is ${env}`)
20
26
  if (isEquinoxEnabled) {
21
27
  let config = (await getConfiguration({
22
28
  configMapNames: ['Equinox_Markets'],
23
29
  country: market,
24
- environment: 'test',
30
+ environment: env,
25
31
  clientId: '735b1eb810304bba966af0891ab54053'
26
32
  }));
27
33
 
28
- if (config.country_code != '') {
34
+ if (config.Equinox_Markets.country_code != '') {
29
35
  return await this.getProductFromEquinox(skus, localeMarket, config);
30
36
  }
31
37
  }