assentify-sdk-react-native 0.0.41 → 1.0.0-Beta
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 +11 -1
- package/android/build.gradle +28 -30
- package/android/gradle.properties +2 -2
- package/android/src/main/java/com/assentifysdk/AssentifySdkModule.kt +81 -118
- package/android/src/main/java/com/assentifysdk/FaceMatchActivity.kt +27 -24
- package/android/src/main/java/com/assentifysdk/FlowActivity.kt +191 -0
- package/android/src/main/java/com/assentifysdk/QrActivity.kt +10 -11
- package/android/src/main/java/com/assentifysdk/ScanIDActivity.kt +83 -98
- package/android/src/main/java/com/assentifysdk/ScanOtherActivity.kt +7 -6
- package/android/src/main/java/com/assentifysdk/ScanPassportActivity.kt +8 -13
- package/android/src/main/res/layout/activity_face_scan.xml +1 -1
- package/android/src/main/res/layout/activity_flow.xml +9 -0
- package/android/src/main/res/layout/activity_scan.xml +1 -1
- package/assentify-sdk.podspec +2 -1
- package/ios/NativeAssentifySdk.mm +24 -4
- package/ios/NativeAssentifySdk.swift +229 -30
- package/ios/UIComponents/RNPassportScanner.swift +4 -3
- package/ios/View/FaceMatchController.swift +131 -124
- package/ios/View/IDCardController.swift +48 -35
- package/ios/View/OtherController.swift +9 -18
- package/ios/View/PassportController.swift +82 -121
- package/ios/View/QrController.swift +9 -6
- package/lib/commonjs/AssentifyProvider.js +88 -101
- package/lib/commonjs/AssentifyProvider.js.map +1 -1
- package/lib/commonjs/AssentifyWrapper.js +11 -17
- package/lib/commonjs/AssentifyWrapper.js.map +1 -1
- package/lib/commonjs/BackgroundType.js +11 -0
- package/lib/commonjs/BackgroundType.js.map +1 -0
- package/lib/commonjs/helpers/parsers/FlowCompletedModelParser.js +26 -0
- package/lib/commonjs/helpers/parsers/FlowCompletedModelParser.js.map +1 -0
- package/lib/commonjs/index.js +4 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/AssentifyProvider.js +86 -98
- package/lib/module/AssentifyProvider.js.map +1 -1
- package/lib/module/AssentifyWrapper.js +11 -17
- package/lib/module/AssentifyWrapper.js.map +1 -1
- package/lib/module/BackgroundType.js +5 -0
- package/lib/module/BackgroundType.js.map +1 -0
- package/lib/module/helpers/parsers/FlowCompletedModelParser.js +20 -0
- package/lib/module/helpers/parsers/FlowCompletedModelParser.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/example/babel.config.d.ts +153 -1
- package/lib/typescript/example/babel.config.d.ts.map +1 -1
- package/lib/typescript/example/metro.config.d.ts +2 -2
- package/lib/typescript/example/metro.config.d.ts.map +1 -1
- package/lib/typescript/example/react-native.config.d.ts +153 -1
- package/lib/typescript/example/react-native.config.d.ts.map +1 -1
- package/lib/typescript/example/src/App.d.ts.map +1 -1
- package/lib/typescript/example/src/Home.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts +3 -1
- package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts +4 -6
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/BackgroundType.d.ts +6 -0
- package/lib/typescript/lib/commonjs/BackgroundType.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/FlowCompletedModelParser.d.ts +11 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/FlowCompletedModelParser.d.ts.map +1 -0
- package/lib/typescript/lib/module/AssentifyProvider.d.ts +4 -2
- package/lib/typescript/lib/module/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts +4 -6
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/lib/module/BackgroundType.d.ts +5 -0
- package/lib/typescript/lib/module/BackgroundType.d.ts.map +1 -0
- package/lib/typescript/lib/module/helpers/parsers/FlowCompletedModelParser.d.ts +10 -0
- package/lib/typescript/lib/module/helpers/parsers/FlowCompletedModelParser.d.ts.map +1 -0
- package/lib/typescript/lib/module/index.d.ts +5 -7
- package/lib/typescript/lib/module/index.d.ts.map +1 -1
- package/lib/typescript/src/AssentifyProvider.d.ts +5 -2
- package/lib/typescript/src/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/src/AssentifyWrapper.d.ts +6 -7
- package/lib/typescript/src/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/src/BackgroundType.d.ts +6 -0
- package/lib/typescript/src/BackgroundType.d.ts.map +1 -0
- package/lib/typescript/src/helpers/parsers/FaceMatchParser.d.ts.map +1 -1
- package/lib/typescript/src/helpers/parsers/FlowCompletedModelParser.d.ts +4 -0
- package/lib/typescript/src/helpers/parsers/FlowCompletedModelParser.d.ts.map +1 -0
- package/lib/typescript/src/helpers/parsers/IDCardParser.d.ts.map +1 -1
- package/lib/typescript/src/helpers/parsers/OtherIDParser.d.ts.map +1 -1
- package/lib/typescript/src/helpers/parsers/PassportParser.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +5 -7
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +11 -2
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +14 -11
- package/src/AssentifyProvider.tsx +196 -147
- package/src/AssentifyWrapper.ts +55 -27
- package/src/BackgroundType.ts +7 -0
- package/src/helpers/parsers/FlowCompletedModelParser.ts +31 -0
- package/src/index.ts +1 -1
- package/src/types.ts +13 -2
- package/lib/commonjs/DoneFlags.js +0 -14
- package/lib/commonjs/DoneFlags.js.map +0 -1
- package/lib/module/DoneFlags.js +0 -8
- package/lib/module/DoneFlags.js.map +0 -1
- package/lib/typescript/lib/commonjs/DoneFlags.d.ts +0 -9
- package/lib/typescript/lib/commonjs/DoneFlags.d.ts.map +0 -1
- package/lib/typescript/lib/module/DoneFlags.d.ts +0 -8
- package/lib/typescript/lib/module/DoneFlags.d.ts.map +0 -1
- package/lib/typescript/src/DoneFlags.d.ts +0 -9
- package/lib/typescript/src/DoneFlags.d.ts.map +0 -1
- package/src/DoneFlags.ts +0 -11
|
@@ -1,211 +1,263 @@
|
|
|
1
|
+
|
|
1
2
|
import {
|
|
2
3
|
NativeModules,
|
|
3
4
|
NativeEventEmitter,
|
|
4
5
|
DeviceEventEmitter,
|
|
5
6
|
LogBox,
|
|
6
7
|
} from 'react-native';
|
|
7
|
-
import React
|
|
8
|
-
createContext,
|
|
9
|
-
useCallback,
|
|
10
|
-
useEffect,
|
|
11
|
-
useMemo,
|
|
12
|
-
useRef,
|
|
13
|
-
} from 'react';
|
|
14
|
-
import { merge } from 'lodash';
|
|
8
|
+
import * as React from 'react';
|
|
15
9
|
import {
|
|
16
|
-
type PassportExtractedModel,
|
|
17
|
-
type FaceExtractedModel,
|
|
18
|
-
type IDExtractedModel,
|
|
19
|
-
type OtherExtractedModel,
|
|
20
10
|
type TemplatesByCountry,
|
|
21
11
|
type StepDefinitions,
|
|
22
12
|
type DocumentTokensModel,
|
|
23
13
|
type CreateUserDocumentResponseModel,
|
|
24
14
|
type SignatureResponseModel,
|
|
25
|
-
FAILED_RESULT,
|
|
26
|
-
type IdentificationDocumentCapture,
|
|
27
15
|
} from './types';
|
|
28
|
-
|
|
29
|
-
type DoneFlagsCode,
|
|
30
|
-
} from './DoneFlags';
|
|
16
|
+
|
|
31
17
|
import JsonParserPassport from './helpers/parsers/PassportParser';
|
|
32
18
|
import JsonParserFaceMatch from './helpers/parsers/FaceMatchParser';
|
|
33
19
|
import JsonParserIdCard from './helpers/parsers/IDCardParser';
|
|
34
20
|
import JsonParserOtherID from './helpers/parsers/OtherIDParser';
|
|
21
|
+
import JsonParserFlowCompletedList from './helpers/parsers/FlowCompletedModelParser';
|
|
35
22
|
|
|
36
23
|
const { NativeAssentifySdk } = NativeModules;
|
|
37
24
|
|
|
38
|
-
const AssentifyContext = createContext<undefined>(undefined);
|
|
25
|
+
const AssentifyContext = React.createContext<undefined>(undefined);
|
|
39
26
|
|
|
40
27
|
LogBox.ignoreAllLogs();
|
|
41
|
-
const AssentifyProvider = () => {
|
|
42
|
-
|
|
43
28
|
|
|
29
|
+
type AssentifyProviderProps = {
|
|
30
|
+
children?: React.ReactNode;
|
|
31
|
+
};
|
|
44
32
|
|
|
45
|
-
|
|
33
|
+
const AssentifyProvider = ({ children }: AssentifyProviderProps) => {
|
|
34
|
+
React.useEffect(() => {
|
|
46
35
|
const emitter = new NativeEventEmitter(NativeAssentifySdk);
|
|
47
36
|
|
|
48
|
-
/// Initialize
|
|
49
37
|
const assentifySdkInit = emitter.addListener('AppResult', (result) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
38
|
+
if (result?.assentifySdkInitSuccess != null) {
|
|
39
|
+
if (result.assentifySdkInitSuccess) {
|
|
40
|
+
const templates = JSON.parse(
|
|
41
|
+
result?.AssentifySdkHasTemplates
|
|
42
|
+
) as TemplatesByCountry[];
|
|
43
|
+
|
|
44
|
+
const stepDefinitions = JSON.parse(
|
|
45
|
+
result?.StepDefinitions
|
|
46
|
+
) as StepDefinitions[];
|
|
47
|
+
|
|
48
|
+
DeviceEventEmitter.emit('assentifySdkInit', {
|
|
49
|
+
status: true,
|
|
50
|
+
templates,
|
|
51
|
+
stepDefinitions,
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
DeviceEventEmitter.emit('assentifySdkInit', {
|
|
55
|
+
status: false,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
62
61
|
const onComplete = emitter.addListener('onComplete', (result) => {
|
|
63
62
|
if (result?.PassportDataModel) {
|
|
64
|
-
const response = JsonParserPassport(result
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
const response = JsonParserPassport(result.PassportDataModel);
|
|
64
|
+
DeviceEventEmitter.emit('onCompletePassport', {
|
|
65
|
+
passportExtractedModel: response,
|
|
66
|
+
});
|
|
67
67
|
} else if (result?.FaceMatchDataModel) {
|
|
68
|
-
const response = JsonParserFaceMatch(result
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
const response = JsonParserFaceMatch(result.FaceMatchDataModel);
|
|
69
|
+
DeviceEventEmitter.emit('onCompleteFaceMatch', {
|
|
70
|
+
faceExtractedModel: response,
|
|
71
|
+
});
|
|
71
72
|
} else if (result?.IdDataModel) {
|
|
72
|
-
const response = JsonParserIdCard(result
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
const response = JsonParserIdCard(result.IdDataModel);
|
|
74
|
+
const isFrontPage = result?.isFrontPage as boolean | undefined;
|
|
75
|
+
const isLastPage = result?.isLastPage as boolean | undefined;
|
|
76
|
+
|
|
77
|
+
DeviceEventEmitter.emit('onCompleteIDCard', {
|
|
78
|
+
iDExtractedModel: response,
|
|
79
|
+
isFrontPage,
|
|
80
|
+
isLastPage,
|
|
81
|
+
});
|
|
75
82
|
} else if (result?.OtherDataModel) {
|
|
76
|
-
const response = JsonParserOtherID(result
|
|
77
|
-
|
|
78
|
-
|
|
83
|
+
const response = JsonParserOtherID(result.OtherDataModel);
|
|
84
|
+
DeviceEventEmitter.emit('onCompleteOther', {
|
|
85
|
+
otherExtractedModel: response,
|
|
86
|
+
});
|
|
79
87
|
}
|
|
80
88
|
});
|
|
81
89
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
const onCompleteQrScan = emitter.addListener('onCompleteQrScan', (result) => {
|
|
91
|
+
if (result?.IdQrDataModel) {
|
|
92
|
+
const response = JsonParserIdCard(result.IdQrDataModel);
|
|
93
|
+
DeviceEventEmitter.emit('onCompleteQr', {
|
|
94
|
+
iDExtractedModel: response,
|
|
87
95
|
});
|
|
96
|
+
}
|
|
97
|
+
});
|
|
88
98
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
DeviceEventEmitter.emit('EventResult', { "eventName": "onStartQrScan" });
|
|
99
|
+
const onStartQrScan = emitter.addListener('onStartQrScan', () => {
|
|
100
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onStartQrScan' });
|
|
92
101
|
});
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
|
|
103
|
+
const onErrorQrScan = emitter.addListener('onErrorQrScan', () => {
|
|
104
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onErrorQrScan' });
|
|
95
105
|
});
|
|
96
106
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
107
|
+
const onSendEvent = emitter.addListener('onSend', () => {
|
|
108
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onSend' });
|
|
109
|
+
});
|
|
100
110
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
111
|
+
const onRetryEvent = emitter.addListener('onRetry', () => {
|
|
112
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onRetry' });
|
|
113
|
+
});
|
|
104
114
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
115
|
+
const onClipPreparationCompleteEvent = emitter.addListener(
|
|
116
|
+
'onClipPreparationComplete',
|
|
117
|
+
() => {
|
|
118
|
+
DeviceEventEmitter.emit('EventResult', {
|
|
119
|
+
eventName: 'onClipPreparationComplete',
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
);
|
|
108
123
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
124
|
+
const onStatusUpdatedEvent = emitter.addListener('onStatusUpdated', () => {
|
|
125
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onStatusUpdated' });
|
|
126
|
+
});
|
|
112
127
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
128
|
+
const onUpdatedEvent = emitter.addListener('onUpdated', () => {
|
|
129
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onUpdated' });
|
|
130
|
+
});
|
|
116
131
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
132
|
+
const onLivenessUpdateEvent = emitter.addListener('onLivenessUpdate', () => {
|
|
133
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onLivenessUpdate' });
|
|
134
|
+
});
|
|
120
135
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
136
|
+
const onCardDetectedEvent = emitter.addListener('onCardDetected', () => {
|
|
137
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onCardDetected' });
|
|
138
|
+
});
|
|
124
139
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
140
|
+
const onMrzExtractedEvent = emitter.addListener('onMrzExtracted', () => {
|
|
141
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onMrzExtracted' });
|
|
142
|
+
});
|
|
128
143
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
144
|
+
const onMrzDetectedEvent = emitter.addListener('onMrzDetected', () => {
|
|
145
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onMrzDetected' });
|
|
146
|
+
});
|
|
132
147
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
148
|
+
const onNoMrzDetectedEvent = emitter.addListener('onNoMrzDetected', () => {
|
|
149
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onNoMrzDetected' });
|
|
150
|
+
});
|
|
136
151
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
152
|
+
const onFaceDetectedEvent = emitter.addListener('onFaceDetected', () => {
|
|
153
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onFaceDetected' });
|
|
154
|
+
});
|
|
140
155
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
156
|
+
const onNoFaceDetectedEvent = emitter.addListener('onNoFaceDetected', () => {
|
|
157
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onNoFaceDetected' });
|
|
158
|
+
});
|
|
144
159
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
160
|
+
const onFaceExtractedEvent = emitter.addListener('onFaceExtracted', () => {
|
|
161
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onFaceExtracted' });
|
|
162
|
+
});
|
|
148
163
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
164
|
+
const onQualityCheckAvailableEvent = emitter.addListener(
|
|
165
|
+
'onQualityCheckAvailable',
|
|
166
|
+
() => {
|
|
167
|
+
DeviceEventEmitter.emit('EventResult', {
|
|
168
|
+
eventName: 'onQualityCheckAvailable',
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
);
|
|
152
172
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
173
|
+
const onDocumentCapturedEvent = emitter.addListener(
|
|
174
|
+
'onDocumentCaptured',
|
|
175
|
+
() => {
|
|
176
|
+
DeviceEventEmitter.emit('EventResult', {
|
|
177
|
+
eventName: 'onDocumentCaptured',
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
);
|
|
156
181
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
182
|
+
const onDocumentCroppedEvent = emitter.addListener(
|
|
183
|
+
'onDocumentCropped',
|
|
184
|
+
() => {
|
|
185
|
+
DeviceEventEmitter.emit('EventResult', {
|
|
186
|
+
eventName: 'onDocumentCropped',
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
);
|
|
160
190
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
191
|
+
const onUploadFailedEvent = emitter.addListener('onUploadFailed', () => {
|
|
192
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onUploadFailed' });
|
|
193
|
+
});
|
|
164
194
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
195
|
+
const onWrongTemplate = emitter.addListener('onWrongTemplate', () => {
|
|
196
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onWrongTemplate' });
|
|
197
|
+
});
|
|
168
198
|
|
|
199
|
+
const onHasTokens = emitter.addListener('onHasTokens', (result) => {
|
|
200
|
+
if (result != null) {
|
|
201
|
+
const response = JSON.parse(
|
|
202
|
+
result?.documentTokens
|
|
203
|
+
) as DocumentTokensModel[];
|
|
169
204
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
});
|
|
205
|
+
DeviceEventEmitter.emit('signingOnHasTokens', {
|
|
206
|
+
documentTokens: response,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
});
|
|
177
210
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
211
|
+
const onCreateUserDocumentInstance = emitter.addListener(
|
|
212
|
+
'onCreateUserDocumentInstance',
|
|
213
|
+
(result) => {
|
|
214
|
+
if (result != null) {
|
|
215
|
+
const response = JSON.parse(
|
|
216
|
+
result?.userDocumentResponseModel
|
|
217
|
+
) as CreateUserDocumentResponseModel;
|
|
218
|
+
|
|
219
|
+
DeviceEventEmitter.emit('signingOnCreateUserDocumentInstance', {
|
|
220
|
+
userDocumentResponseModel: response,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
);
|
|
185
225
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
});
|
|
226
|
+
const onSignature = emitter.addListener('onSignature', (result) => {
|
|
227
|
+
if (result != null) {
|
|
228
|
+
const response = JSON.parse(
|
|
229
|
+
result?.signatureResponseModel
|
|
230
|
+
) as SignatureResponseModel;
|
|
193
231
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
DeviceEventEmitter.emit('SubmitDataEvents',{"Success":true});
|
|
199
|
-
}else{
|
|
200
|
-
DeviceEventEmitter.emit('SubmitDataEvents',{"Success":false});
|
|
201
|
-
}
|
|
202
|
-
}
|
|
232
|
+
DeviceEventEmitter.emit('signingOnSignature', {
|
|
233
|
+
signatureResponseModel: response,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
203
236
|
});
|
|
204
237
|
|
|
238
|
+
const submitResult = emitter.addListener('SubmitResult', (result) => {
|
|
239
|
+
if (result != null) {
|
|
240
|
+
DeviceEventEmitter.emit('SubmitDataEvents', {
|
|
241
|
+
Success: !!result?.success,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
const onNativeFlowCompleted = emitter.addListener('OnNativeFlowCompleted', (result) => {
|
|
247
|
+
if (result?.DataModel) {
|
|
248
|
+
const response = JsonParserFlowCompletedList(result.DataModel);
|
|
249
|
+
DeviceEventEmitter.emit('OnFlowCompleted', {
|
|
250
|
+
dataModel: response,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
});
|
|
205
254
|
|
|
206
255
|
return () => {
|
|
207
256
|
assentifySdkInit.remove();
|
|
208
257
|
onComplete.remove();
|
|
258
|
+
onCompleteQrScan.remove();
|
|
259
|
+
onStartQrScan.remove();
|
|
260
|
+
onErrorQrScan.remove();
|
|
209
261
|
onSendEvent.remove();
|
|
210
262
|
onRetryEvent.remove();
|
|
211
263
|
onClipPreparationCompleteEvent.remove();
|
|
@@ -224,22 +276,19 @@ const AssentifyProvider = () => {
|
|
|
224
276
|
onDocumentCroppedEvent.remove();
|
|
225
277
|
onUploadFailedEvent.remove();
|
|
226
278
|
onWrongTemplate.remove();
|
|
227
|
-
submitResult.remove();
|
|
228
279
|
onHasTokens.remove();
|
|
229
280
|
onCreateUserDocumentInstance.remove();
|
|
230
281
|
onSignature.remove();
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
onErrorQrScan.remove();
|
|
282
|
+
submitResult.remove();
|
|
283
|
+
onNativeFlowCompleted.remove();
|
|
234
284
|
};
|
|
235
|
-
}, [
|
|
236
|
-
]);
|
|
285
|
+
}, []);
|
|
237
286
|
|
|
238
287
|
return (
|
|
239
288
|
<AssentifyContext.Provider value={undefined}>
|
|
289
|
+
{children}
|
|
240
290
|
</AssentifyContext.Provider>
|
|
241
291
|
);
|
|
242
292
|
};
|
|
243
293
|
|
|
244
294
|
export { AssentifyProvider };
|
|
245
|
-
|
package/src/AssentifyWrapper.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NativeModules, Platform, Alert, Linking } from 'react-native';
|
|
2
2
|
import { type LanguageCode } from './Language';
|
|
3
|
-
import { type
|
|
3
|
+
import { type TemplatesByCountry } from './types';
|
|
4
|
+
import { type BackgroundTypeCode } from './BackgroundType';
|
|
4
5
|
|
|
5
6
|
const LINKING_ERROR =
|
|
6
7
|
`The package 'assentify-sdk-react-native-react-native' doesn't seem to be linked. Make sure: \n\n` +
|
|
@@ -30,7 +31,6 @@ const AssentifyWrapper = {
|
|
|
30
31
|
performLivenessFace?: boolean,
|
|
31
32
|
ENV_CustomColor?: string,
|
|
32
33
|
enableDetect?: boolean,
|
|
33
|
-
enableGuide?: boolean,
|
|
34
34
|
androidMotionCardLimit?: number,
|
|
35
35
|
androidMotionPassportLimit?: number,
|
|
36
36
|
iOSMotionCardsLimit?: number,
|
|
@@ -41,12 +41,12 @@ const AssentifyWrapper = {
|
|
|
41
41
|
iOSBrightnessLowThreshold?: number,
|
|
42
42
|
activeLiveType?: String,
|
|
43
43
|
activeLivenessCheckCount?: number,
|
|
44
|
-
retryCount?: number,
|
|
45
44
|
faceLivenessRetryCount?: number,
|
|
46
45
|
minRam?: number,
|
|
47
46
|
iOSMinRam?: number,
|
|
48
47
|
minCPUCores ?: number,
|
|
49
|
-
manualClickColor?: string
|
|
48
|
+
manualClickColor?: string,
|
|
49
|
+
countDownNumbersColor?: string
|
|
50
50
|
) {
|
|
51
51
|
AssentifySdk.initialize(
|
|
52
52
|
apiKey,
|
|
@@ -55,7 +55,6 @@ const AssentifyWrapper = {
|
|
|
55
55
|
performLivenessFace ?? false,
|
|
56
56
|
ENV_CustomColor ?? '#f5a103',
|
|
57
57
|
enableDetect ?? true,
|
|
58
|
-
enableGuide ?? true,
|
|
59
58
|
androidMotionCardLimit?? 10,
|
|
60
59
|
androidMotionPassportLimit?? 15,
|
|
61
60
|
iOSMotionCardsLimit?? 30,
|
|
@@ -66,12 +65,12 @@ const AssentifyWrapper = {
|
|
|
66
65
|
iOSBrightnessLowThreshold?? 50,
|
|
67
66
|
activeLiveType?? "NONE",
|
|
68
67
|
activeLivenessCheckCount??0,
|
|
69
|
-
retryCount??3,
|
|
70
68
|
faceLivenessRetryCount??2,
|
|
71
69
|
minRam??8,
|
|
72
70
|
iOSMinRam??2,
|
|
73
71
|
minCPUCores??6,
|
|
74
|
-
manualClickColor ?? '#f5a103'
|
|
72
|
+
manualClickColor ?? '#f5a103',
|
|
73
|
+
countDownNumbersColor ?? '#f5a103'
|
|
75
74
|
);
|
|
76
75
|
},
|
|
77
76
|
|
|
@@ -86,8 +85,8 @@ const AssentifyWrapper = {
|
|
|
86
85
|
},
|
|
87
86
|
|
|
88
87
|
/// ID
|
|
89
|
-
startScanIDCard: function (
|
|
90
|
-
AssentifySdk.startScanIDPage(JSON.stringify(
|
|
88
|
+
startScanIDCard: function (templatesByCountryObject: TemplatesByCountry,language: LanguageCode,flippingCard: boolean,stepID :number){
|
|
89
|
+
AssentifySdk.startScanIDPage(JSON.stringify(templatesByCountryObject),language,flippingCard,stepID);
|
|
91
90
|
},
|
|
92
91
|
|
|
93
92
|
/// Face Match
|
|
@@ -96,33 +95,62 @@ const AssentifyWrapper = {
|
|
|
96
95
|
},
|
|
97
96
|
|
|
98
97
|
|
|
99
|
-
/// Context Aware Signing
|
|
100
|
-
startContextAwareSigning: function (){
|
|
101
|
-
AssentifySdk.startContextAwareSigning();
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
/// Qr
|
|
105
|
-
startScanQr: function (kycDocumentDetailsList: KycDocumentDetails[],language: LanguageCode,stepID :number){
|
|
106
|
-
AssentifySdk.startScanQrPage(JSON.stringify(kycDocumentDetailsList),language,stepID);
|
|
107
|
-
},
|
|
108
98
|
|
|
109
|
-
createUserDocumentInstance: function (dataMap:Record<string, string>){
|
|
110
|
-
AssentifySdk.createUserDocumentInstance(dataMap);
|
|
111
|
-
},
|
|
112
99
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
100
|
+
startScanQr: function (templatesByCountryObject: TemplatesByCountry,language: LanguageCode,stepID :number){
|
|
101
|
+
AssentifySdk.startScanQrPage(JSON.stringify(templatesByCountryObject),language,stepID);
|
|
102
|
+
},
|
|
116
103
|
|
|
117
104
|
|
|
118
105
|
/// Submit Data
|
|
119
106
|
submitData: function (dataMap:Record<string, string> ){
|
|
120
107
|
AssentifySdk.submitData(dataMap);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
108
|
+
},
|
|
124
109
|
|
|
125
110
|
|
|
111
|
+
/// Flow
|
|
112
|
+
|
|
113
|
+
startFlow: function (
|
|
114
|
+
logoUrl?: string,
|
|
115
|
+
svgBackgroundImageUrl?: string,
|
|
116
|
+
textColor?: string,
|
|
117
|
+
secondaryTextColor?: string,
|
|
118
|
+
backgroundCardColor?: string,
|
|
119
|
+
accentColor?: string,
|
|
120
|
+
backgroundColors?: string[],
|
|
121
|
+
clickColors?: string[],
|
|
122
|
+
angleDegreesBackgroundColors?: number,
|
|
123
|
+
holdUntilBackgroundColors?: number,
|
|
124
|
+
angleDegreesClickColors?: number,
|
|
125
|
+
holdUntilClickColors?: number,
|
|
126
|
+
backgroundType?: BackgroundTypeCode,
|
|
127
|
+
clear?: boolean,
|
|
128
|
+
language?: LanguageCode,
|
|
129
|
+
enableNfc?: boolean,
|
|
130
|
+
enableQr?: boolean,
|
|
131
|
+
blockLoaderCustomProperties?:Record<string, string>
|
|
132
|
+
) {
|
|
133
|
+
AssentifySdk.startFlow(
|
|
134
|
+
logoUrl ?? "",
|
|
135
|
+
svgBackgroundImageUrl ?? "",
|
|
136
|
+
textColor ?? "",
|
|
137
|
+
secondaryTextColor ?? "",
|
|
138
|
+
backgroundCardColor ?? "",
|
|
139
|
+
accentColor ?? "",
|
|
140
|
+
backgroundColors ?? [],
|
|
141
|
+
clickColors ?? [],
|
|
142
|
+
angleDegreesBackgroundColors ?? 90.0,
|
|
143
|
+
holdUntilBackgroundColors ?? 0.4,
|
|
144
|
+
angleDegreesClickColors ?? 90.0,
|
|
145
|
+
holdUntilClickColors ?? 0.4,
|
|
146
|
+
backgroundType,
|
|
147
|
+
clear,
|
|
148
|
+
language ?? "NON",
|
|
149
|
+
enableNfc ?? false,
|
|
150
|
+
enableQr ?? false,
|
|
151
|
+
JSON.stringify(blockLoaderCustomProperties ?? {})
|
|
152
|
+
);
|
|
153
|
+
},
|
|
126
154
|
|
|
127
155
|
};
|
|
128
156
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { FlowCompletedModel, SubmitRequestModel } from '../../types';
|
|
2
|
+
|
|
3
|
+
const JsonParserFlowCompletedList = (
|
|
4
|
+
jsonString: string,
|
|
5
|
+
): FlowCompletedModel[] => {
|
|
6
|
+
const jsonArray = JSON.parse(jsonString ?? '[]');
|
|
7
|
+
|
|
8
|
+
if (!Array.isArray(jsonArray)) {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return jsonArray.map((item): FlowCompletedModel => {
|
|
13
|
+
const submitRequestModel = item?.submitRequestModel
|
|
14
|
+
? ({
|
|
15
|
+
stepId:
|
|
16
|
+
item.submitRequestModel?.stepId != null
|
|
17
|
+
? Number(item.submitRequestModel.stepId)
|
|
18
|
+
: undefined,
|
|
19
|
+
stepDefinition: item.submitRequestModel?.stepDefinition,
|
|
20
|
+
extractedInformation: item.submitRequestModel?.extractedInformation,
|
|
21
|
+
} as SubmitRequestModel)
|
|
22
|
+
: undefined;
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
stepData: (item?.stepData ?? {}) as Record<string, string>,
|
|
26
|
+
submitRequestModel,
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default JsonParserFlowCompletedList;
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,6 @@ import AssentifyWrapper from './AssentifyWrapper';
|
|
|
3
3
|
export * from './types';
|
|
4
4
|
export * from './Language';
|
|
5
5
|
export * from './ActiveLiveType';
|
|
6
|
-
export * from './
|
|
6
|
+
export * from './BackgroundType';
|
|
7
7
|
export const Assentify = AssentifyWrapper;
|
|
8
8
|
export * from './AssentifyProvider';
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type LanguageCode } from './Language';
|
|
2
|
+
import { type BackgroundTypeCode } from './BackgroundType';
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
export interface AssentifySdkCallback {
|
|
@@ -41,9 +42,9 @@ export interface Assentify {
|
|
|
41
42
|
) => void;
|
|
42
43
|
|
|
43
44
|
|
|
44
|
-
startScanIDCard:(
|
|
45
|
+
startScanIDCard:(templatesByCountryObject :TemplatesByCountry,language: LanguageCode,flippingCard: boolean) => void;
|
|
45
46
|
|
|
46
|
-
startScanQr:(
|
|
47
|
+
startScanQr:(templatesByCountryObject: TemplatesByCountry,language: LanguageCode) => void;
|
|
47
48
|
|
|
48
49
|
startFaceMatch: (
|
|
49
50
|
imageUrl: String,
|
|
@@ -408,3 +409,13 @@ export type StepDefinitions = {
|
|
|
408
409
|
stepDefinition: string;
|
|
409
410
|
};
|
|
410
411
|
|
|
412
|
+
export type SubmitRequestModel = {
|
|
413
|
+
stepId?: number;
|
|
414
|
+
stepDefinition?: string;
|
|
415
|
+
extractedInformation?: Record<string, any>;
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
export type FlowCompletedModel = {
|
|
419
|
+
stepData: Record<string, string>;
|
|
420
|
+
submitRequestModel?: SubmitRequestModel;
|
|
421
|
+
};
|