కంటెంట్‌కు వెళ్ళు
Yuva chat hookమెనూ

Yuva chat hook

A React hook over the useyuva headless client for live chat: the session, conversation list, one thread with realtime messages, typing, read state, sending text and files, rating and attachment download. Labels with English defaults.

loading

    ప్రివ్యూ నమూనా డేటాతో నడుస్తుంది. దీనికి నెట్‌వర్క్ లేదా ఛానెల్ అవసరం లేదు.

    ఇన్‌స్టాలేషన్

    దీన్ని shadcn ప్రాజెక్ట్‌లో నడపండి. ఫైళ్లు మీ సొంత కోడ్‌లోకి కాపీ అవుతాయి.

    Shell
    npx shadcn@latest add https://useyuva.com/r/use-yuva-chat.json

    వినియోగం

    tsx
    import { useYuvaChat } from "@/hooks/use-yuva-chat"
    
    const chat = useYuvaChat({ server, channel })

    Props

    UseYuvaChatOptions

    Propరకం
    server?string
    channel?string
    client?YuvaClient
    identityToken?IdentityTokenSource | null
    helpArticleId?string

    YuvaChatState

    Propరకం
    loadingboolean
    errorunknown
    inboxClientInbox | null
    contactClientContact | null
    connectionConnectionState["state"]
    conversationsClientConversation[]
    hasMoreConversationsboolean
    loadMoreConversations() => Promise<void>
    activeIdstring | null
    conversationClientConversation | null
    open(id: string | null) => Promise<void>
    removedboolean
    threadLoadingboolean
    messagesYuvaChatMessage[]
    hasEarlierboolean
    loadEarlier() => Promise<void>
    typingClientMessage["author"] | null
    memberReadAtstring | null
    send(input: YuvaChatSendInput) => Promise<void>
    retry(id: string) => Promise<void>
    discard(id: string) => void
    setTyping(on: boolean) => void
    markRead() => Promise<void>
    rate(rating: Rating, comment?: string) => Promise<void>
    openAttachment(attachment: ClientAttachment) => Promise<void>
    saveEmail(email: string) => Promise<void>

    ఆధారపడేవి

    ఈ ఐటమ్‌ను ఇన్‌స్టాల్ చేస్తే కింది వాటిని కూడా జోడిస్తుంది.

    npm ప్యాకేజీలు