# chatty-block-cart-confirmation

API chuẩn của element chatty-block-cart-confirmation, sinh từ custom-elements.json của prototype trong guide.

## Key rules

- `chatty-block-cart-confirmation` khai báo 1 attribute, 1 property không có attribute, 1 event, 0 slot, 1 part và 0 CSS custom property.
- Import 1 module `@avada/chatty-ui/elements/chatty-block-cart-confirmation.js` là define `chatty-block-cart-confirmation`; chunk chỉ import element nó dùng. Prototype chuẩn:  trong guide.
- Đổi tên attribute, event, slot, part hay CSS custom property là đổi API: diff của custom-elements.json phải có trong 1 MR.

## Overview

Canonical cart lines adapted to the existing grouped receipt. Class `ChattyBlockCartConfirmation`.

### Attributes

| Name | Property | Type | Default | Description |
| --- | --- | --- | --- | --- |
| `block` | `block` | `object` | `{}` | Canonical data.receipts (legacy receipts/receipt accepted) with title, quantity, linePrice, currency and optional variant/thumbnail. |

### Properties

Attributes also expose the properties listed in the Property column above.

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `strings` | `object` | `{}` | Translated receipt heading and quantity labels. |

### Events

| Name | Detail type | Description |
| --- | --- | --- |
| `chatty-view-cart` | `CustomEvent<{}>` | Host-owned bag requested. |

### Slots

Not declared in the manifest.

### Parts

| Name | Description |
| --- | --- |
| `base` | Grouped receipt. |

### CSS custom properties

Not declared in the manifest.

## Usage

```js
import '@avada/chatty-ui/tokens/tokens.css';
import '@avada/chatty-ui/elements/chatty-block-cart-confirmation.js';
```

```html
<chatty-block-cart-confirmation
    block='{"type":"cart-confirmation","data":{"receipts":[{"title":"Canvas tote","quantity":2,"linePrice":48,"currency":"USD"},{"title":"Travel tote","quantity":1,"linePrice":32,"currency":"USD"}]}}'
  ></chatty-block-cart-confirmation>
```

## Live preview

Component thật dùng cùng story với trang component; dữ liệu mẫu nằm trong frame cục bộ.

Example (Standard) — Default: trạng thái mặc định và nội dung mẫu của element.

```html
<chatty-block-cart-confirmation
    block='{"type":"cart-confirmation","data":{"receipts":[{"title":"Canvas tote","quantity":2,"linePrice":48,"currency":"USD"},{"title":"Travel tote","quantity":1,"linePrice":32,"currency":"USD"}]}}'
  ></chatty-block-cart-confirmation>
```

## Anatomy

Số trong hình khớp bảng bên dưới. Phần chỉ hiện ở state khác được ghi Not shown; ví dụ không thêm phần tử giả.

Example (Standard) — Anatomy: một instance mặc định riêng, có khoảng trống quanh các phần được đánh số.

```html
<chatty-block-cart-confirmation
    block='{"type":"cart-confirmation","data":{"receipts":[{"title":"Canvas tote","quantity":2,"linePrice":48,"currency":"USD"},{"title":"Travel tote","quantity":1,"linePrice":32,"currency":"USD"}]}}'
  ></chatty-block-cart-confirmation>
```

| Part | Element | Source |
| --- | --- | --- |
| 1 | CSS part `base` | chatty-ui/custom-elements.json |

## Keyboard

No element-specific keys.

### Source

- chatty-ui/custom-elements.json
