@factorialco/f0-react 3.5.1 → 3.6.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.d.ts CHANGED
@@ -1827,6 +1827,15 @@ export declare const defaultTranslations: {
1827
1827
  readonly link: {
1828
1828
  readonly opensInNewTab: "opens in new tab";
1829
1829
  };
1830
+ readonly audioPlayer: {
1831
+ readonly label: "Audio player";
1832
+ readonly play: "Play";
1833
+ readonly pause: "Pause";
1834
+ readonly seek: "Seek";
1835
+ readonly options: "Recording options";
1836
+ readonly playbackSpeed: "Playback speed";
1837
+ readonly position: "{{current}} of {{total}}";
1838
+ };
1830
1839
  readonly actions: {
1831
1840
  readonly add: "Add";
1832
1841
  readonly edit: "Edit";
package/dist/ai.js CHANGED
@@ -1,6 +1,6 @@
1
- import { C as e, D as r, c as t, F as o, a as i, f as n, g as F, d as C, e as A, I as l, P as d, b as u, u as m } from "./F0CanvasPanel-CLzhNgm-.js";
1
+ import { C as e, D as r, c as t, F as o, a as i, f as n, g as F, d as C, e as A, I as l, P as d, b as u, u as m } from "./F0CanvasPanel-DvbRRItR.js";
2
2
  import { defaultTranslations as c } from "./i18n-provider-defaults.js";
3
- import { A as P, s as v, t as f, w as g, l as p, i as T, q as y, x as S, p as x, r as H, j as V, e as b, g as k, k as w, F as M, h as O, a as D, n as j, m as q, o as z, b as B, f as E, v as L, c as R, d as G, u as J } from "./useChatHistory-DXxW-N6d.js";
3
+ import { A as P, s as v, t as f, w as g, l as p, i as T, q as y, x as S, p as x, r as H, j as V, e as b, g as k, k as w, F as M, h as O, a as D, n as j, m as q, o as z, b as B, f as E, v as L, c as R, d as G, u as J } from "./useChatHistory-CLdeCKIl.js";
4
4
  export {
5
5
  P as AiChatTranslationsProvider,
6
6
  e as ChatSpinner,
@@ -3045,6 +3045,15 @@ declare const defaultTranslations: {
3045
3045
  readonly link: {
3046
3046
  readonly opensInNewTab: "opens in new tab";
3047
3047
  };
3048
+ readonly audioPlayer: {
3049
+ readonly label: "Audio player";
3050
+ readonly play: "Play";
3051
+ readonly pause: "Pause";
3052
+ readonly seek: "Seek";
3053
+ readonly options: "Recording options";
3054
+ readonly playbackSpeed: "Playback speed";
3055
+ readonly position: "{{current}} of {{total}}";
3056
+ };
3048
3057
  readonly actions: {
3049
3058
  readonly add: "Add";
3050
3059
  readonly edit: "Edit";
@@ -1,9 +1,9 @@
1
- import { h as ga, B as pa, i as ba, j as xa, k as Dt, l as Be, m as Te, n as va, o as b, p as J, q as ye, u as oe, T as ya, r as wa, s as Na, R as Ca, t as Ia, v as ce, w as ka, x as Nt, y as ut, z as Ve, A as Le, E as Sa, G as Fa, H as U, J as Aa, K as La, L as xe, M as mn, N as Oa, O as Pa, Q as H, S as hn, U as z, V as ke, W as Ea, X as _a, Y as Da, Z as Ta, _ as za, $ as Oe, a0 as gn, a1 as Ra, a2 as we, a3 as Ue, a4 as Ba, e as pn, a5 as Ae, a6 as $a, a7 as bn, a8 as ie, a9 as X, aa as xn, ab as vn, ac as Ma, ad as yn, ae as pe, af as ae, ag as Wa, ah as ja, ai as Va, aj as Ua, ak as ve, al as Ye, am as Ha, an as Ga, ao as Ka, ap as qa, aq as Je, ar as wn, as as Ya, at as Ja, au as Za, av as He, aw as Xa, ax as Nn, ay as Qa, az as er, aA as tr, aB as nr, aC as ar, aD as rr, aE as ir, aF as lr, aG as ft, aH as Cn, aI as mt, aJ as In, aK as sr, aL as or, aM as cr, aN as dr, aO as ur, aP as Ze, aQ as Xe, aR as ht, aS as kn, aT as fr, aU as Ct, aV as mr, aW as hr, aX as gr, aY as Re, aZ as pr, a_ as br, a$ as $e, b0 as Tt, b1 as gt, b2 as xr, b3 as vr, a as yr, b as wr, b4 as Sn, b5 as Nr, g as Cr, F as Ir, b6 as kr, b7 as Fn, b8 as Sr, b9 as An, ba as Ln, bb as Fr, bc as Ar, bd as Lr, be as Or, bf as Pr, bg as Er, bh as _r, bi as Dr, bj as Tr, bk as On, bl as zr, bm as Rr, bn as Br, bo as $r, bp as ge, bq as It, br as kt, bs as St, bt as Pn, bu as Ft, bv as En, bw as _n, bx as Mr, by as Wr, bz as jr, bA as Vr, bB as Ur, bC as Hr, bD as Gr, bE as Kr, bF as zt, bG as qr, bH as Yr, bI as Rt, bJ as Bt, bK as $t, bL as Jr, bM as Zr, bN as Xr, bO as Qr, bP as Dn, bQ as ei, bR as ti } from "./F0CanvasPanel-CLzhNgm-.js";
2
- import { c1 as Kc, c0 as qc, cd as Yc, bZ as Jc, b_ as Zc, bS as Xc, cg as Qc, bT as ed, bU as td, ch as nd, b$ as ad, c9 as rd, ca as id, ce as ld, bV as sd, c3 as od, c2 as cd, bW as dd, bX as ud, cb as fd, ci as md, cc as hd, cf as gd, c8 as pd, c5 as bd, c7 as xd, c4 as vd, bY as yd, c6 as wd } from "./F0CanvasPanel-CLzhNgm-.js";
1
+ import { h as ga, B as pa, i as ba, j as xa, k as Dt, l as Be, m as Te, n as va, o as b, p as J, q as ye, u as oe, T as ya, r as wa, s as Na, R as Ca, t as Ia, v as ce, w as ka, x as Nt, y as ut, z as Ve, A as Le, E as Sa, G as Fa, H as U, J as Aa, K as La, L as xe, M as mn, N as Oa, O as Pa, Q as H, S as hn, U as z, V as ke, W as Ea, X as _a, Y as Da, Z as Ta, _ as za, $ as Oe, a0 as gn, a1 as Ra, a2 as we, a3 as Ue, a4 as Ba, e as pn, a5 as Ae, a6 as $a, a7 as bn, a8 as ie, a9 as X, aa as xn, ab as vn, ac as Ma, ad as yn, ae as pe, af as ae, ag as Wa, ah as ja, ai as Va, aj as Ua, ak as ve, al as Ye, am as Ha, an as Ga, ao as Ka, ap as qa, aq as Je, ar as wn, as as Ya, at as Ja, au as Za, av as He, aw as Xa, ax as Nn, ay as Qa, az as er, aA as tr, aB as nr, aC as ar, aD as rr, aE as ir, aF as lr, aG as ft, aH as Cn, aI as mt, aJ as In, aK as sr, aL as or, aM as cr, aN as dr, aO as ur, aP as Ze, aQ as Xe, aR as ht, aS as kn, aT as fr, aU as Ct, aV as mr, aW as hr, aX as gr, aY as Re, aZ as pr, a_ as br, a$ as $e, b0 as Tt, b1 as gt, b2 as xr, b3 as vr, a as yr, b as wr, b4 as Sn, b5 as Nr, g as Cr, F as Ir, b6 as kr, b7 as Fn, b8 as Sr, b9 as An, ba as Ln, bb as Fr, bc as Ar, bd as Lr, be as Or, bf as Pr, bg as Er, bh as _r, bi as Dr, bj as Tr, bk as On, bl as zr, bm as Rr, bn as Br, bo as $r, bp as ge, bq as It, br as kt, bs as St, bt as Pn, bu as Ft, bv as En, bw as _n, bx as Mr, by as Wr, bz as jr, bA as Vr, bB as Ur, bC as Hr, bD as Gr, bE as Kr, bF as zt, bG as qr, bH as Yr, bI as Rt, bJ as Bt, bK as $t, bL as Jr, bM as Zr, bN as Xr, bO as Qr, bP as Dn, bQ as ei, bR as ti } from "./F0CanvasPanel-DvbRRItR.js";
2
+ import { c1 as Kc, c0 as qc, cd as Yc, bZ as Jc, b_ as Zc, bS as Xc, cg as Qc, bT as ed, bU as td, ch as nd, b$ as ad, c9 as rd, ca as id, ce as ld, bV as sd, c3 as od, c2 as cd, bW as dd, bX as ud, cb as fd, ci as md, cc as hd, cf as gd, c8 as pd, c5 as bd, c7 as xd, c4 as vd, bY as yd, c6 as wd } from "./F0CanvasPanel-DvbRRItR.js";
3
3
  import { jsx as e, jsxs as o, Fragment as Z } from "react/jsx-runtime";
4
4
  import ue, { forwardRef as G, useRef as j, useTransition as ni, useState as D, useLayoutEffect as Tn, useId as pt, useContext as Pe, createContext as Qe, useEffect as W, useCallback as ne, useMemo as q, Fragment as ai, isValidElement as ri, cloneElement as zn, Children as Rn } from "react";
5
- import { C as ii, P as li, a as Bn, M as si, p as oi, b as ci, R as Mt, c as $n, u as di, d as ui, e as fi, f as mi, g as hi, h as Mn, S as gi, A as pi, B as bi, L as xi, i as vi, V as yi, j as wi, k as Ni, l as Ci, O as Ii } from "./useDataCollectionSource-CehPwPy3.js";
6
- import { r as Cd, s as Id, o as kd, H as Sd, t as Fd, z as Ad, a8 as Ld, G as Od, q as Pd, aa as Ed, a9 as _d, Q as Dd, ad as Td, F as zd, Y as Rd, U as Bd, J as $d, af as Md, K as Wd, Z as jd, _ as Vd, v as Ud, ab as Hd, ac as Gd, N as Kd, $ as qd, a5 as Yd, a7 as Jd, w as Zd, y as Xd, D as Qd, W as eu, ae as tu, X as nu, T as au, ag as ru, x as iu, E as lu, m as su, n as ou, a1 as cu, a2 as du, a6 as uu, I as fu, a3 as mu, a0 as hu, a4 as gu } from "./useDataCollectionSource-CehPwPy3.js";
5
+ import { C as ii, P as li, a as Bn, M as si, p as oi, b as ci, R as Mt, c as $n, u as di, d as ui, e as fi, f as mi, g as hi, h as Mn, S as gi, A as pi, B as bi, L as xi, i as vi, V as yi, j as wi, k as Ni, l as Ci, O as Ii } from "./useDataCollectionSource-DBWuY_n4.js";
6
+ import { r as Cd, s as Id, o as kd, H as Sd, t as Fd, z as Ad, a8 as Ld, G as Od, q as Pd, aa as Ed, a9 as _d, Q as Dd, ad as Td, F as zd, Y as Rd, U as Bd, J as $d, af as Md, K as Wd, Z as jd, _ as Vd, v as Ud, ab as Hd, ac as Gd, N as Kd, $ as qd, a5 as Yd, a7 as Jd, w as Zd, y as Xd, D as Qd, W as eu, ae as tu, X as nu, T as au, ag as ru, x as iu, E as lu, m as su, n as ou, a1 as cu, a2 as du, a6 as uu, I as fu, a3 as mu, a0 as hu, a4 as gu } from "./useDataCollectionSource-DBWuY_n4.js";
7
7
  const ki = ga("Search", [
8
8
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
9
9
  ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
package/dist/f0.d.ts CHANGED
@@ -44,6 +44,8 @@ import type * as echarts_2 from 'echarts';
44
44
  import { EmployeeItemProps } from './types';
45
45
  import { F0AccordionSkeletonProps } from './F0AccordionSkeleton';
46
46
  import { F0AnalyticsDashboardProps as F0AnalyticsDashboardProps_2 } from './types';
47
+ import { F0AudioPlayerCardProps as F0AudioPlayerCardProps_2 } from './types';
48
+ import { F0AudioPlayerProps as F0AudioPlayerProps_2 } from './types';
47
49
  import { F0AvatarCompanyProps as F0AvatarCompanyProps_2 } from './types';
48
50
  import { F0AvatarDateProps } from './F0AvatarDate';
49
51
  import { F0AvatarEmojiProps as F0AvatarEmojiProps_2 } from './F0AvatarEmoji';
@@ -1163,6 +1165,33 @@ export declare type AttachedFile = {
1163
1165
  errorMessage?: string;
1164
1166
  };
1165
1167
 
1168
+ export declare interface AudioPlayerControls extends AudioPlayerState {
1169
+ play: () => void;
1170
+ pause: () => void;
1171
+ toggle: () => void;
1172
+ seek: (seconds: number) => void;
1173
+ setPlaybackRate: (rate: number) => void;
1174
+ }
1175
+
1176
+ export declare interface AudioPlayerMenuAction {
1177
+ label: string;
1178
+ icon?: IconType;
1179
+ onClick: () => void;
1180
+ critical?: boolean;
1181
+ }
1182
+
1183
+ export declare const audioPlayerSizes: readonly ["sm", "md"];
1184
+
1185
+ export declare interface AudioPlayerState {
1186
+ isPlaying: boolean;
1187
+ currentTime: number;
1188
+ duration: number;
1189
+ buffered: number;
1190
+ playbackRate: number;
1191
+ isLoading: boolean;
1192
+ error: MediaError | null;
1193
+ }
1194
+
1166
1195
  /**
1167
1196
  * An item that can be passed in the `availableFormDefinitions` array.
1168
1197
  * Accepts either a plain {@link F0AiAvailableFormDefinition} or the result
@@ -4298,6 +4327,15 @@ export declare const defaultTranslations: {
4298
4327
  readonly link: {
4299
4328
  readonly opensInNewTab: "opens in new tab";
4300
4329
  };
4330
+ readonly audioPlayer: {
4331
+ readonly label: "Audio player";
4332
+ readonly play: "Play";
4333
+ readonly pause: "Pause";
4334
+ readonly seek: "Seek";
4335
+ readonly options: "Recording options";
4336
+ readonly playbackSpeed: "Playback speed";
4337
+ readonly position: "{{current}} of {{total}}";
4338
+ };
4301
4339
  readonly actions: {
4302
4340
  readonly add: "Add";
4303
4341
  readonly edit: "Edit";
@@ -6552,6 +6590,110 @@ declare type F0AssistantMessageExtraProps = {
6552
6590
  renderMarkdown?: (content: string) => ReactNode;
6553
6591
  };
6554
6592
 
6593
+ /**
6594
+ * @experimental This is an experimental component, use it at your own risk.
6595
+ */
6596
+ export declare const F0AudioPlayer: WithDataTestIdReturnType_3<ForwardRefExoticComponent<F0AudioPlayerProps_2 & RefAttributes<HTMLDivElement>>>;
6597
+
6598
+ /**
6599
+ * @experimental This is an experimental component, use it at your own risk.
6600
+ */
6601
+ export declare const F0AudioPlayerCard: WithDataTestIdReturnType_3<ForwardRefExoticComponent<F0AudioPlayerCardProps_2 & RefAttributes<HTMLDivElement>>>;
6602
+
6603
+ export declare interface F0AudioPlayerCardProps extends F0AudioPlayerProps {
6604
+ /**
6605
+ * The title shown in the card header (e.g. "AI Call with Alex Williams").
6606
+ */
6607
+ title: string;
6608
+ /**
6609
+ * An optional subtitle shown under the title (e.g. "May 9, 2025 - 10:00am").
6610
+ */
6611
+ subtitle?: string;
6612
+ /**
6613
+ * Extra actions appended to the kebab menu below the playback-speed options
6614
+ * (after a separator) — e.g. a download or copy-link action. The kebab itself
6615
+ * is always rendered by the card.
6616
+ */
6617
+ actions?: AudioPlayerMenuAction[];
6618
+ }
6619
+
6620
+ export declare interface F0AudioPlayerProps extends WithDataTestIdProps, DataAttributes_2 {
6621
+ /**
6622
+ * The audio source URL.
6623
+ */
6624
+ src: string;
6625
+ /**
6626
+ * How much of the audio to preload.
6627
+ * @default "metadata"
6628
+ */
6629
+ preload?: "none" | "metadata" | "auto";
6630
+ /**
6631
+ * Start playing as soon as the audio is ready.
6632
+ * @default false
6633
+ */
6634
+ autoPlay?: boolean;
6635
+ /**
6636
+ * Controlled playing state. Pair with `onPlayingChange`.
6637
+ */
6638
+ playing?: boolean;
6639
+ /**
6640
+ * Initial playing state when uncontrolled.
6641
+ * @default false
6642
+ */
6643
+ defaultPlaying?: boolean;
6644
+ /**
6645
+ * Fired when the playing state changes (play or pause).
6646
+ */
6647
+ onPlayingChange?: (playing: boolean) => void;
6648
+ /**
6649
+ * Playback rates offered in the speed menu. Pass an empty array to hide the
6650
+ * speed options.
6651
+ * @default [1, 1.5, 2]
6652
+ */
6653
+ playbackRates?: number[];
6654
+ /**
6655
+ * Fired when playback starts.
6656
+ */
6657
+ onPlay?: () => void;
6658
+ /**
6659
+ * Fired when playback pauses.
6660
+ */
6661
+ onPause?: () => void;
6662
+ /**
6663
+ * Fired when the user seeks, with the target position in seconds.
6664
+ */
6665
+ onSeek?: (seconds: number) => void;
6666
+ /**
6667
+ * Fired on every time update, with the current position in seconds.
6668
+ */
6669
+ onTimeUpdate?: (seconds: number) => void;
6670
+ /**
6671
+ * Fired when playback reaches the end.
6672
+ */
6673
+ onEnded?: () => void;
6674
+ /**
6675
+ * Fired when the audio fails to load or play.
6676
+ */
6677
+ onError?: (error: MediaError | null) => void;
6678
+ /**
6679
+ * Disables all controls.
6680
+ * @default false
6681
+ */
6682
+ disabled?: boolean;
6683
+ /**
6684
+ * Accessible label for the player region.
6685
+ */
6686
+ ariaLabel?: string;
6687
+ /**
6688
+ * The size of the player.
6689
+ * @default "md"
6690
+ */
6691
+ size?: F0AudioPlayerSize;
6692
+ className?: string;
6693
+ }
6694
+
6695
+ export declare type F0AudioPlayerSize = (typeof audioPlayerSizes)[number];
6696
+
6555
6697
  export declare function F0AuraVoiceAnimation({ size, state, color, colorShift, audioTrack, themeMode, className, ref, ...props }: F0AuraVoiceAnimationProps & ComponentProps<"div"> & VariantProps<typeof F0AuraVoiceAnimationVariants>): JSX_2.Element;
6556
6698
 
6557
6699
  export declare interface F0AuraVoiceAnimationProps {
@@ -11048,6 +11190,8 @@ declare type FontSize = (typeof fontSizes)[number];
11048
11190
 
11049
11191
  declare const fontSizes: readonly ["sm", "md", "lg"];
11050
11192
 
11193
+ export declare const formatPlaybackTime: (seconds: number) => string;
11194
+
11051
11195
  /**
11052
11196
  * A preset formatting instruction the LLM can specify instead of a
11053
11197
  * real formatter function. The wrapper component maps these to actual
@@ -15391,6 +15535,17 @@ export declare function useAiChat(): AiChatProviderReturnValue;
15391
15535
 
15392
15536
  export declare function useAiChatTranslations(): AiChatTranslations;
15393
15537
 
15538
+ export declare const useAudioPlayer: (audioRef: RefObject<HTMLAudioElement>, callbacks?: UseAudioPlayerCallbacks) => AudioPlayerControls;
15539
+
15540
+ declare interface UseAudioPlayerCallbacks {
15541
+ onPlay?: () => void;
15542
+ onPause?: () => void;
15543
+ onSeek?: (seconds: number) => void;
15544
+ onTimeUpdate?: (seconds: number) => void;
15545
+ onEnded?: () => void;
15546
+ onError?: (error: MediaError | null) => void;
15547
+ }
15548
+
15394
15549
  /**
15395
15550
  * Hook returning the canvas entity definition for `type` from the registry
15396
15551
  * supplied to `F0AiChatProvider.canvasEntities`. Returns `undefined` when no