@pixelverse/strichjs-sdk 1.7.1 → 1.7.3
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/CHANGELOG.md +16 -0
- package/dist/strich-noesm.js +2 -2
- package/dist/strich.d.ts +96 -23
- package/dist/strich.js +2 -2
- package/package.json +2 -2
package/dist/strich.d.ts
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fine-grained audio feedback configuration object
|
|
3
|
+
*/
|
|
4
|
+
export declare interface AudioFeedbackConfiguration {
|
|
5
|
+
/**
|
|
6
|
+
* Toggle audible beep upon successful scan.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Uses the WebAudio API to emit a "cash register"-like beep. Beeping is done on a best-effort
|
|
10
|
+
* basis and should not be relied upon. If the browser does not support the WebAudio API,
|
|
11
|
+
* beeping will not work, and no error will be thrown.
|
|
12
|
+
*
|
|
13
|
+
* @defaultValue true
|
|
14
|
+
*/
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Explicitly set the AudioSession type used for audible feedback.
|
|
18
|
+
*
|
|
19
|
+
* See https://github.com/w3c/audio-session/blob/main/explainer.md#api-design for a list of acceptable values.
|
|
20
|
+
*
|
|
21
|
+
* By default, the value `transient` is used if the AudioSession API is available.
|
|
22
|
+
* Setting this value to `null` will disable setting the AudioSession type.
|
|
23
|
+
*/
|
|
24
|
+
audioSessionType?: string | null;
|
|
25
|
+
}
|
|
26
|
+
|
|
1
27
|
/**
|
|
2
28
|
* BarcodeReader is the primary interface of the STRICH SDK.
|
|
3
29
|
*/
|
|
@@ -16,40 +42,66 @@ export declare class BarcodeReader {
|
|
|
16
42
|
*/
|
|
17
43
|
onError?: (error: Error) => (void);
|
|
18
44
|
/**
|
|
19
|
-
* Create a new BarcodeReader using a Configuration.
|
|
45
|
+
* Create a new BarcodeReader using a {@link Configuration} object.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* This will perform some basic checks, such as if the SDK was initialized, the browser supports the required APIs
|
|
49
|
+
* and the host element is visible and has a non-zero size. This will not access the camera yet, that happens
|
|
50
|
+
* in the {@link BarcodeReader#initialize} method.
|
|
20
51
|
*
|
|
21
52
|
* @param configuration - A configuration object.
|
|
22
53
|
*/
|
|
23
|
-
constructor(
|
|
54
|
+
constructor(configuration: Configuration);
|
|
24
55
|
/**
|
|
25
56
|
* Initialize the BarcodeReader instance.
|
|
26
57
|
*
|
|
27
|
-
* @
|
|
58
|
+
* @remarks
|
|
59
|
+
* This will attempt to acquire a camera stream, so it is essential that the returned Promise is awaited, and that
|
|
60
|
+
* measures are taken so that the returned BarcodeReader instance is destroyed when it is no longer need. That
|
|
61
|
+
* will free the camera stream for subsequent use.
|
|
62
|
+
*
|
|
63
|
+
* If you are getting camera-related initialization errors, the most likely cause is that you are
|
|
64
|
+
* attempting to initialize a BarcodeReader and the camera feed has not been released yet.
|
|
65
|
+
*
|
|
66
|
+
* @returns A promise resolving to an initialized BarcodeReader instance, or an {@link SdkError} object.
|
|
28
67
|
*/
|
|
29
68
|
initialize(): Promise<BarcodeReader>;
|
|
30
69
|
/**
|
|
31
|
-
* Start
|
|
70
|
+
* Start barcode recognition.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* The BarcodeReader instance must have previously been successfully initialized using the
|
|
74
|
+
* {@link BarcodeReader#initialize} method.
|
|
32
75
|
*/
|
|
33
76
|
start(): Promise<void>;
|
|
34
77
|
/**
|
|
35
|
-
* Stop
|
|
78
|
+
* Stop barcode recognition.
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* This will suspend camera frame processing/barcode recognition, but will not release the camera stream.
|
|
82
|
+
* If you no longer intend to use the BarcodeReader instance, call {@link BarcodeReader#destroy} afterward.
|
|
36
83
|
*
|
|
37
|
-
*
|
|
84
|
+
* If you intend to only temporarily stop recognition of barcodes and resume later, call
|
|
85
|
+
* {@link BarcodeReader#start} again.
|
|
38
86
|
*/
|
|
39
87
|
stop(): Promise<void>;
|
|
40
88
|
/**
|
|
41
89
|
* Destroy this BarcodeReader instance, making it unusable.
|
|
42
90
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* This will release all associated resources, including the camera stream, and should be called whenever an
|
|
93
|
+
* application no longer needs the BarcodeReader.
|
|
45
94
|
*
|
|
46
95
|
* @returns Promise that resolves when the BarcodeReader and its associated resources are fully destroyed.
|
|
47
96
|
*/
|
|
48
97
|
destroy(): Promise<void>;
|
|
49
98
|
/**
|
|
50
|
-
* Show
|
|
99
|
+
* Show or hide the BarcodeReader instance.
|
|
100
|
+
*
|
|
101
|
+
* @remarks
|
|
102
|
+
* This will not release the camera stream.
|
|
51
103
|
*
|
|
52
|
-
* @param visible - True
|
|
104
|
+
* @param visible - True to display the BarcodeReader, false to hide it
|
|
53
105
|
*/
|
|
54
106
|
setVisible(visible: boolean): Promise<void>;
|
|
55
107
|
/**
|
|
@@ -208,9 +260,14 @@ export declare interface FeedbackConfiguration {
|
|
|
208
260
|
/**
|
|
209
261
|
* Toggle audible beep upon successful scan.
|
|
210
262
|
*
|
|
263
|
+
* @remarks
|
|
264
|
+
* Uses the WebAudio API to emit a "cash register"-like beep. Beeping is done on a best-effort
|
|
265
|
+
* basis and should not be relied upon. If the browser does not support the WebAudio API,
|
|
266
|
+
* beeping will not work, and no error will be thrown.
|
|
267
|
+
*
|
|
211
268
|
* @defaultValue true
|
|
212
269
|
*/
|
|
213
|
-
audio?: boolean;
|
|
270
|
+
audio?: boolean | AudioFeedbackConfiguration;
|
|
214
271
|
/**
|
|
215
272
|
* Toggle vibration upon successful scan, if supported by device.
|
|
216
273
|
*
|
|
@@ -560,9 +617,10 @@ export declare class PopupScanner {
|
|
|
560
617
|
/**
|
|
561
618
|
* Scan barcodes using a pre-built, modal popup interface.
|
|
562
619
|
*
|
|
620
|
+
* @remarks
|
|
563
621
|
* Scanning is active until one or more barcodes of the configured symbologies
|
|
564
|
-
* (see {@link PopupConfiguration
|
|
565
|
-
* (see {@link PopupConfiguration
|
|
622
|
+
* (see {@link PopupConfiguration.symbologies}) are detected. If a detection handler is provided
|
|
623
|
+
* (see {@link PopupConfiguration.detectionHandler}), scanning will continue until the detection
|
|
566
624
|
* handler returns a truthy value.
|
|
567
625
|
*
|
|
568
626
|
* @param configuration - The popup scanner configuration
|
|
@@ -672,44 +730,59 @@ export declare interface Size {
|
|
|
672
730
|
}
|
|
673
731
|
|
|
674
732
|
/**
|
|
675
|
-
*
|
|
733
|
+
* Main entrypoint for the STRICH Barcode Scanning SDK, containing initialization and utility methods.
|
|
734
|
+
*
|
|
735
|
+
* The SDK has to be initialized with a license key using the {@link StrichSDK.initialize} method before barcodes may be scanned.
|
|
676
736
|
*/
|
|
677
737
|
export declare class StrichSDK {
|
|
678
738
|
/**
|
|
679
|
-
*
|
|
739
|
+
* @returns The semantic version of the SDK, as MAJOR.MINOR.PATCH
|
|
680
740
|
*/
|
|
681
741
|
static version(): string;
|
|
682
742
|
/**
|
|
683
|
-
*
|
|
743
|
+
* @returns True if the SDK was successfully initialized, false otherwise
|
|
684
744
|
*/
|
|
685
745
|
static isInitialized(): boolean;
|
|
686
746
|
/**
|
|
687
|
-
* One-time initialization of the SDK
|
|
747
|
+
* One-time initialization of the SDK
|
|
748
|
+
*
|
|
749
|
+
* @remarks
|
|
750
|
+
* For online licenses, this will invoke an HTTPS call to our license service. If possible, we recommend calling
|
|
751
|
+
* this method early in the lifecycle of your scanning flow, to avoid any delay at the time a {@link BarcodeReader}
|
|
752
|
+
* instance is required.
|
|
688
753
|
*
|
|
689
754
|
* @param licenseKey - The license key obtained from the Customer Portal.
|
|
755
|
+
* @returns A Promise that resolves when the SDK was initialized successfully, or an {@link SdkError} instance.
|
|
690
756
|
*/
|
|
691
757
|
static initialize(licenseKey: string): Promise<void>;
|
|
692
758
|
/**
|
|
693
|
-
* Set custom ID for
|
|
759
|
+
* Set a custom ID for additional context.
|
|
694
760
|
*
|
|
761
|
+
* @remarks
|
|
695
762
|
* The custom ID is independent of the device ID, and can be used for custom device
|
|
696
763
|
* identifiers, location identifiers or anonymous user identifiers.
|
|
764
|
+
* Unless you opt out of usage tracking (an Enterprise-only capability), the custom ID will also be
|
|
765
|
+
* available in the CSV export of your scans.
|
|
766
|
+
*
|
|
767
|
+
* The custom ID is not a per-scan identifier.
|
|
697
768
|
*
|
|
698
769
|
* USING THE CUSTOM ID TO TRANSMIT PERSONALLY IDENTIFYING DATA IS FORBIDDEN AND
|
|
699
770
|
* CONSTITUTES A BREACH OF THE TERMS OF THE LICENSE AGREEMENT.
|
|
700
771
|
*
|
|
701
772
|
* @param customId - The custom ID. Use `null` to unset the custom ID.
|
|
702
|
-
* @defaultValue No custom ID is set by default
|
|
703
773
|
*/
|
|
704
774
|
static setCustomId(customId: string | null): void;
|
|
705
775
|
/**
|
|
706
|
-
* Override the language
|
|
776
|
+
* Override the language of built-in error messages shown in the scanning UI.
|
|
777
|
+
* By default, browser's language (navigator.language) will be used.
|
|
707
778
|
*
|
|
708
|
-
* @param lang - The ISO language code, e.g. 'en'
|
|
779
|
+
* @param lang - The lower-case ISO language code, e.g. 'en'
|
|
709
780
|
*/
|
|
710
781
|
static setLanguage(lang: string): void;
|
|
711
782
|
/**
|
|
712
783
|
* Check if the browser has access to a camera device, which is required for scanning barcodes.
|
|
784
|
+
*
|
|
785
|
+
* @remarks
|
|
713
786
|
* This can be used as a check if a BarcodeReader should be presented, or a fallback to a manual input method
|
|
714
787
|
* or error page should be displayed.
|
|
715
788
|
*
|
|
@@ -727,8 +800,8 @@ export declare class StrichSDK {
|
|
|
727
800
|
* @remarks
|
|
728
801
|
* The Permissions API is currently not available on Firefox: 'unknown' will be returned.
|
|
729
802
|
*
|
|
730
|
-
* @returns
|
|
731
|
-
* 'prompt' if a prompt will occur, and 'unknown' if it could not be determined for any reason.
|
|
803
|
+
* @returns A Promise resolving to the current state of the camera permission: 'granted' if it is granted, 'denied'
|
|
804
|
+
* if it is denied, 'prompt' if a prompt will occur, and 'unknown' if it could not be determined for any reason.
|
|
732
805
|
*/
|
|
733
806
|
static getCameraPermissionState(): Promise<'denied' | 'granted' | 'prompt' | 'unknown'>;
|
|
734
807
|
}
|