import { a as StytchProjectConfigurationInput, I as IHeadlessMagicLinksClient, b as IHeadlessSessionClient, c as IHeadlessOTPsClient, d as IHeadlessCryptoWalletClient, e as IHeadlessWebAuthnClient, f as IHeadlessPasswordClient, C as ConsumerState, g as StytchClientOptions } from './ui-BfG6bZHf.js';
import { I as IHeadlessIDPClient, a as INetworkClient, O as OAuthAuthorizeStartOptions, b as OAuthAuthorizeStartResponse, c as OAuthAuthorizeSubmitOptions, d as OAuthAuthorizeSubmitResponse, e as OAuthLogoutStartOptions, f as OAuthLogoutStartResponse, g as IHeadlessOAuthClient, h as OneTapRenderResult, i as IHeadlessUserClient, j as IHeadlessTOTPClient, k as IHeadlessImpersonationClient, l as IHeadlessRBACClient, S as StateChangeRegisterFunction, P as ParseAuthenticateUrl, A as AuthenticateByUrl } from './createAuthUrlHandler-Bx2xzMj7.js';

declare class HeadlessIDPClient implements IHeadlessIDPClient {
    private _networkClient;
    constructor(_networkClient: INetworkClient);
    oauthAuthorizeStart: (data: OAuthAuthorizeStartOptions) => Promise<OAuthAuthorizeStartResponse>;
    oauthAuthorizeSubmit: (data: OAuthAuthorizeSubmitOptions) => Promise<OAuthAuthorizeSubmitResponse>;
    oauthLogoutStart: (data: OAuthLogoutStartOptions) => Promise<OAuthLogoutStartResponse>;
}

type GoogleOneTapOAuthOptions = {
    /**
     * The URL that Stytch redirects to after the OAuth flow is completed for a user that already exists.
     * This URL should be an endpoint in the backend server that verifies the request by querying Stytch's /oauth/authenticate endpoint and finishes the login.
     * The URL should be configured as a Login URL in the Stytch Dashboard's Redirect URL page.
     * If the field is not specified, the default in the Dashboard is used.
     */
    login_redirect_url?: string;
    /**
     * The URL that Stytch redirects to after the OAuth flow is completed for a user that does not yet exist.
     * This URL should be an endpoint in the backend server that verifies the request by querying Stytch's /oauth/authenticate endpoint and finishes the login.
     * The URL should be configured as a Sign Up URL in the Stytch Dashboard's Redirect URL page.
     * If the field is not specified, the default in the Dashboard is used.
     */
    signup_redirect_url?: string;
    /**
     * An optional callback function that runs when a user explicitly cancels out of the one tap flow.
     * This callback may not be invoked immediately or at all depending on the behavior of the browser and Google's SDK.
     */
    onOneTapCancelled?: () => void;
    /**
     * Controls whether clicking outside the One Tap prompt dismisses the prompt.
     * Defaults to true.
     */
    cancel_on_tap_outside?: boolean;
};
interface IGoogleOneTapOAuthProvider {
    /**
     * Start an OAuth flow by showing the Google one tap prompt in the top right corner of the user's browser.
     * You can configure this to be started by a user action (i.e Button click) or on load/render.
     * @example
     * const showGoogleOneTap = useCallback(()=> {
     *   stytch.oauth.googleOneTap.start({
     *     login_redirect_url: 'https://example.com/oauth/callback',
     *     signup_redirect_url: 'https://example.com/oauth/callback',
     *   })
     * }, [stytch]);
     * return (
     *   <Button onClick={showGoogleOneTap}> Show Google one tap </Button>
     * );
     *
     * @param options - An {@link GoogleOneTapOAuthOptions} object
     *
     * @returns A {@link OneTapRenderResult} object. The result object includes if the one-tap prompt
     * was rendered, and a reason if it couldn't be rendered.
     *
     * @throws An Error if the one tap client cannot be created.
     */
    start(options?: GoogleOneTapOAuthOptions): Promise<OneTapRenderResult>;
}
interface IWebOAuthClient<TProjectConfiguration extends StytchProjectConfigurationInput> extends IHeadlessOAuthClient<TProjectConfiguration> {
    googleOneTap: IGoogleOneTapOAuthProvider;
}

type HandledTokenType = 'magic_links' | 'oauth' | 'impersonation';
/**
 * A headless client used for invoking the Stytch API.
 * The Stytch Headless Client can be used as a drop-in solution for authentication and session management.
 * Full documentation can be found {@link https://stytch.com/docs/sdks/javascript-sdk online}.
 * @example
 * const stytch = new StytchClient('public-token-<find yours in the stytch dashboard>');
 * stytch.magicLinks.email.loginOrCreate('sandbox@stytch.com', {
 *   login_magic_link_url: 'https://example.com/authenticate',
 *   login_expiration_minutes: 60,
 *   signup_magic_link_url: 'https://example.com/authenticate',
 *   signup_expiration_minutes: 60,
 * });
 */
declare class StytchClient<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> {
    private readonly _subscriptionService;
    private readonly _sessionManager;
    private readonly _networkClient;
    private readonly _dataLayer;
    private readonly _stateChangeClient;
    user: IHeadlessUserClient;
    magicLinks: IHeadlessMagicLinksClient<TProjectConfiguration>;
    session: IHeadlessSessionClient<TProjectConfiguration>;
    otps: IHeadlessOTPsClient<TProjectConfiguration>;
    oauth: IWebOAuthClient<TProjectConfiguration>;
    cryptoWallets: IHeadlessCryptoWalletClient<TProjectConfiguration>;
    totps: IHeadlessTOTPClient<TProjectConfiguration>;
    webauthn: IHeadlessWebAuthnClient<TProjectConfiguration>;
    passwords: IHeadlessPasswordClient<TProjectConfiguration>;
    impersonation: IHeadlessImpersonationClient<TProjectConfiguration>;
    rbac: IHeadlessRBACClient;
    idp: HeadlessIDPClient;
    /**
     * Register a callback function to be invoked whenever certain state changes
     * occur, like a user or session object being updated.
     *
     * This is an alternative to more specific methods like `user.onChange` and
     * `session.onChange`. It can be helpful if you want to be notified of related
     * changes to different parts of state at once.
     *
     * If you are only interested in specific state changes, consider using more
     * specific methods like `user.onChange` and `session.onChange` instead.
     */
    onStateChange: StateChangeRegisterFunction<ConsumerState>;
    /**
     * Extracts token and token type from the current page URL's query parameters.
     * If the current URL do not have the required query params, this will return null.
     * Otherwise, returns an object { handled: boolean, tokenType: string, token: string }
     */
    parseAuthenticateUrl: ParseAuthenticateUrl<HandledTokenType>;
    /**
     * Call this method to authenticate the user when the user has been redirected
     * to this page with a token in the query parameters, such as after OAuth
     * or through an email magic link. This method currently supports
     *
     * - Magic links
     * - OAuth
     * - Impersonation
     *
     * Returns null if token or stytch_token_type query parameters are not present,
     * or returns an unhandled result if the token type is not recognized.
     */
    authenticateByUrl: AuthenticateByUrl<HandledTokenType>;
    constructor(publicTokenRaw: string, options?: StytchClientOptions);
}

export { StytchClient as S };
