Embedded components playground
Pick a component, set its attributes, see it live in one of your sandboxes, and copy the code that places it in your page. The script is pinned to version 1.0.0with its integrity. Every attribute is explained in the embedded components guide.
Live preview<lexopti-client>
The authorization did not complete. Try again.Authorization in progress in the LexOpti window…The browser blocked the authorization window: allow pop-ups for this page, then try again.Connected to the sandbox {organization}. The component follows your settings.The access token expired: authorize again.LexOpti refused the session ({detail}).Refused: the portal opens embedded components in sandbox organizations only (sandbox_required). Choose a sandbox when you authorize.The component script did not load from the embed host.Not connected: authorize a sandbox to see the component.The authorization opens in this tab; you will come back here, your settings kept.
Events received
HTML
<script
type="module"
src="https://embed.lexopti.com/embed/v1.0.0.js"
integrity="sha384-2N9mNdBzYHj8ZSUxBaHxKXNPRwcwlKcJQ7PopEKhcDnoKBmAJ8RVKFcn4FXAOWTZ"
crossorigin="anonymous"
></script>
<lexopti-client
integration="YOUR_PUBLIC_ID"
client="LEXOPTI_CLIENT_ID"
></lexopti-client>
<script type="module">
const element = document.querySelector("lexopti-client");
element.sessionProvider = async ({
codeChallenge,
codeChallengeMethod,
component,
}) => {
const response = await fetch("/your-server/lexopti-embed-session", {
body: JSON.stringify({ codeChallenge, codeChallengeMethod, component }),
headers: { "content-type": "application/json" },
method: "POST",
});
return { code: (await response.json()).code };
};
for (const type of ["ready","resize","navigate","client-created","case-created","check-started","check-completed","alert-reviewed","classification-validated","mention-created","session-ended","display-changed","error"]) {
element.addEventListener(`lexopti-${type}`, (event) => {
console.log(event.type, event.detail);
});
}
</script>React
With @lexopti/embed-react; the page still loads the script above.
import { LexoptiClient } from "@lexopti/embed-react";
import type { LexoptiSessionProvider } from "@lexopti/embed-react";
const sessionProvider: LexoptiSessionProvider = async (request) => {
const response = await fetch("/your-server/lexopti-embed-session", {
body: JSON.stringify(request),
headers: { "content-type": "application/json" },
method: "POST",
});
return { code: (await response.json()).code };
};
const log = (type: string, detail: unknown) => console.log(type, detail);
export function LexoptiEmbed() {
return (
<LexoptiClient
integration="YOUR_PUBLIC_ID"
client="LEXOPTI_CLIENT_ID"
sessionProvider={sessionProvider}
onReady={(event) => log(event.type, event.detail)}
onResize={(event) => log(event.type, event.detail)}
onNavigate={(event) => log(event.type, event.detail)}
onClientCreated={(event) => log(event.type, event.detail)}
onCaseCreated={(event) => log(event.type, event.detail)}
onCheckStarted={(event) => log(event.type, event.detail)}
onCheckCompleted={(event) => log(event.type, event.detail)}
onAlertReviewed={(event) => log(event.type, event.detail)}
onClassificationValidated={(event) => log(event.type, event.detail)}
onMentionCreated={(event) => log(event.type, event.detail)}
onSessionEnded={(event) => log(event.type, event.detail)}
onDisplayChanged={(event) => log(event.type, event.detail)}
onError={(event) => log(event.type, event.detail)}
/>
);
}