Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
3c1f57d
fix: Add sign-in/sign-up pages for OAuth redirect flow
Aug 26, 2025
7ea255e
fix: Update Clerk props and fix Convex auth domain mismatch
Aug 26, 2025
f11b587
fix: Configure production deployment for Netlify
Aug 26, 2025
538f4f0
fix: Update Convex auth config to use environment variables
Aug 26, 2025
a36c9bc
fix: Add Netlify-specific IP headers for proper region detection
Aug 26, 2025
c93f18f
fix: Resolve production authentication and RadioGroup errors
Aug 26, 2025
7191173
fix: resolve Clerk-Convex user sync issues
Aug 26, 2025
f6e77d5
fix: rename use-current-user.ts to .tsx to fix JSX syntax error
Aug 26, 2025
32ac490
fix: resolve Convex createOrUpdateStudent submission error
Aug 27, 2025
8ad2356
fix: make email sending non-blocking in student form submission
Aug 27, 2025
89919f0
feat: Update platform branding to Nurse Practitioner focus
Aug 27, 2025
c7f6827
Security: Remove exposed API keys and sensitive documentation
Aug 28, 2025
4f9da32
docs: Create secure documentation templates without exposed keys
Aug 28, 2025
935da74
fix: add multiple bypass methods for region lock issues
Aug 28, 2025
ac26c73
fix: resolve all build errors and codebase issues
Aug 28, 2025
0718ef0
fix: resolve remaining ESLint warnings and unit test failures
Aug 28, 2025
3c52f7f
Remove location-based access restrictions
Aug 28, 2025
d7bbf5e
feat: implement streamlined intake flows with Stripe integration
Aug 28, 2025
966097d
fix: resolve React error 185 infinite update loop in student intake form
Aug 28, 2025
353e90c
feat: implement student intake access control with payment verification
Aug 28, 2025
24ea8e3
feat: implement comprehensive IP protection and payment-gated intake …
Aug 28, 2025
8def1b7
fix: resolve Convex backend deployment and add payment protection err…
Aug 28, 2025
735ad95
feat: restore comprehensive 7-step student intake form behind paywall
Aug 29, 2025
0714e2f
fix: update CSP headers to allow Google Fonts, Clerk workers, and tel…
Aug 29, 2025
096e8cb
Delete .env.prod-deploy
thefiredev-cloud Aug 29, 2025
978df6e
feat: major cleanup - remove unnecessary features and simplify codebase
Aug 29, 2025
c43d235
Merge branch 'main' of https://github.com/Apex-ai-net/MentoLoop
Aug 29, 2025
e34c443
chore: clean up environment files and improve .gitignore
Aug 29, 2025
1c73048
fix: integrate Stripe checkout in student intake Step 4 payment flow
Aug 29, 2025
52ebfb1
fix: implement dynamic Stripe pricing for student intake payments
Aug 29, 2025
de05dcc
fix: resolve Convex-Stripe payment sync issues for student intake
Aug 30, 2025
faf30ea
fix: remove deprecated audit log references from admin.ts
Aug 30, 2025
6bae6e4
fix: add explicit type annotation to auditLogs variable
Aug 30, 2025
0a89a6c
feat: complete Stripe payment integration with new account
Aug 31, 2025
cc84cda
fix: resolve TypeScript build errors and API consistency issues
Aug 31, 2025
2aba683
fix: add explicit logging and fix price ID mapping in payments
Aug 31, 2025
75f34d2
fix: ensure user exists in Convex before creating payment session
Aug 31, 2025
0fe430e
fix: update Clerk JWT issuer domain to match actual Clerk instance
Aug 31, 2025
841e56c
feat: add discount code support for student intake payments
Aug 31, 2025
44e1527
fix: resolve TypeScript error in discount code validation
Aug 31, 2025
877d973
fix: resolve discount code validation error and improve payment flow
Aug 31, 2025
b8b8e5f
fix: update Stripe price IDs to resolve payment error
Aug 31, 2025
362ff44
fix: add validation and fallback mapping for old Stripe price IDs
Aug 31, 2025
0d379b1
fix: apply NP12345 discount code correctly for 100% off
Sep 1, 2025
b688fb0
feat: Fix dashboard alignment and configure admin accounts
Sep 1, 2025
6adb437
fix: Add missing intakePayments query to resolve Netlify build error
Sep 1, 2025
a04cb2a
fix: Update Convex generated API types to include intakePayments
Sep 1, 2025
69f6294
fix: prevent navbar from showing on dashboard pages to fix overlap issue
Sep 2, 2025
1688f51
fix: improve admin user recognition and prevent duplicate accounts
Sep 2, 2025
b1fd889
fix: resolve React hydration error on dashboard page
Sep 2, 2025
1162a8c
fix: ensure admin users are properly routed to admin portal
Sep 2, 2025
6413206
fix: ensure admin emails always get admin access
Sep 2, 2025
67bcc6e
fix: remove admin email exposure in student portal
Sep 2, 2025
8508d52
fix: prevent admin users from accessing student dashboard
Sep 2, 2025
8196364
feat: implement dashboard routing, discount codes, and installment pa…
Sep 2, 2025
1cbb8b9
fix: remove syncAdminUser to fix Netlify build error
Sep 2, 2025
191c035
fix: resolve React error #300 in admin dashboard
Sep 2, 2025
c9f4b48
fix: preserve admin status for admin@mentoloop.com and support@mentol…
Sep 2, 2025
075da79
fix: correct undefined userEmail variable references in admin user fu…
Sep 2, 2025
befa6d7
Fix admin user authentication and hydration issues
Sep 2, 2025
eb966bd
Fix TypeScript error in discount-setup page - add couponId to result …
Sep 2, 2025
9d28568
fix: resolve React hydration errors on dashboard
Sep 2, 2025
63f9c18
fix: remove admin access from support@mentoloop.com
Sep 2, 2025
cd29273
feat: add glass-navbar to admin dashboard with MentoLoop branding
Sep 2, 2025
1068958
fix: resolve navbar alignment issues in admin dashboard
Sep 2, 2025
cb1a740
fix: resolve navigation bar overlap in dashboard layout
Sep 2, 2025
6565df0
fix: position sidebar below navbar to prevent logo overlap
Sep 2, 2025
57c626e
refactor: remove decorative icons from navigation system
Sep 3, 2025
6bbc699
fix: Phase 1 - Critical fixes for MentoLoop dashboard
Sep 3, 2025
8515151
fix: resolve Netlify build errors
Sep 3, 2025
790b1aa
fix: remove NODE_ENV override to resolve Netlify Html component error
Sep 3, 2025
6f1841c
fix: remove hardcoded statistics and fix production configuration
Sep 3, 2025
a1df006
fix: resolve dashboard issues and add missing pages
Sep 3, 2025
8fd83ce
refactor: transform preceptors from payment collectors to paid servic…
Sep 3, 2025
7968876
feat: implement role-based account creation routing
Sep 3, 2025
4f267a0
Fix role-based routing and simplify preceptor verification
Sep 3, 2025
38224b4
fix: resolve TypeScript errors blocking build
Sep 3, 2025
0eec29b
feat: simplify preceptor registration form
Sep 3, 2025
7e668ac
Redesign institutions page with artistic style matching home page
Sep 3, 2025
09ffa77
refactor: simplify institution page and remove dark mode support
Sep 4, 2025
e981def
Fix Netlify deployment configuration
Sep 4, 2025
cb0f21e
Fix authentication issues and simplify user sync logic
Sep 5, 2025
0193220
Fix Clerk deprecation warnings and improve logging
Sep 5, 2025
bc2a390
Fix JWT configuration and add missing Netlify environment variables
Sep 5, 2025
45bf5df
Merge remote changes and resolve conflicts
Sep 5, 2025
41c1712
fix: correct specialty values in preceptor signup form
Sep 5, 2025
6e6b8c2
fix: remove Dashboard buttons from sidebar and add footer to dashboar…
Sep 5, 2025
bee6ed2
Remove billing for preceptors and connect dashboards to real data
Sep 5, 2025
76564f3
Implement complete application flow with pre-signup pages, CEU module…
Sep 5, 2025
b964f66
feat: migrate application from test data to production database
Sep 5, 2025
ee05d6e
Fix Netlify build errors - resolve TypeScript and ESLint issues
Sep 5, 2025
869d7a5
Simplify all dashboard homepages with clean navigation design
Sep 6, 2025
bfb7ada
Fix infinite loading spinner issue in student dashboard
Sep 6, 2025
6c3dda1
Production fixes: Clean unused vars, fix React hooks, remove console …
Sep 6, 2025
0dc7f4a
feat: comprehensive performance optimization and mobile enhancements
Sep 6, 2025
87b6b06
fix: move cssnano and autoprefixer to production dependencies
Sep 6, 2025
9530b24
feat: update landing pages with new messaging and pricing structure
Sep 7, 2025
e49eaa4
feat: Update pricing structure and create dedicated landing pages
Sep 7, 2025
1ae9c10
docs: update deployment workflow - never use local dev server, always…
Sep 8, 2025
b0a13df
fix: remove geographic restrictions and production blockers
Sep 8, 2025
53b2cbf
fix: improve discount code application in Stripe checkout session
Sep 8, 2025
63bbc50
fix: production-ready improvements - remove homepage pricing, clean c…
Sep 9, 2025
d96ba1c
feat: add CEU courses and billing backend functions
Sep 9, 2025
5a088be
feat: complete enterprise dashboard, add error boundaries, and optimi…
Sep 9, 2025
73447ba
fix: resolve TypeScript and ESLint errors in billing page
Sep 9, 2025
7dd8082
fix: resolve TypeScript errors in CEU page
Sep 9, 2025
d40bb58
feat: Complete MentorFit integration and testing
Sep 10, 2025
952e720
feat: enhance landing pages with animated backgrounds and professiona…
Sep 12, 2025
c2de677
fix: update navigation links to point to landing pages instead of int…
Sep 12, 2025
f03b6c2
test: add comprehensive matching system verification and documentation
Sep 12, 2025
03dc379
feat: add AI chatbot and update contact page
Sep 13, 2025
f8fe6e2
fix: resolve Netlify build errors for chatbot deployment
Sep 13, 2025
db06a96
fix: add Convex deployment to build process
Sep 13, 2025
191da3b
Trigger rebuild with CONVEX_DEPLOY_KEY configured
Sep 13, 2025
a3637e9
fix: add explicit TypeScript types to chatbot.ts for Convex deployment
Sep 13, 2025
e0d1e64
feat: enhance chatbot with full LLM conversational capabilities
Sep 13, 2025
cca9272
fix: resolve chatbot issue by updating to non-deprecated OpenAI model
Sep 13, 2025
43eb08f
fix: resolve chatbot rendering issue by fixing API imports
Sep 13, 2025
cd50fac
feat: optimize chatbot for faster responses using GPT-4-turbo
Sep 13, 2025
92ee403
feat: enhance student intake form with improved UX and pricing options
Sep 14, 2025
1f0f17e
feat: enhance chatbot with bigger window and smooth animations
Sep 14, 2025
f59996c
fix: remove watch demo button from student landing page
Sep 14, 2025
e86e47c
feat: update student intake confirmation to show MentorFit immediately
Sep 14, 2025
aad39cb
fix: resolve 'Missing student information' error in payment step
Sep 14, 2025
22e6a31
fix: resolve invalid Stripe price ID errors in payment step
Sep 14, 2025
63220d3
fix: create LIVE Stripe products and update price IDs
Sep 14, 2025
5a8c271
fix: create actual LIVE Stripe products with correct API keys
Sep 14, 2025
4c2ab77
fix: resolve Stripe discount code application issue
Sep 14, 2025
231d91c
feat: add discount code testing dashboard for admin
Sep 14, 2025
f97da48
fix: resolve placeholder implementations and build issues
Sep 14, 2025
75187b7
feat(gpt5): add chat/docs API, hooks, minimal UI, prompt validators; …
Sep 15, 2025
09f334c
fix(gpt5): add explicit Convex types for action, handler return, and …
Sep 15, 2025
b1f3cf8
feat(intake/ui/stripe): hide redundant fields in student intake (pref…
Sep 15, 2025
828bdc6
feat(intake): add 'Other' specialty text input in rotation needs; add…
Sep 15, 2025
36804c9
feat(messaging/docs): enforce preceptor-first messaging; wire student…
Sep 15, 2025
dfcd9fb
feat(hours-credits): add hourCredits table; deduct on approval; grant…
Sep 15, 2025
7dbc59b
feat(stripe-connect): add preceptor Connect fields; actions to create…
Sep 15, 2025
dc33918
feat(loop-exchange/privacy): add privacy opt-out toggle to preceptor …
Sep 15, 2025
506af74
docs(readme): refresh README for current stack, deployment, testing, …
Sep 16, 2025
3fbeccf
QA hardening: GPT-5 routes no-store + sanitized logs; Stripe webhook …
Sep 16, 2025
8ce0053
Stripe Checkout: prefer promotion_code auto-apply for NP12345; fallba…
Sep 16, 2025
3d12bdd
Checkout UX: show custom submit message when 100% discount is applied…
Sep 16, 2025
5e8639f
Zero-cost pathway: NP12345 unlocks MentorFit without Stripe (grantZer…
Sep 16, 2025
c4f1a6a
test: improve Playwright E2E test configuration and add QA utilities
Sep 16, 2025
2c55417
docs(README): add live demo link and replace screenshots with sandbox…
Sep 17, 2025
7a84fe6
fix(payments): avoid sending allow_promotion_codes with discounts to …
Sep 17, 2025
507c1fd
fix(checkout): remove unsupported automatic_payment_methods from Stri…
Sep 17, 2025
958a677
MentorFit entitlement unlock: backend status + frontend gating\n\n- C…
Sep 17, 2025
36857fe
Stripe checkout: robust Idempotency-Key based on params hash + single…
Sep 17, 2025
3a428ac
Checkout confirmation: include intake metadata in session; add confir…
Sep 17, 2025
ab810d3
Fix Netlify build: remove unused 'react-bits' import from confirmatio…
Sep 17, 2025
1fb5181
Route fix: enforce Convex userType='student' on intake confirmation t…
Sep 17, 2025
037a518
RoleGuard: auto-correct to student when Clerk metadata shows complete…
Sep 17, 2025
907fd20
MCP: fix Stripe server config (@stripe/mcp, STRIPE_SECRET_KEY), add i…
Sep 18, 2025
e2ebc40
payments: remove MENTO12345 from penny overrides; admin API: init-men…
Sep 18, 2025
1c07bea
docs: update Codex context to emphasize NP preceptor–student mentorsh…
Sep 19, 2025
2328983
chore(ci): add scripts/static-scan.js and env parity placeholders; e2…
Sep 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
288 changes: 288 additions & 0 deletions .codex/MENTOLOOP_PROMPT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,288 @@
# MentoLoop — Nurse practitioner preceptor–student mentorship system with AI-powered matching — Codex Project Context

This file provides Codex with project-wide context, standards, and patterns to ensure output aligns with MentoLoop’s architecture, compliance, and quality requirements.

## Project Overview
- Platform: Nurse practitioner preceptor–student mentorship system with AI-powered matching
- URL: sandboxmentoloop.online
- Repository: https://github.com/Apex-ai-net/MentoLoop
- Version: 0.9.7
- Primary Users: Nursing students, preceptors, healthcare institutions

## Tech Stack

### Frontend
- Framework: Next.js 15 with App Router (Turbopack)
- Styling: TailwindCSS v4, shadcn/ui components
- UI Libraries: Radix UI, Framer Motion, Motion Primitives
- Icons: Lucide React, Tabler Icons
- Charts: Recharts for data visualization
- State Management: React hooks with Convex real-time sync

### Backend & Database
- Database: Convex (real-time serverless)
- Authentication: Clerk (with JWT templates)
- File Storage: Convex file storage
- API Pattern: Convex mutations/actions/queries

### AI & Integrations
- AI Providers: OpenAI GPT-4, Google Gemini Pro
- Email: SendGrid (internal action pattern)
- SMS: Twilio
- Payments: Stripe (subscription-based)
- Webhooks: Svix for validation

## Project Structure
```
├── app/ # Next.js App Router
│ ├── (landing)/ # Public landing pages
│ ├── dashboard/ # Protected dashboard routes
│ ├── admin/ # Admin panel
│ ├── student-intake/ # Student onboarding
│ ├── preceptor-intake/ # Preceptor onboarding
│ └── api/ # API routes
├── convex/ # Backend functions
│ ├── schema.ts # Database schema
│ ├── users.ts # User management
│ ├── matches.ts # Matching logic
│ ├── aiMatching.ts # AI-enhanced matching
│ ├── messages.ts # HIPAA-compliant messaging
│ ├── payments.ts # Stripe integration
│ ├── emails.ts # SendGrid templates
│ └── sms.ts # Twilio notifications
├── components/ # React components
│ ├── ui/ # shadcn/ui components
│ ├── dashboard/ # Dashboard components
│ └── shared/ # Shared components
├── lib/ # Utilities
└── hooks/ # Custom React hooks
```

## Key Coding Patterns

### Convex Database Operations
```ts
import { v } from "convex/values";
import { mutation, query, action } from "./_generated/server";

// Queries for read operations
export const getStudents = query({
args: { schoolId: v.optional(v.id("schools")) },
handler: async (ctx, args) => {
const identity = await ctx.auth.getUserIdentity();
if (!identity) throw new Error("Unauthorized");
return await ctx.db.query("students").collect();
},
});

// Mutations for write operations
export const updateStudent = mutation({
args: { studentId: v.id("students"), data: v.object({ /* ... */ }) },
handler: async (ctx, args) => {
// Validate and update
},
});

// Actions for external API calls
export const sendEmail = action({
args: { /* SendGrid params */ },
handler: async (ctx, args) => {
// External API calls go in actions
},
});
```

### Component Structure
```ts
interface ComponentProps {
data: Student;
onUpdate: (id: Id<"students">, data: Partial<Student>) => void;
}

export function StudentCard({ data, onUpdate }: ComponentProps) {
const students = useQuery(api.students.list);
if (students === undefined) return <Skeleton />;
if (students === null) return <ErrorState />;
return <Card className="p-4">{/* ... */}</Card>;
}
```

## Environment Variables (required)
- Convex: `CONVEX_DEPLOYMENT`, `NEXT_PUBLIC_CONVEX_URL`
- Clerk: `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY`, `CLERK_SECRET_KEY`, `CLERK_JWT_ISSUER_DOMAIN`, `CLERK_WEBHOOK_SECRET`
- AI: `OPENAI_API_KEY`, `GEMINI_API_KEY`
- Communications: `SENDGRID_API_KEY`, `SENDGRID_FROM_EMAIL`, `TWILIO_ACCOUNT_SID`, `TWILIO_AUTH_TOKEN`, `TWILIO_PHONE_NUMBER`
- Stripe: `STRIPE_SECRET_KEY`, `STRIPE_WEBHOOK_SECRET`, `NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY`, `STRIPE_PRICE_ID_CORE`, `STRIPE_PRICE_ID_PRO`, `STRIPE_PRICE_ID_PREMIUM`
- App Settings: `NEXT_PUBLIC_APP_URL`, `EMAIL_DOMAIN`, `NODE_ENV=production`
- Feature Flags: `ENABLE_AI_MATCHING`, `ENABLE_EMAIL_NOTIFICATIONS`, `ENABLE_SMS_NOTIFICATIONS`, `ENABLE_PAYMENT_PROCESSING`

## Healthcare Compliance Requirements

### HIPAA Compliance
- Encrypt all patient data in transit and at rest
- Implement audit logging for all data access
- Use secure messaging for all communications
- Never log PHI in console or error messages

### FERPA Compliance
- Protect student educational records
- Implement proper access controls
- Maintain data retention policies

## Development Guidelines

### Code Quality Standards
- TypeScript strict mode
- Comprehensive error handling
- JSDoc comments for complex functions
- Follow ESLint and Prettier
- Unit tests for critical functions

### Git Workflow
- Feature branches: `feature/description`
- Bug fixes: `fix/description`
- Commit format: `type(scope): message`
- Run tests before pushing

### Performance Optimization
- Use `React.memo` for expensive components
- Virtual scrolling for large lists
- Optimize images via `next/image`
- Dynamic imports for code splitting
- Cache Convex queries when appropriate

### Security Best Practices
- Validate all user inputs
- Use parameterized queries
- Implement rate limiting
- Sanitize data before display
- Use environment variables for secrets
- Never expose sensitive data in client code

## Common Tasks & Solutions
- Add feature: define schema in `convex/schema.ts`, create functions in `convex/`, build UI in `components/`, add routes in `app/`, wire real-time via Convex hooks, add tests/docs.
- Debug Convex: check dashboard logs, verify env vars, ensure auth flow, review schema migrations.
- Optimize AI matching: use streamlined algorithm in `aiMatching.ts`, cache responses, implement fallbacks, monitor usage/costs.

## Testing Requirements
- Unit tests with Vitest for utilities
- Integration tests for API endpoints
- E2E tests with Playwright for critical flows
- Component tests for complex UI logic

## Deployment Notes
- Primary: Netlify (automatic deployments)
- Alternative: Vercel
- CI/CD: GitHub Actions
- Environments: development, staging, production

## Important Patterns
- Convex: use actions for external APIs, mutations for writes, queries for reads
- Real-time: prefer `useQuery`, implement optimistic updates, handle connection states
- Compliance: audit all data access, encrypt sensitive data, enforce access controls

## Cursor Rules
A stricter ruleset exists in `.cursor/rules/mentoloop.mdc` and is always applied.


### Dashboard Stabilization Execution Plan (2025-09-18)

Prepared for Codex hand-off; keep this section current as phases close.

Goal
- Stabilize dashboard features, fix dead buttons/flows, squash bugs, and get lint/types/tests clean so Codex can implement confidently.

Scope snapshot
- Dashboard routes under `app/dashboard/*` (student, admin, preceptor) have partially wired actions.
- Payments/discounts verification: `NP12345` = 100%, `MENTO12345` = 99.9%.
- Idempotency and checkout robustness need recheck after latest edits.
- Lint/type/test hygiene before hand-off.

Phase 0 — Baseline health (same-day)
- Build, type-check, lint, unit + e2e smoke:
- `npm run type-check`, `npm run lint`, `npm run test:unit:run`, `npm run test:e2e`
- MCP checks:
- Stripe: list coupons/prices, recent intents; verify `NP12345` (100%), `MENTO12345` (99.9%).
- Netlify: last deploy status and logs.
- Sentry: recent errors for dashboard routes.
- Output: short report with failures, stack traces, and owners.

Phase 1 — Inventory dead features (Day 1)
- Crawl dashboard UI and log “no-op” UI:
- Buttons/menus that don’t navigate, dispatch, or call Convex.
- Modals/forms missing submit handlers or success toasts.
- Prioritize by user impact (Blockers → Core UX → Nice-to-have).
- Output: checklist per route: `action → expected → current → fix candidate`.

Phase 2 — Payments and intake gating (Day 1–2)
- Ensure discount behavior:
- `NP12345`: zero-total end-to-end (no charge), immediate access.
- `MENTO12345`: 99.9% off applied via promotion code; UI shows correct final total.
- Verify idempotency:
- Customer create/update keys hash-based and vary with params; no `idempotency_error`.
- Confirm webhook/audit:
- `payments`, `paymentAttempts`, `paymentsAudit` updated; receipt URL stored.

Phase 3 — Wire dead features (Day 2–3)
- Student dashboard: Messages (send, mark read), Billing (open portal, history).
- Admin dashboard: Finance filters/CSV, matches actions, discount setup status.
- Preceptor dashboard: Matches list/actions and navigation from notifications.
- Each wire-up: optimistic UI, success/error toast, and e2e happy-path.

Phase 4 — Bug fixes + polish (Day 3–4)
- Fix navigation loops and guards (RoleGuard/intake step protection).
- Loading/error states, skeletons, a11y labels on forms/buttons.
- Stabilize flaky tests with data-testids and explicit waits.

Phase 5 — Hygiene (Day 4)
- Lint/types clean; remove unused/any; minimal typings where needed.
- Unit coverage for critical UI logic (messages, payments summary).
- E2E coverage:
- Intake basic → checkout with `NP12345` and `MENTO12345`
- Dashboard message send/read
- Admin discount init (NP + MENTO) smoke

Phase 6 — Observability + compliance (Day 4–5)
- Sentry: add breadcrumbs around checkout, intake transitions, and dashboard actions.
- Logs: ensure no PHI/PII; audit trails for payments/matches.
- Netlify headers/security: verify security headers applied site-wide.

Handover to Codex
- Open a single tracking issue with:
- The prioritized checklist (Phase 1 output).
- Repro steps for each bug (short).
- Acceptance criteria per feature.
- Commands to run locally and in CI.

MCP-assisted tasks to automate during execution
- Stripe: verify coupons, prices, intents, and fetch receipt URLs by email/session_id.
- Netlify: poll last deploy status and recent logs on push.
- Sentry: list recent issues filtered by dashboard paths.
- GitHub: list/open issues for each item in the checklist.

Definition of done
- Dashboard actions wired with feedback and no console errors.
- `NP12345` 100% and `MENTO12345` 99.9% pass e2e; idempotency errors eliminated.
- `npm run type-check` and `npm run lint` clean; tests green in CI.
- Sentry quiet for common flows; Netlify deploy green.

### 2025-09-19 Update — Dark Mode + Phase 0 Results

- Dark mode only: enforced via `html.dark`, dark palette in `app/globals.css`, Tailwind `darkMode: 'class'`, Sonner `theme="dark"`, charts theme mapping extended, Clerk UI set to dark.
- Baseline checks:
- Type-check: clean
- Lint: clean
- Unit tests: 80 passed, 3 skipped
- E2E live smoke: passed via external Playwright config against `https://sandboxmentoloop.online` (artifacts in `tmp/browser-inspect/`)
- Stripe MCP verification:
- Coupons: `NP12345` 100% (once), `MENTO12345` 99.9% (forever)
- Prices include $0.01 test price; recent PaymentIntents list empty (OK for idle)
- Notes:
- Local e2e using dev server requires `NEXT_PUBLIC_CONVEX_URL`; live-run external config avoids env deps.
- Sentry SDK warns about `onRequestError` hook in instrumentation; add `Sentry.captureRequestError` in a follow-up.

Next steps
- Phase 1 inventory of dead features in dashboard routes and prioritize (Blockers → Core UX → Nice-to-have).
- Phase 2 payments gating/idempotency recheck, webhook audit receipts.
- Add Sentry breadcrumbs across checkout/intake/dashboard actions.
- Netlify deploy/logs monitor on push.
47 changes: 47 additions & 0 deletions .codex/PLAN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Phased launch plan (live tracking)

Phase 1 – Intake + Payments polish (start now)
- Student intake step 1: hide full name/email/phone; prefill from Clerk; keep DOB only
- Student intake step 2: ensure NP track includes “Other”; require university/school fields explicitly
- Membership/pricing: verify 60h block and 30h a la carte are present (done); add one‑cent discount path (choose: test price or amount_off coupon)
- UI: make dashboard navbar solid white; replace landing footer in dashboard with a simple footer; hide “More” menus where unused

Phase 1a – Discount system GA (in flight)
- Owner (Payments Eng): Run `api.payments.syncDiscountCouponsToStudentProducts` in Stripe test/live; capture recreated coupon IDs for finance log. Target: week 1.
- Owner (Data Eng): Backfill existing `discountUsage` rows with new `stripePriceId`/`membershipPlan` columns; verify analytics dashboards still reconcile. Target: week 1.
- Owner (QA): Build automated coverage (unit+integration) for discount validation helpers and intake logging; wire into CI. Target: week 2.
- Owner (QA): Complete end-to-end QA: Core/Pro/Premium checkout (full + installments), NP12345 zero-cost flow, admin finance views. Target: week 2.
- Owner (Ops): Document ops rollback + verification steps in Stripe Ops runbook; ensure permissions allow metadata spot-check. Target: week 1.
- Dependencies: confirm STRIPE_SECRET_KEY + price IDs available in both test/live; ensure Convex access for backfill mutation.
- QA exit criteria: automated tests green + manual matrix signed off + finance dashboard sanity check screenshot archived.

Phase 2 – Messaging, Documents, Hours policy
- Enforce preceptor‑first messaging in convex/messages.sendMessage
- Wire documents UI (upload/view/delete) to convex/documents.ts and remove dead buttons
- Model hour credits with issuedAt/expiresAt (1 year) and enforce no rollover for a la carte; surface expiration in student dashboard
- Pre-work: audit existing messaging/document handlers to list missing validations, storage calls, and UI gaps.

Phase 3 – Preceptor onboarding + payouts
- Preceptor intake: add licenseNumber, telehealth willingness toggle; display verified/unverified on dashboard
- Stripe Connect for preceptor payouts (connected account onboarding, destination charges/transfers); add payout summary UI
- Loop Exchange: add privacy opt‑out in intake/profile; respect in directory

Phase 4 – Enterprise refinements
- Remove test analytics; enforce student capacity (e.g., 20 concurrent)
- Add Calendly CTA on enterprise landing/dashboard

Stripe envs
- Netlify: NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY (set), OPENAI_API_KEY (set)
- Convex: STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, STRIPE_PRICE_ID_* (set in Convex dashboard)

Toward v1.0 (new)
- Harden Stripe webhooks: leverage enriched discount metadata, emit structured logs/alerts when coupons lack `audience=student` or sync fails.
- Expand audit logging: record who runs discount sync, expose finance export summarizing discount usage by product.
- Final regression matrix for 1.0: student/preceptor intake, payments, admin RBAC, matching basics; capture sign-off before release cut.
- Prep release operations: draft 1.0 notes, update ROADMAP milestones, tag branch after CI (lint, type-check, tests, E2E) is green.
- Release owner: assemble regression matrix + schedule; due week prior to 1.0 cut.
- Product/Comms: draft release notes + changelog once Phase 1a + Phase 2 complete.

Build stability
- Short‑term: if needed, deploy with `npx convex deploy --typecheck=disable && next build`
- Long‑term: refactor any Convex actions using ctx.db directly into internalQuery/internalMutation wrappers
Loading
Loading