@hylid/types 3.3.0-alpha.9 → 4.0.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/common.d.ts CHANGED
@@ -13,3 +13,15 @@ export declare type Callback<T> = (result?: T) => void;
13
13
  * @property {string} attribute 访问 my 对象上的属性(如: my.SDKVersion)套壳 H5 only
14
14
  */
15
15
  export declare type JsApiType = 'async' | 'sync' | 'callback' | 'attribute';
16
+ export interface GetGeneralAppInfo {
17
+ (): {
18
+ walletLogo: string;
19
+ walletName: string;
20
+ appIcon?: string;
21
+ iosDownloadLink: string;
22
+ androidDownloadLink: string;
23
+ iOSAppId: string;
24
+ androidAppId: string;
25
+ pspId: string;
26
+ };
27
+ }
@@ -1,4 +1,5 @@
1
1
  import { AppLinkParams } from './appLink';
2
2
  export interface HyCustomJSAPI {
3
3
  getCallAppLink(params: AppLinkParams): string;
4
+ getAppScanLink(params: AppLinkParams): string;
4
5
  }
package/lib/mp.d.ts CHANGED
@@ -22,7 +22,12 @@ export interface getCurrentPagesOptions {
22
22
  }[]) => void;
23
23
  fail: (err: any) => void;
24
24
  }
25
- export interface MPApi extends MiniprogramApi {
25
+ export interface AsyncCallback<T = any> {
26
+ success?: ((res: T) => void) | undefined;
27
+ fail?: ((err: AsyncCallbackFailObject) => void) | undefined;
28
+ complete?: ((res?: any) => any) | undefined;
29
+ }
30
+ export interface MPApi extends Omit<MiniprogramApi, 'request'> {
26
31
  authorize: (opt: any) => void;
27
32
  getAuthUserInfo: (opt: any) => void;
28
33
  crossPay(args?: TradePayArgs): void;
@@ -70,26 +75,182 @@ export interface MPApi extends MiniprogramApi {
70
75
  }>): void;
71
76
  getCurrentPages(args: getCurrentPagesOptions): void;
72
77
  getSDKVersion(args: AsyncCallback<string>): void;
78
+ request: (args: {
79
+ url: string;
80
+ headers?: {
81
+ [key: string]: string;
82
+ } | undefined;
83
+ method?: 'GET' | 'POST' | undefined;
84
+ data?: any;
85
+ timeout?: number | undefined;
86
+ dataType?: 'json' | 'text' | 'base64' | 'arraybuffer' | undefined;
87
+ } & AsyncCallback<{
88
+ data: any;
89
+ status: number;
90
+ headers: any;
91
+ }>) => void;
73
92
  createWithoutAuthRpc: (args: {
74
93
  appId?: string;
75
94
  workspaceId?: string;
76
95
  defaultGateway: string;
77
96
  defaultHeaders?: Record<string, string>;
78
- request: (args: RequestArgs) => void;
79
- }) => PickMPAttr<'rpc'>;
97
+ request: PickMPAttr<'request'>;
98
+ }) => PickPromiseAttr<PickMPAttr<'rpc'>>;
80
99
  rpcWithAuth: PickMPAttr<'rpc'>;
81
100
  rpcWithAuthAPlus: PickMPAttr<'rpc'>;
82
- defineRuntimeConfig: {
83
- (args: Record<string, any>): void;
84
- getRuntimeConfig?: () => Record<string, any>;
85
- };
101
+ defineRuntimeConfig: (args: Record<string, any>) => Record<string, any>;
86
102
  getAuthCode: (args: {
87
103
  scopes: string | string[];
88
104
  appId?: string;
89
105
  } & AsyncCallback<GetAuthCodeCallbackValue>) => void;
106
+ easyShare: (args: {
107
+ bizType: string;
108
+ title: string;
109
+ desc: string;
110
+ searchTips?: string;
111
+ iconUrl?: string;
112
+ icon?: string;
113
+ imageUrl?: string;
114
+ image?: string;
115
+ url: string;
116
+ } & AsyncCallback<{
117
+ succeed: boolean;
118
+ channelName: string;
119
+ }>) => void;
120
+ homeAddAppToMyApps: (args: {
121
+ appId: string;
122
+ }) => void;
123
+ homeCanAddAppToMyApps: (args: {
124
+ appId: string;
125
+ } & AsyncCallback<{
126
+ canAddAppToMyApps: boolean;
127
+ }>) => void;
128
+ removeNotifyListener: (args: {
129
+ name: string;
130
+ }) => void;
131
+ addNotifyListener: (args: {
132
+ name: string;
133
+ keep?: boolean;
134
+ callback?: (res: any) => void;
135
+ } & AsyncCallback<any>) => void;
136
+ postNotification: (args: {
137
+ name: string;
138
+ data: object;
139
+ }) => void;
140
+ openWebURL: (args: {
141
+ url: string;
142
+ path?: string;
143
+ } & AsyncCallback<void>) => void;
144
+ openInApp: (args: {
145
+ url: string;
146
+ path?: string;
147
+ } & AsyncCallback<void>) => void;
148
+ openOtherApp: (args: {
149
+ appId: string;
150
+ path?: string;
151
+ launchParams?: Record<string, any>;
152
+ } & AsyncCallback<void>) => void;
153
+ openInBrowser: (args: {
154
+ url: string;
155
+ path?: string;
156
+ } & AsyncCallback<void>) => void;
157
+ openPayCodePage: () => void;
158
+ openApPayCodePage: () => void;
159
+ openScanPage: () => void;
160
+ getMainSelectedCity: (args: AsyncCallback<{
161
+ fullName: string;
162
+ enName: string;
163
+ name: string;
164
+ code: string;
165
+ chineseMainLand: boolean;
166
+ isManualSelected: boolean;
167
+ settingTime: number;
168
+ }>) => void;
169
+ chooseDistrict: (args: {
170
+ mode?: 0 | 1 | 2;
171
+ src?: string;
172
+ mainTitle?: string;
173
+ mainHeadList?: Array<HeadModel>;
174
+ mainNormalList?: Array<ItemModel>;
175
+ mainMergeOptions?: Record<string, string>;
176
+ seniorTitle?: string;
177
+ seniorPageList?: Array<{
178
+ title: string;
179
+ headList?: Array<HeadModel>;
180
+ normalList?: Array<ItemModel>;
181
+ }>;
182
+ } & AsyncCallback<{
183
+ name: string;
184
+ adCode: string;
185
+ ext: string;
186
+ }>) => void;
187
+ popWindow: () => void;
188
+ setTransparentTitle: (args: AsyncCallback<{
189
+ transparentTitle: 'none' | 'auto' | 'always' | 'custom';
190
+ }>) => void;
191
+ getLocation: (args: {
192
+ bizType?: string;
193
+ requestType?: number;
194
+ timeout?: number;
195
+ horizontalAccuracy?: number;
196
+ } & GetLocationArgs) => void;
197
+ showAuthGuide: (args: AsyncCallback<{
198
+ /**
199
+ * When shown is true, it indicates the permission guide
200
+ * pop-up will be shown; when it is false, it indicates
201
+ * the user has allowed the permission.
202
+ */
203
+ shown: boolean;
204
+ }> & {
205
+ authType: string;
206
+ bizType?: string;
207
+ }) => void;
90
208
  }
209
+ export declare type HeadModel = {
210
+ /**
211
+ * 区块名,如“热门城市”。
212
+ */
213
+ title?: string;
214
+ /**
215
+ * 模块类型。
216
+ * 0: 常规城市。
217
+ * 1: 定位模块。
218
+ * 2: 展示支付宝提供的热门城市模块。
219
+ */
220
+ type?: 0 | 1 | 2;
221
+ /**
222
+ * 区块城市列表。不支持嵌套。
223
+ */
224
+ list?: Array<ItemModel>;
225
+ };
226
+ export declare type ItemModel = {
227
+ /**
228
+ * 城市名。
229
+ */
230
+ name: string;
231
+ /**
232
+ * 行政区划代码。不同行政区域对应的代码可查看 https://www.mca.gov.cn/mzsj/xzqh/1980/2019/202002281436.html
233
+ */
234
+ adCode: string;
235
+ /**
236
+ * 城市名对应拼音拼写,方便用户检索。
237
+ */
238
+ spell?: string;
239
+ /**
240
+ * 子标题。
241
+ */
242
+ appendName?: string;
243
+ /**
244
+ * 额外信息。
245
+ */
246
+ ext?: string;
247
+ /**
248
+ * 支持级联,自定义次级城市列表。
249
+ */
250
+ subList?: Array<ItemModel>;
251
+ };
91
252
  export declare type PickMPAttr<Attr extends keyof MPApi> = PickAttr<Attr, MPApi>;
92
253
  export declare type PickMPArgs<Attr extends keyof MPApi> = Parameters<PickMPAttr<Attr>>[0];
93
254
  export declare type PickMpReturns<Attr extends keyof MPApi> = ReturnType<PickMPAttr<Attr>>;
94
- export declare type ReturnTypePromise<T> = T extends AsyncCallback<infer S> ? (args?: Omit<T, "success" | "fail" | "complete"> | undefined) => Promise<S> : never;
255
+ export declare type ReturnTypePromise<T> = T extends AsyncCallback<infer S> ? (args?: T | undefined) => Promise<S> : never;
95
256
  export declare type PickPromiseAttr<T> = T extends (args: infer S) => void ? ReturnTypePromise<S> : never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hylid/types",
3
- "version": "3.3.0-alpha.9",
3
+ "version": "4.0.0-alpha.11",
4
4
  "main": "lib/index.js",
5
5
  "files": [
6
6
  "lib",