@nuskin/ns-product-lib 2.11.0-cx24-5092.22 → 2.11.0-cx24-5092.24

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.11.0-cx24-5092.24](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.23...v2.11.0-cx24-5092.24) (2023-09-15)
2
+
3
+
4
+ ### New
5
+
6
+ * Moving from AEM to CS for EQ markets ([aa54de4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/aa54de461ca03dbf2a67161b1ce352216425b6e8))
7
+
8
+ # [2.11.0-cx24-5092.23](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.22...v2.11.0-cx24-5092.23) (2023-09-15)
9
+
10
+
11
+ ### New
12
+
13
+ * Moving from AEM to CS for EQ markets ([f7c76ec](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/f7c76ec6445f262758600d3e99307ee7f4c85be4))
14
+
1
15
  # [2.11.0-cx24-5092.22](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.21...v2.11.0-cx24-5092.22) (2023-09-15)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.11.0-cx24-5092.22",
3
+ "version": "2.11.0-cx24-5092.24",
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": {
@@ -100,8 +100,22 @@ const ProductGraphQL = {
100
100
 
101
101
  mapResponseToProduct: async function (response, market, locale, config) {
102
102
  console.log('RESPONSE ' + JSON.stringify(response))
103
+ let res;
104
+ if (response.variants.length >= 1) {
105
+ res = await this.mapProductRegular(response, market, locale, config)
106
+ }
107
+ if (response.bundles) {
108
+ //nothing to do yet
109
+ }
110
+
111
+ const promotions = await this.getProductPromotions(response.variants[0].sku, response.variants[0].id, config, locale)
112
+ console.log(promotions)
113
+ return res;
114
+ },
115
+
116
+ mapProductRegular: async function (response, market, locale) {
103
117
  let res = {
104
- "sku": response.variants[0].sku,
118
+ "sku": response.variants[0].id,
105
119
  "globalProductID": response.id,
106
120
  "title": response.variants[0].title,
107
121
  "country": market,
@@ -126,13 +140,13 @@ const ProductGraphQL = {
126
140
  "priceType": "WRTL",
127
141
  "price": 0,
128
142
  "priceMap": {
129
- "WRTL": response.variants[0].totalPrice.retail,
130
- "WADW-WRTL": response.variants[0].totalPrice.retailSubscription,
131
- "WADR": response.variants[0].totalPrice.retailSubscription, //retail ADR (subscription) price
132
- "RTL": response.variants[0].totalPrice.retail,
133
- "WWHL": response.variants[0].totalPrice.wholesale,
134
- "WADW": response.variants[0].totalPrice.wholesaleSubscription,//wholesale ADR (subscription price)
135
- "WHL": response.variants[0].totalPrice.wholesale
143
+ "WRTL": (response.variants[0].totalPrice) ? response.variants[0].totalPrice.retail : response.variants[0].price.retail,
144
+ "WADW-WRTL": (response.variants[0].totalPrice) ? response.variants[0].totalPrice.retailSubscription : response.variants[0].price.retail,
145
+ "WADR": (response.variants[0].totalPrice) ? response.variants[0].totalPrice.retailSubscription : response.variants[0].price.retailSubscription, //retail ADR (subscription) price
146
+ "RTL": (response.variants[0].totalPrice) ? response.variants[0].totalPrice.retail : response.variants[0].price.retail,
147
+ "WWHL": (response.variants[0].totalPrice) ? response.variants[0].totalPrice.wholesale : response.variants[0].price.wholesale,
148
+ "WADW": (response.variants[0].totalPrice) ? response.variants[0].totalPrice.wholesaleSubscription : response.variants[0].price.wholesaleSubscription,//wholesale ADR (subscription price)
149
+ "WHL": (response.variants[0].totalPrice) ? response.variants[0].totalPrice.wholesale : response.variants[0].price.wholesale
136
150
  },
137
151
  "cvMap": {
138
152
  "WWHL": response.variants[0].points.wholesale.cv,
@@ -167,8 +181,14 @@ const ProductGraphQL = {
167
181
  "equinoxProductId": response.id,
168
182
  "properties": {}
169
183
  }
170
- const promotions = await this.getProductPromotions(response.variants[0].sku, response.variants[0].id, config, locale)
171
- console.log(promotions)
184
+ return res;
185
+
186
+ },
187
+ mapProductBundle: async function (response, market, locale) {
188
+ let res;
189
+ response.bundle.kitProducts.forEach((product) => {
190
+ res = this.mapProductRegular(product, market, locale)
191
+ })
172
192
  return res;
173
193
  },
174
194
  /**