@hanzo/app 0.2.12 → 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/Chat.js +13 -5
- package/dist/Me.js +1 -1
- package/dist/SettingsPane.js +86 -2
- package/package.json +1 -1
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";
|
|
@@ -503,7 +503,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
|
|
|
503
503
|
// THE MODEL AND THE EFFORT are the one choice Chat and Dev share
|
|
504
504
|
// (@hanzo/build `useMind`): the catalog from `GET /v1/models` and what the
|
|
505
505
|
// reader kept, changed from the composer's chip or from Settings.
|
|
506
|
-
const { t } = useI18n();
|
|
506
|
+
const { t, locale, setLocale } = useI18n();
|
|
507
507
|
const target = useMemo(() => ({ api: api(), token: bearer, org: org() }), [anonymous]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
508
508
|
// THE PLAN decides what the chip may offer: Free answers from the free lane
|
|
509
509
|
// alone, so it opens there and lists the rest as upgrades (@hanzo/build).
|
|
@@ -1496,7 +1496,15 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
|
|
|
1496
1496
|
}, children: [_jsx(Schedule, { open: plan !== null, onOpenChange: (open) => {
|
|
1497
1497
|
if (!open)
|
|
1498
1498
|
setPlan(null);
|
|
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"), children: [_jsx(Sparkles, { size: 13, color: "var(--primary)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Upgrade") })] })) : null,
|
|
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,
|
|
1500
1508
|
// AN EMPTY ROOM CENTRES ITS COMPOSER on a laptop. While nothing has been
|
|
1501
1509
|
// said the opening (the heading) and the composer sit as one group in the
|
|
1502
1510
|
// middle of the height; the moment a turn exists the transcript takes the
|
package/dist/Me.js
CHANGED
|
@@ -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('
|
|
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/SettingsPane.js
CHANGED
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/app",
|
|
3
|
-
"version": "0.2.
|
|
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",
|