@robylon/web-react-sdk 1.1.28-staging.7 → 1.1.28

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.
Files changed (110) hide show
  1. package/README.md +402 -34
  2. package/dist/cjs/index.js +1 -5534
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/types/components/ChatbotContainer/ChatbotContainer.d.ts +12 -0
  5. package/dist/cjs/types/components/ChatbotContainer/index.d.ts +1 -0
  6. package/dist/cjs/types/config.d.ts +1 -1
  7. package/dist/cjs/types/constants/fontStyles.d.ts +2 -0
  8. package/dist/cjs/types/core/api.d.ts +6 -54
  9. package/dist/cjs/types/core/config.d.ts +34 -0
  10. package/dist/cjs/types/core/events.d.ts +22 -0
  11. package/dist/cjs/types/core/index.d.ts +4 -0
  12. package/dist/cjs/types/core/state.d.ts +34 -0
  13. package/dist/cjs/types/index.d.ts +5 -9
  14. package/dist/cjs/types/types.d.ts +34 -9
  15. package/dist/cjs/types/utils/fetchData.d.ts +16 -0
  16. package/dist/cjs/types/vanilla/components/ChatbotContainer.d.ts +45 -0
  17. package/dist/cjs/types/vanilla/components/ChatbotFloatingButton.d.ts +69 -0
  18. package/dist/cjs/types/vanilla/components/ChatbotIframe.d.ts +71 -0
  19. package/dist/cjs/types/vanilla/index.d.ts +15 -29
  20. package/dist/esm/index.js +1 -5527
  21. package/dist/esm/index.js.map +1 -1
  22. package/dist/esm/types/components/ChatbotContainer/ChatbotContainer.d.ts +12 -0
  23. package/dist/esm/types/components/ChatbotContainer/index.d.ts +1 -0
  24. package/dist/esm/types/config.d.ts +1 -1
  25. package/dist/esm/types/constants/fontStyles.d.ts +2 -0
  26. package/dist/esm/types/core/api.d.ts +6 -54
  27. package/dist/esm/types/core/config.d.ts +34 -0
  28. package/dist/esm/types/core/events.d.ts +22 -0
  29. package/dist/esm/types/core/index.d.ts +4 -0
  30. package/dist/esm/types/core/state.d.ts +34 -0
  31. package/dist/esm/types/index.d.ts +5 -9
  32. package/dist/esm/types/types.d.ts +34 -9
  33. package/dist/esm/types/utils/fetchData.d.ts +16 -0
  34. package/dist/esm/types/vanilla/components/ChatbotContainer.d.ts +45 -0
  35. package/dist/esm/types/vanilla/components/ChatbotFloatingButton.d.ts +69 -0
  36. package/dist/esm/types/vanilla/components/ChatbotIframe.d.ts +71 -0
  37. package/dist/esm/types/vanilla/index.d.ts +15 -29
  38. package/dist/index.d.ts +101 -77
  39. package/dist/umd/robylon-chatbot.js +2 -0
  40. package/dist/umd/robylon-chatbot.js.map +1 -0
  41. package/dist/umd/types/components/ChatbotContainer/ChatbotContainer.d.ts +12 -0
  42. package/dist/umd/types/components/ChatbotContainer/index.d.ts +1 -0
  43. package/dist/umd/types/config.d.ts +1 -1
  44. package/dist/umd/types/constants/fontStyles.d.ts +2 -0
  45. package/dist/umd/types/core/api.d.ts +6 -54
  46. package/dist/umd/types/core/config.d.ts +34 -0
  47. package/dist/umd/types/core/events.d.ts +22 -0
  48. package/dist/umd/types/core/index.d.ts +4 -0
  49. package/dist/umd/types/core/state.d.ts +34 -0
  50. package/dist/umd/types/index.d.ts +5 -9
  51. package/dist/umd/types/types.d.ts +34 -9
  52. package/dist/umd/types/utils/fetchData.d.ts +16 -0
  53. package/dist/umd/types/vanilla/components/ChatbotContainer.d.ts +45 -0
  54. package/dist/umd/types/vanilla/components/ChatbotFloatingButton.d.ts +69 -0
  55. package/dist/umd/types/vanilla/components/ChatbotIframe.d.ts +71 -0
  56. package/dist/umd/types/vanilla/index.d.ts +15 -29
  57. package/package.json +30 -82
  58. package/dist/cjs/legacy.js +0 -2
  59. package/dist/cjs/legacy.js.map +0 -1
  60. package/dist/cjs/react.js +0 -2
  61. package/dist/cjs/react.js.map +0 -1
  62. package/dist/cjs/types/core/chatbotEmbed.d.ts +0 -59
  63. package/dist/cjs/types/core/utils/color.d.ts +0 -1
  64. package/dist/cjs/types/core/utils/cookies.d.ts +0 -30
  65. package/dist/cjs/types/core/utils/environment.d.ts +0 -19
  66. package/dist/cjs/types/core/utils/logger.d.ts +0 -37
  67. package/dist/cjs/types/core/utils/system.d.ts +0 -22
  68. package/dist/cjs/types/index.legacy.d.ts +0 -7
  69. package/dist/cjs/types/index.react.d.ts +0 -9
  70. package/dist/cjs/types/index.vanilla.d.ts +0 -32
  71. package/dist/cjs/types/react/components/Chatbot.d.ts +0 -34
  72. package/dist/cjs/types/react/components/ErrorBoundary.d.ts +0 -18
  73. package/dist/cjs/types/types/config.d.ts +0 -33
  74. package/dist/cjs/types/types/index.d.ts +0 -16
  75. package/dist/esm/legacy.js +0 -2
  76. package/dist/esm/legacy.js.map +0 -1
  77. package/dist/esm/react.js +0 -2
  78. package/dist/esm/react.js.map +0 -1
  79. package/dist/esm/types/core/chatbotEmbed.d.ts +0 -59
  80. package/dist/esm/types/core/utils/color.d.ts +0 -1
  81. package/dist/esm/types/core/utils/cookies.d.ts +0 -30
  82. package/dist/esm/types/core/utils/environment.d.ts +0 -19
  83. package/dist/esm/types/core/utils/logger.d.ts +0 -37
  84. package/dist/esm/types/core/utils/system.d.ts +0 -22
  85. package/dist/esm/types/index.legacy.d.ts +0 -7
  86. package/dist/esm/types/index.react.d.ts +0 -9
  87. package/dist/esm/types/index.vanilla.d.ts +0 -32
  88. package/dist/esm/types/react/components/Chatbot.d.ts +0 -34
  89. package/dist/esm/types/react/components/ErrorBoundary.d.ts +0 -18
  90. package/dist/esm/types/types/config.d.ts +0 -33
  91. package/dist/esm/types/types/index.d.ts +0 -16
  92. package/dist/legacy.d.ts +0 -160
  93. package/dist/react.d.ts +0 -49
  94. package/dist/umd/robylon.js +0 -5545
  95. package/dist/umd/robylon.js.map +0 -1
  96. package/dist/umd/robylon.min.js +0 -20
  97. package/dist/umd/robylon.min.js.map +0 -1
  98. package/dist/umd/types/core/chatbotEmbed.d.ts +0 -59
  99. package/dist/umd/types/core/utils/color.d.ts +0 -1
  100. package/dist/umd/types/core/utils/cookies.d.ts +0 -30
  101. package/dist/umd/types/core/utils/environment.d.ts +0 -19
  102. package/dist/umd/types/core/utils/logger.d.ts +0 -37
  103. package/dist/umd/types/core/utils/system.d.ts +0 -22
  104. package/dist/umd/types/index.legacy.d.ts +0 -7
  105. package/dist/umd/types/index.react.d.ts +0 -9
  106. package/dist/umd/types/index.vanilla.d.ts +0 -32
  107. package/dist/umd/types/react/components/Chatbot.d.ts +0 -34
  108. package/dist/umd/types/react/components/ErrorBoundary.d.ts +0 -18
  109. package/dist/umd/types/types/config.d.ts +0 -33
  110. package/dist/umd/types/types/index.d.ts +0 -16
package/README.md CHANGED
@@ -1,71 +1,439 @@
1
1
  # Robylon SDK
2
2
 
3
- The Robylon SDK provides chatbot functionality that can be used in both React and vanilla JavaScript applications.
3
+ The Robylon SDK provides an easy way to integrate a customizable chatbot into your application. This SDK supports both React applications and plain JavaScript/no-code websites.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Installation](#installation)
8
+ - [React SDK Usage](#react-sdk-usage)
9
+ - [Plain JavaScript & No-Code Integration](#plain-javascript--no-code-integration)
10
+ - [Quick Embed (Easiest Method)](#quick-embed-easiest-method)
11
+ - [Option 1: Quick Setup - Load with Page](#option-1-quick-setup---load-with-page)
12
+ - [Option 2: Reliable Loading - After DOM is Ready](#option-2-reliable-loading---after-dom-is-ready)
13
+ - [Option 3: User Context - Initialize After User Data](#option-3-user-context---initialize-after-user-data)
14
+ - [Configuration Options](#configuration-options)
15
+ - [Event Handling](#event-handling)
16
+ - [Customization](#customization)
17
+ - [Troubleshooting](#troubleshooting)
18
+ - [Platform-Specific Integration Guides](#platform-specific-integration-guides)
19
+ - [Webflow](#webflow-integration)
20
+ - [Wix](#wix-integration)
21
+ - [Shopify](#shopify-integration)
22
+ - [WordPress](#wordpress-integration)
23
+ - [Using the SDK from CDN](#using-the-sdk-from-cdn)
4
24
 
5
25
  ## Installation
6
26
 
7
- ### React
27
+ ### For React applications:
8
28
 
9
29
  ```bash
10
30
  npm install @robylon/web-react-sdk
31
+ # or
32
+ yarn add @robylon/web-react-sdk
11
33
  ```
12
34
 
13
- ### Vanilla JavaScript
35
+ ### For plain JavaScript and no-code websites:
36
+
37
+ Add this script to your website by copying and pasting the following code into the `<head>` section of your HTML:
14
38
 
15
39
  ```html
16
- <script src="https://staging-cdn.robylon.com/1.1.28-staging.6/robylon.min.js"></script>
40
+ <script src="https://cdn.robylon.ai/sdk/latest/chatbot.js"></script>
17
41
  ```
18
42
 
19
- Or via npm:
43
+ #### Where to place the script:
20
44
 
21
- ```bash
22
- npm install @robylon/web-react-sdk
23
- ```
45
+ 1. **For website builders (Wix, Squarespace, etc.):**
46
+
47
+ - Find your site editor or dashboard
48
+ - Look for "Custom Code", "Header Code", or "Site Settings" options
49
+ - Paste the script there, usually in a section labeled "Header" or "Head"
50
+
51
+ 2. **For custom HTML sites:**
52
+
53
+ - Open your website's HTML file in your editor
54
+ - Find the `<head>` section (it's near the top, between `<html>` and `<body>` tags)
55
+ - Paste the script tag just before the closing `</head>` tag
56
+
57
+ 3. **For WordPress:**
58
+ - Go to your WordPress dashboard
59
+ - Navigate to Appearance → Theme Editor or use a header/footer plugin
60
+ - Add the script to the header.php file before the closing `</head>` tag
61
+
62
+ > **Note:** Some of the integration options later in this guide will show different placements of this script - follow the specific example that best matches your needs.
24
63
 
25
- ## Usage
64
+ ## React SDK Usage
26
65
 
27
- ### React
66
+ ### React: Basic Implementation
67
+
68
+ To use the Robylon SDK in a React application:
28
69
 
29
70
  ```jsx
30
- import { Chatbot } from '@robylon/web-react-sdk/react';
71
+ import { Chatbot } from "@robylon/web-react-sdk";
31
72
 
32
73
  function App() {
74
+ const handleChatbotEvent = (event) => {
75
+ console.log("Chatbot event:", event.type, event.data);
76
+ };
77
+
33
78
  return (
34
79
  <div className="App">
35
- <Chatbot
36
- api_key="your-api-key"
80
+ <h1>My Website</h1>
81
+
82
+ <Chatbot
83
+ api_key="YOUR_API_KEY"
37
84
  user_id="optional-user-id"
38
- onEvent={(event) => console.log(event)}
85
+ user_token="optional-auth-token"
86
+ user_profile={{
87
+ name: "Optional User Name",
88
+ email: "optional.email@example.com",
89
+ }}
90
+ onEvent={handleChatbotEvent}
39
91
  />
40
92
  </div>
41
93
  );
42
94
  }
95
+
96
+ export default App;
43
97
  ```
44
98
 
45
- ### Vanilla JavaScript
99
+ ### React: Event Handling
46
100
 
47
- ```javascript
48
- // From CDN
49
- Robylon.create({
50
- api_key: 'your-api-key',
51
- user_id: 'optional-user-id',
52
- onEvent: (event) => console.log(event)
53
- }).then(chatbot => {
54
- // The chatbot is now ready to use
55
- chatbot.show();
56
- });
101
+ The React component accepts an `onEvent` prop for handling chatbot events:
102
+
103
+ ```jsx
104
+ <Chatbot
105
+ api_key="YOUR_API_KEY"
106
+ onEvent={(event) => {
107
+ switch (event.type) {
108
+ case "CHATBOT_LOADED":
109
+ console.log("Chatbot loaded");
110
+ break;
111
+ case "CHATBOT_OPENED":
112
+ console.log("Chatbot opened");
113
+ break;
114
+ case "CHATBOT_CLOSED":
115
+ console.log("Chatbot closed");
116
+ break;
117
+ // See the Supported Events section for all available events
118
+ }
119
+ }}
120
+ />
121
+ ```
122
+
123
+ The `Chatbot` component renders a floating button that opens a chat interface when clicked. It handles all the communication with the Robylon backend services.
124
+
125
+ ## Plain JavaScript & No-Code Integration
126
+
127
+ > **IMPORTANT:** You will need an API key from Robylon for any integration to work.
128
+
129
+ ### Quick Embed (Easiest Method)
130
+
131
+ This is the simplest way to add the Robylon chatbot to any website with a single line of code. Just copy and paste this script tag into your HTML:
132
+
133
+ ```
134
+ <script>(function(k){window.R=window.R||function(){(window.R.q=window.R.q||[]).push(arguments)};window.R=new Proxy(window.R,{get:(t,p)=>p==="q"?t.q:(...a)=>t(p,...a)});function l(){var s=document.createElement("script");s.src="https://cdn.robylon.ai/sdk/latest/chatbot.js";s.onload=()=>k&&window.RobylonChatbot.create({api_key:k});document.body.appendChild(s)}document.readyState==="complete"?l():window.addEventListener("load",l)})("YOUR_API_KEY_HERE");</script>
135
+ ```
136
+
137
+ Just replace `YOUR_API_KEY_HERE` with your actual Robylon API key, and you're done! No additional code is needed.
138
+
139
+ #### Where to place the script:
140
+
141
+ - At the end of your HTML `<body>` section for best performance
142
+ - Or anywhere in your HTML code if you're using a website builder
143
+
144
+ There are several other ways to add the Robylon chatbot to your website or no-code platform, depending on your needs:
145
+
146
+ ### Option 1: Quick Setup - Load with Page
147
+
148
+ This is the simplest approach for any website. The chatbot loads while the page is loading but doesn't block the page from appearing.
149
+
150
+ #### What to copy:
151
+
152
+ 1️⃣ **Add this to your HTML `<head>` section:**
153
+
154
+ ```html
155
+ <script
156
+ src="https://cdn.robylon.ai/sdk/latest/robylon-chatbot.js"
157
+ defer
158
+ ></script>
159
+ <script>
160
+ // Initialize when page is ready
161
+ document.addEventListener("DOMContentLoaded", () => {
162
+ RobylonChatbot.create({
163
+ api_key: "YOUR_API_KEY", // Replace with your actual API key
164
+ user_id: "optional-user-id", // Optional: remove if not needed
165
+ user_profile: {
166
+ name: "Optional User Name", // Optional: remove if not needed
167
+ email: "optional.email@example.com", // Optional: remove if not needed
168
+ },
169
+ });
170
+ });
171
+ </script>
172
+ ```
173
+
174
+ #### Complete example:
175
+
176
+ ```html
177
+ <!DOCTYPE html>
178
+ <html>
179
+ <head>
180
+ <title>Robylon SDK - Quick Setup</title>
181
+ <!-- COPY FROM HERE -->
182
+ <script
183
+ src="https://cdn.robylon.ai/sdk/latest/robylon-chatbot.js"
184
+ defer
185
+ ></script>
186
+ <script>
187
+ // Initialize when page is ready
188
+ document.addEventListener("DOMContentLoaded", () => {
189
+ RobylonChatbot.create({
190
+ api_key: "YOUR_API_KEY", // Replace with your actual API key
191
+ user_id: "optional-user-id", // Optional: remove if not needed
192
+ user_profile: {
193
+ name: "Optional User Name", // Optional: remove if not needed
194
+ email: "optional.email@example.com", // Optional: remove if not needed
195
+ },
196
+ });
197
+ });
198
+ </script>
199
+ <!-- COPY UNTIL HERE -->
200
+ </head>
201
+ <body>
202
+ <h1>Your Website Content</h1>
203
+ <!-- Your website content here -->
204
+ </body>
205
+ </html>
206
+ ```
207
+
208
+ ### Option 2: Reliable Loading - After DOM is Ready
57
209
 
58
- // From npm module
59
- import { create } from '@robylon/web-react-sdk';
210
+ This approach ensures the chatbot only initializes after your page is fully loaded, making it more reliable for websites with complex layouts.
60
211
 
61
- create({
62
- api_key: 'your-api-key',
63
- user_id: 'optional-user-id'
64
- }).then(chatbot => {
65
- chatbot.show();
212
+ #### What to copy:
213
+
214
+ 1️⃣ **Add this to your HTML `<head>` section:**
215
+
216
+ ```html
217
+ <script src="https://cdn.robylon.ai/sdk/latest/robylon-chatbot.js"></script>
218
+ ```
219
+
220
+ 2️⃣ **Add this at the end of your HTML `<body>` section:**
221
+
222
+ ```html
223
+ <script>
224
+ // Wait for page to be fully loaded before showing chatbot
225
+ document.addEventListener("DOMContentLoaded", () => {
226
+ RobylonChatbot.create({
227
+ api_key: "YOUR_API_KEY", // Replace with your actual API key
228
+ user_id: "optional-user-id", // Optional: remove if not needed
229
+ user_profile: {
230
+ name: "Optional User Name", // Optional: remove if not needed
231
+ email: "optional.email@example.com", // Optional: remove if not needed
232
+ },
233
+ });
234
+ });
235
+ </script>
236
+ ```
237
+
238
+ #### Complete example:
239
+
240
+ ```html
241
+ <!DOCTYPE html>
242
+ <html>
243
+ <head>
244
+ <title>Robylon SDK - Reliable Loading</title>
245
+ <!-- COPY FROM HERE -->
246
+ <script src="https://cdn.robylon.ai/sdk/latest/robylon-chatbot.js"></script>
247
+ <!-- COPY UNTIL HERE -->
248
+ </head>
249
+ <body>
250
+ <h1>Your Website Content</h1>
251
+ <!-- Your website content here -->
252
+
253
+ <script>
254
+ // Wait for page to be fully loaded before showing chatbot
255
+ document.addEventListener("DOMContentLoaded", () => {
256
+ RobylonChatbot.create({
257
+ api_key: "YOUR_API_KEY", // Replace with your actual API key
258
+ user_id: "optional-user-id", // Optional: remove if not needed
259
+ user_profile: {
260
+ name: "Optional User Name", // Optional: remove if not needed
261
+ email: "optional.email@example.com", // Optional: remove if not needed
262
+ },
263
+ });
264
+ });
265
+ </script>
266
+ </body>
267
+ </html>
268
+ ```
269
+
270
+ ### Option 3: User Context - Initialize After User Data
271
+
272
+ This approach loads the chatbot after user data is available. Great for websites where you want to personalize the chat experience.
273
+
274
+ #### What to copy:
275
+
276
+ 1️⃣ **Add this to your HTML `<head>` section:**
277
+
278
+ ```html
279
+ <script
280
+ src="https://cdn.robylon.ai/sdk/latest/robylon-chatbot.js"
281
+ defer
282
+ ></script>
283
+ ```
284
+
285
+ 2️⃣ **Add this script at the end of your HTML `<body>` section:**
286
+
287
+ ```html
288
+ <script>
289
+ // Wait for page to be ready
290
+ document.addEventListener("DOMContentLoaded", () => {
291
+ // Get your user data (replace this with your own method)
292
+ getUserData().then((user) => {
293
+ // Initialize chatbot with user info
294
+ RobylonChatbot.create({
295
+ api_key: "YOUR_API_KEY", // Replace with your actual API key
296
+ user_id: user.id,
297
+ user_profile: {
298
+ name: user.name,
299
+ email: user.email,
300
+ },
301
+ });
302
+ });
303
+ });
304
+
305
+ // Example function to get user data - replace with your own
306
+ function getUserData() {
307
+ // This is just a placeholder - replace with your actual code
308
+ return Promise.resolve({
309
+ id: "user123",
310
+ name: "Jane Smith",
311
+ email: "jane@example.com",
312
+ });
313
+ }
314
+ </script>
315
+ ```
316
+
317
+ #### Complete example:
318
+
319
+ ```html
320
+ <!DOCTYPE html>
321
+ <html>
322
+ <head>
323
+ <title>My Website</title>
324
+ <!-- COPY FROM HERE -->
325
+ <script
326
+ src="https://cdn.robylon.ai/sdk/latest/robylon-chatbot.js"
327
+ defer
328
+ ></script>
329
+ <!-- COPY UNTIL HERE -->
330
+ </head>
331
+ <body>
332
+ <h1>Your Website Content</h1>
333
+ <!-- Your website content here -->
334
+
335
+ <!-- COPY FROM HERE -->
336
+ <script>
337
+ // Wait for page to be ready
338
+ document.addEventListener("DOMContentLoaded", () => {
339
+ // Get your user data (replace this with your own method)
340
+ getUserData().then((user) => {
341
+ // Initialize chatbot with user info
342
+ RobylonChatbot.create({
343
+ api_key: "YOUR_API_KEY", // Replace with your actual API key
344
+ user_id: user.id,
345
+ user_profile: {
346
+ name: user.name,
347
+ email: user.email,
348
+ },
349
+ });
350
+ });
351
+ });
352
+
353
+ // Example function to get user data - replace with your own
354
+ function getUserData() {
355
+ // This is just a placeholder - replace with your actual code
356
+ return Promise.resolve({
357
+ id: "user123",
358
+ name: "Jane Smith",
359
+ email: "jane@example.com",
360
+ });
361
+ }
362
+ </script>
363
+ <!-- COPY UNTIL HERE -->
364
+ </body>
365
+ </html>
366
+ ```
367
+
368
+ ### Plain JS & No-Code: Event Handling
369
+
370
+ You can handle chatbot events in plain JavaScript using the `onEvent` callback:
371
+
372
+ #### What to copy:
373
+
374
+ ```javascript
375
+ const chatbot = RobylonChatbot.create({
376
+ api_key: "YOUR_API_KEY", // Replace with your actual API key
377
+ onEvent: function (event) {
378
+ switch (event.type) {
379
+ case "CHATBOT_LOADED":
380
+ console.log("Chatbot loaded");
381
+ break;
382
+ case "CHATBOT_OPENED":
383
+ console.log("Chatbot opened");
384
+ break;
385
+ case "CHATBOT_CLOSED":
386
+ console.log("Chatbot closed");
387
+ break;
388
+ // See the Supported Events section for all available events
389
+ }
390
+ },
66
391
  });
392
+
393
+ // The chatbot instance provides methods to control the chatbot
394
+ // chatbot.show(); // Show the chatbot
395
+ // chatbot.hide(); // Hide the chatbot
396
+ // chatbot.toggle(); // Toggle visibility
397
+ // chatbot.destroy(); // Remove the chatbot from the page
67
398
  ```
68
399
 
69
- ## Documentation
400
+ ## Configuration Options
401
+
402
+ The SDK supports the following configuration options for both React and plain JavaScript implementations:
403
+
404
+ | Option | Type | Description | Required/Optional |
405
+ | ------------ | -------- | ----------------------------------------- | ----------------- |
406
+ | api_key | string | Your Robylon API key | Required |
407
+ | user_id | string | User identifier for conversation tracking | Optional |
408
+ | user_token | string | Authentication token | Optional |
409
+ | user_profile | object | Additional user information | Optional |
410
+ | onEvent | function | Event handler for chatbot interactions | Optional |
411
+
412
+ ## Event Handling
413
+
414
+ ### Supported Events
415
+
416
+ The SDK emits the following events that you can listen for in both React and plain JavaScript implementations:
417
+
418
+ | Event Type | Description | Data |
419
+ | ---------------------------- | ----------------------------------------------- | ---------------------------------------- |
420
+ | `CHATBOT_BUTTON_LOADED` | The chatbot button has been loaded and rendered | - |
421
+ | `CHATBOT_LOADED` | The chatbot iframe has been loaded | - |
422
+ | `CHATBOT_OPENED` | The chatbot has been opened | - |
423
+ | `CHATBOT_CLOSED` | The chatbot has been closed | - |
424
+ | `CHAT_INITIALIZED` | The chat session has been initialized | - |
425
+ | `CHAT_INITIALIZATION_FAILED` | The chat session failed to initialize | `{ error: string }` |
426
+ | `SESSION_REFRESHED` | The chat session has been refreshed | - |
427
+ | `MESSAGE_SENT` | User has sent a message | `{ message: string }` |
428
+ | `MESSAGE_RECEIVED` | A message was received from the chatbot | `{ message: string }` |
429
+ | `CONVERSATION_STARTED` | A new conversation has started | `{ conversationId: string }` |
430
+ | `CONVERSATION_ENDED` | The current conversation has ended | `{ conversationId: string }` |
431
+ | `USER_AUTHENTICATED` | The user has been authenticated | `{ userId: string }` |
432
+ | `USER_PROFILE_UPDATED` | The user profile has been updated | `{ profile: object }` |
433
+ | `USER_FEEDBACK_SUBMITTED` | The user has submitted feedback | `{ rating: number, comment: string }` |
434
+ | `FILE_UPLOAD_STARTED` | A file upload has started | `{ fileName: string, fileSize: number }` |
435
+ | `FILE_UPLOAD_COMPLETED` | A file upload has completed | `{ fileName: string, fileUrl: string }` |
436
+ | `FILE_UPLOAD_FAILED` | A file upload has failed | `{ fileName: string, error: string }` |
437
+ | `CHATBOT_ERROR` | An error occurred in the chatbot | `{ code: string, message: string }` |
70
438
 
71
- For detailed documentation, please visit: [https://app.robylon.ai/docs](https://app.robylon.ai/docs)
439
+ Events can be handled through the `onEvent` callback in both React and plain JavaScript implementations. Each event includes a `timestamp`