// Core types /** 工会邀请类型。 */ export type AgencyInviteTypeValue = 'to_be_member' | 'to_be_subagency'; /** WebView 主题模式。 */ export type ConfigThemeValue = 'dark' | 'light'; /** 图片用途类型,对应 `UploadImage.FileType`。 */ export type UploadImageFileTypeValue = 'user_avatar' | 'room_image' | 'other'; /** 图片来源方式,对应 `UploadImage.Sources`。 */ export type UploadImageSourcesValue = 'picker' | 'camera' | 'both'; /** 随机匹配房间类型,当前支持推荐热门与关注。 */ export type EnterRoomMatchTypeValue = 'popular' | 'follow'; /** 房间类型,用于切换房间回调。 */ export type RoomTypeValue = 'live' | 'chat'; /** 礼物分组类型,用于打开礼物面板回调。 */ export type GiftChunkTypeValue = 'recommend' | 'lucky' | 'luxury' | 'bag'; /** 权益资产类型:`0` 金币,`1` 积分。 */ export type BenefitAssetTypeValue = 0 | 1; /** 进房后可配置的回调类型。 */ export type EnterRoomCallbackTypeValue = | 'open_gift_popup' | 'open_game' | 'open_activity' | 'switch_room_type'; /** 权益列表项。 */ export interface BenefitItem { /** 权益唯一标识 ID。 */ id: number; /** 权益类型:`0` 金币,`1` 积分。 */ type: BenefitAssetTypeValue; /** 权益名称。 */ name: string; /** 权益图片地址。 */ image: string; /** 权益数量。 */ quantity?: number; /** 有效天数。 */ duration?: number; } /** 携带 SKU 直接发起内购时创建的充值订单。 */ export interface RechargeOrder { /** 订单 ID。 */ id: number; /** 创建时间戳。 */ createdAt: number; /** 订单号。 */ orderNo: string; /** 外部计划 ID。 */ outerPlanId: string; /** 支付方式,当前为 Google Play 内购。 */ payType: 'google'; /** 充值金额:美元。 */ amount: number; /** 是否上报成功。 */ report: boolean; } /** 进入房间 Action 的执行结果。 */ export interface EnterRoomResult { /** 目标房间 ID。 */ id?: number; /** 随机匹配类型。 */ match?: EnterRoomMatchTypeValue; /** 是否通过返回逻辑进入当前/活跃房间。 */ back?: boolean; } /** 活体检测 Action 的执行结果。 */ export interface LiveDetectResult { /** 活体检测 token。 */ token: string; /** 活体检测图片信息。 */ images?: string; } /** 图片上传 Action 的执行结果。 */ export interface UploadImageResult { /** 已上传的云图片地址。 */ url?: string; /** 上传失败时的错误消息。 */ error?: string; } /** 图片裁剪配置的数据形状;运行时请使用 `UploadImage.Cropping` 实例。 */ export interface UploadImageCroppingData { /** 裁剪后图片宽度。 */ width: number; /** 裁剪后图片高度。 */ height: number; } /** 权益弹窗主题的数据形状;运行时请使用 `GrantBenefits.Theme` 实例。 */ export interface GrantBenefitsThemeData { /** 主题图片。 */ image: string; /** 主题色。 */ tintColor: string; /** 按钮图片;仅当 `okAction` 非空时需要。 */ buttonImage?: string; /** 头部装饰高度,默认 `196`。 */ topInset?: number; } /** Action 类型到执行结果的映射。 */ export type ActionEventResultMap = { jump: undefined; navigate: undefined; replace: undefined; goback: undefined; enter_room: EnterRoomResult; live_detect: LiveDetectResult; onelink: string; ask: boolean; agency_invite: boolean; recharge: RechargeOrder | undefined; refresh_user_info: undefined; close: undefined; config: undefined; track: undefined; grant_benefits: undefined; verify_trade_password: boolean; upload_image: UploadImageResult; }; /** 根据 Action 类型提取执行结果类型。 */ export type ActionEventResult = ActionEventResultMap[T]; /** `bridge.ask` 的可选参数。 */ export interface AskOptions { /** 询问标题;与 message 任一非空时弹出确认框。 */ title?: string; /** 询问内容;与 title 任一非空时弹出确认框。 */ message?: string; /** 当前回复状态。 */ accepted?: boolean; /** 展示文本。 */ text?: string; } /** `bridge.recharge` 的可选参数。 */ export interface RechargeOptions { /** Google Play SKU;携带时跳过充值弹窗并直接发起内购。 */ sku?: string; /** 展示文本。 */ text?: string; } /** `bridge.config` 的可选参数。 */ export interface ConfigOptions { /** WebView 主题模式。 */ theme?: ConfigThemeValue; /** 品牌主色。 */ brandColor?: string; /** 强调色。 */ tintColor?: string; /** 页面标题。 */ title?: string; } /** `bridge.grantBenefits` 的可选参数。 */ export interface GrantBenefitsOptions { /** 弹窗标题,默认 `Congratulations`。 */ title?: string; /** 弹窗消息,默认 `The gift will be put into your bag`。 */ message?: string; /** 确认按钮动作。 */ okAction?: Action; /** 是否允许关闭,默认 `true`。 */ closeable?: boolean; /** 自动关闭时间,单位毫秒。 */ duration?: number; /** 自定义主题;运行时请使用 `GrantBenefits.Theme` 实例。 */ theme?: GrantBenefitsTheme; /** 展示文本。 */ text?: string; } /** `bridge.uploadImage` 的可选参数。 */ export interface UploadImageOptions { /** 图片用途类型,默认 `other`。 */ fileType?: UploadImageFileTypeValue; /** 图片来源方式,默认 `both`。 */ sources?: UploadImageSourcesValue; /** 裁剪配置;运行时请使用 `UploadImage.Cropping` 实例。 */ cropping?: UploadImageCropping; /** 压缩质量,范围 `0` 到 `1`。 */ quality?: number; /** 展示文本。 */ text?: string; } export class Jump { constructor(path: string); text: string | null; path: string; getText(): string | null; setText(text: string): this; getPath(): string; setPath(path: string): this; toMap(): Record; } export class Navigate { constructor(screen: string, params?: Record); text: string | null; screen: string; params: Record; getText(): string | null; setText(text: string): this; getScreen(): string; setScreen(screen: string): this; getParams(): Record; setParams(params: Record): this; toMap(): Record; } export class Replace extends Navigate { constructor(screen: string, params?: Record); } export class Goback { constructor(); text: string | null; getText(): string | null; setText(text: string): this; toMap(): Record; } export class OpenGiftPopupCallback { constructor(); id: number | null; type: GiftChunkTypeValue | null; count: number | null; getId(): number | null; setId(id: number): this; getType(): GiftChunkTypeValue | null; setType(type: GiftChunkTypeValue): this; getCount(): number | null; setCount(count: number): this; toMap(): Record; } export class OpenGameCallback { constructor(); id: number | null; getId(): number | null; setId(id: number): this; toMap(): Record; } export class OpenActivityCallback { constructor(); id: string | null; getId(): string | null; setId(id: string): this; toMap(): Record; } export class SwitchRoomTypeCallback { constructor(); type: RoomTypeValue | null; getType(): RoomTypeValue | null; setType(type: RoomTypeValue): this; toMap(): Record; } export const CallbackType: { OPEN_GIFT_POPUP: 'open_gift_popup'; OPEN_GAME: 'open_game'; OPEN_ACTIVITY: 'open_activity'; SWITCH_ROOM_TYPE: 'switch_room_type'; }; export class EnterRoom { constructor(); text: string | null; id: number | null; match: EnterRoomMatchTypeValue | null; callbacks: Record | null; back: boolean | null; useReplace: boolean | null; static CallbackType: typeof CallbackType; static OpenGiftPopupCallback: typeof OpenGiftPopupCallback; static OpenGameCallback: typeof OpenGameCallback; static OpenActivityCallback: typeof OpenActivityCallback; static SwitchRoomTypeCallback: typeof SwitchRoomTypeCallback; getText(): string | null; setText(text: string): this; getId(): number | null; setId(id: number): this; getMatch(): EnterRoomMatchTypeValue | null; setMatch(match: EnterRoomMatchTypeValue): this; getBack(): boolean | null; setBack(back: boolean): this; getUseReplace(): boolean | null; setUseReplace(useReplace: boolean): this; addOpenGiftPopupCallback(cb: OpenGiftPopupCallback): this; addOpenGameCallback(cb: OpenGameCallback): this; addOpenActivityCallback(cb: OpenActivityCallback): this; addSwitchRoomTypeCallback(cb: SwitchRoomTypeCallback): this; toMap(): Record; } export class LiveDetect { constructor(); text: string | null; getText(): string | null; setText(text: string): this; toMap(): Record; } export class Onelink { constructor(url?: string); text: string | null; url: string | null; share: boolean | null; getText(): string | null; setText(text: string): this; getUrl(): string | null; setUrl(url: string): this; getShare(): boolean | null; setShare(share: boolean): this; toMap(): Record; } export class Ask { constructor(id: number); text: string | null; id: number; title: string | null; message: string | null; accepted: boolean | null; getText(): string | null; setText(text: string): this; getId(): number; setId(id: number): this; getTitle(): string | null; setTitle(title: string): this; getMessage(): string | null; setMessage(message: string): this; getAccepted(): boolean | null; setAccepted(accepted: boolean): this; toMap(): Record; } export class AgencyInfo { id: string | null; name: string | null; ownerId: string | null; ownerName: string | null; ownerAvatar: string | null; getId(): string | null; setId(id: string): this; getName(): string | null; setName(name: string): this; getOwnerId(): string | null; setOwnerId(ownerId: string): this; getOwnerName(): string | null; setOwnerName(ownerName: string): this; getOwnerAvatar(): string | null; setOwnerAvatar(ownerAvatar: string): this; toMap(): Record; } export const AgencyInviteType: { TO_BE_MEMBER: 'to_be_member'; TO_BE_SUBAGENCY: 'to_be_subagency'; }; export class AgencyInvite { constructor(id: number, type: AgencyInviteTypeValue); text: string | null; id: number; type: AgencyInviteTypeValue; title: string | null; message: string | null; agencyInfo: AgencyInfo | null; accepted: boolean | null; static AgencyInfo: typeof AgencyInfo; static AgencyInviteType: typeof AgencyInviteType; getText(): string | null; setText(text: string): this; getId(): number; setId(id: number): this; getType(): AgencyInviteTypeValue; setType(type: AgencyInviteTypeValue): this; getTitle(): string | null; setTitle(title: string): this; getMessage(): string | null; setMessage(message: string): this; getAgencyInfo(): AgencyInfo | null; setAgencyInfo(agencyInfo: AgencyInfo): this; getAccepted(): boolean | null; setAccepted(accepted: boolean): this; toMap(): Record; } export class Recharge { constructor(); text: string | null; getText(): string | null; setText(text: string): this; sku: string | null; getSku(): string | null; setSku(sku: string): this; toMap(): Record; } export class RefreshUserInfo { constructor(); text: string | null; getText(): string | null; setText(text: string): this; toMap(): Record; } export class Close { constructor(); text: string | null; getText(): string | null; setText(text: string): this; toMap(): Record; } export const ConfigTheme: { DARK: 'dark'; LIGHT: 'light'; }; export class Config { constructor(); text: string | null; theme: ConfigThemeValue | null; brandColor: string | null; tintColor: string | null; title: string | null; static Theme: typeof ConfigTheme; getText(): string | null; setText(text: string): this; getTheme(): ConfigThemeValue | null; setTheme(theme: ConfigThemeValue): this; getBrandColor(): string | null; setBrandColor(brandColor: string): this; getTintColor(): string | null; setTintColor(tintColor: string): this; getTitle(): string | null; setTitle(title: string): this; toMap(): Record; } export class Track { constructor(name: string); text: string | null; name: string; params: Record | null; options: Record | null; getText(): string | null; setText(text: string): this; getName(): string; setName(name: string): this; getParams(): Record | null; setParams(params: Record): this; getOptions(): Record | null; setOptions(options: Record): this; toMap(): Record; } export class GrantBenefitsTheme { constructor(); image: string | null; tintColor: string | null; buttonImage: string | null; topInset: number | null; getImage(): string | null; setImage(image: string): this; getTintColor(): string | null; setTintColor(tintColor: string): this; getButtonImage(): string | null; setButtonImage(buttonImage: string): this; getTopInset(): number | null; setTopInset(topInset: number): this; toMap(): GrantBenefitsThemeData; } export class GrantBenefits { constructor(benefits: BenefitItem[]); text: string | null; benefits: BenefitItem[]; title: string | null; message: string | null; okAction: Action | null; closeable: boolean | null; duration: number | null; theme: GrantBenefitsTheme | null; static Theme: typeof GrantBenefitsTheme; getText(): string | null; setText(text: string): this; getBenefits(): BenefitItem[]; setBenefits(benefits: BenefitItem[]): this; getTitle(): string | null; setTitle(title: string): this; getMessage(): string | null; setMessage(message: string): this; getOkAction(): Action | null; setOkAction(okAction: Action): this; getCloseable(): boolean | null; setCloseable(closeable: boolean): this; getDuration(): number | null; setDuration(duration: number): this; getTheme(): GrantBenefitsTheme | null; setTheme(theme: GrantBenefitsTheme): this; toMap(): Record; } export class VerifyTradePassword { constructor(); text: string | null; getText(): string | null; setText(text: string): this; toMap(): Record; } export const UploadImageFileType: { USER_AVATAR: 'user_avatar'; ROOM_IMAGE: 'room_image'; OTHER: 'other'; }; export const UploadImageSources: { PICKER: 'picker'; CAMERA: 'camera'; BOTH: 'both'; }; export class UploadImageCropping { constructor(); width: number | null; height: number | null; getWidth(): number | null; setWidth(width: number): this; getHeight(): number | null; setHeight(height: number): this; toMap(): UploadImageCroppingData; } export class UploadImage { constructor(); text: string | null; fileType: UploadImageFileTypeValue | null; sources: UploadImageSourcesValue | null; cropping: UploadImageCropping | null; quality: number | null; static FileType: typeof UploadImageFileType; static Sources: typeof UploadImageSources; static Cropping: typeof UploadImageCropping; getText(): string | null; setText(text: string): this; getFileType(): UploadImageFileTypeValue | null; setFileType(fileType: UploadImageFileTypeValue): this; getSources(): UploadImageSourcesValue | null; setSources(sources: UploadImageSourcesValue): this; getCropping(): UploadImageCropping | null; setCropping(cropping: UploadImageCropping): this; getQuality(): number | null; setQuality(quality: number): this; toMap(): Record; } export class Action { constructor(type: ActionTypeValue, data: any); type: ActionTypeValue; data: any; messageId: string | null; getType(): ActionTypeValue; setType(type: ActionTypeValue): this; getData(): any; setData(data: any): this; setBaseData(text: string): this; toJson(): string; } export type ActionTypeValue = | 'jump' | 'navigate' | 'replace' | 'goback' | 'enter_room' | 'live_detect' | 'onelink' | 'ask' | 'agency_invite' | 'recharge' | 'refresh_user_info' | 'close' | 'config' | 'track' | 'grant_benefits' | 'verify_trade_password' | 'upload_image'; export const ActionType: { JUMP: 'jump'; NAVIGATE: 'navigate'; REPLACE: 'replace'; GOBACK: 'goback'; ENTER_ROOM: 'enter_room'; LIVE_DETECT: 'live_detect'; ONELINK: 'onelink'; ASK: 'ask'; AGENCY_INVITE: 'agency_invite'; RECHARGE: 'recharge'; REFRESH_USER_INFO: 'refresh_user_info'; CLOSE: 'close'; CONFIG: 'config'; TRACK: 'track'; GRANT_BENEFITS: 'grant_benefits'; VERIFY_TRADE_PASSWORD: 'verify_trade_password'; UPLOAD_IMAGE: 'upload_image'; }; export const ActionData: { Jump: typeof Jump; Navigate: typeof Navigate; Replace: typeof Replace; Goback: typeof Goback; EnterRoom: typeof EnterRoom; LiveDetect: typeof LiveDetect; Onelink: typeof Onelink; Ask: typeof Ask; AgencyInvite: typeof AgencyInvite; Recharge: typeof Recharge; RefreshUserInfo: typeof RefreshUserInfo; Close: typeof Close; Config: typeof Config; Track: typeof Track; GrantBenefits: typeof GrantBenefits; VerifyTradePassword: typeof VerifyTradePassword; UploadImage: typeof UploadImage; }; export const ActionCreator: { ActionData: typeof ActionData; ActionType: typeof ActionType; buildJump(path: string): Jump; createJumpAction(path: string): Action; createJumpActionWithData(jump: Jump): Action; buildNavigate(screen: string, params?: Record): Navigate; createNavigateAction(screen: string): Action; createNavigateActionWithParams( screen: string, params: Record, ): Action; createNavigateActionWithData(navigate: Navigate): Action; buildReplace(screen: string, params?: Record): Replace; createReplaceAction(screen: string): Action; createReplaceActionWithParams( screen: string, params: Record, ): Action; createReplaceActionWithData(replace: Replace): Action; buildGoback(): Goback; createGobackAction(): Action; createGobackActionWithData(goback: Goback): Action; buildEnterRoom(): EnterRoom; createEnterRoomAction(id: number): Action; createEnterRoomActionWithData(enterRoom: EnterRoom): Action; buildLiveDetect(): LiveDetect; createLiveDetectAction(): Action; createLiveDetectActionWithData(liveDetect: LiveDetect): Action; buildOnelink(url: string): Onelink; createOnelinkAction(url: string): Action; createOnelinkActionWithData(onelink: Onelink): Action; buildAsk(id: number): Ask; createAskAction(id: number): Action; createAskActionWithData(ask: Ask): Action; buildAgencyInvite(id: number, type: AgencyInviteTypeValue): AgencyInvite; createAgencyInviteAction(id: number, type: AgencyInviteTypeValue): Action; createAgencyInviteActionWithData(agencyInvite: AgencyInvite): Action; buildRecharge(): Recharge; createRechargeAction(): Action; createRechargeActionWithData(recharge: Recharge): Action; buildRefreshUserInfo(): RefreshUserInfo; createRefreshUserInfoAction(): Action; createRefreshUserInfoActionWithData(refreshUserInfo: RefreshUserInfo): Action; buildClose(): Close; createCloseAction(): Action; createCloseActionWithData(close: Close): Action; buildConfig(): Config; createConfigAction(): Action; createConfigActionWithData(config: Config): Action; buildTrack(name: string): Track; createTrackAction(name: string): Action; createTrackActionWithData(track: Track): Action; buildGrantBenefits(benefits: BenefitItem[]): GrantBenefits; createGrantBenefitsAction(benefits: BenefitItem[]): Action; createGrantBenefitsActionWithData(grantBenefits: GrantBenefits): Action; buildVerifyTradePassword(): VerifyTradePassword; createVerifyTradePasswordAction(): Action; createVerifyTradePasswordActionWithData( verifyTradePassword: VerifyTradePassword, ): Action; buildUploadImage(): UploadImage; createUploadImageAction(): Action; createUploadImageActionWithData(uploadImage: UploadImage): Action; };