@trulioo/docv-capture-web 2.13.0 → 2.13.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/README.md +15 -15
- package/package.json +1 -1
- package/trulioo-docv-capture-web.d.ts +3 -4
- package/trulioo-docv-capture-web.js +1 -1
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 `
|
|
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.
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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:
|
|
79
|
+
truliooCapture.startFeedback(documentCamera.id).then((result: TruliooCaptureResponse) => {
|
|
80
80
|
console.log(`Succesfully captured a good image: ${result}`)
|
|
81
81
|
})
|
|
82
82
|
```
|
|
@@ -122,7 +122,7 @@ 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 `
|
|
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
|
|
|
@@ -130,7 +130,7 @@ verification by calling the `acceptImage` function.
|
|
|
130
130
|
|
|
131
131
|
```javascript showLineNumbers
|
|
132
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:
|
|
133
|
+
result.verifyImage().then((verifyFeedback: TruliooVerifyResponse) => {
|
|
134
134
|
if (verifyFeedback.verificationStatus == VerificationStatus.CAN_BE_PROCESSED) {
|
|
135
135
|
// Note that the acceptImage can be called outside of the verifyImage function.
|
|
136
136
|
result.acceptImage().then((status: boolean) => {
|
package/package.json
CHANGED
|
@@ -45,13 +45,12 @@ export declare class TruliooCamera /* extends capture.Camera */ {
|
|
|
45
45
|
get id(): string;
|
|
46
46
|
get detectionType(): DetectionType;
|
|
47
47
|
removeCamera(): void;
|
|
48
|
-
renderCamera(parentElementId: string,
|
|
48
|
+
renderCamera(parentElementId: string, cameraProps?: Nullable<CameraProps>): Promise<boolean>;
|
|
49
49
|
}
|
|
50
50
|
export declare class CameraProps {
|
|
51
|
-
constructor(
|
|
52
|
-
get backgroundColor(): Nullable<string>;
|
|
51
|
+
constructor(onCaptureRegionChange: Nullable<(p0: CaptureRegion) => void>);
|
|
53
52
|
get onCaptureRegionChange(): Nullable<(p0: CaptureRegion) => void>;
|
|
54
|
-
copy(
|
|
53
|
+
copy(onCaptureRegionChange?: Nullable<(p0: CaptureRegion) => void>): CameraProps;
|
|
55
54
|
toString(): string;
|
|
56
55
|
hashCode(): number;
|
|
57
56
|
equals(other: Nullable<any>): boolean;
|