@microblink/capture 1.1.1 → 1.2.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/types/index.d.ts CHANGED
@@ -40,7 +40,7 @@ export declare class Analyzer extends EmbindObject {
40
40
  }
41
41
 
42
42
  /**
43
- * Copyright (c) 2023 Microblink Ltd. All rights reserved.
43
+ * Copyright (c) 2024 Microblink Ltd. All rights reserved.
44
44
  *
45
45
  * ANY UNAUTHORIZED USE OR SALE, DUPLICATION, OR DISTRIBUTION
46
46
  * OF THIS PROGRAM OR ANY OF ITS PARTS, IN SOURCE OR BINARY FORMS,
@@ -64,7 +64,7 @@ export declare type AnalyzerResult = {
64
64
  };
65
65
 
66
66
  /**
67
- * Copyright (c) 2023 Microblink Ltd. All rights reserved.
67
+ * Copyright (c) 2024 Microblink Ltd. All rights reserved.
68
68
  *
69
69
  * ANY UNAUTHORIZED USE OR SALE, DUPLICATION, OR DISTRIBUTION
70
70
  * OF THIS PROGRAM OR ANY OF ITS PARTS, IN SOURCE OR BINARY FORMS,
@@ -78,12 +78,13 @@ export declare type AnalyzerResult = {
78
78
  */
79
79
  export declare type AnalyzerSettings = {
80
80
  /**
81
- * Whether to capture a single side or capture both sides
81
+ * Whether to capture a single side or capture all possible sides
82
+ * Determines whether to capture a single side or capture all possible sides
82
83
  * of a document with automatic side detection.
83
84
  */
84
85
  captureSingleSide: boolean;
85
86
  /**
86
- * Whether to return an image of a cropped and perspective-corrected document.
87
+ * Determines whether to return an image of a cropped and perspective-corrected document.
87
88
  */
88
89
  returnTransformedDocumentImage: boolean;
89
90
  /**
@@ -110,10 +111,15 @@ export declare type AnalyzerSettings = {
110
111
  */
111
112
  documentFramingMargin: number;
112
113
  /**
113
- * Whether to return an image of the transformed document with applied margin
114
+ * Determines whether to return an image of the transformed document with applied margin
114
115
  * used during document framing.
115
116
  */
116
117
  keepMarginOnTransformedDocumentImage: boolean;
118
+ /**
119
+ * Determines whether to preserve the captured document DPI in transformed document image.
120
+ * If disabled, the document DPI is downscaled to 400 DPI.
121
+ */
122
+ keepDpiOnTransformedDocumentImage: boolean;
117
123
  /**
118
124
  * Parameters for lighting estimation.
119
125
  *
@@ -131,32 +137,45 @@ export declare type AnalyzerSettings = {
131
137
  */
132
138
  lightingThresholds: LightingThresholds;
133
139
  /**
134
- * Whether to discard frames with blurred documents.
140
+ * Defines percentage of the document area that is allowed to be occluded by hand.
135
141
  *
136
- * If it is enabled, the capture process is allowed to finish with blur on the
137
- * document.
142
+ * Allowed values are from 0 to 1.
138
143
  */
139
- ignoreBlur: boolean;
144
+ handOcclusionThreshold: number;
140
145
  /**
141
- * Whether to discard frames with glare detected on the document.
146
+ * Defines the tolerance for discarding overly tilted frames.
147
+ * The following values are possible:
142
148
  *
143
- * If it is enabled, the capture process is allowed to finish with glare on
144
- * the document.
149
+ * - `"disabled"` - Disables tilt detection.
150
+ * - `"strict"` - The policy is strict, resulting in more frames being discarded.
151
+ * - `"normal"` - Trade-off between `"strict"` and `"relaxed"`.
152
+ * - `"relaxed"` - The policy is relaxed, resulting in fewer frames being discarded.
153
+ *
154
+ * @defaultValue `"normal"`
145
155
  */
146
- ignoreGlare: boolean;
156
+ tiltPolicy: StrictnessLevel;
147
157
  /**
148
- * Defines percentage of the document area that is allowed to be occluded by hand.
158
+ * Defines the tolerance for discarding overly blurred frames.
159
+ * The following values are possible:
149
160
  *
150
- * Allowed values are from 0 to 1.
161
+ * - `"disabled"` - Disables blur detection.
162
+ * - `"strict"` - The policy is strict, resulting in more frames being discarded.
163
+ * - `"normal"` - Trade-off between `"strict"` and `"relaxed"`.
164
+ * - `"relaxed"` - The policy is relaxed, resulting in fewer frames being discarded.
165
+ *
166
+ * @defaultValue `"normal"`
151
167
  */
152
- handOcclusionThreshold: number;
168
+ blurPolicy: StrictnessLevel;
153
169
  /**
154
- * Threshold for detecting tilted documents. Frames with documents tilted more
155
- * than defined by this threshold are discarded.
170
+ * Defines the tolerance for discarding frames with excessive glare.
171
+ * - `"disabled"` - Disables glare detection.
172
+ * - `"strict"` - The policy is strict, resulting in more frames being discarded.
173
+ * - `"normal"` - Trade-off between `"strict"` and `"relaxed"`.
174
+ * - `"relaxed"` - The policy is relaxed, resulting in fewer frames being discarded.
156
175
  *
157
- * Allowed values are from 0 to 1.
176
+ * @defaultValue `"normal"`
158
177
  */
159
- tiltThreshold: number;
178
+ glarePolicy: StrictnessLevel;
160
179
  /**
161
180
  * Required minimum DPI of the captured document on transformed image.
162
181
  *
@@ -167,9 +186,9 @@ export declare type AnalyzerSettings = {
167
186
  */
168
187
  minimumDocumentDpi: number;
169
188
  /**
170
- * Whether to automatically adjust minimum document dpi.
189
+ * Determines whether to automatically adjust minimum document DPI.
171
190
  *
172
- * If it is enabled, the minimum dpi is adjusted to optimal value for the
191
+ * If it is enabled, the minimum DPI is adjusted to optimal value for the
173
192
  * provided input resolution to enable capture of all document groups.
174
193
  */
175
194
  adjustMinimumDocumentDpi: boolean;
@@ -178,6 +197,7 @@ export declare type AnalyzerSettings = {
178
197
  export declare type BaltazarRequest = Readonly<{
179
198
  licenseId: string;
180
199
  licensee: string;
200
+ applicationIds: Array<string>;
181
201
  packageName: string;
182
202
  platform: string;
183
203
  sdkName: string;
@@ -219,10 +239,17 @@ export declare type CaptureCallbacks = Partial<{
219
239
  onCaptureResult: (result: AnalyzerResult) => void;
220
240
  }>;
221
241
 
242
+ /**
243
+ * The Capture UI component. Provides methods for controlling the Capture SDK and the UI
244
+ */
222
245
  export declare type CaptureComponent = {
246
+ /** The instance of the Capture SDK wrapped by the UI */
247
+ captureSdk: CaptureSdk;
248
+ /** Updates the localization strings */
249
+ updateLocalization: SetStoreFunction<LocalizationStrings>;
223
250
  /** Dismounts the component from the DOM and unloads the SDK */
224
251
  dismount: () => void;
225
- } & ExposedComponentApi;
252
+ };
226
253
 
227
254
  /**
228
255
  * Singleton that represents the Capture SDK
@@ -443,6 +470,13 @@ declare type CreateCaptureUiSettings = {
443
470
  uiSettings?: UiSettings;
444
471
  };
445
472
 
473
+ /**
474
+ * Creates the capture UI with an existing instance of the Capture SDK
475
+ * @param captureSdk
476
+ * @param uiSettings
477
+ */
478
+ export declare function createCaptureUiWithInstance(captureSdk: CaptureSdk, uiSettings?: UiSettings): CaptureComponent;
479
+
446
480
  /**
447
481
  * Creates a new `DirectApi` instance.
448
482
  * @param settings - The settings for the `DirectApi` instance.
@@ -453,7 +487,7 @@ export declare function createDirectApi(settings: DirectApiSettings): Promise<Di
453
487
  declare const createEndpoint: unique symbol;
454
488
 
455
489
  /**
456
- * Copyright (c) 2023 Microblink Ltd. All rights reserved.
490
+ * Copyright (c) 2024 Microblink Ltd. All rights reserved.
457
491
  *
458
492
  * ANY UNAUTHORIZED USE OR SALE, DUPLICATION, OR DISTRIBUTION
459
493
  * OF THIS PROGRAM OR ANY OF ITS PARTS, IN SOURCE OR BINARY FORMS,
@@ -463,43 +497,43 @@ declare const createEndpoint: unique symbol;
463
497
  * REVERSE ENGINEER, DECOMPILE, OR DISASSEMBLE IT.
464
498
  */
465
499
  declare const _default: {
466
- scan_the_front_side: string;
467
- flip_document: string;
468
- scan_the_back_side: string;
469
- scanning_wrong_side: string;
470
- move_closer: string;
471
- move_farther: string;
472
- camera_angle_too_steep: string;
473
- document_too_close_to_edge: string;
474
- rotate_phone_animation: string;
475
- rotate_phone: string;
476
- lightning_too_bright: string;
477
- lightning_too_dark: string;
478
- blur_detected: string;
479
- glare_detected: string;
480
- occluded: string;
481
- need_help_tooltip: string;
482
- onboarding_field_visible_title: string;
483
- onboarding_field_visible_details: string;
484
- tutorial_fields_visible_title: string;
485
- tutorial_fields_visible_start: string;
486
- tutorial_fields_visible_details: string;
487
- tutorial_harsh_light_title: string;
488
- tutorial_harsh_light_details: string;
489
- tutorial_keep_still_title: string;
490
- tutorial_keep_still_details: string;
491
- camera_unavailable: string;
492
- camera_permission_error: string;
493
- settings: string;
494
- camera_media_capture_error: string;
495
- camera_unable_to_resume_session: string;
496
- camera_query_in_progress: string;
497
- done: string;
498
- cancel: string;
499
- back: string;
500
- next: string;
501
- ok: string;
502
- dismiss: string;
500
+ readonly scan_the_front_side: "Scan the front side of the document";
501
+ readonly flip_document: "Flip the document";
502
+ readonly scan_the_back_side: "Scan the back side of the document";
503
+ readonly scanning_wrong_side: "Scanning wrong side";
504
+ readonly move_closer: "Move closer";
505
+ readonly move_farther: "Move farther";
506
+ readonly camera_angle_too_steep: "Keep document parallel to phone";
507
+ readonly document_too_close_to_edge: "Move farther";
508
+ readonly rotate_phone_animation: "Rotate card or turn phone to landscape";
509
+ readonly rotate_phone: "Rotate phone or card";
510
+ readonly lightning_too_bright: "Move to spot with less lighting";
511
+ readonly lightning_too_dark: "Move to brighter spot";
512
+ readonly blur_detected: "Keep document and phone still";
513
+ readonly glare_detected: "Tilt or move document to remove reflection";
514
+ readonly occluded: "Keep the document fully visible";
515
+ readonly need_help_tooltip: "Need help?";
516
+ readonly onboarding_field_visible_title: "Keep all the details visible";
517
+ readonly onboarding_field_visible_details: "Make sure you keep the document well lit. All document fields should be visible on the camera screen.";
518
+ readonly tutorial_fields_visible_title: "Keep all the fields visible";
519
+ readonly tutorial_fields_visible_start: "Start scanning";
520
+ readonly tutorial_fields_visible_details: "Make sure you aren’t covering parts of the document with a finger, including the bottom lines. Also, watch out for hologram reflections that go over the document fields.";
521
+ readonly tutorial_harsh_light_title: "Watch out for harsh light";
522
+ readonly tutorial_harsh_light_details: "Avoid direct harsh light because it reflects from the document and can make parts of the document unreadable. If you can’t read data on the document, it won’t be visible to the camera either.";
523
+ readonly tutorial_keep_still_title: "Keep still while scanning";
524
+ readonly tutorial_keep_still_details: "Try to keep the phone and document still while scanning. Moving either can blur the image and make data on the document unreadable.";
525
+ readonly camera_unavailable: "Camera Unavailable";
526
+ readonly camera_permission_error: "App doesn't have permission to use the camera, please change privacy settings";
527
+ readonly settings: "Settings";
528
+ readonly camera_media_capture_error: "Unable to capture media";
529
+ readonly camera_unable_to_resume_session: "Unable to resume";
530
+ readonly camera_query_in_progress: "Selecting best camera, please wait";
531
+ readonly done: "Done";
532
+ readonly cancel: "Cancel";
533
+ readonly back: "Back";
534
+ readonly next: "Next";
535
+ readonly ok: "OK";
536
+ readonly dismiss: "Dismiss";
503
537
  };
504
538
 
505
539
  /**
@@ -625,7 +659,7 @@ export declare type DocumentOcclusionStatus = "not-available" | "occluded" | "no
625
659
  export declare type DocumentSideAnalysisStatus = "not-available" | "side-already-captured" | "side-not-captured";
626
660
 
627
661
  /**
628
- * Copyright (c) 2023 Microblink Ltd. All rights reserved.
662
+ * Copyright (c) 2024 Microblink Ltd. All rights reserved.
629
663
  *
630
664
  * ANY UNAUTHORIZED USE OR SALE, DUPLICATION, OR DISTRIBUTION
631
665
  * OF THIS PROGRAM OR ANY OF ITS PARTS, IN SOURCE OR BINARY FORMS,
@@ -649,14 +683,6 @@ declare abstract class EmbindObject {
649
683
  delete(): Promise<void>;
650
684
  }
651
685
 
652
- export declare type ExposedComponentApi = {
653
- /** Can return undefined if called after the SDK has been
654
- * destroyed
655
- */
656
- captureSdk: CaptureSdk | undefined;
657
- updateLocalization: SetStoreFunction<LocalizationStrings>;
658
- };
659
-
660
686
  declare class FeedbackParser {
661
687
  private timeWindow;
662
688
  private decayRate;
@@ -695,7 +721,7 @@ export declare type FrameAnalysisError = {
695
721
  export declare type FrameAnalysisErrorType = "analyzer-settings-unsuitable-error" | "unknown-error";
696
722
 
697
723
  /**
698
- * Copyright (c) 2023 Microblink Ltd. All rights reserved.
724
+ * Copyright (c) 2024 Microblink Ltd. All rights reserved.
699
725
  *
700
726
  * ANY UNAUTHORIZED USE OR SALE, DUPLICATION, OR DISTRIBUTION
701
727
  * OF THIS PROGRAM OR ANY OF ITS PARTS, IN SOURCE OR BINARY FORMS,
@@ -729,7 +755,7 @@ export declare type FrameAnalysisStatus = {
729
755
  export declare const getBase64StringFromDataURL: (dataURL: string) => string;
730
756
 
731
757
  /**
732
- * Copyright (c) 2023 Microblink Ltd. All rights reserved.
758
+ * Copyright (c) 2024 Microblink Ltd. All rights reserved.
733
759
  *
734
760
  * ANY UNAUTHORIZED USE OR SALE, DUPLICATION, OR DISTRIBUTION
735
761
  * OF THIS PROGRAM OR ANY OF ITS PARTS, IN SOURCE OR BINARY FORMS,
@@ -747,7 +773,7 @@ export declare enum LicenseTokenState {
747
773
  }
748
774
 
749
775
  /**
750
- * Copyright (c) 2023 Microblink Ltd. All rights reserved.
776
+ * Copyright (c) 2024 Microblink Ltd. All rights reserved.
751
777
  *
752
778
  * ANY UNAUTHORIZED USE OR SALE, DUPLICATION, OR DISTRIBUTION
753
779
  * OF THIS PROGRAM OR ANY OF ITS PARTS, IN SOURCE OR BINARY FORMS,
@@ -758,8 +784,10 @@ export declare enum LicenseTokenState {
758
784
  */
759
785
  export declare type LicenseUnlockResult = Readonly<{
760
786
  isTrial: boolean;
787
+ hasPing: boolean;
761
788
  licenseId: string;
762
789
  licensee: string;
790
+ applicationIds: Array<string>;
763
791
  packageName: string;
764
792
  sdkName: string;
765
793
  sdkVersion: string;
@@ -796,7 +824,11 @@ declare type Local<T> = Omit<LocalObject<T>, keyof ProxyMethods> & (T extends (.
796
824
  }): MaybePromise<Local<Unpromisify<TInstance>>>;
797
825
  } : unknown);
798
826
 
799
- declare type LocalizationStrings = typeof _default;
827
+ declare type LocaleRecord = typeof _default;
828
+
829
+ declare type LocalizationStrings = {
830
+ [K in keyof LocaleRecord]: LocaleRecord[K] | (string & {});
831
+ };
800
832
 
801
833
  /**
802
834
  * Takes the type of an object as a remote thread would see it through a proxy (e.g. when passed in as a function
@@ -1033,6 +1065,8 @@ declare interface StoreApi<T> {
1033
1065
  destroy: () => void;
1034
1066
  }
1035
1067
 
1068
+ export declare type StrictnessLevel = "disabled" | "strict" | "normal" | "relaxed";
1069
+
1036
1070
  /**
1037
1071
  * Branded type for type safety. Requires casting where required.
1038
1072
  */
@@ -1058,7 +1092,15 @@ declare type UiSettings = {
1058
1092
  /**
1059
1093
  * User provided localization keys
1060
1094
  */
1061
- localization?: Partial<Record<keyof LocalizationStrings, string>>;
1095
+ localization?: Partial<LocalizationStrings>;
1096
+ /**
1097
+ * If `true`, the SDK will be destroyed when the component is dismounted.
1098
+ * This is useful if you want to re-initialize the SDK on the same page.
1099
+ *
1100
+ * Defaults to `true` when using `createCaptureUi` and `false` when using
1101
+ * `createCaptureUiWithInstance`.
1102
+ */
1103
+ destroyInstanceOnDismount?: boolean;
1062
1104
  };
1063
1105
 
1064
1106
  export declare type UiState = Readonly<{
Binary file