@pixelverse/strichjs-sdk 1.4.2 → 1.4.4

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/dist/strich.d.ts CHANGED
@@ -1,192 +1,146 @@
1
1
  /**
2
- * STRICH SDK error class
2
+ * BarcodeReader is the primary interface of the STRICH SDK.
3
3
  */
4
- export class SdkError extends Error {
4
+ export declare class BarcodeReader {
5
+ private configuration;
5
6
  /**
6
- * Flag indicating if this error is related to camera access.
7
+ * User-supplied barcode detection handler.
8
+ *
9
+ * This is a synchronous call, so further processing will not happen until the handler returns.
7
10
  */
8
- duringCameraAccess: boolean;
11
+ detected?: (detections: CodeDetection[]) => (void);
9
12
  /**
10
- * A localized error message, if available, otherwise this will contain the non-localized message.
13
+ * Optional user-supplied error callback.
14
+ *
15
+ * This is invoked by the BarcodeReader if an error occurred while processing frames, and is usually not
16
+ * recoverable.
11
17
  */
12
- localizedMessage: string;
18
+ onError?: (error: Error) => (void);
13
19
  /**
14
- * An optional underlying error that caused this error.
20
+ * Create a new BarcodeReader using a Configuration.
21
+ *
22
+ * @param configuration - A configuration object.
15
23
  */
16
- cause?: Error;
24
+ constructor(configuration: Configuration);
17
25
  /**
18
- * An optional detail message to display to disambiguate multiple errors (not-translated)
26
+ * Initialize the BarcodeReader instance.
27
+ *
28
+ * @returns A promise resolving to an initialized BarcodeReader instance, or an error object.
19
29
  */
20
- detailMessage?: string;
21
- constructor(keyOrMessage: string, cause?: Error);
30
+ initialize(): Promise<BarcodeReader>;
22
31
  /**
23
- * Create an SDK error for a license checking error including detail.
24
- *
25
- * This sets the detailMessage member but also adds the detail message to
26
- * message itself, as it contains valuable hints as to why the license
27
- * check failed.
28
- *
29
- * @param detailMessage
32
+ * Start scanning for barcodes.
30
33
  */
31
- static invalidLicenseErrorWithDetail(detailMessage: string): SdkError;
32
- }
33
- /**
34
- * Configuration for the frame source (camera).
35
- */
36
- export interface FrameSourceConfiguration {
34
+ start(): Promise<void>;
35
+ private tick;
37
36
  /**
38
- * Video frame resolution.
39
- *
40
- * @remarks
41
- * The default resolution is 720p, which is usually enough for good quality
42
- * barcodes. You can try higher resolutions if you have very fine or
43
- * degraded codes, at the expense of higher computational requirements.
37
+ * Stop the BarcodeReader instance.
44
38
  *
45
- * @defaultValue hd
39
+ * This will temporarily suspend processing of camera frames / detection of codes.
46
40
  */
47
- resolution?: 'hd' | 'full-hd' | 'auto';
41
+ stop(): Promise<void>;
48
42
  /**
49
- * Remember the camera that was last used to successfully scan a code.
43
+ * Destroy this BarcodeReader instance, making it unusable.
50
44
  *
51
- * @remarks
52
- * If this is set to true, the frame source will remember the camera used
53
- * whenever a code was successfully scanned, and attempt to use the same
54
- * camera again when re-initialized.
45
+ * This will release all associated resources, and should be called whenever an application no longer needs to
46
+ * scan.
55
47
  *
56
- * @defaultValue false
48
+ * @returns Promise that resolves when the BarcodeReader and its associated resources are fully destroyed.
57
49
  */
58
- rememberCameraDeviceId?: boolean;
50
+ destroy(): Promise<void>;
59
51
  /**
60
- * Allow passing in exact constraints for camera device selection via
61
- * [getUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#constraints).
62
- * If set, will override the {@link resolution} property and any other camera-related properties.
63
- *
64
- * @example
65
- * In the example below, a camera device is explicitly selected by ID. Audio is explicitly not requested (never
66
- * used by STRICH) and an HD-like resolution preference is specified by range.
67
- *
68
- * ```js
69
- * constraints: {
70
- * video: {
71
- * deviceId: {
72
- * exact: '2d122f8e0630b5a6a19c157f066e13e05115f12f7d4dfb29e5560b4acefe7308'
73
- * },
74
- * width: {min: 800, ideal: 1280, max: 1600},
75
- * height: {min: 600, ideal: 720, max: 900}
76
- * },
77
- * audio: false
78
- * }
79
- * ```
80
- *
81
- * @remarks
82
- * This is an advanced option, and should only be used if you are familiar with the
83
- * [Media Capture and Streams API](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia)
84
- * and have to build your own camera selection workflow.
52
+ * Show/hide the BarcodeReader instance.
85
53
  *
86
- * @defaultValue undefined
54
+ * @param visible - True/false for visible/hidden
87
55
  */
88
- constraints?: MediaStreamConstraints;
56
+ setVisible(visible: boolean): Promise<void>;
57
+ /**
58
+ * @returns the current visibility of this BarcodeReader instance
59
+ */
60
+ getVisible(): boolean;
89
61
  }
90
- export function defaultFrameSourceConfiguration(): FrameSourceConfiguration;
62
+
91
63
  /**
92
- * The region of interest is specified as an inset between screen edge and RoE on each side,
93
- * expressed as a fractional value (between 0 and 0.5).
94
- *
95
- * For instance, to have an area that occupies the middle 80% horizontal area and 50% vertical area, you would
96
- * specify the region of interest as follows:
97
- *
98
- * ```json
99
- * { left: 0.1, right: 0.1, top: 0.25, bottom: 0.25 }
100
- * ```
101
- * (10% width inset on each side, 25% height inset on each side)
64
+ * A code detection reported by the STRICH SDK.
102
65
  */
103
- export interface RegionOfInterest {
66
+ export declare interface CodeDetection {
104
67
  /**
105
- * Left inset, relative [0 .. 0.5].
106
- *
107
- * @example 0.1
68
+ * The textual data contained in the code.
108
69
  */
109
- left: number;
70
+ data: string;
110
71
  /**
111
- * Top inset, relative [0 .. 0.5].
112
- *
113
- * @example 0.25
72
+ * The type of detected code.
114
73
  */
115
- top: number;
74
+ typeName: string;
116
75
  /**
117
- * Right inset, relative [0 .. 0.5].
76
+ * Supplemental data for this code.
77
+ */
78
+ supplementalData: string | null;
79
+ /**
80
+ * The bounding rectangle in which the code was detected.
118
81
  *
119
- * @example 0.1
82
+ * Note: this might not be precise, especially for 1D barcodes.
120
83
  */
121
- right: number;
84
+ boundingRect: Rect;
122
85
  /**
123
- * Bottom inset, relative [0 .. 0.5]
86
+ * The quadrilateral in which the code was detected.
124
87
  *
125
- * @example 0.25
88
+ * For rotated or warped codes, this might contain a more precise location estimate than boundingRect.
126
89
  */
127
- bottom: number;
90
+ quadrilateral: Quadrilateral;
91
+ /**
92
+ * The time of detection.
93
+ */
94
+ time: number;
95
+ /**
96
+ * The raw contained bytes contained in the code.
97
+ */
98
+ rawData: Uint8Array;
128
99
  }
100
+
129
101
  /**
130
- * Locator configuration
102
+ * BarcodeReader configuration object.
131
103
  */
132
- export interface LocatorConfiguration {
104
+ export declare interface Configuration {
133
105
  /**
134
- * The region of interest in viewport coordinates.
106
+ * CSS Selector or reference to the HTML element that will host the visible elements of the BarcodeReader.
135
107
  *
136
- * @remarks if no region of interest is specified, an appropriate one will automatically be selected at run-time
137
- * depending on the configured symbologies.
108
+ * @remarks
109
+ * When using a selector, make sure the selector only matches a single element, e.g. by using an ID.
138
110
  */
139
- regionOfInterest?: RegionOfInterest;
111
+ selector: string | HTMLElement;
140
112
  /**
141
- * Disregard colorful areas, assume barcodes are printed black on white.
113
+ * Mode: can be 'immediate' (default) for always-on scanning, and 'touch', to only scan when a touch occurs.
142
114
  *
143
- * @remarks This is an advanced setting and should normally not be changed.
144
- * @defaultValue false
115
+ * @defaultValue immediate
145
116
  */
146
- chromaReject?: boolean;
117
+ mode?: 'immediate' | 'touch';
147
118
  /**
148
- * The locator implementation to use. This should normally not be changed, unless it is specifically required
149
- * to target WebGL 1.
150
- *
151
- * @remarks This is an advanced setting and should normally not be changed, unless targeting WebGL1 and not
152
- * WebGL2 is explicitly required.
153
- * @defaultValue auto
119
+ * Frame source configuration
154
120
  */
155
- impl?: 'auto' | 'webgl1' | 'webgl2';
121
+ frameSource?: FrameSourceConfiguration;
156
122
  /**
157
- * Disable asynchronous reads from GPU when using `webgl2` {@link impl}.
158
- *
159
- * @remarks Some older iOS versions have issues with WebGL2 asynchronous reads. There is usually no need to change
160
- * this setting from its default.
161
- * @defaultValue false
123
+ * Locator configuration
162
124
  */
163
- forceSyncReadback?: boolean;
164
- }
165
- /**
166
- * The supported symbologies.
167
- */
168
- export type SymbologyName = 'ean13' | 'ean8' | 'ean5' | 'ean2' | 'upca' | 'upce' | 'databar' | 'databar-exp' | 'code39' | 'code93' | 'code128' | 'i25' | 'codabar' | 'qr' | 'aztec' | 'datamatrix' | 'pdf417';
169
- /**
170
- * For variable-length symbologies, min/max length can be specified in addition to the symbology.
171
- */
172
- export type SymbologySpec = {
125
+ locator?: LocatorConfiguration;
173
126
  /**
174
- * The name of the symbology.
127
+ * Engine configuration
175
128
  */
176
- name: SymbologyName;
129
+ engine?: EngineConfiguration;
177
130
  /**
178
- * The minimum length of the barcode, only has an effect for variable-length symbologies.
131
+ * Overlay configuration
179
132
  */
180
- minLen?: number;
133
+ overlay?: OverlayConfiguration;
181
134
  /**
182
- * The maximum length of the barcode, only has an effect for variable-length symbologies.
135
+ * Feedback configuration
183
136
  */
184
- maxLen?: number;
185
- };
137
+ feedback?: FeedbackConfiguration;
138
+ }
139
+
186
140
  /**
187
141
  * Engine configuration
188
142
  */
189
- export interface EngineConfiguration {
143
+ export declare interface EngineConfiguration {
190
144
  /**
191
145
  * The enabled symbologies.
192
146
  *
@@ -196,8 +150,8 @@ export interface EngineConfiguration {
196
150
  *
197
151
  * @example ['qr', 'code128']
198
152
  *
199
- * @default
200
- * ```undefined```
153
+ * @defaultValue
154
+ * `undefined`
201
155
  * (all symbologies enabled - NOT RECOMMENDED)
202
156
  */
203
157
  symbologies?: (SymbologyName | SymbologySpec)[];
@@ -220,60 +174,171 @@ export interface EngineConfiguration {
220
174
  */
221
175
  minScanlinesNeeded?: number;
222
176
  /**
223
- * Toggle recognition of inverted barcodes (light print on dark background).
224
- *
225
- * @remarks
226
- * This should only be enabled if you need to detect these barcodes, as additional processing will take place.
177
+ * Toggle recognition of inverted barcodes (light print on dark background).
178
+ *
179
+ * @remarks
180
+ * This should only be enabled if you need to detect these barcodes, as additional processing will take place.
181
+ *
182
+ * @defaultValue false
183
+ */
184
+ invertedCodes?: boolean;
185
+ /**
186
+ * Time interval in milliseconds during which multiple detections of the same code are not repeated.
187
+ *
188
+ * @remarks It is recommended to set a duplicateInterval as scans are metered except in Enterprise subscriptions.
189
+ * @defaultValue 750
190
+ */
191
+ duplicateInterval?: number;
192
+ /**
193
+ * Set the minimum occurrence count for 1D barcodes with weak checksums in a given time window for it be accepted.
194
+ *
195
+ * @remarks
196
+ * Setting this parameter to 0 disables hysteresis (default behavior for versions up to 1.1.0)
197
+ *
198
+ * @defaultValue 2
199
+ */
200
+ hysteresisMinCount?: number;
201
+ /**
202
+ * Set the duration of the hysteresis window in milliseconds.
203
+ *
204
+ * @defaultValue 350
205
+ */
206
+ hysteresisInterval?: number;
207
+ }
208
+
209
+ /**
210
+ * User feedback configuration
211
+ */
212
+ export declare interface FeedbackConfiguration {
213
+ /**
214
+ * Toggle audible beep upon successful scan.
215
+ *
216
+ * @defaultValue true
217
+ */
218
+ audio?: boolean;
219
+ /**
220
+ * Toggle vibration upon successful scan, if supported by device.
221
+ *
222
+ * @defaultValue true
223
+ */
224
+ vibration?: boolean;
225
+ }
226
+
227
+ /**
228
+ * Configuration for the frame source (camera).
229
+ */
230
+ export declare interface FrameSourceConfiguration {
231
+ /**
232
+ * Video frame resolution.
233
+ *
234
+ * @remarks
235
+ * The default resolution is 720p, which is usually enough for good quality
236
+ * barcodes. You can try higher resolutions if you have very fine or
237
+ * degraded codes, at the expense of higher computational requirements.
238
+ *
239
+ * @defaultValue hd
240
+ */
241
+ resolution?: 'hd' | 'full-hd' | 'auto';
242
+ /**
243
+ * Remember the camera that was last used to successfully scan a code.
244
+ *
245
+ * @remarks
246
+ * If this is set to true, the frame source will remember the camera used
247
+ * whenever a code was successfully scanned, and attempt to use the same
248
+ * camera again when re-initialized.
249
+ *
250
+ * @defaultValue false
251
+ */
252
+ rememberCameraDeviceId?: boolean;
253
+ /**
254
+ * Allow passing in exact constraints for camera device selection via
255
+ * [getUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#constraints).
256
+ * If set, will override the {@link FrameSourceConfiguration.resolution} property and any other camera-related properties.
257
+ *
258
+ * @example
259
+ * In the example below, a camera device is explicitly selected by ID. Audio is explicitly not requested (never
260
+ * used by STRICH) and an HD-like resolution preference is specified by range.
261
+ *
262
+ * ```js
263
+ * constraints: {
264
+ * video: {
265
+ * deviceId: {
266
+ * exact: '2d122f8e0630b5a6a19c157f066e13e05115f12f7d4dfb29e5560b4acefe7308'
267
+ * },
268
+ * width: {min: 800, ideal: 1280, max: 1600},
269
+ * height: {min: 600, ideal: 720, max: 900}
270
+ * },
271
+ * audio: false
272
+ * }
273
+ * ```
274
+ *
275
+ * @remarks
276
+ * This is an advanced option, and should only be used if you are familiar with the
277
+ * [Media Capture and Streams API](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia)
278
+ * and have to build your own camera selection workflow.
279
+ *
280
+ * @defaultValue undefined
281
+ */
282
+ constraints?: MediaStreamConstraints;
283
+ }
284
+
285
+ /**
286
+ * Locator configuration
287
+ */
288
+ export declare interface LocatorConfiguration {
289
+ /**
290
+ * The region of interest in viewport coordinates.
227
291
  *
228
- * @defaultValue false
292
+ * @remarks if no region of interest is specified, an appropriate one will automatically be selected at run-time
293
+ * depending on the configured symbologies.
229
294
  */
230
- invertedCodes?: boolean;
295
+ regionOfInterest?: RegionOfInterest;
231
296
  /**
232
- * Time interval in milliseconds during which multiple detections of the same code are not repeated.
297
+ * Disregard colorful areas, assume barcodes are printed black on white.
233
298
  *
234
- * @remarks It is recommended to set a duplicateInterval as scans are metered except in Enterprise subscriptions.
235
- * @defaultValue 750
299
+ * @remarks This is an advanced setting and should normally not be changed.
300
+ * @defaultValue false
236
301
  */
237
- duplicateInterval?: number;
302
+ chromaReject?: boolean;
238
303
  /**
239
- * Set the minimum occurrence count for 1D barcodes with weak checksums in a given time window for it be accepted.
240
- *
241
- * @remarks
242
- * Setting this parameter to 0 disables hysteresis (default behavior for versions <= 1.1.0)
304
+ * The locator implementation to use. This should normally not be changed, unless it is specifically required
305
+ * to target WebGL 1.
243
306
  *
244
- * @defaultValue 2
307
+ * @remarks This is an advanced setting and should normally not be changed, unless targeting WebGL1 and not
308
+ * WebGL2 is explicitly required.
309
+ * @defaultValue auto
245
310
  */
246
- hysteresisMinCount?: number;
311
+ impl?: 'auto' | 'webgl1' | 'webgl2';
247
312
  /**
248
- * Set the duration of the hysteresis window in milliseconds.
313
+ * Disable asynchronous reads from GPU when using `webgl2` {@link LocatorConfiguration.impl}.
249
314
  *
250
- * @defaultValue 350
315
+ * @remarks Some older iOS versions have issues with WebGL2 asynchronous reads. There is usually no need to change
316
+ * this setting from its default.
317
+ * @defaultValue false
251
318
  */
252
- hysteresisInterval?: number;
319
+ forceSyncReadback?: boolean;
253
320
  }
321
+
254
322
  /**
255
323
  * Overlay configuration
256
324
  */
257
- export interface OverlayConfiguration {
325
+ export declare interface OverlayConfiguration {
258
326
  /**
259
327
  * Indicate if a horizontal line should be drawn to aid in positioning 1D barcodes.
260
328
  *
261
329
  * @defaultValue true
262
- * @category Styling
263
330
  */
264
331
  showTargetingLine?: boolean;
265
332
  /**
266
333
  * Indicate if the overlay should draw the bounding boxes of detected barcodes on top of the camera preview.
267
334
  *
268
335
  * @defaultValue true
269
- * @category Styling
270
336
  */
271
337
  showDetections?: boolean;
272
338
  /**
273
339
  * Indicate if the camera selector should be shown in the overlay.
274
340
  *
275
341
  * @defaultValue true
276
- * @category Interaction
277
342
  */
278
343
  showCameraSelector?: boolean;
279
344
  /**
@@ -283,7 +348,6 @@ export interface OverlayConfiguration {
283
348
  * offered in the camera selector.
284
349
  *
285
350
  * @defaultValue true
286
- * @category Interaction
287
351
  */
288
352
  filterCameras?: boolean;
289
353
  /**
@@ -291,7 +355,6 @@ export interface OverlayConfiguration {
291
355
  *
292
356
  * @remarks Flashlight functionality is not supported in some browsers.
293
357
  * @defaultValue true
294
- * @category Interaction
295
358
  */
296
359
  showFlashlight?: boolean;
297
360
  /**
@@ -299,7 +362,6 @@ export interface OverlayConfiguration {
299
362
  *
300
363
  * @remarks Triggering autofocus is currently only available on Android devices.
301
364
  * @defaultValue true
302
- * @category Interaction
303
365
  */
304
366
  focusOnTap?: boolean;
305
367
  /**
@@ -307,7 +369,6 @@ export interface OverlayConfiguration {
307
369
  * format, with the color components given as integers with no separating whitespace.
308
370
  *
309
371
  * @defaultValue rgb(255,255,255)
310
- * @category Styling
311
372
  */
312
373
  primaryColor?: string;
313
374
  /**
@@ -315,9 +376,8 @@ export interface OverlayConfiguration {
315
376
  * components given as integers with no separating whitespace. The fill will become transparent when the
316
377
  * detection becomes stale.
317
378
  *
318
- * @remarks Only has an effect if {@link showDetections} is true.
379
+ * @remarks Only has an effect if {@link OverlayConfiguration.showDetections} is true.
319
380
  * @defaultValue rgb(0,0,255)
320
- * @category Styling
321
381
  */
322
382
  detectionFillColor?: string;
323
383
  /**
@@ -325,9 +385,8 @@ export interface OverlayConfiguration {
325
385
  * with the color components given as integers with no separating whitespace. The border will become transparent
326
386
  * when the detection becomes stale.
327
387
  *
328
- * @remarks Only has an effect if {@link showDetections} is true.
388
+ * @remarks Only has an effect if {@link OverlayConfiguration.showDetections} is true.
329
389
  * @defaultValue undefined
330
- * @category Styling
331
390
  */
332
391
  detectionBorderColor?: string;
333
392
  /**
@@ -337,7 +396,6 @@ export interface OverlayConfiguration {
337
396
  * The allowed range is 0 to 4 pixels. Values outside the range are clamped.
338
397
  *
339
398
  * @defaultValue 0
340
- * @category Styling
341
399
  */
342
400
  detectionBorderWidth?: number;
343
401
  /**
@@ -345,7 +403,6 @@ export interface OverlayConfiguration {
345
403
  * Must be specified in rgb() format, with the color components given as integers with no separating whitespace.
346
404
  *
347
405
  * @defaultvalue rgb(255,0,0)
348
- * @category Styling
349
406
  */
350
407
  targetingLineActiveColor?: string;
351
408
  /**
@@ -354,7 +411,6 @@ export interface OverlayConfiguration {
354
411
  * The allowed range of the corner radius is 0 to 8 pixels.
355
412
  *
356
413
  * @defaultValue 0
357
- * @category Styling
358
414
  */
359
415
  cornerRadius?: number;
360
416
  /**
@@ -364,84 +420,116 @@ export interface OverlayConfiguration {
364
420
  * should have a transparent background (WebP or PNG format). The recommended size is 140x30 pixels.
365
421
  *
366
422
  * @remarks This is an enterprise-only capability.
367
- * @category Styling
368
423
  */
369
424
  customLogoSrc?: string;
370
425
  }
426
+
371
427
  /**
372
- * User feedback configuration
428
+ * A point in two-dimensional space.
429
+ *
430
+ * The y coordinate origin starts at the top.
373
431
  */
374
- export interface FeedbackConfiguration {
432
+ export declare interface Point {
375
433
  /**
376
- * Toggle audible beep upon successful scan.
377
- *
378
- * @defaultValue true
434
+ * The x-coordinate in pixels.
379
435
  */
380
- audio?: boolean;
436
+ x: number;
381
437
  /**
382
- * Toggle vibration upon successful scan, if supported by device.
383
- *
384
- * @defaultValue true
438
+ * The y-coordinate in pixels.
385
439
  */
386
- vibration?: boolean;
440
+ y: number;
387
441
  }
442
+
388
443
  /**
389
- * BarcodeReader configuration object.
444
+ * A non-intersecting polygon with four points.
390
445
  */
391
- export interface Configuration {
446
+ export declare interface Quadrilateral {
392
447
  /**
393
- * CSS Selector or reference to the HTML element that will host the visible elements of the BarcodeReader.
394
- *
395
- * @remarks
396
- * When using a selector, make sure the selector only matches a single element, e.g. by using an ID.
448
+ * The 4 points forming the quadrilateral.
397
449
  */
398
- selector: string | HTMLElement;
450
+ points: Point[];
451
+ }
452
+
453
+ /**
454
+ * An axis-aligned rectangle in two-dimensional space.
455
+ */
456
+ export declare interface Rect {
399
457
  /**
400
- * Mode: can be 'immediate' (default) for always-on scanning, and 'touch', to only scan when a touch occurs.
401
- *
402
- * @defaultValue immediate
458
+ * The origin of the rectangle.
403
459
  */
404
- mode?: 'immediate' | 'touch';
460
+ origin: Point;
405
461
  /**
406
- * Frame source configuration
462
+ * The size of the rectangle.
407
463
  */
408
- frameSource?: FrameSourceConfiguration;
464
+ size: Size;
465
+ }
466
+
467
+ /**
468
+ * The region of interest is specified as an inset between screen edge and RoE on each side,
469
+ * expressed as a fractional value (between 0 and 0.5).
470
+ *
471
+ * For instance, to have an area that occupies the middle 80% horizontal area and 50% vertical area, you would
472
+ * specify the region of interest as follows:
473
+ *
474
+ * ```json
475
+ * { left: 0.1, right: 0.1, top: 0.25, bottom: 0.25 }
476
+ * ```
477
+ * (10% width inset on each side, 25% height inset on each side)
478
+ */
479
+ export declare interface RegionOfInterest {
409
480
  /**
410
- * Locator configuration
481
+ * Left inset, relative [0 .. 0.5].
482
+ *
483
+ * @example 0.1
411
484
  */
412
- locator?: LocatorConfiguration;
485
+ left: number;
413
486
  /**
414
- * Engine configuration
487
+ * Top inset, relative [0 .. 0.5].
488
+ *
489
+ * @example 0.25
415
490
  */
416
- engine?: EngineConfiguration;
491
+ top: number;
417
492
  /**
418
- * Overlay configuration
493
+ * Right inset, relative [0 .. 0.5].
494
+ *
495
+ * @example 0.1
419
496
  */
420
- overlay?: OverlayConfiguration;
497
+ right: number;
421
498
  /**
422
- * Feedback configuration
499
+ * Bottom inset, relative [0 .. 0.5]
500
+ *
501
+ * @example 0.25
423
502
  */
424
- feedback?: FeedbackConfiguration;
503
+ bottom: number;
425
504
  }
505
+
426
506
  /**
427
- * A point in two-dimensional space.
428
- *
429
- * The y coordinate origin starts at the top.
507
+ * STRICH SDK error class
430
508
  */
431
- export interface Point {
509
+ export declare class SdkError extends Error {
432
510
  /**
433
- * The x-coordinate in pixels.
511
+ * Flag indicating if this error is related to camera access.
434
512
  */
435
- x: number;
513
+ duringCameraAccess: boolean;
436
514
  /**
437
- * The y-coordinate in pixels.
515
+ * A localized error message, if available, otherwise this will contain the non-localized message.
438
516
  */
439
- y: number;
517
+ localizedMessage: string;
518
+ /**
519
+ * An optional underlying error that caused this error.
520
+ */
521
+ cause?: Error;
522
+ /**
523
+ * An optional detail message to display to disambiguate multiple errors (not-translated)
524
+ */
525
+ detailMessage?: string;
526
+ constructor(keyOrMessage: string, cause?: Error);
440
527
  }
528
+
441
529
  /**
442
530
  * The size of a bounding box, represented by its width and height.
443
531
  */
444
- export interface Size {
532
+ export declare interface Size {
445
533
  /**
446
534
  * The width in pixels.
447
535
  */
@@ -451,32 +539,11 @@ export interface Size {
451
539
  */
452
540
  height: number;
453
541
  }
454
- /**
455
- * An axis-aligned rectangle in two-dimensional space.
456
- */
457
- export interface Rect {
458
- /**
459
- * The origin of the rectangle.
460
- */
461
- origin: Point;
462
- /**
463
- * The size of the rectangle.
464
- */
465
- size: Size;
466
- }
467
- /**
468
- * A non-intersecting polygon with four points.
469
- */
470
- export interface Quadrilateral {
471
- /**
472
- * The 4 points forming the quadrilateral.
473
- */
474
- points: Point[];
475
- }
542
+
476
543
  /**
477
544
  * Before the STRICH SDK {@link BarcodeReader} can be used, a one-time initialization of the SDK must be performed.
478
545
  */
479
- export class StrichSDK {
546
+ export declare class StrichSDK {
480
547
  /**
481
548
  * Return the version of the STRICH SDK.
482
549
  */
@@ -488,7 +555,7 @@ export class StrichSDK {
488
555
  /**
489
556
  * One-time initialization of the SDK.
490
557
  *
491
- * @param licenseKey The license key obtained from the Customer Portal.
558
+ * @param licenseKey - The license key obtained from the Customer Portal.
492
559
  */
493
560
  static initialize(licenseKey: string): Promise<void>;
494
561
  /**
@@ -500,14 +567,14 @@ export class StrichSDK {
500
567
  * USING THE CUSTOM ID TO TRANSMIT PERSONALLY IDENTIFYING DATA IS FORBIDDEN AND
501
568
  * CONSTITUTES A BREACH OF THE TERMS OF THE LICENSE AGREEMENT.
502
569
  *
503
- * @param customId The custom ID. Use `null` to unset the custom ID.
504
- * @default No custom ID is set by default
570
+ * @param customId - The custom ID. Use `null` to unset the custom ID.
571
+ * @defaultValue No custom ID is set by default
505
572
  */
506
573
  static setCustomId(customId: string | null): void;
507
574
  /**
508
575
  * Override the language that was detected from the browser's language (navigator.language)
509
576
  *
510
- * @param lang ISO language code, e.g. 'en'
577
+ * @param lang - The ISO language code, e.g. 'en'
511
578
  */
512
579
  static setLanguage(lang: string): void;
513
580
  /**
@@ -515,108 +582,33 @@ export class StrichSDK {
515
582
  * This can be used as a check if a BarcodeReader should be presented, or a fallback to a manual input method
516
583
  * or error page should be displayed.
517
584
  *
518
- * @return A Promise that resolves to a boolean value indicating if a camera is available. The Promise will reject
585
+ * @returns A Promise that resolves to a boolean value indicating if a camera is available. The Promise will reject
519
586
  * if the check fails for any reason (including missing/denied permissions).
520
587
  */
521
588
  static hasCameraDevice(): Promise<boolean>;
522
589
  }
590
+
523
591
  /**
524
- * A code detection reported by the STRICH SDK.
592
+ * The supported symbologies.
525
593
  */
526
- export interface CodeDetection {
527
- /**
528
- * The textual data contained in the code.
529
- */
530
- data: string;
531
- /**
532
- * The type of detected code.
533
- */
534
- typeName: string;
535
- /**
536
- * Supplemental data for this code.
537
- */
538
- supplementalData: string | null;
539
- /**
540
- * The bounding rectangle in which the code was detected.
541
- *
542
- * Note: this might not be precise, especially for 1D barcodes.
543
- */
544
- boundingRect: Rect;
545
- /**
546
- * The quadrilateral in which the code was detected.
547
- *
548
- * For rotated or warped codes, this might contain a more precise location estimate than boundingRect.
549
- */
550
- quadrilateral: Quadrilateral;
551
- /**
552
- * The time of detection.
553
- */
554
- time: number;
555
- /**
556
- * The raw contained bytes contained in the code.
557
- */
558
- rawData: Uint8Array;
559
- }
594
+ export declare type SymbologyName = 'ean13' | 'ean8' | 'ean5' | 'ean2' | 'upca' | 'upce' | 'databar' | 'databar-exp' | 'code39' | 'code93' | 'code128' | 'i25' | 'codabar' | 'qr' | 'aztec' | 'datamatrix' | 'pdf417';
595
+
560
596
  /**
561
- * BarcodeReader is the primary interface of the STRICH SDK.
597
+ * For variable-length symbologies, min/max length can be specified in addition to the symbology.
562
598
  */
563
- export class BarcodeReader {
564
- /**
565
- * User-supplied barcode detection handler.
566
- *
567
- * This is a synchronous call, so further processing will not happen until the handler returns.
568
- */
569
- detected?: (detections: CodeDetection[]) => (void);
570
- /**
571
- * Optional user-supplied error callback.
572
- *
573
- * This is invoked by the BarcodeReader if an error occurred while processing frames, and is usually not
574
- * recoverable.
575
- */
576
- onError?: (error: Error) => (void);
577
- /**
578
- * Create a new BarcodeReader using a Configuration.
579
- *
580
- * @param configuration A configuration object.
581
- */
582
- constructor(configuration: Configuration);
583
- /**
584
- * Initialize the BarcodeReader instance.
585
- *
586
- *
587
- *
588
- * @return A promise resolving to an initialized BarcodeReader instance, or an error object.
589
- */
590
- initialize(): Promise<BarcodeReader>;
591
- /**
592
- * Start scanning for barcodes.
593
- */
594
- start(): Promise<void>;
599
+ export declare type SymbologySpec = {
595
600
  /**
596
- * Stop the BarcodeReader instance.
597
- *
598
- * This will temporarily suspend processing of camera frames / detection of codes.
599
- */
600
- stop(): Promise<void>;
601
- /**
602
- * Destroy this BarcodeReader instance, making it unusable.
603
- *
604
- * This will release all associated resources, and should be called whenever an application no longer needs to
605
- * scan.
606
- *
607
- * @return Promise that resolves when the BarcodeReader and its associated resources are fully destroyed.
601
+ * The name of the symbology.
608
602
  */
609
- destroy(): Promise<void>;
603
+ name: SymbologyName;
610
604
  /**
611
- * Show/hide the BarcodeReader instance.
612
- *
613
- * @param visible True/false for visible/hidden
605
+ * The minimum length of the barcode, only has an effect for variable-length symbologies.
614
606
  */
615
- setVisible(visible: boolean): Promise<void>;
607
+ minLen?: number;
616
608
  /**
617
- * @return the current visibility of this BarcodeReader instance
609
+ * The maximum length of the barcode, only has an effect for variable-length symbologies.
618
610
  */
619
- getVisible(): boolean;
620
- }
611
+ maxLen?: number;
612
+ };
621
613
 
622
- //# sourceMappingURL=strich.d.ts.map
614
+ export { }