123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649 |
- declare module "dh-mini-sdk-for-wx-2.0.1" {
- type Callback = (result: any) => void;
- type SuccessCallback = (response: Response) => void;
- type FailCallback = (error: Error) => void;
- type CompleteCallback = (result: Result) => void;
- interface Response {
- code: string | number | undefined;
- data: any;
- message: string
- }
- interface Error {
- code: string | number | undefined;
- data: any;
- message: string
- }
- interface Result {
- code: string | number | undefined;
- data: any;
- message: string
- }
- interface Options {
- requests: Requests;
- gameAppId: string | number;
- appId: string | number;
- appVersion: string;
- packageName: string;
- channel: string | number;
- mainChannel: string | number;
- secondChannel: string | number;
- heartbeatEnable?: boolean;
- reyunAppKey?: string;
- gravityEngineAccessToken?: string;
- gravityEngineDebug?: boolean;
- gravityEnginePayEventEnable?: boolean;
- tencentUserActionId: number;
- tencentSecretKey: string;
- tencentDebug?: boolean;
- }
- interface Requests {
- login: string | string[];
- pay: string | string[];
- midas: string | string[];
- survey: string | string[];
- customerService: string | string[];
- gameClub: string | string[];
- log: string | string[];
- errorLog: string | string[];
- }
- interface UserInfo {
- accountId: number;
- accountName: string;
- accountView: string;
- expireTimestamp: number;
- loginTimestamp: number;
- loginType: number;
- region: number;
- sign: string;
- token: string;
- isFirstLogin: boolean;
- userExtraInfo: UserExtraInfo;
- }
- interface UserExtraInfo {
- openId: string;
- userName: string;
- avatar: string;
- nickName: string;
- }
- interface UserRoleInfo {
- type: "LOGIN_GAME" | "CREATE_ROLE" | "LEVEL_UP" | "PAY_SUCCESS";
- areaId?: string | number;
- areaName?: string;
- roleId?: string | number;
- roleName?: string;
- roleLevel?: number;
- roleVipLevel?: number;
- itemId?: string;
- itemName?: string;
- orderId?: string | number;
- orderPrice?: number;
- currency?: string;
- payType?: string;
- }
- interface LoginOptions {
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface UploadRoleInfoOptions {
- type: "LOGIN_GAME" | "CREATE_ROLE" | "LEVEL_UP" | "PAY_SUCCESS";
- areaId?: string | number;
- areaName?: string;
- roleId?: string | number;
- roleName?: string;
- roleLevel?: number;
- roleVipLevel?: number;
- itemId?: string;
- itemName?: string;
- orderId?: string | number;
- orderPrice?: number;
- currency?: string;
- payType?: string;
- }
- interface CreateUserInfoButtonOptions {
- type: "text" | "image";
- text?: string;
- image?: string;
- style: {
- top: number;
- left: number;
- width: number;
- height: number;
- borderWidth?: number;
- borderRadius?: number;
- borderColor?: string;
- backgroundColor?: string;
- color?: string;
- fontSize?: number;
- textAlign?: string;
- lineHeight?: number;
- };
- withCredentials?: boolean;
- lang?: "en" | "zh_CN" | "zh_TW";
- }
- interface UserInfoButton {
- show: () => void;
- hide: () => void;
- destroy: () => void;
- onTap: (listener: Callback) => void;
- offTap: (listener: Callback) => void;
- }
- interface GetUserInfoOptions {
- withCredentials?: boolean;
- lang?: "en" | "zh_CN" | "zh_TW";
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface PayOptions {
- cardMessageTitle?: string;
- cardMessageImage?: string;
- areaId?: string | number;
- areaName?: string;
- roleId?: string | number;
- roleName?: string;
- roleLevel?: number;
- itemId: string;
- itemName: string;
- itemNum?: number;
- itemPrice: number;
- currency?: string;
- rate: number;
- memo?: string;
- remark?: string;
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface PaySettings {
- android?: "h5" | "midas";
- ios?: "h5";
- windows?: "h5" | "midas";
- mac?: "h5";
- devtools?: "h5" | "midas";
- }
- interface CreateRewardedVideoAdOptions {
- adUnitId: string;
- adMultiton?: boolean;
- adPlatform?: string;
- adPosition?: string;
- onLoad?: (response: Response) => void;
- onClose?: (result: Result) => void;
- onError?: (error: Error) => void;
- }
- interface RewardedVideoAd {
- load: (callback?: Callback) => void;
- show: (options?: RewardedVideoAdShowOptions | Callback, callback?: Callback) => void;
- destroy: () => void;
- }
- interface RewardedVideoAdShowOptions {
- adPosition?: string;
- }
- interface OpenSurveyOptions {
- areaId?: string | number;
- roleId?: string | number;
- roleName?: string;
- roleLevel?: number;
- surveyId: number;
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface OpenCustomerServiceOptions {
- areaId?: string | number;
- roleId?: string | number;
- roleName?: string;
- roleLevel?: number;
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface CreateFeedbackButtonOptions {
- type: "text" | "image";
- text?: string;
- image?: string;
- style: {
- top: number;
- left: number;
- width: number;
- height: number;
- borderWidth?: number;
- borderRadius?: number;
- borderColor?: string;
- backgroundColor?: string;
- color?: string;
- fontSize?: number;
- textAlign?: string;
- lineHeight?: number;
- }
- }
- interface FeedbackButton {
- show: () => void;
- hide: () => void;
- destroy: () => void;
- onTap: (listener: Callback) => void;
- offTap: (listener: Callback) => void;
- }
- interface OpenChannelsUserProfileOptions {
- finderUserName: string;
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface OpenChannelsEventOptions {
- finderUserName: string;
- eventId: string;
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface OpenChannelsActivityOptions {
- finderUserName: string;
- feedId: string;
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface OpenChannelsLiveOptions {
- finderUserName: string;
- feedId?: string;
- noticeId?: string;
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface ReserveChannelsLiveOptions {
- noticeId: string;
- }
- interface GetChannelsLiveNoticeInfoOptions {
- finderUserName: string;
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface GetChannelsLiveInfoOptions {
- finderUserName: string;
- startTime?: number;
- endTime?: number;
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface CreateGameClubButtonOptions {
- type: "text" | "image";
- text?: string;
- icon?: "green" | "white" | "dark" | "light";
- image?: string;
- style: {
- top: number;
- left: number;
- width: number;
- height: number;
- borderWidth?: number;
- borderRadius?: number;
- borderColor?: string;
- backgroundColor?: string;
- color?: string;
- fontSize?: number;
- textAlign?: string;
- lineHeight?: number;
- };
- openlink?: string;
- hasRedDot?: boolean;
- }
- interface GameClubButton {
- show: () => void;
- hide: () => void;
- destroy: () => void;
- onTap: (listener: Callback) => void;
- offTap: (listener: Callback) => void;
- }
- interface ShareImageToGameClubOptions {
- title: string;
- content: string;
- url?: string;
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface ShareCanvasToGameClubOptions {
- title: string;
- content: string;
- x?: number;
- y?: number;
- width?: number;
- height?: number;
- destWidth?: number;
- destHeight?: number;
- fileType?: "png" | "jpg";
- quality?: number;
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface GetGameClubDataOptions {
- dataTypeList: GameClubDataType[];
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface GameClubDataType {
- type: number;
- subKey?: string;
- }
- interface GameRecorder {
- isFrameSupported(): boolean;
- isSoundSupported(): boolean;
- isVolumeSupported(): boolean;
- isAtempoSupported(): boolean;
- on(event: string, callback: Callback): void;
- off(event: string, callback: Callback): void;
- start(options?: GameRecorderStartOptions): Promise<any>;
- pause(): Promise<any>;
- resume(): Promise<any>;
- stop(): Promise<any>;
- abort(): Promise<any>;
- }
- interface GameRecorderStartOptions {
- fps?: number;
- bitrate?: number;
- gop?: number;
- duration?: number;
- hookBgm?: boolean
- }
- interface ShareGameRecorderVideoOptions {
- title?: string;
- desc?: string;
- path?: string;
- query?: string;
- timeRange?: number[][];
- bgm?: string;
- volume?: number;
- atempo?: number;
- audioMix?: boolean;
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface CreateGameRecorderShareButtonOptions {
- icon?: string;
- image?: string;
- text?: string;
- style?: {
- top?: number;
- left?: number;
- height?: number;
- paddingLeft?: number;
- paddingRight?: number;
- color?: string;
- fontSize?: number;
- iconMarginRight?: number;
- };
- share?: {
- path?: string;
- query?: string;
- timeRange?: number[][];
- bgm?: string;
- volume?: number;
- atempo?: number;
- audioMix?: boolean;
- }
- }
- interface GameRecorderShareButton {
- show: () => void;
- hide: () => void;
- destroy: () => void;
- onTap: (listener: Callback) => void;
- offTap: (listener: Callback) => void;
- }
- interface SetShareOptions {
- title?: string;
- imageUrl?: string;
- imageUrlId?: string;
- imagePreviewUrl?: string;
- imagePreviewUrlId?: string;
- path?: string;
- query?: Record<string, unknown>;
- }
- interface ShareOptions {
- title?: string;
- imageUrl?: string;
- imageUrlId?: string;
- path?: string;
- query?: Record<string, unknown>;
- }
- interface ShowShareImageMenuOptions {
- path: string;
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface SubscribeMessageOptions {
- tmplIds: string[];
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface SubscribeSystemMessageOptions {
- msgTypeList: string[];
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface OpenSettingOptions {
- withSubscriptions?: boolean;
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface GetSettingOptions {
- withSubscriptions?: boolean;
- success?: SuccessCallback;
- fail?: FailCallback;
- complete?: CompleteCallback;
- }
- interface TrackEventEventParams {
- [key: string]: any;
- }
- interface ModalConfirmOptions {
- title: string;
- content: string;
- cancelText?: string;
- confirmText?: string;
- success?: Callback;
- fail?: Callback;
- complete?: Callback;
- }
- interface AnalyticsRoleOptions {
- areaId?: string | number;
- roleId?: string | number;
- roleName?: string;
- roleGender?: number;
- soles?: number;
- }
- interface AnalyticsPayOptions {
- areaId?: string | number;
- roleId?: string | number;
- roleLevel?: number;
- roleVipLevel?: number;
- channel?: number;
- orderId: string;
- orderPrice: number;
- itemId: string;
- payType?: string;
- currency?: string;
- }
- interface AnalyticsAdOptions {
- adUnitId?: string;
- adType?: number;
- adPlatform?: string;
- adPosition?: string;
- adEventName: "ad_play" | "ad_inclick" | "ad_close" | "ad_error";
- adEventResult?: 0 | 1 | 2;
- adEventMessage?: string;
- adPlayDuration?: number;
- }
- interface AnalyticsShareOptions {
- shareType: 1 | 2 | 3;
- }
- interface AnalyticsEventOptions {
- areaId?: string | number;
- roleId?: string | number;
- eventName: string;
- eventObj?: string;
- eventResult?: string;
- eventCode?: string;
- statMode?: 1 | 2;
- extendParamJson?: string;
- }
- interface AnalyticsLogOptions {
- eventId: string;
- subEventId?: string;
- logLevel?: "d" | "e";
- logContent: string;
- accountId?: string | number;
- }
- export default class DHMiniSDK {
- constructor(options: Options);
- readonly version: string;
- readonly requests: Requests;
- readonly env: "develop" | "trial" | "release";
- readonly isShow: boolean;
- readonly system: any;
- readonly networkType: string;
- readonly deviceId: string;
- readonly deviceOS: string;
- readonly launchOptions: any;
- readonly gameAppId: string | number;
- readonly appId: string | number;
- readonly appVersion: string;
- readonly packageName: string;
- readonly channel: string | number;
- readonly mainChannel: string | number;
- readonly secondChannel: string | number;
- readonly userInfo: UserInfo | null;
- readonly userRoleInfo: UserRoleInfo | null;
- readonly heartbeatEnable: boolean;
- readonly reyunAppKey?: string;
- readonly gravityEngineAccessToken?: string;
- readonly gravityEngineDebug?: boolean;
- readonly gravityEnginePayEventEnable?: boolean;
- readonly tencentUserActionId: number;
- readonly tencentSecretKey: string;
- readonly tencentDebug?: boolean;
- readonly login: (options: LoginOptions) => void;
- readonly uploadRoleInfo: (options: UploadRoleInfoOptions, callback?: Callback) => void;
- readonly createUserInfoButton: (options: CreateUserInfoButtonOptions) => UserInfoButton;
- readonly getUserInfo: (options: GetUserInfoOptions) => void;
- readonly pay: (options: PayOptions, settings?: PaySettings) => void;
- readonly createRewardedVideoAd: (options: CreateRewardedVideoAdOptions) => RewardedVideoAd;
- readonly openSurvey: (options: OpenSurveyOptions) => void;
- readonly openCustomerService: (options: OpenCustomerServiceOptions) => void;
- readonly createFeedbackButton: (options: CreateFeedbackButtonOptions) => FeedbackButton;
- readonly openChannelsUserProfile: (options: OpenChannelsUserProfileOptions) => void;
- readonly openChannelsEvent: (options: OpenChannelsEventOptions) => void;
- readonly openChannelsActivity: (options: OpenChannelsActivityOptions) => void;
- readonly openChannelsLive: (options: OpenChannelsLiveOptions) => void;
- readonly reserveChannelsLive: (options: ReserveChannelsLiveOptions) => void;
- readonly getChannelsLiveNoticeInfo: (options: GetChannelsLiveNoticeInfoOptions) => void;
- readonly getChannelsLiveInfo: (options: GetChannelsLiveInfoOptions) => void;
- readonly createGameClubButton: (options: CreateGameClubButtonOptions) => GameClubButton;
- readonly shareImageToGameClub: (options: ShareImageToGameClubOptions) => void;
- readonly shareCanvasToGameClub: (options: ShareCanvasToGameClubOptions) => void;
- readonly getGameClubData: (options: GetGameClubDataOptions) => void;
- readonly getGameRecorder: () => GameRecorder;
- readonly shareGameRecorderVideo: (options: ShareGameRecorderVideoOptions) => void;
- readonly createGameRecorderShareButton: (options: CreateGameRecorderShareButtonOptions) => GameRecorderShareButton;
- readonly setShare: (options: SetShareOptions) => void;
- readonly share: (options: ShareOptions) => void;
- readonly showShareImageMenu: (options: ShowShareImageMenuOptions) => void;
- readonly subscribeMessage: (options: SubscribeMessageOptions) => void;
- readonly subscribeSystemMessage: (options: SubscribeSystemMessageOptions) => void;
- readonly openSetting: (options: OpenSettingOptions) => void;
- readonly getSetting: (options: GetSettingOptions) => void;
- readonly getAccountId: () => string | number | void;
- readonly getOpenId: () => string | number | void;
- readonly isRegister: () => boolean;
- readonly showUpgradeMessage: (message?: string) => void;
- readonly modal: {
- loading: (message: string) => void;
- message: (message: string) => void;
- success: (message: string) => void;
- error: (message: string) => void;
- confirm: (options: ModalConfirmOptions) => void;
- };
- readonly trackEvent: (eventId: string, eventParams: TrackEventEventParams, callback?: Callback) => void;
- readonly analytics: {
- loaded: (callback?: Callback) => void;
- register: (callback?: Callback) => void;
- logged: (callback?: Callback) => void;
- role: (options: AnalyticsRoleOptions, callback?: Callback) => void;
- pay: (options: AnalyticsPayOptions, callback?: Callback) => void;
- ad: (options: AnalyticsAdOptions, callback?: Callback) => void;
- share: (options: AnalyticsShareOptions, callback?: Callback) => void;
- event: (options: AnalyticsEventOptions, callback?: Callback) => void;
- log: (options: AnalyticsLogOptions, callback?: Callback) => void;
- };
- }
- }
|