On this page
Components
Answer error
Thông báo lỗi an toàn cho khách và hành động Retry do host xử lý.
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 |
AnswerError |
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-answer-error.element.jsWrap code linesCopy<chatty-answer-error></chatty-answer-error>
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.
Element
| Element |
Module |
chatty-answer-error |
@avada/chatty-ui/elements/answer-error.js |
API
Classic
Current (React), being replaced
LightDarkDesktopMobile
Component React thật; dữ liệu fixture, không gửi request.
Show code
error-retry.jsxWrap code linesCopyimport React, {useState} from 'react';
import {AnswerError} from '@avada/chatty-ui/canonical/AnswerError.jsx';
export function Retry({surface}) {
const [retried, setRetried] = useState(false);
return (
<div className={surface === 'classic' ? 'Avada-Faqs__ChatMessages-Container--v2' : undefined}>
<AnswerError t={text => text} onRetry={() => setRetried(true)} />
{retried && <p role="status">Retry requested locally.</p>}
</div>
);
}
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 |
AnswerError |
@avada/chatty-ui/canonical/AnswerError.jsx |
AnswerError |
Anatomy
| Part |
Element |
| 1 |
AnswerError |
Placement / order
| Context |
Order |
| Conversation |
Caller supplies surrounding content |
Props
Sizes
Tokens
| Part |
Token |
Light |
Dark |
| Error text |
--chatty-contact-muted |
Fallback #6b6b6b |
Fallback #6b6b6b |
| Retry ink |
--chatty-contact-fg |
Fallback #1f1f1f |
Fallback #1f1f1f |
States
| State |
Trigger |
Visual change (values) |
ARIA/attribute |
| Error |
Answer fails |
Error label and Retry visible |
role alert |
Behaviour
| Interaction |
Result |
| Retry |
Calls onRetry |
Copy
| String |
i18n key |
Where |
| Caller translated |
Not available |
AnswerError |
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
error-retry.jsxWrap code linesCopyimport React, {useState} from 'react';
import {AnswerError} from '@avada/chatty-ui/canonical/AnswerError.jsx';
export function Retry({surface}) {
const [retried, setRetried] = useState(false);
return (
<div className={surface === 'classic' ? 'Avada-Faqs__ChatMessages-Container--v2' : undefined}>
<AnswerError t={text => text} onRetry={() => setRetried(true)} />
{retried && <p role="status">Retry requested locally.</p>}
</div>
);
}
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 |
AnswerError |
@avada/chatty-ui/canonical/AnswerError.jsx |
AnswerError |
Anatomy
| Part |
Element |
| 1 |
AnswerError |
Placement / order
| Context |
Order |
| Conversation |
Caller supplies surrounding content |
Props
Sizes
Tokens
| Part |
Token |
Light |
Dark |
| Error text |
--chatty-contact-muted |
Fallback #6b6b6b |
Fallback #6b6b6b |
| Retry ink |
--chatty-contact-fg |
Fallback #1f1f1f |
Fallback #1f1f1f |
States
| State |
Trigger |
Visual change (values) |
ARIA/attribute |
| Error |
Answer fails |
Error label and Retry visible |
role alert |
Behaviour
| Interaction |
Result |
| Retry |
Calls onRetry |
Copy
| String |
i18n key |
Where |
| Caller translated |
Not available |
AnswerError |
Source
| File |
Evidence |
|
Owning React implementation. |
Do / Don't
Accessibility