@robylon/react-native-sdk 2.0.24 → 2.0.25-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/lib/commonjs/config.js +1 -1
- package/lib/commonjs/config.js.map +1 -1
- package/lib/commonjs/constants.js +1 -1
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/openChatbot.js +2 -1
- package/lib/commonjs/versions/version.staging.js +1 -1
- package/lib/module/config.js +1 -1
- package/lib/module/config.js.map +1 -1
- package/lib/module/constants.js +1 -1
- package/lib/module/constants.js.map +1 -1
- package/lib/module/openChatbot.js +1 -2
- package/lib/module/openChatbot.js.map +1 -1
- package/lib/module/versions/version.staging.js +1 -1
- package/lib/typescript/versions/version.staging.d.ts +1 -1
- package/package.json +1 -1
- package/src/Chatbotsdk.tsx +852 -0
- package/src/FloatingButton/launchers/ImageLauncher.tsx +75 -0
- package/src/FloatingButton/launchers/TextLauncher.tsx +84 -0
- package/src/FloatingButton/launchers/TextualImageLauncher.tsx +133 -0
- package/src/FloatingButton.tsx +97 -0
- package/src/LoadingIndicator.tsx +11 -0
- package/src/Toast.tsx +65 -0
- package/src/components/DebugButton.tsx +46 -0
- package/src/components/ErrorBoundary.tsx +38 -0
- package/src/config.ts +4 -0
- package/src/constants/errorConstants.ts +21 -0
- package/src/constants/fontStyles.ts +3 -0
- package/src/constants.ts +5 -0
- package/src/global.d.ts +11 -0
- package/src/hooks/useChatbotEvents.ts +93 -0
- package/src/index.tsx +10 -0
- package/src/openChatbot.ts +11 -0
- package/src/openChatbot.tsx +0 -0
- package/src/services/ErrorTrackingService.ts +217 -0
- package/src/types/events.ts +25 -0
- package/src/types/react-native-flipper-performance-plugin.d.ts +3 -0
- package/src/types/react-native-globals.d.ts +10 -0
- package/src/utils/animations.ts +120 -0
- package/src/utils/colorUtils.ts +35 -0
- package/src/utils/cookieUtils.ts +7 -0
- package/src/utils/debugConfig.ts +56 -0
- package/src/utils/debugMenu.ts +14 -0
- package/src/utils/errorHandler.ts +58 -0
- package/src/utils/logger.ts +14 -0
- package/src/utils/systemInfo.ts +84 -0
- package/src/utils/webViewStorage.ts +62 -0
- package/src/version.ts +2 -0
- package/src/versions/version.dev.ts +2 -0
- package/src/versions/version.production.ts +2 -0
- package/src/versions/version.staging.ts +2 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { logger } from "./logger";
|
|
2
|
+
|
|
3
|
+
export enum StorageMessageType {
|
|
4
|
+
GET_STORAGE = "GET_STORAGE",
|
|
5
|
+
SET_STORAGE = "SET_STORAGE",
|
|
6
|
+
STORAGE_READY = "STORAGE_READY",
|
|
7
|
+
STORAGE_ERROR = "STORAGE_ERROR",
|
|
8
|
+
STORAGE_RESPONSE = "STORAGE_RESPONSE",
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface StorageMessage {
|
|
12
|
+
type: StorageMessageType;
|
|
13
|
+
key?: string;
|
|
14
|
+
value?: string;
|
|
15
|
+
error?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const getStorageScript = () => `
|
|
19
|
+
window.handleStorageOperation = function(message) {
|
|
20
|
+
try {
|
|
21
|
+
switch(message.type) {
|
|
22
|
+
case '${StorageMessageType.GET_STORAGE}':
|
|
23
|
+
const value = localStorage.getItem(message.key);
|
|
24
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
25
|
+
type: '${StorageMessageType.STORAGE_RESPONSE}',
|
|
26
|
+
key: message.key,
|
|
27
|
+
value: value
|
|
28
|
+
}));
|
|
29
|
+
break;
|
|
30
|
+
case '${StorageMessageType.SET_STORAGE}':
|
|
31
|
+
localStorage.setItem(message.key, message.value);
|
|
32
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
33
|
+
type: '${StorageMessageType.STORAGE_RESPONSE}',
|
|
34
|
+
key: message.key,
|
|
35
|
+
value: message.value
|
|
36
|
+
}));
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
} catch (error) {
|
|
40
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
41
|
+
type: '${StorageMessageType.STORAGE_ERROR}',
|
|
42
|
+
error: error.message
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
48
|
+
type: '${StorageMessageType.STORAGE_READY}'
|
|
49
|
+
}));
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
export const createStorageMessage = (
|
|
53
|
+
type: StorageMessageType,
|
|
54
|
+
key?: string,
|
|
55
|
+
value?: string
|
|
56
|
+
): string => {
|
|
57
|
+
return `window.handleStorageOperation(${JSON.stringify({
|
|
58
|
+
type,
|
|
59
|
+
key,
|
|
60
|
+
value,
|
|
61
|
+
})});`;
|
|
62
|
+
};
|
package/src/version.ts
ADDED