@nuskin/cs-product-lib 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/helpers.js +6 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/cs-product-lib",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Library for pulling and parsing product content (and applying business logic) retrieved from Contentstack",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/helpers.js CHANGED
@@ -473,14 +473,17 @@ function mapImage(image) {
473
473
  }
474
474
  }
475
475
  if ((image || {}).derivatives) {
476
+ // isSvg will only work if a public link to the original derivative is authored on the bynder asset.
477
+ const isSvg = (image.derivatives || {}).original && (image.derivatives || {}).original.includes('.svg');
476
478
  return {
477
- url: (image.derivatives || {}).webImage,
479
+ url: isSvg ? (image.derivatives || {}).original : (image.derivatives || {}).webImage,
478
480
  alt: image.description || image.name || '',
479
481
  thumbnail: (image.derivatives || {}).thumbnail
480
482
  }
481
483
  } else if ((image || {}).files) {
484
+ const isSvg = (image.files.original || {}).url && (image.files.original || {}).url.includes('.svg');
482
485
  return {
483
- url: (image.files.webImage || {}).url,
486
+ url: isSvg ? (image.files.original || {}).url : (image.files.webImage || {}).url,
484
487
  alt: image.description || image.name || '',
485
488
  thumbnail: (image.files.thumbnail || {}).url
486
489
  }
@@ -1034,7 +1037,7 @@ function mapWarranty(product) {
1034
1037
  !isNullOrEmpty(linkText) && !isNullOrEmpty(message)
1035
1038
  ? translationPresent
1036
1039
  : defaultTranslation
1037
- const html = `<a href='${warranty.derivatives.original}' target='blank'><img src='https://media.nuskin.com/m/6e6218c498daee3e/Small-shield-check-24.jpg' alt='warranty icon' />${translation}</a>`
1040
+ const html = `<a href='${warranty.derivatives.original}' target='blank'><img src='https://media.nuskin.com/m/6e6218c498daee3e/original/shield-check-24.svg' alt='warranty icon' />${translation}</a>`
1038
1041
  if (warranty.derivatives.original) {
1039
1042
  // only send if externally available bynder doc url exists
1040
1043
  return htmlToMarkdown(html)