@copilotz/directory 1.0.0-rc.79 → 1.0.0-rc.81

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.
Files changed (68) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +9 -68
  3. package/contract.d.ts +1 -8
  4. package/contract.js +1 -8
  5. package/mod.d.ts +2 -67
  6. package/mod.js +2 -122
  7. package/package.json +9 -35
  8. package/web.d.ts +2 -36
  9. package/web.js +2 -57
  10. package/WORDS.md +0 -198
  11. package/actions/code.d.ts +0 -4
  12. package/actions/code.js +0 -135
  13. package/actions/host.d.ts +0 -2
  14. package/actions/host.js +0 -55
  15. package/actions/invite.d.ts +0 -5
  16. package/actions/invite.js +0 -129
  17. package/actions/org.d.ts +0 -10
  18. package/actions/org.js +0 -273
  19. package/collections/credit-code.d.ts +0 -107
  20. package/collections/credit-code.js +0 -28
  21. package/collections/invite.d.ts +0 -74
  22. package/collections/invite.js +0 -20
  23. package/collections/membership.d.ts +0 -65
  24. package/collections/membership.js +0 -22
  25. package/collections/org-host.d.ts +0 -55
  26. package/collections/org-host.js +0 -30
  27. package/collections/org.d.ts +0 -134
  28. package/collections/org.js +0 -58
  29. package/collections/staff.d.ts +0 -35
  30. package/collections/staff.js +0 -12
  31. package/routes/console.d.ts +0 -26
  32. package/routes/console.js +0 -129
  33. package/routes/enter.d.ts +0 -18
  34. package/routes/enter.js +0 -47
  35. package/routes/forward.d.ts +0 -35
  36. package/routes/forward.js +0 -119
  37. package/routes/orgs.d.ts +0 -25
  38. package/routes/orgs.js +0 -113
  39. package/routes/signout.d.ts +0 -11
  40. package/routes/signout.js +0 -36
  41. package/shared/enter.d.ts +0 -36
  42. package/shared/enter.js +0 -82
  43. package/shared/http.d.ts +0 -42
  44. package/shared/http.js +0 -77
  45. package/shared/member.d.ts +0 -21
  46. package/shared/member.js +0 -73
  47. package/shared/settings.d.ts +0 -53
  48. package/shared/settings.js +0 -16
  49. package/shared/state.d.ts +0 -74
  50. package/shared/state.js +0 -101
  51. package/views/web/codes.d.ts +0 -27
  52. package/views/web/codes.js +0 -50
  53. package/views/web/console-codes.d.ts +0 -37
  54. package/views/web/console-codes.js +0 -166
  55. package/views/web/console.d.ts +0 -37
  56. package/views/web/console.js +0 -224
  57. package/views/web/lists.d.ts +0 -48
  58. package/views/web/lists.js +0 -42
  59. package/views/web/org.d.ts +0 -12
  60. package/views/web/org.js +0 -62
  61. package/views/web/orgs.d.ts +0 -148
  62. package/views/web/orgs.js +0 -253
  63. package/views/web/style.d.ts +0 -6
  64. package/views/web/style.js +0 -197
  65. package/views/web/switcher.d.ts +0 -81
  66. package/views/web/switcher.js +0 -367
  67. package/views/web/words.d.ts +0 -10
  68. package/views/web/words.js +0 -206
@@ -1,367 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- /**
3
- * Orgs in the shell, when the app serves many (`useOrgs`), through the web
4
- * shell's `orgs` slot: the switcher at the top of the sidebar, where the
5
- * app's identity sits (`orgs.switcher`: the org you're in, your standing
6
- * there; opened, your orgs, Personal first-class, invitations waiting with a
7
- * badge, to join or decline in place, a new org, the org's settings, and for
8
- * staff, every org); on the rail, the sidebar folded (`orgs.rail`), the same
9
- * as the org's face, named beside it, opening beside the rail; beside every
10
- * page (`orgs.overlay`), the small dialog
11
- * that makes an org and going between them: a short transition while the
12
- * page starts over in the other org, and a word once it's there; and what
13
- * the shell's menu and palette list (`useShellOrgs`). Staff in an org that
14
- * isn't theirs see it, quietly and all the time (a line along the top of
15
- * the window): what they do is on its record.
16
- */
17
- import { useEffect, useRef, useState, useSyncExternalStore, } from "react";
18
- import { Avatar, Badge, Button, Dialog, Field, Icon, Input, lang, message, Notice, Popover, RailItem, Spinner, Time, } from "copilotz/web";
19
- import { answerOrgInvite, arrived, asStaff, createOrg, enterOrg, orgName, useOrgs, useSwitching, } from "./orgs.js";
20
- import { orgRoleName, runs, useStanding, } from "copilotz/plugins/interfaces/contract";
21
- import { standingName } from "./lists.js";
22
- import { STYLE } from "./style.js";
23
- import { say } from "./words.js";
24
- /** The directory front end's styles, with whatever of it is drawn. */
25
- export const style = _jsx("style", { href: "directory-web", precedence: "copilotz", children: STYLE });
26
- /**
27
- * The switcher (`orgs.switcher`, the `orgs` slot's): where you are among your orgs, at the top
28
- * of the sidebar, once they're known (the shell draws it once `useShellOrgs` answers).
29
- */
30
- export const switcherView = (_, ctx) => (_jsx(Switcher, { call: ctx.call }));
31
- /**
32
- * The switcher on the rail (`orgs.rail`, the `orgs` slot's), the sidebar folded: the org's face,
33
- * named beside it, its invitations counted at its corner; it opens the same choices, beside it.
34
- */
35
- export const switcherRailView = (_, ctx) => (_jsx(Switcher, { call: ctx.call, rail: true }));
36
- function Switcher({ call, rail }) {
37
- const orgs = useOrgs();
38
- const ready = orgs.status === "ready";
39
- const standing = useStanding(call, ready);
40
- if (!ready)
41
- return null;
42
- return (_jsxs(_Fragment, { children: [style, _jsx(OrgSwitcher, { orgs: orgs.value, here: orgs.here, standing: standing, staff: asStaff(orgs.value), onNew: openNewOrg, rail: rail })] }));
43
- }
44
- /**
45
- * Beside every page (`orgs.overlay`, the `orgs` slot's), outside the sidebar, which is a drawer
46
- * on a phone: the line along the top while in an org as staff, the dialog that makes an org,
47
- * and going into one.
48
- */
49
- export const overlayView = () => _jsx(Overlay, {});
50
- function Overlay() {
51
- const orgs = useOrgs();
52
- const making = useSyncExternalStore(newOrg.subscribe, newOrg.get, newOrg.get);
53
- const ready = orgs.status === "ready";
54
- return (_jsxs(_Fragment, { children: [style, ready && asStaff(orgs.value)
55
- ? (_jsx("div", { className: "copilotz-staff-line", role: "note", children: _jsx("span", { className: "copilotz-sr", children: say("staffLine") }) }))
56
- : null, ready ? _jsx(NewOrg, { open: making, onClose: closeNewOrg }) : null, _jsx(Switching, {})] }));
57
- }
58
- /**
59
- * What the shell's own parts list of the person's orgs (the `orgs` slot's hook): their email,
60
- * the org's page and (for staff) every org in their menu, and orgs in the palette. Nothing until
61
- * the orgs are known, or where the server serves one.
62
- */
63
- export function useShellOrgs(call) {
64
- const orgs = useOrgs();
65
- const ready = orgs.status === "ready";
66
- const standing = useStanding(call, ready);
67
- if (!ready)
68
- return undefined;
69
- const { value, here } = orgs;
70
- return {
71
- email: value.email,
72
- menu: [
73
- ...(here
74
- ? [{
75
- label: runs(standing) ? say("orgSettings") : say("aboutOrg"),
76
- icon: "settings",
77
- href: "/org",
78
- }]
79
- : []),
80
- ...(value.staff
81
- ? [{ label: say("allOrgsConsole"), icon: "server", href: "/console" }]
82
- : []),
83
- ],
84
- palette: orgsPalette(value, here, standing),
85
- };
86
- }
87
- /** Whether the dialog that makes an org is open: the switcher opens it, the overlay draws it. */
88
- let making = false;
89
- const makers = new Set();
90
- const newOrg = {
91
- subscribe(listener) {
92
- makers.add(listener);
93
- return () => makers.delete(listener);
94
- },
95
- get: () => making,
96
- };
97
- const setMaking = (open) => {
98
- making = open;
99
- for (const listener of makers)
100
- listener();
101
- };
102
- /** Opens the dialog that makes an org. */
103
- export const openNewOrg = () => setMaking(true);
104
- const closeNewOrg = () => setMaking(false);
105
- /** The words a phrase gives to find an item by (its keywords), apart. */
106
- const keywords = (key) => say(key).split(/\s+/).filter(Boolean);
107
- /** An org's face: yours (Personal) is you; a team's, its initials. */
108
- export function OrgFace({ org, person, size = 26 }) {
109
- return org.kind === "personal"
110
- ? _jsx(Avatar, { name: person, size: size })
111
- : _jsx(Avatar, { name: org.name, kind: "org", size: size, ...(org.id ? { tint: org.id } : {}) });
112
- }
113
- /** What the switcher says under the org's name: your standing there. */
114
- function subline(org, standing, staff) {
115
- if (staff)
116
- return say("staffAccess");
117
- if (org?.kind === "personal")
118
- return say("justYou");
119
- return standingName(standing) || " ";
120
- }
121
- export function OrgSwitcher({ orgs, here, standing, staff, onNew, rail }) {
122
- const [failed, setFailed] = useState();
123
- /** Goes in or back as staff: the page starts over, or it stays and says why. */
124
- const switchTo = (org, staff) => {
125
- setFailed(undefined);
126
- enterOrg(org, staff).catch((e) => setFailed(message(e)));
127
- };
128
- const waiting = orgs.invites.length;
129
- const name = here ? orgName(here) : say("organization");
130
- const mine = [...orgs.orgs].sort((a, b) => Number(b.kind === "personal") - Number(a.kind === "personal") ||
131
- a.name.localeCompare(b.name, undefined, { sensitivity: "base" }));
132
- const face = here
133
- ? _jsx(OrgFace, { org: here, person: orgs.person, size: 28 })
134
- : _jsx(Avatar, { name: name, kind: "org", size: 28 });
135
- const title = staff ? say("inAsStaffTitle", { name }) : say("switchOrg", { name });
136
- return (_jsx(Popover, { label: say("yourOrgs"), width: 312, className: "copilotz-orgs", ...(rail ? { side: "end", align: "start" } : {}), trigger: (props) => rail
137
- ? (_jsx(RailItem, { ...props, className: "copilotz-org-rail", "data-staff": staff || undefined, leading: face,
138
- // Staff hear first that they're in as staff; anyone else, what waits for them.
139
- label: waiting && !staff ? say("switchOrgWaiting", { name, count: waiting }) : title, badge: waiting, tooltip: !props["aria-expanded"] }))
140
- : (_jsxs("button", { type: "button", ...props, className: "copilotz-org", "data-staff": staff || undefined, title: title, children: [face, _jsxs("span", { className: "copilotz-org-text", children: [_jsx("span", { className: "copilotz-org-name", children: name }), _jsxs("span", { className: "copilotz-org-sub", children: [staff ? _jsx(Icon, { name: "shield", size: 12 }) : null, subline(here, standing, staff)] })] }), waiting
141
- ? (_jsx("span", { className: "copilotz-org-dot", "aria-label": say("invitationsCount", { count: waiting }), children: waiting }))
142
- : null, _jsx(Icon, { name: "selector", size: 15, className: "copilotz-org-chevron" })] })), children: (close) => (_jsxs("div", { className: "copilotz-orgs-box", children: [_jsx("p", { className: "copilotz-orgs-who", children: say.nodes("signedInAs", { who: _jsx("b", { children: orgs.email ?? orgs.person }) }) }), staff && here
143
- ? (_jsxs("div", { className: "copilotz-orgs-staff", children: [_jsx(Icon, { name: "shield", size: 15 }), _jsxs("span", { children: [say.nodes("inAsStaff", { name: _jsx("b", { children: here.name }) }), standing?.role
144
- ? (_jsx("button", { type: "button", "data-popover-item": true, className: "copilotz-orgs-staff-back", onClick: () => switchTo(here, false), children: say("continueAs", { role: standingName(standing) }) }))
145
- : null] })] }))
146
- : null, failed ? _jsx(Notice, { tone: "destructive", role: "alert", children: failed }) : null, _jsx("ul", { className: "copilotz-orgs-list", "aria-label": say("organizations"), children: mine.map((org) => (_jsx("li", { children: _jsx(OrgRow, { org: org, person: orgs.person, current: org.id === orgs.current, close: close }) }, org.id))) }), waiting
147
- ? (_jsxs("section", { className: "copilotz-orgs-invites", "aria-labelledby": "copilotz-orgs-invites", children: [_jsxs("h3", { id: "copilotz-orgs-invites", children: [say("invitations"), " ", _jsx(Badge, { tone: "primary", children: waiting })] }), _jsx("ul", { children: orgs.invites.map((invite) => (_jsx("li", { children: _jsx(InviteRow, { invite: invite, close: close }) }, invite.id))) })] }))
148
- : null, _jsxs("div", { className: "copilotz-orgs-actions", children: [_jsxs("button", { type: "button", "data-popover-item": true, className: "copilotz-orgs-action", onClick: () => {
149
- close();
150
- onNew();
151
- }, children: [_jsx("span", { className: "copilotz-orgs-icon copilotz-orgs-icon-new", children: _jsx(Icon, { name: "plus", size: 15 }) }), say("newOrgMore")] }), here && (runs(standing) || standing?.role)
152
- ? (_jsxs("a", { "data-popover-item": true, className: "copilotz-orgs-action", href: "/org", onClick: close, children: [_jsx("span", { className: "copilotz-orgs-icon", children: _jsx(Icon, { name: "settings", size: 15 }) }), runs(standing) ? say("orgSettings") : say("aboutOrg")] }))
153
- : null, orgs.staff && here && !staff
154
- ? (_jsxs("button", { type: "button", "data-popover-item": true, className: "copilotz-orgs-action", onClick: () => switchTo(here, true), children: [_jsx("span", { className: "copilotz-orgs-icon", children: _jsx(Icon, { name: "shield", size: 15 }) }), say("enterAsStaff")] }))
155
- : null, orgs.staff
156
- ? (_jsxs("a", { "data-popover-item": true, className: "copilotz-orgs-action", href: "/console", onClick: close, children: [_jsx("span", { className: "copilotz-orgs-icon", children: _jsx(Icon, { name: "server", size: 15 }) }), say("allOrgsConsole")] }))
157
- : null] })] })) }));
158
- }
159
- /** One of your orgs: going into it, or where you are (a check). A suspended one says so. */
160
- function OrgRow({ org, person, current, close }) {
161
- const [error, setError] = useState();
162
- const suspended = !!org.suspended && !current;
163
- return (_jsxs("button", { type: "button", "data-popover-item": true, className: "copilotz-orgs-row", "aria-current": current || undefined, "aria-disabled": suspended || undefined, title: suspended ? say("suspendedTitle", { name: org.name }) : undefined, onClick: () => {
164
- if (suspended)
165
- return;
166
- if (current)
167
- return close();
168
- setError(undefined);
169
- const going = enterOrg(org);
170
- close();
171
- going.catch((e) => setError(message(e)));
172
- }, children: [_jsx(OrgFace, { org: org, person: person, size: 28 }), _jsxs("span", { className: "copilotz-orgs-row-text", children: [_jsx("span", { className: "copilotz-orgs-row-name", children: orgName(org) }), error
173
- ? _jsx("span", { className: "copilotz-orgs-row-error", children: error })
174
- : org.kind === "personal"
175
- ? _jsx("span", { className: "copilotz-orgs-row-sub", children: say("yourOwn") })
176
- : null] }), suspended ? _jsx(Badge, { tone: "warning", children: say("suspended") }) : null, current ? _jsx(Icon, { name: "check", size: 16, className: "copilotz-orgs-check" }) : null] }));
177
- }
178
- /** An invitation to an org, answered in place: joining goes into it. */
179
- function InviteRow({ invite, close }) {
180
- const [busy, setBusy] = useState();
181
- const [error, setError] = useState();
182
- const answer = (accept) => {
183
- setBusy(accept ? "join" : "decline");
184
- setError(undefined);
185
- const answered = answerOrgInvite(invite, accept);
186
- // Joining goes into it: the transition shows over everything.
187
- if (accept)
188
- close();
189
- answered.catch((e) => {
190
- setError(message(e));
191
- setBusy(undefined);
192
- });
193
- };
194
- return (_jsxs("div", { className: "copilotz-orgs-invite", children: [_jsx(Avatar, { name: invite.name, kind: "org", size: 28, tint: invite.org }), _jsxs("div", { className: "copilotz-orgs-invite-text", children: [_jsx("p", { className: "copilotz-orgs-invite-name", children: invite.name }), _jsx("p", { className: "copilotz-orgs-invite-meta", children: error ?? say.nodes(invite.from ? "invitedFromAsAt" : "invitedAsAt", {
195
- from: invite.from ?? "",
196
- role: orgRoleName(invite.role).toLocaleLowerCase(lang()),
197
- time: _jsx(Time, { at: invite.at }),
198
- }) }), _jsxs("div", { className: "copilotz-orgs-invite-answers", children: [_jsx(Button, { size: "sm", variant: "primary", "data-popover-item": true, loading: busy === "join", disabled: !!busy, onClick: () => answer(true), children: say("join") }), _jsx(Button, { size: "sm", variant: "ghost", "data-popover-item": true, loading: busy === "decline", disabled: !!busy, onClick: () => answer(false), children: say("decline") })] })] })] }));
199
- }
200
- /** Names longer than this aren't taken. */
201
- const LONGEST = 80;
202
- /** The small dialog that makes a team org: its name, then you're in it, its owner. */
203
- export function NewOrg({ open, onClose }) {
204
- const [name, setName] = useState("");
205
- const [busy, setBusy] = useState(false);
206
- const [error, setError] = useState();
207
- useEffect(() => {
208
- if (!open) {
209
- setName("");
210
- setError(undefined);
211
- setBusy(false);
212
- }
213
- }, [open]);
214
- const typed = name.trim();
215
- const long = typed.length > LONGEST;
216
- const create = async (event) => {
217
- event?.preventDefault();
218
- if (!typed || long || busy)
219
- return;
220
- setBusy(true);
221
- setError(undefined);
222
- try {
223
- await createOrg(typed);
224
- }
225
- catch (e) {
226
- setError(message(e));
227
- setBusy(false);
228
- }
229
- };
230
- return (_jsx(Dialog, { open: open, onClose: onClose, size: "sm", title: say("newOrg"), description: say("newOrgAbout"), footer: _jsxs(_Fragment, { children: [_jsx(Button, { variant: "ghost", onClick: onClose, disabled: busy, children: say("cancel") }), _jsx(Button, { variant: "primary", loading: busy, disabled: !typed || long, onClick: () => void create(), children: say("createOrg") })] }), children: _jsxs("form", { onSubmit: create, className: "copilotz-new-org", children: [_jsx("div", { className: "copilotz-new-org-preview", "aria-hidden": "true", children: _jsx(Avatar, { name: typed || "?", kind: "org", size: 44 }) }), _jsx(Field, { label: say("name"), hint: long ? undefined : say("newOrgNameHint"), error: long ? say("atMost", { count: LONGEST }) : error, children: (control) => (_jsx(Input, { ...control, value: name, onChange: (e) => setName(e.target.value), placeholder: say("newOrgPlaceholder"), autoComplete: "organization", maxLength: LONGEST + 20, autoFocus: true })) })] }) }));
231
- }
232
- /** While the page goes into another org: its face and name, over everything, until it's there. */
233
- export function Switching() {
234
- const to = useSwitching();
235
- const [welcome, setWelcome] = useState();
236
- const layer = useRef(null);
237
- // Over everything, a dialog that started it included: a modal of its own, on top.
238
- useEffect(() => {
239
- if (to && !layer.current?.open)
240
- layer.current?.showModal();
241
- }, [to]);
242
- useEffect(() => {
243
- const came = arrived();
244
- if (!came)
245
- return;
246
- setWelcome(came);
247
- const done = setTimeout(() => setWelcome(undefined), came.staff || came.moved ? 5200 : 2600);
248
- return () => clearTimeout(done);
249
- }, []);
250
- return (_jsxs(_Fragment, { children: [to
251
- ? (_jsx("dialog", { ref: layer, className: "copilotz-switching", "aria-live": "assertive", "aria-label": say("goingInto", { name: orgName(to) }),
252
- // It ends when the page starts over, not on Escape.
253
- onCancel: (event) => event.preventDefault(), children: _jsxs("div", { className: "copilotz-switching-box", children: [to.kind === "personal"
254
- ? (_jsx("span", { className: "copilotz-switching-personal", children: _jsx(Icon, { name: "person", size: 26 }) }))
255
- : (_jsx(Avatar, { name: to.name, kind: "org", size: 56, ...(to.id ? { tint: to.id } : {}) })), _jsx("p", { className: "copilotz-switching-label", children: to.staff ? say("enteringAsStaff") : say("switchingTo") }), _jsx("p", { className: "copilotz-switching-name", children: orgName(to) }), _jsx(Spinner, { variant: "dots", size: 6 })] }) }))
256
- : null, welcome && !to
257
- ? (_jsxs("div", { className: "copilotz-arrived", role: "status", "data-staff": welcome.staff || undefined, "data-long": welcome.staff || welcome.moved || undefined, children: [welcome.staff
258
- ? _jsx(Icon, { name: "shield", size: 16 })
259
- : _jsx(Icon, { name: welcome.moved ? "info" : "check", size: 16 }), _jsx("span", { children: welcome.staff
260
- ? say.nodes("inAsStaff", { name: _jsx("b", { children: welcome.name }) })
261
- : welcome.moved
262
- ? say.nodes("movedOrg", { name: _jsx("b", { children: orgName(welcome) }) })
263
- : say.nodes("youreIn", { name: _jsx("b", { children: orgName(welcome) }) }) })] }))
264
- : null] }));
265
- }
266
- /** Making a team org from the palette: its name, then you're in it. */
267
- const newOrgStep = () => ({
268
- title: say("newOrg"),
269
- placeholder: say("nameIt"),
270
- note: say("newOrgAbout"),
271
- filter: false,
272
- items: (search) => {
273
- const name = search.trim();
274
- if (!name)
275
- return [];
276
- const long = name.length > LONGEST;
277
- return [{
278
- title: "",
279
- items: [{
280
- key: "org:create",
281
- label: say("createNamed", { name }),
282
- icon: "plus",
283
- disabled: long,
284
- ...(long ? { description: say("atMost", { count: LONGEST }) } : {}),
285
- run: () => createOrg(name),
286
- }],
287
- }];
288
- },
289
- });
290
- /**
291
- * What the palette offers for orgs: the others to switch to, invitations to
292
- * join or decline (with the spaces' own, under one heading), a new org, the
293
- * org's settings, and for staff, every org.
294
- */
295
- export function orgsPalette(orgs, here, standing) {
296
- const others = orgs.orgs.filter((o) => o.id !== orgs.current);
297
- const groups = [{
298
- title: say("organizations"),
299
- order: 25,
300
- items: [
301
- ...others.map((org) => ({
302
- key: `org:${org.id}`,
303
- label: say("switchTo", { name: orgName(org) }),
304
- leading: _jsx(OrgFace, { org: org, person: orgs.person, size: 26 }),
305
- ...(org.suspended
306
- ? { description: say("suspended"), disabled: true }
307
- : org.kind === "personal"
308
- ? { description: say("yourOwnOrg") }
309
- : {}),
310
- keywords: [...keywords("keysSwitch"), org.name],
311
- run: () => enterOrg(org),
312
- })),
313
- {
314
- key: "org:new",
315
- label: say("newOrgMore"),
316
- icon: "plus",
317
- keywords: keywords("keysNewOrg"),
318
- step: newOrgStep(),
319
- },
320
- ...(here
321
- ? [{
322
- key: "org:settings",
323
- label: runs(standing) ? say("orgSettings") : say("aboutOrg"),
324
- icon: "settings",
325
- keywords: keywords("keysOrgSettings"),
326
- href: "/org",
327
- }]
328
- : []),
329
- ...(orgs.staff
330
- ? [{
331
- key: "org:console",
332
- label: say("allOrgsConsole"),
333
- icon: "server",
334
- keywords: keywords("keysConsole"),
335
- href: "/console",
336
- }]
337
- : []),
338
- ],
339
- }];
340
- if (orgs.invites.length) {
341
- groups.unshift({
342
- title: say("invitations"),
343
- order: 5,
344
- items: orgs.invites.flatMap((invite) => [
345
- {
346
- key: `org-invite:${invite.id}`,
347
- label: say("joinNamed", { name: invite.name }),
348
- leading: _jsx(Avatar, { name: invite.name, kind: "org", size: 26, tint: invite.org }),
349
- description: say(invite.from ? "invitedFromAs" : "invitedAs", {
350
- from: invite.from ?? "",
351
- role: orgRoleName(invite.role).toLocaleLowerCase(lang()),
352
- }),
353
- keywords: keywords("keysAcceptOrgInvite"),
354
- run: () => answerOrgInvite(invite, true),
355
- },
356
- {
357
- key: `org-decline:${invite.id}`,
358
- label: say("declineOrgInvite", { name: invite.name }),
359
- icon: "close",
360
- keywords: keywords("keysOrgInvite"),
361
- run: () => answerOrgInvite(invite, false),
362
- },
363
- ]),
364
- });
365
- }
366
- return groups;
367
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * The words of the directory's front end, in English: the org switcher, going between orgs, the
3
- * org's page and staff's console keep the keys they had in the web shell (`shell.<key>`), so an
4
- * app's own words for them still hold; what an org is called where it shows is `directory.<key>`.
5
- */
6
- import { type Phrase } from "copilotz/web/words";
7
- export declare const say: import("copilotz/web/words").Say<"personal" | "team" | "placement" | "join" | "actions" | "staff" | "cancel" | "name" | "status" | "suspended" | "rename" | "people" | "spaces" | "active" | "goHome" | "staffLine" | "orgSettings" | "aboutOrg" | "allOrgsConsole" | "organization" | "oneOrg" | "oneOrgAbout" | "notInOrg" | "chooseOrg" | "personalOrg" | "teamOrg" | "staffAccess" | "orgAboutStaff" | "orgAboutPersonal" | "orgAboutRuns" | "orgAboutGuest" | "orgAboutMember" | "orgSection" | "heldBack" | "orgSettingsOf" | "nothingToSet" | "nothingToSetAbout" | "justYou" | "yourOrgs" | "organizations" | "inAsStaffTitle" | "switchOrg" | "switchOrgWaiting" | "invitationsCount" | "signedInAs" | "inAsStaff" | "continueAs" | "invitations" | "newOrgMore" | "enterAsStaff" | "suspendedTitle" | "yourOwn" | "invitedFromAsAt" | "invitedAsAt" | "invitedFromAs" | "invitedAs" | "joinNamed" | "decline" | "newOrg" | "newOrgAbout" | "createOrg" | "newOrgNameHint" | "atMost" | "newOrgPlaceholder" | "goingInto" | "enteringAsStaff" | "switchingTo" | "movedOrg" | "youreIn" | "nameIt" | "createNamed" | "switchTo" | "yourOwnOrg" | "declineOrgInvite" | "keysSwitch" | "keysNewOrg" | "keysOrgSettings" | "keysConsole" | "keysAcceptOrgInvite" | "keysOrgInvite" | "filterAll" | "filterTeams" | "giftCodes" | "consoleTitle" | "forStaff" | "forStaffAbout" | "consoleShows" | "giftCodesAbout" | "consoleAbout" | "refresh" | "teamOrgs" | "searchPlaceholder" | "searchOrgs" | "whichOrgs" | "lastActive" | "noMatch" | "nothingMatches" | "nothingYet" | "footAll" | "footSome" | "hereAsStaff" | "youreHere" | "copyOrgId" | "notYet" | "inItAsStaff" | "goIntoAsStaff" | "moreOf" | "renameMore" | "liftMore" | "suspendMore" | "moveMore" | "exportRows" | "deleteMore" | "unsupported" | "renamedTo" | "renameOrg" | "renameOrgAbout" | "liftTitle" | "suspendTitle" | "openAgain" | "isSuspended" | "lift" | "suspend" | "liftAbout" | "suspendAbout" | "nowLivesIn" | "moveTitle" | "moveAbout" | "moveRows" | "moveText" | "nowIn" | "newSchema" | "sameSchema" | "schemaRule" | "isDeleted" | "deleteTitle" | "deleteForGood" | "cantUndo" | "deleteAbout" | "exportFirst" | "typeToConfirm" | "codeWaiting" | "codeClaimed" | "codeRevoked" | "codeExpired" | "sayDollars" | "codesCount" | "newGiftCode" | "tryAgain" | "noCodes" | "noCodesAbout" | "termsLapse" | "termsNoLapse" | "termsLapseClaim" | "termsNoLapseClaim" | "codeShortTitle" | "codeMade" | "claimedBy" | "takeBack" | "makeCode" | "makeTheCode" | "credits" | "lapseOn" | "lapseHint" | "claimBy" | "claimHint" | "whatFor" | "whatForHint" | "notePlaceholder" | "yourCode" | "keptIt" | "copyCode" | "notShownAgain" | "notShownAgainAbout" | "takeBackTitle" | "takeItBack" | "takeBackAbout">;
8
- export declare const sayOrg: import("copilotz/web/words").Say<"personalOrg">;
9
- /** Every word of the directory's front end, by area (WORDS.md lists them). */
10
- export declare const PHRASES: Record<string, Record<string, Phrase>>;
@@ -1,206 +0,0 @@
1
- /**
2
- * The words of the directory's front end, in English: the org switcher, going between orgs, the
3
- * org's page and staff's console keep the keys they had in the web shell (`shell.<key>`), so an
4
- * app's own words for them still hold; what an org is called where it shows is `directory.<key>`.
5
- */
6
- import { defineWords } from "copilotz/web/words";
7
- const shell = {
8
- // Going home, and staff in an org (org.tsx, switcher.tsx)
9
- goHome: "Go home",
10
- staffLine: "You're in this org as platform staff: what you do is on its record.",
11
- // In the account menu and the palette (web.tsx)
12
- orgSettings: "Organization settings",
13
- aboutOrg: "About this organization",
14
- allOrgsConsole: "All orgs (console)",
15
- // Standing (lists.ts)
16
- staff: "Staff",
17
- // The org's page (org.tsx)
18
- organization: "Organization",
19
- oneOrg: "One organization here",
20
- oneOrgAbout: "This app serves a single organization, so there's nothing to set here.",
21
- notInOrg: "You're not in an organization",
22
- chooseOrg: "Choose one from the switcher at the top of the sidebar.",
23
- personalOrg: "Personal org",
24
- teamOrg: "Team org",
25
- staffAccess: "Staff access",
26
- orgAboutStaff: "You're here as platform staff: what you do is on {name}'s record.",
27
- orgAboutPersonal: "Your own organization: just you, and what you make alone.",
28
- orgAboutRuns: "Who's in {name}, what it uses, and what it's called.",
29
- orgAboutGuest: "What {name} is. As a guest, you work in the spaces you're invited to.",
30
- orgAboutMember: "What {name} is, and who's in it.",
31
- orgSection: "{name}: {section}",
32
- heldBack: "{section} is for this org's owners and admins. Ask one of them if you need something changed there.",
33
- orgSettingsOf: "{name}'s settings",
34
- nothingToSet: "Nothing to set here",
35
- nothingToSetAbout: "This app adds no sections to an organization's page.",
36
- // Orgs: the switcher, the new-org dialog, going between orgs, the palette (switcher.tsx)
37
- justYou: "Just you",
38
- yourOrgs: "Your organizations",
39
- organizations: "Organizations",
40
- inAsStaffTitle: "You're in {name} as platform staff: what you do is on its record",
41
- switchOrg: "{name}: switch organization",
42
- // …on the rail, the sidebar folded, with invitations waiting
43
- switchOrgWaiting: {
44
- one: "{name}: switch organization ({count} invitation)",
45
- other: "{name}: switch organization ({count} invitations)",
46
- },
47
- invitationsCount: "{count} invitations",
48
- signedInAs: "Signed in as {who}",
49
- inAsStaff: "You're in {name} as staff. What you do here is on its record.",
50
- continueAs: "Continue as {role}",
51
- invitations: "Invitations",
52
- newOrgMore: "New organization…",
53
- enterAsStaff: "Enter as staff",
54
- suspendedTitle: "{name} is suspended: nobody goes in for now",
55
- yourOwn: "Your own",
56
- suspended: "Suspended",
57
- invitedFromAsAt: "{from} invited you, as {role} · {time}",
58
- invitedAsAt: "You're invited, as {role} · {time}",
59
- invitedFromAs: "{from} invited you, as {role}",
60
- invitedAs: "You're invited, as {role}",
61
- join: "Join",
62
- joinNamed: "Join {name}",
63
- decline: "Decline",
64
- newOrg: "New organization",
65
- newOrgAbout: "For a team: you'll own it, and invite people by email.",
66
- cancel: "Cancel",
67
- createOrg: "Create organization",
68
- name: "Name",
69
- newOrgNameHint: "Usually your team's or company's name. You can change it later.",
70
- atMost: "At most {count} characters",
71
- newOrgPlaceholder: "e.g. Acme",
72
- goingInto: "Going into {name}",
73
- enteringAsStaff: "Entering as staff",
74
- switchingTo: "Switching to",
75
- movedOrg: "You're no longer in the org you were in. You're in {name}.",
76
- youreIn: "You're in {name}",
77
- nameIt: "Name it",
78
- createNamed: "Create “{name}”",
79
- switchTo: "Switch to {name}",
80
- yourOwnOrg: "Your own org",
81
- declineOrgInvite: "Decline {name}'s invitation",
82
- // Words the palette finds an item by, apart by spaces
83
- keysSwitch: "organization org switch",
84
- keysNewOrg: "create team organization org",
85
- keysOrgSettings: "members usage invite roles organization",
86
- keysConsole: "staff console platform suspend",
87
- keysAcceptOrgInvite: "invitation accept organization",
88
- keysOrgInvite: "invitation organization",
89
- // Staff's console (console.tsx)
90
- filterAll: "All",
91
- filterTeams: "Teams",
92
- personal: "Personal",
93
- giftCodes: "Gift codes",
94
- consoleTitle: "Console",
95
- forStaff: "For platform staff",
96
- forStaffAbout: "The console lists every organization, for the people who run this app.",
97
- consoleShows: "What the console shows",
98
- giftCodesAbout: "Credits waiting to be claimed. Someone who runs an org types one in under Billing, and its credits are that org's.",
99
- consoleAbout: "Every org on this app: what each last reported, where its rows live, and what you can do about it. Nothing here reads an org's content.",
100
- refresh: "Refresh",
101
- teamOrgs: "Team orgs",
102
- people: "People",
103
- searchPlaceholder: "Search by name, id, schema or maker",
104
- searchOrgs: "Search organizations",
105
- whichOrgs: "Which organizations",
106
- spaces: "Spaces",
107
- lastActive: "Last active",
108
- placement: "Placement",
109
- status: "Status",
110
- actions: "Actions",
111
- noMatch: "No organization matches",
112
- nothingMatches: "Nothing matches “{search}”",
113
- nothingYet: "Nothing in this list yet.",
114
- footAll: {
115
- one: "{count} organization · the most recently active first",
116
- other: "{count} organizations · the most recently active first",
117
- },
118
- footSome: "{shown} of {total} organizations · the most recently active first",
119
- hereAsStaff: "You're here as staff",
120
- youreHere: "You're here",
121
- team: "Team",
122
- copyOrgId: "Copy the org's id",
123
- notYet: "Not yet",
124
- active: "Active",
125
- inItAsStaff: "You're in it as staff",
126
- goIntoAsStaff: "Go into {name} as staff: what you do there is on its record",
127
- moreOf: "{name}: more",
128
- renameMore: "Rename…",
129
- liftMore: "Lift the suspension…",
130
- suspendMore: "Suspend…",
131
- moveMore: "Move to another schema…",
132
- exportRows: "Export its rows (SQL)",
133
- deleteMore: "Delete for good…",
134
- unsupported: "This app doesn't do that yet. ({reason})",
135
- renamedTo: "Renamed to “{name}”.",
136
- renameOrg: "Rename organization",
137
- renameOrgAbout: "Its people see the new name at once, everywhere.",
138
- rename: "Rename",
139
- liftTitle: "Lift the suspension of {name}?",
140
- suspendTitle: "Suspend {name}?",
141
- openAgain: "{name} is open again.",
142
- isSuspended: "{name} is suspended.",
143
- lift: "Lift the suspension",
144
- suspend: "Suspend",
145
- liftAbout: "Its people can go in again, as before. Nothing in it changed while it was suspended.",
146
- suspendAbout: "Nobody but staff goes in until you lift it: its people see that it's suspended. Nothing in it is changed or deleted.",
147
- nowLivesIn: "{name} now lives in “{schema}”.",
148
- moveTitle: "Move {name}",
149
- moveAbout: "For big orgs: gives it a schema of its own, so its load and its rows stand apart from the shared pool.",
150
- moveRows: "Move its rows",
151
- moveText: "It's closed for a moment, its rows are copied to the new schema as they are, and it opens there on its next use. Its people may see it reconnect.",
152
- nowIn: "Now in",
153
- newSchema: "New schema",
154
- sameSchema: "That's where it is now.",
155
- schemaRule: "Lowercase letters, digits and _, starting with a letter.",
156
- isDeleted: "{name} is deleted.",
157
- deleteTitle: "Delete {name} for good?",
158
- deleteForGood: "Delete for good",
159
- cantUndo: "This can't be undone",
160
- deleteAbout: "Everything in it goes: its people's memberships, spaces, conversations, agents, files and usage. Its people are signed out of it at once. Export its rows first if you may need them.",
161
- exportFirst: "Export its rows (SQL) first",
162
- typeToConfirm: "Type {name} to confirm",
163
- // Gift codes (console-codes.tsx, codes.ts)
164
- codeWaiting: "Waiting",
165
- codeClaimed: "Claimed",
166
- codeRevoked: "Taken back",
167
- codeExpired: "Expired",
168
- sayDollars: "Say how many dollars of credits.",
169
- codesCount: { one: "{count} code, the newest first", other: "{count} codes, the newest first" },
170
- newGiftCode: "New gift code",
171
- tryAgain: "Try again",
172
- noCodes: "No gift codes yet",
173
- noCodesAbout: "A gift code gives whoever claims it credits for their org.",
174
- termsLapse: "Credits lapse {lapse}",
175
- termsNoLapse: "Credits don't lapse",
176
- termsLapseClaim: "Credits lapse {lapse} · claim by {until}",
177
- termsNoLapseClaim: "Credits don't lapse · claim by {until}",
178
- codeShortTitle: "Only the start of what's kept: it can't be claimed with this",
179
- codeMade: "· made {time}",
180
- claimedBy: "by {org}, {day}",
181
- takeBack: "Take back",
182
- makeCode: "Make a {amount} code",
183
- makeTheCode: "Make the code",
184
- credits: "Credits",
185
- lapseOn: "Credits lapse on",
186
- lapseHint: "Empty: they don't lapse.",
187
- claimBy: "Claim by",
188
- claimHint: "Empty: any time.",
189
- whatFor: "What it's for",
190
- whatForHint: "Whoever claims it sees this in their history.",
191
- notePlaceholder: "Conference, November",
192
- yourCode: "Your {amount} gift code",
193
- keptIt: "Done, I've kept it",
194
- copyCode: "Copy the code",
195
- notShownAgain: "This won't be shown again",
196
- notShownAgainAbout: "Only a fingerprint of it is kept, so nobody can look it up later. Copy it now. If it's lost, take this one back and make another.",
197
- takeBackTitle: "Take back this {amount} code?",
198
- takeItBack: "Take it back",
199
- takeBackAbout: "Nobody can claim it after this, and that can't be undone. If someone still needs it, make them a new one.",
200
- };
201
- /** What an org is called where it shows: everyone's own. */
202
- const directory = { personalOrg: "Personal" };
203
- export const say = defineWords("shell", shell);
204
- export const sayOrg = defineWords("directory", directory);
205
- /** Every word of the directory's front end, by area (WORDS.md lists them). */
206
- export const PHRASES = { shell, directory };