@burdenoff/microfe-timecampus 2026.1030.2 → 2026.1030.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/generated/wspace-operations.d.ts +299 -0
  2. package/dist/generated/wspace-operations.d.ts.map +1 -1
  3. package/dist/generated/wspace-operations.js +1234 -1112
  4. package/dist/generated/wspace-operations.js.map +1 -1
  5. package/dist/generated/wspace-types.d.ts +2 -63
  6. package/dist/generated/wspace-types.d.ts.map +1 -1
  7. package/dist/generated/wspace-types.js +15 -8
  8. package/dist/generated/wspace-types.js.map +1 -1
  9. package/dist/index.js +7 -7
  10. package/dist/timecampus/TimeCampusRoot.d.ts.map +1 -1
  11. package/dist/timecampus/TimeCampusRoot.js +86 -78
  12. package/dist/timecampus/TimeCampusRoot.js.map +1 -1
  13. package/dist/timecampus/TimeCampusRoutes.d.ts.map +1 -1
  14. package/dist/timecampus/TimeCampusRoutes.js +15 -11
  15. package/dist/timecampus/TimeCampusRoutes.js.map +1 -1
  16. package/dist/timecampus/index.js +7 -7
  17. package/dist/timecampus/pages/channels/ChannelsPage.d.ts +2 -0
  18. package/dist/timecampus/pages/channels/ChannelsPage.d.ts.map +1 -0
  19. package/dist/timecampus/pages/channels/ChannelsPage.js +673 -0
  20. package/dist/timecampus/pages/channels/ChannelsPage.js.map +1 -0
  21. package/dist/timecampus/pages/channels/channelCatalog.d.ts +49 -0
  22. package/dist/timecampus/pages/channels/channelCatalog.d.ts.map +1 -0
  23. package/dist/timecampus/pages/channels/channelCatalog.js +125 -0
  24. package/dist/timecampus/pages/channels/channelCatalog.js.map +1 -0
  25. package/dist/types/external-enums.d.ts +17 -0
  26. package/dist/types/external-enums.d.ts.map +1 -0
  27. package/dist/types/external-enums.js +4 -0
  28. package/dist/types/external-enums.js.map +1 -0
  29. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChannelsPage.js","names":[],"sources":["../../../../src/timecampus/pages/channels/ChannelsPage.tsx"],"sourcesContent":["/**\n * Channels — the control plane for automatic capture (BOFF-4036).\n *\n * Lists the caller's capture channels (browser extension, desktop and mobile\n * apps, IDE plugin, CLI, calendar sync, API clients) with their status, last\n * sync and settings, and lets them connect, pause/resume, configure privacy and\n * retention, disconnect, purge captured data and remove a channel. Channels are\n * private to the person who connected them.\n */\nimport { useMemo, useState } from \"react\";\nimport {\n AppWindow,\n Calendar,\n Check,\n Code2,\n Copy,\n Globe,\n Pause,\n Play,\n Plug,\n PlugZap,\n Plus,\n Search,\n Settings2,\n Smartphone,\n Terminal,\n Trash2,\n Unplug,\n Webhook,\n Workflow,\n} from \"lucide-react\";\nimport type { ReactNode } from \"react\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport {\n PageLayout,\n StatCard,\n StatusBadge,\n EmptyState,\n LoadingSkeleton,\n Modal,\n ToastContainer,\n useToast,\n} from \"../../components\";\nimport { cn, formatRelativeTime } from \"../../utils/helpers\";\nimport { useTimeCampus } from \"../../providers/TimeCampusProvider\";\nimport {\n useMyTimeCampusCaptureChannelsQuery,\n useConnectTimeCampusCaptureChannelMutation,\n useUpdateTimeCampusCaptureChannelMutation,\n useDisconnectTimeCampusCaptureChannelMutation,\n usePurgeTimeCampusCaptureChannelEventsMutation,\n useDeleteTimeCampusCaptureChannelMutation,\n type CaptureChannelFieldsFragment,\n} from \"@/generated/wspace-operations\";\nimport {\n TimeCampusCaptureChannelPrivacyMode as PrivacyMode,\n TimeCampusCaptureChannelStatus as ChannelStatus,\n TimeCampusCaptureChannelType as ChannelType,\n} from \"@/generated/wspace-types\";\nimport {\n CHANNEL_CATALOG,\n CHANNEL_SETUP_HINT,\n PRIVACY_OPTIONS,\n catalogEntry,\n formatRetention,\n formatSyncInterval,\n isOverdue,\n matchesChannelSearch,\n parseOptionalPositiveInt,\n privacyLabel,\n statusDisplay,\n} from \"./channelCatalog\";\n\ntype Channel = CaptureChannelFieldsFragment;\n\nconst MAX_RETENTION_DAYS = 3650;\nconst MAX_SYNC_INTERVAL_MINUTES = 10080;\n\nconst inputClass =\n \"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus-visible:ring-2 focus-visible:ring-action-primary-bg/50\";\nconst secondaryButton =\n \"inline-flex items-center justify-center gap-1.5 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50 disabled:opacity-50\";\nconst primaryButton =\n \"inline-flex items-center justify-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50\";\nconst dangerButton =\n \"inline-flex items-center justify-center gap-1.5 rounded-md bg-status-error-bg px-3 py-2 text-sm font-medium text-status-error-text hover:bg-status-error-bg/80 disabled:opacity-50\";\n\nconst TYPE_ICONS: Record<ChannelType, ReactNode> = {\n [ChannelType.Browser]: <Globe className=\"h-5 w-5\" />,\n [ChannelType.Desktop]: <AppWindow className=\"h-5 w-5\" />,\n [ChannelType.Mobile]: <Smartphone className=\"h-5 w-5\" />,\n [ChannelType.Ide]: <Code2 className=\"h-5 w-5\" />,\n [ChannelType.Cli]: <Terminal className=\"h-5 w-5\" />,\n [ChannelType.Calendar]: <Calendar className=\"h-5 w-5\" />,\n [ChannelType.Api]: <Webhook className=\"h-5 w-5\" />,\n [ChannelType.Custom]: <Workflow className=\"h-5 w-5\" />,\n};\n\ninterface SettingsForm {\n name: string;\n privacyMode: PrivacyMode;\n retentionDays: string;\n syncIntervalMinutes: string;\n}\n\n/** Validate the shared settings fields; returns an error message or values. */\nfunction readSettings(form: SettingsForm):\n | { error: string }\n | {\n name: string;\n privacyMode: PrivacyMode;\n retentionDays: number | null;\n syncIntervalMinutes: number | null;\n } {\n const name = form.name.trim();\n if (!name || name.length > 120) {\n return { error: \"Give the channel a name of up to 120 characters.\" };\n }\n const retention = parseOptionalPositiveInt(\n form.retentionDays,\n MAX_RETENTION_DAYS,\n );\n if (!retention.ok) {\n return {\n error: `Retention must be a whole number of days between 1 and ${MAX_RETENTION_DAYS}, or empty to keep data.`,\n };\n }\n const interval = parseOptionalPositiveInt(\n form.syncIntervalMinutes,\n MAX_SYNC_INTERVAL_MINUTES,\n );\n if (!interval.ok) {\n return {\n error: `Sync interval must be a whole number of minutes between 1 and ${MAX_SYNC_INTERVAL_MINUTES}, or empty.`,\n };\n }\n return {\n name,\n privacyMode: form.privacyMode,\n retentionDays: retention.value,\n syncIntervalMinutes: interval.value,\n };\n}\n\nfunction SettingsFields({\n form,\n onChange,\n idPrefix,\n}: {\n form: SettingsForm;\n onChange: (next: SettingsForm) => void;\n idPrefix: string;\n}) {\n return (\n <div className=\"space-y-4\">\n <div>\n <label\n htmlFor={`${idPrefix}-name`}\n className=\"block text-sm font-medium text-text-primary\"\n >\n Name\n </label>\n <input\n id={`${idPrefix}-name`}\n type=\"text\"\n maxLength={120}\n value={form.name}\n onChange={(e) => onChange({ ...form, name: e.target.value })}\n className={inputClass}\n />\n </div>\n\n <fieldset>\n <legend className=\"block text-sm font-medium text-text-primary\">\n Privacy\n </legend>\n <div className=\"mt-2 space-y-2\">\n {PRIVACY_OPTIONS.map((option) => (\n <label\n key={option.value}\n className={cn(\n \"flex cursor-pointer items-start gap-3 rounded-lg border p-3\",\n form.privacyMode === option.value\n ? \"border-action-primary-bg bg-action-primary-bg/5\"\n : \"border-border-subtle\",\n )}\n >\n <input\n type=\"radio\"\n name={`${idPrefix}-privacy`}\n value={option.value}\n checked={form.privacyMode === option.value}\n onChange={() =>\n onChange({ ...form, privacyMode: option.value })\n }\n className=\"mt-1\"\n />\n <span>\n <span className=\"block text-sm font-medium text-text-primary\">\n {option.label}\n </span>\n <span className=\"block text-xs text-text-secondary\">\n {option.description}\n </span>\n </span>\n </label>\n ))}\n </div>\n </fieldset>\n\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label\n htmlFor={`${idPrefix}-retention`}\n className=\"block text-sm font-medium text-text-primary\"\n >\n Keep captured data for (days)\n </label>\n <input\n id={`${idPrefix}-retention`}\n type=\"text\"\n inputMode=\"numeric\"\n placeholder=\"Until I delete it\"\n value={form.retentionDays}\n onChange={(e) =>\n onChange({ ...form, retentionDays: e.target.value })\n }\n className={inputClass}\n />\n <p className=\"mt-1 text-xs text-text-secondary\">\n Older events from this channel are deleted automatically.\n </p>\n </div>\n <div>\n <label\n htmlFor={`${idPrefix}-interval`}\n className=\"block text-sm font-medium text-text-primary\"\n >\n Expected sync interval (minutes)\n </label>\n <input\n id={`${idPrefix}-interval`}\n type=\"text\"\n inputMode=\"numeric\"\n placeholder=\"On demand\"\n value={form.syncIntervalMinutes}\n onChange={(e) =>\n onChange({ ...form, syncIntervalMinutes: e.target.value })\n }\n className={inputClass}\n />\n <p className=\"mt-1 text-xs text-text-secondary\">\n Used to flag a source that has gone quiet.\n </p>\n </div>\n </div>\n </div>\n );\n}\n\nfunction settingsFromChannel(channel: Channel): SettingsForm {\n return {\n name: channel.name,\n privacyMode: channel.privacyMode,\n retentionDays:\n channel.retentionDays == null ? \"\" : String(channel.retentionDays),\n syncIntervalMinutes:\n channel.syncIntervalMinutes == null\n ? \"\"\n : String(channel.syncIntervalMinutes),\n };\n}\n\nfunction ChannelCard({\n channel,\n busy,\n onManage,\n onTogglePause,\n onResume,\n}: {\n channel: Channel;\n busy: boolean;\n onManage: () => void;\n onTogglePause: () => void;\n onResume: () => void;\n}) {\n const entry = catalogEntry(channel.type);\n const status = statusDisplay(channel.status);\n const overdue = isOverdue(\n channel.status,\n channel.lastSyncAt,\n channel.syncIntervalMinutes,\n );\n const disconnected = channel.status === ChannelStatus.Disconnected;\n\n return (\n <GlassCard\n treatment=\"glass\"\n className=\"flex flex-col p-4 sm:p-5\"\n data-testid=\"channel-card\"\n >\n <div className=\"flex items-start gap-3\">\n <div\n className={cn(\n \"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg\",\n disconnected\n ? \"bg-bg-sunken text-text-secondary\"\n : \"bg-action-primary-bg/10 text-primary\",\n )}\n >\n {TYPE_ICONS[channel.type]}\n </div>\n <div className=\"min-w-0 flex-1\">\n <h3 className=\"truncate text-base font-semibold text-text-primary\">\n {channel.name}\n </h3>\n <p className=\"truncate text-xs text-text-secondary\">\n {entry.label}\n {channel.provider ? ` · ${channel.provider}` : \"\"}\n </p>\n </div>\n </div>\n\n <div className=\"mt-3 flex flex-wrap items-center gap-2\">\n <StatusBadge label={status.label} variant={status.tone} dot />\n {overdue && <StatusBadge label=\"Sync overdue\" variant=\"warning\" />}\n <StatusBadge\n label={privacyLabel(channel.privacyMode)}\n variant=\"muted\"\n />\n </div>\n\n <dl className=\"mt-3 space-y-1 text-sm\">\n <div className=\"flex justify-between gap-3\">\n <dt className=\"text-text-secondary\">Last sync</dt>\n <dd className=\"text-right text-text-primary\">\n {channel.lastSyncAt\n ? formatRelativeTime(channel.lastSyncAt)\n : \"Never\"}\n </dd>\n </div>\n <div className=\"flex justify-between gap-3\">\n <dt className=\"text-text-secondary\">Interval</dt>\n <dd className=\"text-right text-text-primary\">\n {formatSyncInterval(channel.syncIntervalMinutes)}\n </dd>\n </div>\n <div className=\"flex justify-between gap-3\">\n <dt className=\"text-text-secondary\">Events captured</dt>\n <dd className=\"text-right text-text-primary\">\n {channel.totalEvents.toLocaleString()}\n </dd>\n </div>\n <div className=\"flex justify-between gap-3\">\n <dt className=\"text-text-secondary\">Retention</dt>\n <dd className=\"text-right text-text-primary\">\n {formatRetention(channel.retentionDays)}\n </dd>\n </div>\n </dl>\n\n <div className=\"mt-4 grid grid-cols-2 gap-2\">\n <button\n type=\"button\"\n className={secondaryButton}\n onClick={onManage}\n aria-label={`Manage ${channel.name}`}\n >\n <Settings2 className=\"h-4 w-4\" />\n Manage\n </button>\n {disconnected ? (\n <button\n type=\"button\"\n className={secondaryButton}\n onClick={onResume}\n disabled={busy}\n aria-label={`Reconnect ${channel.name}`}\n >\n <PlugZap className=\"h-4 w-4\" />\n Reconnect\n </button>\n ) : (\n <button\n type=\"button\"\n className={secondaryButton}\n onClick={onTogglePause}\n disabled={busy}\n aria-label={`${channel.status === ChannelStatus.Paused ? \"Resume\" : \"Pause\"} ${channel.name}`}\n >\n {channel.status === ChannelStatus.Paused ? (\n <>\n <Play className=\"h-4 w-4\" />\n Resume\n </>\n ) : (\n <>\n <Pause className=\"h-4 w-4\" />\n Pause\n </>\n )}\n </button>\n )}\n </div>\n </GlassCard>\n );\n}\n\nfunction ChannelIdBlock({ channelId }: { channelId: string }) {\n const [copied, setCopied] = useState(false);\n const copy = async () => {\n try {\n await navigator.clipboard.writeText(channelId);\n setCopied(true);\n window.setTimeout(() => setCopied(false), 2000);\n } catch {\n setCopied(false);\n }\n };\n return (\n <div>\n <p className=\"text-sm font-medium text-text-primary\">Channel ID</p>\n <div className=\"mt-1 flex items-center gap-2\">\n <code\n className=\"min-w-0 flex-1 truncate rounded-md border border-border-subtle bg-bg-sunken px-3 py-2 text-xs text-text-primary\"\n data-testid=\"channel-id\"\n >\n {channelId}\n </code>\n <button\n type=\"button\"\n className={secondaryButton}\n onClick={copy}\n aria-label=\"Copy channel ID\"\n >\n {copied ? (\n <Check className=\"h-4 w-4\" />\n ) : (\n <Copy className=\"h-4 w-4\" />\n )}\n {copied ? \"Copied\" : \"Copy\"}\n </button>\n </div>\n <p className=\"mt-2 text-xs text-text-secondary\">{CHANNEL_SETUP_HINT}</p>\n </div>\n );\n}\n\ntype Confirm =\n | { kind: \"disconnect\"; channel: Channel }\n | { kind: \"purge\"; channel: Channel }\n | { kind: \"remove\"; channel: Channel };\n\nexport function ChannelsPage() {\n const { workspaceId = \"\" } = useTimeCampus();\n const { toasts, addToast, dismissToast } = useToast();\n const [search, setSearch] = useState(\"\");\n\n const { data, loading, error, refetch } = useMyTimeCampusCaptureChannelsQuery(\n {\n variables: { includeDisconnected: true },\n skip: !workspaceId,\n fetchPolicy: \"cache-and-network\",\n },\n );\n\n const [connectChannel, { loading: connecting }] =\n useConnectTimeCampusCaptureChannelMutation();\n const [updateChannel, { loading: updating }] =\n useUpdateTimeCampusCaptureChannelMutation();\n const [disconnectChannel] = useDisconnectTimeCampusCaptureChannelMutation();\n const [purgeEvents] = usePurgeTimeCampusCaptureChannelEventsMutation();\n const [deleteChannel] = useDeleteTimeCampusCaptureChannelMutation();\n\n const [busyId, setBusyId] = useState<string | null>(null);\n\n // Connect flow: pick a type, then name + settings, then show the channel ID.\n const [connectOpen, setConnectOpen] = useState(false);\n const [connectType, setConnectType] = useState<ChannelType | null>(null);\n const [connectForm, setConnectForm] = useState<SettingsForm>({\n name: \"\",\n privacyMode: PrivacyMode.Full,\n retentionDays: \"\",\n syncIntervalMinutes: \"\",\n });\n const [connectError, setConnectError] = useState<string | null>(null);\n const [connected, setConnected] = useState<Channel | null>(null);\n\n // Manage flow.\n const [managing, setManaging] = useState<Channel | null>(null);\n const [manageForm, setManageForm] = useState<SettingsForm | null>(null);\n const [manageError, setManageError] = useState<string | null>(null);\n\n const [confirm, setConfirm] = useState<Confirm | null>(null);\n const [confirmBusy, setConfirmBusy] = useState(false);\n\n const channels: Channel[] = useMemo(\n () => data?.myTimeCampusCaptureChannels ?? [],\n [data],\n );\n const visible = useMemo(\n () => channels.filter((c) => matchesChannelSearch(c, search)),\n [channels, search],\n );\n const activeCount = channels.filter(\n (c) => c.status === ChannelStatus.Active,\n ).length;\n const totalEvents = channels.reduce((sum, c) => sum + c.totalEvents, 0);\n\n const pageProps = {\n title: \"Channels\",\n description: \"Manage and configure your connected capture sources\",\n purpose:\n \"Channels are the sources that feed your automatic timeline: the browser extension, desktop and mobile apps, editors, the command line, calendars and your own API clients. Connect a source here, then decide how much detail it may store, how long its data is kept, and pause or disconnect it at any time. Your channels are private to you.\",\n } as const;\n\n const openConnect = () => {\n setConnectType(null);\n setConnected(null);\n setConnectError(null);\n setConnectOpen(true);\n };\n\n const pickType = (type: ChannelType) => {\n setConnectType(type);\n setConnectForm({\n name: catalogEntry(type).defaultName,\n privacyMode: PrivacyMode.Full,\n retentionDays: \"\",\n syncIntervalMinutes: \"\",\n });\n setConnectError(null);\n };\n\n const closeConnect = () => {\n setConnectOpen(false);\n setConnectType(null);\n setConnected(null);\n };\n\n const submitConnect = async () => {\n if (!connectType) return;\n const values = readSettings(connectForm);\n if (\"error\" in values) {\n setConnectError(values.error);\n return;\n }\n setConnectError(null);\n try {\n const res = await connectChannel({\n variables: { input: { type: connectType, ...values } },\n });\n if (res.error) throw new Error(res.error.message);\n const created = res.data?.connectTimeCampusCaptureChannel;\n if (!created) throw new Error(\"No channel returned\");\n setConnected(created);\n await refetch();\n } catch (err) {\n setConnectError(\n err instanceof Error && err.message\n ? err.message\n : \"Couldn't connect this channel. Please try again.\",\n );\n }\n };\n\n const openManage = (channel: Channel) => {\n setManaging(channel);\n setManageForm(settingsFromChannel(channel));\n setManageError(null);\n };\n\n const closeManage = () => {\n setManaging(null);\n setManageForm(null);\n };\n\n const submitManage = async () => {\n if (!managing || !manageForm) return;\n const values = readSettings(manageForm);\n if (\"error\" in values) {\n setManageError(values.error);\n return;\n }\n setManageError(null);\n try {\n const res = await updateChannel({\n variables: { id: managing.id, input: values },\n });\n if (res.error) throw new Error(res.error.message);\n await refetch();\n addToast({ title: `${values.name} updated`, variant: \"success\" });\n closeManage();\n } catch (err) {\n setManageError(\n err instanceof Error && err.message\n ? err.message\n : \"Couldn't save these settings. Please try again.\",\n );\n }\n };\n\n const setStatus = async (channel: Channel, status: ChannelStatus) => {\n setBusyId(channel.id);\n try {\n const res = await updateChannel({\n variables: { id: channel.id, input: { status } },\n });\n if (res.error) throw new Error(res.error.message);\n await refetch();\n addToast({\n title:\n status === ChannelStatus.Paused\n ? `${channel.name} paused`\n : `${channel.name} is capturing again`,\n description:\n status === ChannelStatus.Paused\n ? \"Events it sends while paused are refused and never stored.\"\n : undefined,\n variant: \"success\",\n });\n } catch {\n addToast({\n title: \"Couldn't change this channel\",\n description: \"Nothing was changed. Please try again.\",\n variant: \"error\",\n });\n } finally {\n setBusyId(null);\n }\n };\n\n const runConfirm = async () => {\n if (!confirm) return;\n const { channel } = confirm;\n setConfirmBusy(true);\n try {\n if (confirm.kind === \"disconnect\") {\n const res = await disconnectChannel({ variables: { id: channel.id } });\n if (res.error) throw new Error(res.error.message);\n addToast({\n title: `${channel.name} disconnected`,\n description: \"Captured events are kept until you delete them.\",\n variant: \"success\",\n });\n } else if (confirm.kind === \"purge\") {\n const res = await purgeEvents({\n variables: { id: channel.id, confirm: true },\n });\n if (res.error) throw new Error(res.error.message);\n const purged =\n res.data?.purgeTimeCampusCaptureChannelEvents.purgedEvents ?? 0;\n addToast({\n title: `Deleted ${purged.toLocaleString()} captured ${purged === 1 ? \"event\" : \"events\"}`,\n variant: \"success\",\n });\n } else {\n const res = await deleteChannel({\n variables: { id: channel.id, confirm: true },\n });\n if (res.error) throw new Error(res.error.message);\n addToast({ title: `${channel.name} removed`, variant: \"success\" });\n }\n await refetch();\n setConfirm(null);\n closeManage();\n } catch {\n addToast({\n title: \"That didn't work\",\n description: \"Nothing was changed. Please try again.\",\n variant: \"error\",\n });\n } finally {\n setConfirmBusy(false);\n }\n };\n\n const connectButton = (\n <button type=\"button\" className={primaryButton} onClick={openConnect}>\n <Plus className=\"h-4 w-4\" />\n Connect channel\n </button>\n );\n\n const initialLoading = !workspaceId || (loading && !data);\n\n return (\n <PageLayout {...pageProps} actions={connectButton}>\n {initialLoading ? (\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4\">\n <LoadingSkeleton variant=\"card\" count={4} />\n </div>\n ) : error && !data ? (\n <div className=\"rounded-xl border border-status-error-border/50 bg-status-error-bg/10 p-4 text-sm text-status-error-text\">\n We couldn't load your channels right now. Please try again in a\n moment.\n </div>\n ) : (\n <div className=\"space-y-6\">\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <StatCard\n title=\"Channels\"\n value={channels.length}\n icon={<Plug className=\"h-5 w-5\" />}\n />\n <StatCard\n title=\"Capturing now\"\n value={activeCount}\n icon={<PlugZap className=\"h-5 w-5\" />}\n />\n <StatCard\n title=\"Events captured\"\n value={totalEvents.toLocaleString()}\n icon={<Workflow className=\"h-5 w-5\" />}\n />\n </div>\n\n {channels.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title=\"No channels connected yet\"\n description=\"Connect your first source — a browser, an editor, your calendar or an API client — and its activity will start assembling your timeline.\"\n action={connectButton}\n />\n ) : (\n <>\n <div className=\"relative max-w-md\">\n <Search className=\"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary\" />\n <input\n type=\"search\"\n aria-label=\"Search channels\"\n placeholder=\"Search channels...\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n className={cn(inputClass, \"mt-0 pl-9\")}\n />\n </div>\n {visible.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">\n No channels match \"{search}\".\n </p>\n ) : (\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4\">\n {visible.map((channel) => (\n <ChannelCard\n key={channel.id}\n channel={channel}\n busy={busyId === channel.id || updating}\n onManage={() => openManage(channel)}\n onTogglePause={() =>\n setStatus(\n channel,\n channel.status === ChannelStatus.Paused\n ? ChannelStatus.Active\n : ChannelStatus.Paused,\n )\n }\n onResume={() => setStatus(channel, ChannelStatus.Active)}\n />\n ))}\n </div>\n )}\n </>\n )}\n </div>\n )}\n\n {/* ── Connect ─────────────────────────────────────────────────────── */}\n <Modal\n open={connectOpen}\n onClose={closeConnect}\n title={\n connected\n ? \"Channel connected\"\n : connectType\n ? `Connect ${catalogEntry(connectType).label}`\n : \"Connect a channel\"\n }\n description={\n connected\n ? \"Your source can start sending activity to this channel.\"\n : connectType\n ? \"Choose how much this source may store and how long to keep it.\"\n : \"Pick the kind of source you want to capture from.\"\n }\n size=\"xl\"\n footer={\n connected ? (\n <button\n type=\"button\"\n className={primaryButton}\n onClick={closeConnect}\n >\n Done\n </button>\n ) : connectType ? (\n <>\n <button\n type=\"button\"\n className={secondaryButton}\n onClick={() => setConnectType(null)}\n >\n Back\n </button>\n <button\n type=\"button\"\n className={primaryButton}\n onClick={submitConnect}\n disabled={connecting}\n >\n {connecting ? \"Connecting...\" : \"Connect\"}\n </button>\n </>\n ) : (\n <button\n type=\"button\"\n className={secondaryButton}\n onClick={closeConnect}\n >\n Cancel\n </button>\n )\n }\n >\n {connected ? (\n <ChannelIdBlock channelId={connected.id} />\n ) : connectType ? (\n <>\n {connectError && (\n <div className=\"mb-4 rounded-lg border border-status-error-border/50 bg-status-error-bg/10 p-3 text-sm text-status-error-text\">\n {connectError}\n </div>\n )}\n <SettingsFields\n form={connectForm}\n onChange={setConnectForm}\n idPrefix=\"connect\"\n />\n </>\n ) : (\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n {CHANNEL_CATALOG.map((entry) => (\n <button\n key={entry.type}\n type=\"button\"\n onClick={() => pickType(entry.type)}\n className=\"flex items-start gap-3 rounded-lg border border-border-subtle p-3 text-left hover:bg-bg-sunken/50\"\n >\n <span className=\"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-action-primary-bg/10 text-primary\">\n {TYPE_ICONS[entry.type]}\n </span>\n <span className=\"min-w-0\">\n <span className=\"block text-sm font-medium text-text-primary\">\n {entry.label}\n </span>\n <span className=\"block text-xs text-text-secondary\">\n {entry.description}\n </span>\n </span>\n </button>\n ))}\n </div>\n )}\n </Modal>\n\n {/* ── Manage ──────────────────────────────────────────────────────── */}\n <Modal\n open={managing !== null && confirm === null}\n onClose={closeManage}\n title={managing ? `Manage ${managing.name}` : \"Manage channel\"}\n description={managing ? catalogEntry(managing.type).label : undefined}\n size=\"xl\"\n footer={\n <>\n <button\n type=\"button\"\n className={secondaryButton}\n onClick={closeManage}\n >\n Cancel\n </button>\n <button\n type=\"button\"\n className={primaryButton}\n onClick={submitManage}\n disabled={updating}\n >\n {updating ? \"Saving...\" : \"Save changes\"}\n </button>\n </>\n }\n >\n {managing && manageForm && (\n <div className=\"space-y-6\">\n {manageError && (\n <div className=\"rounded-lg border border-status-error-border/50 bg-status-error-bg/10 p-3 text-sm text-status-error-text\">\n {manageError}\n </div>\n )}\n <SettingsFields\n form={manageForm}\n onChange={setManageForm}\n idPrefix=\"manage\"\n />\n <ChannelIdBlock channelId={managing.id} />\n <div className=\"rounded-lg border border-status-error-border/40 p-4\">\n <p className=\"text-sm font-medium text-text-primary\">\n Disconnect or delete\n </p>\n <p className=\"mt-1 text-xs text-text-secondary\">\n Disconnecting stops capture but keeps what was captured.\n Deleting captured data and removing the channel cannot be\n undone.\n </p>\n <div className=\"mt-3 flex flex-wrap gap-2\">\n {managing.status !== ChannelStatus.Disconnected && (\n <button\n type=\"button\"\n className={secondaryButton}\n onClick={() =>\n setConfirm({ kind: \"disconnect\", channel: managing })\n }\n >\n <Unplug className=\"h-4 w-4\" />\n Disconnect\n </button>\n )}\n <button\n type=\"button\"\n className={secondaryButton}\n onClick={() =>\n setConfirm({ kind: \"purge\", channel: managing })\n }\n >\n <Trash2 className=\"h-4 w-4\" />\n Delete captured data\n </button>\n <button\n type=\"button\"\n className={dangerButton}\n onClick={() =>\n setConfirm({ kind: \"remove\", channel: managing })\n }\n >\n <Trash2 className=\"h-4 w-4\" />\n Remove channel\n </button>\n </div>\n </div>\n </div>\n )}\n </Modal>\n\n {/* ── Confirm ─────────────────────────────────────────────────────── */}\n <Modal\n open={confirm !== null}\n onClose={() => setConfirm(null)}\n title={\n confirm?.kind === \"disconnect\"\n ? \"Disconnect channel?\"\n : confirm?.kind === \"purge\"\n ? \"Delete captured data?\"\n : \"Remove channel?\"\n }\n footer={\n <>\n <button\n type=\"button\"\n className={secondaryButton}\n onClick={() => setConfirm(null)}\n >\n Cancel\n </button>\n <button\n type=\"button\"\n className={\n confirm?.kind === \"disconnect\" ? primaryButton : dangerButton\n }\n onClick={runConfirm}\n disabled={confirmBusy}\n >\n {confirmBusy\n ? \"Working...\"\n : confirm?.kind === \"disconnect\"\n ? \"Disconnect\"\n : confirm?.kind === \"purge\"\n ? \"Delete data\"\n : \"Remove\"}\n </button>\n </>\n }\n >\n <p className=\"text-sm text-text-secondary\">\n {confirm?.kind === \"disconnect\" &&\n `${confirm.channel.name} will stop capturing. Anything it sends is refused until you reconnect it. Captured events are kept.`}\n {confirm?.kind === \"purge\" &&\n `Every event captured by ${confirm.channel.name} will be permanently deleted from your timeline. This cannot be undone.`}\n {confirm?.kind === \"remove\" &&\n `${confirm.channel.name} will be removed and its ID refused from now on. Events it already captured stay on your timeline unless you delete them first.`}\n </p>\n </Modal>\n\n <ToastContainer toasts={toasts} onDismiss={dismissToast} />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2EA,IAAM,IAAqB,MACrB,IAA4B,OAE5B,IACJ,wNACI,IACJ,oLACI,IACJ,4LACI,KACJ,sLAEI,IAA6C;EAChD,EAAY,UAAU,kBAAC,GAAD,EAAO,WAAU,UAAW,CAAA;EAClD,EAAY,UAAU,kBAAC,GAAD,EAAW,WAAU,UAAW,CAAA;EACtD,EAAY,SAAS,kBAAC,GAAD,EAAY,WAAU,UAAW,CAAA;EACtD,EAAY,MAAM,kBAAC,IAAD,EAAO,WAAU,UAAW,CAAA;EAC9C,EAAY,MAAM,kBAAC,GAAD,EAAU,WAAU,UAAW,CAAA;EACjD,EAAY,WAAW,kBAAC,GAAD,EAAU,WAAU,UAAW,CAAA;EACtD,EAAY,MAAM,kBAAC,GAAD,EAAS,WAAU,UAAW,CAAA;EAChD,EAAY,SAAS,kBAAC,GAAD,EAAU,WAAU,UAAW,CAAA;AACvD;AAUA,SAAS,GAAa,GAOhB;CACJ,IAAM,IAAO,EAAK,KAAK,KAAK;CAC5B,IAAI,CAAC,KAAQ,EAAK,SAAS,KACzB,OAAO,EAAE,OAAO,mDAAmD;CAErE,IAAM,IAAY,EAChB,EAAK,eACL,CACF;CACA,IAAI,CAAC,EAAU,IACb,OAAO,EACL,OAAO,0DAA0D,EAAmB,0BACtF;CAEF,IAAM,IAAW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WACL,WAAW;WACX,eACE,EAAW;YAAE,MAAM;YAAS,SAAS;WAAS,CAAC;WAJnD,UAAA,CAOE,kBAAC,GAAD,EAAQ,WAAU,UAAW,CAAA,GAAC,sBAExB;;UACR,kBAAC,UAAD;WACE,MAAK;WACL,WAAW;WACX,eACE,EAAW;YAAE,MAAM;YAAU,SAAS;WAAS,CAAC;WAJpD,UAAA,CAOE,kBAAC,GAAD,EAAQ,WAAU,UAAW,CAAA,GAAC,gBAExB;;SACL;;OACF;;KACF;;GAEF,CAAA;GAGP,kBAAC,GAAD;IACE,MAAM,MAAY;IAClB,eAAe,EAAW,IAAI;IAC9B,OACE,GAAS,SAAS,eACd,wBACA,GAAS,SAAS,UAChB,0BACA;IAER,QACE,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,UAAD;KACE,MAAK;KACL,WAAW;KACX,eAAe,EAAW,IAAI;KAC/B,UAAA;IAEO,CAAA,GACR,kBAAC,UAAD;KACE,MAAK;KACL,WACE,GAAS,SAAS,eAAe,IAAgB;KAEnD,SAAS;KACT,UAAU;KAET,UAAA,KACG,eACA,GAAS,SAAS,eAChB,eACA,GAAS,SAAS,UAChB,gBACA;IACF,CAAA,CACR,EAAA,CAAA;IAGJ,UAAA,kBAAC,KAAD;KAAG,WAAU;KAAb,UAAA;MACG,GAAS,SAAS,gBACjB,GAAG,EAAQ,QAAQ,KAAK;MACzB,GAAS,SAAS,WACjB,2BAA2B,EAAQ,QAAQ,KAAK;MACjD,GAAS,SAAS,YACjB,GAAG,EAAQ,QAAQ,KAAK;KACzB;;GACE,CAAA;GAEP,kBAAC,IAAD;IAAwB;IAAQ,WAAW;GAAe,CAAA;EAChD;;AAEhB"}
@@ -0,0 +1,49 @@
1
+ import { TimeCampusCaptureChannelPrivacyMode as PrivacyMode, TimeCampusCaptureChannelStatus as ChannelStatus, TimeCampusCaptureChannelType as ChannelType } from '../../../generated/wspace-types';
2
+ export interface ChannelCatalogEntry {
3
+ type: ChannelType;
4
+ label: string;
5
+ description: string;
6
+ /** Name suggested when connecting a channel of this type. */
7
+ defaultName: string;
8
+ }
9
+ /**
10
+ * How a source is told which channel it is. Kept honest: the built-in
11
+ * TimeCampus clients do not ask for a channel ID yet, so this explains the
12
+ * API contract rather than pointing at settings screens that do not exist.
13
+ */
14
+ export declare const CHANNEL_SETUP_HINT: string;
15
+ export declare const CHANNEL_CATALOG: readonly ChannelCatalogEntry[];
16
+ export declare function catalogEntry(type: ChannelType): ChannelCatalogEntry;
17
+ export declare const PRIVACY_OPTIONS: readonly {
18
+ value: PrivacyMode;
19
+ label: string;
20
+ description: string;
21
+ }[];
22
+ export declare function privacyLabel(mode: PrivacyMode): string;
23
+ export type StatusTone = "success" | "warning" | "muted";
24
+ export declare function statusDisplay(status: ChannelStatus): {
25
+ label: string;
26
+ tone: StatusTone;
27
+ };
28
+ /** "Every 15 minutes", "Hourly", "Daily", or "On demand" when unset. */
29
+ export declare function formatSyncInterval(minutes: number | null | undefined): string;
30
+ export declare function formatRetention(days: number | null | undefined): string;
31
+ /**
32
+ * True when an ACTIVE channel has missed more than two of its declared sync
33
+ * intervals, so the user can see a source has gone quiet.
34
+ */
35
+ export declare function isOverdue(status: ChannelStatus, lastSyncAt: string | null | undefined, syncIntervalMinutes: number | null | undefined, now?: Date): boolean;
36
+ /** Parse an optional positive whole-number form field; "" → null. */
37
+ export declare function parseOptionalPositiveInt(raw: string, max: number): {
38
+ ok: true;
39
+ value: number | null;
40
+ } | {
41
+ ok: false;
42
+ };
43
+ /** Case-insensitive match on name, provider and the type's label. */
44
+ export declare function matchesChannelSearch(channel: {
45
+ name: string;
46
+ provider?: string | null;
47
+ type: ChannelType;
48
+ }, query: string): boolean;
49
+ //# sourceMappingURL=channelCatalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channelCatalog.d.ts","sourceRoot":"","sources":["../../../../src/timecampus/pages/channels/channelCatalog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,mCAAmC,IAAI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;AACrE,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAA;CAAE,CAOpD;AAED,qEAAqE;AACrE,wBAAgB,oBAAoB,CAClC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,EACtE,KAAK,EAAE,MAAM,GACZ,OAAO,CAWT"}
@@ -0,0 +1,125 @@
1
+ import { TimeCampusCaptureChannelPrivacyMode as e, TimeCampusCaptureChannelStatus as t, TimeCampusCaptureChannelType as n } from "../../../generated/wspace-types.js";
2
+ //#region src/timecampus/pages/channels/channelCatalog.ts
3
+ var r = "Sources send this ID as channelId when they push activity to TimeCampus (ingestTimeCampusCaptureEvents). Use it from the API, your own scripts or any client that lets you set a channel ID; events then follow this channel's status, privacy and retention settings.", i = [
4
+ {
5
+ type: n.Browser,
6
+ label: "Browser Extension",
7
+ description: "Active tabs and sites from Chrome, Edge or Firefox.",
8
+ defaultName: "Browser Extension"
9
+ },
10
+ {
11
+ type: n.Desktop,
12
+ label: "Desktop App",
13
+ description: "Foreground applications and windows on your computer.",
14
+ defaultName: "Desktop App"
15
+ },
16
+ {
17
+ type: n.Mobile,
18
+ label: "Mobile App",
19
+ description: "App usage captured by the TimeCampus mobile app.",
20
+ defaultName: "Mobile App"
21
+ },
22
+ {
23
+ type: n.Ide,
24
+ label: "IDE Plugin",
25
+ description: "Coding time from VS Code and other editors.",
26
+ defaultName: "IDE Plugin"
27
+ },
28
+ {
29
+ type: n.Cli,
30
+ label: "Command Line",
31
+ description: "Terminal sessions and commands via the TimeCampus CLI.",
32
+ defaultName: "Command Line"
33
+ },
34
+ {
35
+ type: n.Calendar,
36
+ label: "Calendar Sync",
37
+ description: "Meetings and events from your calendar.",
38
+ defaultName: "Calendar"
39
+ },
40
+ {
41
+ type: n.Api,
42
+ label: "API Client",
43
+ description: "Your own scripts or tools posting activity through the API.",
44
+ defaultName: "API Client"
45
+ },
46
+ {
47
+ type: n.Custom,
48
+ label: "Custom Source",
49
+ description: "Anything else that can describe how your time was spent.",
50
+ defaultName: "Custom Source"
51
+ }
52
+ ];
53
+ function a(e) {
54
+ return i.find((t) => t.type === e) ?? i[i.length - 1];
55
+ }
56
+ var o = [
57
+ {
58
+ value: e.Full,
59
+ label: "Full detail",
60
+ description: "Keep titles, URLs and details as the source sends them."
61
+ },
62
+ {
63
+ value: e.TitlesOnly,
64
+ label: "Titles only",
65
+ description: "Keep window and page titles; drop URLs and extra details."
66
+ },
67
+ {
68
+ value: e.AggregateOnly,
69
+ label: "Aggregate only",
70
+ description: "Keep only the app, category and timing. Titles and URLs never reach the server."
71
+ }
72
+ ];
73
+ function s(e) {
74
+ return o.find((t) => t.value === e)?.label ?? e;
75
+ }
76
+ function c(e) {
77
+ switch (e) {
78
+ case t.Active: return {
79
+ label: "Connected",
80
+ tone: "success"
81
+ };
82
+ case t.Paused: return {
83
+ label: "Paused",
84
+ tone: "warning"
85
+ };
86
+ default: return {
87
+ label: "Disconnected",
88
+ tone: "muted"
89
+ };
90
+ }
91
+ }
92
+ function l(e) {
93
+ return e == null ? "On demand" : e === 60 ? "Hourly" : e === 1440 ? "Daily" : e === 10080 ? "Weekly" : e % 1440 == 0 ? `Every ${e / 1440} days` : e % 60 == 0 ? `Every ${e / 60} hours` : e === 1 ? "Every minute" : `Every ${e} minutes`;
94
+ }
95
+ function u(e) {
96
+ return e == null ? "Kept until you delete it" : e === 1 ? "1 day" : `${e} days`;
97
+ }
98
+ function d(e, n, r, i = /* @__PURE__ */ new Date()) {
99
+ return e !== t.Active || !r || !n ? !1 : i.getTime() - new Date(n).getTime() > r * 2 * 6e4;
100
+ }
101
+ function f(e, t) {
102
+ let n = e.trim();
103
+ if (!n) return {
104
+ ok: !0,
105
+ value: null
106
+ };
107
+ if (!/^\d+$/.test(n)) return { ok: !1 };
108
+ let r = Number(n);
109
+ return r < 1 || r > t ? { ok: !1 } : {
110
+ ok: !0,
111
+ value: r
112
+ };
113
+ }
114
+ function p(e, t) {
115
+ let n = t.trim().toLowerCase();
116
+ return !n || [
117
+ e.name,
118
+ e.provider ?? "",
119
+ a(e.type).label
120
+ ].join(" ").toLowerCase().includes(n);
121
+ }
122
+ //#endregion
123
+ export { i as CHANNEL_CATALOG, r as CHANNEL_SETUP_HINT, o as PRIVACY_OPTIONS, a as catalogEntry, u as formatRetention, l as formatSyncInterval, d as isOverdue, p as matchesChannelSearch, f as parseOptionalPositiveInt, s as privacyLabel, c as statusDisplay };
124
+
125
+ //# sourceMappingURL=channelCatalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channelCatalog.js","names":[],"sources":["../../../../src/timecampus/pages/channels/channelCatalog.ts"],"sourcesContent":["/**\n * Capture-channel catalogue and display helpers (BOFF-4036).\n *\n * Pure functions only, so the page stays thin and this logic is unit-tested.\n */\nimport {\n TimeCampusCaptureChannelPrivacyMode as PrivacyMode,\n TimeCampusCaptureChannelStatus as ChannelStatus,\n TimeCampusCaptureChannelType as ChannelType,\n} from \"@/generated/wspace-types\";\n\nexport interface ChannelCatalogEntry {\n type: ChannelType;\n label: string;\n description: string;\n /** Name suggested when connecting a channel of this type. */\n defaultName: string;\n}\n\n/**\n * How a source is told which channel it is. Kept honest: the built-in\n * TimeCampus clients do not ask for a channel ID yet, so this explains the\n * API contract rather than pointing at settings screens that do not exist.\n */\nexport const CHANNEL_SETUP_HINT =\n \"Sources send this ID as channelId when they push activity to TimeCampus \" +\n \"(ingestTimeCampusCaptureEvents). Use it from the API, your own scripts or \" +\n \"any client that lets you set a channel ID; events then follow this \" +\n \"channel's status, privacy and retention settings.\";\n\nexport const CHANNEL_CATALOG: readonly ChannelCatalogEntry[] = [\n {\n type: ChannelType.Browser,\n label: \"Browser Extension\",\n description: \"Active tabs and sites from Chrome, Edge or Firefox.\",\n defaultName: \"Browser Extension\",\n },\n {\n type: ChannelType.Desktop,\n label: \"Desktop App\",\n description: \"Foreground applications and windows on your computer.\",\n defaultName: \"Desktop App\",\n },\n {\n type: ChannelType.Mobile,\n label: \"Mobile App\",\n description: \"App usage captured by the TimeCampus mobile app.\",\n defaultName: \"Mobile App\",\n },\n {\n type: ChannelType.Ide,\n label: \"IDE Plugin\",\n description: \"Coding time from VS Code and other editors.\",\n defaultName: \"IDE Plugin\",\n },\n {\n type: ChannelType.Cli,\n label: \"Command Line\",\n description: \"Terminal sessions and commands via the TimeCampus CLI.\",\n defaultName: \"Command Line\",\n },\n {\n type: ChannelType.Calendar,\n label: \"Calendar Sync\",\n description: \"Meetings and events from your calendar.\",\n defaultName: \"Calendar\",\n },\n {\n type: ChannelType.Api,\n label: \"API Client\",\n description: \"Your own scripts or tools posting activity through the API.\",\n defaultName: \"API Client\",\n },\n {\n type: ChannelType.Custom,\n label: \"Custom Source\",\n description: \"Anything else that can describe how your time was spent.\",\n defaultName: \"Custom Source\",\n },\n];\n\nexport function catalogEntry(type: ChannelType): ChannelCatalogEntry {\n return (\n CHANNEL_CATALOG.find((entry) => entry.type === type) ??\n CHANNEL_CATALOG[CHANNEL_CATALOG.length - 1]!\n );\n}\n\nexport const PRIVACY_OPTIONS: readonly {\n value: PrivacyMode;\n label: string;\n description: string;\n}[] = [\n {\n value: PrivacyMode.Full,\n label: \"Full detail\",\n description: \"Keep titles, URLs and details as the source sends them.\",\n },\n {\n value: PrivacyMode.TitlesOnly,\n label: \"Titles only\",\n description: \"Keep window and page titles; drop URLs and extra details.\",\n },\n {\n value: PrivacyMode.AggregateOnly,\n label: \"Aggregate only\",\n description:\n \"Keep only the app, category and timing. Titles and URLs never reach the server.\",\n },\n];\n\nexport function privacyLabel(mode: PrivacyMode): string {\n return PRIVACY_OPTIONS.find((o) => o.value === mode)?.label ?? mode;\n}\n\nexport type StatusTone = \"success\" | \"warning\" | \"muted\";\n\nexport function statusDisplay(status: ChannelStatus): {\n label: string;\n tone: StatusTone;\n} {\n switch (status) {\n case ChannelStatus.Active:\n return { label: \"Connected\", tone: \"success\" };\n case ChannelStatus.Paused:\n return { label: \"Paused\", tone: \"warning\" };\n default:\n return { label: \"Disconnected\", tone: \"muted\" };\n }\n}\n\n/** \"Every 15 minutes\", \"Hourly\", \"Daily\", or \"On demand\" when unset. */\nexport function formatSyncInterval(minutes: number | null | undefined): string {\n if (minutes == null) return \"On demand\";\n if (minutes === 60) return \"Hourly\";\n if (minutes === 1440) return \"Daily\";\n if (minutes === 10080) return \"Weekly\";\n if (minutes % 1440 === 0) return `Every ${minutes / 1440} days`;\n if (minutes % 60 === 0) return `Every ${minutes / 60} hours`;\n return minutes === 1 ? \"Every minute\" : `Every ${minutes} minutes`;\n}\n\nexport function formatRetention(days: number | null | undefined): string {\n if (days == null) return \"Kept until you delete it\";\n if (days === 1) return \"1 day\";\n return `${days} days`;\n}\n\n/**\n * True when an ACTIVE channel has missed more than two of its declared sync\n * intervals, so the user can see a source has gone quiet.\n */\nexport function isOverdue(\n status: ChannelStatus,\n lastSyncAt: string | null | undefined,\n syncIntervalMinutes: number | null | undefined,\n now: Date = new Date(),\n): boolean {\n if (status !== ChannelStatus.Active || !syncIntervalMinutes || !lastSyncAt) {\n return false;\n }\n const elapsedMs = now.getTime() - new Date(lastSyncAt).getTime();\n return elapsedMs > syncIntervalMinutes * 2 * 60_000;\n}\n\n/** Parse an optional positive whole-number form field; \"\" → null. */\nexport function parseOptionalPositiveInt(\n raw: string,\n max: number,\n): { ok: true; value: number | null } | { ok: false } {\n const trimmed = raw.trim();\n if (!trimmed) return { ok: true, value: null };\n if (!/^\\d+$/.test(trimmed)) return { ok: false };\n const value = Number(trimmed);\n if (value < 1 || value > max) return { ok: false };\n return { ok: true, value };\n}\n\n/** Case-insensitive match on name, provider and the type's label. */\nexport function matchesChannelSearch(\n channel: { name: string; provider?: string | null; type: ChannelType },\n query: string,\n): boolean {\n const q = query.trim().toLowerCase();\n if (!q) return true;\n return [\n channel.name,\n channel.provider ?? \"\",\n catalogEntry(channel.type).label,\n ]\n .join(\" \")\n .toLowerCase()\n .includes(q);\n}\n"],"mappings":";;AAwBA,IAAa,IACX,0QAKW,IAAkD;CAC7D;EACE,MAAM,EAAY;EAClB,OAAO;EACP,aAAa;EACb,aAAa;CACf;CACA;EACE,MAAM,EAAY;EAClB,OAAO;EACP,aAAa;EACb,aAAa;CACf;CACA;EACE,MAAM,EAAY;EAClB,OAAO;EACP,aAAa;EACb,aAAa;CACf;CACA;EACE,MAAM,EAAY;EAClB,OAAO;EACP,aAAa;EACb,aAAa;CACf;CACA;EACE,MAAM,EAAY;EAClB,OAAO;EACP,aAAa;EACb,aAAa;CACf;CACA;EACE,MAAM,EAAY;EAClB,OAAO;EACP,aAAa;EACb,aAAa;CACf;CACA;EACE,MAAM,EAAY;EAClB,OAAO;EACP,aAAa;EACb,aAAa;CACf;CACA;EACE,MAAM,EAAY;EAClB,OAAO;EACP,aAAa;EACb,aAAa;CACf;AACF;AAEA,SAAgB,EAAa,GAAwC;CACnE,OACE,EAAgB,MAAM,MAAU,EAAM,SAAS,CAAI,KACnD,EAAgB,EAAgB,SAAS;AAE7C;AAEA,IAAa,IAIP;CACJ;EACE,OAAO,EAAY;EACnB,OAAO;EACP,aAAa;CACf;CACA;EACE,OAAO,EAAY;EACnB,OAAO;EACP,aAAa;CACf;CACA;EACE,OAAO,EAAY;EACnB,OAAO;EACP,aACE;CACJ;AACF;AAEA,SAAgB,EAAa,GAA2B;CACtD,OAAO,EAAgB,MAAM,MAAM,EAAE,UAAU,CAAI,CAAC,EAAE,SAAS;AACjE;AAIA,SAAgB,EAAc,GAG5B;CACA,QAAQ,GAAR;EACE,KAAK,EAAc,QACjB,OAAO;GAAE,OAAO;GAAa,MAAM;EAAU;EAC/C,KAAK,EAAc,QACjB,OAAO;GAAE,OAAO;GAAU,MAAM;EAAU;EAC5C,S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c.yml).
4
+ *
5
+ * BigConsoleWidgetType (owned by wspace-bigconsole-svc) has two values that
6
+ * differ only in case, `MAP` and `map`. graphql-codegen PascalCases enum
7
+ * member names, so it would emit `Map` twice, which esbuild/Vite reject
8
+ * ("The symbol \"Map\" has already been declared") and which fails every test
9
+ * and build in this package. TimeCampus never reads or writes BigConsole
10
+ * widgets, so the enum is exposed as its raw wire value.
11
+ *
12
+ * The generated types module re-exports this name, so it needs a runtime
13
+ * binding as well as a type; the binding is an empty, frozen lookup.
14
+ */
15
+ export type BigConsoleWidgetType = string;
16
+ export declare const BigConsoleWidgetType: Readonly<Record<string, string>>;
17
+ //# sourceMappingURL=external-enums.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-enums.d.ts","sourceRoot":"","sources":["../../src/types/external-enums.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAC1C,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAC/C,CAAC"}
@@ -0,0 +1,4 @@
1
+ Object.freeze({});
2
+ //#endregion
3
+
4
+ //# sourceMappingURL=external-enums.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-enums.js","names":[],"sources":["../../src/types/external-enums.ts"],"sourcesContent":["/**\n * Enums the GraphQL codegen takes from here instead of generating\n * (`enumValues` in .graphqlrc.yml).\n *\n * BigConsoleWidgetType (owned by wspace-bigconsole-svc) has two values that\n * differ only in case, `MAP` and `map`. graphql-codegen PascalCases enum\n * member names, so it would emit `Map` twice, which esbuild/Vite reject\n * (\"The symbol \\\"Map\\\" has already been declared\") and which fails every test\n * and build in this package. TimeCampus never reads or writes BigConsole\n * widgets, so the enum is exposed as its raw wire value.\n *\n * The generated types module re-exports this name, so it needs a runtime\n * binding as well as a type; the binding is an empty, frozen lookup.\n */\nexport type BigConsoleWidgetType = string;\nexport const BigConsoleWidgetType: Readonly<Record<string, string>> =\n Object.freeze({});\n"],"mappings":"AAgBE,OAAO,OAAO,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-timecampus",
3
- "version": "2026.1030.2",
3
+ "version": "2026.1030.3",
4
4
  "description": "Burdenoff TimeCampus Microfrontend - AI-powered time management and productivity platform",
5
5
  "type": "module",
6
6
  "files": [