@celljs/ta-web 4.46.3 → 4.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/esm/browser/chat/chat-protocol.d.ts +7 -0
  2. package/esm/browser/chat/chat-view.js +1 -1
  3. package/esm/browser/chat/chat.d.ts +1 -0
  4. package/esm/browser/chat/chat.js +15 -3
  5. package/esm/browser/chat/draft-model.d.ts +1 -1
  6. package/esm/browser/chat/draft-model.js +2 -2
  7. package/esm/browser/components/account-menu.d.ts +2 -0
  8. package/esm/browser/components/account-menu.js +10 -1
  9. package/esm/browser/components/app-nav.js +4 -1
  10. package/esm/browser/components/app-update-view.d.ts +2 -0
  11. package/esm/browser/components/app-update-view.js +37 -0
  12. package/esm/browser/components/app-view.js +22 -2
  13. package/esm/browser/components/auth-guide.d.ts +25 -0
  14. package/esm/browser/components/auth-guide.js +44 -0
  15. package/esm/browser/components/auth-view.d.ts +2 -0
  16. package/esm/browser/components/auth-view.js +30 -9
  17. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  18. package/esm/browser/components/custom-provider-util.d.ts +2 -0
  19. package/esm/browser/components/custom-provider-util.js +5 -0
  20. package/esm/browser/components/custom-provider-view.js +31 -10
  21. package/esm/browser/components/discover-view.d.ts +8 -1
  22. package/esm/browser/components/discover-view.js +28 -3
  23. package/esm/browser/components/extension-settings.js +1 -0
  24. package/esm/browser/components/first-steps-util.d.ts +29 -0
  25. package/esm/browser/components/first-steps-util.js +41 -0
  26. package/esm/browser/components/first-steps.d.ts +3 -0
  27. package/esm/browser/components/first-steps.js +36 -0
  28. package/esm/browser/components/host-view.d.ts +1 -1
  29. package/esm/browser/components/me-rows.d.ts +8 -1
  30. package/esm/browser/components/me-rows.js +3 -3
  31. package/esm/browser/components/me-view.js +1 -1
  32. package/esm/browser/components/message-user.js +6 -3
  33. package/esm/browser/components/model-picker.d.ts +5 -0
  34. package/esm/browser/components/model-picker.js +10 -1
  35. package/esm/browser/components/nav-places.d.ts +14 -0
  36. package/esm/browser/components/nav-places.js +11 -0
  37. package/esm/browser/components/relay-view-util.d.ts +5 -0
  38. package/esm/browser/components/relay-view-util.js +14 -0
  39. package/esm/browser/components/relay-view.js +11 -7
  40. package/esm/browser/components/settings-choices.js +2 -0
  41. package/esm/browser/components/settings-controls.d.ts +15 -0
  42. package/esm/browser/components/settings-controls.js +13 -0
  43. package/esm/browser/components/settings-more.js +1 -0
  44. package/esm/browser/components/settings-parts.d.ts +3 -1
  45. package/esm/browser/components/settings-parts.js +3 -0
  46. package/esm/browser/components/settings-view.js +37 -11
  47. package/esm/browser/device/app-update.d.ts +62 -0
  48. package/esm/browser/device/app-update.js +144 -0
  49. package/esm/browser/extension/icons.js +2 -1
  50. package/esm/browser/extension/web-api-contributions.d.ts +6 -1
  51. package/esm/browser/extension/web-api-partners.d.ts +6 -0
  52. package/esm/browser/extension/web-api-spec.js +1 -0
  53. package/esm/browser/extension/web-home.js +9 -0
  54. package/esm/browser/extension/web-metrics.d.ts +3 -0
  55. package/esm/browser/extension/web-metrics.js +33 -22
  56. package/esm/browser/extension/web-pages.d.ts +3 -1
  57. package/esm/browser/extension/web-pages.js +1 -0
  58. package/esm/browser/i18n/en/account.d.ts +7 -0
  59. package/esm/browser/i18n/en/account.js +13 -6
  60. package/esm/browser/i18n/en/chat.d.ts +2 -0
  61. package/esm/browser/i18n/en/chat.js +2 -0
  62. package/esm/browser/i18n/en/discover.d.ts +3 -0
  63. package/esm/browser/i18n/en/discover.js +3 -0
  64. package/esm/browser/i18n/en/service.d.ts +6 -0
  65. package/esm/browser/i18n/en/service.js +6 -0
  66. package/esm/browser/i18n/en/settings.d.ts +3 -0
  67. package/esm/browser/i18n/en/settings.js +3 -0
  68. package/esm/browser/i18n/ja/account.js +13 -6
  69. package/esm/browser/i18n/ja/chat.js +2 -0
  70. package/esm/browser/i18n/ja/discover.js +3 -0
  71. package/esm/browser/i18n/ja/service.js +6 -0
  72. package/esm/browser/i18n/ja/settings.js +3 -0
  73. package/esm/browser/i18n/locales.d.ts +22 -1
  74. package/esm/browser/i18n/messages.d.ts +21 -0
  75. package/esm/browser/i18n/zh/account.js +13 -6
  76. package/esm/browser/i18n/zh/chat.js +2 -0
  77. package/esm/browser/i18n/zh/discover.js +3 -0
  78. package/esm/browser/i18n/zh/service.js +6 -0
  79. package/esm/browser/i18n/zh/settings.js +3 -0
  80. package/esm/browser/i18n/zh-tw/account.js +13 -6
  81. package/esm/browser/i18n/zh-tw/chat.js +2 -0
  82. package/esm/browser/i18n/zh-tw/discover.js +3 -0
  83. package/esm/browser/i18n/zh-tw/service.js +6 -0
  84. package/esm/browser/i18n/zh-tw/settings.js +3 -0
  85. package/esm/browser/notices/notices.d.ts +2 -0
  86. package/esm/browser/notices/notices.js +2 -0
  87. package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
  88. package/esm/browser/settings/settings-protocol.d.ts +5 -0
  89. package/esm/browser/settings/settings-protocol.js +2 -0
  90. package/esm/browser/style/dialogs.d.ts +1 -1
  91. package/esm/browser/style/dialogs.js +7 -0
  92. package/lib/browser/chat/chat-protocol.d.ts +7 -0
  93. package/lib/browser/chat/chat-view.js +1 -1
  94. package/lib/browser/chat/chat.d.ts +1 -0
  95. package/lib/browser/chat/chat.js +14 -2
  96. package/lib/browser/chat/draft-model.d.ts +1 -1
  97. package/lib/browser/chat/draft-model.js +2 -2
  98. package/lib/browser/components/account-menu.d.ts +2 -0
  99. package/lib/browser/components/account-menu.js +10 -1
  100. package/lib/browser/components/app-nav.js +3 -0
  101. package/lib/browser/components/app-update-view.d.ts +3 -0
  102. package/lib/browser/components/app-update-view.js +73 -0
  103. package/lib/browser/components/app-view.js +21 -1
  104. package/lib/browser/components/auth-guide.d.ts +26 -0
  105. package/lib/browser/components/auth-guide.js +47 -0
  106. package/lib/browser/components/auth-view.d.ts +2 -0
  107. package/lib/browser/components/auth-view.js +29 -8
  108. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  109. package/lib/browser/components/custom-provider-util.d.ts +2 -0
  110. package/lib/browser/components/custom-provider-util.js +5 -0
  111. package/lib/browser/components/custom-provider-view.js +30 -9
  112. package/lib/browser/components/discover-view.d.ts +8 -1
  113. package/lib/browser/components/discover-view.js +27 -2
  114. package/lib/browser/components/extension-settings.js +1 -0
  115. package/lib/browser/components/first-steps-util.d.ts +30 -0
  116. package/lib/browser/components/first-steps-util.js +44 -0
  117. package/lib/browser/components/first-steps.d.ts +4 -0
  118. package/lib/browser/components/first-steps.js +72 -0
  119. package/lib/browser/components/host-view.d.ts +1 -1
  120. package/lib/browser/components/me-rows.d.ts +8 -1
  121. package/lib/browser/components/me-rows.js +3 -3
  122. package/lib/browser/components/me-view.js +1 -1
  123. package/lib/browser/components/message-user.js +5 -2
  124. package/lib/browser/components/model-picker.d.ts +5 -0
  125. package/lib/browser/components/model-picker.js +10 -1
  126. package/lib/browser/components/nav-places.d.ts +14 -0
  127. package/lib/browser/components/nav-places.js +13 -1
  128. package/lib/browser/components/relay-view-util.d.ts +6 -0
  129. package/lib/browser/components/relay-view-util.js +17 -0
  130. package/lib/browser/components/relay-view.js +10 -6
  131. package/lib/browser/components/settings-choices.js +2 -0
  132. package/lib/browser/components/settings-controls.d.ts +15 -0
  133. package/lib/browser/components/settings-controls.js +13 -0
  134. package/lib/browser/components/settings-more.js +1 -0
  135. package/lib/browser/components/settings-parts.d.ts +3 -1
  136. package/lib/browser/components/settings-parts.js +3 -0
  137. package/lib/browser/components/settings-view.js +36 -10
  138. package/lib/browser/device/app-update.d.ts +63 -0
  139. package/lib/browser/device/app-update.js +182 -0
  140. package/lib/browser/extension/icons.js +1 -0
  141. package/lib/browser/extension/web-api-contributions.d.ts +6 -1
  142. package/lib/browser/extension/web-api-partners.d.ts +6 -0
  143. package/lib/browser/extension/web-api-spec.js +1 -0
  144. package/lib/browser/extension/web-home.js +9 -0
  145. package/lib/browser/extension/web-metrics.d.ts +3 -0
  146. package/lib/browser/extension/web-metrics.js +32 -21
  147. package/lib/browser/extension/web-pages.d.ts +3 -1
  148. package/lib/browser/extension/web-pages.js +1 -0
  149. package/lib/browser/i18n/en/account.d.ts +7 -0
  150. package/lib/browser/i18n/en/account.js +13 -6
  151. package/lib/browser/i18n/en/chat.d.ts +2 -0
  152. package/lib/browser/i18n/en/chat.js +2 -0
  153. package/lib/browser/i18n/en/discover.d.ts +3 -0
  154. package/lib/browser/i18n/en/discover.js +3 -0
  155. package/lib/browser/i18n/en/service.d.ts +6 -0
  156. package/lib/browser/i18n/en/service.js +6 -0
  157. package/lib/browser/i18n/en/settings.d.ts +3 -0
  158. package/lib/browser/i18n/en/settings.js +3 -0
  159. package/lib/browser/i18n/ja/account.js +13 -6
  160. package/lib/browser/i18n/ja/chat.js +2 -0
  161. package/lib/browser/i18n/ja/discover.js +3 -0
  162. package/lib/browser/i18n/ja/service.js +6 -0
  163. package/lib/browser/i18n/ja/settings.js +3 -0
  164. package/lib/browser/i18n/locales.d.ts +22 -1
  165. package/lib/browser/i18n/messages.d.ts +21 -0
  166. package/lib/browser/i18n/zh/account.js +13 -6
  167. package/lib/browser/i18n/zh/chat.js +2 -0
  168. package/lib/browser/i18n/zh/discover.js +3 -0
  169. package/lib/browser/i18n/zh/service.js +6 -0
  170. package/lib/browser/i18n/zh/settings.js +3 -0
  171. package/lib/browser/i18n/zh-tw/account.js +13 -6
  172. package/lib/browser/i18n/zh-tw/chat.js +2 -0
  173. package/lib/browser/i18n/zh-tw/discover.js +3 -0
  174. package/lib/browser/i18n/zh-tw/service.js +6 -0
  175. package/lib/browser/i18n/zh-tw/settings.js +3 -0
  176. package/lib/browser/notices/notices.d.ts +2 -0
  177. package/lib/browser/notices/notices.js +3 -1
  178. package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
  179. package/lib/browser/settings/settings-protocol.d.ts +5 -0
  180. package/lib/browser/settings/settings-protocol.js +2 -0
  181. package/lib/browser/style/dialogs.d.ts +1 -1
  182. package/lib/browser/style/dialogs.js +7 -0
  183. package/package.json +7 -7
@@ -48,6 +48,7 @@ const assistant_task_util_1 = require("../assistant/assistant-task-util");
48
48
  const extension_view_1 = require("../extension/extension-view");
49
49
  const icons_1 = require("../extension/icons");
50
50
  const use_t_1 = require("../i18n/use-t");
51
+ const notices_1 = require("../notices/notices");
51
52
  const message_1 = require("../util/message");
52
53
  const face_1 = require("./face");
53
54
  const icon_1 = require("./icon");
@@ -62,11 +63,13 @@ exports.Outbox = React.createContext({ of: new Map() });
62
63
  /** A message that did not go: marked as such, with a way to send it again or take it back, as in a messenger. */
63
64
  function SendFailed({ sent, actions }) {
64
65
  const t = (0, use_t_1.useT)();
66
+ // For want of a model: said, with the way to connect one; it goes by itself once one is (TaChat.resendSignedOut).
67
+ const noModel = sent.code === ta_protocol_1.TaErrorCode.NOT_SIGNED_IN;
65
68
  return (React.createElement("div", { className: "ta-send-failed", title: sent.failed },
66
69
  React.createElement(icon_1.Icon, { icon: lucide_react_1.CircleAlert, size: 14 }),
67
- React.createElement("span", null, t('ta.message.sendFailed')),
70
+ React.createElement("span", null, t(noModel ? 'ta.message.noModel' : 'ta.message.sendFailed')),
68
71
  actions && (React.createElement(React.Fragment, null,
69
- React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => actions.resend(sent.id) }, t('ta.message.resend')),
72
+ noModel ? (React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => window.dispatchEvent(new Event(notices_1.SIGN_IN_EVENT)) }, t('ta.message.connectModel'))) : (React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => actions.resend(sent.id) }, t('ta.message.resend'))),
70
73
  React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => actions.discard(sent.id) }, t('ta.message.discard'))))));
71
74
  }
72
75
  /**
@@ -14,6 +14,11 @@ export declare namespace ModelPickerUtil {
14
14
  function withoutAgents<T extends ModelSource & Pick<TaSettingsSnapshot, 'agents'>>(source: T): T;
15
15
  /** The model of the settings of `snapshot`'s directory: the project's, else the user's. */
16
16
  function settingsModel(snapshot: Pick<TaSettingsSnapshot, 'user' | 'project'>): string | undefined;
17
+ /**
18
+ * The model a new conversation of `snapshot`'s directory works with when none is picked: pi's choice, that of
19
+ * the settings when the server did not tell it, or it is one `snapshot` leaves out (withoutAgents).
20
+ */
21
+ function initialModel(snapshot: Pick<TaSettingsSnapshot, 'user' | 'project' | 'models' | 'initialModel'>): string | undefined;
17
22
  /**
18
23
  * The models as entries of a list, under their providers in the order the providers first come, `value`
19
24
  * checked; a `value` no longer offered comes first, so that it stays.
@@ -79,6 +79,15 @@ var ModelPickerUtil;
79
79
  return typeof model === 'string' && model ? model : undefined;
80
80
  }
81
81
  ModelPickerUtil.settingsModel = settingsModel;
82
+ /**
83
+ * The model a new conversation of `snapshot`'s directory works with when none is picked: pi's choice, that of
84
+ * the settings when the server did not tell it, or it is one `snapshot` leaves out (withoutAgents).
85
+ */
86
+ function initialModel(snapshot) {
87
+ const model = snapshot.initialModel;
88
+ return model && snapshot.models.includes(model) ? model : settingsModel(snapshot);
89
+ }
90
+ ModelPickerUtil.initialModel = initialModel;
82
91
  /**
83
92
  * The models as entries of a list, under their providers in the order the providers first come, `value`
84
93
  * checked; a `value` no longer offered comes first, so that it stays.
@@ -211,7 +220,7 @@ function SettingsModelPicker({ settings, cwd, value, onChange, defaultLabel, lab
211
220
  const t = (0, use_t_1.useT)();
212
221
  const read = useModelSource(settings, cwd);
213
222
  const source = React.useMemo(() => (read && noAgents ? ModelPickerUtil.withoutAgents(read) : read), [read, noAgents]);
214
- const fallback = source && ModelPickerUtil.settingsModel(source);
223
+ const fallback = source && ModelPickerUtil.initialModel(source);
215
224
  const shown = defaultLabel !== null && defaultLabel !== void 0 ? defaultLabel : (fallback ? t('ta.model.default', { name: ModelPickerUtil.name(source, fallback) }) : t('ta.model.defaultNone'));
216
225
  // An agent picked before it was left out does not count: the default is what holds.
217
226
  const picked = noAgents && ((_a = read === null || read === void 0 ? void 0 : read.agents) === null || _a === void 0 ? void 0 : _a.includes(value)) ? '' : value;
@@ -43,6 +43,10 @@ export interface Navigation {
43
43
  */
44
44
  onOpen: WebPageInfo[];
45
45
  setting: NavigationSetting;
46
+ /** Whether Discover lists a page first (discoverFirst); none while the user has all listed (Settings.allFeatures). */
47
+ first?(id: string): boolean;
48
+ /** All features listed in Discover itself, or not. */
49
+ showAll(on: boolean): void;
46
50
  pin(id: string): void;
47
51
  fold(id: string): void;
48
52
  update(setting: NavigationSetting): void;
@@ -68,6 +72,16 @@ export declare function discoverGroups<T extends {
68
72
  group: WebPageGroup;
69
73
  pages: T[];
70
74
  }[];
75
+ /** A feature opened in the last of these days stays in the first list of Discover (docs/design/ta-simple.md 4.2). */
76
+ export declare const DISCOVER_RECENT_DAYS = 30;
77
+ /** What Discover reads of a page to place it: its WebPageInfo. */
78
+ export type DiscoverInfo = Pick<WebPageInfo, 'tier' | 'extensionId' | 'usedAt'>;
79
+ /**
80
+ * Whether Discover lists a page first, or under All features (docs/design/ta-simple.md 4.2): first, one of a package the
81
+ * user added, one for most people (`tier` common), one opened in the last DISCOVER_RECENT_DAYS days; the others wait
82
+ * under All features until used, as the apps of a phone in its library.
83
+ */
84
+ export declare function discoverFirst(info: DiscoverInfo | undefined, now: number): boolean;
71
85
  /** Discover is in the navigation: some pages are under it. */
72
86
  export declare function hasDiscover(navigation: Pick<Navigation, 'discover' | 'onOpen'>): boolean;
73
87
  export interface PhoneTabLabels {
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DISCOVER_GROUPS = exports.ME_TAB = exports.DISCOVER = void 0;
3
+ exports.DISCOVER_RECENT_DAYS = exports.DISCOVER_GROUPS = exports.ME_TAB = exports.DISCOVER = void 0;
4
4
  exports.railPages = railPages;
5
5
  exports.entryHold = entryHold;
6
6
  exports.fixedTabs = fixedTabs;
7
7
  exports.places = places;
8
8
  exports.arrangeViews = arrangeViews;
9
9
  exports.discoverGroups = discoverGroups;
10
+ exports.discoverFirst = discoverFirst;
10
11
  exports.hasDiscover = hasDiscover;
11
12
  exports.phoneTabs = phoneTabs;
12
13
  const lucide_react_1 = require("lucide-react");
@@ -64,6 +65,17 @@ function discoverGroups(pages) {
64
65
  const of = (page) => (page.group && exports.DISCOVER_GROUPS.includes(page.group) ? page.group : 'more');
65
66
  return exports.DISCOVER_GROUPS.map(group => ({ group, pages: pages.filter(page => of(page) === group) })).filter(entry => entry.pages.length > 0);
66
67
  }
68
+ /** A feature opened in the last of these days stays in the first list of Discover (docs/design/ta-simple.md 4.2). */
69
+ exports.DISCOVER_RECENT_DAYS = 30;
70
+ /**
71
+ * Whether Discover lists a page first, or under All features (docs/design/ta-simple.md 4.2): first, one of a package the
72
+ * user added, one for most people (`tier` common), one opened in the last DISCOVER_RECENT_DAYS days; the others wait
73
+ * under All features until used, as the apps of a phone in its library.
74
+ */
75
+ function discoverFirst(info, now) {
76
+ return (!!info &&
77
+ (!!info.extensionId || info.tier === 'common' || (info.usedAt !== undefined && now - info.usedAt < exports.DISCOVER_RECENT_DAYS * 24 * 60 * 60 * 1000)));
78
+ }
67
79
  /** Discover is in the navigation: some pages are under it. */
68
80
  function hasDiscover(navigation) {
69
81
  return navigation.discover.length > 0 || navigation.onOpen.length > 0;
@@ -0,0 +1,6 @@
1
+ import type { TaRelayDevice } from '@celljs/ta-protocol';
2
+ export declare namespace RelayViewUtil {
3
+ /** The name of the next device paired: `base`, numbered when one paired already has it (`Phone 2`). */
4
+ function nextName(base: string, devices: readonly Pick<TaRelayDevice, 'name'>[]): string;
5
+ }
6
+ //# sourceMappingURL=relay-view-util.d.ts.map
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RelayViewUtil = void 0;
4
+ var RelayViewUtil;
5
+ (function (RelayViewUtil) {
6
+ /** The name of the next device paired: `base`, numbered when one paired already has it (`Phone 2`). */
7
+ function nextName(base, devices) {
8
+ const taken = new Set(devices.map(device => device.name));
9
+ let name = base;
10
+ for (let n = 2; taken.has(name); n++) {
11
+ name = `${base} ${n}`;
12
+ }
13
+ return name;
14
+ }
15
+ RelayViewUtil.nextName = nextName;
16
+ })(RelayViewUtil || (exports.RelayViewUtil = RelayViewUtil = {}));
17
+ //# sourceMappingURL=relay-view-util.js.map
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.RelayDialog = RelayDialog;
37
37
  const ta_protocol_1 = require("@celljs/ta-protocol");
38
+ const relay_protocol_1 = require("@celljs/ta-relay/lib/common/relay-protocol");
38
39
  const lucide_react_1 = require("lucide-react");
39
40
  const React = __importStar(require("react"));
40
41
  const react_dom_1 = require("react-dom");
@@ -46,6 +47,7 @@ const busy_1 = require("./busy");
46
47
  const icon_1 = require("./icon");
47
48
  const picture_1 = require("./picture");
48
49
  const qr_view_1 = require("./qr-view");
50
+ const relay_view_util_1 = require("./relay-view-util");
49
51
  const serve_value_1 = require("./serve-value");
50
52
  const settings_controls_1 = require("./settings-controls");
51
53
  const RELAY_TOPICS = [ta_protocol_1.TaServeChanges.RELAY];
@@ -82,7 +84,6 @@ function RelayDialog({ onClose }) {
82
84
  const [, bench] = (0, hooks_1.useWorkbench)();
83
85
  const [, notices] = (0, hooks_1.useNotices)();
84
86
  const [link, setLink] = React.useState();
85
- const [name, setName] = React.useState('');
86
87
  const [busy, run] = (0, busy_1.useBusy)();
87
88
  // Whether ta serve reached the relay shows as it does (TaServeChanges.RELAY), a moment after pairing.
88
89
  const getRelay = React.useCallback(() => bench.relay.getRelay(), [bench]);
@@ -118,9 +119,9 @@ function RelayDialog({ onClose }) {
118
119
  return;
119
120
  }
120
121
  try {
121
- const paired = await bench.relay.pair((_a = info.relay) !== null && _a !== void 0 ? _a : info.defaultRelay, name.trim() || t('ta.relay.phone'));
122
+ // Named for the user, rather than asked: a name of the phone's, numbered (RelayViewUtil.nextName).
123
+ const paired = await bench.relay.pair((_a = info.relay) !== null && _a !== void 0 ? _a : info.defaultRelay, relay_view_util_1.RelayViewUtil.nextName(t('ta.relay.phone'), info.devices));
122
124
  setLink(paired.link);
123
- setName('');
124
125
  void load();
125
126
  }
126
127
  catch (error) {
@@ -153,6 +154,12 @@ function RelayDialog({ onClose }) {
153
154
  link ? (React.createElement("div", { className: "ta-relay-pairing" },
154
155
  React.createElement(qr_view_1.QrView, { text: link }),
155
156
  React.createElement("p", null, t('ta.relay.scan')),
157
+ React.createElement("p", { className: "ta-relay-download" },
158
+ React.createElement(icon_1.Icon, { icon: lucide_react_1.Download, size: 14 }),
159
+ React.createElement("span", null,
160
+ t('ta.relay.noApp'),
161
+ ' ',
162
+ React.createElement("a", { href: relay_protocol_1.RELAY_DOWNLOAD_PAGE, target: "_blank", rel: "noreferrer" }, t('ta.relay.download')))),
156
163
  React.createElement("div", { className: "ta-auth-actions" },
157
164
  React.createElement("button", { type: "button", className: "ta-button", onClick: () => void run(() => { var _a; return (_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText(link).catch(() => undefined); }) },
158
165
  React.createElement(icon_1.Icon, { icon: lucide_react_1.Copy, size: 15 }),
@@ -162,9 +169,6 @@ function RelayDialog({ onClose }) {
162
169
  React.createElement(RelayPicture, null),
163
170
  React.createElement("p", null, t('ta.relay.hint')),
164
171
  React.createElement("div", { className: "ta-relay-form" },
165
- React.createElement("label", { className: "ta-field" },
166
- React.createElement(lucide_react_1.Smartphone, { size: 15, strokeWidth: 1.75, "aria-hidden": "true" }),
167
- React.createElement("input", { placeholder: t('ta.relay.phone'), value: name, onChange: event => setName(event.target.value) })),
168
172
  React.createElement("button", { type: "button", className: busy ? 'ta-button ta-primary ta-busy' : 'ta-button ta-primary', "aria-busy": busy || undefined, disabled: !info, onClick: () => void run(pair) },
169
173
  t('ta.relay.pair'),
170
174
  React.createElement(busy_1.BusyMark, { busy: busy }))))),
@@ -126,6 +126,8 @@ function navigationRows(navigation, t) {
126
126
  return t(navigation.setting.pinned.includes(id) ? 'ta.settings.navigation.overflow' : 'ta.settings.navigation.folded');
127
127
  };
128
128
  return [
129
+ (0, settings_controls_1.row)('all-features', [t('ta.settings.allFeatures'), t('ta.settings.allFeaturesHint'), t('ta.discover.all')], React.createElement(settings_controls_1.Row, { label: t('ta.settings.allFeatures'), description: t('ta.settings.allFeaturesHint') },
130
+ React.createElement(settings_controls_1.Switch, { label: t('ta.settings.allFeatures'), checked: !navigation.first, onChange: navigation.showAll }))),
129
131
  ...navigation.pages.map(page => {
130
132
  const title = web_extension_protocol_1.WebLabelUtil.text(page.title);
131
133
  return (0, settings_controls_1.row)(`navigation:${page.id}`, [title, t('ta.settings.navigation')], React.createElement(settings_controls_1.Row, { label: title, description: where(page.id) },
@@ -65,6 +65,21 @@ export declare namespace SettingsViewUtil {
65
65
  }, P extends {
66
66
  sections: S[];
67
67
  }>(parts: P[], query: string): P[];
68
+ /**
69
+ * The sections most people look for (`tier` common, docs/design/ta-simple.md 4.2), in their parts; the parts left.
70
+ * The others are a row away (More settings), and the search finds them.
71
+ */
72
+ function common<S extends {
73
+ tier?: string;
74
+ }, P extends {
75
+ sections: S[];
76
+ }>(parts: P[]): P[];
77
+ /** How many sections `common` leaves out. */
78
+ function hidden(parts: readonly {
79
+ sections: readonly {
80
+ tier?: string;
81
+ }[];
82
+ }[]): number;
68
83
  /**
69
84
  * The sections in their parts, in the order of `groups`: a section without a group in the first, those of a part by
70
85
  * `order` (default 0), in the order given for the same; parts without a section left out.
@@ -113,6 +113,19 @@ var SettingsViewUtil;
113
113
  .filter(part => part.sections.length > 0);
114
114
  }
115
115
  SettingsViewUtil.filter = filter;
116
+ /**
117
+ * The sections most people look for (`tier` common, docs/design/ta-simple.md 4.2), in their parts; the parts left.
118
+ * The others are a row away (More settings), and the search finds them.
119
+ */
120
+ function common(parts) {
121
+ return parts.map(part => ({ ...part, sections: part.sections.filter(entry => entry.tier === 'common') })).filter(part => part.sections.length > 0);
122
+ }
123
+ SettingsViewUtil.common = common;
124
+ /** How many sections `common` leaves out. */
125
+ function hidden(parts) {
126
+ return parts.reduce((count, part) => count + part.sections.filter(entry => entry.tier !== 'common').length, 0);
127
+ }
128
+ SettingsViewUtil.hidden = hidden;
116
129
  /**
117
130
  * The sections in their parts, in the order of `groups`: a section without a group in the first, those of a part by
118
131
  * `order` (default 0), in the order given for the same; parts without a section left out.
@@ -259,6 +259,7 @@ function useMoreSections(onDialog) {
259
259
  title: t('ta.settings.about'),
260
260
  icon: lucide_react_1.Info,
261
261
  order: 1000,
262
+ tier: 'common',
262
263
  rows: workbench.server
263
264
  ? [
264
265
  (0, settings_controls_1.row)('version', [t('ta.settings.version'), 'version'], React.createElement(settings_controls_1.Row, { label: t('ta.settings.version'), description: restartTa.update
@@ -1,4 +1,4 @@
1
- import { type TaSettingsScope } from '@celljs/ta-protocol';
1
+ import { type TaSettingsScope, type TaTier } from '@celljs/ta-protocol';
2
2
  import * as React from 'react';
3
3
  import type { WebSettingsGroup } from '../extension/web-extension-api';
4
4
  import type { Glyph } from './icon';
@@ -14,6 +14,8 @@ export interface SectionEntry {
14
14
  order?: number;
15
15
  /** A setting of pi's files, of the user or of the project: under the scope of its part (Part.lead). */
16
16
  scoped?: boolean;
17
+ /** `common`: shown from the start; the others under More settings (SettingsViewUtil.common). */
18
+ tier?: TaTier;
17
19
  }
18
20
  export interface Part {
19
21
  id: string;
@@ -75,6 +75,7 @@ function useParts(scope, onScope, onDialog) {
75
75
  id: 'appearance',
76
76
  title: t('ta.settings.appearance'),
77
77
  icon: lucide_react_1.Palette,
78
+ tier: 'common',
78
79
  rows: [
79
80
  (0, settings_controls_1.row)('theme', [t('ta.settings.theme'), 'theme'], React.createElement(settings_controls_1.Row, { label: t('ta.settings.theme'), stacked: true },
80
81
  React.createElement(settings_controls_1.Segmented, { label: t('ta.settings.theme'), value: settings.theme, choices: settings_choices_1.THEMES, onChange: theme => store.update({ theme }) }))),
@@ -108,6 +109,7 @@ function useParts(scope, onScope, onDialog) {
108
109
  id: 'language',
109
110
  title: t('ta.settings.language'),
110
111
  icon: lucide_react_1.Languages,
112
+ tier: 'common',
111
113
  // A phone has no room for five names side by side: a row each, as its own settings have them.
112
114
  rows: handheld
113
115
  ? settings_choices_1.LANGUAGES.map(choice => {
@@ -221,6 +223,7 @@ function useParts(scope, onScope, onDialog) {
221
223
  icon: (_a = settings_choices_1.GROUP_ICONS[group.id]) !== null && _a !== void 0 ? _a : lucide_react_1.Wrench,
222
224
  group: 'ta',
223
225
  scoped: true,
226
+ ...(group.id === 'model' ? { tier: 'common' } : {}),
224
227
  rows: snapshot
225
228
  ? group.keys.flatMap(key => {
226
229
  const spec = agent_settings_1.AgentSettingsUtil.spec(key);
@@ -37,6 +37,8 @@ exports.SettingsView = SettingsView;
37
37
  const lucide_react_1 = require("lucide-react");
38
38
  const React = __importStar(require("react"));
39
39
  const device_1 = require("../device/device");
40
+ const web_metrics_1 = require("../extension/web-metrics");
41
+ const hooks_1 = require("../hooks");
40
42
  const use_t_1 = require("../i18n/use-t");
41
43
  const screen_protocol_1 = require("../screen/screen-protocol");
42
44
  const use_screen_part_1 = require("../screen/use-screen-part");
@@ -63,6 +65,15 @@ function SettingsView({ section, onClose, onMenu, onBack }) {
63
65
  const [dialog, setDialog] = React.useState();
64
66
  const closeDialog = React.useCallback(() => setDialog(undefined), []);
65
67
  const parts = (0, settings_parts_1.useParts)(scope, setScope, setDialog);
68
+ const [{ settings }] = (0, hooks_1.useSettings)();
69
+ // The sections most people look for first, the others a row away (docs/design/ta-simple.md 4.2); all of them for a
70
+ // search, for one asked for that is not of those, and for one who has every feature shown.
71
+ const [more, setMore] = React.useState(false);
72
+ React.useEffect(() => { var _a; return (_a = web_metrics_1.WebMetrics.current) === null || _a === void 0 ? void 0 : _a.own(more ? 'page:settings-more' : 'page:settings'); }, [more]);
73
+ const asked = section !== undefined && parts.some(part => part.sections.some(entry => entry.id === section && entry.tier !== 'common'));
74
+ const all = settings.allFeatures || more || asked || !!query.trim();
75
+ const shownParts = all ? parts : settings_controls_1.SettingsViewUtil.common(parts);
76
+ const onMore = all || settings_controls_1.SettingsViewUtil.hidden(parts) === 0 ? undefined : () => setMore(true);
66
77
  // What an agent reads of the settings and where it goes in them (docs/design/ta-app-use.md 3); the rows are read as they show.
67
78
  (0, use_screen_part_1.useScreenPart)({
68
79
  id: 'settings',
@@ -76,6 +87,9 @@ function SettingsView({ section, onClose, onMenu, onBack }) {
76
87
  var _a;
77
88
  var _b, _c;
78
89
  const entry = parts.flatMap(part => part.sections).find(candidate => candidate.id === id);
90
+ if (entry && entry.tier !== 'common' && !all) {
91
+ setMore(true);
92
+ }
79
93
  const root = document.querySelector('[data-ta-part="settings"]');
80
94
  const link = (_b = root === null || root === void 0 ? void 0 : root.querySelector(`[data-ta-item="${CSS.escape(id !== null && id !== void 0 ? id : '')}"]`)) !== null && _b !== void 0 ? _b : [...((_c = root === null || root === void 0 ? void 0 : root.querySelectorAll('.ta-list-main')) !== null && _c !== void 0 ? _c : [])].find(button => { var _a; return ((_a = button.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === (entry === null || entry === void 0 ? void 0 : entry.title); });
81
95
  if (link) {
@@ -98,11 +112,17 @@ function SettingsView({ section, onClose, onMenu, onBack }) {
98
112
  React.createElement(icon_1.Icon, { icon: lucide_react_1.Search, size: 14 }),
99
113
  React.createElement("input", { value: query, placeholder: t('ta.settings.search'), "aria-label": t('ta.settings.search'), onChange: event => setQuery(event.target.value) }),
100
114
  query && React.createElement(icon_1.IconButton, { icon: lucide_react_1.X, label: t('ta.close'), onClick: () => setQuery('') })));
101
- const props = { parts, query, search, section };
115
+ const props = { parts: shownParts, query, search, section, onMore };
102
116
  return (React.createElement("section", { className: "ta-settings-page", "aria-label": t('ta.settings'), ...screen_protocol_1.ScreenUtil.part('settings') },
103
117
  handheld ? React.createElement(PhoneSettings, { ...props, onBack: onBack !== null && onBack !== void 0 ? onBack : onClose }) : React.createElement(WideSettings, { ...props, onClose: onClose, onMenu: onMenu, onBack: onBack }),
104
118
  dialog === 'directory' && React.createElement(working_directory_1.WorkingDirectoryPicker, { onClose: closeDialog })));
105
119
  }
120
+ /** The row under the sections that shows the others. */
121
+ function MoreRow({ onMore }) {
122
+ const t = (0, use_t_1.useT)();
123
+ return (React.createElement(list_rows_1.ListGroup, null,
124
+ React.createElement(list_rows_1.ListRow, { icon: lucide_react_1.Settings2, label: t('ta.settings.more'), onClick: onMore })));
125
+ }
106
126
  /** The rows of a section, in a card. */
107
127
  function SectionRows({ entry }) {
108
128
  return entry.rows.length > 0 ? (React.createElement("div", { className: "ta-setting-card" }, entry.rows.map(candidate => (React.createElement(React.Fragment, { key: candidate.key }, candidate.node))))) : null;
@@ -113,7 +133,7 @@ function SectionRows({ entry }) {
113
133
  * packages, the settings of ta) and grows, until the user scrolls; marked on the left even when the page
114
134
  * cannot scroll it to the top.
115
135
  */
116
- function WideSettings({ parts, query, search, section, onClose, onMenu, onBack }) {
136
+ function WideSettings({ parts, query, search, section, onMore, onClose, onMenu, onBack }) {
117
137
  const t = (0, use_t_1.useT)();
118
138
  const [active, setActive] = React.useState(section !== null && section !== void 0 ? section : 'appearance');
119
139
  const scroller = React.useRef(null);
@@ -185,11 +205,15 @@ function WideSettings({ parts, query, search, section, onClose, onMenu, onBack }
185
205
  search,
186
206
  onMenu && React.createElement(icon_1.IconButton, { icon: lucide_react_1.X, label: t('ta.close'), onClick: onClose })),
187
207
  React.createElement("div", { className: "ta-settings-body" },
188
- React.createElement("nav", { className: "ta-settings-toc", "aria-label": t('ta.settings') }, shown.map(part => (React.createElement("div", { key: part.id, className: "ta-settings-toc-part" },
189
- React.createElement("button", { type: "button", className: "ta-settings-toc-group", onClick: () => go(part.sections[0].id, 'smooth') }, part.title),
190
- part.sections.map(entry => (React.createElement("button", { key: entry.id, type: "button", className: `ta-settings-toc-item${active === entry.id ? ' ta-active' : ''}`, "aria-current": active === entry.id || undefined, onClick: () => go(entry.id, 'smooth'), ...screen_protocol_1.ScreenUtil.item(entry.id) },
191
- React.createElement(icon_1.Icon, { icon: entry.icon, size: 14 }),
192
- React.createElement("span", { className: "ta-ellipsis" }, entry.title)))))))),
208
+ React.createElement("nav", { className: "ta-settings-toc", "aria-label": t('ta.settings') },
209
+ shown.map(part => (React.createElement("div", { key: part.id, className: "ta-settings-toc-part" },
210
+ React.createElement("button", { type: "button", className: "ta-settings-toc-group", onClick: () => go(part.sections[0].id, 'smooth') }, part.title),
211
+ part.sections.map(entry => (React.createElement("button", { key: entry.id, type: "button", className: `ta-settings-toc-item${active === entry.id ? ' ta-active' : ''}`, "aria-current": active === entry.id || undefined, onClick: () => go(entry.id, 'smooth'), ...screen_protocol_1.ScreenUtil.item(entry.id) },
212
+ React.createElement(icon_1.Icon, { icon: entry.icon, size: 14 }),
213
+ React.createElement("span", { className: "ta-ellipsis" }, entry.title))))))),
214
+ onMore && (React.createElement("button", { type: "button", className: "ta-settings-toc-item", onClick: onMore },
215
+ React.createElement(icon_1.Icon, { icon: lucide_react_1.Settings2, size: 14 }),
216
+ React.createElement("span", { className: "ta-ellipsis" }, t('ta.settings.more'))))),
193
217
  React.createElement("div", { className: "ta-settings-scroll", ref: scroller, onScroll: onScroll },
194
218
  React.createElement("div", { className: "ta-settings-content", ref: content },
195
219
  shown.length === 0 && React.createElement(empty_state_1.EmptyState, { title: t('ta.settings.noMatch', { query: query.trim() }) }),
@@ -202,7 +226,8 @@ function WideSettings({ parts, query, search, section, onClose, onMenu, onBack }
202
226
  React.createElement(icon_1.Icon, { icon: entry.icon, size: 13 }),
203
227
  " ",
204
228
  entry.title),
205
- React.createElement(SectionRows, { entry: entry })))); })))))))));
229
+ React.createElement(SectionRows, { entry: entry })))); })))),
230
+ onMore && React.createElement(MoreRow, { onMore: onMore }))))));
206
231
  }
207
232
  /** A page of a phone: its head, with the way back and its title, over a list. */
208
233
  function PhonePage({ title, onBack, children }) {
@@ -228,7 +253,7 @@ function PhoneSection({ part, entry, onBack }) {
228
253
  * section tapped pushed over it as a page of its own; a search lists the rows that match in place. A section
229
254
  * Me opened (the theme, the language, about) is that page alone, and back goes to Me.
230
255
  */
231
- function PhoneSettings({ parts, query, search, section, onBack }) {
256
+ function PhoneSettings({ parts, query, search, section, onMore, onBack }) {
232
257
  const t = (0, use_t_1.useT)();
233
258
  /** The section pushed over the list, kept while it slides away. */
234
259
  const [pushed, setPushed] = React.useState();
@@ -257,7 +282,8 @@ function PhoneSettings({ parts, query, search, section, onBack }) {
257
282
  React.createElement(SectionRows, { entry: entry })))))
258
283
  : parts.map(part => (React.createElement("section", { key: part.id, className: "ta-settings-phone-group", "aria-label": part.title },
259
284
  React.createElement("h2", { className: "ta-settings-phone-caption" }, part.title),
260
- React.createElement(list_rows_1.ListGroup, null, part.sections.map(entry => (React.createElement(list_rows_1.ListRow, { key: entry.id, icon: entry.icon, label: entry.title, onClick: () => setPushed({ id: entry.id, open: true }) })))))))));
285
+ React.createElement(list_rows_1.ListGroup, null, part.sections.map(entry => (React.createElement(list_rows_1.ListRow, { key: entry.id, icon: entry.icon, label: entry.title, onClick: () => setPushed({ id: entry.id, open: true }) }))))))),
286
+ !query.trim() && onMore && React.createElement(MoreRow, { onMore: onMore })));
261
287
  return React.createElement(phone_shell_1.PhoneStack, { base: list, top: top && React.createElement(PhoneSection, { ...top, onBack: close }), open: !!top && !!(pushed === null || pushed === void 0 ? void 0 : pushed.open), onClose: close });
262
288
  }
263
289
  //# sourceMappingURL=settings-view.js.map
@@ -0,0 +1,63 @@
1
+ /**
2
+ * What a build of the phone app says of where its new versions are: `ta-app.json` beside its page. The iPhone app
3
+ * signed for the company has it, written in as it is signed (apps/ta-mobile/scripts/package.ts), and installs its new
4
+ * versions from the internal download page with a tap; the other builds (signed by whoever installs them, Android, a
5
+ * browser) have none, and are told of nothing.
6
+ */
7
+ export interface AppUpdateSource {
8
+ /** The manifest of the download page, latest.json: version, build and the files of each system. */
9
+ updates: string;
10
+ /** This build's system as the manifest names it: `ios-arm64`. */
11
+ target: string;
12
+ version: string;
13
+ build: number;
14
+ }
15
+ /** A newer build of the app: its version, and the link that installs it. */
16
+ export interface AppUpdateOffer {
17
+ version: string;
18
+ build: number;
19
+ link: string;
20
+ }
21
+ /** What the updates read of the app; tests give their own. */
22
+ export interface AppUpdateEnvironment {
23
+ /** ta-app.json of the app, parsed; undefined where there is none. */
24
+ own(): Promise<unknown>;
25
+ /** The manifest at the address, parsed; throws when it cannot be read (offline, outside the company's network). */
26
+ get(url: string): Promise<unknown>;
27
+ /** Calls the listener each time the app comes back to the front. */
28
+ onForeground(listener: () => void): void;
29
+ /** Opens the link: the system asks the user to install. */
30
+ open(link: string): void;
31
+ }
32
+ export declare namespace AppUpdateUtil {
33
+ const FILE = "ta-app.json";
34
+ function source(value: unknown): AppUpdateSource | undefined;
35
+ /**
36
+ * The build of the manifest when it is newer than the app's, with the link that installs it: the itms-services link
37
+ * the manifest gives (iOS), else the address of its file; either only of the site of the manifest.
38
+ */
39
+ function offer(source: AppUpdateSource, manifest: unknown): AppUpdateOffer | undefined;
40
+ }
41
+ /**
42
+ * Newer versions of the phone app that does not update itself (the iPhone app signed for the company): read from the
43
+ * manifest of its download page as the app starts and each time it comes back to the front, and installed with a tap
44
+ * (the system asks, then puts the new version in its place, nothing lost). Nothing where the app does not say where its
45
+ * new versions are (AppUpdateSource); one not read (offline, outside the company's network) leaves what was known.
46
+ */
47
+ export declare class AppUpdates {
48
+ protected readonly environment: () => AppUpdateEnvironment | undefined;
49
+ protected current?: AppUpdateOffer;
50
+ protected started: boolean;
51
+ protected source?: Promise<AppUpdateSource | undefined>;
52
+ protected readonly listeners: Set<() => void>;
53
+ constructor(environment?: () => AppUpdateEnvironment | undefined);
54
+ get offer(): AppUpdateOffer | undefined;
55
+ subscribe(listener: () => void): () => void;
56
+ start(): void;
57
+ install(): void;
58
+ protected check(env: AppUpdateEnvironment): Promise<void>;
59
+ }
60
+ export declare const AppUpdate: AppUpdates;
61
+ /** The newer version of the phone app to install, while there is one. */
62
+ export declare function useAppUpdate(): AppUpdateOffer | undefined;
63
+ //# sourceMappingURL=app-update.d.ts.map