@nuskin/ns-product-lib 2.11.0-cx24-5092.15 → 2.11.0-cx24-5092.17

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ # [2.11.0-cx24-5092.17](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.16...v2.11.0-cx24-5092.17) (2023-09-14)
2
+
3
+
4
+ ### New
5
+
6
+ * Moving from AEM to CS for EQ markets ([a55c20f](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/a55c20fbd26268215a6d79bc43b818704730c1b3))
7
+ * Moving from AEM to CS for EQ markets ([b58bab6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/b58bab6b7ef78e0444a3f918afc844772de832f8))
8
+
9
+ # [2.11.0-cx24-5092.16](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.15...v2.11.0-cx24-5092.16) (2023-09-14)
10
+
11
+
12
+ ### New
13
+
14
+ * Moving from AEM to CS for EQ markets ([95c3072](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/95c30729cdbccd4a1520a276057d227d7050f02d))
15
+ * Moving from AEM to CS for EQ markets ([8dd3f14](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/8dd3f14feaddd492c657cee8bd630c6c7b533e83))
16
+
1
17
  # [2.11.0-cx24-5092.15](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.14...v2.11.0-cx24-5092.15) (2023-09-14)
2
18
 
3
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.11.0-cx24-5092.15",
3
+ "version": "2.11.0-cx24-5092.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": {
@@ -28,7 +28,7 @@ const ProductData = {
28
28
 
29
29
  const config = (await getConfiguration(['Equinox_Markets'])).Equinox_Markets;
30
30
  if (config.active) {
31
- graphQLResponse = ProductGraphQL.getProductFromGraphQL(skus[0], market, locale)
31
+ graphQLResponse = await ProductGraphQL.getProductFromGraphQL(skus[0], market, locale)
32
32
  console.log(graphQLResponse)
33
33
  return graphQLResponse;
34
34
  }
@@ -44,6 +44,7 @@ const ProductGraphQL = {
44
44
  data: payload,
45
45
  responseType: 'json'
46
46
  });
47
+
47
48
  return {
48
49
  data: {
49
50
  "status": 200,
@@ -64,6 +65,37 @@ const ProductGraphQL = {
64
65
 
65
66
 
66
67
 
68
+ },
69
+
70
+ getProductPromotions: async function (sku, productId, config, locale) {
71
+
72
+ const url = config.API_Base_URLs
73
+ const sub = config.kong_subdomains + '/catalogs/products/'
74
+ const storeId = config.store_id
75
+ const payload = {
76
+ "productId": productId,
77
+ "categoryId": ["all_products"],
78
+ "skus": [{
79
+ "skuId": sku,
80
+ "productId": productId,
81
+ "type": "DEFAULT"
82
+ }],
83
+ "isSubscriptionIncludedInPromotion": true
84
+ }
85
+
86
+ try {
87
+ const response = await axios.request({
88
+ method: 'post',
89
+ url: url + sub + productId + '/promotions?locale=' + locale + '&storeId=' + storeId,
90
+ data: payload,
91
+ responseType: 'json'
92
+ });
93
+ return response
94
+ } catch (e) {
95
+ console.log(e)
96
+ }
97
+
98
+
67
99
  },
68
100
 
69
101
  mapResponseToProduct: function (response, market, locale) {