@factorialco/f0-react 1.434.0 → 1.436.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.
@@ -1,7 +1,7 @@
1
1
  import { defaultTranslations as ke } from "./i18n-provider-defaults.js";
2
2
  import { jsx as q, jsxs as le } from "react/jsx-runtime";
3
3
  import { useInsertionEffect as Xe, createContext as Ye, useContext as $e, useRef as B, useEffect as ie, useState as Ue, useCallback as qe, useMemo as He } from "react";
4
- import { r as Ke, l as je, m as Qe, n as Je, o as Me, p as Ze, q as et, s as tt, t as rt, v as nt, w as Ne, x as ot, V as it, y as st, z as at, A as ct, S as ut, H as lt, B as se, D as ft, E as dt, G as ht, J as mt, K as pt, L as vt, M as fe, N as gt } from "./F0AiChat-BCNtjNO0.js";
4
+ import { r as Ke, l as je, m as Qe, n as Je, o as Me, p as Ze, q as et, s as tt, t as rt, v as nt, w as Ne, x as ot, V as it, y as st, z as at, A as ct, S as ut, H as lt, B as se, D as ft, E as dt, G as ht, J as mt, K as pt, L as vt, M as fe, N as gt } from "./F0AiChat-Cg05PVK9.js";
5
5
  import { useTrackVolume as wt } from "@livekit/components-react";
6
6
  function Tt(t, e, r) {
7
7
  Xe(() => t.on(e, r), [t, e, r]);
package/dist/ai.d.ts CHANGED
@@ -237,6 +237,10 @@ declare type AiChatProviderReturnValue = {
237
237
  inProgress: boolean;
238
238
  /** Set the in-progress state (synced from CopilotKit's isLoading) */
239
239
  setInProgress: (value: boolean) => void;
240
+ /** The current clarifying question shown in the textarea, or null if none */
241
+ clarifyingQuestion: ClarifyingQuestionState | null;
242
+ /** Set the current clarifying question (or null to dismiss) */
243
+ setClarifyingQuestion: React.Dispatch<React.SetStateAction<ClarifyingQuestionState | null>>;
240
244
  } & Pick<AiChatState, "greeting" | "agent" | "disclaimer" | "resizable" | "entityRefs" | "toolHints" | "credits" | "fileAttachments"> & {
241
245
  /** The current canvas content, or null when canvas is closed */
242
246
  canvasContent: CanvasContent | null;
@@ -422,6 +426,15 @@ export declare const aiTranslations: {
422
426
  };
423
427
  readonly attachFile: "Attach file";
424
428
  readonly removeFile: "Remove";
429
+ readonly clarifyingQuestion: {
430
+ readonly submit: "Submit";
431
+ readonly next: "Next";
432
+ readonly back: "Back";
433
+ readonly typeYourAnswer: "Type your answer…";
434
+ readonly stepOf: "{{current}} of {{total}}";
435
+ readonly custom: "own answer";
436
+ readonly skipped: "skipped";
437
+ };
425
438
  readonly growth: {
426
439
  readonly demoCard: {
427
440
  readonly title: "See {{moduleName}} in action";
@@ -672,6 +685,81 @@ declare type ChatTextareaProps = InputProps & {
672
685
  onGetCredits?: () => void;
673
686
  };
674
687
 
688
+ /**
689
+ * A single selectable option within a clarifying question step.
690
+ */
691
+ declare interface ClarifyingOption {
692
+ /** Unique identifier for this option */
693
+ id: string;
694
+ /** Display label shown to the user */
695
+ label: string;
696
+ }
697
+
698
+ /**
699
+ * The active clarifying question state pushed into the AiChat context.
700
+ * When no clarifying question is active the context value is `null`.
701
+ *
702
+ * Navigation metadata (currentStepIndex, totalSteps) and callbacks live
703
+ * here so the panel component stays a pure view of this state.
704
+ */
705
+ declare interface ClarifyingQuestionState {
706
+ /** The current step's data + interaction state */
707
+ currentStep: ClarifyingStepState;
708
+ /** Zero-based index of the current step */
709
+ currentStepIndex: number;
710
+ /** Total number of steps (1 for single-step questions) */
711
+ totalSteps: number;
712
+ /** Toggle selection of an option by its ID */
713
+ toggleOption: (optionId: string) => void;
714
+ /** Confirm the current step's selection and advance (or submit on final step) */
715
+ confirm: () => void;
716
+ /** Go back to the previous step */
717
+ back: () => void;
718
+ /** Set the custom answer text */
719
+ setCustomAnswerText: (text: string) => void;
720
+ /** Toggle whether the custom answer is included in the submission */
721
+ setCustomAnswerActive: (active: boolean) => void;
722
+ /** Activate the custom answer input (in single mode, clears predefined selections) */
723
+ activateCustomAnswer: () => void;
724
+ }
725
+
726
+ /**
727
+ * Selection mode for a clarifying question step.
728
+ * - "single": only one option can be selected (rendered as radio buttons)
729
+ * - "multiple": multiple options can be selected (rendered as checkboxes)
730
+ */
731
+ declare type ClarifyingSelectionMode = "single" | "multiple";
732
+
733
+ /**
734
+ * Pure data describing a single clarifying question step.
735
+ * This is what the AI backend sends — no UI state or callbacks.
736
+ */
737
+ declare interface ClarifyingStepData {
738
+ /** The question text displayed to the user */
739
+ question: string;
740
+ /** Available options the user can select from */
741
+ options: ClarifyingOption[];
742
+ /** Selection mode. Defaults to "single" when omitted */
743
+ selectionMode?: ClarifyingSelectionMode;
744
+ /** Whether the user can skip this step without selecting any option */
745
+ optional?: boolean;
746
+ /** Whether the user can type a free-text custom answer */
747
+ allowCustomAnswer?: boolean;
748
+ }
749
+
750
+ /**
751
+ * A step enriched with the user's current interaction state.
752
+ * Used internally by the controller to track selections per step.
753
+ */
754
+ declare interface ClarifyingStepState extends ClarifyingStepData {
755
+ /** IDs of currently selected options */
756
+ selectedOptionIds: string[];
757
+ /** Current custom answer text (preserved even when deactivated) */
758
+ customAnswerText?: string;
759
+ /** Whether the custom answer is currently included in the submission */
760
+ isCustomAnswerActive: boolean;
761
+ }
762
+
675
763
  declare interface CollectionComputation {
676
764
  datasetId: string;
677
765
  sortBy?: string;
@@ -1163,6 +1251,15 @@ export declare const defaultTranslations: {
1163
1251
  };
1164
1252
  readonly attachFile: "Attach file";
1165
1253
  readonly removeFile: "Remove";
1254
+ readonly clarifyingQuestion: {
1255
+ readonly submit: "Submit";
1256
+ readonly next: "Next";
1257
+ readonly back: "Back";
1258
+ readonly typeYourAnswer: "Type your answer…";
1259
+ readonly stepOf: "{{current}} of {{total}}";
1260
+ readonly custom: "own answer";
1261
+ readonly skipped: "skipped";
1262
+ };
1166
1263
  readonly growth: {
1167
1264
  readonly demoCard: {
1168
1265
  readonly title: "See {{moduleName}} in action";
@@ -1872,6 +1969,11 @@ declare module "gridstack" {
1872
1969
  }
1873
1970
 
1874
1971
 
1972
+ declare namespace Calendar {
1973
+ var displayName: string;
1974
+ }
1975
+
1976
+
1875
1977
  declare module "@tiptap/core" {
1876
1978
  interface Commands<ReturnType> {
1877
1979
  aiBlock: {
@@ -1919,8 +2021,3 @@ declare module "@tiptap/core" {
1919
2021
  };
1920
2022
  }
1921
2023
  }
1922
-
1923
-
1924
- declare namespace Calendar {
1925
- var displayName: string;
1926
- }
package/dist/ai.js CHANGED
@@ -1,6 +1,6 @@
1
- import { i as t, h as i, F as e, a as n, C as o, b as r, j as A, k as c, I as u, g as F, c as h, d as C, u as l, f as I, e as f } from "./F0AiChat-BCNtjNO0.js";
1
+ import { i as t, h as i, F as e, a as n, C as o, b as r, j as A, k as c, I as u, g as F, c as h, d as C, u as l, f as I, e as f } from "./F0AiChat-Cg05PVK9.js";
2
2
  import { defaultTranslations as d } from "./i18n-provider-defaults.js";
3
- import { A as p, F as S, c as g, d as v, b as x, a as k, o as O, u as P } from "./F0HILActionConfirmation-4KT5qQii.js";
3
+ import { A as p, F as S, c as g, d as v, b as x, a as k, o as O, u as P } from "./F0HILActionConfirmation-CMnMjtvP.js";
4
4
  export {
5
5
  p as AiChatTranslationsProvider,
6
6
  t as ChatSpinner,