# Pitchbar visitor widget

Standalone Vite build that produces a single IIFE bundle uploaded to the
CDN at deploy time. The customer embeds it with:

```html
<script
    src="https://cdn.pitchbar.io/widget.js"
    data-agent-id="agt_..."
    async
></script>
```

## Build

```
npm run build:widget
```

Output: `public/widget/widget.js` (gzipped budget: **≤ 50KB**).

## Constraints

- MUST NOT import from `resources/js/` (admin code).
- MUST NOT pull `@inertiajs/*`, shadcn/Radix, or any admin-only dep.
- React/ReactDOM are aliased to `preact/compat` in the build config.
- Lucide icons: import individually if used.

## Layout

```
resources/widget/
├── src/
│   ├── entry.tsx       — Vite entry; mounts to Shadow DOM
│   ├── App.tsx         — root component
│   ├── core/           — WS, store, API (added in WU-19)
│   ├── ui/             — Bar, Messages, Composer, etc. (WU-19)
│   └── triggers/       — exit-intent, idle, scroll (WU-20)
└── README.md
```
