@openviking/react 0.1.6 → 0.1.8-beta.10.1.g8e5299efeb0a

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 (172) hide show
  1. package/README.md +13 -1
  2. package/dist/1~0.js +57 -0
  3. package/dist/2~0.js +6 -5
  4. package/dist/3c~0.js +10 -4
  5. package/dist/3~0.js +189 -13
  6. package/dist/5~0.js +181 -0
  7. package/dist/6~0.js +48 -0
  8. package/dist/ae~0.js +8 -1
  9. package/dist/ark-message-list-view~0.js +9 -4
  10. package/dist/a~0.js +12 -6
  11. package/dist/c7r~0.js +50 -0
  12. package/dist/ck~0.js +3 -0
  13. package/dist/client/paths.d.ts +6 -0
  14. package/dist/client/provider.d.ts +6 -1
  15. package/dist/components/agent-connect/style.css +224 -35
  16. package/dist/components/api-key-login-form/api-key-login-form.d.ts +2 -0
  17. package/dist/components/api-key-login-form/index.d.ts +3 -0
  18. package/dist/components/api-key-login-form/style.css +438 -0
  19. package/dist/components/api-key-login-form/style.js +0 -0
  20. package/dist/components/api-key-login-form/types.d.ts +7 -0
  21. package/dist/components/api-key-login-form.js +1 -0
  22. package/dist/components/directory-tour/directory-tour-intro.d.ts +3 -0
  23. package/dist/components/directory-tour/index.d.ts +2 -1
  24. package/dist/components/directory-tour/style.css +367 -39
  25. package/dist/components/directory-tour/tour-card.d.ts +14 -0
  26. package/dist/components/directory-tour/types.d.ts +24 -1
  27. package/dist/components/directory-tour/use-tour-anchor.d.ts +1 -0
  28. package/dist/components/directory-tour/use-tour-position.d.ts +4 -1
  29. package/dist/components/directory-tour/use-tour-theme.d.ts +2 -0
  30. package/dist/components/directory-tour.js +53 -2
  31. package/dist/components/email-login-form/email-login-form.d.ts +2 -0
  32. package/dist/components/email-login-form/index.d.ts +3 -0
  33. package/dist/components/email-login-form/style.css +438 -0
  34. package/dist/components/email-login-form/style.js +0 -0
  35. package/dist/components/email-login-form/types.d.ts +11 -0
  36. package/dist/components/email-login-form.js +1 -0
  37. package/dist/components/experience-dashboard/experience-impact.d.ts +3 -1
  38. package/dist/components/experience-dashboard/style.css +229 -12
  39. package/dist/components/experience-dashboard.js +1 -1
  40. package/dist/components/file-browser-entries/style.css +331 -80
  41. package/dist/components/file-preview/file-preview-header.d.ts +4 -21
  42. package/dist/components/file-preview/file-preview-toolbar.d.ts +7 -0
  43. package/dist/components/file-preview/locales/en-US.d.ts +9 -0
  44. package/dist/components/file-preview/locales/zh-CN.d.ts +9 -0
  45. package/dist/components/file-preview/style.css +335 -76
  46. package/dist/components/file-preview/types.d.ts +14 -21
  47. package/dist/components/file-tree/file-tree-toolbar.d.ts +3 -3
  48. package/dist/components/file-tree/locales/en-US.d.ts +3 -0
  49. package/dist/components/file-tree/locales/zh-CN.d.ts +3 -0
  50. package/dist/components/file-tree/style.css +313 -86
  51. package/dist/components/file-tree/types.d.ts +13 -4
  52. package/dist/components/invitation-confirmation/index.d.ts +3 -0
  53. package/dist/components/invitation-confirmation/invitation-confirmation.d.ts +2 -0
  54. package/dist/components/invitation-confirmation/style.css +438 -0
  55. package/dist/components/invitation-confirmation/style.js +0 -0
  56. package/dist/components/invitation-confirmation/types.d.ts +20 -0
  57. package/dist/components/invitation-confirmation.js +1 -0
  58. package/dist/components/login-method-selector/index.d.ts +2 -0
  59. package/dist/components/login-method-selector/login-method-selector.d.ts +2 -0
  60. package/dist/components/login-method-selector/style.css +438 -0
  61. package/dist/components/login-method-selector/style.js +0 -0
  62. package/dist/components/login-method-selector/types.d.ts +14 -0
  63. package/dist/components/login-method-selector.js +1 -0
  64. package/dist/components/password-reset-request-form/index.d.ts +3 -0
  65. package/dist/components/password-reset-request-form/password-reset-request-form.d.ts +2 -0
  66. package/dist/components/password-reset-request-form/style.css +438 -0
  67. package/dist/components/password-reset-request-form/style.js +0 -0
  68. package/dist/components/password-reset-request-form/types.d.ts +13 -0
  69. package/dist/components/password-reset-request-form.js +1 -0
  70. package/dist/components/password-setup-form/index.d.ts +3 -0
  71. package/dist/components/password-setup-form/password-setup-form.d.ts +2 -0
  72. package/dist/components/password-setup-form/style.css +438 -0
  73. package/dist/components/password-setup-form/style.js +0 -0
  74. package/dist/components/password-setup-form/types.d.ts +10 -0
  75. package/dist/components/password-setup-form.js +1 -0
  76. package/dist/components/scope-switcher/style.css +368 -37
  77. package/dist/components/style.css +13071 -7474
  78. package/dist/components/tui/style.css +271 -35
  79. package/dist/components/viking-bot/interaction/style.css +143 -22
  80. package/dist/components/viking-bot/style.css +951 -295
  81. package/dist/components/wiki-dashboard/index.d.ts +1 -1
  82. package/dist/components/wiki-dashboard/style.css +241 -14
  83. package/dist/components/wiki-dashboard/types.d.ts +12 -16
  84. package/dist/components/wiki-dashboard/wiki-action-button.d.ts +2 -9
  85. package/dist/components/wiki-dashboard/wiki-conflict-card.d.ts +3 -10
  86. package/dist/c~0.js +16 -8
  87. package/dist/d~0.js +28 -0
  88. package/dist/ep~0.js +493 -0
  89. package/dist/e~0.js +33 -328
  90. package/dist/fi~0.js +13 -28
  91. package/dist/fj~0.js +38 -69
  92. package/dist/fl~0.js +710 -0
  93. package/dist/f~0.js +61 -685
  94. package/dist/g~0.js +135 -0
  95. package/dist/icons/index.d.ts +2 -0
  96. package/dist/icons.js +1 -1
  97. package/dist/index.d.ts +12 -0
  98. package/dist/index.js +9 -3
  99. package/dist/k~0.js +44 -4
  100. package/dist/l5~0.js +3813 -0
  101. package/dist/lk~0.js +5 -2
  102. package/dist/l~0.js +49 -2369
  103. package/dist/modules/console/style.css +1485 -351
  104. package/dist/modules/file-browser/acl/acl-add-principal.d.ts +12 -0
  105. package/dist/modules/file-browser/acl/acl-candidate.d.ts +8 -0
  106. package/dist/modules/file-browser/acl/acl-client.d.ts +13 -0
  107. package/dist/modules/file-browser/acl/acl-confirmation.d.ts +6 -0
  108. package/dist/modules/file-browser/acl/acl-entry.d.ts +13 -0
  109. package/dist/modules/file-browser/acl/acl-labels.d.ts +47 -0
  110. package/dist/modules/file-browser/acl/acl-menu.d.ts +10 -0
  111. package/dist/modules/file-browser/acl/acl-modal.d.ts +17 -0
  112. package/dist/modules/file-browser/acl/acl-model.d.ts +17 -0
  113. package/dist/modules/file-browser/acl/acl-principal-tabs.d.ts +6 -0
  114. package/dist/modules/file-browser/acl/acl-tag.d.ts +7 -0
  115. package/dist/modules/file-browser/acl/locales/en-US.d.ts +44 -0
  116. package/dist/modules/file-browser/acl/locales/zh-CN.d.ts +44 -0
  117. package/dist/modules/file-browser/acl/use-acl-principals.d.ts +17 -0
  118. package/dist/modules/file-browser/acl/use-acl-report.d.ts +27 -0
  119. package/dist/modules/file-browser/acl-types.d.ts +86 -0
  120. package/dist/modules/file-browser/dashboard-model.d.ts +3 -0
  121. package/dist/modules/file-browser/file-browser-detail-icons.d.ts +0 -6
  122. package/dist/modules/file-browser/file-browser-detail.d.ts +5 -23
  123. package/dist/modules/file-browser/file-browser-labels.d.ts +1 -1
  124. package/dist/modules/file-browser/file-browser-search.d.ts +20 -0
  125. package/dist/modules/file-browser/file-browser-toolbar.d.ts +3 -10
  126. package/dist/modules/file-browser/file-browser-tree-pane.d.ts +2 -6
  127. package/dist/modules/file-browser/file-browser.d.ts +1 -1
  128. package/dist/modules/file-browser/fs-directories.d.ts +1 -0
  129. package/dist/modules/file-browser/fs-file-editing.d.ts +4 -0
  130. package/dist/modules/file-browser/fs-model.d.ts +3 -1
  131. package/dist/modules/file-browser/fs-preview-images.d.ts +3 -0
  132. package/dist/modules/file-browser/fs-read-file.d.ts +1 -1
  133. package/dist/modules/file-browser/index.d.ts +1 -0
  134. package/dist/modules/file-browser/locales/en-US.d.ts +5 -0
  135. package/dist/modules/file-browser/locales/zh-CN.d.ts +5 -0
  136. package/dist/modules/file-browser/style.css +2595 -703
  137. package/dist/modules/file-browser/types.d.ts +22 -20
  138. package/dist/modules/file-browser/use-file-browser-acl.d.ts +16 -0
  139. package/dist/modules/file-browser/use-file-browser.d.ts +5 -7
  140. package/dist/modules/file-browser/use-fs-tree.d.ts +1 -0
  141. package/dist/modules/file-browser/wiki-dashboard-pane.d.ts +2 -4
  142. package/dist/modules/file-browser.js +1 -1
  143. package/dist/modules/scope-cascade/style.css +537 -37
  144. package/dist/modules/style.css +12429 -8855
  145. package/dist/n~0.js +61 -37
  146. package/dist/p0~0.js +27 -0
  147. package/dist/p~0.js +34 -25
  148. package/dist/rt~0.js +107 -4
  149. package/dist/r~0.js +1 -1
  150. package/dist/shared/auth/agreements.d.ts +10 -0
  151. package/dist/shared/auth/fields.d.ts +15 -0
  152. package/dist/shared/auth/form-frame.d.ts +12 -0
  153. package/dist/shared/auth/locales/en-US.d.ts +24 -0
  154. package/dist/shared/auth/locales/zh-CN.d.ts +24 -0
  155. package/dist/shared/auth/types.d.ts +61 -0
  156. package/dist/shared/auth/use-auth-labels.d.ts +3 -0
  157. package/dist/shared/auth/use-form.d.ts +8 -0
  158. package/dist/shared/components/button/button.d.ts +20 -0
  159. package/dist/shared/components/input/input.d.ts +17 -0
  160. package/dist/shared/components/modal/locales/en-US.d.ts +4 -0
  161. package/dist/shared/components/modal/locales/zh-CN.d.ts +4 -0
  162. package/dist/shared/components/modal/modal.d.ts +2 -0
  163. package/dist/shared/components/modal/types.d.ts +18 -0
  164. package/dist/shared/components/overlay/lock-body-scroll.d.ts +1 -0
  165. package/dist/style.css +15477 -6258
  166. package/dist/s~0.js +16 -0
  167. package/dist/u~0.js +15 -6
  168. package/dist/viking-bot-composer~0.js +29 -11
  169. package/dist/viking-bot-interaction~0.js +2 -1
  170. package/package.json +34 -3
  171. package/dist/modules/file-browser/fs-selection.d.ts +0 -4
  172. package/dist/o~0.js +0 -106
package/dist/f~0.js CHANGED
@@ -1,700 +1,76 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { useId, useState } from "react";
3
- import { mergeLabels } from "./nx~0.js";
4
- import { FileInputIcon, ScanSearchIcon, ActivityIcon } from "./k~0.js";
5
- import { DashboardState } from "./37~0.js";
6
- import { useLocale } from "./28~0.js";
7
- function DashboardTabs({ tabs, active, label, onChange, children }) {
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ import { useAuthLabels, Field } from "./g~0.js";
4
+ import { useForm, FormFrame } from "./5~0.js";
5
+ function PasswordSetupForm({ account, passwordHint, validatePassword, onSubmit, locale, labels: overrides, ...options }) {
8
6
  const id = useId();
9
- return /*#__PURE__*/ jsxs(Fragment, {
10
- children: [
11
- /*#__PURE__*/ jsx("div", {
12
- className: "ov-dashboard-tabs",
13
- role: "tablist",
14
- tabIndex: -1,
15
- "aria-label": label,
16
- onKeyDown: (event)=>{
17
- const delta = 'ArrowRight' === event.key ? 1 : 'ArrowLeft' === event.key ? -1 : 0;
18
- if (!delta && 'Home' !== event.key && 'End' !== event.key) return;
19
- event.preventDefault();
20
- const index = 'Home' === event.key ? 0 : 'End' === event.key ? tabs.length - 1 : (tabs.findIndex((tab)=>tab.key === active) + delta + tabs.length) % tabs.length;
21
- onChange(tabs[index].key);
22
- const buttons = event.currentTarget.querySelectorAll('[role="tab"]');
23
- buttons[index]?.focus();
24
- },
25
- children: tabs.map((tab)=>/*#__PURE__*/ jsx("button", {
26
- type: "button",
27
- id: `${id}-${tab.key}`,
28
- role: "tab",
29
- "aria-selected": active === tab.key,
30
- "aria-controls": `${id}-panel`,
31
- tabIndex: active === tab.key ? 0 : -1,
32
- onClick: ()=>onChange(tab.key),
33
- children: tab.title
34
- }, tab.key))
35
- }),
36
- /*#__PURE__*/ jsx("div", {
37
- role: "tabpanel",
38
- id: `${id}-panel`,
39
- "aria-labelledby": `${id}-${active}`,
40
- className: "ov-dashboard-tabpanel",
41
- children: children
42
- })
43
- ]
7
+ const labels = useAuthLabels(locale, overrides);
8
+ const form = useForm({
9
+ password: '',
10
+ confirmation: ''
11
+ }, ({ password, confirmation })=>{
12
+ const message = password ? validatePassword?.(password) : void 0;
13
+ return {
14
+ password: password ? void 0 === message ? void 0 : {
15
+ message
16
+ } : {
17
+ key: 'required'
18
+ },
19
+ confirmation: confirmation ? password !== confirmation ? {
20
+ key: 'mismatch'
21
+ } : void 0 : {
22
+ key: 'required'
23
+ }
24
+ };
44
25
  });
45
- }
46
- const en = {
47
- latest: 'Latest experience',
48
- sourceCount: 'Generated from {count} trajectories',
49
- sourceUri: 'Source Trajectory URI',
50
- task: 'Task',
51
- copy: 'Copy',
52
- copied: 'Copied',
53
- copyFailed: 'Copy failed',
54
- title: 'Agent experiences',
55
- allExperiences: 'All experiences',
56
- index: 'No.',
57
- impact: 'Application impact',
58
- source: 'Source trace',
59
- test: 'Test',
60
- application: 'Experience application data',
61
- notice: 'AI-generated data may contain errors',
62
- injection: 'Context injections',
63
- recall: 'Retrieval recalls',
64
- listRecall: 'Experience recalls',
65
- rate: 'Injection rate',
66
- outcomes: 'Outcome distribution',
67
- trajectories: 'Application trajectories',
68
- empty: 'No experiences',
69
- emptySource: 'No source records',
70
- emptyTests: 'No test materials',
71
- emptyOutcomes: 'No distribution data',
72
- loading: 'Loading…',
73
- failed: 'Could not load data',
74
- retry: 'Retry',
75
- previous: 'Previous',
76
- next: 'Next',
77
- all: 'All time',
78
- week: 'Last 7 days',
79
- month: 'Last 30 days',
80
- range: 'Statistics period',
81
- updated: 'Updated',
82
- name: 'Experience',
83
- success: 'Task success',
84
- partial: 'Partial success',
85
- unfinished: 'Unfinished',
86
- failure: 'Failure',
87
- unknown: 'Unknown',
88
- unsupportedMetric: 'Metric not provided',
89
- open: 'Open'
90
- };
91
- const zh = {
92
- latest: '最新经验',
93
- sourceCount: '由 {count} 条轨迹生成',
94
- sourceUri: '来源 Trajectory URI',
95
- task: '任务描述',
96
- copy: '复制',
97
- copied: '已复制',
98
- copyFailed: '复制失败',
99
- title: 'Agent 经验',
100
- allExperiences: '全部经验',
101
- index: '序号',
102
- impact: '应用效果',
103
- source: '来源追溯',
104
- test: '测试',
105
- application: '经验应用数据',
106
- notice: '数据由 AI 生成,可能有误',
107
- injection: '注入上下文次数',
108
- recall: '检索召回次数',
109
- listRecall: '经验召回次数',
110
- rate: '注入率',
111
- outcomes: '任务结果分布',
112
- trajectories: '应用轨迹记录',
113
- empty: '暂无经验',
114
- emptySource: '暂无来源记录',
115
- emptyTests: '暂无测试材料',
116
- emptyOutcomes: '暂无可用分布数据',
117
- loading: '加载中…',
118
- failed: '数据加载失败',
119
- retry: '重试',
120
- previous: '上一页',
121
- next: '下一页',
122
- all: '全部时间',
123
- week: '最近 7 天',
124
- month: '最近 30 天',
125
- range: '选择统计时间范围',
126
- updated: '更新于',
127
- name: '经验文件',
128
- success: '任务成功',
129
- partial: '部分成功',
130
- unfinished: '未完成',
131
- failure: '失败',
132
- unknown: '未知',
133
- unsupportedMetric: '未提供此指标',
134
- open: '打开'
135
- };
136
- const experienceLabels = (locale, labels)=>mergeLabels('zh-CN' === locale ? zh : en, labels);
137
- function updatedAt(value, locale) {
138
- const time = Date.parse(value);
139
- if (!Number.isFinite(time)) return value;
140
- const seconds = (time - Date.now()) / 1000;
141
- const absolute = Math.abs(seconds);
142
- if (absolute >= 604800) return new Intl.DateTimeFormat(locale).format(time);
143
- const [unit, size] = absolute < 3600 ? [
144
- 'minute',
145
- 60
146
- ] : absolute < 86400 ? [
147
- 'hour',
148
- 3600
149
- ] : [
150
- 'day',
151
- 86400
152
- ];
153
- return new Intl.RelativeTimeFormat(locale, {
154
- numeric: 'always'
155
- }).format(Math.round(seconds / size), unit);
156
- }
157
- function ExperienceList({ items, total, startIndex = 0, locale = 'en-US', labels: t, onOpenUri }) {
158
- return /*#__PURE__*/ jsxs(Fragment, {
159
- children: [
160
- /*#__PURE__*/ jsxs("h2", {
161
- className: "ov-experience-dashboard__list-title",
162
- children: [
163
- t.allExperiences,
164
- void 0 === total ? '' : ` · ${total}`
165
- ]
26
+ return /*#__PURE__*/ jsxs(FormFrame, {
27
+ ...options,
28
+ labels: labels,
29
+ submitLabel: labels.confirm,
30
+ validate: form.validate,
31
+ onSubmit: ()=>onSubmit?.({
32
+ password: form.values.password
166
33
  }),
167
- /*#__PURE__*/ jsx("div", {
168
- className: "ov-experience-dashboard__table-scroll",
169
- tabIndex: 0,
170
- role: "region",
171
- "aria-label": t.title,
172
- children: /*#__PURE__*/ jsxs("table", {
173
- className: "ov-experience-dashboard__table",
174
- children: [
175
- /*#__PURE__*/ jsx("caption", {
176
- children: t.title
177
- }),
178
- /*#__PURE__*/ jsx("thead", {
179
- children: /*#__PURE__*/ jsxs("tr", {
180
- children: [
181
- /*#__PURE__*/ jsx("th", {
182
- scope: "col",
183
- children: t.index
184
- }),
185
- /*#__PURE__*/ jsx("th", {
186
- scope: "col",
187
- children: t.name
188
- }),
189
- /*#__PURE__*/ jsx("th", {
190
- scope: "col",
191
- children: t.injection
192
- }),
193
- /*#__PURE__*/ jsx("th", {
194
- scope: "col",
195
- children: t.listRecall
196
- })
197
- ]
198
- })
199
- }),
200
- /*#__PURE__*/ jsx("tbody", {
201
- children: items.map((item, index)=>/*#__PURE__*/ jsxs("tr", {
202
- children: [
203
- /*#__PURE__*/ jsxs("td", {
204
- children: [
205
- "# ",
206
- startIndex + index + 1
207
- ]
208
- }),
209
- /*#__PURE__*/ jsxs("th", {
210
- scope: "row",
211
- children: [
212
- /*#__PURE__*/ jsx("button", {
213
- type: "button",
214
- disabled: !onOpenUri,
215
- onClick: ()=>onOpenUri?.(item.uri),
216
- children: item.name
217
- }),
218
- /*#__PURE__*/ jsxs("span", {
219
- children: [
220
- /*#__PURE__*/ jsx("code", {
221
- title: item.uri,
222
- children: item.uri
223
- }),
224
- item.modTime ? /*#__PURE__*/ jsxs("time", {
225
- dateTime: item.modTime,
226
- title: item.modTime,
227
- children: [
228
- "\xb7 ",
229
- t.updated,
230
- " ",
231
- updatedAt(item.modTime, locale)
232
- ]
233
- }) : null
234
- ]
235
- })
236
- ]
237
- }),
238
- /*#__PURE__*/ jsx("td", {
239
- children: item.injectionCount ?? '—'
240
- }),
241
- /*#__PURE__*/ jsx("td", {
242
- children: item.recallCount ?? '—'
243
- })
244
- ]
245
- }, item.uri))
246
- })
247
- ]
248
- })
249
- })
250
- ]
251
- });
252
- }
253
- function ExperienceTrajectories({ items, onOpenUri, source = false }) {
254
- return /*#__PURE__*/ jsx("ul", {
255
- className: `ov-experience-dashboard__timeline${source ? ' ov-experience-dashboard__timeline--source' : ''}`,
256
- children: items.map((item)=>/*#__PURE__*/ jsxs("li", {
257
- children: [
258
- item.created_at ? /*#__PURE__*/ jsx("time", {
259
- dateTime: item.created_at,
260
- children: item.created_at
261
- }) : null,
262
- /*#__PURE__*/ jsx("button", {
263
- type: "button",
264
- disabled: !onOpenUri,
265
- onClick: ()=>onOpenUri?.(item.uri),
266
- children: item.name
267
- }),
268
- /*#__PURE__*/ jsx("code", {
269
- children: item.uri
270
- }),
271
- item.description ? /*#__PURE__*/ jsx("p", {
272
- children: item.description
273
- }) : null
274
- ]
275
- }, item.uri))
276
- });
277
- }
278
- const ORDER = [
279
- 'success',
280
- 'partial',
281
- 'unfinished',
282
- 'failure',
283
- 'unknown'
284
- ];
285
- function ExperienceImpact({ data, labels: t, days, onDaysChange, outcomesState, trajectoriesState, onOpenUri }) {
286
- const total = data.outcomes?.reduce((sum, item)=>sum + item.count, 0) ?? 0;
287
- const metrics = [
288
- {
289
- label: t.injection,
290
- value: data.effect?.injectionCount,
291
- icon: /*#__PURE__*/ jsx(FileInputIcon, {
292
- width: 14,
293
- height: 14
294
- })
295
- },
296
- {
297
- label: t.recall,
298
- value: data.effect?.recallCount,
299
- icon: /*#__PURE__*/ jsx(ScanSearchIcon, {
300
- width: 14,
301
- height: 14
302
- })
303
- },
304
- {
305
- label: t.rate,
306
- value: data.effect ? new Intl.NumberFormat('en-US', {
307
- style: 'percent',
308
- maximumFractionDigits: 1
309
- }).format(data.effect.injectionRate) : void 0,
310
- icon: /*#__PURE__*/ jsx(ActivityIcon, {
311
- width: 14,
312
- height: 14
313
- })
314
- }
315
- ];
316
- return /*#__PURE__*/ jsxs("div", {
317
- className: "ov-experience-dashboard__impact",
318
34
  children: [
319
- /*#__PURE__*/ jsxs("div", {
320
- className: "ov-experience-dashboard__heading",
35
+ account && /*#__PURE__*/ jsxs("div", {
36
+ className: "ov-auth__account",
321
37
  children: [
322
- /*#__PURE__*/ jsxs("div", {
323
- children: [
324
- /*#__PURE__*/ jsx("h2", {
325
- children: t.application
326
- }),
327
- /*#__PURE__*/ jsx("span", {
328
- children: t.notice
329
- })
330
- ]
38
+ /*#__PURE__*/ jsx("strong", {
39
+ children: account
331
40
  }),
332
- /*#__PURE__*/ jsxs("select", {
333
- "aria-label": t.range,
334
- value: days,
335
- onChange: (event)=>onDaysChange(Number(event.target.value)),
336
- children: [
337
- /*#__PURE__*/ jsx("option", {
338
- value: 7,
339
- children: t.week
340
- }),
341
- /*#__PURE__*/ jsx("option", {
342
- value: 30,
343
- children: t.month
344
- }),
345
- /*#__PURE__*/ jsx("option", {
346
- value: 0,
347
- children: t.all
348
- })
349
- ]
41
+ /*#__PURE__*/ jsx("span", {
42
+ children: labels.account
350
43
  })
351
44
  ]
352
45
  }),
353
- /*#__PURE__*/ jsx("dl", {
354
- className: "ov-experience-dashboard__metrics",
355
- children: metrics.map((metric)=>/*#__PURE__*/ jsxs("div", {
356
- title: void 0 === metric.value ? t.unsupportedMetric : void 0,
357
- children: [
358
- metric.icon,
359
- /*#__PURE__*/ jsx("dd", {
360
- children: metric.value ?? '—'
361
- }),
362
- /*#__PURE__*/ jsx("dt", {
363
- children: metric.label
364
- })
365
- ]
366
- }, metric.label))
46
+ /*#__PURE__*/ jsx(Field, {
47
+ id: `${id}-password`,
48
+ label: labels.newPassword,
49
+ labels: labels,
50
+ value: form.values.password,
51
+ secret: true,
52
+ autoComplete: "new-password",
53
+ "aria-describedby": `${id}-hint`,
54
+ error: form.errors.password,
55
+ onChange: (value)=>form.update('password', value)
367
56
  }),
368
- /*#__PURE__*/ jsx("section", {
369
- className: "ov-experience-dashboard__distribution",
370
- "aria-label": t.outcomes,
371
- children: data.outcomes?.length ? ORDER.map((outcome)=>{
372
- const count = data.outcomes?.find((item)=>item.outcome === outcome)?.count ?? 0;
373
- return /*#__PURE__*/ jsxs("div", {
374
- className: "ov-experience-dashboard__outcome",
375
- children: [
376
- /*#__PURE__*/ jsxs("div", {
377
- children: [
378
- /*#__PURE__*/ jsx("span", {
379
- children: t[outcome]
380
- }),
381
- /*#__PURE__*/ jsx("strong", {
382
- children: count
383
- })
384
- ]
385
- }),
386
- /*#__PURE__*/ jsx("div", {
387
- className: "ov-experience-dashboard__outcome-track",
388
- "aria-hidden": "true",
389
- children: /*#__PURE__*/ jsx("span", {
390
- style: {
391
- width: `${total > 0 ? Math.max(count / total * 100, count ? 2 : 0) : 0}%`
392
- }
393
- })
394
- })
395
- ]
396
- }, outcome);
397
- }) : /*#__PURE__*/ jsx(DashboardState, {
398
- state: outcomesState,
399
- empty: t.emptyOutcomes,
400
- loading: t.loading,
401
- failed: t.failed,
402
- retry: t.retry
403
- })
57
+ /*#__PURE__*/ jsx(Field, {
58
+ id: `${id}-confirmation`,
59
+ label: labels.confirmation,
60
+ labels: labels,
61
+ value: form.values.confirmation,
62
+ secret: true,
63
+ autoComplete: "new-password",
64
+ "aria-describedby": `${id}-hint`,
65
+ error: form.errors.confirmation,
66
+ onChange: (value)=>form.update('confirmation', value)
404
67
  }),
405
- /*#__PURE__*/ jsxs("section", {
406
- className: "ov-experience-dashboard__trajectories",
407
- children: [
408
- /*#__PURE__*/ jsxs("h3", {
409
- children: [
410
- t.trajectories,
411
- void 0 === data.trajectoryTotal ? '' : ` · ${data.trajectoryTotal}`
412
- ]
413
- }),
414
- data.trajectories?.length ? /*#__PURE__*/ jsx(ExperienceTrajectories, {
415
- items: data.trajectories,
416
- onOpenUri: onOpenUri
417
- }) : /*#__PURE__*/ jsx(DashboardState, {
418
- state: trajectoriesState,
419
- empty: t.empty,
420
- loading: t.loading,
421
- failed: t.failed,
422
- retry: t.retry
423
- })
424
- ]
425
- })
426
- ]
427
- });
428
- }
429
- function CopyButton({ value, labels: t }) {
430
- const [result, setResult] = useState();
431
- const state = result?.value === value ? result.state : void 0;
432
- const copy = async ()=>{
433
- setResult({
434
- value,
435
- state: 'pending'
436
- });
437
- try {
438
- await navigator.clipboard.writeText(value);
439
- setResult({
440
- value,
441
- state: 'copied'
442
- });
443
- } catch {
444
- setResult({
445
- value,
446
- state: 'failed'
447
- });
448
- }
449
- };
450
- return /*#__PURE__*/ jsx("button", {
451
- type: "button",
452
- disabled: !value || 'pending' === state,
453
- "aria-live": "polite",
454
- onClick: ()=>void copy(),
455
- children: 'copied' === state ? t.copied : 'failed' === state ? t.copyFailed : t.copy
456
- });
457
- }
458
- function ExperienceTests({ items, labels: t, onOpenUri }) {
459
- return /*#__PURE__*/ jsx("div", {
460
- className: "ov-experience-dashboard__tests",
461
- children: items.map((item)=>/*#__PURE__*/ jsxs("article", {
462
- children: [
463
- /*#__PURE__*/ jsxs("header", {
464
- children: [
465
- /*#__PURE__*/ jsxs("div", {
466
- className: "ov-experience-dashboard__test-heading",
467
- children: [
468
- /*#__PURE__*/ jsx("strong", {
469
- children: item.title
470
- }),
471
- /*#__PURE__*/ jsxs("div", {
472
- className: "ov-experience-dashboard__test-meta",
473
- children: [
474
- /*#__PURE__*/ jsx("span", {
475
- children: t.sourceUri
476
- }),
477
- /*#__PURE__*/ jsx("code", {
478
- title: item.uri,
479
- children: item.uri ?? '—'
480
- }),
481
- item.uri ? /*#__PURE__*/ jsxs(Fragment, {
482
- children: [
483
- /*#__PURE__*/ jsx(CopyButton, {
484
- value: item.uri,
485
- labels: t
486
- }),
487
- /*#__PURE__*/ jsx("button", {
488
- type: "button",
489
- disabled: !onOpenUri,
490
- onClick: ()=>item.uri && onOpenUri?.(item.uri),
491
- children: t.open
492
- })
493
- ]
494
- }) : null
495
- ]
496
- }),
497
- item.taskQuery ? /*#__PURE__*/ jsxs("div", {
498
- className: "ov-experience-dashboard__test-meta",
499
- children: [
500
- /*#__PURE__*/ jsx("span", {
501
- children: t.task
502
- }),
503
- /*#__PURE__*/ jsx("p", {
504
- children: item.taskQuery
505
- })
506
- ]
507
- }) : null
508
- ]
509
- }),
510
- /*#__PURE__*/ jsx(CopyButton, {
511
- value: item.content,
512
- labels: t
513
- })
514
- ]
515
- }),
516
- /*#__PURE__*/ jsx("div", {
517
- className: "ov-experience-dashboard__test-content",
518
- children: item.content.split('\n').map((line, index)=>{
519
- const role = line.match(/^(User|Assistant):(.*)$/);
520
- return /*#__PURE__*/ jsx("div", {
521
- children: role ? /*#__PURE__*/ jsxs(Fragment, {
522
- children: [
523
- /*#__PURE__*/ jsxs("strong", {
524
- children: [
525
- role[1],
526
- ":"
527
- ]
528
- }),
529
- role[2]
530
- ]
531
- }) : line.startsWith('# ') ? /*#__PURE__*/ jsx("strong", {
532
- children: line
533
- }) : line || '\u00a0'
534
- }, index);
535
- })
536
- })
537
- ]
538
- }, item.id))
539
- });
540
- }
541
- function ExperiencePagination({ page, hasMore, loading, labels: t, onPageChange }) {
542
- if (!page && !hasMore) return null;
543
- return /*#__PURE__*/ jsxs("div", {
544
- className: "ov-experience-dashboard__pagination",
545
- children: [
546
- /*#__PURE__*/ jsx("button", {
547
- type: "button",
548
- disabled: !page || loading || !onPageChange,
549
- onClick: ()=>onPageChange?.(page - 1),
550
- children: t.previous
551
- }),
552
- /*#__PURE__*/ jsx("span", {
553
- children: page + 1
554
- }),
555
- /*#__PURE__*/ jsx("button", {
556
- type: "button",
557
- disabled: !hasMore || loading || !onPageChange,
558
- onClick: ()=>onPageChange?.(page + 1),
559
- children: t.next
68
+ /*#__PURE__*/ jsx("p", {
69
+ className: "ov-auth__description",
70
+ id: `${id}-hint`,
71
+ children: passwordHint
560
72
  })
561
73
  ]
562
74
  });
563
75
  }
564
- function ExperienceDashboard(props) {
565
- return /*#__PURE__*/ jsx(ExperienceDashboardContent, {
566
- ...props
567
- }, props.uri);
568
- }
569
- function ExperienceDashboardContent({ uri, data = {}, kind, tab: controlledTab, days: controlledDays, page = 0, hasMore = false, startIndex = 0, states = {}, onTabChange, onDaysChange, onPageChange, locale: localeProp, onOpenUri, labels, className, ...rest }) {
570
- const locale = useLocale(localeProp);
571
- const [localTab, setLocalTab] = useState('impact');
572
- const [localDays, setLocalDays] = useState(7);
573
- const selectedTab = controlledTab ?? localTab;
574
- const missingTest = void 0 === data.testMaterials;
575
- const tab = 'test' === selectedTab && missingTest ? 'impact' : selectedTab;
576
- if ('test' === localTab && missingTest) setLocalTab('impact');
577
- const days = controlledDays ?? localDays;
578
- const setTab = (value)=>{
579
- setLocalTab(value);
580
- onTabChange?.(value);
581
- };
582
- const setDays = (value)=>{
583
- setLocalDays(value);
584
- onDaysChange?.(value);
585
- };
586
- const t = experienceLabels(locale, labels);
587
- const directory = 'directory' === kind;
588
- const result = data;
589
- const tabs = [
590
- {
591
- key: 'impact',
592
- title: t.impact
593
- },
594
- {
595
- key: 'source',
596
- title: t.source
597
- },
598
- ...void 0 === result.testMaterials ? [] : [
599
- {
600
- key: 'test',
601
- title: t.test
602
- }
603
- ]
604
- ];
605
- const activeState = directory ? states.list : 'source' === tab ? states.sources : states.trajectories;
606
- const pagination = /*#__PURE__*/ jsx(ExperiencePagination, {
607
- page: page,
608
- hasMore: hasMore,
609
- loading: activeState?.loading,
610
- labels: t,
611
- onPageChange: onPageChange
612
- });
613
- return /*#__PURE__*/ jsx("div", {
614
- ...rest,
615
- "data-resource-uri": uri,
616
- className: [
617
- 'ov-experience-dashboard',
618
- className
619
- ].filter(Boolean).join(' '),
620
- children: directory ? /*#__PURE__*/ jsxs("div", {
621
- className: "ov-experience-dashboard__body",
622
- children: [
623
- result.experiences?.length ? /*#__PURE__*/ jsx(ExperienceList, {
624
- items: result.experiences,
625
- total: result.total,
626
- locale: locale,
627
- startIndex: startIndex,
628
- labels: t,
629
- onOpenUri: onOpenUri
630
- }) : /*#__PURE__*/ jsx(DashboardState, {
631
- state: states.list,
632
- empty: t.empty,
633
- loading: t.loading,
634
- failed: t.failed,
635
- retry: t.retry
636
- }),
637
- pagination
638
- ]
639
- }) : /*#__PURE__*/ jsx(DashboardTabs, {
640
- tabs: tabs,
641
- active: tab,
642
- label: t.title,
643
- onChange: setTab,
644
- children: /*#__PURE__*/ jsx("div", {
645
- className: "ov-experience-dashboard__body",
646
- children: 'impact' === tab ? /*#__PURE__*/ jsxs(Fragment, {
647
- children: [
648
- /*#__PURE__*/ jsx(ExperienceImpact, {
649
- data: result,
650
- labels: t,
651
- days: days,
652
- onDaysChange: setDays,
653
- outcomesState: states.outcomes ?? {},
654
- trajectoriesState: states.trajectories ?? {},
655
- onOpenUri: onOpenUri
656
- }),
657
- pagination
658
- ]
659
- }) : 'source' === tab ? result.sources?.length ? /*#__PURE__*/ jsxs("details", {
660
- open: true,
661
- className: "ov-experience-dashboard__source-group",
662
- children: [
663
- /*#__PURE__*/ jsxs("summary", {
664
- children: [
665
- /*#__PURE__*/ jsx("strong", {
666
- children: t.latest
667
- }),
668
- /*#__PURE__*/ jsx("span", {
669
- children: t.sourceCount.replace('{count}', String(result.sources.length))
670
- })
671
- ]
672
- }),
673
- /*#__PURE__*/ jsx(ExperienceTrajectories, {
674
- items: result.sources,
675
- source: true,
676
- onOpenUri: onOpenUri
677
- })
678
- ]
679
- }) : /*#__PURE__*/ jsx(DashboardState, {
680
- state: states.sources,
681
- empty: t.emptySource,
682
- loading: t.loading,
683
- failed: t.failed,
684
- retry: t.retry
685
- }) : result.testMaterials?.length ? /*#__PURE__*/ jsx(ExperienceTests, {
686
- items: result.testMaterials,
687
- labels: t,
688
- onOpenUri: onOpenUri
689
- }) : /*#__PURE__*/ jsx(DashboardState, {
690
- state: states.tests,
691
- empty: t.emptyTests,
692
- loading: t.loading,
693
- failed: t.failed,
694
- retry: t.retry
695
- })
696
- })
697
- })
698
- });
699
- }
700
- export { ExperienceDashboard };
76
+ export { PasswordSetupForm };