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.
- package/README.md +25 -4
- package/ios/VisitRnSdkViewManager.h +1 -19
- package/ios/VisitRnSdkViewManager.m +8 -1294
- package/lib/commonjs/components/VideoCallComponent.js +59 -73
- package/lib/commonjs/components/VideoCallComponent.js.map +1 -1
- package/lib/commonjs/index.android.js +31 -352
- package/lib/commonjs/index.android.js.map +1 -1
- package/lib/commonjs/index.ios.js +14 -222
- package/lib/commonjs/index.ios.js.map +1 -1
- package/lib/module/components/VideoCallComponent.js +57 -69
- package/lib/module/components/VideoCallComponent.js.map +1 -1
- package/lib/module/index.android.js +28 -344
- package/lib/module/index.android.js.map +1 -1
- package/lib/module/index.ios.js +13 -219
- package/lib/module/index.ios.js.map +1 -1
- package/package.json +3 -5
- package/src/index.android.js +30 -513
- package/src/index.ios.js +30 -317
- package/android/bin/build/generated/source/buildConfig/debug/com/visitrnsdk/BuildConfig.class +0 -0
- package/android/bin/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -7
- package/android/bin/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +0 -18
- package/android/bin/build/intermediates/aar_main_jar/debug/classes.jar +0 -0
- package/android/bin/build/intermediates/aar_metadata/debug/aar-metadata.properties +0 -5
- package/android/bin/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
- package/android/bin/build/intermediates/annotations_typedef_file/debug/typedefs.txt +0 -0
- package/android/bin/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/android/bin/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
- package/android/bin/build/intermediates/compile_symbol_list/debug/R.txt +0 -1954
- package/android/bin/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -1
- package/android/bin/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
- package/android/bin/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
- package/android/bin/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
- package/android/bin/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
- package/android/bin/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
- package/android/bin/build/intermediates/library_java_res/debug/res.jar +0 -0
- package/android/bin/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -2
- package/android/bin/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -8
- package/android/bin/build/intermediates/merged_java_res/debug/feature-react-native-visit-rn-sdk.jar +0 -0
- package/android/bin/build/intermediates/merged_manifest/debug/AndroidManifest.xml +0 -7
- package/android/bin/build/intermediates/navigation_json/debug/navigation.json +0 -1
- package/android/bin/build/intermediates/packaged_manifests/debug/output-metadata.json +0 -18
- package/android/bin/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/android/bin/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -1447
- package/android/bin/build/intermediates/variant_model/debug/variant_model.json +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +0 -2
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/bin/build/outputs/aar/react-native-visit-rn-sdk-debug.aar +0 -0
- package/android/bin/build/outputs/logs/manifest-merger-debug-report.txt +0 -25
- package/android/bin/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/bin/build/tmp/kotlin-classes/debug/META-INF/react-native-visit-rn-sdk_debug.kotlin_module +0 -0
- package/android/bin/local.properties +0 -8
- package/lib/commonjs/Services.js +0 -36
- package/lib/commonjs/Services.js.map +0 -1
- package/lib/commonjs/constants.js +0 -12
- package/lib/commonjs/constants.js.map +0 -1
- package/lib/module/Services.js +0 -27
- package/lib/module/Services.js.map +0 -1
- package/lib/module/constants.js +0 -5
- package/lib/module/constants.js.map +0 -1
- package/src/Services.js +0 -37
- package/src/constants.js +0 -4
package/src/index.ios.js
CHANGED
|
@@ -1,33 +1,9 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
|
|
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
|
-
|
|
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
|
-
|
|
210
|
-
|
|
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
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
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
|
-
|
|
428
|
-
|
|
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
|
-
};
|
package/android/bin/build/generated/source/buildConfig/debug/com/visitrnsdk/BuildConfig.class
DELETED
|
Binary file
|
|
@@ -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
|
-
}
|
|
Binary file
|
package/android/bin/build/intermediates/annotation_processor_list/debug/annotationProcessors.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
File without changes
|
|
Binary file
|
|
Binary file
|