tybotflow-widget 0.0.3
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/README.md +42 -0
- package/dist/index.d.ts +115 -0
- package/dist/index.es.js +53271 -0
- package/dist/index.umd.js +541 -0
- package/package.json +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# TybotFlow Widget SDK
|
|
2
|
+
|
|
3
|
+
A modern, customizable React widget for Tybot chat integration.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install tybot-widget
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
in react
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { createTybotWidget } from "tybot-widget";
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
createTybotWidget({
|
|
20
|
+
bot: { botId: "your-bot-id", name: "My Bot" },
|
|
21
|
+
mainColor: "#FF0000",
|
|
22
|
+
// ...other config options
|
|
23
|
+
});
|
|
24
|
+
}, []);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
with script tag
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
<script src="https://unpkg.com/tybotflow-widget/dist/index.umd.js"></script>
|
|
31
|
+
<script>
|
|
32
|
+
TybotWidget.createTybotWidget({
|
|
33
|
+
bot: { botId: "your-bot-id", name: "My Bot" },
|
|
34
|
+
mainColor: "#FF0000",
|
|
35
|
+
// ...other config options
|
|
36
|
+
});
|
|
37
|
+
</script>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Props
|
|
41
|
+
|
|
42
|
+
See `dist/index.d.ts` for all available configuration options.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mounts the Tybot Widget to the DOM.
|
|
3
|
+
* @param config - Configuration options for the widget.
|
|
4
|
+
* @example
|
|
5
|
+
* ```html
|
|
6
|
+
* <script>
|
|
7
|
+
* TybotWidget.createTybotWidget(
|
|
8
|
+
* {
|
|
9
|
+
* bot: { botId: '123', name: 'Support Bot' }
|
|
10
|
+
* }
|
|
11
|
+
* );
|
|
12
|
+
* </script>
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function createTybotWidget(
|
|
16
|
+
config: TybotWidgetConfig
|
|
17
|
+
): void;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Information about a bot instance.
|
|
21
|
+
* @category Types
|
|
22
|
+
*/
|
|
23
|
+
declare interface IBot {
|
|
24
|
+
/** Bot's numeric ID (optional). */
|
|
25
|
+
id?: number;
|
|
26
|
+
/** Unique bot identifier string. */
|
|
27
|
+
botId: string;
|
|
28
|
+
/** Display name of the bot. */
|
|
29
|
+
name: any;
|
|
30
|
+
/** Optional description of the bot. */
|
|
31
|
+
description?: string | null;
|
|
32
|
+
/** Whether the bot is active (camelCase). */
|
|
33
|
+
isActive?: boolean;
|
|
34
|
+
/** URL to the bot's avatar image. */
|
|
35
|
+
avatar_url?: string;
|
|
36
|
+
/** Whether the bot is active (snake_case, API compatibility). */
|
|
37
|
+
is_active?: boolean;
|
|
38
|
+
/** Whether the bot is deleted. */
|
|
39
|
+
is_deleted?: boolean;
|
|
40
|
+
/** Domain ID the bot belongs to. */
|
|
41
|
+
domainId?: number;
|
|
42
|
+
/** Allow additional arbitrary properties. */
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Configuration for the Tybot Widget instance.
|
|
48
|
+
* @category Props
|
|
49
|
+
*/
|
|
50
|
+
declare interface TybotWidgetConfig {
|
|
51
|
+
/** Current user object or ID. */
|
|
52
|
+
user?: any;
|
|
53
|
+
/** Authentication token for API calls. */
|
|
54
|
+
token?: string | null;
|
|
55
|
+
/** Title displayed in the widget header. */
|
|
56
|
+
title?: string;
|
|
57
|
+
/** URL or path to the widget icon. */
|
|
58
|
+
icon?: string;
|
|
59
|
+
/** Background color for the icon container (in hex #RRGGBB). */
|
|
60
|
+
iconBackgroundColor?: string;
|
|
61
|
+
/** Border radius for the icon container (all css units for <radius> (px, rem, etc.)). */
|
|
62
|
+
iconRoundness?: string;
|
|
63
|
+
/** Primary theme color (in hex #RRGGBB). */
|
|
64
|
+
mainColor?: string;
|
|
65
|
+
/** Secondary theme color (in hex #RRGGBB). */
|
|
66
|
+
secondaryColor?: string;
|
|
67
|
+
/** Tertiary theme color (in hex #RRGGBB). */
|
|
68
|
+
thirdColor?: string;
|
|
69
|
+
/** Background color for the input field (in hex #RRGGBB). */
|
|
70
|
+
inputBackgroundColor?: string;
|
|
71
|
+
/** Text color for the input field (in hex #RRGGBB). */
|
|
72
|
+
inputTextColor?: string;
|
|
73
|
+
/** Border radius for all the widget corners (all css units for <radius> (px, rem, etc.)). */
|
|
74
|
+
roundness?: string;
|
|
75
|
+
/** Minimum width of the widget panel (in pixels). */
|
|
76
|
+
minPanelWidth?: number;
|
|
77
|
+
/** Maximum width of the widget panel (in pixels). */
|
|
78
|
+
maxPanelWidth?: number;
|
|
79
|
+
/** Border radius for chat bubbles (all css units for <radius> (px, rem, etc.)). */
|
|
80
|
+
chatRoundness?: string;
|
|
81
|
+
/** Maximum width of chat bubbles (in percent %). */
|
|
82
|
+
chatMaxWidth?: number;
|
|
83
|
+
/** Top-left border radius for the toggle button (all css units for <radius> (px, rem, etc.)). */
|
|
84
|
+
toggleBtnBorderTopLeftRadius?: string;
|
|
85
|
+
/** Top-right border radius for the toggle button (all css units for <radius> (px, em, etc.)). */
|
|
86
|
+
toggleBtnBorderTopRightRadius?: string;
|
|
87
|
+
/** Bottom-left border radius for the toggle button (all css units for <radius> (px, rem, etc.)). */
|
|
88
|
+
toggleBtnBorderBottomLeftRadius?: string;
|
|
89
|
+
/** Bottom-right border radius for the toggle button (all css units for <radius> (px, rem, etc.)). */
|
|
90
|
+
toggleBtnBorderBottomRightRadius?: string;
|
|
91
|
+
/** First gradient color for the header (in hex #RRGGBB). */
|
|
92
|
+
headerFirstColor?: string;
|
|
93
|
+
/** Second gradient color for the header (in hex #RRGGBB). */
|
|
94
|
+
headerSecondColor?: string;
|
|
95
|
+
/** Background color for the upload menu (in hex #RRGGBB). */
|
|
96
|
+
menuBackgroundColor?: string;
|
|
97
|
+
/** Text color for the menu items (in hex #RRGGBB). */
|
|
98
|
+
menuTextColor?: string;
|
|
99
|
+
/** Background color when hovering over a menu item (in hex #RRGGBB). */
|
|
100
|
+
menuHoverBackgroundColor?: string;
|
|
101
|
+
/** Text color for agent messages (in hex #RRGGBB). */
|
|
102
|
+
agentChatResponseColor?: string;
|
|
103
|
+
/** Background color for agent messages (in hex #RRGGBB). */
|
|
104
|
+
agentChatResponseBgColor?: string;
|
|
105
|
+
/** Text color for user messages (in hex #RRGGBB). */
|
|
106
|
+
userChatMessagesColor?: string;
|
|
107
|
+
/** User role identifier. */
|
|
108
|
+
role?: string | null;
|
|
109
|
+
/** Base API URL for widget requests. */
|
|
110
|
+
API_URL?: string;
|
|
111
|
+
/** Bot instance configuration. */
|
|
112
|
+
bot: IBot;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export { }
|