@nuskin/ns-product-lib 2.11.0-cx24-5092.21 → 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,17 @@
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
+
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)
9
+
10
+
11
+ ### New
12
+
13
+ * Moving from AEM to CS for EQ markets ([85f3d2d](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/85f3d2d724c80b9afefd5d4af6fc9fd4ab5abc32))
14
+
1
15
  # [2.11.0-cx24-5092.21](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.20...v2.11.0-cx24-5092.21) (2023-09-14)
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.21",
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,18 +100,32 @@ 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,
108
122
  "language": locale,
109
123
  "shortDescr": response.variants[0].description,
110
124
  "longDescr": response.variants[0].productDetails.description,
111
- "fullImage": response.productImages[0].url,
112
- "imageAltText": response.productImages[0].alt,
125
+ "fullImage": response.variants[0].productImages[0].url,
126
+ "imageAltText": response.variants[0].productImages[0].alt,
113
127
 
114
- "thumbnail": response.productImages[0].thumbnail,
128
+ "thumbnail": response.variants[0].productImages[0].thumbnail,
115
129
  "ingredients": response.variants[0].ingredients,
116
130
  "benefits": response.variants[0].benefits,
117
131
  "usage": response.variants[0].usage,
@@ -151,9 +165,10 @@ const ProductGraphQL = {
151
165
  "size": response.variants[0].size,
152
166
  "status": this.switchStatusFromEquinox(response.variants[0].status.status),
153
167
  "variantType": "Other",
154
- "variantDropdownLabel": response.variantSelectLabel || response.variants[0].title,
168
+ "variantDropdownLabel": response.variantSelectLabel || '',
155
169
  "variantDropdownPlaceholder": "Select Type",
156
- "variantsLabel": response.variantSelectLabel || response.variants[0].title,
170
+ "variantsLabel": response.variants[0].variantLabel || '',
171
+ "variants": [],
157
172
  "groupOffer": false,
158
173
  "personalOffer": false,
159
174
  "savedEventName": '',
@@ -166,8 +181,14 @@ const ProductGraphQL = {
166
181
  "equinoxProductId": response.id,
167
182
  "properties": {}
168
183
  }
169
- const promotions = await this.getProductPromotions(response.variants[0].sku, response.variants[0].id, config, locale)
170
- 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
+ })
171
192
  return res;
172
193
  },
173
194
  /**