@robylon/web-react-sdk 1.1.26-staging.7 → 1.1.28-staging.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/README.md +46 -129
- package/dist/cjs/index.js +1145 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/legacy.js +2 -0
- package/dist/cjs/legacy.js.map +1 -0
- package/dist/cjs/react.js +2 -0
- package/dist/cjs/react.js.map +1 -0
- package/dist/cjs/types/core/api.d.ts +56 -0
- package/dist/cjs/types/core/chatbotEmbed.d.ts +59 -0
- package/dist/cjs/types/core/utils/color.d.ts +1 -0
- package/dist/cjs/types/core/utils/cookies.d.ts +30 -0
- package/dist/cjs/types/core/utils/environment.d.ts +19 -0
- package/dist/cjs/types/core/utils/logger.d.ts +37 -0
- package/dist/cjs/types/core/utils/system.d.ts +22 -0
- package/dist/cjs/types/index.d.ts +6 -2
- package/dist/cjs/types/index.react.d.ts +8 -0
- package/dist/cjs/types/index.vanilla.d.ts +27 -0
- package/dist/cjs/types/react/components/Chatbot.d.ts +32 -0
- package/dist/cjs/types/react/components/ErrorBoundary.d.ts +18 -0
- package/dist/cjs/types/types.d.ts +9 -1
- package/dist/cjs/types/vanilla/index.d.ts +44 -0
- package/dist/esm/index.js +1139 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/legacy.js +2 -0
- package/dist/esm/legacy.js.map +1 -0
- package/dist/esm/react.js +2 -0
- package/dist/esm/react.js.map +1 -0
- package/dist/esm/types/core/api.d.ts +56 -0
- package/dist/esm/types/core/chatbotEmbed.d.ts +59 -0
- package/dist/esm/types/core/utils/color.d.ts +1 -0
- package/dist/esm/types/core/utils/cookies.d.ts +30 -0
- package/dist/esm/types/core/utils/environment.d.ts +19 -0
- package/dist/esm/types/core/utils/logger.d.ts +37 -0
- package/dist/esm/types/core/utils/system.d.ts +22 -0
- package/dist/esm/types/index.d.ts +6 -2
- package/dist/esm/types/index.react.d.ts +8 -0
- package/dist/esm/types/index.vanilla.d.ts +27 -0
- package/dist/esm/types/react/components/Chatbot.d.ts +32 -0
- package/dist/esm/types/react/components/ErrorBoundary.d.ts +18 -0
- package/dist/esm/types/types.d.ts +9 -1
- package/dist/esm/types/vanilla/index.d.ts +44 -0
- package/dist/index.d.ts +62 -57
- package/dist/umd/robylon.js +1152 -0
- package/dist/umd/robylon.js.map +1 -0
- package/dist/umd/robylon.min.js +2 -0
- package/dist/umd/robylon.min.js.map +1 -0
- package/dist/umd/types/components/ChatbotFloatingButton.d.ts +12 -0
- package/dist/umd/types/components/ChatbotIframe.d.ts +12 -0
- package/dist/umd/types/components/ErrorBoundary.d.ts +15 -0
- package/dist/umd/types/components/RobylonChatbot.d.ts +11 -0
- package/dist/umd/types/config.d.ts +5 -0
- package/dist/umd/types/constants/errorConstants.d.ts +60 -0
- package/dist/umd/types/core/api.d.ts +56 -0
- package/dist/umd/types/core/chatbotEmbed.d.ts +59 -0
- package/dist/umd/types/core/utils/color.d.ts +1 -0
- package/dist/umd/types/core/utils/cookies.d.ts +30 -0
- package/dist/umd/types/core/utils/environment.d.ts +19 -0
- package/dist/umd/types/core/utils/logger.d.ts +37 -0
- package/dist/umd/types/core/utils/system.d.ts +22 -0
- package/dist/umd/types/hooks/useChatbot.d.ts +2 -0
- package/dist/umd/types/hooks/useChatbotEvents.d.ts +12 -0
- package/dist/umd/types/hooks/useChatbotState.d.ts +16 -0
- package/dist/umd/types/hooks/useWhyDidYouUpdate.d.ts +5 -0
- package/dist/umd/types/index.d.ts +7 -0
- package/dist/umd/types/index.react.d.ts +8 -0
- package/dist/umd/types/index.vanilla.d.ts +27 -0
- package/dist/umd/types/react/components/Chatbot.d.ts +32 -0
- package/dist/umd/types/react/components/ErrorBoundary.d.ts +18 -0
- package/dist/umd/types/services/ErrorTrackingService.d.ts +38 -0
- package/dist/umd/types/types/config.d.ts +33 -0
- package/dist/umd/types/types/events.d.ts +22 -0
- package/dist/umd/types/types/index.d.ts +16 -0
- package/dist/umd/types/types/state.d.ts +5 -0
- package/dist/umd/types/types.d.ts +46 -0
- package/dist/umd/types/utils/chatbotSdk.d.ts +23 -0
- package/dist/umd/types/utils/colorUtils.d.ts +1 -0
- package/dist/umd/types/utils/cookieUtils.d.ts +6 -0
- package/dist/umd/types/utils/environment.d.ts +12 -0
- package/dist/umd/types/utils/fetchData.d.ts +30 -0
- package/dist/umd/types/utils/logger.d.ts +6 -0
- package/dist/umd/types/utils/misc.d.ts +1 -0
- package/dist/umd/types/utils/originalFetchDataFile.d.ts +1 -0
- package/dist/umd/types/utils/systemInfo.d.ts +13 -0
- package/dist/umd/types/utils/version.d.ts +1 -0
- package/dist/umd/types/vanilla/index.d.ts +44 -0
- package/package.json +62 -8
package/README.md
CHANGED
|
@@ -1,154 +1,71 @@
|
|
|
1
|
-
# Robylon
|
|
1
|
+
# Robylon SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Robylon SDK provides chatbot functionality that can be used in both React and vanilla JavaScript applications.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
+
### React
|
|
8
|
+
|
|
7
9
|
```bash
|
|
8
10
|
npm install @robylon/web-react-sdk
|
|
9
|
-
# or
|
|
10
|
-
yarn add @robylon/web-react-sdk
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
```jsx
|
|
16
|
-
import { Chatbot } from "@robylon/web-react-sdk";
|
|
17
|
-
|
|
18
|
-
function App() {
|
|
19
|
-
const handleChatbotEvent = (event) => {
|
|
20
|
-
logger.log(`Chatbot event: ${event.type}`, event);
|
|
21
|
-
};
|
|
13
|
+
### Vanilla JavaScript
|
|
22
14
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
api_key="your-api-key"
|
|
26
|
-
user_id="user-id"
|
|
27
|
-
user_token="optional-auth-token"
|
|
28
|
-
user_profile={{
|
|
29
|
-
email: "user@example.com",
|
|
30
|
-
name: "John Doe",
|
|
31
|
-
mobile: "1234567890",
|
|
32
|
-
}}
|
|
33
|
-
onEvent={handleChatbotEvent}
|
|
34
|
-
/>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
15
|
+
```html
|
|
16
|
+
<script src="https://staging-cdn.robylon.com/sdk/1.1.27/robylon.min.js"></script>
|
|
37
17
|
```
|
|
38
18
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
### Required Props
|
|
19
|
+
Or via npm:
|
|
42
20
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
### Optional Props
|
|
47
|
-
|
|
48
|
-
- `user_token`: Authentication token for the user
|
|
49
|
-
- `user_profile`: Object containing user information
|
|
50
|
-
- `email`: User's email address
|
|
51
|
-
- `name`: User's name
|
|
52
|
-
- `mobile`: User's mobile number
|
|
53
|
-
- `onEvent`: Callback function to handle chatbot events
|
|
54
|
-
|
|
55
|
-
### Event Handling
|
|
56
|
-
|
|
57
|
-
The SDK emits various events that you can listen to using the `onEvent` prop. Each event has the following structure:
|
|
58
|
-
|
|
59
|
-
```typescript
|
|
60
|
-
interface ChatbotEvent {
|
|
61
|
-
type: ChatbotEventType;
|
|
62
|
-
timestamp: number;
|
|
63
|
-
data?: any;
|
|
64
|
-
}
|
|
21
|
+
```bash
|
|
22
|
+
npm install @robylon/web-react-sdk
|
|
65
23
|
```
|
|
66
24
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
```typescript
|
|
70
|
-
enum ChatbotEventType {
|
|
71
|
-
CHATBOT_BUTTON_LOADED = "CHATBOT_BUTTON_LOADED", // When the chat button is rendered
|
|
72
|
-
CHATBOT_OPENED = "CHATBOT_OPENED", // When chat window is opened
|
|
73
|
-
CHATBOT_CLOSED = "CHATBOT_CLOSED", // When chat window is closed
|
|
74
|
-
CHATBOT_APP_READY = "CHATBOT_APP_READY", // When SDK is fully initialized
|
|
75
|
-
CHATBOT_LOADED = "CHATBOT_LOADED", // When chatbot iframe is loaded
|
|
76
|
-
CHAT_INITIALIZED = "CHAT_INITIALIZED", // When chat session is initialized
|
|
77
|
-
SESSION_REFRESHED = "SESSION_REFRESHED", // When chat session is refreshed
|
|
78
|
-
CHAT_INITIALIZATION_FAILED = "CHAT_INITIALIZATION_FAILED", // When initialization fails
|
|
79
|
-
}
|
|
80
|
-
```
|
|
25
|
+
## Usage
|
|
81
26
|
|
|
82
|
-
|
|
27
|
+
### React
|
|
83
28
|
|
|
84
29
|
```jsx
|
|
85
|
-
|
|
86
|
-
const handleChatbotEvent = (event) => {
|
|
87
|
-
switch (event.type) {
|
|
88
|
-
case "CHATBOT_BUTTON_CLICKED":
|
|
89
|
-
logger.log("Chat button clicked at:", new Date(event.timestamp));
|
|
90
|
-
break;
|
|
91
|
-
case "CHATBOT_OPENED":
|
|
92
|
-
logger.log("Chat window opened at:", new Date(event.timestamp));
|
|
93
|
-
break;
|
|
94
|
-
case "CHAT_INITIALIZED":
|
|
95
|
-
logger.log("Chat session initialized");
|
|
96
|
-
break;
|
|
97
|
-
case "CHAT_INITIALIZATION_FAILED":
|
|
98
|
-
console.error("Chat initialization failed:", event.data);
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
};
|
|
30
|
+
import { Chatbot } from '@robylon/web-react-sdk/react';
|
|
102
31
|
|
|
32
|
+
function App() {
|
|
103
33
|
return (
|
|
104
|
-
<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
34
|
+
<div className="App">
|
|
35
|
+
<Chatbot
|
|
36
|
+
api_key="your-api-key"
|
|
37
|
+
user_id="optional-user-id"
|
|
38
|
+
onEvent={(event) => console.log(event)}
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
109
41
|
);
|
|
110
42
|
}
|
|
111
43
|
```
|
|
112
44
|
|
|
113
|
-
###
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
## Browser Support
|
|
136
|
-
|
|
137
|
-
The SDK supports all modern browsers and includes fallbacks for:
|
|
138
|
-
|
|
139
|
-
- User agent detection
|
|
140
|
-
- Screen size detection
|
|
141
|
-
- Browser identification
|
|
142
|
-
- Device type detection
|
|
143
|
-
|
|
144
|
-
## Development
|
|
145
|
-
|
|
146
|
-
### Creating Branches
|
|
147
|
-
|
|
148
|
-
Always use the provided script to create new branches:
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
npm run branch
|
|
45
|
+
### Vanilla JavaScript
|
|
46
|
+
|
|
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
|
+
});
|
|
57
|
+
|
|
58
|
+
// From npm module
|
|
59
|
+
import { create } from '@robylon/web-react-sdk';
|
|
60
|
+
|
|
61
|
+
create({
|
|
62
|
+
api_key: 'your-api-key',
|
|
63
|
+
user_id: 'optional-user-id'
|
|
64
|
+
}).then(chatbot => {
|
|
65
|
+
chatbot.show();
|
|
66
|
+
});
|
|
152
67
|
```
|
|
153
68
|
|
|
154
|
-
|
|
69
|
+
## Documentation
|
|
70
|
+
|
|
71
|
+
For detailed documentation, please visit: [https://app.robylon.ai/docs](https://app.robylon.ai/docs)
|