TRUCKIPIE CALL DESK WEB - DEPLOYMENT PACKAGE
Version: 1.0.0 (initial web foundation)
Target: Namecheap Stellar Plus / cPanel / PHP 8.1+ / MySQL or MariaDB

IMPORTANT STATUS
This is an uploadable initial web application foundation with Microsoft 365 sign-in, role-based dashboard, carrier/call/lead/attendance/DNC APIs, MySQL schema, and embedded RingCentral panel configuration. It is not a completed 1:1 port of every Chrome extension feature. Full historical migration requires exporting each agent's local Chrome workspace and validating those exports. RingCentral embedded calling and Microsoft OAuth require tenant/app configuration and a real-account test before production use.

DEPLOY
1. Create subdomain desk.truckipie.com in cPanel and enable SSL.
2. Create a MySQL database and database user in cPanel. Grant ALL privileges on that database.
3. Upload this ZIP's contents into the subdomain document root (usually public_html/desk/).
4. Visit https://desk.truckipie.com/install.php.
5. Enter database details, the initial CEO @truckipie.com email, Microsoft app client ID (pre-filled), and Microsoft client secret. The installer writes private/config.php and creates tables.
6. In Microsoft Entra > App registrations > Authentication, add a Web redirect URI exactly:
   https://desk.truckipie.com/api/auth/callback
   Ensure authorization code flow and a client secret are configured. Use the existing client ID if that app registration can support Web platform redirect URIs. Do not put the client secret in JavaScript.
7. Sign in with the initial CEO account. Other @truckipie.com Member accounts are provisioned as Agents; CEO can promote Managers in User Management.
8. Configure the RingCentral public app ID in Settings. RingCentral embedded app must allow the desk domain and microphone permissions. Test with a company-controlled number before live calling.
9. Delete or rename install.php after successful installation (the app also creates an install.lock file).

DOCUMENT ROOT NOTE
This package is intended to be extracted into the subdomain's document root. The private directory is protected by .htaccess, but ideally move /private outside public_html if your cPanel layout permits. If moved, update the require path in api/bootstrap.php and app/config-loader.php.

FEATURES IN THIS INITIAL RELEASE
- Microsoft 365 OAuth login; checks @truckipie.com and Member account through Microsoft Graph.
- CEO / Manager / Agent roles and user management.
- Central MySQL carrier records, campaigns, call records, leads, callbacks, attendance, DNC, reservations, SMS logs/templates, audit logs.
- Carrier search and manual carrier creation.
- Call outcome logging and lead creation.
- Attendance check-in/out.
- Company-wide DNC checks.
- Carrier reservation endpoint with transaction/unique constraints.
- RingCentral embedded phone iframe placeholder configurable from Settings.
- CSV migration importer for structured JSON export packages (see migration/README.md).
- JSON/CSV export endpoints and setup documentation.

NOT YET INCLUDED / REQUIRES FOLLOW-UP DEVELOPMENT
- Exact port of the full version 9 calling queue, FMCSA query filters and Excel workbook generator.
- Automatic extraction from each agent's Chrome OPFS. Each Chrome profile must export its own workspace first; browser security prevents a server from reading local extension storage remotely.
- RingCentral OAuth token exchange, server-side call-event webhooks and automatic call reconciliation. Embedded iframe sign-in is included, but full call event integration must be validated against your RingCentral app/account.
- SMS sending and consent workflows are stored as records/templates; production send integration must be configured and tested.
- Load test proving 20-50 simultaneous users on Stellar Plus. Shared hosting limits may require a VPS backend.

SECURITY
- HTTPS is mandatory.
- Never share Microsoft client secret or database password.
- Change CEO assignment only through trusted admin.
- Back up MySQL before migration/import.
- Do not use the app for production calling until RingCentral origin, OAuth, consent, DNC and call-event tests pass.

FRONTEND NOTE
This first upload-ready package uses dependency-free browser JavaScript for the interface rather than a compiled React bundle. This avoids requiring Node/npm build tooling on Stellar Plus and keeps the first deployment directly uploadable. The backend API and database are separated so a React/Vite frontend can replace the UI later without changing the core data model. This is a deliberate deployment simplification, not a claim that the current UI is React.
