@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/f0.d.ts CHANGED
@@ -540,6 +540,12 @@ export declare type AiChatMode = "chat" | "voice";
540
540
  */
541
541
  export declare type AiChatProviderProps = {
542
542
  enabled?: boolean;
543
+ /**
544
+ * Edge the whole side panel docks to (AI chat, hosted content and canvas).
545
+ * Hosts set "left" for a chat-first experience (e.g. communications).
546
+ * @default "right"
547
+ */
548
+ side?: "left" | "right";
543
549
  /**
544
550
  * Greeting phrase(s) shown by the welcome screen when the chat is empty.
545
551
  * A single string renders once; an array rotates through phrases. Purely
@@ -764,6 +770,28 @@ declare type AiChatProviderReturnValue = {
764
770
  pendingQuote: PendingQuote | null;
765
771
  /** Set the pending quote (pass null to clear). */
766
772
  setPendingQuote: React.Dispatch<React.SetStateAction<PendingQuote | null>>;
773
+ /**
774
+ * Content currently hosted in the side panel, or `null` to show the F0.ai
775
+ * chat. Only one is mounted at a time — see {@link SidePanelContent}.
776
+ */
777
+ panelContent: SidePanelContent | null;
778
+ /**
779
+ * Mount `content` in the side panel (replacing whatever was there) and open
780
+ * the panel. Pass `null` to fall back to the AI chat. The previous content
781
+ * is unmounted thanks to the `id` key.
782
+ */
783
+ setPanelContent: (content: SidePanelContent | null) => void;
784
+ /** Clear the custom panel content and fall back to the F0.ai chat. */
785
+ clearPanelContent: () => void;
786
+ /**
787
+ * Edge the whole side panel docks to — the AI chat, hosted content and the
788
+ * canvas all follow it. Defaults to "right". Hosts flip it to "left" for a
789
+ * chat-first experience (e.g. communications), where left is comfier to
790
+ * navigate between conversations.
791
+ */
792
+ panelSide: "left" | "right";
793
+ /** Set which edge the side panel docks to. */
794
+ setPanelSide: React.Dispatch<React.SetStateAction<"left" | "right">>;
767
795
  } & Pick<AiChatState, "agent" | "chatHeader" | "chatMessages" | "chatInput" | "disclaimer" | "resizable" | "entityRefs" | "canvasActions" | "canvasEntities" | "credits" | "employeeCredits" | "creditWarning" | "fileAttachments" | "onTranscribe"> & {
768
796
  /** The current canvas content, or null when canvas is closed */
769
797
  canvasContent: CanvasContent | null;
@@ -786,6 +814,8 @@ declare type AiChatProviderReturnValue = {
786
814
  */
787
815
  declare interface AiChatState {
788
816
  enabled: boolean;
817
+ /** Initial edge the panel docks to. @default "right" */
818
+ side?: "left" | "right";
789
819
  agent?: string;
790
820
  initialMessage?: string | string[];
791
821
  chatHeader?: React.ReactNode;
@@ -3052,6 +3082,14 @@ export declare interface ClarifyingStepState extends ClarifyingStepData {
3052
3082
 
3053
3083
  declare type ColId = string;
3054
3084
 
3085
+ export declare function CollapsibleGroup({ label, threads, pinnedIds, onSelect, onPin, onUnpin, onDelete, }: CollapsibleGroupProps): JSX_2.Element;
3086
+
3087
+ declare interface CollapsibleGroupProps extends ThreadActionHandlers {
3088
+ label: string;
3089
+ threads: ChatThread[];
3090
+ pinnedIds: Set<string>;
3091
+ }
3092
+
3055
3093
  export declare interface CollectionComputation {
3056
3094
  datasetId: string;
3057
3095
  sortBy?: string;
@@ -4798,6 +4836,86 @@ export declare const defaultTranslations: {
4798
4836
  };
4799
4837
  };
4800
4838
  };
4839
+ readonly chat: {
4840
+ readonly placeholder: "Write something here..";
4841
+ readonly searchPlaceholder: "Search messages";
4842
+ readonly closeSearch: "Close search";
4843
+ readonly noResults: "No chats found";
4844
+ readonly backToLatest: "Jump to latest";
4845
+ readonly muted: "Muted";
4846
+ readonly attachFile: "Attach file";
4847
+ readonly addEmoji: "Add emoji";
4848
+ readonly recordAudio: "Record audio";
4849
+ readonly listening: "Listening…";
4850
+ readonly stopRecording: "Stop and transcribe";
4851
+ readonly cancelRecording: "Cancel recording";
4852
+ readonly dropFilesHere: "Drop your files here";
4853
+ readonly removeFile: "Remove";
4854
+ readonly tooManyFilesError: "You can attach up to {{maxFiles}} files at once";
4855
+ readonly fileUploadError: "Upload failed";
4856
+ readonly micPermissionDenied: "Microphone access is blocked. Allow it in your browser settings to dictate.";
4857
+ readonly micError: "Couldn't access the microphone.";
4858
+ readonly transcriptionError: "Couldn't transcribe the audio. Try again.";
4859
+ readonly sent: "Sent";
4860
+ readonly read: "Read";
4861
+ readonly readBy: {
4862
+ readonly one: "Read by {{count}}";
4863
+ readonly other: "Read by {{count}}";
4864
+ };
4865
+ readonly delivered: "Delivered";
4866
+ readonly back: "Back";
4867
+ readonly writing: "Writing…";
4868
+ readonly isTyping: "{{name}} is writing…";
4869
+ readonly twoTyping: "{{first}} and {{second}} are writing…";
4870
+ readonly severalTyping: "Several people are writing…";
4871
+ readonly deletedMessage: "Message deleted";
4872
+ readonly moreActions: "Message actions";
4873
+ readonly options: "Options";
4874
+ readonly pin: "Pin";
4875
+ readonly unpin: "Unpin";
4876
+ readonly info: "Info";
4877
+ readonly viewProfile: "View profile";
4878
+ readonly mentionEveryone: "here";
4879
+ readonly mentionEveryoneDescription: "Notify everyone in this group";
4880
+ readonly reply: "Reply";
4881
+ readonly react: "Add reaction";
4882
+ readonly download: "Download";
4883
+ readonly removeQuote: "Remove quote";
4884
+ readonly edit: "Edit";
4885
+ readonly editing: "Editing";
4886
+ readonly edited: "edited";
4887
+ readonly cancelEdit: "Cancel edit";
4888
+ readonly saveEdit: "Save";
4889
+ readonly you: "You";
4890
+ readonly openImage: "Open image";
4891
+ readonly imagePreview: "Image preview";
4892
+ readonly closePreview: "Close";
4893
+ readonly previousImage: "Previous image";
4894
+ readonly nextImage: "Next image";
4895
+ readonly photo: "Photo";
4896
+ readonly photoCount: {
4897
+ readonly one: "{{count}} photo";
4898
+ readonly other: "{{count}} photos";
4899
+ };
4900
+ readonly fileCount: {
4901
+ readonly one: "{{count}} file";
4902
+ readonly other: "{{count}} files";
4903
+ };
4904
+ readonly attachmentCount: {
4905
+ readonly one: "{{count}} attachment";
4906
+ readonly other: "{{count}} attachments";
4907
+ };
4908
+ readonly scrollToBottom: "Scroll to bottom";
4909
+ readonly newMessages: "New messages";
4910
+ readonly unreadCount: {
4911
+ readonly one: "{{count}} unread";
4912
+ readonly other: "{{count}} unread";
4913
+ };
4914
+ readonly emptyConversation: "No messages yet";
4915
+ readonly emptyConversationDescription: "Send a message to start the conversation.";
4916
+ readonly error: "Couldn't load this conversation";
4917
+ readonly loadingOlder: "Loading earlier messages…";
4918
+ };
4801
4919
  readonly dataChart: {
4802
4920
  readonly heatmapNotSupported: "Heatmap not supported at this size";
4803
4921
  readonly barChartVertical: "Bar (vertical)";
@@ -5230,7 +5348,7 @@ declare const dialogPositions: readonly ["center", "left", "right", "fullscreen"
5230
5348
  *
5231
5349
  * const result = await dialogs.open({ title, content, actions: { primary: { label: "OK", value: true } } })
5232
5350
  */
5233
- export declare const dialogs: {
5351
+ declare const dialogs: {
5234
5352
  /** Open a dialog. Resolves with the value of the action the user picked. */
5235
5353
  open: (definition: Optional<DialogDefinition, "id">) => Promise<DialogActionValue>;
5236
5354
  /** Open a notification-style dialog (info/warning/critical/positive). */
@@ -5239,9 +5357,18 @@ export declare const dialogs: {
5239
5357
  alert: (options: AlertDialogOptions) => Promise<DialogActionValue>;
5240
5358
  /** Notification dialog with confirm + cancel actions (defaults to Ok/Cancel). */
5241
5359
  confirmation: (options: ConfirmDialogOptions) => Promise<DialogActionValue>;
5360
+ /**
5361
+ * Back-compat alias for {@link confirmation} — the v3 `dialog.confirm(...)`.
5362
+ * Same options shape (`type`, `title`, `msg`, `confirm`, `cancel`), so legacy
5363
+ * call sites keep working through the `dialogs as dialog` re-export.
5364
+ * @deprecated Use `confirmation` instead.
5365
+ */
5366
+ confirm: (options: ConfirmDialogOptions) => Promise<DialogActionValue>;
5242
5367
  /** Programmatically close a dialog by id (resolves its promise with undefined). */
5243
5368
  close: (id: DialogId) => void;
5244
5369
  };
5370
+ export { dialogs as dialog }
5371
+ export { dialogs }
5245
5372
 
5246
5373
  declare type DialogSimpleAction = {
5247
5374
  label?: string;
@@ -5939,6 +6066,16 @@ export declare interface F0AiAvailableFormDefinition<TParams extends Record<stri
5939
6066
  */
5940
6067
  export declare const F0AiChat: ({ header: headerProp, messages: messagesProp, input: inputProp, }: F0AiChatProps) => JSX_2.Element | null;
5941
6068
 
6069
+ /**
6070
+ * The AI chat credits / settings popover button, on its own. Use it to surface
6071
+ * the popover outside the chat header — e.g. from a sidebar that already owns
6072
+ * the chat navigation (history, new chat), leaving the header minimal.
6073
+ */
6074
+ export declare const F0AiChatCreditsButton: ({ credits, employeeCredits, trigger, }: Pick<F0AiChatHeaderProps, "credits" | "employeeCredits"> & {
6075
+ /** Custom popover trigger (asChild). Defaults to the Sliders icon button. */
6076
+ trigger?: ReactNode;
6077
+ }) => JSX_2.Element | null;
6078
+
5942
6079
  /**
5943
6080
  * Headless chat header. Renders a top bar with title (or thread selector),
5944
6081
  * credits popover, fullscreen toggle and close button. Has two visual
@@ -5949,7 +6086,7 @@ export declare const F0AiChat: ({ header: headerProp, messages: messagesProp, in
5949
6086
  *
5950
6087
  * Decoupled from CopilotKit and `useAiChat()` — everything via props.
5951
6088
  */
5952
- export declare const F0AiChatHeader: ({ historyEnabled, title, currentThreadTitle, fullscreen, lockVisualizationMode, onToggleVisualizationMode, onClose, onNewChat, onOpenHistory, hasMessages, credits, employeeCredits, }: F0AiChatHeaderProps) => JSX_2.Element;
6089
+ export declare const F0AiChatHeader: ({ historyEnabled, title, currentThreadTitle, fullscreen, lockVisualizationMode, onToggleVisualizationMode, onClose, onNewChat, onOpenHistory, hasMessages, credits, employeeCredits, compact, }: F0AiChatHeaderProps) => JSX_2.Element;
5953
6090
 
5954
6091
  export declare type F0AiChatHeaderProps = {
5955
6092
  /**
@@ -5983,6 +6120,12 @@ export declare type F0AiChatHeaderProps = {
5983
6120
  onOpenHistory?: () => void;
5984
6121
  /** Legacy variant gate: only renders the "new chat" button when true. */
5985
6122
  hasMessages?: boolean;
6123
+ /**
6124
+ * Minimal header: render only the expand + close controls (no title, new
6125
+ * chat or credits popover). Use when a sidebar owns the chat navigation and
6126
+ * the credits/settings popover (see `F0AiChatCreditsButton`).
6127
+ */
6128
+ compact?: boolean;
5986
6129
  /** Credits configuration. When present, renders the credits popover button. */
5987
6130
  credits?: AiChatCredits;
5988
6131
  /**
@@ -6044,7 +6187,7 @@ export declare interface F0AiChatProps {
6044
6187
  /**
6045
6188
  * @experimental This is an experimental component use it at your own risk
6046
6189
  */
6047
- 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;
6190
+ 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;
6048
6191
 
6049
6192
  /**
6050
6193
  * Headless chat composer.
@@ -7390,7 +7533,7 @@ export declare type F0CanvasCardProps = {
7390
7533
  * Headless: no CopilotKit or `useAiChat()` dependency — the host wires
7391
7534
  * `content`, `onClose` and `entities` directly.
7392
7535
  */
7393
- export declare function F0CanvasPanel({ content, onClose, entities, }: F0CanvasPanelProps): ReactNode;
7536
+ export declare function F0CanvasPanel({ content, onClose, entities, side, }: F0CanvasPanelProps): ReactNode;
7394
7537
 
7395
7538
  export declare namespace F0CanvasPanel {
7396
7539
  var displayName: string;
@@ -7403,6 +7546,12 @@ export declare type F0CanvasPanelProps = {
7403
7546
  onClose: () => void;
7404
7547
  /** Canvas entity registry keyed by `CanvasContent["type"]`. */
7405
7548
  entities?: Record<string, CanvasEntityDefinition<any>>;
7549
+ /**
7550
+ * Edge the adjacent chat panel docks to. The canvas hugs the seam on the
7551
+ * opposite side, so the rounded corner / open border face the chat.
7552
+ * Defaults to "right" (chat on the right -> canvas seam on its right).
7553
+ */
7554
+ side?: "left" | "right";
7406
7555
  };
7407
7556
 
7408
7557
  export declare const F0Card: WithDataTestIdReturnType_3<ForwardRefExoticComponent<F0CardProps & RefAttributes<HTMLDivElement>> & {
@@ -7501,6 +7650,13 @@ declare interface F0CardHorizontalProps {
7501
7650
 
7502
7651
  export declare type F0CardProps = Omit<CardInternalProps, (typeof privateProps_3)[number]>;
7503
7652
 
7653
+ /**
7654
+ * @experimental This is an experimental component, use it at your own risk.
7655
+ */
7656
+ export declare const F0CardRow: WithDataTestIdReturnType_3<ForwardRefExoticComponent<F0CardHorizontalProps & RefAttributes<HTMLDivElement>> & {
7657
+ Skeleton: () => JSX_2.Element;
7658
+ }>;
7659
+
7504
7660
  declare interface F0CardSelectConfig {
7505
7661
  options: CardSelectOption[];
7506
7662
  hideLabel?: boolean;
@@ -14992,6 +15148,17 @@ export declare const setDataCollectionUrlParams: <CurrentFiltersState extends Fi
14992
15148
 
14993
15149
  declare type SetFormCardValueFormatter = <T = unknown>(entry: FormCardValueFormatterEntry<T>) => void;
14994
15150
 
15151
+ /**
15152
+ * A single piece of content hosted in the side panel — the same resizable +
15153
+ * fullscreen space the F0.ai chat lives in. Only one is mounted at a time:
15154
+ * the `id` keys the content so switching conversations unmounts the previous
15155
+ * one and mounts the new. `panelContent === null` falls back to the AI chat.
15156
+ */
15157
+ export declare type SidePanelContent = {
15158
+ id: string;
15159
+ content: React.ReactNode;
15160
+ };
15161
+
14995
15162
  /**
14996
15163
  * Response structure for non-paginated data
14997
15164
  */
@@ -15799,6 +15966,32 @@ export declare interface ThreadGroup {
15799
15966
  threads: ChatThread[];
15800
15967
  }
15801
15968
 
15969
+ export declare function ThreadItem({ thread, isPinned, isActive, isPending, onSelect, onPin, onUnpin, onDelete, className, }: ThreadItemProps): JSX_2.Element;
15970
+
15971
+ declare interface ThreadItemProps extends ThreadActionHandlers {
15972
+ thread: ChatThread;
15973
+ isPinned: boolean;
15974
+ /** Keeps the row highlighted while its thread is the one open in the panel. */
15975
+ isActive?: boolean;
15976
+ /**
15977
+ * A pin/unpin/delete request for this thread is in flight. Replaces the
15978
+ * actions button with a spinner (kept visible off-hover) so the row reads as
15979
+ * "saving" while the backend confirms. Wire it from `useChatHistory`'s
15980
+ * `pendingIds`.
15981
+ */
15982
+ isPending?: boolean;
15983
+ /** Override the row classes (e.g. to match the sidebar's chat-row paddings). */
15984
+ className?: string;
15985
+ }
15986
+
15987
+ /**
15988
+ * Loading placeholder for the chat-history thread list. Mirrors the real
15989
+ * layout: a couple of collapsible groups, each with a short title and a few
15990
+ * title-only rows of varying width (no avatar or trailing actions — those only
15991
+ * appear on hover).
15992
+ */
15993
+ export declare function ThreadListSkeleton(): JSX_2.Element;
15994
+
15802
15995
  export declare type TimelineRowStatus = (typeof timelineRowStatuses)[number];
15803
15996
 
15804
15997
  export declare const timelineRowStatuses: readonly ["completed", "in-progress", "not-started"];
@@ -16217,7 +16410,7 @@ export declare function useCanvasEntity(type: string | undefined): CanvasEntityD
16217
16410
  * URLs, auth headers or fetch wiring. Manages pinned threads in
16218
16411
  * localStorage and the threads list (loading/error/data).
16219
16412
  */
16220
- export declare function useChatHistory({ enabled, fetchThreads: fetchThreadsCb, deleteThread: deleteThreadCb, }: UseChatHistoryOptions): UseChatHistoryReturn;
16413
+ export declare function useChatHistory({ enabled, fetchThreads: fetchThreadsCb, deleteThread: deleteThreadCb, pinThread: pinThreadCb, unpinThread: unpinThreadCb, }: UseChatHistoryOptions): UseChatHistoryReturn;
16221
16414
 
16222
16415
  declare type UseChatHistoryOptions = {
16223
16416
  /** When true, fetches threads on mount. Default: `false`. */
@@ -16232,6 +16425,16 @@ declare type UseChatHistoryOptions = {
16232
16425
  * failure; the hook will then re-fetch to restore consistency.
16233
16426
  */
16234
16427
  deleteThread: (id: string) => Promise<void>;
16428
+ /**
16429
+ * Optional async persisters for the pin state (e.g. a Stream-backed mutation
16430
+ * in the host app). When provided, pin/unpin become host-backed: the change
16431
+ * is applied optimistically (the row moves between groups at once), the id is
16432
+ * marked in `pendingIds` while the request is in flight, and the change is
16433
+ * rolled back if the callback rejects. When omitted, the pin state is kept
16434
+ * locally in localStorage as before — synchronous and never pending.
16435
+ */
16436
+ pinThread?: (id: string) => Promise<void>;
16437
+ unpinThread?: (id: string) => Promise<void>;
16235
16438
  };
16236
16439
 
16237
16440
  declare type UseChatHistoryReturn = {
@@ -16240,6 +16443,14 @@ declare type UseChatHistoryReturn = {
16240
16443
  error: string | null;
16241
16444
  refetch: () => void;
16242
16445
  pinnedIds: Set<string>;
16446
+ /**
16447
+ * Ids of threads with an in-flight pin/unpin/delete request. Use it to show a
16448
+ * per-row loading affordance (e.g. a spinner where the actions sit) while the
16449
+ * backend confirms. Only populated for host-backed actions: a synchronous,
16450
+ * localStorage-only pin (no `pinThread`/`unpinThread` callback) is never
16451
+ * pending.
16452
+ */
16453
+ pendingIds: Set<string>;
16243
16454
  pinThread: (id: string) => void;
16244
16455
  unpinThread: (id: string) => void;
16245
16456
  deleteThread: (id: string) => Promise<void>;