@nuskin/ns-product-lib 2.11.0-cx24-5092.33 → 2.11.0-cx24-5092.35

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.35](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.34...v2.11.0-cx24-5092.35) (2023-09-27)
2
+
3
+
4
+ ### Fix
5
+
6
+ * unit testing ([5a356e9](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/5a356e964d235ec3dbe557b42a016b7cd06640b1))
7
+
8
+ # [2.11.0-cx24-5092.34](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.33...v2.11.0-cx24-5092.34) (2023-09-19)
9
+
10
+
11
+ ### New
12
+
13
+ * Moving from AEM to CS for EQ markets ([9f649ff](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9f649ff3b0e5f6e076d2bdbf429c24b45e685ff6))
14
+
1
15
  # [2.11.0-cx24-5092.33](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.11.0-cx24-5092.32...v2.11.0-cx24-5092.33) (2023-09-19)
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.33",
3
+ "version": "2.11.0-cx24-5092.35",
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": {
@@ -120,7 +120,7 @@ const ProductGraphQL = {
120
120
 
121
121
  mapProductRegular: async function (response, market, locale) {
122
122
  let res = {
123
- "sku": response.variants[0].id,
123
+ "sku": response.variants[0].sku,
124
124
  "globalProductID": response.id,
125
125
  "title": response.variants[0].title,
126
126
  "country": market,
@@ -268,7 +268,40 @@ const ProductGraphQL = {
268
268
  },
269
269
  mapProductBundle: async function (response, market, locale) {
270
270
  let res;
271
- res = this.mapProductRegular(response.bundle.kitProducts[0].product, market, locale)
271
+ const kitBundleProducts = response.bundle.kitProducts;
272
+
273
+ res = this.mapProductRegular(kitBundleProducts[0].product, market, locale)
274
+ res.priceMap = {
275
+ "WRTL": (response.bundle.totalPrice) ? response.bundle.totalPrice.retail : response.bundle.price.retail,
276
+ "WADW-WRTL": (response.bundle.totalPrice) ? response.bundle.totalPrice.retailSubscription : response.bundle.price.retail,
277
+ "WADR": (response.bundle.totalPrice) ? response.bundle.totalPrice.retailSubscription : response.bundle.price.retailSubscription, //retail ADR (subscription) price
278
+ "RTL": (response.bundle.totalPrice) ? response.bundle.totalPrice.retail : response.bundle.price.retail,
279
+ "WWHL": (response.bundle.totalPrice) ? response.bundle.totalPrice.wholesale : response.bundle.price.wholesale,
280
+ "WADW": (response.bundle.totalPrice) ? response.bundle.totalPrice.wholesaleSubscription : response.bundle.price.wholesaleSubscription,//wholesale ADR (subscription price)
281
+ "WHL": (response.bundle.totalPrice) ? response.bundle.totalPrice.wholesale : response.bundle.price.wholesale
282
+ }
283
+ res.childSkus = [{
284
+ productId: response.bundle.id,
285
+ type: response.bundle.type,
286
+ skuId: '',
287
+ availableChannels: response.bundle.availableChannels
288
+ },
289
+ ...response.bundle.kitProducts(kitProduct => {
290
+ return {
291
+ productId: kitProduct.product.id,
292
+ skuId: kitProduct.product.id,
293
+ skuQuantity: kitProduct.quantity,
294
+ type: "MANDATORY",
295
+ inventory: {
296
+ atpQty: kitProduct.variants[0].availableQuantity,
297
+ backOrderDate: kitProduct.variants[0].status.backorderedAvailableDate,
298
+ backOrdered: kitProduct.variants[0].status.isBackordered
299
+ }
300
+ }
301
+ })];
302
+
303
+ res.status = this.switchStatusFromEquinox(response.bundle.status.status)
304
+
272
305
  return res;
273
306
  },
274
307
  /**