Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

721 B
Raw Blame
export type MeetingRouteTarget =
  | { kind: 'new' }
  | { kind: 'setup' | 'active'; shareToken: string }
  | { kind: 'unavailable' };

export function parseMeetingRoute(pathname: string): MeetingRouteTarget {
  const path = pathname.replace(/^\/app(?=\/)/, '').replace(/\/$/, '');
  if (path === '/meet/new') return { kind: 'new' };
  const match = path.match(/^\/meet\/(join\/)?([^/]+)$/);
  if (!match || match[2] === 'join') return { kind: 'unavailable' };
  try {
    const shareToken = decodeURIComponent(match[2]);
    if (!shareToken || shareToken.includes('/')) return { kind: 'unavailable' };
    return { kind: match[1] ? 'setup' : 'active', shareToken };
  } catch {
    return { kind: 'unavailable' };
  }
}