@hanzo/app 0.3.56 → 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/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
  }
@@ -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, GET, guest, signs } 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
@@ -176,7 +176,7 @@ export function handoff(address) {
176
176
  const asked = new URLSearchParams(address.split("#")[0].split("?")[1] ?? "").has("client_id");
177
177
  if (!guest(host) && !(signs(host) && !asked))
178
178
  return false;
179
- window.location.assign(GET + address);
179
+ window.location.assign(HOST + address);
180
180
  return true;
181
181
  }
182
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
@@ -201,17 +203,15 @@ export declare const away: (hostname: string, address: string) => string | null;
201
203
  export declare const SIGNIN = "https://hanzo.ai";
202
204
  /** Whether a host is the one Hanzo signs in on. */
203
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";
204
210
  /**
205
- * The Hanzo App, to get: the page with Download, Install CLI and Open in web.
206
- * It is this export's /app, served as the root of hanzo.app (universe
207
- * static-sites `hanzo-app`), so it is linked by that address.
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.
208
213
  */
209
- export declare const GET = "https://hanzo.app";
210
- /**
211
- * The app, opened from another host: the chat at hanzo.app/chat. A reader who
212
- * is signed out signs in on hanzo.ai's page and lands back in the chat.
213
- */
214
- export declare const WEB = "https://hanzo.app/chat";
214
+ export declare const WEB = "https://hanzo.app/";
215
215
  /**
216
216
  * Whether a host serves this export and signs nobody in: every `<slug>.hanzo.app`
217
217
  * alias the Sites plane serves it at, and hanzo.chat, whose root is /forward.
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. */
@@ -309,7 +318,7 @@ export { APPS as ROOMS, leaves as room };
309
318
  */
310
319
  export const away = (hostname, address) => {
311
320
  if (guest(hostname))
312
- return GET + address;
321
+ return HOST + address;
313
322
  if (!apex(hostname) || !leaves(address))
314
323
  return null;
315
324
  const home = address.match(/^\/home\/?(?=[?#]|$)/);
@@ -323,17 +332,15 @@ export const away = (hostname, address) => {
323
332
  export const SIGNIN = 'https://hanzo.ai';
324
333
  /** Whether a host is the one Hanzo signs in on. */
325
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`;
326
339
  /**
327
- * The Hanzo App, to get: the page with Download, Install CLI and Open in web.
328
- * It is this export's /app, served as the root of hanzo.app (universe
329
- * static-sites `hanzo-app`), so it is linked by that address.
330
- */
331
- export const GET = 'https://hanzo.app';
332
- /**
333
- * The app, opened from another host: the chat at hanzo.app/chat. A reader who
334
- * is signed out signs in on hanzo.ai's page and lands 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.
335
342
  */
336
- export const WEB = `${GET}${CHAT}`;
343
+ export const WEB = `${HOST}/`;
337
344
  /**
338
345
  * Whether a host serves this export and signs nobody in: every `<slug>.hanzo.app`
339
346
  * alias the Sites plane serves it at, and hanzo.chat, whose root is /forward.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/app",
3
- "version": "0.3.56",
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",