@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.
Files changed (106) hide show
  1. package/README.md +4 -4
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/AndroidManifest.xml +1 -1
  4. package/android/src/main/java/kyc/transfergratis/com/TransfergratisSdkModule.kt +6 -6
  5. package/android/src/main/java/kyc/transfergratis/com/TransfergratisSdkView.kt +2 -2
  6. package/build/package.json +5 -5
  7. package/build/src/App.d.ts +2 -2
  8. package/build/src/App.d.ts.map +1 -1
  9. package/build/src/App.js +2 -2
  10. package/build/src/App.js.map +1 -1
  11. package/build/src/{SanctumKeySdk.types.d.ts → TransfergratisSdk.types.d.ts} +3 -3
  12. package/build/src/TransfergratisSdk.types.d.ts.map +1 -0
  13. package/build/src/TransfergratisSdk.types.js +2 -0
  14. package/build/src/TransfergratisSdk.types.js.map +1 -0
  15. package/build/src/{SanctumKeySdkModule.d.ts → TransfergratisSdkModule.d.ts} +4 -4
  16. package/build/src/TransfergratisSdkModule.d.ts.map +1 -0
  17. package/build/src/{SanctumKeySdkModule.js → TransfergratisSdkModule.js} +2 -2
  18. package/build/src/TransfergratisSdkModule.js.map +1 -0
  19. package/build/src/{SanctumKeySdkModule.web.d.ts → TransfergratisSdkModule.web.d.ts} +4 -4
  20. package/build/src/TransfergratisSdkModule.web.d.ts.map +1 -0
  21. package/build/src/{SanctumKeySdkModule.web.js → TransfergratisSdkModule.web.js} +3 -3
  22. package/build/src/TransfergratisSdkModule.web.js.map +1 -0
  23. package/build/src/TransfergratisSdkView.d.ts +4 -0
  24. package/build/src/TransfergratisSdkView.d.ts.map +1 -0
  25. package/build/src/TransfergratisSdkView.js +7 -0
  26. package/build/src/TransfergratisSdkView.js.map +1 -0
  27. package/build/src/TransfergratisSdkView.web.d.ts +4 -0
  28. package/build/src/TransfergratisSdkView.web.d.ts.map +1 -0
  29. package/build/src/{SanctumKeySdkView.web.js → TransfergratisSdkView.web.js} +2 -2
  30. package/build/src/TransfergratisSdkView.web.js.map +1 -0
  31. package/build/src/api/axios.js +2 -2
  32. package/build/src/api/axios.js.map +1 -1
  33. package/build/src/components/EnhancedCameraView.d.ts.map +1 -1
  34. package/build/src/components/EnhancedCameraView.js +12 -61
  35. package/build/src/components/EnhancedCameraView.js.map +1 -1
  36. package/build/src/components/KYCElements/CountrySelection.d.ts.map +1 -1
  37. package/build/src/components/KYCElements/CountrySelection.js +259 -63
  38. package/build/src/components/KYCElements/CountrySelection.js.map +1 -1
  39. package/build/src/components/KYCElements/EmailVerificationTemplate.d.ts.map +1 -1
  40. package/build/src/components/KYCElements/EmailVerificationTemplate.js +11 -32
  41. package/build/src/components/KYCElements/EmailVerificationTemplate.js.map +1 -1
  42. package/build/src/components/KYCElements/IDCardCapture.d.ts.map +1 -1
  43. package/build/src/components/KYCElements/IDCardCapture.js +222 -68
  44. package/build/src/components/KYCElements/IDCardCapture.js.map +1 -1
  45. package/build/src/components/KYCElements/PhoneVerificationTemplate.d.ts.map +1 -1
  46. package/build/src/components/KYCElements/PhoneVerificationTemplate.js +9 -11
  47. package/build/src/components/KYCElements/PhoneVerificationTemplate.js.map +1 -1
  48. package/build/src/components/NativeCameraView.js +1 -1
  49. package/build/src/components/NativeCameraView.js.map +1 -1
  50. package/build/src/config/KYCConfig.js +1 -1
  51. package/build/src/config/KYCConfig.js.map +1 -1
  52. package/build/src/config/allowedDomains.js +6 -6
  53. package/build/src/config/allowedDomains.js.map +1 -1
  54. package/build/src/config/region_mapping.json +727 -0
  55. package/build/src/index.d.ts +3 -3
  56. package/build/src/index.d.ts.map +1 -1
  57. package/build/src/index.js +3 -3
  58. package/build/src/index.js.map +1 -1
  59. package/build/src/modules/api/CardAuthentification.d.ts.map +1 -1
  60. package/build/src/modules/api/CardAuthentification.js +3 -7
  61. package/build/src/modules/api/CardAuthentification.js.map +1 -1
  62. package/build/src/modules/api/KYCService.d.ts +1 -2
  63. package/build/src/modules/api/KYCService.d.ts.map +1 -1
  64. package/build/src/modules/api/KYCService.js +103 -63
  65. package/build/src/modules/api/KYCService.js.map +1 -1
  66. package/build/src/modules/camera/NativeCameraModule.js +17 -17
  67. package/build/src/modules/camera/NativeCameraModule.js.map +1 -1
  68. package/expo-module.config.json +2 -2
  69. package/ios/TransfergratisSdk.podspec +2 -2
  70. package/ios/TransfergratisSdkModule.swift +12 -12
  71. package/package.json +5 -5
  72. package/src/App.tsx +2 -2
  73. package/src/{SanctumKeySdk.types.ts → TransfergratisSdk.types.ts} +2 -2
  74. package/src/{SanctumKeySdkModule.ts → TransfergratisSdkModule.ts} +3 -3
  75. package/src/{SanctumKeySdkModule.web.ts → TransfergratisSdkModule.web.ts} +3 -3
  76. package/src/TransfergratisSdkView.tsx +11 -0
  77. package/src/{SanctumKeySdkView.web.tsx → TransfergratisSdkView.web.tsx} +2 -2
  78. package/src/api/axios.ts +2 -2
  79. package/src/components/EnhancedCameraView.tsx +34 -99
  80. package/src/components/KYCElements/CountrySelection.tsx +300 -74
  81. package/src/components/KYCElements/EmailVerificationTemplate.tsx +10 -36
  82. package/src/components/KYCElements/IDCardCapture.tsx +310 -156
  83. package/src/components/KYCElements/PhoneVerificationTemplate.tsx +9 -11
  84. package/src/components/NativeCameraView.tsx +1 -1
  85. package/src/config/KYCConfig.ts +1 -1
  86. package/src/config/allowedDomains.ts +6 -6
  87. package/src/i18n/README.md +1 -1
  88. package/src/index.ts +3 -3
  89. package/src/modules/api/CardAuthentification.ts +5 -8
  90. package/src/modules/api/KYCService.ts +167 -116
  91. package/src/modules/camera/NativeCameraModule.ts +17 -17
  92. package/build/src/SanctumKeySdk.types.d.ts.map +0 -1
  93. package/build/src/SanctumKeySdk.types.js +0 -2
  94. package/build/src/SanctumKeySdk.types.js.map +0 -1
  95. package/build/src/SanctumKeySdkModule.d.ts.map +0 -1
  96. package/build/src/SanctumKeySdkModule.js.map +0 -1
  97. package/build/src/SanctumKeySdkModule.web.d.ts.map +0 -1
  98. package/build/src/SanctumKeySdkModule.web.js.map +0 -1
  99. package/build/src/SanctumKeySdkView.d.ts +0 -4
  100. package/build/src/SanctumKeySdkView.d.ts.map +0 -1
  101. package/build/src/SanctumKeySdkView.js +0 -7
  102. package/build/src/SanctumKeySdkView.js.map +0 -1
  103. package/build/src/SanctumKeySdkView.web.d.ts +0 -4
  104. package/build/src/SanctumKeySdkView.web.d.ts.map +0 -1
  105. package/build/src/SanctumKeySdkView.web.js.map +0 -1
  106. package/src/SanctumKeySdkView.tsx +0 -11
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
 
3
- import { SanctumKeySdkViewProps } from './SanctumKeySdk.types';
3
+ import { TransfergratisSdkViewProps } from './TransfergratisSdk.types';
4
4
 
5
- export default function SanctumKeySdkView(props: SanctumKeySdkViewProps) {
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.SanctumKey.com',
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.SanctumKey.com',
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, ActivityIndicator } from 'react-native';
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
- ...result,
112
- path: result.path || photo.path,
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, styles.centerContent]}>
129
+ <View style={[styles.container, style, { justifyContent: 'center', alignItems: 'center' }]}>
150
130
  <Text style={styles.permissionMessage}>{t('camera.permissionRequired')}</Text>
151
- <Button
152
- title="Refresh Camera"
153
- onPress={() => setRefreshCamera(prev => !prev)}
154
- variant="primary"
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
- // 🚨 FIX: Don't return an invisible blank screen if the device is loading!
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
- centerContent: { justifyContent: 'center', alignItems: 'center', padding: 20 },
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
  });