@celljs/ta-web 4.46.3 → 4.47.1
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/esm/browser/assistant/assistant-view.js +2 -1
- package/esm/browser/chat/chat-protocol.d.ts +7 -0
- package/esm/browser/chat/chat-view.js +3 -2
- package/esm/browser/chat/chat.d.ts +1 -0
- package/esm/browser/chat/chat.js +15 -3
- package/esm/browser/chat/draft-model.d.ts +1 -1
- package/esm/browser/chat/draft-model.js +2 -2
- package/esm/browser/components/account-menu.d.ts +2 -0
- package/esm/browser/components/account-menu.js +10 -1
- package/esm/browser/components/app-nav.js +4 -1
- package/esm/browser/components/app-shell-state.js +11 -0
- package/esm/browser/components/app-update-view.d.ts +2 -0
- package/esm/browser/components/app-update-view.js +37 -0
- package/esm/browser/components/app-view.js +22 -2
- package/esm/browser/components/auth-guide.d.ts +25 -0
- package/esm/browser/components/auth-guide.js +44 -0
- package/esm/browser/components/auth-view.d.ts +2 -0
- package/esm/browser/components/auth-view.js +30 -9
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/custom-provider-util.d.ts +2 -0
- package/esm/browser/components/custom-provider-util.js +5 -0
- package/esm/browser/components/custom-provider-view.js +31 -10
- package/esm/browser/components/discover-view.d.ts +8 -1
- package/esm/browser/components/discover-view.js +28 -3
- package/esm/browser/components/extension-settings.js +1 -0
- package/esm/browser/components/first-steps-util.d.ts +59 -0
- package/esm/browser/components/first-steps-util.js +74 -0
- package/esm/browser/components/first-steps.d.ts +3 -0
- package/esm/browser/components/first-steps.js +36 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/list-rows.d.ts +1 -1
- package/esm/browser/components/list-rows.js +1 -1
- package/esm/browser/components/me-rows.d.ts +8 -1
- package/esm/browser/components/me-rows.js +3 -3
- package/esm/browser/components/me-view.js +1 -1
- package/esm/browser/components/message-user.js +6 -3
- package/esm/browser/components/model-picker.d.ts +5 -0
- package/esm/browser/components/model-picker.js +10 -1
- package/esm/browser/components/nav-places.d.ts +14 -0
- package/esm/browser/components/nav-places.js +11 -0
- package/esm/browser/components/phone-hint.d.ts +6 -0
- package/esm/browser/components/phone-hint.js +63 -0
- package/esm/browser/components/relay-view-util.d.ts +5 -0
- package/esm/browser/components/relay-view-util.js +14 -0
- package/esm/browser/components/relay-view.js +11 -7
- package/esm/browser/components/session-view.js +2 -1
- package/esm/browser/components/settings-choices.js +2 -0
- package/esm/browser/components/settings-controls.d.ts +15 -0
- package/esm/browser/components/settings-controls.js +13 -0
- package/esm/browser/components/settings-more.js +1 -0
- package/esm/browser/components/settings-parts.d.ts +3 -1
- package/esm/browser/components/settings-parts.js +3 -0
- package/esm/browser/components/settings-view.js +37 -11
- package/esm/browser/device/app-update.d.ts +62 -0
- package/esm/browser/device/app-update.js +144 -0
- package/esm/browser/extension/icons.js +2 -1
- package/esm/browser/extension/web-api-contributions.d.ts +6 -1
- package/esm/browser/extension/web-api-partners.d.ts +6 -0
- package/esm/browser/extension/web-api-spec.js +1 -0
- package/esm/browser/extension/web-home.js +9 -0
- package/esm/browser/extension/web-metrics.d.ts +3 -0
- package/esm/browser/extension/web-metrics.js +33 -22
- package/esm/browser/extension/web-pages.d.ts +3 -1
- package/esm/browser/extension/web-pages.js +1 -0
- package/esm/browser/i18n/en/account.d.ts +7 -0
- package/esm/browser/i18n/en/account.js +13 -6
- package/esm/browser/i18n/en/chat.d.ts +2 -0
- package/esm/browser/i18n/en/chat.js +2 -0
- package/esm/browser/i18n/en/discover.d.ts +3 -0
- package/esm/browser/i18n/en/discover.js +3 -0
- package/esm/browser/i18n/en/service.d.ts +8 -0
- package/esm/browser/i18n/en/service.js +8 -0
- package/esm/browser/i18n/en/settings.d.ts +3 -0
- package/esm/browser/i18n/en/settings.js +3 -0
- package/esm/browser/i18n/ja/account.js +13 -6
- package/esm/browser/i18n/ja/chat.js +2 -0
- package/esm/browser/i18n/ja/discover.js +3 -0
- package/esm/browser/i18n/ja/service.js +8 -0
- package/esm/browser/i18n/ja/settings.js +3 -0
- package/esm/browser/i18n/locales.d.ts +24 -1
- package/esm/browser/i18n/messages.d.ts +23 -0
- package/esm/browser/i18n/zh/account.js +13 -6
- package/esm/browser/i18n/zh/chat.js +2 -0
- package/esm/browser/i18n/zh/discover.js +3 -0
- package/esm/browser/i18n/zh/service.js +8 -0
- package/esm/browser/i18n/zh/settings.js +3 -0
- package/esm/browser/i18n/zh-tw/account.js +13 -6
- package/esm/browser/i18n/zh-tw/chat.js +2 -0
- package/esm/browser/i18n/zh-tw/discover.js +3 -0
- package/esm/browser/i18n/zh-tw/service.js +8 -0
- package/esm/browser/i18n/zh-tw/settings.js +3 -0
- package/esm/browser/notices/notices.d.ts +2 -0
- package/esm/browser/notices/notices.js +2 -0
- package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/esm/browser/settings/settings-protocol.d.ts +5 -0
- package/esm/browser/settings/settings-protocol.js +2 -0
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation-column.js +4 -0
- package/esm/browser/style/dialogs.d.ts +1 -1
- package/esm/browser/style/dialogs.js +7 -0
- package/esm/browser/style/skins.d.ts +1 -1
- package/esm/browser/style/skins.js +1 -1
- package/lib/browser/assistant/assistant-view.js +2 -1
- package/lib/browser/chat/chat-protocol.d.ts +7 -0
- package/lib/browser/chat/chat-view.js +3 -2
- package/lib/browser/chat/chat.d.ts +1 -0
- package/lib/browser/chat/chat.js +14 -2
- package/lib/browser/chat/draft-model.d.ts +1 -1
- package/lib/browser/chat/draft-model.js +2 -2
- package/lib/browser/components/account-menu.d.ts +2 -0
- package/lib/browser/components/account-menu.js +10 -1
- package/lib/browser/components/app-nav.js +3 -0
- package/lib/browser/components/app-shell-state.js +11 -0
- package/lib/browser/components/app-update-view.d.ts +3 -0
- package/lib/browser/components/app-update-view.js +73 -0
- package/lib/browser/components/app-view.js +21 -1
- package/lib/browser/components/auth-guide.d.ts +26 -0
- package/lib/browser/components/auth-guide.js +47 -0
- package/lib/browser/components/auth-view.d.ts +2 -0
- package/lib/browser/components/auth-view.js +29 -8
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/custom-provider-util.d.ts +2 -0
- package/lib/browser/components/custom-provider-util.js +5 -0
- package/lib/browser/components/custom-provider-view.js +30 -9
- package/lib/browser/components/discover-view.d.ts +8 -1
- package/lib/browser/components/discover-view.js +27 -2
- package/lib/browser/components/extension-settings.js +1 -0
- package/lib/browser/components/first-steps-util.d.ts +60 -0
- package/lib/browser/components/first-steps-util.js +77 -0
- package/lib/browser/components/first-steps.d.ts +4 -0
- package/lib/browser/components/first-steps.js +72 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/list-rows.d.ts +1 -1
- package/lib/browser/components/list-rows.js +1 -1
- package/lib/browser/components/me-rows.d.ts +8 -1
- package/lib/browser/components/me-rows.js +3 -3
- package/lib/browser/components/me-view.js +1 -1
- package/lib/browser/components/message-user.js +5 -2
- package/lib/browser/components/model-picker.d.ts +5 -0
- package/lib/browser/components/model-picker.js +10 -1
- package/lib/browser/components/nav-places.d.ts +14 -0
- package/lib/browser/components/nav-places.js +13 -1
- package/lib/browser/components/phone-hint.d.ts +7 -0
- package/lib/browser/components/phone-hint.js +99 -0
- package/lib/browser/components/relay-view-util.d.ts +6 -0
- package/lib/browser/components/relay-view-util.js +17 -0
- package/lib/browser/components/relay-view.js +10 -6
- package/lib/browser/components/session-view.js +2 -1
- package/lib/browser/components/settings-choices.js +2 -0
- package/lib/browser/components/settings-controls.d.ts +15 -0
- package/lib/browser/components/settings-controls.js +13 -0
- package/lib/browser/components/settings-more.js +1 -0
- package/lib/browser/components/settings-parts.d.ts +3 -1
- package/lib/browser/components/settings-parts.js +3 -0
- package/lib/browser/components/settings-view.js +36 -10
- package/lib/browser/device/app-update.d.ts +63 -0
- package/lib/browser/device/app-update.js +182 -0
- package/lib/browser/extension/icons.js +1 -0
- package/lib/browser/extension/web-api-contributions.d.ts +6 -1
- package/lib/browser/extension/web-api-partners.d.ts +6 -0
- package/lib/browser/extension/web-api-spec.js +1 -0
- package/lib/browser/extension/web-home.js +9 -0
- package/lib/browser/extension/web-metrics.d.ts +3 -0
- package/lib/browser/extension/web-metrics.js +32 -21
- package/lib/browser/extension/web-pages.d.ts +3 -1
- package/lib/browser/extension/web-pages.js +1 -0
- package/lib/browser/i18n/en/account.d.ts +7 -0
- package/lib/browser/i18n/en/account.js +13 -6
- package/lib/browser/i18n/en/chat.d.ts +2 -0
- package/lib/browser/i18n/en/chat.js +2 -0
- package/lib/browser/i18n/en/discover.d.ts +3 -0
- package/lib/browser/i18n/en/discover.js +3 -0
- package/lib/browser/i18n/en/service.d.ts +8 -0
- package/lib/browser/i18n/en/service.js +8 -0
- package/lib/browser/i18n/en/settings.d.ts +3 -0
- package/lib/browser/i18n/en/settings.js +3 -0
- package/lib/browser/i18n/ja/account.js +13 -6
- package/lib/browser/i18n/ja/chat.js +2 -0
- package/lib/browser/i18n/ja/discover.js +3 -0
- package/lib/browser/i18n/ja/service.js +8 -0
- package/lib/browser/i18n/ja/settings.js +3 -0
- package/lib/browser/i18n/locales.d.ts +24 -1
- package/lib/browser/i18n/messages.d.ts +23 -0
- package/lib/browser/i18n/zh/account.js +13 -6
- package/lib/browser/i18n/zh/chat.js +2 -0
- package/lib/browser/i18n/zh/discover.js +3 -0
- package/lib/browser/i18n/zh/service.js +8 -0
- package/lib/browser/i18n/zh/settings.js +3 -0
- package/lib/browser/i18n/zh-tw/account.js +13 -6
- package/lib/browser/i18n/zh-tw/chat.js +2 -0
- package/lib/browser/i18n/zh-tw/discover.js +3 -0
- package/lib/browser/i18n/zh-tw/service.js +8 -0
- package/lib/browser/i18n/zh-tw/settings.js +3 -0
- package/lib/browser/notices/notices.d.ts +2 -0
- package/lib/browser/notices/notices.js +3 -1
- package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/lib/browser/settings/settings-protocol.d.ts +5 -0
- package/lib/browser/settings/settings-protocol.js +2 -0
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation-column.js +4 -0
- package/lib/browser/style/dialogs.d.ts +1 -1
- package/lib/browser/style/dialogs.js +7 -0
- package/lib/browser/style/skins.d.ts +1 -1
- package/lib/browser/style/skins.js +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A line above the message box after a newcomer's first conversation was answered: Ta is on the phone too, a tap shows
|
|
4
|
+
* the code to scan (RelayDialog). Once (FirstStepsUtil.phoneHint), kept for the user on every device.
|
|
5
|
+
*/
|
|
6
|
+
export declare function PhoneHint(): React.JSX.Element;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useInject } from '@celljs/react';
|
|
2
|
+
import { TA_OWNER } from '@celljs/ta-protocol';
|
|
3
|
+
import { Smartphone, X } from 'lucide-react';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { useDevice } from '../device/device.js';
|
|
6
|
+
import { WebMetrics } from '../extension/web-metrics.js';
|
|
7
|
+
import { usePersisted, useWorkbench } from '../hooks.js';
|
|
8
|
+
import { useT } from '../i18n/use-t.js';
|
|
9
|
+
import { TaState } from '../state/state-protocol.js';
|
|
10
|
+
import { FirstStepsUtil } from './first-steps-util.js';
|
|
11
|
+
import { Icon, IconButton } from './icon.js';
|
|
12
|
+
import { MessagePeople } from './people.js';
|
|
13
|
+
import { RelayDialog } from './relay-view.js';
|
|
14
|
+
/**
|
|
15
|
+
* A line above the message box after a newcomer's first conversation was answered: Ta is on the phone too, a tap shows
|
|
16
|
+
* the code to scan (RelayDialog). Once (FirstStepsUtil.phoneHint), kept for the user on every device.
|
|
17
|
+
*/
|
|
18
|
+
export function PhoneHint() {
|
|
19
|
+
var _a;
|
|
20
|
+
const t = useT();
|
|
21
|
+
const handheld = useDevice(device => device.handheld);
|
|
22
|
+
const state = useInject(TaState);
|
|
23
|
+
const [workbench, bench] = useWorkbench();
|
|
24
|
+
const [kept, setKept] = usePersisted(FirstStepsUtil.STATE);
|
|
25
|
+
const [loaded, setLoaded] = React.useState(false);
|
|
26
|
+
const [paired, setPaired] = React.useState();
|
|
27
|
+
const [pairing, setPairing] = React.useState(false);
|
|
28
|
+
// Pairing is the owner's: one let into their Ta (a collaborator, a guest) is not offered it.
|
|
29
|
+
const owner = React.useContext(MessagePeople).me === TA_OWNER;
|
|
30
|
+
const online = owner && workbench.status === 'online';
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
void state.load(FirstStepsUtil.STATE).then(() => setLoaded(true), () => undefined);
|
|
33
|
+
}, [state]);
|
|
34
|
+
// The phones paired, asked only once the line could show at all.
|
|
35
|
+
const candidate = loaded && online && FirstStepsUtil.phoneHint(kept, { handheld, paired: 0, now: Date.now() });
|
|
36
|
+
React.useEffect(() => {
|
|
37
|
+
if (candidate && paired === undefined) {
|
|
38
|
+
bench.relay.getRelay().then(info => setPaired(info.devices.length), () => undefined);
|
|
39
|
+
}
|
|
40
|
+
}, [candidate, paired, bench]);
|
|
41
|
+
const shown = candidate && paired !== undefined && FirstStepsUtil.phoneHint(kept, { handheld, paired, now: Date.now() });
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
if (shown && ((_a = kept.phone) === null || _a === void 0 ? void 0 : _a.at) === undefined) {
|
|
45
|
+
(_b = WebMetrics.current) === null || _b === void 0 ? void 0 : _b.own('step:phone-hint');
|
|
46
|
+
setKept(before => ({ ...before, phone: { ...before.phone, at: Date.now() } }));
|
|
47
|
+
}
|
|
48
|
+
}, [shown, (_a = kept.phone) === null || _a === void 0 ? void 0 : _a.at, setKept]);
|
|
49
|
+
const done = () => setKept(before => ({ ...before, phone: { ...before.phone, done: true } }));
|
|
50
|
+
return (React.createElement(React.Fragment, null,
|
|
51
|
+
shown && (React.createElement("div", { className: "ta-phone-hint" },
|
|
52
|
+
React.createElement(Icon, { icon: Smartphone, size: 14 }),
|
|
53
|
+
React.createElement("span", { className: "ta-ellipsis" }, t('ta.phoneHint.text')),
|
|
54
|
+
React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => {
|
|
55
|
+
var _a;
|
|
56
|
+
(_a = WebMetrics.current) === null || _a === void 0 ? void 0 : _a.own('step:phone-pair');
|
|
57
|
+
setPairing(true);
|
|
58
|
+
done();
|
|
59
|
+
} }, t('ta.phoneHint.pair')),
|
|
60
|
+
React.createElement(IconButton, { icon: X, label: t('ta.close'), onClick: done }))),
|
|
61
|
+
pairing && React.createElement(RelayDialog, { onClose: () => setPairing(false) })));
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=phone-hint.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { TaRelayDevice } from '@celljs/ta-protocol';
|
|
2
|
+
export declare namespace RelayViewUtil {
|
|
3
|
+
/** The name of the next device paired: `base`, numbered when one paired already has it (`Phone 2`). */
|
|
4
|
+
function nextName(base: string, devices: readonly Pick<TaRelayDevice, 'name'>[]): string;
|
|
5
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export var RelayViewUtil;
|
|
2
|
+
(function (RelayViewUtil) {
|
|
3
|
+
/** The name of the next device paired: `base`, numbered when one paired already has it (`Phone 2`). */
|
|
4
|
+
function nextName(base, devices) {
|
|
5
|
+
const taken = new Set(devices.map(device => device.name));
|
|
6
|
+
let name = base;
|
|
7
|
+
for (let n = 2; taken.has(name); n++) {
|
|
8
|
+
name = `${base} ${n}`;
|
|
9
|
+
}
|
|
10
|
+
return name;
|
|
11
|
+
}
|
|
12
|
+
RelayViewUtil.nextName = nextName;
|
|
13
|
+
})(RelayViewUtil || (RelayViewUtil = {}));
|
|
14
|
+
//# sourceMappingURL=relay-view-util.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TaServeChanges } from '@celljs/ta-protocol';
|
|
2
|
-
import {
|
|
2
|
+
import { RELAY_DOWNLOAD_PAGE } from '@celljs/ta-relay/lib/common/relay-protocol';
|
|
3
|
+
import { Copy, Download, Smartphone, Trash2, X } from 'lucide-react';
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
import { createPortal } from 'react-dom';
|
|
5
6
|
import { useBackLayer } from '../device/back-stack.js';
|
|
@@ -10,6 +11,7 @@ import { BusyMark, useBusy } from './busy.js';
|
|
|
10
11
|
import { Icon, IconButton } from './icon.js';
|
|
11
12
|
import { Picture } from './picture.js';
|
|
12
13
|
import { QrView } from './qr-view.js';
|
|
14
|
+
import { RelayViewUtil } from './relay-view-util.js';
|
|
13
15
|
import { useServeValue } from './serve-value.js';
|
|
14
16
|
import { Switch } from './settings-controls.js';
|
|
15
17
|
const RELAY_TOPICS = [TaServeChanges.RELAY];
|
|
@@ -46,7 +48,6 @@ export function RelayDialog({ onClose }) {
|
|
|
46
48
|
const [, bench] = useWorkbench();
|
|
47
49
|
const [, notices] = useNotices();
|
|
48
50
|
const [link, setLink] = React.useState();
|
|
49
|
-
const [name, setName] = React.useState('');
|
|
50
51
|
const [busy, run] = useBusy();
|
|
51
52
|
// Whether ta serve reached the relay shows as it does (TaServeChanges.RELAY), a moment after pairing.
|
|
52
53
|
const getRelay = React.useCallback(() => bench.relay.getRelay(), [bench]);
|
|
@@ -82,9 +83,9 @@ export function RelayDialog({ onClose }) {
|
|
|
82
83
|
return;
|
|
83
84
|
}
|
|
84
85
|
try {
|
|
85
|
-
|
|
86
|
+
// Named for the user, rather than asked: a name of the phone's, numbered (RelayViewUtil.nextName).
|
|
87
|
+
const paired = await bench.relay.pair((_a = info.relay) !== null && _a !== void 0 ? _a : info.defaultRelay, RelayViewUtil.nextName(t('ta.relay.phone'), info.devices));
|
|
86
88
|
setLink(paired.link);
|
|
87
|
-
setName('');
|
|
88
89
|
void load();
|
|
89
90
|
}
|
|
90
91
|
catch (error) {
|
|
@@ -117,6 +118,12 @@ export function RelayDialog({ onClose }) {
|
|
|
117
118
|
link ? (React.createElement("div", { className: "ta-relay-pairing" },
|
|
118
119
|
React.createElement(QrView, { text: link }),
|
|
119
120
|
React.createElement("p", null, t('ta.relay.scan')),
|
|
121
|
+
React.createElement("p", { className: "ta-relay-download" },
|
|
122
|
+
React.createElement(Icon, { icon: Download, size: 14 }),
|
|
123
|
+
React.createElement("span", null,
|
|
124
|
+
t('ta.relay.noApp'),
|
|
125
|
+
' ',
|
|
126
|
+
React.createElement("a", { href: RELAY_DOWNLOAD_PAGE, target: "_blank", rel: "noreferrer" }, t('ta.relay.download')))),
|
|
120
127
|
React.createElement("div", { className: "ta-auth-actions" },
|
|
121
128
|
React.createElement("button", { type: "button", className: "ta-button", onClick: () => void run(() => { var _a; return (_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText(link).catch(() => undefined); }) },
|
|
122
129
|
React.createElement(Icon, { icon: Copy, size: 15 }),
|
|
@@ -126,9 +133,6 @@ export function RelayDialog({ onClose }) {
|
|
|
126
133
|
React.createElement(RelayPicture, null),
|
|
127
134
|
React.createElement("p", null, t('ta.relay.hint')),
|
|
128
135
|
React.createElement("div", { className: "ta-relay-form" },
|
|
129
|
-
React.createElement("label", { className: "ta-field" },
|
|
130
|
-
React.createElement(Smartphone, { size: 15, strokeWidth: 1.75, "aria-hidden": "true" }),
|
|
131
|
-
React.createElement("input", { placeholder: t('ta.relay.phone'), value: name, onChange: event => setName(event.target.value) })),
|
|
132
136
|
React.createElement("button", { type: "button", className: busy ? 'ta-button ta-primary ta-busy' : 'ta-button ta-primary', "aria-busy": busy || undefined, disabled: !info, onClick: () => void run(pair) },
|
|
133
137
|
t('ta.relay.pair'),
|
|
134
138
|
React.createElement(BusyMark, { busy: busy }))))),
|
|
@@ -41,6 +41,7 @@ import { MessageImages } from './message-images.js';
|
|
|
41
41
|
import { ConversationSession, MessageList } from './message-list.js';
|
|
42
42
|
import { MovedNotice } from './moved-notice.js';
|
|
43
43
|
import { MessagePeople, PeopleFaces, PresenceLine, PresenceUtil } from './people.js';
|
|
44
|
+
import { PhoneHint } from './phone-hint.js';
|
|
44
45
|
import { useSessionSettings } from './session-settings.js';
|
|
45
46
|
import { TerminalArt } from './terminal-art.js';
|
|
46
47
|
import { useStopTimes } from './use-stop-times.js';
|
|
@@ -390,7 +391,7 @@ export function SessionView({ store, server, workspace, info, onClosed, onActivi
|
|
|
390
391
|
widgetsAt('aboveEditor'),
|
|
391
392
|
addons.above,
|
|
392
393
|
React.createElement(CallBar, { state: callState, call: call })),
|
|
393
|
-
React.createElement(Composer, { ref: composer, store: store, server: server, workspace: workspace, working: state.working, compacting: !!state.compacting, commands: settings.commands, cwd: info === null || info === void 0 ? void 0 : info.cwd, actions: composerActions, recentShots: recentShots, onStopTimed: stopTimed, onTyping: onTyping, draft: (info === null || info === void 0 ? void 0 : info.sessionFile) ? DraftPlaces.chat(info.sessionFile) : undefined, onTalkCall: callable && !callState.active ? talkCall(call) : undefined, talkCalls: talkCalls, onError: fail }),
|
|
394
|
+
React.createElement(Composer, { above: React.createElement(PhoneHint, null), ref: composer, store: store, server: server, workspace: workspace, working: state.working, compacting: !!state.compacting, commands: settings.commands, cwd: info === null || info === void 0 ? void 0 : info.cwd, actions: composerActions, recentShots: recentShots, onStopTimed: stopTimed, onTyping: onTyping, draft: (info === null || info === void 0 ? void 0 : info.sessionFile) ? DraftPlaces.chat(info.sessionFile) : undefined, onTalkCall: callable && !callState.active ? talkCall(call) : undefined, talkCalls: talkCalls, onError: fail }),
|
|
394
395
|
belowComposer,
|
|
395
396
|
widgetsAt('belowEditor'),
|
|
396
397
|
statuses.length > 0 && (React.createElement("div", { className: "ta-statusline" }, statuses.map(([key, text]) => (React.createElement(StatusChip, { key: key, text: text })))))))));
|
|
@@ -87,6 +87,8 @@ export function navigationRows(navigation, t) {
|
|
|
87
87
|
return t(navigation.setting.pinned.includes(id) ? 'ta.settings.navigation.overflow' : 'ta.settings.navigation.folded');
|
|
88
88
|
};
|
|
89
89
|
return [
|
|
90
|
+
row('all-features', [t('ta.settings.allFeatures'), t('ta.settings.allFeaturesHint'), t('ta.discover.all')], React.createElement(Row, { label: t('ta.settings.allFeatures'), description: t('ta.settings.allFeaturesHint') },
|
|
91
|
+
React.createElement(Switch, { label: t('ta.settings.allFeatures'), checked: !navigation.first, onChange: navigation.showAll }))),
|
|
90
92
|
...navigation.pages.map(page => {
|
|
91
93
|
const title = WebLabelUtil.text(page.title);
|
|
92
94
|
return row(`navigation:${page.id}`, [title, t('ta.settings.navigation')], React.createElement(Row, { label: title, description: where(page.id) },
|
|
@@ -65,6 +65,21 @@ export declare namespace SettingsViewUtil {
|
|
|
65
65
|
}, P extends {
|
|
66
66
|
sections: S[];
|
|
67
67
|
}>(parts: P[], query: string): P[];
|
|
68
|
+
/**
|
|
69
|
+
* The sections most people look for (`tier` common, docs/design/ta-simple.md 4.2), in their parts; the parts left.
|
|
70
|
+
* The others are a row away (More settings), and the search finds them.
|
|
71
|
+
*/
|
|
72
|
+
function common<S extends {
|
|
73
|
+
tier?: string;
|
|
74
|
+
}, P extends {
|
|
75
|
+
sections: S[];
|
|
76
|
+
}>(parts: P[]): P[];
|
|
77
|
+
/** How many sections `common` leaves out. */
|
|
78
|
+
function hidden(parts: readonly {
|
|
79
|
+
sections: readonly {
|
|
80
|
+
tier?: string;
|
|
81
|
+
}[];
|
|
82
|
+
}[]): number;
|
|
68
83
|
/**
|
|
69
84
|
* The sections in their parts, in the order of `groups`: a section without a group in the first, those of a part by
|
|
70
85
|
* `order` (default 0), in the order given for the same; parts without a section left out.
|
|
@@ -70,6 +70,19 @@ export var SettingsViewUtil;
|
|
|
70
70
|
.filter(part => part.sections.length > 0);
|
|
71
71
|
}
|
|
72
72
|
SettingsViewUtil.filter = filter;
|
|
73
|
+
/**
|
|
74
|
+
* The sections most people look for (`tier` common, docs/design/ta-simple.md 4.2), in their parts; the parts left.
|
|
75
|
+
* The others are a row away (More settings), and the search finds them.
|
|
76
|
+
*/
|
|
77
|
+
function common(parts) {
|
|
78
|
+
return parts.map(part => ({ ...part, sections: part.sections.filter(entry => entry.tier === 'common') })).filter(part => part.sections.length > 0);
|
|
79
|
+
}
|
|
80
|
+
SettingsViewUtil.common = common;
|
|
81
|
+
/** How many sections `common` leaves out. */
|
|
82
|
+
function hidden(parts) {
|
|
83
|
+
return parts.reduce((count, part) => count + part.sections.filter(entry => entry.tier !== 'common').length, 0);
|
|
84
|
+
}
|
|
85
|
+
SettingsViewUtil.hidden = hidden;
|
|
73
86
|
/**
|
|
74
87
|
* The sections in their parts, in the order of `groups`: a section without a group in the first, those of a part by
|
|
75
88
|
* `order` (default 0), in the order given for the same; parts without a section left out.
|
|
@@ -223,6 +223,7 @@ export function useMoreSections(onDialog) {
|
|
|
223
223
|
title: t('ta.settings.about'),
|
|
224
224
|
icon: Info,
|
|
225
225
|
order: 1000,
|
|
226
|
+
tier: 'common',
|
|
226
227
|
rows: workbench.server
|
|
227
228
|
? [
|
|
228
229
|
row('version', [t('ta.settings.version'), 'version'], React.createElement(Row, { label: t('ta.settings.version'), description: restartTa.update
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TaSettingsScope } from '@celljs/ta-protocol';
|
|
1
|
+
import { type TaSettingsScope, type TaTier } from '@celljs/ta-protocol';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import type { WebSettingsGroup } from '../extension/web-extension-api.js';
|
|
4
4
|
import type { Glyph } from './icon.js';
|
|
@@ -14,6 +14,8 @@ export interface SectionEntry {
|
|
|
14
14
|
order?: number;
|
|
15
15
|
/** A setting of pi's files, of the user or of the project: under the scope of its part (Part.lead). */
|
|
16
16
|
scoped?: boolean;
|
|
17
|
+
/** `common`: shown from the start; the others under More settings (SettingsViewUtil.common). */
|
|
18
|
+
tier?: TaTier;
|
|
17
19
|
}
|
|
18
20
|
export interface Part {
|
|
19
21
|
id: string;
|
|
@@ -39,6 +39,7 @@ export function useParts(scope, onScope, onDialog) {
|
|
|
39
39
|
id: 'appearance',
|
|
40
40
|
title: t('ta.settings.appearance'),
|
|
41
41
|
icon: Palette,
|
|
42
|
+
tier: 'common',
|
|
42
43
|
rows: [
|
|
43
44
|
row('theme', [t('ta.settings.theme'), 'theme'], React.createElement(Row, { label: t('ta.settings.theme'), stacked: true },
|
|
44
45
|
React.createElement(Segmented, { label: t('ta.settings.theme'), value: settings.theme, choices: THEMES, onChange: theme => store.update({ theme }) }))),
|
|
@@ -72,6 +73,7 @@ export function useParts(scope, onScope, onDialog) {
|
|
|
72
73
|
id: 'language',
|
|
73
74
|
title: t('ta.settings.language'),
|
|
74
75
|
icon: Languages,
|
|
76
|
+
tier: 'common',
|
|
75
77
|
// A phone has no room for five names side by side: a row each, as its own settings have them.
|
|
76
78
|
rows: handheld
|
|
77
79
|
? LANGUAGES.map(choice => {
|
|
@@ -185,6 +187,7 @@ export function useParts(scope, onScope, onDialog) {
|
|
|
185
187
|
icon: (_a = GROUP_ICONS[group.id]) !== null && _a !== void 0 ? _a : Wrench,
|
|
186
188
|
group: 'ta',
|
|
187
189
|
scoped: true,
|
|
190
|
+
...(group.id === 'model' ? { tier: 'common' } : {}),
|
|
188
191
|
rows: snapshot
|
|
189
192
|
? group.keys.flatMap(key => {
|
|
190
193
|
const spec = AgentSettingsUtil.spec(key);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { ChevronLeft, Menu, Search, X } from 'lucide-react';
|
|
1
|
+
import { ChevronLeft, Menu, Search, Settings2, X } from 'lucide-react';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useDevice } from '../device/device.js';
|
|
4
|
+
import { WebMetrics } from '../extension/web-metrics.js';
|
|
5
|
+
import { useSettings } from '../hooks.js';
|
|
4
6
|
import { useT } from '../i18n/use-t.js';
|
|
5
7
|
import { ScreenUtil } from '../screen/screen-protocol.js';
|
|
6
8
|
import { useScreenPart } from '../screen/use-screen-part.js';
|
|
@@ -27,6 +29,15 @@ export function SettingsView({ section, onClose, onMenu, onBack }) {
|
|
|
27
29
|
const [dialog, setDialog] = React.useState();
|
|
28
30
|
const closeDialog = React.useCallback(() => setDialog(undefined), []);
|
|
29
31
|
const parts = useParts(scope, setScope, setDialog);
|
|
32
|
+
const [{ settings }] = useSettings();
|
|
33
|
+
// The sections most people look for first, the others a row away (docs/design/ta-simple.md 4.2); all of them for a
|
|
34
|
+
// search, for one asked for that is not of those, and for one who has every feature shown.
|
|
35
|
+
const [more, setMore] = React.useState(false);
|
|
36
|
+
React.useEffect(() => { var _a; return (_a = WebMetrics.current) === null || _a === void 0 ? void 0 : _a.own(more ? 'page:settings-more' : 'page:settings'); }, [more]);
|
|
37
|
+
const asked = section !== undefined && parts.some(part => part.sections.some(entry => entry.id === section && entry.tier !== 'common'));
|
|
38
|
+
const all = settings.allFeatures || more || asked || !!query.trim();
|
|
39
|
+
const shownParts = all ? parts : SettingsViewUtil.common(parts);
|
|
40
|
+
const onMore = all || SettingsViewUtil.hidden(parts) === 0 ? undefined : () => setMore(true);
|
|
30
41
|
// What an agent reads of the settings and where it goes in them (docs/design/ta-app-use.md 3); the rows are read as they show.
|
|
31
42
|
useScreenPart({
|
|
32
43
|
id: 'settings',
|
|
@@ -40,6 +51,9 @@ export function SettingsView({ section, onClose, onMenu, onBack }) {
|
|
|
40
51
|
var _a;
|
|
41
52
|
var _b, _c;
|
|
42
53
|
const entry = parts.flatMap(part => part.sections).find(candidate => candidate.id === id);
|
|
54
|
+
if (entry && entry.tier !== 'common' && !all) {
|
|
55
|
+
setMore(true);
|
|
56
|
+
}
|
|
43
57
|
const root = document.querySelector('[data-ta-part="settings"]');
|
|
44
58
|
const link = (_b = root === null || root === void 0 ? void 0 : root.querySelector(`[data-ta-item="${CSS.escape(id !== null && id !== void 0 ? id : '')}"]`)) !== null && _b !== void 0 ? _b : [...((_c = root === null || root === void 0 ? void 0 : root.querySelectorAll('.ta-list-main')) !== null && _c !== void 0 ? _c : [])].find(button => { var _a; return ((_a = button.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === (entry === null || entry === void 0 ? void 0 : entry.title); });
|
|
45
59
|
if (link) {
|
|
@@ -62,11 +76,17 @@ export function SettingsView({ section, onClose, onMenu, onBack }) {
|
|
|
62
76
|
React.createElement(Icon, { icon: Search, size: 14 }),
|
|
63
77
|
React.createElement("input", { value: query, placeholder: t('ta.settings.search'), "aria-label": t('ta.settings.search'), onChange: event => setQuery(event.target.value) }),
|
|
64
78
|
query && React.createElement(IconButton, { icon: X, label: t('ta.close'), onClick: () => setQuery('') })));
|
|
65
|
-
const props = { parts, query, search, section };
|
|
79
|
+
const props = { parts: shownParts, query, search, section, onMore };
|
|
66
80
|
return (React.createElement("section", { className: "ta-settings-page", "aria-label": t('ta.settings'), ...ScreenUtil.part('settings') },
|
|
67
81
|
handheld ? React.createElement(PhoneSettings, { ...props, onBack: onBack !== null && onBack !== void 0 ? onBack : onClose }) : React.createElement(WideSettings, { ...props, onClose: onClose, onMenu: onMenu, onBack: onBack }),
|
|
68
82
|
dialog === 'directory' && React.createElement(WorkingDirectoryPicker, { onClose: closeDialog })));
|
|
69
83
|
}
|
|
84
|
+
/** The row under the sections that shows the others. */
|
|
85
|
+
function MoreRow({ onMore }) {
|
|
86
|
+
const t = useT();
|
|
87
|
+
return (React.createElement(ListGroup, null,
|
|
88
|
+
React.createElement(ListRow, { icon: Settings2, label: t('ta.settings.more'), onClick: onMore })));
|
|
89
|
+
}
|
|
70
90
|
/** The rows of a section, in a card. */
|
|
71
91
|
function SectionRows({ entry }) {
|
|
72
92
|
return entry.rows.length > 0 ? (React.createElement("div", { className: "ta-setting-card" }, entry.rows.map(candidate => (React.createElement(React.Fragment, { key: candidate.key }, candidate.node))))) : null;
|
|
@@ -77,7 +97,7 @@ function SectionRows({ entry }) {
|
|
|
77
97
|
* packages, the settings of ta) and grows, until the user scrolls; marked on the left even when the page
|
|
78
98
|
* cannot scroll it to the top.
|
|
79
99
|
*/
|
|
80
|
-
function WideSettings({ parts, query, search, section, onClose, onMenu, onBack }) {
|
|
100
|
+
function WideSettings({ parts, query, search, section, onMore, onClose, onMenu, onBack }) {
|
|
81
101
|
const t = useT();
|
|
82
102
|
const [active, setActive] = React.useState(section !== null && section !== void 0 ? section : 'appearance');
|
|
83
103
|
const scroller = React.useRef(null);
|
|
@@ -149,11 +169,15 @@ function WideSettings({ parts, query, search, section, onClose, onMenu, onBack }
|
|
|
149
169
|
search,
|
|
150
170
|
onMenu && React.createElement(IconButton, { icon: X, label: t('ta.close'), onClick: onClose })),
|
|
151
171
|
React.createElement("div", { className: "ta-settings-body" },
|
|
152
|
-
React.createElement("nav", { className: "ta-settings-toc", "aria-label": t('ta.settings') },
|
|
153
|
-
React.createElement("
|
|
154
|
-
|
|
155
|
-
React.createElement(
|
|
156
|
-
|
|
172
|
+
React.createElement("nav", { className: "ta-settings-toc", "aria-label": t('ta.settings') },
|
|
173
|
+
shown.map(part => (React.createElement("div", { key: part.id, className: "ta-settings-toc-part" },
|
|
174
|
+
React.createElement("button", { type: "button", className: "ta-settings-toc-group", onClick: () => go(part.sections[0].id, 'smooth') }, part.title),
|
|
175
|
+
part.sections.map(entry => (React.createElement("button", { key: entry.id, type: "button", className: `ta-settings-toc-item${active === entry.id ? ' ta-active' : ''}`, "aria-current": active === entry.id || undefined, onClick: () => go(entry.id, 'smooth'), ...ScreenUtil.item(entry.id) },
|
|
176
|
+
React.createElement(Icon, { icon: entry.icon, size: 14 }),
|
|
177
|
+
React.createElement("span", { className: "ta-ellipsis" }, entry.title))))))),
|
|
178
|
+
onMore && (React.createElement("button", { type: "button", className: "ta-settings-toc-item", onClick: onMore },
|
|
179
|
+
React.createElement(Icon, { icon: Settings2, size: 14 }),
|
|
180
|
+
React.createElement("span", { className: "ta-ellipsis" }, t('ta.settings.more'))))),
|
|
157
181
|
React.createElement("div", { className: "ta-settings-scroll", ref: scroller, onScroll: onScroll },
|
|
158
182
|
React.createElement("div", { className: "ta-settings-content", ref: content },
|
|
159
183
|
shown.length === 0 && React.createElement(EmptyState, { title: t('ta.settings.noMatch', { query: query.trim() }) }),
|
|
@@ -166,7 +190,8 @@ function WideSettings({ parts, query, search, section, onClose, onMenu, onBack }
|
|
|
166
190
|
React.createElement(Icon, { icon: entry.icon, size: 13 }),
|
|
167
191
|
" ",
|
|
168
192
|
entry.title),
|
|
169
|
-
React.createElement(SectionRows, { entry: entry })))); }))))
|
|
193
|
+
React.createElement(SectionRows, { entry: entry })))); })))),
|
|
194
|
+
onMore && React.createElement(MoreRow, { onMore: onMore }))))));
|
|
170
195
|
}
|
|
171
196
|
/** A page of a phone: its head, with the way back and its title, over a list. */
|
|
172
197
|
function PhonePage({ title, onBack, children }) {
|
|
@@ -192,7 +217,7 @@ function PhoneSection({ part, entry, onBack }) {
|
|
|
192
217
|
* section tapped pushed over it as a page of its own; a search lists the rows that match in place. A section
|
|
193
218
|
* Me opened (the theme, the language, about) is that page alone, and back goes to Me.
|
|
194
219
|
*/
|
|
195
|
-
function PhoneSettings({ parts, query, search, section, onBack }) {
|
|
220
|
+
function PhoneSettings({ parts, query, search, section, onMore, onBack }) {
|
|
196
221
|
const t = useT();
|
|
197
222
|
/** The section pushed over the list, kept while it slides away. */
|
|
198
223
|
const [pushed, setPushed] = React.useState();
|
|
@@ -221,7 +246,8 @@ function PhoneSettings({ parts, query, search, section, onBack }) {
|
|
|
221
246
|
React.createElement(SectionRows, { entry: entry })))))
|
|
222
247
|
: parts.map(part => (React.createElement("section", { key: part.id, className: "ta-settings-phone-group", "aria-label": part.title },
|
|
223
248
|
React.createElement("h2", { className: "ta-settings-phone-caption" }, part.title),
|
|
224
|
-
React.createElement(ListGroup, null, part.sections.map(entry => (React.createElement(ListRow, { key: entry.id, icon: entry.icon, label: entry.title, onClick: () => setPushed({ id: entry.id, open: true }) })))))))
|
|
249
|
+
React.createElement(ListGroup, null, part.sections.map(entry => (React.createElement(ListRow, { key: entry.id, icon: entry.icon, label: entry.title, onClick: () => setPushed({ id: entry.id, open: true }) }))))))),
|
|
250
|
+
!query.trim() && onMore && React.createElement(MoreRow, { onMore: onMore })));
|
|
225
251
|
return React.createElement(PhoneStack, { base: list, top: top && React.createElement(PhoneSection, { ...top, onBack: close }), open: !!top && !!(pushed === null || pushed === void 0 ? void 0 : pushed.open), onClose: close });
|
|
226
252
|
}
|
|
227
253
|
//# sourceMappingURL=settings-view.js.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a build of the phone app says of where its new versions are: `ta-app.json` beside its page. The iPhone app
|
|
3
|
+
* signed for the company has it, written in as it is signed (apps/ta-mobile/scripts/package.ts), and installs its new
|
|
4
|
+
* versions from the internal download page with a tap; the other builds (signed by whoever installs them, Android, a
|
|
5
|
+
* browser) have none, and are told of nothing.
|
|
6
|
+
*/
|
|
7
|
+
export interface AppUpdateSource {
|
|
8
|
+
/** The manifest of the download page, latest.json: version, build and the files of each system. */
|
|
9
|
+
updates: string;
|
|
10
|
+
/** This build's system as the manifest names it: `ios-arm64`. */
|
|
11
|
+
target: string;
|
|
12
|
+
version: string;
|
|
13
|
+
build: number;
|
|
14
|
+
}
|
|
15
|
+
/** A newer build of the app: its version, and the link that installs it. */
|
|
16
|
+
export interface AppUpdateOffer {
|
|
17
|
+
version: string;
|
|
18
|
+
build: number;
|
|
19
|
+
link: string;
|
|
20
|
+
}
|
|
21
|
+
/** What the updates read of the app; tests give their own. */
|
|
22
|
+
export interface AppUpdateEnvironment {
|
|
23
|
+
/** ta-app.json of the app, parsed; undefined where there is none. */
|
|
24
|
+
own(): Promise<unknown>;
|
|
25
|
+
/** The manifest at the address, parsed; throws when it cannot be read (offline, outside the company's network). */
|
|
26
|
+
get(url: string): Promise<unknown>;
|
|
27
|
+
/** Calls the listener each time the app comes back to the front. */
|
|
28
|
+
onForeground(listener: () => void): void;
|
|
29
|
+
/** Opens the link: the system asks the user to install. */
|
|
30
|
+
open(link: string): void;
|
|
31
|
+
}
|
|
32
|
+
export declare namespace AppUpdateUtil {
|
|
33
|
+
const FILE = "ta-app.json";
|
|
34
|
+
function source(value: unknown): AppUpdateSource | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* The build of the manifest when it is newer than the app's, with the link that installs it: the itms-services link
|
|
37
|
+
* the manifest gives (iOS), else the address of its file; either only of the site of the manifest.
|
|
38
|
+
*/
|
|
39
|
+
function offer(source: AppUpdateSource, manifest: unknown): AppUpdateOffer | undefined;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Newer versions of the phone app that does not update itself (the iPhone app signed for the company): read from the
|
|
43
|
+
* manifest of its download page as the app starts and each time it comes back to the front, and installed with a tap
|
|
44
|
+
* (the system asks, then puts the new version in its place, nothing lost). Nothing where the app does not say where its
|
|
45
|
+
* new versions are (AppUpdateSource); one not read (offline, outside the company's network) leaves what was known.
|
|
46
|
+
*/
|
|
47
|
+
export declare class AppUpdates {
|
|
48
|
+
protected readonly environment: () => AppUpdateEnvironment | undefined;
|
|
49
|
+
protected current?: AppUpdateOffer;
|
|
50
|
+
protected started: boolean;
|
|
51
|
+
protected source?: Promise<AppUpdateSource | undefined>;
|
|
52
|
+
protected readonly listeners: Set<() => void>;
|
|
53
|
+
constructor(environment?: () => AppUpdateEnvironment | undefined);
|
|
54
|
+
get offer(): AppUpdateOffer | undefined;
|
|
55
|
+
subscribe(listener: () => void): () => void;
|
|
56
|
+
start(): void;
|
|
57
|
+
install(): void;
|
|
58
|
+
protected check(env: AppUpdateEnvironment): Promise<void>;
|
|
59
|
+
}
|
|
60
|
+
export declare const AppUpdate: AppUpdates;
|
|
61
|
+
/** The newer version of the phone app to install, while there is one. */
|
|
62
|
+
export declare function useAppUpdate(): AppUpdateOffer | undefined;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { nativePlugin } from './device.js';
|
|
3
|
+
export var AppUpdateUtil;
|
|
4
|
+
(function (AppUpdateUtil) {
|
|
5
|
+
AppUpdateUtil.FILE = 'ta-app.json';
|
|
6
|
+
function source(value) {
|
|
7
|
+
const one = value;
|
|
8
|
+
if (!one || typeof one !== 'object' || typeof one.updates !== 'string' || !one.updates.startsWith('https://')) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
if (typeof one.target !== 'string' || typeof one.version !== 'string' || !Number.isFinite(one.build)) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
return { updates: one.updates, target: one.target, version: one.version, build: Number(one.build) };
|
|
15
|
+
}
|
|
16
|
+
AppUpdateUtil.source = source;
|
|
17
|
+
/**
|
|
18
|
+
* The build of the manifest when it is newer than the app's, with the link that installs it: the itms-services link
|
|
19
|
+
* the manifest gives (iOS), else the address of its file; either only of the site of the manifest.
|
|
20
|
+
*/
|
|
21
|
+
function offer(source, manifest) {
|
|
22
|
+
var _a;
|
|
23
|
+
const one = manifest;
|
|
24
|
+
const file = (_a = one === null || one === void 0 ? void 0 : one.files) === null || _a === void 0 ? void 0 : _a[source.target];
|
|
25
|
+
if (typeof (one === null || one === void 0 ? void 0 : one.version) !== 'string' || typeof one.build !== 'number' || !(one.build > source.build) || !file) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
const link = linkOf(source.updates, file);
|
|
29
|
+
return link ? { version: one.version, build: one.build, link } : undefined;
|
|
30
|
+
}
|
|
31
|
+
AppUpdateUtil.offer = offer;
|
|
32
|
+
function linkOf(updates, file) {
|
|
33
|
+
var _a;
|
|
34
|
+
const site = new URL(updates).origin;
|
|
35
|
+
if (typeof file.install === 'string') {
|
|
36
|
+
const install = parse(file.install);
|
|
37
|
+
const manifest = (install === null || install === void 0 ? void 0 : install.protocol) === 'itms-services:' ? parse((_a = install.searchParams.get('url')) !== null && _a !== void 0 ? _a : '') : undefined;
|
|
38
|
+
return (manifest === null || manifest === void 0 ? void 0 : manifest.origin) === site ? file.install : undefined;
|
|
39
|
+
}
|
|
40
|
+
const at = typeof file.path === 'string' ? parse(file.path, updates) : undefined;
|
|
41
|
+
return (at === null || at === void 0 ? void 0 : at.origin) === site ? at.href : undefined;
|
|
42
|
+
}
|
|
43
|
+
function parse(url, base) {
|
|
44
|
+
try {
|
|
45
|
+
return new URL(url, base);
|
|
46
|
+
}
|
|
47
|
+
catch (_a) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
})(AppUpdateUtil || (AppUpdateUtil = {}));
|
|
52
|
+
/**
|
|
53
|
+
* Newer versions of the phone app that does not update itself (the iPhone app signed for the company): read from the
|
|
54
|
+
* manifest of its download page as the app starts and each time it comes back to the front, and installed with a tap
|
|
55
|
+
* (the system asks, then puts the new version in its place, nothing lost). Nothing where the app does not say where its
|
|
56
|
+
* new versions are (AppUpdateSource); one not read (offline, outside the company's network) leaves what was known.
|
|
57
|
+
*/
|
|
58
|
+
export class AppUpdates {
|
|
59
|
+
constructor(environment = browser) {
|
|
60
|
+
this.environment = environment;
|
|
61
|
+
this.started = false;
|
|
62
|
+
this.listeners = new Set();
|
|
63
|
+
}
|
|
64
|
+
get offer() {
|
|
65
|
+
this.start();
|
|
66
|
+
return this.current;
|
|
67
|
+
}
|
|
68
|
+
subscribe(listener) {
|
|
69
|
+
this.listeners.add(listener);
|
|
70
|
+
return () => this.listeners.delete(listener);
|
|
71
|
+
}
|
|
72
|
+
start() {
|
|
73
|
+
if (this.started) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this.started = true;
|
|
77
|
+
const env = this.environment();
|
|
78
|
+
if (!env) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
void this.check(env);
|
|
82
|
+
env.onForeground(() => void this.check(env));
|
|
83
|
+
}
|
|
84
|
+
install() {
|
|
85
|
+
var _a;
|
|
86
|
+
if (this.current) {
|
|
87
|
+
(_a = this.environment()) === null || _a === void 0 ? void 0 : _a.open(this.current.link);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async check(env) {
|
|
91
|
+
var _a;
|
|
92
|
+
var _b;
|
|
93
|
+
(_b = this.source) !== null && _b !== void 0 ? _b : (this.source = env.own().then(AppUpdateUtil.source, () => undefined));
|
|
94
|
+
const source = await this.source;
|
|
95
|
+
if (!source) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const manifest = await env.get(source.updates).catch(() => undefined);
|
|
99
|
+
if (manifest === undefined) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const offer = AppUpdateUtil.offer(source, manifest);
|
|
103
|
+
if ((offer === null || offer === void 0 ? void 0 : offer.build) !== ((_a = this.current) === null || _a === void 0 ? void 0 : _a.build)) {
|
|
104
|
+
this.current = offer;
|
|
105
|
+
for (const listener of this.listeners) {
|
|
106
|
+
listener();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** The Ta app (Capacitor): its own file read from its page, the manifest by its HTTP plugin (no CORS there); none in a browser. */
|
|
112
|
+
function browser() {
|
|
113
|
+
const http = typeof window === 'undefined' ? undefined : nativePlugin('CapacitorHttp');
|
|
114
|
+
if (!http) {
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
own: async () => {
|
|
119
|
+
const response = await fetch(new URL(AppUpdateUtil.FILE, document.baseURI), { cache: 'no-store' });
|
|
120
|
+
return response.ok ? response.json() : undefined;
|
|
121
|
+
},
|
|
122
|
+
get: async (url) => {
|
|
123
|
+
const response = (await http('get', { url, responseType: 'json', headers: { 'Cache-Control': 'no-cache' } }));
|
|
124
|
+
if (!response || !(Number(response.status) < 400)) {
|
|
125
|
+
throw new Error(`${url}: ${response === null || response === void 0 ? void 0 : response.status}`);
|
|
126
|
+
}
|
|
127
|
+
return typeof response.data === 'string' ? JSON.parse(response.data) : response.data;
|
|
128
|
+
},
|
|
129
|
+
onForeground: listener => document.addEventListener('visibilitychange', () => {
|
|
130
|
+
if (document.visibilityState === 'visible') {
|
|
131
|
+
listener();
|
|
132
|
+
}
|
|
133
|
+
}),
|
|
134
|
+
open: link => {
|
|
135
|
+
window.location.href = link;
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export const AppUpdate = new AppUpdates();
|
|
140
|
+
/** The newer version of the phone app to install, while there is one. */
|
|
141
|
+
export function useAppUpdate() {
|
|
142
|
+
return React.useSyncExternalStore(listener => AppUpdate.subscribe(listener), () => AppUpdate.offer, () => undefined);
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=app-update.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlarmClock, AlignCenter, AlignLeft, AlignRight, Aperture, AppWindow, Archive, ArrowDown, ArrowDownToLine, ArrowDownWideNarrow, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, ArrowUpNarrowWide, Bell, BellOff, BetweenHorizontalStart, BetweenVerticalStart, Bold, BookOpen, Bot, Box, Bug, Building2, Calendar, Camera, CaseSensitive, ChartColumn, ChartSpline, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsDownUp, ChevronsUpDown, ChevronUp, Circle, CircleAlert, CircleArrowRight, CircleHelp, Clipboard, ClipboardPaste, Clock, Cloud, CloudUpload, Code, Coins, Columns2, Contact, Copy, CopyMinus, CornerDownRight, CornerUpLeft, Cpu, Crown, Database, Download, Ellipsis, Eraser, ExternalLink, Eye, File, FileArchive, FileDiff, FilePlus, Files, FileText, Film, FlaskConical, Folder, FolderInput, FolderLock, FolderOpen, FolderPlus, FolderSearch, FolderTree, Forward, Gamepad2, Gauge, GitBranch, GitCommitHorizontal, Globe, Grip, Hand, HardDrive, Hash, Headphones, Heart, House, Image, ImagePlus, Info, Keyboard, KeyRound, Laptop, LayoutDashboard, Lightbulb, Link, List, ListChecks, ListTodo, ListTree, ListX, LoaderCircle, LocateFixed, Lock, MapIcon, Maximize, Maximize2, Megaphone, MemoryStick, MessageCircle, MessageSquareDot, MessageSquareText, MessagesSquare, Mic, Minimize2, Minus, Monitor, MonitorSmartphone, MousePointer2, MousePointerClick, Navigation, Package, PackageOpen, PaintBucket, Paperclip, Pencil, Phone, Pin, PinOff, Play, Plus, Pointer, Power, Presentation, Puzzle, QrCode, Quote, Radar, RefreshCw, Regex, Replace, ReplaceAll, Rocket, RotateCcw, Rows2, Save, Scan, ScanLine, ScrollText, Search, Send, Server, Share2, Sheet, Shield, ShieldAlert, ShieldCheck, Shuffle, Sigma, SlidersHorizontal, Smartphone, Snowflake, Sparkles, Square, SquareMinus, SquarePlus, SquareTerminal, Star, StarOff, Store, TableCellsMerge, Target, Text, ThumbsDown, ThumbsUp, Timer, Trash2, TrendingDown, TrendingUp, Trophy, Undo2, Unplug, Upload, User, UserPlus, Users, Volume2, WholeWord, Wrench, X, Zap, } from 'lucide-react';
|
|
1
|
+
import { AlarmClock, AlignCenter, AlignLeft, AlignRight, Aperture, AppWindow, Archive, ArrowDown, ArrowDownToLine, ArrowDownWideNarrow, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, ArrowUpNarrowWide, Bell, BellOff, BetweenHorizontalStart, BetweenVerticalStart, Bold, BookOpen, Bot, Box, Bug, Building2, Calendar, Camera, CaseSensitive, ChartColumn, ChartSpline, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsDownUp, ChevronsUpDown, ChevronUp, Circle, CircleAlert, CircleArrowRight, CircleHelp, Clipboard, ClipboardPaste, Clock, Cloud, CloudUpload, Code, Coins, Columns2, Contact, Copy, CopyMinus, CornerDownRight, CornerUpLeft, Cpu, Crown, Database, Download, Ellipsis, Eraser, ExternalLink, Eye, EyeOff, File, FileArchive, FileDiff, FilePlus, Files, FileText, Film, FlaskConical, Folder, FolderInput, FolderLock, FolderOpen, FolderPlus, FolderSearch, FolderTree, Forward, Gamepad2, Gauge, GitBranch, GitCommitHorizontal, Globe, Grip, Hand, HardDrive, Hash, Headphones, Heart, House, Image, ImagePlus, Info, Keyboard, KeyRound, Laptop, LayoutDashboard, Lightbulb, Link, List, ListChecks, ListTodo, ListTree, ListX, LoaderCircle, LocateFixed, Lock, MapIcon, Maximize, Maximize2, Megaphone, MemoryStick, MessageCircle, MessageSquareDot, MessageSquareText, MessagesSquare, Mic, Minimize2, Minus, Monitor, MonitorSmartphone, MousePointer2, MousePointerClick, Navigation, Package, PackageOpen, PaintBucket, Paperclip, Pencil, Phone, Pin, PinOff, Play, Plus, Pointer, Power, Presentation, Puzzle, QrCode, Quote, Radar, RefreshCw, Regex, Replace, ReplaceAll, Rocket, RotateCcw, Rows2, Save, Scan, ScanLine, ScrollText, Search, Send, Server, Share2, Sheet, Shield, ShieldAlert, ShieldCheck, Shuffle, Sigma, SlidersHorizontal, Smartphone, Snowflake, Sparkles, Square, SquareMinus, SquarePlus, SquareTerminal, Star, StarOff, Store, TableCellsMerge, Target, Text, ThumbsDown, ThumbsUp, Timer, Trash2, TrendingDown, TrendingUp, Trophy, Undo2, Unplug, Upload, User, UserPlus, Users, Volume2, WholeWord, Wrench, X, Zap, } from 'lucide-react';
|
|
2
2
|
/** The icons a web extension gets as `pi.ui.icons`; names are lucide's. Only add: removing one breaks extensions. */
|
|
3
3
|
export const WEB_ICONS = Object.freeze({
|
|
4
4
|
AlignCenter,
|
|
@@ -67,6 +67,7 @@ export const WEB_ICONS = Object.freeze({
|
|
|
67
67
|
Ellipsis,
|
|
68
68
|
ExternalLink,
|
|
69
69
|
Eye,
|
|
70
|
+
EyeOff,
|
|
70
71
|
File,
|
|
71
72
|
FileArchive,
|
|
72
73
|
FileDiff,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Part of the web extension API (web-extension-api.ts, which exports it all): what an extension registers, and what the page tells it of them. */
|
|
2
|
-
import type { TaRoomInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import type { TaRoomInfo, TaTier } from '@celljs/ta-protocol';
|
|
3
3
|
import type * as React from 'react';
|
|
4
4
|
import type { WebIcon } from './web-extension-api.js';
|
|
5
5
|
export type * from './web-api-call.js';
|
|
@@ -23,6 +23,11 @@ export interface WebSettingsSection {
|
|
|
23
23
|
group?: WebSettingsGroup;
|
|
24
24
|
/** Smaller first among those of extensions in its group, then as registered; default 100 (negative: before Ta's). */
|
|
25
25
|
order?: number;
|
|
26
|
+
/**
|
|
27
|
+
* `common` for a section most people look for (docs/design/ta-simple.md 4.2), shown from the start; the others (the
|
|
28
|
+
* default) a row away, under More settings, and found by the search. Newer than some Ta apps, which show all.
|
|
29
|
+
*/
|
|
30
|
+
tier?: TaTier;
|
|
26
31
|
rows: WebSettingRow[];
|
|
27
32
|
/** A store of Settings → Storage (TaStorageInfo.id): its rows show under it there; older Ta apps list it as a section. */
|
|
28
33
|
storage?: string;
|