import { AuthorizationModal } from './authModal.js'; import { ConnectUI } from './connectUI.js'; import type { ConnectUIProps } from './connectUI.js'; import type { AuthErrorType, AuthOptions, AuthSuccess, ConnectionConfig } from './types.js'; export type * from './types.js'; export * from './connectUI.js'; export type NangoOptions = { host?: string; websocketsPath?: string; width?: number; height?: number; debug?: boolean; } & ({ connectSessionToken?: string; publicKey?: never; } | { connectSessionToken?: never; publicKey?: string; }); export declare class AuthError extends Error { type: AuthErrorType; constructor(message: string, type: AuthErrorType); } export default class Nango { private hostBaseUrl; private websocketsBaseUrl; private publicKey; private connectSessionToken; private debug; private width; private height; private tm; win: AuthorizationModal | null; constructor(config?: NangoOptions); /** * Creates a new unauthenticated connection using the specified provider configuration key and connection ID * @param providerConfigKey - The key identifying the provider configuration on Nango * @param connectionId - Optional. The ID of the connection * @param connectionConfig - Optional. Additional configuration for the connection * @returns A promise that resolves with the authentication result */ create(providerConfigKey: string, connectionConfig?: ConnectionConfig): Promise; create(providerConfigKey: string, connectionId: string, connectionConfig?: ConnectionConfig): Promise; /** * Initiates the authorization process for a connection * @param providerConfigKey - The key identifying the provider configuration on Nango * @param connectionId - Optional. The ID of the connection for which to authorize * @param options - Optional. Additional options for authorization * @returns A promise that resolves with the authorization result */ auth(providerConfigKey: string, options?: AuthOptions): Promise; auth(providerConfigKey: string, connectionId: string, options?: AuthOptions): Promise; reconnect(providerConfigKey: string, options?: AuthOptions): Promise; /** * Clear state of the frontend SDK * Delays closing the popup so the callback page can postMessage to conect ui * and the opener can process the message before the popup is destroyed. */ clear(): void; /** * Open managed Connect UI */ openConnectUI(params: ConnectUIProps): ConnectUI; /** * Converts the provided credentials to a Connection configuration object * @param credentials - The credentials to convert * @returns The connection configuration object */ private convertCredentialsToConfig; private triggerAuth; /** * Performs authorization based on the provided credentials i.e api, basic, appstore and oauth2 * @param providerConfigKey - The key identifying the provider configuration on Nango * @param connectionId - The ID of the connection for which to create the custom Authorization * @param connectionConfigWithCredentials - The connection configuration containing the credentials * @param connectionConfig - Optional. Additional connection configuration * @returns A promise that resolves with the authorization result */ private customAuth; /** * Converts the connection ID and configuration parameters into a query string * @param connectionId - The ID of the connection for which to generate a query string * @param connectionConfig - Optional. Additional configuration for the connection * @returns The generated query string */ private toQueryString; /** * Check that we have one valid credential * It's not done in the constructor because if you only use Nango Connect it's not relevant to throw an error */ private ensureCredentials; } //# sourceMappingURL=index.d.ts.map