import { H as HostedFrameModal } from './login-Dqemys65.js'; export { L as LoginCallbackOptions, a as LoginDisplayMode, b as LoginEventData, c as LoginEventType, e as LoginParams, f as LoginResult, g as LoginUI, h as LoginUIOptions, i as createLoginUI, j as handleLoginCallbackIfPresent } from './login-Dqemys65.js'; type LoginDeviceType = "desktop" | "mobile" | "tablet" | "unknown"; type LoginEnvironmentInput = { coarsePointer?: boolean; maxTouchPoints?: number; platform?: string; standalone?: boolean; userAgent?: string; userAgentDataMobile?: boolean; }; type LoginEnvironment = { deviceType: LoginDeviceType; isAndroid: boolean; isCoarsePointer: boolean; isDesktop: boolean; isIOS: boolean; isIPadOS: boolean; isMobile: boolean; isStandalone: boolean; isTablet: boolean; isTouch: boolean; isWeChat: boolean; maxTouchPoints: number; platform: string; shouldUseRedirectLogin: boolean; userAgent: string; }; declare function detectLoginEnvironment(input?: LoginEnvironmentInput): LoginEnvironment; /** * Youidian Payment SDK - Client Module * 用于浏览器端集成,包含支付弹窗、状态轮询等功能 * 不依赖 Node.js crypto 模块 */ /** * Payment event types from checkout pages */ type PaymentEventType = "PAYMENT_READY" | "PAYMENT_SUCCESS" | "PAYMENT_CANCELLED" | "PAYMENT_CLOSE" | "PAYMENT_RESIZE" | "PAYMENT_STARTED"; /** * Payment event data from postMessage */ interface PaymentEventData { type: PaymentEventType; orderId?: string; height?: number; } /** * Order status response */ interface OrderStatus { orderId: string; status: "PENDING" | "PAID" | "CANCELLED" | "REFUNDED" | "FAILED" | "EXPIRED"; paidAt?: string; channelTransactionId?: string; } interface PaymentUIThemeColors { primary?: string; secondary?: string; foreground?: string; muted?: string; surface?: string; } /** * Payment UI Options */ interface PaymentUIOptions { locale?: string; onSuccess?: (orderId?: string) => void; onCancel?: (orderId?: string) => void; onClose?: () => void; onFallbackBlocked?: (url: string) => void; onFallbackOpen?: (url: string) => void; onFallbackVisible?: () => void; /** Origin to validate postMessage (defaults to '*', set for security) */ allowedOrigin?: string; /** Theme colors for SDK fallback/loading chrome. Defaults to Youidian green. */ theme?: PaymentUIThemeColors; /** Text for the fallback button shown when the checkout iframe is slow. */ fallbackButtonText?: string; /** Text for retrying the embedded checkout iframe. */ fallbackRetryText?: string; /** How long to wait for PAYMENT_READY or PAYMENT_RESIZE. Defaults to 8000ms. */ iframeLoadTimeoutMs?: number; /** Description shown while the hosted checkout iframe is loading. */ loadingDescription?: string; /** Title shown while the hosted checkout iframe is loading. */ loadingTitle?: string; } /** * Poll Options */ interface PollOptions { /** Polling interval in ms (default: 3000) */ interval?: number; /** Timeout in ms (default: 300000 = 5 minutes) */ timeout?: number; /** Callback on each status check */ onStatusChange?: (status: OrderStatus) => void; } /** * Client-side Payment UI Helper * 浏览器端支付 UI 辅助类,用于弹出支付窗口和轮询订单状态 */ /** * Params for opening payment directly without manual URL construction */ interface PaymentParams { appId: string; userId?: string; /** Existing Youidian order ID - opens checkout for an already-created order */ orderId?: string; /** Product ID - use with priceId for direct ID-based payment */ productId?: string; /** Price ID - use with productId for direct ID-based payment */ priceId?: string; /** Product code - use with locale for code-based payment (alternative to productId/priceId) */ productCode?: string; /** Optional custom recharge amount in the smallest currency unit */ customAmount?: { amount: number; currency: string; }; /** * @deprecated Use checkoutUrl instead * Defaults to https://pay.imgto.link */ baseUrl?: string; /** * Checkout page URL (e.g. https://pay.youidian.com) * Defaults to https://pay.imgto.link */ checkoutUrl?: string; } /** * Client-side Payment UI Helper * 浏览器端支付 UI 辅助类,用于弹出支付窗口和轮询订单状态 */ declare class PaymentUI extends HostedFrameModal { private activeCheckoutAppId; private activeCheckoutBaseUrl; private activeOrderId; private paymentCompleted; private cancelRequestedOrderId; private iframeFallbackPanel; private iframeLoadingPanel; private iframeLoadTimer; private iframeReady; private cleanupPaymentFrameState; private markPaymentIframeReady; private showPaymentIframeLoading; private openFallbackPaymentPage; private showPaymentIframeFallback; private startPaymentIframeWatchdog; private cancelHostedOrder; /** * Opens the payment checkout page in an iframe modal. * @param urlOrParams - The checkout page URL or payment parameters * @param options - UI options */ openPayment(urlOrParams: string | PaymentParams, options?: PaymentUIOptions): void; close(): void; /** * Poll order status from integrator's API endpoint * @param statusUrl - The integrator's API endpoint to check order status * @param options - Polling options * @returns Promise that resolves when order is paid or rejects on timeout/failure */ pollOrderStatus(statusUrl: string, options?: PollOptions): Promise; } interface WechatMessageBindingUIOptions { bindingUrl: string; displayMode?: "redirect" | "popup"; popupName?: string; } declare class MessageUI { openWechatBinding(options: WechatMessageBindingUIOptions): void; } declare function createMessageUI(): MessageUI; /** * Convenience function to create a PaymentUI instance */ declare function createPaymentUI(): PaymentUI; export { type LoginDeviceType, type LoginEnvironment, type LoginEnvironmentInput, MessageUI, type OrderStatus, type PaymentEventData, type PaymentEventType, type PaymentParams, PaymentUI, type PaymentUIOptions, type PaymentUIThemeColors, type PollOptions, type WechatMessageBindingUIOptions, createMessageUI, createPaymentUI, detectLoginEnvironment };