@nuskin/ns-product-lib 2.4.2-cx24-2612.1.1 → 2.5.0-cx24-2462.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +21 -2
- package/package.json +1 -1
- package/src/productData.js +60 -15
package/CHANGELOG.md
CHANGED
@@ -1,9 +1,21 @@
|
|
1
|
-
|
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)
|
2
|
+
|
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
|
+
### Update
|
9
|
+
|
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))
|
12
|
+
|
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)
|
2
14
|
|
3
15
|
|
4
16
|
### Fix
|
5
17
|
|
6
|
-
* [Equinox market] Admin > Move up/down/top/bottom of featured products and edit bundle is not working ([
|
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))
|
7
19
|
|
8
20
|
## [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)
|
9
21
|
|
@@ -43,10 +55,13 @@
|
|
43
55
|
|
44
56
|
* 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)
|
45
57
|
|
58
|
+
<<<<<<< HEAD
|
59
|
+
=======
|
46
60
|
### New
|
47
61
|
|
48
62
|
* 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)
|
49
63
|
|
64
|
+
>>>>>>> CX24.2
|
50
65
|
### Release
|
51
66
|
|
52
67
|
* Automated changes by GitLab pipeline [skip ci] ([8f75316](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/8f75316b692ddccda5b7bea830ee6dc625b942c7))
|
@@ -54,6 +69,9 @@
|
|
54
69
|
|
55
70
|
### Update
|
56
71
|
|
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
|
+
=======
|
57
75
|
* 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)
|
58
76
|
* 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)
|
59
77
|
* use platform-specific values when initialized ([18de006](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/18de006211ab396f4d7fa40d0089c8e185d9cee9))
|
@@ -72,6 +90,7 @@
|
|
72
90
|
|
73
91
|
* 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)
|
74
92
|
* 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
|
75
94
|
|
76
95
|
# [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)
|
77
96
|
|
package/package.json
CHANGED
package/src/productData.js
CHANGED
@@ -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,
|
@@ -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,18 +243,19 @@ const ProductData = {
|
|
243
243
|
"longDescr": data.properties.productDetailsDescription,
|
244
244
|
"fullImage": imageURL,
|
245
245
|
"imageAltText": data.properties.name,
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
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
|
+
)) : [],
|
253
254
|
"thumbnail": thumbnailImage,
|
254
255
|
"ingredients": data.properties.ingredients,
|
255
|
-
|
256
|
-
|
257
|
-
|
256
|
+
benefits: mapBenefits(data.properties.benefits),
|
257
|
+
usage: mapUsage(data.properties.usage),
|
258
|
+
resources: mapResources(data.properties.resources),
|
258
259
|
"videos": "",
|
259
260
|
"movie": "",
|
260
261
|
"youtube": "",
|
@@ -268,7 +269,7 @@ const ProductData = {
|
|
268
269
|
"availableQuantity": data.sku[count].inventoryProperties.atpQty,
|
269
270
|
"maxQuantity": 999,
|
270
271
|
"points": "",
|
271
|
-
"cv": (data.sku[count].priceFacets.CV) ?
|
272
|
+
"cv": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : '',
|
272
273
|
"pv": data.sku[count].priceFacets.PV,
|
273
274
|
"priceType": "WRTL",
|
274
275
|
"price": data.sku[count].priceFacets["Regular Price"],
|
@@ -409,12 +410,56 @@ const ProductData = {
|
|
409
410
|
return products
|
410
411
|
}
|
411
412
|
|
412
|
-
|
413
|
+
return products.sort(function (a, b) {
|
413
414
|
return skus.indexOf(a.sku) - skus.indexOf(b.sku);
|
414
415
|
});
|
415
416
|
|
416
|
-
|
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('');
|
417
459
|
|
460
|
+
return {
|
461
|
+
usageHTML: text,
|
462
|
+
usageText: 'Usage'
|
418
463
|
}
|
419
464
|
}
|
420
465
|
|