@nuskin/ns-product-lib 2.5.0-cx24-2462.1.1 → 2.5.0-cx24-2862.1

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,21 +1,17 @@
1
- # [2.5.0-cx24-2462.1.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.4.2-CX24.2.1...v2.5.0-cx24-2462.1.1) (2022-11-07)
1
+ # [2.5.0-cx24-2862.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.4.2-cx24-2612.1.1...v2.5.0-cx24-2862.1) (2022-11-10)
2
2
 
3
3
 
4
- ### Release
5
-
6
- * Automated changes by GitLab pipeline [skip ci] ([62c7b7d](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/62c7b7d38d24f3f267c859ae7f16af55f8d950f1))
7
-
8
4
  ### Update
9
5
 
10
- * map product images to carousel images (CX24-2462) ([1e17c6e](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/1e17c6ec39e54b4bdb2bb804c997eb14c9e501d5))
11
- * map remaining equinox properties (CX24-2462) ([dafe0c0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/dafe0c0349207439d05ba0e45a71c8868a1d65bc))
6
+ * set ADR pricing from equinox (CX24-2862) ([9f6dfb7](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9f6dfb726f40b1335411318629a2ebdf1b4dac96))
7
+ * set ADR pricing from equinox (CX24-2862) ([61f550a](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/61f550a21c5cc9d062549ec2aaf2758aebccf2be))
12
8
 
13
- ## [2.4.2-CX24.2.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.4.1...v2.4.2-CX24.2.1) (2022-11-07)
9
+ ## [2.4.2-cx24-2612.1.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.4.1...v2.4.2-cx24-2612.1.1) (2022-11-07)
14
10
 
15
11
 
16
12
  ### Fix
17
13
 
18
- * [Equinox market] Admin > Move up/down/top/bottom of featured products and edit bundle is not working ([82611ca](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/82611cab93c990ed1ce05690feb9d00967090dea))
14
+ * [Equinox market] Admin > Move up/down/top/bottom of featured products and edit bundle is not working ([9d9d106](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9d9d10667477b4c7ef7bf8ec013aab322d3cdbcc))
19
15
 
20
16
  ## [2.4.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.4.0...v2.4.1) (2022-11-06)
21
17
 
@@ -55,13 +51,10 @@
55
51
 
56
52
  * To make multiple products work (#CX24-2444) ([ce4c483](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/ce4c483b7fbb0527e60045d8174fd503a67e63fa)), closes [#CX24-2444](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2444)
57
53
 
58
- <<<<<<< HEAD
59
- =======
60
54
  ### New
61
55
 
62
56
  * added support for inventory label (#CX24-2186) ([3e27481](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/3e2748106cd6098086dbd6b738964deabacc875d)), closes [#CX24-2186](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2186)
63
57
 
64
- >>>>>>> CX24.2
65
58
  ### Release
66
59
 
67
60
  * Automated changes by GitLab pipeline [skip ci] ([8f75316](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/8f75316b692ddccda5b7bea830ee6dc625b942c7))
@@ -69,9 +62,6 @@
69
62
 
70
63
  ### Update
71
64
 
72
- <<<<<<< HEAD
73
- * map product images to carousel images (CX24-2462) ([1e17c6e](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/1e17c6ec39e54b4bdb2bb804c997eb14c9e501d5))
74
- =======
75
65
  * added support for variant and price (#CX24-2186) ([e0bf8f2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/e0bf8f280a838dfa4cc613e5bc34d254dbdc8e1a)), closes [#CX24-2186](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2186)
76
66
  * added variant label (#CX24-2186) ([4c223b3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/4c223b34438ed73cb824716cacb93482486f8195)), closes [#CX24-2186](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2186)
77
67
  * use platform-specific values when initialized ([18de006](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/18de006211ab396f4d7fa40d0089c8e185d9cee9))
@@ -90,7 +80,6 @@
90
80
 
91
81
  * added support for variant and price (#CX24-2186) ([e0bf8f2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/e0bf8f280a838dfa4cc613e5bc34d254dbdc8e1a)), closes [#CX24-2186](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2186)
92
82
  * added variant label (#CX24-2186) ([4c223b3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/4c223b34438ed73cb824716cacb93482486f8195)), closes [#CX24-2186](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2186)
93
- >>>>>>> CX24.2
94
83
 
95
84
  # [2.3.0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.2.0...v2.3.0) (2022-10-14)
96
85
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.5.0-cx24-2462.1.1",
3
+ "version": "2.5.0-cx24-2862.1",
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": {
@@ -81,7 +81,7 @@ const ProductData = {
81
81
  /**
82
82
  * @param {contentstack.MarketConfig} marketConfig
83
83
  */
84
- getLegacyRequestHeaders: function (marketConfig) {
84
+ getLegacyRequestHeaders: function(marketConfig) {
85
85
  return {
86
86
  'Content-Type': 'application/json',
87
87
  client_id: marketConfig.checkout_client_id,
@@ -149,10 +149,10 @@ const ProductData = {
149
149
  "priceMap": {
150
150
  "WRTL": eqVariant.priceFacets["Regular Price"],
151
151
  "WADW-WRTL": eqVariant.priceFacets["Regular Price"],
152
- "WADR": 9999.01,
152
+ "WADR": eqVariant.priceFacets["Regular Price"],
153
153
  "RTL": eqVariant.priceFacets["Regular Price"],
154
154
  "WWHL": eqVariant.priceFacets["Wholesale Price"],
155
- "WADW": 9998.01,
155
+ "WADW": eqVariant.priceFacets["Wholesale Price"],
156
156
  "WHL": eqVariant.priceFacets["Wholesale Price"]
157
157
  },
158
158
  "cvMap": {
@@ -223,7 +223,7 @@ const ProductData = {
223
223
  if (imageURL.includes('contentstack')) {
224
224
  thumbnailImage = imageURL + '?width=40'
225
225
  } else {
226
- thumbnailImage = imageURL.replace(regex, '40.40')
226
+ thumbnailImage = imageURL.replace(regex,'40.40')
227
227
  }
228
228
 
229
229
  if (data.sku && data.sku.length > 1) {
@@ -243,19 +243,18 @@ const ProductData = {
243
243
  "longDescr": data.properties.productDetailsDescription,
244
244
  "fullImage": imageURL,
245
245
  "imageAltText": data.properties.name,
246
- productCarouselImages: data.sku[count].properties.productImages
247
- ? JSON.parse(data.sku[count].properties.productImages).map(img => (
248
- {
249
- contentType: /\.jpg/i.test(img.url) ? 'img' : 'video',
250
- src: img.url,
251
- alt: img.alt
252
- }
253
- )) : [],
246
+ "productCarouselImages": [
247
+ {
248
+ "contentType": "img",
249
+ "src": "/content/products/24/00/35/24003529/jcr:content/fullImage.imgw.1280.1280.png",
250
+ "alt": ""
251
+ }
252
+ ],
254
253
  "thumbnail": thumbnailImage,
255
254
  "ingredients": data.properties.ingredients,
256
- benefits: mapBenefits(data.properties.benefits),
257
- usage: mapUsage(data.properties.usage),
258
- resources: mapResources(data.properties.resources),
255
+ "benefits": data.properties.benefits,
256
+ "usage": data.properties.usage,
257
+ "resources": data.sku[count].properties.resources,
259
258
  "videos": "",
260
259
  "movie": "",
261
260
  "youtube": "",
@@ -269,16 +268,16 @@ const ProductData = {
269
268
  "availableQuantity": data.sku[count].inventoryProperties.atpQty,
270
269
  "maxQuantity": 999,
271
270
  "points": "",
272
- "cv": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : '',
271
+ "cv": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : '',
273
272
  "pv": data.sku[count].priceFacets.PV,
274
273
  "priceType": "WRTL",
275
274
  "price": data.sku[count].priceFacets["Regular Price"],
276
275
  "priceMap": {
277
276
  "WRTL": data.sku[count].priceFacets["Regular Price"],
278
277
  "WADW-WRTL": data.sku[count].priceFacets["Regular Price"],
279
- "WADR": 9999.01,
278
+ "WADR": data.sku[count].priceFacets["Regular Price"],
280
279
  "RTL": data.sku[count].priceFacets["Regular Price"],
281
- "WADW": 9998.01,
280
+ "WADW": data.sku[count].priceFacets["Wholesale Price"],
282
281
  "WHL": data.sku[count].priceFacets["Wholesale Price"],
283
282
  "WWHL": data.sku[count].priceFacets["Wholesale Price"]
284
283
  },
@@ -410,56 +409,12 @@ const ProductData = {
410
409
  return products
411
410
  }
412
411
 
413
- return products.sort(function (a, b) {
412
+ const sortedProducts = products.sort(function (a, b) {
414
413
  return skus.indexOf(a.sku) - skus.indexOf(b.sku);
415
414
  });
416
415
 
417
- }
418
- }
419
-
420
- function mapBenefits(benefits) {
421
- if (!benefits) {
422
- return {};
423
- }
424
-
425
- const list = JSON.parse(benefits)
426
- .map(item => item.benefits.map(benefit => benefit).join(''))
427
- .join('');
428
-
429
- return {
430
- benefitsHTML: list,
431
- benefitsText: 'Benefits',
432
- benefitItems: []
433
- };
434
- }
435
-
436
- function mapResources(resources) {
437
- if (!resources) {
438
- return {};
439
- }
440
-
441
- const text = JSON.parse(resources)
442
- .map(res => `<p><a href="${res.url}" target="_blank">${res.title}</a></p>`)
443
- .join('');
444
-
445
- return {
446
- resourcesHTML: text,
447
- resourcesText: 'Resources',
448
- resourceLinks: []
449
- }
450
- }
451
-
452
- function mapUsage(usage) {
453
- if (!usage) {
454
- return {};
455
- }
456
-
457
- const text = JSON.parse(usage).additionalText
458
- .map(t => t).join('');
416
+ return sortedProducts
459
417
 
460
- return {
461
- usageHTML: text,
462
- usageText: 'Usage'
463
418
  }
464
419
  }
465
420