@celljs/ta-web 4.46.2 → 4.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. package/esm/browser/account/account-side.d.ts +3 -3
  2. package/esm/browser/account/account-side.js +11 -21
  3. package/esm/browser/account/device-account.d.ts +8 -0
  4. package/esm/browser/account/device-account.js +20 -0
  5. package/esm/browser/chat/chat-protocol.d.ts +7 -0
  6. package/esm/browser/chat/chat-view.js +1 -1
  7. package/esm/browser/chat/chat.d.ts +1 -0
  8. package/esm/browser/chat/chat.js +15 -3
  9. package/esm/browser/chat/draft-model.d.ts +1 -1
  10. package/esm/browser/chat/draft-model.js +2 -2
  11. package/esm/browser/components/access-view.js +12 -10
  12. package/esm/browser/components/account-menu.d.ts +2 -0
  13. package/esm/browser/components/account-menu.js +11 -2
  14. package/esm/browser/components/account-view.js +9 -5
  15. package/esm/browser/components/app-nav.js +4 -1
  16. package/esm/browser/components/app-shell-state.d.ts +2 -0
  17. package/esm/browser/components/app-update-view.d.ts +2 -0
  18. package/esm/browser/components/app-update-view.js +37 -0
  19. package/esm/browser/components/app-view.js +33 -108
  20. package/esm/browser/components/auth-guide.d.ts +25 -0
  21. package/esm/browser/components/auth-guide.js +44 -0
  22. package/esm/browser/components/auth-view.d.ts +2 -0
  23. package/esm/browser/components/auth-view.js +30 -9
  24. package/esm/browser/components/chat-list-controls.d.ts +38 -0
  25. package/esm/browser/components/chat-list-controls.js +46 -0
  26. package/esm/browser/components/chat-list-hooks.d.ts +19 -0
  27. package/esm/browser/components/chat-list-hooks.js +52 -0
  28. package/esm/browser/components/chat-list-rows.d.ts +51 -0
  29. package/esm/browser/components/chat-list-rows.js +110 -0
  30. package/esm/browser/components/chat-list-sections.d.ts +36 -0
  31. package/esm/browser/components/chat-list-sections.js +72 -0
  32. package/esm/browser/components/chat-list.js +48 -221
  33. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  34. package/esm/browser/components/cloud-sign-in-view.js +4 -1
  35. package/esm/browser/components/custom-provider-util.d.ts +2 -0
  36. package/esm/browser/components/custom-provider-util.js +5 -0
  37. package/esm/browser/components/custom-provider-view.js +33 -12
  38. package/esm/browser/components/device-sign-in-page.js +4 -5
  39. package/esm/browser/components/discover-view.d.ts +8 -1
  40. package/esm/browser/components/discover-view.js +28 -3
  41. package/esm/browser/components/environment-view.js +60 -62
  42. package/esm/browser/components/extension-settings.js +1 -0
  43. package/esm/browser/components/first-steps-util.d.ts +29 -0
  44. package/esm/browser/components/first-steps-util.js +41 -0
  45. package/esm/browser/components/first-steps.d.ts +3 -0
  46. package/esm/browser/components/first-steps.js +36 -0
  47. package/esm/browser/components/host-view.d.ts +3 -3
  48. package/esm/browser/components/host-view.js +11 -11
  49. package/esm/browser/components/me-rows.d.ts +8 -1
  50. package/esm/browser/components/me-rows.js +3 -3
  51. package/esm/browser/components/me-view.js +1 -1
  52. package/esm/browser/components/message-user.js +6 -3
  53. package/esm/browser/components/model-picker.d.ts +5 -0
  54. package/esm/browser/components/model-picker.js +10 -1
  55. package/esm/browser/components/nav-places.d.ts +14 -0
  56. package/esm/browser/components/nav-places.js +11 -0
  57. package/esm/browser/components/phone-shell.d.ts +14 -0
  58. package/esm/browser/components/phone-shell.js +22 -0
  59. package/esm/browser/components/picture-dialog.js +4 -7
  60. package/esm/browser/components/profile-view.js +1 -1
  61. package/esm/browser/components/relay-services.js +4 -7
  62. package/esm/browser/components/relay-view-util.d.ts +5 -0
  63. package/esm/browser/components/relay-view-util.js +14 -0
  64. package/esm/browser/components/relay-view.js +40 -37
  65. package/esm/browser/components/scan-screen.js +5 -8
  66. package/esm/browser/components/screen-navigator.d.ts +9 -0
  67. package/esm/browser/components/screen-navigator.js +84 -0
  68. package/esm/browser/components/search-page.js +9 -2
  69. package/esm/browser/components/serve-value.d.ts +27 -0
  70. package/esm/browser/components/serve-value.js +61 -0
  71. package/esm/browser/components/serve-watch.d.ts +23 -0
  72. package/esm/browser/components/serve-watch.js +36 -0
  73. package/esm/browser/components/settings-choices.js +2 -0
  74. package/esm/browser/components/settings-controls.d.ts +15 -0
  75. package/esm/browser/components/settings-controls.js +13 -0
  76. package/esm/browser/components/settings-more.js +6 -4
  77. package/esm/browser/components/settings-parts.d.ts +3 -1
  78. package/esm/browser/components/settings-parts.js +3 -0
  79. package/esm/browser/components/settings-view.js +37 -11
  80. package/esm/browser/components/share-friends.js +3 -4
  81. package/esm/browser/components/share-sheet.js +3 -4
  82. package/esm/browser/components/tool-view.js +17 -3
  83. package/esm/browser/device/app-update.d.ts +62 -0
  84. package/esm/browser/device/app-update.js +144 -0
  85. package/esm/browser/extension/icons.js +2 -1
  86. package/esm/browser/extension/web-api-contributions.d.ts +6 -1
  87. package/esm/browser/extension/web-api-partners.d.ts +6 -0
  88. package/esm/browser/extension/web-api-spec.js +1 -0
  89. package/esm/browser/extension/web-home.js +9 -0
  90. package/esm/browser/extension/web-metrics.d.ts +3 -0
  91. package/esm/browser/extension/web-metrics.js +33 -22
  92. package/esm/browser/extension/web-pages.d.ts +3 -1
  93. package/esm/browser/extension/web-pages.js +1 -0
  94. package/esm/browser/gateway/console-agents.js +11 -15
  95. package/esm/browser/gateway/console-parts.d.ts +7 -4
  96. package/esm/browser/gateway/console-parts.js +11 -20
  97. package/esm/browser/gateway/console-trend.js +2 -2
  98. package/esm/browser/gateway/console-updates.js +6 -4
  99. package/esm/browser/gateway/console-view.js +6 -6
  100. package/esm/browser/i18n/en/account.d.ts +7 -0
  101. package/esm/browser/i18n/en/account.js +13 -6
  102. package/esm/browser/i18n/en/chat.d.ts +2 -0
  103. package/esm/browser/i18n/en/chat.js +2 -0
  104. package/esm/browser/i18n/en/discover.d.ts +3 -0
  105. package/esm/browser/i18n/en/discover.js +3 -0
  106. package/esm/browser/i18n/en/service.d.ts +6 -0
  107. package/esm/browser/i18n/en/service.js +6 -0
  108. package/esm/browser/i18n/en/settings.d.ts +3 -0
  109. package/esm/browser/i18n/en/settings.js +3 -0
  110. package/esm/browser/i18n/ja/account.js +13 -6
  111. package/esm/browser/i18n/ja/chat.js +2 -0
  112. package/esm/browser/i18n/ja/discover.js +3 -0
  113. package/esm/browser/i18n/ja/service.js +6 -0
  114. package/esm/browser/i18n/ja/settings.js +3 -0
  115. package/esm/browser/i18n/locales.d.ts +22 -1
  116. package/esm/browser/i18n/messages.d.ts +21 -0
  117. package/esm/browser/i18n/zh/account.js +13 -6
  118. package/esm/browser/i18n/zh/chat.js +2 -0
  119. package/esm/browser/i18n/zh/discover.js +3 -0
  120. package/esm/browser/i18n/zh/service.js +6 -0
  121. package/esm/browser/i18n/zh/settings.js +3 -0
  122. package/esm/browser/i18n/zh-tw/account.js +13 -6
  123. package/esm/browser/i18n/zh-tw/chat.js +2 -0
  124. package/esm/browser/i18n/zh-tw/discover.js +3 -0
  125. package/esm/browser/i18n/zh-tw/service.js +6 -0
  126. package/esm/browser/i18n/zh-tw/settings.js +3 -0
  127. package/esm/browser/notices/notices.d.ts +2 -0
  128. package/esm/browser/notices/notices.js +2 -0
  129. package/esm/browser/partners/group-picker.js +3 -4
  130. package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
  131. package/esm/browser/settings/settings-protocol.d.ts +5 -0
  132. package/esm/browser/settings/settings-protocol.js +2 -0
  133. package/esm/browser/style/chat-list.d.ts +1 -1
  134. package/esm/browser/style/chat-list.js +4 -3
  135. package/esm/browser/style/dialogs.d.ts +1 -1
  136. package/esm/browser/style/dialogs.js +7 -0
  137. package/esm/browser/style/pages.d.ts +1 -1
  138. package/esm/browser/style/pages.js +5 -3
  139. package/esm/browser/style/shell.d.ts +1 -1
  140. package/esm/browser/style/shell.js +1 -1
  141. package/esm/browser/util/tool.d.ts +5 -0
  142. package/esm/browser/util/tool.js +21 -3
  143. package/lib/browser/account/account-side.d.ts +3 -3
  144. package/lib/browser/account/account-side.js +11 -21
  145. package/lib/browser/account/device-account.d.ts +8 -0
  146. package/lib/browser/account/device-account.js +20 -0
  147. package/lib/browser/chat/chat-protocol.d.ts +7 -0
  148. package/lib/browser/chat/chat-view.js +1 -1
  149. package/lib/browser/chat/chat.d.ts +1 -0
  150. package/lib/browser/chat/chat.js +14 -2
  151. package/lib/browser/chat/draft-model.d.ts +1 -1
  152. package/lib/browser/chat/draft-model.js +2 -2
  153. package/lib/browser/components/access-view.js +12 -10
  154. package/lib/browser/components/account-menu.d.ts +2 -0
  155. package/lib/browser/components/account-menu.js +11 -2
  156. package/lib/browser/components/account-view.js +9 -5
  157. package/lib/browser/components/app-nav.js +3 -0
  158. package/lib/browser/components/app-shell-state.d.ts +2 -0
  159. package/lib/browser/components/app-update-view.d.ts +3 -0
  160. package/lib/browser/components/app-update-view.js +73 -0
  161. package/lib/browser/components/app-view.js +30 -105
  162. package/lib/browser/components/auth-guide.d.ts +26 -0
  163. package/lib/browser/components/auth-guide.js +47 -0
  164. package/lib/browser/components/auth-view.d.ts +2 -0
  165. package/lib/browser/components/auth-view.js +29 -8
  166. package/lib/browser/components/chat-list-controls.d.ts +39 -0
  167. package/lib/browser/components/chat-list-controls.js +86 -0
  168. package/lib/browser/components/chat-list-hooks.d.ts +19 -0
  169. package/lib/browser/components/chat-list-hooks.js +53 -0
  170. package/lib/browser/components/chat-list-rows.d.ts +52 -0
  171. package/lib/browser/components/chat-list-rows.js +147 -0
  172. package/lib/browser/components/chat-list-sections.d.ts +37 -0
  173. package/lib/browser/components/chat-list-sections.js +108 -0
  174. package/lib/browser/components/chat-list.js +44 -217
  175. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  176. package/lib/browser/components/cloud-sign-in-view.js +4 -1
  177. package/lib/browser/components/custom-provider-util.d.ts +2 -0
  178. package/lib/browser/components/custom-provider-util.js +5 -0
  179. package/lib/browser/components/custom-provider-view.js +32 -11
  180. package/lib/browser/components/device-sign-in-page.js +4 -5
  181. package/lib/browser/components/discover-view.d.ts +8 -1
  182. package/lib/browser/components/discover-view.js +27 -2
  183. package/lib/browser/components/environment-view.js +60 -62
  184. package/lib/browser/components/extension-settings.js +1 -0
  185. package/lib/browser/components/first-steps-util.d.ts +30 -0
  186. package/lib/browser/components/first-steps-util.js +44 -0
  187. package/lib/browser/components/first-steps.d.ts +4 -0
  188. package/lib/browser/components/first-steps.js +72 -0
  189. package/lib/browser/components/host-view.d.ts +3 -3
  190. package/lib/browser/components/host-view.js +11 -11
  191. package/lib/browser/components/me-rows.d.ts +8 -1
  192. package/lib/browser/components/me-rows.js +3 -3
  193. package/lib/browser/components/me-view.js +1 -1
  194. package/lib/browser/components/message-user.js +5 -2
  195. package/lib/browser/components/model-picker.d.ts +5 -0
  196. package/lib/browser/components/model-picker.js +10 -1
  197. package/lib/browser/components/nav-places.d.ts +14 -0
  198. package/lib/browser/components/nav-places.js +13 -1
  199. package/lib/browser/components/phone-shell.d.ts +14 -0
  200. package/lib/browser/components/phone-shell.js +23 -0
  201. package/lib/browser/components/picture-dialog.js +4 -7
  202. package/lib/browser/components/profile-view.js +1 -1
  203. package/lib/browser/components/relay-services.js +4 -7
  204. package/lib/browser/components/relay-view-util.d.ts +6 -0
  205. package/lib/browser/components/relay-view-util.js +17 -0
  206. package/lib/browser/components/relay-view.js +38 -35
  207. package/lib/browser/components/scan-screen.js +5 -8
  208. package/lib/browser/components/screen-navigator.d.ts +9 -0
  209. package/lib/browser/components/screen-navigator.js +85 -0
  210. package/lib/browser/components/search-page.js +8 -1
  211. package/lib/browser/components/serve-value.d.ts +28 -0
  212. package/lib/browser/components/serve-value.js +97 -0
  213. package/lib/browser/components/serve-watch.d.ts +24 -0
  214. package/lib/browser/components/serve-watch.js +39 -0
  215. package/lib/browser/components/settings-choices.js +2 -0
  216. package/lib/browser/components/settings-controls.d.ts +15 -0
  217. package/lib/browser/components/settings-controls.js +13 -0
  218. package/lib/browser/components/settings-more.js +6 -4
  219. package/lib/browser/components/settings-parts.d.ts +3 -1
  220. package/lib/browser/components/settings-parts.js +3 -0
  221. package/lib/browser/components/settings-view.js +36 -10
  222. package/lib/browser/components/share-friends.js +3 -4
  223. package/lib/browser/components/share-sheet.js +3 -4
  224. package/lib/browser/components/tool-view.js +17 -3
  225. package/lib/browser/device/app-update.d.ts +63 -0
  226. package/lib/browser/device/app-update.js +182 -0
  227. package/lib/browser/extension/icons.js +1 -0
  228. package/lib/browser/extension/web-api-contributions.d.ts +6 -1
  229. package/lib/browser/extension/web-api-partners.d.ts +6 -0
  230. package/lib/browser/extension/web-api-spec.js +1 -0
  231. package/lib/browser/extension/web-home.js +9 -0
  232. package/lib/browser/extension/web-metrics.d.ts +3 -0
  233. package/lib/browser/extension/web-metrics.js +32 -21
  234. package/lib/browser/extension/web-pages.d.ts +3 -1
  235. package/lib/browser/extension/web-pages.js +1 -0
  236. package/lib/browser/gateway/console-agents.js +10 -14
  237. package/lib/browser/gateway/console-parts.d.ts +7 -4
  238. package/lib/browser/gateway/console-parts.js +12 -21
  239. package/lib/browser/gateway/console-trend.js +1 -1
  240. package/lib/browser/gateway/console-updates.js +5 -3
  241. package/lib/browser/gateway/console-view.js +5 -5
  242. package/lib/browser/i18n/en/account.d.ts +7 -0
  243. package/lib/browser/i18n/en/account.js +13 -6
  244. package/lib/browser/i18n/en/chat.d.ts +2 -0
  245. package/lib/browser/i18n/en/chat.js +2 -0
  246. package/lib/browser/i18n/en/discover.d.ts +3 -0
  247. package/lib/browser/i18n/en/discover.js +3 -0
  248. package/lib/browser/i18n/en/service.d.ts +6 -0
  249. package/lib/browser/i18n/en/service.js +6 -0
  250. package/lib/browser/i18n/en/settings.d.ts +3 -0
  251. package/lib/browser/i18n/en/settings.js +3 -0
  252. package/lib/browser/i18n/ja/account.js +13 -6
  253. package/lib/browser/i18n/ja/chat.js +2 -0
  254. package/lib/browser/i18n/ja/discover.js +3 -0
  255. package/lib/browser/i18n/ja/service.js +6 -0
  256. package/lib/browser/i18n/ja/settings.js +3 -0
  257. package/lib/browser/i18n/locales.d.ts +22 -1
  258. package/lib/browser/i18n/messages.d.ts +21 -0
  259. package/lib/browser/i18n/zh/account.js +13 -6
  260. package/lib/browser/i18n/zh/chat.js +2 -0
  261. package/lib/browser/i18n/zh/discover.js +3 -0
  262. package/lib/browser/i18n/zh/service.js +6 -0
  263. package/lib/browser/i18n/zh/settings.js +3 -0
  264. package/lib/browser/i18n/zh-tw/account.js +13 -6
  265. package/lib/browser/i18n/zh-tw/chat.js +2 -0
  266. package/lib/browser/i18n/zh-tw/discover.js +3 -0
  267. package/lib/browser/i18n/zh-tw/service.js +6 -0
  268. package/lib/browser/i18n/zh-tw/settings.js +3 -0
  269. package/lib/browser/notices/notices.d.ts +2 -0
  270. package/lib/browser/notices/notices.js +3 -1
  271. package/lib/browser/partners/group-picker.js +3 -4
  272. package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
  273. package/lib/browser/settings/settings-protocol.d.ts +5 -0
  274. package/lib/browser/settings/settings-protocol.js +2 -0
  275. package/lib/browser/style/chat-list.d.ts +1 -1
  276. package/lib/browser/style/chat-list.js +4 -3
  277. package/lib/browser/style/dialogs.d.ts +1 -1
  278. package/lib/browser/style/dialogs.js +7 -0
  279. package/lib/browser/style/pages.d.ts +1 -1
  280. package/lib/browser/style/pages.js +5 -3
  281. package/lib/browser/style/shell.d.ts +1 -1
  282. package/lib/browser/style/shell.js +1 -1
  283. package/lib/browser/util/tool.d.ts +5 -0
  284. package/lib/browser/util/tool.js +21 -3
  285. package/package.json +7 -7
@@ -1,12 +1,12 @@
1
- import type { TaAccountInfo } from '@celljs/ta-protocol';
1
+ import { type TaAccountInfo } from '@celljs/ta-protocol';
2
2
  import { type AccountSide } from './device-account.js';
3
3
  /**
4
4
  * The account a page shows (docs/design/ta-account.md): in the app, the phone's own; elsewhere, that of the computer
5
5
  * whose page it is, once connected to it.
6
6
  */
7
7
  export declare function useAccountSide(): AccountSide | undefined;
8
- /** The account as it is now, read again every few seconds while shown; `act` runs a change and shows what it made. */
9
- export declare function useAccountInfo(side: AccountSide | undefined, every?: number): {
8
+ /** The account as it is now, read again as it changes (TaServeChanges.ACCOUNT, DeviceAccount.onChange); `act` runs a change and shows what it made. */
9
+ export declare function useAccountInfo(side: AccountSide | undefined): {
10
10
  info: TaAccountInfo | undefined;
11
11
  failed: unknown;
12
12
  act: (run: (side: AccountSide) => Promise<TaAccountInfo>) => Promise<void>;
@@ -1,6 +1,8 @@
1
+ import { TaServeChanges } from '@celljs/ta-protocol';
1
2
  import { relayDefaultUrl } from '@celljs/ta-relay';
2
3
  import * as React from 'react';
3
4
  import { CloudSignInUtil } from '../cloud/cloud-sign-in.js';
5
+ import { useServeValue } from '../components/serve-value.js';
4
6
  import { useWorkbench } from '../hooks.js';
5
7
  import { WorkbenchUtil } from '../workbench-util.js';
6
8
  import { DeviceAccount } from './device-account.js';
@@ -47,30 +49,18 @@ export function useAccountSide() {
47
49
  return online ? serveSide(bench.account) : undefined;
48
50
  }, [app, online, bench]);
49
51
  }
50
- /** The account as it is now, read again every few seconds while shown; `act` runs a change and shows what it made. */
51
- export function useAccountInfo(side, every = 3000) {
52
- const [info, setInfo] = React.useState();
53
- const [failed, setFailed] = React.useState();
54
- React.useEffect(() => {
55
- if (!side) {
56
- return;
57
- }
58
- let live = true;
59
- const read = () => side.read().then(
60
- // Mostly the same as before: what shows it is not drawn again every few seconds for nothing.
61
- next => live && setInfo(previous => WorkbenchUtil.same(previous, next)), (error) => live && setFailed(error));
62
- void read();
63
- const timer = setInterval(() => document.visibilityState !== 'hidden' && void read(), every);
64
- return () => {
65
- live = false;
66
- clearInterval(timer);
67
- };
68
- }, [side, every]);
52
+ /** The account as it is now, read again as it changes (TaServeChanges.ACCOUNT, DeviceAccount.onChange); `act` runs a change and shows what it made. */
53
+ export function useAccountInfo(side) {
54
+ const read = React.useMemo(() => (side ? () => side.read() : undefined), [side]);
55
+ const changes = React.useMemo(() => { var _a; return (_a = side === null || side === void 0 ? void 0 : side.onChange) === null || _a === void 0 ? void 0 : _a.bind(side); }, [side]);
56
+ // Mostly the same as before: what shows it is not drawn again for nothing.
57
+ const { value: info, failed, set } = useServeValue(read, { key: side, topics: TOPICS, changes, same: WorkbenchUtil.same });
69
58
  const act = React.useCallback(async (run) => {
70
59
  if (side) {
71
- setInfo(await run(side));
60
+ set(await run(side));
72
61
  }
73
- }, [side]);
62
+ }, [side, set]);
74
63
  return { info, failed, act };
75
64
  }
65
+ const TOPICS = [TaServeChanges.ACCOUNT];
76
66
  //# sourceMappingURL=account-side.js.map
@@ -11,6 +11,8 @@ export interface AccountSide {
11
11
  signOut(): Promise<TaAccountInfo>;
12
12
  /** The device's own (DeviceAccount.joinThrough): signs in as the computer in use is, which lets it in. */
13
13
  joinThrough?(): Promise<TaAccountInfo>;
14
+ /** The device's own: hears when what `read` answers changed. That of a computer is told by its ta serve (TaServeChanges.ACCOUNT). */
15
+ onChange?(listener: () => void): () => void;
14
16
  }
15
17
  /** The computers a device's account brings, kept with the device's computers (TaWorkbench). */
16
18
  export interface AccountHosts {
@@ -66,6 +68,9 @@ export declare class DeviceAccount implements AccountSide {
66
68
  protected error?: string;
67
69
  protected timer?: ReturnType<typeof setTimeout>;
68
70
  protected running?: Promise<void>;
71
+ protected readonly listeners: Set<() => void>;
72
+ /** What the listeners were told the account is, last. */
73
+ protected told?: string;
69
74
  protected constructor(hosts: AccountHosts, service: () => Promise<string>, gateways: () => Promise<string[]>);
70
75
  /** The computers to bring into the account, and the devices of it this device lets in once they ask. */
71
76
  protected static joining(): Joining;
@@ -137,6 +142,9 @@ export declare class DeviceAccount implements AccountSide {
137
142
  protected schedule(after: number): void;
138
143
  protected round(): Promise<void>;
139
144
  protected pollSignIn(): Promise<number>;
145
+ onChange(listener: () => void): () => void;
146
+ /** The pages that show the account hear when it changed: a device asking in, the sign-in done, an error. */
147
+ protected tell(): void;
140
148
  read(): Promise<TaAccountInfo>;
141
149
  signIn(provider: string, service?: string): Promise<TaAccountInfo>;
142
150
  cancelSignIn(): Promise<TaAccountInfo>;
@@ -23,6 +23,7 @@ export class DeviceAccount {
23
23
  this.hosts = hosts;
24
24
  this.service = service;
25
25
  this.gateways = gateways;
26
+ this.listeners = new Set();
26
27
  this.bringing = false;
27
28
  /** The computers tried once in this page: one that would not join is not asked again every round. */
28
29
  this.tried = new Set();
@@ -373,6 +374,7 @@ export class DeviceAccount {
373
374
  finally {
374
375
  this.running = undefined;
375
376
  }
377
+ this.tell();
376
378
  if (document.visibilityState !== 'hidden') {
377
379
  this.schedule(next);
378
380
  }
@@ -406,9 +408,27 @@ export class DeviceAccount {
406
408
  DeviceAccount.keepJoining({ ...joining, hosts: [...new Set([...joining.hosts, ...scanned])] });
407
409
  return WAITING_SYNC_MS;
408
410
  }
411
+ onChange(listener) {
412
+ this.listeners.add(listener);
413
+ return () => this.listeners.delete(listener);
414
+ }
415
+ /** The pages that show the account hear when it changed: a device asking in, the sign-in done, an error. */
416
+ tell() {
417
+ var _a;
418
+ var _b, _c, _d;
419
+ const now = JSON.stringify([(_b = this.view) !== null && _b !== void 0 ? _b : null, (_c = this.error) !== null && _c !== void 0 ? _c : null, (_d = (_a = this.signingIn) === null || _a === void 0 ? void 0 : _a.code) !== null && _d !== void 0 ? _d : null, !!this.agent]);
420
+ if (now !== this.told) {
421
+ this.told = now;
422
+ for (const listener of this.listeners) {
423
+ listener();
424
+ }
425
+ }
426
+ }
409
427
  async read() {
410
428
  var _a, _b;
411
429
  var _c, _d;
430
+ // What a change asked of the account made (a sign-in, a device let in, a switch): the other pages hear of it.
431
+ this.tell();
412
432
  const service = (_d = (_c = (_a = this.agent) === null || _a === void 0 ? void 0 : _a.state.service) !== null && _c !== void 0 ? _c : (_b = this.signingIn) === null || _b === void 0 ? void 0 : _b.way.service) !== null && _d !== void 0 ? _d : (await this.service());
413
433
  const error = this.error ? { error: this.error } : {};
414
434
  if (!this.agent) {
@@ -20,6 +20,8 @@ export interface ChatDraft {
20
20
  /** Of this first message and its opening (openId, clientMessageId): sent again, it opens and runs once. */
21
21
  id: string;
22
22
  failed?: string;
23
+ /** The code of the error it failed with (OutboxMessage.code). */
24
+ code?: string;
23
25
  heldAt?: number;
24
26
  };
25
27
  }
@@ -78,6 +80,11 @@ export interface TaChat {
78
80
  resendDraft(): Promise<void>;
79
81
  /** Takes back the first message that failed. */
80
82
  discardDraft(): void;
83
+ /**
84
+ * Sends again what failed for want of a model (TaErrorCode.NOT_SIGNED_IN), the first message of a new
85
+ * conversation or those of the one shown: the user has just connected one (SIGNED_IN_EVENT).
86
+ */
87
+ resendSignedOut(): Promise<void>;
81
88
  /** Stops the run of the conversation still opening, once it is there. */
82
89
  stopDraft(): void;
83
90
  /**
@@ -79,7 +79,7 @@ function DraftView({ draft, menu, aboveComposer, belowComposer }) {
79
79
  content: [{ type: 'text', text: sending.message }, ...((_a = sending.images) !== null && _a !== void 0 ? _a : [])],
80
80
  timestamp: Date.now(),
81
81
  };
82
- return SessionStore.withSent(SessionReducer.initial(), [{ id: 'draft', message, failed: sending.failed }]);
82
+ return SessionStore.withSent(SessionReducer.initial(), [{ id: 'draft', message, failed: sending.failed, code: sending.code }]);
83
83
  }, [sending]);
84
84
  const outbox = React.useMemo(() => ({ resend: () => void chat.resendDraft(), discard: () => chat.discardDraft() }), [chat]);
85
85
  return (React.createElement("section", { className: "ta-session" },
@@ -20,6 +20,7 @@ export declare class TaChatImpl extends ChatShown implements TaChat {
20
20
  protected holdDraft(sending: NonNullable<ChatDraft['sending']>): boolean;
21
21
  resendDraft(): Promise<void>;
22
22
  discardDraft(): void;
23
+ resendSignedOut(): Promise<void>;
23
24
  stopDraft(): void;
24
25
  show(session: string | Promise<string>, opening?: ChatOpening): Promise<void>;
25
26
  /** A session the caller still opens: its place shows now, under a key no session has. */
@@ -6,7 +6,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { Component } from '@celljs/core';
8
8
  import { HOLD_MS, TaRemoteError } from '@celljs/ta-client';
9
- import { TaErrorCode } from '@celljs/ta-protocol';
9
+ import { TaErrorCode, TaErrorUtil } from '@celljs/ta-protocol';
10
+ import { SIGNED_IN_EVENT } from '../notices/notices.js';
10
11
  import { StateUtil } from '../state/state-protocol.js';
11
12
  import { FrameUtil } from '../util/frame.js';
12
13
  import { REMOVED_CHATS, TaChat } from './chat-protocol.js';
@@ -33,6 +34,9 @@ let TaChatImpl = class TaChatImpl extends ChatShown {
33
34
  }
34
35
  }
35
36
  });
37
+ if (typeof window !== 'undefined') {
38
+ window.addEventListener(SIGNED_IN_EVENT, () => void this.resendSignedOut());
39
+ }
36
40
  }
37
41
  if (this.current.store || this.current.draft) {
38
42
  return;
@@ -148,7 +152,8 @@ let TaChatImpl = class TaChatImpl extends ChatShown {
148
152
  // No conversation: the message stays, marked, to send again; for a lost connection, once it is back.
149
153
  const failed = this.current.draft;
150
154
  if ((failed === null || failed === void 0 ? void 0 : failed.sending) && !(ChatUtil.lost(error) && this.holdDraft(failed.sending))) {
151
- this.update({ draft: { ...failed, sending: { ...failed.sending, failed: ChatUtil.message(error) } } });
155
+ const code = TaErrorUtil.code(error);
156
+ this.update({ draft: { ...failed, sending: { ...failed.sending, failed: ChatUtil.message(error), ...(code ? { code } : {}) } } });
152
157
  }
153
158
  return;
154
159
  }
@@ -188,7 +193,7 @@ let TaChatImpl = class TaChatImpl extends ChatShown {
188
193
  }
189
194
  // With its id: one that opened before the failure was told is not opened again.
190
195
  this.stopping = false;
191
- this.update({ draft: { ...draft, sending: { ...draft.sending, failed: undefined, heldAt: undefined } } });
196
+ this.update({ draft: { ...draft, sending: { ...draft.sending, failed: undefined, code: undefined, heldAt: undefined } } });
192
197
  return this.openDraft();
193
198
  }
194
199
  discardDraft() {
@@ -198,6 +203,13 @@ let TaChatImpl = class TaChatImpl extends ChatShown {
198
203
  this.update({ draft: { ...draft, sending: undefined } });
199
204
  }
200
205
  }
206
+ async resendSignedOut() {
207
+ var _a, _b, _c;
208
+ if (((_b = (_a = this.current.draft) === null || _a === void 0 ? void 0 : _a.sending) === null || _b === void 0 ? void 0 : _b.code) === TaErrorCode.NOT_SIGNED_IN) {
209
+ await this.resendDraft();
210
+ }
211
+ await ((_c = this.current.store) === null || _c === void 0 ? void 0 : _c.resendFailed(TaErrorCode.NOT_SIGNED_IN));
212
+ }
201
213
  stopDraft() {
202
214
  var _a;
203
215
  if ((_a = this.current.draft) === null || _a === void 0 ? void 0 : _a.sending) {
@@ -3,7 +3,7 @@ import type { ComposerAction } from '../components/composer-box-protocol.js';
3
3
  import type { Translate } from '../i18n/use-t.js';
4
4
  import type { ChatDraft } from './chat-protocol.js';
5
5
  export declare namespace DraftModelUtil {
6
- /** The model entry of the + of a new conversation: the models with credentials, the picked one checked, else that of the settings. */
6
+ /** The model entry of the + of a new conversation: the models with credentials, the picked one checked, else the one it would work with. */
7
7
  function action(snapshot: TaSettingsSnapshot, picked: string | undefined, pick: (model: string) => void, t: Translate): ComposerAction;
8
8
  }
9
9
  /**
@@ -2,9 +2,9 @@ import * as React from 'react';
2
2
  import { ModelPickerUtil } from '../components/model-picker.js';
3
3
  export var DraftModelUtil;
4
4
  (function (DraftModelUtil) {
5
- /** The model entry of the + of a new conversation: the models with credentials, the picked one checked, else that of the settings. */
5
+ /** The model entry of the + of a new conversation: the models with credentials, the picked one checked, else the one it would work with. */
6
6
  function action(snapshot, picked, pick, t) {
7
- return ModelPickerUtil.action(snapshot, picked !== null && picked !== void 0 ? picked : ModelPickerUtil.settingsModel(snapshot), pick, t);
7
+ return ModelPickerUtil.action(snapshot, picked !== null && picked !== void 0 ? picked : ModelPickerUtil.initialModel(snapshot), pick, t);
8
8
  }
9
9
  DraftModelUtil.action = action;
10
10
  })(DraftModelUtil || (DraftModelUtil = {}));
@@ -4,6 +4,7 @@ import { useNotices, useWorkbench } from '../hooks.js';
4
4
  import { useLanguage, useT } from '../i18n/use-t.js';
5
5
  import { WorkbenchUtil } from '../workbench-util.js';
6
6
  import { AccessViewUtil } from './access-util.js';
7
+ import { useBusy } from './busy.js';
7
8
  import { ChatListUtil } from './chat-list-util.js';
8
9
  import { Icon, IconButton } from './icon.js';
9
10
  import { EmptyRow, Row, Switch } from './settings-controls.js';
@@ -45,9 +46,10 @@ export function AccessSettings({ info, onChange }) {
45
46
  const [workbench, bench] = useWorkbench();
46
47
  const [, notices] = useNotices();
47
48
  const [text, setText] = React.useState('');
48
- const [busy, setBusy] = React.useState(false);
49
- const run = async (action) => {
50
- setBusy(true);
49
+ const [busy, start] = useBusy();
50
+ const [removing, setRemoving] = React.useState();
51
+ /** One change at a time, the button clicked turning until it is done; then what is allowed is read again. */
52
+ const run = (action) => start(async () => {
51
53
  try {
52
54
  await action();
53
55
  }
@@ -55,18 +57,17 @@ export function AccessSettings({ info, onChange }) {
55
57
  notices.error(error);
56
58
  }
57
59
  finally {
58
- setBusy(false);
59
60
  await onChange().catch(() => undefined);
60
61
  }
61
- };
62
+ });
62
63
  // The sign-in goes through the page's own ta serve: not from the app, nor for another computer, nor at an address of
63
64
  // this machine alone (the desktop app's), which the provider sends no one back to and where the token lets in anyway.
64
65
  const here = !WorkbenchUtil.isApp() && !WorkbenchUtil.loopback() && workbench.host === WorkbenchUtil.serverOf({ token: '' }, location.host);
65
66
  // Behind a gateway, only its administrators let accounts in; everyone sees the browsers of their own.
66
67
  const manage = info.canManage !== false;
67
- const bind = (provider) => run(async () => {
68
+ const bind = async (provider) => {
68
69
  location.assign(await bench.access.bindUrl(provider));
69
- });
70
+ };
70
71
  const remove = async (account) => {
71
72
  const confirmed = await notices.confirm({
72
73
  title: t('ta.access.removeConfirm', { account }),
@@ -75,7 +76,8 @@ export function AccessSettings({ info, onChange }) {
75
76
  danger: true,
76
77
  });
77
78
  if (confirmed) {
78
- await run(() => bench.access.disallow(account));
79
+ setRemoving(account);
80
+ await bench.access.disallow(account).finally(() => setRemoving(undefined));
79
81
  }
80
82
  };
81
83
  const date = (time) => new Date(time).toLocaleString(language, { dateStyle: 'medium', timeStyle: 'short' });
@@ -105,7 +107,7 @@ export function AccessSettings({ info, onChange }) {
105
107
  React.createElement(Switch, { checked: Boolean(rule), disabled: busy || (rule === null || rule === void 0 ? void 0 : rule.source) === 'env', label: t('ta.access.open', { name: provider.name }), onChange: on => open(provider, on) })));
106
108
  }),
107
109
  manage && here && info.providers.length > 0 && (React.createElement(Row, { label: t('ta.access.bind'), description: t('ta.access.bindHint'), stacked: true },
108
- React.createElement("div", { className: "ta-access-bind" }, info.providers.map(provider => (React.createElement("button", { key: provider.id, type: "button", className: "ta-button", disabled: busy, onClick: () => void bind(provider.id) },
110
+ React.createElement("div", { className: "ta-access-bind" }, info.providers.map(provider => (React.createElement("button", { key: provider.id, type: "button", className: "ta-button", disabled: busy, onClick: () => void run(() => bind(provider.id)) },
109
111
  React.createElement(SignInMark, { provider: provider.id, size: 15 }),
110
112
  " ",
111
113
  SignInAccountsUtil.label(provider, t))))))),
@@ -129,7 +131,7 @@ export function AccessSettings({ info, onChange }) {
129
131
  " ",
130
132
  t('ta.access.add'))))),
131
133
  manage && info.accounts.length === 0 && React.createElement(EmptyRow, { title: t('ta.access.none'), hint: t('ta.access.noneHint') }),
132
- info.accounts.map(account => { var _a; return (React.createElement(Row, { key: `account:${account.id}`, label: React.createElement(AccountLabel, { ...account }), description: account.source === 'env' ? t('ta.access.fromEnv') : t('ta.access.added', { time: date((_a = account.addedAt) !== null && _a !== void 0 ? _a : 0) }) }, account.source === 'added' && (React.createElement(IconButton, { icon: Trash2, label: t('ta.access.removeAccount', { account: account.id }), disabled: busy, onClick: () => void remove(account.id) })))); }),
134
+ info.accounts.map(account => { var _a; return (React.createElement(Row, { key: `account:${account.id}`, label: React.createElement(AccountLabel, { ...account }), description: account.source === 'env' ? t('ta.access.fromEnv') : t('ta.access.added', { time: date((_a = account.addedAt) !== null && _a !== void 0 ? _a : 0) }) }, account.source === 'added' && (React.createElement(IconButton, { icon: Trash2, label: t('ta.access.removeAccount', { account: account.id }), disabled: busy, busy: removing === account.id, onClick: () => void run(() => remove(account.id)) })))); }),
133
135
  info.signIns.map(signIn => { var _a, _b; return (React.createElement(Row, { key: `signIn:${signIn.id}`, icon: /iOS|Android/.test((_a = AccessViewUtil.device(signIn.device)) !== null && _a !== void 0 ? _a : '') ? Smartphone : Monitor, label: (_b = AccessViewUtil.device(signIn.device)) !== null && _b !== void 0 ? _b : t('ta.access.browser'), description: [
134
136
  signIn.account,
135
137
  signIn.current ? t('ta.access.thisBrowser') : undefined,
@@ -43,6 +43,8 @@ export declare function useAccount(): {
43
43
  name: string;
44
44
  account: string | undefined;
45
45
  service: string;
46
+ /** What the line of the connection calls the computer Ta runs on: this one, or another. */
47
+ computer: string;
46
48
  };
47
49
  export interface AccountMenuProps {
48
50
  /** Shows the settings view, at a section. */
@@ -2,6 +2,7 @@ import { ArrowLeftRight, Download, Info, KeyRound, LogIn, LogOut, MonitorSmartph
2
2
  import * as React from 'react';
3
3
  import { useAccountInfo, useAccountSide } from '../account/account-side.js';
4
4
  import { DeviceAccount } from '../account/device-account.js';
5
+ import { AppUpdate, useAppUpdate } from '../device/app-update.js';
5
6
  import { useDevice } from '../device/device.js';
6
7
  import { WebLabelUtil } from '../extension/web-extension-protocol.js';
7
8
  import { useNotices, usePersisted, usePwa, useWebExtensions, useWorkbench } from '../hooks.js';
@@ -30,11 +31,12 @@ export function useAccountEntries(onSettings, onDialog) {
30
31
  // A finger has no keys to learn; a phone is not the computer that pairs phones.
31
32
  const { touch, handheld } = useDevice();
32
33
  const restartTa = useRestartTa();
34
+ const appUpdate = useAppUpdate();
33
35
  // The vault, while its package is on: the one place for the sign-ins, keys and personal details of the account.
34
36
  const vault = useSecretPeek().manage;
35
37
  const [, notices] = useNotices();
36
38
  const side = useAccountSide();
37
- const { info } = useAccountInfo(side, 15000);
39
+ const { info } = useAccountInfo(side);
38
40
  const signedIn = Boolean(info === null || info === void 0 ? void 0 : info.account);
39
41
  const app = WorkbenchUtil.ownDevice();
40
42
  const [{ views }, extensions] = useWebExtensions();
@@ -80,6 +82,9 @@ export function useAccountEntries(onSettings, onDialog) {
80
82
  if (update) {
81
83
  entry('restart', t('ta.update.restartTo', { version: ServeRestartUtil.label(update) }), RotateCw, () => void restartTa.restart(), { action: true });
82
84
  }
85
+ if (appUpdate) {
86
+ entry('appUpdate', t('ta.appUpdate.installTo', { version: appUpdate.version }), Download, () => AppUpdate.install(), { action: true });
87
+ }
83
88
  entry('install', t('ta.pwa.install'), Download, () => void pwa.install(), { action: true });
84
89
  // As WeChat's: the account in use kept, with its computers, to come back to in one tap (docs/design/ta-me.md 4).
85
90
  entry('signIn', t('ta.me.signIn'), LogIn, () => onDialog('signIn'));
@@ -89,11 +94,13 @@ export function useAccountEntries(onSettings, onDialog) {
89
94
  vault: Boolean(vault),
90
95
  own: own.map(view => view.id),
91
96
  update: Boolean(update),
97
+ appUpdate: Boolean(appUpdate),
92
98
  installable: installable && !standalone,
93
99
  switchAccount: app && signedIn,
94
100
  // The account is who the user is, not one of their devices (docs/design/ta-me.md 4).
95
101
  signIn: Boolean(info) && !signedIn,
96
102
  pairPhone: !app && !handheld,
103
+ signOut: signedIn || WorkbenchUtil.elsewhere(host),
97
104
  }).map(group => group.map(key => entries[key]));
98
105
  }
99
106
  /** What the entries of the account open over the page. */
@@ -154,6 +161,8 @@ export function useAccount() {
154
161
  name: (_c = name !== null && name !== void 0 ? name : server === null || server === void 0 ? void 0 : server.user) !== null && _c !== void 0 ? _c : t('ta.account'),
155
162
  account: account !== null && account !== void 0 ? account : undefined,
156
163
  service: server && online ? `${state} · v${server.version}` : state,
164
+ /** What the line of the connection calls the computer Ta runs on: this one, or another. */
165
+ computer: t(WorkbenchUtil.elsewhere(host) ? 'ta.account.service' : 'ta.account.thisComputer'),
157
166
  };
158
167
  }
159
168
  /** Moves the focus through the items of a menu with the arrow keys. */
@@ -207,7 +216,7 @@ export function AccountMenu({ onSettings, active }) {
207
216
  ((_a = account.account) !== null && _a !== void 0 ? _a : account.machine) && React.createElement("span", { className: "ta-account-sub ta-ellipsis" }, (_b = account.account) !== null && _b !== void 0 ? _b : account.machine))),
208
217
  React.createElement("div", { className: "ta-account-service", title: account.server ? `Ta v${account.server.version}` : undefined },
209
218
  React.createElement("span", { className: `ta-account-state ${account.online ? 'ta-ok' : 'ta-warn'}` }),
210
- React.createElement("span", { className: "ta-account-service-name" }, t('ta.account.service')),
219
+ React.createElement("span", { className: "ta-account-service-name" }, account.computer),
211
220
  React.createElement("span", { className: "ta-account-service-state" }, account.service)),
212
221
  groups
213
222
  .filter(group => group.length > 0)
@@ -132,6 +132,7 @@ export function AccountWays({ info, act }) {
132
132
  const t = useT();
133
133
  const way = useAccountWay();
134
134
  const [, notices] = useNotices();
135
+ const [busy, run] = useBusy();
135
136
  if (info.signingIn || !info.account) {
136
137
  return (React.createElement(React.Fragment, null,
137
138
  info.error && React.createElement(Callout, { level: "error" }, info.error),
@@ -143,7 +144,7 @@ export function AccountWays({ info, act }) {
143
144
  // Signed in, no computer of the account yet: they come by themselves once signed in there.
144
145
  const signOut = async () => {
145
146
  if (await notices.confirm({ title: t('ta.myDevices.signOutConfirm'), confirmLabel: t('ta.settings.signOut'), danger: true })) {
146
- void act(side => side.signOut()).catch((error) => notices.error(error));
147
+ await act(side => side.signOut()).catch((error) => notices.error(error));
147
148
  }
148
149
  };
149
150
  return (React.createElement("div", { className: "ta-account-signed" },
@@ -154,7 +155,9 @@ export function AccountWays({ info, act }) {
154
155
  " \u00B7 ",
155
156
  accountName(info.account))),
156
157
  React.createElement("p", { className: "ta-account-hint" }, t('ta.myDevices.computersComing')),
157
- React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => void signOut() }, t('ta.settings.signOut'))));
158
+ React.createElement("button", { type: "button", className: `ta-link-button${busy ? ' ta-busy' : ''}`, onClick: () => void run(signOut) },
159
+ React.createElement(BusyMark, { busy: busy }),
160
+ t('ta.settings.signOut'))));
158
161
  }
159
162
  /** The accounts this device switched away from, on its sign-in: a tap goes back to one, its computers with it. */
160
163
  export function RecentAccounts() {
@@ -243,8 +246,9 @@ export function DevicesDialog({ onClose }) {
243
246
  adding === 'cloud' ? (React.createElement(CloudSignInFlow, { onBack: () => setAdding(undefined) })) : adding === 'paste' ? (React.createElement(LinkForm, { busy: add.busy, autoFocus: true, placeholder: t('ta.signin.pairing'), onSubmit: text => void add.add(text) })) : (React.createElement(React.Fragment, null,
244
247
  !info && side && React.createElement(Loading, { compact: true }),
245
248
  React.createElement("div", { className: "ta-host-actions" },
246
- add.canScan && (React.createElement("button", { type: "button", className: "ta-button ta-primary", disabled: add.busy, onClick: () => void add.scan() },
247
- add.busy ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(Icon, { icon: ScanLine, size: 16 }),
249
+ add.canScan && (React.createElement("button", { type: "button", className: `ta-button ta-primary${add.busy ? ' ta-busy' : ''}`, disabled: add.busy, onClick: add.scan },
250
+ React.createElement(BusyMark, { busy: add.busy }),
251
+ React.createElement(Icon, { icon: ScanLine, size: 16 }),
248
252
  " ",
249
253
  t('ta.hosts.scanShort'))),
250
254
  React.createElement("button", { type: "button", className: "ta-button", disabled: add.busy, onClick: () => setAdding('paste') },
@@ -338,7 +342,7 @@ export function AccountAsk() {
338
342
  const t = useT();
339
343
  const side = useAccountSide();
340
344
  const [, notices] = useNotices();
341
- const { info, act } = useAccountInfo(side, 5000);
345
+ const { info, act } = useAccountInfo(side);
342
346
  const [later, setLater] = React.useState([]);
343
347
  const asking = (info === null || info === void 0 ? void 0 : info.account) && !info.waiting ? info.devices.find(one => one.waiting && !later.includes(one.id)) : undefined;
344
348
  if (!asking) {
@@ -13,7 +13,7 @@ import { ConnectionBanner } from './connection-bar.js';
13
13
  import { useContextMenu } from './context-menu.js';
14
14
  import { Dino } from './dino.js';
15
15
  import { IconButton } from './icon.js';
16
- import { DISCOVER, entryHold, hasDiscover, places } from './nav-places.js';
16
+ import { DISCOVER, discoverFirst, entryHold, hasDiscover, places } from './nav-places.js';
17
17
  import { PageStackContext } from './phone-shell.js';
18
18
  import { DinoFace } from './ta-avatar.js';
19
19
  import { UnseenDrop } from './unseen-drop.js';
@@ -31,10 +31,13 @@ export function useNavigation(views) {
31
31
  const onOpen = React.useMemo(() => pages.filter(page => page.onOpen && page.place === 'discover'), [pages]);
32
32
  // The pages a page lists (a game, on the Games page) are there, not in the navigation or under Discover.
33
33
  const listed = React.useMemo(() => new Set(pages.filter(page => page.place === 'list').map(page => page.id)), [pages]);
34
+ const infos = React.useMemo(() => new Map(pages.map(page => [page.id, page])), [pages]);
34
35
  return {
35
36
  ...places(views.filter(view => !listed.has(view.id)), setting, handheld, onOpen.length > 0),
36
37
  onOpen,
37
38
  setting,
39
+ ...(settings.allFeatures ? {} : { first: (id) => discoverFirst(infos.get(id), Date.now()) }),
40
+ showAll: on => store.update({ allFeatures: on }),
38
41
  pin: id => update(NavigationUtil.pin(setting, id)),
39
42
  fold: id => update(NavigationUtil.fold(setting, id)),
40
43
  update,
@@ -79,3 +79,5 @@ export declare function useAppShell(): {
79
79
  deciding: number;
80
80
  setChatsBusy: React.Dispatch<React.SetStateAction<boolean>>;
81
81
  };
82
+ /** The state of the shell, as AppShell and what it hands it read. */
83
+ export type AppShellState = ReturnType<typeof useAppShell>;
@@ -0,0 +1,2 @@
1
+ /** Tells once of each newer version of the phone app that does not update itself (AppUpdates), with Update and Later. */
2
+ export declare function AppUpdateNotices(): null;
@@ -0,0 +1,37 @@
1
+ import * as React from 'react';
2
+ import { AppUpdate, useAppUpdate } from '../device/app-update.js';
3
+ import { useNotices } from '../hooks.js';
4
+ import { useT } from '../i18n/use-t.js';
5
+ import { storage } from '../workbench-util.js';
6
+ /** The version of the phone app the user put off installing (Later): not told of again on this device. */
7
+ const LATER_KEY = 'ta.appUpdate.later';
8
+ /** Tells once of each newer version of the phone app that does not update itself (AppUpdates), with Update and Later. */
9
+ export function AppUpdateNotices() {
10
+ const t = useT();
11
+ const [, notices] = useNotices();
12
+ const offer = useAppUpdate();
13
+ const told = React.useRef(undefined);
14
+ React.useEffect(() => {
15
+ var _a;
16
+ if (told.current && told.current.version !== (offer === null || offer === void 0 ? void 0 : offer.version)) {
17
+ notices.dismiss(told.current.id);
18
+ told.current = undefined;
19
+ }
20
+ if (!offer || told.current || ((_a = storage()) === null || _a === void 0 ? void 0 : _a.getItem(LATER_KEY)) === offer.version) {
21
+ return;
22
+ }
23
+ const { version } = offer;
24
+ told.current = {
25
+ version,
26
+ id: notices.notify(t('ta.appUpdate.available', { version }), {
27
+ detail: t('ta.appUpdate.detail'),
28
+ key: 'ta-app-update',
29
+ sticky: true,
30
+ actions: [{ label: t('ta.update.later'), run: () => { var _a; return (_a = storage()) === null || _a === void 0 ? void 0 : _a.setItem(LATER_KEY, version); } }],
31
+ action: { label: t('ta.appUpdate.update'), run: () => AppUpdate.install() },
32
+ }),
33
+ };
34
+ }, [offer, notices, t]);
35
+ return null;
36
+ }
37
+ //# sourceMappingURL=app-update-view.js.map