@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.
Files changed (86) hide show
  1. package/README.md +46 -129
  2. package/dist/cjs/index.js +1145 -1
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/legacy.js +2 -0
  5. package/dist/cjs/legacy.js.map +1 -0
  6. package/dist/cjs/react.js +2 -0
  7. package/dist/cjs/react.js.map +1 -0
  8. package/dist/cjs/types/core/api.d.ts +56 -0
  9. package/dist/cjs/types/core/chatbotEmbed.d.ts +59 -0
  10. package/dist/cjs/types/core/utils/color.d.ts +1 -0
  11. package/dist/cjs/types/core/utils/cookies.d.ts +30 -0
  12. package/dist/cjs/types/core/utils/environment.d.ts +19 -0
  13. package/dist/cjs/types/core/utils/logger.d.ts +37 -0
  14. package/dist/cjs/types/core/utils/system.d.ts +22 -0
  15. package/dist/cjs/types/index.d.ts +6 -2
  16. package/dist/cjs/types/index.react.d.ts +8 -0
  17. package/dist/cjs/types/index.vanilla.d.ts +27 -0
  18. package/dist/cjs/types/react/components/Chatbot.d.ts +32 -0
  19. package/dist/cjs/types/react/components/ErrorBoundary.d.ts +18 -0
  20. package/dist/cjs/types/types.d.ts +9 -1
  21. package/dist/cjs/types/vanilla/index.d.ts +44 -0
  22. package/dist/esm/index.js +1139 -1
  23. package/dist/esm/index.js.map +1 -1
  24. package/dist/esm/legacy.js +2 -0
  25. package/dist/esm/legacy.js.map +1 -0
  26. package/dist/esm/react.js +2 -0
  27. package/dist/esm/react.js.map +1 -0
  28. package/dist/esm/types/core/api.d.ts +56 -0
  29. package/dist/esm/types/core/chatbotEmbed.d.ts +59 -0
  30. package/dist/esm/types/core/utils/color.d.ts +1 -0
  31. package/dist/esm/types/core/utils/cookies.d.ts +30 -0
  32. package/dist/esm/types/core/utils/environment.d.ts +19 -0
  33. package/dist/esm/types/core/utils/logger.d.ts +37 -0
  34. package/dist/esm/types/core/utils/system.d.ts +22 -0
  35. package/dist/esm/types/index.d.ts +6 -2
  36. package/dist/esm/types/index.react.d.ts +8 -0
  37. package/dist/esm/types/index.vanilla.d.ts +27 -0
  38. package/dist/esm/types/react/components/Chatbot.d.ts +32 -0
  39. package/dist/esm/types/react/components/ErrorBoundary.d.ts +18 -0
  40. package/dist/esm/types/types.d.ts +9 -1
  41. package/dist/esm/types/vanilla/index.d.ts +44 -0
  42. package/dist/index.d.ts +62 -57
  43. package/dist/umd/robylon.js +1152 -0
  44. package/dist/umd/robylon.js.map +1 -0
  45. package/dist/umd/robylon.min.js +2 -0
  46. package/dist/umd/robylon.min.js.map +1 -0
  47. package/dist/umd/types/components/ChatbotFloatingButton.d.ts +12 -0
  48. package/dist/umd/types/components/ChatbotIframe.d.ts +12 -0
  49. package/dist/umd/types/components/ErrorBoundary.d.ts +15 -0
  50. package/dist/umd/types/components/RobylonChatbot.d.ts +11 -0
  51. package/dist/umd/types/config.d.ts +5 -0
  52. package/dist/umd/types/constants/errorConstants.d.ts +60 -0
  53. package/dist/umd/types/core/api.d.ts +56 -0
  54. package/dist/umd/types/core/chatbotEmbed.d.ts +59 -0
  55. package/dist/umd/types/core/utils/color.d.ts +1 -0
  56. package/dist/umd/types/core/utils/cookies.d.ts +30 -0
  57. package/dist/umd/types/core/utils/environment.d.ts +19 -0
  58. package/dist/umd/types/core/utils/logger.d.ts +37 -0
  59. package/dist/umd/types/core/utils/system.d.ts +22 -0
  60. package/dist/umd/types/hooks/useChatbot.d.ts +2 -0
  61. package/dist/umd/types/hooks/useChatbotEvents.d.ts +12 -0
  62. package/dist/umd/types/hooks/useChatbotState.d.ts +16 -0
  63. package/dist/umd/types/hooks/useWhyDidYouUpdate.d.ts +5 -0
  64. package/dist/umd/types/index.d.ts +7 -0
  65. package/dist/umd/types/index.react.d.ts +8 -0
  66. package/dist/umd/types/index.vanilla.d.ts +27 -0
  67. package/dist/umd/types/react/components/Chatbot.d.ts +32 -0
  68. package/dist/umd/types/react/components/ErrorBoundary.d.ts +18 -0
  69. package/dist/umd/types/services/ErrorTrackingService.d.ts +38 -0
  70. package/dist/umd/types/types/config.d.ts +33 -0
  71. package/dist/umd/types/types/events.d.ts +22 -0
  72. package/dist/umd/types/types/index.d.ts +16 -0
  73. package/dist/umd/types/types/state.d.ts +5 -0
  74. package/dist/umd/types/types.d.ts +46 -0
  75. package/dist/umd/types/utils/chatbotSdk.d.ts +23 -0
  76. package/dist/umd/types/utils/colorUtils.d.ts +1 -0
  77. package/dist/umd/types/utils/cookieUtils.d.ts +6 -0
  78. package/dist/umd/types/utils/environment.d.ts +12 -0
  79. package/dist/umd/types/utils/fetchData.d.ts +30 -0
  80. package/dist/umd/types/utils/logger.d.ts +6 -0
  81. package/dist/umd/types/utils/misc.d.ts +1 -0
  82. package/dist/umd/types/utils/originalFetchDataFile.d.ts +1 -0
  83. package/dist/umd/types/utils/systemInfo.d.ts +13 -0
  84. package/dist/umd/types/utils/version.d.ts +1 -0
  85. package/dist/umd/types/vanilla/index.d.ts +44 -0
  86. package/package.json +62 -8
package/README.md CHANGED
@@ -1,154 +1,71 @@
1
- # Robylon Web React SDK
1
+ # Robylon SDK
2
2
 
3
- A lightweight React SDK for integrating Robylon's AI-powered chatbot into your web applications.
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
- ## Quick Start
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
- return (
24
- <Chatbot
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
- ## Configuration
40
-
41
- ### Required Props
19
+ Or via npm:
42
20
 
43
- - `api_key`: Your Robylon API key
44
- - `user_id`: Unique identifier for the current user
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
- Available event types:
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
- Example usage:
27
+ ### React
83
28
 
84
29
  ```jsx
85
- function App() {
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
- <Chatbot
105
- api_key="your-api-key"
106
- user_id="user-id"
107
- onEvent={handleChatbotEvent}
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
- ### Automatically Included Information
114
-
115
- The SDK automatically collects and includes the following system information:
116
-
117
- - `platform`: Always set to "web"
118
- - `os`: User's operating system
119
- - `browser`: User's browser type
120
- - `device`: Device type (desktop/mobile/tablet)
121
- - `screen_size`: User's screen dimensions (width and height)
122
- - `sdk_version`: Current version of the SDK
123
-
124
- ## Features
125
-
126
- - Persistent chat interface
127
- - Responsive design for all screen sizes
128
- - Automatic system information collection
129
- - Customizable chat bubble
130
- - Session management
131
- - Secure communication channel
132
- - Cross-browser compatibility
133
- - Comprehensive event system
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
- This ensures proper version control and naming conventions.
69
+ ## Documentation
70
+
71
+ For detailed documentation, please visit: [https://app.robylon.ai/docs](https://app.robylon.ai/docs)