@hanzo/app 0.2.15 → 0.2.17
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 +3 -0
- package/dist/Learning.d.ts +1 -0
- package/dist/Learning.js +2 -1
- package/dist/Me.d.ts +2 -1
- package/dist/Me.js +5 -3
- package/dist/Setup.js +116 -100
- package/dist/ThinkingEffort.js +2 -2
- package/dist/lib/chatPreferences.d.ts +1 -0
- package/dist/lib/chatPreferences.js +6 -2
- package/dist/{learning.js → lib/learning.js} +2 -2
- package/package.json +1 -1
- /package/dist/{learning.d.ts → lib/learning.d.ts} +0 -0
package/dist/Chat.js
CHANGED
|
@@ -1590,6 +1590,9 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
|
|
|
1590
1590
|
if (eff === 'low' || eff === 'medium' || eff === 'high') {
|
|
1591
1591
|
mind.pace(eff);
|
|
1592
1592
|
}
|
|
1593
|
+
else if (eff === 'xhigh' || eff === 'max') {
|
|
1594
|
+
mind.pace('high');
|
|
1595
|
+
}
|
|
1593
1596
|
}, disabled: chat.streaming || talk.open }), basePrompt.send] })),
|
|
1594
1597
|
};
|
|
1595
1598
|
})() }), _jsx(AgentMaker, {}), carry.dialog, _jsx(Upgrade, { ask: ask, onClose: () => setAsk(null) })] }));
|
package/dist/Learning.d.ts
CHANGED
package/dist/Learning.js
CHANGED
|
@@ -6,7 +6,8 @@ import { useEffect, useRef, useState } from 'react';
|
|
|
6
6
|
import { Button, Dialog, DialogContent, DialogTitle, Input, Text, XStack, YStack } from '@hanzo/ui';
|
|
7
7
|
import { say } from './failure.js';
|
|
8
8
|
import { org } from './lib/session.js';
|
|
9
|
-
import { learningAnalyze, learningCompare, learningCreate, learningRead } from './learning.js';
|
|
9
|
+
import { learningAnalyze, learningCompare, learningCreate, learningRead } from './lib/learning.js';
|
|
10
|
+
export * from './lib/learning.js';
|
|
10
11
|
/** The user's actual evidence and findings. Closed dialogs make no API requests. */
|
|
11
12
|
export function Learning({ open, onClose }) {
|
|
12
13
|
const { t } = useI18n();
|
package/dist/Me.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare function Face({ host, size }: {
|
|
|
21
21
|
* plan, Free included, is one to move up from.
|
|
22
22
|
*/
|
|
23
23
|
export declare const upgrade: (family: string | null | undefined) => string;
|
|
24
|
-
export declare function Me({ host, narrow, above, onOrg, }: {
|
|
24
|
+
export declare function Me({ host, narrow, above, onOrg, defaultAccountOpen, }: {
|
|
25
25
|
host: Who;
|
|
26
26
|
/** The rail's: the face alone, the menu opening beside it. */
|
|
27
27
|
narrow?: boolean;
|
|
@@ -32,6 +32,7 @@ export declare function Me({ host, narrow, above, onOrg, }: {
|
|
|
32
32
|
above?: boolean;
|
|
33
33
|
/** Work in another organization: picked, then the app opened in it. */
|
|
34
34
|
onOrg: (org: string) => void;
|
|
35
|
+
defaultAccountOpen?: boolean;
|
|
35
36
|
}): import("react").JSX.Element;
|
|
36
37
|
/**
|
|
37
38
|
* What became of an organization this tab created: nothing to say once the token
|
package/dist/Me.js
CHANGED
|
@@ -142,11 +142,12 @@ const Mark = ({ org }) => (_jsx(XStack, { width: 16, height: 16, rounded: "$2",
|
|
|
142
142
|
export const upgrade = (family) => family === 'Enterprise' ? phrase('Enterprise plan') : family === 'Agency' ? phrase('Agency plan') : phrase('Upgrade plan');
|
|
143
143
|
/** The keys a row prints, in this platform's spelling. */
|
|
144
144
|
const mac = () => typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent);
|
|
145
|
-
export function Me({ host, narrow = false, above = false, onOrg, }) {
|
|
145
|
+
export function Me({ host, narrow = false, above = false, onOrg, defaultAccountOpen = false, }) {
|
|
146
146
|
const { t, dir, locale, setLocale } = useI18n();
|
|
147
147
|
const rtl = dir === 'rtl';
|
|
148
148
|
const [open, setOpen] = useState(false);
|
|
149
|
-
const [account, setAccount] = useState(false);
|
|
149
|
+
const [account, setAccount] = useState(defaultAccountOpen ?? false);
|
|
150
|
+
const [orgs, setOrgs] = useState(false);
|
|
150
151
|
const [lang, setLang] = useState(false);
|
|
151
152
|
const [langQuery, setLangQuery] = useState('');
|
|
152
153
|
const [help, setHelp] = useState(false);
|
|
@@ -208,6 +209,7 @@ export function Me({ host, narrow = false, above = false, onOrg, }) {
|
|
|
208
209
|
if (next)
|
|
209
210
|
return;
|
|
210
211
|
setAccount(false);
|
|
212
|
+
setOrgs(false);
|
|
211
213
|
setLang(false);
|
|
212
214
|
setHelp(false);
|
|
213
215
|
},
|
|
@@ -221,7 +223,7 @@ export function Me({ host, narrow = false, above = false, onOrg, }) {
|
|
|
221
223
|
$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) => {
|
|
222
224
|
e?.stopPropagation?.();
|
|
223
225
|
getPro();
|
|
224
|
-
}, 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:
|
|
226
|
+
}, 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", "data-slot": "me-account", 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: 240, maxW: "calc(100vw - 16px)", pointerEvents: "auto", children: [_jsx(Meter, { read: read, onPlans: () => leave('here'), onBilling: () => (setOpen(false), showSettings('billing')) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onSelect: () => showSettings('account'), children: _jsx(Line, { icon: _jsx(CircleUserRound, { size: 16, "aria-hidden": true }), children: t('Profile') }) }), _jsx(DropdownMenuItem, { onSelect: () => showSettings('general'), children: _jsx(Line, { icon: _jsx(Palette, { size: 16, "aria-hidden": true }), children: t('Personalization') }) }), _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') }) })] })) : null] }), _jsxs(DropdownMenuSub, { open: orgs, onOpenChange: setOrgs, children: [_jsx(DropdownMenuSubTrigger, { "data-slot": "me-orgs", children: _jsx(Line, { icon: _jsx(Mark, { org: here ?? all[0] }), trail: _jsx(Check, { size: 16, "aria-label": t('Current') }), children: t('{org} · {plan}', { org: (here ? (here.personal ? t('Personal') : here.display) : current), plan: planName || t('No plan') }) }) }), orgs ? (_jsxs(DropdownMenuSubContent, { minW: 260, maxW: "calc(100vw - 16px)", pointerEvents: "auto", children: [_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] }), _jsx(DropdownMenuItem, { onSelect: () => leave('here'), children: _jsx(Line, { icon: _jsx(Sparkles, { size: 16, "aria-hidden": true }), children: t(plans) }) }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuSub, { open: lang, onOpenChange: (next) => {
|
|
225
227
|
setLang(next);
|
|
226
228
|
if (!next)
|
|
227
229
|
setLangQuery('');
|
package/dist/Setup.js
CHANGED
|
@@ -39,30 +39,83 @@ export function Setup() {
|
|
|
39
39
|
const [busy, setBusy] = useState(null);
|
|
40
40
|
const [modalOpen, setModalOpen] = useState(false);
|
|
41
41
|
const [errorMsg, setErrorMsg] = useState(null);
|
|
42
|
+
const [syncTurn, setSyncTurn] = useState(0);
|
|
42
43
|
const signed = isAuthenticated && Boolean(accessToken);
|
|
43
|
-
// Sync with remote connectors when authenticated
|
|
44
|
+
// Sync with remote integrations & connectors when authenticated or returning from OAuth tab/popup
|
|
44
45
|
useEffect(() => {
|
|
45
46
|
if (!signed)
|
|
46
47
|
return;
|
|
47
48
|
let live = true;
|
|
48
49
|
const auth = scope();
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
Promise.all([
|
|
51
|
+
fetch(`${api()}/v1/integrations`, { headers: auth })
|
|
52
|
+
.then((r) => (r.ok ? r.json() : null))
|
|
53
|
+
.catch(() => null),
|
|
54
|
+
fetch(`${api()}/v1/integrations/connectors`, { headers: auth })
|
|
55
|
+
.then((r) => (r.ok ? r.json() : null))
|
|
56
|
+
.catch(() => null),
|
|
57
|
+
]).then(([integrationsData, connectorsData]) => {
|
|
58
|
+
if (!live)
|
|
53
59
|
return;
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
const providers = Array.isArray(integrationsData?.providers)
|
|
61
|
+
? integrationsData.providers
|
|
62
|
+
: null;
|
|
63
|
+
const connectors = Array.isArray(connectorsData?.connectors)
|
|
64
|
+
? connectorsData.connectors
|
|
65
|
+
: null;
|
|
66
|
+
if (!providers && !connectors)
|
|
67
|
+
return;
|
|
68
|
+
const connectedSet = new Set();
|
|
69
|
+
if (providers) {
|
|
70
|
+
for (const p of providers) {
|
|
71
|
+
if (p.connected)
|
|
72
|
+
connectedSet.add(String(p.id));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (connectors) {
|
|
76
|
+
for (const c of connectors) {
|
|
77
|
+
connectedSet.add(String(c.provider));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const hasGithub = connectedSet.has('github') || connectedSet.has('github-copilot');
|
|
81
|
+
const hasSlack = connectedSet.has('slack');
|
|
82
|
+
const hasGoogle = connectedSet.has('google') ||
|
|
83
|
+
connectedSet.has('gmail') ||
|
|
84
|
+
connectedSet.has('google-drive') ||
|
|
85
|
+
connectedSet.has('google-calendar');
|
|
86
|
+
if (providers) {
|
|
87
|
+
setGithubDone(hasGithub);
|
|
88
|
+
setSlackDone(hasSlack);
|
|
89
|
+
setGoogleDone(hasGoogle);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
if (hasGithub)
|
|
93
|
+
setGithubDone(true);
|
|
94
|
+
if (hasSlack)
|
|
95
|
+
setSlackDone(true);
|
|
96
|
+
if (hasGoogle)
|
|
97
|
+
setGoogleDone(true);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
63
100
|
return () => {
|
|
64
101
|
live = false;
|
|
65
102
|
};
|
|
103
|
+
}, [signed, syncTurn]);
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
if (!signed)
|
|
106
|
+
return;
|
|
107
|
+
const onReturn = () => {
|
|
108
|
+
if (document.visibilityState === 'visible') {
|
|
109
|
+
setSyncTurn((n) => n + 1);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const onFocus = () => setSyncTurn((n) => n + 1);
|
|
113
|
+
document.addEventListener('visibilitychange', onReturn);
|
|
114
|
+
window.addEventListener('focus', onFocus);
|
|
115
|
+
return () => {
|
|
116
|
+
document.removeEventListener('visibilitychange', onReturn);
|
|
117
|
+
window.removeEventListener('focus', onFocus);
|
|
118
|
+
};
|
|
66
119
|
}, [signed]);
|
|
67
120
|
const totalDone = (githubDone ? 1 : 0) + (slackDone ? 1 : 0) + (googleDone ? 1 : 0);
|
|
68
121
|
const allDone = totalDone === 3;
|
|
@@ -71,116 +124,79 @@ export function Setup() {
|
|
|
71
124
|
if (step === 1 && githubDone)
|
|
72
125
|
setStep(slackDone ? 3 : 2);
|
|
73
126
|
else if (step === 2 && slackDone)
|
|
74
|
-
setStep(3);
|
|
127
|
+
setStep(googleDone ? 1 : 3);
|
|
128
|
+
else if (step === 3 && googleDone && (!githubDone || !slackDone))
|
|
129
|
+
setStep(!githubDone ? 1 : 2);
|
|
75
130
|
}, [githubDone, slackDone, googleDone, step]);
|
|
76
131
|
if (later && !modalOpen)
|
|
77
132
|
return null;
|
|
78
|
-
|
|
79
|
-
const handleConnectGithub = async () => {
|
|
133
|
+
const connectOAuthProvider = async (provider, label, onDone) => {
|
|
80
134
|
if (!signed) {
|
|
81
135
|
enter();
|
|
82
136
|
return;
|
|
83
137
|
}
|
|
84
|
-
setBusy(
|
|
138
|
+
setBusy(provider);
|
|
85
139
|
setErrorMsg(null);
|
|
86
140
|
try {
|
|
87
|
-
const res = await fetch(`${api()}/v1/integrations/
|
|
141
|
+
const res = await fetch(`${api()}/v1/integrations/${provider}/connect`, {
|
|
88
142
|
method: 'POST',
|
|
89
143
|
headers: { ...scope(), 'Content-Type': 'application/json' },
|
|
90
144
|
body: '{}',
|
|
91
145
|
});
|
|
92
|
-
if (res.ok) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
146
|
+
if (!res.ok) {
|
|
147
|
+
let detail = '';
|
|
148
|
+
try {
|
|
149
|
+
const errJson = (await res.json());
|
|
150
|
+
detail =
|
|
151
|
+
(typeof errJson?.error === 'string' ? errJson.error : errJson?.error?.message) ||
|
|
152
|
+
errJson?.message ||
|
|
153
|
+
'';
|
|
96
154
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
// Fallback: open OAuth authorize channel
|
|
100
|
-
const fallback = `${api()}/v1/channels/github/oauth/authorize?redirect_uri=${encodeURIComponent(window.location.origin + '/inbox')}`;
|
|
101
|
-
window.open(fallback, 'hanzo-oauth-github', 'width=600,height=700');
|
|
102
|
-
}
|
|
103
|
-
setGithubDone(true);
|
|
104
|
-
setStep(slackDone ? 3 : 2);
|
|
105
|
-
}
|
|
106
|
-
catch {
|
|
107
|
-
// Local/mock fallback: set connected and advance
|
|
108
|
-
setGithubDone(true);
|
|
109
|
-
setStep(slackDone ? 3 : 2);
|
|
110
|
-
}
|
|
111
|
-
finally {
|
|
112
|
-
setBusy(null);
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
// 2. Connect Slack
|
|
116
|
-
const handleConnectSlack = async () => {
|
|
117
|
-
if (!signed) {
|
|
118
|
-
enter();
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
setBusy('slack');
|
|
122
|
-
setErrorMsg(null);
|
|
123
|
-
try {
|
|
124
|
-
const res = await fetch(`${api()}/v1/integrations/slack/connect`, {
|
|
125
|
-
method: 'POST',
|
|
126
|
-
headers: { ...scope(), 'Content-Type': 'application/json' },
|
|
127
|
-
body: '{}',
|
|
128
|
-
});
|
|
129
|
-
if (res.ok) {
|
|
130
|
-
const j = (await res.json());
|
|
131
|
-
if (j.authorizeUrl) {
|
|
132
|
-
window.open(j.authorizeUrl, 'hanzo-oauth-slack', 'width=600,height=700');
|
|
155
|
+
catch {
|
|
156
|
+
// ignore
|
|
133
157
|
}
|
|
158
|
+
setErrorMsg(detail || t('Could not connect {provider} right now. Please try again.', { provider: label }));
|
|
159
|
+
return;
|
|
134
160
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
finally {
|
|
149
|
-
setBusy(null);
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
// 3. Connect Google (Gmail, Calendar & Drive)
|
|
153
|
-
const handleConnectGoogle = async () => {
|
|
154
|
-
if (!signed) {
|
|
155
|
-
enter();
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
setBusy('google');
|
|
159
|
-
setErrorMsg(null);
|
|
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');
|
|
161
|
+
const j = (await res.json());
|
|
162
|
+
if (j.authorizeUrl) {
|
|
163
|
+
const popup = window.open(j.authorizeUrl, `hanzo-oauth-${provider}`, 'width=600,height=700');
|
|
164
|
+
if (!popup) {
|
|
165
|
+
window.open(j.authorizeUrl, '_blank', 'noopener,noreferrer');
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
const timer = window.setInterval(() => {
|
|
169
|
+
if (popup.closed) {
|
|
170
|
+
window.clearInterval(timer);
|
|
171
|
+
setSyncTurn((n) => n + 1);
|
|
172
|
+
}
|
|
173
|
+
}, 1000);
|
|
170
174
|
}
|
|
171
175
|
}
|
|
172
|
-
else {
|
|
173
|
-
|
|
174
|
-
window.open(fallback, 'hanzo-oauth-google', 'width=600,height=700');
|
|
176
|
+
else if (j.connected) {
|
|
177
|
+
onDone();
|
|
175
178
|
}
|
|
176
|
-
setGoogleDone(true);
|
|
177
179
|
}
|
|
178
180
|
catch {
|
|
179
|
-
|
|
181
|
+
setErrorMsg(t('Could not connect {provider} right now. Please try again.', { provider: label }));
|
|
180
182
|
}
|
|
181
183
|
finally {
|
|
182
184
|
setBusy(null);
|
|
183
185
|
}
|
|
184
186
|
};
|
|
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') }) }) })] }) })] }));
|
|
187
|
+
// 1. Connect GitHub
|
|
188
|
+
const handleConnectGithub = () => connectOAuthProvider('github', 'GitHub', () => {
|
|
189
|
+
setGithubDone(true);
|
|
190
|
+
setStep(slackDone ? 3 : 2);
|
|
191
|
+
});
|
|
192
|
+
// 2. Connect Slack
|
|
193
|
+
const handleConnectSlack = () => connectOAuthProvider('slack', 'Slack', () => {
|
|
194
|
+
setSlackDone(true);
|
|
195
|
+
setStep(3);
|
|
196
|
+
});
|
|
197
|
+
// 3. Connect Google (Gmail, Calendar & Drive)
|
|
198
|
+
const handleConnectGoogle = () => connectOAuthProvider('google', 'Google', () => {
|
|
199
|
+
setGoogleDone(true);
|
|
200
|
+
});
|
|
201
|
+
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%", overflow: "hidden", children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$1.5", minW: 0, children: [_jsxs(XStack, { items: "center", gap: "$1.5", minW: 0, flex: 1, children: [_jsx(Sparkles, { size: 15, color: "var(--primary)", "aria-hidden": true }), _jsx(SizableText, { size: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: allDone ? t('Onboarding complete') : t('Quick setup ({n}/3)', { n: totalDone }) })] }), _jsxs(XStack, { items: "center", gap: "$1", shrink: 0, 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", minW: 0, children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$1.5", flexWrap: "wrap", minW: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, children: [_jsx(ProviderMark, { org: "github", size: 18 }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: t('1. Connect GitHub') })] }), githubDone ? (_jsxs(XStack, { items: "center", gap: "$1", shrink: 0, children: [_jsx(Check, { size: 12, color: GOOD, "aria-hidden": true }), _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", flexWrap: "wrap", 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", minW: 0, children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$1.5", flexWrap: "wrap", minW: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, children: [_jsx(SlackMark, { size: 18 }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: t('2. Connect Slack') })] }), slackDone ? (_jsxs(XStack, { items: "center", gap: "$1", shrink: 0, children: [_jsx(Check, { size: 12, color: GOOD, "aria-hidden": true }), _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", flexWrap: "wrap", 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", minW: 0, children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$1.5", flexWrap: "wrap", minW: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, children: [_jsx(ProviderMark, { org: "google", size: 18 }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: t('3. Connect Google') })] }), googleDone ? (_jsxs(XStack, { items: "center", gap: "$1", shrink: 0, children: [_jsx(Check, { size: 12, color: GOOD, "aria-hidden": true }), _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') }) }) })] }) })] }));
|
|
186
202
|
}
|
package/dist/ThinkingEffort.js
CHANGED
|
@@ -65,7 +65,7 @@ export function ThinkingEffort({ effort = DEFAULT_EFFORT, onChange, disabled = f
|
|
|
65
65
|
e.preventDefault();
|
|
66
66
|
setOpen(true);
|
|
67
67
|
}
|
|
68
|
-
}, children: [_jsx(Text, { fontSize: "$2", fontWeight: "500", color: "$ink", children: t('Thinking effort') }), _jsx(ChevronDown, { size: 12, color: "var(--soft, var(--muted-foreground))", "aria-hidden": true })] }) }), _jsx(PopoverContent, { solid: true, align: "end", p: "$3", width:
|
|
68
|
+
}, children: [_jsx(Text, { fontSize: "$2", fontWeight: "500", color: "$ink", children: t('Thinking effort') }), _jsx(ChevronDown, { size: 12, color: "var(--soft, var(--muted-foreground))", "aria-hidden": true })] }) }), _jsx(PopoverContent, { solid: true, align: "end", p: "$3", width: 260, minW: 260, maxW: 260, items: "stretch", rounded: "$4", bg: "var(--pane-fill, var(--surface-card))", borderWidth: 1, borderColor: "var(--pane-edge, var(--white-15))", boxShadow: "var(--shadow-sheet-1)", backdropFilter: "var(--pane-blur, blur(24px) saturate(190%))", children: _jsxs(YStack, { gap: "$3", width: "100%", minW: 234, maxW: 234, self: "stretch", "data-slot": "thinking-effort-card", role: "dialog", "aria-label": t('Thinking effort'), children: [_jsxs(XStack, { items: "center", justify: "center", gap: "$1", cursor: "pointer", onClick: () => {
|
|
69
69
|
if (disabled)
|
|
70
70
|
return;
|
|
71
71
|
const next = EFFORT_STEPS[(activeIndex + 1) % EFFORT_STEPS.length];
|
|
@@ -93,5 +93,5 @@ export function ThinkingEffort({ effort = DEFAULT_EFFORT, onChange, disabled = f
|
|
|
93
93
|
style: {
|
|
94
94
|
left: `calc(2px + (100% - 28px) * ${percentage / 100})`,
|
|
95
95
|
transition: dragging ? 'none' : 'left 0.2s cubic-bezier(0.16, 1, 0.3, 1)',
|
|
96
|
-
} })] }), _jsx(
|
|
96
|
+
} })] }), _jsx(XStack, { width: "100%", minH: 32, items: "center", justify: "center", px: "$1", children: _jsx(Text, { fontSize: "$1", color: "$soft", text: "center", children: t(current.note) }) })] }) })] }));
|
|
97
97
|
}
|
|
@@ -3,6 +3,7 @@ export interface ChatPreferences {
|
|
|
3
3
|
showModelSelector: boolean;
|
|
4
4
|
allowThirdPartyModels: boolean;
|
|
5
5
|
effort: EffortLevel;
|
|
6
|
+
effortVersion?: number;
|
|
6
7
|
}
|
|
7
8
|
export declare function getChatPreferences(): ChatPreferences;
|
|
8
9
|
export declare function setChatPreferences(patch: Partial<ChatPreferences>): ChatPreferences;
|
|
@@ -7,10 +7,12 @@ import { useEffect, useState } from 'react';
|
|
|
7
7
|
import { DEFAULT_EFFORT, EFFORT_STEPS } from '../ThinkingEffort.js';
|
|
8
8
|
const STORAGE_KEY = 'hanzo.chat.preferences';
|
|
9
9
|
const EVENT_NAME = 'hanzo:chat:preferences';
|
|
10
|
+
const EFFORT_SCHEMA_VERSION = 2;
|
|
10
11
|
const DEFAULT_PREFERENCES = {
|
|
11
12
|
showModelSelector: false,
|
|
12
13
|
allowThirdPartyModels: false,
|
|
13
14
|
effort: DEFAULT_EFFORT,
|
|
15
|
+
effortVersion: EFFORT_SCHEMA_VERSION,
|
|
14
16
|
};
|
|
15
17
|
function validEffort(v) {
|
|
16
18
|
return EFFORT_STEPS.some((s) => s.id === v) ? v : DEFAULT_EFFORT;
|
|
@@ -23,10 +25,12 @@ export function getChatPreferences() {
|
|
|
23
25
|
if (!raw)
|
|
24
26
|
return DEFAULT_PREFERENCES;
|
|
25
27
|
const parsed = JSON.parse(raw);
|
|
28
|
+
const migratedEffort = parsed.effortVersion === EFFORT_SCHEMA_VERSION ? validEffort(parsed.effort) : DEFAULT_EFFORT;
|
|
26
29
|
return {
|
|
27
30
|
showModelSelector: Boolean(parsed.showModelSelector),
|
|
28
31
|
allowThirdPartyModels: Boolean(parsed.allowThirdPartyModels),
|
|
29
|
-
effort:
|
|
32
|
+
effort: migratedEffort,
|
|
33
|
+
effortVersion: EFFORT_SCHEMA_VERSION,
|
|
30
34
|
};
|
|
31
35
|
}
|
|
32
36
|
catch {
|
|
@@ -35,7 +39,7 @@ export function getChatPreferences() {
|
|
|
35
39
|
}
|
|
36
40
|
export function setChatPreferences(patch) {
|
|
37
41
|
const current = getChatPreferences();
|
|
38
|
-
const next = { ...current, ...patch };
|
|
42
|
+
const next = { ...current, ...patch, effortVersion: EFFORT_SCHEMA_VERSION };
|
|
39
43
|
if (typeof window !== 'undefined') {
|
|
40
44
|
try {
|
|
41
45
|
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(next));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/app",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17",
|
|
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",
|
|
File without changes
|