@factorialco/f0-react 4.14.1 → 4.15.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.
package/dist/ai.d.ts CHANGED
@@ -254,6 +254,12 @@ export declare type AiChatMode = "chat" | "voice";
254
254
  */
255
255
  export declare type AiChatProviderProps = {
256
256
  enabled?: boolean;
257
+ /**
258
+ * Edge the whole side panel docks to (AI chat, hosted content and canvas).
259
+ * Hosts set "left" for a chat-first experience (e.g. communications).
260
+ * @default "right"
261
+ */
262
+ side?: "left" | "right";
257
263
  /**
258
264
  * Greeting phrase(s) shown by the welcome screen when the chat is empty.
259
265
  * A single string renders once; an array rotates through phrases. Purely
@@ -478,6 +484,28 @@ declare type AiChatProviderReturnValue = {
478
484
  pendingQuote: PendingQuote | null;
479
485
  /** Set the pending quote (pass null to clear). */
480
486
  setPendingQuote: React.Dispatch<React.SetStateAction<PendingQuote | null>>;
487
+ /**
488
+ * Content currently hosted in the side panel, or `null` to show the F0.ai
489
+ * chat. Only one is mounted at a time — see {@link SidePanelContent}.
490
+ */
491
+ panelContent: SidePanelContent | null;
492
+ /**
493
+ * Mount `content` in the side panel (replacing whatever was there) and open
494
+ * the panel. Pass `null` to fall back to the AI chat. The previous content
495
+ * is unmounted thanks to the `id` key.
496
+ */
497
+ setPanelContent: (content: SidePanelContent | null) => void;
498
+ /** Clear the custom panel content and fall back to the F0.ai chat. */
499
+ clearPanelContent: () => void;
500
+ /**
501
+ * Edge the whole side panel docks to — the AI chat, hosted content and the
502
+ * canvas all follow it. Defaults to "right". Hosts flip it to "left" for a
503
+ * chat-first experience (e.g. communications), where left is comfier to
504
+ * navigate between conversations.
505
+ */
506
+ panelSide: "left" | "right";
507
+ /** Set which edge the side panel docks to. */
508
+ setPanelSide: React.Dispatch<React.SetStateAction<"left" | "right">>;
481
509
  } & Pick<AiChatState, "agent" | "chatHeader" | "chatMessages" | "chatInput" | "disclaimer" | "resizable" | "entityRefs" | "canvasActions" | "canvasEntities" | "credits" | "employeeCredits" | "creditWarning" | "fileAttachments" | "onTranscribe"> & {
482
510
  /** The current canvas content, or null when canvas is closed */
483
511
  canvasContent: CanvasContent | null;
@@ -500,6 +528,8 @@ declare type AiChatProviderReturnValue = {
500
528
  */
501
529
  declare interface AiChatState {
502
530
  enabled: boolean;
531
+ /** Initial edge the panel docks to. @default "right" */
532
+ side?: "left" | "right";
503
533
  agent?: string;
504
534
  initialMessage?: string | string[];
505
535
  chatHeader?: React.ReactNode;
@@ -1505,6 +1535,14 @@ export declare interface ClarifyingStepState extends ClarifyingStepData {
1505
1535
  isCustomAnswerActive: boolean;
1506
1536
  }
1507
1537
 
1538
+ export declare function CollapsibleGroup({ label, threads, pinnedIds, onSelect, onPin, onUnpin, onDelete, }: CollapsibleGroupProps): JSX_2.Element;
1539
+
1540
+ declare interface CollapsibleGroupProps extends ThreadActionHandlers {
1541
+ label: string;
1542
+ threads: ChatThread[];
1543
+ pinnedIds: Set<string>;
1544
+ }
1545
+
1508
1546
  export declare interface CollectionComputation {
1509
1547
  datasetId: string;
1510
1548
  sortBy?: string;
@@ -2261,6 +2299,86 @@ export declare const defaultTranslations: {
2261
2299
  };
2262
2300
  };
2263
2301
  };
2302
+ readonly chat: {
2303
+ readonly placeholder: "Write something here..";
2304
+ readonly searchPlaceholder: "Search messages";
2305
+ readonly closeSearch: "Close search";
2306
+ readonly noResults: "No chats found";
2307
+ readonly backToLatest: "Jump to latest";
2308
+ readonly muted: "Muted";
2309
+ readonly attachFile: "Attach file";
2310
+ readonly addEmoji: "Add emoji";
2311
+ readonly recordAudio: "Record audio";
2312
+ readonly listening: "Listening…";
2313
+ readonly stopRecording: "Stop and transcribe";
2314
+ readonly cancelRecording: "Cancel recording";
2315
+ readonly dropFilesHere: "Drop your files here";
2316
+ readonly removeFile: "Remove";
2317
+ readonly tooManyFilesError: "You can attach up to {{maxFiles}} files at once";
2318
+ readonly fileUploadError: "Upload failed";
2319
+ readonly micPermissionDenied: "Microphone access is blocked. Allow it in your browser settings to dictate.";
2320
+ readonly micError: "Couldn't access the microphone.";
2321
+ readonly transcriptionError: "Couldn't transcribe the audio. Try again.";
2322
+ readonly sent: "Sent";
2323
+ readonly read: "Read";
2324
+ readonly readBy: {
2325
+ readonly one: "Read by {{count}}";
2326
+ readonly other: "Read by {{count}}";
2327
+ };
2328
+ readonly delivered: "Delivered";
2329
+ readonly back: "Back";
2330
+ readonly writing: "Writing…";
2331
+ readonly isTyping: "{{name}} is writing…";
2332
+ readonly twoTyping: "{{first}} and {{second}} are writing…";
2333
+ readonly severalTyping: "Several people are writing…";
2334
+ readonly deletedMessage: "Message deleted";
2335
+ readonly moreActions: "Message actions";
2336
+ readonly options: "Options";
2337
+ readonly pin: "Pin";
2338
+ readonly unpin: "Unpin";
2339
+ readonly info: "Info";
2340
+ readonly viewProfile: "View profile";
2341
+ readonly mentionEveryone: "here";
2342
+ readonly mentionEveryoneDescription: "Notify everyone in this group";
2343
+ readonly reply: "Reply";
2344
+ readonly react: "Add reaction";
2345
+ readonly download: "Download";
2346
+ readonly removeQuote: "Remove quote";
2347
+ readonly edit: "Edit";
2348
+ readonly editing: "Editing";
2349
+ readonly edited: "edited";
2350
+ readonly cancelEdit: "Cancel edit";
2351
+ readonly saveEdit: "Save";
2352
+ readonly you: "You";
2353
+ readonly openImage: "Open image";
2354
+ readonly imagePreview: "Image preview";
2355
+ readonly closePreview: "Close";
2356
+ readonly previousImage: "Previous image";
2357
+ readonly nextImage: "Next image";
2358
+ readonly photo: "Photo";
2359
+ readonly photoCount: {
2360
+ readonly one: "{{count}} photo";
2361
+ readonly other: "{{count}} photos";
2362
+ };
2363
+ readonly fileCount: {
2364
+ readonly one: "{{count}} file";
2365
+ readonly other: "{{count}} files";
2366
+ };
2367
+ readonly attachmentCount: {
2368
+ readonly one: "{{count}} attachment";
2369
+ readonly other: "{{count}} attachments";
2370
+ };
2371
+ readonly scrollToBottom: "Scroll to bottom";
2372
+ readonly newMessages: "New messages";
2373
+ readonly unreadCount: {
2374
+ readonly one: "{{count}} unread";
2375
+ readonly other: "{{count}} unread";
2376
+ };
2377
+ readonly emptyConversation: "No messages yet";
2378
+ readonly emptyConversationDescription: "Send a message to start the conversation.";
2379
+ readonly error: "Couldn't load this conversation";
2380
+ readonly loadingOlder: "Loading earlier messages…";
2381
+ };
2264
2382
  readonly dataChart: {
2265
2383
  readonly heatmapNotSupported: "Heatmap not supported at this size";
2266
2384
  readonly barChartVertical: "Bar (vertical)";
@@ -2676,6 +2794,16 @@ export declare interface F0ActionItemProps {
2676
2794
  */
2677
2795
  export declare const F0AiChat: ({ header: headerProp, messages: messagesProp, input: inputProp, }: F0AiChatProps) => JSX_2.Element | null;
2678
2796
 
2797
+ /**
2798
+ * The AI chat credits / settings popover button, on its own. Use it to surface
2799
+ * the popover outside the chat header — e.g. from a sidebar that already owns
2800
+ * the chat navigation (history, new chat), leaving the header minimal.
2801
+ */
2802
+ export declare const F0AiChatCreditsButton: ({ credits, employeeCredits, trigger, }: Pick<F0AiChatHeaderProps, "credits" | "employeeCredits"> & {
2803
+ /** Custom popover trigger (asChild). Defaults to the Sliders icon button. */
2804
+ trigger?: ReactNode;
2805
+ }) => JSX_2.Element | null;
2806
+
2679
2807
  /**
2680
2808
  * Headless chat header. Renders a top bar with title (or thread selector),
2681
2809
  * credits popover, fullscreen toggle and close button. Has two visual
@@ -2686,7 +2814,7 @@ export declare const F0AiChat: ({ header: headerProp, messages: messagesProp, in
2686
2814
  *
2687
2815
  * Decoupled from CopilotKit and `useAiChat()` — everything via props.
2688
2816
  */
2689
- export declare const F0AiChatHeader: ({ historyEnabled, title, currentThreadTitle, fullscreen, lockVisualizationMode, onToggleVisualizationMode, onClose, onNewChat, onOpenHistory, hasMessages, credits, employeeCredits, }: F0AiChatHeaderProps) => JSX_2.Element;
2817
+ export declare const F0AiChatHeader: ({ historyEnabled, title, currentThreadTitle, fullscreen, lockVisualizationMode, onToggleVisualizationMode, onClose, onNewChat, onOpenHistory, hasMessages, credits, employeeCredits, compact, }: F0AiChatHeaderProps) => JSX_2.Element;
2690
2818
 
2691
2819
  export declare type F0AiChatHeaderProps = {
2692
2820
  /**
@@ -2720,6 +2848,12 @@ export declare type F0AiChatHeaderProps = {
2720
2848
  onOpenHistory?: () => void;
2721
2849
  /** Legacy variant gate: only renders the "new chat" button when true. */
2722
2850
  hasMessages?: boolean;
2851
+ /**
2852
+ * Minimal header: render only the expand + close controls (no title, new
2853
+ * chat or credits popover). Use when a sidebar owns the chat navigation and
2854
+ * the credits/settings popover (see `F0AiChatCreditsButton`).
2855
+ */
2856
+ compact?: boolean;
2723
2857
  /** Credits configuration. When present, renders the credits popover button. */
2724
2858
  credits?: AiChatCredits;
2725
2859
  /**
@@ -2781,7 +2915,7 @@ export declare interface F0AiChatProps {
2781
2915
  /**
2782
2916
  * @experimental This is an experimental component use it at your own risk
2783
2917
  */
2784
- export declare const F0AiChatProvider: ({ enabled, initialMessage, chatHeader, chatMessages, chatInput, welcomeScreenSuggestions, disclaimer, resizable, defaultVisualizationMode, lockVisualizationMode, historyEnabled, footer, VoiceMode, entityRefs, canvasActions, canvasEntities, credits, employeeCredits, creditWarning, fileAttachments, onTranscribe, onThumbsUp, onThumbsDown, children, agent, tracking, }: AiChatProviderProps) => JSX_2.Element;
2918
+ export declare const F0AiChatProvider: ({ enabled, side, initialMessage, chatHeader, chatMessages, chatInput, welcomeScreenSuggestions, disclaimer, resizable, defaultVisualizationMode, lockVisualizationMode, historyEnabled, footer, VoiceMode, entityRefs, canvasActions, canvasEntities, credits, employeeCredits, creditWarning, fileAttachments, onTranscribe, onThumbsUp, onThumbsDown, children, agent, tracking, }: AiChatProviderProps) => JSX_2.Element;
2785
2919
 
2786
2920
  /**
2787
2921
  * Headless chat composer.
@@ -3359,7 +3493,7 @@ export declare type F0CanvasCardProps = {
3359
3493
  * Headless: no CopilotKit or `useAiChat()` dependency — the host wires
3360
3494
  * `content`, `onClose` and `entities` directly.
3361
3495
  */
3362
- export declare function F0CanvasPanel({ content, onClose, entities, }: F0CanvasPanelProps): ReactNode;
3496
+ export declare function F0CanvasPanel({ content, onClose, entities, side, }: F0CanvasPanelProps): ReactNode;
3363
3497
 
3364
3498
  export declare namespace F0CanvasPanel {
3365
3499
  var displayName: string;
@@ -3372,6 +3506,12 @@ export declare type F0CanvasPanelProps = {
3372
3506
  onClose: () => void;
3373
3507
  /** Canvas entity registry keyed by `CanvasContent["type"]`. */
3374
3508
  entities?: Record<string, CanvasEntityDefinition<any>>;
3509
+ /**
3510
+ * Edge the adjacent chat panel docks to. The canvas hugs the seam on the
3511
+ * opposite side, so the rounded corner / open border face the chat.
3512
+ * Defaults to "right" (chat on the right -> canvas seam on its right).
3513
+ */
3514
+ side?: "left" | "right";
3375
3515
  };
3376
3516
 
3377
3517
  declare interface F0CardHorizontalProps {
@@ -4426,6 +4566,17 @@ export declare interface ResolvedStepAnswer {
4426
4566
 
4427
4567
  declare type SetFormCardValueFormatter = <T = unknown>(entry: FormCardValueFormatterEntry<T>) => void;
4428
4568
 
4569
+ /**
4570
+ * A single piece of content hosted in the side panel — the same resizable +
4571
+ * fullscreen space the F0.ai chat lives in. Only one is mounted at a time:
4572
+ * the `id` keys the content so switching conversations unmounts the previous
4573
+ * one and mounts the new. `panelContent === null` falls back to the AI chat.
4574
+ */
4575
+ export declare type SidePanelContent = {
4576
+ id: string;
4577
+ content: React.ReactNode;
4578
+ };
4579
+
4429
4580
  export declare type SparklineDataPoint = {
4430
4581
  value: number;
4431
4582
  };
@@ -4510,6 +4661,32 @@ export declare interface ThreadGroup {
4510
4661
  threads: ChatThread[];
4511
4662
  }
4512
4663
 
4664
+ export declare function ThreadItem({ thread, isPinned, isActive, isPending, onSelect, onPin, onUnpin, onDelete, className, }: ThreadItemProps): JSX_2.Element;
4665
+
4666
+ declare interface ThreadItemProps extends ThreadActionHandlers {
4667
+ thread: ChatThread;
4668
+ isPinned: boolean;
4669
+ /** Keeps the row highlighted while its thread is the one open in the panel. */
4670
+ isActive?: boolean;
4671
+ /**
4672
+ * A pin/unpin/delete request for this thread is in flight. Replaces the
4673
+ * actions button with a spinner (kept visible off-hover) so the row reads as
4674
+ * "saving" while the backend confirms. Wire it from `useChatHistory`'s
4675
+ * `pendingIds`.
4676
+ */
4677
+ isPending?: boolean;
4678
+ /** Override the row classes (e.g. to match the sidebar's chat-row paddings). */
4679
+ className?: string;
4680
+ }
4681
+
4682
+ /**
4683
+ * Loading placeholder for the chat-history thread list. Mirrors the real
4684
+ * layout: a couple of collapsible groups, each with a short title and a few
4685
+ * title-only rows of varying width (no avatar or trailing actions — those only
4686
+ * appear on hover).
4687
+ */
4688
+ export declare function ThreadListSkeleton(): JSX_2.Element;
4689
+
4513
4690
  /**
4514
4691
  * Transcribes a recorded audio blob to text (voice dictation). The returned
4515
4692
  * promise resolves with the final transcript; `onPartial` delivers
@@ -4576,7 +4753,7 @@ export declare function useCanvasEntity(type: string | undefined): CanvasEntityD
4576
4753
  * URLs, auth headers or fetch wiring. Manages pinned threads in
4577
4754
  * localStorage and the threads list (loading/error/data).
4578
4755
  */
4579
- export declare function useChatHistory({ enabled, fetchThreads: fetchThreadsCb, deleteThread: deleteThreadCb, }: UseChatHistoryOptions): UseChatHistoryReturn;
4756
+ export declare function useChatHistory({ enabled, fetchThreads: fetchThreadsCb, deleteThread: deleteThreadCb, pinThread: pinThreadCb, unpinThread: unpinThreadCb, }: UseChatHistoryOptions): UseChatHistoryReturn;
4580
4757
 
4581
4758
  declare type UseChatHistoryOptions = {
4582
4759
  /** When true, fetches threads on mount. Default: `false`. */
@@ -4591,6 +4768,16 @@ declare type UseChatHistoryOptions = {
4591
4768
  * failure; the hook will then re-fetch to restore consistency.
4592
4769
  */
4593
4770
  deleteThread: (id: string) => Promise<void>;
4771
+ /**
4772
+ * Optional async persisters for the pin state (e.g. a Stream-backed mutation
4773
+ * in the host app). When provided, pin/unpin become host-backed: the change
4774
+ * is applied optimistically (the row moves between groups at once), the id is
4775
+ * marked in `pendingIds` while the request is in flight, and the change is
4776
+ * rolled back if the callback rejects. When omitted, the pin state is kept
4777
+ * locally in localStorage as before — synchronous and never pending.
4778
+ */
4779
+ pinThread?: (id: string) => Promise<void>;
4780
+ unpinThread?: (id: string) => Promise<void>;
4594
4781
  };
4595
4782
 
4596
4783
  declare type UseChatHistoryReturn = {
@@ -4599,6 +4786,14 @@ declare type UseChatHistoryReturn = {
4599
4786
  error: string | null;
4600
4787
  refetch: () => void;
4601
4788
  pinnedIds: Set<string>;
4789
+ /**
4790
+ * Ids of threads with an in-flight pin/unpin/delete request. Use it to show a
4791
+ * per-row loading affordance (e.g. a spinner where the actions sit) while the
4792
+ * backend confirms. Only populated for host-backed actions: a synchronous,
4793
+ * localStorage-only pin (no `pinThread`/`unpinThread` callback) is never
4794
+ * pending.
4795
+ */
4796
+ pendingIds: Set<string>;
4602
4797
  pinThread: (id: string) => void;
4603
4798
  unpinThread: (id: string) => void;
4604
4799
  deleteThread: (id: string) => Promise<void>;
package/dist/ai.js CHANGED
@@ -1,46 +1,50 @@
1
- import { C as e, D as r, c as i, F as o, a as t, f as n, g as F, d as C, e as A, I as l, P as d, b as u, u as m } from "./F0CanvasPanel-CsVpTFqp.js";
1
+ import { C as e, D as r, c as t, F as i, a as o, f as n, g as F, d as C, e as l, I as A, P as d, b as u, u as h } from "./F0CanvasPanel-kwJ0WQmR.js";
2
2
  import { defaultTranslations as c } from "./i18n-provider-defaults.js";
3
- import { A as v, s as I, t as g, w as f, l as p, i as y, q as T, x as S, y as x, p as H, r as O, j as V, e as b, g as k, k as w, F as M, h as D, a as j, n as q, m as z, o as B, b as E, f as L, v as R, c as G, d as J, u as K } from "./F0AiProcessingOverlay-BbAadqE5.js";
3
+ import { A as P, C as T, t as p, s as v, v as g, y as f, l as y, i as S, q as x, z as b, B as k, p as H, r as O, j as V, e as w, g as B, k as M, F as z, T as D, w as L, h as j, a as q, n as E, m as G, o as R, b as J, f as K, x as N, c as Q, d as U, u as W } from "./F0AiProcessingOverlay-B63Lnn9t.js";
4
4
  export {
5
- v as AiChatTranslationsProvider,
5
+ P as AiChatTranslationsProvider,
6
6
  e as ChatSpinner,
7
+ T as CollapsibleGroup,
7
8
  r as DropOverlay,
8
- i as F0ActionItem,
9
- o as F0AiChat,
10
- I as F0AiChatHeader,
9
+ t as F0ActionItem,
10
+ i as F0AiChat,
11
+ p as F0AiChatCreditsButton,
12
+ v as F0AiChatHeader,
11
13
  g as F0AiChatHistory,
12
- t as F0AiChatProvider,
14
+ o as F0AiChatProvider,
13
15
  f as F0AiChatTextArea,
14
- p as F0AiInsightCard,
15
- y as F0AiMask,
16
- T as F0AiMessageSources,
17
- S as F0AiMessagesContainer,
16
+ y as F0AiInsightCard,
17
+ S as F0AiMask,
18
+ x as F0AiMessageSources,
19
+ b as F0AiMessagesContainer,
18
20
  n as F0AiPong,
19
- x as F0AiProcessingOverlay,
21
+ k as F0AiProcessingOverlay,
20
22
  H as F0AiProposalCard,
21
23
  O as F0AiTableCard,
22
24
  V as F0AuraVoiceAnimation,
23
- b as F0CanvasCard,
25
+ w as F0CanvasCard,
24
26
  F as F0CanvasPanel,
25
- k as F0ClarifyingPanel,
26
- w as F0HILActionConfirmation,
27
+ B as F0ClarifyingPanel,
28
+ M as F0HILActionConfirmation,
27
29
  C as F0OneIcon,
28
- A as F0OneSwitch,
29
- M as FormCardValueFormatterProvider,
30
- l as I18nProvider,
30
+ l as F0OneSwitch,
31
+ z as FormCardValueFormatterProvider,
32
+ A as I18nProvider,
31
33
  d as PongBall,
32
- D as actionItemStatuses,
33
- j as aiTranslations,
34
- q as contentTypes,
34
+ D as ThreadItem,
35
+ L as ThreadListSkeleton,
36
+ j as actionItemStatuses,
37
+ q as aiTranslations,
38
+ E as contentTypes,
35
39
  c as defaultTranslations,
36
- z as markdownRenderers,
37
- B as oneIconSizes,
40
+ G as markdownRenderers,
41
+ R as oneIconSizes,
38
42
  u as useAiChat,
39
- E as useAiChatTranslations,
40
- L as useCanvasEntity,
41
- R as useChatHistory,
42
- G as useFormCardValueFormatter,
43
- m as useI18n,
44
- J as useSetFormCardValueFormatter,
45
- K as useToolCallId
43
+ J as useAiChatTranslations,
44
+ K as useCanvasEntity,
45
+ N as useChatHistory,
46
+ Q as useFormCardValueFormatter,
47
+ h as useI18n,
48
+ U as useSetFormCardValueFormatter,
49
+ W as useToolCallId
46
50
  };