import { useEffect, memo } from "react"; import { Template } from "./Template"; import type { KcProps } from "./KcProps"; import type { KcContextBase } from "../getKcContext/KcContextBase"; import { getMsg } from "../i18n"; import { headInsert } from "../tools/headInsert"; import { pathJoin } from "../tools/pathJoin"; import { useCssAndCx } from "tss-react"; export const LoginOtp = memo(({ kcContext, ...props }: { kcContext: KcContextBase.LoginOtp } & KcProps) => { const { otpLogin, url } = kcContext; const { cx } = useCssAndCx(); const { msg, msgStr } = getMsg(kcContext); useEffect(() => { let isCleanedUp = false; headInsert({ "type": "javascript", "src": pathJoin(kcContext.url.resourcesCommonPath, "node_modules/jquery/dist/jquery.min.js"), }).then(() => { if (isCleanedUp) return; evaluateInlineScript(); }); return () => { isCleanedUp = true; }; }, []); return (