@nuskin/cs-product-lib 1.0.29-9877-2.1 → 1.0.29

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/cs-product-lib",
3
- "version": "1.0.29-9877-2.1",
3
+ "version": "1.0.29",
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/csProduct.js CHANGED
@@ -81,7 +81,7 @@ const csProduct = (props) => {
81
81
  return props
82
82
  }
83
83
 
84
- const removeInvalidVariants = async (products, locale, translations) => {
84
+ const removeInvalidVariants = async (products = [], locale, translations) => {
85
85
  const validSkus = []
86
86
  for (const product of products) {
87
87
  for (const variant of product?.variants || []) {
@@ -365,10 +365,11 @@ const csProduct = (props) => {
365
365
  url += `&skip=${start}`
366
366
  }
367
367
  try {
368
- const res = await axios(url)
369
-
370
- if (onlyEntries) return res?.data?.entries ? res.data.entries : res
371
- else return res?.data?.entries ? res.data : res
368
+ const res = await axios(url);
369
+ if (onlyEntries) {
370
+ return res?.data?.entries ? res.data.entries : res
371
+ }
372
+ return res?.data?.entries ? res.data : res
372
373
  } catch (error) {
373
374
  return error
374
375
  }
@@ -15,7 +15,7 @@ const formatProduct = (parent, homeUrl) => {
15
15
  productImages: helpers?.getProductImages(parent),
16
16
  salesLabel: parent?.sales_label,
17
17
  salesText: parent?.sales_text,
18
- salesRichText: helpers?.mapSalesRichText(parent?.sales_rich_text),
18
+ activeEventDisclaimer: helpers?.mapActiveEventDisclaimer(parent?.active_event_disclaimer),
19
19
  description: entities.decodeHTML(parent?.short_description || ''),
20
20
  salesDisclaimer: helpers?.mapSalesDisclaimer(parent?.sales_disclaimer),
21
21
  features: helpers?.mapFeatures(parent),
@@ -15,7 +15,7 @@ const formatVariant = (parent) => ({
15
15
  title: parent?.name || parent?.defaults?.name,
16
16
  salesLabel: parent?.sales_label,
17
17
  salesText: parent?.sales_text,
18
- salesRichText: helpers?.mapSalesRichText(parent?.sales_rich_text),
18
+ activeEventDisclaimer: helpers?.mapActiveEventDisclaimer(parent?.active_event_disclaimer),
19
19
  description: entities?.decodeHTML(
20
20
  parent?.short_description_override || parent?.defaults?.description || ''
21
21
  ),
package/src/helpers.js CHANGED
@@ -935,12 +935,12 @@ function mapDisclaimerWarnings(disclaimerWarnings) {
935
935
  .filter((disclaimerWarning) => !!disclaimerWarning)
936
936
  }
937
937
 
938
- function mapSalesRichText(salesRichText) {
938
+ function mapActiveEventDisclaimer(activeEventDisclaimer) {
939
939
 
940
- if (!hasRichTextContent(salesRichText)) {
940
+ if (!hasRichTextContent(activeEventDisclaimer)) {
941
941
  return null
942
942
  }
943
- const markdownText = createMarkdown(salesRichText, '', '', '')
943
+ const markdownText = createMarkdown(activeEventDisclaimer, '', '', '')
944
944
  return {
945
945
  markdownText
946
946
  }
@@ -1180,5 +1180,5 @@ module.exports = {
1180
1180
  mapFaqs,
1181
1181
  createMarkdownFromRTE,
1182
1182
  benefitsToMarkdown,
1183
- mapSalesRichText
1183
+ mapActiveEventDisclaimer
1184
1184
  }