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

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,7 @@ export interface getCurrentPagesOptions {
22
22
  }[]) => void;
23
23
  fail: (err: any) => void;
24
24
  }
25
- export interface MPApi extends MiniprogramApi {
25
+ export interface MPApi extends Omit<MiniprogramApi, 'request'> {
26
26
  authorize: (opt: any) => void;
27
27
  getAuthUserInfo: (opt: any) => void;
28
28
  crossPay(args?: TradePayArgs): void;
@@ -70,26 +70,159 @@ export interface MPApi extends MiniprogramApi {
70
70
  }>): void;
71
71
  getCurrentPages(args: getCurrentPagesOptions): void;
72
72
  getSDKVersion(args: AsyncCallback<string>): void;
73
+ request: (args: {
74
+ url: string;
75
+ headers?: {
76
+ [key: string]: string;
77
+ } | undefined;
78
+ method?: 'GET' | 'POST' | undefined;
79
+ data?: any;
80
+ timeout?: number | undefined;
81
+ dataType?: 'json' | 'text' | 'base64' | 'arraybuffer' | undefined;
82
+ } & AsyncCallback<{
83
+ data: any;
84
+ status: number;
85
+ headers: any;
86
+ }>) => void;
73
87
  createWithoutAuthRpc: (args: {
74
88
  appId?: string;
75
89
  workspaceId?: string;
76
90
  defaultGateway: string;
77
91
  defaultHeaders?: Record<string, string>;
78
- request: (args: RequestArgs) => void;
92
+ request: PickMPAttr<'request'>;
79
93
  }) => PickMPAttr<'rpc'>;
80
94
  rpcWithAuth: PickMPAttr<'rpc'>;
81
95
  rpcWithAuthAPlus: PickMPAttr<'rpc'>;
82
- defineRuntimeConfig: {
83
- (args: Record<string, any>): void;
84
- getRuntimeConfig?: () => Record<string, any>;
85
- };
96
+ defineRuntimeConfig: (args: Record<string, any>) => Record<string, any>;
86
97
  getAuthCode: (args: {
87
98
  scopes: string | string[];
88
99
  appId?: string;
89
100
  } & AsyncCallback<GetAuthCodeCallbackValue>) => void;
101
+ easyShare: (args: {
102
+ bizType: string;
103
+ title: string;
104
+ desc: string;
105
+ searchTips?: string;
106
+ iconUrl?: string;
107
+ icon?: string;
108
+ imageUrl?: string;
109
+ image?: string;
110
+ url: string;
111
+ }) => void;
112
+ homeAddAppToMyApps: (args: {
113
+ appId: string;
114
+ }) => void;
115
+ homeCanAddAppToMyApps: (args: {
116
+ appId: string;
117
+ } & AsyncCallback<{
118
+ canAddAppToMyApps: boolean;
119
+ }>) => void;
120
+ removeNotifyListener: (args: {
121
+ name: string;
122
+ }) => void;
123
+ addNotifyListener: (args: {
124
+ name: string;
125
+ keep?: boolean;
126
+ callback: (res: any) => void;
127
+ } & AsyncCallback<void>) => void;
128
+ postNotification: (args: {
129
+ name: string;
130
+ data: object;
131
+ }) => void;
132
+ openWebURL: (args: {
133
+ url: string;
134
+ path?: string;
135
+ } & AsyncCallback<void>) => void;
136
+ openInApp: (args: {
137
+ url: string;
138
+ path?: string;
139
+ } & AsyncCallback<void>) => void;
140
+ openOtherApp: (args: {
141
+ appId: string;
142
+ path?: string;
143
+ launchParams?: Record<string, any>;
144
+ } & AsyncCallback<void>) => void;
145
+ openInBrowser: (args: {
146
+ url: string;
147
+ path?: string;
148
+ } & AsyncCallback<void>) => void;
149
+ openPayCodePage: () => void;
150
+ openApPayCodePage: () => void;
151
+ openScanPage: () => void;
152
+ getMainSelectedCity: (args: AsyncCallback<{
153
+ fullName: string;
154
+ enName: string;
155
+ name: string;
156
+ code: string;
157
+ chineseMainLand: boolean;
158
+ isManualSelected: boolean;
159
+ settingTime: number;
160
+ }>) => void;
161
+ chooseDistrict: (args: {
162
+ mode?: 0 | 1 | 2;
163
+ src?: string;
164
+ mainTitle?: string;
165
+ mainHeadList?: Array<HeadModel>;
166
+ mainNormalList?: Array<ItemModel>;
167
+ mainMergeOptions?: Record<string, string>;
168
+ seniorTitle?: string;
169
+ seniorPageList?: Array<{
170
+ title: string;
171
+ headList?: Array<HeadModel>;
172
+ normalList?: Array<ItemModel>;
173
+ }>;
174
+ } & AsyncCallback<{
175
+ name: string;
176
+ adCode: string;
177
+ ext: string;
178
+ }>) => void;
179
+ popWindow: () => void;
90
180
  }
181
+ export declare type HeadModel = {
182
+ /**
183
+ * 区块名,如“热门城市”。
184
+ */
185
+ title?: string;
186
+ /**
187
+ * 模块类型。
188
+ * 0: 常规城市。
189
+ * 1: 定位模块。
190
+ * 2: 展示支付宝提供的热门城市模块。
191
+ */
192
+ type?: 0 | 1 | 2;
193
+ /**
194
+ * 区块城市列表。不支持嵌套。
195
+ */
196
+ list?: Array<ItemModel>;
197
+ };
198
+ export declare type ItemModel = {
199
+ /**
200
+ * 城市名。
201
+ */
202
+ name: string;
203
+ /**
204
+ * 行政区划代码。不同行政区域对应的代码可查看 https://www.mca.gov.cn/mzsj/xzqh/1980/2019/202002281436.html
205
+ */
206
+ adCode: string;
207
+ /**
208
+ * 城市名对应拼音拼写,方便用户检索。
209
+ */
210
+ spell?: string;
211
+ /**
212
+ * 子标题。
213
+ */
214
+ appendName?: string;
215
+ /**
216
+ * 额外信息。
217
+ */
218
+ ext?: string;
219
+ /**
220
+ * 支持级联,自定义次级城市列表。
221
+ */
222
+ subList?: Array<ItemModel>;
223
+ };
91
224
  export declare type PickMPAttr<Attr extends keyof MPApi> = PickAttr<Attr, MPApi>;
92
225
  export declare type PickMPArgs<Attr extends keyof MPApi> = Parameters<PickMPAttr<Attr>>[0];
93
226
  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;
227
+ export declare type ReturnTypePromise<T> = T extends AsyncCallback<infer S> ? (args?: Omit<T, 'success' | 'fail' | 'complete'> | undefined) => Promise<S> : never;
95
228
  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.2",
4
4
  "main": "lib/index.js",
5
5
  "files": [
6
6
  "lib",