diff --git a/README.md b/README.md index 86702a3ac..349607266 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,7 @@ The `editor-wc` tag accepts the following attributes, which must be provided as The web component communicates with the host page via the following custom events: +- `editor-aiHintLearnMoreLinkClicked`: When the user clicks the "Learn more" link about AI hints - event detail contains the `projectIdentifier` and the `source` of the click (`"errorMessage"` for the link under an AI error hint, `"settings"` for the link in the settings panel) - `editor-aiHintRequested`: When an AI error hint request finishes after the user clicks the hint button (or retries after a failure) - event detail contains the `projectIdentifier`, the `errorDetails` of the error being shown, and the `outcome` (`"shown"` or `"failed"`) - `editor-aiHintToggled`: When the user turns AI hints on or off in the settings panel - event detail contains the `projectIdentifier` and whether hints are now `enabled` - `editor-aiHintTurnOffLinkClicked`: When the user clicks the turn off link under an AI error hint, which opens the AI hint settings - event detail contains the `projectIdentifier` and the `errorDetails` of the error being shown diff --git a/src/components/Editor/AiErrorMessage/AiErrorMessage.jsx b/src/components/Editor/AiErrorMessage/AiErrorMessage.jsx index 97dbc35ed..f386af30b 100644 --- a/src/components/Editor/AiErrorMessage/AiErrorMessage.jsx +++ b/src/components/Editor/AiErrorMessage/AiErrorMessage.jsx @@ -7,8 +7,9 @@ import BadgeQuestionMarkIcon from "../../../assets/icons/badge_question_mark.svg import SettingsIcon from "../../../assets/icons/settings.svg"; import { openAiHintSettings } from "../../../redux/EditorSlice"; import ApiCallHandler from "../../../utils/apiCallHandler"; -import { aiHintLinkComponents } from "../../../utils/aiHintLinks"; +import { getAiHintLinkComponents } from "../../../utils/aiHintLinks"; import { + aiHintLearnMoreLinkClickedEvent, aiHintRequestedEvent, aiHintTurnOffLinkClickedEvent, } from "../../../events/WebComponentCustomEvents"; @@ -113,6 +114,15 @@ const AiErrorMessage = () => { ); }; + const handleLearnMoreClick = () => { + document.dispatchEvent( + aiHintLearnMoreLinkClickedEvent({ + projectIdentifier, + source: "errorMessage", + }), + ); + }; + return (
{showResult && ( @@ -145,7 +155,9 @@ const AiErrorMessage = () => {