Files
2026-07-08 16:15:37 +02:00

41 lines
1.6 KiB
TypeScript

// VA-P23 · pure client-safe route-path builders for the email-inbox module.
// Loaders build these and pass them into the VMs so the VMs stay routing-agnostic
// (mirrors calendarRoutePaths). Unlike calendar, the email inbox has its OWN
// plan-gated feature key (`email-inbox` in packages/entitlements) — the ticket
// names the connector gate tenantHasModule('email_inbox'); the canonical key is
// kebab-case per repo convention (documented deviation, VA-P23).
export const EMAIL_INBOX_MODULE_KEY = "email-inbox";
/** The inbox list. */
export function emailInboxPath(tenantSlug: string): string {
return `/${tenantSlug}/emails`;
}
/** A single message's thread detail. */
export function emailMessagePath(tenantSlug: string, messageId: string): string {
return `/${tenantSlug}/emails/${messageId}`;
}
/** The compose surface (new mail / reply / forward via query params). */
export function emailComposePath(tenantSlug: string): string {
return `/${tenantSlug}/emails/new`;
}
/** The mailbox connect settings. */
export function emailSettingsPath(tenantSlug: string): string {
return `/${tenantSlug}/settings/integrations/email`;
}
/**
* The OAuth callback URIs. NOT tenant-scoped (providers redirect to fixed URIs);
* the signed `state` carries the tenant + user + provider.
*/
export const GMAIL_OAUTH_CALLBACK_PATH = "/integrations/email/google/oauth/callback";
export const MICROSOFT_OAUTH_CALLBACK_PATH = "/integrations/email/microsoft/oauth/callback";
/** 404 helper (Bauprinzip A.5.3 — permission/owner miss renders 404, not 403). */
export function notFoundResponse(): Response {
return new Response("Not Found", { status: 404 });
}