@tarojs/taro 3.7.0-alpha.2 → 3.7.0-alpha.22
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/package.json +16 -3
- package/types/api/ad/index.d.ts +6 -18
- package/types/api/ai/inference.d.ts +129 -0
- package/types/api/ai/visionkit.d.ts +625 -54
- package/types/api/alipay/index.d.ts +43 -0
- package/types/api/base/crypto.d.ts +18 -4
- package/types/api/base/index.d.ts +2 -2
- package/types/api/base/performance.d.ts +65 -2
- package/types/api/base/system.d.ts +65 -0
- package/types/api/base/weapp/app-event.d.ts +18 -18
- package/types/api/canvas/index.d.ts +67 -54
- package/types/api/device/calendar.d.ts +2 -2
- package/types/api/device/screen.d.ts +61 -0
- package/types/api/device/sms.d.ts +26 -0
- package/types/api/media/audio.d.ts +50 -30
- package/types/api/media/image.d.ts +40 -17
- package/types/api/media/live.d.ts +52 -0
- package/types/api/media/video.d.ts +64 -23
- package/types/api/media/voip.d.ts +103 -0
- package/types/api/network/download.d.ts +2 -10
- package/types/api/network/request.d.ts +84 -24
- package/types/api/network/upload.d.ts +2 -10
- package/types/api/open-api/address.d.ts +12 -10
- package/types/api/open-api/channels.d.ts +31 -0
- package/types/api/open-api/device-voip.d.ts +63 -0
- package/types/api/open-api/login.d.ts +1 -1
- package/types/api/open-api/my-miniprogram.d.ts +2 -2
- package/types/api/open-api/privacy.d.ts +99 -0
- package/types/api/route/index.d.ts +3 -0
- package/types/api/share/index.d.ts +1 -1
- package/types/api/skyline/index.d.ts +59 -0
- package/types/api/storage/cache-manager.d.ts +198 -0
- package/types/api/taro.extend.d.ts +223 -0
- package/types/{taro.hooks.d.ts → api/taro.hooks.d.ts} +4 -4
- package/types/api/ui/navigation-bar.d.ts +1 -1
- package/types/compile/compiler.d.ts +8 -6
- package/types/compile/config/h5.d.ts +79 -11
- package/types/compile/config/mini.d.ts +83 -12
- package/types/compile/config/project.d.ts +242 -20
- package/types/compile/config/rn.d.ts +64 -0
- package/types/compile/config/util.d.ts +83 -11
- package/types/compile/hooks.d.ts +1 -1
- package/types/compile/viteCompilerContext.d.ts +128 -0
- package/types/global.d.ts +9 -8
- package/types/index.d.ts +9 -7
- package/types/taro.api.d.ts +11 -1
- package/types/taro.component.d.ts +3 -2
- package/types/taro.config.d.ts +122 -2
- package/types/taro.extend.d.ts +0 -112
|
@@ -57,14 +57,6 @@ declare module '../../index' {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
namespace DownloadTask {
|
|
60
|
-
/** HTTP Response Header 事件的回调函数 */
|
|
61
|
-
type OffHeadersReceivedCallback = (
|
|
62
|
-
res: TaroGeneral.CallbackResult,
|
|
63
|
-
) => void
|
|
64
|
-
/** 下载进度变化事件的回调函数 */
|
|
65
|
-
type OffProgressUpdateCallback = (
|
|
66
|
-
res: TaroGeneral.CallbackResult,
|
|
67
|
-
) => void
|
|
68
60
|
/** HTTP Response Header 事件的回调函数 */
|
|
69
61
|
type OnHeadersReceivedCallback = (
|
|
70
62
|
result: OnHeadersReceivedCallbackResult,
|
|
@@ -135,7 +127,7 @@ declare module '../../index' {
|
|
|
135
127
|
*/
|
|
136
128
|
offProgressUpdate(
|
|
137
129
|
/** 下载进度变化事件的回调函数 */
|
|
138
|
-
callback: DownloadTask.
|
|
130
|
+
callback: DownloadTask.OnProgressUpdateCallback,
|
|
139
131
|
): void
|
|
140
132
|
/** 监听 HTTP Response Header 事件。会比请求完成事件更早
|
|
141
133
|
* @supported weapp, h5
|
|
@@ -151,7 +143,7 @@ declare module '../../index' {
|
|
|
151
143
|
*/
|
|
152
144
|
offHeadersReceived(
|
|
153
145
|
/** HTTP Response Header 事件的回调函数 */
|
|
154
|
-
callback: DownloadTask.
|
|
146
|
+
callback: DownloadTask.OnHeadersReceivedCallback,
|
|
155
147
|
): void
|
|
156
148
|
}
|
|
157
149
|
|
|
@@ -2,7 +2,7 @@ import Taro from '../../index'
|
|
|
2
2
|
|
|
3
3
|
declare module '../../index' {
|
|
4
4
|
namespace request {
|
|
5
|
-
interface Option
|
|
5
|
+
interface Option<T = any, U extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any> {
|
|
6
6
|
/** 开发者服务器接口地址 */
|
|
7
7
|
url: string
|
|
8
8
|
/** 请求的参数 */
|
|
@@ -14,11 +14,11 @@ declare module '../../index' {
|
|
|
14
14
|
header?: TaroGeneral.IAnyObject
|
|
15
15
|
/** 超时时间,单位为毫秒
|
|
16
16
|
* @default 2000
|
|
17
|
-
* @supported weapp, h5, tt
|
|
17
|
+
* @supported weapp, h5, tt, alipay
|
|
18
18
|
*/
|
|
19
19
|
timeout?: number
|
|
20
20
|
/** HTTP 请求方法
|
|
21
|
-
* @default GET
|
|
21
|
+
* @default "GET"
|
|
22
22
|
*/
|
|
23
23
|
method?: keyof Method
|
|
24
24
|
/** 返回的数据格式 */
|
|
@@ -54,70 +54,99 @@ declare module '../../index' {
|
|
|
54
54
|
* @supported weapp
|
|
55
55
|
*/
|
|
56
56
|
enableChunked?: boolean
|
|
57
|
+
/**
|
|
58
|
+
* wifi下使用移动网络发送请求
|
|
59
|
+
* @default false
|
|
60
|
+
* @supported weapp
|
|
61
|
+
*/
|
|
62
|
+
forceCellularNetwork?: boolean
|
|
63
|
+
/**
|
|
64
|
+
* headers 中设置 cookie 字段是否生效。如果为 false,则 headers 中的 cookie 字段将被忽略,请求头中将包含服务端上一次返回的 cookie(如果有)。
|
|
65
|
+
* @default false
|
|
66
|
+
* @supported alipay 支付宝: 10.2.33+
|
|
67
|
+
*/
|
|
68
|
+
enableCookie?: boolean
|
|
69
|
+
/**
|
|
70
|
+
* referer 策略,用于控制当前请求 header 对象中 referer 字段格式。该参数默认值可通过 app.json 中的配置进行修改。
|
|
71
|
+
* @default "querystring"
|
|
72
|
+
* @supported alipay 支付宝: 10.3.50+ APPX: 2.8.7 开发者工具: 3.5.1
|
|
73
|
+
* @see https://opendocs.alipay.com/mini/api/owycmh#referrerStrategy%20%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E
|
|
74
|
+
*/
|
|
75
|
+
referrerStrategy?: keyof ReferrerStrategy
|
|
57
76
|
/** 接口调用成功的回调函数 */
|
|
58
77
|
success?: (result: SuccessCallbackResult<T>) => void
|
|
59
78
|
/** 接口调用失败的回调函数 */
|
|
60
79
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
61
80
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
62
81
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
63
|
-
/**
|
|
82
|
+
/** 设置是否使用 jsonp 方式获取数据
|
|
64
83
|
* @default false
|
|
65
84
|
* @supported h5
|
|
66
85
|
*/
|
|
67
|
-
jsonp?: boolean
|
|
68
|
-
/** 设置
|
|
69
|
-
* @default false
|
|
86
|
+
jsonp?: boolean | string
|
|
87
|
+
/** 设置 jsonp 请求 url 是否需要被缓存
|
|
70
88
|
* @supported h5
|
|
71
89
|
*/
|
|
72
|
-
jsonpCache?:
|
|
73
|
-
/**
|
|
90
|
+
jsonpCache?: RequestCache
|
|
91
|
+
/** 设置是否允许跨域请求
|
|
74
92
|
* @default "same-origin"
|
|
75
93
|
* @supported h5
|
|
76
94
|
*/
|
|
77
95
|
mode?: keyof CorsMode
|
|
78
|
-
/**
|
|
96
|
+
/** 设置是否携带 Cookie
|
|
79
97
|
* @default "omit"
|
|
80
98
|
* @supported h5
|
|
81
99
|
*/
|
|
82
100
|
credentials?: keyof Credentials
|
|
83
|
-
/**
|
|
101
|
+
/** 设置缓存模式
|
|
84
102
|
* @default "default"
|
|
85
103
|
* @supported h5
|
|
86
104
|
*/
|
|
87
105
|
cache?: keyof Cache
|
|
88
|
-
/**
|
|
106
|
+
/** 设置请求重试次数
|
|
89
107
|
* @default 2
|
|
90
108
|
* @supported h5
|
|
109
|
+
* @h5 仅在 jsonp 模式下生效
|
|
91
110
|
*/
|
|
92
111
|
retryTimes?: number
|
|
93
|
-
/**
|
|
112
|
+
/** 设置请求的兜底接口
|
|
94
113
|
* @supported h5
|
|
114
|
+
* @h5 仅在 jsonp 模式下生效
|
|
95
115
|
*/
|
|
96
116
|
backup?: string | string[]
|
|
97
|
-
/**
|
|
117
|
+
/** 设置请求中止信号
|
|
118
|
+
* @supported h5
|
|
119
|
+
*/
|
|
120
|
+
signal?: AbortSignal
|
|
121
|
+
/** 设置请求响应的数据校验函数,若返回 false,则请求兜底接口,若无兜底接口,则报请求失败
|
|
98
122
|
* @supported h5
|
|
123
|
+
* @h5 仅在 jsonp 模式下生效
|
|
99
124
|
*/
|
|
100
125
|
dataCheck?(): boolean
|
|
101
|
-
/**
|
|
126
|
+
/** 设置请求是否使用缓存
|
|
102
127
|
* @default false
|
|
103
128
|
* @supported h5
|
|
129
|
+
* @h5 仅在 jsonp 模式下生效
|
|
104
130
|
*/
|
|
105
131
|
useStore?: boolean
|
|
106
|
-
/**
|
|
132
|
+
/** 设置请求缓存校验的 key
|
|
107
133
|
* @supported h5
|
|
134
|
+
* @h5 仅在 jsonp 模式下生效
|
|
108
135
|
*/
|
|
109
136
|
storeCheckKey?: string
|
|
110
|
-
/**
|
|
137
|
+
/** 设置请求缓存签名
|
|
111
138
|
* @supported h5
|
|
139
|
+
* @h5 仅在 jsonp 模式下生效
|
|
112
140
|
*/
|
|
113
141
|
storeSign?: string
|
|
114
|
-
/**
|
|
142
|
+
/** 设置请求校验函数,一般不需要设置
|
|
115
143
|
* @supported h5
|
|
116
144
|
*/
|
|
117
145
|
storeCheck?(): boolean
|
|
118
146
|
}
|
|
119
147
|
|
|
120
|
-
interface SuccessCallbackResult
|
|
148
|
+
interface SuccessCallbackResult<T extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any>
|
|
149
|
+
extends TaroGeneral.CallbackResult {
|
|
121
150
|
/** 开发者服务器返回的数据 */
|
|
122
151
|
data: T
|
|
123
152
|
/** 开发者服务器返回的 HTTP Response Header */
|
|
@@ -132,10 +161,26 @@ declare module '../../index' {
|
|
|
132
161
|
|
|
133
162
|
/** 返回的数据格式 */
|
|
134
163
|
interface DataType {
|
|
135
|
-
/**
|
|
164
|
+
/**
|
|
165
|
+
* 返回的数据为 JSON,返回后会对返回的数据进行一次 JSON.parse
|
|
136
166
|
* 其他: 不对返回的内容进行 JSON.parse
|
|
137
167
|
*/
|
|
138
168
|
json
|
|
169
|
+
/**
|
|
170
|
+
* 返回的数据为文本字符串
|
|
171
|
+
* @supported alipay
|
|
172
|
+
*/
|
|
173
|
+
text
|
|
174
|
+
/**
|
|
175
|
+
* 返回的数据将转换为 base64 格式字符串
|
|
176
|
+
* @supported alipay
|
|
177
|
+
*/
|
|
178
|
+
base64
|
|
179
|
+
/**
|
|
180
|
+
* 返回的数据将保持 ArrayBuffer 数据
|
|
181
|
+
* @supported alipay 支付宝: 10.1.70+
|
|
182
|
+
*/
|
|
183
|
+
arraybuffer
|
|
139
184
|
}
|
|
140
185
|
|
|
141
186
|
/** HTTP 请求方法 */
|
|
@@ -199,6 +244,21 @@ declare module '../../index' {
|
|
|
199
244
|
/** 浏览器在其HTTP缓存中寻找匹配的请求 */
|
|
200
245
|
'only-if-cached'
|
|
201
246
|
}
|
|
247
|
+
/** referer 策略 */
|
|
248
|
+
interface ReferrerStrategy {
|
|
249
|
+
/**
|
|
250
|
+
* referer 值为 https://{appid}.hybrid.alipay-eco.com/{appid}/{version}/index.html
|
|
251
|
+
*/
|
|
252
|
+
index
|
|
253
|
+
/**
|
|
254
|
+
* 保留 page(pages/xxx/yyy),referer 值为 https://{appid}.hybrid.alipay-eco.com/{appid}/{version}/index.html#{page}
|
|
255
|
+
*/
|
|
256
|
+
page
|
|
257
|
+
/**
|
|
258
|
+
* 默认值。会将发起请求时所在页面的 URL 作为 referer 值,会保留 page(pages/xxx/yyy)和 querystring(x=1&y=2)并可能有框架添加的其他参数,referer 值为 https://{appid}.hybrid.alipay-eco.com/{appid}/{version}/index.html#{page}?{querysrtring}{框架其他参数}
|
|
259
|
+
*/
|
|
260
|
+
querystring
|
|
261
|
+
}
|
|
202
262
|
}
|
|
203
263
|
|
|
204
264
|
/** 网络请求任务对象
|
|
@@ -266,7 +326,7 @@ declare module '../../index' {
|
|
|
266
326
|
*/
|
|
267
327
|
onHeadersReceived(
|
|
268
328
|
/** HTTP Response Header 事件的回调函数 */
|
|
269
|
-
callback: RequestTask.onHeadersReceived.Callback
|
|
329
|
+
callback: RequestTask.onHeadersReceived.Callback
|
|
270
330
|
): void
|
|
271
331
|
/** 取消监听 HTTP Response Header 事件
|
|
272
332
|
* @supported weapp
|
|
@@ -274,7 +334,7 @@ declare module '../../index' {
|
|
|
274
334
|
*/
|
|
275
335
|
offHeadersReceived(
|
|
276
336
|
/** HTTP Response Header 事件的回调函数 */
|
|
277
|
-
callback: RequestTask.onHeadersReceived.Callback
|
|
337
|
+
callback: RequestTask.onHeadersReceived.Callback
|
|
278
338
|
): void
|
|
279
339
|
/** 监听 Transfer-Encoding Chunk Received 事件。当接收到新的chunk时触发。
|
|
280
340
|
* @supported weapp
|
|
@@ -282,7 +342,7 @@ declare module '../../index' {
|
|
|
282
342
|
*/
|
|
283
343
|
onChunkReceived(
|
|
284
344
|
/** Transfer-Encoding Chunk Received 事件的回调函数 */
|
|
285
|
-
callback: RequestTask.onChunkReceived.Callback
|
|
345
|
+
callback: RequestTask.onChunkReceived.Callback
|
|
286
346
|
): void
|
|
287
347
|
/** 移除 Transfer-Encoding Chunk Received 事件的监听函数
|
|
288
348
|
* @supported weapp
|
|
@@ -290,7 +350,7 @@ declare module '../../index' {
|
|
|
290
350
|
*/
|
|
291
351
|
offChunkReceived(
|
|
292
352
|
/** Transfer-Encoding Chunk Received 事件的回调函数 */
|
|
293
|
-
callback: RequestTask.onChunkReceived.Callback
|
|
353
|
+
callback: RequestTask.onChunkReceived.Callback
|
|
294
354
|
): void
|
|
295
355
|
}
|
|
296
356
|
|
|
@@ -56,14 +56,6 @@ declare module '../../index' {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
namespace UploadTask {
|
|
59
|
-
/** HTTP Response Header 事件的回调函数 */
|
|
60
|
-
type OffHeadersReceivedCallback = (
|
|
61
|
-
res: TaroGeneral.CallbackResult,
|
|
62
|
-
) => void
|
|
63
|
-
/** 上传进度变化事件的回调函数 */
|
|
64
|
-
type OffProgressUpdateCallback = (
|
|
65
|
-
res: TaroGeneral.CallbackResult,
|
|
66
|
-
) => void
|
|
67
59
|
/** HTTP Response Header 事件的回调函数 */
|
|
68
60
|
type OnHeadersReceivedCallback = (
|
|
69
61
|
result: OnHeadersReceivedCallbackResult,
|
|
@@ -138,7 +130,7 @@ declare module '../../index' {
|
|
|
138
130
|
*/
|
|
139
131
|
offProgressUpdate(
|
|
140
132
|
/** 上传进度变化事件的回调函数 */
|
|
141
|
-
callback: UploadTask.
|
|
133
|
+
callback: UploadTask.OnProgressUpdateCallback,
|
|
142
134
|
): void
|
|
143
135
|
/** 监听 HTTP Response Header 事件。会比请求完成事件更早
|
|
144
136
|
* @supported weapp, h5
|
|
@@ -154,7 +146,7 @@ declare module '../../index' {
|
|
|
154
146
|
*/
|
|
155
147
|
offHeadersReceived(
|
|
156
148
|
/** HTTP Response Header 事件的回调函数 */
|
|
157
|
-
callback: UploadTask.
|
|
149
|
+
callback: UploadTask.OnHeadersReceivedCallback,
|
|
158
150
|
): void
|
|
159
151
|
}
|
|
160
152
|
|
|
@@ -4,32 +4,34 @@ declare module '../../index' {
|
|
|
4
4
|
namespace chooseAddress {
|
|
5
5
|
interface Option {
|
|
6
6
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
-
complete?: (res:
|
|
7
|
+
complete?: (res: SuccessCallbackResult) => void
|
|
8
8
|
/** 接口调用失败的回调函数 */
|
|
9
9
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
10
|
/** 接口调用成功的回调函数 */
|
|
11
11
|
success?: (result: SuccessCallbackResult) => void
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
interface SuccessCallbackResult {
|
|
14
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
15
|
+
/** 收货人姓名 */
|
|
16
|
+
userName: string
|
|
17
|
+
/** 邮编 */
|
|
18
|
+
postalCode: string
|
|
19
|
+
/** 国标收货地址第一级地址 */
|
|
20
|
+
provinceName: string
|
|
15
21
|
/** 国标收货地址第二级地址 */
|
|
16
22
|
cityName: string
|
|
17
23
|
/** 国标收货地址第三级地址 */
|
|
18
24
|
countyName: string
|
|
25
|
+
/** 国标收货地址第四级地址 */
|
|
26
|
+
streetName: string
|
|
19
27
|
/** 详细收货地址信息 */
|
|
20
28
|
detailInfo: string
|
|
21
|
-
/**
|
|
22
|
-
|
|
29
|
+
/** 新选择器详细收货地址信息 */
|
|
30
|
+
detailInfoNew: string
|
|
23
31
|
/** 收货地址国家码 */
|
|
24
32
|
nationalCode: string
|
|
25
|
-
/** 邮编 */
|
|
26
|
-
postalCode: string
|
|
27
|
-
/** 国标收货地址第一级地址 */
|
|
28
|
-
provinceName: string
|
|
29
33
|
/** 收货人手机号码 */
|
|
30
34
|
telNumber: string
|
|
31
|
-
/** 收货人姓名 */
|
|
32
|
-
userName: string
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -68,6 +68,31 @@ declare module '../../index' {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
namespace getChannelsShareKey {
|
|
72
|
+
interface Option {
|
|
73
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
74
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
75
|
+
/** 接口调用失败的回调函数 */
|
|
76
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
77
|
+
/** 接口调用成功的回调函数 */
|
|
78
|
+
success?: (result: SuccessCallbackResult) => void
|
|
79
|
+
}
|
|
80
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
81
|
+
/** 分享者 openid */
|
|
82
|
+
sharerOpenId: string
|
|
83
|
+
/** 推广员 */
|
|
84
|
+
promoter: Promoter
|
|
85
|
+
}
|
|
86
|
+
interface Promoter {
|
|
87
|
+
/** 推广员昵称 */
|
|
88
|
+
finderNickname: string
|
|
89
|
+
/** 推广员id */
|
|
90
|
+
promoterId: string
|
|
91
|
+
/** 推广员openid */
|
|
92
|
+
promoterOpenId: string
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
71
96
|
namespace getChannelsLiveNoticeInfo {
|
|
72
97
|
interface Option {
|
|
73
98
|
/** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
|
|
@@ -164,6 +189,12 @@ declare module '../../index' {
|
|
|
164
189
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsActivity.html
|
|
165
190
|
*/
|
|
166
191
|
openChannelsActivity(option?: openChannelsActivity.Option): Promise<TaroGeneral.CallbackResult>
|
|
192
|
+
/** 获取视频号直播卡片/视频卡片的分享来源,
|
|
193
|
+
* 仅当卡片携带了分享信息、同时用户已授权该小程序获取视频号分享信息且启动场景值为 1177、1184、1195、1208 时可用
|
|
194
|
+
* @supported weapp
|
|
195
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.getChannelsShareKey.html
|
|
196
|
+
*/
|
|
197
|
+
getChannelsShareKey(option?: getChannelsShareKey.Option): Promise<getChannelsShareKey.SuccessCallbackResult>
|
|
167
198
|
/** 获取视频号直播预告信息
|
|
168
199
|
* @supported weapp
|
|
169
200
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.getChannelsLiveNoticeInfo.html
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace requestDeviceVoIP {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 设备唯一序列号。由厂商分配,长度不能超过128字节。字符只接受数字,大小写字母,下划线(_)和连字符(-) */
|
|
7
|
+
sn: string
|
|
8
|
+
/** 设备票据,5分钟内有效 */
|
|
9
|
+
snTicket: string
|
|
10
|
+
/** 设备型号 id。通过微信公众平台注册设备获得。 */
|
|
11
|
+
modelId: string
|
|
12
|
+
/** 设备名称,将显示在授权弹窗内(长度不超过13)。授权框中「设备名字」= 「deviceName」 + 「modelId 对应设备型号」 */
|
|
13
|
+
deviceName: string
|
|
14
|
+
/** 是否为授权设备组,默认 false */
|
|
15
|
+
isGroup?: boolean
|
|
16
|
+
/** 设备组的唯一标识 id 。isGroup 为 true 时只需要传该参数,isGroup 为 false 时不需要传该参数,但需要传 sn、snTicket、modelId、deviceName 。 */
|
|
17
|
+
groupId: string
|
|
18
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
19
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
20
|
+
/** 接口调用失败的回调函数 */
|
|
21
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
22
|
+
/** 接口调用成功的回调函数 */
|
|
23
|
+
success?: (result: TaroGeneral.CallbackResult) => void
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
namespace getDeviceVoIPList {
|
|
28
|
+
interface Option {
|
|
29
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
30
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
31
|
+
/** 接口调用失败的回调函数 */
|
|
32
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
33
|
+
/** 接口调用成功的回调函数 */
|
|
34
|
+
success?: (result: SuccessCallbackResult) => void
|
|
35
|
+
}
|
|
36
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
37
|
+
list: DeviceVoIP[]
|
|
38
|
+
}
|
|
39
|
+
interface DeviceVoIP {
|
|
40
|
+
/** 设备唯一序列号。(仅单台设备时) */
|
|
41
|
+
sn: string
|
|
42
|
+
/** 设备型号 id。通过微信公众平台注册设备获得。(仅单台设备时) */
|
|
43
|
+
model_id: string
|
|
44
|
+
/** 设备组的唯一标识 id(仅设备组时) */
|
|
45
|
+
group_id: string
|
|
46
|
+
/** 设备(组)授权状态。0:未授权;1:已授权 */
|
|
47
|
+
status: number
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface TaroStatic {
|
|
52
|
+
/** 请求用户授权与设备(组)间进行音视频通话
|
|
53
|
+
* @supported weapp
|
|
54
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/device-voip/wx.requestDeviceVoIP.html
|
|
55
|
+
*/
|
|
56
|
+
requestDeviceVoIP(option: requestDeviceVoIP.Option): Promise<TaroGeneral.CallbackResult>
|
|
57
|
+
/** 查询当前用户授权的音视频通话设备(组)信息
|
|
58
|
+
* @supported weapp
|
|
59
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/device-voip/wx.getDeviceVoIPList.html
|
|
60
|
+
*/
|
|
61
|
+
getDeviceVoIPList(option: getDeviceVoIPList.Option): Promise<getDeviceVoIPList.SuccessCallbackResult>
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -81,7 +81,7 @@ declare module '../../index' {
|
|
|
81
81
|
*
|
|
82
82
|
* 通过 Taro.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用 Taro.checkSession 接口检测当前用户登录态是否有效。
|
|
83
83
|
*
|
|
84
|
-
* 登录态过期后开发者可以再调用 Taro.login
|
|
84
|
+
* 登录态过期后开发者可以再调用 Taro.login 获取新的用户登录态。调用 Taro.checkSession 成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
|
|
85
85
|
* @supported weapp
|
|
86
86
|
* @example
|
|
87
87
|
* ```tsx
|
|
@@ -8,7 +8,7 @@ declare module '../../index' {
|
|
|
8
8
|
/** 接口调用失败的回调函数 */
|
|
9
9
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
10
|
/** 接口调用成功的回调函数 */
|
|
11
|
-
success?: (res:
|
|
11
|
+
success?: (res: SuccessCallbackResult) => void
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
@@ -23,6 +23,6 @@ declare module '../../index' {
|
|
|
23
23
|
* @supported weapp
|
|
24
24
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/my-miniprogram/wx.checkIsAddedToMyMiniProgram.html
|
|
25
25
|
*/
|
|
26
|
-
checkIsAddedToMyMiniProgram(option?: checkIsAddedToMyMiniProgram.Option):
|
|
26
|
+
checkIsAddedToMyMiniProgram(option?: checkIsAddedToMyMiniProgram.Option): void
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace getPrivacySetting {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
|
+
/** 接口调用失败的回调函数 */
|
|
9
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 接口调用成功的回调函数 */
|
|
11
|
+
success?: (result: SuccessCallbackResult) => void
|
|
12
|
+
}
|
|
13
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
14
|
+
/** 是否需要用户授权隐私协议(如果开发者没有在[mp后台-设置-服务内容声明-用户隐私保护指引]中声明隐私收集类型则会返回false;如果开发者声明了隐私收集,且用户之前同意过隐私协议则会返回false;如果开发者声明了隐私收集,且用户还没同意过则返回true;如果用户之前同意过、但后来小程序又新增了隐私收集类型也会返回true) */
|
|
15
|
+
needAuthorization: boolean
|
|
16
|
+
/** 隐私授权协议的名称 */
|
|
17
|
+
privacyContractName: string
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
namespace requirePrivacyAuthorize {
|
|
22
|
+
interface Option {
|
|
23
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
24
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
25
|
+
/** 接口调用失败的回调函数 */
|
|
26
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
27
|
+
/** 接口调用成功的回调函数 */
|
|
28
|
+
success?: (result: TaroGeneral.CallbackResult) => void
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
namespace openPrivacyContract {
|
|
33
|
+
interface Option {
|
|
34
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
35
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
36
|
+
/** 接口调用失败的回调函数 */
|
|
37
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
38
|
+
/** 接口调用成功的回调函数 */
|
|
39
|
+
success?: (result: TaroGeneral.CallbackResult) => void
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
namespace onNeedPrivacyAuthorization {
|
|
44
|
+
/**
|
|
45
|
+
* resolve 是 onNeedPrivacyAuthorization 的回调参数,是一个接口函数。
|
|
46
|
+
* 当触发 needPrivacyAuthorization 事件时,触发该事件的隐私接口或组件会处于 pending 状态。
|
|
47
|
+
* 如果调用 resolve({ buttonId: 'disagree-btn', event:'agree' }),则触发当前 needPrivacyAuthorization 事件的原隐私接口或组件会继续执行。其中 buttonId 为隐私同意授权按钮的id,为确保用户有同意的操作,基础库会检查对应的同意按钮是否被点击过。
|
|
48
|
+
* 如果调用 resolve({ event: 'disagree' }),则触发当前 needPrivacyAuthorization 事件的原隐私接口或组件会失败并返回 API:fail privacy permission is not authorized 的错误信息。
|
|
49
|
+
* 在调用 resolve({ event: 'agree'/'disagree' }) 之前,开发者可以调用 resolve({ event: 'exposureAuthorization' }) 把隐私弹窗曝光告知平台。
|
|
50
|
+
*/
|
|
51
|
+
interface ResolveOption {
|
|
52
|
+
/** 用户操作类型 */
|
|
53
|
+
event: 'exposureAuthorization' | 'agree' | 'disagree'
|
|
54
|
+
/** 同意授权按钮的id (仅event=agree时必填) */
|
|
55
|
+
buttonId?: string
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 触发本次 onNeedPrivacyAuthorization 事件的关联信息
|
|
59
|
+
*/
|
|
60
|
+
interface EventInfo {
|
|
61
|
+
referrer: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** 隐私授权监听函数 */
|
|
65
|
+
type Listener = (
|
|
66
|
+
/** 事件回调函数 */
|
|
67
|
+
resolve: (option: ResolveOption) => void,
|
|
68
|
+
/** 关联事件信息 */
|
|
69
|
+
eventInfo: EventInfo
|
|
70
|
+
) => void
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface TaroStatic {
|
|
74
|
+
/**
|
|
75
|
+
* 查询隐私授权情况。隐私合规开发指南详情可见《小程序隐私协议开发指南》
|
|
76
|
+
* @supported weapp
|
|
77
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.getPrivacySetting.html
|
|
78
|
+
*/
|
|
79
|
+
getPrivacySetting(option?: getPrivacySetting.Option): void
|
|
80
|
+
/**
|
|
81
|
+
* 跳转至隐私协议页面。隐私合规开发指南详情可见《小程序隐私协议开发指南》
|
|
82
|
+
* @supported weapp
|
|
83
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.openPrivacyContract.html
|
|
84
|
+
*/
|
|
85
|
+
openPrivacyContract(option?: openPrivacyContract.Option): void
|
|
86
|
+
/**
|
|
87
|
+
* 模拟隐私接口调用,并触发隐私弹窗逻辑。隐私合规开发指南详情可见《小程序隐私协议开发指南》
|
|
88
|
+
* @supported weapp
|
|
89
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.requirePrivacyAuthorize.html
|
|
90
|
+
*/
|
|
91
|
+
requirePrivacyAuthorize(option?: requirePrivacyAuthorize.Option): void
|
|
92
|
+
/**
|
|
93
|
+
* 监听隐私接口需要用户授权事件。当需要用户进行隐私授权时会触发。触发该事件时,开发者需要弹出隐私协议说明,并在用户同意或拒绝授权后调用回调接口 resolve 触发原隐私接口或组件继续执行。隐私合规开发指南详情可见《小程序隐私协议开发指南》
|
|
94
|
+
* @supported weapp
|
|
95
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.onNeedPrivacyAuthorization.html
|
|
96
|
+
*/
|
|
97
|
+
onNeedPrivacyAuthorization(listener: onNeedPrivacyAuthorization.Listener): void
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -156,6 +156,7 @@ declare module '../../index' {
|
|
|
156
156
|
|
|
157
157
|
/** 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。
|
|
158
158
|
* @supported weapp, h5, rn, tt
|
|
159
|
+
* @h5 未针对 tabbar 页面做限制处理
|
|
159
160
|
* @example
|
|
160
161
|
* ```tsx
|
|
161
162
|
* Taro.redirectTo({
|
|
@@ -168,6 +169,7 @@ declare module '../../index' {
|
|
|
168
169
|
|
|
169
170
|
/** 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 Taro.navigateBack 可以返回到原页面。小程序中页面栈最多十层。
|
|
170
171
|
* @supported weapp, h5, rn, tt
|
|
172
|
+
* @h5 未针对 tabbar 页面做限制处理
|
|
171
173
|
* @example
|
|
172
174
|
* ```tsx
|
|
173
175
|
* Taro.navigateTo({
|
|
@@ -194,6 +196,7 @@ declare module '../../index' {
|
|
|
194
196
|
|
|
195
197
|
/** 关闭当前页面,返回上一页面或多级页面。可通过 getCurrentPages 获取当前的页面栈,决定需要返回几层。
|
|
196
198
|
* @supported weapp, h5, rn, tt
|
|
199
|
+
* @h5 若入参 delta 大于现有页面数时,返回应用打开的第一个页面(如果想要返回首页请使用 reLaunch 方法)。
|
|
197
200
|
* @example
|
|
198
201
|
* ```tsx
|
|
199
202
|
* // 注意:调用 navigateTo 跳转时,调用该方法的页面会被加入堆栈,而 redirectTo 方法则不会。见下方示例代码
|
|
@@ -200,7 +200,7 @@ declare module '../../index' {
|
|
|
200
200
|
* Taro.downloadFile({
|
|
201
201
|
* url: 'https://res.wx.qq.com/wxdoc/dist/assets/img/demo.ef5c5bef.jpg',
|
|
202
202
|
* success: (res) => {
|
|
203
|
-
*
|
|
203
|
+
* Taro.showShareImageMenu({
|
|
204
204
|
* path: res.tempFilePath
|
|
205
205
|
* })
|
|
206
206
|
* }
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
/**
|
|
5
|
+
* Snapshot 实例,可通过 SelectorQuery 获取。
|
|
6
|
+
*
|
|
7
|
+
* Snapshot 通过 id 跟一个 snapshot 组件绑定,操作对应的 snapshot 组件。
|
|
8
|
+
* @supported weapp
|
|
9
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/skyline/Snapshot.html
|
|
10
|
+
*/
|
|
11
|
+
interface Snapshot {
|
|
12
|
+
/**
|
|
13
|
+
* 画布宽度
|
|
14
|
+
*/
|
|
15
|
+
width: number
|
|
16
|
+
/**
|
|
17
|
+
* 画布高度
|
|
18
|
+
*/
|
|
19
|
+
height: number
|
|
20
|
+
/**
|
|
21
|
+
* 对 snapshot 组件子树进行截图
|
|
22
|
+
* @param option
|
|
23
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/skyline/Snapshot.takeSnapshot.html
|
|
24
|
+
*/
|
|
25
|
+
takeSnapshot(option: Snapshot.TakeSnapshot.Option): Promise<TaroGeneral.CallbackResult>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
namespace Snapshot {
|
|
29
|
+
namespace TakeSnapshot {
|
|
30
|
+
interface Option {
|
|
31
|
+
/**
|
|
32
|
+
* 截图导出类型,'file' 保存到临时文件目录或 'arraybuffer' 返回图片二进制数据,默认值为 'file'
|
|
33
|
+
*/
|
|
34
|
+
type: string
|
|
35
|
+
/**
|
|
36
|
+
* 截图文件格式,'rgba' 或 'png',默认值为 'png'
|
|
37
|
+
*/
|
|
38
|
+
format: string
|
|
39
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
40
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
41
|
+
/** 接口调用失败的回调函数 */
|
|
42
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
43
|
+
/** 接口调用成功的回调函数 */
|
|
44
|
+
success?: (res: SuccessCallbackResult) => void
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface SuccessCallbackResult {
|
|
48
|
+
/**
|
|
49
|
+
* 截图保存的临时文件路径,当 type 为 file 该字段生效
|
|
50
|
+
*/
|
|
51
|
+
tempFilePath: string
|
|
52
|
+
/**
|
|
53
|
+
* 截图对应的二进制数据,当 type 为 arraybuffer 该字段生效
|
|
54
|
+
*/
|
|
55
|
+
data: string
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|