@hanzo/app 0.3.55 → 0.3.57

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 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(' · ') }), ...{ title: who }, width: narrow ? (above ? 44 : 36) : '100%', minH: narrow ? (above ? 44 : 36) : 48,
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 account on the sidebar's foot (Sidebar's `pb`).
133
- pt: (HEAD - MARK) / 2, pb: "$2", gap: 4, shrink: 0, items: "center", $touchable: { pt: (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
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", pb: 4, children: [_jsx(Mark, { label: t('See plans and pricing'), "data-slot": "anon-pricing", onPress: () => {
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: () => {
package/dist/Shell.js CHANGED
@@ -79,7 +79,7 @@ import { Face } from "./cast.js";
79
79
  import { useStarred, titleOf } from "./stars.js";
80
80
  import { channelName } from "./network.js";
81
81
  import { useChannels, teamKey, channelHref } from "./channels.js";
82
- import { apex, app, away, dev, ENTRY, leaves, WORKSPACE } from "./lib/host.js";
82
+ import { apex, app, away, chat, CHAT as TALK, dev, ENTRY, leaves, WORKSPACE } from "./lib/host.js";
83
83
  import { netKey } from "./conversations.js";
84
84
  import { FIRST, SettingsList, } from "./Settings.js";
85
85
  import { Search } from "./Search.js";
@@ -167,7 +167,10 @@ const HOME = {
167
167
  */
168
168
  const CHAT = {
169
169
  id: "chat",
170
- route: "/chat",
170
+ // Chat's own address: `/` on the app's host, /chat elsewhere (lib/host `chat`).
171
+ get route() {
172
+ return chat();
173
+ },
171
174
  get name() {
172
175
  return brand();
173
176
  },
@@ -1468,5 +1471,5 @@ function Frame({ mode, children, navigate, back, forward, }) {
1468
1471
  setPeeking(false);
1469
1472
  }, children: list })) : null, _jsx(Split, { swap: settingsPane ? _jsx(Suspense, { fallback: null, children: _jsx(SettingsPane, { id: settingsPane }) }) : undefined, children: children }), finding ? (_jsx(Search, { actions: doors, onClose: found,
1470
1473
  // A chat opens in this workspace's Chat, the palette having picked it; the rest is the app's.
1471
- go: (to) => navigate?.(to.startsWith(CHAT.route) ? CHAT.route : site(to)) })) : null] }));
1474
+ go: (to) => navigate?.(to.startsWith(TALK) ? chat() : site(to)) })) : null] }));
1472
1475
  }
@@ -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.ai instead. With no `to`
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
- * On a `guest` host, send this sign-in to `address` on hanzo.ai and report that
79
- * it left; anywhere else, do nothing and report false so the caller signs in
80
- * here. A guest host cannot finish a sign-in (no client lists its callback), so
81
- * starting one there only reaches IAM's refusal.
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
  /**
@@ -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, SIGNIN } from "./host.js";
22
+ import { apex, guest, HOST, 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.ai instead. With no `to`
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
- * On a `guest` host, send this sign-in to `address` on hanzo.ai and report that
166
- * it left; anywhere else, do nothing and report false so the caller signs in
167
- * here. A guest host cannot finish a sign-in (no client lists its callback), so
168
- * starting one there only reaches IAM's refusal.
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" || !guest(window.location.hostname))
173
+ if (typeof window === "undefined")
172
174
  return false;
173
- window.location.assign(SIGNIN + address);
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(HOST + address);
174
180
  return true;
175
181
  }
176
182
  /**
@@ -49,6 +49,8 @@ export declare const TABS = "https://tabs.hanzo.ai";
49
49
  */
50
50
  export declare const CHAT = "/chat";
51
51
  export declare const DEV = "/dev";
52
+ /** Chat's own address on this host: `/` on the app's, /chat on every other. */
53
+ export declare const chat: () => string;
52
54
  /**
53
55
  * Studio: making images, audio, video and documents, and editing them.
54
56
  * hanzo.ai/studio, whose page draws the app for a signed-in reader.
@@ -82,7 +84,7 @@ export declare const studio: (at: string) => string;
82
84
  export declare const design: (at: string) => string;
83
85
  /** Flow at an address of its own (@hanzo/studio `FlowStudio`): '' is New, /flow. */
84
86
  export declare const flow: (at: string) => string;
85
- /** Chat on a conversation, or /chat itself for a new one. */
87
+ /** Chat on a conversation, or Chat itself for a new one (`chat`: `/` on the app's host). */
86
88
  export declare const talk: (id?: string | null) => string;
87
89
  /**
88
90
  * Settings, and every page under it: the person's and the organization's, the
@@ -187,32 +189,35 @@ export declare function leaves(address: string): boolean;
187
189
  export { APPS as ROOMS, leaves as room };
188
190
  /**
189
191
  * 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 in and a guest
191
- * host cannot; on the apex, the same app and query on the workspace; otherwise
192
- * null. Home is the workspace's root, so /home?channel=x lands on /?channel=x.
192
+ * host, the same address on hanzo.app, the app's host, because every app signs
193
+ * in and a guest host cannot; on the apex, the same app and query on the
194
+ * workspace; otherwise null. Home is the workspace's root, so /home?channel=x
195
+ * lands on /?channel=x.
193
196
  */
194
197
  export declare const away: (hostname: string, address: string) => string | null;
195
- /** Where a sign-in started on a `guest` host is finished: the app's own host. */
196
- export declare const SIGNIN = "https://hanzo.app";
197
198
  /**
198
- * The Hanzo App, to get: the page with Download, Install CLI and Open in web.
199
- * It is this export's /app, served as the root of hanzo.app (universe
200
- * static-sites `hanzo-app`), so it is linked by that address.
199
+ * Where Hanzo signs in: hanzo.ai's own page. The app's host, hanzo.app, keeps
200
+ * its session and visits it (`VISITS`): it leaves with its own authorize
201
+ * request, hanzo.ai's page finishes it, and the code comes back to hanzo.app.
201
202
  */
202
- export declare const GET = "https://hanzo.app";
203
+ export declare const SIGNIN = "https://hanzo.ai";
204
+ /** Whether a host is the one Hanzo signs in on. */
205
+ export declare const signs: (hostname: string) => boolean;
206
+ /** The app's own host. Chat is its root. */
207
+ export declare const HOST = "https://hanzo.app";
208
+ /** The Hanzo App, to get: the page with Download, Install CLI and Open in web, this export's /app. */
209
+ export declare const GET = "https://hanzo.app/app";
203
210
  /**
204
- * The app, opened from another host: the chat at hanzo.app/chat. A reader who
205
- * is signed out is asked to sign in there, on hanzo.app's own page, and lands
206
- * back in the chat.
211
+ * The app, opened from another host: Chat, at hanzo.app's root. A reader who is
212
+ * signed out signs in on hanzo.ai's page and lands back in it.
207
213
  */
208
- export declare const WEB = "https://hanzo.app/chat";
214
+ export declare const WEB = "https://hanzo.app/";
209
215
  /**
210
- * Whether a host serves this export and signs nobody in: hanzo.ai, the
211
- * signed-out site, while it still serves this export; every `<slug>.hanzo.app`
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 any of them: every
215
- * address that needs one is the same address on hanzo.app.
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
@@ -53,6 +53,15 @@ export const TABS = 'https://tabs.hanzo.ai';
53
53
  */
54
54
  export const CHAT = '/chat';
55
55
  export const DEV = '/dev';
56
+ /**
57
+ * Whether this page is on the app's own host, where Chat is the root: `/` is a new
58
+ * conversation and /chat forwards to it (universe static-sites `hanzo-app`). Read in
59
+ * the browser; a prerender has no host and answers no. A conversation keeps its
60
+ * path, /chat/<id>, on every host.
61
+ */
62
+ const rooted = () => typeof window !== 'undefined' && apex(window.location.hostname);
63
+ /** Chat's own address on this host: `/` on the app's, /chat on every other. */
64
+ export const chat = () => (rooted() ? '/' : CHAT);
56
65
  /**
57
66
  * Studio: making images, audio, video and documents, and editing them.
58
67
  * hanzo.ai/studio, whose page draws the app for a signed-in reader.
@@ -88,8 +97,8 @@ export const studio = (at) => (at ? `${STUDIO}/${at.replace(/^\/+/, '')}` : STUD
88
97
  export const design = (at) => (at ? `${DESIGN}/${at.replace(/^\/+/, '')}` : DESIGN);
89
98
  /** Flow at an address of its own (@hanzo/studio `FlowStudio`): '' is New, /flow. */
90
99
  export const flow = (at) => (at ? `${FLOW}/${at.replace(/^\/+/, '')}` : FLOW);
91
- /** Chat on a conversation, or /chat itself for a new one. */
92
- export const talk = (id) => (id ? `${CHAT}/${encodeURIComponent(id)}` : CHAT);
100
+ /** Chat on a conversation, or Chat itself for a new one (`chat`: `/` on the app's host). */
101
+ export const talk = (id) => (id ? `${CHAT}/${encodeURIComponent(id)}` : chat());
93
102
  /**
94
103
  * Settings, and every page under it: the person's and the organization's, the
95
104
  * host's own pages beside the app (hanzo.ai's app/(app)/settings), served
@@ -131,7 +140,7 @@ const SHARED = 'shared';
131
140
  /** The place a path names, or null when it names none of the app's. */
132
141
  export function place(pathname) {
133
142
  const p = pathname.replace(/\/+$/, '') || '/';
134
- if (p === CHAT)
143
+ if (p === CHAT || (p === '/' && rooted()))
135
144
  return { mode: 'chat', thread: null };
136
145
  if (p === DEV || p.startsWith(`${DEV}/`))
137
146
  return { mode: 'dev', at: path(parse(p.slice(DEV.length))) };
@@ -273,10 +282,10 @@ export function remember(mode) {
273
282
  export function resume() {
274
283
  try {
275
284
  const kept = window.localStorage.getItem(MODE);
276
- return kept === 'dev' ? DEV : kept === 'studio' ? STUDIO : kept === 'design' ? DESIGN : kept === 'flow' ? FLOW : kept === 'tabs' ? TERMINALS : CHAT;
285
+ return kept === 'dev' ? DEV : kept === 'studio' ? STUDIO : kept === 'design' ? DESIGN : kept === 'flow' ? FLOW : kept === 'tabs' ? TERMINALS : chat();
277
286
  }
278
287
  catch {
279
- return CHAT;
288
+ return chat();
280
289
  }
281
290
  }
282
291
  /** The routes under app/(app) the apex keeps: the app — /chat, a chat shared by link, and /dev. */
@@ -302,41 +311,44 @@ export function leaves(address) {
302
311
  export { APPS as ROOMS, leaves as room };
303
312
  /**
304
313
  * 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 in and a guest
306
- * host cannot; on the apex, the same app and query on the workspace; otherwise
307
- * null. Home is the workspace's root, so /home?channel=x lands on /?channel=x.
314
+ * host, the same address on hanzo.app, the app's host, because every app signs
315
+ * in and a guest host cannot; on the apex, the same app and query on the
316
+ * workspace; otherwise null. Home is the workspace's root, so /home?channel=x
317
+ * lands on /?channel=x.
308
318
  */
309
319
  export const away = (hostname, address) => {
310
320
  if (guest(hostname))
311
- return SIGNIN + address;
321
+ return HOST + address;
312
322
  if (!apex(hostname) || !leaves(address))
313
323
  return null;
314
324
  const home = address.match(/^\/home\/?(?=[?#]|$)/);
315
325
  return home ? `${WORKSPACE}/${address.slice(home[0].length)}` : `${WORKSPACE}${address}`;
316
326
  };
317
- /** Where a sign-in started on a `guest` host is finished: the app's own host. */
318
- export const SIGNIN = 'https://hanzo.app';
319
327
  /**
320
- * The Hanzo App, to get: the page with Download, Install CLI and Open in web.
321
- * It is this export's /app, served as the root of hanzo.app (universe
322
- * static-sites `hanzo-app`), so it is linked by that address.
328
+ * Where Hanzo signs in: hanzo.ai's own page. The app's host, hanzo.app, keeps
329
+ * its session and visits it (`VISITS`): it leaves with its own authorize
330
+ * request, hanzo.ai's page finishes it, and the code comes back to hanzo.app.
323
331
  */
324
- export const GET = 'https://hanzo.app';
332
+ export const SIGNIN = 'https://hanzo.ai';
333
+ /** Whether a host is the one Hanzo signs in on. */
334
+ export const signs = (hostname) => hostname === 'hanzo.ai' || hostname === 'www.hanzo.ai';
335
+ /** The app's own host. Chat is its root. */
336
+ export const HOST = 'https://hanzo.app';
337
+ /** The Hanzo App, to get: the page with Download, Install CLI and Open in web, this export's /app. */
338
+ export const GET = `${HOST}/app`;
325
339
  /**
326
- * The app, opened from another host: the chat at hanzo.app/chat. A reader who
327
- * is signed out is asked to sign in there, on hanzo.app's own page, and lands
328
- * back in the chat.
340
+ * The app, opened from another host: Chat, at hanzo.app's root. A reader who is
341
+ * signed out signs in on hanzo.ai's page and lands back in it.
329
342
  */
330
- export const WEB = `${SIGNIN}${CHAT}`;
343
+ export const WEB = `${HOST}/`;
331
344
  /**
332
- * Whether a host serves this export and signs nobody in: hanzo.ai, the
333
- * signed-out site, while it still serves this export; every `<slug>.hanzo.app`
334
- * alias the Sites plane serves it at; and hanzo.chat, whose root is /forward.
345
+ * Whether a host serves this export and signs nobody in: every `<slug>.hanzo.app`
346
+ * alias the Sites plane serves it at, and hanzo.chat, whose root is /forward.
335
347
  * `<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 any of them: every
337
- * address that needs one is the same address on hanzo.app.
348
+ * only an address for the chat, so no sign-in runs under either: every address
349
+ * is the same address on hanzo.app.
338
350
  */
339
- export const guest = (hostname) => hostname === 'hanzo.ai' || hostname === 'www.hanzo.ai' || hostname.endsWith('.hanzo.app') || hostname === 'hanzo.chat';
351
+ export const guest = (hostname) => hostname.endsWith('.hanzo.app') || hostname === 'hanzo.chat';
340
352
  /** The devnet's hosts are one label under hanzo.ai ending in `-dev`: app-dev, api-dev, id-dev. */
341
353
  const DEVNET = '-dev.hanzo.ai';
342
354
  /**
@@ -356,20 +368,20 @@ export function devnet(hostname) {
356
368
  }
357
369
  /**
358
370
  * The hosts that answer IAM's sign-in and sign-out calls on their own origin:
359
- * hanzo.app, where Hanzo signs in (its /v1 is the cloud API, universe
360
- * hanzo-domains `v1-hanzo-app`), testnet's test.hanzo.ai, and the dev server's
361
- * /v1 proxy.
371
+ * hanzo.ai, where Hanzo signs in (universe static-sites `hanzo-ai`'s /v1/iam
372
+ * routes), hanzo.app (its /v1 is the cloud API, hanzo-domains `v1-hanzo-app`),
373
+ * testnet's test.hanzo.ai, and the dev server's /v1 proxy.
362
374
  */
363
- const ANSWERS = new Set([...APEX, 'test.hanzo.ai', 'localhost', '127.0.0.1']);
375
+ const ANSWERS = new Set(['hanzo.ai', 'www.hanzo.ai', ...APEX, 'test.hanzo.ai', 'localhost', '127.0.0.1']);
364
376
  /**
365
377
  * The hosts this export is served on that keep a session of their own and sign
366
- * in on hanzo.app: a person signed out there is sent to hanzo.app/login carrying
378
+ * in on hanzo.ai: a person signed out there is sent to hanzo.ai/login carrying
367
379
  * the host's OWN authorize request (its callback, its PKCE challenge), which
368
- * hanzo.app's page finishes, and the code comes back to the host's
380
+ * hanzo.ai's page finishes, and the code comes back to the host's
369
381
  * /auth/callback. One sign-in page for Hanzo, and nobody types a credential on
370
- * these hosts.
382
+ * these hosts. hanzo.app, the app's own host, is one.
371
383
  */
372
- const VISITS = new Set(['cloud.hanzo.ai', 'hanzo.bot', 'bot.hanzo.ai']);
384
+ const VISITS = new Set([...APEX, 'cloud.hanzo.ai', 'hanzo.bot', 'bot.hanzo.ai']);
373
385
  /** Whether a host signs in on hanzo.ai with its own request (`VISITS`). */
374
386
  export const visits = (hostname) => VISITS.has(hostname);
375
387
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/app",
3
- "version": "0.3.55",
3
+ "version": "0.3.57",
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",