feat(web): ask before sending analytics, drop team screens, hide v1-absent memory features (P1.3a)
- Analytics are opt-in (decision Q7, ADR-0006). PostHog does not start or capture anything until the user clicks Allow in a first-run dialog that says what is sent. Escape or closing stores nothing and asks again. The existing Privacy & Telemetry toggle in Settings withdraws consent at once. Builds without VITE_POSTHOG_KEY show no dialog and send nothing. - Remove the remaining upsell copy: the /team page with its per-seat price, Stripe and Teams wording in the erase-data dialog, Teams/Enterprise hints. - Remove team screens (decision Q3): Waggle Dance, team presence in chat, team storage and sharing in workspace creation, storage and files. - Hide memory features that are not in v1 (decision Q2) behind one map in lib/memory-features.ts: the knowledge graph, import history, wiki, agent memory hooks and Room launches. The map is the seam P1.5 fills from the memory store's capabilities. - Say Windows, macOS and Linux instead of "Linux soon". - Update the e2e specs for the removed and hidden screens. Also logs UF-029: the Settings "Import Data" button has no handler.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
import { lazy, Suspense, useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react';
|
||||
import { AnimatePresence } from 'framer-motion';
|
||||
import { Navigate, useLocation, useNavigate } from 'react-router-dom';
|
||||
import { Home, MessageSquare, Brain, ListTodo, Library, Network, Plug, Shield } from 'lucide-react';
|
||||
import { Home, MessageSquare, Brain, ListTodo, Library, Plug, Shield } from 'lucide-react';
|
||||
import wallpaperDark from '@/assets/wallpaper.jpg';
|
||||
import wallpaperLight from '@/assets/wallpaper-light.jpg';
|
||||
import BootScreen from './BootScreen';
|
||||
@@ -28,6 +28,7 @@ import { stashDeepLink } from '@/lib/app-deeplink';
|
||||
import { writeLoginBriefingDismissed, writeLoginBriefingLastDismissedAt, readLoginBriefingDismissed, readSkipBriefingParam } from '@/lib/login-briefing';
|
||||
import { prefetchBriefing, computeAwayDays, BRIEFING_ABSENCE_DAYS } from '@/lib/briefing-source';
|
||||
import { homeCacheExists } from '@/lib/home-cache';
|
||||
import { shouldAskAnalyticsConsent } from '@/lib/analytics-consent';
|
||||
import { resolveReturningUserOnboarding, isOnboardingStatusKnownSync } from '@/hooks/useOnboarding';
|
||||
import { shouldShowCoachMarks, readOnboardedThisSession, readForceTour, clearForceTour } from '@/lib/coach-marks-gate';
|
||||
import { matchNavRoute, queryString, routeFor, routeForSearchResult } from '@/lib/routes';
|
||||
@@ -37,7 +38,6 @@ import { buildCommandCatalog, type CatalogCommand } from '@/lib/command-catalog'
|
||||
import { ShellProvider, useShell } from '@/providers/ShellContext';
|
||||
import { seedChat, useChatWidgetState } from '@/hooks/useChatWidgetState';
|
||||
import { useKeyboardShortcuts } from '@/hooks/useKeyboardShortcuts';
|
||||
import { useWaggleDance } from '@/hooks/useWaggleDance';
|
||||
import { useBumpSessionCount } from '@/hooks/useDockLabels';
|
||||
import { useDockNudge } from '@/hooks/useDockNudge';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
@@ -56,6 +56,7 @@ const OnboardingWizard = lazy(() => import('./overlays/OnboardingWizard'));
|
||||
const OnboardingTooltips = lazy(() => import('./overlays/OnboardingTooltips'));
|
||||
const LoginBriefing = lazy(() => import('./overlays/LoginBriefing'));
|
||||
const ContextRail = lazy(() => import('./overlays/ContextRail'));
|
||||
const AnalyticsConsentDialog = lazy(() => import('./overlays/AnalyticsConsentDialog'));
|
||||
|
||||
const deferredShellElement = (element: ReactNode) => (
|
||||
<Suspense fallback={null}>{element}</Suspense>
|
||||
@@ -129,12 +130,10 @@ const ShellLayout = () => {
|
||||
contextRailTarget, setContextRailTarget,
|
||||
} = useShell();
|
||||
|
||||
const { allSignals: waggleSignals } = useWaggleDance();
|
||||
const overlaysRef = useRef(ov);
|
||||
useEffect(() => {
|
||||
overlaysRef.current = ov;
|
||||
}, [ov]);
|
||||
const waggleUnacknowledged = waggleSignals.filter(s => !s.acknowledged).length;
|
||||
// W2A: no implicit workspaces[0] fallback — the chrome shows a workspace only
|
||||
// when one was explicitly selected. Sidebar/StatusBar accept null names; the
|
||||
// Chat spine item opens the WorkspaceSwitcher when there is no real selection.
|
||||
@@ -189,6 +188,9 @@ const ShellLayout = () => {
|
||||
const { entry: activeChatEntry, setPersona: setActiveChatPersona } =
|
||||
useChatWidgetState(effectiveActiveWorkspaceId ?? 'local-default');
|
||||
|
||||
// ADR-0006: ask about analytics once per launch until the user chooses.
|
||||
const [askAnalyticsConsent, setAskAnalyticsConsent] = useState(shouldAskAnalyticsConsent);
|
||||
|
||||
// User display name for the sidebar user row (PR1 LOW #2). Best-effort via the
|
||||
// existing identity surface; re-fetched on connect-settle because the first
|
||||
// call can race the session-token attach and 401 → name:null. Falls back to
|
||||
@@ -372,9 +374,7 @@ const ShellLayout = () => {
|
||||
const briefingAwayDays = useMemo(() => computeAwayDays(workspaces), [workspaces]);
|
||||
|
||||
// Five-place spine + a power-tier "Pinned" group. Chat resolves to the active
|
||||
// workspace's chat tab (routeFor falls back to /home with no workspace). The
|
||||
// Agents & tasks badge surfaces unacknowledged coordination signals for now;
|
||||
// PR3 refines it to the real pending-approvals/tasks count.
|
||||
// workspace's chat tab (routeFor falls back to /home with no workspace).
|
||||
const isPro = currentTier === 'power' || currentTier === 'admin';
|
||||
const spine: SidebarNavItem[] = useMemo(() => [
|
||||
{ key: 'home', label: 'Home', icon: Home, to: '/home', match: ['/home'] },
|
||||
@@ -392,13 +392,12 @@ const ShellLayout = () => {
|
||||
onClick: navigateToActiveChat,
|
||||
},
|
||||
{ key: 'memory', label: 'Memory', icon: Brain, to: '/memory', match: ['/memory'] },
|
||||
{ key: 'agents', label: 'Agents', icon: ListTodo, to: '/agents', match: ['/agents', '/automations'], badge: waggleUnacknowledged || undefined },
|
||||
{ key: 'agents', label: 'Agents', icon: ListTodo, to: '/agents', match: ['/agents', '/automations'] },
|
||||
{ key: 'library', label: 'Library', icon: Library, to: '/artifacts', match: ['/artifacts', '/files', '/skills'] },
|
||||
], [effectiveActiveWorkspaceId, navigateToActiveChat, waggleUnacknowledged]);
|
||||
], [effectiveActiveWorkspaceId, navigateToActiveChat]);
|
||||
const pinned: SidebarNavItem[] = useMemo(() => {
|
||||
if (!isPro) return [];
|
||||
return [
|
||||
{ key: 'swarm', label: 'Agent swarm', icon: Network, to: '/waggle-dance', match: ['/waggle-dance'] },
|
||||
{ key: 'connectors', label: 'Connectors', icon: Plug, to: '/connectors', match: ['/connectors'] },
|
||||
{ key: 'approvals', label: 'Approvals', icon: Shield, to: '/approvals', match: ['/approvals'] },
|
||||
];
|
||||
@@ -417,11 +416,21 @@ const ShellLayout = () => {
|
||||
}
|
||||
}, [navigate, ov]);
|
||||
|
||||
// ADR-0006: the analytics question (only when the build has a PostHog key and
|
||||
// the user has not chosen yet). On first launch it comes BEFORE the wizard
|
||||
// mounts: the wizard maps a window-level Escape to Skip, so the two must not
|
||||
// be open together, and asking first lets the one PostHog event
|
||||
// (onboarding_complete) be sent if the user allows it.
|
||||
const analyticsConsentDialog = askAnalyticsConsent && deferredShellElement(
|
||||
<AnalyticsConsentDialog onClose={() => setAskAnalyticsConsent(false)} />
|
||||
);
|
||||
|
||||
// FR #33: when the onboarding wizard is active, render ONLY the wizard —
|
||||
// no nav, no canvas, no overlays (§1.2 OnboardingWizard row: full-screen
|
||||
// takeover at the layout level, any URL). Hooks above keep running so
|
||||
// completion re-renders with workspaces/personas already populated.
|
||||
if (!onboardingState.completed) {
|
||||
if (analyticsConsentDialog) return analyticsConsentDialog;
|
||||
return deferredShellElement(
|
||||
<OnboardingWizard
|
||||
serverBaseUrl={adapter.getServerUrl()}
|
||||
@@ -439,7 +448,7 @@ const ShellLayout = () => {
|
||||
const anyModalOpen =
|
||||
ov.showGlobalSearch || ov.showCreateWorkspace || ov.showPersonaSwitcher ||
|
||||
ov.showWorkspaceSwitcher || ov.showNotifications || ov.showKeyboardHelp ||
|
||||
ov.showSpawnAgent;
|
||||
ov.showSpawnAgent || askAnalyticsConsent;
|
||||
|
||||
return (
|
||||
<div className="relative w-screen h-screen overflow-hidden select-none">
|
||||
@@ -574,7 +583,7 @@ const ShellLayout = () => {
|
||||
Lane H item 4: additionally require a ≥7-day absence — otherwise the home
|
||||
hero's recall strip is the catch-up, and this modal stays closed. */}
|
||||
{onboardingState.completed && onboardingState.tooltipsDismissed && ov.showLoginBriefing
|
||||
&& briefingLanding === 'armed' && location.pathname.startsWith('/home') && !offline
|
||||
&& !askAnalyticsConsent && briefingLanding === 'armed' && location.pathname.startsWith('/home') && !offline
|
||||
&& briefingAwayDays >= BRIEFING_ABSENCE_DAYS && (
|
||||
deferredShellElement(
|
||||
<LoginBriefing
|
||||
@@ -593,6 +602,7 @@ const ShellLayout = () => {
|
||||
{contextRailTarget && deferredShellElement(
|
||||
<ContextRail target={contextRailTarget} onClose={() => setContextRailTarget(null)} />
|
||||
)}
|
||||
{analyticsConsentDialog}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user