stack/examples
BilalG1 64ddb41374
fix(demo): align payments-demo with its own hexclave.config.ts catalog (#1651)
## Problem

The demo's `payments-demo` page white-screens on load with:

```
Item with ID "emails_per_month" not found.   (KnownError.fromJson)
```

## Root cause

The demo runs (via the CLI `dev` / development-environment flow) against
an auto-created **Development Environment Project**, which is
provisioned from `examples/demo/hexclave.config.ts`. That config
declares items `api_calls` / `seats` and products `pro` / `team_pro` /
`extra_seats`.

But the demo **code** still referenced the **internal** project's plan
catalog from `@hexclave/shared/plans` — `emails_per_month`, products
`team` / `growth`, `PLAN_LIMITS`, `resolvePlanId`. None of those exist
in the demo's own config, so `team.useItem("emails_per_month")` threw
`ItemNotFound` and crashed the whole page.

Confirmed by dumping the live rendered config
(`tenancy.config.payments`, the exact path the SDK reads) for the
dev-environment project: items `["seats","api_calls"]`, products
`["pro","team_pro","extra_seats"]` — no `emails_per_month`. The
`internal` project's config is healthy and unrelated; this is purely
demo code drift from its own config file.

## Fix

Align the demo code with its own `hexclave.config.ts` (the CLI's
declared source of truth):

- `useItem("seats")` + seat metrics instead of email-quota metrics
- Buy `team_pro` / `extra_seats` instead of `team` / `growth`
- Local `resolveTeamPlan()` instead of `resolvePlanId()` / `PLAN_LIMITS`
- `create-checkout-url` + `config-check` routes updated to the new
catalog
- Copy updates (header, "Free plan" note, manual-end-test instructions)

No backend or provisioning changes — the dev-environment project already
had the correct catalog; only the demo code was stale.

## Verification

- `pnpm --filter @hexclave/example-demo-app typecheck` — pass
- `pnpm --filter @hexclave/example-demo-app lint` — pass
- Demo page loads cleanly: team card renders (active plan "none", 0
seats granted/available), **Buy Team Pro** / **Buy Extra Seat (add-on)**
buttons present, no crash.

## Note

The demo is treated here as a generic SaaS example (its
`hexclave.config.ts` is the curated source of truth). If the intent was
instead for the demo to exercise the internal project's real plans +
email-quota, the alternative fix would be to update `hexclave.config.ts`
rather than the demo code.


<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Fixes the payments demo white-screen by aligning it with its own
`hexclave.config.ts` catalog. The page now loads and uses seat-based
metrics and the correct product IDs.

- **Bug Fixes**
- Use `seats` item and seat metrics; drop
`emails_per_month`/`PLAN_LIMITS`/`resolvePlanId` from
`@hexclave/shared/plans` in favor of a local `resolveTeamPlan()`.
- Switch checkout product IDs to `team_pro` and `extra_seats`; update
API validation, labels, and copy.
- Update `config-check` to expect `api_calls`, `seats`, and
`teamProSeats: 25`.

<sup>Written for commit 8e5bd9a575.
Summary will update on new commits.</sup>

<a
href="https://cubic.dev/pr/hexclave/hexclave/pull/1651?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>

<!-- End of auto-generated description by cubic. -->



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Transitioned subscription model from email-quota plans to seat-based
Team Pro with Extra Seats add-on
* Updated checkout system and payment configuration for new product
offerings
* Updated demo interface labels and metrics display to reflect
seat-based model

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-06-25 14:47:55 -07:00
..
cjs-test chore: update package versions 2026-06-25 19:11:40 +00:00
convex chore: update package versions 2026-06-25 19:11:40 +00:00
demo fix(demo): align payments-demo with its own hexclave.config.ts catalog (#1651) 2026-06-25 14:47:55 -07:00
docs-examples chore: update package versions 2026-06-25 19:11:40 +00:00
e-commerce chore: update package versions 2026-06-25 19:11:40 +00:00
js-example chore: update package versions 2026-06-25 19:11:40 +00:00
lovable-react-18-example chore: update package versions 2026-06-25 19:11:40 +00:00
middleware chore: update package versions 2026-06-25 19:11:40 +00:00
react-example chore: update package versions 2026-06-25 19:11:40 +00:00
supabase chore: update package versions 2026-06-25 19:11:40 +00:00
tanstack-start-demo chore: update package versions 2026-06-25 19:11:40 +00:00