import { AsyncStoreProperty, AuthLike, GetCurrentPartialUserOptions, GetCurrentUserOptions, HandlerUrlOptions, HandlerUrls, OAuthScopesOnSignIn, RedirectMethod, RedirectToOptions, ResolvedHandlerUrls, TokenStoreInit, stackAppInternalsSymbol } from "../../common.js"; import { CustomerInvoicesList, CustomerInvoicesRequestOptions, CustomerProductsList, CustomerProductsRequestOptions, Item } from "../../customers/index.js"; import { ProjectCurrentUser, SyncedPartialUser, TokenPartialUser } from "../../users/index.js"; import { Project } from "../../projects/index.js"; import { AnalyticsOptions } from "../implementations/session-replay.js"; import { KnownErrors } from "@stackframe/stack-shared"; import { CurrentUserCrud } from "@stackframe/stack-shared/dist/interface/crud/current-user"; import { Result } from "@stackframe/stack-shared/dist/utils/results"; import { RequestListener } from "@stackframe/stack-shared/dist/interface/client-interface"; //#region src/lib/stack-app/apps/interfaces/client-app.d.ts type StackClientAppConstructorOptions = { baseUrl?: string | { browser: string; server: string; }; extraRequestHeaders?: Record; projectId?: ProjectId; publishableClientKey?: string; urls?: HandlerUrlOptions; oauthScopesOnSignIn?: Partial; tokenStore?: TokenStoreInit; redirectMethod?: RedirectMethod; inheritsFrom?: StackClientApp; /** * By default, the Stack app will automatically prefetch some data from Stack's server when this app is first * constructed. This improves the performance of your app, but will create network requests that are unnecessary if * the app is never used or disposed of immediately. To disable this behavior, set this option to true. */ noAutomaticPrefetch?: boolean; /** * Options for analytics and session recording. Replays are disabled by default; * set `{ replays: { enabled: true } }` to opt in. */ analytics?: AnalyticsOptions; } & ({ tokenStore: TokenStoreInit; } | { tokenStore?: undefined; inheritsFrom: StackClientApp; }) & (string extends ProjectId ? unknown : ({ projectId: ProjectId; } | { inheritsFrom: StackClientApp; })); type StackClientAppJson = StackClientAppConstructorOptions & { inheritsFrom?: undefined; } & { uniqueIdentifier: string; }; type StackClientApp = ({ readonly projectId: ProjectId; /** * The version of the Stack Auth SDK. */ readonly version: string; /** * @deprecated `app.urls` is static and does not include runtime redirect-back parameters. * For navigation, prefer `redirectToXyz()` methods (for example `redirectToSignIn()`). */ readonly urls: Readonly; signInWithOAuth(provider: string, options?: { returnTo?: string; }): Promise; signInWithCredential(options: { email: string; password: string; noRedirect?: boolean; }): Promise>; signUpWithCredential(options: { email: string; password: string; noRedirect?: boolean; } & ({ noVerificationCallback: true; } | { noVerificationCallback?: false; verificationCallbackUrl?: string; })): Promise>; signInWithPasskey(): Promise>; callOAuthCallback(): Promise; promptCliLogin(options: { appUrl: string; expiresInMillis?: number; anonRefreshToken?: string; promptLink?: (url: string, loginCode: string) => void; }): Promise>; sendForgotPasswordEmail(email: string, options?: { callbackUrl?: string; }): Promise>; sendMagicLinkEmail(email: string, options?: { callbackUrl?: string; }): Promise>; resetPassword(options: { code: string; password: string; }): Promise>; verifyPasswordResetCode(code: string): Promise>; verifyTeamInvitationCode(code: string): Promise>; acceptTeamInvitation(code: string): Promise>; getTeamInvitationDetails(code: string): Promise>; verifyEmail(code: string): Promise>; signInWithMagicLink(code: string, options?: { noRedirect?: boolean; }): Promise>; signInWithMfa(otp: string, code: string, options?: { noRedirect?: boolean; }): Promise>; redirectToOAuthCallback(): Promise; getConvexClientAuth(options: HasTokenStore extends false ? { tokenStore: TokenStoreInit; } : { tokenStore?: TokenStoreInit; }): (args: { forceRefreshToken: boolean; }) => Promise; getConvexHttpClientAuth(options: { tokenStore: TokenStoreInit; }): Promise; useUser(options: GetCurrentUserOptions & { or: 'redirect'; }): ProjectCurrentUser; useUser(options: GetCurrentUserOptions & { or: 'throw'; }): ProjectCurrentUser; useUser(options: GetCurrentUserOptions & { or: 'anonymous'; }): ProjectCurrentUser; useUser(options?: GetCurrentUserOptions): ProjectCurrentUser | null; getUser(options: GetCurrentUserOptions & { or: 'redirect'; }): Promise>; getUser(options: GetCurrentUserOptions & { or: 'throw'; }): Promise>; getUser(options: GetCurrentUserOptions & { or: 'anonymous'; }): Promise>; getUser(options?: GetCurrentUserOptions): Promise | null>; cancelSubscription(options: { productId: string; subscriptionId?: string; } | { productId: string; subscriptionId?: string; teamId: string; }): Promise; getPartialUser(options: GetCurrentPartialUserOptions & { from: 'token'; }): Promise; getPartialUser(options: GetCurrentPartialUserOptions & { from: 'convex'; }): Promise; getPartialUser(options: GetCurrentPartialUserOptions): Promise; usePartialUser(options: GetCurrentPartialUserOptions & { from: 'token'; }): TokenPartialUser | null; usePartialUser(options: GetCurrentPartialUserOptions & { from: 'convex'; }): TokenPartialUser | null; usePartialUser(options: GetCurrentPartialUserOptions): SyncedPartialUser | TokenPartialUser | null; useNavigate(): (to: string) => void; [stackAppInternalsSymbol]: { toClientJson(): StackClientAppJson; setCurrentUser(userJsonPromise: Promise): void; getConstructorOptions(): StackClientAppConstructorOptions & { inheritsFrom?: undefined; }; sendSessionReplayBatch(body: string, options: { keepalive: boolean; }): Promise>; sendAnalyticsEventBatch(body: string, options: { keepalive: boolean; }): Promise>; addRequestListener(listener: RequestListener): () => void; sendRequest(path: string, requestOptions: RequestInit, requestType?: "client" | "server" | "admin"): Promise; signInWithTokens(tokens: { accessToken: string; refreshToken: string; }): Promise; }; } & AsyncStoreProperty<"project", [], Project, false> & AsyncStoreProperty<"item", [{ itemId: string; userId: string; } | { itemId: string; teamId: string; } | { itemId: string; customCustomerId: string; }], Item, false> & AsyncStoreProperty<"products", [options: CustomerProductsRequestOptions], CustomerProductsList, true> & AsyncStoreProperty<"invoices", [options: CustomerInvoicesRequestOptions], CustomerInvoicesList, true> & { [K in `redirectTo${Capitalize>}`]: (options?: RedirectToOptions) => Promise } & AuthLike); type StackClientAppConstructor = { new (options: StackClientAppConstructorOptions): StackClientApp; new (options: StackClientAppConstructorOptions): StackClientApp; [stackAppInternalsSymbol]: { fromClientJson(json: StackClientAppJson): StackClientApp; }; }; declare const StackClientApp: StackClientAppConstructor; //#endregion export { StackClientApp, StackClientAppConstructor, StackClientAppConstructorOptions, StackClientAppJson }; //# sourceMappingURL=client-app.d.ts.map