@hylid/types
Advanced tools
Comparing version 3.3.0-alpha.19 to 4.0.0-alpha.0
@@ -16,1 +16,13 @@ export declare type PickAttr<Attr extends keyof T, T = any> = { | ||
export declare type JsApiType = 'async' | 'sync' | 'callback' | 'attribute'; | ||
export interface GetGeneralAppInfo { | ||
(): { | ||
walletLogo: string; | ||
walletName: string; | ||
appIcon?: string; | ||
iosDownloadLink: string; | ||
androidDownloadLink: string; | ||
iOSAppId: string; | ||
androidAppId: string; | ||
pspId: string; | ||
}; | ||
} |
import { AppLinkParams } from './appLink'; | ||
export interface HyCustomJSAPI { | ||
getCallAppLink(params: AppLinkParams): string; | ||
getAppScanLink(params: AppLinkParams): string; | ||
} |
146
lib/mp.d.ts
@@ -25,3 +25,3 @@ /// <reference types="miniprogram" /> | ||
} | ||
export interface MPApi extends MiniprogramApi { | ||
export interface MPApi extends Omit<MiniprogramApi, 'request'> { | ||
authorize: (opt: any) => void; | ||
@@ -74,2 +74,16 @@ getAuthUserInfo: (opt: any) => void; | ||
getSDKVersion(args: AsyncCallback<string>): void; | ||
request: (args: { | ||
url: string; | ||
headers?: { | ||
[key: string]: string; | ||
} | undefined; | ||
method?: 'GET' | 'POST' | undefined; | ||
data?: any; | ||
timeout?: number | undefined; | ||
dataType?: 'json' | 'text' | 'base64' | 'arraybuffer' | undefined; | ||
} & AsyncCallback<{ | ||
data: any; | ||
status: number; | ||
headers: any; | ||
}>) => void; | ||
createWithoutAuthRpc: (args: { | ||
@@ -80,10 +94,7 @@ appId?: string; | ||
defaultHeaders?: Record<string, string>; | ||
request: (args: RequestArgs) => void; | ||
request: PickMPAttr<'request'>; | ||
}) => PickMPAttr<'rpc'>; | ||
rpcWithAuth: PickMPAttr<'rpc'>; | ||
rpcWithAuthAPlus: PickMPAttr<'rpc'>; | ||
defineRuntimeConfig: { | ||
(args: Record<string, any>): void; | ||
getRuntimeConfig?: () => Record<string, any>; | ||
}; | ||
defineRuntimeConfig: (args: Record<string, any>) => Record<string, any>; | ||
getAuthCode: (args: { | ||
@@ -93,7 +104,128 @@ scopes: string | string[]; | ||
} & AsyncCallback<GetAuthCodeCallbackValue>) => void; | ||
easyShare: (args: { | ||
bizType: string; | ||
title: string; | ||
desc: string; | ||
searchTips?: string; | ||
iconUrl?: string; | ||
icon?: string; | ||
imageUrl?: string; | ||
image?: string; | ||
url: string; | ||
}) => void; | ||
homeAddAppToMyApps: (args: { | ||
appId: string; | ||
}) => void; | ||
homeCanAddAppToMyApps: (args: { | ||
appId: string; | ||
} & AsyncCallback<{ | ||
canAddAppToMyApps: boolean; | ||
}>) => void; | ||
removeNotifyListener: (args: { | ||
name: string; | ||
}) => void; | ||
addNotifyListener: (args: { | ||
name: string; | ||
keep?: boolean; | ||
callback: (res: any) => void; | ||
} & AsyncCallback<void>) => void; | ||
postNotification: (args: { | ||
name: string; | ||
data: object; | ||
}) => void; | ||
openWebURL: (args: { | ||
url: string; | ||
path?: string; | ||
} & AsyncCallback<void>) => void; | ||
openInApp: (args: { | ||
url: string; | ||
path?: string; | ||
} & AsyncCallback<void>) => void; | ||
openOtherApp: (args: { | ||
appId: string; | ||
path?: string; | ||
launchParams?: Record<string, any>; | ||
} & AsyncCallback<void>) => void; | ||
openInBrowser: (args: { | ||
url: string; | ||
path?: string; | ||
} & AsyncCallback<void>) => void; | ||
openPayCodePage: () => void; | ||
openApPayCodePage: () => void; | ||
openScanPage: () => void; | ||
getMainSelectedCity: (args: AsyncCallback<{ | ||
fullName: string; | ||
enName: string; | ||
name: string; | ||
code: string; | ||
chineseMainLand: boolean; | ||
isManualSelected: boolean; | ||
settingTime: number; | ||
}>) => void; | ||
chooseDistrict: (args: { | ||
mode?: 0 | 1 | 2; | ||
src?: string; | ||
mainTitle?: string; | ||
mainHeadList?: Array<HeadModel>; | ||
mainNormalList?: Array<ItemModel>; | ||
mainMergeOptions?: Record<string, string>; | ||
seniorTitle?: string; | ||
seniorPageList?: Array<{ | ||
title: string; | ||
headList?: Array<HeadModel>; | ||
normalList?: Array<ItemModel>; | ||
}>; | ||
} & AsyncCallback<{ | ||
name: string; | ||
adCode: string; | ||
ext: string; | ||
}>) => void; | ||
} | ||
export declare type HeadModel = { | ||
/** | ||
* 区块名,如“热门城市”。 | ||
*/ | ||
title?: string; | ||
/** | ||
* 模块类型。 | ||
* 0: 常规城市。 | ||
* 1: 定位模块。 | ||
* 2: 展示支付宝提供的热门城市模块。 | ||
*/ | ||
type?: 0 | 1 | 2; | ||
/** | ||
* 区块城市列表。不支持嵌套。 | ||
*/ | ||
list?: Array<ItemModel>; | ||
}; | ||
export declare type ItemModel = { | ||
/** | ||
* 城市名。 | ||
*/ | ||
name: string; | ||
/** | ||
* 行政区划代码。不同行政区域对应的代码可查看 https://www.mca.gov.cn/mzsj/xzqh/1980/2019/202002281436.html | ||
*/ | ||
adCode: string; | ||
/** | ||
* 城市名对应拼音拼写,方便用户检索。 | ||
*/ | ||
spell?: string; | ||
/** | ||
* 子标题。 | ||
*/ | ||
appendName?: string; | ||
/** | ||
* 额外信息。 | ||
*/ | ||
ext?: string; | ||
/** | ||
* 支持级联,自定义次级城市列表。 | ||
*/ | ||
subList?: Array<ItemModel>; | ||
}; | ||
export declare type PickMPAttr<Attr extends keyof MPApi> = PickAttr<Attr, MPApi>; | ||
export declare type PickMPArgs<Attr extends keyof MPApi> = Parameters<PickMPAttr<Attr>>[0]; | ||
export declare type PickMpReturns<Attr extends keyof MPApi> = ReturnType<PickMPAttr<Attr>>; | ||
export declare type ReturnTypePromise<T> = T extends AsyncCallback<infer S> ? (args?: Omit<T, "success" | "fail" | "complete"> | undefined) => Promise<S> : never; | ||
export declare type ReturnTypePromise<T> = T extends AsyncCallback<infer S> ? (args?: Omit<T, 'success' | 'fail' | 'complete'> | undefined) => Promise<S> : never; | ||
export declare type PickPromiseAttr<T> = T extends (args: infer S) => void ? ReturnTypePromise<S> : never; |
{ | ||
"name": "@hylid/types", | ||
"version": "3.3.0-alpha.19", | ||
"version": "4.0.0-alpha.0", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
18657
555
0