starti.app 2.0.145 → 2.0.150

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.
@@ -0,0 +1,74 @@
1
+ import { EventTargetWithType } from "../../EventTarget";
2
+ import { Startiapp } from "../../startiapp";
3
+ export declare class Auth extends EventTargetWithType<{
4
+ authenticationCompleted: CustomEvent<AuthenticationResult>;
5
+ }> {
6
+ private readonly startiapp;
7
+ private authIntegration;
8
+ constructor(startiapp: Startiapp);
9
+ /**
10
+ * Sign in with a provider
11
+ *
12
+ * @param providerName - The provider to sign in with ("google", "apple", "microsoft", "custom")
13
+ * @returns A promise that resolves with the authentication result
14
+ * @example
15
+ * ```typescript
16
+ * const result = await startiapp.Auth.signIn("google");
17
+ * if (result.IsSuccess) {
18
+ * console.log("User authenticated:", result.Email);
19
+ * }
20
+ * ```
21
+ */
22
+ signIn: (providerName: string) => Promise<AuthenticationResult>;
23
+ /**
24
+ * Sign out the current user
25
+ *
26
+ * @returns A promise that resolves with true if sign out was successful
27
+ * @example
28
+ * ```typescript
29
+ * const success = await startiapp.Auth.signOut();
30
+ * console.log("Signed out:", success);
31
+ * ```
32
+ */
33
+ signOut: () => Promise<boolean>;
34
+ /**
35
+ * Get the current authentication session (synchronous)
36
+ *
37
+ * @returns The current session or null if not authenticated
38
+ * @example
39
+ * ```typescript
40
+ * const session = startiapp.Auth.getCurrentSession();
41
+ * if (session) {
42
+ * console.log("Current user:", session.Email);
43
+ * }
44
+ * ```
45
+ */
46
+ getCurrentSession: () => Promise<AuthenticationResult | null>;
47
+ /**
48
+ * Check if user is currently authenticated (synchronous)
49
+ *
50
+ * @returns True if user is authenticated, false otherwise
51
+ * @example
52
+ * ```typescript
53
+ * if (startiapp.Auth.isAuthenticated()) {
54
+ * console.log("User is logged in");
55
+ * }
56
+ * ```
57
+ */
58
+ isAuthenticated: () => Promise<boolean>;
59
+ }
60
+ export interface AuthenticationResult {
61
+ IsSuccess: boolean;
62
+ AccessToken?: string;
63
+ RefreshToken?: string;
64
+ IdToken?: string;
65
+ ExpiresAt?: string;
66
+ UserId?: string;
67
+ Email?: string;
68
+ Name?: string;
69
+ ProfilePictureUrl?: string;
70
+ ErrorMessage?: string;
71
+ AdditionalClaims: Record<string, string>;
72
+ ProviderName?: string;
73
+ RedirectUri?: string;
74
+ }
@@ -62,13 +62,18 @@ export declare class PushNotification extends EventTargetWithType<{
62
62
  *
63
63
  * @param topics List of topics to subscribe to
64
64
  * @param shouldCheckAccess Boolean indicating whether to check for push notification permissions
65
+ * @returns Array of successfully subscribed topics with their actual server-assigned topic IDs and names
65
66
  *
66
67
  * @example
67
68
  * ```typescript
68
- * await pushNotification.subscribeToTopics(["topic1", "topic2"]);
69
+ * const subscribedTopics = await pushNotification.subscribeToTopics(["topic1", "topic2"]);
70
+ * console.log(subscribedTopics); // [{ topic: "topic1", name: "Topic 1" }, { topic: "topic2", name: "Topic 2" }]
69
71
  * ```
70
72
  */
71
- subscribeToTopics(topics: string[], shouldCheckAccess?: boolean): Promise<void>;
73
+ subscribeToTopics(topics: string[], shouldCheckAccess?: boolean): Promise<Array<{
74
+ topic: string;
75
+ name: string;
76
+ }>>;
72
77
  /**
73
78
  * This method unsubscribes to a list of topics.
74
79
  *
@@ -1,4 +1,5 @@
1
1
  import { NavigationSpinnerOptions, PermissionStatus, RegexDto, VibrationIntensity } from "./integrations/App/typings";
2
+ import { AuthenticationResult } from "./integrations/Auth/AuthIntegration";
2
3
  import { BiometricsAuthenticationType, BiometricsResultReponse, SaveUsernameAndPasswordConfiguration } from "./integrations/Biometrics/BiometricsIntegration";
3
4
  import { NoticeResponse, TokensResponse } from "./integrations/ExternalPurchaseCustomLink/typings";
4
5
  import { InApPurchasePurchaseType, InAppPurchaseGetProductResponse, InAppPurchaseProductResponse, InAppPurchaseResponse } from "./integrations/InAppPurchase/InAppPurchaseIntegration";
@@ -124,6 +125,12 @@ type DeveloperIntegration = {
124
125
  type StorageIntegration = {
125
126
  clearWebData(): void;
126
127
  };
128
+ type AuthIntegration = {
129
+ signIn(providerName: string): void;
130
+ signOut(): void;
131
+ getCurrentSession(): AuthenticationResult | null;
132
+ isAuthenticated(): boolean;
133
+ };
127
134
  type LocationIntegration = {
128
135
  getLocation(options?: LocationOptions): Location;
129
136
  startLocationListener(options?: LocationListeningOptions): boolean;
@@ -162,5 +169,6 @@ export type Integrations = {
162
169
  LocationIntegration: LocationIntegration;
163
170
  MediaIntegration: MediaIntegration;
164
171
  ExternalPurchaseCustomLinkIntegration: ExternalPurchaseCustomLinkIntegration;
172
+ AuthIntegration: AuthIntegration;
165
173
  };
166
174
  export {};
@@ -1,4 +1,5 @@
1
1
  import { App } from "./integrations/App/AppIntegration";
2
+ import { Auth } from "./integrations/Auth/AuthIntegration";
2
3
  import { Biometrics } from "./integrations/Biometrics/BiometricsIntegration";
3
4
  import { Developer } from "./integrations/Developer/DeveloperIntegration";
4
5
  import { ExternalPurchaseCustomLink } from "./integrations/ExternalPurchaseCustomLink/ExternalPurchaseCustomLinkIntegration";
@@ -23,6 +24,7 @@ declare global {
23
24
  export declare class StartiappClass extends EventTarget {
24
25
  private readonly appIntegration;
25
26
  App: App;
27
+ Auth: Auth;
26
28
  Share: Share;
27
29
  Location: Location;
28
30
  NfcScanner: NfcScanner;
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.145",
5
+ "version": "2.0.150",
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",