Package-level declarations
Types
A team member shown in the chat header.
The human handling a conversation.
Whether the team can answer right now.
Team availability changed.
What POST /bootstrap returns.
A frame the SDK sends: {t, d, id?, v: 1}.
The SDK identifying itself on the socket.
Socket close codes the gateway uses.
Another way to reach the shop, resolved to a link by the gateway.
The channel behind a ContactButton.
Something that happened in a conversation (status change, handoff, notice, ...).
The team started a conversation with the visitor.
Conversation lifecycle status.
A conversation as the gateway reports it on ready / conversation.start.
One of the visitor's conversations changed status or handler.
A conversation summary changed (team-side shape; tolerated).
A request failed (with the request id) or an unsolicited error.
A conversation event visible to visitors.
One piece of a formatted message (port of format.ts). Never HTML.
How the greeting is shown (dashboard: website settings → greeting).
Who signs the greeting.
The name hosts see for Availability.
Languages the Hatang widget and SDK speak.
The chat header: a subtitle per language, the business logo and what the avatar spot shows.
Who the chat header shows (dashboard: website settings → header).
How the launcher button looks: a preset icon or the site's own image, and an optional short label per language that turns it into a pill ("Hỗ trợ").
The launcher's preset icon (dashboard: website settings → launcher button).
Reply to message.send.
A rich card carried in MessageDto.metadata (kind + payload). Every channel degrades to the message text; the SDK renders the card under the bubble.
A chat message.
A message in one of the visitor's conversations.
What the site asks for before a visitor writes while nobody is online.
One line of an order.
Orders and payments the timeline says are paid: an order_paid system message (metadata.order_id) or an order_paid event (data.order_id, data.payment_id). The payment card message is not updated live when the customer pays, so the card checks these too (see PaymentCard.isPaid).
A payment request (VietQR).
Why no QR code could be found. Network failures surface as IOException instead.
What the payment card draws its VietQR code from.
Reply to ping.
A product carousel.
One product in a ProductCard.
Buttons under a bot message; tapping one sends its label.
Auth succeeded: the visitor, the active conversation and its tail.
The gateway asks the client to start over (browsers reload).
Reply to resume.
The screen the app shows (the native counterpart of a page).
Who wrote a message or caused an event.
A frame the gateway sends. Unknown types decode to UnknownFrame and are ignored.
The session moved to another visitor record; store the token and start over.
Site settings the widget and SDK render from.
The site's preferred colour scheme.
One row of a conversation: a MessageDto or a ConversationEventDto.
Someone is typing.
A frame type this SDK does not know; ignored for forward compatibility.
Which registered app and build a visitor uses.
The visitor-safe view of one of their conversations (history list, conversation.update).
The visitor (this app's user as the site sees them).
Functions
The text to show in the bubble of a message that carries card.
Port of cardOf from @hatang/chat-protocol: the card in metadata, if any. Unknown kinds are null.
Parses a frame from the wire.
Serialises frame for the wire.
Tokenises text: links, **bold**, _italic_, ` `code` ` and line breaks. HTML is never interpreted.
The plain text of tokens (labels for links, no markers).
Like decodeFrame but returns null instead of throwing.