Skip to content

Conversation

@dipratap
Copy link
Contributor

@dipratap dipratap commented Nov 3, 2025

Adds a mapper for FAQ opportunity to transform FAQ suggestions to JSON Patches.
Suggestion format:

"data": {
"topic": "modifier pdf",
"transformRules": {
"action": "appendChild",
"selector": "main"
},
"item": {
"answerSuitabilityReason": "...",
"questionRelevanceReason": "...",
"question": "Comment modifier un PDF déjà existant ?",
"answer": "Answer to the question.",
"sources": [...]
},
"headingText": "FAQs",
"shouldOptimize": true,
"url": "https://www.adobe.com/fr/acrobat/online/pdf-editor.html"
}

Final HTML Format:

...

FAQs

Question 1

Answer 1

Question 2

Answer 2
.. ..

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

This PR will trigger a patch release when merged.

/**
* Converts markdown text to HAST (Hypertext Abstract Syntax Tree) format
*/
markdownToHast(markdown: string): object;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer markdowntohast as a util method instead of part of this interface. Its an internal inpl detail of suggestion to patch conversion that shouldnt be exposed in the mapper interface.

Copy link
Contributor

@nit23uec nit23uec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls move mdtohast in a util method to be reused in suggestionToPatch impl. Rest lgtm

@dipratap dipratap requested a review from nit23uec November 9, 2025 23:14
}).filter((patch) => patch !== null);
let patches = [];
// Use suggestionsToPatches if available
if (mapper.suggestionsToPatches) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have only one api: suggestionsToPatches

}

const s3Path = `opportunities/${siteTokowakaKey}`;
const s3Path = getTokowakaConfigS3Path(siteTokowakaKey);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This api would need isPreview param too

* @throws {Error} Always throws - use suggestionsToPatches instead
* @see suggestionsToPatches
*/
suggestionToPatch() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to remove this for all opppty right away.

@dipratap dipratap merged commit 4c7ff9d into main Nov 13, 2025
7 checks passed
@dipratap dipratap deleted the faq-edge branch November 13, 2025 11:36
solaris007 pushed a commit that referenced this pull request Nov 13, 2025
@solaris007
Copy link
Member

🎉 This PR is included in version @adobe/spacecat-shared-tokowaka-client-v1.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants