starti.app 2.0.35 → 2.0.51

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,44 @@ export declare class App extends EventTargetWithType<{
50
50
  * ```
51
51
  */
52
52
  addInternalDomain: (domain: string) => Promise<void>;
53
+ /**
54
+ * Get the internal domains of the app.
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * const internalDomains = await startiapp.App.getInternalDomains();
59
+ * console.log(internalDomains);
60
+ * ```
61
+ */
62
+ getInternalDomains: () => Promise<void>;
63
+ /**
64
+ * Add external domains to the app.
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * await startiapp.App.addExternalDomains(/example.com/, /starti.app/);
69
+ * ```
70
+ */
71
+ addExternalDomains: (...domains: RegExp[]) => Promise<void>;
72
+ /**
73
+ * Remove external domains from the app.
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * await startiapp.App.removeExternalDomains(/example.com/, /starti.app/);
78
+ * ```
79
+ */
80
+ removeExternalDomains: (...domains: RegExp[]) => Promise<void>;
81
+ /**
82
+ * Get the external domains of the app.
83
+ *
84
+ * @example
85
+ * ```typescript
86
+ * const externalDomains = await startiapp.App.getExternalDomains();
87
+ * console.log(externalDomains);
88
+ * ```
89
+ */
90
+ getExternalDomains: () => Promise<void>;
53
91
  /**
54
92
  * Remove an internal domain from the app.
55
93
  *
@@ -61,8 +99,27 @@ export declare class App extends EventTargetWithType<{
61
99
  removeInternalDomain: (domain: string) => Promise<void>;
62
100
  /** Sets the status bar options for the app. */
63
101
  setStatusBar: (options: SetStatusBarOptions) => Promise<void>;
102
+ /** Hides the status bar */
103
+ hideStatusBar: () => Promise<void>;
104
+ /** Shows the status bar */
105
+ showStatusBar: () => Promise<void>;
106
+ /** Sets the safe area background color for the app. */
107
+ setSafeAreaBackgroundColor: (color: string) => Promise<boolean>;
64
108
  /** Sets the navigation spinner options for the app. */
65
109
  setSpinner: (options: SpinnerOptions) => Promise<void>;
110
+ /**
111
+ * Hides the navigation spinner.
112
+ */
113
+ hideSpinner: () => Promise<void>;
114
+ /**
115
+ * Shows the navigation spinner.
116
+ *
117
+ * @example
118
+ * ```typescript
119
+ * await startiapp.App.showSpinner();
120
+ * ```
121
+ */
122
+ showSpinner: (options?: SpinnerOptions) => Promise<void>;
66
123
  /** Enables the screen to rotate */
67
124
  enableScreenRotation: () => Promise<void>;
68
125
  /** Prevents the screen from rotation */
@@ -103,6 +160,26 @@ export declare class App extends EventTargetWithType<{
103
160
  * Retrieves the current app url.
104
161
  */
105
162
  getAppUrl: () => Promise<string>;
163
+ openExternalBrowser: (url: string) => Promise<void>;
164
+ /**
165
+ * Set the app url.
166
+ *
167
+ * @example
168
+ * ```typescript
169
+ * await startiapp.App.setAppUrl("https://example.com");
170
+ * ```
171
+ *
172
+ */
173
+ setAppUrl: (url: string) => Promise<void>;
174
+ /**
175
+ * Reset the app url.
176
+ *
177
+ * @example
178
+ * ```typescript
179
+ * await startiapp.App.resetAppUrl();
180
+ * ```
181
+ */
182
+ resetAppUrl: () => Promise<void>;
106
183
  /**
107
184
  * Prompt the user to review the app.
108
185
  *
@@ -0,0 +1,12 @@
1
+ import { PopulatedSaveUsernameAndPasswordConfiguration, SaveUsernameAndPasswordConfiguration } from "./BiometricsIntegration";
2
+ export declare class BiometricService {
3
+ static saveConfigurationAndAddMiddlewareToSubmitButton(configurationKey: string, credentialsKey: string, request: SaveUsernameAndPasswordConfiguration): void;
4
+ static getCredentials(credentialsKey: string): {
5
+ username: string;
6
+ password: string;
7
+ } | null;
8
+ static removeConfiguration(configurationKey: string): void;
9
+ static promptForBiometrics(populatedConfiguration: PopulatedSaveUsernameAndPasswordConfiguration): Promise<boolean>;
10
+ static getPopulatedConfiguration(configurationKey: string): PopulatedSaveUsernameAndPasswordConfiguration;
11
+ static tryLoginAsync(configurationKey: string): Promise<boolean>;
12
+ }
@@ -4,6 +4,8 @@ export declare class Biometrics extends EventTarget {
4
4
  private biometricsIntegration;
5
5
  private SECURED_CONTENT_KEY;
6
6
  private SECURED_LOGIN_KEY;
7
+ private BiometricsConfigurationKey;
8
+ private BiometricsCredentialsKey;
7
9
  private defaultScanTitle;
8
10
  private defaultScanReason;
9
11
  constructor(startiapp: Startiapp);
@@ -61,9 +63,44 @@ export declare class Biometrics extends EventTarget {
61
63
  * @returns A promise that resolves when the secured content is successfully removed.
62
64
  */
63
65
  removeSecuredContent(): Promise<void>;
66
+ /**
67
+ * Starts the process of saving a username and password using biometrics.
68
+ * When logged in successfully, make sure to call {@link endSaveUsernameAndPassword} to save the username and password.
69
+ *
70
+ * @param request - The configuration for saving the username and password.
71
+ */
72
+ startSaveUsernameAndPassword(request: SaveUsernameAndPasswordConfiguration): Promise<void>;
73
+ /**
74
+ * Ends the process of saving a username and password using biometrics.
75
+ *
76
+ * @returns A promise that resolves when the username and password are successfully saved.
77
+ */
78
+ endSaveUsernameAndPassword(): Promise<void>;
64
79
  }
65
80
  export type BiometricsAuthenticationType = "None" | "Face" | "Fingerprint";
66
81
  export type BiometricsResultReponse<T> = {
67
82
  key: string;
68
83
  result: T;
69
84
  };
85
+ /**
86
+ * The configuration for saving a username and password using biometrics.
87
+ * @param usernameInputFieldSelector - The JS selector for the username input field.
88
+ * @param passwordInputFieldSelector - The JS selector for the password input field.
89
+ * @param submitButtonSelector - The JS selector for the submit button.
90
+ * @param title - The title of the biometrics scan.
91
+ * @param reason - The reason for the biometrics scan.
92
+ */
93
+ export type SaveUsernameAndPasswordConfiguration = {
94
+ usernameInputFieldSelector: string;
95
+ passwordInputFieldSelector: string;
96
+ submitButtonSelector: string;
97
+ title: string;
98
+ reason: string;
99
+ };
100
+ export type PopulatedSaveUsernameAndPasswordConfiguration = SaveUsernameAndPasswordConfiguration & {
101
+ usernameInputField: HTMLInputElement;
102
+ passwordInputField: HTMLInputElement;
103
+ submitButton: HTMLButtonElement;
104
+ } | {
105
+ error: string;
106
+ };
@@ -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
- import { BiometricsAuthenticationType, BiometricsResultReponse } from "./integrations/Biometrics/BiometricsIntegration";
2
+ import { BiometricsAuthenticationType, BiometricsResultReponse, SaveUsernameAndPasswordConfiguration } 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;
@@ -70,6 +71,8 @@ type BiometricIntegration = {
70
71
  getSecuredContent(key: string, title: string, reason: string): BiometricsResultReponse<string | null>;
71
72
  hasSecuredContent(key: string): BiometricsResultReponse<boolean>;
72
73
  removeSecuredContent(key: string): void;
74
+ startSaveUsernameAndPassword(request: SaveUsernameAndPasswordConfiguration): void;
75
+ endSaveUsernameAndPassword(): void;
73
76
  };
74
77
  type CalendarIntegration = {
75
78
  isAccessGranted(): void;
@@ -113,6 +116,9 @@ type LocationIntegration = {
113
116
  startLocationListener(options?: LocationListeningOptions): boolean;
114
117
  stopLocationListener(): void;
115
118
  isLocationListenerActive(): boolean;
119
+ createGeofence(region: GeofenceRegion): void;
120
+ removeGeofence(region: GeofenceRegion): void;
121
+ getGeofences(): GeofenceRegion[];
116
122
  };
117
123
  export type Integrations = {
118
124
  "AppIntegration": AppIntegration;
@@ -0,0 +1,10 @@
1
+ export declare const SessionStorage: {
2
+ getItem<T>(key: string): T | null;
3
+ setItem<T>(key: string, value: T): void;
4
+ removeItem(key: string): void;
5
+ };
6
+ export declare const LocalStorage: {
7
+ getItem<T>(key: string): T | null;
8
+ setItem<T>(key: string, value: T): void;
9
+ removeItem(key: string): void;
10
+ };
@@ -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.51",
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",