@hanzo/app 0.2.37 → 0.2.39
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/Accounts.d.ts +6 -0
- package/dist/Accounts.js +29 -0
- package/dist/App.js +10 -6
- package/dist/Betas.d.ts +6 -0
- package/dist/Betas.js +5 -3
- package/dist/Chrome.d.ts +7 -6
- package/dist/Chrome.js +12 -12
- package/dist/Column.js +1 -1
- package/dist/Hosted.d.ts +14 -0
- package/dist/Hosted.js +162 -0
- package/dist/Orgs.js +4 -3
- package/dist/Palette.js +3 -2
- package/dist/Rail.d.ts +3 -1
- package/dist/Rail.js +11 -7
- package/dist/lib/accounts.d.ts +35 -0
- package/dist/lib/accounts.js +103 -0
- package/dist/lib/betas.d.ts +11 -0
- package/dist/lib/betas.js +5 -5
- package/dist/lib/host.d.ts +10 -0
- package/dist/lib/host.js +16 -0
- package/dist/lib/hosted.d.ts +43 -0
- package/dist/lib/hosted.js +59 -0
- package/dist/lib/signout.js +9 -2
- package/dist/where.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Account } from './lib/accounts.js';
|
|
2
|
+
/** One account's face and words, the same wherever it is drawn. */
|
|
3
|
+
export declare function Face({ account }: {
|
|
4
|
+
account: Account;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
6
|
+
export declare function Accounts(): import("react").JSX.Element;
|
package/dist/Accounts.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* The accounts signed in on this browser, as a list: who they are, which one is
|
|
5
|
+
* this one, a tap to be another, and one to add. Log out is IAM's, and ends every
|
|
6
|
+
* one of them (lib/accounts), so it is said once, for all.
|
|
7
|
+
*/
|
|
8
|
+
import { Check, Plus } from 'lucide-react';
|
|
9
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
10
|
+
import { Text, View, XStack, YStack } from '@hanzo/gui';
|
|
11
|
+
import { Avatar, Button } from '@hanzo/ui';
|
|
12
|
+
import { label, useAccounts } from './lib/accounts.js';
|
|
13
|
+
import { useSignOut } from './lib/signout.js';
|
|
14
|
+
/** One account's face and words, the same wherever it is drawn. */
|
|
15
|
+
export function Face({ account }) {
|
|
16
|
+
const { title, line } = label(account);
|
|
17
|
+
return (_jsxs(_Fragment, { children: [_jsx(Avatar, { src: account.avatar || null, name: title, colorSeed: account.sub, alt: "" }), _jsxs(YStack, { flex: 1, minW: 0, gap: 2, children: [_jsx(Text, { fontSize: "$4", fontWeight: "500", color: "$ink", numberOfLines: 1, text: "start", children: title }), line ? (_jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, text: "start", children: line })) : null] })] }));
|
|
18
|
+
}
|
|
19
|
+
export function Accounts() {
|
|
20
|
+
const { t } = useI18n();
|
|
21
|
+
const out = useSignOut();
|
|
22
|
+
const { accounts, current, switchTo, add } = useAccounts();
|
|
23
|
+
if (accounts.length === 0)
|
|
24
|
+
return null;
|
|
25
|
+
return (_jsxs(YStack, { render: "section", "aria-label": t('Accounts'), mt: 36, children: [_jsx(Text, { render: "h2", fontSize: "$6", fontWeight: "500", color: "$ink", children: t('Accounts') }), _jsx(YStack, { render: "ul", "aria-label": t('Signed in on this browser'), m: 0, p: 0, mt: 14, gap: 8, children: accounts.map((a) => {
|
|
26
|
+
const here = a.sub === current?.sub;
|
|
27
|
+
return (_jsx(View, { render: "li", display: "block", children: _jsxs(XStack, { render: "button", onClick: here ? undefined : () => void switchTo(a), "aria-current": here || undefined, width: "100%", items: "center", gap: 12, px: 12, py: 10, rounded: 12, borderWidth: 1, borderColor: here ? '$ink' : '$edge', bg: "transparent", cursor: here ? 'default' : 'pointer', hoverStyle: here ? undefined : { bg: '$hover' }, children: [_jsx(Face, { account: a }), here ? _jsx(Check, { size: 16, "aria-label": t('Current') }) : null] }) }, a.sub));
|
|
28
|
+
}) }), _jsxs(XStack, { mt: 14, gap: 8, flexWrap: "wrap", children: [_jsxs(Button, { type: "button", variant: "outline", onClick: () => void add(), children: [_jsx(Plus, { size: 16, "aria-hidden": true }), t('Add account')] }), _jsx(Button, { type: "button", variant: "ghost", onClick: () => void out(), children: t('Log out') })] })] }));
|
|
29
|
+
}
|
package/dist/App.js
CHANGED
|
@@ -82,7 +82,7 @@ import { Palette } from './Palette.js';
|
|
|
82
82
|
import { summons } from './seek.js';
|
|
83
83
|
import { floor, pane } from './ground.js';
|
|
84
84
|
import { pick } from './lib/session.js';
|
|
85
|
-
import { app, go, place, settings, studio, talk, TERMINALS, visit } from './lib/host.js';
|
|
85
|
+
import { app, go, hosted, place, settings, studio, talk, TERMINALS, visit } from './lib/host.js';
|
|
86
86
|
import { Top } from './Top.js';
|
|
87
87
|
import { FOOT, HEIGHT, TOP, useView } from './view.js';
|
|
88
88
|
import { dragWindow, toggleWindowMaximize, WindowControls } from './WindowControls.js';
|
|
@@ -90,6 +90,8 @@ import { dragWindow, toggleWindowMaximize, WindowControls } from './WindowContro
|
|
|
90
90
|
const Studio = lazy(() => import('@hanzo/studio').then((m) => ({ default: m.Studio })));
|
|
91
91
|
/** Tabs, the same way: the terminals on the reader's machines (Terminals.tsx). */
|
|
92
92
|
const Terminals = lazy(() => import('./Terminals.js'));
|
|
93
|
+
/** The apps in beta that draw inside the app (lib/hosted), fetched when one is opened at /apps/<id>. */
|
|
94
|
+
const Hosted = lazy(() => import('./Hosted.js').then((m) => ({ default: m.HostedPane })));
|
|
93
95
|
/** Betas, fetched when opening /beta in the app. */
|
|
94
96
|
const Betas = lazy(() => import('./Betas.js').then((m) => ({ default: m.BetasPane })));
|
|
95
97
|
/** `/` is Chat on a new conversation. */
|
|
@@ -136,8 +138,10 @@ function Window({ bar, betas }) {
|
|
|
136
138
|
const here = path ?? '/';
|
|
137
139
|
const at = place(here) ?? HOME;
|
|
138
140
|
const mode = at.mode;
|
|
139
|
-
// Tabs and
|
|
140
|
-
const alone = mode === 'tabs' || mode === 'beta';
|
|
141
|
+
// Tabs, Betas and the hosted apps are their panes alone: no sidebar beside them, and no Dev places in a phone's menu.
|
|
142
|
+
const alone = mode === 'tabs' || mode === 'beta' || mode === 'hosted';
|
|
143
|
+
// The hosted app the address names (lib/hosted), for the rail to light.
|
|
144
|
+
const inside = at.mode === 'hosted' ? at.id : null;
|
|
141
145
|
const where = at.mode === 'dev' ? at.at : null;
|
|
142
146
|
// Studio's host: Dev's, at Studio's address, its moves under /studio, and
|
|
143
147
|
// another organization opening Studio's New in it.
|
|
@@ -259,9 +263,9 @@ function Window({ bar, betas }) {
|
|
|
259
263
|
// Another organization: picked, and the app opened in it at the mode's New.
|
|
260
264
|
const org = (o) => {
|
|
261
265
|
pick(o);
|
|
262
|
-
window.location.assign(mode === 'dev' ? app('') : mode === 'studio' ? studio('') : mode === 'tabs' ? TERMINALS : talk());
|
|
266
|
+
window.location.assign(mode === 'dev' ? app('') : mode === 'studio' ? studio('') : mode === 'tabs' ? TERMINALS : inside ? hosted(inside) : talk());
|
|
263
267
|
};
|
|
264
|
-
const sidebar = mode === 'beta' ? [] : mode === 'studio' ? places(maker, (p) => maker.go(p)) : mode === 'dev' && raised(where) === 'customize'
|
|
268
|
+
const sidebar = mode === 'beta' || mode === 'hosted' ? [] : mode === 'studio' ? places(maker, (p) => maker.go(p)) : mode === 'dev' && raised(where) === 'customize'
|
|
265
269
|
? tabs(host, (p) => host.go(p), t).map((group) => ({ ...group, links: [...group.links, {
|
|
266
270
|
id: 'learning', label: t('Learning'), active: learning, icon: _jsx(RefreshCw, { size: 16, "aria-hidden": true }),
|
|
267
271
|
onPress: () => { shut(); setLearning(true); },
|
|
@@ -275,5 +279,5 @@ function Window({ bar, betas }) {
|
|
|
275
279
|
// inline-style: the slide, a transform with no logical form whose sign and distance the drawer writes on the element itself, a drag every frame (Drawer.tsx).
|
|
276
280
|
style: drawer.slide ?? undefined, flex: 1, minW: 0, minH: 0, paddingInlineEnd: "var(--pane-gap)", pb: "var(--pane-gap)",
|
|
277
281
|
// The gap above the pane is the gap at its end and foot; a window's own bar above it is that gap.
|
|
278
|
-
pt: bar ? 0 : 'var(--pane-gap)', "$max-md": { p: 0 }, children: [drawer.slide ? _jsx(Lift, {}) : null, _jsx(YStack, { height: "100%", "$max-md": { display: 'none' }, children: _jsx(Rail, { host: host, mode: mode, at: where, open: !closed, toggle: bar ? undefined : flip, onChat: toChat, onDev: toDev, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }) }), closed || alone ? null : (_jsx(YStack, { "$max-md": { display: 'none' }, children: _jsx(Column, { host: host, mode: mode, thread: thread, go: move, onShut: () => setClosed(true), onSeek: seek, onBack: back, places: sidebar }) })), _jsxs(YStack, { "data-slot": "stage", flex: 1, minW: 0, minH: 0, marginInlineStart: closed || alone ? 0 : 'var(--pane-gap)', "$max-md": { marginInlineStart: 0, pb: `max(var(--pane-gap), ${FOOT})` }, children: [bar ? null : _jsx(Top, { host: host, mode: mode, places: sidebar, open: drawer.state !== 'shut', go: move, onMenu: drawer.open, onChat: toChat, onDev: toDev }), _jsx(XStack, { "data-slot": "panes", flex: 1, minW: 0, minH: 0, children: mode === 'chat' ? (_jsx(Paned, { framed: true, children: _jsx(Chat, {}) })) : mode === 'tabs' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(Suspense, { fallback: null, children: _jsx(Terminals, {}) }) })) : mode === 'studio' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(YStack, { flex: 1, minH: 0, height: "100%", children: _jsx(Suspense, { fallback: null, children: _jsx(Studio, { host: maker, rail: false }) }) }) })) : mode === 'beta' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflowY: "auto", overflowX: "hidden", flex: 1, minW: 0, minH: 0, p: "$4", $md: { p: '$6' }, children: betas ?? (_jsx(Suspense, { fallback: null, children: _jsx(Betas, { go: move }) })) })) : (_jsx(YStack, { render: "main", "data-slot": "pane", ...(run ? null : { ...pane(), overflow: 'hidden' }), flex: 1, minW: 0, minH: 0, children: plans ? null : _jsx(Builder, { host: host, rail: false }) })) })] })] }), drawer.state === 'shut' ? null : (_jsx(Layer, { drawer: drawer, top: bar ? BAR : 0, children: _jsx(Column, { host: host, mode: mode, thread: thread, go: move, onShut: shut, onSeek: seek, onBack: back, drawer: true, places: sidebar, rail: _jsx(Rail, { host: host, mode: mode, at: where, open: true, rows: true, onChat: toChat, onDev: toDev, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }), foot: _jsx(Foot, { host: host, onChat: fresh, onOrg: org }) }) })), finding ? _jsx(Palette, { go: move, onClose: found, mode: mode, host: host }) : null, learning ? _jsx(Learning, { open: true, onClose: () => setLearning(false) }) : null] }) }) }) }));
|
|
282
|
+
pt: bar ? 0 : 'var(--pane-gap)', "$max-md": { p: 0 }, children: [drawer.slide ? _jsx(Lift, {}) : null, _jsx(YStack, { height: "100%", "$max-md": { display: 'none' }, children: _jsx(Rail, { host: host, mode: mode, at: where, inside: inside, open: !closed, toggle: bar ? undefined : flip, onChat: toChat, onDev: toDev, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }) }), closed || alone ? null : (_jsx(YStack, { "$max-md": { display: 'none' }, children: _jsx(Column, { host: host, mode: mode, thread: thread, go: move, onShut: () => setClosed(true), onSeek: seek, onBack: back, places: sidebar }) })), _jsxs(YStack, { "data-slot": "stage", flex: 1, minW: 0, minH: 0, marginInlineStart: closed || alone ? 0 : 'var(--pane-gap)', "$max-md": { marginInlineStart: 0, pb: `max(var(--pane-gap), ${FOOT})` }, children: [bar ? null : _jsx(Top, { host: host, mode: mode, places: sidebar, open: drawer.state !== 'shut', go: move, onMenu: drawer.open, onChat: toChat, onDev: toDev }), _jsx(XStack, { "data-slot": "panes", flex: 1, minW: 0, minH: 0, children: mode === 'chat' ? (_jsx(Paned, { framed: true, children: _jsx(Chat, {}) })) : mode === 'tabs' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(Suspense, { fallback: null, children: _jsx(Terminals, {}) }) })) : mode === 'studio' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(YStack, { flex: 1, minH: 0, height: "100%", children: _jsx(Suspense, { fallback: null, children: _jsx(Studio, { host: maker, rail: false }) }) }) })) : at.mode === 'hosted' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(Suspense, { fallback: null, children: _jsx(Hosted, { id: at.id, go: move }) }) })) : mode === 'beta' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflowY: "auto", overflowX: "hidden", flex: 1, minW: 0, minH: 0, p: "$4", $md: { p: '$6' }, children: betas ?? (_jsx(Suspense, { fallback: null, children: _jsx(Betas, { go: move }) })) })) : (_jsx(YStack, { render: "main", "data-slot": "pane", ...(run ? null : { ...pane(), overflow: 'hidden' }), flex: 1, minW: 0, minH: 0, children: plans ? null : _jsx(Builder, { host: host, rail: false }) })) })] })] }), drawer.state === 'shut' ? null : (_jsx(Layer, { drawer: drawer, top: bar ? BAR : 0, children: _jsx(Column, { host: host, mode: mode, thread: thread, go: move, onShut: shut, onSeek: seek, onBack: back, drawer: true, places: sidebar, rail: _jsx(Rail, { host: host, mode: mode, at: where, inside: inside, open: true, rows: true, onChat: toChat, onDev: toDev, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }), foot: _jsx(Foot, { host: host, onChat: fresh, onOrg: org }) }) })), finding ? _jsx(Palette, { go: move, onClose: found, mode: mode, host: host }) : null, learning ? _jsx(Learning, { open: true, onClose: () => setLearning(false) }) : null] }) }) }) }));
|
|
279
283
|
}
|
package/dist/Betas.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Beta } from './lib/betas.js';
|
|
1
2
|
/** The apps in beta as this reader stands: which open, which they asked for, and the ask. */
|
|
2
3
|
export declare function useBetas(): {
|
|
3
4
|
/** The one predicate: whether this reader may open the app `id`. */
|
|
@@ -13,6 +14,11 @@ export declare function useBetas(): {
|
|
|
13
14
|
/** The cloud has answered for this reader. */
|
|
14
15
|
ready: boolean;
|
|
15
16
|
};
|
|
17
|
+
/** One app's action: Open where it may (in the app, for one that draws inside it), Requested once asked, else Request access. */
|
|
18
|
+
export declare function Ask({ beta, go }: {
|
|
19
|
+
beta: Beta;
|
|
20
|
+
go?: (href: string) => void;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
16
22
|
/** Every app in beta, by group, each with its action. */
|
|
17
23
|
export declare function BetasList({ go }: {
|
|
18
24
|
go?: (href: string) => void;
|
package/dist/Betas.js
CHANGED
|
@@ -30,6 +30,7 @@ import { Button, Dialog, DialogContent, DialogTitle, Text, XStack, YStack } from
|
|
|
30
30
|
import { api } from './lib/api.js';
|
|
31
31
|
import { BETAS, GROUPS, opens } from './lib/betas.js';
|
|
32
32
|
import { bearer, scope, superAdmin } from './lib/session.js';
|
|
33
|
+
import { hosted } from './lib/host.js';
|
|
33
34
|
import { CHANGED, optin } from './lib/optin.js';
|
|
34
35
|
const NONE = { flags: {}, asked: [], public: [], blocked: false };
|
|
35
36
|
/** A group's heading as the list draws it: authored English, drawn through `t`. */
|
|
@@ -129,14 +130,15 @@ function here() {
|
|
|
129
130
|
const host = window.location.hostname;
|
|
130
131
|
return host === 'localhost' || host === '127.0.0.1' || host === '[::1]' || host.endsWith('.local') || /^10\./.test(host) || /^192\.168\./.test(host);
|
|
131
132
|
}
|
|
132
|
-
/** One app's action: Open where it may, Requested once asked, else Request access. */
|
|
133
|
-
function Ask({ beta, go }) {
|
|
133
|
+
/** One app's action: Open where it may (in the app, for one that draws inside it), Requested once asked, else Request access. */
|
|
134
|
+
export function Ask({ beta, go }) {
|
|
134
135
|
const { t } = useI18n();
|
|
135
136
|
const { open, asked, promoted, blocked, request } = useBetas();
|
|
136
137
|
const [busy, setBusy] = useState(false);
|
|
137
138
|
const [wrong, setWrong] = useState(null);
|
|
138
139
|
if (open(beta.id)) {
|
|
139
|
-
|
|
140
|
+
const to = beta.embed !== undefined ? hosted(beta.id) : beta.href;
|
|
141
|
+
return to && go ? (_jsx(Button, { size: "sm", rounded: 999, onPress: () => go(to), "data-slot": "beta-open", children: t('Open') })) : (_jsx(Text, { fontSize: "$2", color: "$color11", "data-slot": "beta-on", children: t('You’re in') }));
|
|
140
142
|
}
|
|
141
143
|
if (promoted(beta.id)) {
|
|
142
144
|
return (_jsx(Text, { fontSize: "$2", color: "$color11", text: "right", maxW: 200, "data-slot": "beta-optin", children: t(blocked ? 'Turned off by your organization' : 'Turn on experimental features in Settings') }));
|
package/dist/Chrome.d.ts
CHANGED
|
@@ -5,14 +5,15 @@
|
|
|
5
5
|
* The brand at the start (`HanzoWordmark`: `brand()` in words, as the site's own bar sets it), going to this
|
|
6
6
|
* host's root; then the host's `back`, where the page has a step to go back to.
|
|
7
7
|
* At the end, once someone is signed in, who it is: the face, the name and the
|
|
8
|
-
* address,
|
|
9
|
-
* brand. Under gui's `md` the account folds into its face, a menu of the address
|
|
8
|
+
* address, the other accounts signed in on this browser to be one tap away
|
|
9
|
+
* (lib/accounts), Add account and Log out. Signed out, nothing but the brand. Under gui's `md` the account folds into its face, a menu of the address
|
|
10
10
|
* and the same two ways out.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
* `rememberDestination`), so the sign-in that follows comes back
|
|
14
|
-
* hanzo.ai's /join does. Log out is the
|
|
15
|
-
* session is IAM's: the
|
|
12
|
+
* Being another account, and adding one, write this page down first
|
|
13
|
+
* (destination.ts `rememberDestination`), so the sign-in that follows comes back
|
|
14
|
+
* to it, as hanzo.ai's /join does, and neither ends a session. Log out is the
|
|
15
|
+
* account menu's own (lib/signout) and ends every one. The session is IAM's: the
|
|
16
|
+
* host mounts `IamProvider`.
|
|
16
17
|
*/
|
|
17
18
|
import { type ReactNode } from 'react';
|
|
18
19
|
export declare function Chrome({ back }: {
|
package/dist/Chrome.js
CHANGED
|
@@ -7,14 +7,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
7
7
|
* The brand at the start (`HanzoWordmark`: `brand()` in words, as the site's own bar sets it), going to this
|
|
8
8
|
* host's root; then the host's `back`, where the page has a step to go back to.
|
|
9
9
|
* At the end, once someone is signed in, who it is: the face, the name and the
|
|
10
|
-
* address,
|
|
11
|
-
* brand. Under gui's `md` the account folds into its face, a menu of the address
|
|
10
|
+
* address, the other accounts signed in on this browser to be one tap away
|
|
11
|
+
* (lib/accounts), Add account and Log out. Signed out, nothing but the brand. Under gui's `md` the account folds into its face, a menu of the address
|
|
12
12
|
* and the same two ways out.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
* `rememberDestination`), so the sign-in that follows comes back
|
|
16
|
-
* hanzo.ai's /join does. Log out is the
|
|
17
|
-
* session is IAM's: the
|
|
14
|
+
* Being another account, and adding one, write this page down first
|
|
15
|
+
* (destination.ts `rememberDestination`), so the sign-in that follows comes back
|
|
16
|
+
* to it, as hanzo.ai's /join does, and neither ends a session. Log out is the
|
|
17
|
+
* account menu's own (lib/signout) and ends every one. The session is IAM's: the
|
|
18
|
+
* host mounts `IamProvider`.
|
|
18
19
|
*/
|
|
19
20
|
import { useEffect, useState } from 'react';
|
|
20
21
|
import { useI18n } from '@hanzo/i18n/react';
|
|
@@ -22,7 +23,8 @@ import { useIam } from '@hanzo/iam/react';
|
|
|
22
23
|
import { Text, View, XStack, YStack } from '@hanzo/gui';
|
|
23
24
|
import { Avatar, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from '@hanzo/ui';
|
|
24
25
|
import { HanzoWordmark } from '@hanzogui/shell';
|
|
25
|
-
import {
|
|
26
|
+
import { Face } from './Accounts.js';
|
|
27
|
+
import { useAccounts } from './lib/accounts.js';
|
|
26
28
|
import { named } from './lib/session.js';
|
|
27
29
|
import { useSignOut } from './lib/signout.js';
|
|
28
30
|
import { brand, site } from './where.js';
|
|
@@ -57,16 +59,14 @@ export function Chrome({ back }) {
|
|
|
57
59
|
const email = u?.email || claimed?.email || '';
|
|
58
60
|
const avatar = typeof u?.avatar === 'string' && u.avatar.startsWith('https://') ? u.avatar : '';
|
|
59
61
|
const who = name || email;
|
|
60
|
-
const other = () => {
|
|
61
|
-
rememberDestination();
|
|
62
|
-
void signOut();
|
|
63
|
-
};
|
|
64
62
|
const out = () => void signOut();
|
|
63
|
+
const { accounts, current, switchTo, add } = useAccounts();
|
|
64
|
+
const others = accounts.filter((a) => a.sub !== current?.sub);
|
|
65
65
|
const signed = isAuthenticated && Boolean(who);
|
|
66
66
|
const moved = useMoved();
|
|
67
67
|
return (_jsxs(XStack, { render: "header", "data-slot": "masthead", "data-scrolled": moved ? 'true' : 'false', "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, position: "sticky", t: 0, z: "var(--z-header)", shrink: 0, boxSizing: "content-box", height: HEIGHT, pt: NOTCH, px: 20, gap: 12, items: "center", bg: moved ? GLASS : 'transparent', backdropFilter: moved ? BLUR : 'none', transition: "quickest", borderBottomWidth: 0, children: [_jsx(Text, { render: _jsx("a", { href: "/", "aria-label": t('{brand} home', { brand: brand() }), "data-tauri-drag-region": "deep", onClick: (e) => {
|
|
68
68
|
if (typeof document !== 'undefined' && document.documentElement.getAttribute('data-desktop') === 'true') {
|
|
69
69
|
e.preventDefault();
|
|
70
70
|
}
|
|
71
|
-
} }), display: "flex", items: "center", shrink: 0, color: "var(--foreground)", textDecorationLine: "none", "data-tauri-drag-region": "deep", children: _jsx(HanzoWordmark, { label: brand(), size: 22, "data-tauri-drag-region": "deep" }) }), back, _jsx(View, { flex: 1, "data-tauri-drag-region": "deep" }), signed ? (_jsx(View, { render: "section", "aria-label": t('Account'), display: "flex", children: _jsxs(DropdownMenu, { placement: dir === 'rtl' ? 'bottom-start' : 'bottom-end', offset: 8, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "aria-label": t('Account: {name}', { name: who }), width: 40, height: 40, rounded: 999, items: "center", justify: "center", borderWidth: 0, bg: "transparent", hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, cursor: "pointer", children: _jsx(Avatar, { src: avatar || null, name: who, alt: "" }) }) }), _jsxs(DropdownMenuContent, { minW: 240, maxW: "calc(100vw - 16px)", "aria-labelledby": undefined, "aria-label": t('Account'), children: [_jsx(DropdownMenuLabel, { children: _jsxs(YStack, { minW: 0, gap: 2, children: [_jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$ink", numberOfLines: 1, children: who }), name && email ? (_jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, children: email })) : null] }) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onSelect: () => window.location.assign(site('/support')), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Help') }) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onSelect:
|
|
71
|
+
} }), display: "flex", items: "center", shrink: 0, color: "var(--foreground)", textDecorationLine: "none", "data-tauri-drag-region": "deep", children: _jsx(HanzoWordmark, { label: brand(), size: 22, "data-tauri-drag-region": "deep" }) }), back, _jsx(View, { flex: 1, "data-tauri-drag-region": "deep" }), signed ? (_jsx(View, { render: "section", "aria-label": t('Account'), display: "flex", children: _jsxs(DropdownMenu, { placement: dir === 'rtl' ? 'bottom-start' : 'bottom-end', offset: 8, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "aria-label": t('Account: {name}', { name: who }), width: 40, height: 40, rounded: 999, items: "center", justify: "center", borderWidth: 0, bg: "transparent", hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, cursor: "pointer", children: _jsx(Avatar, { src: avatar || null, name: who, alt: "" }) }) }), _jsxs(DropdownMenuContent, { minW: 240, maxW: "calc(100vw - 16px)", "aria-labelledby": undefined, "aria-label": t('Account'), children: [_jsx(DropdownMenuLabel, { children: _jsxs(YStack, { minW: 0, gap: 2, children: [_jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$ink", numberOfLines: 1, children: who }), name && email ? (_jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, children: email })) : null] }) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onSelect: () => window.location.assign(site('/support')), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Help') }) }), _jsx(DropdownMenuSeparator, {}), others.map((a) => (_jsx(DropdownMenuItem, { onSelect: () => void switchTo(a), children: _jsx(XStack, { items: "center", gap: 10, minW: 0, children: _jsx(Face, { account: a }) }) }, a.sub))), _jsx(DropdownMenuItem, { onSelect: () => void add(), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Add account') }) }), _jsx(DropdownMenuItem, { onSelect: out, children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Log out') }) })] })] }) })) : null, _jsx(WindowControls, {})] }));
|
|
72
72
|
}
|
package/dist/Column.js
CHANGED
|
@@ -130,5 +130,5 @@ export function Column({ host, mode, thread, go, onShut, onSeek, onBack, drawer
|
|
|
130
130
|
borderColor: 'var(--border-strong)',
|
|
131
131
|
bg: 'var(--pane-fill)',
|
|
132
132
|
}
|
|
133
|
-
: HEAD), children: _jsx(Search, { size: drawer ? 18 : 16, "aria-hidden": true }) })] })), mode === 'chat' ? (_jsx(YStack, { role: "list", gap: 2, shrink: 0, children: _jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { "data-slot": "app-new", ...ROW, active: !thread, bg: "transparent", hoverStyle: { bg: '$hover' }, icon: _jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(SquarePen, { size: 16, "aria-hidden": true }) }), onPress: create, ...keys(create), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('New chat') }) }) }) })) : (_jsx(YStack, { "data-slot": "app-places", shrink: 0, children: groups.map((g, i) => (_jsxs(YStack, { pt: i ? '$2' : 0, children: [i && g.label ? (_jsx(Text, { id: `${uid}-${g.id}`, paddingInlineStart: "$2", pb: 2, fontSize: "$3", color: "$soft", children: g.label })) : null, _jsx(YStack, { role: "list", "aria-labelledby": i && g.label ? `${uid}-${g.id}` : undefined, "aria-label": i && g.label ? undefined : g.label || (at ? t(TITLE[at]) : g.id), gap: 1, children: g.links.map((link) => (_jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { ...ROW, ...(link.id === NEW ? { 'data-slot': 'app-new' } : {}), active: link.active, icon: link.id === NEW ? (_jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(SquarePen, { size: 16, "aria-hidden": true }) })) : link.icon ? (_jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: link.icon })) : null, onPress: link.onPress, ...keys(() => link.onPress?.()), children: _jsx(Text, { fontSize: "$3", color: link.active ? '$ink' : '$quiet', children: link.label }) }) }, link.id))) })] }, g.id))) })), rail, mode === 'studio' || mode === 'tabs' || mode === 'beta' || at ? _jsx(YStack, { flex: 1, minH: 0 }) : _jsx(Recents, { host: host, mode: mode, thread: thread, onOpen: open, onNew: create }), at ? null : (_jsxs(YStack, { gap: "$2", pt: "$2", shrink: 0, children: [_jsx(Made, {}), _jsx(Setup, { go: go })] })), free ? (_jsx(YStack, { role: "list", gap: 2, shrink: 0, pt: "$2", children: _jsx(YStack, { role: "listitem", minH: MARK, justify: "center", children: _jsx(SidebarItem, { ...ROW, "data-slot": "column-upgrade", icon: _jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(Sparkles, { size: 16, "aria-hidden": true, color: "var(--primary)" }) }), onPress: () => window.location.assign(payUrl('/cart', { returnUrl: window.location.href })), ...keys(() => window.location.assign(payUrl('/cart', { returnUrl: window.location.href }))), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Upgrade plan') }) }) }) })) : null, foot] }), drawer ? null : (_jsx(Gutter, { side: dir === 'rtl' ? 'right' : 'left', span: span.span, floor: FLOOR, ceil: CEIL, reset: WIDTH, onSpan: span.move, onKeep: span.keep, onShut: onShut, label: t('Resize sidebar') }))] }));
|
|
133
|
+
: HEAD), children: _jsx(Search, { size: drawer ? 18 : 16, "aria-hidden": true }) })] })), mode === 'chat' ? (_jsx(YStack, { role: "list", gap: 2, shrink: 0, children: _jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { "data-slot": "app-new", ...ROW, active: !thread, bg: "transparent", hoverStyle: { bg: '$hover' }, icon: _jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(SquarePen, { size: 16, "aria-hidden": true }) }), onPress: create, ...keys(create), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('New chat') }) }) }) })) : (_jsx(YStack, { "data-slot": "app-places", shrink: 0, children: groups.map((g, i) => (_jsxs(YStack, { pt: i ? '$2' : 0, children: [i && g.label ? (_jsx(Text, { id: `${uid}-${g.id}`, paddingInlineStart: "$2", pb: 2, fontSize: "$3", color: "$soft", children: g.label })) : null, _jsx(YStack, { role: "list", "aria-labelledby": i && g.label ? `${uid}-${g.id}` : undefined, "aria-label": i && g.label ? undefined : g.label || (at ? t(TITLE[at]) : g.id), gap: 1, children: g.links.map((link) => (_jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { ...ROW, ...(link.id === NEW ? { 'data-slot': 'app-new' } : {}), active: link.active, icon: link.id === NEW ? (_jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(SquarePen, { size: 16, "aria-hidden": true }) })) : link.icon ? (_jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: link.icon })) : null, onPress: link.onPress, ...keys(() => link.onPress?.()), children: _jsx(Text, { fontSize: "$3", color: link.active ? '$ink' : '$quiet', children: link.label }) }) }, link.id))) })] }, g.id))) })), rail, mode === 'studio' || mode === 'tabs' || mode === 'beta' || mode === 'hosted' || at ? _jsx(YStack, { flex: 1, minH: 0 }) : _jsx(Recents, { host: host, mode: mode, thread: thread, onOpen: open, onNew: create }), at ? null : (_jsxs(YStack, { gap: "$2", pt: "$2", shrink: 0, children: [_jsx(Made, {}), _jsx(Setup, { go: go })] })), free ? (_jsx(YStack, { role: "list", gap: 2, shrink: 0, pt: "$2", children: _jsx(YStack, { role: "listitem", minH: MARK, justify: "center", children: _jsx(SidebarItem, { ...ROW, "data-slot": "column-upgrade", icon: _jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(Sparkles, { size: 16, "aria-hidden": true, color: "var(--primary)" }) }), onPress: () => window.location.assign(payUrl('/cart', { returnUrl: window.location.href })), ...keys(() => window.location.assign(payUrl('/cart', { returnUrl: window.location.href }))), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Upgrade plan') }) }) }) })) : null, foot] }), drawer ? null : (_jsx(Gutter, { side: dir === 'rtl' ? 'right' : 'left', span: span.span, floor: FLOOR, ceil: CEIL, reset: WIDTH, onSpan: span.move, onKeep: span.keep, onShut: onShut, label: t('Resize sidebar') }))] }));
|
|
134
134
|
}
|
package/dist/Hosted.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** How long a frame may take to load before the pane says it did not. */
|
|
2
|
+
export declare const PATIENCE = 20000;
|
|
3
|
+
/** What the host tells a frame about how it looks. */
|
|
4
|
+
export interface Hostly {
|
|
5
|
+
type: 'hanzo:host';
|
|
6
|
+
theme: 'light' | 'dark';
|
|
7
|
+
accent?: string;
|
|
8
|
+
density?: string;
|
|
9
|
+
org?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function HostedPane({ id, go }: {
|
|
12
|
+
id: string;
|
|
13
|
+
go: (address: string) => void;
|
|
14
|
+
}): import("react").JSX.Element;
|
package/dist/Hosted.js
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
// The apps in beta that stand inside the app, at /apps/<id> (lib/hosted): one
|
|
4
|
+
// pane for CRM, Commerce, CMS, Analytics and Insights. Each is a standalone app
|
|
5
|
+
// on a host of its own, and the pane frames that live host, so the app deploys
|
|
6
|
+
// on its own and hanzo.ai shows the deploy at once.
|
|
7
|
+
//
|
|
8
|
+
// WHO MAY OPEN ONE is `useBetas().open`, the one predicate (lib/betas): a reader
|
|
9
|
+
// the switch is off for is shown the app's request path, the Betas list's own
|
|
10
|
+
// action, never a frame. Still reading the switches, or the cloud not
|
|
11
|
+
// answering, shows the loader and then the request path, never the app.
|
|
12
|
+
//
|
|
13
|
+
// THE FRAME is `?embed=1` on the app's own address, same registrable domain, so
|
|
14
|
+
// IAM's session cookie is first-party in it. The host tells the frame how it
|
|
15
|
+
// looks (`hanzo:host`: theme, accent, density, organization) when it has loaded
|
|
16
|
+
// and whenever the look or the organization changes; the frame may say where it
|
|
17
|
+
// is (`hanzo:navigate`, kept in this address as `?at=`) and that it is up
|
|
18
|
+
// (`hanzo:ready`). A message is heard only from that host's origin and that one
|
|
19
|
+
// frame, and an app that never speaks still works.
|
|
20
|
+
//
|
|
21
|
+
// A frame the host refuses to draw fires no error a page can read, so a frame
|
|
22
|
+
// that has not loaded after `PATIENCE` is said to have failed, with the way out:
|
|
23
|
+
// the app in a tab.
|
|
24
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
25
|
+
import { ExternalLink, RotateCw } from 'lucide-react';
|
|
26
|
+
import { current, dark } from '@hanzo/appearance';
|
|
27
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
28
|
+
import { Button, Spinner, Text, XStack, YStack } from '@hanzo/ui';
|
|
29
|
+
import { View } from '@hanzo/gui';
|
|
30
|
+
import { Ask, useBetas } from './Betas.js';
|
|
31
|
+
import { out } from './help.js';
|
|
32
|
+
import { useOrg } from './host.js';
|
|
33
|
+
import { BETAS } from './lib/betas.js';
|
|
34
|
+
import { go as replace, hosted } from './lib/host.js';
|
|
35
|
+
import { frameUrl, hostedApp, origin, pathOn } from './lib/hosted.js';
|
|
36
|
+
/** How long a frame may take to load before the pane says it did not. */
|
|
37
|
+
export const PATIENCE = 20_000;
|
|
38
|
+
/** What the frame may use of the browser: the clipboard and full screen, which the apps' own pages ask for. */
|
|
39
|
+
const ALLOW = 'clipboard-read; clipboard-write; fullscreen';
|
|
40
|
+
/**
|
|
41
|
+
* How the page looks as the reader has it, read off their stored choice for the
|
|
42
|
+
* organization and read again whenever the document's own look is repainted
|
|
43
|
+
* (a class or a variable on <html>), so a change in Settings reaches the frame
|
|
44
|
+
* without a second reading of the account.
|
|
45
|
+
*/
|
|
46
|
+
function useLooks(orgId) {
|
|
47
|
+
const read = useCallback(() => {
|
|
48
|
+
const { pref } = current({ orgId });
|
|
49
|
+
return { theme: dark(pref.theme ?? 'system') ? 'dark' : 'light', accent: pref.accent, density: pref.density };
|
|
50
|
+
}, [orgId]);
|
|
51
|
+
const [looks, setLooks] = useState(read);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
const again = () => setLooks((was) => {
|
|
54
|
+
const now = read();
|
|
55
|
+
return was.theme === now.theme && was.accent === now.accent && was.density === now.density ? was : now;
|
|
56
|
+
});
|
|
57
|
+
again();
|
|
58
|
+
const watch = new MutationObserver(again);
|
|
59
|
+
watch.observe(document.documentElement, { attributes: true, attributeFilter: ['class', 'style', 'data-scheme', 'data-theme'] });
|
|
60
|
+
return () => watch.disconnect();
|
|
61
|
+
}, [read]);
|
|
62
|
+
return looks;
|
|
63
|
+
}
|
|
64
|
+
/** The page the address names inside the app, when it names one: `?at=/path` on the app's own host. */
|
|
65
|
+
const started = () => {
|
|
66
|
+
const at = new URLSearchParams(window.location.search).get('at');
|
|
67
|
+
return at && at.startsWith('/') && !at.startsWith('//') ? at : null;
|
|
68
|
+
};
|
|
69
|
+
export function HostedPane({ id, go }) {
|
|
70
|
+
const { open, ready } = useBetas();
|
|
71
|
+
const app = hostedApp(id);
|
|
72
|
+
if (!app)
|
|
73
|
+
return null;
|
|
74
|
+
if (!ready)
|
|
75
|
+
return _jsx(Waiting, {});
|
|
76
|
+
if (!open(app.id))
|
|
77
|
+
return _jsx(Request, { app: app, go: go });
|
|
78
|
+
return _jsx(Frame, { app: app }, app.id);
|
|
79
|
+
}
|
|
80
|
+
/** The loader: the shell's spinner, centred in the pane. */
|
|
81
|
+
function Waiting() {
|
|
82
|
+
return (_jsx(YStack, { flex: 1, items: "center", justify: "center", "data-slot": "hosted-loading", children: _jsx(Spinner, { size: 28, color: "$color10" }) }));
|
|
83
|
+
}
|
|
84
|
+
/** The request path: the app, what it is, and the Betas list's own action for it. */
|
|
85
|
+
function Request({ app, go }) {
|
|
86
|
+
const { t } = useI18n();
|
|
87
|
+
const beta = BETAS.find((b) => b.id === app.id);
|
|
88
|
+
const Icon = app.icon;
|
|
89
|
+
return (_jsxs(YStack, { flex: 1, items: "center", justify: "center", gap: "$3", p: "$6", "data-slot": "hosted-request", "data-app": app.id, children: [_jsx(Icon, { size: 28, "aria-hidden": true }), _jsx(Text, { fontSize: "$6", fontWeight: "600", color: "$color12", children: app.name }), beta ? (_jsx(Text, { fontSize: "$3", color: "$color11", text: "center", maxW: 420, children: t(beta.line) })) : null, beta ? _jsx(Ask, { beta: beta, go: go }) : null, _jsx(Button, { size: "sm", variant: "ghost", rounded: 999, onPress: () => go('/beta'), children: t('All betas') })] }));
|
|
90
|
+
}
|
|
91
|
+
/** The frame, with its quiet toolbar, its loader and its failure. */
|
|
92
|
+
function Frame({ app }) {
|
|
93
|
+
const { t } = useI18n();
|
|
94
|
+
const org = useOrg();
|
|
95
|
+
const looks = useLooks(org.id);
|
|
96
|
+
const frame = useRef(null);
|
|
97
|
+
// The page the frame is on, as the app last said (or the address asked for): reload and the tab keep it.
|
|
98
|
+
const at = useRef(started());
|
|
99
|
+
const [src, setSrc] = useState(() => frameUrl(app, at.current));
|
|
100
|
+
const [turn, setTurn] = useState(0);
|
|
101
|
+
const [state, setState] = useState('loading');
|
|
102
|
+
const host = origin(app);
|
|
103
|
+
// What the frame is told: each time it loads, and whenever the look or the organization changes after.
|
|
104
|
+
const tell = useCallback(() => {
|
|
105
|
+
const to = frame.current?.contentWindow;
|
|
106
|
+
if (!to)
|
|
107
|
+
return;
|
|
108
|
+
const said = { type: 'hanzo:host', ...looks, org: org.id };
|
|
109
|
+
try {
|
|
110
|
+
to.postMessage(said, host);
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
/* a window that is no longer the app's: nothing to tell */
|
|
114
|
+
}
|
|
115
|
+
}, [looks, org.id, host]);
|
|
116
|
+
const up = useRef(false);
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
up.current = state === 'ready';
|
|
119
|
+
}, [state]);
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (up.current)
|
|
122
|
+
tell();
|
|
123
|
+
}, [tell]);
|
|
124
|
+
const loaded = () => {
|
|
125
|
+
setState((was) => (was === 'failed' ? was : 'ready'));
|
|
126
|
+
tell();
|
|
127
|
+
};
|
|
128
|
+
// What the frame says: heard from its host and from it alone.
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
const hear = (e) => {
|
|
131
|
+
if (e.origin !== host || e.source !== frame.current?.contentWindow)
|
|
132
|
+
return;
|
|
133
|
+
const said = e.data;
|
|
134
|
+
if (said?.type === 'hanzo:ready')
|
|
135
|
+
setState('ready');
|
|
136
|
+
else if (said?.type === 'hanzo:navigate' && typeof said.href === 'string') {
|
|
137
|
+
const to = pathOn(app, said.href);
|
|
138
|
+
if (!to)
|
|
139
|
+
return;
|
|
140
|
+
at.current = to;
|
|
141
|
+
replace(hosted(app.id, to === '/' ? undefined : to), true);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
window.addEventListener('message', hear);
|
|
145
|
+
return () => window.removeEventListener('message', hear);
|
|
146
|
+
}, [app, host]);
|
|
147
|
+
// A frame that never loads is said not to have.
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
if (state !== 'loading')
|
|
150
|
+
return;
|
|
151
|
+
const late = window.setTimeout(() => setState('failed'), PATIENCE);
|
|
152
|
+
return () => window.clearTimeout(late);
|
|
153
|
+
}, [state, turn]);
|
|
154
|
+
const reload = () => {
|
|
155
|
+
setSrc(frameUrl(app, at.current));
|
|
156
|
+
setState('loading');
|
|
157
|
+
setTurn((n) => n + 1);
|
|
158
|
+
};
|
|
159
|
+
const tab = () => out(at.current ? `${host}${at.current}` : app.href);
|
|
160
|
+
const Icon = app.icon;
|
|
161
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, "data-slot": "hosted", "data-app": app.id, children: [_jsxs(XStack, { items: "center", gap: "$2", px: "$3", height: 36, shrink: 0, borderBottomWidth: 1, borderColor: "$borderColor", "data-slot": "hosted-bar", children: [_jsx(Icon, { size: 14, "aria-hidden": true }), _jsx(Text, { fontSize: "$2", fontWeight: "500", color: "$color12", children: app.name }), _jsx(Text, { fontSize: "$2", color: "$color10", numberOfLines: 1, flex: 1, minW: 0, children: app.host }), _jsx(Button, { size: "sm", variant: "ghost", rounded: 999, "aria-label": t('Reload'), onPress: reload, "data-slot": "hosted-reload", children: _jsx(RotateCw, { size: 14, "aria-hidden": true }) }), _jsx(Button, { size: "sm", variant: "ghost", rounded: 999, "aria-label": t('Open in a tab'), onPress: tab, "data-slot": "hosted-tab", children: _jsx(ExternalLink, { size: 14, "aria-hidden": true }) })] }), _jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsx(View, { flex: 1, width: "100%", height: "100%", borderWidth: 0, bg: "transparent", render: _jsx("iframe", { ref: frame, src: src, title: app.name, allow: ALLOW, referrerPolicy: "strict-origin-when-cross-origin", "data-slot": "hosted-frame", onLoad: loaded }, turn) }), state === 'loading' ? (_jsx(YStack, { position: "absolute", t: 0, l: 0, r: 0, b: 0, items: "center", justify: "center", pointerEvents: "none", "data-slot": "hosted-loading", children: _jsx(Spinner, { size: 28, color: "$color10" }) })) : null, state === 'failed' ? (_jsxs(YStack, { position: "absolute", t: 0, l: 0, r: 0, b: 0, items: "center", justify: "center", gap: "$3", bg: "$background", "data-slot": "hosted-failed", children: [_jsx(Text, { fontSize: "$3", color: "$color11", children: t('{name} did not open here.', { name: app.name }) }), _jsx(Button, { size: "sm", rounded: 999, onPress: tab, children: t('Open in a tab') })] })) : null] })] }));
|
|
162
|
+
}
|
package/dist/Orgs.js
CHANGED
|
@@ -55,6 +55,7 @@ import { english } from './say.js';
|
|
|
55
55
|
import { countSignup } from './lib/intent.js';
|
|
56
56
|
import { BAD, mix } from './lib/mix.js';
|
|
57
57
|
import { useRooms } from './host.js';
|
|
58
|
+
import { Accounts } from './Accounts.js';
|
|
58
59
|
import { Chrome } from './Chrome.js';
|
|
59
60
|
import { site, where } from './where.js';
|
|
60
61
|
/** A template to set up once the organization is live. */
|
|
@@ -315,7 +316,7 @@ function Rule({ mt = 20, mb = 20 }) {
|
|
|
315
316
|
}
|
|
316
317
|
/** A screen's heading and the line under it; `lead` is the line's leading where it states one. */
|
|
317
318
|
function Heading({ title, lede, lead }) {
|
|
318
|
-
return (_jsxs(_Fragment, { children: [_jsx(Text, { render: "h1", fontSize: "$10", fontWeight: "500", letterSpacing: -0.32, color: "var(--text-primary)", children: title }), _jsx(Text, { render: "p", mt: 6, fontSize: "$4", lineHeight: lead, color: muted, children: lede })] }));
|
|
319
|
+
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
320
|
}
|
|
320
321
|
/** The room, held back until the organization is known. */
|
|
321
322
|
function Veil() {
|
|
@@ -603,11 +604,11 @@ function Pick({ members, current, onPick, onClose, }) {
|
|
|
603
604
|
document.addEventListener('keydown', key);
|
|
604
605
|
return () => document.removeEventListener('keydown', key);
|
|
605
606
|
}, [onClose, founding]);
|
|
606
|
-
return (_jsxs(Page, { label: t('Choose an organization'), children: [_jsxs(Column, { children: [_jsxs(XStack, { items: "flex-start", justify: "space-between", gap: 12, children: [_jsx(YStack, { flex: 1, minW: 0, children: _jsx(Heading, { title: t('Choose an organization')
|
|
607
|
+
return (_jsxs(Page, { label: t('Choose an organization'), children: [_jsxs(Column, { children: [_jsxs(XStack, { items: "flex-start", justify: "space-between", gap: 12, children: [_jsx(YStack, { flex: 1, minW: 0, children: _jsx(Heading, { title: t('Choose an organization') }) }), onClose ? (_jsx(Button, { variant: "ghost", size: "icon-sm", marginInlineEnd: -8, onClick: onClose, "aria-label": t('Close'), children: _jsx(X, { size: 16, "aria-hidden": true }) })) : null] }), _jsx(Rule, {}), _jsx(XStack, { render: "form", onSubmit: (e) => {
|
|
607
608
|
e.preventDefault();
|
|
608
609
|
if (shown[0])
|
|
609
610
|
onPick(shown[0].name);
|
|
610
|
-
}, children: _jsx(SearchInput, { name: "organizations", value: q, onChange: setQ, placeholder: t(sudo ? 'Search every organization' : 'Find an organization'), actions: sudo ? null : (_jsxs(Button, { type: "button", onClick: () => setFounding(true), children: [_jsx(Plus, { size: 16, "aria-hidden": true }), t('New organization')] })) }) }), _jsx(YStack, { render: "ul", "aria-label": t('Your organizations'), m: 0, p: 0, mt: 14, gap: 8, children: shown.map((o) => (_jsx(Choice, { org: o, current: o.name === current, onPress: () => onPick(o.name) }, o.name))) }), shown.length === 0 ? (_jsx(Text, { render: "p", mt: 14, fontSize: "$3", color: "$soft", children: t('None of yours matches “{query}”.', { query: q.trim() }) })) : null, sudo ? _jsx(Everyone, { q: q, skip: members }) : null] }), founding ? _jsx(Found, { onClose: () => setFounding(false) }) : null] }));
|
|
611
|
+
}, children: _jsx(SearchInput, { name: "organizations", value: q, onChange: setQ, placeholder: t(sudo ? 'Search every organization' : 'Find an organization'), actions: sudo ? null : (_jsxs(Button, { type: "button", onClick: () => setFounding(true), children: [_jsx(Plus, { size: 16, "aria-hidden": true }), t('New organization')] })) }) }), _jsx(YStack, { render: "ul", "aria-label": t('Your organizations'), m: 0, p: 0, mt: 14, gap: 8, children: shown.map((o) => (_jsx(Choice, { org: o, current: o.name === current, onPress: () => onPick(o.name) }, o.name))) }), shown.length === 0 ? (_jsx(Text, { render: "p", mt: 14, fontSize: "$3", color: "$soft", children: t('None of yours matches “{query}”.', { query: q.trim() }) })) : null, sudo ? _jsx(Everyone, { q: q, skip: members }) : null, _jsx(Accounts, {})] }), founding ? _jsx(Found, { onClose: () => setFounding(false) }) : null] }));
|
|
611
612
|
}
|
|
612
613
|
/**
|
|
613
614
|
* EVERY ORGANIZATION, for a SuperAdmin to step into.
|
package/dist/Palette.js
CHANGED
|
@@ -43,7 +43,7 @@ import { empty, openThread, withAgents } from './open.js';
|
|
|
43
43
|
import { useThreadList } from './thread.js';
|
|
44
44
|
import { useSignOut } from './lib/signout.js';
|
|
45
45
|
import { choose } from './lib/session.js';
|
|
46
|
-
import { app, paged, settings, studio, talk, TERMINALS, WORKSPACE } from './lib/host.js';
|
|
46
|
+
import { app, hosted, paged, settings, studio, talk, TERMINALS, WORKSPACE } from './lib/host.js';
|
|
47
47
|
import { BETAS } from './lib/betas.js';
|
|
48
48
|
import { useBetas } from './Betas.js';
|
|
49
49
|
import { tidy } from './lib/title.js';
|
|
@@ -207,7 +207,8 @@ export function Palette({ onClose, go, actions: frame = [], mode = 'chat', host,
|
|
|
207
207
|
icon: _jsx(Sparkles, { ...ICON }),
|
|
208
208
|
where: t('Beta'),
|
|
209
209
|
keywords: ['beta', b.line],
|
|
210
|
-
|
|
210
|
+
// One that draws inside the app opens there; any other at its own host.
|
|
211
|
+
run: () => (b.embed !== undefined ? go(hosted(b.id)) : out(b.href)),
|
|
211
212
|
}));
|
|
212
213
|
const here = [...top.map(swap), ...frame.filter((b) => !top.some((a) => a.id === b.id)), ...granted];
|
|
213
214
|
const doing = actions(host, go, () => void signOut(), () => (setQuery(''), setKeys(true)), t);
|
package/dist/Rail.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export declare function Toggle({ open, onPress, label }: {
|
|
|
29
29
|
onPress: () => void;
|
|
30
30
|
label?: string;
|
|
31
31
|
}): import("react").JSX.Element;
|
|
32
|
-
export declare function Rail({ host, mode, at, open, toggle, rows, onChat, onDev, onStudio, onTabs, go, onOrg, }: {
|
|
32
|
+
export declare function Rail({ host, mode, at, open, toggle, inside, rows, onChat, onDev, onStudio, onTabs, go, onOrg, }: {
|
|
33
33
|
host: Host;
|
|
34
34
|
mode: Place['mode'];
|
|
35
35
|
/** Dev's builder address, or null outside Dev. */
|
|
@@ -38,6 +38,8 @@ export declare function Rail({ host, mode, at, open, toggle, rows, onChat, onDev
|
|
|
38
38
|
open: boolean;
|
|
39
39
|
/** Lead with the sidebar's toggle; absent where the host's bar holds it. */
|
|
40
40
|
toggle?: () => void;
|
|
41
|
+
/** The hosted app (lib/hosted) the reader is in, if any. */
|
|
42
|
+
inside?: string | null;
|
|
41
43
|
/** Listed as rows in a phone's menu rather than marks down the window's edge. */
|
|
42
44
|
rows?: boolean;
|
|
43
45
|
/** To Chat, Dev and Studio, each where the reader left it. */
|
package/dist/Rail.js
CHANGED
|
@@ -43,9 +43,10 @@ import { SidebarItem } from '@hanzo/ui/chat';
|
|
|
43
43
|
import { BetasDialog, useBetas } from './Betas.js';
|
|
44
44
|
import { out } from './help.js';
|
|
45
45
|
import { BETAS } from './lib/betas.js';
|
|
46
|
+
import { HOSTED_APPS } from './lib/hosted.js';
|
|
46
47
|
import { Me } from './Me.js';
|
|
47
48
|
import { BAND } from './ground.js';
|
|
48
|
-
import { app, WORKSPACE } from './lib/host.js';
|
|
49
|
+
import { app, hosted, WORKSPACE } from './lib/host.js';
|
|
49
50
|
/** The rail's width, px. */
|
|
50
51
|
export const RAIL = 44;
|
|
51
52
|
/** A mark, px: a 36px square on a 44px pitch. */
|
|
@@ -87,7 +88,7 @@ export function Toggle({ open, onPress, label }) {
|
|
|
87
88
|
const { t } = useI18n();
|
|
88
89
|
return (_jsx(Mark, { label: label ?? t(open ? 'Close sidebar' : 'Open sidebar'), "data-slot": "sidebar-toggle", "aria-expanded": open, onPress: onPress, children: _jsx(PanelLeft, { size: 18, "aria-hidden": true, "data-i18n-mirror": true }) }));
|
|
89
90
|
}
|
|
90
|
-
export function Rail({ host, mode, at, open, toggle, rows = false, onChat, onDev, onStudio, onTabs, go, onOrg, }) {
|
|
91
|
+
export function Rail({ host, mode, at, open, toggle, inside = null, rows = false, onChat, onDev, onStudio, onTabs, go, onOrg, }) {
|
|
91
92
|
const { t, dir } = useI18n();
|
|
92
93
|
const here = mode === 'dev' ? raised(at) : null;
|
|
93
94
|
const to = (p) => () => go(app(p));
|
|
@@ -96,8 +97,11 @@ export function Rail({ host, mode, at, open, toggle, rows = false, onChat, onDev
|
|
|
96
97
|
const team = mode !== 'studio';
|
|
97
98
|
const { open: opened } = useBetas();
|
|
98
99
|
const [betas, setBetas] = useState(false);
|
|
99
|
-
// The apps in beta this reader may open, each where it lives.
|
|
100
|
-
const granted = BETAS.filter((b) => b.href && opened(b.id));
|
|
100
|
+
// The apps in beta this reader may open, each where it lives; those that draw inside the app have marks of their own.
|
|
101
|
+
const granted = BETAS.filter((b) => b.href && b.embed === undefined && opened(b.id));
|
|
102
|
+
const apps = HOSTED_APPS.filter((a) => opened(a.id));
|
|
103
|
+
// A link out of the app, or a place in it.
|
|
104
|
+
const reach = (address) => (address.startsWith('/') ? go(address) : out(address));
|
|
101
105
|
const rest = [
|
|
102
106
|
...(rows
|
|
103
107
|
? [
|
|
@@ -117,12 +121,12 @@ export function Rail({ host, mode, at, open, toggle, rows = false, onChat, onDev
|
|
|
117
121
|
]
|
|
118
122
|
: []),
|
|
119
123
|
];
|
|
120
|
-
const betasDialog = _jsx(BetasDialog, { open: betas, onOpenChange: setBetas, go:
|
|
124
|
+
const betasDialog = _jsx(BetasDialog, { open: betas, onOpenChange: setBetas, go: reach });
|
|
121
125
|
if (rows)
|
|
122
|
-
return (_jsxs(YStack, { "data-slot": "places", render: "nav", "aria-label": t('Products'), pt: "$2", shrink: 0, children: [_jsxs(YStack, { role: "list", gap: 2, children: [_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: "Studio", on: mode === 'studio', onPress: onStudio, "data-slot": "place-studio", icon: _jsx(WandSparkles, { size: 16, "aria-hidden": true }) }) }), _jsx(YStack, { role: "listitem", children: _jsx(Row, { label: "Tabs", on: mode === 'tabs', onPress: onTabs, "data-slot": "place-tabs", icon: _jsx(SquareTerminal, { size: 16, "aria-hidden": true }) }) }), _jsx(YStack, { role: "listitem", children: _jsx(DropdownMenu, { placement: "bottom-start", minWidth: 220, trigger: _jsx(Row, { label: t('More'), "data-slot": "place-more", "aria-haspopup": "menu", icon: _jsx(Ellipsis, { size: 16, "aria-hidden": true }) }), items: rest }) })] }), betasDialog] }));
|
|
126
|
+
return (_jsxs(YStack, { "data-slot": "places", render: "nav", "aria-label": t('Products'), pt: "$2", shrink: 0, children: [_jsxs(YStack, { role: "list", gap: 2, children: [_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: "Studio", on: mode === 'studio', onPress: onStudio, "data-slot": "place-studio", icon: _jsx(WandSparkles, { size: 16, "aria-hidden": true }) }) }), _jsx(YStack, { role: "listitem", children: _jsx(Row, { label: "Tabs", on: mode === 'tabs', onPress: onTabs, "data-slot": "place-tabs", icon: _jsx(SquareTerminal, { size: 16, "aria-hidden": true }) }) }), apps.map((a) => (_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: a.name, on: inside === a.id, onPress: () => go(hosted(a.id)), "data-slot": `place-app-${a.id}`, icon: _jsx(a.icon, { size: 16, "aria-hidden": true }) }) }, a.id))), _jsx(YStack, { role: "listitem", children: _jsx(DropdownMenu, { placement: "bottom-start", minWidth: 220, trigger: _jsx(Row, { label: t('More'), "data-slot": "place-more", "aria-haspopup": "menu", icon: _jsx(Ellipsis, { size: 16, "aria-hidden": true }) }), items: rest }) })] }), betasDialog] }));
|
|
123
127
|
return (_jsxs(YStack, { "data-slot": "rail", render: "nav", "aria-label": t('Products'), width: RAIL, flex: 1,
|
|
124
128
|
// The first mark centred on the head band beside it (BAND), the account on the sidebar's foot (Column's `pb`).
|
|
125
|
-
pt: (BAND - MARK) / 2, pb: "$2", gap: 4, shrink: 0, items: "center", $touchable: { pt: (BAND - TOUCH) / 2 }, children: [toggle ? (_jsx(YStack, { pb: 4, children: _jsx(Toggle, { open: open, onPress: toggle }) })) : null, _jsx(Mark, { label: t('Chat'), on: mode === 'chat', onPress: onChat, "data-slot": "rail-chat", children: _jsx(MessageSquare, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Dev", on: mode === 'dev' && !here, onPress: onDev, "data-slot": "rail-dev", children: _jsx(Code2, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Studio", on: mode === 'studio', onPress: onStudio, "data-slot": "rail-studio", children: _jsx(WandSparkles, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Tabs", on: mode === 'tabs', onPress: onTabs, "data-slot": "rail-tabs", children: _jsx(SquareTerminal, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Library'), on: here === 'library', onPress: to(RAISED.library), "data-slot": "rail-library", children: _jsx(Library, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Scheduled tasks'), on: here === 'scheduled', onPress: to(RAISED.scheduled), "data-slot": "rail-scheduled", children: _jsx(Clock, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Customize'), on: here === 'customize', onPress: to(RAISED.customize), "data-slot": "rail-customize", children: _jsx(Puzzle, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Betas'), on: mode === 'beta', onPress: () => go('/beta'), "data-slot": "rail-betas", children: _jsx(FlaskConical, { size: 18, "aria-hidden": true }) }), betasDialog, rest.length ? (_jsx(DropdownMenu
|
|
129
|
+
pt: (BAND - MARK) / 2, pb: "$2", gap: 4, shrink: 0, items: "center", $touchable: { pt: (BAND - TOUCH) / 2 }, children: [toggle ? (_jsx(YStack, { pb: 4, children: _jsx(Toggle, { open: open, onPress: toggle }) })) : null, _jsx(Mark, { label: t('Chat'), on: mode === 'chat', onPress: onChat, "data-slot": "rail-chat", children: _jsx(MessageSquare, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Dev", on: mode === 'dev' && !here, onPress: onDev, "data-slot": "rail-dev", children: _jsx(Code2, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Studio", on: mode === 'studio', onPress: onStudio, "data-slot": "rail-studio", children: _jsx(WandSparkles, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Tabs", on: mode === 'tabs', onPress: onTabs, "data-slot": "rail-tabs", children: _jsx(SquareTerminal, { size: 18, "aria-hidden": true }) }), apps.map((a) => (_jsx(Mark, { label: a.name, on: inside === a.id, onPress: () => go(hosted(a.id)), "data-slot": `rail-app-${a.id}`, children: _jsx(a.icon, { size: 18, "aria-hidden": true }) }, a.id))), _jsx(Mark, { label: t('Library'), on: here === 'library', onPress: to(RAISED.library), "data-slot": "rail-library", children: _jsx(Library, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Scheduled tasks'), on: here === 'scheduled', onPress: to(RAISED.scheduled), "data-slot": "rail-scheduled", children: _jsx(Clock, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Customize'), on: here === 'customize', onPress: to(RAISED.customize), "data-slot": "rail-customize", children: _jsx(Puzzle, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Betas'), on: mode === 'beta', onPress: () => go('/beta'), "data-slot": "rail-betas", children: _jsx(FlaskConical, { size: 18, "aria-hidden": true }) }), betasDialog, rest.length ? (_jsx(DropdownMenu
|
|
126
130
|
// Toward the content: right of the rail, left of it right to left.
|
|
127
131
|
, {
|
|
128
132
|
// Toward the content: right of the rail, left of it right to left.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** One person signed in on this browser: enough to recognise them, and to name them in a `login_hint`. */
|
|
2
|
+
export interface Account {
|
|
3
|
+
sub: string;
|
|
4
|
+
owner: string;
|
|
5
|
+
name: string;
|
|
6
|
+
displayName: string;
|
|
7
|
+
email: string;
|
|
8
|
+
avatar: string;
|
|
9
|
+
}
|
|
10
|
+
/** The accounts IAM holds for this browser, read from `base`. An answer that is not a list, or none, is nobody. */
|
|
11
|
+
export declare function read(base: string, signal?: AbortSignal): Promise<Account[]>;
|
|
12
|
+
/** What the page knows of the reader, to tell which account is theirs. */
|
|
13
|
+
export interface Who {
|
|
14
|
+
email?: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
sub?: string;
|
|
17
|
+
}
|
|
18
|
+
/** Whether `account` is the reader: the same subject, else the same address, else the same username. */
|
|
19
|
+
export declare function is(account: Account, who: Who): boolean;
|
|
20
|
+
/** The line a row says: the display name, else the username; and the address when it adds something. */
|
|
21
|
+
export declare function label(account: Account): {
|
|
22
|
+
title: string;
|
|
23
|
+
line: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The accounts signed in here, which is the reader's, and the two ways to leave
|
|
27
|
+
* for another: `switchTo` an account in the list, and `add` one. Signed out it
|
|
28
|
+
* reads nothing.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useAccounts(): {
|
|
31
|
+
accounts: Account[];
|
|
32
|
+
current: Account | null;
|
|
33
|
+
switchTo: (a: Account) => Promise<void>;
|
|
34
|
+
add: () => Promise<void>;
|
|
35
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
/**
|
|
3
|
+
* THE PEOPLE SIGNED IN ON THIS BROWSER, and the way to be any one of them.
|
|
4
|
+
*
|
|
5
|
+
* IAM's session cookie holds one session per person (GET /v1/iam/accounts lists
|
|
6
|
+
* them, most recent first; it answers the browser that holds them and no other).
|
|
7
|
+
* Being one of them is the ordinary sign-in with a `login_hint` naming the person:
|
|
8
|
+
* IAM continues as that account and nobody types anything. Adding another is the
|
|
9
|
+
* sign-in with `prompt=login`, which asks for credentials and keeps the sessions
|
|
10
|
+
* already held. Neither ends a session. Signing OUT is IAM's, and it ends every
|
|
11
|
+
* session the browser holds (internal/oidc/logout.go), so no row here offers to
|
|
12
|
+
* end just one.
|
|
13
|
+
*
|
|
14
|
+
* Both go through the page's own IAM client (`useClient`), so the authorize
|
|
15
|
+
* address is the one this site signs in at, and both write the page down first
|
|
16
|
+
* (`rememberDestination`), so the sign-in returns here.
|
|
17
|
+
*/
|
|
18
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
19
|
+
import { useIam } from '@hanzo/iam/react';
|
|
20
|
+
import { rememberDestination } from './destination.js';
|
|
21
|
+
import { named } from './session.js';
|
|
22
|
+
import { here, useClient } from './signout.js';
|
|
23
|
+
const PATH = '/v1/iam/accounts';
|
|
24
|
+
const text = (v) => (typeof v === 'string' ? v.trim() : '');
|
|
25
|
+
/** One row of IAM's answer, or nothing for a row that cannot be named. Only an https picture is kept. */
|
|
26
|
+
function clean(raw) {
|
|
27
|
+
const r = (raw ?? {});
|
|
28
|
+
const sub = text(r.sub);
|
|
29
|
+
const name = text(r.name);
|
|
30
|
+
if (!sub || !name)
|
|
31
|
+
return null;
|
|
32
|
+
const avatar = text(r.avatar);
|
|
33
|
+
return {
|
|
34
|
+
sub,
|
|
35
|
+
owner: text(r.owner),
|
|
36
|
+
name,
|
|
37
|
+
displayName: text(r.displayName),
|
|
38
|
+
email: text(r.email).toLowerCase(),
|
|
39
|
+
avatar: avatar.startsWith('https://') ? avatar : '',
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** The accounts IAM holds for this browser, read from `base`. An answer that is not a list, or none, is nobody. */
|
|
43
|
+
export async function read(base, signal) {
|
|
44
|
+
try {
|
|
45
|
+
const res = await fetch(`${base.replace(/\/+$/, '')}${PATH}`, { credentials: 'include', headers: { Accept: 'application/json' }, signal });
|
|
46
|
+
if (!res.ok)
|
|
47
|
+
return [];
|
|
48
|
+
const body = (await res.json());
|
|
49
|
+
const rows = Array.isArray(body) ? body : body?.data;
|
|
50
|
+
const seen = new Set();
|
|
51
|
+
return (Array.isArray(rows) ? rows : [])
|
|
52
|
+
.map(clean)
|
|
53
|
+
.filter((a) => a !== null && !seen.has(a.sub) && !!seen.add(a.sub));
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/** Whether `account` is the reader: the same subject, else the same address, else the same username. */
|
|
60
|
+
export function is(account, who) {
|
|
61
|
+
if (who.sub && account.sub === who.sub)
|
|
62
|
+
return true;
|
|
63
|
+
if (who.email && account.email && account.email === who.email.trim().toLowerCase())
|
|
64
|
+
return true;
|
|
65
|
+
return !who.email && !!who.name && account.name === who.name;
|
|
66
|
+
}
|
|
67
|
+
/** The line a row says: the display name, else the username; and the address when it adds something. */
|
|
68
|
+
export function label(account) {
|
|
69
|
+
const title = account.displayName || account.name;
|
|
70
|
+
return { title, line: account.email && account.email !== title ? account.email : '' };
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The accounts signed in here, which is the reader's, and the two ways to leave
|
|
74
|
+
* for another: `switchTo` an account in the list, and `add` one. Signed out it
|
|
75
|
+
* reads nothing.
|
|
76
|
+
*/
|
|
77
|
+
export function useAccounts() {
|
|
78
|
+
const { config, user, isAuthenticated } = useIam();
|
|
79
|
+
const client = useClient();
|
|
80
|
+
const [accounts, setAccounts] = useState([]);
|
|
81
|
+
const base = here() ? window.location.origin : config.serverUrl || '';
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
if (!isAuthenticated || !base)
|
|
84
|
+
return;
|
|
85
|
+
const ctl = new AbortController();
|
|
86
|
+
void read(base, ctl.signal).then((list) => {
|
|
87
|
+
if (!ctl.signal.aborted)
|
|
88
|
+
setAccounts(list);
|
|
89
|
+
});
|
|
90
|
+
return () => ctl.abort();
|
|
91
|
+
}, [base, isAuthenticated]);
|
|
92
|
+
const claimed = named();
|
|
93
|
+
const u = user;
|
|
94
|
+
const who = { sub: u?.sub ?? u?.id, email: u?.email || claimed?.email, name: u?.name || claimed?.name };
|
|
95
|
+
const current = useMemo(() => accounts.find((a) => is(a, who)) ?? null, [accounts, who.sub, who.email, who.name]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
96
|
+
const go = useCallback(async (extra) => {
|
|
97
|
+
rememberDestination();
|
|
98
|
+
window.location.replace(await client.getSigninUrl(extra));
|
|
99
|
+
}, [client]);
|
|
100
|
+
const switchTo = useCallback((a) => go({ additionalParams: { login_hint: a.sub } }), [go]);
|
|
101
|
+
const add = useCallback(() => go({ additionalParams: { prompt: 'login' } }), [go]);
|
|
102
|
+
return { accounts, current, switchTo, add };
|
|
103
|
+
}
|
package/dist/lib/betas.d.ts
CHANGED
|
@@ -21,6 +21,15 @@
|
|
|
21
21
|
*/
|
|
22
22
|
export declare const GROUPS: readonly ['Business', 'Data', 'Agents', 'Build & run', 'Security', 'Creative', 'Models'];
|
|
23
23
|
export type Group = (typeof GROUPS)[number];
|
|
24
|
+
/**
|
|
25
|
+
* How an app draws inside the Hanzo app, at /apps/<id>: its own live host in a
|
|
26
|
+
* frame (`href`, with `?embed=1`), so a deploy of the standalone app reaches
|
|
27
|
+
* hanzo.ai with no release here. A row may later name a module the app exports
|
|
28
|
+
* instead (`mount`); nothing reads it yet.
|
|
29
|
+
*/
|
|
30
|
+
export type Embed = 'frame' | {
|
|
31
|
+
mount: string;
|
|
32
|
+
};
|
|
24
33
|
export interface Beta {
|
|
25
34
|
/** Stable, lowercase, one word: the switch is `beta.<id>`. */
|
|
26
35
|
id: string;
|
|
@@ -30,6 +39,8 @@ export interface Beta {
|
|
|
30
39
|
group: Group;
|
|
31
40
|
/** Where it opens once granted; absent while it is not built as an app. */
|
|
32
41
|
href?: string;
|
|
42
|
+
/** Drawn inside the app as well, once granted (lib/hosted). */
|
|
43
|
+
embed?: Embed;
|
|
33
44
|
}
|
|
34
45
|
export declare const BETAS: readonly Beta[];
|
|
35
46
|
/** The switch of one app in beta. */
|
package/dist/lib/betas.js
CHANGED
|
@@ -24,16 +24,16 @@ export const GROUPS = ['Business', 'Data', 'Agents', 'Build & run', 'Security',
|
|
|
24
24
|
/** The developer platform, where a module in beta opens at its own address for anyone who has it. */
|
|
25
25
|
const PLATFORM = 'https://platform.hanzo.ai';
|
|
26
26
|
export const BETAS = [
|
|
27
|
-
{ id: 'crm', name: 'CRM', line: phrase('Companies, contacts and deals, per org'), group: 'Business', href:
|
|
27
|
+
{ id: 'crm', name: 'CRM', line: phrase('Companies, contacts and deals, per org'), group: 'Business', href: 'https://crm.hanzo.ai/', embed: 'frame' },
|
|
28
28
|
{ id: 'erp', name: 'ERP', line: phrase('Items, sales, purchasing, accounting and HR'), group: 'Business', href: `${PLATFORM}/erp` },
|
|
29
|
-
{ id: 'commerce', name: 'Commerce', line: phrase('Catalog, cart, checkout and orders'), group: 'Business', href: 'https://commerce-admin.hanzo.ai/admin' },
|
|
29
|
+
{ id: 'commerce', name: 'Commerce', line: phrase('Catalog, cart, checkout and orders'), group: 'Business', href: 'https://commerce-admin.hanzo.ai/admin/', embed: 'frame' },
|
|
30
30
|
{ id: 'books', name: 'Books', line: phrase('Chart of accounts, ledger and bank reconciliation'), group: 'Business' },
|
|
31
31
|
{ id: 'finance', name: 'Finance', line: phrase('One ledger for your money operations'), group: 'Business', href: 'https://finance.hanzo.ai' },
|
|
32
32
|
{ id: 'treasury', name: 'Treasury & Ledger', line: phrase('Reserves, payouts and a double-entry journal'), group: 'Business' },
|
|
33
33
|
{ id: 'dataroom', name: 'Data Room', line: phrase('Share documents and see who opened them'), group: 'Business', href: 'https://dataroom.hanzo.ai' },
|
|
34
34
|
{ id: 'sign', name: 'Sign', line: phrase('Send a PDF, get it signed, keep the record'), group: 'Business', href: 'https://esign.hanzo.ai' },
|
|
35
35
|
{ id: 'company', name: 'Company', line: phrase('Formation, documents and filings'), group: 'Business', href: `${PLATFORM}/company` },
|
|
36
|
-
{ id: 'cms', name: 'CMS', line: phrase('Pages, posts, media and navigation'), group: 'Business', href: 'https://cms.hanzo.ai/admin' },
|
|
36
|
+
{ id: 'cms', name: 'CMS', line: phrase('Pages, posts, media and navigation'), group: 'Business', href: 'https://cms.hanzo.ai/admin', embed: 'frame' },
|
|
37
37
|
{ id: 'helpdesk', name: 'Help Center', line: phrase('Tickets, teams and SLAs'), group: 'Business', href: 'https://hanzo.help' },
|
|
38
38
|
{ id: 'marketing', name: 'Marketing', line: phrase('Campaigns, audiences and email sequences'), group: 'Business', href: 'https://marketing.hanzo.ai' },
|
|
39
39
|
{ id: 'ads', name: 'Ads', line: phrase('Paid campaigns, launched and paused in one place'), group: 'Business', href: 'https://ads.hanzo.ai' },
|
|
@@ -42,8 +42,8 @@ export const BETAS = [
|
|
|
42
42
|
{ id: 'risk', name: 'Risk', line: phrase('AML monitoring and fraud on one engine'), group: 'Business', href: 'https://aml.hanzo.ai' },
|
|
43
43
|
{ id: 'idv', name: 'Identity Verification', line: phrase('KYC, KYB and AML vendors behind one interface'), group: 'Business' },
|
|
44
44
|
{ id: 'base', name: 'Base', line: phrase('Data, users, files and live updates per org'), group: 'Data', href: 'https://base.hanzo.ai' },
|
|
45
|
-
{ id: 'analytics', name: 'Analytics', line: phrase('Privacy-first product analytics'), group: 'Data', href: 'https://analytics.hanzo.ai' },
|
|
46
|
-
{ id: 'insights', name: 'Insights', line: phrase('Funnels, session replay, flags and experiments'), group: 'Data', href: 'https://insights.hanzo.ai' },
|
|
45
|
+
{ id: 'analytics', name: 'Analytics', line: phrase('Privacy-first product analytics'), group: 'Data', href: 'https://analytics.hanzo.ai', embed: 'frame' },
|
|
46
|
+
{ id: 'insights', name: 'Insights', line: phrase('Funnels, session replay, flags and experiments'), group: 'Data', href: 'https://insights.hanzo.ai', embed: 'frame' },
|
|
47
47
|
{ id: 'search', name: 'Search', line: phrase('Keyword and meaning in one query'), group: 'Data', href: `${PLATFORM}/search` },
|
|
48
48
|
{ id: 'world', name: 'World', line: phrase('A live map of every model and AI workload'), group: 'Data', href: 'https://world.hanzo.ai' },
|
|
49
49
|
{ id: 'crawl', name: 'Crawl', line: phrase('Turn a website into clean Markdown'), group: 'Data', href: `${PLATFORM}/crawl` },
|
package/dist/lib/host.d.ts
CHANGED
|
@@ -62,6 +62,13 @@ export declare const TERMINALS = "/tabs";
|
|
|
62
62
|
* Betas: ecosystem betas, early access preview, and waitlist dashboard.
|
|
63
63
|
*/
|
|
64
64
|
export declare const BETA = "/beta";
|
|
65
|
+
/**
|
|
66
|
+
* The apps in beta that stand inside the app (lib/hosted): /apps/<id>, one
|
|
67
|
+
* pane for all of them, each the live host of the standalone app in a frame.
|
|
68
|
+
*/
|
|
69
|
+
export declare const HOSTED = "/apps";
|
|
70
|
+
/** The address of one hosted app, and the page inside it (`at`, a path on its own host) when it is on one. */
|
|
71
|
+
export declare const hosted: (id: string, at?: string) => string;
|
|
65
72
|
/** Studio at an address of its own (@hanzo/studio `route`): '' is New, /studio. */
|
|
66
73
|
export declare const studio: (at: string) => string;
|
|
67
74
|
/** Chat on a conversation, or /chat itself for a new one. */
|
|
@@ -99,6 +106,9 @@ export type Place = {
|
|
|
99
106
|
mode: 'tabs';
|
|
100
107
|
} | {
|
|
101
108
|
mode: 'beta';
|
|
109
|
+
} | {
|
|
110
|
+
mode: 'hosted';
|
|
111
|
+
id: string;
|
|
102
112
|
};
|
|
103
113
|
/** The place a path names, or null when it names none of the app's. */
|
|
104
114
|
export declare function place(pathname: string): Place | null;
|
package/dist/lib/host.js
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import APP from './rooms.json' with { type: 'json' };
|
|
17
17
|
import { href, parse, path, route, SESSION, SLUG } from '@hanzo/build/route';
|
|
18
18
|
import { site } from '../where.js';
|
|
19
|
+
import { BETAS } from './betas.js';
|
|
19
20
|
/** The workspace's own address. */
|
|
20
21
|
export const WORKSPACE = 'https://hanzo.team';
|
|
21
22
|
/**
|
|
@@ -65,6 +66,15 @@ export const TERMINALS = '/tabs';
|
|
|
65
66
|
* Betas: ecosystem betas, early access preview, and waitlist dashboard.
|
|
66
67
|
*/
|
|
67
68
|
export const BETA = '/beta';
|
|
69
|
+
/**
|
|
70
|
+
* The apps in beta that stand inside the app (lib/hosted): /apps/<id>, one
|
|
71
|
+
* pane for all of them, each the live host of the standalone app in a frame.
|
|
72
|
+
*/
|
|
73
|
+
export const HOSTED = '/apps';
|
|
74
|
+
/** The address of one hosted app, and the page inside it (`at`, a path on its own host) when it is on one. */
|
|
75
|
+
export const hosted = (id, at) => `${HOSTED}/${id}${at ? `?at=${encodeURIComponent(at)}` : ''}`;
|
|
76
|
+
/** Whether `id` is an app in beta that draws inside the app. */
|
|
77
|
+
const inside = (id) => BETAS.some((b) => b.id === id && b.embed !== undefined);
|
|
68
78
|
/** Studio at an address of its own (@hanzo/studio `route`): '' is New, /studio. */
|
|
69
79
|
export const studio = (at) => (at ? `${STUDIO}/${at.replace(/^\/+/, '')}` : STUDIO);
|
|
70
80
|
/** Chat on a conversation, or /chat itself for a new one. */
|
|
@@ -118,6 +128,10 @@ export function place(pathname) {
|
|
|
118
128
|
return { mode: 'tabs' };
|
|
119
129
|
if (p === BETA)
|
|
120
130
|
return { mode: 'beta' };
|
|
131
|
+
if (p.startsWith(`${HOSTED}/`)) {
|
|
132
|
+
const id = p.slice(HOSTED.length + 1);
|
|
133
|
+
return inside(id) ? { mode: 'hosted', id } : null;
|
|
134
|
+
}
|
|
121
135
|
if (!p.startsWith(`${CHAT}/`))
|
|
122
136
|
return null;
|
|
123
137
|
const id = p.slice(CHAT.length + 1);
|
|
@@ -143,6 +157,8 @@ export function page(pathname) {
|
|
|
143
157
|
return STUDIO;
|
|
144
158
|
if (at.mode === 'beta')
|
|
145
159
|
return BETA;
|
|
160
|
+
if (at.mode === 'hosted')
|
|
161
|
+
return `${HOSTED}/:id`;
|
|
146
162
|
const r = route(at.at);
|
|
147
163
|
if (r.kind === 'run')
|
|
148
164
|
return `${DEV}/run/:id`;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The apps that draw inside the Hanzo app: one table, derived from the apps in
|
|
3
|
+
* beta (lib/betas) that name an `embed`, so an app is listed once.
|
|
4
|
+
*
|
|
5
|
+
* Each stays a standalone app on a host of its own and deploys on its own. The
|
|
6
|
+
* pane at /apps/<id> frames that live host (`frame`), so a deploy of the
|
|
7
|
+
* standalone app reaches hanzo.ai with no release of this package. `?embed=1`
|
|
8
|
+
* asks the standalone app to leave out its own wordmark and sidebar once it
|
|
9
|
+
* knows the flag; an app that does not still works, in its own chrome.
|
|
10
|
+
*
|
|
11
|
+
* Whether a reader may open one is `opens` (lib/betas), the one predicate; this
|
|
12
|
+
* table says only what there is to open and where.
|
|
13
|
+
*/
|
|
14
|
+
import { type LucideIcon } from 'lucide-react';
|
|
15
|
+
import { type Embed } from './betas.js';
|
|
16
|
+
export interface Hosted {
|
|
17
|
+
/** The app's id: `beta.<id>` is its switch, and /apps/<id> its address. */
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
/** Its standalone host, `crm.hanzo.ai`. */
|
|
21
|
+
host: string;
|
|
22
|
+
/** Where it opens on its own: the host and the page it starts on. */
|
|
23
|
+
href: string;
|
|
24
|
+
icon: LucideIcon;
|
|
25
|
+
/** The principal switch, `beta.<id>`. */
|
|
26
|
+
flag: string;
|
|
27
|
+
/** How it is drawn: a frame of its live host today; a row may name a module instead. */
|
|
28
|
+
embed: Embed;
|
|
29
|
+
}
|
|
30
|
+
/** The apps that draw inside the app, in the order the list holds them. */
|
|
31
|
+
export declare const HOSTED_APPS: readonly Hosted[];
|
|
32
|
+
/** One hosted app by id. */
|
|
33
|
+
export declare const hostedApp: (id: string) => Hosted | undefined;
|
|
34
|
+
/** The origin of an app's host, the only one a frame of it speaks to and hears from. */
|
|
35
|
+
export declare const origin: (app: Hosted) => string;
|
|
36
|
+
/**
|
|
37
|
+
* The address the frame loads: the app's own page (`app.href`), or `at`, a path
|
|
38
|
+
* on the same host the reader was last on, with `embed=1` on it. A path that
|
|
39
|
+
* names another host or is not a path is the start page.
|
|
40
|
+
*/
|
|
41
|
+
export declare function frameUrl(app: Hosted, at?: string | null): string;
|
|
42
|
+
/** The path and query of an address on the app's own host, without `embed`, or null when it is on another. */
|
|
43
|
+
export declare function pathOn(app: Hosted, href: string): string | null;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The apps that draw inside the Hanzo app: one table, derived from the apps in
|
|
3
|
+
* beta (lib/betas) that name an `embed`, so an app is listed once.
|
|
4
|
+
*
|
|
5
|
+
* Each stays a standalone app on a host of its own and deploys on its own. The
|
|
6
|
+
* pane at /apps/<id> frames that live host (`frame`), so a deploy of the
|
|
7
|
+
* standalone app reaches hanzo.ai with no release of this package. `?embed=1`
|
|
8
|
+
* asks the standalone app to leave out its own wordmark and sidebar once it
|
|
9
|
+
* knows the flag; an app that does not still works, in its own chrome.
|
|
10
|
+
*
|
|
11
|
+
* Whether a reader may open one is `opens` (lib/betas), the one predicate; this
|
|
12
|
+
* table says only what there is to open and where.
|
|
13
|
+
*/
|
|
14
|
+
import { ChartColumn, ContactRound, Newspaper, ShoppingCart, Sparkles, Telescope } from 'lucide-react';
|
|
15
|
+
import { BETAS, key } from './betas.js';
|
|
16
|
+
const ICON = {
|
|
17
|
+
crm: ContactRound,
|
|
18
|
+
commerce: ShoppingCart,
|
|
19
|
+
cms: Newspaper,
|
|
20
|
+
analytics: ChartColumn,
|
|
21
|
+
insights: Telescope,
|
|
22
|
+
};
|
|
23
|
+
/** The apps that draw inside the app, in the order the list holds them. */
|
|
24
|
+
export const HOSTED_APPS = BETAS.flatMap((b) => b.embed !== undefined && b.href ? [{ id: b.id, name: b.name, host: new URL(b.href).host, href: b.href, icon: ICON[b.id] ?? Sparkles, flag: key(b.id), embed: b.embed }] : []);
|
|
25
|
+
/** One hosted app by id. */
|
|
26
|
+
export const hostedApp = (id) => HOSTED_APPS.find((a) => a.id === id);
|
|
27
|
+
/** The origin of an app's host, the only one a frame of it speaks to and hears from. */
|
|
28
|
+
export const origin = (app) => new URL(app.href).origin;
|
|
29
|
+
/**
|
|
30
|
+
* The address the frame loads: the app's own page (`app.href`), or `at`, a path
|
|
31
|
+
* on the same host the reader was last on, with `embed=1` on it. A path that
|
|
32
|
+
* names another host or is not a path is the start page.
|
|
33
|
+
*/
|
|
34
|
+
export function frameUrl(app, at) {
|
|
35
|
+
const base = new URL(app.href);
|
|
36
|
+
if (at && at.startsWith('/') && !at.startsWith('//')) {
|
|
37
|
+
const to = new URL(at, base.origin);
|
|
38
|
+
if (to.origin === base.origin)
|
|
39
|
+
return withEmbed(to);
|
|
40
|
+
}
|
|
41
|
+
return withEmbed(base);
|
|
42
|
+
}
|
|
43
|
+
function withEmbed(url) {
|
|
44
|
+
url.searchParams.set('embed', '1');
|
|
45
|
+
return url.toString();
|
|
46
|
+
}
|
|
47
|
+
/** The path and query of an address on the app's own host, without `embed`, or null when it is on another. */
|
|
48
|
+
export function pathOn(app, href) {
|
|
49
|
+
try {
|
|
50
|
+
const to = new URL(href, origin(app));
|
|
51
|
+
if (to.origin !== origin(app))
|
|
52
|
+
return null;
|
|
53
|
+
to.searchParams.delete('embed');
|
|
54
|
+
return `${to.pathname}${to.search}`;
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
}
|
package/dist/lib/signout.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* session a person signs in with here is the one a later visit finds, and the
|
|
8
8
|
* one sign-out ends. Nobody is sent to hanzo.id for any of it.
|
|
9
9
|
*/
|
|
10
|
-
import { useMemo } from 'react';
|
|
10
|
+
import { useCallback, useMemo } from 'react';
|
|
11
11
|
import { IAM } from '@hanzo/iam';
|
|
12
12
|
import { useIam } from '@hanzo/iam/react';
|
|
13
13
|
import { useSignOut as useUiSignOut } from '@hanzo/ui/auth';
|
|
@@ -36,5 +36,12 @@ export const OUT = '/login?from=logout';
|
|
|
36
36
|
*/
|
|
37
37
|
export function useSignOut() {
|
|
38
38
|
// @ts-expect-error everywhere option added in @hanzo/ui / IAM shared sign-out
|
|
39
|
-
|
|
39
|
+
const signOut = useUiSignOut({ to: OUT, track, everywhere: true });
|
|
40
|
+
return useCallback(async () => {
|
|
41
|
+
// Google One Tap signs a returning person in on its own (`auto_select`), which
|
|
42
|
+
// would put them straight back in the account they just left. Leaving says so.
|
|
43
|
+
;
|
|
44
|
+
window.google?.accounts?.id?.disableAutoSelect?.();
|
|
45
|
+
await signOut();
|
|
46
|
+
}, [signOut]);
|
|
40
47
|
}
|
package/dist/where.d.ts
CHANGED
|
@@ -74,6 +74,6 @@ export declare const where: () => Addresses;
|
|
|
74
74
|
/** The product's name, as the host states it. Read at call time, like every address. */
|
|
75
75
|
export declare const brand: () => string;
|
|
76
76
|
/** The product's name in each mode of the app: the host's brand in Chat (Hanzo AI, Hanzo Team), Hanzo Dev in Dev. */
|
|
77
|
-
export declare const wordmark: (mode: 'chat' | 'dev' | 'studio' | 'tabs' | 'beta') => string;
|
|
77
|
+
export declare const wordmark: (mode: 'chat' | 'dev' | 'studio' | 'tabs' | 'beta' | 'hosted') => string;
|
|
78
78
|
/** A page of the app's own, from wherever the rooms are mounted. */
|
|
79
79
|
export declare const site: (path: string) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/app",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.39",
|
|
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",
|