assentify-sdk-react-native 1.0.0-Beta.4 → 1.0.0-Beta.41
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/Package.swift +172 -0
- package/README.md +124 -32
- package/android/build.gradle +1 -6
- package/android/src/main/java/com/assentifysdk/AssentifySdkModule.kt +48 -9
- package/android/src/main/java/com/assentifysdk/FlowActivity.kt +75 -7
- package/android/src/main/java/com/assentifysdk/ScanIDActivity.kt +67 -6
- package/android/src/main/java/com/assentifysdk/ScanPassportActivity.kt +53 -1
- package/android/src/main/res/layout/activity_scan.xml +45 -57
- package/ios/AssentifySdkBaseModule.swift +1 -0
- package/ios/NativeAssentifySdk.mm +19 -2
- package/ios/NativeAssentifySdk.swift +151 -25
- package/ios/UIComponents/RNPassportScanner.swift +4 -3
- package/ios/View/AssentifySdkEventEmitting.swift +10 -0
- package/ios/View/DataDecoder.swift +16 -16
- package/ios/View/FaceMatchController.swift +51 -51
- package/ios/View/IDCardController.swift +93 -37
- package/ios/View/OtherController.swift +33 -33
- package/ios/View/PassportController.swift +84 -36
- package/ios/View/QrController.swift +10 -10
- package/ios/View/UI.swift +77 -26
- package/lib/commonjs/AssentifyProvider.js +3 -0
- package/lib/commonjs/AssentifyProvider.js.map +1 -1
- package/lib/commonjs/AssentifyWrapper.js +4 -4
- package/lib/commonjs/AssentifyWrapper.js.map +1 -1
- package/lib/commonjs/ClickFontWeightType.js +14 -0
- package/lib/commonjs/ClickFontWeightType.js.map +1 -0
- package/lib/commonjs/FlowStepperType.js +11 -0
- package/lib/commonjs/FlowStepperType.js.map +1 -0
- package/lib/commonjs/Language.js +5 -1
- package/lib/commonjs/Language.js.map +1 -1
- package/lib/commonjs/ValidationStyleType.js +11 -0
- package/lib/commonjs/ValidationStyleType.js.map +1 -0
- package/lib/commonjs/index.js +36 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/AssentifyProvider.js +4 -0
- package/lib/module/AssentifyProvider.js.map +1 -1
- package/lib/module/AssentifyWrapper.js +4 -4
- package/lib/module/AssentifyWrapper.js.map +1 -1
- package/lib/module/ClickFontWeightType.js +8 -0
- package/lib/module/ClickFontWeightType.js.map +1 -0
- package/lib/module/FlowStepperType.js +5 -0
- package/lib/module/FlowStepperType.js.map +1 -0
- package/lib/module/Language.js +4 -0
- package/lib/module/Language.js.map +1 -1
- package/lib/module/ValidationStyleType.js +5 -0
- package/lib/module/ValidationStyleType.js.map +1 -0
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/babel.config.d.ts +0 -1
- package/lib/typescript/example/babel.config.d.ts +36 -5
- package/lib/typescript/example/babel.config.d.ts.map +1 -1
- package/lib/typescript/example/metro.config.d.ts +9 -1
- package/lib/typescript/example/metro.config.d.ts.map +1 -1
- package/lib/typescript/example/react-native.config.d.ts +34 -3
- 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.map +1 -1
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts +2 -2
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/ClickFontWeightType.d.ts +9 -0
- package/lib/typescript/lib/commonjs/ClickFontWeightType.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/FlowStepperType.d.ts +6 -0
- package/lib/typescript/lib/commonjs/FlowStepperType.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Language.d.ts +6 -0
- package/lib/typescript/lib/commonjs/ValidationStyleType.d.ts +6 -0
- package/lib/typescript/lib/commonjs/ValidationStyleType.d.ts.map +1 -0
- package/lib/typescript/lib/module/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts +2 -2
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/lib/module/ClickFontWeightType.d.ts +8 -0
- package/lib/typescript/lib/module/ClickFontWeightType.d.ts.map +1 -0
- package/lib/typescript/lib/module/FlowStepperType.d.ts +5 -0
- package/lib/typescript/lib/module/FlowStepperType.d.ts.map +1 -0
- package/lib/typescript/lib/module/Language.d.ts +6 -0
- package/lib/typescript/lib/module/ValidationStyleType.d.ts +5 -0
- package/lib/typescript/lib/module/ValidationStyleType.d.ts.map +1 -0
- package/lib/typescript/lib/module/index.d.ts +5 -2
- package/lib/typescript/lib/module/index.d.ts.map +1 -1
- package/lib/typescript/src/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/src/AssentifyWrapper.d.ts +6 -2
- package/lib/typescript/src/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/src/ClickFontWeightType.d.ts +9 -0
- package/lib/typescript/src/ClickFontWeightType.d.ts.map +1 -0
- package/lib/typescript/src/FlowStepperType.d.ts +6 -0
- package/lib/typescript/src/FlowStepperType.d.ts.map +1 -0
- package/lib/typescript/src/Language.d.ts +5 -0
- package/lib/typescript/src/Language.d.ts.map +1 -1
- package/lib/typescript/src/ValidationStyleType.d.ts +6 -0
- package/lib/typescript/src/ValidationStyleType.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +5 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +63 -10
- package/src/AssentifyProvider.tsx +341 -305
- package/src/AssentifyWrapper.ts +47 -6
- package/src/ClickFontWeightType.ts +10 -0
- package/src/FlowStepperType.ts +7 -0
- package/src/Language.ts +7 -0
- package/src/ValidationStyleType.ts +7 -0
- package/src/index.ts +3 -0
- package/src/types.ts +1 -0
- package/assentify-sdk.podspec +0 -44
- package/lib/typescript/example/src/navigator.d.ts +0 -4
- package/lib/typescript/example/src/navigator.d.ts.map +0 -1
|
@@ -1,305 +1,341 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
type
|
|
11
|
-
type
|
|
12
|
-
type
|
|
13
|
-
type
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
DeviceEventEmitter.emit('EventResult', { eventName: '
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
'
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const
|
|
137
|
-
DeviceEventEmitter.emit('EventResult', { eventName: '
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
DeviceEventEmitter.emit('EventResult', { eventName: '
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
'
|
|
175
|
-
() => {
|
|
176
|
-
DeviceEventEmitter.emit('EventResult', {
|
|
177
|
-
eventName: '
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
const
|
|
183
|
-
'
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
1
|
+
import {
|
|
2
|
+
NativeModules,
|
|
3
|
+
NativeEventEmitter,
|
|
4
|
+
DeviceEventEmitter,
|
|
5
|
+
LogBox,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import {
|
|
9
|
+
type TemplatesByCountry,
|
|
10
|
+
type StepDefinitions,
|
|
11
|
+
type DocumentTokensModel,
|
|
12
|
+
type CreateUserDocumentResponseModel,
|
|
13
|
+
type SignatureResponseModel,
|
|
14
|
+
} from './types';
|
|
15
|
+
|
|
16
|
+
import JsonParserPassport from './helpers/parsers/PassportParser';
|
|
17
|
+
import JsonParserFaceMatch from './helpers/parsers/FaceMatchParser';
|
|
18
|
+
import JsonParserIdCard from './helpers/parsers/IDCardParser';
|
|
19
|
+
import JsonParserOtherID from './helpers/parsers/OtherIDParser';
|
|
20
|
+
import JsonParserFlowCompletedList from './helpers/parsers/FlowCompletedModelParser';
|
|
21
|
+
|
|
22
|
+
// NativeEventEmitter payloads come from native (Kotlin/Swift) code and have
|
|
23
|
+
// no static shape on the JS side; fields are narrowed ad hoc below.
|
|
24
|
+
type NativeSdkEventPayload = Record<string, any>;
|
|
25
|
+
|
|
26
|
+
const { NativeAssentifySdk } = NativeModules;
|
|
27
|
+
|
|
28
|
+
const AssentifyContext = React.createContext<undefined>(undefined);
|
|
29
|
+
|
|
30
|
+
LogBox.ignoreAllLogs();
|
|
31
|
+
|
|
32
|
+
type AssentifyProviderProps = {
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const AssentifyProvider = ({ children }: AssentifyProviderProps) => {
|
|
37
|
+
React.useEffect(() => {
|
|
38
|
+
const emitter = new NativeEventEmitter(NativeAssentifySdk);
|
|
39
|
+
|
|
40
|
+
const assentifySdkInit = emitter.addListener(
|
|
41
|
+
'AppResult',
|
|
42
|
+
(result: NativeSdkEventPayload) => {
|
|
43
|
+
if (result?.assentifySdkInitSuccess != null) {
|
|
44
|
+
if (result.assentifySdkInitSuccess) {
|
|
45
|
+
const templates = JSON.parse(
|
|
46
|
+
result?.AssentifySdkHasTemplates
|
|
47
|
+
) as TemplatesByCountry[];
|
|
48
|
+
|
|
49
|
+
const stepDefinitions = JSON.parse(
|
|
50
|
+
result?.StepDefinitions
|
|
51
|
+
) as StepDefinitions[];
|
|
52
|
+
|
|
53
|
+
DeviceEventEmitter.emit('assentifySdkInit', {
|
|
54
|
+
status: true,
|
|
55
|
+
templates,
|
|
56
|
+
stepDefinitions,
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
DeviceEventEmitter.emit('assentifySdkInit', {
|
|
60
|
+
status: false,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const onComplete = emitter.addListener(
|
|
68
|
+
'onComplete',
|
|
69
|
+
(result: NativeSdkEventPayload) => {
|
|
70
|
+
if (result?.PassportDataModel) {
|
|
71
|
+
const response = JsonParserPassport(result.PassportDataModel);
|
|
72
|
+
DeviceEventEmitter.emit('onCompletePassport', {
|
|
73
|
+
passportExtractedModel: response,
|
|
74
|
+
});
|
|
75
|
+
} else if (result?.FaceMatchDataModel) {
|
|
76
|
+
const response = JsonParserFaceMatch(result.FaceMatchDataModel);
|
|
77
|
+
DeviceEventEmitter.emit('onCompleteFaceMatch', {
|
|
78
|
+
faceExtractedModel: response,
|
|
79
|
+
});
|
|
80
|
+
} else if (result?.IdDataModel) {
|
|
81
|
+
const response = JsonParserIdCard(result.IdDataModel);
|
|
82
|
+
const isFrontPage = result?.isFrontPage as boolean | undefined;
|
|
83
|
+
const isLastPage = result?.isLastPage as boolean | undefined;
|
|
84
|
+
|
|
85
|
+
DeviceEventEmitter.emit('onCompleteIDCard', {
|
|
86
|
+
iDExtractedModel: response,
|
|
87
|
+
isFrontPage,
|
|
88
|
+
isLastPage,
|
|
89
|
+
});
|
|
90
|
+
} else if (result?.OtherDataModel) {
|
|
91
|
+
const response = JsonParserOtherID(result.OtherDataModel);
|
|
92
|
+
DeviceEventEmitter.emit('onCompleteOther', {
|
|
93
|
+
otherExtractedModel: response,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const onCompleteQrScan = emitter.addListener(
|
|
100
|
+
'onCompleteQrScan',
|
|
101
|
+
(result: NativeSdkEventPayload) => {
|
|
102
|
+
if (result?.IdQrDataModel) {
|
|
103
|
+
const response = JsonParserIdCard(result.IdQrDataModel);
|
|
104
|
+
DeviceEventEmitter.emit('onCompleteQr', {
|
|
105
|
+
iDExtractedModel: response,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const onStartQrScan = emitter.addListener('onStartQrScan', () => {
|
|
112
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onStartQrScan' });
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const onErrorQrScan = emitter.addListener('onErrorQrScan', () => {
|
|
116
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onErrorQrScan' });
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const onSendEvent = emitter.addListener('onSend', () => {
|
|
120
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onSend' });
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const onRetryEvent = emitter.addListener('onRetry', () => {
|
|
124
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onRetry' });
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const onClipPreparationCompleteEvent = emitter.addListener(
|
|
128
|
+
'onClipPreparationComplete',
|
|
129
|
+
() => {
|
|
130
|
+
DeviceEventEmitter.emit('EventResult', {
|
|
131
|
+
eventName: 'onClipPreparationComplete',
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
const onStatusUpdatedEvent = emitter.addListener('onStatusUpdated', () => {
|
|
137
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onStatusUpdated' });
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const onUpdatedEvent = emitter.addListener('onUpdated', () => {
|
|
141
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onUpdated' });
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
const onLivenessUpdateEvent = emitter.addListener(
|
|
145
|
+
'onLivenessUpdate',
|
|
146
|
+
() => {
|
|
147
|
+
DeviceEventEmitter.emit('EventResult', {
|
|
148
|
+
eventName: 'onLivenessUpdate',
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
const onCardDetectedEvent = emitter.addListener('onCardDetected', () => {
|
|
154
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onCardDetected' });
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
const onMrzExtractedEvent = emitter.addListener('onMrzExtracted', () => {
|
|
158
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onMrzExtracted' });
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const onMrzDetectedEvent = emitter.addListener('onMrzDetected', () => {
|
|
162
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onMrzDetected' });
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
const onNoMrzDetectedEvent = emitter.addListener('onNoMrzDetected', () => {
|
|
166
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onNoMrzDetected' });
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const onFaceDetectedEvent = emitter.addListener('onFaceDetected', () => {
|
|
170
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onFaceDetected' });
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
const onNoFaceDetectedEvent = emitter.addListener(
|
|
174
|
+
'onNoFaceDetected',
|
|
175
|
+
() => {
|
|
176
|
+
DeviceEventEmitter.emit('EventResult', {
|
|
177
|
+
eventName: 'onNoFaceDetected',
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
const onFaceExtractedEvent = emitter.addListener('onFaceExtracted', () => {
|
|
183
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onFaceExtracted' });
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
const onQualityCheckAvailableEvent = emitter.addListener(
|
|
187
|
+
'onQualityCheckAvailable',
|
|
188
|
+
() => {
|
|
189
|
+
DeviceEventEmitter.emit('EventResult', {
|
|
190
|
+
eventName: 'onQualityCheckAvailable',
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
const onDocumentCapturedEvent = emitter.addListener(
|
|
196
|
+
'onDocumentCaptured',
|
|
197
|
+
() => {
|
|
198
|
+
DeviceEventEmitter.emit('EventResult', {
|
|
199
|
+
eventName: 'onDocumentCaptured',
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
const onDocumentCroppedEvent = emitter.addListener(
|
|
205
|
+
'onDocumentCropped',
|
|
206
|
+
() => {
|
|
207
|
+
DeviceEventEmitter.emit('EventResult', {
|
|
208
|
+
eventName: 'onDocumentCropped',
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
const onUploadFailedEvent = emitter.addListener('onUploadFailed', () => {
|
|
214
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onUploadFailed' });
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
const onWrongTemplate = emitter.addListener('onWrongTemplate', () => {
|
|
218
|
+
DeviceEventEmitter.emit('EventResult', { eventName: 'onWrongTemplate' });
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
const onHasTokens = emitter.addListener(
|
|
222
|
+
'onHasTokens',
|
|
223
|
+
(result: NativeSdkEventPayload) => {
|
|
224
|
+
if (result != null) {
|
|
225
|
+
const response = JSON.parse(
|
|
226
|
+
result?.documentTokens
|
|
227
|
+
) as DocumentTokensModel[];
|
|
228
|
+
|
|
229
|
+
DeviceEventEmitter.emit('signingOnHasTokens', {
|
|
230
|
+
documentTokens: response,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
const onCreateUserDocumentInstance = emitter.addListener(
|
|
237
|
+
'onCreateUserDocumentInstance',
|
|
238
|
+
(result: NativeSdkEventPayload) => {
|
|
239
|
+
if (result != null) {
|
|
240
|
+
const response = JSON.parse(
|
|
241
|
+
result?.userDocumentResponseModel
|
|
242
|
+
) as CreateUserDocumentResponseModel;
|
|
243
|
+
|
|
244
|
+
DeviceEventEmitter.emit('signingOnCreateUserDocumentInstance', {
|
|
245
|
+
userDocumentResponseModel: response,
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
const onSignature = emitter.addListener(
|
|
252
|
+
'onSignature',
|
|
253
|
+
(result: NativeSdkEventPayload) => {
|
|
254
|
+
if (result != null) {
|
|
255
|
+
const response = JSON.parse(
|
|
256
|
+
result?.signatureResponseModel
|
|
257
|
+
) as SignatureResponseModel;
|
|
258
|
+
|
|
259
|
+
DeviceEventEmitter.emit('signingOnSignature', {
|
|
260
|
+
signatureResponseModel: response,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
const submitResult = emitter.addListener(
|
|
267
|
+
'SubmitResult',
|
|
268
|
+
(result: NativeSdkEventPayload) => {
|
|
269
|
+
if (result != null) {
|
|
270
|
+
DeviceEventEmitter.emit('SubmitDataEvents', {
|
|
271
|
+
Success: !!result?.success,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
);
|
|
276
|
+
|
|
277
|
+
const onNativeFlowCompleted = emitter.addListener(
|
|
278
|
+
'OnNativeFlowCompleted',
|
|
279
|
+
(result: NativeSdkEventPayload) => {
|
|
280
|
+
if (result?.DataModel) {
|
|
281
|
+
const response = JsonParserFlowCompletedList(result.DataModel);
|
|
282
|
+
DeviceEventEmitter.emit('OnFlowCompleted', {
|
|
283
|
+
dataModel: response,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
);
|
|
288
|
+
|
|
289
|
+
const onNativeStepCompleted = emitter.addListener(
|
|
290
|
+
'OnNativeStepCompleted',
|
|
291
|
+
(result: NativeSdkEventPayload) => {
|
|
292
|
+
if (result?.DataModel) {
|
|
293
|
+
const response = JsonParserFlowCompletedList(result.DataModel);
|
|
294
|
+
DeviceEventEmitter.emit('OnStepCompleted', {
|
|
295
|
+
dataModel: response,
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
return () => {
|
|
302
|
+
assentifySdkInit.remove();
|
|
303
|
+
onComplete.remove();
|
|
304
|
+
onCompleteQrScan.remove();
|
|
305
|
+
onStartQrScan.remove();
|
|
306
|
+
onErrorQrScan.remove();
|
|
307
|
+
onSendEvent.remove();
|
|
308
|
+
onRetryEvent.remove();
|
|
309
|
+
onClipPreparationCompleteEvent.remove();
|
|
310
|
+
onStatusUpdatedEvent.remove();
|
|
311
|
+
onUpdatedEvent.remove();
|
|
312
|
+
onLivenessUpdateEvent.remove();
|
|
313
|
+
onCardDetectedEvent.remove();
|
|
314
|
+
onMrzExtractedEvent.remove();
|
|
315
|
+
onMrzDetectedEvent.remove();
|
|
316
|
+
onNoMrzDetectedEvent.remove();
|
|
317
|
+
onFaceDetectedEvent.remove();
|
|
318
|
+
onNoFaceDetectedEvent.remove();
|
|
319
|
+
onFaceExtractedEvent.remove();
|
|
320
|
+
onQualityCheckAvailableEvent.remove();
|
|
321
|
+
onDocumentCapturedEvent.remove();
|
|
322
|
+
onDocumentCroppedEvent.remove();
|
|
323
|
+
onUploadFailedEvent.remove();
|
|
324
|
+
onWrongTemplate.remove();
|
|
325
|
+
onHasTokens.remove();
|
|
326
|
+
onCreateUserDocumentInstance.remove();
|
|
327
|
+
onSignature.remove();
|
|
328
|
+
submitResult.remove();
|
|
329
|
+
onNativeFlowCompleted.remove();
|
|
330
|
+
onNativeStepCompleted.remove();
|
|
331
|
+
};
|
|
332
|
+
}, []);
|
|
333
|
+
|
|
334
|
+
return (
|
|
335
|
+
<AssentifyContext.Provider value={undefined}>
|
|
336
|
+
{children}
|
|
337
|
+
</AssentifyContext.Provider>
|
|
338
|
+
);
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
export { AssentifyProvider };
|