@transmitsecurity/platform-web-sdk 2.3.2-beta-26093939905.0 → 2.4.0

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/dist/idv.d.ts CHANGED
@@ -1,3 +1,77 @@
1
+ type AddImagesResponse = {
2
+ /**
3
+ * Feedback for the submitted image
4
+ */
5
+ feedback: AddImagesResponse.feedback;
6
+ /**
7
+ * Indicates whether all the images required for the verification check were received
8
+ */
9
+ complete: boolean;
10
+ /**
11
+ * The additional image types that need to be added
12
+ */
13
+ missing_images: Array<'document_front' | 'document_back' | 'selfie'>;
14
+ /**
15
+ * Custom feedback corresponding to the restricted criteria (as configured in the Admin Portal)
16
+ */
17
+ custom_feedback?: string;
18
+ /**
19
+ * Indicates whether the document is expected to have a barcode
20
+ */
21
+ has_barcode?: boolean;
22
+ supported_barcode_symbologies?: string[];
23
+ };
24
+ declare namespace AddImagesResponse {
25
+ /**
26
+ * Feedback for the submitted image
27
+ */
28
+ enum feedback {
29
+ OK = "ok",
30
+ OTHER = "other",
31
+ DOCUMENT_NOT_FOUND = "document_not_found",
32
+ FACE_NOT_FOUND = "face_not_found",
33
+ DOCUMENT_FACE_NOT_FOUND = "document_face_not_found",
34
+ OBSTRUCTED = "obstructed",
35
+ BLUR = "blur",
36
+ GLARE = "glare",
37
+ DOCUMENT_NOT_SUPPORTED = "document_not_supported",
38
+ DOCUMENT_NOT_MATCHING = "document_not_matching",
39
+ WRONG_DOCUMENT_SIDE = "wrong_document_side",
40
+ MULTI_FACE = "multi_face",
41
+ FACE_ROTATED = "face_rotated",
42
+ FACE_TOO_SMALL = "face_too_small",
43
+ FACE_TOO_CLOSE = "face_too_close",
44
+ CLOSED_EYES = "closed_eyes",
45
+ FACE_ANGLE_TOO_LARGE = "face_angle_too_large",
46
+ FACE_CLOSE_TO_BORDER = "face_close_to_border",
47
+ FACE_OCCLUDED = "face_occluded",
48
+ FACE_CROPPED = "face_cropped",
49
+ BARCODE_NOT_FOUND = "barcode_not_found",
50
+ GLARE_SELFIE = "glare_selfie",
51
+ BLUR_SELFIE = "blur_selfie",
52
+ RESTRICTED_CRITERIA = "restricted_criteria",
53
+ UNCLASSIFIABLE = "unclassifiable"
54
+ }
55
+ }
56
+
57
+ type Step = 'loading_screen' | 'init' | 'document_front' | 'document_back' | 'selfie' | 'processing' | 'error' | 'complete' | 'recapture';
58
+
59
+ type Errors = 'other' | 'camera-error' | 'camera-permission-dismissed' | 'camera-permission-denied' | 'trying-to-initialize-active-session' | 'unable-to-parse-data-uri' | 'failed-to-submit-image' | 'request-error' | 'session-expired';
60
+
61
+ interface CaptureItem {
62
+ sessionId: string;
63
+ type: 'document_front' | 'document_back' | 'selfie';
64
+ feedback: AddImagesResponse.feedback;
65
+ }
66
+ interface CaptureResult {
67
+ captures: CaptureItem[];
68
+ }
69
+ declare class CaptureError extends Error {
70
+ errorCode: Errors;
71
+ step: Step;
72
+ constructor(errorCode: Errors, step: Step, message?: string);
73
+ }
74
+
1
75
  /**
2
76
  * The `idv` module allows you to integrate identity verification services into your application. This allows you to
3
77
  * securely verify the identity of your customers using documents like their driver's license or passport.
@@ -10,6 +84,33 @@
10
84
  * @module tsPlatform.idv
11
85
  */
12
86
 
87
+ /**
88
+ * Options for {@link captureDocument}.
89
+ * @memberof module:tsPlatform.idv
90
+ */
91
+ interface CaptureDocumentOptions {
92
+ /**
93
+ * Acquisition id obtained by calling the backend's
94
+ * `POST /verify/api/v1/verification/{sessionId}/document-acquisition` endpoint.
95
+ * The same id is used for both document_front and document_back uploads, including any retakes.
96
+ */
97
+ acquisitionId: string;
98
+ /** Optional callback invoked for each successful image capture. */
99
+ onCapture?: (result: CaptureItem) => void;
100
+ }
101
+ /**
102
+ * Options for {@link captureSelfie}.
103
+ * @memberof module:tsPlatform.idv
104
+ */
105
+ interface CaptureSelfieOptions {
106
+ /**
107
+ * Acquisition id obtained by calling the backend's
108
+ * `POST /verify/api/v1/verification/{sessionId}/selfie-acquisition` endpoint.
109
+ */
110
+ acquisitionId: string;
111
+ /** Optional callback invoked when the selfie is successfully captured. */
112
+ onCapture?: (result: CaptureItem) => void;
113
+ }
13
114
  /**
14
115
  * Starts a verification session that was created in the backend (via the [Verification API](/openapi/verify/verifications/#operation/createSession)).
15
116
  * This will start the verification process for the user and guides them through the entire identity verification flow
@@ -51,13 +152,56 @@ declare function start(startToken?: string): Promise<boolean>;
51
152
  */
52
153
  declare function recapture(): Promise<boolean>;
53
154
  /**
54
- * deprecated use {@link module:tsPlatform.idv.recapture|recapture} instead
55
- * TODO: [VER-3126](https://transmitsecurity.atlassian.net/browse/VER-3126)
155
+ * Captures document images (front and back if needed). This method is only available when flowType is 'modular'.
156
+ * Returns a Promise that resolves when the document capture sequence completes successfully.
157
+ *
158
+ * Requires an `acquisitionId` minted via the backend's
159
+ * `POST /verify/api/v1/verification/{sessionId}/document-acquisition` endpoint. The same id is sent
160
+ * with every image upload performed during the capture (front, back, retakes).
161
+ * @function captureDocument
162
+ * @param {CaptureDocumentOptions} options - Capture options including the required `acquisitionId`
163
+ * and an optional `onCapture` callback called for each image submission attempt.
164
+ * @returns {Promise<CaptureResult>} Promise that resolves with complete capture information
165
+ * @throws {Error} If `acquisitionId` is missing, flowType is not 'modular', session is not active,
166
+ * or the document step is not available
167
+ * @memberof module:tsPlatform.idv
168
+ * @example
169
+ * // Mint an acquisition id from your backend, then pass it in:
170
+ * const { acquisition_id } = await myBackend.createDocumentAcquisition(sessionId);
171
+ * const result = await tsPlatform.idv.captureDocument({ acquisitionId: acquisition_id });
172
+ * console.log('Captured:', result.captures);
173
+ *
174
+ * // With callback for intermediate results (synchronous)
175
+ * const result = await tsPlatform.idv.captureDocument({
176
+ * acquisitionId: acquisition_id,
177
+ * onCapture: (capture) => {
178
+ * console.log(`Captured ${capture.type} with feedback: ${capture.feedback}`);
179
+ * },
180
+ * });
181
+ */
182
+ declare function captureDocument(options: CaptureDocumentOptions): Promise<CaptureResult>;
183
+ /**
184
+ * Captures a selfie image. This method is only available when flowType is 'modular'.
185
+ * Returns a Promise that resolves when the selfie capture completes successfully.
186
+ *
187
+ * Requires an `acquisitionId` minted via the backend's
188
+ * `POST /verify/api/v1/verification/{sessionId}/selfie-acquisition` endpoint.
189
+ * @function captureSelfie
190
+ * @param {CaptureSelfieOptions} options - Capture options including the required `acquisitionId`
191
+ * and an optional `onCapture` callback.
192
+ * @returns {Promise<CaptureResult>} Promise that resolves with complete capture information
193
+ * @throws {Error} If `acquisitionId` is missing, flowType is not 'modular', session is not active,
194
+ * or the selfie step is not available
195
+ * @memberof module:tsPlatform.idv
196
+ * @example
197
+ * const { acquisition_id } = await myBackend.createSelfieAcquisition(sessionId);
198
+ * const result = await tsPlatform.idv.captureSelfie({ acquisitionId: acquisition_id });
199
+ * console.log('Captured:', result.captures);
56
200
  */
57
- declare function restart(): Promise<boolean>;
201
+ declare function captureSelfie(options: CaptureSelfieOptions): Promise<CaptureResult>;
58
202
  declare const version: () => string;
59
203
 
60
204
  declare const PACKAGE_VERSION: string;
61
205
  declare function initialize(config: any): void;
62
206
 
63
- export { PACKAGE_VERSION, initialize, recapture, restart, start, version };
207
+ export { CaptureDocumentOptions, CaptureError, CaptureItem, CaptureResult, CaptureSelfieOptions, PACKAGE_VERSION, captureDocument, captureSelfie, initialize, recapture, start, version };