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

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [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)
2
+
3
+
4
+ ### New
5
+
6
+ * Moving from AEM to CS for EQ markets ([f7c76ec](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/f7c76ec6445f262758600d3e99307ee7f4c85be4))
7
+
1
8
  # [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
9
 
3
10
 
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.23",
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,
@@ -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
  /**