@nuskin/ns-product-lib 2.5.0-cx24-3168.1 → 2.5.0-cx24-3168.3

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-3168.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-3168.2...v2.5.0-cx24-3168.3) (2023-01-11)
2
+
3
+
4
+ ### Fix
5
+
6
+ * Equinox API called for non equinox market (CX24-3168) ([f056483](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/f056483d277af8aed1af81d70411b7da4bc8f2b6))
7
+
8
+ # [2.5.0-cx24-3168.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-3168.1...v2.5.0-cx24-3168.2) (2023-01-11)
9
+
10
+
11
+ ### Fix
12
+
13
+ * Equinox API called for non equinox market (CX24-3168) ([a399f64](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/a399f64f4a0717d3e61e9454fb3cc039da9c06bb))
14
+
1
15
  # [2.5.0-cx24-3168.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.9...v2.5.0-cx24-3168.1) (2023-01-11)
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-3168.1",
3
+ "version": "2.5.0-cx24-3168.3",
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": {
@@ -4,6 +4,7 @@ const { getConfiguration } = require('@nuskin/configuration-sdk');
4
4
  const axios = require("axios");
5
5
  const contentstack = require('./contentstack/contentstack');
6
6
  const Product = require("./product");
7
+ let config = {};
7
8
 
8
9
  /** @type {*} */
9
10
  const ProductData = {
@@ -15,25 +16,27 @@ const ProductData = {
15
16
  */
16
17
  getProductData: async function (skus, locale, market, isEquinoxEnabled = false) {
17
18
  const localeMarket = `${locale}_${market}`;
18
-
19
+
19
20
  if (isEquinoxEnabled) {
20
- const marketConfig = await contentstack.isMarketEnabled(market);
21
+ if (!config) {
22
+ config = (await getConfiguration({
23
+ configMapNames: ['Equinox_Markets'],
24
+ country: locale.split('_')[1],
25
+ environment: 'test',
26
+ clientId: '735b1eb810304bba966af0891ab54053'
27
+ })).Equinox_Markets;
28
+ }
21
29
 
22
- if (marketConfig !== null) {
23
- return await this.getProductFromEquinox(skus, localeMarket, marketConfig.store_id);
30
+ if (config.store_id !== null) {
31
+ return await this.getProductFromEquinox(skus, localeMarket, config);
24
32
  }
25
33
  }
26
34
 
27
35
  return await this.getProductFromLegacy(skus, localeMarket);
28
36
  },
29
37
 
30
- getProductFromEquinox: async function (skus, locale) {
31
- const config = (await getConfiguration({
32
- configMapNames: ['Equinox_Markets'],
33
- country: locale.split('_')[1],
34
- environment: 'test',
35
- clientId: '735b1eb810304bba966af0891ab54053'
36
- })).Equinox_Markets;
38
+ getProductFromEquinox: async function (skus, locale, config) {
39
+
37
40
  const filter = `{"filters": [{"field": "index_key_skuId","operation": "IN", "value": "${skus.toString()}"}]}`;
38
41
  axios.defaults.withCredentials = true;
39
42