@factorialco/f0-react 2.22.0 → 2.24.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.js CHANGED
@@ -1,44 +1,44 @@
1
- import { C as e, D as r, i, F as o, l as t, m as n, a as F, o as C, p as A, q as l, g as u, r as d, h, j as m, k as c, d as I, I as P, P as f, c as g, n as p, e as v, u as T, f as y, b as S } from "./F0CanvasPanel-v9tjaOnW.js";
2
- import { defaultTranslations as H } from "./i18n-provider-defaults.js";
3
- import { A as b, f as M, F as O, i as j, h as k, j as D, d as q, e as w, c as z, a as B, g as E, o as L, u as G, b as J } from "./F0AiTableCard-BzXULBvr.js";
1
+ import { D as e, F as r, a as t, e as i, f as o, c as n, d as F, I as C, P as A, b as l, u } from "./F0CanvasPanel-DAJcyyFM.js";
2
+ import { defaultTranslations as m } from "./i18n-provider-defaults.js";
3
+ import { A as c, C as I, h as P, s as v, t as f, w as p, m as T, j as g, q as y, x as S, p as x, r as H, k as V, e as b, g as M, l as O, F as k, i as w, a as D, n as j, o as q, b as z, f as B, v as E, c as L, d as G, u as J } from "./useChatHistory-DsrI2Vz9.js";
4
4
  export {
5
- b as AiChatTranslationsProvider,
6
- e as ChatSpinner,
7
- r as DropOverlay,
8
- i as F0ActionItem,
9
- o as F0AiChat,
10
- t as F0AiChatHeader,
11
- n as F0AiChatHistory,
12
- F as F0AiChatProvider,
13
- C as F0AiChatTextArea,
14
- M as F0AiInsightCard,
15
- O as F0AiMask,
16
- j as F0AiMessageSources,
17
- A as F0AiMessagesContainer,
18
- l as F0AiPong,
19
- k as F0AiProposalCard,
20
- D as F0AiTableCard,
21
- q as F0AuraVoiceAnimation,
22
- u as F0CanvasCard,
23
- d as F0CanvasPanel,
24
- h as F0ClarifyingPanel,
25
- w as F0HILActionConfirmation,
26
- m as F0OneIcon,
27
- c as F0OneSwitch,
28
- I as FormCardValueFormatterProvider,
29
- P as I18nProvider,
30
- f as PongBall,
31
- z as actionItemStatuses,
32
- B as aiTranslations,
33
- E as contentTypes,
34
- H as defaultTranslations,
35
- L as oneIconSizes,
36
- g as useAiChat,
37
- G as useAiChatTranslations,
38
- J as useCanvasEntity,
39
- p as useChatHistory,
40
- v as useFormCardValueFormatter,
41
- T as useI18n,
42
- y as useSetFormCardValueFormatter,
43
- S as useToolCallId
5
+ c as AiChatTranslationsProvider,
6
+ I as ChatSpinner,
7
+ e as DropOverlay,
8
+ P as F0ActionItem,
9
+ r as F0AiChat,
10
+ v as F0AiChatHeader,
11
+ f as F0AiChatHistory,
12
+ t as F0AiChatProvider,
13
+ p as F0AiChatTextArea,
14
+ T as F0AiInsightCard,
15
+ g as F0AiMask,
16
+ y as F0AiMessageSources,
17
+ S as F0AiMessagesContainer,
18
+ i as F0AiPong,
19
+ x as F0AiProposalCard,
20
+ H as F0AiTableCard,
21
+ V as F0AuraVoiceAnimation,
22
+ b as F0CanvasCard,
23
+ o as F0CanvasPanel,
24
+ M as F0ClarifyingPanel,
25
+ O as F0HILActionConfirmation,
26
+ n as F0OneIcon,
27
+ F as F0OneSwitch,
28
+ k as FormCardValueFormatterProvider,
29
+ C as I18nProvider,
30
+ A as PongBall,
31
+ w as actionItemStatuses,
32
+ D as aiTranslations,
33
+ j as contentTypes,
34
+ m as defaultTranslations,
35
+ q as oneIconSizes,
36
+ l as useAiChat,
37
+ z as useAiChatTranslations,
38
+ B as useCanvasEntity,
39
+ E as useChatHistory,
40
+ L as useFormCardValueFormatter,
41
+ u as useI18n,
42
+ G as useSetFormCardValueFormatter,
43
+ J as useToolCallId
44
44
  };
@@ -1,4 +1,3 @@
1
- import { AIMessage } from '@copilotkit/shared';
2
1
  import { AlertAvatarProps as AlertAvatarProps_2 } from './F0AvatarAlert';
3
2
  import { AlertTagCellValue } from './types/alertTag';
4
3
  import { AlertTagCellValue as AlertTagCellValue_2 } from './experimental';
@@ -25,7 +24,6 @@ import { CompanyCellValue as CompanyCellValue_2 } from './experimental';
25
24
  import { CompanyItemProps } from './types';
26
25
  import { ComponentProps } from 'react';
27
26
  import { CompoundCellValue } from './types/compound';
28
- import { CopilotKitProps } from '@copilotkit/react-core';
29
27
  import { CountCellValue } from './types/count';
30
28
  import { CountryCellValue } from './types/country';
31
29
  import { DateCellValue } from './types/date';
@@ -68,7 +66,6 @@ import { LineChartConfig } from './experimental';
68
66
  import { LineChartProps } from './experimental';
69
67
  import { LineChartPropsBase } from './utils/types';
70
68
  import { LongTextCellValue } from './types/longText';
71
- import { Message as Message_2 } from '@copilotkit/shared';
72
69
  import { NumberCellValue } from './types/number';
73
70
  import { NumberCellValue as NumberCellValue_2 } from './experimental';
74
71
  import { NumberFilterOptions } from './NumberFilter/NumberFilter';
@@ -502,6 +499,11 @@ declare type AiChatFileAttachmentConfig = {
502
499
  */
503
500
  declare type AiChatProviderProps = {
504
501
  enabled?: boolean;
502
+ /**
503
+ * Greeting phrase(s) shown by the welcome screen when the chat is empty.
504
+ * A single string renders once; an array rotates through phrases. Purely
505
+ * UI config — does not affect runtime behavior.
506
+ */
505
507
  initialMessage?: string | string[];
506
508
  welcomeScreenSuggestions?: WelcomeScreenSuggestion[];
507
509
  disclaimer?: AiChatDisclaimer;
@@ -579,31 +581,40 @@ declare type AiChatProviderProps = {
579
581
  * File attachment configuration. When provided, enables file uploads in the chat.
580
582
  */
581
583
  fileAttachments?: AiChatFileAttachmentConfig;
582
- onThumbsUp?: (message: AIMessage, { threadId, feedback }: {
584
+ onThumbsUp?: (message: F0AIMessage, { threadId, feedback }: {
583
585
  threadId: string;
584
586
  feedback: string;
585
587
  }) => void;
586
- onThumbsDown?: (message: AIMessage, { threadId, feedback }: {
588
+ onThumbsDown?: (message: F0AIMessage, { threadId, feedback }: {
587
589
  threadId: string;
588
590
  feedback: string;
589
591
  }) => void;
590
592
  tracking?: AiChatTrackingOptions;
591
593
  /**
592
- * Optional hook called before a user message is sent. Return false to block submission.
594
+ * Optional name of the AI agent. Forwarded to the host runtime adapter
595
+ * (mock in stories, CopilotKit in factorial) — f0 itself only stores it.
593
596
  */
594
- onBeforeSendMessage?: () => boolean | Promise<boolean>;
597
+ agent?: string;
595
598
  /**
596
- * Optional fetch implementation for AI runtime requests owned by F0.
599
+ * Slot elements rendered inside `<F0AiChat />`. Host apps (factorial in
600
+ * production, the mock runtime in stories) provide their own connected
601
+ * wrappers — f0 ships only the shell. Passing slots here makes them
602
+ * available to any `<F0AiChat />` mounted under this provider (used by
603
+ * `ApplicationFrame`, which renders the chat itself).
597
604
  */
598
- runtimeFetch?: typeof fetch;
599
- } & Pick<CopilotKitProps, "agent" | "credentials" | "children" | "runtimeUrl" | "showDevConsole" | "threadId" | "headers">;
605
+ chatHeader?: React.ReactNode;
606
+ chatMessages?: React.ReactNode;
607
+ chatInput?: React.ReactNode;
608
+ /** Children rendered inside the provider. */
609
+ children?: React.ReactNode;
610
+ };
600
611
 
601
612
  declare type AiChatTrackingOptions = {
602
613
  onVisibility?: () => void;
603
614
  onClose?: () => void;
604
615
  onWelcomeSuggestionClick?: (event: WelcomeSuggestionClickEvent) => void;
605
616
  onNewChat?: () => void;
606
- onMessage?: (message: Message_2) => void;
617
+ onMessage?: (message: F0Message) => void;
607
618
  };
608
619
 
609
620
  /**
@@ -3591,7 +3602,9 @@ export declare type DetailsItemContent = (ComponentProps<typeof DataList.Item> &
3591
3602
  }[TagType_2] | {
3592
3603
  type: "avatar-list";
3593
3604
  avatarList: F0AvatarListProps;
3594
- };
3605
+ } | (ComponentProps<typeof FileItem> & {
3606
+ type: "file";
3607
+ });
3595
3608
 
3596
3609
  /**
3597
3610
  * @experimental This is an experimental component use it at your own risk
@@ -4077,6 +4090,9 @@ export declare const F0AiBanner: ForwardRefExoticComponent<Omit<AiBannerInternal
4077
4090
 
4078
4091
  export declare type F0AiBannerProps = AiBannerInternalProps;
4079
4092
 
4093
+ /** Assistant-flavoured `F0Message`. Same shape — alias kept for clarity. */
4094
+ declare type F0AIMessage = F0Message;
4095
+
4080
4096
  declare const F0AvatarAlert: WithDataTestIdReturnType_5<({ type, size, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, }: AlertAvatarProps_2) => JSX_2.Element>;
4081
4097
 
4082
4098
  declare type F0AvatarCompanyProps = {
@@ -4109,6 +4125,15 @@ declare type F0AvatarIconProps = {
4109
4125
  state?: F0IconProps["state"];
4110
4126
  } & Partial<Pick<BaseAvatarProps, "aria-label" | "aria-labelledby">>;
4111
4127
 
4128
+ /**
4129
+ * Optional extras every avatar entry may carry regardless of `type`.
4130
+ * `tooltipDescription` is rendered as the tooltip's secondary line via the
4131
+ * underlying `Tooltip` `description` slot (use it for emails, roles, etc.).
4132
+ */
4133
+ declare type F0AvatarListExtras = {
4134
+ tooltipDescription?: string;
4135
+ };
4136
+
4112
4137
  declare type F0AvatarListProps = {
4113
4138
  /**
4114
4139
  * The size of the avatars in the list.
@@ -4136,23 +4161,32 @@ declare type F0AvatarListProps = {
4136
4161
  * @default "compact"
4137
4162
  */
4138
4163
  layout?: "fill" | "compact";
4164
+ /**
4165
+ * Controls the scroll behavior of the `+N` overflow popover that lists
4166
+ * collapsed avatars (including their `tooltipDescription` entries).
4167
+ * - `"vertical"` (default): caps the popover height and scrolls vertically.
4168
+ * - `"none"`: lets the popover grow to fit all entries.
4169
+ * @default "vertical"
4170
+ */
4171
+ tooltipScroll?: "vertical" | "none";
4139
4172
  } & F0AvatarListPropsAvatars;
4140
4173
 
4141
4174
  declare type F0AvatarListPropsAvatars = {
4142
4175
  type: "person";
4143
- avatars: (Omit<PersonAvatarVariant, "type"> & Record<string, unknown>)[];
4176
+ avatars: (Omit<PersonAvatarVariant, "type"> & // Allow to have more properties in the avatar variant
4177
+ F0AvatarListExtras & Record<string, unknown>)[];
4144
4178
  } | {
4145
4179
  type: "team";
4146
- avatars: (Omit<TeamAvatarVariant, "type"> & Record<string, unknown>)[];
4180
+ avatars: (Omit<TeamAvatarVariant, "type"> & F0AvatarListExtras & Record<string, unknown>)[];
4147
4181
  } | {
4148
4182
  type: "company";
4149
- avatars: (Omit<CompanyAvatarVariant, "type"> & Record<string, unknown>)[];
4183
+ avatars: (Omit<CompanyAvatarVariant, "type"> & F0AvatarListExtras & Record<string, unknown>)[];
4150
4184
  } | {
4151
4185
  type: "flag";
4152
- avatars: (Omit<FlagAvatarVariant, "type"> & Record<string, unknown>)[];
4186
+ avatars: (Omit<FlagAvatarVariant, "type"> & F0AvatarListExtras & Record<string, unknown>)[];
4153
4187
  } | {
4154
4188
  type: "file";
4155
- avatars: (Omit<FileAvatarVariant, "type"> & Record<string, unknown>)[];
4189
+ avatars: (Omit<FileAvatarVariant, "type"> & F0AvatarListExtras & Record<string, unknown>)[];
4156
4190
  };
4157
4191
 
4158
4192
  export declare const F0AvatarModule: WithDataTestIdReturnType_5<typeof F0AvatarModule_2>;
@@ -4309,6 +4343,24 @@ declare interface F0IconProps extends SVGProps<SVGSVGElement>, VariantProps<type
4309
4343
  color?: "default" | "currentColor" | `#${string}` | Lowercase<NestedKeyOf<typeof f1Colors.icon>>;
4310
4344
  }
4311
4345
 
4346
+ declare type F0Message = {
4347
+ id: string;
4348
+ role: "user" | "assistant" | "system" | "tool";
4349
+ content?: unknown;
4350
+ toolCalls?: F0ToolCall[];
4351
+ toolCallId?: string;
4352
+ createdAt?: string;
4353
+ generativeUI?: () => unknown;
4354
+ rawData?: unknown;
4355
+ /**
4356
+ * Reply quote text attached to the message by the composer. Rendered
4357
+ * as a block above the user bubble. Adapters (factorial / mock) own
4358
+ * the wire encoding; F0 only reads this structured field.
4359
+ */
4360
+ replyQuote?: string;
4361
+ [key: string]: any;
4362
+ };
4363
+
4312
4364
  /**
4313
4365
  * @experimental This is an experimental component, use it at your own risk.
4314
4366
  */
@@ -4591,6 +4643,21 @@ declare interface F0TagStatusProps {
4591
4643
 
4592
4644
  declare const F0TagTeam: WithDataTestIdReturnType_5<ForwardRefExoticComponent<F0TagTeamProps & RefAttributes<HTMLDivElement>>>;
4593
4645
 
4646
+ /**
4647
+ * Loose message shape used inside f0. Mirrors the CopilotKit `Message`
4648
+ * shape so adapters (factorial, mock runtime) can map back and forth
4649
+ * with no field rename, but is owned by f0 — nothing in `src/` imports
4650
+ * from `@copilotkit/*` anymore.
4651
+ */
4652
+ declare type F0ToolCall = {
4653
+ id: string;
4654
+ type?: "function";
4655
+ function: {
4656
+ name: string;
4657
+ arguments: string;
4658
+ };
4659
+ };
4660
+
4594
4661
  /**
4595
4662
  * @experimental This is an experimental component use it at your own risk
4596
4663
  */
@@ -5541,6 +5608,7 @@ declare type MetadataItemValue = {
5541
5608
  variant: StatusVariant;
5542
5609
  } | ({
5543
5610
  type: "list";
5611
+ max?: number;
5544
5612
  } & ({
5545
5613
  variant: "person";
5546
5614
  avatars: (PersonAvatarVariant | (PersonAvatarVariant & Record<string, unknown>))[];
@@ -8469,10 +8537,8 @@ declare module "@tiptap/core" {
8469
8537
 
8470
8538
  declare module "@tiptap/core" {
8471
8539
  interface Commands<ReturnType> {
8472
- videoEmbed: {
8473
- setVideoEmbed: (options: {
8474
- src: string;
8475
- }) => ReturnType;
8540
+ transcript: {
8541
+ insertTranscript: (data: TranscriptData) => ReturnType;
8476
8542
  };
8477
8543
  }
8478
8544
  }
@@ -8480,8 +8546,10 @@ declare module "@tiptap/core" {
8480
8546
 
8481
8547
  declare module "@tiptap/core" {
8482
8548
  interface Commands<ReturnType> {
8483
- transcript: {
8484
- insertTranscript: (data: TranscriptData) => ReturnType;
8549
+ videoEmbed: {
8550
+ setVideoEmbed: (options: {
8551
+ src: string;
8552
+ }) => ReturnType;
8485
8553
  };
8486
8554
  }
8487
8555
  }