# Empty / first-run

Các trạng thái trống của thread và inbox trong Admin, theo code đang chạy.

## Key rules

- Thread trống dùng `inbox-v2__empty`: padding 32px, chữ `body-medium`, căn giữa.
- Đang tải hiện skeleton thay cho empty; chỉ khi tải xong và không có tin mới hiện câu trống.
- Lỗi tải có nút Retry; lỗi do dữ liệu tạm thời không có Retry vì thread tự tải lại.
- Inbox chưa chọn hội thoại dùng `NoConversations` với câu chọn hội thoại hoặc các card kênh.

## Use when / Avoid

Dùng khi vùng nội dung không có gì để hiện: thread chưa có tin, tải lỗi hoặc chưa chọn hội thoại. Trạng thái đang tải dùng skeleton riêng, không dùng câu trống. AI Mode và Classic không có empty state dùng chung trong source nên không nằm trong trang này.

### Use instead

| Component | Use when |
| --- | --- |
| `NoConversations` | Pane chính của inbox khi chưa chọn hội thoại hoặc chưa có kênh. |
| `emptyPlaceholder` | Vùng trống của thread qua canonical Surface. |

## Entry points

| Surface | Owner |
| --- | --- |
| Admin | InboxV2ChatArea dựng `emptySlot` và truyền vào canonical Surface qua `emptyPlaceholder`. |
| Admin | `NoConversations` ở pane chính của inbox. |

## Flow

| Surface | Step | Trigger | UI shown | Component | Copy + i18n key | Timing |
| --- | --- | --- | --- | --- | --- | --- |
| Admin | Đang tải | `adapterLoading` true | Skeleton thay cho câu trống | `emptyPlaceholder` | Not available | Đến khi tải xong |
| Admin | Dữ liệu tạm thời lỗi | `loadError` và `pgUnavailable` | Câu giải thích, không có Retry | `emptyPlaceholder` | Some data is temporarily unavailable. It will come back by itself. / hard-coded | Thread tự tải lại khi dữ liệu trở lại |
| Admin | Tải lỗi | `loadError` | Câu lỗi kèm nút Retry | `emptyPlaceholder` | Couldn't load messages. / hard-coded | Khi click Retry |
| Admin | Thread chưa có tin | Tải xong, không lỗi, không tin | Câu No messages yet. | `emptyPlaceholder` | No messages yet. / hard-coded | Ngay khi tải xong |
| Admin | Chưa chọn hội thoại | Còn hội thoại hoặc user không phải admin | Câu Select conversation to view | `NoConversations` | Select conversation to view / hard-coded | Ngay khi render |

## Edge cases

| Surface | Case | Behaviour |
| --- | --- | --- |
| Admin | Tải lỗi nhưng list rỗng | NoConversations trả về null vì list pane đã báo lỗi |
| Admin | Widget preview | Câu trống dùng `i18n` và rơi về English khi thiếu key |
| Admin | Thread đang tải | `inbox-v2` có `aria-busy` và `inert` khi `adapterLoading` |

## Live preview

Example (Standard) — Chuyển State để xem thread trống, đang tải, lỗi có Retry, dữ liệu tạm thiếu và first-run. Retry nạp lại thread bằng fixture. No conversations thay cả pane, không header hoặc composer; Set up chỉ mô phỏng mở thiết lập kênh.

```js
import '@avada/chatty-ui/tokens/admin.css';
import {html, render} from 'lit';
import {ref} from 'lit/directives/ref.js';
import {IconClose, IconMessage} from '@avada/chatty-ui/elements/icon-glyphs.js';
import '@avada/chatty-ui/elements/surface.js';
import '@avada/chatty-ui/elements/avatar.js';
import '@avada/chatty-ui/elements/badge.js';
import '@avada/chatty-ui/elements/icon-button.js';
import '@avada/chatty-ui/elements/launcher.js';
import '@avada/chatty-ui/elements/button.js';
import {sameGroup} from '@avada/chatty-ui/behaviors/messages.js';

// Reference viewport: 1280 × 900 desktop, 390 × 900 mobile.
const sizes = {
  classic: {width: 400, height: 700},
  'ai-mode': {width: 820, height: 657},
  admin: {width: 527, height: 842}
};
const question = {
  id: 'question',
  senderType: 'customer',
  text: 'Can you help me?',
  createdAt: '2026-01-15T10:00:00Z'
};

/** Viewport-relative sizing survives the initial hidden iframe layout. */
function widgetSize(surface) {
  const mode = new URLSearchParams(location.search).get('mobile');
  const isMobile = mode === null ? innerWidth < 900 : mode === 'true';
  const width = `min(${sizes[surface].width}px, max(0px, 100vw - 40px))`;
  const height = isMobile
    ? `min(${surface === 'admin' ? 848 : 888}px, round(down, calc(${width} * 2.2), 1px))`
    : `${sizes[surface].height}px`;
  return {...sizes[surface], height, mobile: isMobile};
}

/** Local immutable message state with real subscriptions for live previews. */
function fixtureStore(initial) {
  let state = {messages: initial};
  const listeners = new Set();
  return {
    getState: () => state,
    subscribe(listener) {
      listeners.add(listener);
      return () => listeners.delete(listener);
    },
    setMessages(messages) {
      state = {messages};
      listeners.forEach(listener => listener());
    }
  };
}

/** Appends the viewer message without replacing the existing conversation. */
function appendViewer(store, surface, text) {
  const message = {
    id: `viewer-${store.getState().messages.length}`,
    senderType: surface === 'admin' ? 'agent' : 'customer',
    senderMeta: {name: surface === 'admin' ? 'Alex' : 'You'},
    text,
    createdAt: new Date().toISOString()
  };
  store.setMessages([...store.getState().messages, message]);
}

/**
 * One shell owns surface sizing, header, thread and composer for every pattern.
 * @param {string} surface
 * @param {Object} store
 * @param {Object} strings
 * @param {Object} content
 * @param {Function} renderMessage
 * @param {Function} onSend
 * @param {Object} registry
 * @param {boolean} composerHidden
 * @param {string} title
 * @param {Object} headerStart
 * @param {Object} headerActions
 * @param {boolean} sheet
 * @param {string | null} status
 * @returns {Object}
 */
function patternShell({
  surface,
  store,
  strings = {header: 'Store assistant', message: 'Message', send: 'Send'},
  content,
  renderMessage,
  onSend,
  registry,
  title,
  headerStart,
  headerActions,
  status = 'online',
  sheet = false,
  composerHidden = false
}) {
  const size = widgetSize(surface);
  const mobileSheet = sheet && size.mobile;
  if (mobileSheet) {
    size.width = 'none';
    size.height = 'calc(100dvh - 12px)';
  }
  const toggle = (event, closed) => {
    const frame = event.currentTarget.closest('[data-pattern-frame]');
    const panel = frame.querySelector('chatty-surface');
    const launcher = frame.querySelector('[data-pattern-launcher]');
    panel.hidden = closed;
    frame.dataset.closed = String(closed);
    const background = frame.querySelector('[data-sheet-page]');
    if (background) background.inert = !closed && surface === 'ai-mode';
    launcher.hidden = !closed;
    if (closed) {
      launcher.style.insetBlockEnd = `${Math.max(surface === 'ai-mode' ? 40 : 16, frame.getBoundingClientRect().bottom - innerHeight + 20)}px`;
      launcher.focus({preventScroll: true});
    } else {
      const composer = panel.querySelector('chatty-composer');
      const input = !composer.hidden
        ? composer.renderRoot.querySelector('textarea')
        : (panel
            .querySelector('chatty-contact-form:not([hidden])')
            ?.renderRoot.querySelector('chatty-text-field') ??
          panel.querySelector('form chatty-text-field') ??
          panel.querySelector('[data-welcome-invitation]:not([hidden]) chatty-button') ??
          panel
            .querySelector('chatty-pre-chat:not([hidden])')
            ?.renderRoot.querySelector('chatty-button'));
      input?.focus({preventScroll: true});
    }
  };
  const sender = message => {
    const content = renderMessage?.(message) ?? {};
    const messages = store.getState().messages;
    const previous = messages[messages.indexOf(message) - 1];
    if (message.senderType !== 'bot' || sameGroup(message, previous)) return content;
    return {
      ...content,
      sender: html`<span style="display:inline-flex;align-items:center;gap:6px"
        ><chatty-avatar size="sm" label="Assistant">A</chatty-avatar
        >${content.sender ?? message.senderName ?? message.senderMeta?.name ?? 'Assistant'}</span
      >`
    };
  };
  return html`<style>
      [data-pattern-frame] {
        display: flex;
        position: relative;
        justify-content: center;
        inline-size: 100%;
        min-inline-size: 0;
      }
      [data-pattern-frame='classic'] {
        justify-content: flex-end;
      }
      [data-pattern-frame] chatty-surface::part(header) {
        padding: 0;
      }
      [data-pattern-frame='classic'] chatty-surface::part(header),
      [data-pattern-frame='ai-mode'] chatty-surface::part(header) {
        border-bottom-width: 0;
      }
      [data-pattern-frame] [hidden] {
        display: none !important;
      }
      [data-pattern-header] {
        display: flex;
        align-items: center;
        gap: 10px;
        box-sizing: border-box;
        min-inline-size: 0;
        block-size: 52px;
        padding: 0 16px;
      }
      [data-pattern-frame='classic'] [data-pattern-header] {
        block-size: 56px;
        background: var(--chatty-color-accent);
        color: var(--chatty-color-on-accent);
      }
      [data-pattern-frame='classic'] [data-pattern-header] chatty-icon-button {
        --chatty-color-border-focus: var(--chatty-color-on-accent);
      }
      [data-pattern-frame='admin'] [data-pattern-header] {
        block-size: 68px;
        padding: 8px 12px;
      }
      [data-pattern-header] chatty-avatar {
        --chatty-avatar-size: 32px;
      }
      [data-pattern-frame='classic'] [data-pattern-header] chatty-avatar {
        --chatty-avatar-background: #fff;
      }
      [data-pattern-frame='classic'] [data-pattern-header] chatty-avatar::part(base) {
        color: #303030;
        border: 1px solid #767676;
      }
      [data-pattern-actions] {
        display: flex;
        align-items: center;
        gap: 8px;
      }
      [data-pattern-title] {
        flex: 1;
        min-inline-size: 0;
        display: flex;
        flex-direction: column;
      }
      [data-pattern-frame='admin'] [data-pattern-title] {
        gap: 4px;
      }
      [data-pattern-frame='admin'] [data-pattern-title] strong {
        display: flex;
        align-items: center;
        min-block-size: 28px;
        font: var(--p-font-weight-semibold, 650) var(--p-text-heading-md-font-size, 14px) /
          var(--p-text-heading-md-font-line-height, 20px) var(--p-font-family-sans, system-ui);
      }
      [data-pattern-title] strong {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      [data-pattern-header] chatty-icon-button {
        --chatty-icon-button-size: 32px;
        --chatty-icon-button-color: currentColor;
      }
      @media (max-width: 899px), (pointer: coarse) {
        [data-pattern-header] chatty-icon-button {
          --chatty-icon-button-size: 44px;
        }
      }
      [data-pattern-launcher] {
        position: absolute;
        inset-inline-end: 0;
        inset-block-end: 0;
      }
      [data-pattern-frame='ai-mode'] [data-pattern-launcher] {
        inset-inline-end: auto;
        inset-inline-start: 50%;
        transform: translateX(-50%);
      }
      [data-pattern-frame='classic'] [data-pattern-launcher] {
        --chatty-icon-button-size: 56px;
        border-radius: 50%;
        background: var(--chatty-color-accent);
        --chatty-icon-button-color: var(--chatty-color-on-accent);
      }
      [data-sheet-mobile='true'] {
        position: fixed;
        inset: 0;
        inline-size: 100vw;
      }
      [data-sheet-mobile='true'] chatty-surface::part(base) {
        border-radius: 16px 16px 0 0;
      }
      [data-sheet-mobile='true'] chatty-surface {
        position: relative;
        z-index: 2;
        margin-block-start: 12px;
      }
      [data-sheet-page],
      [data-sheet-scrim] {
        position: absolute;
        inset: 0;
        box-sizing: border-box;
      }
      [data-sheet-page] {
        padding: 20px;
        background: var(--chatty-color-bg-surface);
        color: var(--chatty-color-text);
      }
      [data-sheet-scrim] {
        z-index: 1;
        border: 0;
        background: rgb(0 0 0 / 40%);
        animation: sheet-scrim 400ms ease;
      }
      [data-sheet-mobile='true'][data-closed='true'] [data-sheet-scrim] {
        display: none;
      }
      [data-sheet-mobile='true'] [data-pattern-launcher] {
        z-index: 3;
      }
      @keyframes sheet-scrim {
        from {
          opacity: 0;
        }
        to {
          opacity: 1;
        }
      }
      @media (prefers-reduced-motion: reduce) {
        [data-sheet-scrim] {
          animation: none;
        }
      }
    </style>
    <div
      data-pattern-frame=${surface}
      data-sheet-mobile=${String(mobileSheet)}
      data-closed="false"
      style=${`block-size:calc(${size.height} + ${mobileSheet ? 12 : 0}px)`}
    >
      ${
        mobileSheet
          ? html`<div data-sheet-page .inert=${surface === 'ai-mode'}>
                <p>Example storefront</p>
                <chatty-button
                  variant="secondary"
                  type="button"
                  @click=${event => {
                    event.currentTarget.textContent = 'Products opened';
                  }}
                >
                  Browse products
                </chatty-button>
              </div>
              ${surface === 'ai-mode' ? html`<button type="button" data-sheet-scrim tabindex="-1" aria-label="Close chat background" @click=${event => toggle(event, true)}></button>` : ''}`
          : ''
      }
      <chatty-surface
        data-chatty-surface=${surface}
        data-chatty-theme=${surface === 'admin' ? 'light' : (document.documentElement.dataset.chattyTheme ?? document.documentElement.dataset.theme ?? 'light')}
        style=${`inline-size:100%;max-inline-size:${mobileSheet ? 'none' : `${size.width}px`};--chatty-surface-height:${size.height}`}
        .store=${store}
        .registry=${registry ?? null}
        viewer-type=${surface === 'admin' ? 'agent' : 'customer'}
        .selfTypes=${surface === 'admin' ? ['agent', 'bot'] : null}
        .renderMessage=${sender}
      >
        <div slot="header" data-pattern-header>
          ${headerStart ?? ''}
          ${surface === 'admin' ? '' : html`<chatty-avatar label="Store" .status=${status}>S</chatty-avatar>`}
          <span data-pattern-title
            ><strong
              >${title ?? (surface === 'admin' ? 'Customer conversation' : strings.header)}</strong
            >${surface === 'admin' ? html`<chatty-badge size="sm" variant="secondary" style="align-self:flex-start">Customer</chatty-badge>` : status == null ? '' : html`<small data-pattern-status>${status === 'online' ? 'Open' : 'Closed'}</small>`}</span
          >
          <span data-pattern-actions>${headerActions ?? ''}</span>
          ${
            surface === 'admin'
              ? ''
              : html`<chatty-icon-button label="Close panel" @click=${event => toggle(event, true)}
                  >${IconClose()}</chatty-icon-button
                >`
          }
        </div>
        <chatty-thread .strings=${{bot: 'Assistant', ...strings}}></chatty-thread>${content ?? ''}
        <chatty-composer
          slot="footer"
          ?hidden=${composerHidden}
          .label=${strings.message}
          .sendLabel=${strings.send}
          @chatty-send=${event => {
            appendViewer(store, surface, event.detail.text);
            if (onSend) onSend(event.detail.text, event.currentTarget);
            else if (surface !== 'admin')
              store.setMessages([
                ...store.getState().messages,
                {
                  id: `fixture-${store.getState().messages.length}`,
                  senderType: 'bot',
                  text: `You asked: “${event.detail.text}”. I can help with that.`,
                  hasEventTime: false
                }
              ]);
          }}
        ></chatty-composer> </chatty-surface
      >${
        surface === 'admin'
          ? ''
          : surface === 'ai-mode'
            ? html`<chatty-launcher
                data-pattern-launcher
                hidden
                label="Open chat"
                @chatty-open=${event => toggle(event, false)}
                >${IconMessage({size: 20, slot: 'icon'})}Ask a question</chatty-launcher
              >`
            : html`<chatty-icon-button
                data-pattern-launcher
                hidden
                size="lg"
                label="Open chat"
                @click=${event => toggle(event, false)}
                >${IconMessage({size: 24})}</chatty-icon-button
              >`
      }
    </div>`;
}

import '@avada/chatty-ui/elements/skeleton.js';
export function Standard() {
  const store = fixtureStore([]);
  let owner;
  let generation = 0;
  const show = state => {
    const current = ++generation;
    const firstRun = state === 'first-run';
    owner.dataset.state = state;
    render(
      firstRun
        ? html`<section data-first-run aria-label="Inbox setup">
            <h2>Your inbox is waiting!</h2>
            <p>Turn on Chatty's chatbox to let customers message you from your online store.</p>
            <p>
              You can also integrate Chatty with other channels to keep everything in one place!
            </p>
            <div data-channel-cards>
              ${['Live chat', 'Connect Email', 'Messenger / Instagram', 'WhatsApp Business'].map(
                channel =>
                  html`<section>
                    <h3>${channel}</h3>
                    <p>Receive and reply to customers in your Chatty inbox.</p>
                    <chatty-button
                      @click=${event => {
                        event.currentTarget
                          .closest('section')
                          .querySelector('p').textContent = `${channel} setup opened (fixture)`;
                      }}
                      >Set up</chatty-button
                    >
                  </section>`
              )}
            </div>
          </section>`
        : patternShell({
            surface: 'admin',
            store,
            content: html`<div
              slot="empty"
              data-empty-state
              style="padding:32px;text-align:center;box-sizing:border-box"
            >
              ${
                state === 'loading'
                  ? html`<div
                      role="status"
                      aria-label="Loading messages"
                      style="display:grid;gap:16px"
                    >
                      <chatty-skeleton></chatty-skeleton><chatty-skeleton></chatty-skeleton
                      ><chatty-skeleton></chatty-skeleton>
                    </div>`
                  : state === 'error'
                    ? html`<p role="alert">Couldn't load messages.</p>
                        <chatty-button
                          @click=${() => {
                            show('loading');
                            const retry = generation;
                            setTimeout(() => {
                              if (owner.isConnected && retry === generation) show('thread');
                            }, 450);
                          }}
                          >Retry</chatty-button
                        >`
                    : state === 'unavailable'
                      ? html`<p>
                          Some data is temporarily unavailable. It will come back by itself.
                        </p>`
                      : html`<p>No messages yet.</p>`
              }
            </div>`
          }),
      owner
    );
    store.setMessages(state === 'thread' ? [question] : []);
    const surface = owner.querySelector('chatty-surface');
    if (surface) {
      surface.setAttribute('aria-busy', String(state === 'loading'));
      surface.inert = state === 'loading';
    }
    return current;
  };
  return html`<style>
      [data-empty-preview] {
        width: 100%;
        min-width: 0;
      }
      [data-first-run] {
        box-sizing: border-box;
        max-width: 787px;
        min-height: 842px;
        margin: auto;
        padding: 32px;
        text-align: center;
        background: #fff;
        border: 1px solid #e3e3e3;
        color: #303030;
        font: 13px/20px system-ui;
      }
      [data-first-run] h2 {
        font-size: 24px;
        line-height: 32px;
      }
      [data-channel-cards] {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
        margin-top: 32px;
        text-align: left;
      }
      [data-channel-cards] section {
        border: 1px solid #e3e3e3;
        border-radius: 12px;
        padding: 16px;
      }
      @media (max-width: 767px) {
        [data-empty-state] chatty-button {
          --chatty-button-height: 44px;
        }
        [data-channel-cards] {
          grid-template-columns: 1fr;
        }
        [data-first-run] {
          min-height: 770px;
          padding: 32px 16px;
        }
      }
    </style>
    <div
      data-empty-preview
      @empty-state=${event => show(event.detail)}
      ${ref(node => {
        if (node) {
          owner = node;
          queueMicrotask(() => show('empty'));
        }
      })}
    ></div>`;
}
```

## Admin

### Import / element

#### inbox-v2\_\_empty

| Component / element | Import / file | Scope root |
| --- | --- | --- |
| `inbox-v2__empty` |  | .inbox-v2 |

#### NoConversations

| Component / element | Import / file | Scope root |
| --- | --- | --- |
| `NoConversations` | import NoConversations from '@assets/pages/InboxManagement/Parts/MainChat/NoConversations.js'; | Pane chính của inbox |

### Anatomy

#### inbox-v2\_\_empty

| Part | Element |
| --- | --- |
| 1 | `divinbox-v2__empty` chứa câu trạng thái. |
| 2 | `buttoninbox-v2__retry`, chỉ trong trạng thái tải lỗi. |

#### NoConversations

| Part | Element |
| --- | --- |
| 1 | Khối `Avada-Faqs_Main-Chat_NoConvo__Heading` với tiêu đề và mô tả. |
| 2 | Nhóm `Card` theo từng kênh, mỗi card có tiêu đề, mô tả và nút. |
| 3 | Câu chọn hội thoại trong `Avada-Faqs_Main-Chat__No-Select-Conversation`. |

### Placement / order

#### inbox-v2\_\_empty

| Context | Order |
| --- | --- |
| Vùng thread | Thay cho danh sách tin khi tải xong và không có tin. |

#### NoConversations

| Context | Order |
| --- | --- |
| Còn hội thoại hoặc không phải admin | Chỉ hiện câu chọn hội thoại. |
| Chưa có hội thoại, user là admin | Heading rồi nhóm card kênh. |

### Props

#### inbox-v2\_\_empty

| Prop | Type | Values | Default | Notes |
| --- | --- | --- | --- | --- |
| `emptyPlaceholder` | node | Phần tử hiện khi không tải và count bằng 0 | Không có | InboxV2ChatArea dựng `emptySlot` cho prop này. |

#### NoConversations

| Prop | Type | Values | Default | Notes |
| --- | --- | --- | --- | --- |
| Not available | Not available | Not available | Not available | Not available |

### Sizes

#### inbox-v2\_\_empty

| Size | Height | Padding | Gap | Radius | Font role (px/rem) | Hit target | Breakpoint / mechanism |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Empty | Theo nội dung | 32px | Not available | Not available | `body-medium` Derived(13px = type(body-medium, admin, desktop, size)) / Derived(20px = type(body-medium, admin, desktop, line)), mobile Derived(15px = type(body-medium, admin, mobile, size)) / Derived(22px = type(body-medium, admin, mobile, line)) | Not available | Theo mixin `type.role` |
| Retry | Theo nội dung | 4px 14px | margin 10px auto 0 | 999px via `radius.$pill` | `body-small` Derived(12px = type(body-small, admin, desktop, size)) / Derived(18px = type(body-small, admin, desktop, line)), mobile Derived(13px = type(body-small, admin, mobile, size)) / Derived(20px = type(body-small, admin, mobile, line)) | Native box | Theo mixin `type.role` |

#### NoConversations

| Size | Height | Padding | Gap | Radius | Font role (px/rem) | Hit target | Breakpoint / mechanism |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Card kênh | Mô tả cao tối thiểu 40px | `Cardpadding="300"` | `InlineStack` 300; nhóm nút 200 | Not available | Polaris `Text` headingMd | Not available | Không có override mobile trong file |

### Tokens

#### inbox-v2\_\_empty

| Part | Token | Light | Dark |
| --- | --- | --- | --- |
| Chữ empty | `--chatty-color-text-secondary` | #616161 | No Dark skin |
| Chữ Retry | Not available | #005bd3 | No Dark skin |
| Viền Retry | Not available | #cfe2ff; hover #005bd3 | No Dark skin |

#### NoConversations

| Part | Token | Light | Dark |
| --- | --- | --- | --- |
| Heading và card | Not available | Theo Polaris theme | No Dark skin |

### States

#### inbox-v2\_\_empty

| State | Trigger | Visual change (values) | ARIA/attribute |
| --- | --- | --- | --- |
| Đang tải | `adapterLoading` | Skeleton thay cho câu trống | `aria-busy` và `inert` trên `inbox-v2` |
| Hover Retry | Con trỏ | Viền chuyển sang #005bd3 | Không thêm ARIA |
| Focus Retry | Bàn phím | Not available; không có rule focus riêng cho inbox-v2\_\_retry | Native focus |

#### NoConversations

| State | Trigger | Visual change (values) | ARIA/attribute |
| --- | --- | --- | --- |
| Nút bị khóa | `item.enabled` bằng false | `disabled` trên Button của Polaris | `disabled` |
| Nút đang chạy | `item.loading` | `loading` trên Button của Polaris | Theo Polaris |
| List lỗi và rỗng | `listError` và không có hội thoại | Trả về null | Not available |

### Behaviour

#### inbox-v2\_\_empty

| Interaction | Result |
| --- | --- |
| Click Retry | `retrySubscribe` đăng ký lại thread. |
| Lỗi do dữ liệu tạm thời | Không có Retry vì thread tự tải lại. |

#### NoConversations

| Interaction | Result |
| --- | --- |
| Nút kênh | `url` hoặc `onClick`; link ngoài mở bằng `_blank`. |

### Copy

#### inbox-v2\_\_empty

| String | i18n key | Where |
| --- | --- | --- |
| No messages yet. | Hard-coded English | Thread trống |
| Couldn't load messages. | Hard-coded English | Tải lỗi |
| Retry | Hard-coded English | Nút của tải lỗi |
| Some data is temporarily unavailable. It will come back by itself. | Hard-coded English | Dữ liệu tạm thời lỗi |
| No messages yet | No messages yet | Widget preview qua `i18n` |

#### NoConversations

| String | i18n key | Where |
| --- | --- | --- |
| Select conversation to view | Hard-coded English | Câu chọn hội thoại |

### Source

#### inbox-v2\_\_empty

| File | Evidence |
| --- | --- |
|  | Các nhánh empty, lỗi và Retry |
|  | Style empty và Retry |
|  | Vị trí empty trong Surface |

#### NoConversations

| File | Evidence |
| --- | --- |
|  | Các nhánh trống của pane chính |

## Do / Don't

Do: nói rõ trạng thái nào đang xảy ra, tải xong và trống, lỗi tải hay chưa chọn hội thoại.

Don't: hiện câu trống trong lúc `adapterLoading`, hoặc thêm Retry cho lỗi dữ liệu tạm thời.

## Accessibility

| Surface | Role / name | Keyboard / focus | Live region | Contrast pair / ratio |
| --- | --- | --- | --- | --- |
| Admin | `button` Retry, tên accessible là chữ Retry; câu trống không có role | Retry là `button` native, Tab tới được; `retrySubscribe` không gọi hàm focus nào nên focus ở lại nút | Not available; câu trống không có role hay aria. `inbox-v2` có `aria-busy` khi tải | Measured(#616161 / #f1f2fe = 5.57:1) và Measured(#616161 / #f3f1fe = 5.55:1) cho chữ fallback của empty trên gradient nền của inbox-v2 |

