@smile_identity/react-native 10.0.3 → 10.1.1

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/src/index.tsx CHANGED
@@ -29,6 +29,7 @@ import {
29
29
  SmartSelfieJobStatusResponse,
30
30
  UploadRequest,
31
31
  ValidDocumentsResponse,
32
+ JobType,
32
33
  } from './types';
33
34
 
34
35
  const LINKING_ERROR =
@@ -133,6 +134,86 @@ const SmileID = {
133
134
  * Get available services
134
135
  */
135
136
  getServices: () => _SmileID.getServices(),
137
+
138
+ /**
139
+ * Polls the status of a smart selfie job.
140
+ *
141
+ * @param {JobStatusRequest} request - The job status request object.
142
+ * @param {number} interval - The interval duration (in milliseconds) between each polling attempt.
143
+ * @param {number} numAttempts - The number of polling attempts before stopping.
144
+ */
145
+ pollSmartSelfieJobStatus: (
146
+ request: JobStatusRequest,
147
+ interval: number,
148
+ numAttempts: number
149
+ ) => {
150
+ if (!Number.isInteger(interval) || !Number.isInteger(numAttempts)) {
151
+ throw new Error(`interval and numAttempts must be an integer.`);
152
+ }
153
+ request.interval = interval;
154
+ request.numAttempts = numAttempts;
155
+ _SmileID.pollSmartSelfieJobStatus(request);
156
+ },
157
+
158
+ /**
159
+ * Polls the status of a document verification job.
160
+ *
161
+ * @param {JobStatusRequest} request - The job status request object.
162
+ * @param {number} interval - The interval duration (in milliseconds) between each polling attempt.
163
+ * @param {number} numAttempts - The number of polling attempts before stopping.
164
+ */
165
+ pollDocumentVerificationJobStatus: (
166
+ request: JobStatusRequest,
167
+ interval: number,
168
+ numAttempts: number
169
+ ) => {
170
+ if (!Number.isInteger(interval) || !Number.isInteger(numAttempts)) {
171
+ throw new Error(`interval and numAttempts must be an integer.`);
172
+ }
173
+ request.interval = interval;
174
+ request.numAttempts = numAttempts;
175
+ _SmileID.pollDocumentVerificationJobStatus(request);
176
+ },
177
+
178
+ /**
179
+ * Polls the status of a biometric KYC job.
180
+ *
181
+ * @param {JobStatusRequest} request - The job status request object.
182
+ * @param {number} interval - The interval duration (in milliseconds) between each polling attempt.
183
+ * @param {number} numAttempts - The number of polling attempts before stopping.
184
+ */
185
+ pollBiometricKycJobStatus: (
186
+ request: JobStatusRequest,
187
+ interval: number,
188
+ numAttempts: number
189
+ ) => {
190
+ if (!Number.isInteger(interval) || !Number.isInteger(numAttempts)) {
191
+ throw new Error(`interval and numAttempts must be an integer.`);
192
+ }
193
+ request.interval = interval;
194
+ request.numAttempts = numAttempts;
195
+ _SmileID.pollBiometricKycJobStatus(request);
196
+ },
197
+
198
+ /**
199
+ * Polls the status of an enhanced document verification job.
200
+ *
201
+ * @param {JobStatusRequest} request - The job status request object.
202
+ * @param {number} interval - The interval duration (in milliseconds) between each polling attempt.
203
+ * @param {number} numAttempts - The number of polling attempts before stopping.
204
+ */
205
+ pollEnhancedDocumentVerificationJobStatus: (
206
+ request: JobStatusRequest,
207
+ interval: number,
208
+ numAttempts: number
209
+ ) => {
210
+ if (!Number.isInteger(interval) || !Number.isInteger(numAttempts)) {
211
+ throw new Error(`interval and numAttempts must be an integer.`);
212
+ }
213
+ request.interval = interval;
214
+ request.numAttempts = numAttempts;
215
+ _SmileID.pollEnhancedDocumentVerificationJobStatus(request);
216
+ },
136
217
  };
137
218
 
138
219
  export {
@@ -146,6 +227,7 @@ export {
146
227
  SmileIDEnhancedDocumentVerificationView,
147
228
  SmileIDConsentView,
148
229
  //types
230
+ JobType,
149
231
  EnhancedKycRequest,
150
232
  DocumentVerificationRequest,
151
233
  SmartSelfieEnrollmentRequest,
package/src/types.ts CHANGED
@@ -536,6 +536,8 @@ export class JobStatusRequest {
536
536
  partnerId: string;
537
537
  timestamp: string;
538
538
  signature: string;
539
+ interval?: number;
540
+ numAttempts?: number;
539
541
 
540
542
  constructor(
541
543
  userId: string,