From 47103ff69231212357de8ce15d223724777ba7f5 Mon Sep 17 00:00:00 2001 From: Liah Kim Date: Mon, 14 Aug 2023 11:04:41 -0400 Subject: [PATCH 1/5] Update FAQ card to support answerV2 instead of answer J=BACK-2436 TEST=manual Created test site using jambo template and verified that FAQ answer was rendered properly --- cards/faq-accordion/component.js | 9 ++++++++- cards/multilang-faq-accordion/component.js | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/cards/faq-accordion/component.js b/cards/faq-accordion/component.js index 1286f47a0..5e3e5fe59 100644 --- a/cards/faq-accordion/component.js +++ b/cards/faq-accordion/component.js @@ -13,11 +13,18 @@ class faq_accordionCardComponent extends BaseCard['faq-accordion'] { */ dataForRender(profile) { const linkTarget = AnswersExperience.runtimeConfig.get('linkTarget') || '_top'; + let profileAnswer = ''; + if (profile.answerV2 && profile.answerV2.html) { + profileAnswer = profile.answerV2.html; + } else if (profile.answerV2 && profile.answerV2.json) { + console.warn('JSON is not supported, please switch to HTML.') + } return { title: profile.question || profile.name, // The header text of the card // subtitle: '', // The sub-header text of the card - details: profile.answer ? ANSWERS.formatRichText(profile.answer, "answer", linkTarget) : null, // The text in the body of the card + details: profileAnswer ? profileAnswer : null, // The text in the body + // of the card // If the card's details are longer than a certain character count, you can truncate the // text. A toggle will be supplied that can show or hide the truncated text. // showMoreDetails: { diff --git a/cards/multilang-faq-accordion/component.js b/cards/multilang-faq-accordion/component.js index 791107337..2bd757a48 100644 --- a/cards/multilang-faq-accordion/component.js +++ b/cards/multilang-faq-accordion/component.js @@ -13,11 +13,18 @@ class multilang_faq_accordionCardComponent extends BaseCard['multilang-faq-accor */ dataForRender(profile) { const linkTarget = AnswersExperience.runtimeConfig.get('linkTarget') || '_top'; + let profileAnswer = ''; + if (profile.answerV2 && profile.answerV2.html) { + profileAnswer = profile.answerV2.html; + } else if (profile.answerV2 && profile.answerV2.json) { + console.warn('JSON is not supported, please switch to HTML.') + } return { title: profile.question || profile.name, // The header text of the card // subtitle: '', // The sub-header text of the card - details: profile.answer ? ANSWERS.formatRichText(profile.answer, "answer", linkTarget) : null, // The text in the body of the card + details: profileAnswer ? profileAnswer : null, // The text in the body + // of the card // If the card's details are longer than a certain character count, you can truncate the // text. A toggle will be supplied that can show or hide the truncated text. // showMoreDetails: { From d62761220664aaaadefc5e020b15825e78927377 Mon Sep 17 00:00:00 2001 From: Liah Kim Date: Mon, 14 Aug 2023 11:41:23 -0400 Subject: [PATCH 2/5] Reword console warning and add extra check to use formatRichText --- cards/faq-accordion/component.js | 4 +++- cards/multilang-faq-accordion/component.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cards/faq-accordion/component.js b/cards/faq-accordion/component.js index 5e3e5fe59..270e4bad1 100644 --- a/cards/faq-accordion/component.js +++ b/cards/faq-accordion/component.js @@ -17,7 +17,9 @@ class faq_accordionCardComponent extends BaseCard['faq-accordion'] { if (profile.answerV2 && profile.answerV2.html) { profileAnswer = profile.answerV2.html; } else if (profile.answerV2 && profile.answerV2.json) { - console.warn('JSON is not supported, please switch to HTML.') + console.warn('JSON is not supported, please convert to HTML.') + } else if (profile.answer) { + profileAnswer = ANSWERS.formatRichText(profile.answer, "answer", linkTarget); } return { diff --git a/cards/multilang-faq-accordion/component.js b/cards/multilang-faq-accordion/component.js index 2bd757a48..2d6e27c0c 100644 --- a/cards/multilang-faq-accordion/component.js +++ b/cards/multilang-faq-accordion/component.js @@ -17,7 +17,9 @@ class multilang_faq_accordionCardComponent extends BaseCard['multilang-faq-accor if (profile.answerV2 && profile.answerV2.html) { profileAnswer = profile.answerV2.html; } else if (profile.answerV2 && profile.answerV2.json) { - console.warn('JSON is not supported, please switch to HTML.') + console.warn('JSON is not supported, please convert to HTML.') + } else if (profile.answer) { + profileAnswer = ANSWERS.formatRichText(profile.answer, "answer", linkTarget); } return { From df3f6b7c798a271ee5bf104c931c0f6a889c57c5 Mon Sep 17 00:00:00 2001 From: Liah Kim Date: Mon, 14 Aug 2023 14:42:39 -0400 Subject: [PATCH 3/5] Prep v1.33.0 Bump the version number for v1.33.0 J=BACK-2436 TEST=none --- package-lock.json | 2 +- package.json | 2 +- static/package-lock.json | 2 +- static/package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index e26bcc762..6bf7a3dd3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "answers-hitchhiker-theme", - "version": "1.32.0", + "version": "1.33.0", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index b25e0044b..e5263f31f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "answers-hitchhiker-theme", - "version": "1.32.0", + "version": "1.33.0", "description": "A starter Search theme for hitchhikers", "keywords": [ "jambo", diff --git a/static/package-lock.json b/static/package-lock.json index 873c25e6a..4a0de725b 100644 --- a/static/package-lock.json +++ b/static/package-lock.json @@ -1,6 +1,6 @@ { "name": "answers-hitchhiker-theme", - "version": "1.32.0", + "version": "1.33.0", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/static/package.json b/static/package.json index 9e4fcbf8d..cea6640ab 100644 --- a/static/package.json +++ b/static/package.json @@ -1,6 +1,6 @@ { "name": "answers-hitchhiker-theme", - "version": "1.32.0", + "version": "1.33.0", "description": "Toolchain for use with the HH Theme", "main": "Gruntfile.js", "scripts": { From ec1d5d2e3d8bec020687c6dd69eb021573cf3e35 Mon Sep 17 00:00:00 2001 From: Liah Kim Date: Mon, 14 Aug 2023 15:57:03 -0400 Subject: [PATCH 4/5] Add version number updates to package-lock.json files --- package-lock.json | 2 +- static/package-lock.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6bf7a3dd3..d2252f3d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "answers-hitchhiker-theme", - "version": "1.32.0", + "version": "1.33.0", "devDependencies": { "@axe-core/puppeteer": "^4.5.2", "@babel/core": "^7.9.6", diff --git a/static/package-lock.json b/static/package-lock.json index 4a0de725b..3a11a264d 100644 --- a/static/package-lock.json +++ b/static/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "answers-hitchhiker-theme", - "version": "1.32.0", + "version": "1.33.0", "license": "BSD-3-Clause", "dependencies": { "@vimeo/player": "^2.15.3", From f84e49e6bbc18b2c6bc97b5f4d27b9fcfd271def Mon Sep 17 00:00:00 2001 From: cea2aj <42848445+cea2aj@users.noreply.github.com> Date: Mon, 14 Aug 2023 16:53:35 -0400 Subject: [PATCH 5/5] Fix failing translation tests (#1147) The translation files were failing because the line numbers in the multilang-accordion card changed I ran `npm run extract-translations` to update the files J=BACK-2463 TEST=manual Confirmed tests now pass --- translations/messages.pot | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translations/messages.pot b/translations/messages.pot index 18c7bad3f..2d030978a 100644 --- a/translations/messages.pot +++ b/translations/messages.pot @@ -147,7 +147,7 @@ msgstr "" #: cards/multilang-document-standard/component.js:53 #: cards/multilang-event-standard/component.js:53 -#: cards/multilang-faq-accordion/component.js:51 +#: cards/multilang-faq-accordion/component.js:60 #: cards/multilang-financial-professional-location/component.js:69 #: cards/multilang-job-standard/component.js:44 #: cards/multilang-link-standard/component.js:32 @@ -171,7 +171,7 @@ msgstr[1] "" #: cards/multilang-document-standard/component.js:54 #: cards/multilang-event-standard/component.js:54 -#: cards/multilang-faq-accordion/component.js:52 +#: cards/multilang-faq-accordion/component.js:61 #: cards/multilang-financial-professional-location/component.js:70 #: cards/multilang-job-standard/component.js:45 #: cards/multilang-link-standard/component.js:33 @@ -191,7 +191,7 @@ msgstr "" #: cards/multilang-document-standard/component.js:55 #: cards/multilang-event-standard/component.js:55 -#: cards/multilang-faq-accordion/component.js:53 +#: cards/multilang-faq-accordion/component.js:62 #: cards/multilang-financial-professional-location/component.js:71 #: cards/multilang-job-standard/component.js:46 #: cards/multilang-link-standard/component.js:34