@microblink/blinkid-ux-manager 7.3.2 → 7.4.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.
Files changed (36) hide show
  1. package/dist/blinkid-ux-manager.js +277 -47
  2. package/dist/blinkid-ux-manager.js.map +1 -1
  3. package/package.json +3 -3
  4. package/types/core/BlinkIdProcessingError.d.ts +5 -0
  5. package/types/core/BlinkIdProcessingError.d.ts.map +1 -1
  6. package/types/core/BlinkIdUxManager.d.ts +86 -25
  7. package/types/core/BlinkIdUxManager.d.ts.map +1 -1
  8. package/types/core/DocumentClassFilter.d.ts +5 -3
  9. package/types/core/DocumentClassFilter.d.ts.map +1 -1
  10. package/types/core/blinkid-ui-state.d.ts +38 -0
  11. package/types/core/blinkid-ui-state.d.ts.map +1 -1
  12. package/types/core/utils.d.ts +18 -0
  13. package/types/core/utils.d.ts.map +1 -1
  14. package/types/index.d.ts +14 -0
  15. package/types/index.d.ts.map +1 -1
  16. package/types/index.rollup.d.ts +267 -35
  17. package/types/ui/BlinkIdFeedbackUi.d.ts +8 -0
  18. package/types/ui/BlinkIdFeedbackUi.d.ts.map +1 -1
  19. package/types/ui/BlinkIdUiStoreContext.d.ts +59 -0
  20. package/types/ui/BlinkIdUiStoreContext.d.ts.map +1 -1
  21. package/types/ui/LocalizationContext.d.ts +14 -0
  22. package/types/ui/LocalizationContext.d.ts.map +1 -1
  23. package/types/ui/UiFeedbackOverlay.d.ts +6 -0
  24. package/types/ui/UiFeedbackOverlay.d.ts.map +1 -1
  25. package/types/ui/createBlinkIdFeedbackUi.d.ts +34 -1
  26. package/types/ui/createBlinkIdFeedbackUi.d.ts.map +1 -1
  27. package/types/ui/dialogs/ErrorModal.d.ts +9 -0
  28. package/types/ui/dialogs/ErrorModal.d.ts.map +1 -1
  29. package/types/ui/dialogs/HelpModal.d.ts +11 -0
  30. package/types/ui/dialogs/HelpModal.d.ts.map +1 -1
  31. package/types/ui/dialogs/OnboardingGuideModal.d.ts +5 -0
  32. package/types/ui/dialogs/OnboardingGuideModal.d.ts.map +1 -1
  33. package/types/ui/feedbackMessages.d.ts +3 -0
  34. package/types/ui/feedbackMessages.d.ts.map +1 -1
  35. package/types/ui/locales/en.d.ts +3 -0
  36. package/types/ui/locales/en.d.ts.map +1 -1
@@ -19,65 +19,99 @@ import { StringKeyOf } from 'type-fest';
19
19
  */
20
20
  export declare type BlinkIdProcessingError = "timeout" | "unknown";
21
21
 
22
+ /**
23
+ * The type of reticle to display.
24
+ */
22
25
  export declare type BlinkIdReticleType = "searching" | "processing" | "error" | "done" | "flip" | "move_top" | "move_left" | "move_right";
23
26
 
27
+ /**
28
+ * The UI state of BlinkID.
29
+ */
24
30
  export declare type BlinkIdUiState = BlinkIdUiStateMap[keyof BlinkIdUiStateMap];
25
31
 
32
+ /**
33
+ * The key of the UI state.
34
+ */
26
35
  export declare type BlinkIdUiStateKey = "FLIP_CARD" | "DOCUMENT_CAPTURED" | "SENSING_FRONT" | "SENSING_BACK" | "SENSING_DATA_PAGE" | "SENSING_TOP_PAGE" | "SENSING_LEFT_PAGE" | "SENSING_RIGHT_PAGE" | "MOVE_TOP" | "MOVE_LEFT" | "MOVE_RIGHT" | "DOCUMENT_FRAMING_CAMERA_TOO_FAR" | "DOCUMENT_FRAMING_CAMERA_TOO_CLOSE" | "DOCUMENT_FRAMING_CAMERA_ANGLE_TOO_STEEP" | "DOCUMENT_TOO_CLOSE_TO_FRAME_EDGE" | "BLUR_DETECTED" | "GLARE_DETECTED" | "TOO_DARK" | "TOO_BRIGHT" | "OCCLUDED" | "FACE_PHOTO_OCCLUDED" | "UNSUPPORTED_DOCUMENT" | "SCAN_BARCODE" | "WRONG_TOP_PAGE" | "WRONG_LEFT_PAGE" | "WRONG_RIGHT_PAGE" | "WRONG_SIDE";
27
36
 
28
37
  /**
29
38
  * Extended UI state for BlinkID.
39
+ *
40
+ * @template K - The key of the UI state.
30
41
  */
31
42
  export declare type BlinkIdUiStateMap = {
32
43
  [K in BlinkIdUiStateKey]: UiState & {
44
+ /** The key of the UI state. */
33
45
  key: K;
46
+ /** The type of the reticle. */
34
47
  reticleType: BlinkIdReticleType;
35
48
  };
36
49
  };
37
50
 
51
+ /**
52
+ * The UI state map of BlinkID.
53
+ */
38
54
  export declare const blinkIdUiStateMap: BlinkIdUiStateMap;
39
55
 
40
56
  /**
41
- * Manages the UX of the BlinkID SDK.
57
+ * The BlinkIdUxManager class. This is the main class that manages the UX of
58
+ * the BlinkID SDK. It is responsible for handling the UI state, the timeout,
59
+ * the help tooltip, and the document class filter.
42
60
  */
43
61
  export declare class BlinkIdUxManager {
44
62
  #private;
63
+ /** The camera manager. */
45
64
  cameraManager: CameraManager;
65
+ /** The scanning session. */
46
66
  scanningSession: RemoteScanningSession;
67
+ /** Whether the demo overlay should be shown. */
47
68
  showDemoOverlay: boolean;
69
+ /** Whether the production overlay should be shown. */
48
70
  showProductionOverlay: boolean;
71
+ /** The current UI state. */
49
72
  uiState: BlinkIdUiState;
73
+ /** The raw UI state key. */
50
74
  rawUiStateKey: BlinkIdUiStateKey;
75
+ /** The feedback stabilizer. */
51
76
  feedbackStabilizer: FeedbackStabilizer<typeof blinkIdUiStateMap>;
77
+ /** The session settings. */
52
78
  sessionSettings: BlinkIdSessionSettings;
79
+ /**
80
+ * The constructor for the BlinkIdUxManager class.
81
+ *
82
+ * @param cameraManager - The camera manager.
83
+ * @param scanningSession - The scanning session.
84
+ */
53
85
  constructor(cameraManager: CameraManager, scanningSession: RemoteScanningSession);
54
86
  /**
55
- * Indicates whether the UI should display the demo overlay. Controlled by the license property.
87
+ * Indicates whether the UI should display the demo overlay. Controlled by the
88
+ * license property.
56
89
  */
57
90
  getShowDemoOverlay(): boolean;
58
91
  /**
59
- * Indicates whether the UI should display the production overlay. Controlled by the license property.
92
+ * Indicates whether the UI should display the production overlay. Controlled by
93
+ * the license property.
60
94
  */
61
95
  getShowProductionOverlay(): boolean;
62
96
  /**
63
97
  * Returns the timeout duration in ms. Null if timeout won't be triggered ever.
64
- * @returns The timeout duration in ms.
65
98
  */
66
99
  getTimeoutDuration(): number | null;
67
100
  /**
68
101
  * Returns the time in ms before the help tooltip is shown. Null if tooltip won't be auto shown.
69
- * @returns The time in ms before the help tooltip is shown.
70
102
  */
71
103
  getHelpTooltipShowDelay(): number | null;
72
104
  /**
73
105
  * Returns the time in ms before the help tooltip is hidden. Null if tooltip won't be auto hidden.
74
- * @returns The time in ms before the help tooltip is hidden.
75
106
  */
76
107
  getHelpTooltipHideDelay(): number | null;
77
108
  /**
78
109
  * Adds a callback function to be executed when the UI state changes.
79
- * @param callback - Function to be called when UI state changes. Receives the new UI state as parameter.
110
+ *
111
+ * @param callback - Function to be called when UI state changes. Receives the
112
+ * new UI state as parameter.
80
113
  * @returns A cleanup function that removes the callback when called.
114
+ *
81
115
  * @example
82
116
  * const cleanup = manager.addOnUiStateChangedCallback((newState) => {
83
117
  * console.log('UI state changed to:', newState);
@@ -88,8 +122,10 @@ export declare class BlinkIdUxManager {
88
122
  addOnUiStateChangedCallback(callback: (uiState: BlinkIdUiState) => void): () => void;
89
123
  /**
90
124
  * Registers a callback function to be called when a scan result is available.
125
+ *
91
126
  * @param callback - A function that will be called with the scan result.
92
- * @returns A cleanup function that, when called, will remove the registered callback.
127
+ * @returns A cleanup function that, when called, will remove the registered
128
+ * callback.
93
129
  *
94
130
  * @example
95
131
  *
@@ -103,8 +139,11 @@ export declare class BlinkIdUxManager {
103
139
  addOnResultCallback(callback: (result: BlinkIdScanningResult) => void): () => void;
104
140
  /**
105
141
  * Registers a callback function to filter document classes.
106
- * @param callback - A function that will be called with the document class info.
107
- * @returns A cleanup function that, when called, will remove the registered callback.
142
+ *
143
+ * @param callback - A function that will be called with the document class
144
+ * info.
145
+ * @returns A cleanup function that, when called, will remove the registered
146
+ * callback.
108
147
  *
109
148
  * @example
110
149
  * const cleanup = manager.addDocumentClassFilter((docClassInfo) => {
@@ -117,8 +156,11 @@ export declare class BlinkIdUxManager {
117
156
  addDocumentClassFilter(callback: DocumentClassFilter): () => void;
118
157
  /**
119
158
  * Registers a callback function to be called when a frame is processed.
120
- * @param callback - A function that will be called with the frame analysis result.
121
- * @returns A cleanup function that, when called, will remove the registered callback.
159
+ *
160
+ * @param callback - A function that will be called with the frame analysis
161
+ * result.
162
+ * @returns A cleanup function that, when called, will remove the registered
163
+ * callback.
122
164
  *
123
165
  * @example
124
166
  * const cleanup = manager.addOnFrameProcessCallback((frameResult) => {
@@ -130,9 +172,12 @@ export declare class BlinkIdUxManager {
130
172
  */
131
173
  addOnFrameProcessCallback(callback: (frameResult: ProcessResultWithBuffer) => void): () => void;
132
174
  /**
133
- * Registers a callback function to be called when an error occurs during processing.
175
+ * Registers a callback function to be called when an error occurs during
176
+ * processing.
177
+ *
134
178
  * @param callback - A function that will be called with the error state.
135
- * @returns A cleanup function that, when called, will remove the registered callback.
179
+ * @returns A cleanup function that, when called, will remove the registered
180
+ * callback.
136
181
  *
137
182
  * @example
138
183
  * const cleanup = manager.addOnErrorCallback((error) => {
@@ -143,46 +188,87 @@ export declare class BlinkIdUxManager {
143
188
  * cleanup();
144
189
  */
145
190
  addOnErrorCallback(callback: (errorState: BlinkIdProcessingError) => void): () => void;
191
+ /**
192
+ * Registers a callback function to be called when a document is filtered.
193
+ *
194
+ * @param callback - A function that will be called with the document class
195
+ * info.
196
+ * @returns A cleanup function that, when called, will remove the registered
197
+ * callback.
198
+ *
199
+ * @example
200
+ * const cleanup = manager.addOnDocumentFilteredCallback((docClassInfo) => {
201
+ * console.log('Document filtered:', docClassInfo);
202
+ * });
203
+ *
204
+ * // Later, to remove the callback:
205
+ * cleanup();
206
+ */
146
207
  addOnDocumentFilteredCallback(callback: (documentClassInfo: DocumentClassInfo) => void): () => void;
147
208
  /**
148
- * Sets the duration after which the scanning session will timeout. The timeout can occur in various scenarios
149
- * and may be restarted by different scanning events.
209
+ * Sets the duration after which the scanning session will timeout. The
210
+ * timeout can occur in various scenarios and may be restarted by different
211
+ * scanning events.
150
212
  *
151
- * @param duration The timeout duration in milliseconds. If null, timeout won't be triggered ever.
152
- * @param setHelpTooltipShowDelay If true, also sets the help tooltip show delay to half of the provided duration. If timeout duration is null, help tooltip show delay will be set to null. Defaults to true.
213
+ * @param duration The timeout duration in milliseconds. If null, timeout won't
214
+ * be triggered ever.
215
+ * @param setHelpTooltipShowDelay If true, also sets the help tooltip show
216
+ * delay to half of the provided duration. If timeout duration is null, help
217
+ * tooltip show delay will be set to null. Defaults to true.
153
218
  * @throws {Error} Throws an error if duration is less than or equal to 0 when not null.
154
219
  */
155
220
  setTimeoutDuration(duration: number | null, setHelpTooltipShowDelay?: boolean): void;
156
221
  /**
157
222
  * Sets the duration in milliseconds before the help tooltip is shown.
158
223
  * A value of null means the help tooltip will not be auto shown.
159
- * @param duration The duration in milliseconds before the help tooltip is shown. If null, tooltip won't be auto shown.
160
- * @throws {Error} Throws an error if duration is less than or equal to 0 when not null.
224
+ *
225
+ * @param duration The duration in milliseconds before the help tooltip is
226
+ * shown. If null, tooltip won't be auto shown.
227
+ * @throws {Error} Throws an error if duration is less than or equal to 0 when
228
+ * not null.
161
229
  */
162
230
  setHelpTooltipShowDelay(duration: number | null): void;
163
231
  /**
164
232
  * Sets the duration in milliseconds before the help tooltip is hidden.
165
233
  * A value of null means the help tooltip will not be auto hidden.
166
- * @param duration The duration in milliseconds before the help tooltip is hidden. If null, tooltip won't be auto hidden.
167
- * @throws {Error} Throws an error if duration is less than or equal to 0 when not null.
234
+ *
235
+ * @param duration The duration in milliseconds before the help tooltip is
236
+ * hidden. If null, tooltip won't be auto hidden.
237
+ * @throws {Error} Throws an error if duration is less than or equal to 0 when
238
+ * not null.
168
239
  */
169
240
  setHelpTooltipHideDelay(duration: number | null): void;
170
241
  /**
171
- * Clears any active timeout.
242
+ * Clears the scanning session timeout.
172
243
  */
173
244
  clearScanTimeout: () => void;
174
245
  /**
175
- * Resets the manager and clears all callbacks.
246
+ * Resets the scanning session.
247
+ *
248
+ * @param startFrameCapture Whether to start frame processing.
249
+ */
250
+ resetScanningSession(startFrameCapture?: boolean): Promise<void>;
251
+ /**
252
+ * Resets the BlinkIdUxManager. Clears all callbacks.
176
253
  *
177
- * Does not reset the camera manager or the BlinkID core instance.
254
+ * Does not reset the camera manager or the scanning session.
178
255
  */
179
256
  reset(): void;
180
257
  }
181
258
 
182
- export declare function createBlinkIdFeedbackUi(blinkIdUxManager: BlinkIdUxManager, cameraManagerComponent: CameraManagerComponent, { localizationStrings, preserveSdkInstance, showOnboardingGuide, showHelpButton, }?: FeedbackUiOptions): () => void;
259
+ /**
260
+ * Creates the BlinkID feedback UI.
261
+ *
262
+ * @param blinkIdUxManager - The BlinkID Ux Manager.
263
+ * @param cameraManagerComponent - The Camera Manager Component.
264
+ * @param options - The options for the createBlinkIdFeedbackUi function.
265
+ *
266
+ * @returns The function to unmount the feedback UI.
267
+ */
268
+ export declare function createBlinkIdFeedbackUi(blinkIdUxManager: BlinkIdUxManager, cameraManagerComponent: CameraManagerComponent, { localizationStrings, preserveSdkInstance, showOnboardingGuide, showHelpButton, showDocumentFilteredModal, showTimeoutModal, showUnsupportedDocumentModal, }?: FeedbackUiOptions): () => void;
183
269
 
184
270
  /**
185
- * Copyright (c) 2025 Microblink Ltd. All rights reserved.
271
+ * The English localization strings.
186
272
  */
187
273
  declare const _default: {
188
274
  readonly scan_the_front_side: "Scan the front side of the document";
@@ -237,10 +323,12 @@ declare const _default: {
237
323
  /**
238
324
  * A type representing a filter function for document classification.
239
325
  *
240
- * This function is used to determine whether a document class is supported or not.
241
- * It takes a `DocumentClassInfo` object as input and returns a boolean value:
326
+ * This function is used to determine whether a document class is supported or
327
+ * not. It takes a `DocumentClassInfo` object as input and returns a boolean
328
+ * value:
242
329
  * - `true`: The document class is supported.
243
- * - `false`: The document class is not supported, and the document will be marked as "unsupported-document".
330
+ * - `false`: The document class is not supported, and the document will be
331
+ * marked as "unsupported-document".
244
332
  *
245
333
  * @param documentClassInfo - Information about the document class, such as country and type.
246
334
  *
@@ -248,33 +336,111 @@ declare const _default: {
248
336
  */
249
337
  export declare type DocumentClassFilter = (documentClassInfo: DocumentClassInfo) => boolean;
250
338
 
339
+ /**
340
+ * FeedbackStabilizer provides UI state management with temporal smoothing.
341
+ *
342
+ * It helps prevent UI "flickering" by:
343
+ * - Maintaining a time-windowed history of UI state changes
344
+ * - Applying weighted averaging to determine the most appropriate state
345
+ * - Supporting immediate state changes through single-emit events
346
+ * - Enforcing minimum display durations for states
347
+ *
348
+ * @typeParam SdkSpecificStateMap - Type extending UiStateMap for SDK-specific states
349
+ */
251
350
  export declare class FeedbackStabilizer<SdkSpecificStateMap extends UiStateMap> {
351
+ /** The initial key. */
252
352
  private initialKey;
353
+ /** The UI state map. */
253
354
  private uiStateMap;
355
+ /** Time window (in ms) for considering UI state events. */
254
356
  private timeWindow;
357
+ /** The decay rate. */
358
+ /** Rate at which event weights decay over time */
255
359
  private decayRate;
360
+ /** Queue of regular UI state events within the time window */
256
361
  private eventQueue;
257
- /** this is a special queue as min duration of the event can be longer than the `timeWindow` */
362
+ /** Special queue for single-emit events that bypass normal stabilization */
258
363
  private singleEventQueue;
364
+ /** Currently displayed state key */
259
365
  private currentKey;
366
+ /** Timestamp when current state started displaying */
260
367
  private currentStateStartTime;
368
+ /** Accumulated scores for each state in current calculation */
261
369
  private summedScores;
370
+ /** History of scores for each state */
262
371
  private scoreBoard;
372
+ /**
373
+ * Gets the currently active UI state configuration.
374
+ *
375
+ * @returns The currently active UI state configuration.
376
+ */
263
377
  get currentState(): SdkSpecificStateMap[`${Extract<keyof SdkSpecificStateMap, string | number>}`];
378
+ /**
379
+ * Gets a copy of the current event queue for debugging.
380
+ *
381
+ * @returns A copy of the current event queue.
382
+ */
264
383
  getEventQueue(): UiStateEvent[];
384
+ /**
385
+ * Gets the current summed scores for each state.
386
+ *
387
+ * @returns The current summed scores for each state.
388
+ */
265
389
  getScores(): Record<string, number>;
390
+ /**
391
+ * Gets the score history for each state.
392
+ *
393
+ * @returns The score history for each state.
394
+ */
266
395
  getScoreBoard(): Record<string, number[]>;
396
+ /**
397
+ * Updates the time window used for state stabilization
398
+ *
399
+ * @param timeWindow - New time window in milliseconds
400
+ */
267
401
  setTimeWindow(timeWindow: number): void;
402
+ /**
403
+ * Creates a new FeedbackStabilizer instance.
404
+ *
405
+ * @param uiStateMap - Map of all possible UI states and their configurations
406
+ * @param initialKey - Key of the initial UI state to display
407
+ * @param timeWindow - Optional custom time window (in ms) for state averaging
408
+ * @param decayRate - Optional custom decay rate for event weights
409
+ */
268
410
  constructor(uiStateMap: SdkSpecificStateMap, initialKey: StringKeyOf<SdkSpecificStateMap>, timeWindow?: number, decayRate?: number);
411
+ /**
412
+ * Resets the stabilizer to its initial state.
413
+ *
414
+ * @returns The initial state.
415
+ */
269
416
  reset(): void;
417
+ /**
418
+ * Checks if enough time has passed to show a new UI state
419
+ *
420
+ * @returns true if the current state's minimum duration has elapsed
421
+ */
270
422
  canShowNewUiState: () => boolean;
271
423
  /**
272
- * Returns a weighted UI state based on the history
424
+ * Processes a new UI state event and determines the state to display.
425
+ *
426
+ * This method:
427
+ * 1. Handles single-emit events that bypass normal stabilization
428
+ * 2. Maintains a time-windowed queue of regular events
429
+ * 3. Applies temporal averaging with decay to determine the winning state
430
+ *
431
+ * @param incomingUiStateKey - Key of the new UI state event
432
+ * @returns The UI state that should be displayed.
273
433
  */
274
434
  getNewUiState(incomingUiStateKey: StringKeyOf<SdkSpecificStateMap>): SdkSpecificStateMap[StringKeyOf<SdkSpecificStateMap>];
275
435
  }
276
436
 
437
+ /**
438
+ * The options for the createBlinkIdFeedbackUi function.
439
+ */
277
440
  export declare type FeedbackUiOptions = {
441
+ /**
442
+ * The localization strings.
443
+ */
278
444
  localizationStrings?: Partial<LocalizationStrings>;
279
445
  /**
280
446
  * If set to `true`, the BlinkID instance will not be terminated when the
@@ -295,45 +461,111 @@ export declare type FeedbackUiOptions = {
295
461
  * @defaultValue true
296
462
  */
297
463
  showHelpButton?: boolean;
464
+ /**
465
+ * If set to `true`, the document filtered modal will be shown.
466
+ *
467
+ * @defaultValue true
468
+ */
469
+ showDocumentFilteredModal?: boolean;
470
+ /**
471
+ * If set to `true`, the timeout modal will be shown.
472
+ *
473
+ * @defaultValue true
474
+ */
475
+ showTimeoutModal?: boolean;
476
+ /**
477
+ * If set to `true`, the document unsupported modal will be shown.
478
+ *
479
+ * @defaultValue true
480
+ */
481
+ showUnsupportedDocumentModal?: boolean;
298
482
  };
299
483
 
484
+ /**
485
+ * The states that are captured when the first side is captured.
486
+ */
300
487
  export declare const firstSideCapturedStates: BlinkIdUiStateKey[];
301
488
 
489
+ /**
490
+ * Determines the appropriate UI state key based on the current frame processing
491
+ * result and scanning settings.
492
+ *
493
+ * This function acts as a state machine, translating the low-level analysis and
494
+ * completeness results into a high-level UI state that drives the user
495
+ * interface.
496
+ *
497
+ * @param frameProcessResult - The current (possibly partial) result of frame
498
+ * processing, including image analysis and completeness.
499
+ * @param settings - Optional scanning settings that may influence state
500
+ * selection.
501
+ * @returns The UI state key representing what should be shown to the user.
502
+ */
302
503
  export declare function getUiStateKey(frameProcessResult: PartialProcessResult, settings?: Partial<ScanningSettings>): BlinkIdUiStateKey;
303
504
 
505
+ /**
506
+ * The locale record type.
507
+ */
304
508
  export declare type LocaleRecord = typeof _default;
305
509
 
510
+ /**
511
+ * The localization strings type.
512
+ */
306
513
  export declare type LocalizationStrings = {
307
514
  [K in keyof LocaleRecord]: LocaleRecord[K] | (string & {});
308
515
  };
309
516
 
517
+ /**
518
+ * The partial process result.
519
+ */
310
520
  export declare type PartialProcessResult = {
521
+ /** The input image analysis result. */
311
522
  inputImageAnalysisResult: Partial<InputImageAnalysisResult>;
523
+ /** The result completeness. */
312
524
  resultCompleteness: Partial<ResultCompleteness>;
313
525
  };
314
526
 
527
+ /**
528
+ * Represents a UI state configuration with timing and weight parameters.
529
+ * Used to define how different UI states should behave in the stabilization process.
530
+ */
315
531
  export declare type UiState = {
532
+ /** Unique identifier for the UI state */
316
533
  key: string;
534
+ /** Minimum duration (in milliseconds) this state should be displayed */
317
535
  minDuration: number;
318
536
  /**
319
537
  * If true, the event will be emitted once the previous event is done.
320
- * It's not going through the averaging process
538
+ * It bypasses the averaging process and is handled separately.
321
539
  */
322
540
  singleEmit?: boolean;
541
+ /**
542
+ * Initial weight for this state when it enters the stabilization queue.
543
+ * Higher values give the state more influence in the averaging process.
544
+ */
323
545
  initialWeight?: number;
324
546
  };
325
547
 
548
+ /**
549
+ * Represents a UI state event in the stabilization queue.
550
+ * These events are processed to determine which UI state should be displayed.
551
+ */
326
552
  export declare type UiStateEvent = {
553
+ /** Identifier matching a UI state key */
327
554
  key: string;
555
+ /** High-resolution timestamp when the event occurred */
328
556
  timeStamp: DOMHighResTimeStamp;
557
+ /** Current weight of this event in the stabilization process */
329
558
  currentWeight: number;
330
559
  /**
331
- * If true, the event will be emitted once the previous event is done.
332
- * It's not going through the averaging process
560
+ * If true, this event will be emitted once the previous event completes.
561
+ * It bypasses the normal stabilization process.
333
562
  */
334
563
  singleEmit?: boolean;
335
564
  };
336
565
 
566
+ /**
567
+ * Maps state keys to their corresponding UI state configurations.
568
+ */
337
569
  export declare type UiStateMap = Record<string, UiState>;
338
570
 
339
571
  export { }
@@ -4,6 +4,14 @@
4
4
  import type { Component } from "solid-js";
5
5
  import { LocalizationStrings } from "./LocalizationContext";
6
6
  import "virtual:uno.css";
7
+ /**
8
+ * The BlinkIdFeedbackUi component. This is the main component that renders the
9
+ * feedback UI for the BlinkID SDK. It is responsible for rendering the feedback
10
+ * UI, the overlays, and the help button.
11
+ *
12
+ * @param props - The props for the BlinkIdFeedbackUi component.
13
+ * @returns The BlinkIdFeedbackUi component.
14
+ */
7
15
  export declare const BlinkIdFeedbackUi: Component<{
8
16
  localization?: Partial<LocalizationStrings>;
9
17
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"BlinkIdFeedbackUi.d.ts","sourceRoot":"","sources":["../../src/ui/BlinkIdFeedbackUi.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAc1C,OAAO,EAEL,mBAAmB,EAEpB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,iBAAiB,CAAC;AAazB,eAAO,MAAM,iBAAiB,EAAE,SAAS,CAAC;IACxC,YAAY,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC7C,CAqIA,CAAC"}
1
+ {"version":3,"file":"BlinkIdFeedbackUi.d.ts","sourceRoot":"","sources":["../../src/ui/BlinkIdFeedbackUi.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAc1C,OAAO,EAEL,mBAAmB,EAEpB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,iBAAiB,CAAC;AAYzB;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,CAAC;IACxC,YAAY,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC7C,CAoJA,CAAC"}
@@ -6,29 +6,88 @@ import { type ParentComponent } from "solid-js";
6
6
  import { SetStoreFunction } from "solid-js/store";
7
7
  import type { BlinkIdProcessingError } from "../core/BlinkIdProcessingError";
8
8
  import type { BlinkIdUxManager } from "../core/BlinkIdUxManager";
9
+ /**
10
+ * The BlinkIdUiStore type.
11
+ */
9
12
  export type BlinkIdUiStore = {
13
+ /**
14
+ * The BlinkIdUxManager instance.
15
+ */
10
16
  blinkIdUxManager: BlinkIdUxManager;
17
+ /**
18
+ * The CameraManagerComponent instance.
19
+ */
11
20
  cameraManagerComponent: CameraManagerComponent;
21
+ /**
22
+ * The error state.
23
+ */
12
24
  errorState?: BlinkIdProcessingError;
25
+ /**
26
+ * Whether the document has been filtered.
27
+ */
13
28
  documentFiltered: boolean;
29
+ /**
30
+ * Whether the onboarding guide should be shown.
31
+ */
14
32
  showOnboardingGuide?: boolean;
33
+ /**
34
+ * The timeout for the help tooltip.
35
+ */
15
36
  showHelpTooltipTimeout?: number;
37
+ /**
38
+ * Whether the help modal should be shown.
39
+ */
16
40
  showHelpModal?: boolean;
41
+ /**
42
+ * Whether the help button should be shown.
43
+ */
17
44
  showHelpButton?: boolean;
45
+ /**
46
+ * Whether the document filtered modal should be shown.
47
+ */
48
+ showDocumentFilteredModal?: boolean;
49
+ /**
50
+ * Whether the timeout modal should be shown.
51
+ */
52
+ showTimeoutModal?: boolean;
53
+ /**
54
+ * Whether the document unsupported modal should be shown.
55
+ */
56
+ showUnsupportedDocumentModal?: boolean;
57
+ /**
58
+ * The function to dismount the feedback UI.
59
+ */
18
60
  dismountFeedbackUi: () => void;
19
61
  };
62
+ /**
63
+ * The BlinkIdUiStoreContextValue type.
64
+ */
20
65
  type BlinkIdUiStoreContextValue = {
21
66
  store: BlinkIdUiStore;
22
67
  updateStore: SetStoreFunction<BlinkIdUiStore>;
23
68
  };
69
+ /**
70
+ * The BlinkIdUiStoreProvider component.
71
+ *
72
+ * @param props - The props for the BlinkIdUiStoreProvider component.
73
+ * @returns The BlinkIdUiStoreProvider component.
74
+ */
24
75
  export declare const BlinkIdUiStoreProvider: ParentComponent<{
25
76
  blinkIdUxManager: BlinkIdUxManager;
26
77
  cameraManagerComponent: CameraManagerComponent;
27
78
  showOnboardingGuide?: boolean;
28
79
  showHelpButton?: boolean;
29
80
  showHelpTooltipTimeout?: number;
81
+ showDocumentFilteredModal?: boolean;
82
+ showTimeoutModal?: boolean;
83
+ showUnsupportedDocumentModal?: boolean;
30
84
  dismountFeedbackUi: () => void;
31
85
  }>;
86
+ /**
87
+ * The useBlinkIdUiStore function.
88
+ *
89
+ * @returns The BlinkIdUiStore.
90
+ */
32
91
  export declare function useBlinkIdUiStore(): BlinkIdUiStoreContextValue;
33
92
  export {};
34
93
  //# sourceMappingURL=BlinkIdUiStoreContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BlinkIdUiStoreContext.d.ts","sourceRoot":"","sources":["../../src/ui/Blin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C/C,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,kBAAkB,EAAE,MAAM,IAAI,CAAC;CAChC,CAmCA,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,iBAAiB,+BAOhC"}
@@ -4,13 +4,27 @@
4
4
  import { ParentComponent } from "solid-js";
5
5
  import { SetStoreFunction } from "solid-js/store";
6
6
  import enLocaleStrings from "./locales/en";
7
+ /**
8
+ * The locale record type.
9
+ */
7
10
  export type LocaleRecord = typeof enLocaleStrings;
11
+ /**
12
+ * The localization strings type.
13
+ */
8
14
  export type LocalizationStrings = {
9
15
  [K in keyof LocaleRecord]: LocaleRecord[K] | (string & {});
10
16
  };
17
+ /**
18
+ * The localization provider.
19
+ */
11
20
  export declare const LocalizationProvider: ParentComponent<{
12
21
  userStrings?: Partial<LocalizationStrings>;
13
22
  }>;
23
+ /**
24
+ * The use localization hook.
25
+ *
26
+ * @returns The localization strings.
27
+ */
14
28
  export declare function useLocalization(): {
15
29
  t: LocalizationStrings;
16
30
  updateLocalization: SetStoreFunction<LocalizationStrings>;
@@ -1 +1 @@
1
- {"version":3,"file":"LocalizationContext.d.ts","sourceRoot":"","sources":["../../src/ui/LocalizationContext.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,eAAe,EAIhB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,gBAAgB,EAAe,MAAM,gBAAgB,CAAC;AAE/D,OAAO,eAAe,MAAM,cAAc,CAAC;AAE3C,MAAM,MAAM,YAAY,GAAG,OAAO,eAAe,CAAC;AAElD,MAAM,MAAM,mBAAmB,GAAG;KAI/B,CAAC,IAAI,MAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC;CAC3D,CAAC;AAOF,eAAO,MAAM,oBAAoB,EAAE,eAAe,CAAC;IACjD,WAAW,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC5C,CA0BA,CAAC;AAEF,wBAAgB,eAAe;OAlC1B,mBAAmB;wBACF,gBAAgB,CAAC,mBAAmB,CAAC;EAuC1D"}
1
+ {"version":3,"file":"LocalizationContext.d.ts","sourceRoot":"","sources":["../../src/ui/LocalizationContext.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,eAAe,EAIhB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,gBAAgB,EAAe,MAAM,gBAAgB,CAAC;AAE/D,OAAO,eAAe,MAAM,cAAc,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,eAAe,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;KAI/B,CAAC,IAAI,MAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC;CAC3D,CAAC;AAUF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,eAAe,CAAC;IACjD,WAAW,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC5C,CA0BA,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,eAAe;OA1C1B,mBAAmB;wBACF,gBAAgB,CAAC,mBAAmB,CAAC;EA+C1D"}
@@ -3,6 +3,12 @@
3
3
  */
4
4
  import { Component } from "solid-js";
5
5
  import { BlinkIdUiState } from "../core/blinkid-ui-state";
6
+ /**
7
+ * The UiFeedbackOverlay component.
8
+ *
9
+ * @param props - The props for the UiFeedbackOverlay component.
10
+ * @returns The UiFeedbackOverlay component.
11
+ */
6
12
  export declare const UiFeedbackOverlay: Component<{
7
13
  uiState: BlinkIdUiState;
8
14
  }>;