@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 +1 -1
- package/src/csProduct.js +6 -5
- package/src/formatProduct.js +1 -1
- package/src/formatVariant.js +1 -1
- package/src/helpers.js +4 -4
package/package.json
CHANGED
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
|
-
|
|
371
|
-
|
|
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
|
}
|
package/src/formatProduct.js
CHANGED
|
@@ -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
|
-
|
|
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),
|
package/src/formatVariant.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
938
|
+
function mapActiveEventDisclaimer(activeEventDisclaimer) {
|
|
939
939
|
|
|
940
|
-
if (!hasRichTextContent(
|
|
940
|
+
if (!hasRichTextContent(activeEventDisclaimer)) {
|
|
941
941
|
return null
|
|
942
942
|
}
|
|
943
|
-
const markdownText = createMarkdown(
|
|
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
|
-
|
|
1183
|
+
mapActiveEventDisclaimer
|
|
1184
1184
|
}
|