@pixelverse/strichjs-sdk 1.7.1 → 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.
36
53
  *
37
- * This will temporarily suspend processing of camera frames / detection of codes.
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.
57
+ *
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.
51
74
  *
52
- * @param visible - True/false for visible/hidden
75
+ * @remarks
76
+ * This will not release the camera stream.
77
+ *
78
+ * @param visible - True to display the BarcodeReader, false to hide it
53
79
  */
54
80
  setVisible(visible: boolean): Promise<void>;
55
81
  /**
@@ -560,9 +586,10 @@ export declare class PopupScanner {
560
586
  /**
561
587
  * Scan barcodes using a pre-built, modal popup interface.
562
588
  *
589
+ * @remarks
563
590
  * Scanning is active until one or more barcodes of the configured symbologies
564
- * (see {@link PopupConfiguration#symbologies}) are detected. If a detection handler is provided
565
- * (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
566
593
  * handler returns a truthy value.
567
594
  *
568
595
  * @param configuration - The popup scanner configuration
@@ -672,44 +699,59 @@ export declare interface Size {
672
699
  }
673
700
 
674
701
  /**
675
- * 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.
676
705
  */
677
706
  export declare class StrichSDK {
678
707
  /**
679
- * Return the version of the STRICH SDK.
708
+ * @returns The semantic version of the SDK, as MAJOR.MINOR.PATCH
680
709
  */
681
710
  static version(): string;
682
711
  /**
683
- * Return true if the SDK was successfully initialized, false otherwise.
712
+ * @returns True if the SDK was successfully initialized, false otherwise
684
713
  */
685
714
  static isInitialized(): boolean;
686
715
  /**
687
- * 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.
688
722
  *
689
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.
690
725
  */
691
726
  static initialize(licenseKey: string): Promise<void>;
692
727
  /**
693
- * Set custom ID for analytics.
728
+ * Set a custom ID for additional context.
694
729
  *
730
+ * @remarks
695
731
  * The custom ID is independent of the device ID, and can be used for custom device
696
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.
697
737
  *
698
738
  * USING THE CUSTOM ID TO TRANSMIT PERSONALLY IDENTIFYING DATA IS FORBIDDEN AND
699
739
  * CONSTITUTES A BREACH OF THE TERMS OF THE LICENSE AGREEMENT.
700
740
  *
701
741
  * @param customId - The custom ID. Use `null` to unset the custom ID.
702
- * @defaultValue No custom ID is set by default
703
742
  */
704
743
  static setCustomId(customId: string | null): void;
705
744
  /**
706
- * 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.
707
747
  *
708
- * @param lang - The ISO language code, e.g. 'en'
748
+ * @param lang - The lower-case ISO language code, e.g. 'en'
709
749
  */
710
750
  static setLanguage(lang: string): void;
711
751
  /**
712
752
  * Check if the browser has access to a camera device, which is required for scanning barcodes.
753
+ *
754
+ * @remarks
713
755
  * This can be used as a check if a BarcodeReader should be presented, or a fallback to a manual input method
714
756
  * or error page should be displayed.
715
757
  *
@@ -727,8 +769,8 @@ export declare class StrichSDK {
727
769
  * @remarks
728
770
  * The Permissions API is currently not available on Firefox: 'unknown' will be returned.
729
771
  *
730
- * @returns The current state of the camera permission: 'granted' if it is granted, 'denied' if it is denied,
731
- * '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.
732
774
  */
733
775
  static getCameraPermissionState(): Promise<'denied' | 'granted' | 'prompt' | 'unknown'>;
734
776
  }