@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
|
@@ -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,
|
|
@@ -55,6 +55,7 @@ const app_shell_hooks_1 = require("./app-shell-hooks");
|
|
|
55
55
|
const board_1 = require("./board");
|
|
56
56
|
const chat_asks_1 = require("./chat-asks");
|
|
57
57
|
const chat_list_util_1 = require("./chat-list-util");
|
|
58
|
+
const first_steps_util_1 = require("./first-steps-util");
|
|
58
59
|
const nav_places_1 = require("./nav-places");
|
|
59
60
|
const side_lists_1 = require("./side-lists");
|
|
60
61
|
const split_pane_1 = require("./split-pane");
|
|
@@ -145,10 +146,20 @@ function useAppShell() {
|
|
|
145
146
|
}, [offline, host]);
|
|
146
147
|
/** The conversation the page opens with is shown: those shown after are the user's doing. */
|
|
147
148
|
const started = React.useRef(false);
|
|
149
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: once a connection, with what the page has then
|
|
148
150
|
React.useEffect(() => {
|
|
149
151
|
if (online) {
|
|
150
152
|
void chat.start().then(() => {
|
|
151
153
|
started.current = true;
|
|
154
|
+
const { sessions, saved } = bench.state;
|
|
155
|
+
if (first_steps_util_1.FirstStepsUtil.startOnDouble({
|
|
156
|
+
phone,
|
|
157
|
+
page: host.state.page,
|
|
158
|
+
conversation: !!chat.state.store,
|
|
159
|
+
answered: first_steps_util_1.FirstStepsUtil.answered(sessions, saved),
|
|
160
|
+
})) {
|
|
161
|
+
host.showPage(side_lists_1.DOUBLE_PAGE);
|
|
162
|
+
}
|
|
152
163
|
});
|
|
153
164
|
}
|
|
154
165
|
}, [online, chat]);
|
|
@@ -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
|
|
@@ -45,6 +45,7 @@ const app_contexts_1 = require("./app-contexts");
|
|
|
45
45
|
const app_nav_1 = require("./app-nav");
|
|
46
46
|
const app_shell_hooks_1 = require("./app-shell-hooks");
|
|
47
47
|
const app_shell_state_1 = require("./app-shell-state");
|
|
48
|
+
const app_update_view_1 = require("./app-update-view");
|
|
48
49
|
const auth_view_1 = require("./auth-view");
|
|
49
50
|
const board_1 = require("./board");
|
|
50
51
|
const chat_asks_1 = require("./chat-asks");
|
|
@@ -57,6 +58,7 @@ const discover_view_1 = require("./discover-view");
|
|
|
57
58
|
const editor_area_1 = require("./editor-area");
|
|
58
59
|
const entry_holds_1 = require("./entry-holds");
|
|
59
60
|
const environment_view_1 = require("./environment-view");
|
|
61
|
+
const first_steps_1 = require("./first-steps");
|
|
60
62
|
const host_view_1 = require("./host-view");
|
|
61
63
|
const icon_1 = require("./icon");
|
|
62
64
|
const kept_call_bar_1 = require("./kept-call-bar");
|
|
@@ -102,12 +104,27 @@ function AppShell() {
|
|
|
102
104
|
window.addEventListener(notices_1.SIGN_IN_EVENT, ask);
|
|
103
105
|
return () => window.removeEventListener(notices_1.SIGN_IN_EVENT, ask);
|
|
104
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]);
|
|
105
121
|
const doubleId = side_lists_1.DOUBLE_PAGE;
|
|
106
122
|
// Where Ta's agents read the page to be, and go (docs/design/ta-app-use.md 3): set below as it renders.
|
|
107
123
|
const screenShell = (0, screen_navigator_1.useScreenNavigator)();
|
|
108
124
|
const inCall = (0, entry_holds_1.useCallGoingOn)();
|
|
109
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
|
|
110
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);
|
|
111
128
|
const { listed: listedChats, unseen: chatsUnseen } = (0, chats_dot_1.useChatsDot)({
|
|
112
129
|
sessions: workbench.sessions,
|
|
113
130
|
saved: workbench.saved,
|
|
@@ -133,6 +150,8 @@ function AppShell() {
|
|
|
133
150
|
}, onSignedIn: () => {
|
|
134
151
|
setAsked(false);
|
|
135
152
|
reloadProviders();
|
|
153
|
+
// What failed for want of a model goes now (TaChat.resendSignedOut).
|
|
154
|
+
window.dispatchEvent(new Event(notices_1.SIGNED_IN_EVENT));
|
|
136
155
|
}, onProviders: reloadProviders }));
|
|
137
156
|
}
|
|
138
157
|
// What the columns beside the conversation and the editors take, so that the editors never take more than the conversation.
|
|
@@ -188,6 +207,7 @@ function AppShell() {
|
|
|
188
207
|
React.createElement(link_dialog_1.LinkDialog, null),
|
|
189
208
|
React.createElement(remote_prompts_1.RemotePrompts, null),
|
|
190
209
|
React.createElement(serve_restart_1.ServeRestartNotices, null),
|
|
210
|
+
React.createElement(app_update_view_1.AppUpdateNotices, null),
|
|
191
211
|
React.createElement(host_view_1.DeviceOverlays, null),
|
|
192
212
|
codeScan && React.createElement(scan_screen_1.ScanHost, { onCode: text => void codeScan.open(text), onAsk: askDouble }),
|
|
193
213
|
React.createElement(share_dialog_1.ShareHost, null),
|
|
@@ -232,7 +252,7 @@ function AppShell() {
|
|
|
232
252
|
showPage(id);
|
|
233
253
|
}
|
|
234
254
|
};
|
|
235
|
-
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 }));
|
|
236
256
|
const keptPages = entry_holds_1.EntryHoldUtil.kept(extensions.kept, inCall, tabView);
|
|
237
257
|
const holds = entry_holds_1.EntryHoldUtil.holds({
|
|
238
258
|
double: () => {
|
|
@@ -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
|
}
|
|
@@ -47,6 +47,7 @@ const web_extension_protocol_1 = require("../extension/web-extension-protocol");
|
|
|
47
47
|
const hooks_1 = require("../hooks");
|
|
48
48
|
const use_t_1 = require("../i18n/use-t");
|
|
49
49
|
const workbench_util_1 = require("../workbench-util");
|
|
50
|
+
const auth_guide_1 = require("./auth-guide");
|
|
50
51
|
const auth_pictures_1 = require("./auth-pictures");
|
|
51
52
|
const callout_1 = require("./callout");
|
|
52
53
|
const custom_provider_view_1 = require("./custom-provider-view");
|
|
@@ -95,7 +96,7 @@ var AuthUtil;
|
|
|
95
96
|
case 'done':
|
|
96
97
|
return { ...state, prompt: undefined, result: 'done' };
|
|
97
98
|
case 'failed':
|
|
98
|
-
return { ...state, prompt: undefined, result: event.cancelled ? 'cancelled' : 'failed', error: event.message };
|
|
99
|
+
return { ...state, prompt: undefined, result: event.cancelled ? 'cancelled' : 'failed', error: event.message, refused: event.refused };
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
AuthUtil.reduce = reduce;
|
|
@@ -126,7 +127,7 @@ function open(url) {
|
|
|
126
127
|
window.open(url, '_blank', 'noopener,noreferrer');
|
|
127
128
|
}
|
|
128
129
|
/** One sign-in, run on the server: what it shows, and what it asks. */
|
|
129
|
-
function AuthFlow({ provider, onDone, onBack }) {
|
|
130
|
+
function AuthFlow({ provider, onDone, onBack, onRetry }) {
|
|
130
131
|
var _a, _b, _c;
|
|
131
132
|
const t = (0, use_t_1.useT)();
|
|
132
133
|
const [workbench, bench] = (0, hooks_1.useWorkbench)();
|
|
@@ -180,6 +181,7 @@ function AuthFlow({ provider, onDone, onBack }) {
|
|
|
180
181
|
}
|
|
181
182
|
};
|
|
182
183
|
const kind = provider.type === 'api_key' ? t('ta.auth.apiKey') : provider.subscription ? t('ta.auth.subscription') : t('ta.auth.account');
|
|
184
|
+
const guide = provider.type === 'api_key' ? auth_guide_1.AuthGuideUtil.guide(provider.id) : undefined;
|
|
183
185
|
return (React.createElement("div", { className: "ta-auth-flow" },
|
|
184
186
|
React.createElement("div", { className: "ta-auth-flow-head" },
|
|
185
187
|
React.createElement(icon_1.IconButton, { icon: lucide_react_1.ArrowLeft, label: t('ta.auth.back'), onClick: onBack }),
|
|
@@ -237,9 +239,15 @@ function AuthFlow({ provider, onDone, onBack }) {
|
|
|
237
239
|
React.createElement("label", { className: "ta-field" },
|
|
238
240
|
React.createElement(lucide_react_1.KeyRound, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" }),
|
|
239
241
|
React.createElement("input", { type: prompt.prompt.type === 'secret' ? 'password' : 'text', autoFocus: true, autoComplete: "off", spellCheck: false, placeholder: (_a = prompt.prompt.placeholder) !== null && _a !== void 0 ? _a : (prompt.prompt.type === 'secret' ? t('ta.auth.apiKey') : ''), value: answer, onChange: event => setAnswer(event.target.value) })),
|
|
242
|
+
prompt.prompt.type === 'secret' && guide && (React.createElement("p", { className: "ta-auth-guide" },
|
|
243
|
+
t('ta.auth.keyGuide', { name: provider.name }),
|
|
244
|
+
' ',
|
|
245
|
+
React.createElement("a", { href: guide.keys, target: "_blank", rel: "noreferrer", className: "ta-auth-link" }, t('ta.auth.keyPage')),
|
|
246
|
+
' · ',
|
|
247
|
+
React.createElement("a", { href: guide.pricing, target: "_blank", rel: "noreferrer", className: "ta-auth-link" }, t('ta.auth.pricing')))),
|
|
240
248
|
React.createElement("button", { type: "submit", className: "ta-button ta-primary ta-wide", disabled: !answer.trim() }, t('ta.auth.continue'))))),
|
|
241
249
|
!state.result && !prompt && React.createElement(loading_1.Loading, { compact: true, label: (_b = state.progress) !== null && _b !== void 0 ? _b : t('ta.auth.waiting') }),
|
|
242
|
-
state.result === 'failed' && (React.createElement(callout_1.Callout, { level: "error", action: React.createElement("button", { type: "button", className: "ta-button", onClick: onBack }, t('ta.auth.back')) }, t('ta.auth.failed', { message: (_c = state.error) !== null && _c !== void 0 ? _c : '' })))));
|
|
250
|
+
state.result === 'failed' && (React.createElement(callout_1.Callout, { level: "error", action: state.refused ? (React.createElement("button", { type: "button", className: "ta-button", onClick: onRetry }, t('ta.auth.keyAgain'))) : (React.createElement("button", { type: "button", className: "ta-button", onClick: onBack }, t('ta.auth.back'))) }, state.refused ? t('ta.auth.keyRefused', { name: provider.name }) : t('ta.auth.failed', { message: (_c = state.error) !== null && _c !== void 0 ? _c : '' })))));
|
|
243
251
|
}
|
|
244
252
|
function ProviderRow({ provider, onPick, onSignOut, plain }) {
|
|
245
253
|
var _a, _b;
|
|
@@ -298,7 +306,12 @@ function AuthPanel({ onSignedIn, onProviders, kinds }) {
|
|
|
298
306
|
const [, notices] = (0, hooks_1.useNotices)();
|
|
299
307
|
const [providers, reload] = useAuthProviders(workbench.status === 'online');
|
|
300
308
|
const [picked, setPicked] = React.useState();
|
|
309
|
+
/** Sign-ins of `picked` begun: one more begins it again, as after a key the service refused. */
|
|
310
|
+
const [tries, setTries] = React.useState(0);
|
|
301
311
|
const [words, setWords] = React.useState('');
|
|
312
|
+
const language = (0, use_t_1.useLanguage)();
|
|
313
|
+
/** The providers of keys under "more" are shown. */
|
|
314
|
+
const [more, setMore] = React.useState(false);
|
|
302
315
|
/** On the first page: which way the user chose, before the providers of that way. */
|
|
303
316
|
const [kind, setKind] = React.useState();
|
|
304
317
|
/** A provider the user adds by its address (`new`), or one added so, being changed. */
|
|
@@ -324,7 +337,7 @@ function AuthPanel({ onSignedIn, onProviders, kinds }) {
|
|
|
324
337
|
} }));
|
|
325
338
|
}
|
|
326
339
|
if (picked) {
|
|
327
|
-
return React.createElement(AuthFlow, { provider: picked, onDone: done, onBack: back });
|
|
340
|
+
return React.createElement(AuthFlow, { key: tries, provider: picked, onDone: done, onBack: back, onRetry: () => setTries(value => value + 1) });
|
|
328
341
|
}
|
|
329
342
|
if (!providers) {
|
|
330
343
|
return React.createElement(loading_1.Loading, null);
|
|
@@ -367,10 +380,16 @@ function AuthPanel({ onSignedIn, onProviders, kinds }) {
|
|
|
367
380
|
const offered = AuthUtil.offered(providers, words);
|
|
368
381
|
const accounts = kind === 'api_key' ? [] : offered.accounts;
|
|
369
382
|
const keys = kind === 'oauth' ? [] : offered.keys;
|
|
370
|
-
|
|
383
|
+
// Before a search, a few to pick from (those of the language of the page, and the user's own); the others folded.
|
|
384
|
+
const split = words.trim() ? { first: keys, more: [] } : auth_guide_1.AuthGuideUtil.split(keys, language);
|
|
385
|
+
const shownKeys = more ? keys : split.first;
|
|
386
|
+
const group = (title, list, after) => (list.length > 0 || after) && (React.createElement("section", { className: "ta-auth-group" },
|
|
371
387
|
title && React.createElement("h3", null, title),
|
|
372
|
-
|
|
373
|
-
|
|
388
|
+
list.map(provider => (React.createElement(ProviderRow, { key: AuthUtil.key(provider), provider: provider, plain: kind !== undefined, onPick: () => (provider.custom ? edit(provider) : setPicked(provider)), onSignOut: () => void signOut(provider) }))),
|
|
389
|
+
after));
|
|
390
|
+
const unfold = !more && split.more.length > 0 && (React.createElement("button", { type: "button", className: "ta-auth-item ta-auth-more", onClick: () => setMore(true) },
|
|
391
|
+
React.createElement("span", { className: "ta-auth-name" }, t('ta.auth.more', { count: split.more.length })),
|
|
392
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.ChevronRight, size: 15 })));
|
|
374
393
|
// Whatever is searched: a service not in the list is one to add.
|
|
375
394
|
const add = kind !== 'oauth' && (React.createElement("button", { type: "button", className: "ta-auth-item ta-custom-add", onClick: () => setEditing('new') },
|
|
376
395
|
React.createElement(icon_1.Icon, { icon: lucide_react_1.Plus, size: 15 }),
|
|
@@ -386,7 +405,9 @@ function AuthPanel({ onSignedIn, onProviders, kinds }) {
|
|
|
386
405
|
React.createElement("input", { placeholder: t('ta.auth.search'), value: words, onChange: event => setWords(event.target.value) })),
|
|
387
406
|
React.createElement("div", { className: "ta-auth-list" },
|
|
388
407
|
group(kind ? '' : t('ta.auth.accounts'), accounts),
|
|
389
|
-
group(kind ? '' : t('ta.auth.keys'),
|
|
408
|
+
group(kind ? '' : t('ta.auth.keys'), shownKeys, (unfold || add) && (React.createElement(React.Fragment, null,
|
|
409
|
+
unfold,
|
|
410
|
+
add))),
|
|
390
411
|
accounts.length + keys.length === 0 && !add && React.createElement(empty_state_1.EmptyState, { compact: true, title: t('ta.auth.none') }))));
|
|
391
412
|
}
|
|
392
413
|
/** The model accounts, over the page (the gear menu). */
|