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:
shumeiko.it
2026-10-23 14:51:29 +02:00
parent 0325c4eb11
commit f3eb6b6652
66 changed files with 934 additions and 1126 deletions

View File

@@ -0,0 +1,83 @@
/**
* AnalyticsConsentDialog — the first-run analytics question (ADR-0006).
*
* AppShell mounts it only when the build carries a PostHog key and the user
* has not chosen yet (`shouldAskAnalyticsConsent`). "Allow" and "Don't allow"
* store the choice. Escape closes the dialog without storing anything: nothing
* is sent, and the question comes back on the next launch.
*
* The list of what is sent mirrors the events in `@/lib/posthog`.
*/
import { BarChart3 } from 'lucide-react';
import { adapter } from '@/lib/adapter';
import { setAnalyticsConsent, type AnalyticsConsent } from '@/lib/analytics-consent';
import { useFocusTrap } from '@/hooks/useFocusTrap';
interface AnalyticsConsentDialogProps {
/** Called after a choice is made or the dialog is dismissed. */
onClose: () => void;
}
const buttonClass =
'px-4 py-2 rounded-xl border border-border/50 bg-secondary/40 text-sm font-display font-semibold text-foreground hover:bg-secondary/70 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60';
export default function AnalyticsConsentDialog({ onClose }: AnalyticsConsentDialogProps) {
const dialogRef = useFocusTrap<HTMLDivElement>(true, onClose);
const choose = (choice: AnalyticsConsent) => {
void setAnalyticsConsent(choice);
// The Settings toggle drives the local usage log and PostHog together;
// keep the local log in step with this first answer.
void adapter.toggleTelemetry(choice === 'granted').catch(() => {});
onClose();
};
return (
<div className="fixed inset-0 z-[220] flex items-center justify-center p-4">
<div className="absolute inset-0 bg-black/60 backdrop-blur-sm" aria-hidden="true" />
<div
ref={dialogRef}
role="dialog"
aria-modal="true"
aria-labelledby="analytics-consent-title"
aria-describedby="analytics-consent-description"
tabIndex={-1}
className="relative w-full max-w-md glass-strong rounded-2xl shadow-2xl p-6 space-y-4 focus:outline-none"
data-testid="analytics-consent-dialog"
>
<div className="flex items-center gap-3">
<div className="p-2 rounded-xl bg-primary/10">
<BarChart3 className="w-5 h-5 text-honey" aria-hidden="true" />
</div>
<h2 id="analytics-consent-title" className="text-lg font-display font-bold text-foreground">
Share anonymous usage analytics?
</h2>
</div>
<div id="analytics-consent-description" className="space-y-2 text-xs text-muted-foreground leading-relaxed">
<p>
Waggle can send a small amount of usage data to PostHog to help improve the app.
Nothing is sent unless you choose Allow.
</p>
<p className="text-foreground font-medium">What is sent:</p>
<ul className="list-disc pl-4 space-y-1">
<li>One event when you finish onboarding, with the template, persona and model you chose.</li>
<li>A random ID for this install and the browser details PostHog adds, such as browser, operating system and screen size.</li>
</ul>
<p>Your chats, files and memories are never sent.</p>
<p>You can change this later in Settings, under Privacy &amp; Telemetry.</p>
</div>
<div className="flex items-center justify-end gap-3 pt-1">
<button type="button" onClick={() => choose('denied')} className={buttonClass}>
Don't allow
</button>
<button type="button" onClick={() => choose('granted')} className={buttonClass}>
Allow
</button>
</div>
</div>
</div>
);
}

View File

@@ -1,6 +1,6 @@
import { useState, useCallback, useEffect, useRef } from 'react';
import {
X, Plus, Users, Cloud, HardDrive, Server, FolderOpen, Folder,
X, Plus, Users, Cloud, HardDrive, FolderOpen, Folder,
FolderPlus, ChevronRight, Home, Check, Loader2, LayoutTemplate,
Sparkles, Info, Wand2, Target, Microscope, Code, Megaphone,
Rocket, Scale, Building, FileText, Laptop, PenLine, BarChart3,
@@ -43,7 +43,7 @@ interface CreateWorkspaceDialogProps {
open: boolean;
onClose: () => void;
onCreate: (data: {
name: string; group: string; persona?: string; agentGroupId?: string; shared?: boolean;
name: string; group: string; persona?: string; agentGroupId?: string;
storageType?: StorageType; storagePath?: string; templateId?: string;
}) => void;
}
@@ -54,7 +54,6 @@ const GROUPS = [...STANDARD_GROUPS];
const STORAGE_OPTIONS: { type: StorageType; label: string; desc: string; icon: React.ElementType; color: string }[] = [
{ type: 'virtual', label: 'Virtual', desc: 'Server-managed storage', icon: Cloud, color: 'text-violet-400' },
{ type: 'local', label: 'Local', desc: 'Local disk directory', icon: HardDrive, color: 'text-emerald-400' },
{ type: 'team', label: 'Team', desc: 'Remote S3/MinIO storage', icon: Server, color: 'text-sky-400' },
];
/** Icon map for known template IDs */
@@ -730,7 +729,6 @@ const CreateWorkspaceDialog = ({ open, onClose, onCreate }: CreateWorkspaceDialo
const [name, setName] = useState('');
const [group, setGroup] = useState('Personal');
const [selectedPersona, setSelectedPersona] = useState<string | undefined>();
const [shared, setShared] = useState(false);
const [storageType, setStorageType] = useState<StorageType>('virtual');
const [storagePath, setStoragePath] = useState('');
const [showFolderPicker, setShowFolderPicker] = useState(false);
@@ -801,11 +799,10 @@ const CreateWorkspaceDialog = ({ open, onClose, onCreate }: CreateWorkspaceDialo
name: name.trim(), group,
persona: agentMode === 'single' ? selectedPersona : undefined,
agentGroupId: agentMode === 'group' ? selectedGroupId : undefined,
shared,
storageType, storagePath: storagePath.trim() || undefined,
templateId: selectedTemplate || undefined,
});
setName(''); setGroup('Personal'); setSelectedPersona(undefined); setShared(false);
setName(''); setGroup('Personal'); setSelectedPersona(undefined);
setStorageType('virtual'); setStoragePath(''); setSelectedTemplate(null);
setShowTemplateOptions(false); setTemplateSearch(''); setCategoryFilter('all'); setShowAgentOptions(false);
setAgentMode('single'); setSelectedGroupId(undefined);
@@ -1105,7 +1102,7 @@ const CreateWorkspaceDialog = ({ open, onClose, onCreate }: CreateWorkspaceDialo
{/* ── Storage Type ── */}
<div>
<label className="text-xs text-muted-foreground block mb-1.5">Storage Type</label>
<div className="grid grid-cols-3 gap-2">
<div className="grid grid-cols-2 gap-2">
{STORAGE_OPTIONS.map(opt => (
<button key={opt.type} onClick={() => setStorageType(opt.type)}
className={`flex flex-col items-center gap-1 p-3 rounded-xl transition-colors ${
@@ -1156,7 +1153,6 @@ const CreateWorkspaceDialog = ({ open, onClose, onCreate }: CreateWorkspaceDialo
<p className="text-[11px] text-muted-foreground/60 mt-1">
{storageType === 'virtual' && 'Managed automatically — files stored in server-managed storage.'}
{storageType === 'local' && 'Select or type the local directory where workspace files will be stored.'}
{storageType === 'team' && 'Browse or type the S3/MinIO bucket and prefix for shared storage.'}
</p>
</div>
@@ -1267,22 +1263,6 @@ const CreateWorkspaceDialog = ({ open, onClose, onCreate }: CreateWorkspaceDialo
</div>}
</div>
{/* Share toggle */}
<div className="flex items-center justify-between mx-6 mb-3 p-3 rounded-xl bg-secondary/30 border border-border/30">
<div className="flex items-center gap-2">
<Users className="w-4 h-4 text-sky-400" />
<div>
<p className="text-xs font-display text-foreground">Share with team</p>
<p className="text-[11px] text-muted-foreground">Make visible to all team members</p>
</div>
</div>
<button type="button" onClick={() => setShared(!shared)}
aria-label={shared ? 'Stop sharing workspace with team' : 'Share workspace with team'}
className={`w-10 h-5 rounded-full transition-colors ${shared ? 'bg-sky-500' : 'bg-muted'}`}>
<div className={`w-4 h-4 rounded-full bg-foreground transition-transform mx-0.5 ${shared ? 'translate-x-5' : ''}`} />
</button>
</div>
<div className="flex justify-end gap-2 px-6 py-4 border-t border-border/30">
<button type="button" onClick={onClose} className="px-4 py-2 text-xs font-display rounded-lg text-muted-foreground hover:text-foreground transition-colors">Cancel</button>
<button type="button" onClick={handleCreate} disabled={!name.trim() || (storageType === 'local' && !storagePath.trim())} aria-label="Create workspace"

View File

@@ -184,7 +184,7 @@ export default function EraseDataDialog({ open, onClose }: EraseDataDialogProps)
file. The wipe is <span className="text-foreground font-medium">not reversible</span> from the app — you'll need a previously-saved <span className="font-mono">.waggle-backup</span> file to restore.
</p>
<p>
Data already sent to cloud providers (Anthropic, OpenAI, Stripe, etc.) and Teams servers is <span className="text-foreground font-medium">not</span> erased by this action — see the data-handling policy for how to handle those separately.
Data already sent to cloud model providers (Anthropic, OpenAI and others) is <span className="text-foreground font-medium">not</span> erased by this action. Ask those providers to delete it.
</p>
</div>

View File

@@ -18,7 +18,6 @@ const shortcuts = [
{ keys: ['Ctrl', 'Shift', '6'], action: 'Events' },
{ keys: ['Ctrl', 'Shift', '7'], action: 'Settings' },
{ keys: ['Ctrl', 'Shift', '8'], action: 'Skills' },
{ keys: ['Ctrl', 'Shift', '9'], action: 'Agent Swarm' },
]},
{ category: 'Quick Actions', items: [
{ keys: ['Ctrl', 'K'], action: 'Global Search' },

View File

@@ -346,16 +346,14 @@ const LoginBriefing = ({ onDismiss, onOpenWorkspace }: LoginBriefingProps) => {
<div className="flex items-center justify-between mb-1">
<div className="flex items-center gap-2">
<span className="text-sm font-display font-medium text-foreground">{ws.name}</span>
{/* FR #27: tooltip clarifies what the Personal/Team
tag means. Personal workspaces are private to the
account; Team workspaces are
shared. Without this hint the colored chip reads
{/* FR #27: tooltip clarifies what the group tag
means. Without this hint the colored chip reads
as decorative metadata. */}
<HintTooltip
content={
ws.group === 'Personal'
? 'Personal workspaces are visible only to you.'
: 'Team workspaces (Teams/Enterprise) are shared across the organisation.'
: `${ws.group} is a group for sorting your workspaces.`
}
>
<span className="text-[11px] px-1.5 py-0.5 rounded-full bg-muted text-muted-foreground cursor-help">{ws.group}</span>

View File

@@ -3,6 +3,7 @@ import { motion, AnimatePresence, MotionConfig, useReducedMotion } from 'framer-
import beeMascot from '@/assets/personas/general-purpose.png';
import { adapter } from '@/lib/adapter';
import { captureOnboardingComplete } from '@/lib/posthog';
import { hasMemoryFeature } from '@/lib/memory-features';
import { useOfflineStatus } from '@/hooks/useOfflineStatus';
import type { OnboardingState } from '@/hooks/useOnboarding';
import type { UserProfile, ClassifiedHarvestItem } from '@/lib/types';
@@ -49,6 +50,17 @@ const LAST_INDEX = STEP_NAMES.length - 1;
const FIRST_NAV_INDEX = stepIndex('who-are-you');
const LAST_NAV_INDEX = stepIndex('first-task');
/** ADR-0002: history import is hidden in v1 (memory feature map), so its step
* is skipped. It keeps its index, so a persisted `state.step` still resolves. */
const isStepShown = (name: StepName): boolean =>
name !== 'memory-import' || hasMemoryFeature('importHistory');
/** Nearest shown step from `from`, walking forward (1) or back (-1). */
const shownStepFrom = (from: number, dir: 1 | -1): number => {
let i = from;
while (i > 0 && i < LAST_INDEX && !isStepShown(STEP_NAMES[i])) i += dir;
return i;
};
const DEFAULT_FIRST_MESSAGE = 'Hello! What can you help me with?';
/* ─── Main Component (shell) ─── */
@@ -57,7 +69,7 @@ const OnboardingWizard = ({ serverBaseUrl, state, onUpdate, onComplete, onDismis
// `state.step` (5-7) that no longer maps to the re-keyed 5-step chain. Clamp
// into [0, LAST_INDEX] so resume always lands on a renderable step rather
// than a blank screen. `?forceWizard=true` already resets step to 0.
const [step, setStep] = useState(() => Math.min(Math.max(state.step, 0), LAST_INDEX));
const [step, setStep] = useState(() => shownStepFrom(Math.min(Math.max(state.step, 0), LAST_INDEX), 1));
const autoTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
const offline = useOfflineStatus();
const reduceMotion = useReducedMotion();
@@ -191,8 +203,9 @@ const OnboardingWizard = ({ serverBaseUrl, state, onUpdate, onComplete, onDismis
finally { setImporting(false); }
};
/* ── Claude Code auto-detect on mount ── */
/* ── Claude Code auto-detect on mount (only when the import step is shown) ── */
useEffect(() => {
if (!isStepShown('memory-import')) return;
let cancelled = false;
(async () => {
try {
@@ -277,10 +290,15 @@ const OnboardingWizard = ({ serverBaseUrl, state, onUpdate, onComplete, onDismis
const progressPct = LAST_INDEX > 0 ? (step / LAST_INDEX) * 100 : 0;
// Nav chrome (Back + "Step N of M" + dots) spans who-are-you → first-task, so
// each interactive step has a distinct counter/dot fill (template = 4 of 5,
// first-task = 5 of 5) instead of two identical "Step 4 of 4" screens.
// first-task = 5 of 5) instead of two identical "Step 4 of 4" screens. A
// hidden step (isStepShown) gets no dot and no number.
const showNavChrome = step >= FIRST_NAV_INDEX;
const navTotal = LAST_NAV_INDEX - FIRST_NAV_INDEX + 1;
const navCurrent = step - FIRST_NAV_INDEX + 1;
const navSteps = STEP_NAMES
.map((name, index) => ({ name, index }))
.filter(({ name, index }) => index >= FIRST_NAV_INDEX && index <= LAST_NAV_INDEX && isStepShown(name))
.map(({ index }) => index);
const navTotal = navSteps.length;
const navCurrent = navSteps.indexOf(step) + 1;
const recommendedId = recommendTemplateId(profile.workType, profile.role);
return (
@@ -358,7 +376,7 @@ const OnboardingWizard = ({ serverBaseUrl, state, onUpdate, onComplete, onDismis
<button
onClick={() => {
clearTimeout(autoTimer.current);
goToStep(step - 1);
goToStep(shownStepFrom(step - 1, -1));
}}
className="text-xs text-muted-foreground hover:text-foreground transition-colors font-display px-3 py-2 rounded-md focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background"
aria-label="Go to previous step"
@@ -373,8 +391,7 @@ const OnboardingWizard = ({ serverBaseUrl, state, onUpdate, onComplete, onDismis
)}
{showNavChrome && (
<div className="flex gap-1.5" aria-hidden="true">
{STEP_NAMES.slice(FIRST_NAV_INDEX, LAST_NAV_INDEX + 1).map((_, idx) => {
const navStep = FIRST_NAV_INDEX + idx;
{navSteps.map((navStep) => {
return (
<div
key={navStep}
@@ -418,7 +435,7 @@ const OnboardingWizard = ({ serverBaseUrl, state, onUpdate, onComplete, onDismis
)}
{step === stepIndex('model-gate') && (
<ModelGateStep
onContinue={() => goToName('memory-import')}
onContinue={() => goToName(isStepShown('memory-import') ? 'memory-import' : 'template')}
onLater={() => {
clearTimeout(autoTimer.current);
trackTelemetry(serverBaseUrl, 'onboarding_skip', { atStep: step, via: 'model-gate-later' });