@hanzo/app 0.2.58 → 0.3.0
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/README.md +8 -8
- package/dist/{Me.d.ts → Account.d.ts} +1 -1
- package/dist/{Me.js → Account.js} +3 -3
- package/dist/App.d.ts +2 -2
- package/dist/App.js +16 -16
- package/dist/{Top.d.ts → Bar.d.ts} +1 -1
- package/dist/{Top.js → Bar.js} +3 -3
- package/dist/Betas.js +1 -1
- package/dist/Board.js +4 -4
- package/dist/Chat.d.ts +4 -4
- package/dist/Chat.js +96 -96
- package/dist/Contacts.js +17 -15
- package/dist/Directory.js +7 -21
- package/dist/Drive.js +6 -6
- package/dist/{Orgs.d.ts → Gate.d.ts} +1 -1
- package/dist/{Orgs.js → Gate.js} +32 -32
- package/dist/{Chrome.d.ts → Header.d.ts} +1 -1
- package/dist/{Chrome.js → Header.js} +1 -1
- package/dist/Home.d.ts +3 -3
- package/dist/Home.js +30 -30
- package/dist/Inbox.js +29 -33
- package/dist/Meet.js +22 -22
- package/dist/Rail.js +6 -6
- package/dist/RightPane.js +2 -2
- package/dist/{Palette.d.ts → Search.d.ts} +1 -1
- package/dist/{Palette.js → Search.js} +1 -1
- package/dist/Settings.d.ts +3 -3
- package/dist/Settings.js +5 -5
- package/dist/SettingsPane.d.ts +2 -2
- package/dist/SettingsPane.js +5 -5
- package/dist/Setup.js +2 -2
- package/dist/Shell.d.ts +22 -31
- package/dist/Shell.js +167 -114
- package/dist/{Column.d.ts → Sidebar.d.ts} +1 -1
- package/dist/{Column.js → Sidebar.js} +5 -5
- package/dist/Support.js +2 -2
- package/dist/Talk.d.ts +3 -3
- package/dist/Talk.js +18 -18
- package/dist/TeamPreview.js +26 -26
- package/dist/TeamStory.js +1 -1
- package/dist/Usage.js +2 -2
- package/dist/Work.js +2 -2
- package/dist/bots/Bots.js +2 -2
- package/dist/bots/Lights.d.ts +1 -1
- package/dist/bots/Lights.js +1 -1
- package/dist/bots/api.d.ts +8 -7
- package/dist/bots/api.js +4 -4
- package/dist/bots/ink.js +3 -3
- package/dist/bots/kit.d.ts +2 -2
- package/dist/bots/kit.js +4 -4
- package/dist/bots/runtime.js +12 -12
- package/dist/cast.d.ts +14 -14
- package/dist/cast.js +12 -12
- package/dist/channels.d.ts +132 -0
- package/dist/{rooms.js → channels.js} +56 -55
- package/dist/conversations.d.ts +8 -8
- package/dist/conversations.js +18 -17
- package/dist/crew.d.ts +1 -1
- package/dist/crew.js +12 -12
- package/dist/dev.js +6 -6
- package/dist/failure.d.ts +2 -2
- package/dist/failure.js +6 -6
- package/dist/ground.d.ts +1 -1
- package/dist/ground.js +1 -1
- package/dist/help.d.ts +1 -1
- package/dist/help.js +2 -2
- package/dist/hint.d.ts +1 -1
- package/dist/hint.js +1 -1
- package/dist/host.d.ts +15 -15
- package/dist/host.js +13 -13
- package/dist/index.d.ts +5 -5
- package/dist/index.js +4 -4
- package/dist/lib/ai.js +1 -1
- package/dist/lib/api.d.ts +1 -1
- package/dist/lib/api.js +1 -1
- package/dist/lib/destination.d.ts +3 -3
- package/dist/lib/destination.js +3 -3
- package/dist/lib/home.d.ts +2 -2
- package/dist/lib/home.js +2 -2
- package/dist/lib/host.d.ts +17 -16
- package/dist/lib/host.js +19 -18
- package/dist/lib/hostname.d.ts +1 -1
- package/dist/lib/hostname.js +1 -1
- package/dist/lib/list.d.ts +1 -1
- package/dist/lib/list.js +1 -1
- package/dist/lib/models.js +1 -1
- package/dist/lib/org.d.ts +1 -1
- package/dist/lib/org.js +1 -1
- package/dist/lib/orgname.d.ts +1 -1
- package/dist/lib/orgname.js +1 -1
- package/dist/lib/session.d.ts +4 -4
- package/dist/lib/session.js +6 -6
- package/dist/lib/tier.d.ts +4 -4
- package/dist/lib/tier.js +5 -5
- package/dist/lib/tiers.d.ts +1 -1
- package/dist/lib/tiers.js +10 -10
- package/dist/lib/web.d.ts +1 -1
- package/dist/lib/web.js +1 -1
- package/dist/network.d.ts +18 -18
- package/dist/network.js +28 -28
- package/dist/open.d.ts +24 -22
- package/dist/open.js +19 -19
- package/dist/pane.d.ts +6 -6
- package/dist/pane.js +10 -10
- package/dist/roster.d.ts +2 -2
- package/dist/roster.js +1 -1
- package/dist/seek.js +1 -1
- package/dist/slide.d.ts +1 -1
- package/dist/slide.js +1 -1
- package/dist/span.js +1 -1
- package/dist/stars.d.ts +4 -4
- package/dist/stars.js +8 -10
- package/dist/tabs.d.ts +1 -1
- package/dist/tabs.js +1 -1
- package/dist/team.js +1 -1
- package/dist/thread.d.ts +3 -3
- package/dist/thread.js +4 -4
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +1 -1
- package/dist/where.d.ts +7 -7
- package/dist/where.js +2 -2
- package/dist/workday.d.ts +26 -26
- package/dist/workday.js +187 -187
- package/package.json +3 -3
- package/dist/Room.d.ts +0 -8
- package/dist/Room.js +0 -51
- package/dist/rooms.d.ts +0 -131
- /package/dist/lib/{rooms.json → routes.json} +0 -0
package/dist/Contacts.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
// The directory: who is in this org, and who you can put in a
|
|
3
|
+
// The directory: who is in this org, and who you can put in a conversation.
|
|
4
4
|
//
|
|
5
5
|
// IT IS A LIST OF SUBJECTS AND NOTHING ELSE. People, the org's agents, and the
|
|
6
6
|
// presets an org can install as one. It holds no conversations, keeps no
|
|
7
|
-
// threads, and remembers nothing of its own — the
|
|
8
|
-
// thread store with every other conversation, which is
|
|
7
|
+
// threads, and remembers nothing of its own — the conversations it starts live
|
|
8
|
+
// in the thread store with every other conversation, which is
|
|
9
|
+
// `conversations.ts`.
|
|
9
10
|
//
|
|
10
11
|
// WHAT IT USED TO DO. Four `localStorage` keys: a roster of people it invented,
|
|
11
12
|
// a list of agents it invented, a set of `direct_…`/`group_…`/`call_…` threads
|
|
@@ -20,18 +21,19 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
20
21
|
// presets GET /v1/agent/chat/presets (the catalog, public)
|
|
21
22
|
// invite POST /v1/iam/invitations (`createInvitation`)
|
|
22
23
|
// agent POST /v1/agents (`Hire`, the crew's sheet)
|
|
23
|
-
//
|
|
24
|
+
// thread POST /v1/agents/chat/conversations (`start`)
|
|
24
25
|
//
|
|
25
26
|
// THERE IS NO CALL CONTROL, because there is no call. Measured against the
|
|
26
27
|
// platform's own contract — 1629 paths in /v1/openapi.json — nothing serves
|
|
27
|
-
// signalling, an SFU, a
|
|
28
|
+
// signalling, an SFU, a call token or a TURN credential. A button that says
|
|
28
29
|
// Call and opens a chat is worse than no button: it reports a thing that did
|
|
29
|
-
// not happen. When the estate serves a call, the
|
|
30
|
-
// `start` already writes, and this file gains a verb rather than a
|
|
30
|
+
// not happen. When the estate serves a call, the conversation it attaches to is
|
|
31
|
+
// the one `start` already writes, and this file gains a verb rather than a
|
|
32
|
+
// store.
|
|
31
33
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
32
34
|
import { phrase } from '@hanzo/i18n';
|
|
33
35
|
import { useI18n } from '@hanzo/i18n/react';
|
|
34
|
-
import {
|
|
36
|
+
import { useHost } from './host.js';
|
|
35
37
|
import { Check, Plus, Search, UserPlus } from 'lucide-react';
|
|
36
38
|
import { Box, Text, XStack, YStack } from '@hanzo/ui';
|
|
37
39
|
import { useAi, useModels, usePeople, useThreads } from '@hanzo/ai/react';
|
|
@@ -71,7 +73,7 @@ export function Contacts() {
|
|
|
71
73
|
return _jsx(Alone, { children: t('This account is not in an organization yet.') });
|
|
72
74
|
return _jsx(Roster, { owner: currentOrgId });
|
|
73
75
|
}
|
|
74
|
-
/** The
|
|
76
|
+
/** The app's one heading, for every state that has nothing to list. */
|
|
75
77
|
function Alone({ children }) {
|
|
76
78
|
const { t } = useI18n();
|
|
77
79
|
return (_jsxs(YStack, { flex: 1, items: "center", justify: "center", p: "$6", gap: "$3", children: [_jsx(Text, { render: "h1", fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Contacts') }), _jsx(Text, { fontSize: "$3", color: "$soft", maxW: 420, text: "center", children: children })] }));
|
|
@@ -89,14 +91,14 @@ function Note({ children }) {
|
|
|
89
91
|
function Roster({ owner }) {
|
|
90
92
|
const { t } = useI18n();
|
|
91
93
|
const ai = useAi();
|
|
92
|
-
const { router } =
|
|
94
|
+
const { router } = useHost();
|
|
93
95
|
const { people, loading: reading, error: unread } = usePeople({ owner, service: false });
|
|
94
96
|
// `create` and not `ai.agents.create`: the hook's own writer refreshes the
|
|
95
97
|
// list it read, which is what moves an installed preset out of the catalog
|
|
96
98
|
// and into the org's agents without a reload.
|
|
97
99
|
const { agents, create, loading: gathering, error: ungathered } = useCrew();
|
|
98
100
|
// WHAT "RECENTLY" MEANS: the conversations this reader has. It is the same
|
|
99
|
-
// read the sidebar makes, and the only record of who a
|
|
101
|
+
// read the sidebar makes, and the only record of who a conversation was with.
|
|
100
102
|
const { threads } = useThreads();
|
|
101
103
|
// An installed preset needs a model, and `POST /v1/agents` refuses one this
|
|
102
104
|
// deployment does not serve — so it is named against the served catalog by
|
|
@@ -202,7 +204,7 @@ function Roster({ owner }) {
|
|
|
202
204
|
}
|
|
203
205
|
}, [busy, create, models, presets]);
|
|
204
206
|
/**
|
|
205
|
-
* INTO A
|
|
207
|
+
* INTO A CONVERSATION, by the one call that starts one.
|
|
206
208
|
*
|
|
207
209
|
* One selected is a direct conversation, several is a group, and a group of
|
|
208
210
|
* agents or a mix of both is the same act — nothing here branches on how many
|
|
@@ -215,7 +217,7 @@ function Roster({ owner }) {
|
|
|
215
217
|
.map((one) => ({ id: one.key, name: one.label || one.name, agent: one.kind === 'agent' }));
|
|
216
218
|
if (members.length === 0 || busy)
|
|
217
219
|
return;
|
|
218
|
-
setBusy('
|
|
220
|
+
setBusy('conversation');
|
|
219
221
|
setWrong(null);
|
|
220
222
|
try {
|
|
221
223
|
const id = await start(ai, members);
|
|
@@ -241,14 +243,14 @@ function Roster({ owner }) {
|
|
|
241
243
|
? void install(one)
|
|
242
244
|
: setPicked((was) => was.includes(one.key)
|
|
243
245
|
? was.filter((k) => k !== one.key)
|
|
244
|
-
: [...was, one.key]) }, one.key)))) }), picked.length > 0 ? (_jsxs(XStack, { shrink: 0, items: "center", gap: "$2", p: "$3", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { flex: 1, fontSize: "$2", color: "$soft", numberOfLines: 1, children: picked.length === 1 ? t('1 selected') : t('{n} selected', { n: picked.length }) }), _jsx(Control, { onPress: () => setPicked([]), children: t('Clear') }), _jsx(Control, { onPress: () => void enter(), strong: true, children: t(busy === '
|
|
246
|
+
: [...was, one.key]) }, one.key)))) }), picked.length > 0 ? (_jsxs(XStack, { shrink: 0, items: "center", gap: "$2", p: "$3", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { flex: 1, fontSize: "$2", color: "$soft", numberOfLines: 1, children: picked.length === 1 ? t('1 selected') : t('{n} selected', { n: picked.length }) }), _jsx(Control, { onPress: () => setPicked([]), children: t('Clear') }), _jsx(Control, { onPress: () => void enter(), strong: true, children: t(busy === 'conversation' ? 'Opening…' : 'Start conversation') })] })) : null, inviting ? _jsx(Invite, { owner: owner, onClose: () => setInviting(false) }) : null, hiring ? _jsx(Hire, { onClose: () => setHiring(false), onMade: () => setHiring(false) }) : null] }));
|
|
245
247
|
}
|
|
246
248
|
/** One row: a face, a name, a line about them, and what pressing it does. */
|
|
247
249
|
function Row({ one, on, busy, onPress, }) {
|
|
248
250
|
const { t } = useI18n();
|
|
249
251
|
return (_jsx(Box, { render: "button", onClick: onPress, "aria-label": one.label, "aria-pressed": one.kind === 'preset' ? undefined : on, width: "100%", display: "block", cursor: "pointer", borderWidth: 0, borderBottomWidth: 1, borderBottomColor: "var(--borderColor, var(--white-08))", bg: on ? 'var(--raised, var(--white-06))' : 'transparent', children: _jsxs(XStack, { gap: "$3", items: "center", p: "$3", children: [_jsx(Face, { src: one.avatar, emoji: one.emoji, name: one.name, size: 32 }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$2", color: "$ink", numberOfLines: 1, text: "start", children: one.label }), one.note ? (_jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, text: "start", children: one.note })) : null] }), one.kind === 'preset' ? (_jsx(Text, { fontSize: "$2", color: "$soft", children: t(busy ? 'Installing…' : 'Install') })) : on ? (_jsx(Check, { size: 14, "aria-hidden": true })) : null] }) }));
|
|
250
252
|
}
|
|
251
|
-
/** A named control. One shape for every button in this
|
|
253
|
+
/** A named control. One shape for every button in this app. */
|
|
252
254
|
function Control({ children, onPress, icon, strong, }) {
|
|
253
255
|
return (_jsx(Box, { render: "button", onClick: onPress, px: "$3", py: "$2", rounded: "$3", borderWidth: strong ? 0 : 1, borderColor: "$borderColor", bg: strong ? '$ink' : 'transparent', hoverStyle: { bg: strong ? '$ink' : '$hover' }, cursor: "pointer", children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [icon, _jsx(Text, { fontSize: "$2", color: strong ? '$background' : '$ink', fontWeight: strong ? '600' : undefined, numberOfLines: 1, children: children })] }) }));
|
|
254
256
|
}
|
package/dist/Directory.js
CHANGED
|
@@ -80,7 +80,7 @@ const byline = (row, t) => row.connected ? row.account || t('Connected') : row.a
|
|
|
80
80
|
const LEAD = ['tiktok', 'instagram', 'linkedin', 'slack', 'x', 'whatsapp', 'discord', 'telegram', 'facebook', 'teams', 'threads', 'youtube'];
|
|
81
81
|
/**
|
|
82
82
|
* The published integrations (lib/integrations), as directory rows. Real,
|
|
83
|
-
* public, counted. Loaded when the tab first opens, so a page the
|
|
83
|
+
* public, counted. Loaded when the tab first opens, so a page the shell frames
|
|
84
84
|
* carries none of the catalogue's guides.
|
|
85
85
|
*/
|
|
86
86
|
let listing = null;
|
|
@@ -125,11 +125,10 @@ function channelsOf(j) {
|
|
|
125
125
|
* A rejection `say()` can read.
|
|
126
126
|
*
|
|
127
127
|
* It ranks a numeric `status` above the prose beside it, precisely so a
|
|
128
|
-
* reworded message cannot change what
|
|
129
|
-
* that rejects with a bare number carries neither.
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* has to arrive as one rather than as a flat "could not read".
|
|
128
|
+
* reworded message cannot change what an app tells a reader — and a `fetch`
|
|
129
|
+
* that rejects with a bare number carries neither. Signed out, the org's reads
|
|
130
|
+
* answer 403 "a validated principal is required", so a refusal is the common
|
|
131
|
+
* case and has to arrive as one rather than as a flat "could not read".
|
|
133
132
|
*/
|
|
134
133
|
const refusal = (r) => Object.assign(new Error(String(r.status)), { status: r.status });
|
|
135
134
|
export function Directory({ open, onClose, tab: first = 'apps', }) {
|
|
@@ -222,22 +221,9 @@ export function Catalog({ tab }) {
|
|
|
222
221
|
}
|
|
223
222
|
function RowCard({ row, tab }) {
|
|
224
223
|
const { t } = useI18n();
|
|
225
|
-
|
|
226
|
-
/** Hand a channel to the gateway's OAuth and let it say what happened. */
|
|
227
|
-
const connect = () => {
|
|
228
|
-
if (!isAuthenticated) {
|
|
229
|
-
enter();
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
// Same-tab origin for the return leg: the reader lands back on the site
|
|
233
|
-
// they started from rather than on production from a preview build.
|
|
234
|
-
const back = encodeURIComponent(`${window.location.origin}/inbox`);
|
|
235
|
-
window.open(`${api()}/v1/channels/${encodeURIComponent(row.id)}/oauth/authorize?redirect_uri=${back}`, '_blank', 'noopener,noreferrer');
|
|
236
|
-
};
|
|
237
|
-
// Apps open the page this site serves. Only a channel has a flow of its own,
|
|
238
|
-
// and only that one is a button.
|
|
224
|
+
// Apps open the page this site serves.
|
|
239
225
|
const href = site(`/integrations/${row.id}`);
|
|
240
|
-
return (_jsxs(YStack, { gap: "$2", p: "$3", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", height: "100%", bg: "$raised", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(ProviderMark, { org: row.id.replace(/-sdk$/, ''), size: 20 }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$ink", numberOfLines: 1, children: row.name }), _jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, children: row.publisher })] }), row.connected ? (_jsxs(XStack, { items: "center", gap: "$1", px: "$2", py: "$1", rounded: "$2", bg: "$hover", children: [_jsx(Check, { size: 12, color: GOOD, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", color: GOOD, fontWeight: "600", children: t('Connected') })] })) :
|
|
226
|
+
return (_jsxs(YStack, { gap: "$2", p: "$3", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", height: "100%", bg: "$raised", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(ProviderMark, { org: row.id.replace(/-sdk$/, ''), size: 20 }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$ink", numberOfLines: 1, children: row.name }), _jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, children: row.publisher })] }), row.connected ? (_jsxs(XStack, { items: "center", gap: "$1", px: "$2", py: "$1", rounded: "$2", bg: "$hover", children: [_jsx(Check, { size: 12, color: GOOD, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", color: GOOD, fontWeight: "600", children: t('Connected') })] })) : (_jsx(Box, { render: _jsx("a", { href: href, target: tab === 'apps' ? undefined : '_blank', rel: "noreferrer", "aria-label": t('Open {name}', { name: row.name }) }), ...tap, children: _jsxs(XStack, { items: "center", gap: "$1", px: "$2", py: "$1", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", bg: "var(--white-05)", hoverStyle: { bg: '$hover' }, children: [_jsx(Text, { fontSize: "$1", color: "$color", fontWeight: "600", children: t(tab === 'apps' ? 'Docs' : 'Install') }), _jsx(ArrowUpRight, { size: 11, "aria-hidden": true })] }) }))] }), _jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 2, flex: 1, children: row.description }), _jsx(XStack, { items: "center", pt: "$1", children: _jsx(Text, { fontFamily: "$mono", fontVariant: ['tabular-nums'], fontSize: "$1", color: "$soft", children: row.kind === 'MCP' ? 'MCP' : t('native') }) })] }));
|
|
241
227
|
}
|
|
242
228
|
/**
|
|
243
229
|
* One channel: a provider the org can hold an account with.
|
package/dist/Drive.js
CHANGED
|
@@ -7,8 +7,8 @@ import { useIam, useOrganizations } from '@hanzo/iam/react';
|
|
|
7
7
|
import { useI18n } from '@hanzo/i18n/react';
|
|
8
8
|
import { useAi } from './lib/ai.js';
|
|
9
9
|
import { empty, useOpen } from './open.js';
|
|
10
|
-
import { attach,
|
|
11
|
-
import {
|
|
10
|
+
import { attach, conversation } from './pane.js';
|
|
11
|
+
import { useHost } from './host.js';
|
|
12
12
|
import { org } from './lib/session.js';
|
|
13
13
|
import { Badge, Contents, Hits } from './Contents.js';
|
|
14
14
|
import { Editor } from './Editor.js';
|
|
@@ -120,8 +120,8 @@ export function Drive() {
|
|
|
120
120
|
const { client } = useAi();
|
|
121
121
|
const { user, isAuthenticated } = useIam();
|
|
122
122
|
const ready = Boolean(client && isAuthenticated);
|
|
123
|
-
const { bucket, openBucket,
|
|
124
|
-
const { router } =
|
|
123
|
+
const { bucket, openBucket, channel } = useOpen();
|
|
124
|
+
const { router } = useHost();
|
|
125
125
|
const { currentOrg } = useOrganizations();
|
|
126
126
|
const workspace = currentOrg?.displayName || currentOrg?.name || 'hanzo';
|
|
127
127
|
// THE WORKSPACE'S BUCKET is the one named for the org: where a file put into a
|
|
@@ -291,9 +291,9 @@ export function Drive() {
|
|
|
291
291
|
if (!client)
|
|
292
292
|
return;
|
|
293
293
|
empty();
|
|
294
|
-
attach(
|
|
294
|
+
attach(conversation({ channel, thread: null, agent: null }), [f], { api: client, org: scope });
|
|
295
295
|
router.push('/chat');
|
|
296
|
-
}, [client,
|
|
296
|
+
}, [client, channel, scope, router]);
|
|
297
297
|
// WHAT IS AT THIS LEVEL. The store's listing takes `recursive`; passing
|
|
298
298
|
// `delimiter` (S3's own word) is silently ignored, so a flat listing came
|
|
299
299
|
// back and every folder read as a file.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function Gate({ children, front, forward, signup, }: {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
/** Home at `/`: a stranger meets the host's Landing, a member with no team `<Landing member />`. */
|
|
5
5
|
front?: boolean;
|
package/dist/{Orgs.js → Gate.js}
RENAMED
|
@@ -40,7 +40,7 @@ import { Check, Minus, Plus, X } from 'lucide-react';
|
|
|
40
40
|
import { Waiting } from './waiting.js';
|
|
41
41
|
import { LOGIN, enter } from './lib/destination.js';
|
|
42
42
|
import { useAi } from './lib/ai.js';
|
|
43
|
-
import {
|
|
43
|
+
import { useHostname } from './lib/hostname.js';
|
|
44
44
|
import { useHydrated } from './lib/hydrated.js';
|
|
45
45
|
import { api } from './lib/api.js';
|
|
46
46
|
import { usePersonal, useTier } from './lib/tier.js';
|
|
@@ -53,24 +53,24 @@ import { createInvitation, inviteLink, setOrganizationProfile } from './lib/invi
|
|
|
53
53
|
import { createOrg, say } from './lib/org.js';
|
|
54
54
|
import { countSignup } from './lib/intent.js';
|
|
55
55
|
import { BAD, mix } from './lib/mix.js';
|
|
56
|
-
import {
|
|
56
|
+
import { useHost } from './host.js';
|
|
57
57
|
import { Accounts } from './Accounts.js';
|
|
58
|
-
import {
|
|
58
|
+
import { Header } from './Header.js';
|
|
59
59
|
import { site, where } from './where.js';
|
|
60
60
|
/** A template to set up once the organization is live. */
|
|
61
61
|
const SETUP = 'hanzo:org:template';
|
|
62
|
-
/** Checkout for a plan, coming back to this
|
|
62
|
+
/** Checkout for a plan, coming back to this page. */
|
|
63
63
|
function checkout(plan) {
|
|
64
64
|
const origin = typeof window !== 'undefined' ? window.location.origin : 'https://hanzo.ai';
|
|
65
65
|
const path = typeof window !== 'undefined' ? window.location.pathname : '/chat';
|
|
66
66
|
return checkoutUrl(plan.id, `${origin}${path}`);
|
|
67
67
|
}
|
|
68
|
-
export function
|
|
68
|
+
export function Gate({ children, front = false, forward, signup = false, }) {
|
|
69
69
|
const hydrated = useHydrated();
|
|
70
70
|
const { isAuthenticated, isLoading, accessToken } = useIam();
|
|
71
71
|
const { Landing, Signup, team } = where();
|
|
72
72
|
// The front door's own flow: naming a team, inviting it, the per-seat plan —
|
|
73
|
-
// at hanzo.ai's Home and /start, and in every
|
|
73
|
+
// at hanzo.ai's Home and /start, and in every app of hanzo.team.
|
|
74
74
|
const door = front || signup || Boolean(team);
|
|
75
75
|
const arriving = useArrival(door, hydrated, isLoading, isAuthenticated);
|
|
76
76
|
const members = useMemo(() => claimed(), [accessToken]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
@@ -87,11 +87,11 @@ export function Orgs({ children, front = false, forward, signup = false, }) {
|
|
|
87
87
|
}, [accessToken]);
|
|
88
88
|
const [picked, setPicked] = useState(false);
|
|
89
89
|
// The team being set up in this page. Once its name is taken the setup owns
|
|
90
|
-
// the screen until checkout, whatever `
|
|
90
|
+
// the screen until checkout, whatever `Gate` reads of the new organization.
|
|
91
91
|
const [founding, setFounding] = useState(null);
|
|
92
92
|
// The workspace asks for the plan, on its host and behind its front door, and
|
|
93
93
|
// only there is it read: nowhere else does it decide anything.
|
|
94
|
-
const onTeam = workspace(
|
|
94
|
+
const onTeam = workspace(useHostname());
|
|
95
95
|
const asks = door || onTeam;
|
|
96
96
|
const { tier, wrong, reload } = useTier(Boolean(asks && isAuthenticated && current), current);
|
|
97
97
|
// A plan is live when billing READ one for this organization and it is not the free rung.
|
|
@@ -100,7 +100,7 @@ export function Orgs({ children, front = false, forward, signup = false, }) {
|
|
|
100
100
|
// its kind: a team is offered the plan, a personal one is offered a team.
|
|
101
101
|
const free = door && Boolean(tier) && !live;
|
|
102
102
|
const personal = usePersonal(current, free);
|
|
103
|
-
// A SuperAdmin IAM stepped into this organization sees its
|
|
103
|
+
// A SuperAdmin IAM stepped into this organization sees its apps whatever its
|
|
104
104
|
// plan: support is there to see what the organization has, and what it spends
|
|
105
105
|
// is billed to the operator's own books, never the organization's.
|
|
106
106
|
const supporting = Boolean(current) && assumed() === current;
|
|
@@ -127,7 +127,7 @@ export function Orgs({ children, front = false, forward, signup = false, }) {
|
|
|
127
127
|
window.removeEventListener('focus', back);
|
|
128
128
|
};
|
|
129
129
|
}, [reload]);
|
|
130
|
-
// The chooser over the
|
|
130
|
+
// The chooser over the app, asked for from the account menu (session.ts `choose`).
|
|
131
131
|
const [choosing, setChoosing] = useState(false);
|
|
132
132
|
useEffect(() => {
|
|
133
133
|
const ask = () => setChoosing(true);
|
|
@@ -140,7 +140,7 @@ export function Orgs({ children, front = false, forward, signup = false, }) {
|
|
|
140
140
|
setChoosing(false);
|
|
141
141
|
}, []);
|
|
142
142
|
// The organization a link arrives for. hanzo.ai opens the workspace at
|
|
143
|
-
// `?signin&org=<the org it is working in>` (
|
|
143
|
+
// `?signin&org=<the org it is working in>` (Account.tsx); once signed in, an org
|
|
144
144
|
// the token's `orgs` names is chosen and the parameter leaves the address, the
|
|
145
145
|
// way `?signin` does. An org the token does not name is ignored.
|
|
146
146
|
useEffect(() => {
|
|
@@ -186,7 +186,7 @@ export function Orgs({ children, front = false, forward, signup = false, }) {
|
|
|
186
186
|
// NOTHING PRODUCT-SHAPED IS IN THE EXPORTED MARKUP. This branch is what the
|
|
187
187
|
// static file holds and what hydration's first render must agree with, so
|
|
188
188
|
// whatever it returns is what a reader sees before any answer exists. It used
|
|
189
|
-
// to return the
|
|
189
|
+
// to return the app, which put the whole paid interface on disk: the browser
|
|
190
190
|
// painted it from the file, the SDK settled, billing answered, and only then
|
|
191
191
|
// did the ask appear over the top of a product the reader had already been
|
|
192
192
|
// shown. The veil is the same element in both renders, so there is no
|
|
@@ -194,11 +194,11 @@ export function Orgs({ children, front = false, forward, signup = false, }) {
|
|
|
194
194
|
// instead, which is what a stranger there is shown and what a crawler reads.
|
|
195
195
|
if (!hydrated)
|
|
196
196
|
return front && Landing ? _jsx(Landing, {}) : _jsx(Veil, {});
|
|
197
|
-
// Past hydration the
|
|
197
|
+
// Past hydration the app keeps its place in the tree in every branch that
|
|
198
198
|
// draws it — `Held`, the veil AFTER it — so a token refresh mid-session never
|
|
199
199
|
// remounts what the reader had open. The veil is unconditional now: it was
|
|
200
200
|
// hung only when a token was already in hand, which left a visitor arriving
|
|
201
|
-
// without one looking at the
|
|
201
|
+
// without one looking at the app while the SDK decided. Under it the app is
|
|
202
202
|
// inert: it takes no key or press until the gate has decided.
|
|
203
203
|
if (isLoading)
|
|
204
204
|
return front && Landing && !hasSession() && !arriving ? _jsx(Landing, {}) : _jsxs(_Fragment, { children: [_jsx(Held, { veiled: true, children: children }), _jsx(Veil, {})] });
|
|
@@ -215,17 +215,17 @@ export function Orgs({ children, front = false, forward, signup = false, }) {
|
|
|
215
215
|
}
|
|
216
216
|
if (!current || (members.length > 1 && !picked))
|
|
217
217
|
return _jsx(Pick, { members: members, current: current, onPick: choose });
|
|
218
|
-
// Asked for over an open
|
|
218
|
+
// Asked for over an open app, the app keeps its place under the chooser and closing it goes back.
|
|
219
219
|
if (choosing)
|
|
220
220
|
return _jsxs(_Fragment, { children: [_jsx(Held, { veiled: true, children: children }), _jsx(Pick, { members: members, current: current, onPick: choose, onClose: () => setChoosing(false) })] });
|
|
221
221
|
if (open)
|
|
222
222
|
return forward ? _jsx(Forward, { to: forward }) : _jsx(_Fragment, { children: _jsx(Held, { veiled: false, children: children }) });
|
|
223
223
|
// IN THE WORKSPACE NOTHING OPENS WITHOUT A LIVE PLAN. Every branch here
|
|
224
|
-
// used to hand the
|
|
224
|
+
// used to hand the app over when the answer was anything but a plain
|
|
225
225
|
// "free": an error of any kind, a read still in flight, a document with no
|
|
226
226
|
// plan in it. Each was a way in without paying — a refusal, a slow network,
|
|
227
227
|
// or devtools blocking one request all read as permission. The default is the
|
|
228
|
-
// ask, and the
|
|
228
|
+
// ask, and the app is the exception rather than the fallback.
|
|
229
229
|
if (!tier && !wrong)
|
|
230
230
|
return _jsxs(_Fragment, { children: [_jsx(Held, { veiled: true, children: children }), _jsx(Veil, {})] });
|
|
231
231
|
if (free && personal === null)
|
|
@@ -243,7 +243,7 @@ export function Orgs({ children, front = false, forward, signup = false, }) {
|
|
|
243
243
|
return _jsx(Plan, { org: current, members: members, onSwitch: swap });
|
|
244
244
|
}
|
|
245
245
|
// The workspace's host off its front door: no live plan, or none read, does
|
|
246
|
-
// not open the
|
|
246
|
+
// not open the app.
|
|
247
247
|
return _jsx(Subscribe, { org: current, members: members, onSwitch: swap });
|
|
248
248
|
}
|
|
249
249
|
/**
|
|
@@ -275,7 +275,7 @@ function useArrival(door, hydrated, isLoading, isAuthenticated) {
|
|
|
275
275
|
return arriving;
|
|
276
276
|
}
|
|
277
277
|
// ── the screens ────────────────────────────────────────────────────────────────
|
|
278
|
-
/** Every screen here is one sheet over the
|
|
278
|
+
/** Every screen here is one sheet over the app, ten above its modals, and the create dialog ten above that.
|
|
279
279
|
* gui carries a `calc()` to the page unchanged; its types only name custom properties. */
|
|
280
280
|
const SHEET = 'calc(var(--z-modal) + 10)';
|
|
281
281
|
const DIALOG = 'calc(var(--z-modal) + 20)';
|
|
@@ -298,12 +298,12 @@ const FIELD = {
|
|
|
298
298
|
};
|
|
299
299
|
/**
|
|
300
300
|
* The sheet every screen stands on: the whole viewport, scrolling, its column
|
|
301
|
-
* centred, under the focused pages' one bar (`
|
|
301
|
+
* centred, under the focused pages' one bar (`Header`) once someone is signed
|
|
302
302
|
* in. "Signing you in" stands alone.
|
|
303
303
|
*/
|
|
304
304
|
function Page({ label, children }) {
|
|
305
305
|
const { isAuthenticated } = useIam();
|
|
306
|
-
return (_jsxs(YStack, { position: "fixed", inset: 0, z: SHEET, overflowY: "auto", bg: "var(--background)", role: "region", "aria-label": label, children: [isAuthenticated ? _jsx(
|
|
306
|
+
return (_jsxs(YStack, { position: "fixed", inset: 0, z: SHEET, overflowY: "auto", bg: "var(--background)", role: "region", "aria-label": label, children: [isAuthenticated ? _jsx(Header, {}) : null, _jsx(YStack, { pt: TOP, px: 20, pb: 48, children: children })] }));
|
|
307
307
|
}
|
|
308
308
|
/** The column a screen's words sit in. */
|
|
309
309
|
function Column({ children }) {
|
|
@@ -317,12 +317,12 @@ function Rule({ mt = 20, mb = 20 }) {
|
|
|
317
317
|
function Heading({ title, lede, lead }) {
|
|
318
318
|
return (_jsxs(_Fragment, { children: [_jsx(Text, { render: "h1", fontSize: "$10", fontWeight: "500", letterSpacing: -0.32, color: "var(--text-primary)", children: title }), lede ? (_jsx(Text, { render: "p", mt: 6, fontSize: "$4", lineHeight: lead, color: muted, children: lede })) : null] }));
|
|
319
319
|
}
|
|
320
|
-
/** The
|
|
320
|
+
/** The app, held back until the organization is known. */
|
|
321
321
|
function Veil() {
|
|
322
322
|
return _jsx(View, { "aria-hidden": true, position: "fixed", inset: 0, z: SHEET, bg: "var(--background)" });
|
|
323
323
|
}
|
|
324
324
|
/**
|
|
325
|
-
* The
|
|
325
|
+
* The app, in the one place every branch that draws it puts it. Under the veil
|
|
326
326
|
* it is inert and hidden from assistive technology, so what the veil covers
|
|
327
327
|
* takes no focus, key or press: a team on Free cannot type and send before its
|
|
328
328
|
* ask is drawn. It lays out as its children do.
|
|
@@ -332,7 +332,7 @@ function Held({ veiled, children }) {
|
|
|
332
332
|
}
|
|
333
333
|
/** An open organization, sent on. */
|
|
334
334
|
function Forward({ to }) {
|
|
335
|
-
const { router } =
|
|
335
|
+
const { router } = useHost();
|
|
336
336
|
useEffect(() => router.replace(to), [router, to]);
|
|
337
337
|
return _jsx(Veil, {});
|
|
338
338
|
}
|
|
@@ -346,7 +346,7 @@ const FREE_TIER = 'free';
|
|
|
346
346
|
/**
|
|
347
347
|
* Whether a failed tier read is OUR fault. A 5xx or a network error is an
|
|
348
348
|
* outage; a 401, 403 or 404 is an answer, and an answer that is not a paid plan
|
|
349
|
-
* is not a reason to open the
|
|
349
|
+
* is not a reason to open the app.
|
|
350
350
|
*/
|
|
351
351
|
function outage(wrong) {
|
|
352
352
|
const status = wrong?.status;
|
|
@@ -355,10 +355,10 @@ function outage(wrong) {
|
|
|
355
355
|
/**
|
|
356
356
|
* SIGNED OUT IS A TRIP TO SIGN IN, and nothing else.
|
|
357
357
|
*
|
|
358
|
-
* IAM owns every credential, so this
|
|
358
|
+
* IAM owns every credential, so this gate draws no form of its own: it sends
|
|
359
359
|
* the reader to this site's sign-in (destination.ts `enter`), which asks
|
|
360
360
|
* hanzo.id for a session first and draws IAM's form only when there is none.
|
|
361
|
-
* `
|
|
361
|
+
* `Shell` wrote the address down on mount, so the sign-in returns to this page,
|
|
362
362
|
* `?q=` included.
|
|
363
363
|
*/
|
|
364
364
|
function SignIn({ to }) {
|
|
@@ -378,9 +378,9 @@ function CreateDialog({ onClose }) {
|
|
|
378
378
|
const { t } = useI18n();
|
|
379
379
|
const team = usePlan('team');
|
|
380
380
|
// The personal ladder, Free first. hanzo.team offers no personal organization:
|
|
381
|
-
// every
|
|
381
|
+
// every app there runs on a paid plan.
|
|
382
382
|
const ladder = usePlans('personal');
|
|
383
|
-
const alone = !workspace(
|
|
383
|
+
const alone = !workspace(useHostname());
|
|
384
384
|
const [rung, setRung] = useState(null);
|
|
385
385
|
const chosen = ladder.find((p) => p.id === rung) ?? ladder.find((p) => !p.priceMonthly) ?? ladder[0] ?? null;
|
|
386
386
|
const personal = priced(chosen);
|
|
@@ -682,8 +682,8 @@ function Everyone({ q, skip }) {
|
|
|
682
682
|
* display name then written on the row (lib/invite.ts `setOrganizationProfile`).
|
|
683
683
|
* The token in hand predates it, so it is refreshed, and the organization opens on
|
|
684
684
|
* a load: @hanzo/iam's `useOrganizations` reads the token once per mount, and an
|
|
685
|
-
* instance the
|
|
686
|
-
* org) back over the pick, which left the
|
|
685
|
+
* instance the app mounts on the old token writes its home (the token's first
|
|
686
|
+
* org) back over the pick, which left the app unscoped after one request.
|
|
687
687
|
*/
|
|
688
688
|
function Found({ onClose }) {
|
|
689
689
|
const { sdk } = useIam();
|
|
@@ -848,7 +848,7 @@ function Start({ founded = null, onFounded, first, members = [], onSwitch, }) {
|
|
|
848
848
|
})) : (_jsxs(_Fragment, { children: [email, ' ', _jsx(Text, { role: "alert", color: BAD, children: s.refused })] })) }) }, s.email));
|
|
849
849
|
}) })) : null, _jsx(XStack, { gap: 10, flexWrap: "wrap", mt: 24, children: sent.length ? (_jsx(Button, { type: "button", variant: "primary", size: "lg", onClick: () => setStep('plan'), children: t('Continue') })) : (_jsxs(_Fragment, { children: [_jsx(Button, { type: "submit", variant: "primary", size: "lg", disabled: busy, children: busy ? t('Inviting…') : emails.trim() ? t('Invite and continue') : t('Continue') }), _jsx(Button, { type: "button", size: "lg", onClick: () => setStep('plan'), children: t('Skip for now') })] })) })] })) }) }));
|
|
850
850
|
}
|
|
851
|
-
/** Where a checkout from the setup returns:
|
|
851
|
+
/** Where a checkout from the setup returns: Home, on this origin. */
|
|
852
852
|
const home = () => `${window.location.origin}${where().home}`;
|
|
853
853
|
/**
|
|
854
854
|
* THE PLAN: how many seats, billed monthly or annually, then checkout.
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* host mounts `IamProvider`.
|
|
28
28
|
*/
|
|
29
29
|
import { type ReactNode } from 'react';
|
|
30
|
-
export declare function
|
|
30
|
+
export declare function Header({ back, account }: {
|
|
31
31
|
back?: ReactNode;
|
|
32
32
|
account?: ReactNode;
|
|
33
33
|
}): import("react").JSX.Element;
|
|
@@ -70,7 +70,7 @@ function useMoved() {
|
|
|
70
70
|
}
|
|
71
71
|
/** The notch's inset. gui carries a CSS function to the page unchanged; its types only name custom properties. */
|
|
72
72
|
const NOTCH = 'env(safe-area-inset-top)';
|
|
73
|
-
export function
|
|
73
|
+
export function Header({ back, account }) {
|
|
74
74
|
const { t, dir } = useI18n();
|
|
75
75
|
const { user, isAuthenticated } = useIam();
|
|
76
76
|
const signOut = useSignOut();
|
package/dist/Home.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type Mode = (typeof MODES)[number]['id'];
|
|
|
20
20
|
/**
|
|
21
21
|
* Ask, however the host answers.
|
|
22
22
|
*
|
|
23
|
-
* The default sends the question to /chat, which is the one
|
|
23
|
+
* The default sends the question to /chat, which is the one app on this site
|
|
24
24
|
* that reads a question off the address (`?q=`, the name every Hanzo surface
|
|
25
25
|
* takes). A host that already HAS the thread — the chat pane, where this home
|
|
26
26
|
* belongs — passes its own `send` instead and nothing navigates.
|
|
@@ -29,9 +29,9 @@ export interface HomeProps {
|
|
|
29
29
|
ask?: (question: string, mode: Mode, sources: string[]) => void;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* A
|
|
32
|
+
* A CHANNEL IS READ HERE. Home is the org's app: the rail's channels and direct
|
|
33
33
|
* messages open in this pane (`Talk`), keyed `team:<space>/<id>` in the
|
|
34
|
-
* selection slot and in the address, and the
|
|
34
|
+
* selection slot and in the address, and the Channels card below lists them and
|
|
35
35
|
* opens a new one. What other networks carry in stays in the Inbox, under its
|
|
36
36
|
* own key.
|
|
37
37
|
*/
|
package/dist/Home.js
CHANGED
|
@@ -34,7 +34,7 @@ import { Bar } from './progress.js';
|
|
|
34
34
|
import { Card, Go, INK, Quiet, Row, SOFT, CHOSEN } from './card.js';
|
|
35
35
|
import { Talk } from './Talk.js';
|
|
36
36
|
import { useMe } from './roster.js';
|
|
37
|
-
import {
|
|
37
|
+
import { fromKey, teamKey, useChannels } from './channels.js';
|
|
38
38
|
import { invite, apps, projects } from './lib/home.js';
|
|
39
39
|
import { BAD } from './lib/mix.js';
|
|
40
40
|
/** What a question can start here. Four, in the order they escalate. */
|
|
@@ -54,9 +54,9 @@ const MODES = [
|
|
|
54
54
|
const SOURCES = ['web', 'news', 'academic', 'github', 'reddit', 'x'];
|
|
55
55
|
const GROUNDS = (mode) => mode === 'news' || mode === 'research';
|
|
56
56
|
/**
|
|
57
|
-
* A
|
|
57
|
+
* A CHANNEL IS READ HERE. Home is the org's app: the rail's channels and direct
|
|
58
58
|
* messages open in this pane (`Talk`), keyed `team:<space>/<id>` in the
|
|
59
|
-
* selection slot and in the address, and the
|
|
59
|
+
* selection slot and in the address, and the Channels card below lists them and
|
|
60
60
|
* opens a new one. What other networks carry in stays in the Inbox, under its
|
|
61
61
|
* own key.
|
|
62
62
|
*/
|
|
@@ -70,13 +70,13 @@ export function Home({ ask }) {
|
|
|
70
70
|
// closed, it draws nothing — so a second instance beside the shell's costs a
|
|
71
71
|
// component and no pixels, and there is still ONE directory in the codebase.
|
|
72
72
|
const [directory, setDirectory] = useState(false);
|
|
73
|
-
const {
|
|
74
|
-
const held =
|
|
73
|
+
const { channel, openChannel } = useOpen();
|
|
74
|
+
const held = useChannels();
|
|
75
75
|
const here = MODES.find((m) => m.id === mode) ?? MODES[0];
|
|
76
76
|
const grounded = GROUNDS(mode);
|
|
77
|
-
const at =
|
|
77
|
+
const at = fromKey(channel);
|
|
78
78
|
if (at)
|
|
79
|
-
return _jsx(Open, { at: at,
|
|
79
|
+
return _jsx(Open, { at: at, channels: held, back: () => openChannel(null) });
|
|
80
80
|
const send = () => {
|
|
81
81
|
const question = draft.trim();
|
|
82
82
|
if (!question)
|
|
@@ -96,29 +96,29 @@ export function Home({ ask }) {
|
|
|
96
96
|
return (_jsxs(YStack, { "data-home": true, flex: 1, minH: 0, width: "100%", overflowY: "auto", overflowX: "hidden", children: [_jsxs(YStack, { width: "100%", maxW: 720, mx: "auto", px: "$4", pt: "$8", gap: "$4", $sm: { pt: '$10' }, children: [_jsx(Text, { render: "h1", fontSize: "$8", fontWeight: "500", color: INK, text: "center", $sm: { fontSize: '$9' }, children: t('What are we building?') }), _jsx(XStack, { justify: "center", gap: "$1", flexWrap: "wrap", children: MODES.map((one) => (_jsx(Box, { "data-tab": one.id, render: "button", onClick: () => setMode(one.id), "aria-current": mode === one.id, px: "$3", py: "$2", rounded: "$10", bg: mode === one.id ? CHOSEN : 'transparent', hoverStyle: { bg: '$hover' }, children: _jsx(Text, { fontSize: "$3", fontWeight: "500", color: mode === one.id ? INK : SOFT, children: t(one.label) }) }, one.id))) }), _jsx(Composer, { value: draft, onChange: setDraft, onSend: send, placeholder: t(here.asks), label: t(here.asks), rows: 2, maxHeight: 240, children: grounded ? (_jsx(XStack, { gap: "$1", flexWrap: "wrap", shrink: 1, minW: 0, children: SOURCES.map((s) => {
|
|
97
97
|
const on = picked.includes(s);
|
|
98
98
|
return (_jsx(Box, { "data-chip": s, render: "button", "aria-pressed": on, onClick: () => setPicked((held) => (on ? held.filter((h) => h !== s) : [...held, s])), px: "$2", py: "$1", rounded: "$10", bg: on ? CHOSEN : 'transparent', hoverStyle: { bg: '$hover' }, children: _jsxs(Text, { "data-i18n-ltr": true, fontSize: "$2", color: on ? INK : SOFT, children: ["@", s] }) }, s));
|
|
99
|
-
}) })) : null }), _jsx(Crew, { to: "/chat" })] }), _jsx(YStack, { width: "100%", maxW: 880, mx: "auto", px: "$4", py: "$8", children: _jsxs(Grid, { columns: { min: 260, max: 3 }, gap: 12, children: [_jsx(
|
|
99
|
+
}) })) : null }), _jsx(Crew, { to: "/chat" })] }), _jsx(YStack, { width: "100%", maxW: 880, mx: "auto", px: "$4", py: "$8", children: _jsxs(Grid, { columns: { min: 260, max: 3 }, gap: 12, children: [_jsx(Channels, { ...held }), _jsx(Projects, {}), _jsx(Chats, {}), _jsx(Next, { onConnect: () => setDirectory(true) }), _jsx(Apps, { onConnect: () => setDirectory(true) }), _jsx(Team, {}), _jsx(Build, {})] }) }), _jsx(Directory, { open: directory, onClose: () => setDirectory(false) })] }));
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
|
-
* The open
|
|
102
|
+
* The open channel, in place of the question and the cards.
|
|
103
103
|
*
|
|
104
|
-
* The key names a space and an id; the org's list answers which
|
|
105
|
-
* The ladder is the one every card climbs: the session first, because that
|
|
106
|
-
* the state that never resolves, then the refusal, then the read, then a key
|
|
107
|
-
*
|
|
104
|
+
* The key names a space and an id; the org's list answers which channel that
|
|
105
|
+
* is. The ladder is the one every card climbs: the session first, because that
|
|
106
|
+
* is the state that never resolves, then the refusal, then the read, then a key
|
|
107
|
+
* no channel answers to — a shared link to a channel this reader cannot see.
|
|
108
108
|
*/
|
|
109
|
-
function Open({ at,
|
|
109
|
+
function Open({ at, channels, back, }) {
|
|
110
110
|
const { t } = useI18n();
|
|
111
111
|
const { isAuthenticated, isLoading } = useIam();
|
|
112
|
-
const found =
|
|
112
|
+
const found = channels.channels?.find((one) => one.space === at.space && one.id === at.id);
|
|
113
113
|
if (found)
|
|
114
|
-
return _jsx(Talk, {
|
|
115
|
-
const reading = isLoading || (isAuthenticated &&
|
|
114
|
+
return _jsx(Talk, { channel: found }, teamKey(found));
|
|
115
|
+
const reading = isLoading || (isAuthenticated && channels.channels === null && !channels.wrong);
|
|
116
116
|
const line = reading
|
|
117
117
|
? t('Reading the channel.')
|
|
118
118
|
: !isAuthenticated
|
|
119
119
|
? t('Sign in to read this channel.')
|
|
120
|
-
:
|
|
121
|
-
? say(
|
|
120
|
+
: channels.wrong
|
|
121
|
+
? say(channels.wrong, t('this channel'), 'read', t)
|
|
122
122
|
: t('That channel is not here.');
|
|
123
123
|
return (_jsxs(YStack, { flex: 1, items: "center", justify: "center", p: "$6", gap: "$3", children: [_jsx(Text, { fontSize: "$3", color: SOFT, children: line }), reading ? null : (_jsx(Box, { render: "button", onClick: back, ...tap, children: _jsx(Text, { fontSize: "$2", fontWeight: "500", color: INK, children: t('Back to home') }) }))] }));
|
|
124
124
|
}
|
|
@@ -127,17 +127,17 @@ function Open({ at, rooms, back, }) {
|
|
|
127
127
|
on its own rather than emptying the grid.
|
|
128
128
|
────────────────────────────────────────────────────────────────────────── */
|
|
129
129
|
/**
|
|
130
|
-
* The org's
|
|
130
|
+
* The org's channels, and the way to open one.
|
|
131
131
|
*
|
|
132
|
-
* The list is the read the rail makes (`
|
|
133
|
-
* disagree about what the org has. A new
|
|
134
|
-
* first member — the platform adds nobody on its own — in the space of the
|
|
135
|
-
* org's first
|
|
132
|
+
* The list is the read the rail makes (`useChannels`), so the two cannot
|
|
133
|
+
* disagree about what the org has. A new channel is posted with the reader as
|
|
134
|
+
* its first member — the platform adds nobody on its own — in the space of the
|
|
135
|
+
* org's first channel, which is the space an org with one has; an org with none
|
|
136
136
|
* leaves it unsaid. The row the platform answers with is opened at once.
|
|
137
137
|
*/
|
|
138
|
-
function
|
|
138
|
+
function Channels({ channels, wrong, open }) {
|
|
139
139
|
const { t } = useI18n();
|
|
140
|
-
const {
|
|
140
|
+
const { openChannel } = useOpen();
|
|
141
141
|
const me = useMe();
|
|
142
142
|
const [naming, setNaming] = useState(false);
|
|
143
143
|
const [name, setName] = useState('');
|
|
@@ -150,10 +150,10 @@ function Rooms({ rooms, wrong, open }) {
|
|
|
150
150
|
setOpening(true);
|
|
151
151
|
setRefused(null);
|
|
152
152
|
try {
|
|
153
|
-
const made = await open({ name: wanted, space:
|
|
153
|
+
const made = await open({ name: wanted, space: channels?.[0]?.space, members: [me] });
|
|
154
154
|
setName('');
|
|
155
155
|
setNaming(false);
|
|
156
|
-
|
|
156
|
+
openChannel(teamKey(made));
|
|
157
157
|
}
|
|
158
158
|
catch (e) {
|
|
159
159
|
setRefused(plainly(e, t('this channel'), t));
|
|
@@ -162,12 +162,12 @@ function Rooms({ rooms, wrong, open }) {
|
|
|
162
162
|
setOpening(false);
|
|
163
163
|
}
|
|
164
164
|
};
|
|
165
|
-
return (_jsxs(Card, { kind: "
|
|
165
|
+
return (_jsxs(Card, { kind: "channels", icon: _jsx(Hash, { size: 14, "aria-hidden": true }), title: t('Channels'), children: [channels === null ? (_jsx(Waiting, { wrong: wrong, subject: t('your channels') })) : channels.length === 0 ? (_jsx(Quiet, { children: t('No channels yet.') })) : (_jsx(YStack, { gap: "$1", children: channels.slice(0, 6).map((one) => (_jsx(Row, { icon: one.direct ? _jsx(AtSign, { size: 12, "aria-hidden": true }) : _jsx(Hash, { size: 12, "aria-hidden": true }), onPress: () => openChannel(teamKey(one)), children: one.name || t('Direct message') }, teamKey(one)))) })), !me ? null : naming ? (_jsxs(YStack, { gap: "$1", children: [_jsxs(XStack, { gap: "$1", items: "center", children: [_jsx(Text, { render: _jsx("input", { value: name, onChange: (e) => setName(e.target.value), onKeyDown: (e) => {
|
|
166
166
|
if (e.key === 'Enter')
|
|
167
167
|
void make();
|
|
168
168
|
if (e.key === 'Escape')
|
|
169
169
|
setNaming(false);
|
|
170
|
-
}, placeholder: t('Name'), "aria-label": t('Channel name'), autoFocus: true }), flex: 1, minW: 0, bg: "transparent", borderWidth: 1, borderColor: "var(--border)", rounded: 6, px: 8, py: 6, color: "inherit", fontSize: "$2" }), _jsx(Box, { render: "button", onClick: () => void make(), "aria-disabled": opening, opacity: opening ? 0.5 : 1, px: "$2", py: "$1.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsx(Text, { fontSize: "$2", fontWeight: "500", color: INK, children: t('Open it') }) })] }), refused ? (_jsx(Text, { fontSize: "$2", color: BAD, children: refused })) : null] })) : (_jsx(Row, { icon: _jsx(Plus, { size: 12, "aria-hidden": true }), onPress: () => setNaming(true), children: t('New
|
|
170
|
+
}, placeholder: t('Name'), "aria-label": t('Channel name'), autoFocus: true }), flex: 1, minW: 0, bg: "transparent", borderWidth: 1, borderColor: "var(--border)", rounded: 6, px: 8, py: 6, color: "inherit", fontSize: "$2" }), _jsx(Box, { render: "button", onClick: () => void make(), "aria-disabled": opening, opacity: opening ? 0.5 : 1, px: "$2", py: "$1.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsx(Text, { fontSize: "$2", fontWeight: "500", color: INK, children: t('Open it') }) })] }), refused ? (_jsx(Text, { fontSize: "$2", color: BAD, children: refused })) : null] })) : (_jsx(Row, { icon: _jsx(Plus, { size: 12, "aria-hidden": true }), onPress: () => setNaming(true), children: t('New channel') }))] }));
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
173
|
* A read the SDK has no hook for.
|