@personaliai/react-widget 0.1.0 → 0.2.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/index.d.ts CHANGED
@@ -1,28 +1,84 @@
1
- import * as react from 'react';
2
-
3
- interface ChatWidgetCoreProps {
1
+ interface ChattyWidgetProps {
2
+ /**
3
+ * Your bot's unique UUID from the Chatty dashboard.
4
+ */
4
5
  botId: string;
5
- originToken: string | null;
6
- isPreview?: boolean;
7
- paramColor?: string | null;
8
- paramStyle?: string | null;
9
- paramName?: string | null;
10
- paramWelcome?: string | null;
11
- paramAvatarIcon?: string | null;
12
- paramAvatarUrl?: string | null;
13
- paramLogoUrl?: string | null;
14
- paramLogoBgColor?: string | null;
15
- paramShowSenderTag?: string | null;
16
- paramCsatEnabled?: string | null;
17
- paramColorScheme?: string | null;
18
- onWidgetReady?: () => void;
19
- onWidgetClose?: () => void;
20
- onAssistantMessage?: () => void;
21
- onRequestNotificationPermission?: (botName: string, avatarUrl?: string | null) => void;
22
- onTriggerNotification?: (botName: string, bodyText: string, avatarUrl?: string | null) => void;
23
- forceFullscreen?: boolean;
24
- notificationGranted?: boolean;
6
+ /**
7
+ * Host URL for widget.js (defaults to "https://chatty.personaliai.com/widget.js").
8
+ */
9
+ widgetUrl?: string;
10
+ /**
11
+ * Corner anchor for the launcher button ("right" | "left"). Defaults to "right".
12
+ */
13
+ position?: "right" | "left";
14
+ /**
15
+ * Hex color override for launcher button (e.g. "#4F46E5").
16
+ */
17
+ color?: string;
18
+ /**
19
+ * Widget visual style preset ("minimal", "playful", "corporate", etc.).
20
+ */
21
+ style?: string;
22
+ /**
23
+ * Whether to preserve desktop floating panel layout on mobile (defaults to true).
24
+ */
25
+ mobileFullscreen?: boolean;
26
+ /**
27
+ * Whether to display the proactive greeting teaser bubble (defaults to true).
28
+ */
29
+ teaser?: boolean;
30
+ /**
31
+ * Whether to play notification audio chimes on new AI replies (defaults to true).
32
+ */
33
+ sound?: boolean;
34
+ }
35
+ interface ChattyAPI {
36
+ open: () => void;
37
+ close: () => void;
38
+ toggle: () => void;
39
+ }
40
+ declare global {
41
+ interface Window {
42
+ Chatty?: ChattyAPI;
43
+ __chattyWidgetLoaded?: boolean;
44
+ CHATTY_BOT_ID?: string;
45
+ }
25
46
  }
26
- declare function ChatWidgetCore({ botId, originToken, isPreview, paramColor, paramStyle, paramName, paramWelcome, paramAvatarIcon, paramAvatarUrl, paramLogoUrl, paramLogoBgColor, paramShowSenderTag, paramCsatEnabled, paramColorScheme, onWidgetReady, onWidgetClose, onAssistantMessage, onRequestNotificationPermission, onTriggerNotification, forceFullscreen, notificationGranted, }: ChatWidgetCoreProps): react.JSX.Element;
47
+ /**
48
+ * Official React component for Chatty.
49
+ *
50
+ * Mounts the Chatty AI chat assistant into your application using the lightweight
51
+ * script method into an isolated Shadow DOM container.
52
+ *
53
+ * @example
54
+ * ```tsx
55
+ * import { ChattyWidget } from "@personaliai/react-widget";
56
+ *
57
+ * export default function App() {
58
+ * return <ChattyWidget botId="your-bot-uuid" position="right" color="#4F46E5" />;
59
+ * }
60
+ * ```
61
+ */
62
+ declare function ChattyWidget({ botId, widgetUrl, position, color, style, mobileFullscreen, teaser, sound, }: ChattyWidgetProps): null;
63
+ declare const ChatWidget: typeof ChattyWidget;
64
+ type ChatWidgetProps = ChattyWidgetProps;
65
+ /**
66
+ * Hook to programmatically open, close, or toggle the Chatty chat drawer.
67
+ *
68
+ * @example
69
+ * ```tsx
70
+ * import { useChatty } from "@personaliai/react-widget";
71
+ *
72
+ * export function HelpButton() {
73
+ * const { open, close, toggle } = useChatty();
74
+ * return <button onClick={open}>Chat with Support</button>;
75
+ * }
76
+ * ```
77
+ */
78
+ declare function useChatty(): {
79
+ open: () => void;
80
+ close: () => void;
81
+ toggle: () => void;
82
+ };
27
83
 
28
- export { ChatWidgetCore as ChattyWidget, type ChatWidgetCoreProps as ChattyWidgetProps };
84
+ export { ChatWidget, type ChatWidgetProps, type ChattyAPI, ChattyWidget, type ChattyWidgetProps, ChattyWidget as default, useChatty };