@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
|
@@ -0,0 +1,182 @@
|
|
|
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.AppUpdate = exports.AppUpdates = exports.AppUpdateUtil = void 0;
|
|
37
|
+
exports.useAppUpdate = useAppUpdate;
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const device_1 = require("./device");
|
|
40
|
+
var AppUpdateUtil;
|
|
41
|
+
(function (AppUpdateUtil) {
|
|
42
|
+
AppUpdateUtil.FILE = 'ta-app.json';
|
|
43
|
+
function source(value) {
|
|
44
|
+
const one = value;
|
|
45
|
+
if (!one || typeof one !== 'object' || typeof one.updates !== 'string' || !one.updates.startsWith('https://')) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
if (typeof one.target !== 'string' || typeof one.version !== 'string' || !Number.isFinite(one.build)) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
return { updates: one.updates, target: one.target, version: one.version, build: Number(one.build) };
|
|
52
|
+
}
|
|
53
|
+
AppUpdateUtil.source = source;
|
|
54
|
+
/**
|
|
55
|
+
* The build of the manifest when it is newer than the app's, with the link that installs it: the itms-services link
|
|
56
|
+
* the manifest gives (iOS), else the address of its file; either only of the site of the manifest.
|
|
57
|
+
*/
|
|
58
|
+
function offer(source, manifest) {
|
|
59
|
+
var _a;
|
|
60
|
+
const one = manifest;
|
|
61
|
+
const file = (_a = one === null || one === void 0 ? void 0 : one.files) === null || _a === void 0 ? void 0 : _a[source.target];
|
|
62
|
+
if (typeof (one === null || one === void 0 ? void 0 : one.version) !== 'string' || typeof one.build !== 'number' || !(one.build > source.build) || !file) {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
const link = linkOf(source.updates, file);
|
|
66
|
+
return link ? { version: one.version, build: one.build, link } : undefined;
|
|
67
|
+
}
|
|
68
|
+
AppUpdateUtil.offer = offer;
|
|
69
|
+
function linkOf(updates, file) {
|
|
70
|
+
var _a;
|
|
71
|
+
const site = new URL(updates).origin;
|
|
72
|
+
if (typeof file.install === 'string') {
|
|
73
|
+
const install = parse(file.install);
|
|
74
|
+
const manifest = (install === null || install === void 0 ? void 0 : install.protocol) === 'itms-services:' ? parse((_a = install.searchParams.get('url')) !== null && _a !== void 0 ? _a : '') : undefined;
|
|
75
|
+
return (manifest === null || manifest === void 0 ? void 0 : manifest.origin) === site ? file.install : undefined;
|
|
76
|
+
}
|
|
77
|
+
const at = typeof file.path === 'string' ? parse(file.path, updates) : undefined;
|
|
78
|
+
return (at === null || at === void 0 ? void 0 : at.origin) === site ? at.href : undefined;
|
|
79
|
+
}
|
|
80
|
+
function parse(url, base) {
|
|
81
|
+
try {
|
|
82
|
+
return new URL(url, base);
|
|
83
|
+
}
|
|
84
|
+
catch (_a) {
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
})(AppUpdateUtil || (exports.AppUpdateUtil = AppUpdateUtil = {}));
|
|
89
|
+
/**
|
|
90
|
+
* Newer versions of the phone app that does not update itself (the iPhone app signed for the company): read from the
|
|
91
|
+
* manifest of its download page as the app starts and each time it comes back to the front, and installed with a tap
|
|
92
|
+
* (the system asks, then puts the new version in its place, nothing lost). Nothing where the app does not say where its
|
|
93
|
+
* new versions are (AppUpdateSource); one not read (offline, outside the company's network) leaves what was known.
|
|
94
|
+
*/
|
|
95
|
+
class AppUpdates {
|
|
96
|
+
constructor(environment = browser) {
|
|
97
|
+
this.environment = environment;
|
|
98
|
+
this.started = false;
|
|
99
|
+
this.listeners = new Set();
|
|
100
|
+
}
|
|
101
|
+
get offer() {
|
|
102
|
+
this.start();
|
|
103
|
+
return this.current;
|
|
104
|
+
}
|
|
105
|
+
subscribe(listener) {
|
|
106
|
+
this.listeners.add(listener);
|
|
107
|
+
return () => this.listeners.delete(listener);
|
|
108
|
+
}
|
|
109
|
+
start() {
|
|
110
|
+
if (this.started) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this.started = true;
|
|
114
|
+
const env = this.environment();
|
|
115
|
+
if (!env) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
void this.check(env);
|
|
119
|
+
env.onForeground(() => void this.check(env));
|
|
120
|
+
}
|
|
121
|
+
install() {
|
|
122
|
+
var _a;
|
|
123
|
+
if (this.current) {
|
|
124
|
+
(_a = this.environment()) === null || _a === void 0 ? void 0 : _a.open(this.current.link);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
async check(env) {
|
|
128
|
+
var _a;
|
|
129
|
+
var _b;
|
|
130
|
+
(_b = this.source) !== null && _b !== void 0 ? _b : (this.source = env.own().then(AppUpdateUtil.source, () => undefined));
|
|
131
|
+
const source = await this.source;
|
|
132
|
+
if (!source) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const manifest = await env.get(source.updates).catch(() => undefined);
|
|
136
|
+
if (manifest === undefined) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const offer = AppUpdateUtil.offer(source, manifest);
|
|
140
|
+
if ((offer === null || offer === void 0 ? void 0 : offer.build) !== ((_a = this.current) === null || _a === void 0 ? void 0 : _a.build)) {
|
|
141
|
+
this.current = offer;
|
|
142
|
+
for (const listener of this.listeners) {
|
|
143
|
+
listener();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.AppUpdates = AppUpdates;
|
|
149
|
+
/** The Ta app (Capacitor): its own file read from its page, the manifest by its HTTP plugin (no CORS there); none in a browser. */
|
|
150
|
+
function browser() {
|
|
151
|
+
const http = typeof window === 'undefined' ? undefined : (0, device_1.nativePlugin)('CapacitorHttp');
|
|
152
|
+
if (!http) {
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
own: async () => {
|
|
157
|
+
const response = await fetch(new URL(AppUpdateUtil.FILE, document.baseURI), { cache: 'no-store' });
|
|
158
|
+
return response.ok ? response.json() : undefined;
|
|
159
|
+
},
|
|
160
|
+
get: async (url) => {
|
|
161
|
+
const response = (await http('get', { url, responseType: 'json', headers: { 'Cache-Control': 'no-cache' } }));
|
|
162
|
+
if (!response || !(Number(response.status) < 400)) {
|
|
163
|
+
throw new Error(`${url}: ${response === null || response === void 0 ? void 0 : response.status}`);
|
|
164
|
+
}
|
|
165
|
+
return typeof response.data === 'string' ? JSON.parse(response.data) : response.data;
|
|
166
|
+
},
|
|
167
|
+
onForeground: listener => document.addEventListener('visibilitychange', () => {
|
|
168
|
+
if (document.visibilityState === 'visible') {
|
|
169
|
+
listener();
|
|
170
|
+
}
|
|
171
|
+
}),
|
|
172
|
+
open: link => {
|
|
173
|
+
window.location.href = link;
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
exports.AppUpdate = new AppUpdates();
|
|
178
|
+
/** The newer version of the phone app to install, while there is one. */
|
|
179
|
+
function useAppUpdate() {
|
|
180
|
+
return React.useSyncExternalStore(listener => exports.AppUpdate.subscribe(listener), () => exports.AppUpdate.offer, () => undefined);
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=app-update.js.map
|
|
@@ -70,6 +70,7 @@ exports.WEB_ICONS = Object.freeze({
|
|
|
70
70
|
Ellipsis: lucide_react_1.Ellipsis,
|
|
71
71
|
ExternalLink: lucide_react_1.ExternalLink,
|
|
72
72
|
Eye: lucide_react_1.Eye,
|
|
73
|
+
EyeOff: lucide_react_1.EyeOff,
|
|
73
74
|
File: lucide_react_1.File,
|
|
74
75
|
FileArchive: lucide_react_1.FileArchive,
|
|
75
76
|
FileDiff: lucide_react_1.FileDiff,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Part of the web extension API (web-extension-api.ts, which exports it all): what an extension registers, and what the page tells it of them. */
|
|
2
|
-
import type { TaRoomInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import type { TaRoomInfo, TaTier } from '@celljs/ta-protocol';
|
|
3
3
|
import type * as React from 'react';
|
|
4
4
|
import type { WebIcon } from './web-extension-api';
|
|
5
5
|
export type * from './web-api-call';
|
|
@@ -23,6 +23,11 @@ export interface WebSettingsSection {
|
|
|
23
23
|
group?: WebSettingsGroup;
|
|
24
24
|
/** Smaller first among those of extensions in its group, then as registered; default 100 (negative: before Ta's). */
|
|
25
25
|
order?: number;
|
|
26
|
+
/**
|
|
27
|
+
* `common` for a section most people look for (docs/design/ta-simple.md 4.2), shown from the start; the others (the
|
|
28
|
+
* default) a row away, under More settings, and found by the search. Newer than some Ta apps, which show all.
|
|
29
|
+
*/
|
|
30
|
+
tier?: TaTier;
|
|
26
31
|
rows: WebSettingRow[];
|
|
27
32
|
/** A store of Settings → Storage (TaStorageInfo.id): its rows show under it there; older Ta apps list it as a section. */
|
|
28
33
|
storage?: string;
|
|
@@ -169,6 +169,12 @@ export interface WebPartnersUI {
|
|
|
169
169
|
* Ta apps: `pi.ui.openPartner?.(…)`.
|
|
170
170
|
*/
|
|
171
171
|
openPartner(id: string, kind?: WebPartnerKind): Promise<boolean>;
|
|
172
|
+
/**
|
|
173
|
+
* The partners of every extension as the page lists them, now and each time they change, until the function it
|
|
174
|
+
* returns is called: for what follows who the user works with (Screenshot mask hides the names of friends). Newer
|
|
175
|
+
* than some Ta apps: `pi.ui.onPartners?.(…)`.
|
|
176
|
+
*/
|
|
177
|
+
onPartners(listener: (partners: readonly WebPartnerEntry[]) => void): () => void;
|
|
172
178
|
/**
|
|
173
179
|
* Picks people as every picker of Ta does (WebPeoplePickerProps): never a `<select>` or checkboxes of one's own.
|
|
174
180
|
* Newer than some Ta apps: `pi.ui.PeoplePicker` may be missing.
|
|
@@ -157,6 +157,7 @@ exports.WEB_UI_SPEC = {
|
|
|
157
157
|
openHome: page,
|
|
158
158
|
startGroup: page,
|
|
159
159
|
openPartner: page,
|
|
160
|
+
onPartners: page,
|
|
160
161
|
};
|
|
161
162
|
/** What each member of `pi` needs and how it crosses: one entry each, the only place it is said (3.2). */
|
|
162
163
|
exports.WEB_API_SPEC = {
|
|
@@ -71,6 +71,15 @@ var WebHomeUtil;
|
|
|
71
71
|
await partner.open();
|
|
72
72
|
return true;
|
|
73
73
|
},
|
|
74
|
+
onPartners: listener => {
|
|
75
|
+
const tell = () => {
|
|
76
|
+
if (!stopped()) {
|
|
77
|
+
listener(extensions.partners.partners());
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
tell();
|
|
81
|
+
return extensions.partners.subscribe(tell);
|
|
82
|
+
},
|
|
74
83
|
PeoplePicker: people_picker_1.PeoplePicker,
|
|
75
84
|
};
|
|
76
85
|
}
|
|
@@ -23,6 +23,9 @@ export declare class WebMetrics {
|
|
|
23
23
|
dispose(): void;
|
|
24
24
|
/** One of `item` (`page:main`, `web:load`) of the package of `extension`. */
|
|
25
25
|
record(extension: string | undefined, item: string, err?: boolean, ms?: number): void;
|
|
26
|
+
/** One of `item` of Ta's own pages (`page:settings`, `step:first-reply`), in TA_METRICS_OWN. */
|
|
27
|
+
own(item: string, ms?: number): void;
|
|
28
|
+
protected add(pkg: string, item: string, err: boolean, ms: number | undefined): void;
|
|
26
29
|
/** What threw where an extension drew (ExtensionBoundary). */
|
|
27
30
|
renderError(extension: string | undefined): void;
|
|
28
31
|
/** What was counted, told when it may be; dropped when the service does not take it. */
|
|
@@ -45,34 +45,45 @@ class WebMetrics {
|
|
|
45
45
|
}
|
|
46
46
|
/** One of `item` (`page:main`, `web:load`) of the package of `extension`. */
|
|
47
47
|
record(extension, item, err = false, ms) {
|
|
48
|
-
var _a, _b;
|
|
49
48
|
try {
|
|
50
49
|
const pkg = extension === undefined ? undefined : this.packageOf(extension);
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
const key = `${pkg}\u0000${item}`;
|
|
55
|
-
let one = this.counts.get(key);
|
|
56
|
-
if (!one) {
|
|
57
|
-
if (this.counts.size >= ta_protocol_1.TA_METRICS_BATCH) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
one = { pkg, item, n: 0 };
|
|
61
|
-
this.counts.set(key, one);
|
|
62
|
-
}
|
|
63
|
-
one.n++;
|
|
64
|
-
if (err) {
|
|
65
|
-
one.err = ((_a = one.err) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
66
|
-
}
|
|
67
|
-
if (ms !== undefined && Number.isFinite(ms) && ms >= 0) {
|
|
68
|
-
(_b = one.ms) !== null && _b !== void 0 ? _b : (one.ms = new Array(ta_protocol_1.TA_METRICS_BOUNDS.length + 1).fill(0));
|
|
69
|
-
one.ms[ta_protocol_1.TaMetricsUtil.bucket(ms)]++;
|
|
50
|
+
if (pkg) {
|
|
51
|
+
this.add(pkg, item, err, ms);
|
|
70
52
|
}
|
|
71
53
|
}
|
|
72
|
-
catch (
|
|
54
|
+
catch (_a) {
|
|
73
55
|
// Never to what it counts.
|
|
74
56
|
}
|
|
75
57
|
}
|
|
58
|
+
/** One of `item` of Ta's own pages (`page:settings`, `step:first-reply`), in TA_METRICS_OWN. */
|
|
59
|
+
own(item, ms) {
|
|
60
|
+
try {
|
|
61
|
+
this.add(ta_protocol_1.TA_METRICS_OWN, item, false, ms);
|
|
62
|
+
}
|
|
63
|
+
catch (_a) {
|
|
64
|
+
// Never to what it counts.
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
add(pkg, item, err, ms) {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
const key = `${pkg}\u0000${item}`;
|
|
70
|
+
let one = this.counts.get(key);
|
|
71
|
+
if (!one) {
|
|
72
|
+
if (this.counts.size >= ta_protocol_1.TA_METRICS_BATCH) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
one = { pkg, item, n: 0 };
|
|
76
|
+
this.counts.set(key, one);
|
|
77
|
+
}
|
|
78
|
+
one.n++;
|
|
79
|
+
if (err) {
|
|
80
|
+
one.err = ((_a = one.err) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
81
|
+
}
|
|
82
|
+
if (ms !== undefined && Number.isFinite(ms) && ms >= 0) {
|
|
83
|
+
(_b = one.ms) !== null && _b !== void 0 ? _b : (one.ms = new Array(ta_protocol_1.TA_METRICS_BOUNDS.length + 1).fill(0));
|
|
84
|
+
one.ms[ta_protocol_1.TaMetricsUtil.bucket(ms)]++;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
76
87
|
/** What threw where an extension drew (ExtensionBoundary). */
|
|
77
88
|
renderError(extension) {
|
|
78
89
|
this.record(extension, 'render:view', true);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TaTemporaryInfo, TaWebExtensionInfo } from '@celljs/ta-protocol';
|
|
1
|
+
import type { TaTemporaryInfo, TaTier, TaWebExtensionInfo } from '@celljs/ta-protocol';
|
|
2
2
|
import type { StateSpec } from '../state/state-protocol';
|
|
3
3
|
import type { WebIcon } from './web-extension-api';
|
|
4
4
|
import { type WebViewEntry } from './web-extension-protocol';
|
|
@@ -42,6 +42,8 @@ export interface WebPageInfo {
|
|
|
42
42
|
category?: string;
|
|
43
43
|
/** Its group under Discover: WebView.group, or `pi.group` of its package for one started on open (TaWebExtensionInfo.group). */
|
|
44
44
|
group?: string;
|
|
45
|
+
/** `pi.tier` of its package (TaWebExtensionInfo.tier): who it is for, as Discover lists it (DiscoverUtil.split). */
|
|
46
|
+
tier?: TaTier;
|
|
45
47
|
/** For a page of a temporary package: `id` is that of its web extension, for `packages.updateTemporaryPackage` and the rest. */
|
|
46
48
|
temporary?: TaTemporaryInfo & {
|
|
47
49
|
id: string;
|
|
@@ -63,6 +63,7 @@ var WebPagesUtil;
|
|
|
63
63
|
const own = (info) => ({
|
|
64
64
|
...(info && info.origin !== 'builtin' ? { extensionId: info.id, source: info.source } : {}),
|
|
65
65
|
...((info === null || info === void 0 ? void 0 : info.category) ? { category: info.category } : {}),
|
|
66
|
+
...((info === null || info === void 0 ? void 0 : info.tier) ? { tier: info.tier } : {}),
|
|
66
67
|
});
|
|
67
68
|
const lazy = new Set(onOpen.map(entry => entry.info.id));
|
|
68
69
|
const pages = views
|
|
@@ -39,6 +39,7 @@ const lucide_react_1 = require("lucide-react");
|
|
|
39
39
|
const React = __importStar(require("react"));
|
|
40
40
|
const busy_1 = require("../components/busy");
|
|
41
41
|
const callout_1 = require("../components/callout");
|
|
42
|
+
const conversation_scroll_hooks_1 = require("../components/conversation-scroll-hooks");
|
|
42
43
|
const icon_1 = require("../components/icon");
|
|
43
44
|
const loading_1 = require("../components/loading");
|
|
44
45
|
const hooks_1 = require("../hooks");
|
|
@@ -58,7 +59,7 @@ function ActivityList({ tenantId, sessionId }) {
|
|
|
58
59
|
const t = (0, use_t_1.useT)();
|
|
59
60
|
const language = (0, use_t_1.useLanguage)();
|
|
60
61
|
const [, bench] = (0, hooks_1.useWorkbench)();
|
|
61
|
-
const { value, error } = (0, console_parts_1.
|
|
62
|
+
const { value, error } = (0, console_parts_1.useConsoleValue)(() => bench.gateway.getAgentActivity(tenantId, sessionId), `${tenantId}|${sessionId}`, console_parts_1.REFRESH_MS);
|
|
62
63
|
if (error && !value) {
|
|
63
64
|
return React.createElement("p", { className: "ta-console-activity-empty" }, error);
|
|
64
65
|
}
|
|
@@ -122,7 +123,7 @@ function AgentsSection({ tenant }) {
|
|
|
122
123
|
const [, bench] = (0, hooks_1.useWorkbench)();
|
|
123
124
|
const own = tenant.environment.provider === 'own';
|
|
124
125
|
const running = tenant.environment.status === 'running' && !own;
|
|
125
|
-
const { value: agents, error } = (0, console_parts_1.
|
|
126
|
+
const { value: agents, error } = (0, console_parts_1.useConsoleValue)(() => (running ? bench.gateway.getTenantAgents(tenant.id) : Promise.resolve(undefined)), `${tenant.id}|${running}`, console_parts_1.REFRESH_MS);
|
|
126
127
|
const totals = agents === null || agents === void 0 ? void 0 : agents.totals;
|
|
127
128
|
return (React.createElement(console_parts_1.Section, { title: t('ta.console.agents'), hint: running && agents ? t('ta.console.agentsPrivacy') : undefined }, !running ? (React.createElement(console_parts_1.Card, null,
|
|
128
129
|
React.createElement("p", { className: "ta-console-empty" }, own ? t('ta.console.agentsOwn') : t('ta.console.agentsStopped')))) : error && !agents ? (React.createElement(callout_1.Callout, { level: "warning" }, error)) : !agents ? (React.createElement(loading_1.Loading, { compact: true })) : (React.createElement(React.Fragment, null,
|
|
@@ -142,24 +143,19 @@ function LogsSection({ tenant, info }) {
|
|
|
142
143
|
const [, notices] = (0, hooks_1.useNotices)();
|
|
143
144
|
const [logs, setLogs] = React.useState();
|
|
144
145
|
const [busy, run] = (0, busy_1.useBusy)();
|
|
145
|
-
const box = React.useRef(null);
|
|
146
146
|
const hasLogs = tenant.environment.provider !== 'own' && info.providers.some(provider => provider.id === tenant.environment.provider && provider.logs);
|
|
147
|
-
const read =
|
|
148
|
-
// The latest lines are what one looks for: the box starts at its end.
|
|
149
|
-
|
|
150
|
-
React.useLayoutEffect(() => {
|
|
151
|
-
if (box.current) {
|
|
152
|
-
box.current.scrollTop = box.current.scrollHeight;
|
|
153
|
-
}
|
|
154
|
-
}, [logs]);
|
|
147
|
+
const read = () => bench.gateway.getTenantLogs(tenant.id, 300).then(text => setLogs(terminal_text_1.TerminalText.plain(text).trimEnd()), error => notices.error(error));
|
|
148
|
+
// The latest lines are what one looks for: the box starts at its end, again as other lines are read.
|
|
149
|
+
const box = (0, conversation_scroll_hooks_1.useConversationScroll)(0, { sentTo: 'bottom', key: logs });
|
|
155
150
|
if (!hasLogs) {
|
|
156
151
|
return null;
|
|
157
152
|
}
|
|
158
|
-
return (React.createElement(console_parts_1.Section, { title: t('ta.console.logs'), action: logs !== undefined ? React.createElement(icon_1.IconButton, { icon: lucide_react_1.RefreshCw, label: t('ta.console.refresh'), busy: busy, onClick: () => void read
|
|
159
|
-
React.createElement("button", { type: "button", className: `ta-console-entry ta-console-press${busy ? ' ta-busy' : ''}`, onClick: () => void read
|
|
153
|
+
return (React.createElement(console_parts_1.Section, { title: t('ta.console.logs'), action: logs !== undefined ? React.createElement(icon_1.IconButton, { icon: lucide_react_1.RefreshCw, label: t('ta.console.refresh'), busy: busy, onClick: () => void run(read) }) : undefined }, logs === undefined ? (React.createElement(console_parts_1.Card, null,
|
|
154
|
+
React.createElement("button", { type: "button", className: `ta-console-entry ta-console-press${busy ? ' ta-busy' : ''}`, onClick: () => void run(read) },
|
|
160
155
|
React.createElement("span", { className: "ta-console-entry-text" },
|
|
161
156
|
React.createElement("span", { className: "ta-console-entry-label" }, t('ta.console.logsShow')),
|
|
162
157
|
React.createElement("span", { className: "ta-console-entry-hint" }, t('ta.console.logsAudited'))),
|
|
163
|
-
busy ? (React.createElement("span", { className: "ta-spinner ta-busy-mark", "aria-hidden": "true" })) : (React.createElement(icon_1.Icon, { icon: lucide_react_1.ChevronRight, size: 15, className: "ta-console-chevron" }))))) : (React.createElement("
|
|
158
|
+
busy ? (React.createElement("span", { className: "ta-spinner ta-busy-mark", "aria-hidden": "true" })) : (React.createElement(icon_1.Icon, { icon: lucide_react_1.ChevronRight, size: 15, className: "ta-console-chevron" }))))) : (React.createElement("div", { ref: box, className: "ta-console-logs" },
|
|
159
|
+
React.createElement("pre", null, logs || t('ta.console.logsEmpty'))))));
|
|
164
160
|
}
|
|
165
161
|
//# sourceMappingURL=console-agents.js.map
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type TaEnvironmentStatus, type TaQuotaState } from '@celljs/ta-protocol';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
/** How often what the console shows is read again while it is seen. */
|
|
3
|
+
/** How often what the console shows that the gateway cannot know (the agents at work in a tenant's Ta) is read again while it is seen. */
|
|
4
4
|
export declare const REFRESH_MS = 10000;
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Reads `load` now, again as the gateway tells what it keeps changed (TaServeChanges.GATEWAY) and when `key` changes;
|
|
7
|
+
* `every` ms too while seen, for what it shows that the gateway cannot know.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useConsoleValue<T>(load: () => Promise<T>, key: unknown, every?: number): {
|
|
7
10
|
value: T | undefined;
|
|
8
11
|
error: string | undefined;
|
|
9
12
|
read: () => Promise<void>;
|
|
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.REFRESH_MS = void 0;
|
|
37
|
-
exports.
|
|
37
|
+
exports.useConsoleValue = useConsoleValue;
|
|
38
38
|
exports.Section = Section;
|
|
39
39
|
exports.Card = Card;
|
|
40
40
|
exports.Bar = Bar;
|
|
@@ -42,8 +42,10 @@ exports.MeterRow = MeterRow;
|
|
|
42
42
|
exports.Stats = Stats;
|
|
43
43
|
exports.TenantFace = TenantFace;
|
|
44
44
|
exports.QuotaMeters = QuotaMeters;
|
|
45
|
+
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
45
46
|
const React = __importStar(require("react"));
|
|
46
47
|
const access_view_1 = require("../components/access-view");
|
|
48
|
+
const serve_value_1 = require("../components/serve-value");
|
|
47
49
|
const use_t_1 = require("../i18n/use-t");
|
|
48
50
|
const console_util_1 = require("./console-util");
|
|
49
51
|
/*
|
|
@@ -51,27 +53,16 @@ const console_util_1 = require("./console-util");
|
|
|
51
53
|
* card holds rows parted by lines (`Card`), numbers side by side are one strip (`Stats`), and what is used of a
|
|
52
54
|
* limit is a row with a bar (`MeterRow`).
|
|
53
55
|
*/
|
|
54
|
-
/** How often what the console shows is read again while it is seen. */
|
|
56
|
+
/** How often what the console shows that the gateway cannot know (the agents at work in a tenant's Ta) is read again while it is seen. */
|
|
55
57
|
exports.REFRESH_MS = 10000;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
setValue(next);
|
|
65
|
-
setError(undefined);
|
|
66
|
-
setReadAt(Date.now());
|
|
67
|
-
}, (cause) => setError(cause.message)), []);
|
|
68
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: read again whenever what is read changes
|
|
69
|
-
React.useEffect(() => {
|
|
70
|
-
setValue(undefined);
|
|
71
|
-
void read();
|
|
72
|
-
const timer = setInterval(() => document.visibilityState === 'visible' && void read(), every);
|
|
73
|
-
return () => clearInterval(timer);
|
|
74
|
-
}, [key, read, every]);
|
|
58
|
+
const TOPICS = [ta_protocol_1.TaServeChanges.GATEWAY];
|
|
59
|
+
/**
|
|
60
|
+
* Reads `load` now, again as the gateway tells what it keeps changed (TaServeChanges.GATEWAY) and when `key` changes;
|
|
61
|
+
* `every` ms too while seen, for what it shows that the gateway cannot know.
|
|
62
|
+
*/
|
|
63
|
+
function useConsoleValue(load, key, every) {
|
|
64
|
+
const { value, failed, read, readAt } = (0, serve_value_1.useServeValue)(load, { key, topics: TOPICS, every });
|
|
65
|
+
const error = failed === undefined ? undefined : failed instanceof Error ? failed.message : String(failed);
|
|
75
66
|
return { value, error, read, readAt };
|
|
76
67
|
}
|
|
77
68
|
/** A title over what it is the title of; `action` on the right of the title, `hint` under the content. */
|
|
@@ -105,7 +105,7 @@ function TrendCard({ tenantId, tenants, onTenant }) {
|
|
|
105
105
|
const [, bench] = (0, hooks_1.useWorkbench)();
|
|
106
106
|
const [range, setRange] = React.useState(7);
|
|
107
107
|
const [metric, setMetric] = React.useState('tokens');
|
|
108
|
-
const { value: trend, error } = (0, console_parts_1.
|
|
108
|
+
const { value: trend, error } = (0, console_parts_1.useConsoleValue)(() => bench.gateway.getUsageTrend(range === 1 ? 2 : range, tenantId), `${range}|${tenantId}`);
|
|
109
109
|
const points = trend ? console_util_1.ConsoleUtil.points(trend, range) : undefined;
|
|
110
110
|
const totals = points === null || points === void 0 ? void 0 : points.reduce((sum, point) => ({ tokens: sum.tokens + point.tokens, cost: sum.cost + point.cost, turns: sum.turns + point.turns }), {
|
|
111
111
|
tokens: 0,
|
|
@@ -75,13 +75,15 @@ function UpdatesCallout({ info, onChanged }) {
|
|
|
75
75
|
confirmLabel: t('ta.console.updateAll'),
|
|
76
76
|
});
|
|
77
77
|
if (confirmed) {
|
|
78
|
-
await
|
|
78
|
+
await bench.gateway
|
|
79
79
|
.updateTenants()
|
|
80
80
|
.then(onChanged)
|
|
81
|
-
.catch(error => notices.error(error))
|
|
81
|
+
.catch(error => notices.error(error));
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
return (React.createElement(callout_1.Callout, { level: "info", action: React.createElement("button", { type: "button", className: `ta-link-button${busy ? ' ta-busy' : ''}`, disabled: busy, onClick: () => void
|
|
84
|
+
return (React.createElement(callout_1.Callout, { level: "info", action: React.createElement("button", { type: "button", className: `ta-link-button${busy ? ' ta-busy' : ''}`, disabled: busy, onClick: () => void run(updateAll) },
|
|
85
|
+
React.createElement(busy_1.BusyMark, { busy: busy }),
|
|
86
|
+
t('ta.console.updateAll')) }, t('ta.console.updatesAvailable', { count: behind.length, version })));
|
|
85
87
|
}
|
|
86
88
|
/** When running Ta move to a newer version, picked as a limit is; and a look for a newer one now. */
|
|
87
89
|
function UpdatesSection({ info, onChanged }) {
|
|
@@ -198,7 +198,7 @@ function Audit() {
|
|
|
198
198
|
const t = (0, use_t_1.useT)();
|
|
199
199
|
const language = (0, use_t_1.useLanguage)();
|
|
200
200
|
const [, bench] = (0, hooks_1.useWorkbench)();
|
|
201
|
-
const { value } = (0, console_parts_1.
|
|
201
|
+
const { value } = (0, console_parts_1.useConsoleValue)(() => bench.gateway.getAudit(50), 'audit');
|
|
202
202
|
if (!value) {
|
|
203
203
|
return React.createElement(loading_1.Loading, { compact: true });
|
|
204
204
|
}
|
|
@@ -283,13 +283,13 @@ function ConsolePage() {
|
|
|
283
283
|
const t = (0, use_t_1.useT)();
|
|
284
284
|
const language = (0, use_t_1.useLanguage)();
|
|
285
285
|
const [, bench] = (0, hooks_1.useWorkbench)();
|
|
286
|
-
const { value: info, error, read, readAt } = (0, console_parts_1.
|
|
286
|
+
const { value: info, error, read, readAt } = (0, console_parts_1.useConsoleValue)(() => bench.gateway.getConsole(), 'console', console_parts_1.REFRESH_MS);
|
|
287
287
|
const [tab, setTab] = React.useState('overview');
|
|
288
288
|
const [filter, setFilter] = React.useState('all');
|
|
289
289
|
const [openId, setOpenId] = React.useState();
|
|
290
290
|
// Kept while the level slides away, so that it does not empty as it goes.
|
|
291
291
|
const [shownId, setShownId] = React.useState();
|
|
292
|
-
const [refreshing,
|
|
292
|
+
const [refreshing, run] = (0, busy_1.useBusy)();
|
|
293
293
|
const open = (id) => {
|
|
294
294
|
setShownId(id);
|
|
295
295
|
setOpenId(id);
|
|
@@ -304,7 +304,7 @@ function ConsolePage() {
|
|
|
304
304
|
const sub = info ? [info.version && `v${info.version}`, (_a = info.publicUrl) === null || _a === void 0 ? void 0 : _a.replace(/^https?:\/\//, '')].filter(Boolean).join(' · ') : '';
|
|
305
305
|
const list = (React.createElement("div", { className: "ta-list-scroll" },
|
|
306
306
|
React.createElement("div", { className: "ta-list-content ta-console-content" },
|
|
307
|
-
error !== undefined && !info && (React.createElement(callout_1.Callout, { level: "error", action: React.createElement(icon_1.IconButton, { icon: lucide_react_1.RefreshCw, label: t('ta.console.refresh'), onClick: () => void read
|
|
307
|
+
error !== undefined && !info && (React.createElement(callout_1.Callout, { level: "error", action: React.createElement(icon_1.IconButton, { icon: lucide_react_1.RefreshCw, label: t('ta.console.refresh'), busy: refreshing, onClick: () => void run(read) }) }, t('ta.console.failed'))),
|
|
308
308
|
info && (React.createElement(React.Fragment, null,
|
|
309
309
|
React.createElement(settings_controls_1.Segmented, { label: t('ta.console.title'), value: tab, onChange: setTab, choices: [
|
|
310
310
|
{ value: 'overview', label: 'ta.console.tabOverview' },
|
|
@@ -327,7 +327,7 @@ function ConsolePage() {
|
|
|
327
327
|
React.createElement("div", { className: "ta-main-title" },
|
|
328
328
|
React.createElement("span", null, openId && tenant ? tenant.name || tenant.account : t('ta.console.title')),
|
|
329
329
|
!openId && sub && React.createElement("span", { className: "ta-main-sub" }, sub)),
|
|
330
|
-
React.createElement(icon_1.IconButton, { icon: lucide_react_1.RefreshCw, label: t('ta.console.refresh'), busy: refreshing, onClick: () => void
|
|
330
|
+
React.createElement(icon_1.IconButton, { icon: lucide_react_1.RefreshCw, label: t('ta.console.refresh'), busy: refreshing, onClick: () => void run(read) }),
|
|
331
331
|
React.createElement(workbench_toggle_1.WorkbenchToggle, null)),
|
|
332
332
|
React.createElement(phone_shell_1.PhoneStack, { base: list, top: tenant && info ? React.createElement(console_tenant_1.TenantDetail, { tenant: tenant, info: info, onChanged: read }) : null, open: openId !== undefined && tenant !== undefined, onClose: () => setOpenId(undefined) })));
|
|
333
333
|
}
|
|
@@ -87,6 +87,7 @@ export declare const ACCOUNT_EN: {
|
|
|
87
87
|
'ta.presence.owner': string;
|
|
88
88
|
'ta.account': string;
|
|
89
89
|
'ta.account.service': string;
|
|
90
|
+
'ta.account.thisComputer': string;
|
|
90
91
|
'ta.account.menu': string;
|
|
91
92
|
'ta.me': string;
|
|
92
93
|
'ta.auth.title': string;
|
|
@@ -156,6 +157,12 @@ export declare const ACCOUNT_EN: {
|
|
|
156
157
|
'ta.auth.waiting': string;
|
|
157
158
|
'ta.auth.done': string;
|
|
158
159
|
'ta.auth.failed': string;
|
|
160
|
+
'ta.auth.keyGuide': string;
|
|
161
|
+
'ta.auth.keyPage': string;
|
|
162
|
+
'ta.auth.pricing': string;
|
|
163
|
+
'ta.auth.keyRefused': string;
|
|
164
|
+
'ta.auth.keyAgain': string;
|
|
165
|
+
'ta.auth.more': string;
|
|
159
166
|
'ta.auth.none': string;
|
|
160
167
|
'ta.auth.search': string;
|
|
161
168
|
'ta.auth.accountsTitle': string;
|
|
@@ -4,20 +4,20 @@ exports.ACCOUNT_EN = void 0;
|
|
|
4
4
|
/** The words of the account: signing in, who may come in, the devices, the vault, in ICU format. English is the source and the fallback. */
|
|
5
5
|
exports.ACCOUNT_EN = {
|
|
6
6
|
'ta.signin.title': 'Connect to Ta',
|
|
7
|
-
'ta.signin.hint': 'Run ta serve --web
|
|
8
|
-
'ta.signin.token': '
|
|
7
|
+
'ta.signin.hint': 'Run ta serve --web on the computer, which opens this page signed in, or paste the connection code (the token in ~/.ta/agent/serve.json on the computer).',
|
|
8
|
+
'ta.signin.token': 'Connection code',
|
|
9
9
|
'ta.signin.connect': 'Connect',
|
|
10
|
-
'ta.signin.refused': 'The Ta
|
|
10
|
+
'ta.signin.refused': 'The Ta on the computer did not accept the connection code, or it is not running.',
|
|
11
11
|
'ta.signin.pairHint': 'On your computer, run ta pair <relay> and paste the link it prints here. What goes through the relay is encrypted end to end.',
|
|
12
12
|
'ta.signin.pairing': 'Pairing link',
|
|
13
13
|
'ta.signin.pairRefused': 'Your Ta does not know this device: it may have been unpaired. Run ta pair again.',
|
|
14
|
-
'ta.signin.accountsHint': 'Sign in with your account, or paste the
|
|
14
|
+
'ta.signin.accountsHint': 'Sign in with your account, or paste the connection code of the Ta on your computer.',
|
|
15
15
|
'ta.signin.with': 'Continue with {name}',
|
|
16
16
|
'ta.signin.wechat': 'WeChat',
|
|
17
17
|
'ta.signin.orToken': 'or',
|
|
18
18
|
'ta.signin.denied': '{account} may not use this Ta yet. Its owner can let you in under Settings, Access.',
|
|
19
19
|
'ta.signin.failed': 'Signing in did not finish. Try again.',
|
|
20
|
-
'ta.signin.hintRemote': 'Open the sign-in link of your Ta
|
|
20
|
+
'ta.signin.hintRemote': 'Open the sign-in link of your Ta or gateway, or paste its connection code.',
|
|
21
21
|
'ta.access.title': 'Access',
|
|
22
22
|
'ta.access.bind': 'Sign in with your account',
|
|
23
23
|
'ta.access.bindHint': 'Lets in the account you sign in with, so that it signs you in next time, on any device.',
|
|
@@ -90,7 +90,8 @@ exports.ACCOUNT_EN = {
|
|
|
90
90
|
'ta.presence.more': ' +{count}',
|
|
91
91
|
'ta.presence.owner': 'Owner',
|
|
92
92
|
'ta.account': 'Account',
|
|
93
|
-
'ta.account.service': '
|
|
93
|
+
'ta.account.service': 'Computer',
|
|
94
|
+
'ta.account.thisComputer': 'This computer',
|
|
94
95
|
// The settings view and the menu of the account
|
|
95
96
|
'ta.account.menu': 'Account and settings',
|
|
96
97
|
'ta.me': 'Me',
|
|
@@ -161,6 +162,12 @@ exports.ACCOUNT_EN = {
|
|
|
161
162
|
'ta.auth.waiting': 'Waiting…',
|
|
162
163
|
'ta.auth.done': 'Signed in to {name}',
|
|
163
164
|
'ta.auth.failed': 'Could not sign in: {message}',
|
|
165
|
+
'ta.auth.keyGuide': 'Create a key on the site of {name} and paste it here; you pay for what you use.',
|
|
166
|
+
'ta.auth.keyPage': 'Create a key',
|
|
167
|
+
'ta.auth.pricing': 'Prices',
|
|
168
|
+
'ta.auth.keyRefused': '{name} did not take this key, so it was not saved. Copy it again.',
|
|
169
|
+
'ta.auth.keyAgain': 'Type it again',
|
|
170
|
+
'ta.auth.more': 'More providers ({count})',
|
|
164
171
|
'ta.auth.none': 'No matching providers',
|
|
165
172
|
'ta.auth.search': 'Search providers',
|
|
166
173
|
'ta.auth.accountsTitle': 'Model accounts',
|