Skip to content

Commit

Permalink
show enhanced enrollment and authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
jumaallan committed Dec 17, 2024
1 parent a0a2832 commit a2f7615
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 23 deletions.
42 changes: 23 additions & 19 deletions example/src/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import type {
DocumentVerificationRequest,
SmartSelfieAuthenticationRequest,
SmartSelfieEnrollmentRequest,
SmartSelfieAuthenticationRequestEnhanced,
SmartSelfieEnrollmentRequestEnhanced
SmartSelfieAuthenticationEnhancedRequest,
SmartSelfieEnrollmentEnhancedRequest

Check failure on line 11 in example/src/HomeScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Insert `,`
} from '@smile_identity/react-native';

import { SmileID } from '@smile_identity/react-native';
Expand Down Expand Up @@ -47,7 +47,7 @@ export const HomeScreen = ({ navigation }: { navigation: any }) => {
optionalThingKey: 'optionalThingValue',
},
});
const [smartselfieCapture, setSmartselfieCapture] =
const [smartSelfieCapture, setSmartSelfieCapture] =
useState<SmartSelfieEnrollmentRequest>({
...defaultProductRef.current,
});
Expand All @@ -61,12 +61,16 @@ export const HomeScreen = ({ navigation }: { navigation: any }) => {
userId: 'user_0ffc7e8b-9b31-41bc-8131-03103a45d944',
});
const [smartSelfieEnrollmentEnhanced, setSmartSelfieEnrollmentEnhanced] =
useState<SmartSelfieEnrollmentRequestEnhanced>({
userId: 'user_0ffc7e8b-9b31-41bc-8131-03103a45d944',
useState<SmartSelfieEnrollmentEnhancedRequest>({
...defaultProductRef.current,
extraPartnerParams: {

Check failure on line 66 in example/src/HomeScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Insert `·`
optionalThingKey: 'optionalThingValue',

Check failure on line 67 in example/src/HomeScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Insert `·`
},

Check failure on line 68 in example/src/HomeScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Insert `·`
})

Check failure on line 69 in example/src/HomeScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Insert `;`
const [smartSelfieAuthenticationEnhanced, setSmartSelfieAuthenticationEnhanced] =

Check failure on line 70 in example/src/HomeScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `smartSelfieAuthenticationEnhanced,·setSmartSelfieAuthenticationEnhanced]·=` with `⏎····smartSelfieAuthenticationEnhanced,⏎····setSmartSelfieAuthenticationEnhanced,`
useState<SmartSelfieAuthenticationRequestEnhanced>({
userId: 'user_0ffc7e8b-9b31-41bc-8131-03103a45d944',
useState<SmartSelfieAuthenticationEnhancedRequest>({

Check failure on line 71 in example/src/HomeScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `···` with `]·=`
...defaultProductRef.current,

Check failure on line 72 in example/src/HomeScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Delete `····`
userId: 'user_0ffc7e8b-9b31-41bc-8131-03103a45d944',

Check failure on line 73 in example/src/HomeScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Delete `··········`
})

Check failure on line 74 in example/src/HomeScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `······})` with `··});`
const [documentVerification, setDocumentVerification] =
useState<DocumentVerificationRequest>({
Expand Down Expand Up @@ -120,7 +124,7 @@ export const HomeScreen = ({ navigation }: { navigation: any }) => {
jobId,
};

setSmartselfieCapture({
setSmartSelfieCapture({
...defaultProductRef.current,
});

Expand All @@ -146,17 +150,17 @@ export const HomeScreen = ({ navigation }: { navigation: any }) => {
});

setSmartSelfieEnrollmentEnhanced({
userId: generateUuid('user_'),
allowNewEnroll: false,
showInstructions: true,
showAttribution: true,
...defaultProductRef.current,
// allowNewEnroll: false,
// showInstructions: true,
// showAttribution: true,
})

setSmartSelfieAuthenticationEnhanced({
userId: 'user_0ffc7e8b-9b31-41bc-8131-03103a45d944',
allowNewEnroll: false,
showInstructions: true,
showAttribution: true,
...defaultProductRef.current,
// allowNewEnroll: false,
// showInstructions: true,
// showAttribution: true,
})

setDocumentVerification({
Expand Down Expand Up @@ -196,7 +200,7 @@ export const HomeScreen = ({ navigation }: { navigation: any }) => {
setSmileProducts([
{
title: 'SmartSelfie Capture',
product: smartselfieCapture,
product: smartSelfieCapture,
},
{
title: 'Document Capture',
Expand All @@ -212,7 +216,7 @@ export const HomeScreen = ({ navigation }: { navigation: any }) => {
},
{
title: 'SmartSelfie Enrollment (Enhanced)',
product: smartSelfieEnrollmentEnhanced,
product: smartSelfieEnrollment,
},
{
title: 'SmartSelfie Authentication (Enhanced)',
Expand All @@ -236,7 +240,7 @@ export const HomeScreen = ({ navigation }: { navigation: any }) => {
},
]);
}, [
smartselfieCapture,
smartSelfieCapture,
documentCapture,
smartSelfieEnrollment,
smartSelfieAuthentication,
Expand Down
28 changes: 28 additions & 0 deletions example/src/SmileIDCaptureScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import * as React from 'react';
import { StyleSheet, View } from 'react-native';
import {
SmileIDSmartSelfieEnrollmentView,
SmileIDSmartSelfieEnrollmentEnhancedView,
SmileIDSmartSelfieAuthenticationView,
SmileIDSmartSelfieAuthenticationEnhancedView,
SmileIDDocumentVerificationView,
SmileIDBiometricKYCView,
SmileIDDocumentCaptureView,
Expand Down Expand Up @@ -182,6 +184,19 @@ export const SmileIDCaptureScreen: React.FC<SmileIDCaptureScreenProps> = ({
}}
/>
)}
{title === 'SmartSelfie Enrollment (Enhanced)' && (
// @ts-ignore - this is a known issue with the type definitions
<SmileIDSmartSelfieEnrollmentEnhancedView
{...product}
style={styles.smileView}
onResult={(event) => {
if (event.nativeEvent.error) {
handleErrorResponse(event.nativeEvent.error);
return;
}
}}
/>
)}
{title === 'SmartSelfie Authentication' && (
// @ts-ignore - this is a known issue with the type definitions
<SmileIDSmartSelfieAuthenticationView
Expand All @@ -206,6 +221,19 @@ export const SmileIDCaptureScreen: React.FC<SmileIDCaptureScreenProps> = ({
}}
/>
)}
{title === 'SmartSelfie Authentication (Enhanced)' && (
// @ts-ignore - this is a known issue with the type definitions
<SmileIDSmartSelfieAuthenticationEnhancedView
{...product}
style={styles.smileView}
onResult={(event) => {
if (event.nativeEvent.error) {
handleErrorResponse(event.nativeEvent.error);
return;
}
}}
/>
)}
{title === 'Document Verification' && (
// @ts-ignore - this is a known issue with the type definitions
<SmileIDDocumentVerificationView
Expand Down
8 changes: 4 additions & 4 deletions example/src/types/Product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type {
SmileIDViewProps,
SmartSelfieEnrollmentRequest,
SmartSelfieAuthenticationRequest,
SmartSelfieEnrollmentRequestEnhanced,
SmartSelfieAuthenticationRequestEnhanced,
SmartSelfieEnrollmentEnhancedRequest,
SmartSelfieAuthenticationEnhancedRequest,
BiometricKYCRequest,
ConsentRequest,
} from '@smile_identity/react-native';
Expand All @@ -17,8 +17,8 @@ export type Product = {
| DocumentVerificationRequest
| SmartSelfieEnrollmentRequest
| SmartSelfieAuthenticationRequest
| SmartSelfieEnrollmentRequestEnhanced
| SmartSelfieAuthenticationRequestEnhanced
| SmartSelfieEnrollmentEnhancedRequest
| SmartSelfieAuthenticationEnhancedRequest
| BiometricKYCRequest
| SmileIDViewProps
| ConsentRequest;
Expand Down
4 changes: 4 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { NativeModules, Platform } from 'react-native';
import SmileIDSmartSelfieEnrollmentView from './SmileIDSmartSelfieEnrollmentView';
import SmileIDSmartSelfieAuthenticationView from './SmileIDSmartSelfieAuthenticationView';
import SmileIDSmartSelfieEnrollmentEnhancedView from './SmileIDSmartSelfieEnrollmentEnhancedView';
import SmileIDSmartSelfieAuthenticationEnhancedView from './SmileIDSmartSelfieAuthenticationEnhancedView';
import SmileIDDocumentVerificationView from './SmileIDDocumentVerificationView';
import SmileIDBiometricKYCView from './SmileIDBiometricKYCView';
import SmileIDEnhancedDocumentVerificationView from './SmileIDEnhancedDocumentVerificationView';
Expand Down Expand Up @@ -262,6 +264,8 @@ export {
//views
SmileIDSmartSelfieEnrollmentView,
SmileIDSmartSelfieAuthenticationView,
SmileIDSmartSelfieEnrollmentEnhancedView,
SmileIDSmartSelfieAuthenticationEnhancedView,
SmileIDDocumentVerificationView,
SmileIDBiometricKYCView,
SmileIDEnhancedDocumentVerificationView,
Expand Down

0 comments on commit a2f7615

Please sign in to comment.