@celljs/ta-web 4.46.2 → 4.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/browser/account/account-side.d.ts +3 -3
- package/esm/browser/account/account-side.js +11 -21
- package/esm/browser/account/device-account.d.ts +8 -0
- package/esm/browser/account/device-account.js +20 -0
- package/esm/browser/chat/chat-protocol.d.ts +7 -0
- package/esm/browser/chat/chat-view.js +1 -1
- 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/access-view.js +12 -10
- package/esm/browser/components/account-menu.d.ts +2 -0
- package/esm/browser/components/account-menu.js +11 -2
- package/esm/browser/components/account-view.js +9 -5
- package/esm/browser/components/app-nav.js +4 -1
- package/esm/browser/components/app-shell-state.d.ts +2 -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 +33 -108
- 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/chat-list-controls.d.ts +38 -0
- package/esm/browser/components/chat-list-controls.js +46 -0
- package/esm/browser/components/chat-list-hooks.d.ts +19 -0
- package/esm/browser/components/chat-list-hooks.js +52 -0
- package/esm/browser/components/chat-list-rows.d.ts +51 -0
- package/esm/browser/components/chat-list-rows.js +110 -0
- package/esm/browser/components/chat-list-sections.d.ts +36 -0
- package/esm/browser/components/chat-list-sections.js +72 -0
- package/esm/browser/components/chat-list.js +48 -221
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/cloud-sign-in-view.js +4 -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 +33 -12
- package/esm/browser/components/device-sign-in-page.js +4 -5
- package/esm/browser/components/discover-view.d.ts +8 -1
- package/esm/browser/components/discover-view.js +28 -3
- package/esm/browser/components/environment-view.js +60 -62
- package/esm/browser/components/extension-settings.js +1 -0
- package/esm/browser/components/first-steps-util.d.ts +29 -0
- package/esm/browser/components/first-steps-util.js +41 -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 +3 -3
- package/esm/browser/components/host-view.js +11 -11
- 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-shell.d.ts +14 -0
- package/esm/browser/components/phone-shell.js +22 -0
- package/esm/browser/components/picture-dialog.js +4 -7
- package/esm/browser/components/profile-view.js +1 -1
- package/esm/browser/components/relay-services.js +4 -7
- 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 +40 -37
- package/esm/browser/components/scan-screen.js +5 -8
- package/esm/browser/components/screen-navigator.d.ts +9 -0
- package/esm/browser/components/screen-navigator.js +84 -0
- package/esm/browser/components/search-page.js +9 -2
- package/esm/browser/components/serve-value.d.ts +27 -0
- package/esm/browser/components/serve-value.js +61 -0
- package/esm/browser/components/serve-watch.d.ts +23 -0
- package/esm/browser/components/serve-watch.js +36 -0
- 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 +6 -4
- 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/components/share-friends.js +3 -4
- package/esm/browser/components/share-sheet.js +3 -4
- package/esm/browser/components/tool-view.js +17 -3
- 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/gateway/console-agents.js +11 -15
- package/esm/browser/gateway/console-parts.d.ts +7 -4
- package/esm/browser/gateway/console-parts.js +11 -20
- package/esm/browser/gateway/console-trend.js +2 -2
- package/esm/browser/gateway/console-updates.js +6 -4
- package/esm/browser/gateway/console-view.js +6 -6
- 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 +6 -0
- package/esm/browser/i18n/en/service.js +6 -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 +6 -0
- package/esm/browser/i18n/ja/settings.js +3 -0
- package/esm/browser/i18n/locales.d.ts +22 -1
- package/esm/browser/i18n/messages.d.ts +21 -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 +6 -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 +6 -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/partners/group-picker.js +3 -4
- 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/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +4 -3
- package/esm/browser/style/dialogs.d.ts +1 -1
- package/esm/browser/style/dialogs.js +7 -0
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +5 -3
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +1 -1
- package/esm/browser/util/tool.d.ts +5 -0
- package/esm/browser/util/tool.js +21 -3
- package/lib/browser/account/account-side.d.ts +3 -3
- package/lib/browser/account/account-side.js +11 -21
- package/lib/browser/account/device-account.d.ts +8 -0
- package/lib/browser/account/device-account.js +20 -0
- package/lib/browser/chat/chat-protocol.d.ts +7 -0
- package/lib/browser/chat/chat-view.js +1 -1
- 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/access-view.js +12 -10
- package/lib/browser/components/account-menu.d.ts +2 -0
- package/lib/browser/components/account-menu.js +11 -2
- package/lib/browser/components/account-view.js +9 -5
- package/lib/browser/components/app-nav.js +3 -0
- package/lib/browser/components/app-shell-state.d.ts +2 -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 +30 -105
- 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/chat-list-controls.d.ts +39 -0
- package/lib/browser/components/chat-list-controls.js +86 -0
- package/lib/browser/components/chat-list-hooks.d.ts +19 -0
- package/lib/browser/components/chat-list-hooks.js +53 -0
- package/lib/browser/components/chat-list-rows.d.ts +52 -0
- package/lib/browser/components/chat-list-rows.js +147 -0
- package/lib/browser/components/chat-list-sections.d.ts +37 -0
- package/lib/browser/components/chat-list-sections.js +108 -0
- package/lib/browser/components/chat-list.js +44 -217
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/cloud-sign-in-view.js +4 -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 +32 -11
- package/lib/browser/components/device-sign-in-page.js +4 -5
- package/lib/browser/components/discover-view.d.ts +8 -1
- package/lib/browser/components/discover-view.js +27 -2
- package/lib/browser/components/environment-view.js +60 -62
- package/lib/browser/components/extension-settings.js +1 -0
- package/lib/browser/components/first-steps-util.d.ts +30 -0
- package/lib/browser/components/first-steps-util.js +44 -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 +3 -3
- package/lib/browser/components/host-view.js +11 -11
- 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-shell.d.ts +14 -0
- package/lib/browser/components/phone-shell.js +23 -0
- package/lib/browser/components/picture-dialog.js +4 -7
- package/lib/browser/components/profile-view.js +1 -1
- package/lib/browser/components/relay-services.js +4 -7
- 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 +38 -35
- package/lib/browser/components/scan-screen.js +5 -8
- package/lib/browser/components/screen-navigator.d.ts +9 -0
- package/lib/browser/components/screen-navigator.js +85 -0
- package/lib/browser/components/search-page.js +8 -1
- package/lib/browser/components/serve-value.d.ts +28 -0
- package/lib/browser/components/serve-value.js +97 -0
- package/lib/browser/components/serve-watch.d.ts +24 -0
- package/lib/browser/components/serve-watch.js +39 -0
- 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 +6 -4
- 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/components/share-friends.js +3 -4
- package/lib/browser/components/share-sheet.js +3 -4
- package/lib/browser/components/tool-view.js +17 -3
- 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/gateway/console-agents.js +10 -14
- package/lib/browser/gateway/console-parts.d.ts +7 -4
- package/lib/browser/gateway/console-parts.js +12 -21
- package/lib/browser/gateway/console-trend.js +1 -1
- package/lib/browser/gateway/console-updates.js +5 -3
- package/lib/browser/gateway/console-view.js +5 -5
- 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 +6 -0
- package/lib/browser/i18n/en/service.js +6 -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 +6 -0
- package/lib/browser/i18n/ja/settings.js +3 -0
- package/lib/browser/i18n/locales.d.ts +22 -1
- package/lib/browser/i18n/messages.d.ts +21 -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 +6 -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 +6 -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/partners/group-picker.js +3 -4
- 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/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +4 -3
- package/lib/browser/style/dialogs.d.ts +1 -1
- package/lib/browser/style/dialogs.js +7 -0
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +5 -3
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +1 -1
- package/lib/browser/util/tool.d.ts +5 -0
- package/lib/browser/util/tool.js +21 -3
- package/package.json +7 -7
|
@@ -42,6 +42,7 @@ const hooks_1 = require("../hooks");
|
|
|
42
42
|
const use_t_1 = require("../i18n/use-t");
|
|
43
43
|
const workbench_util_1 = require("../workbench-util");
|
|
44
44
|
const access_util_1 = require("./access-util");
|
|
45
|
+
const busy_1 = require("./busy");
|
|
45
46
|
const chat_list_util_1 = require("./chat-list-util");
|
|
46
47
|
const icon_1 = require("./icon");
|
|
47
48
|
const settings_controls_1 = require("./settings-controls");
|
|
@@ -83,9 +84,10 @@ function AccessSettings({ info, onChange }) {
|
|
|
83
84
|
const [workbench, bench] = (0, hooks_1.useWorkbench)();
|
|
84
85
|
const [, notices] = (0, hooks_1.useNotices)();
|
|
85
86
|
const [text, setText] = React.useState('');
|
|
86
|
-
const [busy,
|
|
87
|
-
const
|
|
88
|
-
|
|
87
|
+
const [busy, start] = (0, busy_1.useBusy)();
|
|
88
|
+
const [removing, setRemoving] = React.useState();
|
|
89
|
+
/** One change at a time, the button clicked turning until it is done; then what is allowed is read again. */
|
|
90
|
+
const run = (action) => start(async () => {
|
|
89
91
|
try {
|
|
90
92
|
await action();
|
|
91
93
|
}
|
|
@@ -93,18 +95,17 @@ function AccessSettings({ info, onChange }) {
|
|
|
93
95
|
notices.error(error);
|
|
94
96
|
}
|
|
95
97
|
finally {
|
|
96
|
-
setBusy(false);
|
|
97
98
|
await onChange().catch(() => undefined);
|
|
98
99
|
}
|
|
99
|
-
};
|
|
100
|
+
});
|
|
100
101
|
// The sign-in goes through the page's own ta serve: not from the app, nor for another computer, nor at an address of
|
|
101
102
|
// this machine alone (the desktop app's), which the provider sends no one back to and where the token lets in anyway.
|
|
102
103
|
const here = !workbench_util_1.WorkbenchUtil.isApp() && !workbench_util_1.WorkbenchUtil.loopback() && workbench.host === workbench_util_1.WorkbenchUtil.serverOf({ token: '' }, location.host);
|
|
103
104
|
// Behind a gateway, only its administrators let accounts in; everyone sees the browsers of their own.
|
|
104
105
|
const manage = info.canManage !== false;
|
|
105
|
-
const bind =
|
|
106
|
+
const bind = async (provider) => {
|
|
106
107
|
location.assign(await bench.access.bindUrl(provider));
|
|
107
|
-
}
|
|
108
|
+
};
|
|
108
109
|
const remove = async (account) => {
|
|
109
110
|
const confirmed = await notices.confirm({
|
|
110
111
|
title: t('ta.access.removeConfirm', { account }),
|
|
@@ -113,7 +114,8 @@ function AccessSettings({ info, onChange }) {
|
|
|
113
114
|
danger: true,
|
|
114
115
|
});
|
|
115
116
|
if (confirmed) {
|
|
116
|
-
|
|
117
|
+
setRemoving(account);
|
|
118
|
+
await bench.access.disallow(account).finally(() => setRemoving(undefined));
|
|
117
119
|
}
|
|
118
120
|
};
|
|
119
121
|
const date = (time) => new Date(time).toLocaleString(language, { dateStyle: 'medium', timeStyle: 'short' });
|
|
@@ -143,7 +145,7 @@ function AccessSettings({ info, onChange }) {
|
|
|
143
145
|
React.createElement(settings_controls_1.Switch, { checked: Boolean(rule), disabled: busy || (rule === null || rule === void 0 ? void 0 : rule.source) === 'env', label: t('ta.access.open', { name: provider.name }), onChange: on => open(provider, on) })));
|
|
144
146
|
}),
|
|
145
147
|
manage && here && info.providers.length > 0 && (React.createElement(settings_controls_1.Row, { label: t('ta.access.bind'), description: t('ta.access.bindHint'), stacked: true },
|
|
146
|
-
React.createElement("div", { className: "ta-access-bind" }, info.providers.map(provider => (React.createElement("button", { key: provider.id, type: "button", className: "ta-button", disabled: busy, onClick: () => void bind(provider.id) },
|
|
148
|
+
React.createElement("div", { className: "ta-access-bind" }, info.providers.map(provider => (React.createElement("button", { key: provider.id, type: "button", className: "ta-button", disabled: busy, onClick: () => void run(() => bind(provider.id)) },
|
|
147
149
|
React.createElement(sign_in_marks_1.SignInMark, { provider: provider.id, size: 15 }),
|
|
148
150
|
" ",
|
|
149
151
|
sign_in_accounts_1.SignInAccountsUtil.label(provider, t))))))),
|
|
@@ -167,7 +169,7 @@ function AccessSettings({ info, onChange }) {
|
|
|
167
169
|
" ",
|
|
168
170
|
t('ta.access.add'))))),
|
|
169
171
|
manage && info.accounts.length === 0 && React.createElement(settings_controls_1.EmptyRow, { title: t('ta.access.none'), hint: t('ta.access.noneHint') }),
|
|
170
|
-
info.accounts.map(account => { var _a; return (React.createElement(settings_controls_1.Row, { key: `account:${account.id}`, label: React.createElement(AccountLabel, { ...account }), description: account.source === 'env' ? t('ta.access.fromEnv') : t('ta.access.added', { time: date((_a = account.addedAt) !== null && _a !== void 0 ? _a : 0) }) }, account.source === 'added' && (React.createElement(icon_1.IconButton, { icon: lucide_react_1.Trash2, label: t('ta.access.removeAccount', { account: account.id }), disabled: busy, onClick: () => void remove(account.id) })))); }),
|
|
172
|
+
info.accounts.map(account => { var _a; return (React.createElement(settings_controls_1.Row, { key: `account:${account.id}`, label: React.createElement(AccountLabel, { ...account }), description: account.source === 'env' ? t('ta.access.fromEnv') : t('ta.access.added', { time: date((_a = account.addedAt) !== null && _a !== void 0 ? _a : 0) }) }, account.source === 'added' && (React.createElement(icon_1.IconButton, { icon: lucide_react_1.Trash2, label: t('ta.access.removeAccount', { account: account.id }), disabled: busy, busy: removing === account.id, onClick: () => void run(() => remove(account.id)) })))); }),
|
|
171
173
|
info.signIns.map(signIn => { var _a, _b; return (React.createElement(settings_controls_1.Row, { key: `signIn:${signIn.id}`, icon: /iOS|Android/.test((_a = access_util_1.AccessViewUtil.device(signIn.device)) !== null && _a !== void 0 ? _a : '') ? lucide_react_1.Smartphone : lucide_react_1.Monitor, label: (_b = access_util_1.AccessViewUtil.device(signIn.device)) !== null && _b !== void 0 ? _b : t('ta.access.browser'), description: [
|
|
172
174
|
signIn.account,
|
|
173
175
|
signIn.current ? t('ta.access.thisBrowser') : undefined,
|
|
@@ -43,6 +43,8 @@ export declare function useAccount(): {
|
|
|
43
43
|
name: string;
|
|
44
44
|
account: string | undefined;
|
|
45
45
|
service: string;
|
|
46
|
+
/** What the line of the connection calls the computer Ta runs on: this one, or another. */
|
|
47
|
+
computer: string;
|
|
46
48
|
};
|
|
47
49
|
export interface AccountMenuProps {
|
|
48
50
|
/** Shows the settings view, at a section. */
|
|
@@ -42,6 +42,7 @@ const lucide_react_1 = require("lucide-react");
|
|
|
42
42
|
const React = __importStar(require("react"));
|
|
43
43
|
const account_side_1 = require("../account/account-side");
|
|
44
44
|
const device_account_1 = require("../account/device-account");
|
|
45
|
+
const app_update_1 = require("../device/app-update");
|
|
45
46
|
const device_1 = require("../device/device");
|
|
46
47
|
const web_extension_protocol_1 = require("../extension/web-extension-protocol");
|
|
47
48
|
const hooks_1 = require("../hooks");
|
|
@@ -70,11 +71,12 @@ function useAccountEntries(onSettings, onDialog) {
|
|
|
70
71
|
// A finger has no keys to learn; a phone is not the computer that pairs phones.
|
|
71
72
|
const { touch, handheld } = (0, device_1.useDevice)();
|
|
72
73
|
const restartTa = (0, serve_restart_1.useRestartTa)();
|
|
74
|
+
const appUpdate = (0, app_update_1.useAppUpdate)();
|
|
73
75
|
// The vault, while its package is on: the one place for the sign-ins, keys and personal details of the account.
|
|
74
76
|
const vault = (0, secret_peek_1.useSecretPeek)().manage;
|
|
75
77
|
const [, notices] = (0, hooks_1.useNotices)();
|
|
76
78
|
const side = (0, account_side_1.useAccountSide)();
|
|
77
|
-
const { info } = (0, account_side_1.useAccountInfo)(side
|
|
79
|
+
const { info } = (0, account_side_1.useAccountInfo)(side);
|
|
78
80
|
const signedIn = Boolean(info === null || info === void 0 ? void 0 : info.account);
|
|
79
81
|
const app = workbench_util_1.WorkbenchUtil.ownDevice();
|
|
80
82
|
const [{ views }, extensions] = (0, hooks_1.useWebExtensions)();
|
|
@@ -120,6 +122,9 @@ function useAccountEntries(onSettings, onDialog) {
|
|
|
120
122
|
if (update) {
|
|
121
123
|
entry('restart', t('ta.update.restartTo', { version: serve_restart_1.ServeRestartUtil.label(update) }), lucide_react_1.RotateCw, () => void restartTa.restart(), { action: true });
|
|
122
124
|
}
|
|
125
|
+
if (appUpdate) {
|
|
126
|
+
entry('appUpdate', t('ta.appUpdate.installTo', { version: appUpdate.version }), lucide_react_1.Download, () => app_update_1.AppUpdate.install(), { action: true });
|
|
127
|
+
}
|
|
123
128
|
entry('install', t('ta.pwa.install'), lucide_react_1.Download, () => void pwa.install(), { action: true });
|
|
124
129
|
// As WeChat's: the account in use kept, with its computers, to come back to in one tap (docs/design/ta-me.md 4).
|
|
125
130
|
entry('signIn', t('ta.me.signIn'), lucide_react_1.LogIn, () => onDialog('signIn'));
|
|
@@ -129,11 +134,13 @@ function useAccountEntries(onSettings, onDialog) {
|
|
|
129
134
|
vault: Boolean(vault),
|
|
130
135
|
own: own.map(view => view.id),
|
|
131
136
|
update: Boolean(update),
|
|
137
|
+
appUpdate: Boolean(appUpdate),
|
|
132
138
|
installable: installable && !standalone,
|
|
133
139
|
switchAccount: app && signedIn,
|
|
134
140
|
// The account is who the user is, not one of their devices (docs/design/ta-me.md 4).
|
|
135
141
|
signIn: Boolean(info) && !signedIn,
|
|
136
142
|
pairPhone: !app && !handheld,
|
|
143
|
+
signOut: signedIn || workbench_util_1.WorkbenchUtil.elsewhere(host),
|
|
137
144
|
}).map(group => group.map(key => entries[key]));
|
|
138
145
|
}
|
|
139
146
|
/** What the entries of the account open over the page. */
|
|
@@ -194,6 +201,8 @@ function useAccount() {
|
|
|
194
201
|
name: (_c = name !== null && name !== void 0 ? name : server === null || server === void 0 ? void 0 : server.user) !== null && _c !== void 0 ? _c : t('ta.account'),
|
|
195
202
|
account: account !== null && account !== void 0 ? account : undefined,
|
|
196
203
|
service: server && online ? `${state} · v${server.version}` : state,
|
|
204
|
+
/** What the line of the connection calls the computer Ta runs on: this one, or another. */
|
|
205
|
+
computer: t(workbench_util_1.WorkbenchUtil.elsewhere(host) ? 'ta.account.service' : 'ta.account.thisComputer'),
|
|
197
206
|
};
|
|
198
207
|
}
|
|
199
208
|
/** Moves the focus through the items of a menu with the arrow keys. */
|
|
@@ -247,7 +256,7 @@ function AccountMenu({ onSettings, active }) {
|
|
|
247
256
|
((_a = account.account) !== null && _a !== void 0 ? _a : account.machine) && React.createElement("span", { className: "ta-account-sub ta-ellipsis" }, (_b = account.account) !== null && _b !== void 0 ? _b : account.machine))),
|
|
248
257
|
React.createElement("div", { className: "ta-account-service", title: account.server ? `Ta v${account.server.version}` : undefined },
|
|
249
258
|
React.createElement("span", { className: `ta-account-state ${account.online ? 'ta-ok' : 'ta-warn'}` }),
|
|
250
|
-
React.createElement("span", { className: "ta-account-service-name" },
|
|
259
|
+
React.createElement("span", { className: "ta-account-service-name" }, account.computer),
|
|
251
260
|
React.createElement("span", { className: "ta-account-service-state" }, account.service)),
|
|
252
261
|
groups
|
|
253
262
|
.filter(group => group.length > 0)
|
|
@@ -176,6 +176,7 @@ function AccountWays({ info, act }) {
|
|
|
176
176
|
const t = (0, use_t_1.useT)();
|
|
177
177
|
const way = useAccountWay();
|
|
178
178
|
const [, notices] = (0, hooks_1.useNotices)();
|
|
179
|
+
const [busy, run] = (0, busy_1.useBusy)();
|
|
179
180
|
if (info.signingIn || !info.account) {
|
|
180
181
|
return (React.createElement(React.Fragment, null,
|
|
181
182
|
info.error && React.createElement(callout_1.Callout, { level: "error" }, info.error),
|
|
@@ -187,7 +188,7 @@ function AccountWays({ info, act }) {
|
|
|
187
188
|
// Signed in, no computer of the account yet: they come by themselves once signed in there.
|
|
188
189
|
const signOut = async () => {
|
|
189
190
|
if (await notices.confirm({ title: t('ta.myDevices.signOutConfirm'), confirmLabel: t('ta.settings.signOut'), danger: true })) {
|
|
190
|
-
|
|
191
|
+
await act(side => side.signOut()).catch((error) => notices.error(error));
|
|
191
192
|
}
|
|
192
193
|
};
|
|
193
194
|
return (React.createElement("div", { className: "ta-account-signed" },
|
|
@@ -198,7 +199,9 @@ function AccountWays({ info, act }) {
|
|
|
198
199
|
" \u00B7 ",
|
|
199
200
|
accountName(info.account))),
|
|
200
201
|
React.createElement("p", { className: "ta-account-hint" }, t('ta.myDevices.computersComing')),
|
|
201
|
-
React.createElement("button", { type: "button", className:
|
|
202
|
+
React.createElement("button", { type: "button", className: `ta-link-button${busy ? ' ta-busy' : ''}`, onClick: () => void run(signOut) },
|
|
203
|
+
React.createElement(busy_1.BusyMark, { busy: busy }),
|
|
204
|
+
t('ta.settings.signOut'))));
|
|
202
205
|
}
|
|
203
206
|
/** The accounts this device switched away from, on its sign-in: a tap goes back to one, its computers with it. */
|
|
204
207
|
function RecentAccounts() {
|
|
@@ -287,8 +290,9 @@ function DevicesDialog({ onClose }) {
|
|
|
287
290
|
adding === 'cloud' ? (React.createElement(cloud_sign_in_view_1.CloudSignInFlow, { onBack: () => setAdding(undefined) })) : adding === 'paste' ? (React.createElement(host_view_1.LinkForm, { busy: add.busy, autoFocus: true, placeholder: t('ta.signin.pairing'), onSubmit: text => void add.add(text) })) : (React.createElement(React.Fragment, null,
|
|
288
291
|
!info && side && React.createElement(loading_1.Loading, { compact: true }),
|
|
289
292
|
React.createElement("div", { className: "ta-host-actions" },
|
|
290
|
-
add.canScan && (React.createElement("button", { type: "button", className:
|
|
291
|
-
|
|
293
|
+
add.canScan && (React.createElement("button", { type: "button", className: `ta-button ta-primary${add.busy ? ' ta-busy' : ''}`, disabled: add.busy, onClick: add.scan },
|
|
294
|
+
React.createElement(busy_1.BusyMark, { busy: add.busy }),
|
|
295
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.ScanLine, size: 16 }),
|
|
292
296
|
" ",
|
|
293
297
|
t('ta.hosts.scanShort'))),
|
|
294
298
|
React.createElement("button", { type: "button", className: "ta-button", disabled: add.busy, onClick: () => setAdding('paste') },
|
|
@@ -382,7 +386,7 @@ function AccountAsk() {
|
|
|
382
386
|
const t = (0, use_t_1.useT)();
|
|
383
387
|
const side = (0, account_side_1.useAccountSide)();
|
|
384
388
|
const [, notices] = (0, hooks_1.useNotices)();
|
|
385
|
-
const { info, act } = (0, account_side_1.useAccountInfo)(side
|
|
389
|
+
const { info, act } = (0, account_side_1.useAccountInfo)(side);
|
|
386
390
|
const [later, setLater] = React.useState([]);
|
|
387
391
|
const asking = (info === null || info === void 0 ? void 0 : info.account) && !info.waiting ? info.devices.find(one => one.waiting && !later.includes(one.id)) : undefined;
|
|
388
392
|
if (!asking) {
|
|
@@ -70,10 +70,13 @@ function useNavigation(views) {
|
|
|
70
70
|
const onOpen = React.useMemo(() => pages.filter(page => page.onOpen && page.place === 'discover'), [pages]);
|
|
71
71
|
// The pages a page lists (a game, on the Games page) are there, not in the navigation or under Discover.
|
|
72
72
|
const listed = React.useMemo(() => new Set(pages.filter(page => page.place === 'list').map(page => page.id)), [pages]);
|
|
73
|
+
const infos = React.useMemo(() => new Map(pages.map(page => [page.id, page])), [pages]);
|
|
73
74
|
return {
|
|
74
75
|
...(0, nav_places_1.places)(views.filter(view => !listed.has(view.id)), setting, handheld, onOpen.length > 0),
|
|
75
76
|
onOpen,
|
|
76
77
|
setting,
|
|
78
|
+
...(settings.allFeatures ? {} : { first: (id) => (0, nav_places_1.discoverFirst)(infos.get(id), Date.now()) }),
|
|
79
|
+
showAll: on => store.update({ allFeatures: on }),
|
|
77
80
|
pin: id => update(navigation_1.NavigationUtil.pin(setting, id)),
|
|
78
81
|
fold: id => update(navigation_1.NavigationUtil.fold(setting, id)),
|
|
79
82
|
update,
|
|
@@ -79,4 +79,6 @@ export declare function useAppShell(): {
|
|
|
79
79
|
deciding: number;
|
|
80
80
|
setChatsBusy: React.Dispatch<React.SetStateAction<boolean>>;
|
|
81
81
|
};
|
|
82
|
+
/** The state of the shell, as AppShell and what it hands it read. */
|
|
83
|
+
export type AppShellState = ReturnType<typeof useAppShell>;
|
|
82
84
|
//# sourceMappingURL=app-shell-state.d.ts.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AppUpdateNotices = AppUpdateNotices;
|
|
37
|
+
const React = __importStar(require("react"));
|
|
38
|
+
const app_update_1 = require("../device/app-update");
|
|
39
|
+
const hooks_1 = require("../hooks");
|
|
40
|
+
const use_t_1 = require("../i18n/use-t");
|
|
41
|
+
const workbench_util_1 = require("../workbench-util");
|
|
42
|
+
/** The version of the phone app the user put off installing (Later): not told of again on this device. */
|
|
43
|
+
const LATER_KEY = 'ta.appUpdate.later';
|
|
44
|
+
/** Tells once of each newer version of the phone app that does not update itself (AppUpdates), with Update and Later. */
|
|
45
|
+
function AppUpdateNotices() {
|
|
46
|
+
const t = (0, use_t_1.useT)();
|
|
47
|
+
const [, notices] = (0, hooks_1.useNotices)();
|
|
48
|
+
const offer = (0, app_update_1.useAppUpdate)();
|
|
49
|
+
const told = React.useRef(undefined);
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
var _a;
|
|
52
|
+
if (told.current && told.current.version !== (offer === null || offer === void 0 ? void 0 : offer.version)) {
|
|
53
|
+
notices.dismiss(told.current.id);
|
|
54
|
+
told.current = undefined;
|
|
55
|
+
}
|
|
56
|
+
if (!offer || told.current || ((_a = (0, workbench_util_1.storage)()) === null || _a === void 0 ? void 0 : _a.getItem(LATER_KEY)) === offer.version) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const { version } = offer;
|
|
60
|
+
told.current = {
|
|
61
|
+
version,
|
|
62
|
+
id: notices.notify(t('ta.appUpdate.available', { version }), {
|
|
63
|
+
detail: t('ta.appUpdate.detail'),
|
|
64
|
+
key: 'ta-app-update',
|
|
65
|
+
sticky: true,
|
|
66
|
+
actions: [{ label: t('ta.update.later'), run: () => { var _a; return (_a = (0, workbench_util_1.storage)()) === null || _a === void 0 ? void 0 : _a.setItem(LATER_KEY, version); } }],
|
|
67
|
+
action: { label: t('ta.appUpdate.update'), run: () => app_update_1.AppUpdate.install() },
|
|
68
|
+
}),
|
|
69
|
+
};
|
|
70
|
+
}, [offer, notices, t]);
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=app-update-view.js.map
|
|
@@ -38,7 +38,6 @@ const lucide_react_1 = require("lucide-react");
|
|
|
38
38
|
const React = __importStar(require("react"));
|
|
39
39
|
const assistant_chat_list_1 = require("../assistant/assistant-chat-list");
|
|
40
40
|
const chat_view_1 = require("../chat/chat-view");
|
|
41
|
-
const device_protocol_1 = require("../device/device-protocol");
|
|
42
41
|
const web_extension_protocol_1 = require("../extension/web-extension-protocol");
|
|
43
42
|
const hooks_1 = require("../hooks");
|
|
44
43
|
const notices_1 = require("../notices/notices");
|
|
@@ -46,6 +45,7 @@ const app_contexts_1 = require("./app-contexts");
|
|
|
46
45
|
const app_nav_1 = require("./app-nav");
|
|
47
46
|
const app_shell_hooks_1 = require("./app-shell-hooks");
|
|
48
47
|
const app_shell_state_1 = require("./app-shell-state");
|
|
48
|
+
const app_update_view_1 = require("./app-update-view");
|
|
49
49
|
const auth_view_1 = require("./auth-view");
|
|
50
50
|
const board_1 = require("./board");
|
|
51
51
|
const chat_asks_1 = require("./chat-asks");
|
|
@@ -58,6 +58,7 @@ const discover_view_1 = require("./discover-view");
|
|
|
58
58
|
const editor_area_1 = require("./editor-area");
|
|
59
59
|
const entry_holds_1 = require("./entry-holds");
|
|
60
60
|
const environment_view_1 = require("./environment-view");
|
|
61
|
+
const first_steps_1 = require("./first-steps");
|
|
61
62
|
const host_view_1 = require("./host-view");
|
|
62
63
|
const icon_1 = require("./icon");
|
|
63
64
|
const kept_call_bar_1 = require("./kept-call-bar");
|
|
@@ -71,7 +72,6 @@ const phone_shell_1 = require("./phone-shell");
|
|
|
71
72
|
const remote_prompts_1 = require("./remote-prompts");
|
|
72
73
|
const scan_screen_1 = require("./scan-screen");
|
|
73
74
|
const screen_navigator_1 = require("./screen-navigator");
|
|
74
|
-
const screen_navigator_util_1 = require("./screen-navigator-util");
|
|
75
75
|
const serve_restart_1 = require("./serve-restart");
|
|
76
76
|
const settings_view_1 = require("./settings-view");
|
|
77
77
|
const share_dialog_1 = require("./share-dialog");
|
|
@@ -88,9 +88,10 @@ const workbench_view_1 = require("./workbench-view");
|
|
|
88
88
|
* the conversation instead.
|
|
89
89
|
*/
|
|
90
90
|
function AppShell() {
|
|
91
|
-
var _a, _b
|
|
92
|
-
var
|
|
93
|
-
const
|
|
91
|
+
var _a, _b;
|
|
92
|
+
var _c, _d;
|
|
93
|
+
const shell = (0, app_shell_state_1.useAppShell)();
|
|
94
|
+
const { t, workbench, extensions, host, store, pending, chat, setSideId, removedChats, chatsByDirectory, setChatsByDirectory, foldedChats, setFoldedChats, pinnedChats, setPinnedChats, letGoAsks, setLetGoAsks, navOpen, setNavOpen, phone, screenOpen, setScreenOpen, surface, setSurface, surfaces, settings, setSettings, settingsOpened, tabPage, setTabPage, openSettings, closeSettings, settingsShown, toggleRight, maximized, setMaximized, chatSettings, readArchived, sidebar, editor, online, fileUrl, openLink, activeEditor, view, sideView, side, showPage, lists, tools, openTool, editors, showEditors, navigation, codeScan, notices, railCurrent, tabView, screenPage, seenChats, looking, state, sideShown, showList, toggleWorkbench, toggleSides, picking, chatsBusy, setChatsBusy, deciding, } = shell;
|
|
94
95
|
const [providers, reloadProviders] = (0, auth_view_1.useAuthProviders)(online);
|
|
95
96
|
const [later, setLater] = (0, hooks_1.usePersisted)(app_shell_hooks_1.LOGIN_LATER);
|
|
96
97
|
/** A call failed for want of a sign-in (SIGN_IN_EVENT): the page of sign-in, even if the user put it off. */
|
|
@@ -103,12 +104,27 @@ function AppShell() {
|
|
|
103
104
|
window.addEventListener(notices_1.SIGN_IN_EVENT, ask);
|
|
104
105
|
return () => window.removeEventListener(notices_1.SIGN_IN_EVENT, ask);
|
|
105
106
|
}, [reloadProviders]);
|
|
107
|
+
// Models now where there were none (a key, an account, an agent installed meanwhile): the page of sign-in is done
|
|
108
|
+
// with, and what failed for want of one goes (TaChat.resendSignedOut).
|
|
109
|
+
const signedIn = providers && auth_view_1.AuthUtil.signedIn(providers);
|
|
110
|
+
const hadModels = React.useRef(undefined);
|
|
111
|
+
React.useEffect(() => {
|
|
112
|
+
if (signedIn === undefined) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (signedIn && hadModels.current === false) {
|
|
116
|
+
setAsked(false);
|
|
117
|
+
window.dispatchEvent(new Event(notices_1.SIGNED_IN_EVENT));
|
|
118
|
+
}
|
|
119
|
+
hadModels.current = signedIn;
|
|
120
|
+
}, [signedIn]);
|
|
106
121
|
const doubleId = side_lists_1.DOUBLE_PAGE;
|
|
107
122
|
// Where Ta's agents read the page to be, and go (docs/design/ta-app-use.md 3): set below as it renders.
|
|
108
123
|
const screenShell = (0, screen_navigator_1.useScreenNavigator)();
|
|
109
124
|
const inCall = (0, entry_holds_1.useCallGoingOn)();
|
|
110
125
|
// The chats' tab, and the double's on the rail, have the amber dot while a row of the double's list has one, as a
|
|
111
126
|
// messenger's; what waits for the user to decide is counted there until answered.
|
|
127
|
+
(0, first_steps_1.useFirstSteps)(workbench.status === 'online', workbench.sessions, workbench.saved);
|
|
112
128
|
const { listed: listedChats, unseen: chatsUnseen } = (0, chats_dot_1.useChatsDot)({
|
|
113
129
|
sessions: workbench.sessions,
|
|
114
130
|
saved: workbench.saved,
|
|
@@ -134,6 +150,8 @@ function AppShell() {
|
|
|
134
150
|
}, onSignedIn: () => {
|
|
135
151
|
setAsked(false);
|
|
136
152
|
reloadProviders();
|
|
153
|
+
// What failed for want of a model goes now (TaChat.resendSignedOut).
|
|
154
|
+
window.dispatchEvent(new Event(notices_1.SIGNED_IN_EVENT));
|
|
137
155
|
}, onProviders: reloadProviders }));
|
|
138
156
|
}
|
|
139
157
|
// What the columns beside the conversation and the editors take, so that the editors never take more than the conversation.
|
|
@@ -168,7 +186,7 @@ function AppShell() {
|
|
|
168
186
|
}, onPicked: picked, busy: busy, onBusy: setChatsBusy }));
|
|
169
187
|
// On a phone the conversations going on are pushed over the tab (below); elsewhere they are the chats, filtered.
|
|
170
188
|
const sideList = sideView ? React.createElement(app_nav_1.SidebarView, { view: sideView }) : chatList(!phone && chatsBusy);
|
|
171
|
-
const editorArea = (React.createElement(editor_area_1.EditorArea, { editors: extensions.editors, active: activeEditor, views: tools, onShow: id => host.showEditor(id), onClose: ids => void host.closeEditors(ids), onPin: id => host.pinEditor(id), onOpenView: openTool, onHide: editor.toggle, cwd: (
|
|
189
|
+
const editorArea = (React.createElement(editor_area_1.EditorArea, { editors: extensions.editors, active: activeEditor, views: tools, onShow: id => host.showEditor(id), onClose: ids => void host.closeEditors(ids), onPin: id => host.pinEditor(id), onOpenView: openTool, onHide: editor.toggle, cwd: (_c = web_extension_protocol_1.WebCwdUtil.shown(extensions)) !== null && _c !== void 0 ? _c : (_a = workbench.server) === null || _a === void 0 ? void 0 : _a.cwd, maximized: maximized, onMaximize: () => setMaximized(!maximized) }));
|
|
172
190
|
// A photo of the scan screen to the double: its conversation shows, the photo goes with what to do with it.
|
|
173
191
|
const askDouble = async (text, image) => {
|
|
174
192
|
const double = extensions.views.find(candidate => candidate.id === side_lists_1.DOUBLE_PAGE);
|
|
@@ -189,6 +207,7 @@ function AppShell() {
|
|
|
189
207
|
React.createElement(link_dialog_1.LinkDialog, null),
|
|
190
208
|
React.createElement(remote_prompts_1.RemotePrompts, null),
|
|
191
209
|
React.createElement(serve_restart_1.ServeRestartNotices, null),
|
|
210
|
+
React.createElement(app_update_view_1.AppUpdateNotices, null),
|
|
192
211
|
React.createElement(host_view_1.DeviceOverlays, null),
|
|
193
212
|
codeScan && React.createElement(scan_screen_1.ScanHost, { onCode: text => void codeScan.open(text), onAsk: askDouble }),
|
|
194
213
|
React.createElement(share_dialog_1.ShareHost, null),
|
|
@@ -233,7 +252,7 @@ function AppShell() {
|
|
|
233
252
|
showPage(id);
|
|
234
253
|
}
|
|
235
254
|
};
|
|
236
|
-
const discoverView = (leading) => (React.createElement(discover_view_1.DiscoverView, { pages: navigation.discover, onOpenPages: navigation.onOpen, onOpen: openDiscovered, onPin: pinDiscovered, onSettings: () => openSettings('navigation'), onScan: codeScan && (() => void codeScan.scan()), leading: leading }));
|
|
255
|
+
const discoverView = (leading) => (React.createElement(discover_view_1.DiscoverView, { pages: navigation.discover, onOpenPages: navigation.onOpen, onOpen: openDiscovered, onPin: pinDiscovered, onSettings: () => openSettings('navigation'), onScan: codeScan && (() => void codeScan.scan()), leading: leading, first: navigation.first, onAllFeatures: navigation.showAll }));
|
|
237
256
|
const keptPages = entry_holds_1.EntryHoldUtil.kept(extensions.kept, inCall, tabView);
|
|
238
257
|
const holds = entry_holds_1.EntryHoldUtil.holds({
|
|
239
258
|
double: () => {
|
|
@@ -274,7 +293,7 @@ function AppShell() {
|
|
|
274
293
|
? { ...item, asks: deciding, onSeeAll: letGoAllAsks }
|
|
275
294
|
: item)
|
|
276
295
|
: [];
|
|
277
|
-
const tab = tabPage === 'me' ? nav_places_1.ME_TAB : tabPage === 'discover' ? nav_places_1.DISCOVER : ((
|
|
296
|
+
const tab = tabPage === 'me' ? nav_places_1.ME_TAB : tabPage === 'discover' ? nav_places_1.DISCOVER : ((_d = tabView === null || tabView === void 0 ? void 0 : tabView.id) !== null && _d !== void 0 ? _d : side);
|
|
278
297
|
const pickTab = (id) => {
|
|
279
298
|
setSurface(undefined);
|
|
280
299
|
setChatsBusy(false);
|
|
@@ -290,82 +309,10 @@ function AppShell() {
|
|
|
290
309
|
setSideId(id);
|
|
291
310
|
}
|
|
292
311
|
};
|
|
293
|
-
|
|
294
|
-
const shownChat = store ? workbench.sessions.find(session => session.sessionId === store.sessionId) : undefined;
|
|
295
|
-
screenShell.current = {
|
|
296
|
-
phone,
|
|
297
|
-
where: screen_navigator_util_1.ScreenNavigatorUtil.where({
|
|
298
|
-
settings: settingsShown ? (settings !== null && settings !== void 0 ? settings : '') : undefined,
|
|
299
|
-
page: phone ? (screenOpen ? screenPage : tabView) : tabPage === 'discover' ? undefined : view,
|
|
300
|
-
discover: tabPage === 'discover',
|
|
301
|
-
me: phone && !screenOpen && tabPage === 'me',
|
|
302
|
-
list: (phone ? !screenOpen && !tabView && !tabPage : sideShown) ? (_b = lists.find(entry => entry.id === side)) === null || _b === void 0 ? void 0 : _b.label : undefined,
|
|
303
|
-
chat: (phone ? screenOpen && !screenPage && settings === undefined : settings === undefined && tabPage !== 'discover' && !view)
|
|
304
|
-
? shownChat
|
|
305
|
-
? chatName(shownChat)
|
|
306
|
-
: t('ta.chat.new')
|
|
307
|
-
: undefined,
|
|
308
|
-
words: { settings: t('ta.settings'), discover: t('ta.discover'), me: t('ta.me') },
|
|
309
|
-
}),
|
|
310
|
-
places: [
|
|
311
|
-
...lists.map(entry => ({ id: `list:${entry.id}`, title: entry.label })),
|
|
312
|
-
...navigation.pages.map(page => ({
|
|
313
|
-
id: `page:${page.id}`,
|
|
314
|
-
title: web_extension_protocol_1.WebLabelUtil.text(page.title),
|
|
315
|
-
})),
|
|
316
|
-
...navigation.onOpen.map(page => ({ id: `page:${page.id}`, title: page.title })),
|
|
317
|
-
{ id: 'discover', title: t('ta.discover') },
|
|
318
|
-
...(phone ? [{ id: 'me', title: t('ta.me') }] : []),
|
|
319
|
-
{ id: 'settings', title: t('ta.settings') },
|
|
320
|
-
],
|
|
321
|
-
goPlace: place => {
|
|
322
|
-
const [kind, id = ''] = place.id.split(/:(.*)/s);
|
|
323
|
-
if (kind === 'settings') {
|
|
324
|
-
return openSettings();
|
|
325
|
-
}
|
|
326
|
-
if (kind === 'page') {
|
|
327
|
-
return host.showView(id);
|
|
328
|
-
}
|
|
329
|
-
if (phone) {
|
|
330
|
-
// The tabs are under the screen of a phone: what is over them slides away, as the back does.
|
|
331
|
-
if (screenOpen) {
|
|
332
|
-
closeScreen();
|
|
333
|
-
}
|
|
334
|
-
return pickTab(kind === 'list' ? id : kind === 'me' ? nav_places_1.ME_TAB : nav_places_1.DISCOVER);
|
|
335
|
-
}
|
|
336
|
-
setSettings(undefined);
|
|
337
|
-
setNavOpen(false);
|
|
338
|
-
if (kind === 'discover') {
|
|
339
|
-
setTabPage('discover');
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
setTabPage(undefined);
|
|
343
|
-
setSideId(id);
|
|
344
|
-
if (view) {
|
|
345
|
-
host.showPage('');
|
|
346
|
-
}
|
|
347
|
-
sidebar.reveal();
|
|
348
|
-
},
|
|
349
|
-
showChat: async (target) => {
|
|
350
|
-
const switcher = host.sessionSwitcher();
|
|
351
|
-
if (!switcher) {
|
|
352
|
-
throw new Error('The page cannot show a conversation yet.');
|
|
353
|
-
}
|
|
354
|
-
const shown = switcher('sessionId' in target ? target.sessionId : { sessionFile: target.sessionFile });
|
|
355
|
-
host.showPage('');
|
|
356
|
-
await shown;
|
|
357
|
-
},
|
|
358
|
-
chats: [
|
|
359
|
-
...workbench.sessions
|
|
360
|
-
.filter(session => !session.group)
|
|
361
|
-
.map(session => ({ name: chatName(session), sessionId: session.sessionId, sessionFile: session.sessionFile })),
|
|
362
|
-
...workbench.saved.filter(saved => !saved.group).map(saved => ({ name: chatName(saved), sessionFile: saved.sessionFile })),
|
|
363
|
-
],
|
|
364
|
-
openSettings,
|
|
365
|
-
};
|
|
312
|
+
screenShell.current = (0, screen_navigator_1.shellPlaces)(shell, { closeScreen, pickTab });
|
|
366
313
|
// The launcher and the board are over the first tab only, as WeChat's over its chats.
|
|
367
|
-
const firstTab = ((
|
|
368
|
-
const content = phone ? (React.createElement(phone_shell_1.PhoneShell, { tabs: tabs, tab: tab, launcher: firstTab && surfaces.launcher ? React.createElement(launcher_surface_1.LauncherSurface, { active: surface === 'launcher' }) : undefined, board: firstTab && surfaces.board ? (React.createElement(board_1.BoardSurface, { leading: React.createElement(icon_1.IconButton, { icon: lucide_react_1.ChevronLeft, label: t('ta.back'), onClick: () => setSurface(undefined) }) })) : undefined, surface: surface, onSurface: setSurface, onTab: pickTab, home: React.createElement(PhoneHome, { pushable: side_lists_1.SideListUtil.pushesOver(tabView), busy: chatsBusy, onBusy: setChatsBusy, busyList: () => React.createElement("div", { className: "ta-sidebar" }, chatList(true)) }, tabPage === 'me' ? (React.createElement("div", { className: "ta-main" },
|
|
314
|
+
const firstTab = ((_b = tabs[0]) === null || _b === void 0 ? void 0 : _b.id) === tab;
|
|
315
|
+
const content = phone ? (React.createElement(phone_shell_1.PhoneShell, { tabs: tabs, tab: tab, launcher: firstTab && surfaces.launcher ? React.createElement(launcher_surface_1.LauncherSurface, { active: surface === 'launcher' }) : undefined, board: firstTab && surfaces.board ? (React.createElement(board_1.BoardSurface, { leading: React.createElement(icon_1.IconButton, { icon: lucide_react_1.ChevronLeft, label: t('ta.back'), onClick: () => setSurface(undefined) }) })) : undefined, surface: surface, onSurface: setSurface, onTab: pickTab, home: React.createElement(phone_shell_1.PhoneHome, { pushable: side_lists_1.SideListUtil.pushesOver(tabView), busy: chatsBusy, onBusy: setChatsBusy, busyList: () => React.createElement("div", { className: "ta-sidebar" }, chatList(true)) }, tabPage === 'me' ? (React.createElement("div", { className: "ta-main" },
|
|
369
316
|
React.createElement(me_view_1.MeView, { onSettings: openSettings }))) : tabPage === 'discover' ? (React.createElement("div", { className: "ta-main" }, discoverView())) : tabView ? (React.createElement("div", { className: "ta-main" },
|
|
370
317
|
React.createElement(app_nav_1.PageView, { view: tabView }))) : (React.createElement("div", { className: "ta-sidebar" }, sideList))), screen: React.createElement(React.Fragment, null,
|
|
371
318
|
React.createElement(kept_pages_1.KeptPages, { views: extensions.views, kept: keptPages, shown: screenPage, render: page => (React.createElement(app_nav_1.PageView, { view: page, leading: React.createElement(icon_1.IconButton, { icon: lucide_react_1.ChevronLeft, label: t('ta.back'), className: "ta-narrow-only", onClick: closeScreen }) })) }),
|
|
@@ -392,26 +339,4 @@ function AppShell() {
|
|
|
392
339
|
return (React.createElement(app_contexts_1.AppContexts, { fileUrl: fileUrl, openLink: openLink },
|
|
393
340
|
React.createElement(workbench_toggle_1.WorkbenchToggleContext.Provider, { value: toggle }, content)));
|
|
394
341
|
}
|
|
395
|
-
/**
|
|
396
|
-
* What a tab of a phone shows, and the conversations going on (ui.showChats with `busy`) pushed over it while
|
|
397
|
-
* `busy`, as the folder of the chats is pushed over their list: back with its button, a swipe from the left edge or the
|
|
398
|
-
* back of the system (PhoneStack, a layer of BackLayers), to the tab as it was; a conversation picked in it comes over
|
|
399
|
-
* it, and goes back to it. Drawn while open and while it slides away. Not over a page of an extension's own in the
|
|
400
|
-
* tabs (`pushable`, SideListUtil.pushesOver): the page is drawn as it is, the shell shows those going on over the chats.
|
|
401
|
-
*/
|
|
402
|
-
function PhoneHome({ pushable, busy, onBusy, busyList, children, }) {
|
|
403
|
-
const [drawn, setDrawn] = React.useState(busy);
|
|
404
|
-
React.useEffect(() => {
|
|
405
|
-
if (busy) {
|
|
406
|
-
setDrawn(true);
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
const timer = setTimeout(() => setDrawn(false), device_protocol_1.DeviceMotion.SHEET_MS);
|
|
410
|
-
return () => clearTimeout(timer);
|
|
411
|
-
}, [busy]);
|
|
412
|
-
if (!pushable) {
|
|
413
|
-
return children;
|
|
414
|
-
}
|
|
415
|
-
return React.createElement(phone_shell_1.PhoneStack, { base: children, top: (busy || drawn) && busyList(), open: busy, onClose: () => onBusy(false) });
|
|
416
|
-
}
|
|
417
342
|
//# sourceMappingURL=app-view.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { TaAuthProvider } from '@celljs/ta-protocol';
|
|
2
|
+
/** Where a newcomer gets a key of a provider of models, and what it costs: the pages of the provider. */
|
|
3
|
+
export interface AuthGuide {
|
|
4
|
+
/** The page that makes keys. */
|
|
5
|
+
keys: string;
|
|
6
|
+
/** The prices, paid by use. */
|
|
7
|
+
pricing: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Which providers of keys the page of models puts first, by the language of the page, and how to get their keys
|
|
11
|
+
* (docs/design/ta-simple.md 5, 3 and 8): one a newcomer can pay for and reach from where that language is spoken.
|
|
12
|
+
*/
|
|
13
|
+
export declare namespace AuthGuideUtil {
|
|
14
|
+
function guide(providerId: string): AuthGuide | undefined;
|
|
15
|
+
/** The ids of the providers of keys put first for `language` (a locale, `zh-CN`). */
|
|
16
|
+
function recommended(language: string): string[];
|
|
17
|
+
/**
|
|
18
|
+
* The providers of keys as the page lists them before a search: those recommended for `language`, in their order,
|
|
19
|
+
* and those the user added or signed in to, first; the others under "more".
|
|
20
|
+
*/
|
|
21
|
+
function split(keys: TaAuthProvider[], language: string): {
|
|
22
|
+
first: TaAuthProvider[];
|
|
23
|
+
more: TaAuthProvider[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=auth-guide.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthGuideUtil = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Which providers of keys the page of models puts first, by the language of the page, and how to get their keys
|
|
6
|
+
* (docs/design/ta-simple.md 5, 3 and 8): one a newcomer can pay for and reach from where that language is spoken.
|
|
7
|
+
*/
|
|
8
|
+
var AuthGuideUtil;
|
|
9
|
+
(function (AuthGuideUtil) {
|
|
10
|
+
const GUIDES = {
|
|
11
|
+
deepseek: { keys: 'https://platform.deepseek.com/api_keys', pricing: 'https://api-docs.deepseek.com/quick_start/pricing' },
|
|
12
|
+
'moonshotai-cn': { keys: 'https://platform.kimi.com/console/api-keys', pricing: 'https://platform.kimi.com/docs/pricing/chat' },
|
|
13
|
+
openai: { keys: 'https://platform.openai.com/api-keys', pricing: 'https://openai.com/api/pricing/' },
|
|
14
|
+
anthropic: { keys: 'https://platform.claude.com/settings/keys', pricing: 'https://claude.com/pricing' },
|
|
15
|
+
google: { keys: 'https://aistudio.google.com/apikey', pricing: 'https://ai.google.dev/gemini-api/docs/pricing' },
|
|
16
|
+
};
|
|
17
|
+
/** By the first part of the language (`zh`), or the whole of it (`zh-TW`); English for the others. */
|
|
18
|
+
const RECOMMENDED = {
|
|
19
|
+
zh: ['deepseek', 'moonshotai-cn'],
|
|
20
|
+
'zh-TW': ['deepseek', 'openai', 'google'],
|
|
21
|
+
en: ['openai', 'anthropic', 'google'],
|
|
22
|
+
ja: ['openai', 'anthropic', 'google'],
|
|
23
|
+
};
|
|
24
|
+
function guide(providerId) {
|
|
25
|
+
return GUIDES[providerId];
|
|
26
|
+
}
|
|
27
|
+
AuthGuideUtil.guide = guide;
|
|
28
|
+
/** The ids of the providers of keys put first for `language` (a locale, `zh-CN`). */
|
|
29
|
+
function recommended(language) {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
return (_b = (_a = RECOMMENDED[language]) !== null && _a !== void 0 ? _a : RECOMMENDED[language.split('-')[0]]) !== null && _b !== void 0 ? _b : RECOMMENDED.en;
|
|
32
|
+
}
|
|
33
|
+
AuthGuideUtil.recommended = recommended;
|
|
34
|
+
/**
|
|
35
|
+
* The providers of keys as the page lists them before a search: those recommended for `language`, in their order,
|
|
36
|
+
* and those the user added or signed in to, first; the others under "more".
|
|
37
|
+
*/
|
|
38
|
+
function split(keys, language) {
|
|
39
|
+
const ids = recommended(language);
|
|
40
|
+
const own = (provider) => !!provider.custom || !!provider.configured;
|
|
41
|
+
const picked = ids.map(id => keys.find(provider => provider.id === id && !own(provider))).filter((one) => !!one);
|
|
42
|
+
const first = [...keys.filter(own), ...picked];
|
|
43
|
+
return { first, more: keys.filter(provider => !first.includes(provider)) };
|
|
44
|
+
}
|
|
45
|
+
AuthGuideUtil.split = split;
|
|
46
|
+
})(AuthGuideUtil || (exports.AuthGuideUtil = AuthGuideUtil = {}));
|
|
47
|
+
//# sourceMappingURL=auth-guide.js.map
|
|
@@ -33,6 +33,8 @@ export declare namespace AuthUtil {
|
|
|
33
33
|
};
|
|
34
34
|
result?: 'done' | 'failed' | 'cancelled';
|
|
35
35
|
error?: string;
|
|
36
|
+
/** The service refused the key typed in, which was not kept: another one is to be typed. */
|
|
37
|
+
refused?: boolean;
|
|
36
38
|
}
|
|
37
39
|
function reduce(state: FlowState, event: TaAuthEvent): FlowState;
|
|
38
40
|
}
|