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