import { KnownErrors } from "@hexclave/shared"; import { Result } from "@hexclave/shared/dist/utils/results"; import { AsyncStoreProperty, AuthLike, GetCurrentPartialUserOptions, GetCurrentUserOptions, HandlerUrlOptions, HandlerUrls, OAuthScopesOnSignIn, RedirectMethod, RedirectToOptions, ResolvedHandlerUrls, TokenStoreInit, hexclaveAppInternalsSymbol } from "../../common.js"; import { Project } from "../../projects/index.js"; import { ProjectCurrentUser, SyncedPartialUser, TokenPartialUser } from "../../users/index.js"; import { RequestListener } from "@hexclave/shared/dist/interface/client-interface"; import { CurrentUserCrud } from "@hexclave/shared/dist/interface/crud/current-user"; import { CustomerInvoicesList, CustomerInvoicesRequestOptions, CustomerProductsList, CustomerProductsRequestOptions, Item } from "../../customers/index.js"; import { AnalyticsOptions } from "../implementations/session-replay.js"; //#region src/lib/hexclave-app/apps/interfaces/client-app.d.ts /** @deprecated Use `HexclaveClientAppConstructorOptions` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */ type StackClientAppConstructorOptions = { baseUrl?: string | { browser: string; server: string; }; extraRequestHeaders?: Record; projectId?: ProjectId; publishableClientKey?: string; urls?: HandlerUrlOptions; oauthScopesOnSignIn?: Partial; tokenStore?: TokenStoreInit; redirectMethod?: RedirectMethod; inheritsFrom?: StackClientApp; /** * Whether to show the Hexclave dev tool indicator in browser-like environments. * * - `true`: always show * - `false`: never show * - `"auto"` (default): show based on NODE_ENV or origin heuristics */ devTool?: boolean | "auto"; /** * 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; /** * Whether the constructor starts browser integrations and other automatic side effects. Defaults to `true`. * * Set this to `false` when the app is instantiated inside a custom dashboard. Explicit method calls remain * available and can still perform their documented side effects. */ automaticSideEffects?: boolean; /** * Options for analytics and session recording. Replays are enabled by default; * set `{ replays: { enabled: false } }` to opt out. */ analytics?: AnalyticsOptions; } & ({ tokenStore: TokenStoreInit; } | { tokenStore?: undefined; inheritsFrom: StackClientApp; }) & (string extends ProjectId ? unknown : ({ projectId: ProjectId; } | { inheritsFrom: StackClientApp; })); /** @deprecated Use `HexclaveClientAppJson` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */ type StackClientAppJson = StackClientAppConstructorOptions & { inheritsFrom?: undefined; } & { uniqueIdentifier: string; }; /** @deprecated Use `HexclaveClientApp` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */ type StackClientApp = ({ readonly projectId: ProjectId; /** * The version of the Hexclave SDK. */ readonly version: string; /** * @deprecated Do not use `app.urls` for navigation. It is static and does not include runtime redirect-back, * cross-domain auth, or sign-out state. Use the matching `redirectToXyz()` method instead, for example * `redirectToSignIn()`, `redirectToSignUp()`, `redirectToSignOut()`, or `redirectToAccountSettings()`. */ 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; 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; [hexclaveAppInternalsSymbol]: { 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; getUrls(): Readonly; getRedirectMethod(): RedirectMethod; redirectToUrl(url: string | URL, options?: { replace?: boolean; }): Promise; getRedirectToHandlerUrl(handlerName: keyof HandlerUrls, options?: RedirectToOptions): Promise; redirectToHandler(handlerName: keyof HandlerUrls, options?: RedirectToOptions): Promise; /** Raw flow metadata only. Never navigate to this value without normal redirect validation. */ getRawAfterAuthReturnTo(): string | null; signInWithTokens(tokens: { accessToken: string; refreshToken: string; }): Promise; awaitPendingAuthResolutions(): Promise; isTrustedRedirectUrl(url: 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); /** @deprecated Use `HexclaveClientAppConstructor` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */ type StackClientAppConstructor = { new (options: StackClientAppConstructorOptions): StackClientApp; new (options: StackClientAppConstructorOptions): StackClientApp; [hexclaveAppInternalsSymbol]: { fromClientJson(json: StackClientAppJson): StackClientApp; }; }; type HexclaveClientAppConstructorOptions = StackClientAppConstructorOptions; type HexclaveClientAppJson = StackClientAppJson; type HexclaveClientApp = StackClientApp; type HexclaveClientAppConstructor = StackClientAppConstructor; declare const HexclaveClientApp: HexclaveClientAppConstructor; /** @deprecated Use `HexclaveClientApp` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */ declare const StackClientApp: StackClientAppConstructor; //#endregion export { HexclaveClientApp, HexclaveClientAppConstructor, HexclaveClientAppConstructorOptions, HexclaveClientAppJson, StackClientApp, StackClientAppConstructor, StackClientAppConstructorOptions, StackClientAppJson }; //# sourceMappingURL=client-app.d.ts.map