@pixelverse/strichjs-sdk 1.7.0 → 1.7.2

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
@@ -16,40 +16,66 @@ export declare class BarcodeReader {
16
16
  */
17
17
  onError?: (error: Error) => (void);
18
18
  /**
19
- * Create a new BarcodeReader using a Configuration.
19
+ * Create a new BarcodeReader using a {@link Configuration} object.
20
+ *
21
+ * @remarks
22
+ * This will perform some basic checks, such as if the SDK was initialized, the browser supports the required APIs
23
+ * and the host element is visible and has a non-zero size. This will not access the camera yet, that happens
24
+ * in the {@link BarcodeReader#initialize} method.
20
25
  *
21
26
  * @param configuration - A configuration object.
22
27
  */
23
- constructor(/* @internal */ configuration: Configuration);
28
+ constructor(configuration: Configuration);
24
29
  /**
25
30
  * Initialize the BarcodeReader instance.
26
31
  *
27
- * @returns A promise resolving to an initialized BarcodeReader instance, or an error object.
32
+ * @remarks
33
+ * This will attempt to acquire a camera stream, so it is essential that the returned Promise is awaited, and that
34
+ * measures are taken so that the returned BarcodeReader instance is destroyed when it is no longer need. That
35
+ * will free the camera stream for subsequent use.
36
+ *
37
+ * If you are getting camera-related initialization errors, the most likely cause is that you are
38
+ * attempting to initialize a BarcodeReader and the camera feed has not been released yet.
39
+ *
40
+ * @returns A promise resolving to an initialized BarcodeReader instance, or an {@link SdkError} object.
28
41
  */
29
42
  initialize(): Promise<BarcodeReader>;
30
43
  /**
31
- * Start scanning for barcodes.
44
+ * Start barcode recognition.
45
+ *
46
+ * @remarks
47
+ * The BarcodeReader instance must have previously been successfully initialized using the
48
+ * {@link BarcodeReader#initialize} method.
32
49
  */
33
50
  start(): Promise<void>;
34
51
  /**
35
- * Stop the BarcodeReader instance.
52
+ * Stop barcode recognition.
53
+ *
54
+ * @remarks
55
+ * This will suspend camera frame processing/barcode recognition, but will not release the camera stream.
56
+ * If you no longer intend to use the BarcodeReader instance, call {@link BarcodeReader#destroy} afterward.
36
57
  *
37
- * This will temporarily suspend processing of camera frames / detection of codes.
58
+ * If you intend to only temporarily stop recognition of barcodes and resume later, call
59
+ * {@link BarcodeReader#start} again.
38
60
  */
39
61
  stop(): Promise<void>;
40
62
  /**
41
63
  * Destroy this BarcodeReader instance, making it unusable.
42
64
  *
43
- * This will release all associated resources, and should be called whenever an application no longer needs to
44
- * scan.
65
+ * @remarks
66
+ * This will release all associated resources, including the camera stream, and should be called whenever an
67
+ * application no longer needs the BarcodeReader.
45
68
  *
46
69
  * @returns Promise that resolves when the BarcodeReader and its associated resources are fully destroyed.
47
70
  */
48
71
  destroy(): Promise<void>;
49
72
  /**
50
- * Show/hide the BarcodeReader instance.
73
+ * Show or hide the BarcodeReader instance.
74
+ *
75
+ * @remarks
76
+ * This will not release the camera stream.
51
77
  *
52
- * @param visible - True/false for visible/hidden
78
+ * @param visible - True to display the BarcodeReader, false to hide it
53
79
  */
54
80
  setVisible(visible: boolean): Promise<void>;
55
81
  /**
@@ -537,6 +563,10 @@ export declare interface PopupConfiguration {
537
563
  */
538
564
  cancelButtonColor?: string;
539
565
  };
566
+ /**
567
+ * Optional Overlay configuration.
568
+ */
569
+ overlay?: OverlayConfiguration;
540
570
  /**
541
571
  * Optional configuration for audible and haptic feedback.
542
572
  */
@@ -556,9 +586,10 @@ export declare class PopupScanner {
556
586
  /**
557
587
  * Scan barcodes using a pre-built, modal popup interface.
558
588
  *
589
+ * @remarks
559
590
  * Scanning is active until one or more barcodes of the configured symbologies
560
- * (see {@link PopupConfiguration#symbologies}) are detected. If a detection handler is provided
561
- * (see {@link PopupConfiguration#detectionHandler}), scanning will continue until the detection
591
+ * (see {@link PopupConfiguration.symbologies}) are detected. If a detection handler is provided
592
+ * (see {@link PopupConfiguration.detectionHandler}), scanning will continue until the detection
562
593
  * handler returns a truthy value.
563
594
  *
564
595
  * @param configuration - The popup scanner configuration
@@ -668,44 +699,59 @@ export declare interface Size {
668
699
  }
669
700
 
670
701
  /**
671
- * Before the STRICH SDK {@link BarcodeReader} can be used, a one-time initialization of the SDK must be performed.
702
+ * Main entrypoint for the STRICH Barcode Scanning SDK, containing initialization and utility methods.
703
+ *
704
+ * The SDK has to be initialized with a license key using the {@link StrichSDK.initialize} method before barcodes may be scanned.
672
705
  */
673
706
  export declare class StrichSDK {
674
707
  /**
675
- * Return the version of the STRICH SDK.
708
+ * @returns The semantic version of the SDK, as MAJOR.MINOR.PATCH
676
709
  */
677
710
  static version(): string;
678
711
  /**
679
- * Return true if the SDK was successfully initialized, false otherwise.
712
+ * @returns True if the SDK was successfully initialized, false otherwise
680
713
  */
681
714
  static isInitialized(): boolean;
682
715
  /**
683
- * One-time initialization of the SDK.
716
+ * One-time initialization of the SDK
717
+ *
718
+ * @remarks
719
+ * For online licenses, this will invoke an HTTPS call to our license service. If possible, we recommend calling
720
+ * this method early in the lifecycle of your scanning flow, to avoid any delay at the time a {@link BarcodeReader}
721
+ * instance is required.
684
722
  *
685
723
  * @param licenseKey - The license key obtained from the Customer Portal.
724
+ * @returns A Promise that resolves when the SDK was initialized successfully, or an {@link SdkError} instance.
686
725
  */
687
726
  static initialize(licenseKey: string): Promise<void>;
688
727
  /**
689
- * Set custom ID for analytics.
728
+ * Set a custom ID for additional context.
690
729
  *
730
+ * @remarks
691
731
  * The custom ID is independent of the device ID, and can be used for custom device
692
732
  * identifiers, location identifiers or anonymous user identifiers.
733
+ * Unless you opt out of usage tracking (an Enterprise-only capability), the custom ID will also be
734
+ * available in the CSV export of your scans.
735
+ *
736
+ * The custom ID is not a per-scan identifier.
693
737
  *
694
738
  * USING THE CUSTOM ID TO TRANSMIT PERSONALLY IDENTIFYING DATA IS FORBIDDEN AND
695
739
  * CONSTITUTES A BREACH OF THE TERMS OF THE LICENSE AGREEMENT.
696
740
  *
697
741
  * @param customId - The custom ID. Use `null` to unset the custom ID.
698
- * @defaultValue No custom ID is set by default
699
742
  */
700
743
  static setCustomId(customId: string | null): void;
701
744
  /**
702
- * Override the language that was detected from the browser's language (navigator.language)
745
+ * Override the language of built-in error messages shown in the scanning UI.
746
+ * By default, browser's language (navigator.language) will be used.
703
747
  *
704
- * @param lang - The ISO language code, e.g. 'en'
748
+ * @param lang - The lower-case ISO language code, e.g. 'en'
705
749
  */
706
750
  static setLanguage(lang: string): void;
707
751
  /**
708
752
  * Check if the browser has access to a camera device, which is required for scanning barcodes.
753
+ *
754
+ * @remarks
709
755
  * This can be used as a check if a BarcodeReader should be presented, or a fallback to a manual input method
710
756
  * or error page should be displayed.
711
757
  *
@@ -723,8 +769,8 @@ export declare class StrichSDK {
723
769
  * @remarks
724
770
  * The Permissions API is currently not available on Firefox: 'unknown' will be returned.
725
771
  *
726
- * @returns The current state of the camera permission: 'granted' if it is granted, 'denied' if it is denied,
727
- * 'prompt' if a prompt will occur, and 'unknown' if it could not be determined for any reason.
772
+ * @returns A Promise resolving to the current state of the camera permission: 'granted' if it is granted, 'denied'
773
+ * if it is denied, 'prompt' if a prompt will occur, and 'unknown' if it could not be determined for any reason.
728
774
  */
729
775
  static getCameraPermissionState(): Promise<'denied' | 'granted' | 'prompt' | 'unknown'>;
730
776
  }