@askly/widget 2.9.0 → 2.11.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,28 +1,30 @@
1
1
  import React from "react";
2
2
  export interface ComposerProps {
3
- enableVoiceChat: boolean;
4
3
  fileInputRef: React.RefObject<HTMLInputElement>;
5
4
  handleEmojiClick: (emoji: string) => void;
6
5
  handleFileChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
7
6
  handleFileUploadClick: () => void;
8
7
  input: string;
9
8
  inputRef: React.RefObject<HTMLTextAreaElement>;
10
- isListening: boolean;
11
9
  isTyping: boolean;
12
10
  leadRequired: boolean;
13
11
  placeholderText: string;
14
- readAloud: boolean;
15
12
  sendMessage: (text?: string) => void | Promise<void>;
16
13
  setInput: React.Dispatch<React.SetStateAction<string>>;
17
14
  setShowEmojiPicker: (show: boolean) => void;
18
- setTtsMuted: (muted: boolean) => void;
19
15
  showEmojiPicker: boolean;
20
- stopSpeaking: () => void;
21
- toggleVoiceInput: () => void;
22
- ttsMuted: boolean;
23
- ttsMutedRef: React.MutableRefObject<boolean>;
16
+ startVoiceInput: () => void;
17
+ stopVoiceInput: () => void;
18
+ cancelVoiceInput: () => void;
24
19
  turnstileBlocked: boolean;
25
20
  uploadingFile: boolean;
21
+ voiceInputEnabled: boolean;
22
+ voiceMaxMs: number;
23
+ voiceMeterRef: React.MutableRefObject<{
24
+ level: number;
25
+ elapsedMs: number;
26
+ }>;
27
+ voicePhase: "idle" | "starting" | "recording" | "transcribing";
26
28
  }
27
- /** The message box and its actions: attach, emoji, voice input, read-aloud and send. */
29
+ /** The message box and its actions: attach, emoji, voice input and send. */
28
30
  export declare function Composer(props: ComposerProps): React.JSX.Element;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ export interface VoiceRecorderProps {
3
+ phase: "starting" | "recording" | "transcribing";
4
+ /** Written by the recorder about ten times a second; read here so only this strip re-renders. */
5
+ meterRef: React.MutableRefObject<{
6
+ level: number;
7
+ elapsedMs: number;
8
+ }>;
9
+ maxMs: number;
10
+ onStop: () => void;
11
+ onCancel: () => void;
12
+ }
13
+ /**
14
+ * Replaces the whole message box while a clip is being recorded or transcribed: cancel on
15
+ * the left, a waveform that scrolls in from the right, and stop on the right.
16
+ */
17
+ export declare function VoiceRecorder({ phase, meterRef, maxMs, onStop, onCancel }: VoiceRecorderProps): React.JSX.Element;
package/dist/widget.d.ts CHANGED
@@ -1,41 +1,4 @@
1
1
  import React from "react";
2
+ import type { ChatWidgetProps } from "./core/types";
2
3
  import "./styles.css";
3
- interface ChatWidgetProps {
4
- orgId?: string;
5
- organizationName?: string;
6
- themeColor?: string;
7
- theme?: "light" | "dark" | "auto";
8
- position?: "left" | "right";
9
- orgServerRoute: string;
10
- enableVoiceChat?: boolean;
11
- readAloud?: boolean;
12
- welcomeMessage?: string;
13
- placeholderText?: string;
14
- organizationLogo?: string;
15
- buttonIcon?: string;
16
- buttonShape?: "round" | "square";
17
- autoOpen?: boolean;
18
- greeting?: boolean | {
19
- message?: string;
20
- delayMs?: number;
21
- };
22
- showTimestamp?: boolean;
23
- soundEnabled?: boolean;
24
- soundVolume?: number;
25
- poweredBy?: string;
26
- userId?: string;
27
- timestamp?: number;
28
- signature?: string;
29
- turnstileSiteKey?: string;
30
- excludePaths?: string[];
31
- includePaths?: string[];
32
- configOverride?: Record<string, any>;
33
- resetGeneration?: number;
34
- onMessageSent?: (message: string) => void;
35
- onMessageReceived?: (reply: string) => void;
36
- onChatOpened?: () => void;
37
- onChatClosed?: () => void;
38
- onEscalation?: (data: any) => void;
39
- }
40
- export declare const ChatWidget: ({ orgId, organizationName: initialOrganizationName, themeColor: initialThemeColor, theme: initialTheme, position, orgServerRoute, enableVoiceChat: initialEnableVoiceChat, readAloud: initialReadAloud, welcomeMessage: initialWelcomeMessage, placeholderText, organizationLogo: initialOrganizationLogo, buttonIcon, buttonShape: initialButtonShape, autoOpen, greeting, showTimestamp, soundEnabled, soundVolume, poweredBy, userId, timestamp, signature, turnstileSiteKey, excludePaths, includePaths, configOverride, resetGeneration: initResetGeneration, onMessageSent, onMessageReceived, onChatOpened, onChatClosed, onEscalation, }: ChatWidgetProps) => React.JSX.Element | null;
41
- export {};
4
+ export declare const ChatWidget: ({ orgId, organizationName: initialOrganizationName, themeColor: initialThemeColor, theme: initialTheme, position, orgServerRoute, enableVoiceChat: initialEnableVoiceChat, voiceInput: initialVoiceInput, welcomeMessage: initialWelcomeMessage, placeholderText, organizationLogo: initialOrganizationLogo, buttonIcon, buttonShape: initialButtonShape, autoOpen, greeting, showTimestamp, soundEnabled, soundVolume, poweredBy, userId, timestamp, signature, turnstileSiteKey, excludePaths, includePaths, configOverride, resetGeneration: initResetGeneration, onMessageSent, onMessageReceived, onChatOpened, onChatClosed, onEscalation, }: ChatWidgetProps) => React.JSX.Element | null;