import type { OnboardingReturn, SignupCredentials } from '../types'; /** * Two drivers for the same popup. {@link awaitSignupReturn} is the one to use: * the code goes to the service's callback, so it only waits for the popup to * come back to our origin. {@link openSignup} is the older half-and-half (code * on the redirect, ids by `postMessage`), for a BSP app whose registered * redirect is a page of yours -- what `/onboarding/exchange` exists for. */ /** How the popup is opened, and how to follow its progress. */ export interface OpenSignupOptions { /** Window name, so a second call reuses the popup rather than opening two. */ name?: string; width?: number; height?: number; /** How long to wait for both halves. Default 15 minutes. */ timeoutMs?: number; /** For a console showing more than a spinner. `step` is Meta's own `current_step`. */ onProgress?: (event: { phase: 'opened' | 'step' | 'code' | 'ids' | 'returned'; step?: string; }) => void; } /** Thrown for every way the dialog can fail to produce credentials. */ export declare class EmbeddedSignupError extends Error { readonly code: 'unsupported_environment' | 'popup_blocked' | 'popup_closed' | 'cancelled' | 'signup_error' | 'timeout'; /** The service's own code, when the refusal came back on the return URL. */ readonly reason?: string | undefined; constructor(code: 'unsupported_environment' | 'popup_blocked' | 'popup_closed' | 'cancelled' | 'signup_error' | 'timeout', message: string, /** The service's own code, when the refusal came back on the return URL. */ reason?: string | undefined); } /** * The redirect flow: open the dialog, wait for the popup to come back to our * origin with the service's outcome on it. Nothing here reads Meta, so the * return has to be a page on **this** origin -- a cross-origin one cannot be * read, and the wait ends as `popup_closed`. * * Call it **straight from a click handler**, or the `window.open` is blocked. */ export declare const awaitSignupReturn: (url: string, options?: OpenSignupOptions) => Promise; /** * The older driver, for a BSP app whose registered redirect is a page of yours: * it waits for the code *and* the ids, which is what `/onboarding/exchange` * takes. Call it **straight from a click handler**, as above. */ export declare const openSignup: (url: string, options?: OpenSignupOptions) => Promise;