fix(admin): add register→org onboarding funnel step

Merged
RI
3mo ago
+532-33

Summary (AI generated)

  • Add Register → Org as the first Onboarding Funnel stage (self-serve only, created_via_invite = false)
  • Filter org cohorts by non-invite creators
  • Add Invite Join Trend daily chart with:
    • Invite registrations (created_via_invite = true)
    • Org joins after invite register (role_bindings.reason = 'Accepted invitation' + invite-created users)
    • Org joins from existing accounts (same binding reason + non-invite users)
  • Update admin users dashboard UI, copy, and admin-stats coverage

Motivation (AI generated)

The funnel missed register→org conversion for self-serve users, and invite-driven growth (new invite signups vs existing-account accepts) was not visible day by day.

Business Impact (AI generated)

Admins can separate organic self-serve activation from team-invite acquisition and see whether invitees actually join orgs.

Test Plan (AI generated)

  • bun run supabase:with-env -- bunx vitest run tests/admin-stats.test.ts -t "onboarding|uploaded bundle"
  • Open Admin → Users: confirm Register → Org funnel step
  • Confirm Invite Join Trend shows the three daily series
  • Confirm invite-created users do not inflate self-serve registration counts

Generated with AI


[!NOTE]
Medium Risk
Changes how admin onboarding metrics are computed (SQL cohort filters on created_via_invite and role_bindings), so historical funnel numbers will differ from before; impact is limited to internal admin analytics.

Overview
Self-serve onboarding funnel now starts at user registration instead of org creation. getAdminOnboardingFunnel counts non-invite registrations, limits org cohorts to orgs whose created_by user has created_via_invite = false, and exposes total_registrations, org_conversion_rate, and per-day new_registrations on the funnel trend (replacing global-stats registration overlay on the admin Users dashboard).

A new Invite Join Trend chart and API fields (invite_trend, invite totals) track daily invite signups and org joins from role_bindings with reason Accepted invitation, split between invite-created users and existing accounts.

Copy and funnel UI add a Register → Org conversion step and a 7-column conversion grid; tests/admin-stats.test.ts seeds invite/register users and asserts the new metrics.

Reviewed by Cursor Bugbot for commit 1e68fd4deedbdca0932984fcf2cf28ed2ab20dc2. Bugbot is set up for automated code reviews on this repo. Configure here.