interface HostedFrameMessage { type: string; height?: number; } type HostedFrameOptions = { allowedOrigin?: string; height?: string; onCloseButton?: () => void; onMessage: (data: TData, container: HTMLDivElement, event: MessageEvent) => void; width?: string; }; type HostedFrameInstance = { container: HTMLDivElement; iframe: HTMLIFrameElement; }; declare class HostedFrameModal { protected iframe: HTMLIFrameElement | null; protected modal: HTMLDivElement | null; protected messageHandler: ((event: MessageEvent) => void) | null; protected openHostedFrame(url: string, options: HostedFrameOptions): HostedFrameInstance | null; close(): void; } type LoginEventType = "LOGIN_READY" | "LOGIN_SUCCESS" | "LOGIN_CANCELLED" | "LOGIN_CLOSE" | "LOGIN_RESIZE" | "LOGIN_REDIRECT_REQUIRED" | "LOGIN_ERROR"; type LoginDisplayMode = "auto" | "modal" | "popup" | "redirect"; type LoginFallbackRedirectMode = "auto" | "manual"; interface LoginResult { avatar?: string | null; channel?: string; email?: string | null; expiresAt?: string; legacyCasdoorId?: string; loginToken?: string; name?: string | null; username?: string | null; phoneCountryCode?: string | null; phoneNumber?: string | null; phoneE164?: string | null; phoneVerifiedAt?: string | null; userId?: string; wechatOpenId?: string | null; wechatUnionId?: string | null; } interface LoginEventData extends HostedFrameMessage, LoginResult { type: LoginEventType; attemptId?: string; authUrl?: string; channel?: string; error?: string; message?: string; } interface LoginUIOptions { /** Origin to validate postMessage (defaults to '*', set for security) */ allowedOrigin?: string; /** Whether the SDK should close the login surface after receiving LOGIN_CLOSE. Defaults to true. */ autoClose?: boolean; /** Optional same-origin URL used as the no-API OAuth callback landing page. */ callbackUrl?: string; /** * How to open the hosted login page. Defaults to "auto", which uses an * iframe modal on desktop and redirects on mobile/embedded browsers. */ displayMode?: LoginDisplayMode; /** Text for the fallback button shown when the iframe does not report readiness. */ fallbackButtonText?: string; /** Description for the fallback panel shown when the iframe does not report readiness. */ fallbackDescription?: string; /** * Whether the SDK should redirect automatically when iframe loading times out. * Defaults to "manual" to avoid taking over the integrator page when the * hosted page is only slow to report readiness. */ fallbackRedirectMode?: LoginFallbackRedirectMode; /** Title for the fallback panel shown when the iframe does not report readiness. */ fallbackTitle?: string; /** * How long the SDK waits for LOGIN_READY or LOGIN_RESIZE before showing the * fallback redirect button. Only used when displayMode is "modal". * Defaults to 6000ms. */ iframeLoadTimeoutMs?: number; /** Description shown while the hosted login iframe is loading. */ loadingDescription?: string; /** Title shown while the hosted login iframe is loading. */ loadingTitle?: string; /** * Whether to poll popup.closed to detect manual popup closure. * Only used when displayMode is "popup". Defaults to false because COOP can * make popup.closed unreliable. */ monitorPopupClosed?: boolean; onCancel?: () => void; onClose?: () => void; onError?: (message?: string, data?: LoginEventData) => void; onFallbackVisible?: () => void; onSuccess?: (result: LoginResult) => void; } interface LoginCallbackOptions { /** * Whether the callback helper should close the current window after * publishing the login result. Defaults to false; LoginUI closes the popup * it opened after receiving the callback event. */ autoClose?: boolean; onError?: (message?: string, data?: LoginEventData) => void; onResult?: (data: LoginEventData) => void; onSuccess?: (result: LoginResult) => void; } interface LoginParams { appId: string; /** * @deprecated Use loginUrl instead * Defaults to https://pay.imgto.link */ baseUrl?: string; /** * Hosted login page base URL (e.g. https://pay.youidian.com) * Defaults to https://pay.imgto.link */ loginUrl?: string; /** * Optional locale prefix to prepend to the hosted login path. * If omitted, the SDK automatically resolves the locale from the browser language. */ locale?: string; /** Preferred provider/channel code */ preferredChannel?: string; } declare function handleLoginCallbackIfPresent(options?: LoginCallbackOptions): boolean; declare class LoginUI extends HostedFrameModal { private popup; private callbackChannel; private callbackStorageHandler; private popupMessageHandler; private closeMonitor; private iframeFallbackPanel; private iframeLoadingPanel; private iframeLoadTimer; private iframeRedirectTimer; private iframeReady; private completed; private cleanup; private markIframeReady; private showIframeLoading; private showIframeFallback; private startIframeWatchdog; private handleLoginEvent; private openLoginRedirect; private listenForLoginCallback; close(): void; private buildOpenContext; private openLoginModal; private openLoginPopup; openLogin(params: LoginParams, options?: LoginUIOptions): void; } declare function createLoginUI(): LoginUI; export { HostedFrameModal as H, type LoginCallbackOptions as L, type LoginDisplayMode as a, type LoginEventData as b, type LoginEventType as c, type LoginFallbackRedirectMode as d, type LoginParams as e, type LoginResult as f, LoginUI as g, type LoginUIOptions as h, createLoginUI as i, handleLoginCallbackIfPresent as j };