@velnai/chat-solid
v0.1.1
Published
Drop the Velnai web-chat widget into any SolidJS app. Provider component + useVelnaiChat() primitive.
Maintainers
Readme
@velnai/chat-solid
Drop the Velnai web-chat widget into any SolidJS app.
npm install @velnai/chat-solidUsage
import { VelnaiChatProvider, useVelnaiChat } from '@velnai/chat-solid'
export default function Root() {
return (
<VelnaiChatProvider
publicKey="wac_xxx"
visitorAttrs={{ email: user.email }}
onReady={() => console.log('chat ready')}
>
<App />
</VelnaiChatProvider>
)
}
function LogoutButton() {
const { reset } = useVelnaiChat()
return <button onClick={reset}>Log out</button>
}Props
| Prop | Type |
|---|---|
| publicKey | string |
| visitorAttrs | Record<string, string \| number \| boolean \| null> |
| widgetBase | string (default https://widget.velnai.com) |
| onReady / onOpen / onClose | () => void |
Hook
useVelnaiChat() → { identify, reset, getAttrs, open, close }.
License
MIT
