# Upgrade Hyperchat 1.7 to 1.8

Back up your source, database and private configuration. Apply the update as a reviewable merge and preserve branding, integrations, provider keys, workspace data and published workflows. Do not rerun fresh-owner setup or replace a customer's repository.

This release adds custom funnel domains, opt-in first-party funnel results and bounded analytics cleanup. The additive tables and optional tracking field preserve existing funnels; measurement stays off until a workspace owner/admin enables it. Published pages and existing `/f` URLs continue to work.

For 1.6 or earlier, also read the intermediate upgrade guides, including UPGRADE_1.7.0.md. With untouched old/new extracted releases, run the read-only planner:

```sh
node scripts/plan-upgrade.mjs --installed /path/to/current --baseline /path/to/untouched-old-release --incoming /path/to/hyperchat-1.8.0 > upgrade-plan.json
```

## Merge map

- Backend: `convex/funnelModel.ts`, `funnels.ts`, `funnelDomains.ts`, `funnelDomainDns.ts`, `funnelStats.ts`, `funnelStatsModel.ts` and the cleanup entry in `crons.ts`. Preserve custom schema fields and scheduled jobs.
- Routing: merge `src/proxy.ts`, `next.config.ts` (`skipProxyUrlNormalize`), `src/app/domains`, `src/app/api/funnel-events`, `src/lib/funnel-domain-server.ts` and `funnel-domains.ts`. Combine any existing proxy with the tenant routing and reserved-header stripping; do not overwrite your authentication routing. Public custom domains must not serve the dashboard or auth APIs.
- UI and capture: `funnel-manager.tsx`, `funnel-tools.tsx`, `funnel-tools.css`, `funnel-page.tsx`, `public-funnel.tsx`, and `src/lib/funnel-api.ts`, `funnel-tools-api.ts`, `funnel-tracking.ts`. Preserve existing themes and custom intake behavior.
- Documentation and validation: the 1.8 guide, unit/backend domain/results tests, and the compiled HTTP/browser acceptance scripts in `tests/integration`. Optional browser acceptance uses Puppeteer; the isolated results UI fixture also uses esbuild. Neither is a runtime dependency.

## Deploy and verify

Deploy schema/functions to the installation's own Hyperchat Convex backend before the web update. Generate the full Convex API, run types, unit/backend tests and a production build. Configure `FUNNEL_DOMAIN_TARGET` in Convex and follow docs/FUNNEL_DOMAINS_AND_RESULTS.md for hostname/HTTPS/DNS setup. There is no domain purchase, DNS write, certificate provisioning, external booking/payment confirmation or messaging activation in this update.

Test a synthetic lead, its retry, a tracked CTA and the resulting daily counts in a test workspace. Confirm draft previews create no analytics, unauthorized users cannot manage domains or read reports, and disconnect/unpublish remove access. Avoid real customer messages and real paid transactions during acceptance.

Rollback: turn off measurement and disconnect domain bindings, then restore the previous web/backend source as a matched pair. Preserve the additive analytics tables, existing funnel records and configuration; do not delete or reset customer data as an upgrade repair.
