@factorialco/f0-react 1.412.0 → 1.413.1

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.
@@ -109665,23 +109665,23 @@ export {
109665
109665
  kH as d$,
109666
109666
  bc as d0,
109667
109667
  GI as d1,
109668
- gr1 as d2,
109669
- Jn1 as d3,
109670
- Lk as d4,
109671
- wB as d5,
109672
- AB as d6,
109673
- Ad as d7,
109674
- Td as d8,
109675
- Dd as d9,
109676
- gI as dA,
109677
- II as dB,
109678
- XI as dC,
109679
- ka as dD,
109680
- tB as dE,
109681
- rB as dF,
109682
- hr1 as dG,
109683
- cB as dH,
109684
- CB as dI,
109668
+ Jn1 as d2,
109669
+ Lk as d3,
109670
+ wB as d4,
109671
+ AB as d5,
109672
+ Ad as d6,
109673
+ Td as d7,
109674
+ Dd as d8,
109675
+ Ow as d9,
109676
+ II as dA,
109677
+ XI as dB,
109678
+ ka as dC,
109679
+ tB as dD,
109680
+ rB as dE,
109681
+ hr1 as dF,
109682
+ cB as dG,
109683
+ CB as dH,
109684
+ gr1 as dI,
109685
109685
  br1 as dJ,
109686
109686
  wr1 as dK,
109687
109687
  yr1 as dL,
@@ -109700,87 +109700,86 @@ export {
109700
109700
  d0 as dY,
109701
109701
  or as dZ,
109702
109702
  qs2 as d_,
109703
- Ow as da,
109704
- qu2 as db,
109705
- zr1 as dc,
109706
- UI as dd,
109707
- QI as de,
109708
- bj as df,
109709
- Cr1 as dg,
109710
- Zr1 as dh,
109711
- p8 as di,
109712
- Qn1 as dj,
109713
- cx as dk,
109714
- Ar1 as dl,
109715
- qn as dm,
109716
- Xe1 as dn,
109717
- D3 as dp,
109718
- n01 as dq,
109719
- Qr1 as dr,
109720
- Jr1 as ds,
109721
- lF as dt,
109722
- n4 as du,
109723
- gc as dv,
109724
- sr1 as dw,
109725
- lr1 as dx,
109726
- WI as dy,
109727
- mI as dz,
109703
+ qu2 as da,
109704
+ zr1 as db,
109705
+ UI as dc,
109706
+ QI as dd,
109707
+ bj as de,
109708
+ Cr1 as df,
109709
+ Zr1 as dg,
109710
+ p8 as dh,
109711
+ Qn1 as di,
109712
+ cx as dj,
109713
+ Ar1 as dk,
109714
+ qn as dl,
109715
+ Xe1 as dm,
109716
+ D3 as dn,
109717
+ n01 as dp,
109718
+ Qr1 as dq,
109719
+ Jr1 as dr,
109720
+ lF as ds,
109721
+ n4 as dt,
109722
+ gc as du,
109723
+ sr1 as dv,
109724
+ lr1 as dw,
109725
+ WI as dx,
109726
+ mI as dy,
109727
+ gI as dz,
109728
109728
  JL as e,
109729
109729
  sd as e0,
109730
109730
  HH as e1,
109731
109731
  zk as e2,
109732
109732
  wc as e3,
109733
- q42 as e4,
109734
- j2 as e5,
109735
- Y1 as e6,
109736
- i9 as e7,
109737
- Fr as e8,
109738
- r8 as e9,
109739
- gs2 as eA,
109740
- pl as eB,
109741
- tx as eC,
109742
- nx as eD,
109743
- rx as eE,
109744
- PH as eF,
109745
- b91 as eG,
109746
- V6 as eH,
109747
- E6 as eI,
109748
- or1 as eJ,
109749
- Yb as eK,
109750
- R01 as eL,
109751
- jC2 as eM,
109752
- Xr1 as eN,
109753
- k01 as eO,
109754
- ll2 as eP,
109755
- ef2 as eQ,
109756
- Tn1 as eR,
109757
- sn1 as eS,
109758
- Nr1 as ea,
109759
- Dr1 as eb,
109760
- Tr1 as ec,
109761
- tl2 as ed,
109762
- F4 as ee,
109763
- pi as ef,
109764
- y3 as eg,
109765
- a7 as eh,
109766
- dl2 as ei,
109767
- Fu2 as ej,
109768
- Jv as ek,
109769
- c8 as el,
109770
- cd2 as em,
109771
- dd2 as en,
109772
- kF as eo,
109773
- er as ep,
109774
- Qn as eq,
109775
- oD as er,
109776
- Ml as es,
109777
- c3 as et,
109778
- t7 as eu,
109779
- ah as ev,
109780
- SN as ew,
109781
- er1 as ex,
109782
- q6 as ey,
109783
- nl2 as ez,
109733
+ er as e4,
109734
+ Qn as e5,
109735
+ oD as e6,
109736
+ Ml as e7,
109737
+ c3 as e8,
109738
+ t7 as e9,
109739
+ j2 as eA,
109740
+ Y1 as eB,
109741
+ i9 as eC,
109742
+ Fr as eD,
109743
+ r8 as eE,
109744
+ Nr1 as eF,
109745
+ Dr1 as eG,
109746
+ Tr1 as eH,
109747
+ F4 as eI,
109748
+ pi as eJ,
109749
+ y3 as eK,
109750
+ a7 as eL,
109751
+ dl2 as eM,
109752
+ Fu2 as eN,
109753
+ Jv as eO,
109754
+ cd2 as eP,
109755
+ dd2 as eQ,
109756
+ kF as eR,
109757
+ ah as ea,
109758
+ SN as eb,
109759
+ er1 as ec,
109760
+ q6 as ed,
109761
+ nl2 as ee,
109762
+ tl2 as ef,
109763
+ gs2 as eg,
109764
+ pl as eh,
109765
+ tx as ei,
109766
+ nx as ej,
109767
+ rx as ek,
109768
+ PH as el,
109769
+ c8 as em,
109770
+ b91 as en,
109771
+ V6 as eo,
109772
+ E6 as ep,
109773
+ or1 as eq,
109774
+ Yb as er,
109775
+ R01 as es,
109776
+ jC2 as et,
109777
+ Xr1 as eu,
109778
+ k01 as ev,
109779
+ ll2 as ew,
109780
+ ef2 as ex,
109781
+ Tn1 as ey,
109782
+ sn1 as ez,
109784
109783
  ZN as f,
109785
109784
  y6 as g,
109786
109785
  E3 as h,
package/dist/ai.d.ts CHANGED
@@ -37,6 +37,11 @@ declare type AiChatDisclaimer = {
37
37
  linkText?: string;
38
38
  };
39
39
 
40
+ /**
41
+ * Interaction mode for the AI chat
42
+ */
43
+ export declare type AiChatMode = "chat" | "voice";
44
+
40
45
  /**
41
46
  * Props for the AiChatProvider component
42
47
  */
@@ -73,6 +78,10 @@ export declare type AiChatProviderProps = {
73
78
  * Optional footer content rendered below the textarea
74
79
  */
75
80
  footer?: React.ReactNode;
81
+ /**
82
+ * Optional component rendered in place of the chat UI when voice mode is active.
83
+ */
84
+ VoiceMode?: React.ComponentType;
76
85
  /**
77
86
  * Async resolver functions for entity references in markdown.
78
87
  * Used to fetch profile data for inline entity mentions (hover cards).
@@ -166,6 +175,14 @@ declare type AiChatProviderReturnValue = {
166
175
  * Set the visualization mode
167
176
  */
168
177
  setVisualizationMode: React.Dispatch<React.SetStateAction<VisualizationMode>>;
178
+ /**
179
+ * The current interaction mode
180
+ */
181
+ mode: AiChatMode;
182
+ /**
183
+ * Set the interaction mode
184
+ */
185
+ setMode: React.Dispatch<React.SetStateAction<AiChatMode>>;
169
186
  /**
170
187
  * When true, prevents switching between visualization modes
171
188
  */
@@ -175,6 +192,10 @@ declare type AiChatProviderReturnValue = {
175
192
  * Optional footer content rendered below the textarea
176
193
  */
177
194
  footer?: React.ReactNode;
195
+ /**
196
+ * Optional component rendered when voice mode is active.
197
+ */
198
+ VoiceMode?: React.ComponentType;
178
199
  /**
179
200
  * Set the footer content. Use this to update the footer from outside the provider (e.g. per page/route).
180
201
  */
@@ -182,8 +203,6 @@ declare type AiChatProviderReturnValue = {
182
203
  } & Pick<AiChatState, "greeting" | "agent" | "disclaimer" | "resizable" | "entityResolvers" | "toolHints"> & {
183
204
  /** The current canvas content, or null when canvas is closed */
184
205
  canvasContent: CanvasContent | null;
185
- /** The dashboard config from the current canvas content, or null */
186
- canvasDashboard: ChatDashboardConfig | null;
187
206
  /** Open the canvas panel with the given content */
188
207
  openCanvas: (content: CanvasContent) => void;
189
208
  /** Close the canvas panel and restore the previous visualization mode */
@@ -192,10 +211,6 @@ declare type AiChatProviderReturnValue = {
192
211
  activeToolHint: AiChatToolHint | null;
193
212
  /** Set the active tool hint (pass null to clear) */
194
213
  setActiveToolHint: React.Dispatch<React.SetStateAction<AiChatToolHint | null>>;
195
- /** Get a saved dashboard config by toolCallId (returns updated config after user edits) */
196
- getSavedDashboardConfig: (toolCallId: string) => ChatDashboardConfig | undefined;
197
- /** Save an updated dashboard config keyed by toolCallId */
198
- updateDashboardConfig: (toolCallId: string, config: ChatDashboardConfig) => void;
199
214
  };
200
215
 
201
216
  /**
@@ -213,6 +228,7 @@ declare interface AiChatState {
213
228
  lockVisualizationMode?: boolean;
214
229
  historyEnabled?: boolean;
215
230
  footer?: React.ReactNode;
231
+ VoiceMode?: React.ComponentType;
216
232
  entityResolvers?: EntityResolvers;
217
233
  toolHints?: AiChatToolHint[];
218
234
  placeholders?: string[];
@@ -345,19 +361,54 @@ export declare function Blockquote({ children, ...props }: React.HTMLAttributes<
345
361
 
346
362
  /**
347
363
  * Discriminated union for canvas panel content.
348
- * Expand this union to support new content types in the canvas.
364
+ * Add new entity types to this union as they are implemented.
349
365
  */
350
- export declare type CanvasContent = {
351
- type: "dashboard";
366
+ export declare type CanvasContent = DashboardCanvasContent;
367
+
368
+ /**
369
+ * Base shape shared by all canvas content types.
370
+ * Every entity adds its own fields on top of this.
371
+ */
372
+ export declare type CanvasContentBase = {
373
+ type: string;
352
374
  title: string;
353
- config: ChatDashboardConfig;
354
- apiConfig: {
355
- baseUrl: string;
356
- headers: Record<string, string>;
357
- };
358
375
  toolCallId?: string;
359
376
  };
360
377
 
378
+ /**
379
+ * Contract for a canvas entity type.
380
+ *
381
+ * Each entity (dashboard, survey, goal, job-posting…) implements this
382
+ * interface and registers itself via `registerCanvasEntity()`.
383
+ *
384
+ * To add a new entity type:
385
+ * 1. Create a folder in `canvas/entities/<your-entity>/`
386
+ * 2. Define a type extending `CanvasContentBase` in `types.ts`
387
+ * 3. Implement `CanvasEntityDefinition` in `index.ts`
388
+ * 4. Import the entity module in `canvas/index.ts`
389
+ */
390
+ export declare type CanvasEntityDefinition<T extends CanvasContentBase = CanvasContentBase> = {
391
+ /** Must match the `type` discriminant on the content object */
392
+ type: T["type"];
393
+ /** Renders the main body of the canvas panel */
394
+ renderContent: (props: {
395
+ content: T;
396
+ refreshKey: number;
397
+ }) => ReactNode;
398
+ /** Renders header actions (placed before the close button) */
399
+ renderHeaderActions: (props: {
400
+ content: T;
401
+ }) => ReactNode;
402
+ /**
403
+ * Optional wrapper providing entity-scoped context around
404
+ * both header actions and body (e.g. shared edit-mode state).
405
+ */
406
+ wrapper?: (props: {
407
+ content: T;
408
+ children: ReactNode;
409
+ }) => ReactNode;
410
+ };
411
+
361
412
  export declare interface ChartComputation {
362
413
  datasetId: string;
363
414
  xAxis: string;
@@ -526,6 +577,29 @@ export declare interface CollectionComputation {
526
577
  */
527
578
  export declare type CSSRgbString = `rgb(${number}, ${number}, ${number})` | `rgb(${number},${number},${number})`;
528
579
 
580
+ /**
581
+ * Dashboard canvas content — renders an analytics dashboard.
582
+ */
583
+ export declare type DashboardCanvasContent = CanvasContentBase & {
584
+ type: "dashboard";
585
+ config: ChatDashboardConfig;
586
+ apiConfig: {
587
+ baseUrl: string;
588
+ headers: Record<string, string>;
589
+ };
590
+ };
591
+
592
+ /**
593
+ * Dashboard-specific card that wraps CanvasCard with config-store
594
+ * subscription logic. Re-renders when the user edits and saves
595
+ * the dashboard layout.
596
+ */
597
+ declare function DashboardCard({ config: originalConfig, onView, toolCallId, }: F0ChatReportCardProps): JSX_2.Element;
598
+
599
+ declare namespace DashboardCard {
600
+ var displayName: string;
601
+ }
602
+
529
603
  export declare interface DashboardFetchSpec {
530
604
  fetch: Array<{
531
605
  toolId: string;
@@ -1236,7 +1310,7 @@ export declare const F0AiChat: () => JSX_2.Element | null;
1236
1310
  /**
1237
1311
  * @experimental This is an experimental component use it at your own risk
1238
1312
  */
1239
- export declare const F0AiChatProvider: ({ enabled, greeting, initialMessage, welcomeScreenSuggestions, disclaimer, resizable, defaultVisualizationMode, lockVisualizationMode, historyEnabled, footer, entityResolvers, toolHints, onThumbsUp, onThumbsDown, children, agent, tracking, ...copilotKitProps }: AiChatProviderProps) => JSX_2.Element;
1313
+ export declare const F0AiChatProvider: ({ enabled, greeting, initialMessage, welcomeScreenSuggestions, disclaimer, resizable, defaultVisualizationMode, lockVisualizationMode, historyEnabled, footer, VoiceMode, entityResolvers, toolHints, onThumbsUp, onThumbsDown, children, agent, tracking, ...copilotKitProps }: AiChatProviderProps) => JSX_2.Element;
1240
1314
 
1241
1315
  export declare const F0AiChatTextArea: ({ submitLabel, inProgress, onSend, onStop, placeholders, defaultPlaceholder, autoFocus, entityResolvers, toolHints, activeToolHint, onActiveToolHintChange, }: F0AiChatTextAreaProps) => JSX_2.Element;
1242
1316
 
@@ -1373,29 +1447,19 @@ declare const F0AuraVoiceAnimationVariants: (props?: ({
1373
1447
  })) | undefined) => string;
1374
1448
 
1375
1449
  /**
1376
- * Compact card shown inline in the AI chat to represent a generated
1377
- * dashboard report. Uses F0Card with an icon avatar, the dashboard
1378
- * title/description, and an item summary in metadata. Clicking the
1379
- * card triggers `onView` to open the canvas panel.
1380
- *
1381
- * Subscribes to the external `savedDashboardConfigStore` via
1382
- * `useSyncExternalStore` so it re-renders when the user edits the
1383
- * dashboard layout and saves — independently of React context.
1450
+ * @deprecated Use `DashboardCard` from `canvas/entities/dashboard` directly.
1451
+ * This re-export exists for backwards compatibility.
1384
1452
  */
1385
- export declare function F0ChatReportCard({ config: originalConfig, onView, toolCallId, }: F0ChatReportCardProps): JSX_2.Element;
1453
+ export declare const F0ChatReportCard: typeof DashboardCard;
1386
1454
 
1387
- export declare namespace F0ChatReportCard {
1388
- var displayName: string;
1389
- }
1390
-
1391
- export declare interface F0ChatReportCardProps {
1455
+ export declare type F0ChatReportCardProps = {
1392
1456
  /** The original dashboard config from the agent */
1393
1457
  config: ChatDashboardConfig;
1394
1458
  /** Callback when the user clicks the card to view the report */
1395
1459
  onView: (config: ChatDashboardConfig) => void;
1396
1460
  /** Tool call ID used to look up saved (edited) dashboard configs */
1397
1461
  toolCallId?: string;
1398
- }
1462
+ };
1399
1463
 
1400
1464
  /**
1401
1465
  * Component that renders an optional markdown preview followed by
@@ -1639,6 +1703,12 @@ declare interface GaugeComputation {
1639
1703
  name?: string;
1640
1704
  }
1641
1705
 
1706
+ /**
1707
+ * Look up a registered entity definition by content type.
1708
+ * Returns `undefined` if the type hasn't been registered.
1709
+ */
1710
+ export declare function getCanvasEntity(type: string): CanvasEntityDefinition<any> | undefined;
1711
+
1642
1712
  export declare function H1({ children, ...props }: React.HTMLAttributes<HTMLHeadingElement>): JSX_2.Element;
1643
1713
 
1644
1714
  export declare function H2({ children, ...props }: React.HTMLAttributes<HTMLHeadingElement>): JSX_2.Element;
@@ -1784,6 +1854,12 @@ declare interface RadarComputation {
1784
1854
  sortOrder?: "asc" | "desc";
1785
1855
  }
1786
1856
 
1857
+ /**
1858
+ * Register a canvas entity definition.
1859
+ * Called as a side-effect when each entity module is imported.
1860
+ */
1861
+ export declare function registerCanvasEntity<T extends CanvasContentBase>(definition: CanvasEntityDefinition<T>): void;
1862
+
1787
1863
  export declare function Strong({ children, ...props }: React.HTMLAttributes<HTMLSpanElement>): JSX_2.Element;
1788
1864
 
1789
1865
  export declare function Table({ children, ...props }: React.HTMLAttributes<HTMLTableElement>): JSX_2.Element;
package/dist/ai.js CHANGED
@@ -1,56 +1,58 @@
1
- import { I as e, u as t } from "./F0Input-JjjfHKNJ.js";
1
+ import { I as e, u as t } from "./F0Input-C9w04Jpr.js";
2
2
  import { defaultTranslations as i } from "./i18n-provider-defaults.js";
3
- import { A as r, B as l, C as A, p as F, E as c, g as u, F as h, a as C, z as d, h as m, b as T, i as f, j as p, v as I, w as S, x as g, y as k, c as x, q as H, r as M, s as P, H as b, I as w, L as O, O as v, t as R, P as D, S as E, T as L, m as q, n as y, o as z, U as B, k as U, l as j, u as V, d as G, f as J, e as K } from "./F0AiChat-CA_dpVxM.js";
4
- import { A as Q, F as W, c as X, d as Y, b as Z, a as _, o as $, u as aa } from "./F0HILActionConfirmation-CasXGy89.js";
3
+ import { A as r, B as l, C as A, p as F, E as c, h as u, F as C, a as h, D as d, i as m, b as T, j as f, w as p, x as g, y as I, z as S, c as k, q as x, s as v, t as H, H as M, I as P, L as b, O as w, v as E, P as O, S as y, T as D, m as R, n as L, o as q, U as z, k as B, l as U, g as j, r as V, u as G, d as J, f as K, e as N } from "./F0AiChat-CMz8oLke.js";
4
+ import { A as W, F as X, c as Y, d as Z, e as _, b as $, a as aa, o as sa, u as ea } from "./F0HILActionConfirmation-MJSEogqB.js";
5
5
  export {
6
6
  r as A,
7
- Q as AiChatTranslationsProvider,
7
+ W as AiChatTranslationsProvider,
8
8
  l as Blockquote,
9
9
  A as ChatSpinner,
10
10
  F as Em,
11
11
  c as EntityRef,
12
12
  u as F0ActionItem,
13
- h as F0AiChat,
14
- C as F0AiChatProvider,
13
+ C as F0AiChat,
14
+ h as F0AiChatProvider,
15
15
  d as F0AiChatTextArea,
16
16
  m as F0AiCollapsibleMessage,
17
17
  T as F0AiFullscreenChat,
18
- W as F0AiMask,
19
- X as F0AuraVoiceAnimation,
20
- f as F0ChatReportCard,
21
- p as F0DataDownload,
22
- Y as F0HILActionConfirmation,
23
- I as F0MessageSources,
24
- S as F0OneIcon,
25
- g as F0OneSwitch,
26
- k as F0Thinking,
27
- x as FullscreenChatContext,
28
- H as H1,
29
- M as H2,
30
- P as H3,
31
- b as Hr,
18
+ X as F0AiMask,
19
+ Y as F0AuraVoiceAnimation,
20
+ Z as F0ChatReportCard,
21
+ f as F0DataDownload,
22
+ _ as F0HILActionConfirmation,
23
+ p as F0MessageSources,
24
+ g as F0OneIcon,
25
+ I as F0OneSwitch,
26
+ S as F0Thinking,
27
+ k as FullscreenChatContext,
28
+ x as H1,
29
+ v as H2,
30
+ H as H3,
31
+ M as Hr,
32
32
  e as I18nProvider,
33
- w as Image,
34
- O as Li,
35
- v as Ol,
36
- R as P,
37
- D as Pre,
38
- E as Strong,
39
- L as Table,
40
- q as TableSimple,
41
- y as Td,
42
- z as Th,
43
- B as Ul,
44
- Z as actionItemStatuses,
45
- _ as aiTranslations,
33
+ P as Image,
34
+ b as Li,
35
+ w as Ol,
36
+ E as P,
37
+ O as Pre,
38
+ y as Strong,
39
+ D as Table,
40
+ R as TableSimple,
41
+ L as Td,
42
+ q as Th,
43
+ z as Ul,
44
+ $ as actionItemStatuses,
45
+ aa as aiTranslations,
46
46
  i as defaultTranslations,
47
- U as f0MarkdownRenderers,
48
- j as f0MarkdownRenderersSimple,
49
- $ as oneIconSizes,
50
- V as useAiChat,
51
- aa as useAiChatTranslations,
52
- G as useDefaultCopilotActions,
47
+ B as f0MarkdownRenderers,
48
+ U as f0MarkdownRenderersSimple,
49
+ j as getCanvasEntity,
50
+ sa as oneIconSizes,
51
+ V as registerCanvasEntity,
52
+ G as useAiChat,
53
+ ea as useAiChatTranslations,
54
+ J as useDefaultCopilotActions,
53
55
  t as useI18n,
54
- J as useMessageSourcesAction,
55
- K as useOrchestratorThinkingAction
56
+ K as useMessageSourcesAction,
57
+ N as useOrchestratorThinkingAction
56
58
  };
@@ -445,6 +445,10 @@ declare type AiChatProviderProps = {
445
445
  * Optional footer content rendered below the textarea
446
446
  */
447
447
  footer?: React.ReactNode;
448
+ /**
449
+ * Optional component rendered in place of the chat UI when voice mode is active.
450
+ */
451
+ VoiceMode?: React.ComponentType;
448
452
  /**
449
453
  * Async resolver functions for entity references in markdown.
450
454
  * Used to fetch profile data for inline entity mentions (hover cards).