@nuskin/cs-product-lib 1.0.20 → 1.0.21

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.
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@nuskin/cs-product-lib",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
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": {
7
7
  "audit": "yarn audit --level high",
8
8
  "jsdoc": "node_modules/.bin/jsdoc -a all -c jsdoc.json -r -d jsdocs",
9
9
  "lint": "eslint src __tests__",
10
- "test": "jest --coverage"
10
+ "test": "jest --coverage",
11
+ "security-check": "yarn audit --groups 'dependencies devDependencies' --level high",
12
+ "sc": "yarn security-check"
11
13
  },
12
14
  "publishConfig": {
13
15
  "access": "public"
@@ -45,5 +47,11 @@
45
47
  "lodash": "4.17.21",
46
48
  "moment": "^2.29.4",
47
49
  "turndown": "7.1.1"
50
+ },
51
+ "resolutions": {
52
+ "marked": "4.0.10",
53
+ "semver": "7.5.2",
54
+ "underscore": "1.13.1",
55
+ "word-wrap": "1.2.4"
48
56
  }
49
57
  }
@@ -1,5 +1,6 @@
1
1
  const formatTranslations = (parent) => ({
2
2
  // each value is a function with 'parent' which is the ProductTranslations instance
3
+ // *** remember to use optional chaining here to prevent undefined fields keeping graphql from returning other authored data ***
3
4
  product: parent?.product,
4
5
  addToCartButton:
5
6
  parent?.common_strings_overrides?.cart?.add_to_cart_button ||
package/src/helpers.js CHANGED
@@ -500,14 +500,22 @@ function mapImage(image) {
500
500
  const isSvg = (image.derivatives || {}).original && (image.derivatives || {}).original.includes('.svg');
501
501
  return {
502
502
  url: isSvg ? (image.derivatives || {}).original : (image.derivatives || {}).webImage,
503
- alt: image.description || image.name || '',
503
+ alt:
504
+ (image.meta || {}).SEO_Tags ||
505
+ image.description ||
506
+ image.name ||
507
+ '',
504
508
  thumbnail: (image.derivatives || {}).thumbnail
505
509
  }
506
510
  } else if ((image || {}).files) {
507
511
  const isSvg = (image.files.original || {}).url && (image.files.original || {}).url.includes('.svg');
508
512
  return {
509
513
  url: isSvg ? (image.files.original || {}).url : (image.files.webImage || {}).url,
510
- alt: image.description || image.name || '',
514
+ alt:
515
+ (image.meta || {}).SEO_Tags ||
516
+ image.description ||
517
+ image.name ||
518
+ '',
511
519
  thumbnail: (image.files.thumbnail || {}).url
512
520
  }
513
521
  }