# Extension demo (test fixture)

addons.desc.integration.extdemo This is a **test fixture** used by the integration tests; it is not offered in the marketplace.

| Field | Value |
|---|---|
| Addon id | `integration-extdemo` |
| Kind | `integration` |
| Provides | `extdemo` |
| Engine | `wasm` |
| ABI | `0.2.0` |
| Version | 0.1.0 |
| Author | MythicalSystems |
| Source | `extensions/addons/fixture-ext` |
| Permissions (shown at install) | none |

## Capabilities

| Capability | Value |
|---|---|
| [`bridge`](capabilities.md) | `/api/v1/auth/me` |
| [`events`](capabilities.md) | none |
| [`hooks`](capabilities.md) | `[{"event":"login.before","priority":10},{"event":"client.before_register"},{"event":"invoice.before_create","priority":50},{"event":"order.before_place","fail_open":false,"timeout_ms":1000}]` |
| [`http`](capabilities.md) | none |
| [`kv`](capabilities.md) | true |
| [`routes`](capabilities.md) | `[{"access":"public","method":"GET","path":"/ping"},{"access":"public","method":"GET","path":"/items/:id"},{"access":"admin","method":"GET","path":"/stats","permission":"reports.read"},{"access":"client","method":"POST","path":"/notes"},{"access":"client","method":"GET","path":"/notes"}]` |
| [`secrets`](capabilities.md) | none |
| [`ui`](capabilities.md) | `iframe` |

## Events and hooks

| What | Value |
|---|---|
| Listens to (`events`) | none |
| Hooks | `login.before`, `client.before_register`, `invoice.before_create`, `order.before_place` |
| Emits | none |
| Mixins | none |
| Scheduled jobs | none |

## Settings and secrets

No admin settings are declared in `addon.json` or in the source.

Secrets (stored encrypted, never returned by the API): none.

Outbound HTTP allowed to: none. `$server` is the hostname of the server configured for the product, `$setting:<key>` the host of that setting.

## HTTP routes

Mounted under `/api/v1/addons/integration-extdemo/`.

| Method | Path | Access | Permission |
|---|---|---|---|
| GET | `/ping` | public | - |
| GET | `/items/:id` | public | - |
| GET | `/stats` | admin | `reports.read` |
| POST | `/notes` | client | - |
| GET | `/notes` | client | - |

## UI

Pages: `stats` (admin), `notes` (client), `panel` (client). Slots: `client.dashboard`, `admin.customer.detail`, `admin.invoices.toolbar`, `admin.layout.banner`, `client.*.after`. See [Widgets and slots](widgets.md).

## addon.json

_extensions/addons/fixture-ext/addon.json_

```json
{
  "abi": "0.2.0",
  "author": "MythicalSystems",
  "capabilities": {
    "bridge": [
      "/api/v1/auth/me"
    ],
    "events": [],
    "hooks": [
      {
        "event": "login.before",
        "priority": 10
      },
      {
        "event": "client.before_register"
      },
      {
        "event": "invoice.before_create",
        "priority": 50
      },
      {
        "event": "order.before_place",
        "fail_open": false,
        "timeout_ms": 1000
      }
    ],
    "http": [],
    "kv": true,
    "routes": [
      {
        "access": "public",
        "method": "GET",
        "path": "/ping"
      },
      {
        "access": "public",
        "method": "GET",
        "path": "/items/:id"
      },
      {
        "access": "admin",
        "method": "GET",
        "path": "/stats",
        "permission": "reports.read"
      },
      {
        "access": "client",
        "method": "POST",
        "path": "/notes"
      },
      {
        "access": "client",
        "method": "GET",
        "path": "/notes"
      }
    ],
    "secrets": [],
    "ui": [
      "iframe"
    ]
  },
  "description": "addons.desc.integration.extdemo",
  "engine": "wasm",
  "i18n": {
    "en": {
      "hello": "Hello from an addon.",
      "name": "Name",
      "no_notes": "No notes yet.",
      "note": "Note",
      "notes_title": "My notes",
      "panel_title": "Addon panel",
      "save": "Save",
      "stats_hint": "Counters kept by the addon.",
      "stats_title": "Extension stats",
      "value": "Value"
    },
    "ro": {
      "hello": "Salut de la un addon.",
      "name": "Nume",
      "no_notes": "Încă nu ai notițe.",
      "note": "Notiță",
      "notes_title": "Notițele mele",
      "panel_title": "Panou addon",
      "save": "Salvează",
      "stats_hint": "Contoare ținute de addon.",
      "stats_title": "Statistici extensie",
      "value": "Valoare"
    }
  },
  "id": "integration-extdemo",
  "kind": "integration",
  "name": "Extension demo (test fixture)",
  "permissions": [],
  "provides": "extdemo",
  "settings": [],
  "ui": {
    "pages": [
      {
        "area": "admin",
        "body": {
          "children": [
            {
              "text": "{{t:plugin.integration-extdemo.stats_hint}}",
              "type": "text"
            },
            {
              "columns": [
                {
                  "header": "plugin.integration-extdemo.name",
                  "value": "{{row.label}}"
                },
                {
                  "header": "plugin.integration-extdemo.value",
                  "value": "{{row.value}}"
                }
              ],
              "rows": "{{data.stats}}",
              "type": "table"
            }
          ],
          "type": "stack"
        },
        "data": {
          "stats": {
            "get": "/api/v1/addons/integration-extdemo/stats"
          }
        },
        "icon": "ChartBar",
        "id": "stats",
        "nav": true,
        "title": "plugin.integration-extdemo.stats_title"
      },
      {
        "area": "client",
        "body": {
          "children": [
            {
              "children": [
                {
                  "label": "plugin.integration-extdemo.note",
                  "name": "text",
                  "type": "textarea"
                },
                {
                  "label": "plugin.integration-extdemo.save",
                  "type": "button"
                }
              ],
              "submit": {
                "method": "POST",
                "path": "/api/v1/addons/integration-extdemo/notes",
                "then": {
                  "type": "refresh"
                },
                "type": "request"
              },
              "type": "form"
            },
            {
              "columns": [
                {
                  "header": "plugin.integration-extdemo.note",
                  "value": "{{row.text}}"
                }
              ],
              "empty": {
                "title": "plugin.integration-extdemo.no_notes",
                "type": "empty"
              },
              "rows": "{{data.notes}}",
              "type": "table"
            }
          ],
          "type": "stack"
        },
        "data": {
          "notes": {
            "get": "/api/v1/addons/integration-extdemo/notes"
          }
        },
        "icon": "Note",
        "id": "notes",
        "nav": true,
        "title": "plugin.integration-extdemo.notes_title"
      },
      {
        "area": "client",
        "frame": {
          "height": 240,
          "src": "assets/ui.html"
        },
        "icon": "AppWindow",
        "id": "panel",
        "nav": true,
        "title": "plugin.integration-extdemo.panel_title"
      }
    ],
    "slots": [
      {
        "body": {
          "text": "{{t:plugin.integration-extdemo.hello}}",
          "type": "alert"
        },
        "slot": "client.dashboard"
      },
      {
        "body": {
          "text": "{{t:plugin.integration-extdemo.hello}}",
          "type": "text"
        },
        "data": {
          "stats": {
            "get": "/api/v1/addons/integration-extdemo/stats"
          }
        },
        "slot": "admin.customer.detail"
      },
      {
        "body": {
          "height": 120,
          "src": "assets/ui.html",
          "type": "frame"
        },
        "order": 5,
        "slot": "admin.invoices.toolbar"
      },
      {
        "body": {
          "text": "{{t:plugin.integration-extdemo.hello}}",
          "type": "alert"
        },
        "slot": "admin.layout.banner"
      },
      {
        "body": {
          "text": "{{t:plugin.integration-extdemo.hello}}",
          "type": "text"
        },
        "slot": "client.*.after"
      }
    ]
  },
  "version": "0.1.0",
  "wasm": "addon.wasm"
}
```

