@robylon/react-native-sdk 2.0.19-staging.9 → 2.0.21-dev.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 (91) hide show
  1. package/lib/commonjs/ChatbotWebview.js +1 -1
  2. package/lib/commonjs/ChatbotWebview.js.map +1 -1
  3. package/lib/commonjs/Chatbotsdk.js +69 -2
  4. package/lib/commonjs/Chatbotsdk.js.map +1 -1
  5. package/lib/commonjs/FloatingButton.js +1 -1
  6. package/lib/commonjs/FloatingButton.js.map +1 -1
  7. package/lib/commonjs/Toast.js +1 -1
  8. package/lib/commonjs/Toast.js.map +1 -1
  9. package/lib/commonjs/constants.js +1 -1
  10. package/lib/commonjs/constants.js.map +1 -1
  11. package/lib/commonjs/openChatbot.js +2 -1
  12. package/lib/commonjs/openChatbot.js.map +1 -1
  13. package/lib/commonjs/version.js +1 -1
  14. package/lib/commonjs/versions/version.dev.js +1 -1
  15. package/lib/commonjs/versions/version.dev.js.map +1 -1
  16. package/lib/commonjs/versions/version.staging.js +1 -1
  17. package/lib/commonjs/versions/version.staging.js.map +1 -1
  18. package/lib/module/ChatbotWebview.js +1 -1
  19. package/lib/module/ChatbotWebview.js.map +1 -1
  20. package/lib/module/Chatbotsdk.js +69 -2
  21. package/lib/module/Chatbotsdk.js.map +1 -1
  22. package/lib/module/FloatingButton.js +1 -1
  23. package/lib/module/FloatingButton.js.map +1 -1
  24. package/lib/module/Toast.js +1 -1
  25. package/lib/module/Toast.js.map +1 -1
  26. package/lib/module/constants.js +1 -1
  27. package/lib/module/constants.js.map +1 -1
  28. package/lib/module/version.js +1 -1
  29. package/lib/module/versions/version.dev.js +1 -1
  30. package/lib/module/versions/version.dev.js.map +1 -1
  31. package/lib/module/versions/version.staging.js +1 -1
  32. package/lib/module/versions/version.staging.js.map +1 -1
  33. package/lib/typescript/Chatbotsdk.d.ts +40 -0
  34. package/lib/typescript/Chatbotsdk.d.ts.map +1 -1
  35. package/lib/typescript/FloatingButton.d.ts +1 -0
  36. package/lib/typescript/FloatingButton.d.ts.map +1 -1
  37. package/lib/typescript/version.d.ts +1 -1
  38. package/lib/typescript/version.d.ts.map +1 -1
  39. package/lib/typescript/versions/version.dev.d.ts +1 -1
  40. package/lib/typescript/versions/version.dev.d.ts.map +1 -1
  41. package/lib/typescript/versions/version.staging.d.ts +1 -1
  42. package/lib/typescript/versions/version.staging.d.ts.map +1 -1
  43. package/package.json +2 -2
  44. package/usage/react-native-ios-docs.md +185 -0
  45. package/.npmignore.development +0 -18
  46. package/.npmignore.production +0 -8
  47. package/.npmignore.staging +0 -7
  48. package/babel.config.js +0 -17
  49. package/scripts/create-branch.js +0 -560
  50. package/scripts/create-version-tag.js +0 -29
  51. package/scripts/get-next-version.js +0 -29
  52. package/scripts/husky-setup.js +0 -32
  53. package/scripts/prevent-direct-branch.js +0 -37
  54. package/scripts/publish-version.js +0 -13
  55. package/scripts/release.js +0 -77
  56. package/scripts/setup-git-hooks.js +0 -18
  57. package/scripts/update-version.js +0 -28
  58. package/scripts/validate-branch-name.sh +0 -65
  59. package/scripts/validate-publish.js +0 -71
  60. package/src/ChatbotWebview.tsx +0 -44
  61. package/src/Chatbotsdk.tsx +0 -679
  62. package/src/FloatingButton.tsx +0 -74
  63. package/src/LoadingIndicator.tsx +0 -11
  64. package/src/Toast.tsx +0 -65
  65. package/src/components/DebugButton.tsx +0 -46
  66. package/src/components/ErrorBoundary.tsx +0 -38
  67. package/src/config.ts +0 -4
  68. package/src/constants/errorConstants.ts +0 -21
  69. package/src/constants.ts +0 -4
  70. package/src/global.d.ts +0 -11
  71. package/src/hooks/useChatbotEvents.ts +0 -93
  72. package/src/index.tsx +0 -10
  73. package/src/openChatbot.ts +0 -11
  74. package/src/openChatbot.tsx +0 -0
  75. package/src/services/ErrorTrackingService.ts +0 -217
  76. package/src/types/events.ts +0 -25
  77. package/src/types/react-native-flipper-performance-plugin.d.ts +0 -3
  78. package/src/types/react-native-globals.d.ts +0 -10
  79. package/src/utils/cookieUtils.ts +0 -7
  80. package/src/utils/debugConfig.ts +0 -56
  81. package/src/utils/debugMenu.ts +0 -14
  82. package/src/utils/errorHandler.ts +0 -58
  83. package/src/utils/logger.ts +0 -14
  84. package/src/utils/systemInfo.ts +0 -84
  85. package/src/utils/webViewStorage.ts +0 -62
  86. package/src/version.ts +0 -2
  87. package/src/versions/version.dev.ts +0 -2
  88. package/src/versions/version.production.ts +0 -2
  89. package/src/versions/version.staging.ts +0 -2
  90. package/tsconfig.build.json +0 -16
  91. package/tsconfig.json +0 -26
@@ -1,74 +0,0 @@
1
- import React from "react";
2
- import { TouchableOpacity, StyleSheet, Text, Image } from "react-native";
3
- import { errorTracker } from "./services/ErrorTrackingService";
4
- import { ErrorTypes } from "./constants/errorConstants";
5
-
6
- interface FloatingButtonProps {
7
- onPress: () => void;
8
- brandColor?: string; // For dynamic branding
9
- imageUrl?: string; // For brand logo or icon
10
- }
11
-
12
- const FloatingButton: React.FC<FloatingButtonProps> = ({
13
- onPress,
14
- brandColor = "#007AFF", // Default color
15
- imageUrl,
16
- }) => {
17
- const handleImageError = () => {
18
- errorTracker.trackError(
19
- new Error("Failed to load button image"),
20
- "FloatingButton",
21
- {
22
- type: ErrorTypes.RUNTIME_ERROR,
23
- context: { imageUrl },
24
- }
25
- );
26
- };
27
-
28
- return (
29
- <TouchableOpacity
30
- style={[styles.button, { backgroundColor: brandColor }]}
31
- onPress={onPress}
32
- >
33
- {imageUrl ? (
34
- <Image
35
- source={{ uri: imageUrl }}
36
- style={styles.buttonImage}
37
- onError={handleImageError}
38
- />
39
- ) : (
40
- <Text style={styles.buttonText}>Chat</Text>
41
- )}
42
- </TouchableOpacity>
43
- );
44
- };
45
-
46
- const styles = StyleSheet.create({
47
- button: {
48
- position: "absolute",
49
- bottom: 20,
50
- right: 20,
51
- borderRadius: 24,
52
- width: 48,
53
- height: 48,
54
- justifyContent: "center",
55
- alignItems: "center",
56
- elevation: 5,
57
- shadowColor: "#000",
58
- shadowOffset: { width: 0, height: 2 },
59
- shadowOpacity: 0.25,
60
- shadowRadius: 3.84,
61
- },
62
- buttonText: {
63
- color: "white",
64
- fontSize: 16,
65
- fontWeight: "bold",
66
- },
67
- buttonImage: {
68
- width: 48,
69
- height: 48,
70
- borderRadius: 24,
71
- },
72
- });
73
-
74
- export default FloatingButton;
@@ -1,11 +0,0 @@
1
- import React, { useEffect, useState } from "react";
2
- import { View, ActivityIndicator } from "react-native";
3
- import { WebView } from "react-native-webview";
4
-
5
- const LoadingIndicator: React.FC = () => (
6
- <View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
7
- <ActivityIndicator size="large" color="#0000ff" />
8
- </View>
9
- );
10
-
11
- export default LoadingIndicator;
package/src/Toast.tsx DELETED
@@ -1,65 +0,0 @@
1
- import React, { useState, useEffect } from "react";
2
- import { View, Text, StyleSheet, Animated } from "react-native";
3
-
4
- const Toast = ({
5
- message,
6
- visible,
7
- duration = 3000,
8
- }: {
9
- message: any;
10
- visible: boolean;
11
- duration?: number;
12
- }) => {
13
- const [fadeAnim] = useState(new Animated.Value(0));
14
-
15
- useEffect(() => {
16
- if (visible) {
17
- // Fade in the toast
18
- Animated.timing(fadeAnim, {
19
- toValue: 1,
20
- duration: 300,
21
- useNativeDriver: true,
22
- }).start(() => {
23
- // Auto-hide after duration
24
- setTimeout(() => {
25
- Animated.timing(fadeAnim, {
26
- toValue: 0,
27
- duration: 300,
28
- useNativeDriver: true,
29
- }).start();
30
- }, duration);
31
- });
32
- }
33
- }, [visible]);
34
-
35
- return (
36
- <Animated.View
37
- style={[
38
- styles.toastContainer,
39
- { opacity: fadeAnim, display: visible ? "flex" : "none" },
40
- ]}
41
- >
42
- <Text style={styles.toastText}>{message}</Text>
43
- </Animated.View>
44
- );
45
- };
46
-
47
- const styles = StyleSheet.create({
48
- toastContainer: {
49
- position: "absolute",
50
- bottom: 50,
51
- left: "10%",
52
- right: "10%",
53
- backgroundColor: "rgba(0, 0, 0, 0.8)",
54
- padding: 10,
55
- borderRadius: 5,
56
- alignItems: "center",
57
- justifyContent: "center",
58
- },
59
- toastText: {
60
- color: "#fff",
61
- textAlign: "center",
62
- },
63
- });
64
-
65
- export default Toast;
@@ -1,46 +0,0 @@
1
- import React from "react";
2
- import { TouchableOpacity, Text, StyleSheet, View } from "react-native";
3
- import { openDebugMenu } from "../utils/debugMenu";
4
- import { openDebuggerFromApp } from "../utils/debugMenu";
5
-
6
- const DebugButton = () => {
7
- if (!__DEV__) return null;
8
-
9
- return (
10
- <View style={styles.debugContainer}>
11
- <TouchableOpacity style={styles.debugButton} onPress={openDebugMenu}>
12
- <Text style={styles.debugText}>Menu</Text>
13
- </TouchableOpacity>
14
- <TouchableOpacity
15
- style={[styles.debugButton, styles.debuggerButton]}
16
- onPress={openDebuggerFromApp}
17
- >
18
- <Text style={styles.debugText}>Debug</Text>
19
- </TouchableOpacity>
20
- </View>
21
- );
22
- };
23
-
24
- const styles = StyleSheet.create({
25
- debugContainer: {
26
- position: "absolute",
27
- top: 40,
28
- right: 10,
29
- flexDirection: "row",
30
- gap: 8,
31
- },
32
- debugButton: {
33
- backgroundColor: "rgba(0,0,0,0.7)",
34
- padding: 8,
35
- borderRadius: 4,
36
- },
37
- debuggerButton: {
38
- backgroundColor: "rgba(255,0,0,0.7)",
39
- },
40
- debugText: {
41
- color: "white",
42
- fontSize: 12,
43
- },
44
- });
45
-
46
- export default DebugButton;
@@ -1,38 +0,0 @@
1
- import React, { Component, ErrorInfo, ReactNode } from "react";
2
- import { errorTracker } from "../services/ErrorTrackingService";
3
- import { ErrorTypes } from "../constants/errorConstants";
4
-
5
- interface Props {
6
- children: ReactNode;
7
- componentName: string;
8
- }
9
-
10
- interface State {
11
- hasError: boolean;
12
- }
13
-
14
- export class ErrorBoundary extends Component<Props, State> {
15
- constructor(props: Props) {
16
- super(props);
17
- this.state = { hasError: false };
18
- }
19
-
20
- static getDerivedStateFromError(_: Error): State {
21
- return { hasError: true };
22
- }
23
-
24
- componentDidCatch(error: Error, errorInfo: ErrorInfo) {
25
- errorTracker.trackError(error, this.props.componentName, {
26
- errorInfo,
27
- type: ErrorTypes.RUNTIME_ERROR,
28
- });
29
- }
30
-
31
- render() {
32
- if (this.state.hasError) {
33
- return null; // Or a fallback UI if needed
34
- }
35
-
36
- return this.props.children;
37
- }
38
- }
package/src/config.ts DELETED
@@ -1,4 +0,0 @@
1
- export const config = {
2
- API_URL: process.env.API_URL || 'https://api.robylon.com',
3
- DEBUG: process.env.DEBUG === 'true'
4
- };
@@ -1,21 +0,0 @@
1
- export enum ErrorCodes {
2
- MISSING_API_KEY = "MISSING_API_KEY",
3
- ERROR_TRACKING_INIT_FAILED = "ERROR_TRACKING_INIT_FAILED",
4
- WEBVIEW_LOAD_ERROR = "WEBVIEW_LOAD_ERROR",
5
- CONFIG_FETCH_ERROR = "CONFIG_FETCH_ERROR",
6
- }
7
-
8
- export enum ErrorTypes {
9
- INITIALIZATION_ERROR = "INITIALIZATION_ERROR",
10
- RUNTIME_ERROR = "RUNTIME_ERROR",
11
- NETWORK_ERROR = "NETWORK_ERROR",
12
- }
13
-
14
- export const ErrorMessages = {
15
- [ErrorCodes.MISSING_API_KEY]: (apiKey: any) =>
16
- `Invalid API key: ${apiKey}. Please provide a valid API key.`,
17
- [ErrorCodes.ERROR_TRACKING_INIT_FAILED]:
18
- "Failed to initialize error tracking service.",
19
- [ErrorCodes.WEBVIEW_LOAD_ERROR]: "Failed to load chatbot interface.",
20
- [ErrorCodes.CONFIG_FETCH_ERROR]: "Failed to fetch chatbot configuration.",
21
- };
package/src/constants.ts DELETED
@@ -1,4 +0,0 @@
1
- const BASE_CHATBOT_DOMAIN = process.env.CHATBOT_DOMAIN || "";
2
- const CHATBOT_PATH = process.env.CHATBOT_PATH || "";
3
- export const BASE_CHATBOT_URL = `${BASE_CHATBOT_DOMAIN}/${CHATBOT_PATH}`;
4
- export const API_URL = process.env.API_URL;
package/src/global.d.ts DELETED
@@ -1,11 +0,0 @@
1
- // declare module "react-native" {
2
- // export const View: any;
3
- // export const ActivityIndicator: any;
4
- // export const Linking: any;
5
- // // Add other React Native exports as needed
6
- // }
7
-
8
- declare module "*.json" {
9
- const value: any;
10
- export default value;
11
- }
@@ -1,93 +0,0 @@
1
- import { useCallback } from "react";
2
- import { getSystemInfo } from "../utils/systemInfo";
3
- import { logger } from "../utils/logger";
4
- import {
5
- ChatbotEventType,
6
- AllEventTypes,
7
- ChatbotEventHandler,
8
- } from "../types/events";
9
- import { API_URL } from "../constants";
10
-
11
- interface EventHookProps {
12
- api_key: string;
13
- chatbotConfig: any;
14
- user_profile?: Record<string, any>;
15
- onEvent?: ChatbotEventHandler;
16
- systemInfo: { os: string; browser: string }; // Add this to get system info from WebView
17
- }
18
-
19
- export const useChatbotEvents = ({
20
- api_key,
21
- chatbotConfig,
22
- user_profile,
23
- onEvent,
24
- systemInfo,
25
- }: EventHookProps) => {
26
- const onInternalEvent = useCallback(
27
- async (
28
- eventType: AllEventTypes,
29
- additionalData: Record<string, any> = {}
30
- ) => {
31
- if (!api_key) return;
32
-
33
- try {
34
- const apiUrl = API_URL;
35
- const sysInfo = getSystemInfo(systemInfo);
36
-
37
- const eventData = {
38
- trigger_time: Date.now(),
39
- channel: "CHATBOT",
40
- org_id: api_key,
41
- client_user_id: chatbotConfig?.isAnonymous
42
- ? "Anonymous"
43
- : String(chatbotConfig?.userId || ""),
44
- event_type: eventType,
45
- user_profile: { ...(user_profile || {}) },
46
- ...additionalData,
47
- };
48
-
49
- const payload = {
50
- org_id: api_key,
51
- event_data: eventData,
52
- metadata: {
53
- timestamp: Date.now(),
54
- ...sysInfo,
55
- },
56
- event_type: "INFO",
57
- user_id: chatbotConfig?.userId,
58
- };
59
-
60
- logger.debug("Sending internal event:", payload);
61
-
62
- const response = await fetch(`${apiUrl}/users/sdk/record-logs/`, {
63
- method: "POST",
64
- headers: { "Content-Type": "application/json" },
65
- body: JSON.stringify(payload),
66
- });
67
-
68
- if (!response.ok) {
69
- throw new Error(
70
- `Failed to send internal event: ${response.statusText}`
71
- );
72
- }
73
- } catch (error) {
74
- logger.error("Failed to send internal event:", error);
75
- }
76
- },
77
- [api_key, chatbotConfig, user_profile, systemInfo]
78
- );
79
-
80
- const emitEvent = useCallback(
81
- (type: ChatbotEventType, data?: any) => {
82
- const timestamp = Date.now();
83
- onEvent?.({ type, timestamp, data });
84
- onInternalEvent(type, { ...data, timestamp });
85
- },
86
- [onEvent, onInternalEvent]
87
- );
88
-
89
- return {
90
- emitEvent,
91
- onInternalEvent,
92
- };
93
- };
package/src/index.tsx DELETED
@@ -1,10 +0,0 @@
1
- export { default as Chatbot } from "./Chatbotsdk";
2
- export { openChatbot } from "./openChatbot";
3
- export {
4
- errorTracker,
5
- ErrorTrackingService,
6
- } from "./services/ErrorTrackingService";
7
- export * from "./constants/errorConstants";
8
- export * from "./types/events";
9
-
10
- export type { ChatbotProps } from "./Chatbotsdk";
@@ -1,11 +0,0 @@
1
- import { Linking } from "react-native";
2
- import { BASE_CHATBOT_URL } from "./constants";
3
-
4
- export const openChatbot = (
5
- chatbotId: string,
6
- additionalParams: Record<string, string> = {}
7
- ): void => {
8
- const params = new URLSearchParams({ id: chatbotId, ...additionalParams });
9
- const url = `${BASE_CHATBOT_URL}?${params.toString()}`;
10
- Linking.openURL(url);
11
- };
File without changes
@@ -1,217 +0,0 @@
1
- import { getSystemInfo } from "../utils/systemInfo";
2
- import { logger } from "../utils/logger";
3
- import { API_URL } from "../constants";
4
- import { Platform } from "react-native";
5
-
6
- export enum EventType {
7
- ERROR = "ERROR",
8
- INFO = "INFO",
9
- }
10
-
11
- export interface ErrorEvent {
12
- message: string;
13
- stack?: string;
14
- componentName?: string | null | undefined;
15
- additionalInfo?: Record<string, any>;
16
- timestamp: number;
17
- }
18
-
19
- export interface LogPayload {
20
- org_id: string;
21
- event_data: ErrorEvent;
22
- metadata: Record<string, any>;
23
- event_type: EventType;
24
- user_id?: string | number | null;
25
- }
26
-
27
- export class ErrorTrackingService {
28
- private static instance: ErrorTrackingService;
29
- private apiKey: string = "";
30
- private userId: string | number | null | undefined = null;
31
- private preInitQueue: Array<{
32
- error: Error | string;
33
- componentName?: string | null | undefined;
34
- additionalInfo?: Record<string, any>;
35
- }> = [];
36
- private isInitialized = false;
37
-
38
- private constructor() {}
39
-
40
- static getInstance(): ErrorTrackingService {
41
- if (!ErrorTrackingService.instance) {
42
- ErrorTrackingService.instance = new ErrorTrackingService();
43
- }
44
- return ErrorTrackingService.instance;
45
- }
46
-
47
- initialize(apiKey: string, userId: string | number | null = null) {
48
- try {
49
- // Handle pre-init errors
50
- if (this.preInitQueue.length > 0) {
51
- const payload: LogPayload = {
52
- org_id: "UNINITALIZED",
53
- event_data: {
54
- message: `SDK Initialization Failed: Required parameter 'api_key' is ${
55
- apiKey === undefined
56
- ? "undefined"
57
- : apiKey === null
58
- ? "null"
59
- : apiKey === ""
60
- ? "empty string"
61
- : `invalid: ${apiKey}`
62
- }`,
63
- componentName: "ErrorTrackingService",
64
- additionalInfo: {
65
- preInitError: true,
66
- apiKey,
67
- userId,
68
- timestamp: Date.now(),
69
- },
70
- timestamp: Date.now(),
71
- },
72
- metadata: getSystemInfo({ os: Platform.OS, browser: "React Native" }),
73
- event_type: EventType.ERROR,
74
- user_id: userId,
75
- };
76
-
77
- this.sendLog(payload).catch((error) =>
78
- logger.error("Send log error:", error)
79
- );
80
- }
81
-
82
- this.apiKey = apiKey;
83
- this.userId = userId;
84
- this.isInitialized = true;
85
-
86
- this.processPreInitQueue();
87
- } catch (error) {
88
- logger.error("Error during ErrorTrackingService initialization:", error);
89
- this.preInitQueue.push({
90
- error: error instanceof Error ? error : new Error(String(error)),
91
- componentName: "ErrorTrackingService",
92
- additionalInfo: { apiKey, userId },
93
- });
94
- }
95
- }
96
-
97
- private async processPreInitQueue() {
98
- if (!this.preInitQueue.length) return;
99
-
100
- logger.info(
101
- `Processing ${this.preInitQueue.length} pre-initialization errors`
102
- );
103
-
104
- for (const item of this.preInitQueue) {
105
- await this.trackError(item.error, item.componentName, {
106
- ...item.additionalInfo,
107
- preInitError: true,
108
- });
109
- }
110
-
111
- this.preInitQueue = [];
112
- }
113
-
114
- private async sendLog(payload: LogPayload): Promise<void> {
115
- try {
116
- logger.debug("Sending error log:", payload);
117
- const response = await fetch(`${API_URL}/users/sdk/record-logs/`, {
118
- method: "POST",
119
- headers: {
120
- "Content-Type": "application/json",
121
- },
122
- body: JSON.stringify(payload),
123
- });
124
-
125
- if (!response.ok) {
126
- logger.error("Failed to send error log:", await response.text());
127
- }
128
- } catch (error) {
129
- logger.error("Error sending log:", error);
130
- }
131
- }
132
-
133
- async trackError(
134
- error: Error | string,
135
- componentName: string | null | undefined,
136
- additionalInfo?: Record<string, any>
137
- ) {
138
- if (!this.isInitialized) {
139
- const payload: LogPayload = {
140
- org_id: "UNINITALIZED",
141
- event_data: {
142
- message: error instanceof Error ? error.message : error,
143
- stack: error instanceof Error ? error.stack : undefined,
144
- componentName,
145
- additionalInfo: {
146
- ...additionalInfo,
147
- preInitError: true,
148
- timestamp: Date.now(),
149
- },
150
- timestamp: Date.now(),
151
- },
152
- metadata: getSystemInfo({ os: Platform.OS, browser: "React Native" }),
153
- event_type: EventType.ERROR,
154
- user_id: this.userId,
155
- };
156
-
157
- try {
158
- await this.sendLog(payload);
159
- } catch (sendError) {
160
- this.preInitQueue.push({ error, componentName, additionalInfo });
161
- logger.warn("Error tracked before initialization, queuing:", error);
162
- }
163
- return;
164
- }
165
-
166
- const errorEvent: ErrorEvent = {
167
- message: error instanceof Error ? error.message : error,
168
- stack: error instanceof Error ? error.stack : undefined,
169
- componentName,
170
- additionalInfo: {
171
- ...additionalInfo,
172
- timestamp: Date.now(),
173
- },
174
- timestamp: Date.now(),
175
- };
176
-
177
- const payload: LogPayload = {
178
- org_id: this.apiKey || "UNINITALIZED",
179
- event_data: errorEvent,
180
- metadata: getSystemInfo({ os: Platform.OS, browser: "React Native" }),
181
- event_type: EventType.ERROR,
182
- user_id: this.userId,
183
- };
184
-
185
- await this.sendLog(payload);
186
- }
187
-
188
- async trackInfo(
189
- message: string,
190
- componentName: string | null | undefined,
191
- additionalInfo?: Record<string, any>
192
- ) {
193
- if (!this.apiKey) {
194
- logger.error("Error tracking not initialized");
195
- return;
196
- }
197
-
198
- const infoEvent: ErrorEvent = {
199
- message,
200
- componentName,
201
- additionalInfo,
202
- timestamp: Date.now(),
203
- };
204
-
205
- const payload: LogPayload = {
206
- org_id: this.apiKey,
207
- event_data: infoEvent,
208
- metadata: getSystemInfo({ os: Platform.OS, browser: "React Native" }),
209
- event_type: EventType.INFO,
210
- user_id: this.userId,
211
- };
212
-
213
- await this.sendLog(payload);
214
- }
215
- }
216
-
217
- export const errorTracker = ErrorTrackingService.getInstance();
@@ -1,25 +0,0 @@
1
- export enum ChatbotEventType {
2
- CHATBOT_BUTTON_LOADED = "CHATBOT_BUTTON_LOADED",
3
- CHATBOT_BUTTON_CLICKED = "CHATBOT_BUTTON_CLICKED",
4
- CHATBOT_OPENED = "CHATBOT_OPENED",
5
- CHATBOT_CLOSED = "CHATBOT_CLOSED",
6
- CHATBOT_APP_READY = "CHATBOT_APP_READY",
7
- CHATBOT_LOADED = "CHATBOT_LOADED",
8
- CHAT_INITIALIZED = "CHAT_INITIALIZED",
9
- SESSION_REFRESHED = "SESSION_REFRESHED",
10
- CHAT_INITIALIZATION_FAILED = "CHAT_INITIALIZATION_FAILED",
11
- }
12
-
13
- export enum InternalEventType {
14
- CHAT_MOVED = "CHAT_MOVED",
15
- }
16
-
17
- export type AllEventTypes = ChatbotEventType | InternalEventType;
18
-
19
- export interface ChatbotEvent {
20
- type: ChatbotEventType;
21
- timestamp: number;
22
- data?: any;
23
- }
24
-
25
- export type ChatbotEventHandler = (event: ChatbotEvent) => void;
@@ -1,3 +0,0 @@
1
- declare module "react-native-flipper-performance-plugin" {
2
- export function addPlugin(): void;
3
- }
@@ -1,10 +0,0 @@
1
- declare global {
2
- interface Global {
3
- ErrorUtils: {
4
- setGlobalHandler(callback: (error: Error) => void): void;
5
- getGlobalHandler(): (error: Error, isFatal?: boolean) => void;
6
- };
7
- }
8
- }
9
-
10
- export {};
@@ -1,7 +0,0 @@
1
- export const generateUUID = () => {
2
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
3
- const r = (Math.random() * 16) | 0,
4
- v = c === "x" ? r : (r & 0x3) | 0x8;
5
- return v.toString(16);
6
- });
7
- };