react-native-visit-rn-sdk 5.0.2 → 6.0.1

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 (139) hide show
  1. package/README.md +25 -4
  2. package/ios/VisitRnSdkViewManager.h +1 -19
  3. package/ios/VisitRnSdkViewManager.m +8 -1294
  4. package/lib/commonjs/components/VideoCallComponent.js +59 -73
  5. package/lib/commonjs/components/VideoCallComponent.js.map +1 -1
  6. package/lib/commonjs/index.android.js +31 -352
  7. package/lib/commonjs/index.android.js.map +1 -1
  8. package/lib/commonjs/index.ios.js +14 -222
  9. package/lib/commonjs/index.ios.js.map +1 -1
  10. package/lib/module/components/VideoCallComponent.js +57 -69
  11. package/lib/module/components/VideoCallComponent.js.map +1 -1
  12. package/lib/module/index.android.js +28 -344
  13. package/lib/module/index.android.js.map +1 -1
  14. package/lib/module/index.ios.js +13 -219
  15. package/lib/module/index.ios.js.map +1 -1
  16. package/package.json +3 -5
  17. package/src/index.android.js +30 -513
  18. package/src/index.ios.js +30 -317
  19. package/android/bin/build/generated/source/buildConfig/debug/com/visitrnsdk/BuildConfig.class +0 -0
  20. package/android/bin/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -7
  21. package/android/bin/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +0 -18
  22. package/android/bin/build/intermediates/aar_main_jar/debug/classes.jar +0 -0
  23. package/android/bin/build/intermediates/aar_metadata/debug/aar-metadata.properties +0 -5
  24. package/android/bin/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
  25. package/android/bin/build/intermediates/annotations_typedef_file/debug/typedefs.txt +0 -0
  26. package/android/bin/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  27. package/android/bin/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  28. package/android/bin/build/intermediates/compile_symbol_list/debug/R.txt +0 -1954
  29. package/android/bin/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -1
  30. package/android/bin/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
  31. package/android/bin/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
  32. package/android/bin/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
  33. package/android/bin/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
  34. package/android/bin/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
  35. package/android/bin/build/intermediates/library_java_res/debug/res.jar +0 -0
  36. package/android/bin/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -2
  37. package/android/bin/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -8
  38. package/android/bin/build/intermediates/merged_java_res/debug/feature-react-native-visit-rn-sdk.jar +0 -0
  39. package/android/bin/build/intermediates/merged_manifest/debug/AndroidManifest.xml +0 -7
  40. package/android/bin/build/intermediates/navigation_json/debug/navigation.json +0 -1
  41. package/android/bin/build/intermediates/packaged_manifests/debug/output-metadata.json +0 -18
  42. package/android/bin/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  43. package/android/bin/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -1447
  44. package/android/bin/build/intermediates/variant_model/debug/variant_model.json +0 -0
  45. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  46. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  47. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  48. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
  49. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  50. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
  51. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  52. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  53. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  54. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  55. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  56. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  57. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  58. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  59. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  60. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  61. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  62. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  63. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  64. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  65. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  66. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  67. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  68. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  69. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  70. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  71. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  72. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  73. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  74. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  75. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  76. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  77. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  78. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  79. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  80. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  81. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  82. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  83. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  84. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  85. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  86. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  87. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  88. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  89. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  90. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  91. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  92. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  93. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  94. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  95. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  96. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  97. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  98. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  99. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  100. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  101. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +0 -2
  102. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  103. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  104. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  105. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
  106. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  107. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
  108. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  109. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  110. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  111. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  112. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  113. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  114. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  115. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  116. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  117. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  118. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  119. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  120. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  121. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  122. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
  123. package/android/bin/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  124. package/android/bin/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  125. package/android/bin/build/outputs/aar/react-native-visit-rn-sdk-debug.aar +0 -0
  126. package/android/bin/build/outputs/logs/manifest-merger-debug-report.txt +0 -25
  127. package/android/bin/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  128. package/android/bin/build/tmp/kotlin-classes/debug/META-INF/react-native-visit-rn-sdk_debug.kotlin_module +0 -0
  129. package/android/bin/local.properties +0 -8
  130. package/lib/commonjs/Services.js +0 -36
  131. package/lib/commonjs/Services.js.map +0 -1
  132. package/lib/commonjs/constants.js +0 -12
  133. package/lib/commonjs/constants.js.map +0 -1
  134. package/lib/module/Services.js +0 -27
  135. package/lib/module/Services.js.map +0 -1
  136. package/lib/module/constants.js +0 -5
  137. package/lib/module/constants.js.map +0 -1
  138. package/src/Services.js +0 -37
  139. package/src/constants.js +0 -4
package/src/index.ios.js CHANGED
@@ -1,33 +1,9 @@
1
- import React, {
2
- useRef,
3
- useEffect,
4
- useState,
5
- useCallback,
6
- useMemo,
7
- } from 'react';
8
- import {
9
- StyleSheet,
10
- SafeAreaView,
11
- NativeModules,
12
- NativeEventEmitter,
13
- Linking,
14
- Platform,
15
- ActivityIndicator,
16
- Dimensions,
17
- } from 'react-native';
1
+ import React, { useRef, useCallback } from 'react';
2
+ import { StyleSheet, SafeAreaView, Linking, Dimensions } from 'react-native';
18
3
  import { EventRegister } from 'react-native-event-listeners';
19
4
  import { WebView } from 'react-native-webview';
20
- import DeviceInfo from 'react-native-device-info';
21
- import { getWebViewLink, httpClient } from './Services';
22
- import constants from './constants';
23
5
  import VideoCallComponent from './components/VideoCallComponent';
24
6
 
25
- const LINKING_ERROR =
26
- `The package 'react-native-visit-rn-sdk' doesn't seem to be linked. Make sure: \n\n` +
27
- Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
28
- '- You rebuilt the app after installing the package\n' +
29
- '- You are not using Expo Go\n';
30
-
31
7
  const escapeChars = {
32
8
  lt: '<',
33
9
  gt: '>',
@@ -55,142 +31,13 @@ const unescapeHTML = (str) =>
55
31
 
56
32
  const visitEvent = 'visit-event';
57
33
 
58
- const VisitRnSdkView = ({
59
- cpsid,
60
- baseUrl,
61
- errorBaseUrl,
62
- token,
63
- moduleName,
64
- environment,
65
- magicLink,
66
- isLoggingEnabled,
67
- }) => {
68
- const [source, setSource] = useState('');
69
- const [loading, setLoading] = useState(true);
70
- useEffect(() => {
71
- if (magicLink?.trim()?.length) {
72
- setSource(magicLink);
73
- setLoading(false);
74
- } else {
75
- const systemVersion = DeviceInfo.getSystemVersion();
76
- const version = DeviceInfo.getVersion();
77
- DeviceInfo.getUniqueId()
78
- .then((uniqueId) =>
79
- getWebViewLink(
80
- baseUrl,
81
- token,
82
- cpsid,
83
- 'iPhone',
84
- uniqueId,
85
- version,
86
- systemVersion,
87
- environment
88
- )
89
- )
90
- .then((res) => {
91
- if (res.data?.errorMessage) {
92
- const { errorMessage } = res.data;
93
- const errorUrl = `${errorBaseUrl}/star-health?error=${errorMessage}`;
94
- setSource(errorUrl);
95
- if (res.data?.errorMessage === 'Please login again') {
96
- EventRegister.emitEvent(visitEvent, {
97
- message: 'unauthorized-wellness-access',
98
- errorMessage: errorMessage,
99
- });
100
- }
101
- if (res.data?.errorMessage.includes('External Server Error')) {
102
- EventRegister.emitEvent('visit-event', {
103
- message: 'external-server-error',
104
- errorMessage: errorMessage,
105
- });
106
- }
107
- } else if (res.data.message === 'success') {
108
- const magicCode = res.data?.magicCode;
109
- const responseReferenceId = res.data?.responseReferenceId;
110
- const otherValues = res.data?.otherValues;
111
-
112
- let finalBaseUrl = '';
113
- if (magicCode) {
114
- if (environment.toUpperCase() === 'PROD') {
115
- finalBaseUrl = constants.PROD_BASE_URL;
116
- } else {
117
- finalBaseUrl = constants.STAGE_BASE_URL;
118
- }
119
- }
120
- if (finalBaseUrl && magicCode) {
121
- let finalUrl = `${finalBaseUrl}=${magicCode}`;
122
- if (moduleName?.trim()) {
123
- finalUrl += `&tab=${moduleName}`;
124
- }
125
-
126
- if (
127
- typeof responseReferenceId === 'string' &&
128
- responseReferenceId.trim().length > 0
129
- ) {
130
- finalUrl += `&responseReferenceId=${responseReferenceId}`;
131
- }
132
-
133
- if (
134
- typeof otherValues === 'string' &&
135
- otherValues.trim().length > 0
136
- ) {
137
- finalUrl += `&otherValues=${otherValues}`;
138
- }
139
-
140
- setSource(finalUrl);
141
- }
142
- } else {
143
- EventRegister.emitEvent('visit-event', {
144
- message: 'generate-magic-link-failed',
145
- errorMessage: `${res.data}`,
146
- });
147
- }
148
- })
149
- .catch((err) => {
150
- console.log('getWebViewLink err', { err });
151
- EventRegister.emitEvent('visit-event', {
152
- message: 'generate-magic-link-failed',
153
- errorMessage: `${err}`,
154
- });
155
- })
156
- .finally(() => {
157
- setLoading(false);
158
- });
159
- }
160
- }, [
161
- cpsid,
162
- token,
163
- baseUrl,
164
- errorBaseUrl,
165
- moduleName,
166
- environment,
167
- magicLink,
168
- isLoggingEnabled,
169
- ]);
170
-
171
- const VisitRnSdkViewManager = useMemo(
172
- () =>
173
- NativeModules.VisitRnSdkViewManager
174
- ? NativeModules.VisitRnSdkViewManager
175
- : new Proxy(
176
- {},
177
- {
178
- get() {
179
- throw new Error(LINKING_ERROR);
180
- },
181
- }
182
- ),
183
- []
184
- );
34
+ const VisitRnSdkView = ({ ssoLink, isLoggingEnabled }) => {
35
+ const source = typeof ssoLink === 'string' ? ssoLink.trim() : '';
185
36
 
186
37
  const webviewRef = useRef(null);
187
38
  const videoCallRef = useRef(null);
188
- const [apiBaseUrl, setApiBaseUrl] = useState('');
189
- const [authToken, setAuthToken] = useState('');
190
- const [hasLoadedOnce, setHasLoadedOnce] = useState(false);
191
39
 
192
-
193
- const runBeforeFirst = `
40
+ const runBeforeFirst = `
194
41
  window.isNativeApp = true;
195
42
  window.platform = "IOS";
196
43
  window.setSdkPlatform('IOS');
@@ -206,15 +53,13 @@ const runBeforeFirst = `
206
53
  rawDoctorName && rawDoctorName.indexOf('Dr.') > -1
207
54
  ? rawDoctorName.replace('Dr. ', '')
208
55
  : rawDoctorName && rawDoctorName.indexOf('Dr') > -1
209
- ? rawDoctorName.replace('Dr ', '')
210
- : null;
56
+ ? rawDoctorName.replace('Dr ', '')
57
+ : null;
211
58
  const userName = payload?.userName;
212
59
 
213
60
  if (!roomName || !accessToken) {
214
61
  if (isLoggingEnabled) {
215
- console.warn(
216
- 'Video call payload missing roomName/accessToken.'
217
- );
62
+ console.warn('Video call payload missing roomName/accessToken.');
218
63
  }
219
64
  return;
220
65
  }
@@ -230,64 +75,9 @@ const runBeforeFirst = `
230
75
  [isLoggingEnabled]
231
76
  );
232
77
 
233
- const callSyncApi = useCallback(
234
- (data) =>
235
- httpClient
236
- .post(`${apiBaseUrl}/users/data-sync`, data, {
237
- headers: {
238
- Authorization: authToken,
239
- },
240
- })
241
- .then((res) => console.log('callSyncData response,', res))
242
- .catch((err) => console.log('callSyncData err,', { err })),
243
- [apiBaseUrl, authToken]
244
- );
245
-
246
- const callEmbellishApi = useCallback(
247
- (data) =>
248
- httpClient
249
- .post(`${apiBaseUrl}/users/embellish-sync`, data, {
250
- headers: {
251
- Authorization: authToken,
252
- },
253
- })
254
- .then((res) => console.log('callEmbellishApi response,', res))
255
- .catch((err) => console.log('callEmbellishApi err,', { err })),
256
- [apiBaseUrl, authToken]
257
- );
258
-
259
- useEffect(() => {
260
- const apiManagerEmitter = new NativeEventEmitter(VisitRnSdkViewManager);
261
- const subscription = apiManagerEmitter.addListener(
262
- 'EventReminder',
263
- (reminder) => {
264
- if (reminder?.callSyncData && reminder?.callSyncData?.length) {
265
- callSyncApi(reminder?.callSyncData[0]);
266
- }
267
- if (reminder?.callEmbellishApi && reminder?.callEmbellishApi?.length) {
268
- callEmbellishApi(reminder?.callEmbellishApi[0]);
269
- }
270
- }
271
- );
272
- return () => {
273
- subscription.remove();
274
- };
275
- }, [VisitRnSdkViewManager, callEmbellishApi, callSyncApi]);
276
-
277
78
  const handleMessage = async (event) => {
278
79
  const data = JSON.parse(unescapeHTML(event.nativeEvent.data));
279
- const {
280
- method,
281
- type,
282
- frequency,
283
- timestamp,
284
- // eslint-disable-next-line no-shadow
285
- apiBaseUrl,
286
- authtoken,
287
- googleFitLastSync,
288
- gfHourlyLastSync,
289
- url,
290
- } = data;
80
+ const { method, url } = data;
291
81
  console.log('handleMessage data is', data);
292
82
  console.log(unescapeHTML(event.nativeEvent.data));
293
83
  switch (method) {
@@ -297,53 +87,6 @@ const runBeforeFirst = `
297
87
  case 'UPDATE_PLATFORM':
298
88
  webviewRef.current?.injectJavaScript('window.setSdkPlatform("IOS")');
299
89
  break;
300
- case 'CONNECT_TO_GOOGLE_FIT':
301
- if (DeviceInfo.getModel() === 'iPad') {
302
- console.log('unsupportedHealthKitDevice triggered');
303
- webviewRef.current?.injectJavaScript(
304
- 'window.unsupportedHealthKitDevice(true)'
305
- );
306
- } else {
307
- VisitRnSdkViewManager?.connectToAppleHealth((res) => {
308
- if (res?.sleepTime || res?.numberOfSteps) {
309
- webviewRef.current?.injectJavaScript(
310
- `window.updateFitnessPermissions(true,${res?.numberOfSteps},${res?.sleepTime})`
311
- );
312
- } else {
313
- webviewRef.current?.injectJavaScript(
314
- 'window.updateFitnessPermissions(true,0,0)'
315
- );
316
- }
317
- });
318
- }
319
- break;
320
- case 'GET_DATA_TO_GENERATE_GRAPH':
321
- VisitRnSdkViewManager?.renderGraph(
322
- { type, frequency, timestamp },
323
- (err, results) => {
324
- if (err) {
325
- console.log('error initializing Healthkit: ', err);
326
- return;
327
- }
328
- if (results[0]) {
329
- console.log('results initializing Healthkit: ', results[0]);
330
- webviewRef.current?.injectJavaScript(`window.${results[0]}`);
331
- }
332
- }
333
- );
334
- break;
335
- case 'UPDATE_API_BASE_URL':
336
- if (!hasLoadedOnce) {
337
- console.log('apiBaseUrl is,', apiBaseUrl);
338
- setApiBaseUrl(apiBaseUrl);
339
- setAuthToken(authtoken);
340
- VisitRnSdkViewManager?.updateApiUrl({
341
- googleFitLastSync,
342
- gfHourlyLastSync,
343
- });
344
- setHasLoadedOnce(true);
345
- }
346
- break;
347
90
 
348
91
  case 'OPEN_PDF':
349
92
  Linking.openURL(url);
@@ -370,27 +113,25 @@ const runBeforeFirst = `
370
113
  return (
371
114
  // eslint-disable-next-line react-native/no-inline-styles
372
115
  <SafeAreaView style={{ flex: 1, backgroundColor: 'white', height, width }}>
373
- {loading ? (
374
- <LoadingIndicator />
375
- ) : (
376
- <WebView
377
- ref={webviewRef}
378
- source={{ uri: source }}
379
- style={styles.webView}
380
- javascriptEnabled
381
- onMessage={handleMessage}
382
- injectedJavaScriptBeforeContentLoaded={runBeforeFirst}
383
- onError={(errorMessage) => {
384
- EventRegister.emitEvent(visitEvent, {
385
- message: 'web-view-error',
386
- errorMessage: errorMessage,
387
- });
388
- if (isLoggingEnabled) {
389
- console.warn('Webview error: ', errorMessage);
390
- }
391
- }}
392
- />
393
- )}
116
+ {source ? (
117
+ <WebView
118
+ ref={webviewRef}
119
+ source={{ uri: source }}
120
+ style={styles.webView}
121
+ javascriptEnabled
122
+ onMessage={handleMessage}
123
+ injectedJavaScriptBeforeContentLoaded={runBeforeFirst}
124
+ onError={(errorMessage) => {
125
+ EventRegister.emitEvent(visitEvent, {
126
+ message: 'web-view-error',
127
+ errorMessage: errorMessage,
128
+ });
129
+ if (isLoggingEnabled) {
130
+ console.warn('Webview error: ', errorMessage);
131
+ }
132
+ }}
133
+ />
134
+ ) : null}
394
135
  <VideoCallComponent
395
136
  ref={videoCallRef}
396
137
  onCallConnected={(info) => {
@@ -414,42 +155,14 @@ const runBeforeFirst = `
414
155
  };
415
156
 
416
157
  const styles = StyleSheet.create({
417
- webViewContainer: {
418
- flex: 1,
419
- backgroundColor: 'white',
420
- },
421
158
  webView: {
422
159
  flex: 1,
423
160
  },
424
161
  });
425
162
 
426
163
  VisitRnSdkView.defaultProps = {
427
- id: '',
428
- token: '',
429
- baseUrl: '',
430
- errorBaseUrl: '',
431
- moduleName: '',
164
+ ssoLink: '',
165
+ isLoggingEnabled: false,
432
166
  };
433
167
 
434
168
  export default VisitRnSdkView;
435
-
436
- const LoadingIndicator = () => {
437
- return (
438
- <ActivityIndicator
439
- color="#000"
440
- size="small"
441
- // eslint-disable-next-line react-native/no-inline-styles
442
- style={{
443
- flex: 1,
444
- zIndex: 100,
445
- position: 'absolute',
446
- backgroundColor: '#fff',
447
- opacity: 0.4,
448
- width: '100%',
449
- height: '100%',
450
- justifyContent: 'center',
451
- alignItems: 'center',
452
- }}
453
- />
454
- );
455
- };
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
- package="com.visitrnsdk" >
4
-
5
- <uses-sdk android:minSdkVersion="21" />
6
-
7
- </manifest>
@@ -1,18 +0,0 @@
1
- {
2
- "version": 3,
3
- "artifactType": {
4
- "type": "AAPT_FRIENDLY_MERGED_MANIFESTS",
5
- "kind": "Directory"
6
- },
7
- "applicationId": "com.visitrnsdk",
8
- "variantName": "debug",
9
- "elements": [
10
- {
11
- "type": "SINGLE",
12
- "filters": [],
13
- "attributes": [],
14
- "outputFile": "AndroidManifest.xml"
15
- }
16
- ],
17
- "elementType": "File"
18
- }
@@ -1,5 +0,0 @@
1
- aarFormatVersion=1.0
2
- aarMetadataVersion=1.0
3
- minCompileSdk=1
4
- minCompileSdkExtension=0
5
- minAndroidGradlePluginVersion=1.0.0