@junyul/react
v1.2.2
Published
Junyul SDK for React / Next.js — ComplyProvider, ComplyBanner, useComply().
Maintainers
Readme
@junyul/react
React / Next.js components for Junyul compliance.
import { ComplyProvider, ComplyBanner, useComply } from '@junyul/react';
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<ComplyProvider apiKey={process.env.NEXT_PUBLIC_JUNYUL_KEY!}>
<ComplyBanner assetId="gpt_chatbot_v1" position="top" />
{children}
</ComplyProvider>
);
}
function Chat() {
const { track } = useComply();
const ask = async (q: string) =>
track('gpt_chatbot_v1', async () => fetch('/api/chat', { method: 'POST', body: q }));
...
}