starti.app 2.0.21 → 2.0.35

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.
@@ -6,7 +6,7 @@ type AsyncIntegrationResolverCallOptions<TMethodKey, TMethodResponse> = {
6
6
  methodName: TMethodKey;
7
7
  shouldResolve?: (value: TMethodResponse) => boolean;
8
8
  };
9
- declare class AsyncIntegrationResolver<TIntegrationKey extends keyof Integrations> {
9
+ export declare class AsyncIntegrationResolver<TIntegrationKey extends keyof Integrations> {
10
10
  private integrationKey;
11
11
  promises: Record<string, Array<{
12
12
  resolve: PromiseResolve<any>;
@@ -38,6 +38,9 @@ declare class AsyncIntegrationResolver<TIntegrationKey extends keyof Integration
38
38
  * <integration>.listen("eventName", (args) => {
39
39
  * console.log(args);
40
40
  * });
41
+ *
42
+ * // !!! Important to add .bind(this) when using the listen method like so !!!
43
+ * <integration>.listen("eventName", this.onEventName.bind(this));
41
44
  * ```
42
45
  */
43
46
  listen(eventName: string, listener: (...args: any[]) => void): Promise<void>;
@@ -37,7 +37,7 @@ export declare class Biometrics extends EventTarget {
37
37
  /**
38
38
  * Checks if there's a saved username and password.
39
39
  */
40
- hasUsernameAndPassword(): Promise<BiometricsResultReponse<boolean>>;
40
+ hasUsernameAndPassword(): Promise<boolean>;
41
41
  /**
42
42
  * Removes the saved username and password.
43
43
  */
@@ -54,7 +54,7 @@ export declare class Biometrics extends EventTarget {
54
54
  * Checks if there's secured content.
55
55
  * @returns Returns true if the secured content exists, false otherwise.
56
56
  */
57
- hasSecuredContent(): Promise<BiometricsResultReponse<boolean>>;
57
+ hasSecuredContent(): Promise<boolean>;
58
58
  /**
59
59
  * Removes secured content.
60
60
  *
@@ -1,6 +1,35 @@
1
+ import { EventTargetWithType } from "../../EventTarget";
1
2
  import { Startiapp } from "../../startiapp";
2
- export declare class Location extends EventTarget {
3
+ import { Location as LocationDto, LocationListeningOptions, LocationOptions } from "./types";
4
+ export declare class Location extends EventTargetWithType<{
5
+ locationChanged: CustomEvent<LocationDto>;
6
+ }> {
3
7
  private readonly startiapp;
4
8
  private locationIntegration;
5
9
  constructor(startiapp: Startiapp);
10
+ /**
11
+ * Retrieves the current location.
12
+ *
13
+ * @param options - The options for retrieving the location.
14
+ * @returns A promise that resolves to the current location.
15
+ */
16
+ getLocation(options?: LocationOptions): Promise<LocationDto>;
17
+ /**
18
+ * Starts the location listener.
19
+ *
20
+ * @param options - The options for location listening.
21
+ * @returns A promise that resolves when the location listener has started.
22
+ */
23
+ startLocationListener(options?: LocationListeningOptions): Promise<boolean>;
24
+ /**
25
+ * Checks if the location listener is active.
26
+ * @returns True if the location listener is active, false otherwise.
27
+ */
28
+ isLocationListenerActive(): Promise<boolean>;
29
+ /**
30
+ * Stops the location listener.
31
+ */
32
+ stopLocationListener(): Promise<void>;
33
+ private onListeningFailed;
34
+ private onLocationChanged;
6
35
  }
@@ -0,0 +1,44 @@
1
+ export interface Location {
2
+ latitude: number;
3
+ longitude: number;
4
+ altitude?: number | null;
5
+ accuracy?: number | null;
6
+ altitudeAccuracy?: number | null;
7
+ reducedAccuracy: boolean;
8
+ heading?: number | null;
9
+ speed?: number | null;
10
+ isFromMockProvider: boolean;
11
+ timestamp: string;
12
+ }
13
+ export interface LocationOptions {
14
+ /**
15
+ * The maximum time in milliseconds to wait for a location update.
16
+ */
17
+ timeoutInMs?: number;
18
+ /**
19
+ * The maximum age in milliseconds of a cached location that is acceptable to return.
20
+ */
21
+ maxAgeInMs?: number;
22
+ /**
23
+ * The desired accuracy of the location updates.
24
+ */
25
+ desiredAccuracy?: LocationAccuracyDto;
26
+ }
27
+ export interface LocationListeningOptions {
28
+ /**
29
+ * The minimum time in milliseconds between location updates.
30
+ */
31
+ minimumTimeInMs?: number;
32
+ /**
33
+ * The desired accuracy of the location updates.
34
+ */
35
+ desiredAccuracy?: LocationAccuracyDto;
36
+ }
37
+ export declare enum LocationAccuracyDto {
38
+ Default = "Default",
39
+ Lowest = "Lowest",
40
+ Low = "Low",
41
+ Medium = "Medium",
42
+ High = "High",
43
+ Best = "Best"
44
+ }
@@ -1,6 +1,7 @@
1
1
  import { NavigationSpinnerOptions, RegexDto } from "./integrations/App/typings";
2
2
  import { BiometricsAuthenticationType, BiometricsResultReponse } from "./integrations/Biometrics/BiometricsIntegration";
3
3
  import { InApPurchasePurchaseType, InAppPurchaseGetProductResponse, InAppPurchaseProductResponse, InAppPurchaseResponse } from "./integrations/InAppPurchase/InAppPurchaseIntegration";
4
+ import { Location, LocationListeningOptions, LocationOptions } from "./integrations/Location/types";
4
5
  import { ListenResponse, NetworkAccess } from "./integrations/Network/NetworkIntegration";
5
6
  import { SetStatusBarOptions } from "./startiapp";
6
7
  export type PushNotificationIntegration = {
@@ -107,7 +108,12 @@ type DeveloperIntegration = {
107
108
  type StorageIntegration = {
108
109
  clearWebData(): void;
109
110
  };
110
- type LocationIntegration = object;
111
+ type LocationIntegration = {
112
+ getLocation(options?: LocationOptions): Location;
113
+ startLocationListener(options?: LocationListeningOptions): boolean;
114
+ stopLocationListener(): void;
115
+ isLocationListenerActive(): boolean;
116
+ };
111
117
  export type Integrations = {
112
118
  "AppIntegration": AppIntegration;
113
119
  "DeviceIntegration": DeviceIntegration;
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.21",
5
+ "version": "2.0.35",
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",