omnipay-reactnative-sdk 1.2.2-beta.4 → 1.2.2-beta.7

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 (135) hide show
  1. package/README.md +93 -43
  2. package/android/build.gradle +16 -15
  3. package/android/src/main/AndroidManifest.xml +1 -1
  4. package/android/src/main/java/com/omniretail/omnipay/OmnipayActivityPackage.java +2 -2
  5. package/android/src/main/java/com/omniretail/omnipay/OmnipayLivenessCameraView.java +153 -0
  6. package/android/src/main/java/com/omniretail/omnipay/OmnipayLivenessCameraViewManager.java +49 -0
  7. package/android/src/main/java/com/omniretail/omnipay/OmnipayLivenessModule.java +557 -0
  8. package/ios/OmnipayLivenessCameraView.h +15 -0
  9. package/ios/OmnipayLivenessCameraView.m +80 -0
  10. package/ios/OmnipayLivenessCameraViewManager.m +19 -0
  11. package/ios/OmnipayLivenessModule.h +38 -0
  12. package/ios/OmnipayLivenessModule.m +574 -0
  13. package/lib/commonjs/components/OmnipayProvider.js +2 -66
  14. package/lib/commonjs/components/OmnipayProvider.js.map +1 -1
  15. package/lib/commonjs/components/OmnipayView.js.map +1 -1
  16. package/lib/commonjs/components/biometrics/FaceVerification.js +252 -345
  17. package/lib/commonjs/components/biometrics/FaceVerification.js.map +1 -1
  18. package/lib/commonjs/components/biometrics/LivenessDetection.js +90 -198
  19. package/lib/commonjs/components/biometrics/LivenessDetection.js.map +1 -1
  20. package/lib/commonjs/components/biometrics/OmnipayLivenessCameraView.js +15 -0
  21. package/lib/commonjs/components/biometrics/OmnipayLivenessCameraView.js.map +1 -0
  22. package/lib/commonjs/components/biometrics/PermissionManager.js +279 -0
  23. package/lib/commonjs/components/biometrics/PermissionManager.js.map +1 -0
  24. package/lib/commonjs/components/biometrics/index.js +45 -0
  25. package/lib/commonjs/components/biometrics/index.js.map +1 -0
  26. package/lib/commonjs/components/biometrics/types.js +17 -0
  27. package/lib/commonjs/components/biometrics/types.js.map +1 -0
  28. package/lib/commonjs/components/views/BvnVerification.js.map +1 -1
  29. package/lib/commonjs/components/views/PaylaterAgreement.js.map +1 -1
  30. package/lib/commonjs/components/views/Registration.js.map +1 -1
  31. package/lib/commonjs/index.js +23 -18
  32. package/lib/commonjs/index.js.map +1 -1
  33. package/lib/module/components/OmnipayProvider.js +3 -67
  34. package/lib/module/components/OmnipayProvider.js.map +1 -1
  35. package/lib/module/components/OmnipayView.js.map +1 -1
  36. package/lib/module/components/biometrics/FaceVerification.js +254 -346
  37. package/lib/module/components/biometrics/FaceVerification.js.map +1 -1
  38. package/lib/module/components/biometrics/LivenessDetection.js +75 -197
  39. package/lib/module/components/biometrics/LivenessDetection.js.map +1 -1
  40. package/lib/module/components/biometrics/OmnipayLivenessCameraView.js +7 -0
  41. package/lib/module/components/biometrics/OmnipayLivenessCameraView.js.map +1 -0
  42. package/lib/module/components/biometrics/PermissionManager.js +272 -0
  43. package/lib/module/components/biometrics/PermissionManager.js.map +1 -0
  44. package/lib/module/components/biometrics/index.js +12 -0
  45. package/lib/module/components/biometrics/index.js.map +1 -0
  46. package/lib/module/components/biometrics/types.js +16 -0
  47. package/lib/module/components/biometrics/types.js.map +1 -0
  48. package/lib/module/components/views/BvnVerification.js.map +1 -1
  49. package/lib/module/components/views/PaylaterAgreement.js.map +1 -1
  50. package/lib/module/components/views/Registration.js.map +1 -1
  51. package/lib/module/index.js +5 -4
  52. package/lib/module/index.js.map +1 -1
  53. package/lib/typescript/{src/components → components}/OmnipayProvider.d.ts +1 -1
  54. package/lib/typescript/components/OmnipayProvider.d.ts.map +1 -0
  55. package/lib/typescript/{src/components → components}/OmnipayView.d.ts +21 -20
  56. package/lib/typescript/components/OmnipayView.d.ts.map +1 -0
  57. package/lib/typescript/components/biometrics/FaceVerification.d.ts +11 -0
  58. package/lib/typescript/components/biometrics/FaceVerification.d.ts.map +1 -0
  59. package/lib/typescript/components/biometrics/LivenessDetection.d.ts +33 -0
  60. package/lib/typescript/components/biometrics/LivenessDetection.d.ts.map +1 -0
  61. package/lib/typescript/components/biometrics/OmnipayLivenessCameraView.d.ts +18 -0
  62. package/lib/typescript/components/biometrics/OmnipayLivenessCameraView.d.ts.map +1 -0
  63. package/lib/typescript/components/biometrics/PermissionManager.d.ts +58 -0
  64. package/lib/typescript/components/biometrics/PermissionManager.d.ts.map +1 -0
  65. package/lib/typescript/components/biometrics/index.d.ts +5 -0
  66. package/lib/typescript/components/biometrics/index.d.ts.map +1 -0
  67. package/lib/typescript/components/biometrics/types.d.ts +73 -0
  68. package/lib/typescript/components/biometrics/types.d.ts.map +1 -0
  69. package/lib/typescript/{src/components → components}/views/BvnVerification.d.ts +2 -1
  70. package/lib/typescript/components/views/BvnVerification.d.ts.map +1 -0
  71. package/lib/typescript/{src/components → components}/views/PaylaterAgreement.d.ts +2 -1
  72. package/lib/typescript/components/views/PaylaterAgreement.d.ts.map +1 -0
  73. package/lib/typescript/{src/components → components}/views/Registration.d.ts +2 -1
  74. package/lib/typescript/components/views/Registration.d.ts.map +1 -0
  75. package/lib/typescript/functions.d.ts.map +1 -0
  76. package/lib/typescript/hooks/useOmnipay.d.ts +28 -0
  77. package/lib/typescript/hooks/useOmnipay.d.ts.map +1 -0
  78. package/lib/typescript/index.d.ts +7 -0
  79. package/lib/typescript/index.d.ts.map +1 -0
  80. package/lib/typescript/lib/colors.d.ts.map +1 -0
  81. package/lib/typescript/lib/config.d.ts.map +1 -0
  82. package/omnipay-reactnative-sdk.podspec +32 -29
  83. package/package.json +15 -10
  84. package/src/components/OmnipayProvider.tsx +3 -106
  85. package/src/components/OmnipayView.tsx +1 -1
  86. package/src/components/biometrics/FaceVerification.tsx +291 -368
  87. package/src/components/biometrics/LivenessDetection.ts +113 -250
  88. package/src/components/biometrics/OmnipayLivenessCameraView.tsx +19 -0
  89. package/src/components/biometrics/PermissionManager.ts +317 -0
  90. package/src/components/biometrics/index.ts +11 -0
  91. package/src/components/biometrics/types.ts +86 -0
  92. package/src/components/views/BvnVerification.tsx +1 -1
  93. package/src/components/views/PaylaterAgreement.tsx +1 -1
  94. package/src/components/views/Registration.tsx +1 -1
  95. package/src/index.tsx +4 -15
  96. package/android/src/main/java/com/omniretail/omnipay/LivenessCameraViewManager.java +0 -116
  97. package/android/src/main/java/com/omniretail/omnipay/LivenessDetectionModule.java +0 -588
  98. package/ios/LivenessCameraView.h +0 -22
  99. package/ios/LivenessCameraView.m +0 -135
  100. package/ios/LivenessCameraViewManager.h +0 -12
  101. package/ios/LivenessCameraViewManager.m +0 -24
  102. package/ios/LivenessDetectionModule.h +0 -46
  103. package/ios/LivenessDetectionModule.m +0 -603
  104. package/lib/commonjs/components/biometrics/LivenessCameraView.js +0 -45
  105. package/lib/commonjs/components/biometrics/LivenessCameraView.js.map +0 -1
  106. package/lib/module/components/biometrics/LivenessCameraView.js +0 -39
  107. package/lib/module/components/biometrics/LivenessCameraView.js.map +0 -1
  108. package/lib/typescript/demo/src/App.d.ts +0 -3
  109. package/lib/typescript/demo/src/App.d.ts.map +0 -1
  110. package/lib/typescript/demo/src/Body.d.ts +0 -3
  111. package/lib/typescript/demo/src/Body.d.ts.map +0 -1
  112. package/lib/typescript/demo/src/NotificationsExample.d.ts +0 -4
  113. package/lib/typescript/demo/src/NotificationsExample.d.ts.map +0 -1
  114. package/lib/typescript/src/components/OmnipayProvider.d.ts.map +0 -1
  115. package/lib/typescript/src/components/OmnipayView.d.ts.map +0 -1
  116. package/lib/typescript/src/components/biometrics/FaceVerification.d.ts +0 -12
  117. package/lib/typescript/src/components/biometrics/FaceVerification.d.ts.map +0 -1
  118. package/lib/typescript/src/components/biometrics/LivenessCameraView.d.ts +0 -22
  119. package/lib/typescript/src/components/biometrics/LivenessCameraView.d.ts.map +0 -1
  120. package/lib/typescript/src/components/biometrics/LivenessDetection.d.ts +0 -73
  121. package/lib/typescript/src/components/biometrics/LivenessDetection.d.ts.map +0 -1
  122. package/lib/typescript/src/components/views/BvnVerification.d.ts.map +0 -1
  123. package/lib/typescript/src/components/views/PaylaterAgreement.d.ts.map +0 -1
  124. package/lib/typescript/src/components/views/Registration.d.ts.map +0 -1
  125. package/lib/typescript/src/functions.d.ts.map +0 -1
  126. package/lib/typescript/src/hooks/useOmnipay.d.ts +0 -28
  127. package/lib/typescript/src/hooks/useOmnipay.d.ts.map +0 -1
  128. package/lib/typescript/src/index.d.ts +0 -8
  129. package/lib/typescript/src/index.d.ts.map +0 -1
  130. package/lib/typescript/src/lib/colors.d.ts.map +0 -1
  131. package/lib/typescript/src/lib/config.d.ts.map +0 -1
  132. package/src/components/biometrics/LivenessCameraView.tsx +0 -61
  133. /package/lib/typescript/{src/functions.d.ts → functions.d.ts} +0 -0
  134. /package/lib/typescript/{src/lib → lib}/colors.d.ts +0 -0
  135. /package/lib/typescript/{src/lib → lib}/config.d.ts +0 -0
@@ -1,305 +1,168 @@
1
1
  import { NativeModules, NativeEventEmitter } from 'react-native';
2
+ import type {
3
+ LivenessConfig,
4
+ LivenessResult,
5
+ LivenessChallenge,
6
+ ChallengeResult,
7
+ LivenessEventCallbacks,
8
+ } from './types';
2
9
 
3
- const { LivenessDetection: LivenessDetectionNative } = NativeModules;
10
+ const { OmnipayLivenessModule } = NativeModules;
4
11
 
5
- // TypeScript interfaces matching PRD specifications
6
- export interface LivenessDetectionConfig {
7
- challenges: ('smile' | 'blink' | 'turn_left' | 'turn_right')[];
8
- timeout?: number; // Optional timeout in milliseconds
9
- }
10
-
11
- export interface ChallengeResult {
12
- challenge: string;
13
- success: boolean;
14
- timestamp: number;
15
- duration?: number; // Time taken to complete challenge
16
- }
17
-
18
- export interface LivenessResult {
19
- success: boolean;
20
- screenshot?: string; // Base64 encoded image
21
- challengeResults: ChallengeResult[];
22
- error?: string;
23
- }
24
-
25
- // Event callback types
26
- export interface LivenessCallbacks {
27
- onChallengeStart?: (challenge: string) => void;
28
- onChallengeSuccess?: (challenge: string) => void;
29
- onChallengeFailure?: (challenge: string, reason: string) => void;
30
- onAllChallengesComplete?: (result: LivenessResult) => void;
31
- onScreenshotCaptured?: (screenshot: string) => void;
32
- }
33
-
34
- // Main LivenessDetection class
35
12
  class LivenessDetectionManager {
36
- private eventEmitter: NativeEventEmitter | null = null;
37
- private listeners: any[] = [];
38
- private callbacks: LivenessCallbacks = {};
39
- private isActive = false;
40
- private challengeResults: ChallengeResult[] = [];
41
- private startTime: number = 0;
13
+ private eventEmitter?: NativeEventEmitter;
14
+ private eventListeners: { [key: string]: any } = {};
42
15
 
43
16
  constructor() {
44
- if (LivenessDetectionNative) {
45
- this.eventEmitter = new NativeEventEmitter(LivenessDetectionNative);
46
- this.setupEventListeners();
17
+ if (OmnipayLivenessModule) {
18
+ this.eventEmitter = new NativeEventEmitter(OmnipayLivenessModule);
47
19
  }
48
20
  }
49
21
 
50
- private setupEventListeners() {
51
- if (!this.eventEmitter) return;
52
-
53
- // Challenge start event
54
- this.listeners.push(
55
- this.eventEmitter.addListener('onChallengeStart', (event) => {
56
- console.log('Liveness: Challenge started -', event.challenge);
57
- if (this.callbacks.onChallengeStart) {
58
- this.callbacks.onChallengeStart(event.challenge);
59
- }
60
- })
61
- );
62
-
63
- // Challenge success event
64
- this.listeners.push(
65
- this.eventEmitter.addListener('onChallengeSuccess', (event) => {
66
- console.log('Liveness: Challenge completed -', event.challenge);
67
-
68
- // Record challenge result
69
- const result: ChallengeResult = {
70
- challenge: event.challenge,
71
- success: true,
72
- timestamp: Date.now(),
73
- duration: Date.now() - this.startTime,
74
- };
75
- this.challengeResults.push(result);
76
-
77
- if (this.callbacks.onChallengeSuccess) {
78
- this.callbacks.onChallengeSuccess(event.challenge);
79
- }
80
- })
81
- );
82
-
83
- // Challenge failure event
84
- this.listeners.push(
85
- this.eventEmitter.addListener('onChallengeFailure', (event) => {
86
- console.log(
87
- 'Liveness: Challenge failed -',
88
- event.challenge,
89
- event.reason
90
- );
91
-
92
- // Record failed challenge result
93
- const result: ChallengeResult = {
94
- challenge: event.challenge,
95
- success: false,
96
- timestamp: Date.now(),
97
- duration: Date.now() - this.startTime,
98
- };
99
- this.challengeResults.push(result);
100
-
101
- if (this.callbacks.onChallengeFailure) {
102
- this.callbacks.onChallengeFailure(event.challenge, event.reason);
103
- }
104
- })
105
- );
106
-
107
- // All challenges complete event
108
- this.listeners.push(
109
- this.eventEmitter.addListener('onAllChallengesComplete', (event) => {
110
- console.log('Liveness: All challenges completed', event);
111
-
112
- const result: LivenessResult = {
113
- success: event.success,
114
- screenshot: event.screenshot,
115
- challengeResults: this.challengeResults,
116
- };
117
-
118
- this.isActive = false;
119
-
120
- if (this.callbacks.onAllChallengesComplete) {
121
- this.callbacks.onAllChallengesComplete(result);
122
- }
123
- })
124
- );
125
-
126
- // Screenshot captured event
127
- this.listeners.push(
128
- this.eventEmitter.addListener('onScreenshotCaptured', (event) => {
129
- console.log('Liveness: Screenshot captured');
130
-
131
- if (this.callbacks.onScreenshotCaptured) {
132
- this.callbacks.onScreenshotCaptured(event.screenshot);
133
- }
134
- })
135
- );
136
- }
137
-
138
22
  /**
139
- * Start liveness detection with specified challenges
140
- * @param config - Configuration including challenges array
141
- * @param callbacks - Event callbacks
142
- * @returns Promise resolving to LivenessResult
23
+ * Check if liveness detection is supported on this device
143
24
  */
144
- async startLivenessDetection(
145
- config: LivenessDetectionConfig,
146
- callbacks?: LivenessCallbacks
147
- ): Promise<LivenessResult> {
148
- if (this.isActive) {
149
- throw new Error('Liveness detection is already active');
25
+ async isSupported(): Promise<boolean> {
26
+ if (!OmnipayLivenessModule) {
27
+ return false;
150
28
  }
151
29
 
152
- if (!LivenessDetectionNative) {
153
- throw new Error('Liveness detection is not available on this platform');
30
+ try {
31
+ return await OmnipayLivenessModule.isSupported();
32
+ } catch (error) {
33
+ console.warn('Liveness detection support check failed:', error);
34
+ return false;
154
35
  }
36
+ }
155
37
 
156
- // Validate challenges
157
- if (!config.challenges || config.challenges.length === 0) {
158
- throw new Error('At least one challenge must be specified');
38
+ /**
39
+ * Start liveness detection with given configuration
40
+ */
41
+ async startDetection(
42
+ config: LivenessConfig,
43
+ callbacks?: LivenessEventCallbacks
44
+ ): Promise<LivenessResult> {
45
+ if (!OmnipayLivenessModule) {
46
+ throw new Error('Liveness detection module not available');
159
47
  }
160
48
 
161
- const validChallenges = ['smile', 'blink', 'turn_left', 'turn_right'];
162
- for (const challenge of config.challenges) {
163
- if (!validChallenges.includes(challenge)) {
164
- throw new Error(`Invalid challenge: ${challenge}`);
165
- }
49
+ // Set up event listeners if callbacks provided
50
+ if (callbacks) {
51
+ this.setupEventListeners(callbacks);
166
52
  }
167
53
 
168
54
  try {
169
- // Check camera permission first
170
- const hasPermission = await this.checkCameraPermission();
171
- if (!hasPermission) {
172
- throw new Error(
173
- 'Camera permission is required. Please call requestCameraPermission() first.'
174
- );
175
- }
176
-
177
- // Set callbacks
178
- this.callbacks = callbacks || {};
179
- this.challengeResults = [];
180
- this.startTime = Date.now();
181
- this.isActive = true;
182
-
183
- // Start detection on native side
184
- const result = await LivenessDetectionNative.startLivenessDetection(
185
- config.challenges
186
- );
187
- console.log('Liveness detection started:', result);
188
-
189
- // Return a promise that resolves when all challenges are complete
190
- return new Promise((resolve, reject) => {
191
- const originalOnComplete = this.callbacks.onAllChallengesComplete;
192
-
193
- this.callbacks.onAllChallengesComplete = (
194
- livenessResult: LivenessResult
195
- ) => {
196
- // Call original callback if provided
197
- if (originalOnComplete) {
198
- originalOnComplete(livenessResult);
199
- }
200
-
201
- // Resolve the promise
202
- resolve(livenessResult);
203
- };
204
-
205
- // Set up timeout if specified
206
- if (config.timeout) {
207
- setTimeout(() => {
208
- if (this.isActive) {
209
- this.stopDetection();
210
- reject(new Error('Liveness detection timed out'));
211
- }
212
- }, config.timeout);
213
- }
214
- });
55
+ const result = await OmnipayLivenessModule.startLivenessDetection(config);
56
+ return result;
215
57
  } catch (error) {
216
- this.isActive = false;
58
+ this.cleanupEventListeners();
217
59
  throw error;
218
60
  }
219
61
  }
220
62
 
221
63
  /**
222
- * Stop liveness detection
64
+ * Stop the current detection
223
65
  */
224
- stopDetection(): void {
225
- if (LivenessDetectionNative && this.isActive) {
226
- LivenessDetectionNative.stopLivenessDetection();
227
- this.isActive = false;
228
- this.callbacks = {};
229
- this.challengeResults = [];
230
- console.log('Liveness detection stopped');
66
+ async stopDetection(): Promise<void> {
67
+ if (!OmnipayLivenessModule) {
68
+ return;
231
69
  }
232
- }
233
70
 
234
- /**
235
- * Check if liveness detection is currently active
236
- */
237
- isDetectionActive(): boolean {
238
- return this.isActive;
71
+ try {
72
+ await OmnipayLivenessModule.stopDetection();
73
+ } finally {
74
+ this.cleanupEventListeners();
75
+ }
239
76
  }
240
77
 
241
78
  /**
242
- * Get available challenge types
79
+ * Set up event listeners for detection callbacks
243
80
  */
244
- getAvailableChallenges(): string[] {
245
- return ['smile', 'blink', 'turn_left', 'turn_right'];
246
- }
81
+ private setupEventListeners(callbacks: LivenessEventCallbacks) {
82
+ this.cleanupEventListeners(); // Clean up any existing listeners
247
83
 
248
- /**
249
- * Check if camera permission is granted
250
- */
251
- async checkCameraPermission(): Promise<boolean> {
252
- if (!LivenessDetectionNative) {
253
- throw new Error('Liveness detection is not available on this platform');
84
+ if (!this.eventEmitter) {
85
+ console.warn('Event emitter not available for liveness detection');
86
+ return;
254
87
  }
255
88
 
256
- try {
257
- return await LivenessDetectionNative.checkCameraPermission();
258
- } catch (error) {
259
- console.error('Failed to check camera permission:', error);
260
- return false;
89
+ if (callbacks.onChallengeStart) {
90
+ this.eventListeners.challengeStart = this.eventEmitter.addListener(
91
+ 'onChallengeStart',
92
+ (challenge: LivenessChallenge) => callbacks.onChallengeStart!(challenge)
93
+ );
261
94
  }
262
- }
263
95
 
264
- /**
265
- * Request camera permission from the user
266
- */
267
- async requestCameraPermission(): Promise<boolean> {
268
- if (!LivenessDetectionNative) {
269
- throw new Error('Liveness detection is not available on this platform');
96
+ if (callbacks.onChallengeSuccess) {
97
+ this.eventListeners.challengeSuccess = this.eventEmitter.addListener(
98
+ 'onChallengeSuccess',
99
+ (data: { challenge: LivenessChallenge; result: ChallengeResult }) =>
100
+ callbacks.onChallengeSuccess!(data.challenge, data.result)
101
+ );
270
102
  }
271
103
 
272
- try {
273
- return await LivenessDetectionNative.requestCameraPermission();
274
- } catch (error) {
275
- console.error('Failed to request camera permission:', error);
276
- return false;
104
+ if (callbacks.onChallengeFailure) {
105
+ this.eventListeners.challengeFailure = this.eventEmitter.addListener(
106
+ 'onChallengeFailure',
107
+ (data: { challenge: LivenessChallenge; reason: string }) =>
108
+ callbacks.onChallengeFailure!(data.challenge, data.reason)
109
+ );
110
+ }
111
+
112
+ if (callbacks.onAllChallengesComplete) {
113
+ this.eventListeners.allComplete = this.eventEmitter.addListener(
114
+ 'onAllChallengesComplete',
115
+ () => callbacks.onAllChallengesComplete!()
116
+ );
117
+ }
118
+
119
+ if (callbacks.onScreenshotCaptured) {
120
+ this.eventListeners.screenshot = this.eventEmitter.addListener(
121
+ 'onScreenshotCaptured',
122
+ (screenshot: string) => callbacks.onScreenshotCaptured!(screenshot)
123
+ );
124
+ }
125
+
126
+ if (callbacks.onDetectionFailed) {
127
+ this.eventListeners.failed = this.eventEmitter.addListener(
128
+ 'onDetectionFailed',
129
+ (reason: string) => callbacks.onDetectionFailed!(reason)
130
+ );
277
131
  }
278
132
  }
279
133
 
280
134
  /**
281
- * Cleanup - remove all event listeners
135
+ * Clean up all event listeners
282
136
  */
283
- cleanup(): void {
284
- this.listeners.forEach((listener) => {
137
+ private cleanupEventListeners() {
138
+ Object.values(this.eventListeners).forEach((listener) => {
285
139
  if (listener && listener.remove) {
286
140
  listener.remove();
287
141
  }
288
142
  });
289
- this.listeners = [];
290
- this.stopDetection();
143
+ this.eventListeners = {};
144
+ }
145
+
146
+ /**
147
+ * Get default configuration
148
+ */
149
+ getDefaultConfig(): LivenessConfig {
150
+ return {
151
+ challenges: [
152
+ 'smile',
153
+ 'blink',
154
+ 'turnLeft',
155
+ 'turnRight',
156
+ ] as LivenessChallenge[],
157
+ challengeTimeout: 10,
158
+ totalTimeout: 60,
159
+ debugMode: __DEV__,
160
+ };
291
161
  }
292
162
  }
293
163
 
294
164
  // Export singleton instance
295
165
  export const LivenessDetection = new LivenessDetectionManager();
296
166
 
297
- // Types are already exported above
298
-
299
- // Constants from native module
300
- export const LivenessConstants = {
301
- CHALLENGE_SMILE: 'smile',
302
- CHALLENGE_BLINK: 'blink',
303
- CHALLENGE_TURN_LEFT: 'turn_left',
304
- CHALLENGE_TURN_RIGHT: 'turn_right',
305
- } as const;
167
+ // Export types for convenience
168
+ export * from './types';
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { requireNativeComponent, ViewStyle } from 'react-native';
3
+
4
+ interface OmnipayLivenessCameraViewProps {
5
+ style?: ViewStyle;
6
+ onCameraReady?: (event: { nativeEvent: { ready: boolean } }) => void;
7
+ onCameraError?: (event: { nativeEvent: { error: string } }) => void;
8
+ }
9
+
10
+ const NativeOmnipayLivenessCameraView =
11
+ requireNativeComponent<OmnipayLivenessCameraViewProps>(
12
+ 'OmnipayLivenessCameraView'
13
+ );
14
+
15
+ export const OmnipayLivenessCameraView: React.FC<
16
+ OmnipayLivenessCameraViewProps
17
+ > = (props) => {
18
+ return <NativeOmnipayLivenessCameraView {...props} />;
19
+ };