Hooks
Ez az oldal még csak angolul érhető el.
The hooks of @poltura/theme-sdk/inbox.
Ezen az oldalon
import { … } from '@poltura/theme-sdk/inbox';useInbox
The chat's view and actions: whether it is open, online or unread, the conversation, the help search and the merchant's wording and look.
useInbox(): InboxStateCall it inside InboxRoot, which exists only where the store offers chat; the default InboxWidget already provides it.
Returns: The chat's view and the actions the shopper can take.
Example
import { InboxRoot, useInbox } from '@poltura/theme-sdk/inbox';
function UnreadDot() {
const { view, actions } = useInbox();
if (view.open || view.unread === 0) return null;
return (
<button type="button" onClick={actions.open}>
{view.copy.unread(view.unread)}
</button>
);
}
export function ChatNotice() {
return (
<InboxRoot>
<UnreadDot />
</InboxRoot>
);
}