@hanzo/app 0.2.22 → 0.2.23

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/Setup.d.ts CHANGED
@@ -1 +1,11 @@
1
+ export declare const LATER_KEY = "hanzo.onboarding.later";
2
+ export declare const GITHUB_KEY = "hanzo.onboarding.github";
3
+ export declare const SLACK_KEY = "hanzo.onboarding.slack";
4
+ export declare const GOOGLE_KEY = "hanzo.onboarding.google.v2";
5
+ export declare const GOOGLE_ACCOUNTS_KEY = "hanzo.onboarding.google.accounts";
6
+ export declare const GOOGLE_TOKENS_KEY = "hanzo.onboarding.google.tokens";
7
+ export declare const STEP_KEY = "hanzo.onboarding.step";
8
+ export declare const DEFAULT_GOOGLE_CLIENT_ID = "113591532635-s8pvqrebprkbndluhftddmdap4htvu1p.apps.googleusercontent.com";
9
+ export declare const GOOGLE_WORKSPACE_SCOPES: string;
10
+ export declare function buildGoogleWorkspaceAuthorizeUrl(origin: string, clientId?: string, state?: string): string;
1
11
  export declare function Setup(): import("react").JSX.Element;
package/dist/Setup.js CHANGED
@@ -1,49 +1,121 @@
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 Google (Gmail, Calendar & Drive).
3
+ // The 1-2-3 in-app onboarding: Connect GitHub, Connect Slack, Connect Google Workspace.
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. Google: Connect Gmail, Calendar & Drive so agents can read files, draft emails & manage schedules
9
+ // 3. Google: Connect Google Drive, Docs, Sheets, Gmail & Calendar across one or many Google accounts (personal, work, multiple orgs)
10
10
  import { useEffect, useState } from 'react';
11
11
  import { useI18n } from '@hanzo/i18n/react';
12
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, X } from 'lucide-react';
14
+ import { Check, Maximize2, Plus, Sparkles, X } from 'lucide-react';
15
15
  import { ProviderMark } from './ProviderMark.js';
16
16
  import { useKept } from './kept.js';
17
- import { api, CLIENT } from './lib/api.js';
17
+ import { api } from './lib/api.js';
18
18
  import { answers } from './lib/host.js';
19
19
  import { scope } from './lib/session.js';
20
20
  import { enter } from './lib/destination.js';
21
21
  import { brand } from './where.js';
22
22
  import { GOOD } from './lib/mix.js';
23
23
  const here = () => typeof window !== 'undefined' && answers(window.location.hostname);
24
- const LATER_KEY = 'hanzo.onboarding.later';
25
- const GITHUB_KEY = 'hanzo.onboarding.github';
26
- const SLACK_KEY = 'hanzo.onboarding.slack';
27
- const GOOGLE_KEY = 'hanzo.onboarding.google';
28
- const STEP_KEY = 'hanzo.onboarding.step';
24
+ export const LATER_KEY = 'hanzo.onboarding.later';
25
+ export const GITHUB_KEY = 'hanzo.onboarding.github';
26
+ export const SLACK_KEY = 'hanzo.onboarding.slack';
27
+ export const GOOGLE_KEY = 'hanzo.onboarding.google.v2';
28
+ export const GOOGLE_ACCOUNTS_KEY = 'hanzo.onboarding.google.accounts';
29
+ export const GOOGLE_TOKENS_KEY = 'hanzo.onboarding.google.tokens';
30
+ export const STEP_KEY = 'hanzo.onboarding.step';
31
+ export const DEFAULT_GOOGLE_CLIENT_ID = '113591532635-s8pvqrebprkbndluhftddmdap4htvu1p.apps.googleusercontent.com';
32
+ export const GOOGLE_WORKSPACE_SCOPES = [
33
+ 'openid',
34
+ 'email',
35
+ 'profile',
36
+ 'https://www.googleapis.com/auth/drive',
37
+ 'https://www.googleapis.com/auth/documents',
38
+ 'https://www.googleapis.com/auth/spreadsheets',
39
+ 'https://www.googleapis.com/auth/gmail.modify',
40
+ 'https://www.googleapis.com/auth/calendar',
41
+ ].join(' ');
42
+ export function buildGoogleWorkspaceAuthorizeUrl(origin, clientId = DEFAULT_GOOGLE_CLIENT_ID, state = 'gws') {
43
+ const cleanOrigin = origin.replace(/\/+$/, '');
44
+ const u = new URL('https://accounts.google.com/o/oauth2/v2/auth');
45
+ u.searchParams.set('client_id', clientId || DEFAULT_GOOGLE_CLIENT_ID);
46
+ u.searchParams.set('redirect_uri', `${cleanOrigin}/v1/iam/oauth/callback`);
47
+ u.searchParams.set('response_type', 'token');
48
+ u.searchParams.set('scope', GOOGLE_WORKSPACE_SCOPES);
49
+ u.searchParams.set('include_granted_scopes', 'true');
50
+ u.searchParams.set('prompt', 'select_account consent');
51
+ u.searchParams.set('state', state);
52
+ return u.toString();
53
+ }
29
54
  /** Inline Slack Mark */
30
55
  function SlackMark({ size = 18 }) {
31
56
  return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 54 54", fill: "none", "aria-hidden": true, children: [_jsx("path", { d: "M11.379 33.9993C11.379 37.1358 8.84512 39.6507 5.7276 39.6507C2.61008 39.6507 0.0572205 37.1168 0.0572205 33.9993C0.0572205 30.8817 2.5911 28.3479 5.70862 28.3479H11.36V33.9993H11.379Z", fill: "#E01E5A" }), _jsx("path", { d: "M14.1962 33.9997C14.1962 30.8632 16.7301 28.3483 19.8476 28.3483C22.9651 28.3483 25.499 30.8822 25.499 33.9997V48.1353C25.499 51.2718 22.9651 53.7867 19.8476 53.7867C16.7301 53.7867 14.1962 51.2718 14.1962 48.1353V33.9997Z", fill: "#E01E5A" }), _jsx("path", { d: "M19.8662 11.2673C16.7296 11.2673 14.2148 8.73347 14.2148 5.61594C14.2148 2.49842 16.7486 -0.0354538 19.8662 -0.0354538C22.9837 -0.0354538 25.5175 2.49842 25.5175 5.61594V11.2673H19.8662Z", fill: "#36C5F0" }), _jsx("path", { d: "M19.8682 14.1334C23.0047 14.1334 25.5196 16.6673 25.5196 19.7848C25.5196 22.9023 22.9857 25.4362 19.8682 25.4362H5.67566C2.53916 25.4362 0.0242615 22.9023 0.0242615 19.7848C0.0242615 16.6673 2.55814 14.1334 5.67566 14.1334H19.8682Z", fill: "#36C5F0" }), _jsx("path", { d: "M42.5323 19.7853C42.5323 16.6488 45.0662 14.1339 48.1837 14.1339C51.3012 14.1339 53.8351 16.6678 53.8351 19.7853C53.8351 22.9028 51.3012 25.4367 48.1837 25.4367H42.5323V19.7853Z", fill: "#2EB67D" }), _jsx("path", { d: "M39.7126 19.7934C39.7126 22.9299 37.1787 25.4448 34.0612 25.4448C30.9436 25.4448 28.4098 22.911 28.4098 19.7934V5.61986C28.4098 2.48336 30.9436 -0.0315399 34.0612 -0.0315399C37.1787 -0.0315399 39.7126 2.48336 39.7126 5.61986V19.7934Z", fill: "#2EB67D" }), _jsx("path", { d: "M34.0376 42.482C37.1741 42.482 39.689 45.0158 39.689 48.1334C39.689 51.2509 37.1552 53.7848 34.0376 53.7848C30.9201 53.7848 28.3862 51.2509 28.3862 48.1334V42.482H34.0376Z", fill: "#ECB22E" }), _jsx("path", { d: "M34.0381 39.6507C30.9016 39.6507 28.3867 37.1168 28.3867 33.9993C28.3867 30.8818 30.9206 28.3479 34.0381 28.3479H48.2306C51.3671 28.3479 53.882 30.8818 53.882 33.9993C53.882 37.1168 51.3482 39.6507 48.2306 39.6507H34.0381Z", fill: "#ECB22E" })] }));
32
57
  }
33
58
  export function Setup() {
34
59
  const { t } = useI18n();
35
- const { isAuthenticated, accessToken, sdk } = useIam();
60
+ const { isAuthenticated, accessToken } = useIam();
36
61
  const [later, setLater] = useKept(LATER_KEY, false);
37
62
  const [step, setStep] = useKept(STEP_KEY, 1);
38
63
  const [githubDone, setGithubDone] = useKept(GITHUB_KEY, false);
39
64
  const [slackDone, setSlackDone] = useKept(SLACK_KEY, false);
40
65
  const [googleDone, setGoogleDone] = useKept(GOOGLE_KEY, false);
66
+ const [googleAccounts, setGoogleAccounts] = useKept(GOOGLE_ACCOUNTS_KEY, []);
41
67
  const [busy, setBusy] = useState(null);
42
68
  const [modalOpen, setModalOpen] = useState(false);
43
69
  const [errorMsg, setErrorMsg] = useState(null);
44
70
  const [syncTurn, setSyncTurn] = useState(0);
45
71
  const signed = isAuthenticated && Boolean(accessToken);
46
- // Sync with remote integrations, connectors & linked IAM accounts when authenticated or returning from OAuth tab/popup
72
+ const accountList = Array.isArray(googleAccounts) ? googleAccounts : [];
73
+ const hasGoogle = googleDone || accountList.length > 0;
74
+ const addGoogleAccount = (rawEmail, tokenData) => {
75
+ const clean = rawEmail.trim().toLowerCase();
76
+ const current = Array.isArray(googleAccounts) ? googleAccounts : [];
77
+ const next = clean && !current.includes(clean) ? [...current, clean] : current;
78
+ setGoogleAccounts(next);
79
+ setGoogleDone(true);
80
+ if (typeof window !== 'undefined' && tokenData?.accessToken) {
81
+ try {
82
+ const rawTokens = window.localStorage.getItem(GOOGLE_TOKENS_KEY);
83
+ const parsed = rawTokens ? JSON.parse(rawTokens) : {};
84
+ parsed[clean || 'default'] = {
85
+ accessToken: tokenData.accessToken,
86
+ scope: tokenData.scope || GOOGLE_WORKSPACE_SCOPES,
87
+ connectedAt: new Date().toISOString(),
88
+ };
89
+ window.localStorage.setItem(GOOGLE_TOKENS_KEY, JSON.stringify(parsed));
90
+ }
91
+ catch {
92
+ // ignore storage errors
93
+ }
94
+ }
95
+ };
96
+ const removeGoogleAccount = (targetEmail) => {
97
+ const current = Array.isArray(googleAccounts) ? googleAccounts : [];
98
+ const next = current.filter((a) => a !== targetEmail);
99
+ setGoogleAccounts(next);
100
+ if (next.length === 0) {
101
+ setGoogleDone(false);
102
+ }
103
+ if (typeof window !== 'undefined') {
104
+ try {
105
+ const rawTokens = window.localStorage.getItem(GOOGLE_TOKENS_KEY);
106
+ if (rawTokens) {
107
+ const parsed = JSON.parse(rawTokens);
108
+ delete parsed[targetEmail];
109
+ window.localStorage.setItem(GOOGLE_TOKENS_KEY, JSON.stringify(parsed));
110
+ }
111
+ }
112
+ catch {
113
+ // ignore
114
+ }
115
+ }
116
+ };
117
+ // Sync with remote workspace integrations & connectors (never from IAM login linked-accounts,
118
+ // because basic IAM sign-in does not grant Google Drive/Docs/Sheets/Gmail/Calendar permissions).
47
119
  useEffect(() => {
48
120
  if (!signed)
49
121
  return;
@@ -56,10 +128,7 @@ export function Setup() {
56
128
  fetch(`${api()}/v1/integrations/connectors`, { headers: auth })
57
129
  .then((r) => (r.ok ? r.json() : null))
58
130
  .catch(() => null),
59
- fetch(`${api()}/v1/iam/linked-accounts`, { headers: auth })
60
- .then((r) => (r.ok ? r.json() : null))
61
- .catch(() => null),
62
- ]).then(([integrationsData, connectorsData, linkedData]) => {
131
+ ]).then(([integrationsData, connectorsData]) => {
63
132
  if (!live)
64
133
  return;
65
134
  const providers = Array.isArray(integrationsData?.providers)
@@ -68,76 +137,119 @@ export function Setup() {
68
137
  const connectors = Array.isArray(connectorsData?.connectors)
69
138
  ? connectorsData.connectors
70
139
  : null;
71
- const linkedAccounts = Array.isArray(linkedData?.data)
72
- ? linkedData.data
73
- : null;
74
- if (!providers && !connectors && !linkedAccounts)
140
+ if (!providers && !connectors)
75
141
  return;
76
142
  const connectedSet = new Set();
143
+ const discoveredGoogleAccounts = [];
77
144
  if (providers) {
78
145
  for (const p of providers) {
79
- if (p.connected)
80
- connectedSet.add(String(p.id));
146
+ if (p.connected) {
147
+ const id = String(p.id);
148
+ connectedSet.add(id);
149
+ const conn = p.connection;
150
+ if (id === 'google' && typeof conn?.account === 'string' && conn.account.trim()) {
151
+ discoveredGoogleAccounts.push(conn.account.trim().toLowerCase());
152
+ }
153
+ }
81
154
  }
82
155
  }
83
156
  if (connectors) {
84
157
  for (const c of connectors) {
85
- connectedSet.add(String(c.provider));
158
+ const prov = String(c.provider);
159
+ connectedSet.add(prov);
160
+ if (prov === 'google' && typeof c.account === 'string' && c.account.trim()) {
161
+ discoveredGoogleAccounts.push(c.account.trim().toLowerCase());
162
+ }
86
163
  }
87
164
  }
88
- if (linkedAccounts) {
89
- for (const l of linkedAccounts) {
90
- if (l.provider)
91
- connectedSet.add(String(l.provider).toLowerCase());
92
- }
93
- }
94
- const hasGithub = connectedSet.has('github') || connectedSet.has('github-copilot');
95
- const hasSlack = connectedSet.has('slack');
96
- const hasGoogle = connectedSet.has('google') ||
165
+ const remoteGithub = connectedSet.has('github') || connectedSet.has('github-copilot');
166
+ const remoteSlack = connectedSet.has('slack');
167
+ const remoteGoogle = connectedSet.has('google') ||
97
168
  connectedSet.has('gmail') ||
98
169
  connectedSet.has('google-drive') ||
99
170
  connectedSet.has('google-calendar');
100
- if (hasGithub)
171
+ if (remoteGithub)
101
172
  setGithubDone(true);
102
- if (hasSlack)
173
+ if (remoteSlack)
103
174
  setSlackDone(true);
104
- if (hasGoogle)
175
+ if (remoteGoogle)
105
176
  setGoogleDone(true);
177
+ if (discoveredGoogleAccounts.length > 0) {
178
+ const merged = Array.from(new Set([...accountList, ...discoveredGoogleAccounts]));
179
+ if (merged.length !== accountList.length) {
180
+ setGoogleAccounts(merged);
181
+ }
182
+ }
106
183
  });
107
184
  return () => {
108
185
  live = false;
109
186
  };
110
187
  }, [signed, syncTurn]);
188
+ // Listen for postMessage completion from /auth/callback popup and focus/visibility return
111
189
  useEffect(() => {
112
- if (!signed)
190
+ if (typeof window === 'undefined')
113
191
  return;
192
+ const onMessage = (ev) => {
193
+ if (ev.origin !== window.location.origin)
194
+ return;
195
+ const data = ev.data;
196
+ if (data?.type === 'hanzo-google-workspace-connected') {
197
+ addGoogleAccount(data.email || '', {
198
+ accessToken: data.accessToken || '',
199
+ scope: data.scope,
200
+ });
201
+ setSyncTurn((n) => n + 1);
202
+ }
203
+ };
114
204
  const onReturn = () => {
115
205
  if (document.visibilityState === 'visible') {
116
206
  setSyncTurn((n) => n + 1);
117
207
  }
118
208
  };
119
209
  const onFocus = () => setSyncTurn((n) => n + 1);
210
+ window.addEventListener('message', onMessage);
120
211
  document.addEventListener('visibilitychange', onReturn);
121
212
  window.addEventListener('focus', onFocus);
122
213
  return () => {
214
+ window.removeEventListener('message', onMessage);
123
215
  document.removeEventListener('visibilitychange', onReturn);
124
216
  window.removeEventListener('focus', onFocus);
125
217
  };
126
- }, [signed]);
127
- const totalDone = (githubDone ? 1 : 0) + (slackDone ? 1 : 0) + (googleDone ? 1 : 0);
218
+ }, [signed, googleAccounts]);
219
+ const totalDone = (githubDone ? 1 : 0) + (slackDone ? 1 : 0) + (hasGoogle ? 1 : 0);
128
220
  const allDone = totalDone === 3;
129
- // Automatically advance step if current step is already done
130
- useEffect(() => {
131
- if (step === 1 && githubDone)
132
- setStep(slackDone ? 3 : 2);
133
- else if (step === 2 && slackDone)
134
- setStep(googleDone ? 1 : 3);
135
- else if (step === 3 && googleDone && (!githubDone || !slackDone))
136
- setStep(!githubDone ? 1 : 2);
137
- }, [githubDone, slackDone, googleDone, step]);
221
+ const activeStep = step === 1 || step === 2 || step === 3 ? step : 1;
138
222
  if (later && !modalOpen)
139
223
  return null;
140
- const openOAuthPopup = (authorizeUrl, provider) => {
224
+ const completeGoogleToken = async (accessTokenValue, grantedScope, onDone) => {
225
+ let email = '';
226
+ try {
227
+ const userRes = await fetch('https://www.googleapis.com/oauth2/v2/userinfo', {
228
+ headers: { Authorization: `Bearer ${accessTokenValue}` },
229
+ });
230
+ if (userRes.ok) {
231
+ const userJson = (await userRes.json());
232
+ if (typeof userJson?.email === 'string') {
233
+ email = userJson.email.trim().toLowerCase();
234
+ }
235
+ }
236
+ }
237
+ catch {
238
+ // best-effort userinfo fetch
239
+ }
240
+ addGoogleAccount(email, {
241
+ accessToken: accessTokenValue,
242
+ scope: grantedScope || GOOGLE_WORKSPACE_SCOPES,
243
+ });
244
+ // Best-effort custody sync with backend
245
+ fetch(`${api()}/v1/integrations/google/connect`, {
246
+ method: 'POST',
247
+ headers: { ...scope(), 'Content-Type': 'application/json' },
248
+ body: JSON.stringify({ token: accessTokenValue, accountId: email }),
249
+ }).catch(() => null);
250
+ onDone();
251
+ };
252
+ const openOAuthPopup = (authorizeUrl, provider, onDone) => {
141
253
  const popup = window.open(authorizeUrl, `hanzo-oauth-${provider}`, 'width=600,height=700');
142
254
  if (!popup) {
143
255
  window.open(authorizeUrl, '_blank', 'noopener,noreferrer');
@@ -147,47 +259,67 @@ export function Setup() {
147
259
  if (popup.closed) {
148
260
  window.clearInterval(timer);
149
261
  setSyncTurn((n) => n + 1);
262
+ return;
263
+ }
264
+ if (provider === 'google') {
265
+ try {
266
+ if (popup.location.origin === window.location.origin) {
267
+ const hash = popup.location.hash || '';
268
+ if (hash.includes('access_token=') || hash.includes('error=')) {
269
+ const params = new URLSearchParams(hash.replace(/^#/, ''));
270
+ const tokenVal = params.get('access_token');
271
+ const scopeVal = params.get('scope');
272
+ window.clearInterval(timer);
273
+ popup.close();
274
+ if (tokenVal) {
275
+ void completeGoogleToken(tokenVal, scopeVal, onDone);
276
+ }
277
+ }
278
+ }
279
+ }
280
+ catch {
281
+ // Cross-origin while user is on accounts.google.com; ignore until callback redirects to same origin
282
+ }
150
283
  }
151
- }, 1000);
284
+ }, 250);
152
285
  }
153
286
  };
154
- const connectGoogleViaIam = async (onDone) => {
287
+ const resolveGoogleWorkspaceUrl = async () => {
288
+ let clientId = DEFAULT_GOOGLE_CLIENT_ID;
155
289
  try {
156
- const linkOrigin = here() && typeof window !== 'undefined' ? window.location.origin : api();
157
- const returnUri = typeof window !== 'undefined' ? `${window.location.origin}/auth/callback` : 'https://hanzo.ai/auth/callback';
158
- const linkRes = await fetch(`${linkOrigin}/v1/iam/link`, {
290
+ const res = await fetch(`${api()}/v1/integrations/google/connect`, {
159
291
  method: 'POST',
160
292
  headers: { ...scope(), 'Content-Type': 'application/json' },
161
- body: JSON.stringify({
162
- provider: 'provider-google',
163
- clientId: CLIENT,
164
- returnUri,
165
- }),
293
+ body: '{}',
166
294
  }).catch(() => null);
167
- if (linkRes?.ok) {
168
- const linkJson = (await linkRes.json().catch(() => null));
169
- if (linkJson?.status === 'ok' && typeof linkJson.data === 'string' && linkJson.data) {
170
- return linkJson.data;
171
- }
172
- if (linkJson?.msg && linkJson.msg.toLowerCase().includes('already connected')) {
173
- onDone();
174
- return 'done';
175
- }
176
- }
177
- if (sdk && typeof sdk.getSigninUrl === 'function') {
178
- const signinHref = await sdk.getSigninUrl({ additionalParams: { provider: 'provider-google' } });
179
- const url = new URL(signinHref);
180
- if (here() && typeof window !== 'undefined') {
181
- url.protocol = window.location.protocol;
182
- url.host = window.location.host;
295
+ if (res?.ok) {
296
+ const j = (await res.json().catch(() => null));
297
+ if (j?.authorizeUrl) {
298
+ try {
299
+ const parsed = new URL(j.authorizeUrl);
300
+ const cid = parsed.searchParams.get('client_id');
301
+ if (cid)
302
+ clientId = cid;
303
+ if (!here()) {
304
+ parsed.searchParams.set('scope', GOOGLE_WORKSPACE_SCOPES);
305
+ parsed.searchParams.set('access_type', 'offline');
306
+ parsed.searchParams.set('include_granted_scopes', 'true');
307
+ parsed.searchParams.set('prompt', 'select_account consent');
308
+ return parsed.toString();
309
+ }
310
+ }
311
+ catch {
312
+ // fall through
313
+ }
183
314
  }
184
- return url.href;
185
315
  }
186
316
  }
187
317
  catch {
188
318
  // fall through
189
319
  }
190
- return null;
320
+ const origin = typeof window !== 'undefined' ? window.location.origin : 'https://hanzo.ai';
321
+ const state = `gws_${Date.now().toString(36)}`;
322
+ return buildGoogleWorkspaceAuthorizeUrl(origin, clientId, state);
191
323
  };
192
324
  const connectOAuthProvider = async (provider, label, onDone) => {
193
325
  if (!signed) {
@@ -198,13 +330,9 @@ export function Setup() {
198
330
  setErrorMsg(null);
199
331
  try {
200
332
  if (provider === 'google') {
201
- const iamResult = await connectGoogleViaIam(onDone);
202
- if (iamResult === 'done')
203
- return;
204
- if (iamResult) {
205
- openOAuthPopup(iamResult, 'google');
206
- return;
207
- }
333
+ const googleUrl = await resolveGoogleWorkspaceUrl();
334
+ openOAuthPopup(googleUrl, 'google', onDone);
335
+ return;
208
336
  }
209
337
  const res = await fetch(`${api()}/v1/integrations/${provider}/connect`, {
210
338
  method: 'POST',
@@ -228,7 +356,7 @@ export function Setup() {
228
356
  }
229
357
  const j = (await res.json());
230
358
  if (j.authorizeUrl) {
231
- openOAuthPopup(j.authorizeUrl, provider);
359
+ openOAuthPopup(j.authorizeUrl, provider, onDone);
232
360
  }
233
361
  else if (j.connected) {
234
362
  onDone();
@@ -251,9 +379,19 @@ export function Setup() {
251
379
  setSlackDone(true);
252
380
  setStep(3);
253
381
  });
254
- // 3. Connect Google (Gmail, Calendar & Drive)
382
+ // 3. Connect Google Workspace (Drive, Docs, Sheets, Gmail & Calendar; supports multiple accounts)
255
383
  const handleConnectGoogle = () => connectOAuthProvider('google', 'Google', () => {
256
384
  setGoogleDone(true);
257
385
  });
258
- 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') }) }) })] }) })] }));
386
+ 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, { render: "button", "aria-label": t('Step 1: Connect GitHub'), onClick: () => setStep(1), flex: 1, height: 6, rounded: 3, bg: githubDone ? GOOD : activeStep === 1 ? '$ink' : '$edge', cursor: "pointer" }), _jsx(Box, { render: "button", "aria-label": t('Step 2: Connect Slack'), onClick: () => setStep(2), flex: 1, height: 6, rounded: 3, bg: slackDone ? GOOD : activeStep === 2 ? '$ink' : '$edge', cursor: "pointer" }), _jsx(Box, { render: "button", "aria-label": t('Step 3: Connect Google'), onClick: () => setStep(3), flex: 1, height: 6, rounded: 3, bg: hasGoogle ? GOOD : activeStep === 3 ? '$ink' : '$edge', cursor: "pointer" })] }), 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') })] }), accountList.length > 0 ? (_jsx(XStack, { gap: "$1", flexWrap: "wrap", children: accountList.map((acct) => (_jsxs(XStack, { items: "center", gap: "$1", px: "$2", py: "$0.5", rounded: "$2", bg: "$edge", children: [_jsx(Text, { fontSize: "$1", color: "$ink", numberOfLines: 1, children: acct }), _jsx(Box, { render: "button", "aria-label": t('Remove {account}', { account: acct }), onClick: () => removeGoogleAccount(acct), cursor: "pointer", children: _jsx(X, { size: 11, color: "$soft", "aria-hidden": true }) })] }, acct))) })) : null, _jsxs(XStack, { gap: "$1.5", items: "center", flexWrap: "wrap", children: [_jsx(Box, { render: "button", onClick: handleConnectGoogle, px: "$2.5", py: "$1", rounded: "$3", bg: "$edge", hoverStyle: { bg: '$hover' }, cursor: "pointer", children: _jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(Plus, { size: 12, color: "$ink", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "500", color: "$ink", children: t('Add Google account') })] }) }), _jsx(Box, { render: "button", onClick: () => setLater(true), px: "$2.5", py: "$1", rounded: "$3", bg: "$edge", hoverStyle: { bg: '$hover' }, items: "center", justify: "center", cursor: "pointer", children: _jsx(Text, { fontSize: "$2", fontWeight: "500", children: t('Done') }) })] })] })) : activeStep === 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') }) })] })] })) : activeStep === 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') })] }), hasGoogle ? (_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: accountList.length > 1
387
+ ? t('{n} connected', { n: accountList.length })
388
+ : t('Connected') })] })) : null] }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Grant Drive, Docs, Sheets, Gmail & Calendar permissions. Add personal, work, or multiple org accounts.') }), accountList.length > 0 ? (_jsx(XStack, { gap: "$1", flexWrap: "wrap", children: accountList.map((acct) => (_jsxs(XStack, { items: "center", gap: "$1", px: "$2", py: "$0.5", rounded: "$2", bg: "$edge", children: [_jsx(Text, { fontSize: "$1", color: "$ink", numberOfLines: 1, children: acct }), _jsx(Box, { render: "button", "aria-label": t('Remove {account}', { account: acct }), onClick: () => removeGoogleAccount(acct), cursor: "pointer", children: _jsx(X, { size: 11, color: "$soft", "aria-hidden": true }) })] }, acct))) })) : null, _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'
389
+ ? t('Connecting…')
390
+ : hasGoogle
391
+ ? t('+ Add Google account')
392
+ : 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: hasGoogle ? t('Done') : 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 (Drive, Docs, Sheets, Gmail & Calendar) across personal and business orgs.', { 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(YStack, { p: "$3", rounded: "$4", borderWidth: 1, borderColor: hasGoogle ? GOOD : '$borderColor', bg: "$raised", gap: "$2.5", children: [_jsxs(XStack, { 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 (Drive, Docs, Sheets, Gmail & Calendar)') }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Edit Drive files, Docs, Sheets, Gmail & Calendar across personal and business accounts') })] })] }), _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'
393
+ ? t('Connecting…')
394
+ : hasGoogle
395
+ ? t('+ Add account')
396
+ : t('Connect') }) })] }), accountList.length > 0 ? (_jsx(XStack, { gap: "$1.5", flexWrap: "wrap", children: accountList.map((acct) => (_jsxs(XStack, { items: "center", gap: "$1.5", px: "$2.5", py: "$1", rounded: "$2", bg: "$hover", children: [_jsx(Check, { size: 12, color: GOOD, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", color: "$ink", fontWeight: "500", children: acct }), _jsx(Box, { render: "button", "aria-label": t('Remove {account}', { account: acct }), onClick: () => removeGoogleAccount(acct), cursor: "pointer", children: _jsx(X, { size: 12, color: "$soft", "aria-hidden": true }) })] }, acct))) })) : null] })] }), _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') }) }) })] }) })] }));
259
397
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/app",
3
- "version": "0.2.22",
3
+ "version": "0.2.23",
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",