On this page
Components
Pre-chat
Lời mời nhận email và biên nhận dưới câu trả lời gốc.
Copy page as MarkdownRead Markdown ↗ Key rules
- Element prototype là chuẩn để chatty-ui port theo.
- Host giữ dữ liệu, dịch nhãn và xử lý event; preview chỉ dùng dữ liệu cục bộ.
On this page
Use when / Avoid
Dùng trong cuộc trò chuyện. Tránh nối trực tiếp element với API của shop.
Use instead
| Component |
Use when |
PreChatPrompt |
Implementation React đang chạy. |
| Element prototype |
Consumer chuyển sang custom element. |
Live preview
Standard
Standard
LightDarkDesktopMobile
Element prototype với token trung tính.
Show code
chatty-pre-chat.element.jsWrap code linesCopy<chatty-pre-chat skippable></chatty-pre-chat>
Admin chỉ dùng trong inbox và chỉ light; admin-dark là N/A. Surface chưa có React tương ứng ghi Not available bên dưới.
Standard
LightDarkDesktopMobile
Saved-email receipt là state riêng, không đặt cạnh invitation.
Show code
chatty-pre-chat.element.jsWrap code linesCopy<chatty-pre-chat email="customer@example.com"></chatty-pre-chat>
Element
| Element |
Module |
chatty-pre-chat |
@avada/chatty-ui/elements/pre-chat.js |
API
Classic
Current (React), being replaced
LightDarkDesktopMobile
Component React thật; dữ liệu fixture, không gửi request.
Show code
markdown.jsxWrap code linesCopyimport React, {useState} from 'react';
import ChatThread from '@scripttag/v2/views/ChatThread.jsx';
import {chatStore} from '@scripttag/v2/stores/chatStore.js';
import {WidgetTextRenderer} from '@assets/pages/InboxManagement/v2/blocks/WidgetTextRenderer.jsx';
import {Markdown} from '@avada/chatty-ui/primitives/Markdown.js';
import {MessageFrame} from '@avada/chatty-ui/canonical/MessageFrame.jsx';
import {CanonicalSurface} from '@avada/chatty-ui/canonical/Surface.jsx';
import {PreChatPrompt} from '@avada/chatty-ui/canonical/PreChatPrompt.jsx';
import {Composer} from '@avada/chatty-ui/primitives/Composer.js';
const message = {
id: 'guide-reply',
senderType: 'bot',
text: 'The **canvas tote** is lightweight.',
status: 'sent',
createdAt: '2026-11-23T10:00:00Z',
};
const store = {getState: () => ({messages: [message], loading: false}), subscribe: () => () => {}};
export function PreChat() {
return <PreChatPrompt t={(text) => text} onOpen={() => {}} onSkip={() => {}} />;
}
Token values dưới đây là fallback cục bộ; theme của caller có thể override.
Import / element
| Component / element |
Import / file |
Scope root |
PreChatPrompt |
@avada/chatty-ui/canonical/PreChatPrompt.jsx |
PreChatPrompt |
Anatomy
| Part |
Element |
| 1 |
PreChatPrompt |
Placement / order
| Context |
Order |
| Conversation |
Caller supplies surrounding content |
Props
Sizes
Tokens
| Part |
Token |
Light |
Dark |
| Invitation ink |
--chatty-contact-fg |
Fallback #1f1f1f |
Fallback #1f1f1f |
| Invitation fill |
--chatty-contact-chip |
Fallback #fff |
Fallback #fff |
States
| State |
Trigger |
Visual change (values) |
ARIA/attribute |
| Invitation |
No saved email |
Email and anonymous actions |
Native buttons |
| Saved |
Email exists |
Saved email receipt |
Not available |
Behaviour
| Interaction |
Result |
| Open / Skip |
Calls onOpen or onSkip |
Copy
| String |
i18n key |
Where |
| Caller translated |
Not available |
PreChatPrompt |
Source
| File |
Evidence |
|
Owning React implementation. |
AI Mode
Current (React), being replaced
LightDarkDesktopMobile
Component React thật; dữ liệu fixture, không gửi request.
Show code
markdown.jsxWrap code linesCopyimport React, {useState} from 'react';
import ChatThread from '@scripttag/v2/views/ChatThread.jsx';
import {chatStore} from '@scripttag/v2/stores/chatStore.js';
import {WidgetTextRenderer} from '@assets/pages/InboxManagement/v2/blocks/WidgetTextRenderer.jsx';
import {Markdown} from '@avada/chatty-ui/primitives/Markdown.js';
import {MessageFrame} from '@avada/chatty-ui/canonical/MessageFrame.jsx';
import {CanonicalSurface} from '@avada/chatty-ui/canonical/Surface.jsx';
import {PreChatPrompt} from '@avada/chatty-ui/canonical/PreChatPrompt.jsx';
import {Composer} from '@avada/chatty-ui/primitives/Composer.js';
const message = {
id: 'guide-reply',
senderType: 'bot',
text: 'The **canvas tote** is lightweight.',
status: 'sent',
createdAt: '2026-11-23T10:00:00Z',
};
const store = {getState: () => ({messages: [message], loading: false}), subscribe: () => () => {}};
export function PreChat() {
return <PreChatPrompt t={(text) => text} onOpen={() => {}} onSkip={() => {}} />;
}
Token values dưới đây là fallback cục bộ; theme của caller có thể override.
Import / element
| Component / element |
Import / file |
Scope root |
PreChatPrompt |
@avada/chatty-ui/canonical/PreChatPrompt.jsx |
PreChatPrompt |
Anatomy
| Part |
Element |
| 1 |
PreChatPrompt |
Placement / order
| Context |
Order |
| Conversation |
Caller supplies surrounding content |
Props
Sizes
Tokens
| Part |
Token |
Light |
Dark |
| Invitation ink |
--chatty-contact-fg |
Fallback #1f1f1f |
Fallback #1f1f1f |
| Invitation fill |
--chatty-contact-chip |
Fallback #fff |
Fallback #fff |
States
| State |
Trigger |
Visual change (values) |
ARIA/attribute |
| Invitation |
No saved email |
Email and anonymous actions |
Native buttons |
| Saved |
Email exists |
Saved email receipt |
Not available |
Behaviour
| Interaction |
Result |
| Open / Skip |
Calls onOpen or onSkip |
Copy
| String |
i18n key |
Where |
| Caller translated |
Not available |
PreChatPrompt |
Source
| File |
Evidence |
|
Owning React implementation. |
Do / Don't
Accessibility