/** * 本模块提供链接处理相关方法。 * @packageDocumentation */ /** * 保利威 WebView 桥接器接口 */ export interface WebViewBridge { /** * 向 WebView 发送数据 * @param event 事件 * @param data 数据对象 */ sendData: (event: string, data: Record) => void; } /** 是否安卓 */ export declare const isAndroid: boolean; /** 是否 iOS */ export declare const isIOS: boolean; /** 是否纯血鸿蒙 */ export declare const isHarmony: boolean; /** 是否移动端 */ export declare const isPortable: boolean; /** * 外链跳转方式 */ export declare enum LinkJumpWay { /** * iframe 弹框形式打开 */ PopUp = "POP_UP", /** * 新窗口打开 */ NewWindow = "NEW_WINDOW", /** * 当前窗口打开 */ CurrentWindow = "CURRENT_WINDOW" } /** * 链接数据接口 */ export interface LinkData { /** * 通用平台跳转链接的跳转方式 */ jumpWay: LinkJumpWay; /** * PC 端跳转链接的跳转方式。 * 未指定时回退为 jumpWay。 */ pcLinkJumpWay?: LinkJumpWay; /** * App 降级跳转链接的跳转方式。 * 未指定时回退为 jumpWay。 */ mobileAppLinkJumpWay?: LinkJumpWay; /** * 通用平台跳转链接 */ link: string; /** * PC 端跳转链接 */ pcLink: string; /** * App 链接 */ mobileAppLink: string; /** * 安卓端 app 跳转链接 */ androidLink: string; /** * iOS app 跳转链接 */ iosLink: string; /** * 鸿蒙 app 跳转链接 */ harmonyLink: string; /** * 微信小程序原始 id */ wxMiniprogramOriginalId: string; /** * 微信小程序应用 id */ wxMiniprogramAppId: string; /** * 微信小程序内页面路径及参数 */ wxMiniprogramLink: string; } /** * 获取链接参数 */ export type GetLinkParams = (url: string) => Record; /** * 跳转链接配置项 */ export interface NavigateToLinkOptions { /** 链接数据 */ linkData: LinkData; /** 是否使用保利威桥接器跳转链接 */ usePlvWebviewBridge?: boolean; /** * 获取链接参数 */ getLinkParams?: GetLinkParams; /** 通用链接打开处理器 */ openLink: (url: string, jumpWay: LinkJumpWay) => void; /** 是否移动端 */ isMobile?: () => boolean; /** 是否处于保利威 webview 中 */ isPlvWebview?: () => boolean; /** 获取保利威 webview 桥接器 */ getPlvWebviewBridge?: () => Promise; /** 获取保利威 webview 小窗尺寸 */ getPlvWebviewSmallWindowSize?: () => { width: number; height: number; }; isWxMiniProgramEnv?: () => Promise; /** 跳转微信小程序 */ toWxMiniProgram?: (link: string) => void; /** 跳转失败回调 */ failCallback?: () => void; /** app 标识 */ getIsApp?: () => string | undefined; } /** * 检测自定义环境 UA 配置 */ export declare function isCustomUA(uaList: string[]): boolean; /** * 通过 URL Scheme 打开 App,失败时跳转兜底链接 */ export declare function openAppWithFallback(options: { iosLink: string; androidLink: string; harmonyLink: string; fallbackUrl: string; jumpWay: LinkJumpWay; openLink: (url: string, jumpWay: LinkJumpWay) => void; failCallback?: () => void; getIsApp?: () => string | undefined; }): void; /** * 格式化链接地址 * @param url 需要格式化的链接地址 * @param getLinkParams 获取额外参数的函数,可选 * @returns 格式化后的链接地址 */ export declare function formatLink(url: string, getLinkParams?: (url: string) => Record): string; /** * 根据链接类型和当前环境进行跳转处理 * @param options 跳转配置项 */ export declare function navigateToLink(options: NavigateToLinkOptions): void;