@celljs/ta-web 4.20.0 → 4.22.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.
Files changed (153) hide show
  1. package/esm/browser/account/device-account.d.ts +65 -1
  2. package/esm/browser/account/device-account.js +206 -6
  3. package/esm/browser/assistant/assistant-chat-list.js +5 -1
  4. package/esm/browser/assistant/call-turn-end.d.ts +55 -0
  5. package/esm/browser/assistant/call-turn-end.js +68 -0
  6. package/esm/browser/assistant/realtime-voice.js +3 -3
  7. package/esm/browser/assistant/voice-call.d.ts +19 -28
  8. package/esm/browser/assistant/voice-call.js +64 -51
  9. package/esm/browser/components/account-menu.d.ts +9 -4
  10. package/esm/browser/components/account-menu.js +59 -22
  11. package/esm/browser/components/account-view.d.ts +33 -7
  12. package/esm/browser/components/account-view.js +140 -79
  13. package/esm/browser/components/chat-home-util.d.ts +13 -2
  14. package/esm/browser/components/chat-home-util.js +29 -0
  15. package/esm/browser/components/chat-home.d.ts +16 -4
  16. package/esm/browser/components/chat-home.js +9 -2
  17. package/esm/browser/components/chat-list.js +4 -2
  18. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  19. package/esm/browser/components/cloud-sign-in-view.js +4 -1
  20. package/esm/browser/components/host-view.d.ts +15 -8
  21. package/esm/browser/components/host-view.js +23 -70
  22. package/esm/browser/components/me-view.d.ts +2 -2
  23. package/esm/browser/components/me-view.js +7 -6
  24. package/esm/browser/components/partner-row.d.ts +17 -0
  25. package/esm/browser/components/partner-row.js +48 -0
  26. package/esm/browser/components/profile-view.d.ts +11 -0
  27. package/esm/browser/components/profile-view.js +85 -0
  28. package/esm/browser/components/workbench-view.js +42 -7
  29. package/esm/browser/extension/web-api-components.d.ts +2 -2
  30. package/esm/browser/extension/web-api-home.d.ts +1 -0
  31. package/esm/browser/extension/web-api-partners.d.ts +95 -0
  32. package/esm/browser/extension/web-api-partners.js +2 -0
  33. package/esm/browser/extension/web-extension-api.d.ts +3 -3
  34. package/esm/browser/extension/web-extension-context.js +2 -2
  35. package/esm/browser/extension/web-extension-protocol.d.ts +8 -2
  36. package/esm/browser/extension/web-extension-run.d.ts +2 -1
  37. package/esm/browser/extension/web-extension-run.js +1 -0
  38. package/esm/browser/extension/web-extensions-running.d.ts +2 -0
  39. package/esm/browser/extension/web-extensions-running.js +3 -0
  40. package/esm/browser/extension/web-extensions.d.ts +1 -1
  41. package/esm/browser/extension/web-home.d.ts +11 -19
  42. package/esm/browser/extension/web-home.js +15 -68
  43. package/esm/browser/extension/web-partners.d.ts +8 -0
  44. package/esm/browser/extension/web-partners.js +13 -0
  45. package/esm/browser/extension/web-row-board.d.ts +38 -0
  46. package/esm/browser/extension/web-row-board.js +79 -0
  47. package/esm/browser/i18n/locales.d.ts +31 -1
  48. package/esm/browser/i18n/messages-ja.js +34 -4
  49. package/esm/browser/i18n/messages-zh-tw.js +34 -4
  50. package/esm/browser/i18n/messages.d.ts +30 -0
  51. package/esm/browser/i18n/messages.js +68 -8
  52. package/esm/browser/index.d.ts +4 -0
  53. package/esm/browser/index.js +4 -0
  54. package/esm/browser/partners/group-picker.d.ts +18 -0
  55. package/esm/browser/partners/group-picker.js +81 -0
  56. package/esm/browser/partners/partners-extension.d.ts +14 -0
  57. package/esm/browser/partners/partners-extension.js +61 -0
  58. package/esm/browser/partners/partners-util.d.ts +32 -0
  59. package/esm/browser/partners/partners-util.js +68 -0
  60. package/esm/browser/partners/partners-view.d.ts +32 -0
  61. package/esm/browser/partners/partners-view.js +103 -0
  62. package/esm/browser/style/chat-list.d.ts +1 -1
  63. package/esm/browser/style/chat-list.js +18 -0
  64. package/esm/browser/style/conversation-column.d.ts +1 -1
  65. package/esm/browser/style/conversation-column.js +2 -1
  66. package/esm/browser/style/dialogs.d.ts +1 -1
  67. package/esm/browser/style/dialogs.js +6 -0
  68. package/esm/browser/style/layout.d.ts +1 -1
  69. package/esm/browser/style/layout.js +1 -1
  70. package/esm/browser/style/pages.d.ts +1 -1
  71. package/esm/browser/style/pages.js +6 -0
  72. package/esm/browser/util/turn-end.d.ts +8 -0
  73. package/esm/browser/util/turn-end.js +78 -35
  74. package/esm/browser/workbench-hosts.d.ts +4 -1
  75. package/esm/browser/workbench-hosts.js +17 -0
  76. package/esm/browser/workbench-protocol.d.ts +8 -0
  77. package/lib/browser/account/device-account.d.ts +65 -1
  78. package/lib/browser/account/device-account.js +206 -6
  79. package/lib/browser/assistant/assistant-chat-list.js +5 -1
  80. package/lib/browser/assistant/call-turn-end.d.ts +56 -0
  81. package/lib/browser/assistant/call-turn-end.js +72 -0
  82. package/lib/browser/assistant/realtime-voice.js +3 -3
  83. package/lib/browser/assistant/voice-call.d.ts +19 -28
  84. package/lib/browser/assistant/voice-call.js +67 -54
  85. package/lib/browser/components/account-menu.d.ts +9 -4
  86. package/lib/browser/components/account-menu.js +57 -20
  87. package/lib/browser/components/account-view.d.ts +33 -7
  88. package/lib/browser/components/account-view.js +142 -77
  89. package/lib/browser/components/chat-home-util.d.ts +13 -2
  90. package/lib/browser/components/chat-home-util.js +29 -0
  91. package/lib/browser/components/chat-home.d.ts +16 -4
  92. package/lib/browser/components/chat-home.js +9 -1
  93. package/lib/browser/components/chat-list.js +4 -2
  94. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  95. package/lib/browser/components/cloud-sign-in-view.js +4 -1
  96. package/lib/browser/components/host-view.d.ts +15 -8
  97. package/lib/browser/components/host-view.js +22 -68
  98. package/lib/browser/components/me-view.d.ts +2 -2
  99. package/lib/browser/components/me-view.js +7 -6
  100. package/lib/browser/components/partner-row.d.ts +18 -0
  101. package/lib/browser/components/partner-row.js +84 -0
  102. package/lib/browser/components/profile-view.d.ts +12 -0
  103. package/lib/browser/components/profile-view.js +123 -0
  104. package/lib/browser/components/workbench-view.js +39 -4
  105. package/lib/browser/extension/web-api-components.d.ts +2 -2
  106. package/lib/browser/extension/web-api-home.d.ts +1 -0
  107. package/lib/browser/extension/web-api-partners.d.ts +96 -0
  108. package/lib/browser/extension/web-api-partners.js +3 -0
  109. package/lib/browser/extension/web-extension-api.d.ts +3 -3
  110. package/lib/browser/extension/web-extension-context.js +2 -2
  111. package/lib/browser/extension/web-extension-protocol.d.ts +8 -2
  112. package/lib/browser/extension/web-extension-run.d.ts +2 -1
  113. package/lib/browser/extension/web-extension-run.js +1 -0
  114. package/lib/browser/extension/web-extensions-running.d.ts +2 -0
  115. package/lib/browser/extension/web-extensions-running.js +3 -0
  116. package/lib/browser/extension/web-extensions.d.ts +1 -1
  117. package/lib/browser/extension/web-home.d.ts +11 -19
  118. package/lib/browser/extension/web-home.js +15 -68
  119. package/lib/browser/extension/web-partners.d.ts +9 -0
  120. package/lib/browser/extension/web-partners.js +17 -0
  121. package/lib/browser/extension/web-row-board.d.ts +39 -0
  122. package/lib/browser/extension/web-row-board.js +83 -0
  123. package/lib/browser/i18n/locales.d.ts +31 -1
  124. package/lib/browser/i18n/messages-ja.js +34 -4
  125. package/lib/browser/i18n/messages-zh-tw.js +34 -4
  126. package/lib/browser/i18n/messages.d.ts +30 -0
  127. package/lib/browser/i18n/messages.js +68 -8
  128. package/lib/browser/index.d.ts +4 -0
  129. package/lib/browser/index.js +4 -0
  130. package/lib/browser/partners/group-picker.d.ts +19 -0
  131. package/lib/browser/partners/group-picker.js +119 -0
  132. package/lib/browser/partners/partners-extension.d.ts +15 -0
  133. package/lib/browser/partners/partners-extension.js +97 -0
  134. package/lib/browser/partners/partners-util.d.ts +33 -0
  135. package/lib/browser/partners/partners-util.js +71 -0
  136. package/lib/browser/partners/partners-view.d.ts +33 -0
  137. package/lib/browser/partners/partners-view.js +144 -0
  138. package/lib/browser/style/chat-list.d.ts +1 -1
  139. package/lib/browser/style/chat-list.js +18 -0
  140. package/lib/browser/style/conversation-column.d.ts +1 -1
  141. package/lib/browser/style/conversation-column.js +2 -1
  142. package/lib/browser/style/dialogs.d.ts +1 -1
  143. package/lib/browser/style/dialogs.js +6 -0
  144. package/lib/browser/style/layout.d.ts +1 -1
  145. package/lib/browser/style/layout.js +1 -1
  146. package/lib/browser/style/pages.d.ts +1 -1
  147. package/lib/browser/style/pages.js +6 -0
  148. package/lib/browser/util/turn-end.d.ts +8 -0
  149. package/lib/browser/util/turn-end.js +78 -35
  150. package/lib/browser/workbench-hosts.d.ts +4 -1
  151. package/lib/browser/workbench-hosts.js +17 -0
  152. package/lib/browser/workbench-protocol.d.ts +8 -0
  153. package/package.json +7 -7
@@ -35,14 +35,15 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.useAddHost = useAddHost;
37
37
  exports.HostRow = HostRow;
38
- exports.HostsDialog = HostsDialog;
38
+ exports.LinkForm = LinkForm;
39
39
  exports.PageVeil = PageVeil;
40
40
  exports.DeviceOverlays = DeviceOverlays;
41
- exports.AddHostPanel = AddHostPanel;
41
+ exports.ConnectComputer = ConnectComputer;
42
+ exports.SavedHosts = SavedHosts;
42
43
  const lucide_react_1 = require("lucide-react");
43
44
  const React = __importStar(require("react"));
44
45
  const react_dom_1 = require("react-dom");
45
- const back_stack_1 = require("../device/back-stack");
46
+ const device_account_1 = require("../account/device-account");
46
47
  const code_scan_1 = require("../device/code-scan");
47
48
  const scanner_1 = require("../device/scanner");
48
49
  const hooks_1 = require("../hooks");
@@ -52,8 +53,6 @@ const workbench_util_1 = require("../workbench-util");
52
53
  const account_view_1 = require("./account-view");
53
54
  const callout_1 = require("./callout");
54
55
  const chat_list_util_1 = require("./chat-list-util");
55
- const cloud_sign_in_view_1 = require("./cloud-sign-in-view");
56
- const context_menu_1 = require("./context-menu");
57
56
  const icon_1 = require("./icon");
58
57
  const swipe_row_1 = require("./swipe-row");
59
58
  const ta_avatar_1 = require("./ta-avatar");
@@ -68,6 +67,7 @@ function useAddHost() {
68
67
  const [busy, setBusy] = React.useState(false);
69
68
  const [error, setError] = React.useState();
70
69
  const add = React.useCallback(async (text, scanned = false) => {
70
+ var _a;
71
71
  const credential = workbench_util_1.WorkbenchUtil.credential(text);
72
72
  // The app has no ta serve of its page to give a token to; a code is always a pairing.
73
73
  if (!('pairing' in credential) && (scanned || workbench_util_1.WorkbenchUtil.isApp())) {
@@ -78,6 +78,10 @@ function useAddHost() {
78
78
  setError(undefined);
79
79
  try {
80
80
  await bench.signIn(text);
81
+ if ('pairing' in credential) {
82
+ // Signed in to an account: the computer joins it (docs/design/ta-me.md 4).
83
+ (_a = device_account_1.DeviceAccount.current()) === null || _a === void 0 ? void 0 : _a.bringIn(workbench_util_1.WorkbenchUtil.serverOf(credential, (0, workbench_util_1.pageHost)()));
84
+ }
81
85
  }
82
86
  catch (failure) {
83
87
  setError(failure instanceof workbench_util_1.WorkbenchError && failure.reason === 'refused' ? 'ta.hosts.refused' : 'ta.hosts.unreachable');
@@ -107,7 +111,7 @@ function hostDetail(host) {
107
111
  return [(_a = host.server) === null || _a === void 0 ? void 0 : _a.user, way].filter(Boolean).join(' · ');
108
112
  }
109
113
  /** A computer, as a conversation of the list: its letter, its name and the way to it; a finger swipes it to Remove. */
110
- function HostRow({ host, current, switching, onPick, onMenu, onRemove }) {
114
+ function HostRow({ host, detail, current, switching, onPick, onMenu, onRemove }) {
111
115
  const t = (0, use_t_1.useT)();
112
116
  const label = hosts_1.HostUtil.label(host) || t('ta.hosts.thisServer');
113
117
  return (React.createElement(swipe_row_1.SwipeRow, { as: "li", className: `ta-host-row${current ? ' ta-selected' : ''}`, actions: onRemove && [{ key: 'remove', label: t('ta.hosts.remove'), danger: true, run: onRemove }], onContextMenu: onMenu },
@@ -115,11 +119,11 @@ function HostRow({ host, current, switching, onPick, onMenu, onRemove }) {
115
119
  React.createElement("span", { className: `ta-chat-avatar ta-tone-${chat_list_util_1.ChatListUtil.tone(host.id)}`, "aria-hidden": "true" }, hosts_1.HostUtil.initial({ ...host, name: label })),
116
120
  React.createElement("span", { className: "ta-host-text" },
117
121
  React.createElement("span", { className: "ta-host-name ta-ellipsis" }, label),
118
- React.createElement("span", { className: "ta-host-detail ta-ellipsis" }, hostDetail(host))),
122
+ React.createElement("span", { className: "ta-host-detail ta-ellipsis" }, detail !== null && detail !== void 0 ? detail : hostDetail(host))),
119
123
  switching ? React.createElement("span", { className: "ta-spinner" }) : current && React.createElement(icon_1.Icon, { icon: lucide_react_1.Check, size: 18, className: "ta-host-check" }))));
120
124
  }
121
125
  /** A link pasted by hand, for where there is no camera or the code cannot be read. */
122
- function LinkForm({ busy, onSubmit, placeholder, autoFocus }) {
126
+ function LinkForm({ busy, onSubmit, placeholder, autoFocus, }) {
123
127
  const t = (0, use_t_1.useT)();
124
128
  const [text, setText] = React.useState('');
125
129
  return (React.createElement("form", { className: "ta-host-form", onSubmit: event => {
@@ -131,57 +135,6 @@ function LinkForm({ busy, onSubmit, placeholder, autoFocus }) {
131
135
  React.createElement("input", { type: "password", autoFocus: autoFocus, placeholder: placeholder, value: text, onChange: event => setText(event.target.value) })),
132
136
  React.createElement("button", { type: "submit", className: "ta-button ta-primary", disabled: busy || !text.trim() }, busy ? React.createElement("span", { className: "ta-spinner" }) : t('ta.signin.connect'))));
133
137
  }
134
- /** The computers of this device, the one in use checked: a tap switches, a hold or a right click renames or removes. */
135
- function HostsDialog({ onClose }) {
136
- const t = (0, use_t_1.useT)();
137
- const [{ hosts, host: currentId, switching }, bench] = (0, hooks_1.useWorkbench)();
138
- const [, notices] = (0, hooks_1.useNotices)();
139
- const [menu, openMenu] = (0, context_menu_1.useContextMenu)();
140
- const [pasting, setPasting] = React.useState(false);
141
- const [cloud, setCloud] = React.useState(false);
142
- const adding = useAddHost();
143
- (0, back_stack_1.useBackLayer)(true, onClose);
144
- React.useEffect(() => {
145
- const onKey = (event) => event.key === 'Escape' && onClose();
146
- document.addEventListener('keydown', onKey);
147
- return () => document.removeEventListener('keydown', onKey);
148
- }, [onClose]);
149
- const remove = async (host) => {
150
- const name = hosts_1.HostUtil.label(host) || t('ta.hosts.thisServer');
151
- if (await notices.confirm({ title: t('ta.hosts.removeConfirm', { name }), confirmLabel: t('ta.hosts.remove'), danger: true })) {
152
- bench.forget(host.id);
153
- }
154
- };
155
- const rename = async (host) => {
156
- var _a;
157
- const name = await notices.input({ title: t('ta.hosts.rename'), value: hosts_1.HostUtil.label(host), placeholder: (_a = host.server) === null || _a === void 0 ? void 0 : _a.host });
158
- if (name !== undefined) {
159
- bench.rename(host.id, name);
160
- }
161
- };
162
- return (0, react_dom_1.createPortal)(React.createElement("div", { className: "ta-modal-scrim" },
163
- React.createElement("button", { type: "button", className: "ta-overlay-close", "aria-label": t('ta.close'), tabIndex: -1, onClick: onClose }),
164
- React.createElement("div", { className: "ta-modal ta-hosts-dialog", role: "dialog", "aria-modal": "true", "aria-label": t('ta.hosts.title') },
165
- React.createElement("div", { className: "ta-modal-head" },
166
- React.createElement("span", { className: "ta-modal-title" }, t('ta.hosts.title')),
167
- React.createElement(icon_1.IconButton, { icon: lucide_react_1.X, label: t('ta.close'), onClick: onClose })),
168
- React.createElement("ul", { className: "ta-host-list", hidden: cloud }, hosts.map(host => (React.createElement(HostRow, { key: host.id, host: host, current: host.id === currentId, switching: host.id === switching, onPick: () => bench.switchTo(host.id), onRemove: () => void remove(host), onMenu: event => openMenu(event, [
169
- { label: t('ta.hosts.rename'), run: () => void rename(host) },
170
- { label: t('ta.hosts.remove'), run: () => void remove(host) },
171
- ]) })))),
172
- adding.error && React.createElement(callout_1.Callout, { level: "error" }, t(adding.error)),
173
- cloud ? (React.createElement(cloud_sign_in_view_1.CloudSignInFlow, { onBack: () => setCloud(false) })) : pasting ? (React.createElement(LinkForm, { busy: adding.busy, autoFocus: true, placeholder: t('ta.signin.pairing'), onSubmit: text => void adding.add(text) })) : (React.createElement("div", { className: "ta-host-actions" },
174
- adding.canScan && (React.createElement("button", { type: "button", className: "ta-button ta-primary", disabled: adding.busy, onClick: () => void adding.scan() },
175
- adding.busy ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(icon_1.Icon, { icon: lucide_react_1.ScanLine, size: 16 }),
176
- " ",
177
- t('ta.hosts.scanShort'))),
178
- React.createElement("button", { type: "button", className: "ta-button", disabled: adding.busy, onClick: () => setPasting(true) },
179
- React.createElement(icon_1.Icon, { icon: lucide_react_1.ClipboardPaste, size: 16 }),
180
- " ",
181
- t('ta.hosts.paste')))),
182
- !cloud && !pasting && React.createElement(cloud_sign_in_view_1.CloudSignInEntry, { onPick: () => setCloud(true) }),
183
- menu)), document.body);
184
- }
185
138
  /** How long the page waits under the veil for its extensions, the first time on this device, before it shows as it is. */
186
139
  const ARRIVAL_MS = 3000;
187
140
  /** How long the veil takes to fade. */
@@ -232,11 +185,10 @@ function DeviceOverlays() {
232
185
  React.createElement(PageVeil, null),
233
186
  React.createElement(account_view_1.AccountAsk, null)));
234
187
  }
235
- /** The sign-in of the app: scan the code of a computer, or paste its link; the computers used before, a tap away. */
236
- function AddHostPanel({ error, children }) {
188
+ /** Connecting a computer on the sign-in: scan the code its Ta shows (in the app), or paste its link or a token. */
189
+ function ConnectComputer({ error, children }) {
237
190
  var _a;
238
191
  const t = (0, use_t_1.useT)();
239
- const [{ hosts }, bench] = (0, hooks_1.useWorkbench)();
240
192
  const adding = useAddHost();
241
193
  const [pasting, setPasting] = React.useState(!adding.canScan);
242
194
  const shown = (_a = adding.error) !== null && _a !== void 0 ? _a : error;
@@ -247,11 +199,13 @@ function AddHostPanel({ error, children }) {
247
199
  t('ta.hosts.scan'))),
248
200
  pasting ? (React.createElement(LinkForm, { busy: adding.busy, autoFocus: !adding.canScan, placeholder: t(workbench_util_1.WorkbenchUtil.isApp() ? 'ta.signin.pairing' : 'ta.signin.token'), onSubmit: text => void adding.add(text) })) : (React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => setPasting(true) }, t('ta.hosts.paste'))),
249
201
  shown && React.createElement(callout_1.Callout, { level: "error" }, t(shown)),
250
- children,
251
- hosts.length > 0 && (React.createElement("section", { className: "ta-host-saved" },
252
- React.createElement("h2", null, t('ta.hosts.saved')),
253
- React.createElement("ul", { className: "ta-host-list" }, [...hosts]
254
- .sort((a, b) => b.usedAt - a.usedAt)
255
- .map(host => (React.createElement(HostRow, { key: host.id, host: host, current: false, switching: false, onPick: () => bench.switchTo(host.id) }))))))));
202
+ children));
203
+ }
204
+ /** The computers used before, on the sign-in, the latest first: a tap goes back to one. */
205
+ function SavedHosts() {
206
+ const [{ hosts }, bench] = (0, hooks_1.useWorkbench)();
207
+ return (React.createElement(React.Fragment, null, [...hosts]
208
+ .sort((a, b) => b.usedAt - a.usedAt)
209
+ .map(host => (React.createElement(HostRow, { key: host.id, host: host, current: false, switching: false, onPick: () => bench.switchTo(host.id) })))));
256
210
  }
257
211
  //# sourceMappingURL=host-view.js.map
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import type { SettingsSection } from './settings-view';
3
3
  /**
4
- * Me, the last tab of a phone, as in a messaging app: who is signed in to which machine and whether the app is
5
- * connected, then the entries the rail of a computer has in the menu of its account (account-menu.tsx).
4
+ * Me, the last tab of a phone, as in a messaging app: the user's profile (their picture, name and account, which it
5
+ * opens), the machine in use and whether the app is connected, then the entries the rail of a computer has in the menu of its account (account-menu.tsx).
6
6
  */
7
7
  export declare function MeView({ onSettings }: {
8
8
  onSettings(section?: SettingsSection): void;
@@ -41,10 +41,11 @@ const account_menu_1 = require("./account-menu");
41
41
  const icon_1 = require("./icon");
42
42
  const list_rows_1 = require("./list-rows");
43
43
  /**
44
- * Me, the last tab of a phone, as in a messaging app: who is signed in to which machine and whether the app is
45
- * connected, then the entries the rail of a computer has in the menu of its account (account-menu.tsx).
44
+ * Me, the last tab of a phone, as in a messaging app: the user's profile (their picture, name and account, which it
45
+ * opens), the machine in use and whether the app is connected, then the entries the rail of a computer has in the menu of its account (account-menu.tsx).
46
46
  */
47
47
  function MeView({ onSettings }) {
48
+ var _a, _b;
48
49
  const t = (0, use_t_1.useT)();
49
50
  const account = (0, account_menu_1.useAccount)();
50
51
  const [dialog, setDialog] = React.useState();
@@ -52,20 +53,20 @@ function MeView({ onSettings }) {
52
53
  return (React.createElement("section", { className: "ta-list-page ta-me", "aria-label": t('ta.me') },
53
54
  React.createElement("div", { className: "ta-list-scroll" },
54
55
  React.createElement("div", { className: "ta-list-content" },
55
- React.createElement("button", { type: "button", className: "ta-me-card", "aria-label": t('ta.hosts.title'), onClick: () => setDialog('hosts') },
56
+ React.createElement("button", { type: "button", className: "ta-me-card", "aria-label": t('ta.me.profile'), onClick: () => setDialog('profile') },
56
57
  React.createElement(account_menu_1.AccountFigure, { size: 56, className: "ta-account-figure ta-me-figure" }),
57
58
  React.createElement("span", { className: "ta-me-text" },
58
59
  React.createElement("span", { className: "ta-me-name ta-ellipsis" }, account.name),
59
- account.machine && React.createElement("span", { className: "ta-me-host ta-ellipsis" }, account.machine),
60
+ ((_a = account.account) !== null && _a !== void 0 ? _a : account.machine) && React.createElement("span", { className: "ta-me-host ta-ellipsis" }, (_b = account.account) !== null && _b !== void 0 ? _b : account.machine),
60
61
  React.createElement("span", { className: "ta-me-state" },
61
62
  React.createElement("span", { className: `ta-account-state ${account.online ? 'ta-ok' : 'ta-warn'}` }),
62
- t('ta.account.service'),
63
+ account.account && account.machine ? account.machine : t('ta.account.service'),
63
64
  " \u00B7 ",
64
65
  account.service)),
65
66
  React.createElement(icon_1.Icon, { icon: lucide_react_1.ChevronRight, size: 18, className: "ta-list-chevron" })),
66
67
  groups
67
68
  .filter(group => group.length > 0)
68
69
  .map(group => (React.createElement(list_rows_1.ListGroup, { key: group[0].key }, group.map(entry => { var _a, _b; var _c; return (React.createElement(list_rows_1.ListRow, { key: entry.key, icon: entry.danger ? undefined : entry.icon, label: entry.label, detail: (_c = entry.detail) !== null && _c !== void 0 ? _c : (_b = (_a = entry.choices) === null || _a === void 0 ? void 0 : _a.find(choice => choice.checked)) === null || _b === void 0 ? void 0 : _b.label, danger: entry.danger, action: entry.danger || entry.key === 'install', onClick: entry.run })); })))))),
69
- React.createElement(account_menu_1.AccountDialogs, { dialog: dialog, onClose: () => setDialog(undefined) })));
70
+ React.createElement(account_menu_1.AccountDialogs, { dialog: dialog, onClose: () => setDialog(undefined), onDialog: setDialog })));
70
71
  }
71
72
  //# sourceMappingURL=me-view.js.map
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ import type { WebPartnerEntry } from '../extension/web-api-partners';
3
+ /**
4
+ * A partner (docs/design/ta-partners.md), the same row wherever it is: on the page of the partners as a contact, in the
5
+ * double's list as a conversation. Its face (or its icon on a tile of its tint), its name, what was said last (else
6
+ * what it is), when; an amber dot for what the user has not seen or one asking, a blue ? while it waits for them, a
7
+ * spinner while it answers. Its menu is Open, then its own; pinned as a conversation is where `onPin` is given.
8
+ */
9
+ export declare function PartnerRow({ partner, time, selected, open, pinned, onPin, }: {
10
+ partner: WebPartnerEntry;
11
+ time: string;
12
+ selected: boolean;
13
+ /** Opens it as the list does (TaWebExtensions.openHome): a promise keeps it busy. */
14
+ open(partner: WebPartnerEntry): Promise<void>;
15
+ pinned?: boolean;
16
+ onPin?(pinned: boolean): void;
17
+ }): React.JSX.Element;
18
+ //# sourceMappingURL=partner-row.d.ts.map
@@ -0,0 +1,84 @@
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.PartnerRow = PartnerRow;
37
+ const React = __importStar(require("react"));
38
+ const use_t_1 = require("../i18n/use-t");
39
+ const partners_util_1 = require("../partners/partners-util");
40
+ const chat_home_1 = require("./chat-home");
41
+ const chat_home_util_1 = require("./chat-home-util");
42
+ const chat_list_row_1 = require("./chat-list-row");
43
+ const context_menu_1 = require("./context-menu");
44
+ const host_tag_1 = require("./host-tag");
45
+ const swipe_row_1 = require("./swipe-row");
46
+ /**
47
+ * A partner (docs/design/ta-partners.md), the same row wherever it is: on the page of the partners as a contact, in the
48
+ * double's list as a conversation. Its face (or its icon on a tile of its tint), its name, what was said last (else
49
+ * what it is), when; an amber dot for what the user has not seen or one asking, a blue ? while it waits for them, a
50
+ * spinner while it answers. Its menu is Open, then its own; pinned as a conversation is where `onPin` is given.
51
+ */
52
+ function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
53
+ var _a, _b;
54
+ const t = (0, use_t_1.useT)();
55
+ const [menu, openMenu] = (0, context_menu_1.useContextMenu)();
56
+ const [opening, setOpening] = React.useState(false);
57
+ const Glyph = partner.icon;
58
+ const Own = partner.face;
59
+ const unseen = partners_util_1.PartnersUtil.unseen(partner);
60
+ const asks = !partner.status && !!((_a = partner.chat) === null || _a === void 0 ? void 0 : _a.asks);
61
+ const go = () => {
62
+ setOpening(true);
63
+ void open(partner)
64
+ .catch(error => console.error(`A partner of ${partner.extension} failed to open:`, error))
65
+ .finally(() => setOpening(false));
66
+ };
67
+ const pin = onPin && { label: t(pinned ? 'ta.chat.unpin' : 'ta.chat.pin'), run: () => onPin(!pinned) };
68
+ const own = () => (partner.menu ? chat_home_util_1.ChatHomeUtil.menu(partner.menu()) : []);
69
+ return (React.createElement(swipe_row_1.SwipeRow, { as: "li", className: `ta-chat-row ta-partner-row${selected ? ' ta-selected' : ''}`, "data-unseen": unseen && !asks ? '' : undefined, "data-asks": asks ? '' : undefined, actions: pin ? [{ key: 'pin', ...pin }] : undefined, overlay: menu, onContextMenu: event => {
70
+ const items = own();
71
+ openMenu(event, [
72
+ ...context_menu_1.ContextMenuUtil.sections([{ label: t('ta.chat.open'), run: go }], pin ? [pin] : []),
73
+ ...(items.length ? ['-', ...items] : []),
74
+ ]);
75
+ } },
76
+ React.createElement("button", { type: "button", className: "ta-chat-item", title: partner.name, "aria-current": selected ? 'true' : undefined, onClick: go },
77
+ React.createElement("span", { className: "ta-chat-avatar-box" },
78
+ Own && !opening ? (React.createElement("span", { className: "ta-chat-face", style: { width: 38, height: 38 }, "aria-hidden": "true" },
79
+ React.createElement(Own, { size: 38 }))) : (React.createElement("span", { className: "ta-chat-avatar ta-chat-icon", style: { background: `var(--ta-tint-${partner.tone})`, color: `var(--ta-tint-ink-${partner.tone})`, width: 38, height: 38 }, "aria-hidden": "true" }, opening ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(Glyph, { size: 18, strokeWidth: 1.8 }))),
80
+ partner.online && React.createElement("span", { className: "ta-partner-online", "aria-hidden": "true" }),
81
+ React.createElement(chat_list_row_1.ChatDot, { unseen: unseen, asks: asks })),
82
+ React.createElement(chat_home_1.RowText, { title: partner.name, time: time, line: partners_util_1.PartnersUtil.line(partner, t('ta.partners.waiting')), unseen: unseen, busy: !partner.status && !!((_b = partner.chat) === null || _b === void 0 ? void 0 : _b.busy), tag: partner.location ? React.createElement(host_tag_1.HostTag, { location: partner.location }) : undefined }))));
83
+ }
84
+ //# sourceMappingURL=partner-row.js.map
@@ -0,0 +1,12 @@
1
+ import type { TaIdentity } from '@celljs/ta-protocol';
2
+ import * as React from 'react';
3
+ /** The identity of the computer in use, its name and picture: read once connected, and again when it changes. */
4
+ export declare function useIdentity(): TaIdentity | undefined;
5
+ /** The account in use as a line: "Company account · su", or none while signed out. */
6
+ export declare function useAccountLine(): string | undefined;
7
+ /** The profile, over the page: the picture, the name, and the account, which opens My devices. */
8
+ export declare function ProfileDialog({ onClose, onDevices }: {
9
+ onClose(): void;
10
+ onDevices(): void;
11
+ }): React.JSX.Element;
12
+ //# sourceMappingURL=profile-view.d.ts.map
@@ -0,0 +1,123 @@
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.useIdentity = useIdentity;
37
+ exports.useAccountLine = useAccountLine;
38
+ exports.ProfileDialog = ProfileDialog;
39
+ const lucide_react_1 = require("lucide-react");
40
+ const React = __importStar(require("react"));
41
+ const account_side_1 = require("../account/account-side");
42
+ const hooks_1 = require("../hooks");
43
+ const use_t_1 = require("../i18n/use-t");
44
+ const account_view_1 = require("./account-view");
45
+ const face_1 = require("./face");
46
+ const list_rows_1 = require("./list-rows");
47
+ const picture_dialog_1 = require("./picture-dialog");
48
+ const web_dialog_1 = require("./web-dialog");
49
+ /*
50
+ * The user's profile (docs/design/ta-me.md 3): the picture and the name others see of them in group chats and among
51
+ * friends, and the account they are signed in to. One place to change them, which Me and the menu of the account open;
52
+ * the computers of the account share them.
53
+ */
54
+ const changed = new Set();
55
+ /** The identity of the computer in use, its name and picture: read once connected, and again when it changes. */
56
+ function useIdentity() {
57
+ const [{ status }, workbench] = (0, hooks_1.useWorkbench)();
58
+ const [identity, setIdentity] = React.useState();
59
+ const online = status === 'online';
60
+ React.useEffect(() => {
61
+ if (!online) {
62
+ return;
63
+ }
64
+ let live = true;
65
+ const read = () => void Promise.resolve()
66
+ .then(() => workbench.rooms.getIdentity())
67
+ .then(next => live && setIdentity(next), () => undefined);
68
+ read();
69
+ changed.add(read);
70
+ const stop = workbench.onRoomEvent(event => event.type === 'rooms' && read(), { messages: false });
71
+ return () => {
72
+ live = false;
73
+ changed.delete(read);
74
+ stop();
75
+ };
76
+ }, [online, workbench]);
77
+ return identity;
78
+ }
79
+ /** The account in use as a line: "Company account · su", or none while signed out. */
80
+ function useAccountLine() {
81
+ const side = (0, account_side_1.useAccountSide)();
82
+ const { info } = (0, account_side_1.useAccountInfo)(side, 15000);
83
+ const way = (0, account_view_1.useAccountWay)();
84
+ return (info === null || info === void 0 ? void 0 : info.account) && !info.waiting ? `${way(info.account.id)} · ${(0, account_view_1.accountName)(info.account)}` : undefined;
85
+ }
86
+ /** The profile, over the page: the picture, the name, and the account, which opens My devices. */
87
+ function ProfileDialog({ onClose, onDevices }) {
88
+ var _a;
89
+ const t = (0, use_t_1.useT)();
90
+ const [, workbench] = (0, hooks_1.useWorkbench)();
91
+ const [, notices] = (0, hooks_1.useNotices)();
92
+ const identity = useIdentity();
93
+ const account = useAccountLine();
94
+ const rename = async () => {
95
+ var _a;
96
+ const name = await notices.input({ title: t('ta.me.name'), value: (_a = identity === null || identity === void 0 ? void 0 : identity.name) !== null && _a !== void 0 ? _a : '', placeholder: t('ta.me.nameHint') });
97
+ if ((name === null || name === void 0 ? void 0 : name.trim()) && name.trim() !== (identity === null || identity === void 0 ? void 0 : identity.name)) {
98
+ try {
99
+ await workbench.rooms.setName(name.trim());
100
+ for (const read of changed) {
101
+ read();
102
+ }
103
+ }
104
+ catch (error) {
105
+ notices.error(error);
106
+ }
107
+ }
108
+ };
109
+ return (React.createElement(web_dialog_1.WebDialog, { title: t('ta.me.profile'), onClose: onClose },
110
+ React.createElement("div", { className: "ta-profile" },
111
+ React.createElement("button", { type: "button", className: "ta-profile-picture", "aria-label": t('ta.picture.title'), onClick: () => picture_dialog_1.PicturePicker.open() },
112
+ React.createElement(face_1.Face, { double: true, size: 84 })),
113
+ React.createElement("span", { className: "ta-profile-name ta-ellipsis" }, (_a = identity === null || identity === void 0 ? void 0 : identity.name) !== null && _a !== void 0 ? _a : ''),
114
+ React.createElement(list_rows_1.ListGroup, null,
115
+ React.createElement(list_rows_1.ListRow, { icon: lucide_react_1.CircleUserRound, label: t('ta.me.picture'), onClick: () => picture_dialog_1.PicturePicker.open() }),
116
+ React.createElement(list_rows_1.ListRow, { icon: lucide_react_1.PenLine, label: t('ta.me.name'), detail: identity === null || identity === void 0 ? void 0 : identity.name, onClick: () => void rename() }),
117
+ React.createElement(list_rows_1.ListRow, { icon: lucide_react_1.KeyRound, label: t('ta.me.account'), detail: account !== null && account !== void 0 ? account : t('ta.me.noAccount'), onClick: () => {
118
+ onClose();
119
+ onDevices();
120
+ } })),
121
+ React.createElement("p", { className: "ta-profile-hint" }, t('ta.me.profileHint')))));
122
+ }
123
+ //# sourceMappingURL=profile-view.js.map
@@ -36,6 +36,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.useDocument = useDocument;
37
37
  exports.SignIn = SignIn;
38
38
  const React = __importStar(require("react"));
39
+ const account_side_1 = require("../account/account-side");
40
+ const device_account_1 = require("../account/device-account");
39
41
  const code_scan_1 = require("../device/code-scan");
40
42
  const device_1 = require("../device/device");
41
43
  const hooks_1 = require("../hooks");
@@ -94,6 +96,24 @@ function SignIn(props) {
94
96
  React.createElement(scan_screen_1.ScanReader, null),
95
97
  React.createElement(account_view_1.AccountAsk, null)));
96
98
  }
99
+ /** The accounts and the computers this device signed in to before, the latest first: a tap goes back to one. */
100
+ function RecentSignIns() {
101
+ const t = (0, use_t_1.useT)();
102
+ const [{ hosts }] = (0, hooks_1.useWorkbench)();
103
+ const accounts = workbench_util_1.WorkbenchUtil.isApp() ? device_account_1.DeviceAccount.recent().length : 0;
104
+ if (hosts.length === 0 && accounts === 0) {
105
+ return null;
106
+ }
107
+ return (React.createElement("section", { className: "ta-host-saved" },
108
+ React.createElement("h2", null, t('ta.me.recent')),
109
+ React.createElement("ul", { className: "ta-host-list" },
110
+ React.createElement(account_view_1.RecentAccounts, null),
111
+ React.createElement(host_view_1.SavedHosts, null))));
112
+ }
113
+ /**
114
+ * The sign-in (docs/design/ta-me.md 5): the accounts first (a company's, which brings its Ta in the cloud; GitHub),
115
+ * then the accounts and computers signed in to before, then a computer of one's own by its code or link.
116
+ */
97
117
  function SignInPage({ error }) {
98
118
  const t = (0, use_t_1.useT)();
99
119
  const app = workbench_util_1.WorkbenchUtil.isApp();
@@ -107,6 +127,10 @@ function SignInPage({ error }) {
107
127
  const { known: builtIn, settled: builtInSettled } = (0, cloud_sign_in_view_1.useBuiltInState)();
108
128
  // Its ways, or, out of reach from inside the company's network, the way to it.
109
129
  const company = !accounts && builtIn && (builtIn.providers.length > 0 || builtIn.unreachable) ? builtIn : undefined;
130
+ // The app's own account: its ways, or where it stands.
131
+ const side = (0, account_side_1.useAccountSide)();
132
+ const { info: account, act } = (0, account_side_1.useAccountInfo)(app ? side : undefined);
133
+ const refused = error === 'refused' ? (app ? 'ta.signin.pairRefused' : 'ta.signin.refused') : undefined;
110
134
  useDocument();
111
135
  if (!settled || !builtInSettled) {
112
136
  // Drawn once, as it will stay: not a page of a computer, then one of a company's accounts.
@@ -117,6 +141,15 @@ function SignInPage({ error }) {
117
141
  React.createElement("div", { className: "ta-card" },
118
142
  React.createElement(cloud_sign_in_view_1.CloudSignInFlow, { page: true, onBack: () => setCloud(undefined), provider: cloud.provider, typing: cloud.typing }))));
119
143
  }
144
+ if (account && (account.signingIn || (account.account && account.waiting))) {
145
+ // The code to enter on the provider's page, or the one another device of the account compares: the whole card.
146
+ return (React.createElement("div", { className: "ta-signin" },
147
+ React.createElement("div", { className: "ta-card" },
148
+ React.createElement(ta_avatar_1.TaAvatar, { size: 72 }),
149
+ React.createElement(account_view_1.AccountWays, { info: account, act: act }))));
150
+ }
151
+ const ways = account && (React.createElement("section", { className: "ta-account-sign-in" },
152
+ React.createElement(account_view_1.AccountWays, { info: account, act: act })));
120
153
  if (company) {
121
154
  // A build for a deployment: its accounts first, the ways to a computer of one's own under them.
122
155
  return (React.createElement("div", { className: "ta-signin" },
@@ -125,9 +158,10 @@ function SignInPage({ error }) {
125
158
  React.createElement("h1", null, t('ta.signin.title')),
126
159
  React.createElement("p", null, t('ta.cloud.builtInHint')),
127
160
  React.createElement(cloud_sign_in_view_1.BuiltInSignIn, { known: company, onPick: provider => setCloud({ provider }), onOther: () => setCloud({ typing: true }) }),
161
+ ways,
162
+ React.createElement(RecentSignIns, null),
128
163
  React.createElement("div", { className: "ta-sign-in-or" }, t('ta.cloud.orComputer')),
129
- app && React.createElement(account_view_1.AccountSignInEntry, null),
130
- React.createElement(host_view_1.AddHostPanel, { error: error === 'refused' ? (app ? 'ta.signin.pairRefused' : 'ta.signin.refused') : undefined }))));
164
+ React.createElement(host_view_1.ConnectComputer, { error: refused }))));
131
165
  }
132
166
  return (React.createElement("div", { className: "ta-signin" },
133
167
  React.createElement("div", { className: "ta-card" },
@@ -144,7 +178,8 @@ function SignInPage({ error }) {
144
178
  : 'ta.signin.hint')),
145
179
  !accounts && React.createElement(sign_in_picture_1.ConnectPicture, { way: way }),
146
180
  React.createElement(sign_in_accounts_1.SignInAccounts, { providers: providers, outcome: outcome }),
147
- app && React.createElement(account_view_1.AccountSignInEntry, null),
148
- React.createElement(host_view_1.AddHostPanel, { error: error === 'refused' ? (app ? 'ta.signin.pairRefused' : 'ta.signin.refused') : undefined }, !accounts && React.createElement(cloud_sign_in_view_1.CloudSignInEntry, { onPick: () => setCloud({}) })))));
181
+ ways,
182
+ React.createElement(host_view_1.ConnectComputer, { error: refused }, !accounts && React.createElement(cloud_sign_in_view_1.CloudSignInEntry, { onPick: () => setCloud({}) })),
183
+ React.createElement(RecentSignIns, null))));
149
184
  }
150
185
  //# sourceMappingURL=workbench-view.js.map
@@ -13,8 +13,8 @@ export interface WebModelPickerProps {
13
13
  label?: string;
14
14
  disabled?: boolean;
15
15
  /**
16
- * Without other coding agents (`TaSettingsSnapshot.agents`), for what keeps to some of Ta's tools (the front of a
17
- * call): an agent works with its own and could not run it.
16
+ * Without the coding agents that cannot do without their own tools (`TaSettingsSnapshot.agents`), for what keeps
17
+ * to some of Ta's tools (the front of a call).
18
18
  */
19
19
  noAgents?: boolean;
20
20
  }
@@ -1,4 +1,5 @@
1
1
  import type { WebHomeEntry } from './web-api-contributions';
2
+ export type * from './web-api-partners';
2
3
  /** What the page offers of the rows of the double's home (registerHomeItems), for a list of an extension to show them as its own do. */
3
4
  export interface WebHomeUI {
4
5
  /** A React hook: the rows extensions add to the double's home (registerHomeItems), in the order they loaded. */