@robylon/react-native-sdk 2.0.16-staging.3 → 2.0.17

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 (41) hide show
  1. package/README.md +113 -110
  2. package/lib/commonjs/Chatbotsdk.js.map +1 -1
  3. package/lib/commonjs/config.js +1 -1
  4. package/lib/commonjs/config.js.map +1 -1
  5. package/lib/commonjs/constants.js +1 -1
  6. package/lib/commonjs/constants.js.map +1 -1
  7. package/lib/module/Chatbotsdk.js.map +1 -1
  8. package/lib/module/config.js +1 -1
  9. package/lib/module/config.js.map +1 -1
  10. package/lib/module/constants.js +1 -1
  11. package/lib/module/constants.js.map +1 -1
  12. package/lib/typescript/Chatbotsdk.d.ts +5 -1
  13. package/lib/typescript/Chatbotsdk.d.ts.map +1 -1
  14. package/package.json +1 -1
  15. package/src/ChatbotWebview.tsx +0 -44
  16. package/src/Chatbotsdk.tsx +0 -674
  17. package/src/FloatingButton.tsx +0 -74
  18. package/src/LoadingIndicator.tsx +0 -11
  19. package/src/Toast.tsx +0 -65
  20. package/src/components/DebugButton.tsx +0 -46
  21. package/src/components/ErrorBoundary.tsx +0 -38
  22. package/src/config.ts +0 -4
  23. package/src/constants/errorConstants.ts +0 -21
  24. package/src/constants.ts +0 -4
  25. package/src/global.d.ts +0 -11
  26. package/src/hooks/useChatbotEvents.ts +0 -93
  27. package/src/index.tsx +0 -10
  28. package/src/openChatbot.ts +0 -11
  29. package/src/openChatbot.tsx +0 -0
  30. package/src/services/ErrorTrackingService.ts +0 -217
  31. package/src/types/events.ts +0 -25
  32. package/src/types/react-native-flipper-performance-plugin.d.ts +0 -3
  33. package/src/types/react-native-globals.d.ts +0 -10
  34. package/src/utils/cookieUtils.ts +0 -7
  35. package/src/utils/debugConfig.ts +0 -56
  36. package/src/utils/debugMenu.ts +0 -14
  37. package/src/utils/errorHandler.ts +0 -58
  38. package/src/utils/logger.ts +0 -14
  39. package/src/utils/systemInfo.ts +0 -84
  40. package/src/utils/webViewStorage.ts +0 -62
  41. package/src/version.ts +0 -2
@@ -1,44 +0,0 @@
1
- // File: src/ChatbotWebview.tsx
2
- import React, { useEffect, useState } from "react";
3
- import { View } from "react-native";
4
- import { WebView } from "react-native-webview";
5
- import { BASE_CHATBOT_URL } from "./constants";
6
- import LoadingIndicator from "./LoadingIndicator";
7
-
8
- interface ChatbotWebviewProps {
9
- chatbotId: string;
10
- additionalParams?: Record<string, string>;
11
- }
12
-
13
- const constructUrl = (
14
- chatbotId: string,
15
- additionalParams: Record<string, string> = {}
16
- ): string => {
17
- const params = new URLSearchParams({ id: chatbotId, ...additionalParams });
18
- return `${BASE_CHATBOT_URL}?${params.toString()}`;
19
- };
20
-
21
- export const ChatbotWebview: React.FC<ChatbotWebviewProps> = ({
22
- chatbotId,
23
- additionalParams,
24
- }) => {
25
- const [url, setUrl] = useState<string>("");
26
-
27
- useEffect(() => {
28
- setUrl(constructUrl(chatbotId, additionalParams));
29
- }, [chatbotId, additionalParams]);
30
-
31
- return (
32
- <View style={{ flex: 1 }}>
33
- {url ? (
34
- <WebView
35
- source={{ uri: url }}
36
- startInLoadingState={true}
37
- renderLoading={() => <LoadingIndicator />}
38
- />
39
- ) : (
40
- <LoadingIndicator />
41
- )}
42
- </View>
43
- );
44
- };
@@ -1,674 +0,0 @@
1
- import React, {
2
- useState,
3
- useEffect,
4
- useRef,
5
- useMemo,
6
- useCallback,
7
- } from "react";
8
- import {
9
- View,
10
- StyleSheet,
11
- Animated,
12
- Dimensions,
13
- Platform,
14
- StatusBar,
15
- PixelRatio,
16
- } from "react-native";
17
- import { WebView, WebViewMessageEvent } from "react-native-webview";
18
- import FloatingButton from "./FloatingButton";
19
- import { API_URL, BASE_CHATBOT_URL } from "./constants";
20
- import { SDK_VERSION } from "./version";
21
- import { getSystemInfo, getBrowserAndOSInfoScript } from "./utils/systemInfo";
22
- import { useChatbotEvents } from "./hooks/useChatbotEvents";
23
- import { ChatbotEventType, ChatbotEventHandler } from "./types/events";
24
- import { logger } from "./utils/logger";
25
- import { enableNetworkDebug, enableWebViewDebug } from "./utils/debugConfig";
26
- import DebugButton from "./components/DebugButton";
27
- import { ErrorBoundary } from "./components/ErrorBoundary";
28
- import {
29
- ErrorCodes,
30
- ErrorTypes,
31
- ErrorMessages,
32
- } from "./constants/errorConstants";
33
- import { setupGlobalErrorHandlers } from "./utils/errorHandler";
34
- import { errorTracker } from "./services/ErrorTrackingService";
35
- import { generateUUID } from "./utils/cookieUtils";
36
- import {
37
- StorageMessageType,
38
- StorageMessage,
39
- getStorageScript,
40
- createStorageMessage,
41
- } from "./utils/webViewStorage";
42
-
43
- export interface ChatbotProps {
44
- api_key: string;
45
- user_id?: string | null | number;
46
- user_token?: string;
47
- user_profile?: Record<string, any>;
48
- onEvent?: ChatbotEventHandler;
49
- }
50
-
51
- interface InternalChatbotProps extends ChatbotProps {
52
- show_floating_button?: boolean;
53
- onMessage?: (message: any) => void;
54
- isFullScreen?: boolean;
55
- enableAnimation?: boolean;
56
- onOpen?: () => void;
57
- onClose?: () => void;
58
- }
59
-
60
- interface ChatbotMessage {
61
- type: string;
62
- data?: any;
63
- level?: string;
64
- }
65
-
66
- interface ChatbotConfig {
67
- brand_color: string;
68
- image_url: string;
69
- welcome_message: string;
70
- }
71
-
72
- const Chatbot: React.FC<InternalChatbotProps> = ({
73
- api_key,
74
- user_id,
75
- user_token,
76
- show_floating_button = true,
77
- onEvent,
78
- onMessage,
79
- isFullScreen = true,
80
- enableAnimation = true,
81
- onOpen,
82
- onClose,
83
- user_profile,
84
- }) => {
85
- const [isWebViewVisible, setIsWebViewVisible] = useState(false);
86
- const [chatbotConfig, setChatbotConfig] = useState<ChatbotConfig | null>(
87
- null
88
- );
89
- const [loading, setLoading] = useState(true);
90
- const webViewRef = useRef<WebView>(null);
91
- const fadeAnim = useRef(new Animated.Value(0)).current;
92
- const isFirstLoadRef = useRef(true);
93
- const [toastVisible, setToastVisible] = useState(false);
94
- const [toastMessage, setToastMessage] = useState("");
95
- const [effectiveUserId, setEffectiveUserId] = useState<string>();
96
- const [isStorageReady, setIsStorageReady] = useState(false);
97
- const pendingStorageOps = useRef<Array<() => void>>([]);
98
- const memoryCache = useRef<Record<string, string>>({});
99
-
100
- const [systemInfo, setSystemInfo] = useState({ os: "", browser: "" });
101
-
102
- // Create chatbotConfig object for events
103
- const chatbotConfigForEvents = useMemo(
104
- () => ({
105
- userId: effectiveUserId,
106
- isAnonymous: !user_id && user_id !== 0,
107
- // Add other config properties as needed
108
- }),
109
- [effectiveUserId, user_id]
110
- );
111
-
112
- // Initialize event handling
113
- const { emitEvent, onInternalEvent } = useChatbotEvents({
114
- api_key,
115
- chatbotConfig: chatbotConfigForEvents ?? {},
116
- user_profile: user_profile,
117
- onEvent: onEvent,
118
- systemInfo: systemInfo ?? { os: "", browser: "" },
119
- });
120
-
121
- const triggerAppInit = () => {
122
- if (webViewRef.current) {
123
- webViewRef.current.injectJavaScript(`
124
- // Trigger APP_READY equivalent
125
- window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'APP_READY' }));
126
- true;
127
- `);
128
- }
129
- };
130
-
131
- const executeStorageOp = useCallback(
132
- (operation: () => void) => {
133
- if (isStorageReady) {
134
- operation();
135
- } else {
136
- pendingStorageOps.current.push(operation);
137
- }
138
- },
139
- [isStorageReady]
140
- );
141
-
142
- // Handle WebView messages
143
- const handleMessage = useCallback(
144
- (event: WebViewMessageEvent) => {
145
- const { data } = event.nativeEvent;
146
-
147
- try {
148
- const parsedData: ChatbotMessage = JSON.parse(data);
149
-
150
- // Handle storage messages
151
- if (
152
- Object.values(StorageMessageType).includes(
153
- parsedData.type as StorageMessageType
154
- )
155
- ) {
156
- const storageMessage = parsedData as StorageMessage;
157
- switch (storageMessage.type) {
158
- case StorageMessageType.STORAGE_READY:
159
- setIsStorageReady(true);
160
- pendingStorageOps.current.forEach((op) => op());
161
- pendingStorageOps.current = [];
162
- // Try to get stored ID immediately after storage is ready
163
- webViewRef.current?.injectJavaScript(
164
- createStorageMessage(
165
- StorageMessageType.GET_STORAGE,
166
- "rblyn_anon"
167
- )
168
- );
169
- break;
170
- case StorageMessageType.STORAGE_RESPONSE:
171
- if (storageMessage.key && storageMessage.value) {
172
- memoryCache.current[storageMessage.key] = storageMessage.value;
173
- if (storageMessage.key === "rblyn_anon") {
174
- setEffectiveUserId(storageMessage.value);
175
- }
176
- }
177
- break;
178
- case StorageMessageType.STORAGE_ERROR:
179
- logger.error("WebView storage error:", storageMessage.error);
180
- break;
181
- }
182
- return;
183
- }
184
-
185
- // Add debug logging
186
- if (__DEV__) {
187
- if (parsedData?.type === "CONSOLE") {
188
- console.log(`WebView ${parsedData?.level}:`, parsedData?.data);
189
- return;
190
- }
191
- if (parsedData?.type === "ERROR") {
192
- console.error("WebView Error:", parsedData?.data);
193
- return;
194
- }
195
- }
196
-
197
- if (parsedData?.type === "SYSTEM_INFO") {
198
- setSystemInfo(parsedData?.data ?? { os: "", browser: "" });
199
- return;
200
- }
201
-
202
- if (parsedData?.type === "APP_READY") {
203
- emitEvent(ChatbotEventType.CHATBOT_APP_READY);
204
- if (webViewRef.current && isWebViewVisible) {
205
- webViewRef.current?.injectJavaScript(getBrowserAndOSInfoScript());
206
-
207
- const messageData = {
208
- name: "registerUserId",
209
- action: "registerUserId",
210
- data: {
211
- userId: effectiveUserId,
212
- token: user_token ? `${user_token}` : undefined,
213
- userProfile: {
214
- ...user_profile,
215
- ...getSystemInfo(systemInfo),
216
- },
217
- },
218
- };
219
- logger.debug("messageData====>", JSON.stringify(messageData));
220
- webViewRef.current?.injectJavaScript(`
221
- window.postMessage(${JSON.stringify({
222
- name: "openFrame",
223
- domain: "app-domain.com",
224
- })}, '*');
225
- window.postMessage(${JSON.stringify(messageData)}, '*');
226
- `);
227
- }
228
- }
229
-
230
- // Handle other message types
231
- switch (parsedData?.type) {
232
- case "close_chatbot":
233
- closeWebView();
234
- break;
235
- case "CHATBOT_LOADED":
236
- emitEvent(ChatbotEventType.CHATBOT_LOADED, parsedData?.data);
237
- break;
238
- case "CHAT_INITIALIZED":
239
- emitEvent(ChatbotEventType.CHAT_INITIALIZED, parsedData?.data);
240
- break;
241
- case "SESSION_REFRESHED":
242
- emitEvent(ChatbotEventType.SESSION_REFRESHED, parsedData?.data);
243
- break;
244
- case "CHAT_INITIALIZATION_FAILED":
245
- emitEvent(
246
- ChatbotEventType.CHAT_INITIALIZATION_FAILED,
247
- parsedData?.data
248
- );
249
- break;
250
- default:
251
- if (onMessage) onMessage(parsedData ?? {});
252
- }
253
- } catch (error) {
254
- errorTracker.trackError(
255
- error instanceof Error
256
- ? error
257
- : new Error("Failed to parse WebView message"),
258
- "ChatbotSDK",
259
- {
260
- type: ErrorTypes.RUNTIME_ERROR,
261
- context: { messageData: data },
262
- }
263
- );
264
- }
265
- },
266
- [
267
- emitEvent,
268
- isWebViewVisible,
269
- onMessage,
270
- systemInfo,
271
- effectiveUserId,
272
- user_token,
273
- user_profile,
274
- ]
275
- );
276
-
277
- // Initialize user ID
278
- useEffect(() => {
279
- const initializeUserId = async () => {
280
- let userId = user_id ? String(user_id) : undefined;
281
-
282
- if (!userId) {
283
- // Try memory cache first
284
- userId = memoryCache.current["rblyn_anon"];
285
-
286
- if (!userId) {
287
- userId = generateUUID();
288
- executeStorageOp(() => {
289
- webViewRef.current?.injectJavaScript(
290
- createStorageMessage(
291
- StorageMessageType.SET_STORAGE,
292
- "rblyn_anon",
293
- userId!
294
- )
295
- );
296
- });
297
- }
298
- }
299
-
300
- setEffectiveUserId(userId);
301
- };
302
-
303
- initializeUserId();
304
- }, [user_id, executeStorageOp]);
305
-
306
- // Initialize WebView storage
307
- useEffect(() => {
308
- if (webViewRef.current) {
309
- webViewRef.current.injectJavaScript(getStorageScript());
310
- // Try to get stored ID once storage is ready
311
- executeStorageOp(() => {
312
- webViewRef.current?.injectJavaScript(
313
- createStorageMessage(StorageMessageType.GET_STORAGE, "rblyn_anon")
314
- );
315
- });
316
- }
317
- }, []);
318
-
319
- useEffect(() => {
320
- const fetchChatbotConfig = async () => {
321
- try {
322
- const endpointUrl = `${API_URL}/chat/chatbot/get/`;
323
- const payload = {
324
- client_user_id: effectiveUserId,
325
- org_id: api_key,
326
- token: user_token,
327
- extra_info: {},
328
- };
329
-
330
- // setToastMessage(endpointUrl + " : " + BASE_CHATBOT_URL);
331
- // setToastVisible(true);
332
-
333
- const response = await fetch(endpointUrl, {
334
- method: "POST",
335
- headers: {
336
- "Content-Type": "application/json",
337
- },
338
- body: JSON.stringify(payload),
339
- });
340
-
341
- if (!response.ok) {
342
- throw new Error("Failed to fetch chatbot configuration");
343
- }
344
-
345
- const data = await response.json();
346
- const orgInfo = data?.user?.org_info;
347
-
348
- if (orgInfo) {
349
- setChatbotConfig({
350
- brand_color: orgInfo?.config?.brand_colour || "#007AFF",
351
- image_url: orgInfo?.brand_config?.launcher_logo_url || "",
352
- welcome_message: orgInfo?.config?.welcome_message || "",
353
- });
354
- }
355
- } catch (error) {
356
- errorTracker.trackError(
357
- error instanceof Error
358
- ? error
359
- : new Error("Failed to fetch chatbot configuration"),
360
- "ChatbotSDK",
361
- {
362
- type: ErrorTypes.NETWORK_ERROR,
363
- context: { api_key, user_id },
364
- }
365
- );
366
- } finally {
367
- setLoading(false);
368
- }
369
- };
370
-
371
- if (api_key && effectiveUserId) {
372
- fetchChatbotConfig();
373
- }
374
- }, [api_key, effectiveUserId, user_token]);
375
-
376
- function constructUrl(): string {
377
- if (!effectiveUserId) return "";
378
- const params = new URLSearchParams({
379
- id: api_key,
380
- });
381
- console.log("BASE_CHATBOT_URL SDK_VERSION", BASE_CHATBOT_URL, SDK_VERSION);
382
- return `${BASE_CHATBOT_URL}?${params.toString()}`;
383
- }
384
-
385
- // Handle opening the chatbot
386
- const openWebView = useCallback(() => {
387
- setIsWebViewVisible(true);
388
- if (enableAnimation) {
389
- Animated.timing(fadeAnim, {
390
- toValue: 1,
391
- duration: 250,
392
- useNativeDriver: true,
393
- }).start(() => {
394
- onOpen?.();
395
- emitEvent(ChatbotEventType.CHATBOT_OPENED);
396
- if (!isFirstLoadRef.current) {
397
- setTimeout(triggerAppInit, 100);
398
- }
399
- });
400
- } else {
401
- fadeAnim.setValue(1);
402
- requestAnimationFrame(() => {
403
- onOpen?.();
404
- emitEvent(ChatbotEventType.CHATBOT_OPENED);
405
- if (!isFirstLoadRef.current) {
406
- setTimeout(triggerAppInit, 100);
407
- }
408
- });
409
- }
410
- }, [enableAnimation, fadeAnim, onOpen, emitEvent]);
411
-
412
- // Handle closing the chatbot
413
- const closeWebView = useCallback(() => {
414
- if (webViewRef.current) {
415
- webViewRef.current.postMessage(
416
- JSON.stringify({
417
- name: "closeFrame",
418
- domain: "app-domain.com",
419
- })
420
- );
421
- }
422
-
423
- const complete = () => {
424
- setIsWebViewVisible(false);
425
- onClose?.();
426
- emitEvent(ChatbotEventType.CHATBOT_CLOSED);
427
- };
428
-
429
- if (enableAnimation) {
430
- Animated.timing(fadeAnim, {
431
- toValue: 0,
432
- duration: 200,
433
- useNativeDriver: true,
434
- }).start(complete);
435
- } else {
436
- fadeAnim.setValue(0);
437
- requestAnimationFrame(complete);
438
- }
439
- }, [enableAnimation, fadeAnim, onClose, emitEvent]);
440
-
441
- // Emit button loaded event when component mounts
442
- useEffect(() => {
443
- if (show_floating_button && chatbotConfig) {
444
- emitEvent(ChatbotEventType.CHATBOT_BUTTON_LOADED);
445
- }
446
- }, [show_floating_button, chatbotConfig, emitEvent]);
447
-
448
- const getScreenDimensions = () => {
449
- const windowHeight = Dimensions.get("window").height;
450
- const windowWidth = Dimensions.get("window").width;
451
- const statusBarHeight =
452
- Platform.OS === "ios" ? 0 : StatusBar.currentHeight || 0;
453
-
454
- return {
455
- height: windowHeight - statusBarHeight,
456
- width: windowWidth,
457
- };
458
- };
459
-
460
- const screenDimensions = getScreenDimensions();
461
-
462
- useEffect(() => {
463
- if (__DEV__) {
464
- enableNetworkDebug();
465
- }
466
- }, []);
467
-
468
- // Deliberate error for testing error boundary
469
- // useEffect(() => {
470
- // if (__DEV__) {
471
- // // Set up global error handlers
472
- // setupGlobalErrorHandlers();
473
-
474
- // // Test async error
475
- // setTimeout(() => {
476
- // Promise.reject(new Error("Test async error"));
477
- // }, 1000);
478
-
479
- // // Test sync error
480
- // setTimeout(() => {
481
- // throw new Error("Test sync error");
482
- // }, 2000);
483
- // }
484
- // }, []);
485
-
486
- return (
487
- <ErrorBoundary componentName="ChatbotSDK">
488
- <View style={styles.mainContainer}>
489
- {!loading && (
490
- <>
491
- <ErrorBoundary componentName="FloatingButton">
492
- {show_floating_button && api_key && chatbotConfig && (
493
- <FloatingButton
494
- onPress={() => {
495
- emitEvent(ChatbotEventType.CHATBOT_BUTTON_CLICKED);
496
- openWebView();
497
- }}
498
- brandColor={chatbotConfig.brand_color}
499
- imageUrl={chatbotConfig.image_url}
500
- />
501
- )}
502
- </ErrorBoundary>
503
- <View
504
- style={[
505
- styles.webViewWrapper,
506
- { height: isWebViewVisible ? "100%" : 0 },
507
- ]}
508
- pointerEvents={isWebViewVisible ? "auto" : "none"}
509
- >
510
- <Animated.View
511
- style={[styles.fullScreenContainer, { opacity: fadeAnim }]}
512
- >
513
- <ErrorBoundary componentName="ChatbotWebView">
514
- <WebView
515
- ref={webViewRef}
516
- source={{ uri: constructUrl() }}
517
- onMessage={handleMessage}
518
- style={styles.webview}
519
- containerStyle={
520
- isFullScreen
521
- ? {
522
- width: screenDimensions.width,
523
- height: screenDimensions.height,
524
- }
525
- : undefined
526
- }
527
- allowsInlineMediaPlayback={true}
528
- mediaPlaybackRequiresUserAction={false}
529
- allowFileAccess={false}
530
- geolocationEnabled={false}
531
- javaScriptEnabled={true}
532
- domStorageEnabled={true}
533
- cacheEnabled={true}
534
- scrollEnabled={true}
535
- bounces={false}
536
- onShouldStartLoadWithRequest={(request) => {
537
- return request.url.startsWith(BASE_CHATBOT_URL);
538
- }}
539
- startInLoadingState={isFirstLoadRef.current}
540
- onLoadEnd={() => {
541
- if (__DEV__) {
542
- enableWebViewDebug(webViewRef);
543
- }
544
- webViewRef.current?.injectJavaScript(`
545
- if (!document.querySelector('meta[name="viewport"]')) {
546
- var meta = document.createElement('meta');
547
- meta.name = 'viewport';
548
- meta.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no';
549
- document.getElementsByTagName('head')[0].appendChild(meta);
550
- }
551
-
552
- if (!document.querySelector('#injectedStyle')) {
553
- const style = document.createElement('style');
554
- style.id = 'injectedStyle';
555
- style.textContent = \`
556
- html, body, #root, #__next {
557
- height: 100% !important;
558
- min-height: 100% !important;
559
- overflow: hidden !important;
560
- }
561
- \`;
562
- document.head.appendChild(style);
563
- }
564
-
565
- window.sendToChatbot = function(message) {
566
- window.ReactNativeWebView.postMessage(JSON.stringify(message));
567
- };
568
-
569
- // Only create observer if it doesn't exist
570
- if (!window.closeButtonObserver) {
571
- // Setup mutation observer to watch for close button
572
- window.closeButtonObserver = new MutationObserver(function(mutations) {
573
- const closeButton = document.querySelector('.chatbot-close-button');
574
- if (closeButton && !closeButton.hasAttribute('listener-attached')) {
575
- closeButton.setAttribute('listener-attached', 'true');
576
- closeButton.addEventListener('click', () => {
577
- try {
578
- const message = { type: 'close_chatbot' };
579
- window.ReactNativeWebView.postMessage(JSON.stringify(message));
580
- } catch (error) {
581
- console.error('Error sending close message:', error);
582
- }
583
- });
584
- console.log('Close button listener attached');
585
- }
586
- });
587
-
588
- // Start observing
589
- window.closeButtonObserver.observe(document.body, {
590
- childList: true,
591
- subtree: true
592
- });
593
-
594
- // Initial check for existing button
595
- const existingButton = document.querySelector('.chatbot-close-button');
596
- if (existingButton && !existingButton.hasAttribute('listener-attached')) {
597
- existingButton.setAttribute('listener-attached', 'true');
598
- existingButton.addEventListener('click', () => {
599
- try {
600
- const message = { type: 'close_chatbot' };
601
- window.ReactNativeWebView.postMessage(JSON.stringify(message));
602
- } catch (error) {
603
- console.error('Error sending close message:', error);
604
- }
605
- });
606
- console.log('Close button listener attached to existing button');
607
- }
608
- }
609
-
610
- true;
611
- `);
612
- isFirstLoadRef.current = false;
613
- }}
614
- onError={(syntheticEvent) => {
615
- const { nativeEvent } = syntheticEvent;
616
- errorTracker.trackError(
617
- new Error(nativeEvent.description),
618
- "ChatbotWebView",
619
- {
620
- type: ErrorTypes.RUNTIME_ERROR,
621
- context: {
622
- url: nativeEvent.url,
623
- code: nativeEvent.code,
624
- },
625
- }
626
- );
627
- }}
628
- />
629
- </ErrorBoundary>
630
- </Animated.View>
631
- </View>
632
- </>
633
- )}
634
- {/* <Toast message={toastMessage} visible={toastVisible} duration={10000} /> */}
635
- {__DEV__ && <DebugButton />}
636
- </View>
637
- </ErrorBoundary>
638
- );
639
- };
640
-
641
- const styles = StyleSheet.create({
642
- mainContainer: {
643
- flex: 1,
644
- position: "relative",
645
- },
646
- webViewWrapper: {
647
- position: "absolute",
648
- top: 0,
649
- left: 0,
650
- right: 0,
651
- bottom: 0,
652
- overflow: "hidden",
653
- zIndex: 1000,
654
- },
655
- fullScreenContainer: {
656
- position: "absolute",
657
- top: 0,
658
- left: 0,
659
- right: 0,
660
- bottom: 0,
661
- backgroundColor: "white",
662
- zIndex: 1000,
663
- },
664
- inlineContainer: {
665
- flex: 1,
666
- backgroundColor: "white",
667
- },
668
- webview: {
669
- flex: 1,
670
- backgroundColor: "white",
671
- },
672
- });
673
-
674
- export default Chatbot;