@pixelverse/strichjs-sdk 1.5.4 → 1.6.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/dist/strich.d.ts CHANGED
@@ -2,7 +2,6 @@
2
2
  * BarcodeReader is the primary interface of the STRICH SDK.
3
3
  */
4
4
  export declare class BarcodeReader {
5
- private configuration;
6
5
  /**
7
6
  * User-supplied barcode detection handler.
8
7
  *
@@ -21,7 +20,7 @@ export declare class BarcodeReader {
21
20
  *
22
21
  * @param configuration - A configuration object.
23
22
  */
24
- constructor(configuration: Configuration);
23
+ constructor(/* @internal */ configuration: Configuration);
25
24
  /**
26
25
  * Initialize the BarcodeReader instance.
27
26
  *
@@ -32,7 +31,6 @@ export declare class BarcodeReader {
32
31
  * Start scanning for barcodes.
33
32
  */
34
33
  start(): Promise<void>;
35
- private tick;
36
34
  /**
37
35
  * Stop the BarcodeReader instance.
38
36
  *
@@ -107,8 +105,9 @@ export declare interface Configuration {
107
105
  *
108
106
  * @remarks
109
107
  * When using a selector, make sure the selector only matches a single element, e.g. by using an ID.
108
+ * When using the popup scanner, do not pass a selector.
110
109
  */
111
- selector: string | HTMLElement;
110
+ selector: string | HTMLElement | undefined;
112
111
  /**
113
112
  * Mode: can be 'immediate' (default) for always-on scanning, and 'touch', to only scan when a touch occurs.
114
113
  *
@@ -142,7 +141,9 @@ export declare interface Configuration {
142
141
  */
143
142
  export declare interface EngineConfiguration {
144
143
  /**
145
- * The enabled symbologies.
144
+ * The enabled barcode symbologies.
145
+ *
146
+ * See https://docs.strich.io/supported-symbologies.html for an exhaustive list of supported symbologies.
146
147
  *
147
148
  * @remarks
148
149
  * It is highly recommended to configure only the symbologies required by your application.
@@ -413,7 +414,8 @@ export declare interface OverlayConfiguration {
413
414
  * The image is supplied as an absolute URL or inline as a data URL. The image should have a transparent background
414
415
  * (WebP or PNG format). The recommended size is 140x30 pixels.
415
416
  *
416
- * @remarks This is a capability that is only available as a paid add-on for Enterprise licenses.
417
+ * @remarks This is a capability that is only available as a paid add-on for Enterprise licenses. Please note that
418
+ * attempting to hide or replace the STRICH logo by other means is a violation of the License Agreement.
417
419
  */
418
420
  customLogoSrc?: string;
419
421
  }
@@ -434,6 +436,104 @@ export declare interface Point {
434
436
  y: number;
435
437
  }
436
438
 
439
+ /**
440
+ * Popup scanner configuration
441
+ */
442
+ export declare interface PopupConfiguration {
443
+ /**
444
+ * The barcode symbologies that should be detected.
445
+ *
446
+ * See {@link EngineConfiguration#symbologies} for details.
447
+ */
448
+ symbologies: (SymbologyName | SymbologySpec)[];
449
+ /**
450
+ * An optional handler for detections.
451
+ *
452
+ * Receives barcode detections and must return `true` if scanning should stop, or `false` if scanning should
453
+ * continue. Any truthy value will be interpreted as `true`.
454
+ */
455
+ detectionHandler?: (detections: CodeDetection[]) => boolean;
456
+ /**
457
+ * The camera resolution to use.
458
+ *
459
+ * @defaultValue full-hd
460
+ */
461
+ resolution?: 'hd' | 'full-hd';
462
+ /**
463
+ * Optional overrides for textual popup elements.
464
+ */
465
+ labels?: {
466
+ /**
467
+ * The text to display in the dialog header area.
468
+ *
469
+ * @remarks
470
+ * If no value is supplied, a locale-dependent default text will be used.
471
+ */
472
+ title?: string;
473
+ /**
474
+ * The text to display on the cancel button in the dialog bottom area.
475
+ *
476
+ * @remarks
477
+ * If no value is supplied, a locale-dependent default text will be used.
478
+ */
479
+ cancel?: string;
480
+ };
481
+ style?: {
482
+ /**
483
+ * Background color to use for title. Must be specified in rgb() or rgba() notation.
484
+ *
485
+ * @defaultValue rgba(15,42,66,0.9)
486
+ */
487
+ titleBackgroundColor?: string;
488
+ /**
489
+ * Background color to use for title text. Must be specified in rgb() notation.
490
+ *
491
+ * @defaultValue rgb(236,237,237)
492
+ */
493
+ titleColor?: string;
494
+ /**
495
+ * Background color to use for cancel button. Must be specified in rgb() or rgba() notation.
496
+ *
497
+ * @defaultValue transparent
498
+ */
499
+ cancelButtonBackgroundColor?: string;
500
+ /**
501
+ * Color to use for cancel button outline and text. Must be specified in rgb() or rgba() notation.
502
+ *
503
+ * @defaultValue rgba(15,42,66,0.9)
504
+ */
505
+ cancelButtonColor?: string;
506
+ };
507
+ /**
508
+ * Optional configuration for audible and haptic feedback.
509
+ */
510
+ feedback?: FeedbackConfiguration;
511
+ }
512
+
513
+ /**
514
+ * Pre-built modal scanning interface, intended for simple use cases that do not require a lot of customization.
515
+ *
516
+ * For more advanced use cases and user interface customization, you can provide your own host element and integrate
517
+ * a {@link BarcodeReader} directly.
518
+ *
519
+ * @remarks
520
+ * Requires browser support for the &lt;dialog&gt; element, which is widely available since early 2022.
521
+ */
522
+ export declare class PopupScanner {
523
+ /**
524
+ * Scan barcodes using a pre-built, modal popup interface.
525
+ *
526
+ * Scanning is active until one or more barcodes of the configured symbologies
527
+ * (see {@link PopupConfiguration#symbologies}) are detected. If a detection handler is provided
528
+ * (see {@link PopupConfiguration#detectionHandler}), scanning will continue until the detection
529
+ * handler returns a truthy value.
530
+ *
531
+ * @param configuration - The popup scanner configuration
532
+ * @returns Promise that resolves into the detected barcodes or undefined (user cancellation)
533
+ */
534
+ static scan(configuration: PopupConfiguration): Promise<CodeDetection[] | undefined>;
535
+ }
536
+
437
537
  /**
438
538
  * A non-intersecting polygon with four points.
439
539
  */