starti.app 2.0.87 → 2.0.96

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.
@@ -31,6 +31,7 @@ export declare class AsyncIntegrationResolver<TIntegrationKey extends keyof Inte
31
31
  * ```
32
32
  */
33
33
  call<TIntegrationMethodKey extends keyof Integrations[TIntegrationKey], TMethod extends MethodFunction = FunctionOfIntegrationMethod<TIntegrationKey, TIntegrationMethodKey>, TMethodReturnType = ReturnType<TMethod>>(optionsOrMethodName: AsyncIntegrationResolverCallOptions<TIntegrationMethodKey, TMethodReturnType> | TIntegrationMethodKey, ...args: Parameters<TMethod>): Promise<TMethodReturnType>;
34
+ callWithoutArgs<TIntegrationMethodKey extends keyof Integrations[TIntegrationKey], TMethod extends MethodFunction = FunctionOfIntegrationMethod<TIntegrationKey, TIntegrationMethodKey>, TMethodReturnType = ReturnType<TMethod>>(optionsOrMethodName: AsyncIntegrationResolverCallOptions<TIntegrationMethodKey, TMethodReturnType> | TIntegrationMethodKey): Promise<TMethodReturnType>;
34
35
  /**
35
36
  * Registers an event listener for a specified event name.
36
37
  *
@@ -1,4 +1,5 @@
1
1
  import { EventTargetWithType } from "../../EventTarget";
2
+ import { SemVer } from "../../lib/SemVer";
2
3
  import { InitializeParams, SetStatusBarOptions, SpinnerOptions, Startiapp } from "../../startiapp";
3
4
  import { NavigatingPageEvent, VibrationIntensity } from "./typings";
4
5
  export declare class App extends EventTargetWithType<{
@@ -41,6 +42,7 @@ export declare class App extends EventTargetWithType<{
41
42
  * ```
42
43
  */
43
44
  version: () => Promise<string>;
45
+ get versionUA(): SemVer;
44
46
  /**
45
47
  * Add an internal domain to the app.
46
48
  *
@@ -1,7 +1,10 @@
1
1
  import { Startiapp } from "../../startiapp";
2
+ import { QrScannerOptions } from "./typings";
2
3
  export declare class QrScanner extends EventTarget {
3
4
  private readonly startiapp;
4
5
  private qrIntegration;
6
+ private validationScanner;
7
+ private isScanning;
5
8
  constructor(startiapp: Startiapp);
6
9
  /**
7
10
  * Starts the QR code scanner.
@@ -10,8 +13,36 @@ export declare class QrScanner extends EventTarget {
10
13
  * ```typescript
11
14
  * await qrScanner.scan();
12
15
  * ```
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * // Using a validation function to validate scanned QR codes
20
+ * const validatedResult = await qrScanner.scan({
21
+ * validation: async (scannedValue) => {
22
+ * // Simulate an async validation (e.g., server-side check)
23
+ * await new Promise(resolve => setTimeout(resolve, 1000));
24
+ * return scannedValue === "VALID_CODE"; // Only accept this specific code
25
+ * }
26
+ * });
27
+ *
28
+ * @example
29
+ * // Using a synchronous validation function
30
+ * const validatedResult = await qrScanner.scan({
31
+ * validation: (scannedValue) => {
32
+ * return scannedValue.startsWith("VALID_"); // Accept codes starting with "VALID_"
33
+ * }
34
+ * });
35
+ */
36
+ scan(options?: QrScannerOptions): Promise<string | null>;
37
+ /**
38
+ * Stops the QR code scanner.
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * await qrScanner.stop();
43
+ * ```
13
44
  */
14
- scan(): Promise<string | null>;
45
+ stop(): Promise<boolean>;
15
46
  /**
16
47
  * Check if camera access is granted.
17
48
  *
@@ -31,4 +62,6 @@ export declare class QrScanner extends EventTarget {
31
62
  * ```
32
63
  */
33
64
  requestCameraAccess(): Promise<boolean>;
65
+ private handleQrCodeScanned;
66
+ private handleQrScannerClosed;
34
67
  }
@@ -0,0 +1,16 @@
1
+ import { AsyncIntegrationResolver } from "../../integrationWrapper";
2
+ type ValidationFunction = (scannedValue: string) => boolean | Promise<boolean>;
3
+ export declare class ValidationScanner {
4
+ private readonly qrIntegration;
5
+ private readonly eventTarget;
6
+ private abortController;
7
+ private isValidating;
8
+ private isActive;
9
+ private _currentListener;
10
+ constructor(qrIntegration: AsyncIntegrationResolver<"QrScannerIntegration">, eventTarget: EventTarget);
11
+ start(validation: ValidationFunction): Promise<string | null>;
12
+ stop(): void;
13
+ isRunning(): boolean;
14
+ private cleanup;
15
+ }
16
+ export {};
@@ -0,0 +1,9 @@
1
+ export type QrScannerOptionsNative = {
2
+ /** Whether the scanner should continue scanning after a successful scan. Default is false. */
3
+ continuous?: boolean;
4
+ /** The delay in milliseconds between scan results. Default is 200ms */
5
+ throttleMilliseconds?: number;
6
+ };
7
+ export type QrScannerOptions = {
8
+ validation?: (scannedValue: string) => boolean | Promise<boolean>;
9
+ };
@@ -3,6 +3,7 @@ import { BiometricsAuthenticationType, BiometricsResultReponse, SaveUsernameAndP
3
3
  import { InApPurchasePurchaseType, InAppPurchaseGetProductResponse, InAppPurchaseProductResponse, InAppPurchaseResponse } from "./integrations/InAppPurchase/InAppPurchaseIntegration";
4
4
  import { GeofenceRegion, Location, LocationListeningOptions, LocationOptions } from "./integrations/Location/types";
5
5
  import { ListenResponse, NetworkAccess } from "./integrations/Network/NetworkIntegration";
6
+ import { QrScannerOptionsNative } from "./integrations/QrScanner/typings";
6
7
  import { SetStatusBarOptions } from "./startiapp";
7
8
  export type PushNotificationIntegration = {
8
9
  setBadgeCount(count: number): void;
@@ -20,7 +21,8 @@ type ShareIntegration = {
20
21
  downloadFile(fileUrl: string, fileName: string): boolean;
21
22
  };
22
23
  type QrScannerIntegration = {
23
- startQrCodeScanner(): string | null;
24
+ startQrCodeScanner(options: QrScannerOptionsNative | null): string | null;
25
+ stopQrCodeScanner(): boolean;
24
26
  getCameraAccessState(): "Unknown" | "Denied" | "Granted";
25
27
  isCameraAccessGranted(): boolean;
26
28
  requestCameraAccess(): boolean;
@@ -6,7 +6,7 @@ export declare class SemVer {
6
6
  constructor(version: string);
7
7
  private isValidVersion;
8
8
  isGreaterThan(other: SemVer): boolean;
9
- isGreaterThanOrEqualTo(other: SemVer): boolean;
9
+ isGreaterThanOrEqualTo(other: SemVer | string): boolean;
10
10
  isEqualTo(other: SemVer): boolean;
11
11
  toString(): string;
12
12
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "starti.app",
3
3
  "author": "starti.app",
4
4
  "license": "MIT",
5
- "version": "2.0.87",
5
+ "version": "2.0.96",
6
6
  "description": "Use this package for easy communication with the starti.app API.",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",