@hanzo/app 0.3.55 → 0.3.56
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/Account.js +1 -1
- package/dist/Rail.js +4 -3
- package/dist/lib/destination.d.ts +7 -5
- package/dist/lib/destination.js +14 -8
- package/dist/lib/host.d.ts +17 -12
- package/dist/lib/host.js +28 -23
- package/package.json +1 -1
package/dist/Account.js
CHANGED
|
@@ -288,7 +288,7 @@ export function Account({ host, narrow = false, above = false, onOrg, defaultAcc
|
|
|
288
288
|
// Clear of the rail's mark (or the row) it opens from, and flush with its foot.
|
|
289
289
|
offset: 8, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(XStack, { ref: (el) => {
|
|
290
290
|
row.current = el instanceof HTMLElement ? el : null;
|
|
291
|
-
}, render: "button", "data-slot": "me", "aria-label": t('Account: {name}', { name: [who, current].filter(Boolean).join(' · ') }),
|
|
291
|
+
}, render: "button", "data-slot": "me", "aria-label": t('Account: {name}', { name: [who, current].filter(Boolean).join(' · ') }), width: narrow ? (above ? 44 : 36) : '100%', minH: narrow ? (above ? 44 : 36) : 48,
|
|
292
292
|
// A thumb's 44 on a touch screen.
|
|
293
293
|
$touchable: narrow ? { width: 44, minH: 44 } : undefined, px: narrow ? 0 : '$2', gap: "$2.5", rounded: narrow ? 999 : '$5', borderWidth: narrow && above ? 1 : 0, borderColor: narrow && above ? 'var(--border-strong)' : undefined, bg: narrow && above ? 'var(--pane-fill)' : undefined, 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 ? (above ? 32 : 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) => {
|
|
294
294
|
e?.stopPropagation?.();
|
package/dist/Rail.js
CHANGED
|
@@ -129,12 +129,13 @@ export function Rail({ host, mode, at, open, toggle, inside = null, rows = false
|
|
|
129
129
|
return (_jsxs(YStack, { "data-slot": "rail", render: "nav", "aria-label": t('Products'), width: RAIL, flex: 1,
|
|
130
130
|
// As tall as the window and no taller: its marks scroll inside it (below), never the page.
|
|
131
131
|
minH: 0,
|
|
132
|
-
// The first mark stands at the pane's top edge, one head row high (HEAD), the
|
|
133
|
-
|
|
132
|
+
// The first mark stands at the pane's top edge, one head row high (HEAD), and the last at its foot by the
|
|
133
|
+
// same inset, so the account mirrors the sidebar's toggle across the rail.
|
|
134
|
+
pt: (HEAD - MARK) / 2, pb: (HEAD - MARK) / 2, gap: 4, shrink: 0, items: "center", $touchable: { pt: (TOUCH_HEAD - TOUCH) / 2, pb: (TOUCH_HEAD - TOUCH) / 2 }, children: [toggle ? (_jsx(YStack, { children: _jsx(Toggle, { open: open, onPress: toggle }) })) : null, _jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", items: "center", gap: 4, width: "100%", "$platform-web": { scrollbarWidth: 'none' }, children: [_jsx(Mark, { label: t('Chat'), on: mode === 'chat', onPress: onChat, "data-slot": "rail-chat", children: _jsx(MARKS.chat.icon, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Dev", on: mode === 'dev' && !here, onPress: onDev, "data-slot": "rail-dev", children: _jsx(MARKS.dev.icon, { size: 18, "aria-hidden": true }) }), anon ? null : (_jsx(Mark, { label: "Design", on: mode === 'design', onPress: onDesign, "data-slot": "rail-design", children: _jsx(MARKS.design.icon, { size: 18, "aria-hidden": true }) })), !anon && opened('studio') ? (_jsx(Mark, { label: "Studio", on: mode === 'studio', onPress: onStudio, "data-slot": "rail-studio", children: _jsx(MARKS.studio.icon, { size: 18, "aria-hidden": true }) })) : null, anon ? null : (_jsx(Mark, { label: "Tabs", on: mode === 'tabs', onPress: onTabs, "data-slot": "rail-tabs", children: _jsx(MARKS.tabs.icon, { size: 18, "aria-hidden": true }) })), apps.map((a) => (_jsx(Mark, { label: a.name, on: inside === a.id, onPress: () => go(hosted(a.id)), "data-slot": `rail-app-${a.id}`, children: _jsx(a.icon, { size: 18, "aria-hidden": true }) }, a.id))), _jsx(Mark, { label: t('Library'), on: here === 'library', onPress: to(RAISED.library), "data-slot": "rail-library", children: _jsx(MARKS.library.icon, { size: 18, "aria-hidden": true }) }), anon ? null : (_jsx(Mark, { label: t('Scheduled tasks'), on: here === 'scheduled', onPress: to(RAISED.scheduled), "data-slot": "rail-scheduled", children: _jsx(MARKS.scheduled.icon, { size: 18, "aria-hidden": true }) })), anon ? null : (_jsx(Mark, { label: t('Customize'), on: here === 'customize', onPress: to(RAISED.customize), "data-slot": "rail-customize", children: _jsx(MARKS.customize.icon, { size: 18, "aria-hidden": true }) })), anon ? null : (_jsx(Mark, { label: t('Betas'), on: mode === 'beta', onPress: () => go('/beta'), "data-slot": "rail-betas", children: _jsx(FlaskConical, { size: 18, "aria-hidden": true }) })), betasDialog, !anon && rest.length ? (_jsx(DropdownMenu
|
|
134
135
|
// Toward the content: right of the rail, left of it right to left.
|
|
135
136
|
, {
|
|
136
137
|
// Toward the content: right of the rail, left of it right to left.
|
|
137
|
-
placement: dir === 'rtl' ? 'left-start' : 'right-start', minWidth: 220, trigger: _jsx(XStack, { render: "button", "aria-label": t('More'), ...{ title: t('More') }, "data-slot": "rail-more", width: MARK, height: MARK, rounded: "$4", items: "center", justify: "center", cursor: "pointer", opacity: 0.62, hoverStyle: { bg: '$hover', opacity: 1 }, pressStyle: { bg: '$raised' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, $touchable: { width: 44, height: 44 }, children: _jsx(Ellipsis, { size: 18, "aria-hidden": true }) }), items: rest })) : null] }), anon ? (_jsxs(YStack, { gap: 4, items: "center",
|
|
138
|
+
placement: dir === 'rtl' ? 'left-start' : 'right-start', minWidth: 220, trigger: _jsx(XStack, { render: "button", "aria-label": t('More'), ...{ title: t('More') }, "data-slot": "rail-more", width: MARK, height: MARK, rounded: "$4", items: "center", justify: "center", cursor: "pointer", opacity: 0.62, hoverStyle: { bg: '$hover', opacity: 1 }, pressStyle: { bg: '$raised' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, $touchable: { width: 44, height: 44 }, children: _jsx(Ellipsis, { size: 18, "aria-hidden": true }) }), items: rest })) : null] }), anon ? (_jsxs(YStack, { gap: 4, items: "center", children: [_jsx(Mark, { label: t('See plans and pricing'), "data-slot": "anon-pricing", onPress: () => {
|
|
138
139
|
if (typeof window !== 'undefined')
|
|
139
140
|
window.location.assign('/pricing');
|
|
140
141
|
}, children: _jsx(Sparkles, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Help'), "data-slot": "anon-help", onPress: () => {
|
|
@@ -50,7 +50,7 @@ export declare function door(): string;
|
|
|
50
50
|
* Every signed-out door into the app is this one call: /chat, /dev and every
|
|
51
51
|
* path under them, an app. The page is written down, and the browser goes to `to`,
|
|
52
52
|
* which asks IAM for an existing session before it draws a form
|
|
53
|
-
* (components/auth/panel.tsx `Gate`). On a `guest` host the same address is asked for on hanzo.
|
|
53
|
+
* (components/auth/panel.tsx `Gate`). On a `guest` host the same address is asked for on hanzo.app instead. With no `to`
|
|
54
54
|
* the page is `door()`'s; a control that says "Sign in" names LOGIN.
|
|
55
55
|
*/
|
|
56
56
|
export declare function enter(to?: string): void;
|
|
@@ -75,10 +75,12 @@ export declare function entry(to: string, here: string): string;
|
|
|
75
75
|
*/
|
|
76
76
|
export declare function onward(search: string): string | undefined;
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
79
|
-
* it left
|
|
80
|
-
*
|
|
81
|
-
*
|
|
78
|
+
* Send this sign-in to `address` on hanzo.app, the app's host, and report that
|
|
79
|
+
* it left, from a host that cannot start one for itself: a `guest` (no client
|
|
80
|
+
* lists its callback), and hanzo.ai opened with no app's authorize request in
|
|
81
|
+
* its address, where a session would land on the site rather than in the app.
|
|
82
|
+
* hanzo.app starts its own request and comes back to hanzo.ai's page with it.
|
|
83
|
+
* Anywhere else, do nothing and report false so the caller signs in here.
|
|
82
84
|
*/
|
|
83
85
|
export declare function handoff(address: string): boolean;
|
|
84
86
|
/**
|
package/dist/lib/destination.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* person who cannot be sent back to their page must still be signed in, so a
|
|
20
20
|
* refusal degrades to the default and never to an exception.
|
|
21
21
|
*/
|
|
22
|
-
import { apex, guest,
|
|
22
|
+
import { apex, GET, guest, signs } from "./host.js";
|
|
23
23
|
import { SHARED } from "./share.js";
|
|
24
24
|
import { where } from "../where.js";
|
|
25
25
|
/** The default on the apex: `/`, which takes anyone signed in to the app, in
|
|
@@ -110,7 +110,7 @@ export function door() {
|
|
|
110
110
|
* Every signed-out door into the app is this one call: /chat, /dev and every
|
|
111
111
|
* path under them, an app. The page is written down, and the browser goes to `to`,
|
|
112
112
|
* which asks IAM for an existing session before it draws a form
|
|
113
|
-
* (components/auth/panel.tsx `Gate`). On a `guest` host the same address is asked for on hanzo.
|
|
113
|
+
* (components/auth/panel.tsx `Gate`). On a `guest` host the same address is asked for on hanzo.app instead. With no `to`
|
|
114
114
|
* the page is `door()`'s; a control that says "Sign in" names LOGIN.
|
|
115
115
|
*/
|
|
116
116
|
export function enter(to = door()) {
|
|
@@ -162,15 +162,21 @@ export function onward(search) {
|
|
|
162
162
|
return next && safe(next, "") === next ? next : undefined;
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
|
-
*
|
|
166
|
-
* it left
|
|
167
|
-
*
|
|
168
|
-
*
|
|
165
|
+
* Send this sign-in to `address` on hanzo.app, the app's host, and report that
|
|
166
|
+
* it left, from a host that cannot start one for itself: a `guest` (no client
|
|
167
|
+
* lists its callback), and hanzo.ai opened with no app's authorize request in
|
|
168
|
+
* its address, where a session would land on the site rather than in the app.
|
|
169
|
+
* hanzo.app starts its own request and comes back to hanzo.ai's page with it.
|
|
170
|
+
* Anywhere else, do nothing and report false so the caller signs in here.
|
|
169
171
|
*/
|
|
170
172
|
export function handoff(address) {
|
|
171
|
-
if (typeof window === "undefined"
|
|
173
|
+
if (typeof window === "undefined")
|
|
172
174
|
return false;
|
|
173
|
-
window.location.
|
|
175
|
+
const host = window.location.hostname;
|
|
176
|
+
const asked = new URLSearchParams(address.split("#")[0].split("?")[1] ?? "").has("client_id");
|
|
177
|
+
if (!guest(host) && !(signs(host) && !asked))
|
|
178
|
+
return false;
|
|
179
|
+
window.location.assign(GET + address);
|
|
174
180
|
return true;
|
|
175
181
|
}
|
|
176
182
|
/**
|
package/dist/lib/host.d.ts
CHANGED
|
@@ -187,13 +187,20 @@ export declare function leaves(address: string): boolean;
|
|
|
187
187
|
export { APPS as ROOMS, leaves as room };
|
|
188
188
|
/**
|
|
189
189
|
* Where an address belongs when it is asked for on `hostname`: on a `guest`
|
|
190
|
-
* host, the same address on hanzo.app, because every app signs
|
|
191
|
-
* host cannot; on the apex, the same app and query on the
|
|
192
|
-
* null. Home is the workspace's root, so /home?channel=x
|
|
190
|
+
* host, the same address on hanzo.app, the app's host, because every app signs
|
|
191
|
+
* in and a guest host cannot; on the apex, the same app and query on the
|
|
192
|
+
* workspace; otherwise null. Home is the workspace's root, so /home?channel=x
|
|
193
|
+
* lands on /?channel=x.
|
|
193
194
|
*/
|
|
194
195
|
export declare const away: (hostname: string, address: string) => string | null;
|
|
195
|
-
/**
|
|
196
|
-
|
|
196
|
+
/**
|
|
197
|
+
* Where Hanzo signs in: hanzo.ai's own page. The app's host, hanzo.app, keeps
|
|
198
|
+
* its session and visits it (`VISITS`): it leaves with its own authorize
|
|
199
|
+
* request, hanzo.ai's page finishes it, and the code comes back to hanzo.app.
|
|
200
|
+
*/
|
|
201
|
+
export declare const SIGNIN = "https://hanzo.ai";
|
|
202
|
+
/** Whether a host is the one Hanzo signs in on. */
|
|
203
|
+
export declare const signs: (hostname: string) => boolean;
|
|
197
204
|
/**
|
|
198
205
|
* The Hanzo App, to get: the page with Download, Install CLI and Open in web.
|
|
199
206
|
* It is this export's /app, served as the root of hanzo.app (universe
|
|
@@ -202,17 +209,15 @@ export declare const SIGNIN = "https://hanzo.app";
|
|
|
202
209
|
export declare const GET = "https://hanzo.app";
|
|
203
210
|
/**
|
|
204
211
|
* The app, opened from another host: the chat at hanzo.app/chat. A reader who
|
|
205
|
-
* is signed out
|
|
206
|
-
* back in the chat.
|
|
212
|
+
* is signed out signs in on hanzo.ai's page and lands back in the chat.
|
|
207
213
|
*/
|
|
208
214
|
export declare const WEB = "https://hanzo.app/chat";
|
|
209
215
|
/**
|
|
210
|
-
* Whether a host serves this export and signs nobody in: hanzo.
|
|
211
|
-
*
|
|
212
|
-
* alias the Sites plane serves it at; and hanzo.chat, whose root is /forward.
|
|
216
|
+
* Whether a host serves this export and signs nobody in: every `<slug>.hanzo.app`
|
|
217
|
+
* alias the Sites plane serves it at, and hanzo.chat, whose root is /forward.
|
|
213
218
|
* `<slug>.hanzo.app` is a namespace customers publish into and hanzo.chat is
|
|
214
|
-
* only an address for the chat, so no sign-in runs under
|
|
215
|
-
*
|
|
219
|
+
* only an address for the chat, so no sign-in runs under either: every address
|
|
220
|
+
* is the same address on hanzo.app.
|
|
216
221
|
*/
|
|
217
222
|
export declare const guest: (hostname: string) => boolean;
|
|
218
223
|
/**
|
package/dist/lib/host.js
CHANGED
|
@@ -302,20 +302,27 @@ export function leaves(address) {
|
|
|
302
302
|
export { APPS as ROOMS, leaves as room };
|
|
303
303
|
/**
|
|
304
304
|
* Where an address belongs when it is asked for on `hostname`: on a `guest`
|
|
305
|
-
* host, the same address on hanzo.app, because every app signs
|
|
306
|
-
* host cannot; on the apex, the same app and query on the
|
|
307
|
-
* null. Home is the workspace's root, so /home?channel=x
|
|
305
|
+
* host, the same address on hanzo.app, the app's host, because every app signs
|
|
306
|
+
* in and a guest host cannot; on the apex, the same app and query on the
|
|
307
|
+
* workspace; otherwise null. Home is the workspace's root, so /home?channel=x
|
|
308
|
+
* lands on /?channel=x.
|
|
308
309
|
*/
|
|
309
310
|
export const away = (hostname, address) => {
|
|
310
311
|
if (guest(hostname))
|
|
311
|
-
return
|
|
312
|
+
return GET + address;
|
|
312
313
|
if (!apex(hostname) || !leaves(address))
|
|
313
314
|
return null;
|
|
314
315
|
const home = address.match(/^\/home\/?(?=[?#]|$)/);
|
|
315
316
|
return home ? `${WORKSPACE}/${address.slice(home[0].length)}` : `${WORKSPACE}${address}`;
|
|
316
317
|
};
|
|
317
|
-
/**
|
|
318
|
-
|
|
318
|
+
/**
|
|
319
|
+
* Where Hanzo signs in: hanzo.ai's own page. The app's host, hanzo.app, keeps
|
|
320
|
+
* its session and visits it (`VISITS`): it leaves with its own authorize
|
|
321
|
+
* request, hanzo.ai's page finishes it, and the code comes back to hanzo.app.
|
|
322
|
+
*/
|
|
323
|
+
export const SIGNIN = 'https://hanzo.ai';
|
|
324
|
+
/** Whether a host is the one Hanzo signs in on. */
|
|
325
|
+
export const signs = (hostname) => hostname === 'hanzo.ai' || hostname === 'www.hanzo.ai';
|
|
319
326
|
/**
|
|
320
327
|
* The Hanzo App, to get: the page with Download, Install CLI and Open in web.
|
|
321
328
|
* It is this export's /app, served as the root of hanzo.app (universe
|
|
@@ -324,19 +331,17 @@ export const SIGNIN = 'https://hanzo.app';
|
|
|
324
331
|
export const GET = 'https://hanzo.app';
|
|
325
332
|
/**
|
|
326
333
|
* The app, opened from another host: the chat at hanzo.app/chat. A reader who
|
|
327
|
-
* is signed out
|
|
328
|
-
* back in the chat.
|
|
334
|
+
* is signed out signs in on hanzo.ai's page and lands back in the chat.
|
|
329
335
|
*/
|
|
330
|
-
export const WEB = `${
|
|
336
|
+
export const WEB = `${GET}${CHAT}`;
|
|
331
337
|
/**
|
|
332
|
-
* Whether a host serves this export and signs nobody in: hanzo.
|
|
333
|
-
*
|
|
334
|
-
* alias the Sites plane serves it at; and hanzo.chat, whose root is /forward.
|
|
338
|
+
* Whether a host serves this export and signs nobody in: every `<slug>.hanzo.app`
|
|
339
|
+
* alias the Sites plane serves it at, and hanzo.chat, whose root is /forward.
|
|
335
340
|
* `<slug>.hanzo.app` is a namespace customers publish into and hanzo.chat is
|
|
336
|
-
* only an address for the chat, so no sign-in runs under
|
|
337
|
-
*
|
|
341
|
+
* only an address for the chat, so no sign-in runs under either: every address
|
|
342
|
+
* is the same address on hanzo.app.
|
|
338
343
|
*/
|
|
339
|
-
export const guest = (hostname) => hostname
|
|
344
|
+
export const guest = (hostname) => hostname.endsWith('.hanzo.app') || hostname === 'hanzo.chat';
|
|
340
345
|
/** The devnet's hosts are one label under hanzo.ai ending in `-dev`: app-dev, api-dev, id-dev. */
|
|
341
346
|
const DEVNET = '-dev.hanzo.ai';
|
|
342
347
|
/**
|
|
@@ -356,20 +361,20 @@ export function devnet(hostname) {
|
|
|
356
361
|
}
|
|
357
362
|
/**
|
|
358
363
|
* The hosts that answer IAM's sign-in and sign-out calls on their own origin:
|
|
359
|
-
* hanzo.
|
|
360
|
-
* hanzo-domains `v1-hanzo-app`),
|
|
361
|
-
* /v1 proxy.
|
|
364
|
+
* hanzo.ai, where Hanzo signs in (universe static-sites `hanzo-ai`'s /v1/iam
|
|
365
|
+
* routes), hanzo.app (its /v1 is the cloud API, hanzo-domains `v1-hanzo-app`),
|
|
366
|
+
* testnet's test.hanzo.ai, and the dev server's /v1 proxy.
|
|
362
367
|
*/
|
|
363
|
-
const ANSWERS = new Set([...APEX, 'test.hanzo.ai', 'localhost', '127.0.0.1']);
|
|
368
|
+
const ANSWERS = new Set(['hanzo.ai', 'www.hanzo.ai', ...APEX, 'test.hanzo.ai', 'localhost', '127.0.0.1']);
|
|
364
369
|
/**
|
|
365
370
|
* The hosts this export is served on that keep a session of their own and sign
|
|
366
|
-
* in on hanzo.
|
|
371
|
+
* in on hanzo.ai: a person signed out there is sent to hanzo.ai/login carrying
|
|
367
372
|
* the host's OWN authorize request (its callback, its PKCE challenge), which
|
|
368
|
-
* hanzo.
|
|
373
|
+
* hanzo.ai's page finishes, and the code comes back to the host's
|
|
369
374
|
* /auth/callback. One sign-in page for Hanzo, and nobody types a credential on
|
|
370
|
-
* these hosts.
|
|
375
|
+
* these hosts. hanzo.app, the app's own host, is one.
|
|
371
376
|
*/
|
|
372
|
-
const VISITS = new Set(['cloud.hanzo.ai', 'hanzo.bot', 'bot.hanzo.ai']);
|
|
377
|
+
const VISITS = new Set([...APEX, 'cloud.hanzo.ai', 'hanzo.bot', 'bot.hanzo.ai']);
|
|
373
378
|
/** Whether a host signs in on hanzo.ai with its own request (`VISITS`). */
|
|
374
379
|
export const visits = (hostname) => VISITS.has(hostname);
|
|
375
380
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/app",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.56",
|
|
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",
|