@sanctum-key/react-native-sdk 1.0.8 → 1.0.10
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 +4 -4
- package/android/build.gradle +2 -2
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/kyc/transfergratis/com/TransfergratisSdkModule.kt +6 -6
- package/android/src/main/java/kyc/transfergratis/com/TransfergratisSdkView.kt +2 -2
- package/build/package.json +5 -5
- package/build/src/App.d.ts +2 -2
- package/build/src/App.d.ts.map +1 -1
- package/build/src/App.js +2 -2
- package/build/src/App.js.map +1 -1
- package/build/src/{SanctumKeySdk.types.d.ts → TransfergratisSdk.types.d.ts} +3 -3
- package/build/src/TransfergratisSdk.types.d.ts.map +1 -0
- package/build/src/TransfergratisSdk.types.js +2 -0
- package/build/src/TransfergratisSdk.types.js.map +1 -0
- package/build/src/{SanctumKeySdkModule.d.ts → TransfergratisSdkModule.d.ts} +4 -4
- package/build/src/TransfergratisSdkModule.d.ts.map +1 -0
- package/build/src/{SanctumKeySdkModule.js → TransfergratisSdkModule.js} +2 -2
- package/build/src/TransfergratisSdkModule.js.map +1 -0
- package/build/src/{SanctumKeySdkModule.web.d.ts → TransfergratisSdkModule.web.d.ts} +4 -4
- package/build/src/TransfergratisSdkModule.web.d.ts.map +1 -0
- package/build/src/{SanctumKeySdkModule.web.js → TransfergratisSdkModule.web.js} +3 -3
- package/build/src/TransfergratisSdkModule.web.js.map +1 -0
- package/build/src/TransfergratisSdkView.d.ts +4 -0
- package/build/src/TransfergratisSdkView.d.ts.map +1 -0
- package/build/src/TransfergratisSdkView.js +7 -0
- package/build/src/TransfergratisSdkView.js.map +1 -0
- package/build/src/TransfergratisSdkView.web.d.ts +4 -0
- package/build/src/TransfergratisSdkView.web.d.ts.map +1 -0
- package/build/src/{SanctumKeySdkView.web.js → TransfergratisSdkView.web.js} +2 -2
- package/build/src/TransfergratisSdkView.web.js.map +1 -0
- package/build/src/api/axios.js +2 -2
- package/build/src/api/axios.js.map +1 -1
- package/build/src/components/EnhancedCameraView.d.ts.map +1 -1
- package/build/src/components/EnhancedCameraView.js +12 -61
- package/build/src/components/EnhancedCameraView.js.map +1 -1
- package/build/src/components/KYCElements/CountrySelection.d.ts.map +1 -1
- package/build/src/components/KYCElements/CountrySelection.js +259 -63
- package/build/src/components/KYCElements/CountrySelection.js.map +1 -1
- package/build/src/components/KYCElements/EmailVerificationTemplate.d.ts.map +1 -1
- package/build/src/components/KYCElements/EmailVerificationTemplate.js +11 -32
- package/build/src/components/KYCElements/EmailVerificationTemplate.js.map +1 -1
- package/build/src/components/KYCElements/IDCardCapture.d.ts.map +1 -1
- package/build/src/components/KYCElements/IDCardCapture.js +222 -68
- package/build/src/components/KYCElements/IDCardCapture.js.map +1 -1
- package/build/src/components/KYCElements/PhoneVerificationTemplate.d.ts.map +1 -1
- package/build/src/components/KYCElements/PhoneVerificationTemplate.js +9 -11
- package/build/src/components/KYCElements/PhoneVerificationTemplate.js.map +1 -1
- package/build/src/components/NativeCameraView.js +1 -1
- package/build/src/components/NativeCameraView.js.map +1 -1
- package/build/src/config/KYCConfig.js +1 -1
- package/build/src/config/KYCConfig.js.map +1 -1
- package/build/src/config/allowedDomains.js +6 -6
- package/build/src/config/allowedDomains.js.map +1 -1
- package/build/src/config/region_mapping.json +727 -0
- package/build/src/index.d.ts +3 -3
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +3 -3
- package/build/src/index.js.map +1 -1
- package/build/src/modules/api/CardAuthentification.d.ts.map +1 -1
- package/build/src/modules/api/CardAuthentification.js +3 -7
- package/build/src/modules/api/CardAuthentification.js.map +1 -1
- package/build/src/modules/api/KYCService.d.ts +1 -2
- package/build/src/modules/api/KYCService.d.ts.map +1 -1
- package/build/src/modules/api/KYCService.js +103 -63
- package/build/src/modules/api/KYCService.js.map +1 -1
- package/build/src/modules/camera/NativeCameraModule.js +17 -17
- package/build/src/modules/camera/NativeCameraModule.js.map +1 -1
- package/expo-module.config.json +2 -2
- package/ios/TransfergratisSdk.podspec +2 -2
- package/ios/TransfergratisSdkModule.swift +12 -12
- package/package.json +5 -5
- package/src/App.tsx +2 -2
- package/src/{SanctumKeySdk.types.ts → TransfergratisSdk.types.ts} +2 -2
- package/src/{SanctumKeySdkModule.ts → TransfergratisSdkModule.ts} +3 -3
- package/src/{SanctumKeySdkModule.web.ts → TransfergratisSdkModule.web.ts} +3 -3
- package/src/TransfergratisSdkView.tsx +11 -0
- package/src/{SanctumKeySdkView.web.tsx → TransfergratisSdkView.web.tsx} +2 -2
- package/src/api/axios.ts +2 -2
- package/src/components/EnhancedCameraView.tsx +34 -99
- package/src/components/KYCElements/CountrySelection.tsx +300 -74
- package/src/components/KYCElements/EmailVerificationTemplate.tsx +10 -36
- package/src/components/KYCElements/IDCardCapture.tsx +310 -156
- package/src/components/KYCElements/PhoneVerificationTemplate.tsx +9 -11
- package/src/components/NativeCameraView.tsx +1 -1
- package/src/config/KYCConfig.ts +1 -1
- package/src/config/allowedDomains.ts +6 -6
- package/src/i18n/README.md +1 -1
- package/src/index.ts +3 -3
- package/src/modules/api/CardAuthentification.ts +5 -8
- package/src/modules/api/KYCService.ts +167 -116
- package/src/modules/camera/NativeCameraModule.ts +17 -17
- package/build/src/SanctumKeySdk.types.d.ts.map +0 -1
- package/build/src/SanctumKeySdk.types.js +0 -2
- package/build/src/SanctumKeySdk.types.js.map +0 -1
- package/build/src/SanctumKeySdkModule.d.ts.map +0 -1
- package/build/src/SanctumKeySdkModule.js.map +0 -1
- package/build/src/SanctumKeySdkModule.web.d.ts.map +0 -1
- package/build/src/SanctumKeySdkModule.web.js.map +0 -1
- package/build/src/SanctumKeySdkView.d.ts +0 -4
- package/build/src/SanctumKeySdkView.d.ts.map +0 -1
- package/build/src/SanctumKeySdkView.js +0 -7
- package/build/src/SanctumKeySdkView.js.map +0 -1
- package/build/src/SanctumKeySdkView.web.d.ts +0 -4
- package/build/src/SanctumKeySdkView.web.d.ts.map +0 -1
- package/build/src/SanctumKeySdkView.web.js.map +0 -1
- package/src/SanctumKeySdkView.tsx +0 -11
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { TransfergratisSdkViewProps } from './TransfergratisSdk.types';
|
|
4
4
|
|
|
5
|
-
export default function
|
|
5
|
+
export default function TransfergratisSdkView(props: TransfergratisSdkViewProps) {
|
|
6
6
|
return (
|
|
7
7
|
<div>
|
|
8
8
|
{/* <iframe
|
package/src/api/axios.ts
CHANGED
|
@@ -132,12 +132,12 @@ export default HttpClient;
|
|
|
132
132
|
|
|
133
133
|
// ml service api
|
|
134
134
|
export const mlService = new HttpClient({
|
|
135
|
-
baseURL: 'https://api.ml.
|
|
135
|
+
baseURL: 'https://api.ml.transfergratis.com',
|
|
136
136
|
apiKey: 'your-api-key',
|
|
137
137
|
});
|
|
138
138
|
// backedn service api
|
|
139
139
|
export const backendService = new HttpClient({
|
|
140
|
-
baseURL: 'https://api.backend.
|
|
140
|
+
baseURL: 'https://api.backend.transfergratis.com',
|
|
141
141
|
apiKey: 'your-api-key',
|
|
142
142
|
});
|
|
143
143
|
|
|
@@ -1,35 +1,33 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { View, StyleSheet, Text, AppState
|
|
2
|
+
import { View, StyleSheet, Text, AppState } from 'react-native';
|
|
3
3
|
import { Camera, useCameraDevice } from 'react-native-vision-camera';
|
|
4
4
|
import VisionCameraModule from '../modules/camera/VisionCameraModule';
|
|
5
5
|
import { useI18n } from '../hooks/useI18n';
|
|
6
6
|
import { EnhancedCameraViewProps } from './OverLay/type';
|
|
7
7
|
import { Button } from './ui/Button';
|
|
8
8
|
|
|
9
|
-
export const EnhancedCameraView: React.FC<EnhancedCameraViewProps> = ({
|
|
9
|
+
export const EnhancedCameraView: React.FC<EnhancedCameraViewProps> = ({
|
|
10
10
|
showCamera,
|
|
11
11
|
cameraType: initialCameraType = 'front',
|
|
12
12
|
style,
|
|
13
13
|
onError,
|
|
14
|
-
onSilentCapture,
|
|
14
|
+
onSilentCapture,
|
|
15
15
|
silentCaptureResult,
|
|
16
|
-
isProcessing = false,
|
|
16
|
+
isProcessing = false,
|
|
17
17
|
overlayComponent,
|
|
18
18
|
}) => {
|
|
19
19
|
const { t } = useI18n();
|
|
20
20
|
const camera = useRef<Camera>(null);
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
const isCapturingRef = useRef(false);
|
|
23
23
|
const isProcessingRef = useRef(isProcessing);
|
|
24
24
|
|
|
25
25
|
const [cameraType] = useState<'front' | 'back'>(initialCameraType);
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
// 🚨 BUG FIX: Initialize to null to prevent the "Flicker" on retake
|
|
27
28
|
const [hasPermission, setHasPermission] = useState<boolean | null>(null);
|
|
28
29
|
const [isInitialized, setIsInitialized] = useState(false);
|
|
29
30
|
const [refreshCamera, setRefreshCamera] = useState(false);
|
|
30
|
-
|
|
31
|
-
// 🚨 ADDED: A timeout state to show a refresh button if the camera gets stuck booting
|
|
32
|
-
const [showInitTimeout, setShowInitTimeout] = useState(false);
|
|
33
31
|
|
|
34
32
|
const device = useCameraDevice(cameraType);
|
|
35
33
|
|
|
@@ -56,10 +54,7 @@ export const EnhancedCameraView: React.FC<EnhancedCameraViewProps> = ({
|
|
|
56
54
|
};
|
|
57
55
|
|
|
58
56
|
useEffect(() => {
|
|
59
|
-
if (showCamera)
|
|
60
|
-
setIsInitialized(false); // Reset init state when checking permissions/refreshing
|
|
61
|
-
checkPermissions();
|
|
62
|
-
}
|
|
57
|
+
if (showCamera) checkPermissions();
|
|
63
58
|
}, [showCamera, refreshCamera]);
|
|
64
59
|
|
|
65
60
|
useEffect(() => {
|
|
@@ -71,26 +66,7 @@ export const EnhancedCameraView: React.FC<EnhancedCameraViewProps> = ({
|
|
|
71
66
|
return () => subscription.remove();
|
|
72
67
|
}, [showCamera, hasPermission]);
|
|
73
68
|
|
|
74
|
-
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
let timer: ReturnType<typeof setTimeout>;
|
|
77
|
-
|
|
78
|
-
if (hasPermission && device && showCamera && !isInitialized) {
|
|
79
|
-
timer = setTimeout(() => setShowInitTimeout(true), 3000);
|
|
80
|
-
} else {
|
|
81
|
-
setShowInitTimeout(false);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return () => {
|
|
85
|
-
if (timer) clearTimeout(timer);
|
|
86
|
-
};
|
|
87
|
-
}, [hasPermission, device, showCamera, isInitialized]);
|
|
88
|
-
|
|
89
|
-
const onInitialized = useCallback(() => {
|
|
90
|
-
setIsInitialized(true);
|
|
91
|
-
setShowInitTimeout(false);
|
|
92
|
-
}, []);
|
|
93
|
-
|
|
69
|
+
const onInitialized = useCallback(() => setIsInitialized(true), []);
|
|
94
70
|
const onCameraError = useCallback((error: any) => {
|
|
95
71
|
onError?.({ message: error.message || t('camera.errorOccurred') });
|
|
96
72
|
}, [onError, t]);
|
|
@@ -100,27 +76,30 @@ export const EnhancedCameraView: React.FC<EnhancedCameraViewProps> = ({
|
|
|
100
76
|
if (silentCaptureResult?.isAnalyzing) return;
|
|
101
77
|
|
|
102
78
|
try {
|
|
103
|
-
isCapturingRef.current = true;
|
|
79
|
+
isCapturingRef.current = true;
|
|
104
80
|
const photo = await camera.current.takePhoto({
|
|
105
|
-
enableShutterSound: false,
|
|
106
|
-
flash: 'off',
|
|
81
|
+
enableShutterSound: false,
|
|
82
|
+
flash: 'off',
|
|
107
83
|
});
|
|
108
|
-
const result = await VisionCameraModule.processPhotoResult(photo);
|
|
109
84
|
|
|
85
|
+
const result = await VisionCameraModule.processPhotoResult(photo);
|
|
86
|
+
|
|
110
87
|
onSilentCapture?.({
|
|
111
|
-
|
|
112
|
-
|
|
88
|
+
...result,
|
|
89
|
+
path: result.path || photo.path,
|
|
113
90
|
});
|
|
91
|
+
|
|
114
92
|
} catch (error) {
|
|
115
93
|
// Silent background fail
|
|
116
94
|
} finally {
|
|
117
|
-
isCapturingRef.current = false;
|
|
95
|
+
isCapturingRef.current = false;
|
|
118
96
|
}
|
|
119
97
|
}, [isInitialized, onSilentCapture, silentCaptureResult]);
|
|
120
98
|
|
|
99
|
+
// 🚨 BUG FIX: The Warm-up Timer (Fixes Blurry Images)
|
|
121
100
|
useEffect(() => {
|
|
122
101
|
if (!showCamera || !isInitialized || isProcessing) return;
|
|
123
|
-
|
|
102
|
+
|
|
124
103
|
let isActive = true;
|
|
125
104
|
let intervalId: ReturnType<typeof setInterval>;
|
|
126
105
|
|
|
@@ -128,9 +107,9 @@ export const EnhancedCameraView: React.FC<EnhancedCameraViewProps> = ({
|
|
|
128
107
|
if (!isActive) return;
|
|
129
108
|
intervalId = setInterval(() => {
|
|
130
109
|
captureSilentPhoto();
|
|
131
|
-
}, 1500);
|
|
132
|
-
}, 1000);
|
|
133
|
-
|
|
110
|
+
}, 1500); // 1.5s gives the hardware more time to stabilize between shots
|
|
111
|
+
}, 1000);
|
|
112
|
+
|
|
134
113
|
return () => {
|
|
135
114
|
isActive = false;
|
|
136
115
|
clearTimeout(warmupTimer);
|
|
@@ -139,75 +118,40 @@ export const EnhancedCameraView: React.FC<EnhancedCameraViewProps> = ({
|
|
|
139
118
|
}, [showCamera, isInitialized, isProcessing, captureSilentPhoto]);
|
|
140
119
|
|
|
141
120
|
// --- RENDERERS ---
|
|
142
|
-
|
|
121
|
+
|
|
122
|
+
// 🚨 BUG FIX: Show nothing while checking permissions (Stops flicker)
|
|
143
123
|
if (hasPermission === null) {
|
|
144
124
|
return <View style={[styles.container, style]} />;
|
|
145
125
|
}
|
|
146
126
|
|
|
147
127
|
if (hasPermission === false) {
|
|
148
128
|
return (
|
|
149
|
-
<View style={[styles.container, style,
|
|
129
|
+
<View style={[styles.container, style, { justifyContent: 'center', alignItems: 'center' }]}>
|
|
150
130
|
<Text style={styles.permissionMessage}>{t('camera.permissionRequired')}</Text>
|
|
151
|
-
<Button
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
131
|
+
<Button
|
|
132
|
+
title="Refresh Camera"
|
|
133
|
+
onPress={() => setRefreshCamera(prev => !prev)}
|
|
134
|
+
variant="primary"
|
|
155
135
|
/>
|
|
156
136
|
</View>
|
|
157
137
|
);
|
|
158
138
|
}
|
|
159
139
|
|
|
160
|
-
|
|
161
|
-
// Give them a UI and a way out.
|
|
162
|
-
if (!device || !showCamera) {
|
|
163
|
-
return (
|
|
164
|
-
<View style={[styles.container, style, styles.centerContent]}>
|
|
165
|
-
<ActivityIndicator size="large" color="#2DBD60" style={{ marginBottom: 16 }} />
|
|
166
|
-
<Text style={styles.permissionMessage}>Loading Camera Hardware...</Text>
|
|
167
|
-
<Button
|
|
168
|
-
title="Refresh"
|
|
169
|
-
onPress={() => setRefreshCamera(prev => !prev)}
|
|
170
|
-
variant="outline"
|
|
171
|
-
/>
|
|
172
|
-
</View>
|
|
173
|
-
);
|
|
174
|
-
}
|
|
140
|
+
if (!device || !showCamera) return <View style={[styles.container, style]} />;
|
|
175
141
|
|
|
176
142
|
return (
|
|
177
143
|
<View style={[styles.container, style]}>
|
|
178
144
|
<Camera
|
|
179
|
-
// 🚨 FIX: This key forces the native component to completely remount
|
|
180
|
-
// when permissions are granted or when manually refreshed.
|
|
181
|
-
key={`cam-${hasPermission}-${refreshCamera ? '1' : '0'}`}
|
|
182
145
|
ref={camera}
|
|
183
146
|
style={StyleSheet.absoluteFill}
|
|
184
147
|
device={device}
|
|
185
148
|
isActive={showCamera && !isProcessing}
|
|
186
149
|
photo={true}
|
|
187
|
-
video={false}
|
|
188
|
-
audio={false}
|
|
150
|
+
video={false}
|
|
151
|
+
audio={false}
|
|
189
152
|
onInitialized={onInitialized}
|
|
190
153
|
onError={onCameraError}
|
|
191
154
|
/>
|
|
192
|
-
|
|
193
|
-
{/* 🚨 FIX: Floating Refresh Button if the hardware freezes on a black screen */}
|
|
194
|
-
{!isInitialized && showInitTimeout && (
|
|
195
|
-
<View style={styles.stuckOverlay}>
|
|
196
|
-
<ActivityIndicator size="large" color="#2DBD60" style={{ marginBottom: 16 }} />
|
|
197
|
-
<Text style={{ color: 'white', marginBottom: 16, fontWeight: 'bold' }}>
|
|
198
|
-
Camera is taking a while to start...
|
|
199
|
-
</Text>
|
|
200
|
-
<Button
|
|
201
|
-
title="Restart Camera"
|
|
202
|
-
onPress={() => {
|
|
203
|
-
setIsInitialized(false);
|
|
204
|
-
setRefreshCamera(prev => !prev);
|
|
205
|
-
}}
|
|
206
|
-
variant="primary"
|
|
207
|
-
/>
|
|
208
|
-
</View>
|
|
209
|
-
)}
|
|
210
|
-
|
|
211
155
|
{overlayComponent}
|
|
212
156
|
</View>
|
|
213
157
|
);
|
|
@@ -215,14 +159,5 @@ export const EnhancedCameraView: React.FC<EnhancedCameraViewProps> = ({
|
|
|
215
159
|
|
|
216
160
|
const styles = StyleSheet.create({
|
|
217
161
|
container: { flex: 1, backgroundColor: 'black' },
|
|
218
|
-
|
|
219
|
-
permissionMessage: { color: 'white', textAlign: 'center', marginBottom: 20, fontSize: 16, fontWeight: '600' },
|
|
220
|
-
stuckOverlay: {
|
|
221
|
-
...StyleSheet.absoluteFillObject,
|
|
222
|
-
justifyContent: 'center',
|
|
223
|
-
alignItems: 'center',
|
|
224
|
-
backgroundColor: 'rgba(0,0,0,0.85)',
|
|
225
|
-
zIndex: 1000,
|
|
226
|
-
padding: 20
|
|
227
|
-
}
|
|
162
|
+
permissionMessage: { color: 'white', textAlign: 'center', margin: 20, fontSize: 16 },
|
|
228
163
|
});
|