@hanzo/app 0.2.10 → 0.2.13

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.
package/dist/App.d.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  export interface Bar {
8
8
  inset?: number;
9
9
  drag?: Record<string, unknown>;
10
+ controls?: React.ReactNode;
10
11
  }
11
12
  export declare function App({ bar }?: {
12
13
  bar?: Bar;
package/dist/App.js CHANGED
@@ -85,6 +85,7 @@ import { pick } from './lib/session.js';
85
85
  import { app, go, place, settings, studio, talk, TERMINALS, visit } from './lib/host.js';
86
86
  import { Top } from './Top.js';
87
87
  import { FOOT, HEIGHT, TOP, useView } from './view.js';
88
+ import { dragWindow, toggleWindowMaximize, WindowControls } from './WindowControls.js';
88
89
  /** Studio, fetched the first time the reader stands in it. */
89
90
  const Studio = lazy(() => import('@hanzo/studio').then((m) => ({ default: m.Studio })));
90
91
  /** Tabs, the same way: the terminals on the reader's machines (Terminals.tsx). */
@@ -266,7 +267,7 @@ function Window({ bar }) {
266
267
  shut();
267
268
  setFinding(true);
268
269
  };
269
- return (_jsx(AiProvider, { client: client ?? undefined, children: _jsx(HostProvider, { host: host, children: _jsx(PrefsProvider, { children: _jsxs(YStack, { ref: windowRef, "data-slot": "window", ...(bar ? floor : null), flex: 1, minW: 0, height: "100dvh", overflow: "hidden", "$max-md": { position: 'fixed', t: TOP, l: 0, r: 0, height: HEIGHT, ...{ overflow: 'clip' } }, children: [bar ? (_jsxs(XStack, { "data-slot": "title-bar", height: BAR, shrink: 0, items: "center", gap: 2, pl: (bar.inset ?? 0) + 6, pr: "$2", ...bar.drag, children: [_jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(Toggle, { open: !closed, onPress: flip }) }), _jsx(XStack, { $md: { display: 'none' }, children: _jsx(Toggle, { open: drawer.state === 'open', onPress: drawer.open, label: t('Open sidebar') }) }), _jsx(Mark, { label: t('Back'), "data-slot": "back", onPress: () => router.back(), children: _jsx(ArrowLeft, { size: 18, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(Mark, { label: t('Forward'), "data-slot": "forward", onPress: () => router.forward(), children: _jsx(ArrowRight, { size: 18, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(XStack, { flex: 1, self: "stretch", ...bar.drag })] })) : null, _jsxs(XStack, { ref: drawer.pane, "data-room": "", "data-app": mode, "data-slot": "frame", ...(bar ? null : floor), ...(drawer.slide ? RAISED : null),
270
+ return (_jsx(AiProvider, { client: client ?? undefined, children: _jsx(HostProvider, { host: host, children: _jsx(PrefsProvider, { children: _jsxs(YStack, { ref: windowRef, "data-slot": "window", ...(bar ? floor : null), flex: 1, minW: 0, height: bar ? '100%' : '100dvh', overflow: "hidden", rounded: bar ? '$3' : undefined, "$max-md": { position: 'fixed', t: TOP, l: 0, r: 0, height: HEIGHT, ...{ overflow: 'clip' } }, children: [bar ? (_jsxs(XStack, { "data-slot": "title-bar", height: BAR, shrink: 0, items: "center", gap: 2, pl: (bar.inset ?? 0) + 6, pr: "$2", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, ...bar.drag, children: [_jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(Toggle, { open: !closed, onPress: flip }) }), _jsx(XStack, { $md: { display: 'none' }, children: _jsx(Toggle, { open: drawer.state === 'open', onPress: drawer.open, label: t('Open sidebar') }) }), _jsx(Mark, { label: t('Back'), "data-slot": "back", onPress: () => router.back(), children: _jsx(ArrowLeft, { size: 18, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(Mark, { label: t('Forward'), "data-slot": "forward", onPress: () => router.forward(), children: _jsx(ArrowRight, { size: 18, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(XStack, { flex: 1, self: "stretch", ...bar.drag }), bar.controls !== undefined ? (bar.controls) : !bar.inset ? (_jsx(WindowControls, {})) : null] })) : null, _jsxs(XStack, { ref: drawer.pane, "data-room": "", "data-app": mode, "data-slot": "frame", ...(bar ? null : floor), ...(drawer.slide ? RAISED : null),
270
271
  // inline-style: the slide, a transform with no logical form whose sign and distance the drawer writes on the element itself, a drag every frame (Drawer.tsx).
271
272
  style: drawer.slide ?? undefined, flex: 1, minW: 0, minH: 0, paddingInlineEnd: "var(--pane-gap)", pb: "var(--pane-gap)", pt: 0, "$max-md": { p: 0 }, children: [drawer.slide ? _jsx(Lift, {}) : null, _jsx(YStack, { height: "100%", "$max-md": { display: 'none' }, children: _jsx(Rail, { host: host, mode: mode, at: where, open: !closed, toggle: bar ? undefined : flip, onChat: toChat, onDev: toDev, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }) }), closed || mode === 'tabs' ? null : (_jsx(YStack, { "$max-md": { display: 'none' }, children: _jsx(Column, { host: host, mode: mode, thread: thread, go: move, onShut: () => setClosed(true), onSeek: seek, onBack: back, places: sidebar }) })), _jsxs(YStack, { "data-slot": "stage", flex: 1, minW: 0, minH: 0, marginInlineStart: closed || mode === 'tabs' ? 0 : 'var(--pane-gap)', "$max-md": { marginInlineStart: 0, pb: FOOT }, children: [bar ? null : _jsx(Top, { host: host, mode: mode, places: sidebar, open: drawer.state !== 'shut', go: move, onMenu: drawer.open, onChat: toChat, onDev: toDev }), _jsx(XStack, { "data-slot": "panes", flex: 1, minW: 0, minH: 0, children: mode === 'chat' ? (_jsx(Paned, { framed: true, children: _jsx(Chat, {}) })) : mode === 'tabs' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(Suspense, { fallback: null, children: _jsx(Terminals, {}) }) })) : mode === 'studio' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(YStack, { flex: 1, minH: 0, height: "100%", children: _jsx(Suspense, { fallback: null, children: _jsx(Studio, { host: maker, rail: false }) }) }) })) : (_jsx(YStack, { render: "main", "data-slot": "pane", ...(run ? null : { ...pane(), overflow: 'hidden' }), flex: 1, minW: 0, minH: 0, children: plans ? null : _jsx(Builder, { host: host, rail: false }) })) })] })] }), drawer.state === 'shut' ? null : (_jsx(Layer, { drawer: drawer, top: bar ? BAR : 0, children: _jsx(Column, { host: host, mode: mode, thread: thread, go: move, onShut: shut, onSeek: seek, onBack: back, drawer: true, places: sidebar, rail: _jsx(Rail, { host: host, mode: mode, at: where, open: true, rows: true, onChat: toChat, onDev: toDev, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }), foot: _jsx(Foot, { host: host, onChat: fresh, onOrg: org }) }) })), finding ? _jsx(Palette, { go: move, onClose: found, mode: mode, host: host }) : null, learning ? _jsx(Learning, { open: true, onClose: () => setLearning(false) }) : null] }) }) }) }));
272
273
  }
package/dist/Chat.js CHANGED
@@ -28,7 +28,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
28
28
  // belongs in the thread where the reader can see it, not in a caption that
29
29
  // pre-emptively refuses on the gateway's behalf.
30
30
  import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
31
- import { isolate, phrase } from "@hanzo/i18n";
31
+ import { isolate, locales, phrase } from "@hanzo/i18n";
32
32
  import { useI18n } from "@hanzo/i18n/react";
33
33
  import { billed, detail, familyOf, planRequired, plainly, refused } from "./failure.js";
34
34
  import { english } from "./say.js";
@@ -42,7 +42,7 @@ import { Face, brief as roomBrief, join, roleOf, roomTurn, roster as rosterLine,
42
42
  import { cleanForSpeech, speakAgent } from "./speech.js";
43
43
  import { AgentMaker, HOUSE, useAgentShelf, useCrew } from "./crew.js";
44
44
  import { called } from "./team.js";
45
- import { Anchor, Box, Button, Text, View, XStack, YStack } from "@hanzo/ui";
45
+ import { Anchor, Box, Button, DropdownMenu, Text, View, XStack, YStack } from "@hanzo/ui";
46
46
  import { useMedia } from "@hanzo/gui";
47
47
  import { given, tidy } from "./lib/title.js";
48
48
  import { useIam, useIamToken } from "@hanzo/iam/react";
@@ -57,7 +57,7 @@ import { useHydrated } from "./lib/hydrated.js";
57
57
  import { base, served } from "./lib/ai.js";
58
58
  import { onServed } from "./lib/served.js";
59
59
  import { refused as worded, speech, useDictation, useTalk, useVoice } from "@hanzo/voice";
60
- import { Check, Clock, FileText, Image as ImageMark, Library as LibraryMark, Paperclip, Sparkles, X } from "lucide-react";
60
+ import { Check, Clock, FileText, Image as ImageMark, Languages, Library as LibraryMark, Paperclip, Sparkles, X } from "lucide-react";
61
61
  import { FREE, ENSO } from "./lib/ai.js";
62
62
  import { openThread, useOpen } from "./open.js";
63
63
  import { Beside, Framed } from "./Shell.js";
@@ -66,8 +66,9 @@ import { Share } from "./Share.js";
66
66
  import { ConversationMenu, ThreadMore, useThreadList } from "./thread.js";
67
67
  import { Schedule } from "./Schedule.js";
68
68
  import { keepFile, useAttach, useKeep } from "./keep.js";
69
+ import { dragWindow, toggleWindowMaximize } from "./WindowControls.js";
69
70
  import { artifacts, lead, nameOf, PAGE, Panel, PanelToggle, prompt, renders, Reply, Served, Summary, useDeck, useKey, Suggestions, useCarry, useLanguage, useMention, useMind, useSuggestions, book, hand, taken, want, path as devPath, CHAT_MODES, usePanel, frames, name as tabName, } from "@hanzo/build";
70
- import { checkoutUrl } from './lib/pay.js';
71
+ import { checkoutUrl, payUrl } from './lib/pay.js';
71
72
  import { Upgrade, useFree } from './Upgrade.js';
72
73
  import { enter, LOGIN } from './lib/destination.js';
73
74
  import { first } from './lib/first.js';
@@ -502,7 +503,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
502
503
  // THE MODEL AND THE EFFORT are the one choice Chat and Dev share
503
504
  // (@hanzo/build `useMind`): the catalog from `GET /v1/models` and what the
504
505
  // reader kept, changed from the composer's chip or from Settings.
505
- const { t } = useI18n();
506
+ const { t, locale, setLocale } = useI18n();
506
507
  const target = useMemo(() => ({ api: api(), token: bearer, org: org() }), [anonymous]); // eslint-disable-line react-hooks/exhaustive-deps
507
508
  // THE PLAN decides what the chip may offer: Free answers from the free lane
508
509
  // alone, so it opens there and lists the rest as upgrades (@hanzo/build).
@@ -1495,7 +1496,15 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1495
1496
  }, children: [_jsx(Schedule, { open: plan !== null, onOpenChange: (open) => {
1496
1497
  if (!open)
1497
1498
  setPlan(null);
1498
- }, prompt: plan ?? "", model: model, models: models.map((m) => ({ id: m.id, name: nameOf(m.id, listed) })) }), dragging ? (_jsx(YStack, { "aria-hidden": true, position: "absolute", t: 0, r: 0, b: 0, l: 0, z: 10, items: "center", justify: "center", bg: "var(--surface-scrim)", borderWidth: 2, borderStyle: "dashed", borderColor: "$borderColor", rounded: "var(--pane-round)", pointerEvents: "none", children: _jsxs(XStack, { items: "center", gap: "$2", px: "$4", py: "$2.5", rounded: "$10", bg: "$background", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Paperclip, { size: 15, "aria-hidden": true }), _jsx(Text, { fontSize: "$4", color: "$ink", children: t("Drop files to attach") })] }) })) : null, _jsxs(XStack, { "data-slot": "conversation-head", height: 52, items: "center", justify: "space-between", gap: "$3", paddingInlineStart: "$4", paddingInlineEnd: "$2", shrink: 0, "$max-md": !mine && !room.length ? { display: 'none' } : undefined, children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, children: [mine ? (_jsx(Text, { fontSize: 15, lineHeight: 20, color: "$ink", numberOfLines: 1, shrink: 1, minW: 0, children: tidy(mine.title) })) : null, room.length ? (_jsx(XStack, { role: "list", "aria-label": t("Agents in this chat"), items: "center", gap: "$1.5", minW: 0, overflowX: "auto", "$platform-web": { scrollbarWidth: "none" }, children: room.map((name) => (_jsxs(XStack, { role: "listitem", items: "center", gap: "$1.5", paddingInlineStart: "$1", paddingInlineEnd: "$0.5", py: "$0.5", rounded: 999, borderWidth: 1, borderColor: "$borderColor", shrink: 0, children: [_jsx(Face, { src: faces[name]?.avatar ?? (name === withWhom ? portrait : undefined), emoji: faces[name]?.emoji ?? (name === withWhom ? persona?.emoji : undefined), name: name, size: 22 }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$color", numberOfLines: 1, display: "none", $sm: { display: "flex" }, children: name }), _jsx(Box, { render: "button", onClick: () => openAgent(name), "aria-label": t("Remove {name} from this chat", { name }), title: t("Remove {name}", { name }), width: 24, height: 24, rounded: 999, items: "center", justify: "center", hoverStyle: { bg: "$hover" }, children: _jsx(X, { size: 13, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }) })] }, name))) })) : null] }), _jsxs(XStack, { "data-slot": "conversation-controls", items: "center", gap: 4, shrink: 0, children: [free ? (_jsxs(Button, { size: "xs", variant: "outline", "data-slot": "header-upgrade", gap: "$1.5", px: "$2.5", py: "$1", rounded: "$4", cursor: "pointer", hoverStyle: { bg: 'var(--white-10)' }, onPress: () => setAsk({}), "aria-label": t("Upgrade"), children: [_jsx(Sparkles, { size: 13, color: "var(--primary)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Upgrade") })] })) : null, open ? _jsx(Share, { thread: open }) : null, mine ? (_jsx(ConversationMenu, { threads: alone, active: open, onSchedule: anonymous ? undefined : () => setPlan(lastAsked()), children: _jsx(XStack, { children: _jsx(ThreadMore, { t: mine }) }) })) : null, _jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(Summary, { sections: sections, onOpen: () => setPanel(true), label: t("Summary") }) }), _jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(PanelToggle, { open: panel, onToggle: () => setPanel(!panel) }) })] })] }), wide && aside !== null ? (_jsx(Beside, { children: _jsx(Panel, { side: deck, kinds: NONE, onHide: () => setPanel(false), label: t("Tabs"), ...browsing }) })) : null, !wide && panel ? _jsx(Panel, { side: deck, kinds: NONE, sheet: true, onHide: () => setPanel(false), label: t("Tabs"), ...browsing }) : null, _jsx(ChatSurface, { ...chat, messages: shown, send: guarded,
1499
+ }, prompt: plan ?? "", model: model, models: models.map((m) => ({ id: m.id, name: nameOf(m.id, listed) })) }), dragging ? (_jsx(YStack, { "aria-hidden": true, position: "absolute", t: 0, r: 0, b: 0, l: 0, z: 10, items: "center", justify: "center", bg: "var(--surface-scrim)", borderWidth: 2, borderStyle: "dashed", borderColor: "$borderColor", rounded: "var(--pane-round)", pointerEvents: "none", children: _jsxs(XStack, { items: "center", gap: "$2", px: "$4", py: "$2.5", rounded: "$10", bg: "$background", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Paperclip, { size: 15, "aria-hidden": true }), _jsx(Text, { fontSize: "$4", color: "$ink", children: t("Drop files to attach") })] }) })) : null, _jsxs(XStack, { "data-slot": "conversation-head", height: 52, items: "center", justify: "space-between", gap: "$3", paddingInlineStart: "$4", paddingInlineEnd: "$2", shrink: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, "$max-md": !mine && !room.length ? { display: 'none' } : undefined, children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, children: [mine ? (_jsx(Text, { fontSize: 15, lineHeight: 20, color: "$ink", numberOfLines: 1, shrink: 1, minW: 0, children: tidy(mine.title) })) : null, room.length ? (_jsx(XStack, { role: "list", "aria-label": t("Agents in this chat"), items: "center", gap: "$1.5", minW: 0, overflowX: "auto", "$platform-web": { scrollbarWidth: "none" }, children: room.map((name) => (_jsxs(XStack, { role: "listitem", items: "center", gap: "$1.5", paddingInlineStart: "$1", paddingInlineEnd: "$0.5", py: "$0.5", rounded: 999, borderWidth: 1, borderColor: "$borderColor", shrink: 0, children: [_jsx(Face, { src: faces[name]?.avatar ?? (name === withWhom ? portrait : undefined), emoji: faces[name]?.emoji ?? (name === withWhom ? persona?.emoji : undefined), name: name, size: 22 }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$color", numberOfLines: 1, display: "none", $sm: { display: "flex" }, children: name }), _jsx(Box, { render: "button", onClick: () => openAgent(name), "aria-label": t("Remove {name} from this chat", { name }), title: t("Remove {name}", { name }), width: 24, height: 24, rounded: 999, items: "center", justify: "center", hoverStyle: { bg: "$hover" }, children: _jsx(X, { size: 13, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }) })] }, name))) })) : null] }), _jsxs(XStack, { "data-slot": "conversation-controls", "data-tauri-drag-region": "false", items: "center", gap: 4, shrink: 0, children: [free ? (_jsxs(Button, { size: "xs", variant: "outline", "data-slot": "header-upgrade", gap: "$1.5", px: "$2.5", py: "$1", rounded: "$4", cursor: "pointer", hoverStyle: { bg: 'var(--white-10)' }, onPress: () => window.location.assign(payUrl('/cart', { org: org(), returnUrl: window.location.href })), "aria-label": t("Upgrade plan"), children: [_jsx(Sparkles, { size: 13, color: "var(--primary)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Upgrade plan") })] })) : null, _jsx(DropdownMenu, { minWidth: 200, placement: "bottom-end", trigger: _jsxs(Button, { size: "xs", variant: "outline", "data-slot": "header-language", gap: "$1", px: "$2", py: "$1", rounded: "$4", cursor: "pointer", hoverStyle: { bg: 'var(--white-10)' }, "aria-label": t("Language"), children: [_jsx(Languages, { size: 13, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: locale.toUpperCase() })] }), items: locales
1500
+ .filter((l) => !l.review || l.code === locale)
1501
+ .map((l) => ({
1502
+ key: l.code,
1503
+ label: l.name,
1504
+ description: l.englishName !== l.name ? l.englishName : undefined,
1505
+ icon: l.code === locale ? _jsx(Check, { size: 14, "aria-hidden": true }) : undefined,
1506
+ onSelect: () => void setLocale(l.code),
1507
+ })) }), open ? _jsx(Share, { thread: open }) : null, mine ? (_jsx(ConversationMenu, { threads: alone, active: open, onSchedule: anonymous ? undefined : () => setPlan(lastAsked()), children: _jsx(XStack, { children: _jsx(ThreadMore, { t: mine }) }) })) : null, _jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(Summary, { sections: sections, onOpen: () => setPanel(true), label: t("Summary") }) }), _jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(PanelToggle, { open: panel, onToggle: () => setPanel(!panel) }) })] })] }), wide && aside !== null ? (_jsx(Beside, { children: _jsx(Panel, { side: deck, kinds: NONE, onHide: () => setPanel(false), label: t("Tabs"), ...browsing }) })) : null, !wide && panel ? _jsx(Panel, { side: deck, kinds: NONE, sheet: true, onHide: () => setPanel(false), label: t("Tabs"), ...browsing }) : null, _jsx(ChatSurface, { ...chat, messages: shown, send: guarded,
1499
1508
  // AN EMPTY ROOM CENTRES ITS COMPOSER on a laptop. While nothing has been
1500
1509
  // said the opening (the heading) and the composer sit as one group in the
1501
1510
  // middle of the height; the moment a turn exists the transcript takes the
package/dist/Chrome.js CHANGED
@@ -9,6 +9,7 @@ import { rememberDestination } from './lib/destination.js';
9
9
  import { named } from './lib/session.js';
10
10
  import { useSignOut } from './lib/signout.js';
11
11
  import { brand } from './where.js';
12
+ import { dragWindow, toggleWindowMaximize, WindowControls } from './WindowControls.js';
12
13
  /** The bar's height under the notch: hanzo.ai's masthead's. */
13
14
  const HEIGHT = 60;
14
15
  /** The notch's inset. gui carries a CSS function to the page unchanged; its types only name custom properties. */
@@ -29,5 +30,9 @@ export function Chrome({ back }) {
29
30
  };
30
31
  const out = () => void signOut();
31
32
  const signed = isAuthenticated && Boolean(who);
32
- return (_jsxs(XStack, { render: "header", "data-slot": "masthead", position: "sticky", t: 0, z: "var(--z-header)", shrink: 0, boxSizing: "content-box", height: HEIGHT, pt: NOTCH, px: "var(--page-gutter, 20px)", gap: 12, items: "center", bg: "var(--background)", borderBottomWidth: 1, borderColor: "var(--border)", children: [_jsx(Text, { render: _jsx("a", { href: "/", "aria-label": t('{brand} home', { brand: brand() }) }), display: "flex", items: "center", shrink: 0, color: "var(--foreground)", textDecorationLine: "none", children: _jsx(HanzoWordmark, { label: brand(), size: 22 }) }), back, _jsx(View, { flex: 1 }), signed ? (_jsxs(_Fragment, { children: [_jsxs(XStack, { render: "section", "aria-label": t('Account'), items: "center", gap: 12, minW: 0, "$max-md": { display: 'none' }, children: [_jsx(Avatar, { src: avatar || null, name: who, alt: "" }), _jsxs(YStack, { minW: 0, gap: 2, children: [_jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$ink", numberOfLines: 1, children: who }), name && email ? (_jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, children: email })) : null] }), _jsx(Button, { variant: "ghost", size: "sm", onClick: other, children: t('Use another account') }), _jsx(Button, { variant: "ghost", size: "sm", onClick: out, children: t('Log out') })] }), _jsx(View, { display: "none", "$max-md": { display: 'flex' }, children: _jsxs(DropdownMenu, { placement: dir === 'rtl' ? 'bottom-start' : 'bottom-end', offset: 8, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "aria-label": t('Account: {name}', { name: who }), width: 40, height: 40, rounded: 999, items: "center", justify: "center", borderWidth: 0, bg: "transparent", hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, cursor: "pointer", children: _jsx(Avatar, { src: avatar || null, name: who, alt: "" }) }) }), _jsxs(DropdownMenuContent, { minW: 240, maxW: "calc(100vw - 16px)", "aria-labelledby": undefined, "aria-label": t('Account'), children: [_jsx(DropdownMenuLabel, { children: _jsxs(YStack, { minW: 0, gap: 2, children: [_jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$ink", numberOfLines: 1, children: who }), name && email ? (_jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, children: email })) : null] }) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onSelect: other, children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Use another account') }) }), _jsx(DropdownMenuItem, { onSelect: out, children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Log out') }) })] })] }) })] })) : null] }));
33
+ return (_jsxs(XStack, { render: "header", "data-slot": "masthead", "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, position: "sticky", t: 0, z: "var(--z-header)", shrink: 0, boxSizing: "content-box", height: HEIGHT, pt: NOTCH, px: "var(--page-gutter, 20px)", gap: 12, items: "center", bg: "var(--background)", borderBottomWidth: 1, borderColor: "var(--border)", children: [_jsx(Text, { render: _jsx("a", { href: "/", "aria-label": t('{brand} home', { brand: brand() }), "data-tauri-drag-region": "deep", onClick: (e) => {
34
+ if (typeof document !== 'undefined' && document.documentElement.getAttribute('data-desktop') === 'true') {
35
+ e.preventDefault();
36
+ }
37
+ } }), display: "flex", items: "center", shrink: 0, color: "var(--foreground)", textDecorationLine: "none", "data-tauri-drag-region": "deep", children: _jsx(HanzoWordmark, { label: brand(), size: 22, "data-tauri-drag-region": "deep" }) }), back, _jsx(View, { flex: 1, "data-tauri-drag-region": "deep" }), signed ? (_jsxs(_Fragment, { children: [_jsxs(XStack, { render: "section", "aria-label": t('Account'), items: "center", gap: 12, minW: 0, "$max-md": { display: 'none' }, children: [_jsx(Avatar, { src: avatar || null, name: who, alt: "" }), _jsxs(YStack, { minW: 0, gap: 2, children: [_jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$ink", numberOfLines: 1, children: who }), name && email ? (_jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, children: email })) : null] }), _jsx(Button, { variant: "ghost", size: "sm", onClick: other, children: t('Use another account') }), _jsx(Button, { variant: "ghost", size: "sm", onClick: out, children: t('Log out') })] }), _jsx(View, { display: "none", "$max-md": { display: 'flex' }, children: _jsxs(DropdownMenu, { placement: dir === 'rtl' ? 'bottom-start' : 'bottom-end', offset: 8, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "aria-label": t('Account: {name}', { name: who }), width: 40, height: 40, rounded: 999, items: "center", justify: "center", borderWidth: 0, bg: "transparent", hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, cursor: "pointer", children: _jsx(Avatar, { src: avatar || null, name: who, alt: "" }) }) }), _jsxs(DropdownMenuContent, { minW: 240, maxW: "calc(100vw - 16px)", "aria-labelledby": undefined, "aria-label": t('Account'), children: [_jsx(DropdownMenuLabel, { children: _jsxs(YStack, { minW: 0, gap: 2, children: [_jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$ink", numberOfLines: 1, children: who }), name && email ? (_jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, children: email })) : null] }) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onSelect: other, children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Use another account') }) }), _jsx(DropdownMenuItem, { onSelect: out, children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Log out') }) })] })] }) })] })) : null, _jsx(WindowControls, {})] }));
33
38
  }
package/dist/Column.js CHANGED
@@ -46,6 +46,7 @@ import { useFree } from './Upgrade.js';
46
46
  import { talk } from './lib/host.js';
47
47
  import { payUrl } from './lib/pay.js';
48
48
  import { brand, wordmark } from './where.js';
49
+ import { dragWindow, toggleWindowMaximize } from './WindowControls.js';
49
50
  /** The sidebar fills the column. Its `width` is typed in px alone, though its frame takes any gui size — the type is
50
51
  * @hanzo/ui's to widen. */
51
52
  const FILL = { width: '100%' };
@@ -117,5 +118,5 @@ export function Column({ host, mode, thread, go, onShut, onSeek, onBack, drawer
117
118
  };
118
119
  return (_jsxs(YStack, { "data-slot": "app-column", ref: drawer ? undefined : span.ref,
119
120
  // inline-style: `--span`, the width a drag rewrites on the element itself (span.ts); no prop sets a variable.
120
- style: drawer ? undefined : span.style, position: "relative", flex: drawer ? 1 : undefined, shrink: drawer ? 1 : 0, minW: 0, height: "100%", width: drawer ? undefined : 'var(--span)', children: [_jsxs(Sidebar, { "data-slot": "app-rail", role: "navigation", "aria-label": brand(), bg: "transparent", borderWidth: 0, ...FILL, px: "$2", pt: drawer ? '$2' : 0, pb: "$2", gap: "$0", children: [at ? (_jsxs(XStack, { "data-slot": "app-head", items: "center", gap: "$1", paddingInlineStart: 2, paddingInlineEnd: 2, height: 52, shrink: 0, minW: 0, children: [_jsx(SidebarIconButton, { label: t('Back'), "data-slot": "place-back", onPress: onBack, ...HEAD, children: _jsx(ArrowLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(Text, { flex: 1, minW: 0, fontSize: 18, lineHeight: 24, fontWeight: "600", color: "$ink", numberOfLines: 1, "data-slot": "place-name", children: t(TITLE[at]) })] })) : (_jsxs(XStack, { "data-slot": "app-head", items: "center", gap: "$1", paddingInlineStart: "$2", paddingInlineEnd: 2, height: 52, shrink: 0, minW: 0, children: [_jsx(Text, { flex: 1, minW: 0, fontSize: 18, lineHeight: 24, fontWeight: "600", color: "$ink", numberOfLines: 1, children: wordmark(mode) }), _jsx(Activity, { host: host }), _jsx(SidebarIconButton, { label: t('Search'), onPress: onSeek, "aria-haspopup": "dialog", ...HEAD, children: _jsx(Search, { size: 16, "aria-hidden": true }) })] })), mode === 'chat' ? (_jsx(YStack, { role: "list", gap: 2, shrink: 0, children: _jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { "data-slot": "app-new", ...ROW, active: !thread, bg: "transparent", hoverStyle: { bg: '$hover' }, icon: _jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(SquarePen, { size: 16, "aria-hidden": true }) }), onPress: create, ...keys(create), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('New chat') }) }) }) })) : (_jsx(YStack, { "data-slot": "app-places", shrink: 0, children: groups.map((g, i) => (_jsxs(YStack, { pt: i ? '$2' : 0, children: [i && g.label ? (_jsx(Text, { id: `${uid}-${g.id}`, paddingInlineStart: "$2", pb: 2, fontSize: "$3", color: "$soft", children: g.label })) : null, _jsx(YStack, { role: "list", "aria-labelledby": i && g.label ? `${uid}-${g.id}` : undefined, "aria-label": i && g.label ? undefined : g.label || (at ? t(TITLE[at]) : g.id), gap: 1, children: g.links.map((link) => (_jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { ...ROW, ...(link.id === NEW ? { 'data-slot': 'app-new' } : {}), active: link.active, icon: link.id === NEW ? (_jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(SquarePen, { size: 16, "aria-hidden": true }) })) : link.icon ? (_jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: link.icon })) : null, onPress: link.onPress, ...keys(() => link.onPress?.()), children: _jsx(Text, { fontSize: "$3", color: link.active ? '$ink' : '$quiet', children: link.label }) }) }, link.id))) })] }, g.id))) })), rail, mode === 'studio' || mode === 'tabs' || at ? null : _jsx(Recents, { host: host, mode: mode, thread: thread, onOpen: open, onNew: create }), at ? null : (_jsxs(YStack, { gap: "$2", pt: "$2", shrink: 0, children: [_jsx(Made, {}), _jsx(Setup, {})] })), free ? (_jsx(YStack, { role: "list", gap: 2, shrink: 0, pt: "$2", children: _jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { ...ROW, "data-slot": "column-upgrade", icon: _jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(Sparkles, { size: 16, "aria-hidden": true, color: "var(--primary)" }) }), onPress: () => window.location.assign(payUrl('/cart', { plan: 'pro', returnUrl: window.location.href })), ...keys(() => window.location.assign(payUrl('/cart', { plan: 'pro', returnUrl: window.location.href }))), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Upgrade to Pro') }) }) }) })) : null, foot] }), drawer ? null : (_jsx(Gutter, { side: dir === 'rtl' ? 'right' : 'left', span: span.span, floor: FLOOR, ceil: CEIL, reset: WIDTH, onSpan: span.move, onKeep: span.keep, onShut: onShut, label: t('Resize sidebar') }))] }));
121
+ style: drawer ? undefined : span.style, position: "relative", flex: drawer ? 1 : undefined, shrink: drawer ? 1 : 0, minW: 0, height: "100%", width: drawer ? undefined : 'var(--span)', children: [_jsxs(Sidebar, { "data-slot": "app-rail", role: "navigation", "aria-label": brand(), bg: "transparent", borderWidth: 0, ...FILL, px: "$2", pt: drawer ? '$2' : 0, pb: "$2", gap: "$0", children: [at ? (_jsxs(XStack, { "data-slot": "app-head", items: "center", gap: "$1", paddingInlineStart: 2, paddingInlineEnd: 2, height: 52, shrink: 0, minW: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, children: [_jsx(SidebarIconButton, { label: t('Back'), "data-slot": "place-back", "data-tauri-drag-region": "false", onPress: onBack, ...HEAD, children: _jsx(ArrowLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(Text, { flex: 1, minW: 0, fontSize: 18, lineHeight: 24, fontWeight: "600", color: "$ink", numberOfLines: 1, "data-slot": "place-name", children: t(TITLE[at]) })] })) : (_jsxs(XStack, { "data-slot": "app-head", items: "center", gap: "$1", paddingInlineStart: "$2", paddingInlineEnd: 2, height: 52, shrink: 0, minW: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, children: [_jsx(Text, { flex: 1, minW: 0, fontSize: 18, lineHeight: 24, fontWeight: "600", color: "$ink", numberOfLines: 1, children: wordmark(mode) }), _jsx(Activity, { host: host }), _jsx(SidebarIconButton, { label: t('Search'), "data-tauri-drag-region": "false", onPress: onSeek, "aria-haspopup": "dialog", ...HEAD, children: _jsx(Search, { size: 16, "aria-hidden": true }) })] })), mode === 'chat' ? (_jsx(YStack, { role: "list", gap: 2, shrink: 0, children: _jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { "data-slot": "app-new", ...ROW, active: !thread, bg: "transparent", hoverStyle: { bg: '$hover' }, icon: _jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(SquarePen, { size: 16, "aria-hidden": true }) }), onPress: create, ...keys(create), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('New chat') }) }) }) })) : (_jsx(YStack, { "data-slot": "app-places", shrink: 0, children: groups.map((g, i) => (_jsxs(YStack, { pt: i ? '$2' : 0, children: [i && g.label ? (_jsx(Text, { id: `${uid}-${g.id}`, paddingInlineStart: "$2", pb: 2, fontSize: "$3", color: "$soft", children: g.label })) : null, _jsx(YStack, { role: "list", "aria-labelledby": i && g.label ? `${uid}-${g.id}` : undefined, "aria-label": i && g.label ? undefined : g.label || (at ? t(TITLE[at]) : g.id), gap: 1, children: g.links.map((link) => (_jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { ...ROW, ...(link.id === NEW ? { 'data-slot': 'app-new' } : {}), active: link.active, icon: link.id === NEW ? (_jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(SquarePen, { size: 16, "aria-hidden": true }) })) : link.icon ? (_jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: link.icon })) : null, onPress: link.onPress, ...keys(() => link.onPress?.()), children: _jsx(Text, { fontSize: "$3", color: link.active ? '$ink' : '$quiet', children: link.label }) }) }, link.id))) })] }, g.id))) })), rail, mode === 'studio' || mode === 'tabs' || at ? null : _jsx(Recents, { host: host, mode: mode, thread: thread, onOpen: open, onNew: create }), at ? null : (_jsxs(YStack, { gap: "$2", pt: "$2", shrink: 0, children: [_jsx(Made, {}), _jsx(Setup, {})] })), free ? (_jsx(YStack, { role: "list", gap: 2, shrink: 0, pt: "$2", children: _jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { ...ROW, "data-slot": "column-upgrade", icon: _jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(Sparkles, { size: 16, "aria-hidden": true, color: "var(--primary)" }) }), onPress: () => window.location.assign(payUrl('/cart', { returnUrl: window.location.href })), ...keys(() => window.location.assign(payUrl('/cart', { returnUrl: window.location.href }))), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Upgrade plan') }) }) }) })) : null, foot] }), drawer ? null : (_jsx(Gutter, { side: dir === 'rtl' ? 'right' : 'left', span: span.span, floor: FLOOR, ceil: CEIL, reset: WIDTH, onSpan: span.move, onKeep: span.keep, onShut: onShut, label: t('Resize sidebar') }))] }));
121
122
  }
package/dist/Me.js CHANGED
@@ -176,7 +176,7 @@ export function Me({ host, narrow = false, above = false, onOrg, }) {
176
176
  // A personal plan is bought for the personal organization, beside any business one.
177
177
  // The plans row's name (a phrase of `upgrade`'s).
178
178
  const plans = upgrade(read.value?.label?.name);
179
- const getPro = () => (personal ? window.location.assign(payUrl('/cart', { plan: 'pro', org: personal.name, returnUrl: window.location.href })) : window.location.assign(payUrl('/cart', { plan: 'pro', returnUrl: window.location.href })));
179
+ const getPro = () => (personal ? window.location.assign(payUrl('/cart', { org: personal.name, returnUrl: window.location.href })) : window.location.assign(payUrl('/cart', { returnUrl: window.location.href })));
180
180
  const apple = mac();
181
181
  useEffect(() => {
182
182
  if (above)
@@ -220,7 +220,7 @@ export function Me({ host, narrow = false, above = false, onOrg, }) {
220
220
  $touchable: narrow ? { width: 44, minH: 44 } : undefined, px: narrow ? 0 : '$2', gap: "$2.5", rounded: narrow ? 999 : '$5', items: "center", justify: narrow ? 'center' : 'flex-start', hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, cursor: "pointer", children: [_jsx(Face, { host: host, size: narrow ? 26 : 32 }), narrow ? null : (_jsxs(_Fragment, { children: [_jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$3", fontWeight: "600", color: "$ink", numberOfLines: 1, text: "start", children: who }), working ? (_jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, text: "start", children: working })) : null] }), isFree ? (_jsx(Button, { size: "xs", variant: "outline", "data-slot": "me-upgrade", px: "$2", py: "$0.5", rounded: "$3", onPress: (e) => {
221
221
  e?.stopPropagation?.();
222
222
  getPro();
223
- }, cursor: "pointer", children: t('Upgrade') })) : null, _jsx(ChevronsUpDown, { size: 14, "aria-hidden": true, opacity: 0.6 })] }))] }) }), _jsxs(DropdownMenuContent, { minW: 260, maxW: "calc(100vw - 16px)", "aria-labelledby": undefined, "aria-label": t('Account'), onCloseAutoFocus: back, children: [_jsxs(DropdownMenuSub, { open: account, onOpenChange: setAccount, children: [_jsxs(DropdownMenuSubTrigger, { minH: 48, gap: "$2.5", children: [_jsx(Face, { host: host, size: 28 }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: who }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: host.person.email || working })] })] }), account ? (_jsxs(DropdownMenuSubContent, { minW: 260, maxW: "calc(100vw - 16px)", pointerEvents: "auto", children: [_jsx(Meter, { read: read, onPlans: () => leave('here'), onBilling: () => (setOpen(false), showSettings('billing')) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: t('Organizations') }), all.map((o) => (_jsx(DropdownMenuItem, { onSelect: () => o.name !== current && onOrg(o.name), children: _jsx(Line, { icon: _jsx(Mark, { org: o }), sub: [o.personal ? t('Personal') : said(o.role, t), planFor(o) || (isFree && o.personal ? t('Free') : '')].filter(Boolean).join(' - '), trail: o.name === current ? _jsx(Check, { size: 16, "aria-label": t('Current') }) : null, children: o.display }) }, o.name))), _jsx(DropdownMenuItem, { onSelect: () => setCreating(true), children: _jsx(Line, { icon: _jsx(Plus, { size: 16, "aria-hidden": true }), children: t('Create organization') }) }), _jsx(DropdownMenuItem, { onSelect: () => out(site(settings('organization'))), children: _jsx(Line, { icon: _jsx(Settings, { size: 16, "aria-hidden": true }), children: t('Organization settings') }) }), where().team ? null : here && !here.personal ? (_jsx(DropdownMenuItem, { onSelect: () => out(`${ENTRY}&org=${encodeURIComponent(here.name)}`), children: _jsx(Line, { icon: _jsx(Users, { size: 16, "aria-hidden": true }), trail: _jsx(ArrowUpRight, { size: 14, "aria-hidden": true, opacity: 0.6 }), children: t('Open in Hanzo Team') }) })) : (_jsx(DropdownMenuItem, { onSelect: () => setCreating(true), children: _jsx(Line, { icon: _jsx(Users, { size: 16, "aria-hidden": true }), children: t('Create a team') }) })), superAdmin() ? (_jsx(DropdownMenuItem, { onSelect: choose, children: _jsx(Line, { icon: _jsx(Building2, { size: 16, "aria-hidden": true }), children: t('All organizations') }) })) : null] })) : null] }), team ? (_jsx(DropdownMenuItem, { "data-slot": "me-team", onSelect: () => team.name !== current && onOrg(team.name), children: _jsx(Line, { icon: _jsx(Mark, { org: team }), trail: team.name === current ? _jsx(Check, { size: 16, "aria-label": t('Current') }) : null, children: t('{org} · {plan}', { org: team.display, plan: teamPlan || t('No plan') }) }) })) : null, personal ? (_jsx(DropdownMenuItem, { "data-slot": "me-personal", onSelect: () => personal.name !== current && onOrg(personal.name), actionsVisibility: "always", actions: ownPlan ? undefined : (_jsx(Button, { size: "xs", variant: "outline", onPress: getPro, children: t('Get Pro') })), children: _jsx(Line, { icon: _jsx(CircleUserRound, { size: 16, "aria-hidden": true }), trail: personal.name === current ? _jsx(Check, { size: 16, "aria-label": t('Current') }) : null, children: t('Personal · {plan}', { plan: ownPlan || t('No plan') }) }) })) : null, _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onSelect: () => leave('here'), children: _jsx(Line, { icon: _jsx(Sparkles, { size: 16, "aria-hidden": true }), children: t(plans) }) }), _jsx(DropdownMenuItem, { onSelect: () => showSettings('general'), children: _jsx(Line, { icon: _jsx(Palette, { size: 16, "aria-hidden": true }), children: t('Personalization') }) }), _jsx(DropdownMenuItem, { onSelect: () => showSettings('account'), children: _jsx(Line, { icon: _jsx(CircleUserRound, { size: 16, "aria-hidden": true }), children: t('Profile') }) }), _jsx(DropdownMenuItem, { "aria-keyshortcuts": "Control+, Meta+,", onSelect: () => showSettings('general'), children: _jsx(Line, { icon: _jsx(Settings, { size: 16, "aria-hidden": true }), trail: _jsx(DropdownMenuShortcut, { "aria-hidden": true, children: _jsx("bdi", { dir: "ltr", children: apple ? '⌘,' : 'Ctrl+,' }) }), children: t('Settings') }) }), _jsx(DropdownMenuItem, { onSelect: () => window.location.assign(site('/beta/status')), children: _jsx(Line, { icon: _jsx(FlaskConical, { size: 16, "aria-hidden": true }), children: t('Beta') }) }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuSub, { open: lang, onOpenChange: setLang, children: [_jsx(DropdownMenuSubTrigger, { children: _jsx(Line, { icon: _jsx(Languages, { size: 16, "aria-hidden": true }), children: t('Language') }) }), lang ? (_jsx(DropdownMenuSubContent, { minW: 220, maxW: "calc(100vw - 16px)", pointerEvents: "auto", children: locales
223
+ }, cursor: "pointer", children: t('Upgrade plan') })) : null, _jsx(ChevronsUpDown, { size: 14, "aria-hidden": true, opacity: 0.6 })] }))] }) }), _jsxs(DropdownMenuContent, { minW: 260, maxW: "calc(100vw - 16px)", "aria-labelledby": undefined, "aria-label": t('Account'), onCloseAutoFocus: back, children: [_jsxs(DropdownMenuSub, { open: account, onOpenChange: setAccount, children: [_jsxs(DropdownMenuSubTrigger, { minH: 48, gap: "$2.5", children: [_jsx(Face, { host: host, size: 28 }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: who }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: host.person.email || working })] })] }), account ? (_jsxs(DropdownMenuSubContent, { minW: 260, maxW: "calc(100vw - 16px)", pointerEvents: "auto", children: [_jsx(Meter, { read: read, onPlans: () => leave('here'), onBilling: () => (setOpen(false), showSettings('billing')) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: t('Organizations') }), all.map((o) => (_jsx(DropdownMenuItem, { onSelect: () => o.name !== current && onOrg(o.name), children: _jsx(Line, { icon: _jsx(Mark, { org: o }), sub: [o.personal ? t('Personal') : said(o.role, t), planFor(o) || (isFree && o.personal ? t('Free') : '')].filter(Boolean).join(' - '), trail: o.name === current ? _jsx(Check, { size: 16, "aria-label": t('Current') }) : null, children: o.display }) }, o.name))), _jsx(DropdownMenuItem, { onSelect: () => setCreating(true), children: _jsx(Line, { icon: _jsx(Plus, { size: 16, "aria-hidden": true }), children: t('Create organization') }) }), _jsx(DropdownMenuItem, { onSelect: () => out(site(settings('organization'))), children: _jsx(Line, { icon: _jsx(Settings, { size: 16, "aria-hidden": true }), children: t('Organization settings') }) }), where().team ? null : here && !here.personal ? (_jsx(DropdownMenuItem, { onSelect: () => out(`${ENTRY}&org=${encodeURIComponent(here.name)}`), children: _jsx(Line, { icon: _jsx(Users, { size: 16, "aria-hidden": true }), trail: _jsx(ArrowUpRight, { size: 14, "aria-hidden": true, opacity: 0.6 }), children: t('Open in Hanzo Team') }) })) : (_jsx(DropdownMenuItem, { onSelect: () => setCreating(true), children: _jsx(Line, { icon: _jsx(Users, { size: 16, "aria-hidden": true }), children: t('Create a team') }) })), superAdmin() ? (_jsx(DropdownMenuItem, { onSelect: choose, children: _jsx(Line, { icon: _jsx(Building2, { size: 16, "aria-hidden": true }), children: t('All organizations') }) })) : null] })) : null] }), team ? (_jsx(DropdownMenuItem, { "data-slot": "me-team", onSelect: () => team.name !== current && onOrg(team.name), children: _jsx(Line, { icon: _jsx(Mark, { org: team }), trail: team.name === current ? _jsx(Check, { size: 16, "aria-label": t('Current') }) : null, children: t('{org} · {plan}', { org: team.display, plan: teamPlan || t('No plan') }) }) })) : null, personal ? (_jsx(DropdownMenuItem, { "data-slot": "me-personal", onSelect: () => personal.name !== current && onOrg(personal.name), actionsVisibility: "always", actions: ownPlan ? undefined : (_jsx(Button, { size: "xs", variant: "outline", onPress: getPro, children: t('Upgrade plan') })), children: _jsx(Line, { icon: _jsx(CircleUserRound, { size: 16, "aria-hidden": true }), trail: personal.name === current ? _jsx(Check, { size: 16, "aria-label": t('Current') }) : null, children: t('Personal · {plan}', { plan: ownPlan || t('No plan') }) }) })) : null, _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onSelect: () => leave('here'), children: _jsx(Line, { icon: _jsx(Sparkles, { size: 16, "aria-hidden": true }), children: t(plans) }) }), _jsx(DropdownMenuItem, { onSelect: () => showSettings('general'), children: _jsx(Line, { icon: _jsx(Palette, { size: 16, "aria-hidden": true }), children: t('Personalization') }) }), _jsx(DropdownMenuItem, { onSelect: () => showSettings('account'), children: _jsx(Line, { icon: _jsx(CircleUserRound, { size: 16, "aria-hidden": true }), children: t('Profile') }) }), _jsx(DropdownMenuItem, { "aria-keyshortcuts": "Control+, Meta+,", onSelect: () => showSettings('general'), children: _jsx(Line, { icon: _jsx(Settings, { size: 16, "aria-hidden": true }), trail: _jsx(DropdownMenuShortcut, { "aria-hidden": true, children: _jsx("bdi", { dir: "ltr", children: apple ? '⌘,' : 'Ctrl+,' }) }), children: t('Settings') }) }), _jsx(DropdownMenuItem, { onSelect: () => window.location.assign(site('/beta')), children: _jsx(Line, { icon: _jsx(FlaskConical, { size: 16, "aria-hidden": true }), children: t('Beta') }) }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuSub, { open: lang, onOpenChange: setLang, children: [_jsx(DropdownMenuSubTrigger, { children: _jsx(Line, { icon: _jsx(Languages, { size: 16, "aria-hidden": true }), children: t('Language') }) }), lang ? (_jsx(DropdownMenuSubContent, { minW: 220, maxW: "calc(100vw - 16px)", pointerEvents: "auto", children: locales
224
224
  .filter((l) => !l.review || l.code === locale)
225
225
  .map((l) => (_jsx(DropdownMenuItem, { onSelect: () => void setLocale(l.code), children: _jsx(Line, { sub: l.englishName !== l.name ? l.englishName : undefined, trail: l.code === locale ? _jsx(Check, { size: 16, "aria-label": t('Current') }) : null, children: l.name }) }, l.code))) })) : null] }), _jsxs(DropdownMenuSub, { open: help, onOpenChange: setHelp, children: [_jsx(DropdownMenuSubTrigger, { children: _jsx(Line, { icon: _jsx(LifeBuoy, { size: 16, "aria-hidden": true }), children: t('Help') }) }), help ? (_jsxs(DropdownMenuSubContent, { minW: 240, maxW: "calc(100vw - 16px)", pointerEvents: "auto", children: [pages().map((p) => (_jsx(DropdownMenuItem, { onSelect: () => out(p.href), children: _jsx(Line, { icon: ICONS[p.key], trail: p.key === 'help' ? _jsx(ArrowUpRight, { size: 14, "aria-hidden": true, opacity: 0.6 }) : null, children: t(p.label) }) }, p.key))), _jsx(DropdownMenuItem, { "aria-keyshortcuts": "Control+/ Meta+/", onSelect: () => setKeys(true), children: _jsx(Line, { icon: _jsx(Keyboard, { size: 16, "aria-hidden": true }), trail: _jsx(DropdownMenuShortcut, { "aria-hidden": true, children: _jsx("bdi", { dir: "ltr", children: apple ? '⌘/' : 'Ctrl+/' }) }), children: t('Keyboard shortcuts') }) }), _jsx(DropdownMenuSeparator, {}), legal().map((p) => (_jsx(DropdownMenuItem, { onSelect: () => out(p.href), children: _jsx(Line, { icon: ICONS[p.key], children: t(p.label) }) }, p.key)))] })) : null] }), host.signOut ? (_jsx(DropdownMenuItem, { onSelect: () => host.signOut?.(), children: _jsx(Line, { icon: _jsx(LogOut, { size: 16, "aria-hidden": true, "data-i18n-mirror": true }), children: t('Log out') }) })) : null] })] }), _jsx(Create, { open: creating, onOpenChange: setCreating }), _jsx(Shortcuts, { open: keys, onOpenChange: setKeys, apple: apple })] }));
226
226
  }
package/dist/Rail.js CHANGED
@@ -109,7 +109,7 @@ export function Rail({ host, mode, at, open, toggle, rows = false, onChat, onDev
109
109
  { key: 'team', label: 'Team', icon: _jsx(Users, { size: 16, "aria-hidden": true }), onSelect: () => out(WORKSPACE) },
110
110
  ...granted.map((b) => ({ key: `beta-${b.id}`, label: b.name, icon: _jsx(Sparkles, { size: 16, "aria-hidden": true }), onSelect: () => out(b.href) })),
111
111
  { type: 'separator', key: 'betas-rule' },
112
- { key: 'betas', label: t('Betas'), icon: _jsx(FlaskConical, { size: 16, "aria-hidden": true }), onSelect: () => setBetas(true) },
112
+ { key: 'betas', label: t('Betas'), icon: _jsx(FlaskConical, { size: 16, "aria-hidden": true }), onSelect: () => window.location.assign('/beta') },
113
113
  { key: 'market', label: t('Explore on hanzo.market'), icon: _jsx(Compass, { size: 16, "aria-hidden": true }), onSelect: () => out('https://hanzo.market') },
114
114
  ]
115
115
  : []),
@@ -117,7 +117,7 @@ export function Rail({ host, mode, at, open, toggle, rows = false, onChat, onDev
117
117
  const betasDialog = _jsx(BetasDialog, { open: betas, onOpenChange: setBetas, go: out });
118
118
  if (rows)
119
119
  return (_jsxs(YStack, { "data-slot": "places", render: "nav", "aria-label": t('Products'), pt: "$2", shrink: 0, children: [_jsxs(YStack, { role: "list", gap: 2, children: [_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: "Studio", on: mode === 'studio', onPress: onStudio, "data-slot": "place-studio", icon: _jsx(WandSparkles, { size: 16, "aria-hidden": true }) }) }), _jsx(YStack, { role: "listitem", children: _jsx(Row, { label: "Tabs", on: mode === 'tabs', onPress: onTabs, "data-slot": "place-tabs", icon: _jsx(SquareTerminal, { size: 16, "aria-hidden": true }) }) }), _jsx(YStack, { role: "listitem", children: _jsx(DropdownMenu, { placement: "bottom-start", minWidth: 220, trigger: _jsx(Row, { label: t('More'), "data-slot": "place-more", "aria-haspopup": "menu", icon: _jsx(Ellipsis, { size: 16, "aria-hidden": true }) }), items: rest }) })] }), betasDialog] }));
120
- return (_jsxs(YStack, { "data-slot": "rail", render: "nav", "aria-label": t('Products'), width: RAIL, flex: 1, pt: 4, pb: 4, gap: 4, shrink: 0, items: "center", children: [toggle ? (_jsx(YStack, { pb: 4, children: _jsx(Toggle, { open: open, onPress: toggle }) })) : null, _jsx(Mark, { label: t('Chat'), on: mode === 'chat', onPress: onChat, "data-slot": "rail-chat", children: _jsx(MessageSquare, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Dev", on: mode === 'dev' && !here, onPress: onDev, "data-slot": "rail-dev", children: _jsx(Code2, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Studio", on: mode === 'studio', onPress: onStudio, "data-slot": "rail-studio", children: _jsx(WandSparkles, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Tabs", on: mode === 'tabs', onPress: onTabs, "data-slot": "rail-tabs", children: _jsx(SquareTerminal, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Library'), on: here === 'library', onPress: to(RAISED.library), "data-slot": "rail-library", children: _jsx(Library, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Scheduled tasks'), on: here === 'scheduled', onPress: to(RAISED.scheduled), "data-slot": "rail-scheduled", children: _jsx(Clock, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Customize'), on: here === 'customize', onPress: to(RAISED.customize), "data-slot": "rail-customize", children: _jsx(Puzzle, { size: 18, "aria-hidden": true }) }), betasDialog, rest.length ? (_jsx(DropdownMenu
120
+ return (_jsxs(YStack, { "data-slot": "rail", render: "nav", "aria-label": t('Products'), width: RAIL, flex: 1, pt: 4, pb: 4, gap: 4, shrink: 0, items: "center", children: [toggle ? (_jsx(YStack, { pb: 4, children: _jsx(Toggle, { open: open, onPress: toggle }) })) : null, _jsx(Mark, { label: t('Chat'), on: mode === 'chat', onPress: onChat, "data-slot": "rail-chat", children: _jsx(MessageSquare, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Dev", on: mode === 'dev' && !here, onPress: onDev, "data-slot": "rail-dev", children: _jsx(Code2, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Studio", on: mode === 'studio', onPress: onStudio, "data-slot": "rail-studio", children: _jsx(WandSparkles, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Tabs", on: mode === 'tabs', onPress: onTabs, "data-slot": "rail-tabs", children: _jsx(SquareTerminal, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Library'), on: here === 'library', onPress: to(RAISED.library), "data-slot": "rail-library", children: _jsx(Library, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Scheduled tasks'), on: here === 'scheduled', onPress: to(RAISED.scheduled), "data-slot": "rail-scheduled", children: _jsx(Clock, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Customize'), on: here === 'customize', onPress: to(RAISED.customize), "data-slot": "rail-customize", children: _jsx(Puzzle, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Betas'), on: false, onPress: () => window.location.assign('/beta'), "data-slot": "rail-betas", children: _jsx(FlaskConical, { size: 18, "aria-hidden": true }) }), betasDialog, rest.length ? (_jsx(DropdownMenu
121
121
  // Toward the content: right of the rail, left of it right to left.
122
122
  , {
123
123
  // Toward the content: right of the rail, left of it right to left.
@@ -125,7 +125,91 @@ function Account() {
125
125
  return (_jsxs(YStack, { gap: "$4", children: [_jsxs(XStack, { items: "center", gap: "$3", children: [_jsx(YStack, { width: 44, height: 44, rounded: 22, bg: "$borderColor", items: "center", justify: "center", children: _jsx(Text, { fontSize: "$3", color: "$ink", children: identity.initials }) }), _jsxs(YStack, { gap: "$1", flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$4", color: "$ink", children: identity.name }), identity.email ? _jsx(Text, { fontSize: "$2", color: "$soft", children: _jsx("bdi", { dir: "ltr", children: identity.email }) }) : null] })] }), _jsx(Separator, {}), _jsxs(YStack, { gap: "$2", children: [_jsx(Text, { fontSize: "$2", color: "$soft", children: t('Organizations') }), organizations.length === 0 ? (_jsx(Text, { fontSize: "$3", color: "$soft", children: t('You are not a member of an organization.') })) : (organizations.map((o) => {
126
126
  const here = o.name === currentOrgId;
127
127
  return (_jsx(Box, { render: _jsx("button", { type: "button" }), onClick: () => { pick(o.name); switchOrg(o.name); }, ...tap, children: _jsxs(XStack, { items: "center", justify: "space-between", py: "$2", width: "100%", gap: "$2", children: [_jsx(Text, { fontSize: "$3", color: here ? '$ink' : '$soft', children: o.displayName || o.name }), here && currentRole ? _jsx(Text, { fontSize: "$2", color: "$soft", children: currentRole }) : null] }) }, o.name));
128
- }))] }), _jsx(Separator, {}), _jsx(XStack, { children: _jsx(Button, { size: "sm", onClick: () => logout(), children: t('Sign out') }) })] }));
128
+ }))] }), _jsx(Separator, {}), _jsx(WalletPayouts, {}), _jsx(Separator, {}), _jsx(XStack, { children: _jsx(Button, { size: "sm", onClick: () => logout(), children: t('Sign out') }) })] }));
129
+ }
130
+ /** Real Web3 Wallet Connect & Payout Address for collecting referral & compute rewards. */
131
+ function WalletPayouts() {
132
+ const { t } = useI18n();
133
+ const [address, setAddress] = useState(() => {
134
+ try {
135
+ return typeof window !== 'undefined' ? (window.localStorage.getItem('hanzo.wallet.address') ?? '') : '';
136
+ }
137
+ catch {
138
+ return '';
139
+ }
140
+ });
141
+ const [busy, setBusy] = useState(false);
142
+ const [saved, setSaved] = useState(false);
143
+ const [error, setError] = useState('');
144
+ const persist = async (addr, provider) => {
145
+ const clean = addr.trim();
146
+ setAddress(clean);
147
+ try {
148
+ if (clean)
149
+ window.localStorage.setItem('hanzo.wallet.address', clean);
150
+ else
151
+ window.localStorage.removeItem('hanzo.wallet.address');
152
+ }
153
+ catch { }
154
+ const tok = bearer();
155
+ if (tok && clean) {
156
+ await fetch(`${api()}/v1/preferences`, {
157
+ method: 'PUT',
158
+ headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${tok}` },
159
+ body: JSON.stringify({
160
+ preferences: {
161
+ rewards_payout_wallet: clean,
162
+ rewards_payout_provider: provider,
163
+ },
164
+ }),
165
+ }).catch(() => { });
166
+ }
167
+ setSaved(true);
168
+ setTimeout(() => setSaved(false), 2400);
169
+ };
170
+ const connectEvm = async () => {
171
+ setError('');
172
+ setBusy(true);
173
+ try {
174
+ const eth = typeof window !== 'undefined' ? window.ethereum : undefined;
175
+ if (!eth?.request) {
176
+ setError(t('No EVM browser wallet detected. Install MetaMask, Coinbase Wallet, or Brave Wallet, or paste your payout address below.'));
177
+ return;
178
+ }
179
+ const accounts = await eth.request({ method: 'eth_requestAccounts' });
180
+ const first = accounts?.[0];
181
+ if (first)
182
+ await persist(first, 'evm');
183
+ }
184
+ catch (e) {
185
+ setError(e instanceof Error ? e.message : t('Wallet connection cancelled.'));
186
+ }
187
+ finally {
188
+ setBusy(false);
189
+ }
190
+ };
191
+ const connectSolana = async () => {
192
+ setError('');
193
+ setBusy(true);
194
+ try {
195
+ const sol = typeof window !== 'undefined' ? window.solana : undefined;
196
+ if (!sol?.connect) {
197
+ setError(t('No Solana wallet detected. Install Phantom or Backpack, or paste your payout address below.'));
198
+ return;
199
+ }
200
+ const resp = await sol.connect();
201
+ const pub = resp?.publicKey?.toString();
202
+ if (pub)
203
+ await persist(pub, 'solana');
204
+ }
205
+ catch (e) {
206
+ setError(e instanceof Error ? e.message : t('Wallet connection cancelled.'));
207
+ }
208
+ finally {
209
+ setBusy(false);
210
+ }
211
+ };
212
+ return (_jsxs(YStack, { gap: "$2.5", "data-slot": "wallet-payouts", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Web3 Wallet & Rewards Payouts') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Connect your Web3 wallet (MetaMask, EVM / Base, or Solana) or enter a payout address to collect referral rewards, affiliate commissions, and AI compute rebates.') }), _jsxs(XStack, { gap: "$2", flexWrap: "wrap", children: [_jsx(Button, { size: "sm", variant: "outline", disabled: busy, onClick: () => void connectEvm(), children: t('Connect EVM / MetaMask') }), _jsx(Button, { size: "sm", variant: "outline", disabled: busy, onClick: () => void connectSolana(), children: t('Connect Solana Wallet') })] }), _jsxs(XStack, { gap: "$2", items: "center", children: [_jsx(Input, { flex: 1, size: "sm", placeholder: t('0x... (EVM / Base) or Solana payout address'), value: address, onChange: (e) => setAddress(e.target.value) }), _jsx(Button, { size: "sm", onClick: () => void persist(address, 'manual'), children: saved ? t('Saved!') : t('Save Payout Wallet') })] }), error ? _jsx(Text, { fontSize: "$1", color: "$soft", children: error }) : null] }));
129
213
  }
130
214
  /** Referrals & Rewards — customer referral program and affiliate partner portal. */
131
215
  function Referrals() {
@@ -158,7 +242,7 @@ function Referrals() {
158
242
  const whatsapp = () => {
159
243
  window.open(`https://api.whatsapp.com/send?text=${encodeURIComponent('Deploy with Hanzo — get $20 in free cloud credits: ' + referralUrl)}`, '_blank', 'noopener,noreferrer');
160
244
  };
161
- return (_jsxs(YStack, { gap: "$5", maxW: 640, children: [_jsxs(YStack, { gap: "$1.5", children: [_jsx(XStack, { items: "center", gap: "$2", children: _jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Give $20, Get 20%') }) }), _jsx(Text, { fontSize: "$3", color: "$soft", children: t('Invite developers, creators, and colleagues to Hanzo. They get $20 in free cloud compute credits, and you earn 20% recurring revenue share on their compute spend for 12 months.') })] }), _jsxs(YStack, { gap: "$2", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: t('Your Personal Referral Link') }), _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Box, { flex: 1, p: "$2", rounded: "$2", bg: "$hover", borderWidth: 1, borderColor: "$borderColor", children: _jsx(Text, { fontSize: "$2", color: "$ink", fontFamily: "$mono", numberOfLines: 1, children: referralUrl }) }), _jsx(Button, { size: "sm", onClick: copy, children: copied ? t('Copied!') : t('Copy Link') })] }), _jsxs(XStack, { items: "center", justify: "space-between", pt: "$2", flexWrap: "wrap", gap: "$2", children: [_jsx(Text, { fontSize: "$1", color: "$soft", children: t('1-Click Social Share:') }), _jsxs(XStack, { gap: "$2", flexWrap: "wrap", children: [_jsx(Button, { size: "sm", variant: "outline", onClick: tweet, children: "\uD835\uDD4F (Twitter)" }), _jsx(Button, { size: "sm", variant: "outline", onClick: linkedin, children: "LinkedIn" }), _jsx(Button, { size: "sm", variant: "outline", onClick: telegram, children: "Telegram" }), _jsx(Button, { size: "sm", variant: "outline", onClick: whatsapp, children: "WhatsApp" })] })] })] }), _jsx(Separator, {}), _jsxs(YStack, { gap: "$2", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Referral Rules & Offer Details') }), _jsxs(YStack, { gap: "$1", children: [_jsxs(Text, { fontSize: "$2", color: "$soft", children: ["\u2022 ", t('30-day attribution window: First click binds to user identity upon registration.')] }), _jsxs(Text, { fontSize: "$2", color: "$soft", children: ["\u2022 ", t('20% recurring margin share: Calculated against net platform margin (safe from wholesale token dilution).')] }), _jsxs(Text, { fontSize: "$2", color: "$soft", children: ["\u2022 ", t('Payout options: Platform credits, direct wire/ACH, or on-chain EVM wallet settlement.')] })] })] }), _jsx(Separator, {}), _jsxs(YStack, { gap: "$3", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Official Affiliate & Creator Program') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Building an open-source project, template, or dev community? Apply for official affiliate status for custom vanity links (hanzo.ai/?aff=code) and elevated commission tiers.') }), !applied ? (_jsxs(XStack, { gap: "$2", children: [_jsx(Input, { flex: 1, size: "sm", placeholder: t('Desired vanity code (e.g. your project)'), value: vanity, onChange: (e) => setVanity(e.target.value) }), _jsx(Button, { size: "sm", onClick: () => { if (vanity.trim())
245
+ return (_jsxs(YStack, { gap: "$5", maxW: 640, children: [_jsxs(YStack, { gap: "$1.5", children: [_jsx(XStack, { items: "center", gap: "$2", children: _jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Give $20, Get 20%') }) }), _jsx(Text, { fontSize: "$3", color: "$soft", children: t('Invite developers, creators, and colleagues to Hanzo. They get $20 in free cloud compute credits, and you earn 20% recurring revenue share on their compute spend for 12 months.') })] }), _jsxs(YStack, { gap: "$2", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: t('Your Personal Referral Link') }), _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Box, { flex: 1, p: "$2", rounded: "$2", bg: "$hover", borderWidth: 1, borderColor: "$borderColor", children: _jsx(Text, { fontSize: "$2", color: "$ink", fontFamily: "$mono", numberOfLines: 1, children: referralUrl }) }), _jsx(Button, { size: "sm", onClick: copy, children: copied ? t('Copied!') : t('Copy Link') })] }), _jsxs(XStack, { items: "center", justify: "space-between", pt: "$2", flexWrap: "wrap", gap: "$2", children: [_jsx(Text, { fontSize: "$1", color: "$soft", children: t('1-Click Social Share:') }), _jsxs(XStack, { gap: "$2", flexWrap: "wrap", children: [_jsx(Button, { size: "sm", variant: "outline", onClick: tweet, children: "\uD835\uDD4F (Twitter)" }), _jsx(Button, { size: "sm", variant: "outline", onClick: linkedin, children: "LinkedIn" }), _jsx(Button, { size: "sm", variant: "outline", onClick: telegram, children: "Telegram" }), _jsx(Button, { size: "sm", variant: "outline", onClick: whatsapp, children: "WhatsApp" })] })] })] }), _jsx(Separator, {}), _jsx(WalletPayouts, {}), _jsx(Separator, {}), _jsxs(YStack, { gap: "$2", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Referral Rules & Offer Details') }), _jsxs(YStack, { gap: "$1", children: [_jsxs(Text, { fontSize: "$2", color: "$soft", children: ["\u2022 ", t('30-day attribution window: First click binds to user identity upon registration.')] }), _jsxs(Text, { fontSize: "$2", color: "$soft", children: ["\u2022 ", t('20% recurring margin share: Calculated against net platform margin (safe from wholesale token dilution).')] }), _jsxs(Text, { fontSize: "$2", color: "$soft", children: ["\u2022 ", t('Payout options: Platform credits, direct wire/ACH, or on-chain EVM wallet settlement.')] })] })] }), _jsx(Separator, {}), _jsxs(YStack, { gap: "$3", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Official Affiliate & Creator Program') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Building an open-source project, template, or dev community? Apply for official affiliate status for custom vanity links (hanzo.ai/?aff=code) and elevated commission tiers.') }), !applied ? (_jsxs(XStack, { gap: "$2", children: [_jsx(Input, { flex: 1, size: "sm", placeholder: t('Desired vanity code (e.g. your project)'), value: vanity, onChange: (e) => setVanity(e.target.value) }), _jsx(Button, { size: "sm", onClick: () => { if (vanity.trim())
162
246
  setApplied(true); }, children: t('Apply for Partner') })] })) : (_jsx(Box, { p: "$3", rounded: "$2", bg: "$hover", children: _jsx(Text, { fontSize: "$2", color: "$ink", children: t('Application submitted for review. Manage payouts and advanced settings in platform.hanzo.ai/dashboard/settings/referrals') }) })), _jsx(XStack, { pt: "$1", children: _jsx(Box, { render: _jsx("a", { href: "https://platform.hanzo.ai/dashboard/settings/referrals", target: "_blank", rel: "noreferrer" }), ...tap, children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(Text, { fontSize: "$2", color: "$ink", children: t('Open Full Referrals & Affiliate Portal') }), _jsx(ArrowUpRight, { size: 13, "aria-hidden": true })] }) }) })] })] }));
163
247
  }
164
248
  /** Where the plan's and billing's reads go: this browser's bearer, in its organization. */
package/dist/Setup.js CHANGED
@@ -1,17 +1,17 @@
1
1
  'use client';
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- // The 1-2-3 in-app onboarding: Connect GitHub, Connect Slack, Connect Wallet.
3
+ // The 1-2-3 in-app onboarding: Connect GitHub, Connect Slack, Connect Google (Gmail, Calendar & Drive).
4
4
  // Runs INSIDE the app as a compact card in the sidebar column and as an interactive
5
5
  // popup modal dialog. Never a full-screen redirect away from the user's workspace.
6
6
  //
7
7
  // 1. GitHub: Sync repositories, PRs, and team repository context
8
8
  // 2. Slack: Route notifications, agent conversations, and bot alerts
9
- // 3. Wallet: Web3 multi-chain wallet (MetaMask/EVM/Base/Solana) for credits & payouts
9
+ // 3. Google: Connect Gmail, Calendar & Drive so agents can read files, draft emails & manage schedules
10
10
  import { useEffect, useState } from 'react';
11
11
  import { useI18n } from '@hanzo/i18n/react';
12
- import { Box, Dialog, DialogContent, DialogTitle, Input, SizableText, Text, XStack, YStack } from '@hanzo/ui';
12
+ import { Box, Dialog, DialogContent, DialogTitle, SizableText, Text, XStack, YStack } from '@hanzo/ui';
13
13
  import { useIam } from '@hanzo/iam/react';
14
- import { Check, Maximize2, Sparkles, Wallet, X } from 'lucide-react';
14
+ import { Check, Maximize2, Sparkles, X } from 'lucide-react';
15
15
  import { ProviderMark } from './ProviderMark.js';
16
16
  import { useKept } from './kept.js';
17
17
  import { api } from './lib/api.js';
@@ -22,7 +22,7 @@ import { GOOD } from './lib/mix.js';
22
22
  const LATER_KEY = 'hanzo.onboarding.later';
23
23
  const GITHUB_KEY = 'hanzo.onboarding.github';
24
24
  const SLACK_KEY = 'hanzo.onboarding.slack';
25
- const WALLET_KEY = 'hanzo.onboarding.wallet';
25
+ const GOOGLE_KEY = 'hanzo.onboarding.google';
26
26
  const STEP_KEY = 'hanzo.onboarding.step';
27
27
  /** Inline Slack Mark */
28
28
  function SlackMark({ size = 18 }) {
@@ -35,12 +35,9 @@ export function Setup() {
35
35
  const [step, setStep] = useKept(STEP_KEY, 1);
36
36
  const [githubDone, setGithubDone] = useKept(GITHUB_KEY, false);
37
37
  const [slackDone, setSlackDone] = useKept(SLACK_KEY, false);
38
- const [walletDone, setWalletDone] = useKept(WALLET_KEY, false);
39
- const [walletAddr, setWalletAddr] = useKept('hanzo.onboarding.wallet.addr', '');
38
+ const [googleDone, setGoogleDone] = useKept(GOOGLE_KEY, false);
40
39
  const [busy, setBusy] = useState(null);
41
40
  const [modalOpen, setModalOpen] = useState(false);
42
- const [manualWallet, setManualWallet] = useState('');
43
- const [showWalletInput, setShowWalletInput] = useState(false);
44
41
  const [errorMsg, setErrorMsg] = useState(null);
45
42
  const signed = isAuthenticated && Boolean(accessToken);
46
43
  // Sync with remote connectors when authenticated
@@ -59,33 +56,23 @@ export function Setup() {
59
56
  setGithubDone(true);
60
57
  if (set.has('slack'))
61
58
  setSlackDone(true);
62
- })
63
- .catch(() => { });
64
- fetch(`${api()}/v1/iam/preferences`, { method: 'POST', headers: auth, body: '{}' })
65
- .then((r) => (r.ok ? r.json() : null))
66
- .then((pref) => {
67
- if (!live || !pref)
68
- return;
69
- const w = pref?.onboarding?.wallet ?? pref?.wallet;
70
- if (typeof w === 'string' && w.trim()) {
71
- setWalletDone(true);
72
- setWalletAddr(w.trim());
73
- }
59
+ if (set.has('google') || set.has('gmail') || set.has('google-drive') || set.has('google-calendar'))
60
+ setGoogleDone(true);
74
61
  })
75
62
  .catch(() => { });
76
63
  return () => {
77
64
  live = false;
78
65
  };
79
66
  }, [signed]);
80
- const totalDone = (githubDone ? 1 : 0) + (slackDone ? 1 : 0) + (walletDone ? 1 : 0);
67
+ const totalDone = (githubDone ? 1 : 0) + (slackDone ? 1 : 0) + (googleDone ? 1 : 0);
81
68
  const allDone = totalDone === 3;
82
69
  // Automatically advance step if current step is already done
83
70
  useEffect(() => {
84
71
  if (step === 1 && githubDone)
85
- setStep(slackDone ? (walletDone ? 3 : 3) : 2);
72
+ setStep(slackDone ? 3 : 2);
86
73
  else if (step === 2 && slackDone)
87
- setStep(walletDone ? 3 : 3);
88
- }, [githubDone, slackDone, walletDone, step]);
74
+ setStep(3);
75
+ }, [githubDone, slackDone, googleDone, step]);
89
76
  if (later && !modalOpen)
90
77
  return null;
91
78
  // 1. Connect GitHub
@@ -162,46 +149,38 @@ export function Setup() {
162
149
  setBusy(null);
163
150
  }
164
151
  };
165
- // 3. Connect Wallet
166
- const saveWalletAddress = async (addr) => {
167
- const clean = addr.trim();
168
- if (!clean)
152
+ // 3. Connect Google (Gmail, Calendar & Drive)
153
+ const handleConnectGoogle = async () => {
154
+ if (!signed) {
155
+ enter();
169
156
  return;
170
- setWalletAddr(clean);
171
- setWalletDone(true);
172
- setShowWalletInput(false);
173
- if (signed) {
174
- fetch(`${api()}/v1/iam/preferences`, {
175
- method: 'POST',
176
- headers: { ...scope(), 'Content-Type': 'application/json' },
177
- body: JSON.stringify({ onboarding: { wallet: clean } }),
178
- }).catch(() => { });
179
157
  }
180
- };
181
- const handleConnectWalletWeb3 = async () => {
158
+ setBusy('google');
182
159
  setErrorMsg(null);
183
- if (typeof window !== 'undefined' && window.ethereum) {
184
- setBusy('wallet');
185
- try {
186
- const eth = window.ethereum;
187
- const accounts = await eth.request({ method: 'eth_requestAccounts' });
188
- if (accounts && accounts[0]) {
189
- await saveWalletAddress(accounts[0]);
160
+ try {
161
+ const res = await fetch(`${api()}/v1/integrations/google/connect`, {
162
+ method: 'POST',
163
+ headers: { ...scope(), 'Content-Type': 'application/json' },
164
+ body: '{}',
165
+ });
166
+ if (res.ok) {
167
+ const j = (await res.json());
168
+ if (j.authorizeUrl) {
169
+ window.open(j.authorizeUrl, 'hanzo-oauth-google', 'width=600,height=700');
190
170
  }
191
171
  }
192
- catch (err) {
193
- const msg = err instanceof Error ? err.message : String(err);
194
- setErrorMsg(msg);
195
- setShowWalletInput(true);
196
- }
197
- finally {
198
- setBusy(null);
172
+ else {
173
+ const fallback = `${api()}/v1/channels/google/oauth/authorize?redirect_uri=${encodeURIComponent(window.location.origin + '/inbox')}`;
174
+ window.open(fallback, 'hanzo-oauth-google', 'width=600,height=700');
199
175
  }
176
+ setGoogleDone(true);
177
+ }
178
+ catch {
179
+ setGoogleDone(true);
200
180
  }
201
- else {
202
- setShowWalletInput(true);
181
+ finally {
182
+ setBusy(null);
203
183
  }
204
184
  };
205
- const truncate = (s) => (s.length > 12 ? `${s.slice(0, 6)}…${s.slice(-4)}` : s);
206
- return (_jsxs(_Fragment, { children: [_jsxs(YStack, { "data-slot": "setup", role: "region", "aria-label": t('Onboarding (1-2-3)'), gap: "$2.5", p: "$3", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$raised", width: "100%", children: [_jsxs(XStack, { items: "center", justify: "space-between", children: [_jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(Sparkles, { size: 15, color: "var(--primary)", "aria-hidden": true }), _jsx(SizableText, { size: "$2", fontWeight: "600", color: "$ink", children: allDone ? t('Onboarding complete') : t('Quick setup ({n}/3)', { n: totalDone }) })] }), _jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(Box, { render: "button", "aria-label": t('Expand onboarding popup'), onClick: () => setModalOpen(true), p: "$1", rounded: 999, hoverStyle: { bg: '$hover' }, cursor: "pointer", children: _jsx(Maximize2, { size: 13, "aria-hidden": true, color: "$soft" }) }), _jsx(Box, { render: "button", "aria-label": t('Dismiss'), onClick: () => setLater(true), p: "$1", rounded: 999, hoverStyle: { bg: '$hover' }, cursor: "pointer", children: _jsx(X, { size: 13, "aria-hidden": true, color: "$soft" }) })] })] }), _jsxs(XStack, { gap: "$1", width: "100%", children: [_jsx(Box, { flex: 1, height: 4, rounded: 2, bg: githubDone ? GOOD : step === 1 ? '$ink' : '$edge' }), _jsx(Box, { flex: 1, height: 4, rounded: 2, bg: slackDone ? GOOD : step === 2 ? '$ink' : '$edge' }), _jsx(Box, { flex: 1, height: 4, rounded: 2, bg: walletDone ? GOOD : step === 3 ? '$ink' : '$edge' })] }), allDone ? (_jsxs(YStack, { gap: "$2", pt: "$1", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Check, { size: 16, color: GOOD, "aria-hidden": true }), _jsx(Text, { fontSize: "$2", color: "$ink", fontWeight: "500", children: t('GitHub, Slack & Wallet connected') })] }), _jsx(Box, { render: "button", onClick: () => setLater(true), p: "$1.5", rounded: "$3", bg: "$edge", hoverStyle: { bg: '$hover' }, items: "center", justify: "center", cursor: "pointer", children: _jsx(Text, { fontSize: "$2", fontWeight: "500", children: t('Done') }) })] })) : step === 1 ? (_jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { items: "center", justify: "space-between", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(ProviderMark, { org: "github", size: 18 }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: t('1. Connect GitHub') })] }), githubDone ? (_jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(Check, { size: 12, color: GOOD }), _jsx(Text, { fontSize: "$1", color: GOOD, fontWeight: "600", children: t('Connected') })] })) : null] }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Sync repositories, PRs, and team repository context.') }), _jsxs(XStack, { gap: "$1.5", items: "center", pt: "$1", children: [_jsx(Box, { render: "button", onClick: handleConnectGithub, "aria-disabled": busy === 'github', px: "$2.5", py: "$1", rounded: "$3", bg: "var(--accent)", hoverStyle: { bg: 'var(--accent-hover)' }, cursor: "pointer", opacity: busy === 'github' ? 0.6 : 1, children: _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "var(--accent-foreground)", children: busy === 'github' ? t('Connecting…') : githubDone ? t('Reconnect') : t('Connect GitHub') }) }), _jsx(Box, { render: "button", onClick: () => setStep(2), px: "$2", py: "$1", rounded: "$3", bg: "transparent", hoverStyle: { bg: '$hover' }, cursor: "pointer", children: _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Skip') }) })] })] })) : step === 2 ? (_jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { items: "center", justify: "space-between", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SlackMark, { size: 18 }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: t('2. Connect Slack') })] }), slackDone ? (_jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(Check, { size: 12, color: GOOD }), _jsx(Text, { fontSize: "$1", color: GOOD, fontWeight: "600", children: t('Connected') })] })) : null] }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Route agent notifications and chat in team channels.') }), _jsxs(XStack, { gap: "$1.5", items: "center", pt: "$1", children: [_jsx(Box, { render: "button", onClick: handleConnectSlack, "aria-disabled": busy === 'slack', px: "$2.5", py: "$1", rounded: "$3", bg: "var(--accent)", hoverStyle: { bg: 'var(--accent-hover)' }, cursor: "pointer", opacity: busy === 'slack' ? 0.6 : 1, children: _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "var(--accent-foreground)", children: busy === 'slack' ? t('Connecting…') : slackDone ? t('Reconnect') : t('Connect Slack') }) }), _jsx(Box, { render: "button", onClick: () => setStep(3), px: "$2", py: "$1", rounded: "$3", bg: "transparent", hoverStyle: { bg: '$hover' }, cursor: "pointer", children: _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Skip') }) })] })] })) : (_jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { items: "center", justify: "space-between", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Wallet, { size: 18, color: "var(--primary)" }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: t('3. Connect Wallet') })] }), walletDone ? (_jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(Check, { size: 12, color: GOOD }), _jsx(Text, { fontSize: "$1", color: GOOD, fontWeight: "600", children: walletAddr ? truncate(walletAddr) : t('Connected') })] })) : null] }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Link Web3 wallet for compute credits and rewards.') }), showWalletInput ? (_jsxs(XStack, { gap: "$1.5", items: "center", pt: "$1", children: [_jsx(Input, { value: manualWallet, onChangeText: setManualWallet, placeholder: "0x\u2026 or Solana/Base", height: 30, flex: 1, fontSize: "$1" }), _jsx(Box, { render: "button", onClick: () => void saveWalletAddress(manualWallet), px: "$2.5", py: "$1", rounded: "$3", bg: "var(--accent)", hoverStyle: { bg: 'var(--accent-hover)' }, cursor: "pointer", children: _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "var(--accent-foreground)", children: t('Save') }) })] })) : (_jsxs(XStack, { gap: "$1.5", items: "center", pt: "$1", flexWrap: "wrap", children: [_jsx(Box, { render: "button", onClick: handleConnectWalletWeb3, "aria-disabled": busy === 'wallet', px: "$2.5", py: "$1", rounded: "$3", bg: "var(--accent)", hoverStyle: { bg: 'var(--accent-hover)' }, cursor: "pointer", children: _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "var(--accent-foreground)", children: busy === 'wallet' ? t('Connecting…') : t('Connect Wallet') }) }), _jsx(Box, { render: "button", onClick: () => setShowWalletInput(true), px: "$2", py: "$1", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, cursor: "pointer", children: _jsx(Text, { fontSize: "$1", color: "$ink", children: t('Enter address') }) })] }))] })), errorMsg ? (_jsx(Text, { fontSize: "$1", color: "$red10", children: errorMsg })) : null] }), _jsx(Dialog, { open: modalOpen, onOpenChange: setModalOpen, children: _jsxs(DialogContent, { maxW: 520, rounded: "$6", gap: "$4", p: "$5", children: [_jsx(DialogTitle, { children: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Sparkles, { size: 20, color: "var(--primary)", "aria-hidden": true }), _jsx(Text, { fontSize: "$5", fontWeight: "600", color: "$ink", children: t('Set up {brand} in 3 steps', { brand: brand() }) })] }) }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Connect your essential developer tools and Web3 wallet directly inside {brand()}.', { brand: brand() }) }), _jsxs(YStack, { gap: "$3", children: [_jsxs(XStack, { p: "$3", rounded: "$4", borderWidth: 1, borderColor: githubDone ? GOOD : '$borderColor', bg: "$raised", items: "center", justify: "space-between", gap: "$3", children: [_jsxs(XStack, { items: "center", gap: "$3", flex: 1, children: [_jsx(ProviderMark, { org: "github", size: 24 }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('1. GitHub') }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Sync repositories, PRs, and code context') })] })] }), githubDone ? (_jsxs(XStack, { items: "center", gap: "$1", px: "$2", py: "$1", rounded: "$2", bg: "$hover", children: [_jsx(Check, { size: 14, color: GOOD }), _jsx(Text, { fontSize: "$1", color: GOOD, fontWeight: "600", children: t('Connected') })] })) : (_jsx(Box, { render: "button", onClick: handleConnectGithub, px: "$3", py: "$1.5", rounded: "$3", bg: "var(--accent)", hoverStyle: { bg: 'var(--accent-hover)' }, cursor: "pointer", children: _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "var(--accent-foreground)", children: busy === 'github' ? t('Connecting…') : t('Connect') }) }))] }), _jsxs(XStack, { p: "$3", rounded: "$4", borderWidth: 1, borderColor: slackDone ? GOOD : '$borderColor', bg: "$raised", items: "center", justify: "space-between", gap: "$3", children: [_jsxs(XStack, { items: "center", gap: "$3", flex: 1, children: [_jsx(SlackMark, { size: 24 }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('2. Slack') }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Notifications and agent bot chat in channels') })] })] }), slackDone ? (_jsxs(XStack, { items: "center", gap: "$1", px: "$2", py: "$1", rounded: "$2", bg: "$hover", children: [_jsx(Check, { size: 14, color: GOOD }), _jsx(Text, { fontSize: "$1", color: GOOD, fontWeight: "600", children: t('Connected') })] })) : (_jsx(Box, { render: "button", onClick: handleConnectSlack, px: "$3", py: "$1.5", rounded: "$3", bg: "var(--accent)", hoverStyle: { bg: 'var(--accent-hover)' }, cursor: "pointer", children: _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "var(--accent-foreground)", children: busy === 'slack' ? t('Connecting…') : t('Connect') }) }))] }), _jsxs(XStack, { p: "$3", rounded: "$4", borderWidth: 1, borderColor: walletDone ? GOOD : '$borderColor', bg: "$raised", items: "center", justify: "space-between", gap: "$3", children: [_jsxs(XStack, { items: "center", gap: "$3", flex: 1, children: [_jsx(Wallet, { size: 24, color: "var(--primary)" }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('3. Web3 Wallet') }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('On-chain identity, compute credits, and rewards') })] })] }), walletDone ? (_jsxs(XStack, { items: "center", gap: "$1", px: "$2", py: "$1", rounded: "$2", bg: "$hover", children: [_jsx(Check, { size: 14, color: GOOD }), _jsx(Text, { fontSize: "$1", color: GOOD, fontWeight: "600", children: walletAddr ? truncate(walletAddr) : t('Connected') })] })) : (_jsx(Box, { render: "button", onClick: handleConnectWalletWeb3, px: "$3", py: "$1.5", rounded: "$3", bg: "var(--accent)", hoverStyle: { bg: 'var(--accent-hover)' }, cursor: "pointer", children: _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "var(--accent-foreground)", children: busy === 'wallet' ? t('Connecting…') : t('Connect') }) }))] })] }), _jsx(XStack, { justify: "flex-end", pt: "$2", children: _jsx(Box, { render: "button", onClick: () => setModalOpen(false), px: "$4", py: "$2", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, cursor: "pointer", children: _jsx(Text, { fontSize: "$2", fontWeight: "500", color: "$ink", children: t('Close') }) }) })] }) })] }));
185
+ return (_jsxs(_Fragment, { children: [_jsxs(YStack, { "data-slot": "setup", role: "region", "aria-label": t('Onboarding (1-2-3)'), gap: "$2.5", p: "$3", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$raised", width: "100%", children: [_jsxs(XStack, { items: "center", justify: "space-between", children: [_jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(Sparkles, { size: 15, color: "var(--primary)", "aria-hidden": true }), _jsx(SizableText, { size: "$2", fontWeight: "600", color: "$ink", children: allDone ? t('Onboarding complete') : t('Quick setup ({n}/3)', { n: totalDone }) })] }), _jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(Box, { render: "button", "aria-label": t('Expand onboarding popup'), onClick: () => setModalOpen(true), p: "$1", rounded: 999, hoverStyle: { bg: '$hover' }, cursor: "pointer", children: _jsx(Maximize2, { size: 13, "aria-hidden": true, color: "$soft" }) }), _jsx(Box, { render: "button", "aria-label": t('Dismiss'), onClick: () => setLater(true), p: "$1", rounded: 999, hoverStyle: { bg: '$hover' }, cursor: "pointer", children: _jsx(X, { size: 13, "aria-hidden": true, color: "$soft" }) })] })] }), _jsxs(XStack, { gap: "$1", width: "100%", children: [_jsx(Box, { flex: 1, height: 4, rounded: 2, bg: githubDone ? GOOD : step === 1 ? '$ink' : '$edge' }), _jsx(Box, { flex: 1, height: 4, rounded: 2, bg: slackDone ? GOOD : step === 2 ? '$ink' : '$edge' }), _jsx(Box, { flex: 1, height: 4, rounded: 2, bg: googleDone ? GOOD : step === 3 ? '$ink' : '$edge' })] }), allDone ? (_jsxs(YStack, { gap: "$2", pt: "$1", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Check, { size: 16, color: GOOD, "aria-hidden": true }), _jsx(Text, { fontSize: "$2", color: "$ink", fontWeight: "500", children: t('GitHub, Slack & Google connected') })] }), _jsx(Box, { render: "button", onClick: () => setLater(true), p: "$1.5", rounded: "$3", bg: "$edge", hoverStyle: { bg: '$hover' }, items: "center", justify: "center", cursor: "pointer", children: _jsx(Text, { fontSize: "$2", fontWeight: "500", children: t('Done') }) })] })) : step === 1 ? (_jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { items: "center", justify: "space-between", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(ProviderMark, { org: "github", size: 18 }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: t('1. Connect GitHub') })] }), githubDone ? (_jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(Check, { size: 12, color: GOOD }), _jsx(Text, { fontSize: "$1", color: GOOD, fontWeight: "600", children: t('Connected') })] })) : null] }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Sync repositories, PRs, and team repository context.') }), _jsxs(XStack, { gap: "$1.5", items: "center", pt: "$1", children: [_jsx(Box, { render: "button", onClick: handleConnectGithub, "aria-disabled": busy === 'github', px: "$2.5", py: "$1", rounded: "$3", bg: "var(--accent)", hoverStyle: { bg: 'var(--accent-hover)' }, cursor: "pointer", opacity: busy === 'github' ? 0.6 : 1, children: _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "var(--accent-foreground)", children: busy === 'github' ? t('Connecting…') : githubDone ? t('Reconnect') : t('Connect GitHub') }) }), _jsx(Box, { render: "button", onClick: () => setStep(2), px: "$2", py: "$1", rounded: "$3", bg: "transparent", hoverStyle: { bg: '$hover' }, cursor: "pointer", children: _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Skip') }) })] })] })) : step === 2 ? (_jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { items: "center", justify: "space-between", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SlackMark, { size: 18 }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: t('2. Connect Slack') })] }), slackDone ? (_jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(Check, { size: 12, color: GOOD }), _jsx(Text, { fontSize: "$1", color: GOOD, fontWeight: "600", children: t('Connected') })] })) : null] }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Route agent notifications and chat in team channels.') }), _jsxs(XStack, { gap: "$1.5", items: "center", pt: "$1", children: [_jsx(Box, { render: "button", onClick: handleConnectSlack, "aria-disabled": busy === 'slack', px: "$2.5", py: "$1", rounded: "$3", bg: "var(--accent)", hoverStyle: { bg: 'var(--accent-hover)' }, cursor: "pointer", opacity: busy === 'slack' ? 0.6 : 1, children: _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "var(--accent-foreground)", children: busy === 'slack' ? t('Connecting…') : slackDone ? t('Reconnect') : t('Connect Slack') }) }), _jsx(Box, { render: "button", onClick: () => setStep(3), px: "$2", py: "$1", rounded: "$3", bg: "transparent", hoverStyle: { bg: '$hover' }, cursor: "pointer", children: _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Skip') }) })] })] })) : (_jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { items: "center", justify: "space-between", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(ProviderMark, { org: "google", size: 18 }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: t('3. Connect Google') })] }), googleDone ? (_jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(Check, { size: 12, color: GOOD }), _jsx(Text, { fontSize: "$1", color: GOOD, fontWeight: "600", children: t('Connected') })] })) : null] }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Sync Gmail, Calendar & Drive so Hanzo can read files, draft emails & schedule meetings.') }), _jsxs(XStack, { gap: "$1.5", items: "center", pt: "$1", flexWrap: "wrap", children: [_jsx(Box, { render: "button", onClick: handleConnectGoogle, "aria-disabled": busy === 'google', px: "$2.5", py: "$1", rounded: "$3", bg: "var(--accent)", hoverStyle: { bg: 'var(--accent-hover)' }, cursor: "pointer", opacity: busy === 'google' ? 0.6 : 1, children: _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "var(--accent-foreground)", children: busy === 'google' ? t('Connecting…') : googleDone ? t('Reconnect') : t('Connect Google') }) }), _jsx(Box, { render: "button", onClick: () => setLater(true), px: "$2", py: "$1", rounded: "$3", bg: "transparent", hoverStyle: { bg: '$hover' }, cursor: "pointer", children: _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Skip') }) })] })] })), errorMsg ? (_jsx(Text, { fontSize: "$1", color: "$red10", children: errorMsg })) : null] }), _jsx(Dialog, { open: modalOpen, onOpenChange: setModalOpen, children: _jsxs(DialogContent, { maxW: 520, rounded: "$6", gap: "$4", p: "$5", children: [_jsx(DialogTitle, { children: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Sparkles, { size: 20, color: "var(--primary)", "aria-hidden": true }), _jsx(Text, { fontSize: "$5", fontWeight: "600", color: "$ink", children: t('Set up {brand} in 3 steps', { brand: brand() }) })] }) }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Connect your code, team chat, and Google Workspace (Gmail, Calendar & Drive) directly inside {brand}.', { brand: brand() }) }), _jsxs(YStack, { gap: "$3", children: [_jsxs(XStack, { p: "$3", rounded: "$4", borderWidth: 1, borderColor: githubDone ? GOOD : '$borderColor', bg: "$raised", items: "center", justify: "space-between", gap: "$3", children: [_jsxs(XStack, { items: "center", gap: "$3", flex: 1, children: [_jsx(ProviderMark, { org: "github", size: 24 }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('1. GitHub') }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Sync repositories, PRs, and code context') })] })] }), githubDone ? (_jsxs(XStack, { items: "center", gap: "$1", px: "$2", py: "$1", rounded: "$2", bg: "$hover", children: [_jsx(Check, { size: 14, color: GOOD }), _jsx(Text, { fontSize: "$1", color: GOOD, fontWeight: "600", children: t('Connected') })] })) : (_jsx(Box, { render: "button", onClick: handleConnectGithub, px: "$3", py: "$1.5", rounded: "$3", bg: "var(--accent)", hoverStyle: { bg: 'var(--accent-hover)' }, cursor: "pointer", children: _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "var(--accent-foreground)", children: busy === 'github' ? t('Connecting…') : t('Connect') }) }))] }), _jsxs(XStack, { p: "$3", rounded: "$4", borderWidth: 1, borderColor: slackDone ? GOOD : '$borderColor', bg: "$raised", items: "center", justify: "space-between", gap: "$3", children: [_jsxs(XStack, { items: "center", gap: "$3", flex: 1, children: [_jsx(SlackMark, { size: 24 }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('2. Slack') }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Notifications and agent bot chat in channels') })] })] }), slackDone ? (_jsxs(XStack, { items: "center", gap: "$1", px: "$2", py: "$1", rounded: "$2", bg: "$hover", children: [_jsx(Check, { size: 14, color: GOOD }), _jsx(Text, { fontSize: "$1", color: GOOD, fontWeight: "600", children: t('Connected') })] })) : (_jsx(Box, { render: "button", onClick: handleConnectSlack, px: "$3", py: "$1.5", rounded: "$3", bg: "var(--accent)", hoverStyle: { bg: 'var(--accent-hover)' }, cursor: "pointer", children: _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "var(--accent-foreground)", children: busy === 'slack' ? t('Connecting…') : t('Connect') }) }))] }), _jsxs(XStack, { p: "$3", rounded: "$4", borderWidth: 1, borderColor: googleDone ? GOOD : '$borderColor', bg: "$raised", items: "center", justify: "space-between", gap: "$3", children: [_jsxs(XStack, { items: "center", gap: "$3", flex: 1, children: [_jsx(ProviderMark, { org: "google", size: 24 }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('3. Google Workspace (Gmail, Calendar & Drive)') }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Access Docs, Sheets, Slides, Drive files, Gmail & Calendar') })] })] }), googleDone ? (_jsxs(XStack, { items: "center", gap: "$1", px: "$2", py: "$1", rounded: "$2", bg: "$hover", children: [_jsx(Check, { size: 14, color: GOOD }), _jsx(Text, { fontSize: "$1", color: GOOD, fontWeight: "600", children: t('Connected') })] })) : (_jsx(Box, { render: "button", onClick: handleConnectGoogle, px: "$3", py: "$1.5", rounded: "$3", bg: "var(--accent)", hoverStyle: { bg: 'var(--accent-hover)' }, cursor: "pointer", children: _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "var(--accent-foreground)", children: busy === 'google' ? t('Connecting…') : t('Connect') }) }))] })] }), _jsx(XStack, { justify: "flex-end", pt: "$2", children: _jsx(Box, { render: "button", onClick: () => setModalOpen(false), px: "$4", py: "$2", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, cursor: "pointer", children: _jsx(Text, { fontSize: "$2", fontWeight: "500", color: "$ink", children: t('Close') }) }) })] }) })] }));
207
186
  }
package/dist/Shell.js CHANGED
@@ -80,6 +80,7 @@ import { tidy } from "./lib/title.js";
80
80
  import { summons } from "./seek.js";
81
81
  import { called } from "./team.js";
82
82
  import { checkoutUrl } from './lib/pay.js';
83
+ import { dragWindow, toggleWindowMaximize, WindowControls } from './WindowControls.js';
83
84
  /** Tabs: the terminals, at their own host. */
84
85
  const TABS = "https://tabs.hanzo.ai/app";
85
86
  /** Where a plan is chosen. `lib/plans` owns the address; this is the door. */
@@ -1258,9 +1259,9 @@ function Frame({ mode, children, navigate, back, forward, }) {
1258
1259
  // different things: this one narrows the list beside you, and the
1259
1260
  // bar above opens the palette that finds anything anywhere.
1260
1261
  placeholder: t("Filter"), "aria-label": t("Filter sidebar") }), flex: 1, minW: 0, bg: "transparent", borderWidth: 0, outlineStyle: "none", color: "inherit", fontSize: "$2" })] }) }), settingsPane ? (_jsx(SidebarScroll, { children: _jsx(SettingsList, { active: settingsPane, filter: filter, onPick: pick, onBack: () => showSettings(null) }) })) : (_jsx(_Fragment, { children: _jsx(SidebarScroll, { children: _jsxs(_Fragment, { children: [settled ? (_jsx(Index, { mode: mode, owner: owner, filter: filter, onPick: onPick, navigate: navigate })) : null, products.length ? (_jsx(SidebarFolder, { name: t("Cloud & Platform"), open: filter ? true : undefined, children: products.map((prod) => (_jsx(SidebarItem, { icon: _jsx(prod.icon, { size: 13, "aria-hidden": true }), onPress: () => window.open(prod.href, "_blank", "noopener"), children: t(prod.label) }, prod.id))) })) : null] }) }) })), settled && onApex ? _jsx(Leave, { href: signedIn ? ENTRY : WORKSPACE, children: t("Workspace") }) : null, settled ? (signedIn ? (_jsxs(_Fragment, { children: [free ? (_jsx(SidebarItem, { icon: _jsx(Sparkles, { size: 15, "aria-hidden": true, color: "var(--primary)" }), onPress: () => {
1261
- window.location.assign(payUrl("/cart", { plan: "pro", returnUrl: window.location.href }));
1262
+ window.location.assign(payUrl("/cart", { returnUrl: window.location.href }));
1262
1263
  dismiss();
1263
- }, children: t("Upgrade to Pro") })) : null, _jsx(SidebarItem, { icon: _jsx(UserPlus, { size: 15, "aria-hidden": true }), onPress: () => window.open(invite(), "_blank", "noopener"), children: t("Invite Teammates") }), _jsx(SidebarItem, { icon: _jsx(Share2, { size: 15, "aria-hidden": true }), onPress: () => {
1264
+ }, children: t("Upgrade plan") })) : null, _jsx(SidebarItem, { icon: _jsx(UserPlus, { size: 15, "aria-hidden": true }), onPress: () => window.open(invite(), "_blank", "noopener"), children: t("Invite Teammates") }), _jsx(SidebarItem, { icon: _jsx(Share2, { size: 15, "aria-hidden": true }), onPress: () => {
1264
1265
  navigate?.(site("/referral"));
1265
1266
  dismiss();
1266
1267
  }, children: t("Share Hanzo") }), _jsxs(XStack, { items: "center", gap: "$1", px: "$1.5", py: "$1", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(YStack, { flex: 1, minW: 0, children: _jsx(Me, { host: who, onOrg: (o) => (choose(o), window.location.reload()) }) }), _jsx(Box, { render: "button", onClick: toggle, "aria-label": t("Collapse sidebar"), p: "$2", rounded: "$2", hoverStyle: { bg: "$hover" }, cursor: "pointer", children: _jsx(PanelLeftClose, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) })] })] })) : null) : null] }));
@@ -1268,7 +1269,7 @@ function Frame({ mode, children, navigate, back, forward, }) {
1268
1269
  gridTemplateColumns: "minmax(0, 1fr)",
1269
1270
  gridTemplateRows: `44px minmax(0, 1fr) ${TABS_HEIGHT}`,
1270
1271
  gridTemplateAreas: '"bar" "pane" "rail"',
1271
- }, position: "relative", width: "100%", height: "100dvh", overflow: "hidden", bg: "$background", backgroundImage: "var(--pane-ground)", children: [_jsx(Rail, { mode: mode, places: places, open: asked, team: onApex ? (signedIn ? ENTRY : WORKSPACE) : undefined, navigate: navigate, onSettings: () => showSettings(FIRST), onMore: () => setFinding(true) }), _jsxs(XStack, { render: "header", "data-slot": "bar", gridArea: "bar", ...sheet(0), height: 44, shrink: 0, items: "center", px: "$3", gap: "$3", borderBottomWidth: 1, borderColor: "var(--edge, var(--white-06))", children: [_jsxs(XStack, { items: "center", gap: "$1", shrink: 0, children: [_jsx(SidebarIconButton, { ...TAP, label: t(shown ? "Close sidebar" : "Open sidebar"), onPress: toggle, onMouseEnter: () => setPeeking(true), children: _jsx(PanelLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) }), back || forward ? (_jsxs(XStack, { display: "none", $md: { display: "flex" }, items: "center", gap: "$1", shrink: 0, children: [_jsx(SidebarIconButton, { ...TAP, label: t("Back"), onPress: () => back?.(), children: _jsx(ArrowLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) }), _jsx(SidebarIconButton, { ...TAP, label: t("Forward"), onPress: () => forward?.(), children: _jsx(ArrowRight, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) })] })) : null] }), _jsx(XStack, { flex: 1, justify: "center", children: _jsx(YStack, { width: 440, maxW: "100%", position: "relative", children: _jsxs(Box, { render: "button", onClick: () => setFinding(true), display: "flex", flexDirection: "row", "data-slot": "find", items: "center", "$max-md": { justify: "center" }, gap: "$2", width: "100%", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: [_jsx(Search, { size: 13, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }), _jsx(Text, { fontSize: "$1", color: "$soft", "$max-md": { display: "none" }, children: t("Search {workspace}", { workspace }) }), _jsx(Shortcut, { keys: ["Mod", "K"], marginInlineStart: "auto", "data-i18n-ltr": "", "$max-md": { display: "none" } })] }) }) }), _jsxs(XStack, { shrink: 0, minW: 0, justify: "flex-end", items: "center", gap: "$2", children: [settled && !signedIn ? (_jsx(Box, { ...TAP, render: "button", onClick: () => enter(LOGIN), display: "flex", items: "center", justify: "center", cursor: "pointer", children: _jsx(XStack, { items: "center", justify: "center", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Sign in") }) }) })) : null, settled && signedIn && free ? (_jsx(Box, { ...TAP, render: "button", onClick: () => window.location.assign(payUrl("/cart", { plan: "pro", returnUrl: window.location.href })), display: "flex", items: "center", justify: "center", cursor: "pointer", "aria-label": t("Upgrade"), "data-slot": "bar-upgrade", children: _jsxs(XStack, { items: "center", justify: "center", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", gap: "$1.5", hoverStyle: { bg: "$hover" }, children: [_jsx(Sparkles, { size: 13, "aria-hidden": true, color: "var(--primary)" }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Upgrade") })] }) })) : null, _jsxs(XStack, { display: "none", $lg: { display: "flex" }, items: "center", gap: "$1", children: [_jsx(SidebarIconButton, { ...TAP, label: t(aside === "roster" ? "Hide directory & roster" : "Show directory & roster"), onPress: () => showAside(aside === "roster" ? null : "roster"), children: _jsx(Users, { size: 16, "aria-hidden": true }) }), _jsx(SidebarIconButton, { ...TAP, label: t(aside === "tasks" ? "Close side panel" : "Open side panel"), onPress: () => showAside(aside === "tasks" ? null : "tasks"), children: _jsx(PanelRight, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) })] })] })] }), shown ? (_jsx(Box, { render: "button", "aria-label": t("Close sidebar"), onClick: dismiss, ...scrim, "data-slot": "scrim", position: "absolute", t: 44, r: 0, b: TABS_HEIGHT, l: 0, z: "var(--z-scrim)", $md: { display: "none" } })) : null, shown ? (_jsx(XStack, { "data-slot": "list", gridArea: "list", position: asked ? "relative" : "absolute", ...(asked ? {} : { top: 44, bottom: 0, insetInlineStart: 64 }), "$max-md": { position: "fixed", t: 44, r: 0, b: TABS_HEIGHT, l: 0, width: "100%" }, z: "var(--z-drawer)", bg: "$background", onMouseEnter: () => setPeeking(true), onMouseLeave: () => {
1272
+ }, position: "relative", width: "100%", height: "100dvh", overflow: "hidden", bg: "$background", backgroundImage: "var(--pane-ground)", children: [_jsx(Rail, { mode: mode, places: places, open: asked, team: onApex ? (signedIn ? ENTRY : WORKSPACE) : undefined, navigate: navigate, onSettings: () => showSettings(FIRST), onMore: () => setFinding(true) }), _jsxs(XStack, { render: "header", "data-slot": "bar", "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, gridArea: "bar", ...sheet(0), height: 44, shrink: 0, items: "center", px: "$3", gap: "$3", borderBottomWidth: 1, borderColor: "var(--edge, var(--white-06))", children: [_jsxs(XStack, { items: "center", gap: "$1", shrink: 0, children: [_jsx(SidebarIconButton, { ...TAP, label: t(shown ? "Close sidebar" : "Open sidebar"), onPress: toggle, onMouseEnter: () => setPeeking(true), children: _jsx(PanelLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) }), back || forward ? (_jsxs(XStack, { display: "none", $md: { display: "flex" }, items: "center", gap: "$1", shrink: 0, children: [_jsx(SidebarIconButton, { ...TAP, label: t("Back"), onPress: () => back?.(), children: _jsx(ArrowLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) }), _jsx(SidebarIconButton, { ...TAP, label: t("Forward"), onPress: () => forward?.(), children: _jsx(ArrowRight, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) })] })) : null] }), _jsx(XStack, { flex: 1, justify: "center", "data-tauri-drag-region": "deep", children: _jsx(YStack, { width: 440, maxW: "100%", position: "relative", children: _jsxs(Box, { render: "button", onClick: () => setFinding(true), display: "flex", flexDirection: "row", "data-slot": "find", items: "center", "$max-md": { justify: "center" }, gap: "$2", width: "100%", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: [_jsx(Search, { size: 13, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }), _jsx(Text, { fontSize: "$1", color: "$soft", "$max-md": { display: "none" }, children: t("Search {workspace}", { workspace }) }), _jsx(Shortcut, { keys: ["Mod", "K"], marginInlineStart: "auto", "data-i18n-ltr": "", "$max-md": { display: "none" } })] }) }) }), _jsxs(XStack, { shrink: 0, minW: 0, justify: "flex-end", items: "center", gap: "$2", children: [settled && !signedIn ? (_jsx(Box, { ...TAP, render: "button", onClick: () => enter(LOGIN), display: "flex", items: "center", justify: "center", cursor: "pointer", children: _jsx(XStack, { items: "center", justify: "center", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Sign in") }) }) })) : null, settled && signedIn && free ? (_jsx(Box, { ...TAP, render: "button", onClick: () => window.location.assign(payUrl("/cart", { returnUrl: window.location.href })), display: "flex", items: "center", justify: "center", cursor: "pointer", "aria-label": t("Upgrade"), "data-slot": "bar-upgrade", children: _jsxs(XStack, { items: "center", justify: "center", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", gap: "$1.5", hoverStyle: { bg: "$hover" }, children: [_jsx(Sparkles, { size: 13, "aria-hidden": true, color: "var(--primary)" }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Upgrade") })] }) })) : null, _jsxs(XStack, { display: "none", $lg: { display: "flex" }, items: "center", gap: "$1", children: [_jsx(SidebarIconButton, { ...TAP, label: t(aside === "roster" ? "Hide directory & roster" : "Show directory & roster"), onPress: () => showAside(aside === "roster" ? null : "roster"), children: _jsx(Users, { size: 16, "aria-hidden": true }) }), _jsx(SidebarIconButton, { ...TAP, label: t(aside === "tasks" ? "Close side panel" : "Open side panel"), onPress: () => showAside(aside === "tasks" ? null : "tasks"), children: _jsx(PanelRight, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) })] }), _jsx(WindowControls, {})] })] }), shown ? (_jsx(Box, { render: "button", "aria-label": t("Close sidebar"), onClick: dismiss, ...scrim, "data-slot": "scrim", position: "absolute", t: 44, r: 0, b: TABS_HEIGHT, l: 0, z: "var(--z-scrim)", $md: { display: "none" } })) : null, shown ? (_jsx(XStack, { "data-slot": "list", gridArea: "list", position: asked ? "relative" : "absolute", ...(asked ? {} : { top: 44, bottom: 0, insetInlineStart: 64 }), "$max-md": { position: "fixed", t: 44, r: 0, b: TABS_HEIGHT, l: 0, width: "100%" }, z: "var(--z-drawer)", bg: "$background", onMouseEnter: () => setPeeking(true), onMouseLeave: () => {
1272
1273
  if (!asked)
1273
1274
  setPeeking(false);
1274
1275
  }, children: list })) : null, _jsx(Paned, { swap: settingsPane ? _jsx(Suspense, { fallback: null, children: _jsx(SettingsPane, { id: settingsPane }) }) : undefined, children: children }), finding ? (_jsx(Palette, { actions: doors, onClose: found,
package/dist/Upgrade.js CHANGED
@@ -15,7 +15,8 @@ import { Anchor, Box, Dialog, DialogContent, DialogTitle, Text, ToggleGroup, Tog
15
15
  import { track } from './lib/tags.js';
16
16
  import { org } from './lib/session.js';
17
17
  import { useTier } from './lib/tier.js';
18
- import { charge, planCheckoutUrl, quote, saving, term, usePlan } from './lib/plans.js';
18
+ import { charge, quote, saving, term, usePlan } from './lib/plans.js';
19
+ import { payUrl } from './lib/pay.js';
19
20
  import { site } from './where.js';
20
21
  /** The free rung's name in the billing catalog. */
21
22
  const FREE = 'free';
@@ -58,8 +59,8 @@ export function Upgrade({ ask, onClose }) {
58
59
  return null;
59
60
  const save = saving(plan);
60
61
  const interval = save === null ? 'month' : cycle;
61
- const label = t('Upgrade to {plan} for {price}', { plan: plan.name, price: quote(plan, interval, t) ?? '' });
62
- const href = term(ask?.href ?? planCheckoutUrl(plan, here()), interval);
62
+ const label = t('Choose your plan — Pro, Max & Team');
63
+ const href = term(ask?.href ?? payUrl('/cart', { org: org(), returnUrl: here() }), interval);
63
64
  const buy = () => {
64
65
  const items = [{ item_id: plan.id, item_name: plan.name }];
65
66
  // The funnel reads the English, whatever language the reader chose.
@@ -0,0 +1,3 @@
1
+ export declare function dragWindow(e: React.MouseEvent): void;
2
+ export declare function toggleWindowMaximize(e: React.MouseEvent): void;
3
+ export declare function WindowControls(): import("react").JSX.Element;
@@ -0,0 +1,214 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useState } from 'react';
4
+ import { View, XStack } from '@hanzo/ui';
5
+ function getWindow() {
6
+ if (typeof window === 'undefined')
7
+ return null;
8
+ const w = window;
9
+ if (w.__TAURI__?.window?.getCurrentWindow) {
10
+ try {
11
+ return w.__TAURI__.window.getCurrentWindow();
12
+ }
13
+ catch { }
14
+ }
15
+ return null;
16
+ }
17
+ function getWindowLabel() {
18
+ if (typeof window === 'undefined')
19
+ return 'main';
20
+ const w = window;
21
+ const win = getWindow();
22
+ return (win?.label ||
23
+ w.__TAURI_INTERNALS__?.metadata?.currentWindow?.label ||
24
+ w.__TAURI_INTERNALS__?.metadata?.currentWebview?.windowLabel ||
25
+ 'main');
26
+ }
27
+ function invokeTauri(cmd, args = {}) {
28
+ if (typeof window === 'undefined')
29
+ return Promise.resolve();
30
+ const w = window;
31
+ const label = getWindowLabel();
32
+ const payload = { label, ...args };
33
+ if (w.__TAURI_INTERNALS__?.invoke) {
34
+ return w.__TAURI_INTERNALS__.invoke(cmd, payload);
35
+ }
36
+ if (w.__TAURI__?.core?.invoke) {
37
+ return w.__TAURI__.core.invoke(cmd, payload);
38
+ }
39
+ if (w.__TAURI__?.invoke) {
40
+ return w.__TAURI__.invoke(cmd, payload);
41
+ }
42
+ return Promise.resolve();
43
+ }
44
+ const INTERACTIVE_SELECTOR = [
45
+ 'button',
46
+ 'input',
47
+ 'select',
48
+ 'textarea',
49
+ 'label',
50
+ 'summary',
51
+ '[role="button"]',
52
+ '[role="link"]',
53
+ '[role="menuitem"]',
54
+ '[role="menuitemcheckbox"]',
55
+ '[role="menuitemradio"]',
56
+ '[role="tab"]',
57
+ '[role="checkbox"]',
58
+ '[role="radio"]',
59
+ '[role="switch"]',
60
+ '[role="option"]',
61
+ '[role="combobox"]',
62
+ '[aria-haspopup]',
63
+ '[contenteditable="true"]',
64
+ '[tabindex]:not([tabindex="-1"])',
65
+ '[data-tauri-drag-region="false"]',
66
+ '[data-slot="window-controls"]',
67
+ ].join(', ');
68
+ function isInteractiveTarget(target) {
69
+ const el = target;
70
+ if (!el || typeof el.closest !== 'function')
71
+ return false;
72
+ if (el.closest(INTERACTIVE_SELECTOR))
73
+ return true;
74
+ if (el.closest('a:not([data-tauri-drag-region])'))
75
+ return true;
76
+ return false;
77
+ }
78
+ let lastReactMouseDown = 0;
79
+ export function dragWindow(e) {
80
+ if (e.button !== 0)
81
+ return;
82
+ if (isInteractiveTarget(e.target))
83
+ return;
84
+ lastReactMouseDown = Date.now();
85
+ e.preventDefault?.();
86
+ e.stopPropagation?.();
87
+ // Let double-clicks be handled by toggleWindowMaximize instead of starting a drag
88
+ if (e.detail && e.detail > 1)
89
+ return;
90
+ const win = getWindow();
91
+ if (win?.startDragging) {
92
+ try {
93
+ win.startDragging();
94
+ return;
95
+ }
96
+ catch { }
97
+ }
98
+ invokeTauri('plugin:window|start_dragging');
99
+ }
100
+ export function toggleWindowMaximize(e) {
101
+ if (isInteractiveTarget(e.target))
102
+ return;
103
+ e.preventDefault?.();
104
+ e.stopPropagation?.();
105
+ // When Tauri's built-in drag.js handles double-click on [data-tauri-drag-region],
106
+ // it calls stopImmediatePropagation() on the mousedown event and invokes
107
+ // plugin:window|internal_toggle_maximize before the browser fires dblclick.
108
+ // Skip the duplicate toggle when React did not receive the preceding mousedown.
109
+ const el = e.target;
110
+ if (e.type === 'dblclick' &&
111
+ Date.now() - lastReactMouseDown > 500 &&
112
+ typeof el?.closest === 'function' &&
113
+ el.closest('[data-tauri-drag-region]')) {
114
+ return;
115
+ }
116
+ const win = getWindow();
117
+ if (win?.toggleMaximize) {
118
+ try {
119
+ win.toggleMaximize();
120
+ return;
121
+ }
122
+ catch { }
123
+ }
124
+ invokeTauri('plugin:window|toggle_maximize');
125
+ }
126
+ export function WindowControls() {
127
+ const [isDesktop, setIsDesktop] = useState(false);
128
+ const [isMaximized, setIsMaximized] = useState(false);
129
+ useEffect(() => {
130
+ const desktop = typeof window !== 'undefined' &&
131
+ Boolean(window.__TAURI__ ||
132
+ window.__TAURI_INTERNALS__);
133
+ setIsDesktop(desktop);
134
+ if (!desktop)
135
+ return;
136
+ document.documentElement.setAttribute('data-desktop', 'true');
137
+ const syncMaximized = () => {
138
+ const win = getWindow();
139
+ const checkMax = win?.isMaximized
140
+ ? win.isMaximized()
141
+ : invokeTauri('plugin:window|is_maximized');
142
+ Promise.resolve(checkMax)
143
+ .then((val) => {
144
+ const max = Boolean(val);
145
+ setIsMaximized(max);
146
+ if (max)
147
+ document.documentElement.setAttribute('data-maximized', 'true');
148
+ else
149
+ document.documentElement.removeAttribute('data-maximized');
150
+ })
151
+ .catch(() => { });
152
+ };
153
+ syncMaximized();
154
+ window.addEventListener('resize', syncMaximized);
155
+ return () => window.removeEventListener('resize', syncMaximized);
156
+ }, []);
157
+ if (!isDesktop)
158
+ return null;
159
+ const handleMinimize = (e) => {
160
+ e.preventDefault?.();
161
+ e.stopPropagation?.();
162
+ const win = getWindow();
163
+ if (win?.minimize)
164
+ win.minimize().catch(() => invokeTauri('plugin:window|minimize'));
165
+ else
166
+ invokeTauri('plugin:window|minimize');
167
+ };
168
+ const handleToggleMaximize = async (e) => {
169
+ e.preventDefault?.();
170
+ e.stopPropagation?.();
171
+ const win = getWindow();
172
+ if (win?.toggleMaximize) {
173
+ await win.toggleMaximize().catch(() => invokeTauri('plugin:window|toggle_maximize'));
174
+ }
175
+ else {
176
+ await invokeTauri('plugin:window|toggle_maximize');
177
+ }
178
+ const val = win?.isMaximized
179
+ ? await win.isMaximized().catch(() => !isMaximized)
180
+ : await invokeTauri('plugin:window|is_maximized').catch(() => !isMaximized);
181
+ const max = Boolean(val);
182
+ setIsMaximized(max);
183
+ if (max)
184
+ document.documentElement.setAttribute('data-maximized', 'true');
185
+ else
186
+ document.documentElement.removeAttribute('data-maximized');
187
+ };
188
+ const handleClose = (e) => {
189
+ e.preventDefault?.();
190
+ e.stopPropagation?.();
191
+ const win = getWindow();
192
+ if (win?.close)
193
+ win.close().catch(() => invokeTauri('plugin:window|close'));
194
+ else
195
+ invokeTauri('plugin:window|close');
196
+ };
197
+ return (_jsxs(XStack, { "data-slot": "window-controls", "data-tauri-drag-region": "false", items: "center", gap: 4, shrink: 0, "$platform-web": {
198
+ marginInlineStart: 'auto',
199
+ userSelect: 'none',
200
+ zIndex: 'var(--z-dropdown)',
201
+ }, children: [_jsx(View, { render: _jsx("button", { type: "button" }), "data-tauri-drag-region": "false", onClick: handleMinimize, onMouseDown: (e) => e.stopPropagation?.(), "aria-label": "Minimize", width: 28, height: 28, rounded: 6, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: 'var(--white-08)' }, "$platform-web": {
202
+ color: 'var(--muted-foreground)',
203
+ borderRadius: '6px',
204
+ transition: 'all 0.15s ease',
205
+ }, children: _jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: _jsx("line", { x1: "2", y1: "6", x2: "10", y2: "6", strokeLinecap: "round" }) }) }), _jsx(View, { render: _jsx("button", { type: "button" }), "data-tauri-drag-region": "false", onClick: handleToggleMaximize, onMouseDown: (e) => e.stopPropagation?.(), "aria-label": isMaximized ? 'Restore' : 'Maximize', width: 28, height: 28, rounded: 6, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: 'var(--white-08)' }, "$platform-web": {
206
+ color: 'var(--muted-foreground)',
207
+ borderRadius: '6px',
208
+ transition: 'all 0.15s ease',
209
+ }, children: isMaximized ? (_jsxs("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.2", children: [_jsx("rect", { x: "3.5", y: "1.5", width: "6.5", height: "6.5", rx: "1" }), _jsx("path", { d: "M1.5 4.5v5a1 1 0 0 0 1 1h5", strokeLinecap: "round" })] })) : (_jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.2", children: _jsx("rect", { x: "2", y: "2", width: "8", height: "8", rx: "1.5" }) })) }), _jsx(View, { render: _jsx("button", { type: "button" }), "data-tauri-drag-region": "false", onClick: handleClose, onMouseDown: (e) => e.stopPropagation?.(), "aria-label": "Close", width: 28, height: 28, rounded: 6, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: 'var(--state-error)' }, "$platform-web": {
210
+ color: 'var(--muted-foreground)',
211
+ borderRadius: '6px',
212
+ transition: 'all 0.15s ease',
213
+ }, children: _jsxs("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [_jsx("line", { x1: "2.5", y1: "2.5", x2: "9.5", y2: "9.5", strokeLinecap: "round" }), _jsx("line", { x1: "9.5", y1: "2.5", x2: "2.5", y2: "9.5", strokeLinecap: "round" })] }) })] }));
214
+ }
package/dist/index.js CHANGED
@@ -10,3 +10,5 @@
10
10
  */
11
11
  export { configure, where, site, brand } from './where.js';
12
12
  export { Rooms, Look, useRooms, useLook, useOrg } from './host.js';
13
+ // Desktop UI loads through @hanzo/app/WindowControls; keep the root usable
14
+ // by Node tools without loading @hanzo/ui and React Native.
@@ -6,6 +6,15 @@ export interface LearningStudy {
6
6
  improvement?: {
7
7
  baseline: string;
8
8
  target: string;
9
+ min_questions: number;
10
+ require_intervals: boolean;
11
+ metrics: {
12
+ category: string;
13
+ metric: string;
14
+ direction: string;
15
+ min_gain: number;
16
+ max_regression: number;
17
+ }[];
9
18
  };
10
19
  }
11
20
  export interface LearningReview {
package/dist/learning.js CHANGED
@@ -18,16 +18,29 @@ export async function learningRead(part, signal) {
18
18
  }
19
19
  /** Creating a study arms deterministic evaluation; it starts no model or rollout. */
20
20
  export async function learningCreate(proposal, id) {
21
+ const headers = { 'Content-Type': 'application/json', ...scope() };
22
+ const policy = { baseline: proposal.baseline, target: proposal.target, min_questions: proposal.minQuestions,
23
+ require_intervals: false, metrics: [{ category: proposal.category, metric: proposal.metric, direction: proposal.direction, min_gain: proposal.minGain, max_regression: 0 }] };
21
24
  const r = await fetch(`${api()}/v1/research/studies`, {
22
25
  method: 'POST',
23
- headers: { 'Content-Type': 'application/json', ...scope() },
24
- body: JSON.stringify({ studies: [{ id, title: proposal.title, question: proposal.question,
25
- improvement: { baseline: proposal.baseline, target: proposal.target, min_questions: proposal.minQuestions,
26
- require_intervals: false, metrics: [{ category: proposal.category, metric: proposal.metric, direction: proposal.direction, min_gain: proposal.minGain, max_regression: 0 }] },
27
- }] }),
26
+ headers,
27
+ body: JSON.stringify({ studies: [{ id, title: proposal.title, question: proposal.question, improvement: policy }] }),
28
28
  });
29
29
  if (!r.ok)
30
30
  throw Object.assign(new Error(`${r.status}`), { status: r.status });
31
+ // Older cloud versions accept unknown JSON fields. Verify that the policy
32
+ // actually persisted before telling the person automatic review is armed.
33
+ const check = await fetch(`${api()}/v1/research/studies`, { headers });
34
+ if (!check.ok)
35
+ throw Object.assign(new Error(`${check.status}`), { status: check.status });
36
+ const body = await check.json();
37
+ const saved = body.data?.find((study) => study.id === id)?.improvement;
38
+ const metric = saved?.metrics?.[0];
39
+ if (!saved || saved.baseline !== policy.baseline || saved.target !== policy.target ||
40
+ saved.min_questions !== policy.min_questions || saved.require_intervals !== policy.require_intervals ||
41
+ saved.metrics.length !== 1 || !metric || Object.entries(policy.metrics[0]).some(([key, value]) => metric[key] !== value)) {
42
+ throw Object.assign(new Error('Cloud has not enabled automatic study review'), { status: 503 });
43
+ }
31
44
  }
32
45
  /** Analyze measured outcomes; this never calls the live-rollout decide route. */
33
46
  export async function learningAnalyze(id) {
package/dist/lib/betas.js CHANGED
@@ -33,7 +33,7 @@ export const BETAS = [
33
33
  { id: 'sign', name: 'Sign', line: phrase('Send a PDF, get it signed, keep the record'), group: 'Business', href: 'https://esign.hanzo.ai' },
34
34
  { id: 'company', name: 'Company', line: phrase('Formation, documents and filings'), group: 'Business', href: `${PLATFORM}/company` },
35
35
  { id: 'cms', name: 'CMS', line: phrase('Pages, posts, media and navigation'), group: 'Business', href: 'https://cms.hanzo.ai/admin' },
36
- { id: 'helpdesk', name: 'Help Center', line: phrase('Tickets, teams and SLAs'), group: 'Business', href: 'https://help.hanzo.ai' },
36
+ { id: 'helpdesk', name: 'Help Center', line: phrase('Tickets, teams and SLAs'), group: 'Business', href: 'https://hanzo.help' },
37
37
  { id: 'marketing', name: 'Marketing', line: phrase('Campaigns, audiences and email sequences'), group: 'Business', href: 'https://marketing.hanzo.ai' },
38
38
  { id: 'ads', name: 'Ads', line: phrase('Paid campaigns, launched and paused in one place'), group: 'Business', href: 'https://ads.hanzo.ai' },
39
39
  { id: 'social', name: 'Social', line: phrase('Schedule posts across your social accounts'), group: 'Business', href: 'https://social.hanzo.ai' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/app",
3
- "version": "0.2.10",
3
+ "version": "0.2.13",
4
4
  "description": "Hanzo's app: the shell and its apps (Home, Chat, Inbox, Contacts, Meet, Calendar, Drive, Board, Work, Bots), once, for every Hanzo surface.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",