The three deferred Phase-3 pieces, built + hard-verified. This closes out Β§5.1/Β§5.2 premium features. Still TEST mode, nothing public.
0006_phase3b_... + 0007_share_premium_gate (applied live):is_admin(uid) helper; claim_ai_run(uid, cap) (atomic per-day AI meter).ai_usage (service-only), insights (owner-read), share_links (owner-all + premium-insert trigger), admin_audit (service-only).ai_usage/admin_audit = RLS on, no policy) are intentional β deny-all to clients, service-role only. Plus the one carried pg_net-in-public WARN.generate-insights (premium-gated via is_premium, 5/day rate cap via claim_ai_run, fail-closed, OpenRouter anthropic/claude-sonnet-5 on her key). Strong compliance prompt: descriptive-only, never advice/dose/diagnosis. pages/Insights.tsx rebuilt: free users get a client-side descriptive summary (injections, streak, avg mood, top site) + a premium lock; premium users get AI cards + Refresh.share-view (no auth; the token is the credential; returns a sanitized whitelist β name + compounds + injections + check-ins, never email/id/user_id; noindex, no-store; 404 on revoked/unknown, 410 on expired). pages/Share.tsx (premium-gated create/list/copy/revoke; 30-day expiry; premium enforced by DB trigger). pages/SharedView.tsx = the public read page at /s/:token, rendered OUTSIDE the auth gate (App.tsx restructured to one router). CSV export stays free in Settings.admin (action-dispatched: list/grant/revoke/delete; every action requires caller is_admin server-side; writes admin_audit; never deletes self). pages/Admin.tsx (client-gated by profiles.is_admin + server-enforced): user list with premium/admin badges, grant/revoke premium, multi-select bulk delete. More menu shows an Admin link only to admins. profiles.is_admin set manually in DB for Sondra when she wants access.npx tsc -b clean Β· npm run build clean. `json `` fences β JSON.parse` threw β 502. Parser now strips fences / extracts the JSON object; redeployed (v2); re-verified green.generate-insights (jwt), share-view (public), admin (jwt) β plus Phase 3's create-checkout, stripe-webhook, and Phase 2's send-reminders.
profiles.is_admin = true on your row (one SQL line) to see the Admin console.Landing page, legal pages (privacy/terms/cookie), in-app support form + email alert (her standing rule), empty-state/microcopy polish, mobile Lighthouse gate, /app-safety-check, flip Stripe TESTβlive (+ email-confirm ON), domain cutover to getpeptidepal.com, cancel Emergent. Also: set APP_URL edge secret to the real domain; regenerate types.ts from live DB; decide the pg_net-schema move during the launch DB pass.
Generated for the CEO Dashboard · source: PROJECTS/Peptide Pal/handoffs/v2-phase3b-insights-share-admin-2026-07-07.md π€