@celljs/ta-web 4.46.3 → 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/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/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-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 +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 +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/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/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 +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/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/dialogs.d.ts +1 -1
- package/esm/browser/style/dialogs.js +7 -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/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-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 +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 +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/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/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 +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/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/dialogs.d.ts +1 -1
- package/lib/browser/style/dialogs.js +7 -0
- package/package.json +7 -7
|
@@ -20,6 +20,8 @@ export interface ChatDraft {
|
|
|
20
20
|
/** Of this first message and its opening (openId, clientMessageId): sent again, it opens and runs once. */
|
|
21
21
|
id: string;
|
|
22
22
|
failed?: string;
|
|
23
|
+
/** The code of the error it failed with (OutboxMessage.code). */
|
|
24
|
+
code?: string;
|
|
23
25
|
heldAt?: number;
|
|
24
26
|
};
|
|
25
27
|
}
|
|
@@ -78,6 +80,11 @@ export interface TaChat {
|
|
|
78
80
|
resendDraft(): Promise<void>;
|
|
79
81
|
/** Takes back the first message that failed. */
|
|
80
82
|
discardDraft(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Sends again what failed for want of a model (TaErrorCode.NOT_SIGNED_IN), the first message of a new
|
|
85
|
+
* conversation or those of the one shown: the user has just connected one (SIGNED_IN_EVENT).
|
|
86
|
+
*/
|
|
87
|
+
resendSignedOut(): Promise<void>;
|
|
81
88
|
/** Stops the run of the conversation still opening, once it is there. */
|
|
82
89
|
stopDraft(): void;
|
|
83
90
|
/**
|
|
@@ -79,7 +79,7 @@ function DraftView({ draft, menu, aboveComposer, belowComposer }) {
|
|
|
79
79
|
content: [{ type: 'text', text: sending.message }, ...((_a = sending.images) !== null && _a !== void 0 ? _a : [])],
|
|
80
80
|
timestamp: Date.now(),
|
|
81
81
|
};
|
|
82
|
-
return SessionStore.withSent(SessionReducer.initial(), [{ id: 'draft', message, failed: sending.failed }]);
|
|
82
|
+
return SessionStore.withSent(SessionReducer.initial(), [{ id: 'draft', message, failed: sending.failed, code: sending.code }]);
|
|
83
83
|
}, [sending]);
|
|
84
84
|
const outbox = React.useMemo(() => ({ resend: () => void chat.resendDraft(), discard: () => chat.discardDraft() }), [chat]);
|
|
85
85
|
return (React.createElement("section", { className: "ta-session" },
|
|
@@ -20,6 +20,7 @@ export declare class TaChatImpl extends ChatShown implements TaChat {
|
|
|
20
20
|
protected holdDraft(sending: NonNullable<ChatDraft['sending']>): boolean;
|
|
21
21
|
resendDraft(): Promise<void>;
|
|
22
22
|
discardDraft(): void;
|
|
23
|
+
resendSignedOut(): Promise<void>;
|
|
23
24
|
stopDraft(): void;
|
|
24
25
|
show(session: string | Promise<string>, opening?: ChatOpening): Promise<void>;
|
|
25
26
|
/** A session the caller still opens: its place shows now, under a key no session has. */
|
package/esm/browser/chat/chat.js
CHANGED
|
@@ -6,7 +6,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { Component } from '@celljs/core';
|
|
8
8
|
import { HOLD_MS, TaRemoteError } from '@celljs/ta-client';
|
|
9
|
-
import { TaErrorCode } from '@celljs/ta-protocol';
|
|
9
|
+
import { TaErrorCode, TaErrorUtil } from '@celljs/ta-protocol';
|
|
10
|
+
import { SIGNED_IN_EVENT } from '../notices/notices.js';
|
|
10
11
|
import { StateUtil } from '../state/state-protocol.js';
|
|
11
12
|
import { FrameUtil } from '../util/frame.js';
|
|
12
13
|
import { REMOVED_CHATS, TaChat } from './chat-protocol.js';
|
|
@@ -33,6 +34,9 @@ let TaChatImpl = class TaChatImpl extends ChatShown {
|
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
});
|
|
37
|
+
if (typeof window !== 'undefined') {
|
|
38
|
+
window.addEventListener(SIGNED_IN_EVENT, () => void this.resendSignedOut());
|
|
39
|
+
}
|
|
36
40
|
}
|
|
37
41
|
if (this.current.store || this.current.draft) {
|
|
38
42
|
return;
|
|
@@ -148,7 +152,8 @@ let TaChatImpl = class TaChatImpl extends ChatShown {
|
|
|
148
152
|
// No conversation: the message stays, marked, to send again; for a lost connection, once it is back.
|
|
149
153
|
const failed = this.current.draft;
|
|
150
154
|
if ((failed === null || failed === void 0 ? void 0 : failed.sending) && !(ChatUtil.lost(error) && this.holdDraft(failed.sending))) {
|
|
151
|
-
|
|
155
|
+
const code = TaErrorUtil.code(error);
|
|
156
|
+
this.update({ draft: { ...failed, sending: { ...failed.sending, failed: ChatUtil.message(error), ...(code ? { code } : {}) } } });
|
|
152
157
|
}
|
|
153
158
|
return;
|
|
154
159
|
}
|
|
@@ -188,7 +193,7 @@ let TaChatImpl = class TaChatImpl extends ChatShown {
|
|
|
188
193
|
}
|
|
189
194
|
// With its id: one that opened before the failure was told is not opened again.
|
|
190
195
|
this.stopping = false;
|
|
191
|
-
this.update({ draft: { ...draft, sending: { ...draft.sending, failed: undefined, heldAt: undefined } } });
|
|
196
|
+
this.update({ draft: { ...draft, sending: { ...draft.sending, failed: undefined, code: undefined, heldAt: undefined } } });
|
|
192
197
|
return this.openDraft();
|
|
193
198
|
}
|
|
194
199
|
discardDraft() {
|
|
@@ -198,6 +203,13 @@ let TaChatImpl = class TaChatImpl extends ChatShown {
|
|
|
198
203
|
this.update({ draft: { ...draft, sending: undefined } });
|
|
199
204
|
}
|
|
200
205
|
}
|
|
206
|
+
async resendSignedOut() {
|
|
207
|
+
var _a, _b, _c;
|
|
208
|
+
if (((_b = (_a = this.current.draft) === null || _a === void 0 ? void 0 : _a.sending) === null || _b === void 0 ? void 0 : _b.code) === TaErrorCode.NOT_SIGNED_IN) {
|
|
209
|
+
await this.resendDraft();
|
|
210
|
+
}
|
|
211
|
+
await ((_c = this.current.store) === null || _c === void 0 ? void 0 : _c.resendFailed(TaErrorCode.NOT_SIGNED_IN));
|
|
212
|
+
}
|
|
201
213
|
stopDraft() {
|
|
202
214
|
var _a;
|
|
203
215
|
if ((_a = this.current.draft) === null || _a === void 0 ? void 0 : _a.sending) {
|
|
@@ -3,7 +3,7 @@ import type { ComposerAction } from '../components/composer-box-protocol.js';
|
|
|
3
3
|
import type { Translate } from '../i18n/use-t.js';
|
|
4
4
|
import type { ChatDraft } from './chat-protocol.js';
|
|
5
5
|
export declare namespace DraftModelUtil {
|
|
6
|
-
/** The model entry of the + of a new conversation: the models with credentials, the picked one checked, else
|
|
6
|
+
/** The model entry of the + of a new conversation: the models with credentials, the picked one checked, else the one it would work with. */
|
|
7
7
|
function action(snapshot: TaSettingsSnapshot, picked: string | undefined, pick: (model: string) => void, t: Translate): ComposerAction;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
@@ -2,9 +2,9 @@ import * as React from 'react';
|
|
|
2
2
|
import { ModelPickerUtil } from '../components/model-picker.js';
|
|
3
3
|
export var DraftModelUtil;
|
|
4
4
|
(function (DraftModelUtil) {
|
|
5
|
-
/** The model entry of the + of a new conversation: the models with credentials, the picked one checked, else
|
|
5
|
+
/** The model entry of the + of a new conversation: the models with credentials, the picked one checked, else the one it would work with. */
|
|
6
6
|
function action(snapshot, picked, pick, t) {
|
|
7
|
-
return ModelPickerUtil.action(snapshot, picked !== null && picked !== void 0 ? picked : ModelPickerUtil.
|
|
7
|
+
return ModelPickerUtil.action(snapshot, picked !== null && picked !== void 0 ? picked : ModelPickerUtil.initialModel(snapshot), pick, t);
|
|
8
8
|
}
|
|
9
9
|
DraftModelUtil.action = action;
|
|
10
10
|
})(DraftModelUtil || (DraftModelUtil = {}));
|
|
@@ -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. */
|
|
@@ -2,6 +2,7 @@ import { ArrowLeftRight, Download, Info, KeyRound, LogIn, LogOut, MonitorSmartph
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useAccountInfo, useAccountSide } from '../account/account-side.js';
|
|
4
4
|
import { DeviceAccount } from '../account/device-account.js';
|
|
5
|
+
import { AppUpdate, useAppUpdate } from '../device/app-update.js';
|
|
5
6
|
import { useDevice } from '../device/device.js';
|
|
6
7
|
import { WebLabelUtil } from '../extension/web-extension-protocol.js';
|
|
7
8
|
import { useNotices, usePersisted, usePwa, useWebExtensions, useWorkbench } from '../hooks.js';
|
|
@@ -30,6 +31,7 @@ export function useAccountEntries(onSettings, onDialog) {
|
|
|
30
31
|
// A finger has no keys to learn; a phone is not the computer that pairs phones.
|
|
31
32
|
const { touch, handheld } = useDevice();
|
|
32
33
|
const restartTa = useRestartTa();
|
|
34
|
+
const appUpdate = useAppUpdate();
|
|
33
35
|
// The vault, while its package is on: the one place for the sign-ins, keys and personal details of the account.
|
|
34
36
|
const vault = useSecretPeek().manage;
|
|
35
37
|
const [, notices] = useNotices();
|
|
@@ -80,6 +82,9 @@ export function useAccountEntries(onSettings, onDialog) {
|
|
|
80
82
|
if (update) {
|
|
81
83
|
entry('restart', t('ta.update.restartTo', { version: ServeRestartUtil.label(update) }), RotateCw, () => void restartTa.restart(), { action: true });
|
|
82
84
|
}
|
|
85
|
+
if (appUpdate) {
|
|
86
|
+
entry('appUpdate', t('ta.appUpdate.installTo', { version: appUpdate.version }), Download, () => AppUpdate.install(), { action: true });
|
|
87
|
+
}
|
|
83
88
|
entry('install', t('ta.pwa.install'), Download, () => void pwa.install(), { action: true });
|
|
84
89
|
// As WeChat's: the account in use kept, with its computers, to come back to in one tap (docs/design/ta-me.md 4).
|
|
85
90
|
entry('signIn', t('ta.me.signIn'), LogIn, () => onDialog('signIn'));
|
|
@@ -89,11 +94,13 @@ export function useAccountEntries(onSettings, onDialog) {
|
|
|
89
94
|
vault: Boolean(vault),
|
|
90
95
|
own: own.map(view => view.id),
|
|
91
96
|
update: Boolean(update),
|
|
97
|
+
appUpdate: Boolean(appUpdate),
|
|
92
98
|
installable: installable && !standalone,
|
|
93
99
|
switchAccount: app && signedIn,
|
|
94
100
|
// The account is who the user is, not one of their devices (docs/design/ta-me.md 4).
|
|
95
101
|
signIn: Boolean(info) && !signedIn,
|
|
96
102
|
pairPhone: !app && !handheld,
|
|
103
|
+
signOut: signedIn || WorkbenchUtil.elsewhere(host),
|
|
97
104
|
}).map(group => group.map(key => entries[key]));
|
|
98
105
|
}
|
|
99
106
|
/** What the entries of the account open over the page. */
|
|
@@ -154,6 +161,8 @@ export function useAccount() {
|
|
|
154
161
|
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'),
|
|
155
162
|
account: account !== null && account !== void 0 ? account : undefined,
|
|
156
163
|
service: server && online ? `${state} · v${server.version}` : state,
|
|
164
|
+
/** What the line of the connection calls the computer Ta runs on: this one, or another. */
|
|
165
|
+
computer: t(WorkbenchUtil.elsewhere(host) ? 'ta.account.service' : 'ta.account.thisComputer'),
|
|
157
166
|
};
|
|
158
167
|
}
|
|
159
168
|
/** Moves the focus through the items of a menu with the arrow keys. */
|
|
@@ -207,7 +216,7 @@ export function AccountMenu({ onSettings, active }) {
|
|
|
207
216
|
((_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))),
|
|
208
217
|
React.createElement("div", { className: "ta-account-service", title: account.server ? `Ta v${account.server.version}` : undefined },
|
|
209
218
|
React.createElement("span", { className: `ta-account-state ${account.online ? 'ta-ok' : 'ta-warn'}` }),
|
|
210
|
-
React.createElement("span", { className: "ta-account-service-name" },
|
|
219
|
+
React.createElement("span", { className: "ta-account-service-name" }, account.computer),
|
|
211
220
|
React.createElement("span", { className: "ta-account-service-state" }, account.service)),
|
|
212
221
|
groups
|
|
213
222
|
.filter(group => group.length > 0)
|
|
@@ -13,7 +13,7 @@ import { ConnectionBanner } from './connection-bar.js';
|
|
|
13
13
|
import { useContextMenu } from './context-menu.js';
|
|
14
14
|
import { Dino } from './dino.js';
|
|
15
15
|
import { IconButton } from './icon.js';
|
|
16
|
-
import { DISCOVER, entryHold, hasDiscover, places } from './nav-places.js';
|
|
16
|
+
import { DISCOVER, discoverFirst, entryHold, hasDiscover, places } from './nav-places.js';
|
|
17
17
|
import { PageStackContext } from './phone-shell.js';
|
|
18
18
|
import { DinoFace } from './ta-avatar.js';
|
|
19
19
|
import { UnseenDrop } from './unseen-drop.js';
|
|
@@ -31,10 +31,13 @@ export function useNavigation(views) {
|
|
|
31
31
|
const onOpen = React.useMemo(() => pages.filter(page => page.onOpen && page.place === 'discover'), [pages]);
|
|
32
32
|
// The pages a page lists (a game, on the Games page) are there, not in the navigation or under Discover.
|
|
33
33
|
const listed = React.useMemo(() => new Set(pages.filter(page => page.place === 'list').map(page => page.id)), [pages]);
|
|
34
|
+
const infos = React.useMemo(() => new Map(pages.map(page => [page.id, page])), [pages]);
|
|
34
35
|
return {
|
|
35
36
|
...places(views.filter(view => !listed.has(view.id)), setting, handheld, onOpen.length > 0),
|
|
36
37
|
onOpen,
|
|
37
38
|
setting,
|
|
39
|
+
...(settings.allFeatures ? {} : { first: (id) => discoverFirst(infos.get(id), Date.now()) }),
|
|
40
|
+
showAll: on => store.update({ allFeatures: on }),
|
|
38
41
|
pin: id => update(NavigationUtil.pin(setting, id)),
|
|
39
42
|
fold: id => update(NavigationUtil.fold(setting, id)),
|
|
40
43
|
update,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AppUpdate, useAppUpdate } from '../device/app-update.js';
|
|
3
|
+
import { useNotices } from '../hooks.js';
|
|
4
|
+
import { useT } from '../i18n/use-t.js';
|
|
5
|
+
import { storage } from '../workbench-util.js';
|
|
6
|
+
/** The version of the phone app the user put off installing (Later): not told of again on this device. */
|
|
7
|
+
const LATER_KEY = 'ta.appUpdate.later';
|
|
8
|
+
/** Tells once of each newer version of the phone app that does not update itself (AppUpdates), with Update and Later. */
|
|
9
|
+
export function AppUpdateNotices() {
|
|
10
|
+
const t = useT();
|
|
11
|
+
const [, notices] = useNotices();
|
|
12
|
+
const offer = useAppUpdate();
|
|
13
|
+
const told = React.useRef(undefined);
|
|
14
|
+
React.useEffect(() => {
|
|
15
|
+
var _a;
|
|
16
|
+
if (told.current && told.current.version !== (offer === null || offer === void 0 ? void 0 : offer.version)) {
|
|
17
|
+
notices.dismiss(told.current.id);
|
|
18
|
+
told.current = undefined;
|
|
19
|
+
}
|
|
20
|
+
if (!offer || told.current || ((_a = storage()) === null || _a === void 0 ? void 0 : _a.getItem(LATER_KEY)) === offer.version) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const { version } = offer;
|
|
24
|
+
told.current = {
|
|
25
|
+
version,
|
|
26
|
+
id: notices.notify(t('ta.appUpdate.available', { version }), {
|
|
27
|
+
detail: t('ta.appUpdate.detail'),
|
|
28
|
+
key: 'ta-app-update',
|
|
29
|
+
sticky: true,
|
|
30
|
+
actions: [{ label: t('ta.update.later'), run: () => { var _a; return (_a = storage()) === null || _a === void 0 ? void 0 : _a.setItem(LATER_KEY, version); } }],
|
|
31
|
+
action: { label: t('ta.appUpdate.update'), run: () => AppUpdate.install() },
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
}, [offer, notices, t]);
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=app-update-view.js.map
|
|
@@ -4,11 +4,12 @@ import { AssistantChatList } from '../assistant/assistant-chat-list.js';
|
|
|
4
4
|
import { ChatView } from '../chat/chat-view.js';
|
|
5
5
|
import { WebCwdUtil } from '../extension/web-extension-protocol.js';
|
|
6
6
|
import { usePersisted } from '../hooks.js';
|
|
7
|
-
import { SIGN_IN_EVENT } from '../notices/notices.js';
|
|
7
|
+
import { SIGN_IN_EVENT, SIGNED_IN_EVENT } from '../notices/notices.js';
|
|
8
8
|
import { AppContexts } from './app-contexts.js';
|
|
9
9
|
import { PageView, Rail, SidebarView } from './app-nav.js';
|
|
10
10
|
import { LOGIN_LATER, RAIL } from './app-shell-hooks.js';
|
|
11
11
|
import { useAppShell } from './app-shell-state.js';
|
|
12
|
+
import { AppUpdateNotices } from './app-update-view.js';
|
|
12
13
|
import { AuthUtil, LoginPage, useAuthProviders } from './auth-view.js';
|
|
13
14
|
import { BoardSurface } from './board.js';
|
|
14
15
|
import { ChatAskUtil } from './chat-asks.js';
|
|
@@ -21,6 +22,7 @@ import { DiscoverView } from './discover-view.js';
|
|
|
21
22
|
import { EditorArea } from './editor-area.js';
|
|
22
23
|
import { EntryHoldUtil, useCallGoingOn } from './entry-holds.js';
|
|
23
24
|
import { EnvironmentPage } from './environment-view.js';
|
|
25
|
+
import { useFirstSteps } from './first-steps.js';
|
|
24
26
|
import { DeviceOverlays } from './host-view.js';
|
|
25
27
|
import { IconButton, SidebarLeft } from './icon.js';
|
|
26
28
|
import { KeptCallBar } from './kept-call-bar.js';
|
|
@@ -66,12 +68,27 @@ export function AppShell() {
|
|
|
66
68
|
window.addEventListener(SIGN_IN_EVENT, ask);
|
|
67
69
|
return () => window.removeEventListener(SIGN_IN_EVENT, ask);
|
|
68
70
|
}, [reloadProviders]);
|
|
71
|
+
// Models now where there were none (a key, an account, an agent installed meanwhile): the page of sign-in is done
|
|
72
|
+
// with, and what failed for want of one goes (TaChat.resendSignedOut).
|
|
73
|
+
const signedIn = providers && AuthUtil.signedIn(providers);
|
|
74
|
+
const hadModels = React.useRef(undefined);
|
|
75
|
+
React.useEffect(() => {
|
|
76
|
+
if (signedIn === undefined) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (signedIn && hadModels.current === false) {
|
|
80
|
+
setAsked(false);
|
|
81
|
+
window.dispatchEvent(new Event(SIGNED_IN_EVENT));
|
|
82
|
+
}
|
|
83
|
+
hadModels.current = signedIn;
|
|
84
|
+
}, [signedIn]);
|
|
69
85
|
const doubleId = DOUBLE_PAGE;
|
|
70
86
|
// Where Ta's agents read the page to be, and go (docs/design/ta-app-use.md 3): set below as it renders.
|
|
71
87
|
const screenShell = useScreenNavigator();
|
|
72
88
|
const inCall = useCallGoingOn();
|
|
73
89
|
// 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
|
|
74
90
|
// messenger's; what waits for the user to decide is counted there until answered.
|
|
91
|
+
useFirstSteps(workbench.status === 'online', workbench.sessions, workbench.saved);
|
|
75
92
|
const { listed: listedChats, unseen: chatsUnseen } = useChatsDot({
|
|
76
93
|
sessions: workbench.sessions,
|
|
77
94
|
saved: workbench.saved,
|
|
@@ -97,6 +114,8 @@ export function AppShell() {
|
|
|
97
114
|
}, onSignedIn: () => {
|
|
98
115
|
setAsked(false);
|
|
99
116
|
reloadProviders();
|
|
117
|
+
// What failed for want of a model goes now (TaChat.resendSignedOut).
|
|
118
|
+
window.dispatchEvent(new Event(SIGNED_IN_EVENT));
|
|
100
119
|
}, onProviders: reloadProviders }));
|
|
101
120
|
}
|
|
102
121
|
// What the columns beside the conversation and the editors take, so that the editors never take more than the conversation.
|
|
@@ -152,6 +171,7 @@ export function AppShell() {
|
|
|
152
171
|
React.createElement(LinkDialog, null),
|
|
153
172
|
React.createElement(RemotePrompts, null),
|
|
154
173
|
React.createElement(ServeRestartNotices, null),
|
|
174
|
+
React.createElement(AppUpdateNotices, null),
|
|
155
175
|
React.createElement(DeviceOverlays, null),
|
|
156
176
|
codeScan && React.createElement(ScanHost, { onCode: text => void codeScan.open(text), onAsk: askDouble }),
|
|
157
177
|
React.createElement(ShareHost, null),
|
|
@@ -196,7 +216,7 @@ export function AppShell() {
|
|
|
196
216
|
showPage(id);
|
|
197
217
|
}
|
|
198
218
|
};
|
|
199
|
-
const discoverView = (leading) => (React.createElement(DiscoverView, { pages: navigation.discover, onOpenPages: navigation.onOpen, onOpen: openDiscovered, onPin: pinDiscovered, onSettings: () => openSettings('navigation'), onScan: codeScan && (() => void codeScan.scan()), leading: leading }));
|
|
219
|
+
const discoverView = (leading) => (React.createElement(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 }));
|
|
200
220
|
const keptPages = EntryHoldUtil.kept(extensions.kept, inCall, tabView);
|
|
201
221
|
const holds = EntryHoldUtil.holds({
|
|
202
222
|
double: () => {
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which providers of keys the page of models puts first, by the language of the page, and how to get their keys
|
|
3
|
+
* (docs/design/ta-simple.md 5, 3 and 8): one a newcomer can pay for and reach from where that language is spoken.
|
|
4
|
+
*/
|
|
5
|
+
export var AuthGuideUtil;
|
|
6
|
+
(function (AuthGuideUtil) {
|
|
7
|
+
const GUIDES = {
|
|
8
|
+
deepseek: { keys: 'https://platform.deepseek.com/api_keys', pricing: 'https://api-docs.deepseek.com/quick_start/pricing' },
|
|
9
|
+
'moonshotai-cn': { keys: 'https://platform.kimi.com/console/api-keys', pricing: 'https://platform.kimi.com/docs/pricing/chat' },
|
|
10
|
+
openai: { keys: 'https://platform.openai.com/api-keys', pricing: 'https://openai.com/api/pricing/' },
|
|
11
|
+
anthropic: { keys: 'https://platform.claude.com/settings/keys', pricing: 'https://claude.com/pricing' },
|
|
12
|
+
google: { keys: 'https://aistudio.google.com/apikey', pricing: 'https://ai.google.dev/gemini-api/docs/pricing' },
|
|
13
|
+
};
|
|
14
|
+
/** By the first part of the language (`zh`), or the whole of it (`zh-TW`); English for the others. */
|
|
15
|
+
const RECOMMENDED = {
|
|
16
|
+
zh: ['deepseek', 'moonshotai-cn'],
|
|
17
|
+
'zh-TW': ['deepseek', 'openai', 'google'],
|
|
18
|
+
en: ['openai', 'anthropic', 'google'],
|
|
19
|
+
ja: ['openai', 'anthropic', 'google'],
|
|
20
|
+
};
|
|
21
|
+
function guide(providerId) {
|
|
22
|
+
return GUIDES[providerId];
|
|
23
|
+
}
|
|
24
|
+
AuthGuideUtil.guide = guide;
|
|
25
|
+
/** The ids of the providers of keys put first for `language` (a locale, `zh-CN`). */
|
|
26
|
+
function recommended(language) {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
return (_b = (_a = RECOMMENDED[language]) !== null && _a !== void 0 ? _a : RECOMMENDED[language.split('-')[0]]) !== null && _b !== void 0 ? _b : RECOMMENDED.en;
|
|
29
|
+
}
|
|
30
|
+
AuthGuideUtil.recommended = recommended;
|
|
31
|
+
/**
|
|
32
|
+
* The providers of keys as the page lists them before a search: those recommended for `language`, in their order,
|
|
33
|
+
* and those the user added or signed in to, first; the others under "more".
|
|
34
|
+
*/
|
|
35
|
+
function split(keys, language) {
|
|
36
|
+
const ids = recommended(language);
|
|
37
|
+
const own = (provider) => !!provider.custom || !!provider.configured;
|
|
38
|
+
const picked = ids.map(id => keys.find(provider => provider.id === id && !own(provider))).filter((one) => !!one);
|
|
39
|
+
const first = [...keys.filter(own), ...picked];
|
|
40
|
+
return { first, more: keys.filter(provider => !first.includes(provider)) };
|
|
41
|
+
}
|
|
42
|
+
AuthGuideUtil.split = split;
|
|
43
|
+
})(AuthGuideUtil || (AuthGuideUtil = {}));
|
|
44
|
+
//# 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
|
}
|
|
@@ -5,8 +5,9 @@ import { useBackLayer } from '../device/back-stack.js';
|
|
|
5
5
|
import { ExtensionBoundary } from '../extension/extension-view.js';
|
|
6
6
|
import { WebLabelUtil } from '../extension/web-extension-protocol.js';
|
|
7
7
|
import { useNotices, useWebExtensions, useWorkbench } from '../hooks.js';
|
|
8
|
-
import { useT } from '../i18n/use-t.js';
|
|
8
|
+
import { useLanguage, useT } from '../i18n/use-t.js';
|
|
9
9
|
import { WorkbenchUtil } from '../workbench-util.js';
|
|
10
|
+
import { AuthGuideUtil } from './auth-guide.js';
|
|
10
11
|
import { AuthPicture } from './auth-pictures.js';
|
|
11
12
|
import { Callout } from './callout.js';
|
|
12
13
|
import { CustomProviderForm } from './custom-provider-view.js';
|
|
@@ -55,7 +56,7 @@ export var AuthUtil;
|
|
|
55
56
|
case 'done':
|
|
56
57
|
return { ...state, prompt: undefined, result: 'done' };
|
|
57
58
|
case 'failed':
|
|
58
|
-
return { ...state, prompt: undefined, result: event.cancelled ? 'cancelled' : 'failed', error: event.message };
|
|
59
|
+
return { ...state, prompt: undefined, result: event.cancelled ? 'cancelled' : 'failed', error: event.message, refused: event.refused };
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
AuthUtil.reduce = reduce;
|
|
@@ -86,7 +87,7 @@ function open(url) {
|
|
|
86
87
|
window.open(url, '_blank', 'noopener,noreferrer');
|
|
87
88
|
}
|
|
88
89
|
/** One sign-in, run on the server: what it shows, and what it asks. */
|
|
89
|
-
function AuthFlow({ provider, onDone, onBack }) {
|
|
90
|
+
function AuthFlow({ provider, onDone, onBack, onRetry }) {
|
|
90
91
|
var _a, _b, _c;
|
|
91
92
|
const t = useT();
|
|
92
93
|
const [workbench, bench] = useWorkbench();
|
|
@@ -140,6 +141,7 @@ function AuthFlow({ provider, onDone, onBack }) {
|
|
|
140
141
|
}
|
|
141
142
|
};
|
|
142
143
|
const kind = provider.type === 'api_key' ? t('ta.auth.apiKey') : provider.subscription ? t('ta.auth.subscription') : t('ta.auth.account');
|
|
144
|
+
const guide = provider.type === 'api_key' ? AuthGuideUtil.guide(provider.id) : undefined;
|
|
143
145
|
return (React.createElement("div", { className: "ta-auth-flow" },
|
|
144
146
|
React.createElement("div", { className: "ta-auth-flow-head" },
|
|
145
147
|
React.createElement(IconButton, { icon: ArrowLeft, label: t('ta.auth.back'), onClick: onBack }),
|
|
@@ -197,9 +199,15 @@ function AuthFlow({ provider, onDone, onBack }) {
|
|
|
197
199
|
React.createElement("label", { className: "ta-field" },
|
|
198
200
|
React.createElement(KeyRound, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" }),
|
|
199
201
|
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) })),
|
|
202
|
+
prompt.prompt.type === 'secret' && guide && (React.createElement("p", { className: "ta-auth-guide" },
|
|
203
|
+
t('ta.auth.keyGuide', { name: provider.name }),
|
|
204
|
+
' ',
|
|
205
|
+
React.createElement("a", { href: guide.keys, target: "_blank", rel: "noreferrer", className: "ta-auth-link" }, t('ta.auth.keyPage')),
|
|
206
|
+
' · ',
|
|
207
|
+
React.createElement("a", { href: guide.pricing, target: "_blank", rel: "noreferrer", className: "ta-auth-link" }, t('ta.auth.pricing')))),
|
|
200
208
|
React.createElement("button", { type: "submit", className: "ta-button ta-primary ta-wide", disabled: !answer.trim() }, t('ta.auth.continue'))))),
|
|
201
209
|
!state.result && !prompt && React.createElement(Loading, { compact: true, label: (_b = state.progress) !== null && _b !== void 0 ? _b : t('ta.auth.waiting') }),
|
|
202
|
-
state.result === 'failed' && (React.createElement(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 : '' })))));
|
|
210
|
+
state.result === 'failed' && (React.createElement(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 : '' })))));
|
|
203
211
|
}
|
|
204
212
|
function ProviderRow({ provider, onPick, onSignOut, plain }) {
|
|
205
213
|
var _a, _b;
|
|
@@ -258,7 +266,12 @@ export function AuthPanel({ onSignedIn, onProviders, kinds }) {
|
|
|
258
266
|
const [, notices] = useNotices();
|
|
259
267
|
const [providers, reload] = useAuthProviders(workbench.status === 'online');
|
|
260
268
|
const [picked, setPicked] = React.useState();
|
|
269
|
+
/** Sign-ins of `picked` begun: one more begins it again, as after a key the service refused. */
|
|
270
|
+
const [tries, setTries] = React.useState(0);
|
|
261
271
|
const [words, setWords] = React.useState('');
|
|
272
|
+
const language = useLanguage();
|
|
273
|
+
/** The providers of keys under "more" are shown. */
|
|
274
|
+
const [more, setMore] = React.useState(false);
|
|
262
275
|
/** On the first page: which way the user chose, before the providers of that way. */
|
|
263
276
|
const [kind, setKind] = React.useState();
|
|
264
277
|
/** A provider the user adds by its address (`new`), or one added so, being changed. */
|
|
@@ -284,7 +297,7 @@ export function AuthPanel({ onSignedIn, onProviders, kinds }) {
|
|
|
284
297
|
} }));
|
|
285
298
|
}
|
|
286
299
|
if (picked) {
|
|
287
|
-
return React.createElement(AuthFlow, { provider: picked, onDone: done, onBack: back });
|
|
300
|
+
return React.createElement(AuthFlow, { key: tries, provider: picked, onDone: done, onBack: back, onRetry: () => setTries(value => value + 1) });
|
|
288
301
|
}
|
|
289
302
|
if (!providers) {
|
|
290
303
|
return React.createElement(Loading, null);
|
|
@@ -327,10 +340,16 @@ export function AuthPanel({ onSignedIn, onProviders, kinds }) {
|
|
|
327
340
|
const offered = AuthUtil.offered(providers, words);
|
|
328
341
|
const accounts = kind === 'api_key' ? [] : offered.accounts;
|
|
329
342
|
const keys = kind === 'oauth' ? [] : offered.keys;
|
|
330
|
-
|
|
343
|
+
// Before a search, a few to pick from (those of the language of the page, and the user's own); the others folded.
|
|
344
|
+
const split = words.trim() ? { first: keys, more: [] } : AuthGuideUtil.split(keys, language);
|
|
345
|
+
const shownKeys = more ? keys : split.first;
|
|
346
|
+
const group = (title, list, after) => (list.length > 0 || after) && (React.createElement("section", { className: "ta-auth-group" },
|
|
331
347
|
title && React.createElement("h3", null, title),
|
|
332
|
-
|
|
333
|
-
|
|
348
|
+
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) }))),
|
|
349
|
+
after));
|
|
350
|
+
const unfold = !more && split.more.length > 0 && (React.createElement("button", { type: "button", className: "ta-auth-item ta-auth-more", onClick: () => setMore(true) },
|
|
351
|
+
React.createElement("span", { className: "ta-auth-name" }, t('ta.auth.more', { count: split.more.length })),
|
|
352
|
+
React.createElement(Icon, { icon: ChevronRight, size: 15 })));
|
|
334
353
|
// Whatever is searched: a service not in the list is one to add.
|
|
335
354
|
const add = kind !== 'oauth' && (React.createElement("button", { type: "button", className: "ta-auth-item ta-custom-add", onClick: () => setEditing('new') },
|
|
336
355
|
React.createElement(Icon, { icon: Plus, size: 15 }),
|
|
@@ -346,7 +365,9 @@ export function AuthPanel({ onSignedIn, onProviders, kinds }) {
|
|
|
346
365
|
React.createElement("input", { placeholder: t('ta.auth.search'), value: words, onChange: event => setWords(event.target.value) })),
|
|
347
366
|
React.createElement("div", { className: "ta-auth-list" },
|
|
348
367
|
group(kind ? '' : t('ta.auth.accounts'), accounts),
|
|
349
|
-
group(kind ? '' : t('ta.auth.keys'),
|
|
368
|
+
group(kind ? '' : t('ta.auth.keys'), shownKeys, (unfold || add) && (React.createElement(React.Fragment, null,
|
|
369
|
+
unfold,
|
|
370
|
+
add))),
|
|
350
371
|
accounts.length + keys.length === 0 && !add && React.createElement(EmptyState, { compact: true, title: t('ta.auth.none') }))));
|
|
351
372
|
}
|
|
352
373
|
/** The model accounts, over the page (the gear menu). */
|