@openviking/react 0.1.4 → 0.1.6

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 (139) hide show
  1. package/README.md +15 -11
  2. package/dist/28~0.js +15 -0
  3. package/dist/2~0.js +6 -3
  4. package/dist/37~0.js +27 -0
  5. package/dist/3c~0.js +17 -9
  6. package/dist/3~0.js +4 -2
  7. package/dist/ae~0.js +6 -2
  8. package/dist/a~0.js +79 -72
  9. package/dist/ck~0.js +4 -0
  10. package/dist/client/paths.d.ts +4 -0
  11. package/dist/client/provider.d.ts +10 -6
  12. package/dist/components/agent-connect/agent-connect-code-block.d.ts +14 -0
  13. package/dist/components/agent-connect/agent-connect-copy.d.ts +3 -0
  14. package/dist/components/agent-connect/agent-connect-design.d.ts +1 -1
  15. package/dist/components/agent-connect/agent-connect-installer.d.ts +1 -0
  16. package/dist/components/agent-connect/agent-connect-instructions-view.d.ts +4 -6
  17. package/dist/components/agent-connect/agent-connect-instructions.d.ts +13 -0
  18. package/dist/components/agent-connect/agent-connect-markdown.d.ts +8 -2
  19. package/dist/components/agent-connect/agent-connect-mask.d.ts +10 -0
  20. package/dist/components/agent-connect/agent-connect.d.ts +1 -1
  21. package/dist/components/agent-connect/locales/en-US.d.ts +3 -0
  22. package/dist/components/agent-connect/style.css +163 -5
  23. package/dist/components/agent-connect/types.d.ts +5 -3
  24. package/dist/components/agent-connect/use-agent-connect-copy.d.ts +6 -0
  25. package/dist/components/directory-tour/style.css +46 -2
  26. package/dist/components/directory-tour/types.d.ts +2 -1
  27. package/dist/components/experience-dashboard/dashboard-tabs.d.ts +11 -0
  28. package/dist/components/experience-dashboard/experience-dashboard.d.ts +2 -0
  29. package/dist/components/experience-dashboard/experience-impact.d.ts +11 -0
  30. package/dist/components/experience-dashboard/experience-list.d.ts +9 -0
  31. package/dist/components/experience-dashboard/experience-pagination.d.ts +8 -0
  32. package/dist/components/experience-dashboard/experience-tests.d.ts +6 -0
  33. package/dist/components/experience-dashboard/experience-trajectories.d.ts +6 -0
  34. package/dist/components/experience-dashboard/index.d.ts +2 -0
  35. package/dist/components/experience-dashboard/labels.d.ts +2 -0
  36. package/dist/components/experience-dashboard/style.css +699 -0
  37. package/dist/components/experience-dashboard/style.js +0 -0
  38. package/dist/components/experience-dashboard/types.d.ts +106 -0
  39. package/dist/components/experience-dashboard.js +1 -0
  40. package/dist/components/file-browser-entries/file-browser-entries.d.ts +1 -1
  41. package/dist/components/file-browser-entries/style.css +259 -13
  42. package/dist/components/file-browser-entries/types.d.ts +2 -2
  43. package/dist/components/file-preview/style.css +48 -4
  44. package/dist/components/file-preview/types.d.ts +2 -2
  45. package/dist/components/file-tree/style.css +63 -4
  46. package/dist/components/file-tree/types.d.ts +2 -2
  47. package/dist/components/scope-switcher/scope-switcher.d.ts +2 -2
  48. package/dist/components/scope-switcher/style.css +48 -4
  49. package/dist/components/scope-switcher/types.d.ts +5 -5
  50. package/dist/components/scope-switcher.js +1 -1
  51. package/dist/components/style.css +2451 -139
  52. package/dist/components/tui/style.css +122 -36
  53. package/dist/components/tui/tui.d.ts +1 -1
  54. package/dist/components/tui/types.d.ts +2 -2
  55. package/dist/components/viking-bot/ark-message-list-view.d.ts +4 -1
  56. package/dist/components/viking-bot/interaction/types.d.ts +2 -2
  57. package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +1 -1
  58. package/dist/components/viking-bot/session-actions.d.ts +2 -2
  59. package/dist/components/viking-bot/style.css +159 -12
  60. package/dist/components/viking-bot/types.d.ts +7 -7
  61. package/dist/components/viking-bot/viking-bot.d.ts +1 -1
  62. package/dist/components/wiki-dashboard/index.d.ts +2 -0
  63. package/dist/components/wiki-dashboard/labels.d.ts +2 -0
  64. package/dist/components/wiki-dashboard/style.css +741 -0
  65. package/dist/components/wiki-dashboard/style.js +0 -0
  66. package/dist/components/wiki-dashboard/types.d.ts +92 -0
  67. package/dist/components/wiki-dashboard/wiki-action-button.d.ts +9 -0
  68. package/dist/components/wiki-dashboard/wiki-conflict-card.d.ts +15 -0
  69. package/dist/components/wiki-dashboard/wiki-dashboard.d.ts +2 -0
  70. package/dist/components/wiki-dashboard/wiki-file-icon.d.ts +3 -0
  71. package/dist/components/wiki-dashboard/wiki-severity-filter.d.ts +8 -0
  72. package/dist/components/wiki-dashboard.js +1 -0
  73. package/dist/c~0.js +169 -155
  74. package/dist/e~0.js +3 -1
  75. package/dist/fi~0.js +354 -0
  76. package/dist/fj~0.js +503 -0
  77. package/dist/f~0.js +661 -309
  78. package/dist/icons/index.d.ts +28 -0
  79. package/dist/icons.js +1 -1
  80. package/dist/index.d.ts +4 -0
  81. package/dist/index.js +3 -1
  82. package/dist/k~0.js +277 -1
  83. package/dist/lk~0.js +55 -13
  84. package/dist/l~0.js +1096 -187
  85. package/dist/modules/console/console.d.ts +1 -1
  86. package/dist/modules/console/index.d.ts +1 -2
  87. package/dist/modules/console/style.css +377 -56
  88. package/dist/modules/console/types.d.ts +2 -2
  89. package/dist/modules/console/use-console.d.ts +1 -1
  90. package/dist/modules/console.js +1 -1
  91. package/dist/modules/file-browser/dashboard-data.d.ts +9 -0
  92. package/dist/modules/file-browser/dashboard-indicator.d.ts +8 -0
  93. package/dist/modules/file-browser/dashboard-labels.d.ts +9 -0
  94. package/dist/modules/file-browser/dashboard-model.d.ts +14 -0
  95. package/dist/modules/file-browser/dashboard-resource.d.ts +12 -0
  96. package/dist/modules/file-browser/experience-dashboard-pane.d.ts +8 -0
  97. package/dist/modules/file-browser/experience-data.d.ts +31 -0
  98. package/dist/modules/file-browser/file-browser-labels.d.ts +1 -1
  99. package/dist/modules/file-browser/file-browser-tree-pane.d.ts +3 -2
  100. package/dist/modules/file-browser/file-browser.d.ts +1 -1
  101. package/dist/modules/file-browser/fs-directories.d.ts +8 -0
  102. package/dist/modules/file-browser/fs-lines.d.ts +36 -0
  103. package/dist/modules/file-browser/fs-memory-fields.d.ts +65 -0
  104. package/dist/modules/file-browser/fs-model.d.ts +12 -2
  105. package/dist/modules/file-browser/fs-read-file.d.ts +14 -0
  106. package/dist/modules/file-browser/fs-selection.d.ts +4 -0
  107. package/dist/modules/file-browser/index.d.ts +2 -2
  108. package/dist/modules/file-browser/style.css +1883 -25
  109. package/dist/modules/file-browser/types.d.ts +64 -2
  110. package/dist/modules/file-browser/use-browser-dashboards.d.ts +31 -0
  111. package/dist/modules/file-browser/use-dashboard-query.d.ts +9 -0
  112. package/dist/modules/file-browser/use-experience-dashboard.d.ts +27 -0
  113. package/dist/modules/file-browser/use-file-browser.d.ts +2 -45
  114. package/dist/modules/file-browser/use-fs-tree.d.ts +2 -0
  115. package/dist/modules/file-browser/use-wiki-dashboard.d.ts +17 -0
  116. package/dist/modules/file-browser/wiki-conflicts.d.ts +12 -0
  117. package/dist/modules/file-browser/wiki-dashboard-pane.d.ts +14 -0
  118. package/dist/modules/file-browser.js +1 -1
  119. package/dist/modules/scope-cascade/controller.d.ts +2 -2
  120. package/dist/modules/scope-cascade/index.d.ts +1 -2
  121. package/dist/modules/scope-cascade/scope-cascade.d.ts +2 -2
  122. package/dist/modules/scope-cascade/style.css +48 -4
  123. package/dist/modules/scope-cascade/types.d.ts +9 -4
  124. package/dist/modules/scope-cascade/use-scope-cascade.d.ts +2 -2
  125. package/dist/modules/scope-cascade.js +1 -1
  126. package/dist/modules/style.css +2459 -192
  127. package/dist/n~0.js +16 -130
  128. package/dist/rt~0.js +152 -0
  129. package/dist/r~0.js +17 -38
  130. package/dist/shared/components/popover/popover.d.ts +1 -1
  131. package/dist/shared/components/popover/types.d.ts +7 -1
  132. package/dist/shared/dashboard/dashboard-state.d.ts +12 -0
  133. package/dist/shared/locale-context.d.ts +8 -0
  134. package/dist/static/image/dashboard-background.png +0 -0
  135. package/dist/style.css +9445 -4822
  136. package/dist/u~0.js +324 -96
  137. package/dist/viking-bot-composer~0.js +4 -2
  138. package/dist/viking-bot-interaction~0.js +3 -1
  139. package/package.json +14 -2
File without changes
@@ -0,0 +1,92 @@
1
+ import type { HTMLAttributes } from 'react';
2
+ export interface WikiConflict {
3
+ id: string;
4
+ matchText: string;
5
+ description: string;
6
+ reason: string;
7
+ severity: 'high' | 'medium' | 'low';
8
+ state: 'unfixed' | 'fixed';
9
+ beginTime: number;
10
+ fixTime: number | null;
11
+ fixPlan: string;
12
+ resolutionBasis: string;
13
+ resolutionSource?: 'manual' | 'automatic';
14
+ location: {
15
+ status: 'unique';
16
+ start: number;
17
+ end: number;
18
+ line: number;
19
+ } | {
20
+ status: 'missing' | 'ambiguous';
21
+ };
22
+ }
23
+ export interface WikiDirectoryData {
24
+ files: readonly string[];
25
+ conflictFileCount?: number;
26
+ limited?: boolean;
27
+ }
28
+ export interface WikiFileData {
29
+ conflicts: readonly WikiConflict[];
30
+ /** Document path to display; omitted paths hide the path column. */
31
+ path?: string;
32
+ }
33
+ export type WikiDashboardData = WikiDirectoryData | WikiFileData;
34
+ export interface WikiDashboardLabels {
35
+ title: string;
36
+ pendingLabel: string;
37
+ discuss: string;
38
+ conflicts: string;
39
+ conflictFiles: string;
40
+ pending: string;
41
+ all: string;
42
+ severity: string;
43
+ high: string;
44
+ medium: string;
45
+ low: string;
46
+ fixed: string;
47
+ reason: string;
48
+ file: string;
49
+ empty: string;
50
+ loading: string;
51
+ failed: string;
52
+ retry: string;
53
+ open: string;
54
+ edit: string;
55
+ solution: string;
56
+ occurred: string;
57
+ fixedAt: string;
58
+ evidence: string;
59
+ history: string;
60
+ historyHint: string;
61
+ unavailable: string;
62
+ limited: string;
63
+ }
64
+ interface WikiDashboardCommonProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
65
+ loading?: boolean;
66
+ error?: Error | null;
67
+ locale?: 'en-US' | 'zh-CN';
68
+ onRetry?: () => void;
69
+ labels?: Partial<WikiDashboardLabels>;
70
+ }
71
+ export type WikiDashboardProps = WikiDashboardCommonProps & ({
72
+ kind: 'directory';
73
+ data?: WikiDirectoryData;
74
+ editDisabledReason?: never;
75
+ discussDisabledReason?: never;
76
+ onOpenUri?: (uri: string) => void;
77
+ onOpenDashboard?: (uri: string) => void;
78
+ onEdit?: (uri: string) => void;
79
+ onDiscuss?: never;
80
+ } | {
81
+ kind: 'file';
82
+ data?: WikiFileData;
83
+ /** Explanation shown when editing has no handler. Defaults to labels.unavailable. */
84
+ editDisabledReason?: string;
85
+ /** Explanation shown when discussion has no handler. Defaults to labels.unavailable. */
86
+ discussDisabledReason?: string;
87
+ onOpenUri?: () => void;
88
+ onOpenDashboard?: never;
89
+ onEdit?: (conflict: WikiConflict) => void;
90
+ onDiscuss?: (conflict: WikiConflict) => void;
91
+ });
92
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { ReactNode } from 'react';
2
+ export declare function WikiActionButton({ label, hint, onClick, children, ...aria }: {
3
+ label: string;
4
+ hint: string;
5
+ onClick?: () => void;
6
+ children: ReactNode;
7
+ 'aria-expanded'?: boolean;
8
+ 'aria-controls'?: string;
9
+ }): import("react").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import type { WikiConflict, WikiDashboardProps, WikiDashboardLabels } from './types.js';
2
+ export declare function WikiConflictCard({ conflict, path, labels: t, editDisabledReason, discussDisabledReason, onOpenUri, onEdit, onDiscuss, }: {
3
+ conflict: WikiConflict;
4
+ path?: string;
5
+ labels: WikiDashboardLabels;
6
+ editDisabledReason?: string;
7
+ discussDisabledReason?: string;
8
+ onOpenUri?: () => void;
9
+ onEdit?: Extract<WikiDashboardProps, {
10
+ kind: 'file';
11
+ }>['onEdit'];
12
+ onDiscuss?: Extract<WikiDashboardProps, {
13
+ kind: 'file';
14
+ }>['onDiscuss'];
15
+ }): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { WikiDashboardProps } from './types.js';
2
+ export declare function WikiDashboard(props: WikiDashboardProps): import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare function WikiFileIcon({ name }: {
2
+ name: string;
3
+ }): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import type { WikiConflict, WikiDashboardLabels } from './types.js';
2
+ type Severity = WikiConflict['severity'] | 'all';
3
+ export declare function WikiSeverityFilter({ value, onChange, labels: t, }: {
4
+ value: Severity;
5
+ onChange: (value: Severity) => void;
6
+ labels: WikiDashboardLabels;
7
+ }): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1 @@
1
+ export { WikiDashboard } from "../fj~0.js";
package/dist/c~0.js CHANGED
@@ -3,7 +3,8 @@ import { Suspense, createContext, forwardRef, lazy, useContext, useEffect, useId
3
3
  import { createPortal } from "react-dom";
4
4
  import { resolveLocale } from "./nx~0.js";
5
5
  import { useOverlayPosition } from "./o~0.js";
6
- import { Tooltip } from "./r~0.js";
6
+ import { useLocale, LocaleProvider } from "./28~0.js";
7
+ import { Tooltip } from "./rt~0.js";
7
8
  import { VikingBotIcon } from "./lg~0.js";
8
9
  import { VikingBotInteraction } from "./w~0.js";
9
10
  const en_US_messages = {
@@ -186,98 +187,102 @@ function BotPopover({ label, trigger: renderTrigger, children, placement = 'bott
186
187
  ]
187
188
  });
188
189
  }
189
- function VikingBotSessionActions({ sessions, extra, labels: overrides, locale }) {
190
+ function VikingBotSessionActions({ sessions, extra, labels: overrides, locale: localeProp }) {
191
+ const locale = useLocale(localeProp);
190
192
  const labels = resolveVikingBotLabels(locale, overrides);
191
- return /*#__PURE__*/ jsxs("div", {
192
- className: "ov-viking-bot__session-actions",
193
- children: [
194
- extra,
195
- sessions ? /*#__PURE__*/ jsxs(Fragment, {
196
- children: [
197
- /*#__PURE__*/ jsx(BotPopover, {
198
- label: labels.sessionHistory,
199
- onOpen: sessions.onOpenHistory,
200
- trigger: (props)=>/*#__PURE__*/ jsx(Tooltip, {
201
- content: labels.sessionHistory,
202
- disabled: true === props['aria-expanded'],
203
- children: /*#__PURE__*/ jsx("button", {
204
- ...props,
205
- type: "button",
206
- className: "ov-viking-bot__header-action",
207
- "aria-label": labels.sessionHistory,
208
- children: /*#__PURE__*/ jsx(VikingBotIcon, {
209
- name: "history"
193
+ return /*#__PURE__*/ jsx(LocaleProvider, {
194
+ locale: locale,
195
+ children: /*#__PURE__*/ jsxs("div", {
196
+ className: "ov-viking-bot__session-actions",
197
+ children: [
198
+ extra,
199
+ sessions ? /*#__PURE__*/ jsxs(Fragment, {
200
+ children: [
201
+ /*#__PURE__*/ jsx(BotPopover, {
202
+ label: labels.sessionHistory,
203
+ onOpen: sessions.onOpenHistory,
204
+ trigger: (props)=>/*#__PURE__*/ jsx(Tooltip, {
205
+ content: labels.sessionHistory,
206
+ disabled: true === props['aria-expanded'],
207
+ children: /*#__PURE__*/ jsx("button", {
208
+ ...props,
209
+ type: "button",
210
+ className: "ov-viking-bot__header-action",
211
+ "aria-label": labels.sessionHistory,
212
+ children: /*#__PURE__*/ jsx(VikingBotIcon, {
213
+ name: "history"
214
+ })
210
215
  })
216
+ }),
217
+ children: (close)=>/*#__PURE__*/ jsxs("div", {
218
+ className: "ov-viking-bot__session-history",
219
+ "aria-busy": sessions.isLoading,
220
+ children: [
221
+ sessions.isLoading ? /*#__PURE__*/ jsx("p", {
222
+ role: "status",
223
+ children: labels.loading
224
+ }) : null,
225
+ sessions.error ? /*#__PURE__*/ jsx("p", {
226
+ role: "alert",
227
+ children: sessions.error
228
+ }) : null,
229
+ sessions.isLoading || sessions.error || sessions.items.length ? null : /*#__PURE__*/ jsx("p", {
230
+ className: "ov-viking-bot__empty-history",
231
+ children: labels.emptySessions
232
+ }),
233
+ /*#__PURE__*/ jsx("ul", {
234
+ children: sessions.items.map((item)=>{
235
+ const date = new Date(item.updatedAt ?? '');
236
+ const validDate = Number.isFinite(date.getTime());
237
+ return /*#__PURE__*/ jsx("li", {
238
+ children: /*#__PURE__*/ jsxs("button", {
239
+ type: "button",
240
+ "aria-current": sessions.currentId === item.id || void 0,
241
+ onClick: ()=>{
242
+ close();
243
+ sessions.onSelect(item.id);
244
+ },
245
+ children: [
246
+ /*#__PURE__*/ jsx("span", {
247
+ children: item.title
248
+ }),
249
+ validDate ? /*#__PURE__*/ jsx("time", {
250
+ dateTime: item.updatedAt,
251
+ children: new Intl.DateTimeFormat(locale, {
252
+ dateStyle: 'short',
253
+ timeStyle: 'short'
254
+ }).format(date)
255
+ }) : null
256
+ ]
257
+ })
258
+ }, item.id);
259
+ })
260
+ }),
261
+ sessions.hasMore && sessions.onLoadMore ? /*#__PURE__*/ jsx("button", {
262
+ type: "button",
263
+ disabled: sessions.isLoading,
264
+ onClick: sessions.onLoadMore,
265
+ children: labels.loadMore
266
+ }) : null
267
+ ]
268
+ })
269
+ }),
270
+ /*#__PURE__*/ jsx(Tooltip, {
271
+ content: labels.newSession,
272
+ children: /*#__PURE__*/ jsx("button", {
273
+ type: "button",
274
+ className: "ov-viking-bot__header-action",
275
+ "aria-label": labels.newSession,
276
+ onClick: sessions.onNew,
277
+ children: /*#__PURE__*/ jsx(VikingBotIcon, {
278
+ name: "newSession"
211
279
  })
212
- }),
213
- children: (close)=>/*#__PURE__*/ jsxs("div", {
214
- className: "ov-viking-bot__session-history",
215
- "aria-busy": sessions.isLoading,
216
- children: [
217
- sessions.isLoading ? /*#__PURE__*/ jsx("p", {
218
- role: "status",
219
- children: labels.loading
220
- }) : null,
221
- sessions.error ? /*#__PURE__*/ jsx("p", {
222
- role: "alert",
223
- children: sessions.error
224
- }) : null,
225
- sessions.isLoading || sessions.error || sessions.items.length ? null : /*#__PURE__*/ jsx("p", {
226
- className: "ov-viking-bot__empty-history",
227
- children: labels.emptySessions
228
- }),
229
- /*#__PURE__*/ jsx("ul", {
230
- children: sessions.items.map((item)=>{
231
- const date = new Date(item.updatedAt ?? '');
232
- const validDate = Number.isFinite(date.getTime());
233
- return /*#__PURE__*/ jsx("li", {
234
- children: /*#__PURE__*/ jsxs("button", {
235
- type: "button",
236
- "aria-current": sessions.currentId === item.id || void 0,
237
- onClick: ()=>{
238
- close();
239
- sessions.onSelect(item.id);
240
- },
241
- children: [
242
- /*#__PURE__*/ jsx("span", {
243
- children: item.title
244
- }),
245
- validDate ? /*#__PURE__*/ jsx("time", {
246
- dateTime: item.updatedAt,
247
- children: new Intl.DateTimeFormat(locale, {
248
- dateStyle: 'short',
249
- timeStyle: 'short'
250
- }).format(date)
251
- }) : null
252
- ]
253
- })
254
- }, item.id);
255
- })
256
- }),
257
- sessions.hasMore && sessions.onLoadMore ? /*#__PURE__*/ jsx("button", {
258
- type: "button",
259
- disabled: sessions.isLoading,
260
- onClick: sessions.onLoadMore,
261
- children: labels.loadMore
262
- }) : null
263
- ]
264
- })
265
- }),
266
- /*#__PURE__*/ jsx(Tooltip, {
267
- content: labels.newSession,
268
- children: /*#__PURE__*/ jsx("button", {
269
- type: "button",
270
- className: "ov-viking-bot__header-action",
271
- "aria-label": labels.newSession,
272
- onClick: sessions.onNew,
273
- children: /*#__PURE__*/ jsx(VikingBotIcon, {
274
- name: "newSession"
275
280
  })
276
281
  })
277
- })
278
- ]
279
- }) : null
280
- ]
282
+ ]
283
+ }) : null
284
+ ]
285
+ })
281
286
  });
282
287
  }
283
288
  function QuickInputs({ items, onSelect, disabled }) {
@@ -555,7 +560,8 @@ function ListSkeleton() {
555
560
  });
556
561
  }
557
562
  function VikingBotMessageList(props) {
558
- const labels = resolveVikingBotLabels(props.locale, props.labels);
563
+ const locale = useLocale(props.locale);
564
+ const labels = resolveVikingBotLabels(locale, props.labels);
559
565
  const items = toRenderItems(props.messages, props.streaming);
560
566
  if (0 === items.length) return /*#__PURE__*/ jsx("div", {
561
567
  className: "ov-viking-bot__empty",
@@ -564,11 +570,13 @@ function VikingBotMessageList(props) {
564
570
  return /*#__PURE__*/ jsx(Suspense, {
565
571
  fallback: /*#__PURE__*/ jsx(ListSkeleton, {}),
566
572
  children: /*#__PURE__*/ jsx(List, {
567
- ...props
573
+ ...props,
574
+ locale: locale
568
575
  })
569
576
  });
570
577
  }
571
- function VikingBot({ messages, className, streaming, draft, attachments, isSending, isAvailable = true, unavailableMessage, emptyState, header, sessions, headerActions, locale, quickInputs, onQuickInputSelect, references, footer, children, messageList, composer, interaction, interactionSlot, listKey, composerRef, onDraftChange, onFilesAdded, onAttachmentRemove, onSend, onCancel, onOpenUri, onCopy, onMessageAction, labels: overrides, ...rest }) {
578
+ function VikingBot({ messages, className, streaming, draft, attachments, isSending, isAvailable = true, unavailableMessage, emptyState, header, sessions, headerActions, locale: localeProp, quickInputs, onQuickInputSelect, references, footer, children, messageList, composer, interaction, interactionSlot, listKey, composerRef, onDraftChange, onFilesAdded, onAttachmentRemove, onSend, onCancel, onOpenUri, onCopy, onMessageAction, labels: overrides, ...rest }) {
579
+ const locale = useLocale(localeProp);
572
580
  const labels = resolveVikingBotLabels(locale, overrides);
573
581
  const hasMessages = messages.length > 0;
574
582
  const localComposer = useRef(null);
@@ -593,75 +601,81 @@ function VikingBot({ messages, className, streaming, draft, attachments, isSendi
593
601
  className
594
602
  ].filter(Boolean).join(' '),
595
603
  ...rest,
596
- children: children
604
+ children: /*#__PURE__*/ jsx(LocaleProvider, {
605
+ locale: locale,
606
+ children: children
607
+ })
597
608
  });
598
609
  return /*#__PURE__*/ jsx(QuickInputScope.Provider, {
599
610
  value: shortcuts.tracker,
600
- children: /*#__PURE__*/ jsxs("div", {
601
- className: [
602
- 'ov-viking-bot',
603
- className
604
- ].filter(Boolean).join(' '),
605
- ...rest,
606
- children: [
607
- renderedHeader ? /*#__PURE__*/ jsx("div", {
608
- className: "ov-viking-bot__header",
609
- children: renderedHeader
610
- }) : null,
611
- isAvailable ? null : /*#__PURE__*/ jsx("p", {
612
- className: "ov-viking-bot__unavailable",
613
- role: "status",
614
- children: unavailableMessage ?? labels.unavailable
615
- }),
616
- /*#__PURE__*/ jsx("div", {
617
- className: "ov-viking-bot__body",
618
- children: void 0 !== messageList ? messageList : hasMessages || streaming ? /*#__PURE__*/ jsx(VikingBotMessageList, {
611
+ children: /*#__PURE__*/ jsx(LocaleProvider, {
612
+ locale: locale,
613
+ children: /*#__PURE__*/ jsxs("div", {
614
+ className: [
615
+ 'ov-viking-bot',
616
+ className
617
+ ].filter(Boolean).join(' '),
618
+ ...rest,
619
+ children: [
620
+ renderedHeader ? /*#__PURE__*/ jsx("div", {
621
+ className: "ov-viking-bot__header",
622
+ children: renderedHeader
623
+ }) : null,
624
+ isAvailable ? null : /*#__PURE__*/ jsx("p", {
625
+ className: "ov-viking-bot__unavailable",
626
+ role: "status",
627
+ children: unavailableMessage ?? labels.unavailable
628
+ }),
629
+ /*#__PURE__*/ jsx("div", {
630
+ className: "ov-viking-bot__body",
631
+ children: void 0 !== messageList ? messageList : hasMessages || streaming ? /*#__PURE__*/ jsx(VikingBotMessageList, {
632
+ locale: locale,
633
+ messages: messages,
634
+ streaming: streaming,
635
+ listKey: listKey,
636
+ onOpenUri: onOpenUri,
637
+ onCopy: onCopy,
638
+ onMessageAction: onMessageAction,
639
+ labels: overrides
640
+ }) : /*#__PURE__*/ jsx("div", {
641
+ className: `ov-viking-bot__empty${void 0 === emptyState ? ' ov-viking-bot__empty--welcome' : ''}`,
642
+ children: void 0 === emptyState ? /*#__PURE__*/ jsx(VikingBotWelcome, {
643
+ labels: labels,
644
+ quickInputs: quickInputs,
645
+ onSelect: selectQuickInput,
646
+ disabled: isSending || !isAvailable || !onDraftChange && !onQuickInputSelect
647
+ }) : emptyState
648
+ })
649
+ }),
650
+ footer ? /*#__PURE__*/ jsx("div", {
651
+ className: "ov-viking-bot__footer",
652
+ children: footer
653
+ }) : null,
654
+ interaction ? interactionSlot ?? /*#__PURE__*/ jsx(VikingBotInteraction, {
655
+ ...interaction,
656
+ locale: interaction.locale ?? locale
657
+ }) : composer ?? (void 0 !== draft ? /*#__PURE__*/ jsx(lazy_composer_VikingBotComposer, {
619
658
  locale: locale,
620
- messages: messages,
621
- streaming: streaming,
622
- listKey: listKey,
623
- onOpenUri: onOpenUri,
624
- onCopy: onCopy,
625
- onMessageAction: onMessageAction,
659
+ ref: inputRef,
660
+ value: draft,
661
+ attachments: attachments,
662
+ disabled: !isAvailable,
663
+ isSending: isSending,
664
+ references: references,
665
+ quickInputs: hasMessages || streaming || void 0 !== emptyState ? quickInputs : void 0,
666
+ onQuickInputSelect: selectQuickInput,
667
+ onValueChange: onDraftChange ? (next)=>{
668
+ shortcuts.tracker.edit(next);
669
+ onDraftChange(next);
670
+ } : void 0,
671
+ onFilesAdded: onFilesAdded,
672
+ onAttachmentRemove: onAttachmentRemove,
673
+ onSend: onSend,
674
+ onCancel: onCancel,
626
675
  labels: overrides
627
- }) : /*#__PURE__*/ jsx("div", {
628
- className: `ov-viking-bot__empty${void 0 === emptyState ? ' ov-viking-bot__empty--welcome' : ''}`,
629
- children: void 0 === emptyState ? /*#__PURE__*/ jsx(VikingBotWelcome, {
630
- labels: labels,
631
- quickInputs: quickInputs,
632
- onSelect: selectQuickInput,
633
- disabled: isSending || !isAvailable || !onDraftChange && !onQuickInputSelect
634
- }) : emptyState
635
- })
636
- }),
637
- footer ? /*#__PURE__*/ jsx("div", {
638
- className: "ov-viking-bot__footer",
639
- children: footer
640
- }) : null,
641
- interaction ? interactionSlot ?? /*#__PURE__*/ jsx(VikingBotInteraction, {
642
- ...interaction,
643
- locale: locale
644
- }) : composer ?? (void 0 !== draft ? /*#__PURE__*/ jsx(lazy_composer_VikingBotComposer, {
645
- locale: locale,
646
- ref: inputRef,
647
- value: draft,
648
- attachments: attachments,
649
- disabled: !isAvailable,
650
- isSending: isSending,
651
- references: references,
652
- quickInputs: hasMessages || streaming || void 0 !== emptyState ? quickInputs : void 0,
653
- onQuickInputSelect: selectQuickInput,
654
- onValueChange: onDraftChange ? (next)=>{
655
- shortcuts.tracker.edit(next);
656
- onDraftChange(next);
657
- } : void 0,
658
- onFilesAdded: onFilesAdded,
659
- onAttachmentRemove: onAttachmentRemove,
660
- onSend: onSend,
661
- onCancel: onCancel,
662
- labels: overrides
663
- }) : null)
664
- ]
676
+ }) : null)
677
+ ]
678
+ })
665
679
  })
666
680
  });
667
681
  }
package/dist/e~0.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useId, useRef, useState } from "react";
3
3
  import { createPortal } from "react-dom";
4
+ import { useLocale } from "./28~0.js";
4
5
  import { resolveLocale } from "./nx~0.js";
5
6
  function useTourAnchor(target, locateTarget, timeout, attempt) {
6
7
  const [state, setState] = useState({
@@ -197,7 +198,8 @@ function TourSession(props) {
197
198
  advance: advance
198
199
  }, step.id);
199
200
  }
200
- function TourStep({ step, index, advance, steps, locateTarget, locateTimeout = 10000, placement = 'right', onClose, labels, locale, className, style }) {
201
+ function TourStep({ step, index, advance, steps, locateTarget, locateTimeout = 10000, placement = 'right', onClose, labels, locale: localeProp, className, style }) {
202
+ const locale = useLocale(localeProp);
201
203
  const text = resolveLocale({
202
204
  'en-US': en_US,
203
205
  'zh-CN': zh_CN