starti.app 2.0.35 → 2.0.43

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.
@@ -2,15 +2,19 @@ import { Integrations } from "./integrations";
2
2
  type FunctionOfIntegrationMethod<TIntegrationKey extends keyof Integrations, TIntegrationMethodKey extends keyof Integrations[TIntegrationKey]> = Integrations[TIntegrationKey][TIntegrationMethodKey] extends (...args: infer TArgs) => infer TReturn ? (...args: TArgs) => TReturn : never;
3
3
  type MethodFunction = (...args: any) => any;
4
4
  type PromiseResolve<T> = (value?: T | PromiseLike<T>) => void;
5
+ type PromiseReject = (reason?: any) => void;
5
6
  type AsyncIntegrationResolverCallOptions<TMethodKey, TMethodResponse> = {
6
7
  methodName: TMethodKey;
7
8
  shouldResolve?: (value: TMethodResponse) => boolean;
9
+ shouldReject?: (value: any) => boolean;
8
10
  };
9
11
  export declare class AsyncIntegrationResolver<TIntegrationKey extends keyof Integrations> {
10
12
  private integrationKey;
11
13
  promises: Record<string, Array<{
12
14
  resolve: PromiseResolve<any>;
13
- shouldResolve?: (value: any) => boolean;
15
+ shouldResolve?: (value?: any) => boolean;
16
+ reject: PromiseReject;
17
+ shouldReject?: (value: any) => boolean;
14
18
  }>>;
15
19
  events: Record<string, Array<(...args: any[]) => void>>;
16
20
  private get integration();
@@ -50,6 +50,10 @@ export declare class App extends EventTargetWithType<{
50
50
  * ```
51
51
  */
52
52
  addInternalDomain: (domain: string) => Promise<void>;
53
+ getInternalDomains: () => Promise<void>;
54
+ addExternalDomains: (...domains: RegExp[]) => Promise<void>;
55
+ removeExternalDomains: (...domains: RegExp[]) => Promise<void>;
56
+ getExternalDomains: () => Promise<void>;
53
57
  /**
54
58
  * Remove an internal domain from the app.
55
59
  *
@@ -61,8 +65,16 @@ export declare class App extends EventTargetWithType<{
61
65
  removeInternalDomain: (domain: string) => Promise<void>;
62
66
  /** Sets the status bar options for the app. */
63
67
  setStatusBar: (options: SetStatusBarOptions) => Promise<void>;
68
+ /** Hides the status bar */
69
+ hideStatusBar: () => Promise<void>;
70
+ /** Shows the status bar */
71
+ showStatusBar: () => Promise<void>;
72
+ /** Sets the safe area background color for the app. */
73
+ setSafeAreaBackgroundColor: (color: string) => Promise<boolean>;
64
74
  /** Sets the navigation spinner options for the app. */
65
75
  setSpinner: (options: SpinnerOptions) => Promise<void>;
76
+ hideSpinner: () => Promise<void>;
77
+ showSpinner: (options?: SpinnerOptions) => Promise<void>;
66
78
  /** Enables the screen to rotate */
67
79
  enableScreenRotation: () => Promise<void>;
68
80
  /** Prevents the screen from rotation */
@@ -103,6 +115,26 @@ export declare class App extends EventTargetWithType<{
103
115
  * Retrieves the current app url.
104
116
  */
105
117
  getAppUrl: () => Promise<string>;
118
+ openExternalBrowser: (url: string) => Promise<void>;
119
+ /**
120
+ * Set the app url.
121
+ *
122
+ * @example
123
+ * ```typescript
124
+ * await startiapp.App.setAppUrl("https://example.com");
125
+ * ```
126
+ *
127
+ */
128
+ setAppUrl: (url: string) => Promise<void>;
129
+ /**
130
+ * Reset the app url.
131
+ *
132
+ * @example
133
+ * ```typescript
134
+ * await startiapp.App.resetAppUrl();
135
+ * ```
136
+ */
137
+ resetAppUrl: () => Promise<void>;
106
138
  /**
107
139
  * Prompt the user to review the app.
108
140
  *
@@ -1,8 +1,10 @@
1
1
  import { EventTargetWithType } from "../../EventTarget";
2
2
  import { Startiapp } from "../../startiapp";
3
- import { Location as LocationDto, LocationListeningOptions, LocationOptions } from "./types";
3
+ import { GeofenceRegion, Location as LocationDto, LocationListeningOptions, LocationOptions } from "./types";
4
4
  export declare class Location extends EventTargetWithType<{
5
5
  locationChanged: CustomEvent<LocationDto>;
6
+ onRegionEntered: CustomEvent<GeofenceRegion>;
7
+ onRegionExited: CustomEvent<GeofenceRegion>;
6
8
  }> {
7
9
  private readonly startiapp;
8
10
  private locationIntegration;
@@ -30,6 +32,10 @@ export declare class Location extends EventTargetWithType<{
30
32
  * Stops the location listener.
31
33
  */
32
34
  stopLocationListener(): Promise<void>;
35
+ createGeofence(region: GeofenceRegion): Promise<void>;
36
+ removeGeofence(region: GeofenceRegion): Promise<void>;
37
+ getGeofences(): Promise<GeofenceRegion[]>;
33
38
  private onListeningFailed;
34
39
  private onLocationChanged;
40
+ private onGeofenceEvent;
35
41
  }
@@ -42,3 +42,18 @@ export declare enum LocationAccuracyDto {
42
42
  High = "High",
43
43
  Best = "Best"
44
44
  }
45
+ export interface Position {
46
+ latitude: number;
47
+ longitude: number;
48
+ }
49
+ export interface Distance {
50
+ totalKilometers: number;
51
+ }
52
+ export interface GeofenceRegion {
53
+ identifier: string;
54
+ center: Position;
55
+ radius: Distance;
56
+ notifyOnEntry?: boolean;
57
+ notifyOnExit?: boolean;
58
+ }
59
+ export type GeofenceState = "entered" | "exited" | "unknown";
@@ -1,7 +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
+ import { GeofenceRegion, Location, LocationListeningOptions, LocationOptions } from "./integrations/Location/types";
5
5
  import { ListenResponse, NetworkAccess } from "./integrations/Network/NetworkIntegration";
6
6
  import { SetStatusBarOptions } from "./startiapp";
7
7
  export type PushNotificationIntegration = {
@@ -49,6 +49,7 @@ type AppIntegration = {
49
49
  enableScreenRotation(): void;
50
50
  addInternalDomain(domain: string): void;
51
51
  removeInternalDomain(domain: string): void;
52
+ getInternalDomains(): void;
52
53
  setSafeAreaBackgroundColor(color: string): boolean;
53
54
  hideStatusBar(): void;
54
55
  showStatusBar(): void;
@@ -113,6 +114,9 @@ type LocationIntegration = {
113
114
  startLocationListener(options?: LocationListeningOptions): boolean;
114
115
  stopLocationListener(): void;
115
116
  isLocationListenerActive(): boolean;
117
+ createGeofence(region: GeofenceRegion): void;
118
+ removeGeofence(region: GeofenceRegion): void;
119
+ getGeofences(): GeofenceRegion[];
116
120
  };
117
121
  export type Integrations = {
118
122
  "AppIntegration": AppIntegration;
@@ -2,6 +2,7 @@ import { App } from "./integrations/App/AppIntegration";
2
2
  import { Biometrics } from "./integrations/Biometrics/BiometricsIntegration";
3
3
  import { Developer } from "./integrations/Developer/DeveloperIntegration";
4
4
  import { InAppPurchase } from "./integrations/InAppPurchase/InAppPurchaseIntegration";
5
+ import { Location } from "./integrations/Location/LocationIntegration";
5
6
  import { Network } from "./integrations/Network/NetworkIntegration";
6
7
  import { NfcScanner } from "./integrations/NfcScanner/NfcScannerIntegration";
7
8
  import { PushNotification } from "./integrations/PushNotification/PushNotificationIntegration";
@@ -21,6 +22,7 @@ export declare class StartiappClass extends EventTarget {
21
22
  private readonly appIntegration;
22
23
  App: App;
23
24
  Share: Share;
25
+ Location: Location;
24
26
  NfcScanner: NfcScanner;
25
27
  QrScanner: QrScanner;
26
28
  Biometrics: Biometrics;
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.35",
5
+ "version": "2.0.43",
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",