@sanctum-key/react-native-sdk 1.0.43 → 1.0.45
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/build/package.json +1 -1
- package/build/src/components/KYCElements/IDCardCapture.d.ts.map +1 -1
- package/build/src/components/KYCElements/IDCardCapture.js +49 -1
- package/build/src/components/KYCElements/IDCardCapture.js.map +1 -1
- package/build/src/components/KYCElements/VerificationProgressTemplate.d.ts.map +1 -1
- package/build/src/components/KYCElements/VerificationProgressTemplate.js +81 -56
- package/build/src/components/KYCElements/VerificationProgressTemplate.js.map +1 -1
- package/package.json +1 -1
- package/src/components/KYCElements/IDCardCapture.tsx +61 -1
- package/src/components/KYCElements/VerificationProgressTemplate.tsx +107 -93
package/build/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IDCardCapture.d.ts","sourceRoot":"","sources":["../../../../src/components/KYCElements/IDCardCapture.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAIpE,OAAO,EAAE,iBAAiB,EAAoI,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"IDCardCapture.d.ts","sourceRoot":"","sources":["../../../../src/components/KYCElements/IDCardCapture.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAIpE,OAAO,EAAE,iBAAiB,EAAoI,MAAM,uBAAuB,CAAC;AAuB5L,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,kBAAkB;IAC1B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACvC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAkCD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAo2BtD,CAAC"}
|
|
@@ -16,6 +16,8 @@ import REGION_MAPPING from '../../config/region_mapping.json';
|
|
|
16
16
|
import QRCode from 'react-native-qrcode-svg';
|
|
17
17
|
import { cropImageWithBBoxWithTolerance } from '../../utils/cropByObb';
|
|
18
18
|
import kycService, { authentification, clearAuthToken } from '../../modules/api/KYCService';
|
|
19
|
+
import { Linking } from 'react-native';
|
|
20
|
+
import { Camera } from 'react-native-vision-camera';
|
|
19
21
|
const ISO_TO_COUNTRY_NAME = {
|
|
20
22
|
'KE': 'Kenya', 'CM': 'Cameroon', 'NG': 'Nigeria', 'CA': 'Canada',
|
|
21
23
|
'FR': 'France', 'GH': 'Ghana', 'ZA': 'South Africa', 'GB': 'Britain',
|
|
@@ -189,6 +191,52 @@ export const IDCardCapture = ({ component, value = {}, onValueChange, error, lan
|
|
|
189
191
|
}
|
|
190
192
|
}
|
|
191
193
|
}, [value, currentSide]);
|
|
194
|
+
const handleStartCamera = async () => {
|
|
195
|
+
// Web browsers handle permissions natively when the media stream is requested
|
|
196
|
+
if (Platform.OS === 'web') {
|
|
197
|
+
setShowCamera(true);
|
|
198
|
+
refreshCamera();
|
|
199
|
+
actions.showCustomStepper(false);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
try {
|
|
203
|
+
// 1. Get current status
|
|
204
|
+
let status = await Camera.getCameraPermissionStatus();
|
|
205
|
+
// 2. If it's anything other than granted, request it
|
|
206
|
+
if (status !== 'granted') {
|
|
207
|
+
status = await Camera.requestCameraPermission();
|
|
208
|
+
}
|
|
209
|
+
// 3. Check final status
|
|
210
|
+
if (status === 'granted') {
|
|
211
|
+
// Permission given, start camera
|
|
212
|
+
setShowCamera(true);
|
|
213
|
+
refreshCamera();
|
|
214
|
+
actions.showCustomStepper(false);
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
// Permission permanently denied or restricted
|
|
218
|
+
Alert.alert(state.currentLanguage === 'en' ? 'Camera Access Required' : 'Accès à la caméra requis', state.currentLanguage === 'en'
|
|
219
|
+
? 'We need camera access to scan your ID. Please tap "Settings" to enable it.'
|
|
220
|
+
: 'Nous avons besoin de l\'accès à la caméra pour scanner votre pièce d\'identité. Veuillez appuyer sur "Paramètres" pour l\'activer.', [
|
|
221
|
+
{
|
|
222
|
+
text: state.currentLanguage === 'en' ? 'Cancel' : 'Annuler',
|
|
223
|
+
style: 'cancel'
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
text: state.currentLanguage === 'en' ? 'Settings' : 'Paramètres',
|
|
227
|
+
onPress: () => Linking.openSettings()
|
|
228
|
+
}
|
|
229
|
+
]);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
console.warn('Failed to request camera permission', error);
|
|
234
|
+
// Fallback
|
|
235
|
+
setShowCamera(true);
|
|
236
|
+
refreshCamera();
|
|
237
|
+
actions.showCustomStepper(false);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
192
240
|
const cameraConfig = useMemo(() => {
|
|
193
241
|
let instructions = selectedDocumentType ? (locale === 'en' ? getDocumentTypeInfo(selectedDocumentType.type).instructions.en : getDocumentTypeInfo(selectedDocumentType.type).instructions.fr) : getLocalizedText(component.instructions);
|
|
194
242
|
if (scanPhase === 'barcode')
|
|
@@ -719,7 +767,7 @@ export const IDCardCapture = ({ component, value = {}, onValueChange, error, lan
|
|
|
719
767
|
</View>
|
|
720
768
|
<Button title={state.currentLanguage === "en" ? "Continue on Phone" : "Continuer sur le téléphone"} onPress={() => setShowQRModal(true)} variant="primary" size="large" fullWidth/>
|
|
721
769
|
</>) : (<>
|
|
722
|
-
|
|
770
|
+
<Button title={state.currentLanguage === "en" ? "Start Scanning" : "Commencer la numérisation"} onPress={handleStartCamera} variant="primary" size="large" fullWidth/>
|
|
723
771
|
{Platform.OS === 'web' && (<Button title={state.currentLanguage === "en" ? "Continue on Phone" : "Continuer sur le téléphone"} onPress={() => setShowQRModal(true)} variant="outline" size="large" fullWidth/>)}
|
|
724
772
|
</>)}
|
|
725
773
|
</View>)}
|