@microblink/capture 1.0.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 +175 -0
- package/dist/capture.js +16647 -0
- package/dist/capture.umd.cjs +238 -0
- package/dist/resources/advanced/capture-wasm.data +0 -0
- package/dist/resources/advanced/capture-wasm.js +159 -0
- package/dist/resources/advanced/capture-wasm.wasm +0 -0
- package/dist/resources/advanced-threads/capture-wasm.data +0 -0
- package/dist/resources/advanced-threads/capture-wasm.js +178 -0
- package/dist/resources/advanced-threads/capture-wasm.wasm +0 -0
- package/dist/resources/advanced-threads/capture-wasm.worker.js +1 -0
- package/dist/resources/basic/capture-wasm.data +0 -0
- package/dist/resources/basic/capture-wasm.js +159 -0
- package/dist/resources/basic/capture-wasm.wasm +0 -0
- package/dist/resources/capture-worker.js +5 -0
- package/dist/style.css +1 -0
- package/package.json +62 -0
- package/types/index.d.cts +12 -0
- package/types/index.d.ts +913 -0
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,913 @@
|
|
|
1
|
+
import { MountableElement } from 'solid-js/web';
|
|
2
|
+
import { SetStoreFunction } from 'solid-js/store';
|
|
3
|
+
|
|
4
|
+
export declare class Analyzer extends EmbindObject {
|
|
5
|
+
/**
|
|
6
|
+
* Performs frame analysis and returns `FrameAnalysisResult`
|
|
7
|
+
*/
|
|
8
|
+
analyze(image: ImageData): FrameAnalysisResult;
|
|
9
|
+
getResult: () => AnalyzerResult;
|
|
10
|
+
getSettings: () => AnalyzerSettings;
|
|
11
|
+
updateSettings: (settings: AnalyzerSettings) => void;
|
|
12
|
+
/** Returns analyzer to initial state */
|
|
13
|
+
reset: () => void;
|
|
14
|
+
/**
|
|
15
|
+
* Method used to finish capture of current side when `Analyzer.analyze()`
|
|
16
|
+
* didn't return {@linkcode FrameAnalysisResult#frameAnalysisStatus} state.
|
|
17
|
+
*
|
|
18
|
+
* Method tries to fill `SideCaptureResult` with current best frame, if there
|
|
19
|
+
* isn't one method returns `false` and result is not changed, otherwise
|
|
20
|
+
* `true` is returned and current best frame is filled in current
|
|
21
|
+
* `SideCaptureResult`.
|
|
22
|
+
*/
|
|
23
|
+
finishSideCapture: () => boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Copyright (c) 2023 Microblink Ltd. All rights reserved.
|
|
28
|
+
*
|
|
29
|
+
* ANY UNAUTHORIZED USE OR SALE, DUPLICATION, OR DISTRIBUTION
|
|
30
|
+
* OF THIS PROGRAM OR ANY OF ITS PARTS, IN SOURCE OR BINARY FORMS,
|
|
31
|
+
* WITH OR WITHOUT MODIFICATION, WITH THE PURPOSE OF ACQUIRING
|
|
32
|
+
* UNLAWFUL MATERIAL OR ANY OTHER BENEFIT IS PROHIBITED!
|
|
33
|
+
* THIS PROGRAM IS PROTECTED BY COPYRIGHT LAWS AND YOU MAY NOT
|
|
34
|
+
* REVERSE ENGINEER, DECOMPILE, OR DISASSEMBLE IT.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* The result returned from `Analyzer.analyze`
|
|
38
|
+
*/
|
|
39
|
+
export declare type AnalyzerResult = {
|
|
40
|
+
/** Result of the first side capture */
|
|
41
|
+
firstCapture?: SideCaptureResult;
|
|
42
|
+
/** Result of the second side capture */
|
|
43
|
+
secondCapture?: SideCaptureResult;
|
|
44
|
+
/** Document group */
|
|
45
|
+
documentGroup: DocumentGroup;
|
|
46
|
+
/** Completeness status of the capture process */
|
|
47
|
+
completnessStatus: CompletnessStatus;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Copyright (c) 2023 Microblink Ltd. All rights reserved.
|
|
52
|
+
*
|
|
53
|
+
* ANY UNAUTHORIZED USE OR SALE, DUPLICATION, OR DISTRIBUTION
|
|
54
|
+
* OF THIS PROGRAM OR ANY OF ITS PARTS, IN SOURCE OR BINARY FORMS,
|
|
55
|
+
* WITH OR WITHOUT MODIFICATION, WITH THE PURPOSE OF ACQUIRING
|
|
56
|
+
* UNLAWFUL MATERIAL OR ANY OTHER BENEFIT IS PROHIBITED!
|
|
57
|
+
* THIS PROGRAM IS PROTECTED BY COPYRIGHT LAWS AND YOU MAY NOT
|
|
58
|
+
* REVERSE ENGINEER, DECOMPILE, OR DISASSEMBLE IT.
|
|
59
|
+
*/
|
|
60
|
+
/**
|
|
61
|
+
* Settings for the analyzer.
|
|
62
|
+
*/
|
|
63
|
+
export declare type AnalyzerSettings = {
|
|
64
|
+
/**
|
|
65
|
+
* Whether to capture a single side or capture all possible sides
|
|
66
|
+
* of a document with automatic side detection.
|
|
67
|
+
*/
|
|
68
|
+
captureSingleSide: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Whether to return an image of a cropped and perspective-corrected document.
|
|
71
|
+
*/
|
|
72
|
+
returnTransformedDocumentImage: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Configures capture strategy used to select the best frame.
|
|
75
|
+
*
|
|
76
|
+
* The following values are possible:
|
|
77
|
+
*
|
|
78
|
+
* - `"optimize-for-speed"` - Analysis is faster, but it is possible to
|
|
79
|
+
* capture frames with lower quality
|
|
80
|
+
* - `"optimize-for-quality"` - Analysis is slower in order to capture high
|
|
81
|
+
* quality frames.
|
|
82
|
+
* - `"default"` - Trade-off for quality and speed.
|
|
83
|
+
* - `"single-frame"` - Captures first acceptable frame.
|
|
84
|
+
*/
|
|
85
|
+
captureStrategy: CaptureStrategy;
|
|
86
|
+
/**
|
|
87
|
+
* Enables document capture with a margin defined as the percentage of the
|
|
88
|
+
* dimensions of the framed document.
|
|
89
|
+
*
|
|
90
|
+
* Both margin and document are required to be fully visible on camera frame
|
|
91
|
+
* in order to finish capture.
|
|
92
|
+
*
|
|
93
|
+
* Allowed values are from 0 to 1.
|
|
94
|
+
*/
|
|
95
|
+
documentFramingMargin: number;
|
|
96
|
+
/**
|
|
97
|
+
* Whether to return an image of the transformed document with applied margin
|
|
98
|
+
* used during document framing.
|
|
99
|
+
*/
|
|
100
|
+
keepMarginOnTransformedDocumentImage: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Parameters for lighting estimation.
|
|
103
|
+
*
|
|
104
|
+
* Thresholds used to classify the frame as too dark.
|
|
105
|
+
*
|
|
106
|
+
* If the calculated lighting score are outside these thresholds, the frame is
|
|
107
|
+
* discarded. Allowed values are from 0 to 1.
|
|
108
|
+
*
|
|
109
|
+
* ```typescript
|
|
110
|
+
* type LightingThresholds = {
|
|
111
|
+
* tooDarkThreshold: number;
|
|
112
|
+
* tooBrightThreshold: number;
|
|
113
|
+
* }
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
lightingThresholds: LightingThresholds;
|
|
117
|
+
/**
|
|
118
|
+
* Whether to discard frames with blurred documents.
|
|
119
|
+
*
|
|
120
|
+
* If it is enabled, the capture process is allowed to finish with blur on the
|
|
121
|
+
* document.
|
|
122
|
+
*/
|
|
123
|
+
ignoreBlur: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Whether to discard frames with glare detected on the document.
|
|
126
|
+
*
|
|
127
|
+
* If it is enabled, the capture process is allowed to finish with glare on
|
|
128
|
+
* the document.
|
|
129
|
+
*/
|
|
130
|
+
ignoreGlare: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Defines percentage of the document area that is allowed to be occluded by hand.
|
|
133
|
+
*
|
|
134
|
+
* Allowed values are from 0 to 1.
|
|
135
|
+
*/
|
|
136
|
+
handOcclusionThreshold: number;
|
|
137
|
+
/**
|
|
138
|
+
* Threshold for detecting tilted documents. Frames with documents tilted more
|
|
139
|
+
* than defined by this threshold are discarded.
|
|
140
|
+
*
|
|
141
|
+
* Allowed values are from 0 to 1.
|
|
142
|
+
*/
|
|
143
|
+
tiltThreshold: number;
|
|
144
|
+
/**
|
|
145
|
+
* Required minimum DPI of the captured document on transformed image.
|
|
146
|
+
*
|
|
147
|
+
* Affects how close the document needs to be to the camera in order to get
|
|
148
|
+
* captured.
|
|
149
|
+
*
|
|
150
|
+
* Allowed values are from 150 to 400.
|
|
151
|
+
*/
|
|
152
|
+
minimumDocumentDpi: number;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export declare type BaltazarRequest = Readonly<{
|
|
156
|
+
licenseId: string;
|
|
157
|
+
licensee: string;
|
|
158
|
+
packageName: string;
|
|
159
|
+
platform: string;
|
|
160
|
+
sdkName: string;
|
|
161
|
+
sdkVersion: string;
|
|
162
|
+
}>;
|
|
163
|
+
|
|
164
|
+
export declare type BaltazarResponseData = {
|
|
165
|
+
[key: string]: string;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
declare type Brand<T, Tbrand extends string> = T & {
|
|
169
|
+
[brand]: Tbrand;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
declare const brand: unique symbol;
|
|
173
|
+
|
|
174
|
+
declare interface CameraDeviceInfo extends Omit<MediaDeviceInfo, "kind"> {
|
|
175
|
+
kind: Extract<MediaDeviceInfo["kind"], "videoinput">;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Cancels the capture process. Unlike {@linkcode pauseCapture}, it also resets
|
|
180
|
+
* the analyzer.
|
|
181
|
+
*/
|
|
182
|
+
declare function cancelCapture(): Promise<void>;
|
|
183
|
+
|
|
184
|
+
export declare type CaptureBindings = {
|
|
185
|
+
initializeWithLicenseKey: (licenceKey: string, userId: string, allowHelloMessage: boolean) => LicenseUnlockResult;
|
|
186
|
+
Analyzer: typeof Analyzer;
|
|
187
|
+
submitServerPermission: (serverPermission: StringifiedBaltazarResponse) => ServerPermissionSubmitResult;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export declare type CaptureCallbacks = Partial<{
|
|
191
|
+
/**
|
|
192
|
+
* Will be called on every frame after it has finished processing
|
|
193
|
+
* @param frame {@linkcode ImageData} of the frame. Make sure to copy it as it
|
|
194
|
+
* will be overwritten when the next frame finishes processing.
|
|
195
|
+
* @param frameResult Detailed information on the frame analysis
|
|
196
|
+
*/
|
|
197
|
+
onFrameAnalysis: (frame: ImageData, frameResult: FrameAnalysisResult) => void;
|
|
198
|
+
/**
|
|
199
|
+
* Will be called after the entire recognition process has finished successfully.
|
|
200
|
+
* @param result The result
|
|
201
|
+
*/
|
|
202
|
+
onCaptureResult: (result: AnalyzerResult) => void;
|
|
203
|
+
}>;
|
|
204
|
+
|
|
205
|
+
export declare type CaptureComponent = {
|
|
206
|
+
/** Dismounts the component from the DOM and unloads the SDK */
|
|
207
|
+
dismount: () => void;
|
|
208
|
+
} & ExposedComponentApi;
|
|
209
|
+
|
|
210
|
+
/** The exported API available to the user */
|
|
211
|
+
export declare type CaptureSdk = typeof captureSdk;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* The core singleton with all public API methods.
|
|
215
|
+
*
|
|
216
|
+
* Always defined in external scopes, as it's only accessible as a return value
|
|
217
|
+
* of {@linkcode createCaptureSdk}
|
|
218
|
+
*
|
|
219
|
+
*/
|
|
220
|
+
declare const captureSdk: {
|
|
221
|
+
/**
|
|
222
|
+
* Starts a best-effort camera stream on a provided video element
|
|
223
|
+
*/
|
|
224
|
+
startCameraStream: typeof startCameraStream;
|
|
225
|
+
/**
|
|
226
|
+
* Stops the currently active stream
|
|
227
|
+
*/
|
|
228
|
+
stopStream: typeof stopStream;
|
|
229
|
+
/**
|
|
230
|
+
* Starts the video playback
|
|
231
|
+
*
|
|
232
|
+
* @returns resolves when playback starts
|
|
233
|
+
*/
|
|
234
|
+
startPlayback: typeof startPlayback;
|
|
235
|
+
/**
|
|
236
|
+
* Pauses the video playback. This will also stop the capturing process.
|
|
237
|
+
*/
|
|
238
|
+
pausePlayback: typeof pausePlayback;
|
|
239
|
+
/**
|
|
240
|
+
* Starts playback and capture.
|
|
241
|
+
*/
|
|
242
|
+
startCapture: typeof startCapture;
|
|
243
|
+
/**
|
|
244
|
+
* Pauses the capture process without resetting the recognizer.
|
|
245
|
+
*/
|
|
246
|
+
pauseCapture: typeof pauseCapture;
|
|
247
|
+
/**
|
|
248
|
+
* Cancels the capture process. Unlike {@linkcode pauseCapture}, it also resets
|
|
249
|
+
* the analyzer.
|
|
250
|
+
*/
|
|
251
|
+
cancelCapture: typeof cancelCapture;
|
|
252
|
+
/**
|
|
253
|
+
* Finishes capturing the current side
|
|
254
|
+
*/
|
|
255
|
+
finishSideCapture: typeof finishSideCapture;
|
|
256
|
+
/**
|
|
257
|
+
* Resets the analyzer.
|
|
258
|
+
*/
|
|
259
|
+
resetAnalyzer: typeof resetAnalyzer;
|
|
260
|
+
/**
|
|
261
|
+
* Select a camera device from available ones.
|
|
262
|
+
*
|
|
263
|
+
* @param camera A camera device configured by the SDK. You can see available
|
|
264
|
+
* devices using on {@linkcode ReactiveStore.cameras} available by calling {@linkcode captureSdk.getState()}
|
|
265
|
+
*/
|
|
266
|
+
selectCamera: typeof selectCamera;
|
|
267
|
+
/**
|
|
268
|
+
* Refreshes available devices on the system and updates the state.
|
|
269
|
+
*/
|
|
270
|
+
updateCameraDevices: typeof updateCameraDevices;
|
|
271
|
+
/**
|
|
272
|
+
* Set up callbacks on the SDK
|
|
273
|
+
*
|
|
274
|
+
* @param newCallbacks A subset of available
|
|
275
|
+
* {@linkcode CaptureCallbacks}. Will overwrite the previously set one.
|
|
276
|
+
*
|
|
277
|
+
* Send an empty object (`{}`) to clear callbacks.
|
|
278
|
+
*/
|
|
279
|
+
setCallbacks: typeof setCallbacks;
|
|
280
|
+
/**
|
|
281
|
+
* Updates the analyzer. Capture process can't be active. Stop it using
|
|
282
|
+
* {@linkcode updateAnalyzerSettings} if required.
|
|
283
|
+
* @param settings {@linkcode AnalyzerSettings}. Will merge with the current
|
|
284
|
+
* settings.
|
|
285
|
+
*/
|
|
286
|
+
updateAnalyzerSettings: typeof updateAnalyzerSettings;
|
|
287
|
+
/**
|
|
288
|
+
* Allows the user to subscribe to state changes inside the Capture SDK. Implemented using Zustand.
|
|
289
|
+
* For usage information, see {@link https://github.com/pmndrs/zustand#using-subscribe-with-selector}
|
|
290
|
+
*/
|
|
291
|
+
subscribe: {
|
|
292
|
+
(listener: (selectedState: ReactiveStore, previousSelectedState: ReactiveStore) => void): () => void;
|
|
293
|
+
<U>(selector: (state: ReactiveStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
294
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
295
|
+
fireImmediately?: boolean | undefined;
|
|
296
|
+
} | undefined): () => void;
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Gets the current internal state of the Capture SDK.
|
|
300
|
+
*/
|
|
301
|
+
getState: () => ReactiveStore;
|
|
302
|
+
/**
|
|
303
|
+
* Resets the SDK core and terminates the workers and the Wasm runtime.
|
|
304
|
+
*/
|
|
305
|
+
destroy: typeof destroy;
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
export declare type CaptureSdkSettings = {
|
|
309
|
+
/** The licence key for loading the Capture SDK. Required. */
|
|
310
|
+
licenseKey: string;
|
|
311
|
+
/** Optional callbacks */
|
|
312
|
+
callbacks?: CaptureCallbacks;
|
|
313
|
+
/** Custom settings for the Capture analyzer */
|
|
314
|
+
analyzerSettings?: Partial<AnalyzerSettings>;
|
|
315
|
+
/** By default, the SDK will look for the required `/resources` directory on the current URL path.
|
|
316
|
+
*
|
|
317
|
+
* If you are hosting the resources on a different URL, provide a new relative or absolute one.
|
|
318
|
+
*/
|
|
319
|
+
resourceUrl?: string;
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Document side classification.
|
|
324
|
+
*
|
|
325
|
+
* If side classification was uncertain, `"unknown"` is returned.
|
|
326
|
+
*/
|
|
327
|
+
export declare type CaptureSide = "unknown" | "front" | "back";
|
|
328
|
+
|
|
329
|
+
export declare type CaptureState = "side-captured" | "document-captured" | "first-side-capture-in-progress" | "second-side-capture-in-progress";
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Capture strategy used to select the best frame.
|
|
333
|
+
*
|
|
334
|
+
* The following values are possible:
|
|
335
|
+
*
|
|
336
|
+
* - `"optimize-for-speed"` - Analysis is faster, but it is possible to capture
|
|
337
|
+
* frames with lower quality
|
|
338
|
+
* - `"optimize-for-quality"` - Analysis is slower in order to capture high
|
|
339
|
+
* quality frames.
|
|
340
|
+
* - `"default"` - Trade-off for quality and speed.
|
|
341
|
+
* - `"single-frame"` - Captures first acceptable frame.
|
|
342
|
+
*/
|
|
343
|
+
export declare type CaptureStrategy = "optimize-for-speed" | "optimize-for-quality" | "default" | "single-frame";
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Represents all bound properties on the Wasm object
|
|
347
|
+
*/
|
|
348
|
+
export declare type CaptureWasmModule = CaptureBindings & EmscriptenModule;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Completeness status of capture process
|
|
352
|
+
*/
|
|
353
|
+
export declare type CompletnessStatus = "empty" | "one-side-missing" | "complete";
|
|
354
|
+
|
|
355
|
+
export declare class ConfiguredCamera {
|
|
356
|
+
#private;
|
|
357
|
+
deviceInfo: CameraDeviceInfo;
|
|
358
|
+
settings: MediaTrackSettings;
|
|
359
|
+
activeStream: MediaStream | null;
|
|
360
|
+
name: string;
|
|
361
|
+
constructor(deviceInfo: CameraDeviceInfo, settings: MediaTrackSettings);
|
|
362
|
+
startStream(): Promise<MediaStream>;
|
|
363
|
+
stopStream(): void;
|
|
364
|
+
getVideoTrack(): MediaStreamTrack | undefined;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Main function that loads the SDK and returns a `captureSdk` object
|
|
369
|
+
*/
|
|
370
|
+
export declare function createCaptureSdk(settings: CaptureSdkSettings): Promise<{
|
|
371
|
+
/**
|
|
372
|
+
* Starts a best-effort camera stream on a provided video element
|
|
373
|
+
*/
|
|
374
|
+
startCameraStream: typeof startCameraStream;
|
|
375
|
+
/**
|
|
376
|
+
* Stops the currently active stream
|
|
377
|
+
*/
|
|
378
|
+
stopStream: typeof stopStream;
|
|
379
|
+
/**
|
|
380
|
+
* Starts the video playback
|
|
381
|
+
*
|
|
382
|
+
* @returns resolves when playback starts
|
|
383
|
+
*/
|
|
384
|
+
startPlayback: typeof startPlayback;
|
|
385
|
+
/**
|
|
386
|
+
* Pauses the video playback. This will also stop the capturing process.
|
|
387
|
+
*/
|
|
388
|
+
pausePlayback: typeof pausePlayback;
|
|
389
|
+
/**
|
|
390
|
+
* Starts playback and capture.
|
|
391
|
+
*/
|
|
392
|
+
startCapture: typeof startCapture;
|
|
393
|
+
/**
|
|
394
|
+
* Pauses the capture process without resetting the recognizer.
|
|
395
|
+
*/
|
|
396
|
+
pauseCapture: typeof pauseCapture;
|
|
397
|
+
/**
|
|
398
|
+
* Cancels the capture process. Unlike {@linkcode pauseCapture}, it also resets
|
|
399
|
+
* the analyzer.
|
|
400
|
+
*/
|
|
401
|
+
cancelCapture: typeof cancelCapture;
|
|
402
|
+
/**
|
|
403
|
+
* Finishes capturing the current side
|
|
404
|
+
*/
|
|
405
|
+
finishSideCapture: typeof finishSideCapture;
|
|
406
|
+
/**
|
|
407
|
+
* Resets the analyzer.
|
|
408
|
+
*/
|
|
409
|
+
resetAnalyzer: typeof resetAnalyzer;
|
|
410
|
+
/**
|
|
411
|
+
* Select a camera device from available ones.
|
|
412
|
+
*
|
|
413
|
+
* @param camera A camera device configured by the SDK. You can see available
|
|
414
|
+
* devices using on {@linkcode ReactiveStore.cameras} available by calling {@linkcode captureSdk.getState()}
|
|
415
|
+
*/
|
|
416
|
+
selectCamera: typeof selectCamera;
|
|
417
|
+
/**
|
|
418
|
+
* Refreshes available devices on the system and updates the state.
|
|
419
|
+
*/
|
|
420
|
+
updateCameraDevices: typeof updateCameraDevices;
|
|
421
|
+
/**
|
|
422
|
+
* Set up callbacks on the SDK
|
|
423
|
+
*
|
|
424
|
+
* @param newCallbacks A subset of available
|
|
425
|
+
* {@linkcode CaptureCallbacks}. Will overwrite the previously set one.
|
|
426
|
+
*
|
|
427
|
+
* Send an empty object (`{}`) to clear callbacks.
|
|
428
|
+
*/
|
|
429
|
+
setCallbacks: typeof setCallbacks;
|
|
430
|
+
/**
|
|
431
|
+
* Updates the analyzer. Capture process can't be active. Stop it using
|
|
432
|
+
* {@linkcode updateAnalyzerSettings} if required.
|
|
433
|
+
* @param settings {@linkcode AnalyzerSettings}. Will merge with the current
|
|
434
|
+
* settings.
|
|
435
|
+
*/
|
|
436
|
+
updateAnalyzerSettings: typeof updateAnalyzerSettings;
|
|
437
|
+
/**
|
|
438
|
+
* Allows the user to subscribe to state changes inside the Capture SDK. Implemented using Zustand.
|
|
439
|
+
* For usage information, see {@link https://github.com/pmndrs/zustand#using-subscribe-with-selector}
|
|
440
|
+
*/
|
|
441
|
+
subscribe: {
|
|
442
|
+
(listener: (selectedState: ReactiveStore, previousSelectedState: ReactiveStore) => void): () => void;
|
|
443
|
+
<U>(selector: (state: ReactiveStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
444
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
445
|
+
fireImmediately?: boolean | undefined;
|
|
446
|
+
} | undefined): () => void;
|
|
447
|
+
};
|
|
448
|
+
/**
|
|
449
|
+
* Gets the current internal state of the Capture SDK.
|
|
450
|
+
*/
|
|
451
|
+
getState: () => ReactiveStore;
|
|
452
|
+
/**
|
|
453
|
+
* Resets the SDK core and terminates the workers and the Wasm runtime.
|
|
454
|
+
*/
|
|
455
|
+
destroy: typeof destroy;
|
|
456
|
+
}>;
|
|
457
|
+
|
|
458
|
+
/** Creates the capture UI and loads the SDK */
|
|
459
|
+
export declare function createCaptureUi(settings: CreateCaptureUiSettings): Promise<CaptureComponent>;
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Loads the UI component along with the Capture SDK.
|
|
463
|
+
*
|
|
464
|
+
* @param target The DOM node you want to render the Capture UI component to
|
|
465
|
+
* @param sdkSettings Settings for the Capture SDK
|
|
466
|
+
* @param uiSettings Settings for the Capture SDK UI component
|
|
467
|
+
* @returns An object with methods for controlling the Capture SDK and the UI
|
|
468
|
+
* component
|
|
469
|
+
*
|
|
470
|
+
* @example
|
|
471
|
+
* ```typescript
|
|
472
|
+
* // Load the UI and the SDK
|
|
473
|
+
* const captureComponent = await createCaptureUi({
|
|
474
|
+
* sdkSettings: {
|
|
475
|
+
* licenseKey: "YOUR_LICENCE_KEY",
|
|
476
|
+
* callbacks: {
|
|
477
|
+
* onCaptureResult: (result) => console.log(result),
|
|
478
|
+
* },
|
|
479
|
+
* },
|
|
480
|
+
* });
|
|
481
|
+
*
|
|
482
|
+
* // Will dismount and clean up
|
|
483
|
+
* captureComponent.dismount()
|
|
484
|
+
* ```
|
|
485
|
+
*/
|
|
486
|
+
declare type CreateCaptureUiSettings = {
|
|
487
|
+
sdkSettings: CaptureSdkSettings;
|
|
488
|
+
uiSettings?: UiSettings;
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Copyright (c) 2023 Microblink Ltd. All rights reserved.
|
|
493
|
+
*
|
|
494
|
+
* ANY UNAUTHORIZED USE OR SALE, DUPLICATION, OR DISTRIBUTION
|
|
495
|
+
* OF THIS PROGRAM OR ANY OF ITS PARTS, IN SOURCE OR BINARY FORMS,
|
|
496
|
+
* WITH OR WITHOUT MODIFICATION, WITH THE PURPOSE OF ACQUIRING
|
|
497
|
+
* UNLAWFUL MATERIAL OR ANY OTHER BENEFIT IS PROHIBITED!
|
|
498
|
+
* THIS PROGRAM IS PROTECTED BY COPYRIGHT LAWS AND YOU MAY NOT
|
|
499
|
+
* REVERSE ENGINEER, DECOMPILE, OR DISASSEMBLE IT.
|
|
500
|
+
*/
|
|
501
|
+
declare const _default: {
|
|
502
|
+
scan_the_front_side: string;
|
|
503
|
+
flip_document: string;
|
|
504
|
+
scan_the_back_side: string;
|
|
505
|
+
scanning_wrong_side: string;
|
|
506
|
+
move_closer: string;
|
|
507
|
+
move_farther: string;
|
|
508
|
+
camera_angle_too_steep: string;
|
|
509
|
+
document_too_close_to_edge: string;
|
|
510
|
+
lightning_too_bright: string;
|
|
511
|
+
lightning_too_dark: string;
|
|
512
|
+
blur_detected: string;
|
|
513
|
+
glare_detected: string;
|
|
514
|
+
occluded: string;
|
|
515
|
+
need_help_tooltip: string;
|
|
516
|
+
onboarding_field_visible_title: string;
|
|
517
|
+
onboarding_field_visible_details: string;
|
|
518
|
+
tutorial_fields_visible_title: string;
|
|
519
|
+
tutorial_fields_visible_start: string;
|
|
520
|
+
tutorial_fields_visible_details: string;
|
|
521
|
+
tutorial_harsh_light_title: string;
|
|
522
|
+
tutorial_harsh_light_details: string;
|
|
523
|
+
tutorial_keep_still_title: string;
|
|
524
|
+
tutorial_keep_still_details: string;
|
|
525
|
+
camera_unavailable: string;
|
|
526
|
+
camera_permission_error: string;
|
|
527
|
+
settings: string;
|
|
528
|
+
camera_media_capture_error: string;
|
|
529
|
+
camera_unable_to_resume_session: string;
|
|
530
|
+
camera_query_in_progress: string;
|
|
531
|
+
done: string;
|
|
532
|
+
cancel: string;
|
|
533
|
+
back: string;
|
|
534
|
+
next: string;
|
|
535
|
+
ok: string;
|
|
536
|
+
dismiss: string;
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Resets the captureSdk and terminates the workers and the Wasm runtime.
|
|
541
|
+
*/
|
|
542
|
+
declare function destroy(): Promise<void>;
|
|
543
|
+
|
|
544
|
+
export declare type DocumentBlurStatus = "not-available" | "blur-detected" | "blur-not-detected";
|
|
545
|
+
|
|
546
|
+
export declare type DocumentFramingStatus = "not-available" | "no-document" | "camera-too-far" | "camera-too-close" | "camera-angle-too-steep" | "document-too-close-to-frame-edge" | "ok";
|
|
547
|
+
|
|
548
|
+
export declare type DocumentGlareStatus = "not-available" | "glare-detected" | "glare-not-detected";
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Document group classification.
|
|
552
|
+
*/
|
|
553
|
+
export declare type DocumentGroup = "unknown" | "dl" | "id" | "passport" | "passport-card" | "visa";
|
|
554
|
+
|
|
555
|
+
export declare type DocumentLightingStatus = "not-available" | "too-bright" | "too-dark" | "normal";
|
|
556
|
+
|
|
557
|
+
export declare type DocumentOcclusionStatus = "not-available" | "occluded" | "not-occluded";
|
|
558
|
+
|
|
559
|
+
/** Back side analysis */
|
|
560
|
+
export declare type DocumentSideAnalysisStatus = "not-available" | "side-already-captured" | "side-not-captured";
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Copyright (c) 2023 Microblink Ltd. All rights reserved.
|
|
564
|
+
*
|
|
565
|
+
* ANY UNAUTHORIZED USE OR SALE, DUPLICATION, OR DISTRIBUTION
|
|
566
|
+
* OF THIS PROGRAM OR ANY OF ITS PARTS, IN SOURCE OR BINARY FORMS,
|
|
567
|
+
* WITH OR WITHOUT MODIFICATION, WITH THE PURPOSE OF ACQUIRING
|
|
568
|
+
* UNLAWFUL MATERIAL OR ANY OTHER BENEFIT IS PROHIBITED!
|
|
569
|
+
* THIS PROGRAM IS PROTECTED BY COPYRIGHT LAWS AND YOU MAY NOT
|
|
570
|
+
* REVERSE ENGINEER, DECOMPILE, OR DISASSEMBLE IT.
|
|
571
|
+
*/
|
|
572
|
+
/**
|
|
573
|
+
* Specifies an abstract object placed on the WebAssembly heap.
|
|
574
|
+
* Objects placed on the WebAssembly heap are not cleaned up by the
|
|
575
|
+
* garbage collector of the JavaScript engine. The memory used by
|
|
576
|
+
* the object must be cleaned up manually by calling the delete() method.
|
|
577
|
+
*
|
|
578
|
+
* {@link} https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#memory-management
|
|
579
|
+
*/
|
|
580
|
+
declare abstract class EmbindObject {
|
|
581
|
+
/**
|
|
582
|
+
* Cleans up the object from the WebAssembly heap.
|
|
583
|
+
*/
|
|
584
|
+
delete(): Promise<void>;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
export declare type ExposedComponentApi = {
|
|
588
|
+
/** Can return undefined if called after the SDK has been
|
|
589
|
+
* destroyed
|
|
590
|
+
*/
|
|
591
|
+
captureSdk: CaptureSdk | undefined;
|
|
592
|
+
updateLocalization: SetStoreFunction<LocalizationStrings>;
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
export declare class FeedbackParser {
|
|
596
|
+
private timeWindow;
|
|
597
|
+
private decayRate;
|
|
598
|
+
private eventStack;
|
|
599
|
+
private analyzerSettings;
|
|
600
|
+
private currentUiState;
|
|
601
|
+
private currentStateStartTime;
|
|
602
|
+
constructor(analyzerSettings: AnalyzerSettings);
|
|
603
|
+
reset(): void;
|
|
604
|
+
updateSettings(analyzerSettings: AnalyzerSettings): void;
|
|
605
|
+
/**
|
|
606
|
+
* Returns a weighted UI state based on the history
|
|
607
|
+
*/
|
|
608
|
+
getUiState(frameAnalysisResult: FrameAnalysisResult): Readonly<{
|
|
609
|
+
key: UiStateKey;
|
|
610
|
+
reticleType: ReticleType;
|
|
611
|
+
minDuration: number;
|
|
612
|
+
}>;
|
|
613
|
+
/**
|
|
614
|
+
* Returns a requested UI state key based on the latest frame
|
|
615
|
+
*/
|
|
616
|
+
private getUiStateKeyFromResult;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Finishes capturing the current side
|
|
621
|
+
*/
|
|
622
|
+
declare function finishSideCapture(): Promise<void>;
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Copyright (c) 2023 Microblink Ltd. All rights reserved.
|
|
626
|
+
*
|
|
627
|
+
* ANY UNAUTHORIZED USE OR SALE, DUPLICATION, OR DISTRIBUTION
|
|
628
|
+
* OF THIS PROGRAM OR ANY OF ITS PARTS, IN SOURCE OR BINARY FORMS,
|
|
629
|
+
* WITH OR WITHOUT MODIFICATION, WITH THE PURPOSE OF ACQUIRING
|
|
630
|
+
* UNLAWFUL MATERIAL OR ANY OTHER BENEFIT IS PROHIBITED!
|
|
631
|
+
* THIS PROGRAM IS PROTECTED BY COPYRIGHT LAWS AND YOU MAY NOT
|
|
632
|
+
* REVERSE ENGINEER, DECOMPILE, OR DISASSEMBLE IT.
|
|
633
|
+
*/
|
|
634
|
+
export declare type FrameAnalysisResult = {
|
|
635
|
+
captureState: CaptureState;
|
|
636
|
+
frameCaptured: boolean;
|
|
637
|
+
frameAnalysisStatus: FrameAnalysisStatus;
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
export declare type FrameAnalysisStatus = {
|
|
641
|
+
sideAnalysisStatus: DocumentSideAnalysisStatus;
|
|
642
|
+
framingStatus: DocumentFramingStatus;
|
|
643
|
+
lightingStatus: DocumentLightingStatus;
|
|
644
|
+
blurStatus: DocumentBlurStatus;
|
|
645
|
+
glareStatus: DocumentGlareStatus;
|
|
646
|
+
occlusionStatus: DocumentOcclusionStatus;
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
export declare const getBase64StringFromDataURL: (dataURL: string) => string;
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Copyright (c) 2023 Microblink Ltd. All rights reserved.
|
|
653
|
+
*
|
|
654
|
+
* ANY UNAUTHORIZED USE OR SALE, DUPLICATION, OR DISTRIBUTION
|
|
655
|
+
* OF THIS PROGRAM OR ANY OF ITS PARTS, IN SOURCE OR BINARY FORMS,
|
|
656
|
+
* WITH OR WITHOUT MODIFICATION, WITH THE PURPOSE OF ACQUIRING
|
|
657
|
+
* UNLAWFUL MATERIAL OR ANY OTHER BENEFIT IS PROHIBITED!
|
|
658
|
+
* THIS PROGRAM IS PROTECTED BY COPYRIGHT LAWS AND YOU MAY NOT
|
|
659
|
+
* REVERSE ENGINEER, DECOMPILE, OR DISASSEMBLE IT.
|
|
660
|
+
*/
|
|
661
|
+
export declare const imageDataToUrl: (imageData: ImageData) => string;
|
|
662
|
+
|
|
663
|
+
export declare enum LicenseTokenState {
|
|
664
|
+
Invalid = 0,
|
|
665
|
+
RequiresServerPermission = 1,
|
|
666
|
+
Valid = 2
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Copyright (c) 2023 Microblink Ltd. All rights reserved.
|
|
671
|
+
*
|
|
672
|
+
* ANY UNAUTHORIZED USE OR SALE, DUPLICATION, OR DISTRIBUTION
|
|
673
|
+
* OF THIS PROGRAM OR ANY OF ITS PARTS, IN SOURCE OR BINARY FORMS,
|
|
674
|
+
* WITH OR WITHOUT MODIFICATION, WITH THE PURPOSE OF ACQUIRING
|
|
675
|
+
* UNLAWFUL MATERIAL OR ANY OTHER BENEFIT IS PROHIBITED!
|
|
676
|
+
* THIS PROGRAM IS PROTECTED BY COPYRIGHT LAWS AND YOU MAY NOT
|
|
677
|
+
* REVERSE ENGINEER, DECOMPILE, OR DISASSEMBLE IT.
|
|
678
|
+
*/
|
|
679
|
+
export declare type LicenseUnlockResult = Readonly<{
|
|
680
|
+
isTrial: boolean;
|
|
681
|
+
licenseId: string;
|
|
682
|
+
licensee: string;
|
|
683
|
+
packageName: string;
|
|
684
|
+
sdkName: string;
|
|
685
|
+
sdkVersion: string;
|
|
686
|
+
unlockResult: LicenseTokenState;
|
|
687
|
+
licenseError: string;
|
|
688
|
+
}>;
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Parameters for lighting estimation.
|
|
692
|
+
*
|
|
693
|
+
* Thresholds used to classify the frame as too dark.
|
|
694
|
+
*
|
|
695
|
+
* If the calculated lighting score are outside these thresholds, the frame is
|
|
696
|
+
* discarded. Allowed values are from 0 to 1.
|
|
697
|
+
*/
|
|
698
|
+
export declare type LightingThresholds = {
|
|
699
|
+
tooDarkThreshold: number;
|
|
700
|
+
tooBrightThreshold: number;
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
declare type LocalizationStrings = typeof _default;
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Pauses the capture process without resetting the recognizer.
|
|
707
|
+
*/
|
|
708
|
+
declare function pauseCapture(): void;
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Pauses the video playback. This will also stop the capturing process.
|
|
712
|
+
*/
|
|
713
|
+
declare function pausePlayback(): void;
|
|
714
|
+
|
|
715
|
+
export declare type ReactiveStore = {
|
|
716
|
+
videoElement: HTMLVideoElement | null;
|
|
717
|
+
cameras: ConfiguredCamera[];
|
|
718
|
+
selectedCamera: ConfiguredCamera | null;
|
|
719
|
+
callbacks: CaptureCallbacks;
|
|
720
|
+
isPlaying: boolean;
|
|
721
|
+
isCapturing: boolean;
|
|
722
|
+
isSwappingCamera: boolean;
|
|
723
|
+
isQueryingCameras: boolean;
|
|
724
|
+
analyzerSettings: AnalyzerSettings;
|
|
725
|
+
uiState: UiState;
|
|
726
|
+
/** If Wasm is initialized successfully */
|
|
727
|
+
initialized: boolean;
|
|
728
|
+
errorState: Error | null;
|
|
729
|
+
};
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Resets the analyzer.
|
|
733
|
+
*/
|
|
734
|
+
declare function resetAnalyzer(): Promise<void>;
|
|
735
|
+
|
|
736
|
+
export declare const resetCoreStore: () => void;
|
|
737
|
+
|
|
738
|
+
export declare type ReticleType = "searching" | "processing" | "error" | "done" | "flip";
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* Select a camera device from available ones.
|
|
742
|
+
*
|
|
743
|
+
* @param camera A camera device configured by the SDK. You can see available
|
|
744
|
+
* devices using on {@linkcode ReactiveStore.cameras} available by calling {@linkcode captureSdk.getState()}
|
|
745
|
+
*/
|
|
746
|
+
declare function selectCamera(camera: ConfiguredCamera): Promise<void>;
|
|
747
|
+
|
|
748
|
+
export declare type ServerPermissionSubmitResult = Readonly<{
|
|
749
|
+
status: ServerPermissionSubmitResultStatus;
|
|
750
|
+
lease: number;
|
|
751
|
+
networkErrorDescription?: string;
|
|
752
|
+
}>;
|
|
753
|
+
|
|
754
|
+
export declare enum ServerPermissionSubmitResultStatus {
|
|
755
|
+
Ok = 0,
|
|
756
|
+
NetworkError = 1,
|
|
757
|
+
RemoteLock = 2,
|
|
758
|
+
PermissionExpired = 3,
|
|
759
|
+
PayloadCorrupted = 4,
|
|
760
|
+
PayloadSignatureVerificationFailed = 5,
|
|
761
|
+
IncorrectTokenState = 6
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* Set up callbacks on the SDK
|
|
766
|
+
*
|
|
767
|
+
* @param newCallbacks A subset of available
|
|
768
|
+
* {@linkcode CaptureCallbacks}. Will overwrite the previously set one.
|
|
769
|
+
*
|
|
770
|
+
* Send an empty object (`{}`) to clear callbacks.
|
|
771
|
+
*/
|
|
772
|
+
declare function setCallbacks(newCallbacks: CaptureCallbacks): void;
|
|
773
|
+
|
|
774
|
+
declare type SetStateInternal<T> = {
|
|
775
|
+
_(partial: T | Partial<T> | {
|
|
776
|
+
_(state: T): T | Partial<T>;
|
|
777
|
+
}['_'], replace?: boolean | undefined): void;
|
|
778
|
+
}['_'];
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Result of side capture
|
|
782
|
+
*/
|
|
783
|
+
export declare type SideCaptureResult = {
|
|
784
|
+
/**
|
|
785
|
+
* Original image of the captured document, untransformed, as it was used in
|
|
786
|
+
* analysis.
|
|
787
|
+
*/
|
|
788
|
+
imageResult: ImageData;
|
|
789
|
+
/**
|
|
790
|
+
* Image of the cropped and perspective-corrected document. The transformed
|
|
791
|
+
* image is returned in the correct orientation.
|
|
792
|
+
*/
|
|
793
|
+
transformedImageResult: ImageData | null;
|
|
794
|
+
/**
|
|
795
|
+
* Document side classification.
|
|
796
|
+
*
|
|
797
|
+
* If side classification was uncertain, `"unknown"` is returned.
|
|
798
|
+
*/
|
|
799
|
+
side: CaptureSide;
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Starts a best-effort camera stream on a provided video element
|
|
804
|
+
*/
|
|
805
|
+
declare function startCameraStream(videoElement: HTMLVideoElement, autoplay?: boolean): Promise<void>;
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* Starts playback and capture.
|
|
809
|
+
*/
|
|
810
|
+
declare function startCapture(): Promise<void>;
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Starts the video playback
|
|
814
|
+
*
|
|
815
|
+
* @returns resolves when playback starts
|
|
816
|
+
*/
|
|
817
|
+
declare function startPlayback(): Promise<void>;
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* Stops the currently active stream
|
|
821
|
+
*/
|
|
822
|
+
declare function stopStream(): Promise<void>;
|
|
823
|
+
|
|
824
|
+
declare interface StoreApi<T> {
|
|
825
|
+
setState: SetStateInternal<T>;
|
|
826
|
+
getState: () => T;
|
|
827
|
+
subscribe: (listener: (state: T, prevState: T) => void) => () => void;
|
|
828
|
+
/**
|
|
829
|
+
* @deprecated Use `unsubscribe` returned by `subscribe`
|
|
830
|
+
*/
|
|
831
|
+
destroy: () => void;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Branded type for type safety. Requires casting where required.
|
|
836
|
+
*/
|
|
837
|
+
export declare type StringifiedBaltazarResponse = Brand<string, "StringifiedBaltazarResponse">;
|
|
838
|
+
|
|
839
|
+
declare type UiSettings = {
|
|
840
|
+
/** Target DOM node where you want the UI component to mount.
|
|
841
|
+
*
|
|
842
|
+
* If not provided, the component will be portalled in the document root,
|
|
843
|
+
* taking up the entire screen.
|
|
844
|
+
*/
|
|
845
|
+
target?: MountableElement;
|
|
846
|
+
/** If `true`, an onboarding screen will be visible once the video feed starts.
|
|
847
|
+
*
|
|
848
|
+
* @default `true`
|
|
849
|
+
* */
|
|
850
|
+
showTutorial?: boolean;
|
|
851
|
+
/** If `true`, errors thrown in the SDK will be shown in a dialog.
|
|
852
|
+
*
|
|
853
|
+
* @default `true`
|
|
854
|
+
* */
|
|
855
|
+
showErrorDialog?: boolean;
|
|
856
|
+
/**
|
|
857
|
+
* User provided localization keys
|
|
858
|
+
*/
|
|
859
|
+
localization?: Partial<Record<keyof LocalizationStrings, string>>;
|
|
860
|
+
};
|
|
861
|
+
|
|
862
|
+
export declare type UiState = Readonly<{
|
|
863
|
+
key: UiStateKey;
|
|
864
|
+
reticleType: ReticleType;
|
|
865
|
+
minDuration: number;
|
|
866
|
+
}>;
|
|
867
|
+
|
|
868
|
+
export declare type UiStateEvent = {
|
|
869
|
+
stateKey: Readonly<UiStateKey>;
|
|
870
|
+
timeStamp: Readonly<DOMHighResTimeStamp>;
|
|
871
|
+
currentWeight: number;
|
|
872
|
+
};
|
|
873
|
+
|
|
874
|
+
export declare type UiStateKey = "PROCESSING" | "SIDE_CAPTURED" | "FLIP_CARD" | "DOCUMENT_CAPTURED" | "SENSING_FRONT" | "SENSING_BACK" | "DOCUMENT_FRAMING_CAMERA_TOO_FAR" | "DOCUMENT_FRAMING_CAMERA_TOO_CLOSE" | "DOCUMENT_FRAMING_CAMERA_ANGLE_TOO_STEEP" | "DOCUMENT_TOO_CLOSE_TO_FRAME_EDGE" | "LIGHTING_TOO_DARK" | "LIGHTING_TOO_BRIGHT" | "BLUR_DETECTED" | "GLARE_DETECTED" | "OCCLUDED" | "WRONG_SIDE";
|
|
875
|
+
|
|
876
|
+
export declare const uiStateMap: Readonly<Record<UiStateKey, UiState>>;
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* Updates the analyzer. Capture process can't be active. Stop it using
|
|
880
|
+
* {@linkcode updateAnalyzerSettings} if required.
|
|
881
|
+
* @param settings {@linkcode AnalyzerSettings}. Will merge with the current
|
|
882
|
+
* settings.
|
|
883
|
+
*/
|
|
884
|
+
declare function updateAnalyzerSettings(settings: Partial<AnalyzerSettings>): Promise<void>;
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* Refreshes available devices on the system and updates the state.
|
|
888
|
+
*/
|
|
889
|
+
declare function updateCameraDevices(): Promise<void>;
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* ⚠️ DANGER AHEAD ⚠️
|
|
893
|
+
*
|
|
894
|
+
* The Zustand store. Use only if you know what you're doing.
|
|
895
|
+
*
|
|
896
|
+
* Never use setters as this will break the application logic. We do not have two-way binding.
|
|
897
|
+
* Make sure you only observe the state.
|
|
898
|
+
*
|
|
899
|
+
* Prefer using subscriptions if you require observable state.
|
|
900
|
+
*
|
|
901
|
+
* {@link https://github.com/pmndrs/zustand}
|
|
902
|
+
*/
|
|
903
|
+
export declare const zustandStore: Omit<StoreApi<ReactiveStore>, "subscribe"> & {
|
|
904
|
+
subscribe: {
|
|
905
|
+
(listener: (selectedState: ReactiveStore, previousSelectedState: ReactiveStore) => void): () => void;
|
|
906
|
+
<U>(selector: (state: ReactiveStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
907
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
908
|
+
fireImmediately?: boolean | undefined;
|
|
909
|
+
} | undefined): () => void;
|
|
910
|
+
};
|
|
911
|
+
};
|
|
912
|
+
|
|
913
|
+
export { }
|