@celljs/ta-web 4.47.0 → 4.48.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 (269) hide show
  1. package/esm/browser/assistant/assistant-role.d.ts +1 -1
  2. package/esm/browser/assistant/assistant-role.js +1 -1
  3. package/esm/browser/assistant/assistant-task-source.js +6 -1
  4. package/esm/browser/assistant/assistant-task-util.d.ts +1 -0
  5. package/esm/browser/assistant/assistant-task-util.js +9 -3
  6. package/esm/browser/assistant/assistant-view.js +5 -2
  7. package/esm/browser/chat/chat-view.js +2 -1
  8. package/esm/browser/cloud/cloud-sign-in.d.ts +26 -4
  9. package/esm/browser/cloud/cloud-sign-in.js +88 -18
  10. package/esm/browser/components/app-nav.d.ts +3 -1
  11. package/esm/browser/components/app-nav.js +3 -3
  12. package/esm/browser/components/app-shell-state.js +11 -0
  13. package/esm/browser/components/app-view.js +16 -6
  14. package/esm/browser/components/asks-badge.d.ts +12 -0
  15. package/esm/browser/components/asks-badge.js +17 -1
  16. package/esm/browser/components/chat-list-row.d.ts +4 -1
  17. package/esm/browser/components/chat-list-row.js +7 -1
  18. package/esm/browser/components/chats-dot.d.ts +4 -1
  19. package/esm/browser/components/chats-dot.js +6 -2
  20. package/esm/browser/components/cloud-sign-in-view.d.ts +2 -1
  21. package/esm/browser/components/cloud-sign-in-view.js +28 -5
  22. package/esm/browser/components/composer-box-protocol.d.ts +5 -3
  23. package/esm/browser/components/composer-box.js +11 -11
  24. package/esm/browser/components/composer.d.ts +8 -1
  25. package/esm/browser/components/composer.js +57 -34
  26. package/esm/browser/components/discover-view.js +1 -1
  27. package/esm/browser/components/first-steps-util.d.ts +30 -0
  28. package/esm/browser/components/first-steps-util.js +36 -3
  29. package/esm/browser/components/host-view.d.ts +1 -1
  30. package/esm/browser/components/lightbox.d.ts +15 -1
  31. package/esm/browser/components/lightbox.js +14 -2
  32. package/esm/browser/components/link.js +8 -3
  33. package/esm/browser/components/list-rows.d.ts +1 -1
  34. package/esm/browser/components/list-rows.js +1 -1
  35. package/esm/browser/components/markdown.d.ts +4 -2
  36. package/esm/browser/components/markdown.js +13 -4
  37. package/esm/browser/components/media.d.ts +6 -0
  38. package/esm/browser/components/media.js +9 -1
  39. package/esm/browser/components/message-images.d.ts +5 -0
  40. package/esm/browser/components/message-images.js +40 -4
  41. package/esm/browser/components/message-user.js +4 -2
  42. package/esm/browser/components/partner-row.js +4 -4
  43. package/esm/browser/components/phone-hint.d.ts +6 -0
  44. package/esm/browser/components/phone-hint.js +63 -0
  45. package/esm/browser/components/phone-shell.d.ts +2 -0
  46. package/esm/browser/components/phone-shell.js +2 -2
  47. package/esm/browser/components/sending.d.ts +19 -0
  48. package/esm/browser/components/sending.js +27 -0
  49. package/esm/browser/components/session-view.js +5 -3
  50. package/esm/browser/components/settings-choices.js +1 -0
  51. package/esm/browser/components/settings-parts.js +28 -17
  52. package/esm/browser/components/share-dialog.js +3 -2
  53. package/esm/browser/components/share-item-sheet.js +1 -1
  54. package/esm/browser/components/share-sheet.d.ts +4 -2
  55. package/esm/browser/components/share-sheet.js +16 -2
  56. package/esm/browser/components/sign-in-accounts.js +7 -1
  57. package/esm/browser/components/unseen-drop.d.ts +2 -2
  58. package/esm/browser/components/unseen-drop.js +1 -1
  59. package/esm/browser/device/app-badge.d.ts +8 -0
  60. package/esm/browser/device/app-badge.js +28 -0
  61. package/esm/browser/device/code-scan.js +1 -1
  62. package/esm/browser/extension/web-api-code.d.ts +26 -0
  63. package/esm/browser/extension/web-api-components.d.ts +31 -0
  64. package/esm/browser/extension/web-api-menus.d.ts +15 -0
  65. package/esm/browser/extension/web-api-messages.d.ts +15 -0
  66. package/esm/browser/extension/web-api-messages.js +2 -0
  67. package/esm/browser/extension/web-api-partners.d.ts +16 -0
  68. package/esm/browser/extension/web-api-spec.js +1 -0
  69. package/esm/browser/extension/web-extension-api.d.ts +7 -13
  70. package/esm/browser/extension/web-extension-context.js +2 -0
  71. package/esm/browser/extension/web-session-notices.js +11 -2
  72. package/esm/browser/extension/web-share-ui.js +1 -0
  73. package/esm/browser/extension/web-share.js +3 -3
  74. package/esm/browser/extension/web-sharing.js +1 -1
  75. package/esm/browser/i18n/en/assistant.d.ts +2 -0
  76. package/esm/browser/i18n/en/assistant.js +2 -0
  77. package/esm/browser/i18n/en/chat.d.ts +11 -0
  78. package/esm/browser/i18n/en/chat.js +13 -2
  79. package/esm/browser/i18n/en/common.d.ts +4 -0
  80. package/esm/browser/i18n/en/common.js +4 -0
  81. package/esm/browser/i18n/en/service.d.ts +7 -0
  82. package/esm/browser/i18n/en/service.js +7 -0
  83. package/esm/browser/i18n/en/settings.d.ts +6 -0
  84. package/esm/browser/i18n/en/settings.js +8 -2
  85. package/esm/browser/i18n/ja/assistant.js +2 -0
  86. package/esm/browser/i18n/ja/chat.js +13 -2
  87. package/esm/browser/i18n/ja/common.js +4 -0
  88. package/esm/browser/i18n/ja/service.js +7 -0
  89. package/esm/browser/i18n/ja/settings.js +10 -4
  90. package/esm/browser/i18n/locales.d.ts +31 -1
  91. package/esm/browser/i18n/messages.d.ts +30 -0
  92. package/esm/browser/i18n/zh/assistant.js +2 -0
  93. package/esm/browser/i18n/zh/chat.js +13 -2
  94. package/esm/browser/i18n/zh/common.js +4 -0
  95. package/esm/browser/i18n/zh/service.js +7 -0
  96. package/esm/browser/i18n/zh/settings.js +8 -2
  97. package/esm/browser/i18n/zh-tw/assistant.js +2 -0
  98. package/esm/browser/i18n/zh-tw/chat.js +13 -2
  99. package/esm/browser/i18n/zh-tw/common.js +4 -0
  100. package/esm/browser/i18n/zh-tw/service.js +7 -0
  101. package/esm/browser/i18n/zh-tw/settings.js +8 -2
  102. package/esm/browser/links/links.js +1 -1
  103. package/esm/browser/notices/session-notices.d.ts +4 -4
  104. package/esm/browser/notices/session-notices.js +3 -6
  105. package/esm/browser/partners/partners-util.d.ts +6 -0
  106. package/esm/browser/partners/partners-util.js +22 -0
  107. package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
  108. package/esm/browser/settings/agent-settings.d.ts +2 -0
  109. package/esm/browser/settings/agent-settings.js +2 -0
  110. package/esm/browser/settings/settings-protocol.d.ts +8 -0
  111. package/esm/browser/settings/settings-protocol.js +5 -0
  112. package/esm/browser/style/base.d.ts +1 -1
  113. package/esm/browser/style/base.js +3 -0
  114. package/esm/browser/style/chat-list.d.ts +1 -1
  115. package/esm/browser/style/chat-list.js +8 -3
  116. package/esm/browser/style/conversation-column.d.ts +1 -1
  117. package/esm/browser/style/conversation-column.js +10 -1
  118. package/esm/browser/style/conversation.d.ts +1 -1
  119. package/esm/browser/style/conversation.js +18 -0
  120. package/esm/browser/style/phone.d.ts +1 -1
  121. package/esm/browser/style/phone.js +2 -0
  122. package/esm/browser/style/skins.d.ts +1 -1
  123. package/esm/browser/style/skins.js +1 -1
  124. package/esm/browser/util/composer.d.ts +18 -3
  125. package/esm/browser/util/composer.js +31 -5
  126. package/esm/browser/util/desktop.d.ts +8 -1
  127. package/esm/browser/util/desktop.js +10 -0
  128. package/esm/browser/util/image-shrink.d.ts +5 -1
  129. package/esm/browser/util/image-shrink.js +1 -1
  130. package/esm/browser/util/markdown.d.ts +3 -5
  131. package/esm/browser/util/markdown.js +5 -29
  132. package/esm/browser/util/process.js +2 -2
  133. package/lib/browser/assistant/assistant-role.d.ts +1 -1
  134. package/lib/browser/assistant/assistant-role.js +1 -1
  135. package/lib/browser/assistant/assistant-task-source.js +5 -0
  136. package/lib/browser/assistant/assistant-task-util.d.ts +1 -0
  137. package/lib/browser/assistant/assistant-task-util.js +8 -2
  138. package/lib/browser/assistant/assistant-view.js +5 -2
  139. package/lib/browser/chat/chat-view.js +2 -1
  140. package/lib/browser/cloud/cloud-sign-in.d.ts +26 -4
  141. package/lib/browser/cloud/cloud-sign-in.js +89 -19
  142. package/lib/browser/components/app-nav.d.ts +3 -1
  143. package/lib/browser/components/app-nav.js +2 -2
  144. package/lib/browser/components/app-shell-state.js +11 -0
  145. package/lib/browser/components/app-view.js +16 -6
  146. package/lib/browser/components/asks-badge.d.ts +12 -0
  147. package/lib/browser/components/asks-badge.js +19 -1
  148. package/lib/browser/components/chat-list-row.d.ts +4 -1
  149. package/lib/browser/components/chat-list-row.js +7 -1
  150. package/lib/browser/components/chats-dot.d.ts +4 -1
  151. package/lib/browser/components/chats-dot.js +6 -2
  152. package/lib/browser/components/cloud-sign-in-view.d.ts +2 -1
  153. package/lib/browser/components/cloud-sign-in-view.js +28 -5
  154. package/lib/browser/components/composer-box-protocol.d.ts +5 -3
  155. package/lib/browser/components/composer-box.js +11 -11
  156. package/lib/browser/components/composer.d.ts +8 -1
  157. package/lib/browser/components/composer.js +56 -33
  158. package/lib/browser/components/discover-view.js +1 -1
  159. package/lib/browser/components/first-steps-util.d.ts +30 -0
  160. package/lib/browser/components/first-steps-util.js +37 -4
  161. package/lib/browser/components/host-view.d.ts +1 -1
  162. package/lib/browser/components/lightbox.d.ts +15 -1
  163. package/lib/browser/components/lightbox.js +15 -2
  164. package/lib/browser/components/link.js +8 -3
  165. package/lib/browser/components/list-rows.d.ts +1 -1
  166. package/lib/browser/components/list-rows.js +1 -1
  167. package/lib/browser/components/markdown.d.ts +4 -2
  168. package/lib/browser/components/markdown.js +11 -2
  169. package/lib/browser/components/media.d.ts +6 -0
  170. package/lib/browser/components/media.js +10 -2
  171. package/lib/browser/components/message-images.d.ts +5 -0
  172. package/lib/browser/components/message-images.js +40 -4
  173. package/lib/browser/components/message-user.js +4 -2
  174. package/lib/browser/components/partner-row.js +4 -4
  175. package/lib/browser/components/phone-hint.d.ts +7 -0
  176. package/lib/browser/components/phone-hint.js +99 -0
  177. package/lib/browser/components/phone-shell.d.ts +2 -0
  178. package/lib/browser/components/phone-shell.js +1 -1
  179. package/lib/browser/components/sending.d.ts +20 -0
  180. package/lib/browser/components/sending.js +63 -0
  181. package/lib/browser/components/session-view.js +5 -3
  182. package/lib/browser/components/settings-choices.js +1 -0
  183. package/lib/browser/components/settings-parts.js +26 -15
  184. package/lib/browser/components/share-dialog.js +3 -2
  185. package/lib/browser/components/share-item-sheet.js +1 -1
  186. package/lib/browser/components/share-sheet.d.ts +4 -2
  187. package/lib/browser/components/share-sheet.js +16 -2
  188. package/lib/browser/components/sign-in-accounts.js +7 -1
  189. package/lib/browser/components/unseen-drop.d.ts +2 -2
  190. package/lib/browser/components/unseen-drop.js +1 -1
  191. package/lib/browser/device/app-badge.d.ts +9 -0
  192. package/lib/browser/device/app-badge.js +31 -0
  193. package/lib/browser/device/code-scan.js +1 -1
  194. package/lib/browser/extension/web-api-code.d.ts +26 -0
  195. package/lib/browser/extension/web-api-components.d.ts +31 -0
  196. package/lib/browser/extension/web-api-menus.d.ts +15 -0
  197. package/lib/browser/extension/web-api-messages.d.ts +16 -0
  198. package/lib/browser/extension/web-api-messages.js +3 -0
  199. package/lib/browser/extension/web-api-partners.d.ts +16 -0
  200. package/lib/browser/extension/web-api-spec.js +1 -0
  201. package/lib/browser/extension/web-extension-api.d.ts +7 -13
  202. package/lib/browser/extension/web-extension-context.js +2 -0
  203. package/lib/browser/extension/web-session-notices.js +10 -1
  204. package/lib/browser/extension/web-share-ui.js +1 -0
  205. package/lib/browser/extension/web-share.js +3 -3
  206. package/lib/browser/extension/web-sharing.js +1 -1
  207. package/lib/browser/i18n/en/assistant.d.ts +2 -0
  208. package/lib/browser/i18n/en/assistant.js +2 -0
  209. package/lib/browser/i18n/en/chat.d.ts +11 -0
  210. package/lib/browser/i18n/en/chat.js +13 -2
  211. package/lib/browser/i18n/en/common.d.ts +4 -0
  212. package/lib/browser/i18n/en/common.js +4 -0
  213. package/lib/browser/i18n/en/service.d.ts +7 -0
  214. package/lib/browser/i18n/en/service.js +7 -0
  215. package/lib/browser/i18n/en/settings.d.ts +6 -0
  216. package/lib/browser/i18n/en/settings.js +8 -2
  217. package/lib/browser/i18n/ja/assistant.js +2 -0
  218. package/lib/browser/i18n/ja/chat.js +13 -2
  219. package/lib/browser/i18n/ja/common.js +4 -0
  220. package/lib/browser/i18n/ja/service.js +7 -0
  221. package/lib/browser/i18n/ja/settings.js +10 -4
  222. package/lib/browser/i18n/locales.d.ts +31 -1
  223. package/lib/browser/i18n/messages.d.ts +30 -0
  224. package/lib/browser/i18n/zh/assistant.js +2 -0
  225. package/lib/browser/i18n/zh/chat.js +13 -2
  226. package/lib/browser/i18n/zh/common.js +4 -0
  227. package/lib/browser/i18n/zh/service.js +7 -0
  228. package/lib/browser/i18n/zh/settings.js +8 -2
  229. package/lib/browser/i18n/zh-tw/assistant.js +2 -0
  230. package/lib/browser/i18n/zh-tw/chat.js +13 -2
  231. package/lib/browser/i18n/zh-tw/common.js +4 -0
  232. package/lib/browser/i18n/zh-tw/service.js +7 -0
  233. package/lib/browser/i18n/zh-tw/settings.js +8 -2
  234. package/lib/browser/links/links.js +1 -1
  235. package/lib/browser/notices/session-notices.d.ts +4 -4
  236. package/lib/browser/notices/session-notices.js +3 -6
  237. package/lib/browser/partners/partners-util.d.ts +6 -0
  238. package/lib/browser/partners/partners-util.js +22 -0
  239. package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
  240. package/lib/browser/settings/agent-settings.d.ts +2 -0
  241. package/lib/browser/settings/agent-settings.js +3 -1
  242. package/lib/browser/settings/settings-protocol.d.ts +8 -0
  243. package/lib/browser/settings/settings-protocol.js +6 -1
  244. package/lib/browser/style/base.d.ts +1 -1
  245. package/lib/browser/style/base.js +3 -0
  246. package/lib/browser/style/chat-list.d.ts +1 -1
  247. package/lib/browser/style/chat-list.js +8 -3
  248. package/lib/browser/style/conversation-column.d.ts +1 -1
  249. package/lib/browser/style/conversation-column.js +10 -1
  250. package/lib/browser/style/conversation.d.ts +1 -1
  251. package/lib/browser/style/conversation.js +18 -0
  252. package/lib/browser/style/phone.d.ts +1 -1
  253. package/lib/browser/style/phone.js +2 -0
  254. package/lib/browser/style/skins.d.ts +1 -1
  255. package/lib/browser/style/skins.js +1 -1
  256. package/lib/browser/util/composer.d.ts +18 -3
  257. package/lib/browser/util/composer.js +31 -5
  258. package/lib/browser/util/desktop.d.ts +8 -1
  259. package/lib/browser/util/desktop.js +10 -0
  260. package/lib/browser/util/image-shrink.d.ts +5 -1
  261. package/lib/browser/util/image-shrink.js +1 -1
  262. package/lib/browser/util/markdown.d.ts +3 -5
  263. package/lib/browser/util/markdown.js +5 -29
  264. package/lib/browser/util/process.js +1 -1
  265. package/package.json +7 -7
  266. package/esm/browser/util/share-link.d.ts +0 -21
  267. package/esm/browser/util/share-link.js +0 -61
  268. package/lib/browser/util/share-link.d.ts +0 -22
  269. package/lib/browser/util/share-link.js +0 -64
@@ -203,24 +203,60 @@ function UserImages({ blocks, timestamp }) {
203
203
  lightbox,
204
204
  folding));
205
205
  }
206
+ /**
207
+ * The originals of pictures shown made smaller, as the user asks for them over the page (查看原图): the URL of each
208
+ * come, by key, how the loading of each goes, and the 查看原图 of the Lightbox of one not come yet.
209
+ */
210
+ function useOriginals() {
211
+ const [loaded, setLoaded] = React.useState({});
212
+ const [states, setStates] = React.useState({});
213
+ const live = React.useRef(true);
214
+ React.useEffect(() => {
215
+ live.current = true;
216
+ return () => {
217
+ live.current = false;
218
+ };
219
+ }, []);
220
+ const of = (image) => {
221
+ const original = image === null || image === void 0 ? void 0 : image.original;
222
+ if (!image || !original || loaded[image.key]) {
223
+ return undefined;
224
+ }
225
+ return {
226
+ bytes: original.bytes,
227
+ state: states[image.key],
228
+ onLoad: () => {
229
+ setStates(current => ({ ...current, [image.key]: 'loading' }));
230
+ original.load().then(url => {
231
+ if (live.current) {
232
+ url && setLoaded(current => ({ ...current, [image.key]: url }));
233
+ setStates(({ [image.key]: _, ...rest }) => (url ? rest : { ...rest, [image.key]: 'failed' }));
234
+ }
235
+ }, () => live.current && setStates(current => ({ ...current, [image.key]: 'failed' })));
236
+ },
237
+ };
238
+ };
239
+ return { src: (image) => { var _a; return (image ? ((_a = loaded[image.key]) !== null && _a !== void 0 ? _a : image.src) : undefined); }, of };
240
+ }
206
241
  /**
207
242
  * The pictures of a message of a chat an extension draws (a group chat, a channel), as those of the user in a
208
243
  * conversation: one alone in its shape, more in squares, full size over the page on a click, those still on their way
209
244
  * blurred from their thumbnail.
210
245
  */
211
246
  function ChatImages({ images, alt = '' }) {
212
- var _a, _b, _c, _d, _e;
247
+ var _a, _b;
213
248
  const t = (0, use_t_1.useT)();
214
249
  const [open, setOpen] = React.useState();
215
250
  const [menu, openMenu] = (0, image_menu_1.useImageMenu)();
216
251
  const [, redraw] = React.useReducer((n) => n + 1, 0);
252
+ const originals = useOriginals();
217
253
  if (images.length === 0) {
218
254
  return null;
219
255
  }
220
256
  const fold = `chat:${images[0].key}`;
221
257
  const single = images.length === 1 ? UserImageUtil.box({ width: images[0].width, height: images[0].height }) : undefined;
222
- const shown = open !== undefined ? (_a = images[open]) === null || _a === void 0 ? void 0 : _a.src : undefined;
223
- const lightbox = open !== undefined && shown && (React.createElement(lightbox_1.Lightbox, { src: shown, alt: alt, count: { at: open, of: images.length }, onClose: () => setOpen(undefined), onPrevious: open > 0 && ((_b = images[open - 1]) === null || _b === void 0 ? void 0 : _b.src) ? () => setOpen(open - 1) : undefined, onNext: open < images.length - 1 && ((_c = images[open + 1]) === null || _c === void 0 ? void 0 : _c.src) ? () => setOpen(open + 1) : undefined, previousSrc: open > 0 ? (_d = images[open - 1]) === null || _d === void 0 ? void 0 : _d.src : undefined, nextSrc: (_e = images[open + 1]) === null || _e === void 0 ? void 0 : _e.src }));
258
+ const shown = open !== undefined ? originals.src(images[open]) : undefined;
259
+ const lightbox = open !== undefined && shown && (React.createElement(lightbox_1.Lightbox, { src: shown, alt: alt, count: { at: open, of: images.length }, onClose: () => setOpen(undefined), onPrevious: open > 0 && ((_a = images[open - 1]) === null || _a === void 0 ? void 0 : _a.src) ? () => setOpen(open - 1) : undefined, onNext: open < images.length - 1 && ((_b = images[open + 1]) === null || _b === void 0 ? void 0 : _b.src) ? () => setOpen(open + 1) : undefined, previousSrc: open > 0 ? originals.src(images[open - 1]) : undefined, nextSrc: originals.src(images[open + 1]), original: originals.of(images[open]) }));
224
260
  if (ImageStackUtil.stacked(images.length, fold)) {
225
261
  return (React.createElement(React.Fragment, null,
226
262
  React.createElement(ImageStack, { sources: images.map(image => { var _a; return (_a = image.src) !== null && _a !== void 0 ? _a : image.thumb; }), first: { width: images[0].width, height: images[0].height }, count: images.length, onOpen: () => setOpen(0), onUnfold: () => {
@@ -231,7 +267,7 @@ function ChatImages({ images, alt = '' }) {
231
267
  }
232
268
  return (React.createElement("div", { className: "ta-user-images ta-chat-images", "data-count": Math.min(images.length, 3), style: { '--ta-user-image-columns': gallery_1.GalleryUtil.columns(images.length) } },
233
269
  images.map((image, at) => (React.createElement("button", { key: image.key, type: "button", className: "ta-user-image", title: image.src ? t('ta.markdown.enlarge') : alt, disabled: !image.src, onClick: () => setOpen(at), onContextMenu: event => {
234
- const source = image.src;
270
+ const source = originals.src(image);
235
271
  if (source) {
236
272
  openMenu(event, { full: () => source, enlarge: () => setOpen(at) });
237
273
  }
@@ -58,6 +58,7 @@ const message_images_1 = require("./message-images");
58
58
  const message_menu_1 = require("./message-menu");
59
59
  const people_1 = require("./people");
60
60
  const said_text_1 = require("./said-text");
61
+ const sending_1 = require("./sending");
61
62
  /** The messages of the conversation still on their way from here, by message, with what can be done with those that failed. */
62
63
  exports.Outbox = React.createContext({ of: new Map() });
63
64
  /** A message that did not go: marked as such, with a way to send it again or take it back, as in a messenger. */
@@ -246,8 +247,9 @@ function UserBubble({ message, blocks, text, copied, skill, queued, }) {
246
247
  // Not in the session yet: nothing to branch from or rewind to.
247
248
  return (React.createElement("div", { className: `ta-message ta-user ${sent.failed ? 'ta-user-failed' : 'ta-user-sending'}` },
248
249
  marks,
249
- React.createElement(UserSaid, { blocks: blocks, text: text, timestamp: message.timestamp }),
250
- sent.failed ? React.createElement(SendFailed, { sent: sent, actions: outbox.actions }) : React.createElement("div", { className: "ta-footer" })));
250
+ React.createElement(sending_1.Sending, { failed: sent.failed, onResend: sent.code === ta_protocol_1.TaErrorCode.NOT_SIGNED_IN ? undefined : outbox.actions && (() => { var _a; return (_a = outbox.actions) === null || _a === void 0 ? void 0 : _a.resend(sent.id); }), line: React.createElement(SendFailed, { sent: sent, actions: outbox.actions }) },
251
+ React.createElement(UserSaid, { blocks: blocks, text: text, timestamp: message.timestamp })),
252
+ !sent.failed && React.createElement("div", { className: "ta-footer" })));
251
253
  }
252
254
  return (React.createElement("div", { className: "ta-message ta-user", onContextMenu: onContextMenu },
253
255
  marks,
@@ -52,8 +52,8 @@ const swipe_row_1 = require("./swipe-row");
52
52
  * same for every kind (PartnerRowUtil).
53
53
  */
54
54
  function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
55
- var _a, _b;
56
- var _c;
55
+ var _a, _b, _c, _d;
56
+ var _e;
57
57
  const t = (0, use_t_1.useT)();
58
58
  const [menu, openMenu] = (0, context_menu_1.useContextMenu)();
59
59
  const [opening, setOpening] = React.useState(false);
@@ -91,7 +91,7 @@ function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
91
91
  Own && !opening ? (React.createElement("span", { className: "ta-chat-face", style: { width: 38, height: 38 }, "aria-hidden": "true" },
92
92
  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 }))),
93
93
  partner.online && React.createElement("span", { className: "ta-partner-online", "aria-hidden": "true" }),
94
- React.createElement(chat_list_row_1.ChatDot, { unseen: unseen, asks: asks })),
95
- 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, badge: (_c = partner.label) !== null && _c !== void 0 ? _c : (partner.friends ? t('ta.partners.withFriends') : undefined) }))));
94
+ React.createElement(chat_list_row_1.ChatDot, { unseen: unseen, asks: asks, count: partners_util_1.PartnersUtil.count(partner), onSee: selected || partner.status ? undefined : (_b = partner.chat) === null || _b === void 0 ? void 0 : _b.see })),
95
+ React.createElement(chat_home_1.RowText, { title: partner.name, time: time, line: partners_util_1.PartnersUtil.line(partner, t('ta.partners.waiting')), unseen: unseen, flag: !partner.status && ((_c = partner.chat) === null || _c === void 0 ? void 0 : _c.flag) ? React.createElement("span", { className: "ta-chat-flag ta-alert" }, partner.chat.flag) : undefined, busy: !partner.status && !!((_d = partner.chat) === null || _d === void 0 ? void 0 : _d.busy), tag: partner.location ? React.createElement(host_tag_1.HostTag, { location: partner.location }) : undefined, badge: (_e = partner.label) !== null && _e !== void 0 ? _e : (partner.friends ? t('ta.partners.withFriends') : undefined) }))));
96
96
  }
97
97
  //# sourceMappingURL=partner-row.js.map
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * A line above the message box after a newcomer's first conversation was answered: Ta is on the phone too, a tap shows
4
+ * the code to scan (RelayDialog). Once (FirstStepsUtil.phoneHint), kept for the user on every device.
5
+ */
6
+ export declare function PhoneHint(): React.JSX.Element;
7
+ //# sourceMappingURL=phone-hint.d.ts.map
@@ -0,0 +1,99 @@
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.PhoneHint = PhoneHint;
37
+ const react_1 = require("@celljs/react");
38
+ const ta_protocol_1 = require("@celljs/ta-protocol");
39
+ const lucide_react_1 = require("lucide-react");
40
+ const React = __importStar(require("react"));
41
+ const device_1 = require("../device/device");
42
+ const web_metrics_1 = require("../extension/web-metrics");
43
+ const hooks_1 = require("../hooks");
44
+ const use_t_1 = require("../i18n/use-t");
45
+ const state_protocol_1 = require("../state/state-protocol");
46
+ const first_steps_util_1 = require("./first-steps-util");
47
+ const icon_1 = require("./icon");
48
+ const people_1 = require("./people");
49
+ const relay_view_1 = require("./relay-view");
50
+ /**
51
+ * A line above the message box after a newcomer's first conversation was answered: Ta is on the phone too, a tap shows
52
+ * the code to scan (RelayDialog). Once (FirstStepsUtil.phoneHint), kept for the user on every device.
53
+ */
54
+ function PhoneHint() {
55
+ var _a;
56
+ const t = (0, use_t_1.useT)();
57
+ const handheld = (0, device_1.useDevice)(device => device.handheld);
58
+ const state = (0, react_1.useInject)(state_protocol_1.TaState);
59
+ const [workbench, bench] = (0, hooks_1.useWorkbench)();
60
+ const [kept, setKept] = (0, hooks_1.usePersisted)(first_steps_util_1.FirstStepsUtil.STATE);
61
+ const [loaded, setLoaded] = React.useState(false);
62
+ const [paired, setPaired] = React.useState();
63
+ const [pairing, setPairing] = React.useState(false);
64
+ // Pairing is the owner's: one let into their Ta (a collaborator, a guest) is not offered it.
65
+ const owner = React.useContext(people_1.MessagePeople).me === ta_protocol_1.TA_OWNER;
66
+ const online = owner && workbench.status === 'online';
67
+ React.useEffect(() => {
68
+ void state.load(first_steps_util_1.FirstStepsUtil.STATE).then(() => setLoaded(true), () => undefined);
69
+ }, [state]);
70
+ // The phones paired, asked only once the line could show at all.
71
+ const candidate = loaded && online && first_steps_util_1.FirstStepsUtil.phoneHint(kept, { handheld, paired: 0, now: Date.now() });
72
+ React.useEffect(() => {
73
+ if (candidate && paired === undefined) {
74
+ bench.relay.getRelay().then(info => setPaired(info.devices.length), () => undefined);
75
+ }
76
+ }, [candidate, paired, bench]);
77
+ const shown = candidate && paired !== undefined && first_steps_util_1.FirstStepsUtil.phoneHint(kept, { handheld, paired, now: Date.now() });
78
+ React.useEffect(() => {
79
+ var _a, _b;
80
+ if (shown && ((_a = kept.phone) === null || _a === void 0 ? void 0 : _a.at) === undefined) {
81
+ (_b = web_metrics_1.WebMetrics.current) === null || _b === void 0 ? void 0 : _b.own('step:phone-hint');
82
+ setKept(before => ({ ...before, phone: { ...before.phone, at: Date.now() } }));
83
+ }
84
+ }, [shown, (_a = kept.phone) === null || _a === void 0 ? void 0 : _a.at, setKept]);
85
+ const done = () => setKept(before => ({ ...before, phone: { ...before.phone, done: true } }));
86
+ return (React.createElement(React.Fragment, null,
87
+ shown && (React.createElement("div", { className: "ta-phone-hint" },
88
+ React.createElement(icon_1.Icon, { icon: lucide_react_1.Smartphone, size: 14 }),
89
+ React.createElement("span", { className: "ta-ellipsis" }, t('ta.phoneHint.text')),
90
+ React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => {
91
+ var _a;
92
+ (_a = web_metrics_1.WebMetrics.current) === null || _a === void 0 ? void 0 : _a.own('step:phone-pair');
93
+ setPairing(true);
94
+ done();
95
+ } }, t('ta.phoneHint.pair')),
96
+ React.createElement(icon_1.IconButton, { icon: lucide_react_1.X, label: t('ta.close'), onClick: done }))),
97
+ pairing && React.createElement(relay_view_1.RelayDialog, { onClose: () => setPairing(false) })));
98
+ }
99
+ //# sourceMappingURL=phone-hint.js.map
@@ -19,6 +19,8 @@ export interface PhoneTab {
19
19
  onSeeAll?(): void;
20
20
  /** How many wait for the user to decide (the double's tab): a blue count, in place of the amber dot. */
21
21
  asks?: number;
22
+ /** How many messages people sent the user has not seen (the chats' tab): a red number, before all else. */
23
+ count?: number;
22
24
  }
23
25
  export interface PhoneShellProps {
24
26
  tabs: PhoneTab[];
@@ -283,7 +283,7 @@ function TabBar({ tabs, tab, onTab }) {
283
283
  return (React.createElement("button", { key: item.id, type: "button", className: `ta-tabbar-item${active ? ' ta-active' : ''}`, "aria-current": active ? 'page' : undefined, onClick: event => (active ? again(item.id, event.currentTarget.closest('.ta-phone-home')) : onTab(item.id)), onContextMenu: item.menu ? event => { var _a; return openMenu(event, (_a = item.menu) !== null && _a !== void 0 ? _a : []); } : undefined, ...held(item.hold) },
284
284
  React.createElement("span", { className: "ta-tabbar-icon" },
285
285
  item.double ? React.createElement(ta_avatar_1.DinoFace, { size: 24, className: "ta-nav-face" }) : React.createElement(Glyph, { size: 22, strokeWidth: active ? 2 : 1.6 }),
286
- item.asks ? (React.createElement(asks_badge_1.AsksBadge, { count: item.asks, onDismiss: item.onSeeAll })) : (item.unseen && React.createElement(unseen_drop_1.UnseenDrop, { label: t('ta.chat.unseen'), onDismiss: item.onSeeAll }))),
286
+ item.count ? (React.createElement(asks_badge_1.PeopleBadge, { count: item.count, onDismiss: item.onSeeAll })) : item.asks ? (React.createElement(asks_badge_1.AsksBadge, { count: item.asks, onDismiss: item.onSeeAll })) : (item.unseen && React.createElement(unseen_drop_1.UnseenDrop, { label: t('ta.chat.unseen'), onDismiss: item.onSeeAll }))),
287
287
  React.createElement("span", null, item.label)));
288
288
  }),
289
289
  menu));
@@ -0,0 +1,20 @@
1
+ import * as React from 'react';
2
+ /** How a message of the user on its way shows (WebSendingProps). */
3
+ export interface SendingProps {
4
+ /** Why it did not go: a red mark beside it, and under it the line `line`, else 发送失败 · 重发 · 删除. */
5
+ failed?: string;
6
+ /** How far it went, 0 to 1, when known: said beside the spinner. */
7
+ progress?: number;
8
+ onResend?(): void;
9
+ onDiscard?(): void;
10
+ /** In place of the line under one that did not go. */
11
+ line?: React.ReactNode;
12
+ children?: React.ReactNode;
13
+ }
14
+ /**
15
+ * A message of the user on its way, as a messenger shows it: drawn at once, a spinner beside it while it goes, a red
16
+ * mark beside it and a way to send it again or take it back under it once it did not go. Conversations and the chats
17
+ * of extensions (`ui.Sending`) show their messages on their way so alike.
18
+ */
19
+ export declare function Sending({ failed, progress, onResend, onDiscard, line, children }: SendingProps): React.JSX.Element;
20
+ //# sourceMappingURL=sending.d.ts.map
@@ -0,0 +1,63 @@
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.Sending = Sending;
37
+ const lucide_react_1 = require("lucide-react");
38
+ const React = __importStar(require("react"));
39
+ const use_t_1 = require("../i18n/use-t");
40
+ const icon_1 = require("./icon");
41
+ /**
42
+ * A message of the user on its way, as a messenger shows it: drawn at once, a spinner beside it while it goes, a red
43
+ * mark beside it and a way to send it again or take it back under it once it did not go. Conversations and the chats
44
+ * of extensions (`ui.Sending`) show their messages on their way so alike.
45
+ */
46
+ function Sending({ failed, progress, onResend, onDiscard, line, children }) {
47
+ const t = (0, use_t_1.useT)();
48
+ const percent = progress !== undefined && progress >= 0 && progress < 1 ? Math.floor(progress * 100) : undefined;
49
+ return (React.createElement(React.Fragment, null,
50
+ React.createElement("div", { className: `ta-sending${failed ? ' ta-sending-failed' : ''}` },
51
+ failed ? (React.createElement("button", { type: "button", className: "ta-sending-mark", title: failed, "aria-label": t('ta.message.resend'), disabled: !onResend, onClick: onResend },
52
+ React.createElement(icon_1.Icon, { icon: lucide_react_1.CircleAlert, size: 18 }))) : (React.createElement("span", { className: "ta-sending-mark", role: "status", "aria-label": t('ta.message.sending') },
53
+ percent !== undefined && React.createElement("span", { className: "ta-sending-percent" }, `${percent}%`),
54
+ React.createElement("span", { className: "ta-spinner" }))),
55
+ React.createElement("div", { className: "ta-sending-body" }, children)),
56
+ failed &&
57
+ (line !== null && line !== void 0 ? line : (React.createElement("div", { className: "ta-send-failed", title: failed },
58
+ React.createElement(icon_1.Icon, { icon: lucide_react_1.CircleAlert, size: 14 }),
59
+ React.createElement("span", null, t('ta.message.sendFailed')),
60
+ onResend && (React.createElement("button", { type: "button", className: "ta-link-button", onClick: onResend }, t('ta.message.resend'))),
61
+ onDiscard && (React.createElement("button", { type: "button", className: "ta-link-button", onClick: onDiscard }, t('ta.message.discard'))))))));
62
+ }
63
+ //# sourceMappingURL=sending.js.map
@@ -49,6 +49,7 @@ const code_renderers_1 = require("../markdown/code-renderers");
49
49
  const screen_protocol_1 = require("../screen/screen-protocol");
50
50
  const screen_scroll_1 = require("../screen/screen-scroll");
51
51
  const use_screen_part_1 = require("../screen/use-screen-part");
52
+ const agent_settings_1 = require("../settings/agent-settings");
52
53
  const link_1 = require("../util/link");
53
54
  const message_1 = require("../util/message");
54
55
  const terminal_text_1 = require("../util/terminal-text");
@@ -77,6 +78,7 @@ const message_images_1 = require("./message-images");
77
78
  const message_list_1 = require("./message-list");
78
79
  const moved_notice_1 = require("./moved-notice");
79
80
  const people_1 = require("./people");
81
+ const phone_hint_1 = require("./phone-hint");
80
82
  const session_settings_1 = require("./session-settings");
81
83
  const terminal_art_1 = require("./terminal-art");
82
84
  const use_stop_times_1 = require("./use-stop-times");
@@ -189,7 +191,7 @@ function SessionView({ store, server, workspace, info, onClosed, onActivity, lea
189
191
  const { settings, actions } = (0, session_settings_1.useSessionSettings)(server, (0, hooks_1.useSettingsServer)(), store, state, t, fail, contextAct);
190
192
  const composer = React.useRef(null);
191
193
  const [settingsState] = (0, hooks_1.useSettings)();
192
- const recentShots = settingsState.settings.recentShots;
194
+ const { recentShots, sendWhileWorking } = settingsState.settings;
193
195
  // A call: the conversation listens, answers aloud, and listens again (VoiceCall); not in a tab of the workbench.
194
196
  const [callState, call] = (0, voice_call_bar_1.useVoiceCall)({
195
197
  language: () => settingsState.language,
@@ -242,7 +244,7 @@ function SessionView({ store, server, workspace, info, onClosed, onActivity, lea
242
244
  const fileUrl = React.useCallback(async (path, box) => files.loadable(thumbnail_1.ThumbnailUtil.boxed(await workspace.fileUrl(path, cwd), box)), [workspace, cwd, files]);
243
245
  const namedPaths = React.useCallback(() => message_1.MessageUtil.namedPaths(store.state.messages), [store]);
244
246
  const openLink = (0, hooks_1.useOpenLink)(cwd, namedPaths);
245
- const [{ fileMenus }] = (0, hooks_1.useWebExtensions)();
247
+ const [{ fileMenus }, extensions] = (0, hooks_1.useWebExtensions)();
246
248
  const fileMenu = React.useCallback((path) => (cwd ? fileMenus.flatMap(menu => menu(link_1.LinkUtil.fileRef(cwd, path))) : []), [cwd, fileMenus]);
247
249
  // biome-ignore lint/correctness/useExhaustiveDependencies: runs when a run starts or settles
248
250
  React.useEffect(() => onActivity(), [state.working, onActivity]);
@@ -426,7 +428,7 @@ function SessionView({ store, server, workspace, info, onClosed, onActivity, lea
426
428
  widgetsAt('aboveEditor'),
427
429
  addons.above,
428
430
  React.createElement(voice_call_bar_1.CallBar, { state: callState, call: call })),
429
- React.createElement(composer_1.Composer, { ref: composer, store: store, server: server, workspace: workspace, working: state.working, compacting: !!state.compacting, commands: settings.commands, cwd: info === null || info === void 0 ? void 0 : info.cwd, actions: composerActions, recentShots: recentShots, onStopTimed: stopTimed, onTyping: onTyping, draft: (info === null || info === void 0 ? void 0 : info.sessionFile) ? drafts_protocol_1.DraftPlaces.chat(info.sessionFile) : undefined, onTalkCall: callable && !callState.active ? (0, voice_call_bar_1.talkCall)(call) : undefined, talkCalls: talkCalls, onError: fail }),
431
+ React.createElement(composer_1.Composer, { above: React.createElement(phone_hint_1.PhoneHint, null), ref: composer, store: store, server: server, workspace: workspace, working: state.working, compacting: !!state.compacting, commands: settings.commands, cwd: info === null || info === void 0 ? void 0 : info.cwd, actions: composerActions, recentShots: recentShots, sendWhileWorking: sendWhileWorking, onQueueSettings: () => extensions.openSettings(agent_settings_1.QUEUE_SETTINGS), onStopTimed: stopTimed, onTyping: onTyping, draft: (info === null || info === void 0 ? void 0 : info.sessionFile) ? drafts_protocol_1.DraftPlaces.chat(info.sessionFile) : undefined, onTalkCall: callable && !callState.active ? (0, voice_call_bar_1.talkCall)(call) : undefined, talkCalls: talkCalls, onError: fail }),
430
432
  belowComposer,
431
433
  widgetsAt('belowEditor'),
432
434
  statuses.length > 0 && (React.createElement("div", { className: "ta-statusline" }, statuses.map(([key, text]) => (React.createElement(StatusChip, { key: key, text: text })))))))));
@@ -82,6 +82,7 @@ exports.SHORTCUTS = [
82
82
  { keys: 'Enter', label: 'ta.shortcut.send' },
83
83
  { keys: 'Shift+Enter', label: 'ta.shortcut.newline' },
84
84
  { keys: 'Alt+Enter', label: 'ta.shortcut.followUp' },
85
+ { keys: 'Mod+Enter', label: 'ta.shortcut.sendNow' },
85
86
  { keys: 'Esc', label: 'ta.shortcut.stop' },
86
87
  { keys: '/', label: 'ta.shortcut.commands' },
87
88
  { keys: '@', label: 'ta.shortcut.files' },
@@ -44,6 +44,7 @@ const use_t_1 = require("../i18n/use-t");
44
44
  const agent_settings_1 = require("../settings/agent-settings");
45
45
  const settings_protocol_1 = require("../settings/settings-protocol");
46
46
  const skin_util_1 = require("../skin/skin-util");
47
+ const composer_1 = require("../util/composer");
47
48
  const voice_1 = require("../util/voice");
48
49
  const agent_settings_view_1 = require("./agent-settings-view");
49
50
  const app_nav_1 = require("./app-nav");
@@ -217,27 +218,37 @@ function useParts(scope, onScope, onDialog) {
217
218
  !agent.offline && !snapshot && !agent.error && React.createElement(loading_1.Loading, { compact: true, label: t('ta.settings.loading') }),
218
219
  locked && React.createElement("div", { className: "ta-settings-note" }, t('ta.settings.untrusted')),
219
220
  agent.error && React.createElement("div", { className: "ta-banner ta-banner-error" }, t('ta.settings.failed', { error: agent.error }))));
220
- const ta = agent_settings_1.AGENT_SETTINGS_GROUPS.map(group => { var _a; return ({
221
+ // Of this device, in the section of what pi does with the messages sent while Ta works: one place for the queue.
222
+ const own = {
223
+ [agent_settings_1.QUEUE_SETTINGS]: [
224
+ (0, settings_controls_1.row)('send-while-working', [t('ta.settings.sendWhileWorking'), t('ta.settings.sendWhileWorkingHint', composer_1.ComposerUtil.keyNames(agent_settings_1.ShortcutUtil.isMac()))], React.createElement(settings_controls_1.Row, { label: t('ta.settings.sendWhileWorking'), description: t('ta.settings.sendWhileWorkingHint', composer_1.ComposerUtil.keyNames(agent_settings_1.ShortcutUtil.isMac())), stacked: true },
225
+ React.createElement(settings_controls_1.Segmented, { label: t('ta.settings.sendWhileWorking'), value: settings.sendWhileWorking, choices: settings_protocol_1.SEND_WHILE_WORKING.map(value => ({ value, label: t(`ta.settings.sendWhileWorking.${value}`) })), onChange: value => store.update({ sendWhileWorking: value }) }))),
226
+ ],
227
+ };
228
+ const ta = agent_settings_1.AGENT_SETTINGS_GROUPS.map(group => { var _a, _b; return ({
221
229
  id: group.id,
222
230
  title: t(group.title),
223
231
  icon: (_a = settings_choices_1.GROUP_ICONS[group.id]) !== null && _a !== void 0 ? _a : lucide_react_1.Wrench,
224
232
  group: 'ta',
225
233
  scoped: true,
226
234
  ...(group.id === 'model' ? { tier: 'common' } : {}),
227
- rows: snapshot
228
- ? group.keys.flatMap(key => {
229
- const spec = agent_settings_1.AgentSettingsUtil.spec(key);
230
- if (!spec) {
231
- return [];
232
- }
233
- const label = t(agent_settings_1.AgentSettingsUtil.label(key));
234
- const hint = agent_settings_1.AgentSettingsUtil.hint(key);
235
- return [
236
- (0, settings_controls_1.row)(key, [label, hint && t(hint), key], React.createElement(settings_controls_1.Row, { label: label, description: hint && t(hint), modified: snapshot[scope][key] !== undefined },
237
- React.createElement(agent_settings_view_1.AgentControl, { spec: spec, scope: scope, snapshot: snapshot, disabled: locked, onChange: changes => agent.update(scope, changes) }))),
238
- ];
239
- })
240
- : [],
235
+ rows: [
236
+ ...((_b = own[group.id]) !== null && _b !== void 0 ? _b : []),
237
+ ...(snapshot
238
+ ? group.keys.flatMap(key => {
239
+ const spec = agent_settings_1.AgentSettingsUtil.spec(key);
240
+ if (!spec) {
241
+ return [];
242
+ }
243
+ const label = t(agent_settings_1.AgentSettingsUtil.label(key));
244
+ const hint = agent_settings_1.AgentSettingsUtil.hint(key);
245
+ return [
246
+ (0, settings_controls_1.row)(key, [label, hint && t(hint), key], React.createElement(settings_controls_1.Row, { label: label, description: hint && t(hint), modified: snapshot[scope][key] !== undefined },
247
+ React.createElement(agent_settings_view_1.AgentControl, { spec: spec, scope: scope, snapshot: snapshot, disabled: locked, onChange: changes => agent.update(scope, changes) }))),
248
+ ];
249
+ })
250
+ : []),
251
+ ],
241
252
  }); });
242
253
  // Ta's scoped sections first in its part, under their scope; each part's own sections before those of extensions.
243
254
  const sections = [...web.filter(entry => entry.group !== 'ta'), ...ta, ...web.filter(entry => entry.group === 'ta'), ...more];
@@ -35,11 +35,11 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.ShareDialog = ShareDialog;
37
37
  exports.ShareHost = ShareHost;
38
+ const share_link_1 = require("@celljs/ta-protocol/lib/common/share-link");
38
39
  const lucide_react_1 = require("lucide-react");
39
40
  const React = __importStar(require("react"));
40
41
  const hooks_1 = require("../hooks");
41
42
  const use_t_1 = require("../i18n/use-t");
42
- const share_link_1 = require("../util/share-link");
43
43
  const share_item_sheet_1 = require("./share-item-sheet");
44
44
  const share_sheet_1 = require("./share-sheet");
45
45
  /** The link of an extension: of its source when it is published, else of the relay, made by this computer. */
@@ -72,10 +72,11 @@ function ShareDialog({ target, onClose }) {
72
72
  const t = (0, use_t_1.useT)();
73
73
  const [, bench] = (0, hooks_1.useWorkbench)();
74
74
  const [, notices] = (0, hooks_1.useNotices)();
75
+ const [{ shareWays }] = (0, hooks_1.useWebExtensions)();
75
76
  const [shared, error] = useShared(target);
76
77
  const packageId = target.packageId;
77
78
  const days = (shared === null || shared === void 0 ? void 0 : shared.relayed) ? Math.max(1, Math.round((shared.expiresAt - Date.now()) / 86400000)) : 0;
78
- return (React.createElement(share_sheet_1.ShareSheet, { title: t('ta.share.title', { name: target.title }), link: shared === null || shared === void 0 ? void 0 : shared.link, error: error === undefined ? undefined : error || t('ta.share.cannot'), face: React.createElement(lucide_react_1.Package, { size: 22 }), name: target.title, gets: t('ta.share.extensionGets'), invite: t('ta.share.extensionInvite', { name: target.title }), notes: [(shared === null || shared === void 0 ? void 0 : shared.relayed) ? t('ta.share.relayed', { days, size: Math.round(shared.maxBytes / 1024 / 1024) }) : t('ta.share.published')], onStop: (shared === null || shared === void 0 ? void 0 : shared.relayed) && packageId ? () => bench.relay.unsharePackage(packageId) : undefined, stop: { title: t('ta.share.stopTitle', { name: target.title }), message: t('ta.share.stopHint') }, onClose: onClose, notices: notices, rooms: bench.rooms, onRoomEvent: listener => bench.onRoomEvent(listener, { messages: false }) }));
79
+ return (React.createElement(share_sheet_1.ShareSheet, { title: t('ta.share.title', { name: target.title }), link: shared === null || shared === void 0 ? void 0 : shared.link, error: error === undefined ? undefined : error || t('ta.share.cannot'), face: React.createElement(lucide_react_1.Package, { size: 22 }), name: target.title, icon: "Package", gets: t('ta.share.extensionGets'), invite: t('ta.share.extensionInvite', { name: target.title }), notes: [(shared === null || shared === void 0 ? void 0 : shared.relayed) ? t('ta.share.relayed', { days, size: Math.round(shared.maxBytes / 1024 / 1024) }) : t('ta.share.published')], onStop: (shared === null || shared === void 0 ? void 0 : shared.relayed) && packageId ? () => bench.relay.unsharePackage(packageId) : undefined, stop: { title: t('ta.share.stopTitle', { name: target.title }), message: t('ta.share.stopHint') }, onClose: onClose, notices: notices, rooms: bench.rooms, onRoomEvent: listener => bench.onRoomEvent(listener, { messages: false }), ways: () => shareWays }));
79
80
  }
80
81
  /** The share asked for by a web extension, over the page: an extension handed on, or the share sheet of something. */
81
82
  function ShareHost() {
@@ -69,7 +69,7 @@ function ShareItemSheet({ item, ways, onClose }) {
69
69
  React.createElement(Icon, { size: 22 })),
70
70
  React.createElement("span", { className: "ta-share-who-text" },
71
71
  React.createElement("strong", { className: "ta-share-name" }, name),
72
- React.createElement("span", { className: "ta-share-gets" }, item.kind === 'file' ? t('ta.share.itemFile') : t('ta.share.itemWork'))))),
72
+ React.createElement("span", { className: "ta-share-gets" }, item.kind === 'file' ? t('ta.share.itemFile') : item.kind === 'link' ? item.gets : t('ta.share.itemWork'))))),
73
73
  taking.length ? (React.createElement("div", { className: "ta-share-tiles" }, taking.map(way => (React.createElement(share_sheet_1.Tile, { key: way.key, icon: way.icon, label: web_share_1.WebShareUtil.label(way), onClick: () => pick(way) }))))) : (React.createElement(empty_state_1.EmptyState, { title: t('ta.share.noWay'), compact: true })))));
74
74
  }
75
75
  //# sourceMappingURL=share-item-sheet.js.map
@@ -1,6 +1,6 @@
1
1
  import type { TaRoomEvent, TaRoomServer } from '@celljs/ta-protocol';
2
2
  import * as React from 'react';
3
- import type { WebIcon, WebShareSheetProps } from '../extension/web-extension-api';
3
+ import type { WebIcon, WebShareSheetProps, WebShareWay } from '../extension/web-extension-api';
4
4
  import type { TaNotices } from '../notices/notices-protocol';
5
5
  /** One of the actions under the code, as the share sheets of phones: a round icon over a word. */
6
6
  export declare function Tile({ icon: Icon, label, onClick, disabled }: {
@@ -19,6 +19,8 @@ export interface ShareSheetServices {
19
19
  notices: TaNotices;
20
20
  rooms: TaRoomServer;
21
21
  onRoomEvent?(listener: (event: TaRoomEvent) => void): () => void;
22
+ /** The ways to share (registerShareWay): one that takes a link sends it into chats, friends' and group chats alike. */
23
+ ways?(): readonly WebShareWay[];
22
24
  }
23
- export declare function ShareSheet({ title, link, error, face, name, gets, invite, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, onRoomEvent, }: WebShareSheetProps & ShareSheetServices): React.JSX.Element;
25
+ export declare function ShareSheet({ title, link, error, face, name, icon, gets, invite, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, onRoomEvent, ways, }: WebShareSheetProps & ShareSheetServices): React.JSX.Element;
24
26
  //# sourceMappingURL=share-sheet.d.ts.map
@@ -38,6 +38,7 @@ exports.ShareSheet = ShareSheet;
38
38
  const lucide_react_1 = require("lucide-react");
39
39
  const React = __importStar(require("react"));
40
40
  const share_sheet_compat_1 = require("../extension/share-sheet-compat");
41
+ const web_share_1 = require("../extension/web-share");
41
42
  const use_t_1 = require("../i18n/use-t");
42
43
  const busy_1 = require("./busy");
43
44
  const empty_state_1 = require("./empty-state");
@@ -64,7 +65,7 @@ function Tile({ icon: Icon, label, onClick, disabled }) {
64
65
  React.createElement(Icon, { size: 20 })),
65
66
  React.createElement("span", { className: "ta-share-tile-label" }, label)));
66
67
  }
67
- function ShareSheet({ title, link, error, face, name, gets, invite, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, onRoomEvent, }) {
68
+ function ShareSheet({ title, link, error, face, name, icon, gets, invite, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, onRoomEvent, ways, }) {
68
69
  const t = (0, use_t_1.useT)();
69
70
  const [copied, copy] = useCopied();
70
71
  const [stopping, run] = (0, busy_1.useBusy)();
@@ -72,7 +73,19 @@ function ShareSheet({ title, link, error, face, name, gets, invite, notes, passw
72
73
  const friends = (0, share_friends_1.useShareFriends)(rooms);
73
74
  const [sends, setSends] = React.useState(0);
74
75
  const sent = (0, share_friends_1.useFriendSends)(rooms, own ? undefined : link, sends, onRoomEvent);
75
- const canFriends = !own && !!(friends === null || friends === void 0 ? void 0 : friends.length);
76
+ // Sent into chats as a card, to friends and group chats alike, where a way takes a link (ta-rooms); else sealed for friends alone.
77
+ const chatItem = link && !own ? { kind: 'link', link, title: name || title, invite, ...(gets ? { gets } : {}), ...(icon ? { icon } : {}) } : undefined;
78
+ const chatWay = chatItem ? ways === null || ways === void 0 ? void 0 : ways().find(way => way.accepts(chatItem)) : undefined;
79
+ const toChats = () => {
80
+ if (!chatWay || !chatItem) {
81
+ return;
82
+ }
83
+ onClose();
84
+ Promise.resolve()
85
+ .then(() => chatWay.share(chatItem))
86
+ .catch(reason => notices.error(reason));
87
+ };
88
+ const canFriends = !own && !chatWay && !!(friends === null || friends === void 0 ? void 0 : friends.length);
76
89
  const canSend = !own && typeof navigator !== 'undefined' && typeof navigator.share === 'function';
77
90
  const end = async () => {
78
91
  if (!onStop || (stop && !(await notices.confirm({ title: stop.title, message: stop.message, confirmLabel: t('ta.share.stop'), danger: true })))) {
@@ -110,6 +123,7 @@ function ShareSheet({ title, link, error, face, name, gets, invite, notes, passw
110
123
  setSends(n => n + 1);
111
124
  }
112
125
  } })) : (React.createElement("div", { className: "ta-share-tiles" },
126
+ chatWay && React.createElement(Tile, { icon: chatWay.icon, label: web_share_1.WebShareUtil.label(chatWay), onClick: toChats }),
113
127
  canFriends && React.createElement(Tile, { icon: lucide_react_1.Send, label: t('ta.share.friends'), disabled: !link, onClick: () => setPicking(true) }),
114
128
  React.createElement(Tile, { icon: copied === 'link' ? lucide_react_1.Check : lucide_react_1.Copy, label: copied === 'link' ? t('ta.share.copied') : t('ta.share.copy'), disabled: !link, onClick: () => link && copy((0, share_sheet_compat_1.shareMessage)(invite, link), 'link') }),
115
129
  canSend && (React.createElement(Tile, { icon: lucide_react_1.Share2, label: t('ta.share.apps'), disabled: !link, onClick: () => link && void navigator.share({ title: name || title, text: invite, url: link }).catch(() => undefined) })),
@@ -116,7 +116,13 @@ function usePolledSignIn(onFailed) {
116
116
  window.open(url, '_blank');
117
117
  }
118
118
  },
119
- onProgress: () => undefined,
119
+ // Refused or too late there: this page says so, and the button signs in anew.
120
+ onProgress: progress => {
121
+ if (progress.failed) {
122
+ signIn.stop();
123
+ onFailed();
124
+ }
125
+ },
120
126
  });
121
127
  running.current = signIn;
122
128
  void signIn
@@ -27,8 +27,8 @@ export declare namespace UnseenDropUtil {
27
27
  function neck(from: Point, r: number, to: Point, R: number): string;
28
28
  function distance(a: Point, b: Point): number;
29
29
  }
30
- /** The colour of what is dragged: amber of something unseen, blue of what waits for the user to decide. */
31
- export type DropTone = 'unseen' | 'asks';
30
+ /** The colour of what is dragged: amber of something unseen, blue of what waits for the user to decide, red of what people said. */
31
+ export type DropTone = 'unseen' | 'asks' | 'people';
32
32
  /**
33
33
  * The amber dot of a tab that has something unseen, or the blue count of what waits for the user (AsksBadge, its
34
34
  * `children`). A finger, or the mouse, drags it off as a drop of water, as QQ's unread: stretched past its neck and
@@ -98,7 +98,7 @@ class DropOverlay {
98
98
  this.dot = document.createElementNS(SVG, 'circle');
99
99
  this.bridge = document.createElementNS(SVG, 'path');
100
100
  this.drop = document.createElementNS(SVG, 'circle');
101
- this.svg.setAttribute('class', tone === 'asks' ? 'ta-unseen-drag ta-asks' : 'ta-unseen-drag');
101
+ this.svg.setAttribute('class', tone === 'unseen' ? 'ta-unseen-drag' : `ta-unseen-drag ta-${tone}`);
102
102
  this.svg.setAttribute('aria-hidden', 'true');
103
103
  this.dot.setAttribute('cx', String(origin.x));
104
104
  this.dot.setAttribute('cy', String(origin.y));
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The number on the icon of Ta, as a messenger's: the messages of people the user has not seen, the red number of the
3
+ * chats' tab. Ta Desktop's Dock, the app on iOS (TaPush.swift, which the computer's pushes set too while the app is
4
+ * closed), or an installed web page (the Badging API); 0 takes it off. Nothing where there is no icon.
5
+ */
6
+ export declare namespace AppBadge {
7
+ function set(count: number, scope?: object): void;
8
+ }
9
+ //# sourceMappingURL=app-badge.d.ts.map