@robylon/react-native-sdk 1.10.1-staging.11 → 1.10.1-staging.4

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.
@@ -5,4 +5,3 @@ __fixtures__/
5
5
  __mocks__/
6
6
  .env*
7
7
  *.log
8
- usage/*
@@ -4,4 +4,3 @@ __fixtures__/
4
4
  __mocks__/
5
5
  .env*
6
6
  *.log
7
- usage/*
package/README.md CHANGED
@@ -1,185 +0,0 @@
1
- # Robylon React Native SDK Documentation
2
-
3
- ## Installation
4
-
5
- First, install the package using npm or yarn:
6
-
7
- ```bash
8
- # Using npm
9
- npm install @robylon/react-native-sdk react-native-webview
10
-
11
- # Using yarn
12
- yarn add @robylon/react-native-sdk react-native-webview
13
- ```
14
-
15
- ## Prerequisites
16
-
17
- - React Native project set up for iOS
18
- - `react-native-webview` installed and configured
19
- - Valid Robylon API key
20
-
21
- ## Basic Implementation
22
-
23
- ### 1. Import the SDK
24
-
25
- ```typescript
26
- import { ChatbotSDK } from "@robylon/react-native-sdk";
27
- ```
28
-
29
- ### 2. Basic Usage
30
-
31
- ```typescript
32
- import React from "react";
33
- import { View } from "react-native";
34
- import { ChatbotSDK } from "@robylon/react-native-sdk";
35
-
36
- const App = () => {
37
- return (
38
- <View style={{ flex: 1 }}>
39
- <ChatbotSDK
40
- api_key="YOUR_API_KEY"
41
- user_id="USER_ID"
42
- user_token="USER_TOKEN"
43
- />
44
- </View>
45
- );
46
- };
47
-
48
- export default App;
49
- ```
50
-
51
- ## Props Reference
52
-
53
- ### Required Props
54
-
55
- | Prop | Type | Description |
56
- | --------- | ------ | ------------------------------ |
57
- | `api_key` | string | Your Robylon API key |
58
- | `user_id` | string | Unique identifier for the user |
59
-
60
- ### Optional Props
61
-
62
- | Prop | Type | Default | Description |
63
- | ---------------------- | ---------------------- | --------- | -------------------------------------------- |
64
- | `user_token` | string | undefined | Authentication token for the user |
65
- | `additional_params` | Record<string, string> | {} | Additional parameters to pass to the chatbot |
66
- | `show_floating_button` | boolean | true | Whether to show the floating button |
67
- | `isFullScreen` | boolean | true | Whether to display in fullscreen mode |
68
- | `enableAnimation` | boolean | true | Enable/disable animations |
69
- | `onMessage` | (message: any) => void | undefined | Callback for chatbot messages |
70
- | `onOpen` | () => void | undefined | Callback when chatbot opens |
71
- | `onClose` | () => void | undefined | Callback when chatbot closes |
72
-
73
- ## Advanced Implementation
74
-
75
- ### Custom Configuration Example
76
-
77
- ```typescript
78
- import React from "react";
79
- import { View } from "react-native";
80
- import { ChatbotSDK } from "@robylon/react-native-sdk";
81
-
82
- const App = () => {
83
- const handleMessage = (message) => {
84
- console.log("Received message:", message);
85
- };
86
-
87
- const handleOpen = () => {
88
- console.log("Chatbot opened");
89
- };
90
-
91
- const handleClose = () => {
92
- console.log("Chatbot closed");
93
- };
94
-
95
- return (
96
- <View style={{ flex: 1 }}>
97
- <ChatbotSDK
98
- api_key="YOUR_API_KEY"
99
- user_id="USER_ID"
100
- user_token="USER_TOKEN"
101
- additional_params={{
102
- theme: "light",
103
- language: "en",
104
- }}
105
- show_floating_button={true}
106
- isFullScreen={true}
107
- enableAnimation={true}
108
- onMessage={handleMessage}
109
- onOpen={handleOpen}
110
- onClose={handleClose}
111
- />
112
- </View>
113
- );
114
- };
115
-
116
- export default App;
117
- ```
118
-
119
- <!-- ### Handling Messages
120
-
121
- The `onMessage` callback receives messages in the following format:
122
-
123
- ```typescript
124
- interface ChatbotMessage {
125
- type: string;
126
- data?: any;
127
- }
128
- ```
129
-
130
- Example message handler:
131
-
132
- ```typescript
133
- const handleMessage = (message: ChatbotMessage) => {
134
- switch (message.type) {
135
- case 'user_message':
136
- console.log('User sent:', message.data);
137
- break;
138
- case 'bot_response':
139
- console.log('Bot responded:', message.data);
140
- break;
141
- // Handle other message types
142
- }
143
- };
144
- ``` -->
145
-
146
- ## Styling and Customization
147
-
148
- The SDK automatically fetches and applies your organization's branding configuration, including:
149
-
150
- - Brand color
151
- - Launcher logo
152
- - Welcome message
153
-
154
- <!-- These are fetched using the provided API key and user credentials. -->
155
-
156
- ## Best Practices
157
-
158
- 1. **Error Handling**: Always implement error handling for network requests and message processing.
159
- 2. **User Authentication**: Ensure user_id and user_token are properly managed and updated.
160
- 3. **Performance**: Consider using `useMemo` or `useCallback` for callback functions to optimize performance.
161
- 4. **Testing**: Test the implementation across different iOS devices and orientations.
162
-
163
- ## Troubleshooting
164
-
165
- Common issues and solutions:
166
-
167
- 1. **WebView Not Loading**
168
-
169
- - Verify internet connectivity
170
- - Check if API key is valid
171
- - Ensure WebView permissions are properly configured
172
-
173
- 2. **Authentication Issues**
174
-
175
- - Verify user_token is valid and not expired
176
- - Check if user_id is correctly formatted
177
-
178
- 3. **UI Issues**
179
- - Ensure proper layout hierarchy
180
- - Check for conflicts with other UI elements
181
- - Verify styling properties
182
-
183
- ## Support
184
-
185
- For additional support or to report issues, please contact Robylon support or refer to the official documentation.
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/jobinabraham/Developer/personal/robylon-react-native-sdk/src/FloatingButton.tsx";var FloatingButton=function FloatingButton(_ref){var onPress=_ref.onPress,_ref$brandColor=_ref.brandColor,brandColor=_ref$brandColor===void 0?"#007AFF":_ref$brandColor,imageUrl=_ref.imageUrl;return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.button,{backgroundColor:brandColor}],onPress:onPress,children:imageUrl?(0,_jsxRuntime.jsx)(_reactNative.Image,{source:{uri:imageUrl},style:styles.buttonImage}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonText,children:"Chat"})});};var styles=_reactNative.StyleSheet.create({button:{position:"absolute",bottom:20,right:20,borderRadius:24,width:48,height:48,justifyContent:"center",alignItems:"center",elevation:5,shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:0.25,shadowRadius:3.84},buttonText:{color:"white",fontSize:16,fontWeight:"bold"},buttonImage:{width:48,height:48,borderRadius:24}});var _default=exports.default=FloatingButton;
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/jobinabraham/Developer/personal/robylon-react-native-sdk/src/FloatingButton.tsx";var FloatingButton=function FloatingButton(_ref){var onPress=_ref.onPress,_ref$brandColor=_ref.brandColor,brandColor=_ref$brandColor===void 0?"#007AFF":_ref$brandColor,imageUrl=_ref.imageUrl;return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.button,{backgroundColor:brandColor}],onPress:onPress,children:imageUrl?(0,_jsxRuntime.jsx)(_reactNative.Image,{source:{uri:imageUrl},style:styles.buttonImage}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonText,children:"Chat"})});};var styles=_reactNative.StyleSheet.create({button:{position:"absolute",bottom:20,right:20,borderRadius:30,width:60,height:60,justifyContent:"center",alignItems:"center",elevation:5,shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:0.25,shadowRadius:3.84},buttonText:{color:"white",fontSize:16,fontWeight:"bold"},buttonImage:{width:40,height:40,borderRadius:20}});var _default=exports.default=FloatingButton;
2
2
  //# sourceMappingURL=FloatingButton.js.map
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,"__esModule",{value:true});exports.BASE_CHATBOT_URL=void 0;var BASE_CHATBOT_DOMAIN=process&&process.env&&process.env.CHATBOT_DOMAIN||"http://172.16.1.79:5174"||"";var CHATBOT_PATH=process&&process.env&&process.env.CHATBOT_PATH||"chatbot-plugin"||"";var BASE_CHATBOT_URL=exports.BASE_CHATBOT_URL=BASE_CHATBOT_DOMAIN+"/"+CHATBOT_PATH;
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.BASE_CHATBOT_URL=void 0;var BASE_CHATBOT_DOMAIN=process&&process.env&&process.env.CHATBOT_DOMAIN||"http://172.16.1.14:5174"||"";var CHATBOT_PATH=process&&process.env&&process.env.CHATBOT_PATH||"chatbot-plugin"||"";var BASE_CHATBOT_URL=exports.BASE_CHATBOT_URL=BASE_CHATBOT_DOMAIN+"/"+CHATBOT_PATH;
2
2
  //# sourceMappingURL=constants.js.map
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/jobinabraham/Developer/personal/robylon-react-native-sdk/src/FloatingButton.tsx";var FloatingButton=function FloatingButton(_ref){var onPress=_ref.onPress,_ref$brandColor=_ref.brandColor,brandColor=_ref$brandColor===void 0?"#007AFF":_ref$brandColor,imageUrl=_ref.imageUrl;return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.button,{backgroundColor:brandColor}],onPress:onPress,children:imageUrl?(0,_jsxRuntime.jsx)(_reactNative.Image,{source:{uri:imageUrl},style:styles.buttonImage}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonText,children:"Chat"})});};var styles=_reactNative.StyleSheet.create({button:{position:"absolute",bottom:20,right:20,borderRadius:24,width:48,height:48,justifyContent:"center",alignItems:"center",elevation:5,shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:0.25,shadowRadius:3.84},buttonText:{color:"white",fontSize:16,fontWeight:"bold"},buttonImage:{width:48,height:48,borderRadius:24}});var _default=exports.default=FloatingButton;
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/jobinabraham/Developer/personal/robylon-react-native-sdk/src/FloatingButton.tsx";var FloatingButton=function FloatingButton(_ref){var onPress=_ref.onPress,_ref$brandColor=_ref.brandColor,brandColor=_ref$brandColor===void 0?"#007AFF":_ref$brandColor,imageUrl=_ref.imageUrl;return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.button,{backgroundColor:brandColor}],onPress:onPress,children:imageUrl?(0,_jsxRuntime.jsx)(_reactNative.Image,{source:{uri:imageUrl},style:styles.buttonImage}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonText,children:"Chat"})});};var styles=_reactNative.StyleSheet.create({button:{position:"absolute",bottom:20,right:20,borderRadius:30,width:60,height:60,justifyContent:"center",alignItems:"center",elevation:5,shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:0.25,shadowRadius:3.84},buttonText:{color:"white",fontSize:16,fontWeight:"bold"},buttonImage:{width:40,height:40,borderRadius:20}});var _default=exports.default=FloatingButton;
2
2
  //# sourceMappingURL=FloatingButton.js.map
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,"__esModule",{value:true});exports.BASE_CHATBOT_URL=void 0;var BASE_CHATBOT_DOMAIN=process&&process.env&&process.env.CHATBOT_DOMAIN||"http://172.16.1.79:5174"||"";var CHATBOT_PATH=process&&process.env&&process.env.CHATBOT_PATH||"chatbot-plugin"||"";var BASE_CHATBOT_URL=exports.BASE_CHATBOT_URL=BASE_CHATBOT_DOMAIN+"/"+CHATBOT_PATH;
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.BASE_CHATBOT_URL=void 0;var BASE_CHATBOT_DOMAIN=process&&process.env&&process.env.CHATBOT_DOMAIN||"http://172.16.1.14:5174"||"";var CHATBOT_PATH=process&&process.env&&process.env.CHATBOT_PATH||"chatbot-plugin"||"";var BASE_CHATBOT_URL=exports.BASE_CHATBOT_URL=BASE_CHATBOT_DOMAIN+"/"+CHATBOT_PATH;
2
2
  //# sourceMappingURL=constants.js.map
@@ -1,3 +1,2 @@
1
-
2
- //# sourceMappingURL=openChatbot.js.mape",{value:true});exports.openChatbot=void 0;var _reactNative=require("react-native");var _constants=require("./constants");var openChatbot=exports.openChatbot=function openChatbot(chatbotId){var additionalParams=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var params=new URLSearchParams(Object.assign({id:chatbotId},additionalParams));var url=_constants.BASE_CHATBOT_URL+"?"+params.toString();_reactNative.Linking.openURL(url);};
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.openChatbot=void 0;var _reactNative=require("react-native");var _constants=require("./constants");var openChatbot=exports.openChatbot=function openChatbot(chatbotId){var additionalParams=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var params=new URLSearchParams(Object.assign({id:chatbotId},additionalParams));var url=_constants.BASE_CHATBOT_URL+"?"+params.toString();_reactNative.Linking.openURL(url);};
3
2
  //# sourceMappingURL=openChatbot.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["openChatbot.tsx"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_constants","openChatbot","exports","chatbotId","additionalParams","arguments","length","undefined","params","URLSearchParams","Object","assign","id","url","BASE_CHATBOT_URL","toString","Linking","openURL"],"sourceRoot":"../../src","sources":["openChatbot.ts"],"mappings":"oFAAA,IAAAA,YAAA,CAAAC,OAAA,iBACA,IAAAC,UAAA,CAAAD,OAAA,gBAEO,GAAM,CAAAE,WAAW,CAAAC,OAAA,CAAAD,WAAA,CAAG,QAAd,CAAAA,WAAWA,CACtBE,SAAiB,CAER,IADT,CAAAC,gBAAwC,CAAAC,SAAA,CAAAC,MAAA,IAAAD,SAAA,MAAAE,SAAA,CAAAF,SAAA,IAAG,CAAC,CAAC,CAE7C,GAAM,CAAAG,MAAM,CAAG,GAAI,CAAAC,eAAe,CAAAC,MAAA,CAAAC,MAAA,EAAGC,EAAE,CAAET,SAAS,EAAKC,gBAAgB,CAAE,CAAC,CAC1E,GAAM,CAAAS,GAAG,CAAMC,2BAAgB,KAAIN,MAAM,CAACO,QAAQ,CAAC,CAAG,CACtDC,oBAAO,CAACC,OAAO,CAACJ,GAAG,CAAC,CACtB,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@robylon/react-native-sdk",
3
- "version": "1.10.1-staging.11",
3
+ "version": "1.10.1-staging.4",
4
4
  "description": "React Native SDK for Robylon",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
7
7
  "types": "lib/typescript/index.d.ts",
8
- "react-native": "lib/commonjs/index.js",
8
+ "react-native": "src/index.tsx",
9
9
  "source": "src/index.tsx",
10
10
  "scripts": {
11
11
  "prepare": "bob build",
@@ -31,9 +31,9 @@ const styles = StyleSheet.create({
31
31
  position: "absolute",
32
32
  bottom: 20,
33
33
  right: 20,
34
- borderRadius: 24,
35
- width: 48,
36
- height: 48,
34
+ borderRadius: 30,
35
+ width: 60,
36
+ height: 60,
37
37
  justifyContent: "center",
38
38
  alignItems: "center",
39
39
  elevation: 5,
@@ -48,9 +48,9 @@ const styles = StyleSheet.create({
48
48
  fontWeight: "bold",
49
49
  },
50
50
  buttonImage: {
51
- width: 48,
52
- height: 48,
53
- borderRadius: 24,
51
+ width: 40,
52
+ height: 40,
53
+ borderRadius: 20,
54
54
  },
55
55
  });
56
56