@nuskin/ns-product-lib
Advanced tools
Comparing version 2.4.2-cx24-2612.1.1 to 2.5.0-cx24-2462.1.1
@@ -1,7 +0,19 @@ | ||
## [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) | ||
# [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) | ||
### Release | ||
* Automated changes by GitLab pipeline [skip ci] ([62c7b7d](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/62c7b7d38d24f3f267c859ae7f16af55f8d950f1)) | ||
### Update | ||
* map product images to carousel images (CX24-2462) ([1e17c6e](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/1e17c6ec39e54b4bdb2bb804c997eb14c9e501d5)) | ||
* map remaining equinox properties (CX24-2462) ([dafe0c0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/dafe0c0349207439d05ba0e45a71c8868a1d65bc)) | ||
## [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) | ||
### Fix | ||
* [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)) | ||
* [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)) | ||
@@ -46,2 +58,4 @@ ## [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) | ||
<<<<<<< HEAD | ||
======= | ||
### New | ||
@@ -51,2 +65,3 @@ | ||
>>>>>>> CX24.2 | ||
### Release | ||
@@ -59,2 +74,5 @@ | ||
<<<<<<< HEAD | ||
* map product images to carousel images (CX24-2462) ([1e17c6e](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/1e17c6ec39e54b4bdb2bb804c997eb14c9e501d5)) | ||
======= | ||
* 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) | ||
@@ -78,2 +96,3 @@ * 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) | ||
* 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) | ||
>>>>>>> CX24.2 | ||
@@ -80,0 +99,0 @@ # [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) |
{ | ||
"name": "@nuskin/ns-product-lib", | ||
"version": "2.4.2-cx24-2612.1.1", | ||
"version": "2.5.0-cx24-2462.1.1", | ||
"description": "This project contains shared Product models and code between the backend and frontend.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -84,3 +84,3 @@ "use strict"; | ||
*/ | ||
getLegacyRequestHeaders: function(marketConfig) { | ||
getLegacyRequestHeaders: function (marketConfig) { | ||
return { | ||
@@ -227,3 +227,3 @@ 'Content-Type': 'application/json', | ||
} else { | ||
thumbnailImage = imageURL.replace(regex,'40.40') | ||
thumbnailImage = imageURL.replace(regex, '40.40') | ||
} | ||
@@ -248,14 +248,15 @@ | ||
"imageAltText": data.properties.name, | ||
"productCarouselImages": [ | ||
{ | ||
"contentType": "img", | ||
"src": "/content/products/24/00/35/24003529/jcr:content/fullImage.imgw.1280.1280.png", | ||
"alt": "" | ||
} | ||
], | ||
productCarouselImages: data.sku[count].properties.productImages | ||
? JSON.parse(data.sku[count].properties.productImages).map(img => ( | ||
{ | ||
contentType: /\.jpg/i.test(img.url) ? 'img' : 'video', | ||
src: img.url, | ||
alt: img.alt | ||
} | ||
)) : [], | ||
"thumbnail": thumbnailImage, | ||
"ingredients": data.properties.ingredients, | ||
"benefits": data.properties.benefits, | ||
"usage": data.properties.usage, | ||
"resources": data.sku[count].properties.resources, | ||
benefits: mapBenefits(data.properties.benefits), | ||
usage: mapUsage(data.properties.usage), | ||
resources: mapResources(data.properties.resources), | ||
"videos": "", | ||
@@ -274,3 +275,3 @@ "movie": "", | ||
"points": "", | ||
"cv": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : '', | ||
"cv": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : '', | ||
"pv": data.sku[count].priceFacets.PV, | ||
@@ -416,11 +417,55 @@ "priceType": "WRTL", | ||
const sortedProducts = products.sort(function (a, b) { | ||
return products.sort(function (a, b) { | ||
return skus.indexOf(a.sku) - skus.indexOf(b.sku); | ||
}); | ||
return sortedProducts | ||
} | ||
} | ||
function mapBenefits(benefits) { | ||
if (!benefits) { | ||
return {}; | ||
} | ||
const list = JSON.parse(benefits) | ||
.map(item => item.benefits.map(benefit => benefit).join('')) | ||
.join(''); | ||
return { | ||
benefitsHTML: list, | ||
benefitsText: 'Benefits', | ||
benefitItems: [] | ||
}; | ||
} | ||
function mapResources(resources) { | ||
if (!resources) { | ||
return {}; | ||
} | ||
const text = JSON.parse(resources) | ||
.map(res => `<p><a href="${res.url}" target="_blank">${res.title}</a></p>`) | ||
.join(''); | ||
return { | ||
resourcesHTML: text, | ||
resourcesText: 'Resources', | ||
resourceLinks: [] | ||
} | ||
} | ||
function mapUsage(usage) { | ||
if (!usage) { | ||
return {}; | ||
} | ||
const text = JSON.parse(usage).additionalText | ||
.map(t => t).join(''); | ||
return { | ||
usageHTML: text, | ||
usageText: 'Usage' | ||
} | ||
} | ||
module.exports = ProductData; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
101060
1904