@trulioo/docv-capture-web 2.13.0 → 2.14.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/README.md CHANGED
@@ -27,7 +27,7 @@ truliooCapture.initialize(shortCode).then((transactionId) => {
27
27
  ### Creating and rendering a camera component
28
28
 
29
29
  Using the same created instance of `TruliooCapture`, we can get a camera component to be rendered later by calling the `getCameraComponent` function.
30
- We can specify the camera detection type by providing a `ITruliooCameraConfig` with the desired `DetectionType`.
30
+ We can specify the camera detection type by providing a `TruliooCameraConfig` with the desired `DetectionType`.
31
31
 
32
32
  ```javascript showLineNumbers
33
33
 
@@ -42,21 +42,21 @@ const selfieCamera = truliooCaptureSdkInstance.getCameraComponent({
42
42
  ```
43
43
 
44
44
  To render the camera component on the screen, we just need to call the `renderCamera` function. This will render a full screen camera on the screen by attaching
45
- a video element to the parent element based on the provided element id. We can also include a callback function that will be called by the SDK when the camera is successfully loaded.
45
+ a video element to the parent element based on the provided element id. The `renderCamera` function will resolve when the camera is successfully loaded, otherwise it will reject with an error.
46
46
  The `onCaptureRegionChange` callback function is provided, which will return the current capture frame coordinates location (the location on the camera screen where the document/face should be located to do a capture).
47
47
  We can utilize this coordinate information to render custom UI overlay.
48
48
 
49
49
  ```javascript showLineNumbers
50
- documentCamera.renderCamera("parent-element-id", (cameraLoadSuccess) => {
51
- if (cameraLoadSuccess) {
52
- console.log("Camera loaded successfully!")
53
- } else {
54
- console.log("Failed to load camera.")
55
- }
56
- }, {
57
- onCaptureRegionChange: (captureRegion) => {
58
- // Utilize the given captureRegion data to render custom UI.
59
- }
50
+ const cameraProps = new CameraProps(
51
+ (captureRegion: CaptureRegion) => {
52
+ // Utilize the given captureRegion data to render custom UI.
53
+ }
54
+ )
55
+
56
+ documentCamera.renderCamera("parent-element-id", cameraProps).then((_) => {
57
+ console.log("Camera is successfully loaded")
58
+ }).catch((e: Error) => {
59
+ console.error(`Camera is not loaded successfully: ${e.message}`)
60
60
  })
61
61
  ```
62
62
 
@@ -76,7 +76,7 @@ To do an auto capture experience (a good document/selfie image criteria decided
76
76
  currently active/rendered camera component. The promise will only resolve when the SDK manage to capture a good image that is presented in front of the camera capture frame.
77
77
 
78
78
  ```javascript showLineNumbers
79
- truliooCapture.startFeedback(documentCamera.id).then((result: ITruliooCaptureResponse) => {
79
+ truliooCapture.startFeedback(documentCamera.id).then((result: TruliooCaptureResponse) => {
80
80
  console.log(`Succesfully captured a good image: ${result}`)
81
81
  })
82
82
  ```
@@ -122,16 +122,17 @@ Note that the above flow is the same for the selfie capture type too.
122
122
  ### Analysing the captured image result through post capture verify feedback
123
123
 
124
124
 
125
- Once we have the resulting `ITruliooCaptureResponse` image data, we are able to get a post capture feedback by simply calling the `verifyImage` function that is
125
+ Once we have the resulting `TruliooCaptureResponse` image data, we are able to get a post capture feedback by simply calling the `verifyImage` function that is
126
126
  part of the response data. This will give use more information regarding the captured image and let us decide whether we should submit the captured image for
127
127
  verification by calling the `acceptImage` function.
128
128
 
129
129
 
130
130
 
131
131
  ```javascript showLineNumbers
132
- // As an example, we will submit the captured image for document verification if the post capture feedback returns a CAN_BE_PROCESSED status.
133
- result.verifyImage().then((verifyFeedback: ITruliooVerifyResponse) => {
134
- if (verifyFeedback.verificationStatus == VerificationStatus.CAN_BE_PROCESSED) {
132
+ // As an example, we will submit the captured image for document verification if the post capture feedback documentVerifyResponse.documentTypeAccepted is not RESULT_CHECK_DECLINED.
133
+ // Note that the documentVerifyResponse will have more than just documentTypeAccepted, the below code is just an example of just checking for documentTypeAccepted.
134
+ result.verifyImage().then((verifyFeedback: TruliooVerifyFeedback) => {
135
+ if (verifyFeedback.documentVerifyResponse.documentTypeAccepted !== ResultCheck.RESULT_CHECK_DECLINED) {
135
136
  // Note that the acceptImage can be called outside of the verifyImage function.
136
137
  result.acceptImage().then((status: boolean) => {
137
138
  console.log("Successfully submitted the image")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trulioo/docv-capture-web",
3
- "version": "2.13.0",
3
+ "version": "2.14.0",
4
4
  "main": "trulioo-docv-capture-web.js",
5
5
  "types": "trulioo-docv-capture-web.d.ts",
6
6
  "devDependencies": {
@@ -40,48 +40,6 @@ export declare namespace com.trulioo.docv.core.workflow {
40
40
  equals(other: Nullable<any>): boolean;
41
41
  }
42
42
  }
43
- export declare class TruliooCamera /* extends capture.Camera */ {
44
- constructor(cameraId: string, cameraDetectionType: DetectionType);
45
- get id(): string;
46
- get detectionType(): DetectionType;
47
- removeCamera(): void;
48
- renderCamera(parentElementId: string, onCameraLoaded?: (p0: boolean) => void, cameraProps?: Nullable<CameraProps>): void;
49
- }
50
- export declare class CameraProps {
51
- constructor(backgroundColor: Nullable<string>, onCaptureRegionChange: Nullable<(p0: CaptureRegion) => void>);
52
- get backgroundColor(): Nullable<string>;
53
- get onCaptureRegionChange(): Nullable<(p0: CaptureRegion) => void>;
54
- copy(backgroundColor?: Nullable<string>, onCaptureRegionChange?: Nullable<(p0: CaptureRegion) => void>): CameraProps;
55
- toString(): string;
56
- hashCode(): number;
57
- equals(other: Nullable<any>): boolean;
58
- }
59
- export declare interface CaptureRegion {
60
- readonly bottomRight: PointCoordinates;
61
- readonly center: PointCoordinates;
62
- readonly selfieRadius: number;
63
- readonly topLeft: PointCoordinates;
64
- readonly __doNotUseOrImplementIt: {
65
- readonly CaptureRegion: unique symbol;
66
- };
67
- }
68
- export declare interface PointCoordinates {
69
- readonly x: number;
70
- readonly y: number;
71
- readonly __doNotUseOrImplementIt: {
72
- readonly PointCoordinates: unique symbol;
73
- };
74
- }
75
- export declare class TruliooCapture {
76
- constructor();
77
- initialize(shortCode: string, previewMode?: boolean): Promise<string>;
78
- getCameraComponent(config?: Nullable<TruliooCameraConfig>): TruliooCamera;
79
- startFeedback(cameraId: string, imageFeedback?: Nullable<(p0: TruliooImageFeedback) => void>): Promise<TruliooCaptureResponse>;
80
- stopFeedback(cameraId: string): Promise<boolean>;
81
- onFeedbackState(feedback: (p0: TruliooFeedbackState) => void): void;
82
- captureLatestFrame(): Promise<TruliooCaptureResponse>;
83
- submitTransaction(): Promise<boolean>;
84
- }
85
43
  export declare interface TruliooCameraConfig {
86
44
  readonly detectionType: DetectionType;
87
45
  readonly __doNotUseOrImplementIt: {
@@ -138,38 +96,11 @@ export declare interface TruliooCaptureResponse extends TruliooImageFeedback {
138
96
  }
139
97
  export declare interface TruliooVerifyFeedback {
140
98
  readonly isVerifyAttemptAvailable: boolean;
141
- readonly verificationStatus: VerificationStatus;
99
+ readonly documentVerifyResponse: DocumentVerifyResponse;
142
100
  readonly __doNotUseOrImplementIt: {
143
101
  readonly TruliooVerifyFeedback: unique symbol;
144
102
  };
145
103
  }
146
- export declare abstract class VerificationStatus {
147
- private constructor();
148
- static get CAN_BE_PROCESSED(): VerificationStatus & {
149
- get name(): "CAN_BE_PROCESSED";
150
- get ordinal(): 0;
151
- };
152
- static get CANNOT_BE_CLASSIFIED(): VerificationStatus & {
153
- get name(): "CANNOT_BE_CLASSIFIED";
154
- get ordinal(): 1;
155
- };
156
- static get UNSUPPORTED_DOCUMENT(): VerificationStatus & {
157
- get name(): "UNSUPPORTED_DOCUMENT";
158
- get ordinal(): 2;
159
- };
160
- static get EXPIRED_DOCUMENT(): VerificationStatus & {
161
- get name(): "EXPIRED_DOCUMENT";
162
- get ordinal(): 3;
163
- };
164
- static get ERROR(): VerificationStatus & {
165
- get name(): "ERROR";
166
- get ordinal(): 4;
167
- };
168
- static values(): Array<VerificationStatus>;
169
- static valueOf(value: string): VerificationStatus;
170
- get name(): "CAN_BE_PROCESSED" | "CANNOT_BE_CLASSIFIED" | "UNSUPPORTED_DOCUMENT" | "EXPIRED_DOCUMENT" | "ERROR";
171
- get ordinal(): 0 | 1 | 2 | 3 | 4;
172
- }
173
104
  export declare abstract class TruliooFeedbackState {
174
105
  private constructor();
175
106
  static get NONE(): TruliooFeedbackState & {
@@ -205,4 +136,119 @@ export declare abstract class TruliooFeedbackState {
205
136
  get name(): "NONE" | "CAPTURING" | "BLUR" | "SUCCESS" | "ERROR" | "TOO_CLOSE" | "TOO_FAR";
206
137
  get ordinal(): 0 | 1 | 2 | 3 | 4 | 5 | 6;
207
138
  }
139
+ export declare abstract class ResultCheck {
140
+ private constructor();
141
+ static get RESULT_CHECK_UNSPECIFIED(): ResultCheck & {
142
+ get name(): "RESULT_CHECK_UNSPECIFIED";
143
+ get ordinal(): 0;
144
+ };
145
+ static get RESULT_CHECK_DECLINED(): ResultCheck & {
146
+ get name(): "RESULT_CHECK_DECLINED";
147
+ get ordinal(): 1;
148
+ };
149
+ static get RESULT_CHECK_ACCEPTED(): ResultCheck & {
150
+ get name(): "RESULT_CHECK_ACCEPTED";
151
+ get ordinal(): 2;
152
+ };
153
+ static values(): Array<ResultCheck>;
154
+ static valueOf(value: string): ResultCheck;
155
+ get name(): "RESULT_CHECK_UNSPECIFIED" | "RESULT_CHECK_DECLINED" | "RESULT_CHECK_ACCEPTED";
156
+ get ordinal(): 0 | 1 | 2;
157
+ }
158
+ export declare abstract class DocumentExpirationCheck {
159
+ private constructor();
160
+ static get DOCUMENT_EXPIRATION_CHECK_UNSPECIFIED(): DocumentExpirationCheck & {
161
+ get name(): "DOCUMENT_EXPIRATION_CHECK_UNSPECIFIED";
162
+ get ordinal(): 0;
163
+ };
164
+ static get DOCUMENT_EXPIRATION_CHECK_EXPIRED(): DocumentExpirationCheck & {
165
+ get name(): "DOCUMENT_EXPIRATION_CHECK_EXPIRED";
166
+ get ordinal(): 1;
167
+ };
168
+ static get DOCUMENT_EXPIRATION_CHECK_VALID(): DocumentExpirationCheck & {
169
+ get name(): "DOCUMENT_EXPIRATION_CHECK_VALID";
170
+ get ordinal(): 2;
171
+ };
172
+ static values(): Array<DocumentExpirationCheck>;
173
+ static valueOf(value: string): DocumentExpirationCheck;
174
+ get name(): "DOCUMENT_EXPIRATION_CHECK_UNSPECIFIED" | "DOCUMENT_EXPIRATION_CHECK_EXPIRED" | "DOCUMENT_EXPIRATION_CHECK_VALID";
175
+ get ordinal(): 0 | 1 | 2;
176
+ }
177
+ export declare abstract class BackImageRequirement {
178
+ private constructor();
179
+ static get BACK_IMAGE_REQUIREMENT_UNSPECIFIED(): BackImageRequirement & {
180
+ get name(): "BACK_IMAGE_REQUIREMENT_UNSPECIFIED";
181
+ get ordinal(): 0;
182
+ };
183
+ static get BACK_IMAGE_REQUIREMENT_NOT_REQUIRED(): BackImageRequirement & {
184
+ get name(): "BACK_IMAGE_REQUIREMENT_NOT_REQUIRED";
185
+ get ordinal(): 1;
186
+ };
187
+ static get BACK_IMAGE_REQUIREMENT_REQUIRED(): BackImageRequirement & {
188
+ get name(): "BACK_IMAGE_REQUIREMENT_REQUIRED";
189
+ get ordinal(): 2;
190
+ };
191
+ static values(): Array<BackImageRequirement>;
192
+ static valueOf(value: string): BackImageRequirement;
193
+ get name(): "BACK_IMAGE_REQUIREMENT_UNSPECIFIED" | "BACK_IMAGE_REQUIREMENT_NOT_REQUIRED" | "BACK_IMAGE_REQUIREMENT_REQUIRED";
194
+ get ordinal(): 0 | 1 | 2;
195
+ }
196
+ export declare class DocumentVerifyResponse {
197
+ constructor(documentDetected: ResultCheck, documentTypeAccepted: ResultCheck, documentCountryAccepted: ResultCheck, documentJurisdictionAccepted: ResultCheck, blur: ResultCheck, glare: ResultCheck, skewed: ResultCheck, bright: ResultCheck, documentExpirationCheck: DocumentExpirationCheck, backImageRequirement: BackImageRequirement);
198
+ get documentDetected(): ResultCheck;
199
+ get documentTypeAccepted(): ResultCheck;
200
+ get documentCountryAccepted(): ResultCheck;
201
+ get documentJurisdictionAccepted(): ResultCheck;
202
+ get blur(): ResultCheck;
203
+ get glare(): ResultCheck;
204
+ get skewed(): ResultCheck;
205
+ get bright(): ResultCheck;
206
+ get documentExpirationCheck(): DocumentExpirationCheck;
207
+ get backImageRequirement(): BackImageRequirement;
208
+ copy(documentDetected?: ResultCheck, documentTypeAccepted?: ResultCheck, documentCountryAccepted?: ResultCheck, documentJurisdictionAccepted?: ResultCheck, blur?: ResultCheck, glare?: ResultCheck, skewed?: ResultCheck, bright?: ResultCheck, documentExpirationCheck?: DocumentExpirationCheck, backImageRequirement?: BackImageRequirement): DocumentVerifyResponse;
209
+ toString(): string;
210
+ hashCode(): number;
211
+ equals(other: Nullable<any>): boolean;
212
+ }
213
+ export declare class TruliooCamera /* extends capture.Camera */ {
214
+ constructor(cameraId: string, cameraDetectionType: DetectionType);
215
+ get id(): string;
216
+ get detectionType(): DetectionType;
217
+ removeCamera(): void;
218
+ renderCamera(parentElementId: string, cameraProps?: Nullable<CameraProps>): Promise<boolean>;
219
+ }
220
+ export declare class CameraProps {
221
+ constructor(onCaptureRegionChange: Nullable<(p0: CaptureRegion) => void>);
222
+ get onCaptureRegionChange(): Nullable<(p0: CaptureRegion) => void>;
223
+ copy(onCaptureRegionChange?: Nullable<(p0: CaptureRegion) => void>): CameraProps;
224
+ toString(): string;
225
+ hashCode(): number;
226
+ equals(other: Nullable<any>): boolean;
227
+ }
228
+ export declare interface CaptureRegion {
229
+ readonly bottomRight: PointCoordinates;
230
+ readonly center: PointCoordinates;
231
+ readonly selfieRadius: number;
232
+ readonly topLeft: PointCoordinates;
233
+ readonly __doNotUseOrImplementIt: {
234
+ readonly CaptureRegion: unique symbol;
235
+ };
236
+ }
237
+ export declare interface PointCoordinates {
238
+ readonly x: number;
239
+ readonly y: number;
240
+ readonly __doNotUseOrImplementIt: {
241
+ readonly PointCoordinates: unique symbol;
242
+ };
243
+ }
244
+ export declare class TruliooCapture {
245
+ constructor();
246
+ initialize(shortCode: string, previewMode?: boolean): Promise<string>;
247
+ getCameraComponent(config?: Nullable<TruliooCameraConfig>): TruliooCamera;
248
+ startFeedback(cameraId: string, imageFeedback?: Nullable<(p0: TruliooImageFeedback) => void>): Promise<TruliooCaptureResponse>;
249
+ stopFeedback(cameraId: string): Promise<boolean>;
250
+ onFeedbackState(feedback: (p0: TruliooFeedbackState) => void): void;
251
+ captureLatestFrame(): Promise<TruliooCaptureResponse>;
252
+ submitTransaction(): Promise<boolean>;
253
+ }
208
254
  export as namespace trulioo_docv_capture_web;