@factorialco/f0-react 2.20.0 → 2.21.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
@@ -33,6 +33,7 @@ import { Context } from 'react';
33
33
  import { CopilotKitProps } from '@copilotkit/react-core';
34
34
  import { CountCellValue } from './types/count';
35
35
  import { CountryCellValue } from './types/country';
36
+ import { CSSProperties } from 'react';
36
37
  import { DashboardProps as DashboardProps_2 } from './Dashboard';
37
38
  import { DateCellValue } from './f0';
38
39
  import { DateCellValue as DateCellValue_2 } from './types/date';
@@ -306,7 +307,7 @@ declare type ActionDefinition = DropdownItemSeparator | (Pick<DropdownItemObject
306
307
 
307
308
  export declare type ActionItemStatus = (typeof actionItemStatuses)[number];
308
309
 
309
- export declare const actionItemStatuses: readonly ["inProgress", "executing", "completed"];
310
+ export declare const actionItemStatuses: readonly ["inProgress", "executing", "writing", "completed"];
310
311
 
311
312
  declare type ActionLinkProps = ActionBaseProps & {
312
313
  href: string;
@@ -510,7 +511,6 @@ export declare type AiChatMode = "chat" | "voice";
510
511
  */
511
512
  export declare type AiChatProviderProps = {
512
513
  enabled?: boolean;
513
- greeting?: string;
514
514
  initialMessage?: string | string[];
515
515
  welcomeScreenSuggestions?: WelcomeScreenSuggestion[];
516
516
  disclaimer?: AiChatDisclaimer;
@@ -766,7 +766,7 @@ declare type AiChatProviderReturnValue = {
766
766
  pendingQuote: PendingQuote | null;
767
767
  /** Set the pending quote (pass null to clear). */
768
768
  setPendingQuote: React.Dispatch<React.SetStateAction<PendingQuote | null>>;
769
- } & Pick<AiChatState, "greeting" | "agent" | "disclaimer" | "resizable" | "entityRefs" | "canvasActions" | "canvasEntities" | "credits" | "employeeCredits" | "creditWarning" | "fileAttachments"> & {
769
+ } & Pick<AiChatState, "agent" | "disclaimer" | "resizable" | "entityRefs" | "canvasActions" | "canvasEntities" | "credits" | "employeeCredits" | "creditWarning" | "fileAttachments"> & {
770
770
  /** The current canvas content, or null when canvas is closed */
771
771
  canvasContent: CanvasContent | null;
772
772
  /** Open the canvas panel with the given content */
@@ -785,7 +785,6 @@ declare type AiChatProviderReturnValue = {
785
785
  * Internal state for the AiChat provider
786
786
  */
787
787
  declare interface AiChatState {
788
- greeting?: string;
789
788
  enabled: boolean;
790
789
  agent?: string;
791
790
  initialMessage?: string | string[];
@@ -828,7 +827,7 @@ declare interface AiChatState {
828
827
  declare type AiChatTrackingOptions = {
829
828
  onVisibility?: () => void;
830
829
  onClose?: () => void;
831
- onWelcomeSuggestionClick?: (item: WelcomeScreenSuggestionItem) => void;
830
+ onWelcomeSuggestionClick?: (event: WelcomeSuggestionClickEvent) => void;
832
831
  onNewChat?: () => void;
833
832
  onMessage?: (message: Message_2) => void;
834
833
  };
@@ -896,7 +895,7 @@ export declare const aiTranslations: {
896
895
  readonly stopAnswerGeneration: "Stop generating";
897
896
  readonly responseStopped: "You stopped this response";
898
897
  readonly sendMessage: "Send message";
899
- readonly thoughtsGroupTitle: "Reflection";
898
+ readonly thoughtsGroupTitle: "Reasoning";
900
899
  readonly resourcesGroupTitle: "Resources";
901
900
  readonly thinking: "Thinking...";
902
901
  readonly feedbackModal: {
@@ -2638,7 +2637,19 @@ export declare interface ChatDashboardRadarChartConfig extends ChatDashboardChar
2638
2637
  showArea?: boolean;
2639
2638
  }
2640
2639
 
2641
- export declare const ChatSpinner: ForwardRefExoticComponent<Omit<SVGProps<SVGSVGElement>, "ref"> & RefAttributes<SVGSVGElement>>;
2640
+ export declare const ChatSpinner: ForwardRefExoticComponent<ChatSpinnerProps & RefAttributes<HTMLDivElement>>;
2641
+
2642
+ declare interface ChatSpinnerProps {
2643
+ size?: number;
2644
+ className?: string;
2645
+ style?: CSSProperties;
2646
+ /**
2647
+ * "default" → spins 2 rotations, pauses, repeats.
2648
+ * "continuous" → 2 rotations forward, then 2 backward, no pause. Used for
2649
+ * "writing"-style activity where the indicator should never rest.
2650
+ */
2651
+ variant?: "default" | "continuous";
2652
+ }
2642
2653
 
2643
2654
  export declare type ChatThread = {
2644
2655
  id: string;
@@ -4345,7 +4356,7 @@ export declare const defaultTranslations: {
4345
4356
  readonly stopAnswerGeneration: "Stop generating";
4346
4357
  readonly responseStopped: "You stopped this response";
4347
4358
  readonly sendMessage: "Send message";
4348
- readonly thoughtsGroupTitle: "Reflection";
4359
+ readonly thoughtsGroupTitle: "Reasoning";
4349
4360
  readonly resourcesGroupTitle: "Resources";
4350
4361
  readonly thinking: "Thinking...";
4351
4362
  readonly feedbackModal: {
@@ -5296,7 +5307,7 @@ export declare interface F0ActionItemProps {
5296
5307
  /**
5297
5308
  * Current status of the action item
5298
5309
  */
5299
- status?: "inProgress" | "executing" | "completed";
5310
+ status?: "inProgress" | "executing" | "writing" | "completed";
5300
5311
  /**
5301
5312
  * Whether the action item is part of a group
5302
5313
  */
@@ -5436,7 +5447,7 @@ export declare type F0AiChatHistoryProps = {
5436
5447
  /**
5437
5448
  * @experimental This is an experimental component use it at your own risk
5438
5449
  */
5439
- export declare const F0AiChatProvider: ({ enabled, greeting, initialMessage, welcomeScreenSuggestions, disclaimer, resizable, defaultVisualizationMode, lockVisualizationMode, historyEnabled, footer, VoiceMode, entityRefs, canvasActions, canvasEntities, credits, employeeCredits, creditWarning, fileAttachments, onThumbsUp, onThumbsDown, onBeforeSendMessage, runtimeFetch, children, agent, tracking, ...copilotKitProps }: AiChatProviderProps) => JSX_2.Element;
5450
+ export declare const F0AiChatProvider: ({ enabled, initialMessage, welcomeScreenSuggestions, disclaimer, resizable, defaultVisualizationMode, lockVisualizationMode, historyEnabled, footer, VoiceMode, entityRefs, canvasActions, canvasEntities, credits, employeeCredits, creditWarning, fileAttachments, onThumbsUp, onThumbsDown, onBeforeSendMessage, runtimeFetch, children, agent, tracking, ...copilotKitProps }: AiChatProviderProps) => JSX_2.Element;
5440
5451
 
5441
5452
  /**
5442
5453
  * Headless chat composer.
@@ -5512,8 +5523,9 @@ export declare type F0AiChatTextAreaProps = {
5512
5523
  * Hovering an item previews its prompt in the textarea placeholder.
5513
5524
  */
5514
5525
  welcomeScreenSuggestions?: WelcomeScreenSuggestion[];
5515
- /** Called when the user clicks a sub-suggestion. */
5516
- onSuggestionClick?: (item: WelcomeScreenSuggestionItem) => void;
5526
+ /** Called when the user clicks a sub-suggestion. Receives the picked
5527
+ * `item` and its parent `group` (the outline-button entry). */
5528
+ onSuggestionClick?: (item: WelcomeScreenSuggestionItem, group: WelcomeScreenSuggestion) => void;
5517
5529
  /**
5518
5530
  * When true, the composer adopts the fullscreen layout: the welcome
5519
5531
  * footer is pushed to the bottom and the disclaimer is hidden so the
@@ -5730,12 +5742,12 @@ export declare type F0AiMessagesContainerProps = {
5730
5742
  isLoadingThread?: boolean;
5731
5743
  /** Optional React node rendered inline at the end of the list (e.g. CopilotKit interrupt). */
5732
5744
  interrupt?: ReactNode;
5733
- /** Greeting shown above the initial message in the welcome screen. */
5734
- greeting?: string;
5735
- /** Initial message(s) shown in the welcome screen, or a default if omitted. */
5745
+ /** Welcome phrase shown centered when the chat is empty. Falls back to
5746
+ * `translations.ai.defaultInitialMessage` if omitted. */
5736
5747
  initialMessage?: string | string[];
5737
- /** Optional click on the One icon (factorial uses it for the pong easter egg). */
5738
- onWelcomeIconClick?: () => void;
5748
+ /** Called when the user clicks the welcome phrase (used by F0AiChat to open
5749
+ * the pong easter egg). When omitted the phrase is non-interactive. */
5750
+ onWelcomeClick?: () => void;
5739
5751
  /** Returns a React node for an assistant message's tool call, or null. */
5740
5752
  renderToolCall?: F0AssistantMessageExtraProps["renderToolCall"];
5741
5753
  /** Called when the user selects text and clicks Reply (user or assistant bubble). */
@@ -7790,10 +7802,14 @@ export declare interface F0FormDefinitionPerSection<T extends F0PerSectionSchema
7790
7802
  defaultValues?: {
7791
7803
  [K in keyof T]?: Partial<z.infer<T[K]>>;
7792
7804
  };
7805
+ /** Raw async function for resolving defaultValues — resolved by F0Form at render time */
7806
+ asyncDefaultValues?: (signal: AbortSignal) => Promise<{
7807
+ [K in keyof T]?: Partial<z.infer<T[K]>>;
7808
+ }>;
7793
7809
  onSubmit: (arg: F0WizardFormPerSectionSubmitArg<T>) => Promise<F0FormSubmitResult> | F0FormSubmitResult;
7794
7810
  submitConfig?: F0PerSectionSubmitConfig;
7795
7811
  errorTriggerMode?: F0FormErrorTriggerMode;
7796
- /** Whether async defaultValues are still being resolved */
7812
+ /** Whether async initialFiles are still being resolved */
7797
7813
  isLoading?: boolean;
7798
7814
  /** Zod schema describing params the AI can supply when calling presentForm */
7799
7815
  defaultValuesParamsSchema?: ZodType;
@@ -7819,10 +7835,12 @@ export declare interface F0FormDefinitionSingleSchema<TSchema extends F0FormSche
7819
7835
  schema: TSchema;
7820
7836
  sections?: Record<string, F0SectionConfig>;
7821
7837
  defaultValues?: Partial<z.infer<TSchema>>;
7838
+ /** Raw async function for resolving defaultValues — resolved by F0Form at render time */
7839
+ asyncDefaultValues?: (signal: AbortSignal) => Promise<Partial<z.infer<TSchema>>>;
7822
7840
  onSubmit: (arg: F0WizardFormSingleSubmitArg<TSchema>) => Promise<F0FormSubmitResult> | F0FormSubmitResult;
7823
7841
  submitConfig?: F0FormSubmitConfig;
7824
7842
  errorTriggerMode?: F0FormErrorTriggerMode;
7825
- /** Whether async defaultValues are still being resolved */
7843
+ /** Whether async initialFiles are still being resolved */
7826
7844
  isLoading?: boolean;
7827
7845
  /** Zod schema describing params the AI can supply when calling presentForm */
7828
7846
  defaultValuesParamsSchema?: ZodType;
@@ -14809,6 +14827,18 @@ export declare type WelcomeScreenSuggestionItem = {
14809
14827
  prompt?: string;
14810
14828
  };
14811
14829
 
14830
+ /**
14831
+ * Payload for `tracking.onWelcomeSuggestionClick`. Carries everything an
14832
+ * analytics layer (e.g. Amplitude) needs to attribute the click: the picked
14833
+ * sub-item, its parent group, and the resolved prompt that was actually sent.
14834
+ */
14835
+ declare type WelcomeSuggestionClickEvent = {
14836
+ item: WelcomeScreenSuggestionItem;
14837
+ group: WelcomeScreenSuggestion;
14838
+ /** Prompt actually sent to the AI — `item.prompt` falling back to `item.title`. */
14839
+ prompt: string;
14840
+ };
14841
+
14812
14842
  declare interface WiggleOptions {
14813
14843
  errorHighlight?: boolean;
14814
14844
  }