@telnyx/ai-chat-widget 4.0.1 → 4.0.2

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.
@@ -0,0 +1,182 @@
1
+ import { JSX } from 'react/jsx-runtime';
2
+ import * as React_2 from 'react';
3
+ import { SVGProps } from 'react';
4
+ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
5
+
6
+ declare type BaseProps = {
7
+ /**
8
+ * The default endpoint to use for the chat widget (user can toggle between modes)
9
+ * @default `aida`
10
+ * @deprecated
11
+ */
12
+ endpoint?: 'flow' | 'aida';
13
+ /**
14
+ * The base URL for AIDA (Heavy thinking mode)
15
+ * @required
16
+ */
17
+ chatAPIUrl: string;
18
+ /**
19
+ * The base URL for Flow (Instant mode). If not provided, uses chatAPIUrl.
20
+ */
21
+ flowAPIUrl?: string;
22
+ /**
23
+ * API key for Flow (Instant mode). If not provided, uses user.api_v2_token.
24
+ * This allows using a separate API key for the Flow chatbot.
25
+ */
26
+ flowApiKey?: string;
27
+ /**
28
+ * The base URL of the feedback to send
29
+ * @required
30
+ */
31
+ feedbackAPIUrl: string;
32
+ /**
33
+ * The user info to send with the feedback
34
+ * @required
35
+ * The user info contains the user ID, token, api access key, api v2 token, two factor authentication, role, and expires at
36
+ * @example
37
+ * {
38
+ * id: '123',
39
+ * token: '123',
40
+ * apiAccessKey: '123',
41
+ * api_v2_token: '123',
42
+ * twoFactorAuth: '123',
43
+ * role: 'admin',
44
+ * expiresAt: '2025-01-01',
45
+ * }
46
+ * We use the api_v2_token to authenticate the user with the flow API.
47
+ * @info If you include in api_v2_token, it'll be sent as an authentication header in both EventSource and Feedback API.
48
+ */
49
+ user: UserInfo;
50
+ /**
51
+ * The placeholders to be used in the chat widget
52
+ * @default ["Type your message here..."]
53
+ */
54
+ placeholders?: string[];
55
+ /**
56
+ * The action to be performed when the user clicks the help button
57
+ */
58
+ onHelpAction?: () => void;
59
+ };
60
+
61
+ export declare const ChatWidget: ({ chatAPIUrl, flowAPIUrl, flowApiKey, feedbackAPIUrl, user, onHelpAction, open, setOpen, placeholders, mountPosition, mountDirection, offsetX, offsetY, icon, }: ChatWidgetProps) => JSX.Element;
62
+
63
+ declare interface ChatWidgetNoMounting extends BaseProps {
64
+ open?: never;
65
+ setOpen?: never;
66
+ mountPosition?: never;
67
+ mountDirection?: never;
68
+ offsetX?: never;
69
+ offsetY?: never;
70
+ /**
71
+ * The icon to be used in the chat widget
72
+ * @default `RCSIcon`
73
+ */
74
+ icon?: typeof RCSIcon;
75
+ }
76
+
77
+ declare type ChatWidgetProps = ChatWidgetNoMounting | ChatWidgetWithMounting;
78
+
79
+ declare interface ChatWidgetWithMounting extends BaseProps, MountingProps {
80
+ }
81
+
82
+ declare type MountingProps = {
83
+ open: boolean;
84
+ setOpen: (open: boolean) => void;
85
+ /**
86
+ * The offset of the widget on the x axis
87
+ * @default 0
88
+ */
89
+ offsetX?: number;
90
+ /**
91
+ * The offset of the widget on the y axis
92
+ * @default 0
93
+ */
94
+ offsetY?: number;
95
+ /**
96
+ * The position of the widget
97
+ * Values: `top-left`, `top`, `top-right`, `right`, `bottom-right`, `bottom`, `bottom-left`, `left`
98
+ * @default `bottom-right`
99
+ */
100
+ mountPosition: WidgetMountPosition;
101
+ /**
102
+ * The direction, inside or outside the container
103
+ * Values: `inside`, `outside`
104
+ * @default `inside`
105
+ */
106
+ mountDirection: WidgetMountDirection;
107
+ icon?: never;
108
+ };
109
+
110
+ declare type Props = {
111
+ ref?: React.RefObject<SVGSVGElement>;
112
+ } & SVGProps<SVGSVGElement>;
113
+
114
+ declare const RCSIcon: (props: Props) => JSX.Element;
115
+
116
+ export declare const Tooltip: React_2.FC<TooltipPrimitive.TooltipProps>;
117
+
118
+ export declare const TooltipContent: {
119
+ ({ className, sideOffset, ...props }: React_2.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>): JSX.Element;
120
+ displayName: string;
121
+ };
122
+
123
+ export declare const TooltipProvider: React_2.FC<TooltipPrimitive.TooltipProviderProps>;
124
+
125
+ export declare const TooltipTrigger: React_2.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React_2.RefAttributes<HTMLButtonElement>>;
126
+
127
+ declare type UserInfo = {
128
+ /**
129
+ * The user ID
130
+ * @required
131
+ */
132
+ id: string | null;
133
+ /**
134
+ * The user token
135
+ * @required
136
+ */
137
+ token: string | null;
138
+ /**
139
+ * The user API access key
140
+ * @required
141
+ */
142
+ apiAccessKey: string | null;
143
+ /**
144
+ * The user API v2 token
145
+ * @required
146
+ */
147
+ api_v2_token: string | null;
148
+ /**
149
+ * The user two factor authentication
150
+ */
151
+ twoFactorAuth?: boolean | null;
152
+ /**
153
+ * The user role
154
+ */
155
+ role?: string | null;
156
+ /**
157
+ * The user expires at
158
+ */
159
+ expiresAt?: number | null;
160
+ };
161
+
162
+ declare const WIDGET_MOUNT_DIRECTION: {
163
+ readonly INSIDE: "inside";
164
+ readonly OUTSIDE: "outside";
165
+ };
166
+
167
+ declare const WIDGET_MOUNT_POSITIONS: {
168
+ readonly TOP_LEFT: "top-left";
169
+ readonly TOP: "top";
170
+ readonly TOP_RIGHT: "top-right";
171
+ readonly RIGHT: "right";
172
+ readonly BOTTOM_RIGHT: "bottom-right";
173
+ readonly BOTTOM: "bottom";
174
+ readonly BOTTOM_LEFT: "bottom-left";
175
+ readonly LEFT: "left";
176
+ };
177
+
178
+ declare type WidgetMountDirection = (typeof WIDGET_MOUNT_DIRECTION)[keyof typeof WIDGET_MOUNT_DIRECTION];
179
+
180
+ declare type WidgetMountPosition = (typeof WIDGET_MOUNT_POSITIONS)[keyof typeof WIDGET_MOUNT_POSITIONS];
181
+
182
+ export { }