@tarojs/taro 4.0.0-beta.1 → 4.0.0-beta.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.
Files changed (66) hide show
  1. package/package.json +10 -5
  2. package/types/api/base/debug.d.ts +8 -8
  3. package/types/api/base/env.d.ts +1 -1
  4. package/types/api/base/index.d.ts +3 -3
  5. package/types/api/base/system.d.ts +6 -6
  6. package/types/api/base/weapp/app-event.d.ts +10 -10
  7. package/types/api/base/weapp/life-cycle.d.ts +1 -1
  8. package/types/api/canvas/index.d.ts +367 -63
  9. package/types/api/device/battery.d.ts +1 -1
  10. package/types/api/device/clipboard.d.ts +2 -2
  11. package/types/api/device/keyboard.d.ts +1 -1
  12. package/types/api/device/network.d.ts +3 -3
  13. package/types/api/device/phone.d.ts +1 -1
  14. package/types/api/device/screen.d.ts +2 -2
  15. package/types/api/files/index.d.ts +7 -7
  16. package/types/api/framework/index.d.ts +2 -2
  17. package/types/api/location/index.d.ts +4 -4
  18. package/types/api/media/audio.d.ts +11 -11
  19. package/types/api/media/background-audio.d.ts +1 -1
  20. package/types/api/media/image.d.ts +5 -5
  21. package/types/api/media/video.d.ts +11 -11
  22. package/types/api/navigate/index.d.ts +1 -1
  23. package/types/api/network/download.d.ts +5 -5
  24. package/types/api/network/request.d.ts +5 -5
  25. package/types/api/network/upload.d.ts +7 -7
  26. package/types/api/network/websocket.d.ts +8 -8
  27. package/types/api/open-api/account.d.ts +1 -1
  28. package/types/api/open-api/address.d.ts +13 -5
  29. package/types/api/open-api/authorize.d.ts +1 -1
  30. package/types/api/open-api/bookshelf.d.ts +307 -0
  31. package/types/api/open-api/channels.d.ts +16 -0
  32. package/types/api/open-api/device-voip.d.ts +40 -0
  33. package/types/api/open-api/invoice.d.ts +1 -1
  34. package/types/api/open-api/login.d.ts +15 -2
  35. package/types/api/open-api/privacy.d.ts +8 -0
  36. package/types/api/open-api/settings.d.ts +3 -2
  37. package/types/api/open-api/sticker.d.ts +83 -0
  38. package/types/api/open-api/subscribe-message.d.ts +148 -6
  39. package/types/api/open-api/user-info.d.ts +6 -1
  40. package/types/api/qq/index.d.ts +306 -1
  41. package/types/api/route/index.d.ts +5 -5
  42. package/types/api/storage/index.d.ts +10 -10
  43. package/types/api/swan/download-package.d.ts +80 -0
  44. package/types/api/swan/index.d.ts +151 -0
  45. package/types/api/swan/pay.d.ts +139 -0
  46. package/types/api/taro.extend.d.ts +6 -3
  47. package/types/api/taro.hooks.d.ts +9 -9
  48. package/types/api/ui/animation.d.ts +32 -32
  49. package/types/api/ui/custom-component.d.ts +1 -1
  50. package/types/api/ui/fonts.d.ts +1 -1
  51. package/types/api/ui/interaction.d.ts +6 -6
  52. package/types/api/ui/menu.d.ts +1 -1
  53. package/types/api/ui/navigation-bar.d.ts +2 -2
  54. package/types/api/ui/pull-down-refresh.d.ts +2 -2
  55. package/types/api/ui/scroll.d.ts +1 -1
  56. package/types/api/ui/tab-bar.d.ts +8 -8
  57. package/types/api/ui/window.d.ts +2 -2
  58. package/types/api/wxml/index.d.ts +17 -17
  59. package/types/compile/compiler.d.ts +2 -0
  60. package/types/compile/config/harmony.d.ts +5 -0
  61. package/types/compile/config/mini.d.ts +1 -1
  62. package/types/compile/viteCompilerContext.d.ts +6 -0
  63. package/types/global.d.ts +2 -1
  64. package/types/index.d.ts +13 -4
  65. package/types/taro.api.d.ts +22 -14
  66. package/types/taro.config.d.ts +6 -2
@@ -35,7 +35,7 @@ declare module '../../index' {
35
35
 
36
36
  interface TaroStatic {
37
37
  /** 获取当前帐号信息
38
- * @supported weapp
38
+ * @supported weapp, alipay, qq
39
39
  * @example
40
40
  * ```tsx
41
41
  * const accountInfo = Taro.getAccountInfoSync();
@@ -14,7 +14,9 @@ declare module '../../index' {
14
14
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
15
15
  /** 收货人姓名 */
16
16
  userName: string
17
- /** 邮编 */
17
+ /** 邮编
18
+ * @supported weapp, qq
19
+ */
18
20
  postalCode: string
19
21
  /** 国标收货地址第一级地址 */
20
22
  provinceName: string
@@ -22,13 +24,19 @@ declare module '../../index' {
22
24
  cityName: string
23
25
  /** 国标收货地址第三级地址 */
24
26
  countyName: string
25
- /** 国标收货地址第四级地址 */
27
+ /** 国标收货地址第四级地址
28
+ * @supported weapp, qq
29
+ */
26
30
  streetName: string
27
31
  /** 详细收货地址信息 */
28
32
  detailInfo: string
29
- /** 新选择器详细收货地址信息 */
33
+ /** 新选择器详细收货地址信息
34
+ * @supported weapp, qq
35
+ */
30
36
  detailInfoNew: string
31
- /** 收货地址国家码 */
37
+ /** 收货地址国家码
38
+ * @supported weapp, qq
39
+ */
32
40
  nationalCode: string
33
41
  /** 收货人手机号码 */
34
42
  telNumber: string
@@ -37,7 +45,7 @@ declare module '../../index' {
37
45
 
38
46
  interface TaroStatic {
39
47
  /** 获取用户收货地址。调起用户编辑收货地址原生界面,并在编辑完成后返回用户选择的地址。
40
- * @supported weapp, tt
48
+ * @supported weapp, qq, tt, jd
41
49
  * @example
42
50
  * ```tsx
43
51
  * Taro.chooseAddress({
@@ -55,7 +55,7 @@ declare module '../../index' {
55
55
  authorizeForMiniProgram(option: authorizeForMiniProgram.Option): Promise<TaroGeneral.CallbackResult>
56
56
 
57
57
  /** 提前向用户发起授权请求。调用后会立刻弹窗询问用户是否同意授权小程序使用某项功能或获取用户的某些数据,但不会实际调用对应接口。如果用户之前已经同意授权,则不会出现弹窗,直接返回成功。更多用法详见 [用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)。
58
- * @supported weapp, rn, tt
58
+ * @supported weapp, swan, qq, tt, rn
59
59
  * @example
60
60
  * ```tsx
61
61
  * // 可以通过 Taro.getSetting 先查询一下用户是否授权了 "scope.record" 这个 scope
@@ -0,0 +1,307 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace insertBookshelf {
5
+ interface Option {
6
+ /** 添加的内容分类 */
7
+ category: keyof Category | string
8
+ /** 要添加到书架内容的 id,支持传多个,最多 100 条;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) */
9
+ contentIds: string[]
10
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
11
+ complete?: (res: TaroGeneral.CallbackResult) => void
12
+ /** 接口调用失败的回调函数 */
13
+ fail?: (res: TaroGeneral.CallbackResult) => void
14
+ /** 接口调用成功的回调函数 */
15
+ success?: (res: SuccessCallbackResult) => void
16
+ }
17
+ interface Category {
18
+ /** 专栏模板 */
19
+ article
20
+ /** 文档模板 */
21
+ doc
22
+ /** 动漫模板 */
23
+ cartoon
24
+ /** 影音模板 */
25
+ av
26
+ }
27
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
28
+ /** 添加到书架的结果列表 */
29
+ list: IListItem[]
30
+ }
31
+ interface IListItem {
32
+ /** 内容的唯一标识 */
33
+ contentId: string
34
+ /** 添加状态:值为 0 时是失败,为 1 时是成功 */
35
+ status: keyof Status
36
+ /** 添加信息 */
37
+ msg: string
38
+ }
39
+ interface Status {
40
+ /** 失败 */
41
+ 0
42
+ /** 成功 */
43
+ 1
44
+ }
45
+ }
46
+
47
+ namespace deleteBookshelf {
48
+ interface Option {
49
+ /** 要删除的内容分类 */
50
+ category: keyof Category | string
51
+ /** 要删除书架内容的 id,支持传多个,最多 100 条;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符)。支持批量删除的同一个 category 下的多个 id,不同 category 下的 id 请分别调用该接口删除 */
52
+ contentIds: string[]
53
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
54
+ complete?: (res: TaroGeneral.CallbackResult) => void
55
+ /** 接口调用失败的回调函数 */
56
+ fail?: (res: TaroGeneral.CallbackResult) => void
57
+ /** 接口调用成功的回调函数 */
58
+ success?: (res: SuccessCallbackResult) => void
59
+ }
60
+ interface Category {
61
+ /** 专栏模板 */
62
+ article
63
+ /** 文档模板 */
64
+ doc
65
+ /** 动漫模板 */
66
+ cartoon
67
+ /** 影音模板 */
68
+ av
69
+ }
70
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
71
+ /** 添加到书架的结果列表 */
72
+ list: IListItem[]
73
+ }
74
+ interface IListItem {
75
+ /** 内容的唯一标识 */
76
+ contentId: string
77
+ /** 删除状态:值为 0 时是失败,为 1 时是成功 */
78
+ status: keyof Status
79
+ /** 删除信息 */
80
+ msg: string
81
+ }
82
+ interface Status {
83
+ /** 失败 */
84
+ 0
85
+ /** 成功 */
86
+ 1
87
+ }
88
+ }
89
+
90
+ namespace queryBookshelf {
91
+ interface Option {
92
+ /** 要查询内容的 id,支持传多个,最多 100 条;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) */
93
+ contentIds: string[]
94
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
95
+ complete?: (res: TaroGeneral.CallbackResult) => void
96
+ /** 接口调用失败的回调函数 */
97
+ fail?: (res: TaroGeneral.CallbackResult) => void
98
+ /** 接口调用成功的回调函数 */
99
+ success?: (res: TaroGeneral.CallbackResult) => void
100
+ }
101
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
102
+ /** 查询的内容结果列表 */
103
+ list: IListItem[]
104
+ }
105
+ interface IListItem {
106
+ /** 内容的唯一标识 */
107
+ contentId: string
108
+ /** 状态 */
109
+ status: keyof Status
110
+ }
111
+ interface Status {
112
+ /** 不存在 */
113
+ 0
114
+ /** 存在 */
115
+ 1
116
+ }
117
+ }
118
+
119
+ namespace updateBookshelfReadTime {
120
+ interface Option {
121
+ /** 添加的内容分类 */
122
+ category: keyof Category | string
123
+ /** 要更新内容的 id;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) */
124
+ contentIds: string[]
125
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
126
+ complete?: (res: TaroGeneral.CallbackResult) => void
127
+ /** 接口调用失败的回调函数 */
128
+ fail?: (res: TaroGeneral.CallbackResult) => void
129
+ /** 接口调用成功的回调函数 */
130
+ success?: (res: SuccessCallbackResult) => void
131
+ }
132
+ interface Category {
133
+ /** 专栏模板 */
134
+ article
135
+ /** 文档模板 */
136
+ doc
137
+ /** 动漫模板 */
138
+ cartoon
139
+ /** 影音模板 */
140
+ av
141
+ }
142
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
143
+ /** 更新状态 */
144
+ status: keyof Status
145
+ /** 更新的结果信息 */
146
+ msg: string
147
+ }
148
+ interface Status {
149
+ /** 失败 */
150
+ 0
151
+ /** 成功 */
152
+ 1
153
+ }
154
+ }
155
+
156
+ namespace navigateToBookshelf {
157
+ interface Option {
158
+ /** 跳转到指定的内容分类
159
+ * @supported swan
160
+ */
161
+ category: keyof Category | string
162
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
163
+ complete?: (res: TaroGeneral.CallbackResult) => void
164
+ /** 接口调用失败的回调函数 */
165
+ fail?: (res: TaroGeneral.CallbackResult) => void
166
+ /** 接口调用成功的回调函数 */
167
+ success?: (res: TaroGeneral.CallbackResult) => void
168
+ }
169
+ interface Category {
170
+ /** 专栏模板 */
171
+ article
172
+ /** 文档模板 */
173
+ doc
174
+ /** 动漫模板 */
175
+ cartoon
176
+ /** 影音模板 */
177
+ av
178
+ }
179
+ }
180
+
181
+ interface TaroStatic {
182
+ /** 添加内容到宿主书架
183
+ * @supported swan, qq
184
+ * @swan (需宿主支持书架入口)
185
+ * @example
186
+ * ```tsx
187
+ * Taro.insertBookshelf({
188
+ * category: 'doc',
189
+ * contentIds: ['test1', 'test2'],
190
+ * success(res) {
191
+ * Taro.showModal({
192
+ * title: 'success',
193
+ * content: JSON.stringify(res)
194
+ * })
195
+ * },
196
+ * fail(err) {
197
+ * Taro.showModal({
198
+ * title: 'fail',
199
+ * content: JSON.stringify(err)
200
+ * })
201
+ * }
202
+ * })
203
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-insertBookshelf/
204
+ */
205
+ insertBookshelf(option: insertBookshelf.Option): void
206
+
207
+ /** 删除书架中的内容(需宿主支持书架入口)
208
+ * @supported swan
209
+ * @example
210
+ * ```tsx
211
+ * Taro.deleteBookshelf({
212
+ * category: 'doc',
213
+ * contentIds: ['test1', 'test2'],
214
+ * success(res) {
215
+ * Taro.showModal({
216
+ * title: 'success',
217
+ * content: JSON.stringify(res)
218
+ * })
219
+ * },
220
+ * fail(err) {
221
+ * Taro.showModal({
222
+ * title: 'fail',
223
+ * content: JSON.stringify(err)
224
+ * })
225
+ * }
226
+ * })
227
+ * ```
228
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-deleteBookshelf/
229
+ */
230
+ deleteBookshelf(option: deleteBookshelf.Option): void
231
+
232
+ /** 查询宿主书架的相关内容
233
+ * @supported swan, qq
234
+ * @swan (需宿主支持书架入口)
235
+ * @example
236
+ * ```tsx
237
+ * Taro.queryBookshelf({
238
+ * contentIds: ['test1', 'test2'],
239
+ * success(res) {
240
+ * Taro.showModal({
241
+ * title: 'success',
242
+ * content: JSON.stringify(res)
243
+ * })
244
+ * },
245
+ * fail(err) {
246
+ * Taro.showModal({
247
+ * title: 'fail',
248
+ * content: JSON.stringify(err)
249
+ * })
250
+ * }
251
+ * })
252
+ * ```
253
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-queryBookshelf/
254
+ */
255
+ queryBookshelf(option: queryBookshelf.Option): void
256
+
257
+ /** 更新已加入宿主书架的内容的阅读时间
258
+ * @supported swan, qq
259
+ * @swan (需宿主支持书架入口)
260
+ * @example
261
+ * ```tsx
262
+ * Taro.updateBookshelfReadTime({
263
+ * category: 'doc',
264
+ * contentIds: 'test1',
265
+ * success(res) {
266
+ * Taro.showModal({
267
+ * title: 'success',
268
+ * content: JSON.stringify(res)
269
+ * })
270
+ * },
271
+ * fail(err) {
272
+ * Taro.showModal({
273
+ * title: 'fail',
274
+ * content: JSON.stringify(err)
275
+ * })
276
+ * }
277
+ * })
278
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-queryBookshelf/
279
+ */
280
+ updateBookshelfReadTime(option: updateBookshelfReadTime.Option): void
281
+
282
+ /** 跳转到宿主书架
283
+ * @supported swan
284
+ * @swan (需宿主支持书架入口)
285
+ * @example
286
+ * ```tsx
287
+ * Taro.navigateToBookshelf({
288
+ * category: 'article',
289
+ * contentIds: 'test1',
290
+ * success(res) {
291
+ * Taro.showModal({
292
+ * title: 'navigateToBookshelf',
293
+ * content: 'success'
294
+ * })
295
+ * },
296
+ * fail(err) {
297
+ * Taro.showModal({
298
+ * title: 'fail',
299
+ * content: JSON.stringify(err)
300
+ * })
301
+ * }
302
+ * })
303
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-navigateToBookshelf/
304
+ */
305
+ navigateToBookshelf(option: navigateToBookshelf.Option): void
306
+ }
307
+ }
@@ -118,6 +118,8 @@ declare module '../../index' {
118
118
  nickname: string
119
119
  /** 是否可预约 */
120
120
  reservable: boolean
121
+ /** 除最近的一条预告信息外,其他的预告信息列表(注意:每次最多返回按时间戳增序排列的15个预告信息,其中时间最近的那个预告信息会在接口其他的返回参数中展示,其余的预告信息会在该字段中展示)。 */
122
+ otherInfos?: string[]
121
123
  }
122
124
  interface Status {
123
125
  /** 可用 */
@@ -154,6 +156,10 @@ declare module '../../index' {
154
156
  headUrl: string
155
157
  /** 视频号昵称 */
156
158
  nickname: string
159
+ /** 直播回放状态 */
160
+ replayStatus: keyof ReplayStatus | number
161
+ /** 除最近的一条直播外,其他的直播列表(注意:每次最多返回按时间戳增序排列的15个直播信息,其中时间最近的那个直播会在接口其他的返回参数中展示,其余的直播会在该字段中展示)。 */
162
+ otherInfos?: string[]
157
163
  }
158
164
  interface Status {
159
165
  /** 直播中 */
@@ -161,6 +167,16 @@ declare module '../../index' {
161
167
  /** 直播结束 */
162
168
  3
163
169
  }
170
+ interface ReplayStatus {
171
+ /** 未生成 */
172
+ 0
173
+ /** 已生成 */
174
+ 1
175
+ /** 生成中 */
176
+ 3
177
+ /** 已过期 */
178
+ 6
179
+ }
164
180
  }
165
181
 
166
182
  interface TaroStatic {
@@ -50,12 +50,52 @@ declare module '../../index' {
50
50
 
51
51
  interface TaroStatic {
52
52
  /** 请求用户授权与设备(组)间进行音视频通话
53
+ * @example
54
+ * ```tsx
55
+ * // 授权单台设备
56
+ * Taro.requestDeviceVoIP({
57
+ * sn: 'xxxx',
58
+ * snTicket: 'xxxxx',
59
+ * modelId: 'xxx',
60
+ * deviceName: 'xxx',
61
+ * success(res) {
62
+ * console.log(res)
63
+ * },
64
+ * fail(res) {
65
+ * console.log(res)
66
+ * }
67
+ * })
68
+ *
69
+ * // 批量授权(授权设备组)
70
+ * Taro.requestDeviceVoIP({
71
+ * isGroup: true,
72
+ * groupId: '设备组 ID',
73
+ * success(res) {
74
+ * console.log(res)
75
+ * },
76
+ * fail(res) {
77
+ * console.log(res)
78
+ * }
79
+ * })
80
+ * ```
81
+ *
53
82
  * @supported weapp
54
83
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/device-voip/wx.requestDeviceVoIP.html
55
84
  */
56
85
  requestDeviceVoIP(option: requestDeviceVoIP.Option): Promise<TaroGeneral.CallbackResult>
57
86
  /** 查询当前用户授权的音视频通话设备(组)信息
58
87
  * @supported weapp
88
+ * @example
89
+ * ```tsx
90
+ * Taro.getDeviceVoIPList({
91
+ * success(res) {
92
+ * console.log(res)
93
+ * },
94
+ * fail(res) {
95
+ * console.log(res)
96
+ * }
97
+ * })
98
+ * ```
59
99
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/device-voip/wx.getDeviceVoIPList.html
60
100
  */
61
101
  getDeviceVoIPList(option: getDeviceVoIPList.Option): Promise<getDeviceVoIPList.SuccessCallbackResult>
@@ -75,7 +75,7 @@ declare module '../../index' {
75
75
  * 其中 `access_token` 的获取请参考[auth.getAccessToken](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html)文档
76
76
  * @supported weapp
77
77
  * @example
78
- ```tsx
78
+ * ```tsx
79
79
  * Taro.chooseInvoice({
80
80
  * success: function (res) {}
81
81
  * })
@@ -26,12 +26,25 @@ declare module '../../index' {
26
26
  success?: (result: SuccessCallbackResult) => void
27
27
  /** 超时时间,单位ms */
28
28
  timeout?: number
29
+ /** 未登录时, 是否强制调起登录框
30
+ * @supported tt
31
+ * @default true
32
+ */
33
+ force?: boolean
29
34
  }
30
35
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
31
36
  /** 用户登录凭证(有效期五分钟)。开发者需要在开发者服务器后台调用 [auth.code2Session](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html),使用 code 换取 openid 和 session_key 等信息 */
32
37
  code: string
33
38
  /** 调用结果 */
34
39
  errMsg: string
40
+ /** 用于标识当前设备, 无论登录与否都会返回, 有效期 5 分钟。
41
+ * @supported tt
42
+ */
43
+ anonymousCode?: string
44
+ /** 判断在当前 APP(头条、抖音等)是否处于登录状态。
45
+ * @supported tt
46
+ */
47
+ isLogin?: boolean
35
48
  }
36
49
  }
37
50
 
@@ -54,7 +67,7 @@ declare module '../../index' {
54
67
  pluginLogin(option?: pluginLogin.Option): Promise<pluginLogin.SuccessCallbackResult>
55
68
 
56
69
  /** 调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户的唯一标识(openid)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
57
- * @supported weapp
70
+ * @supported weapp, jd, qq, tt, harmony_hybrid
58
71
  * @example
59
72
  * ```tsx
60
73
  * Taro.login({
@@ -82,7 +95,7 @@ declare module '../../index' {
82
95
  * 通过 Taro.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用 Taro.checkSession 接口检测当前用户登录态是否有效。
83
96
  *
84
97
  * 登录态过期后开发者可以再调用 Taro.login 获取新的用户登录态。调用 Taro.checkSession 成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
85
- * @supported weapp
98
+ * @supported weapp, swan, qq, tt
86
99
  * @example
87
100
  * ```tsx
88
101
  * Taro.checkSession({
@@ -80,6 +80,14 @@ declare module '../../index' {
80
80
  /**
81
81
  * 跳转至隐私协议页面。隐私合规开发指南详情可见《小程序隐私协议开发指南》
82
82
  * @supported weapp
83
+ * @example
84
+ * ```tsx
85
+ * Taro.openPrivacyContract({
86
+ * success: () => {}, // 打开成功
87
+ * fail: () => {}, // 打开失败
88
+ * complete: () => {}
89
+ * })
90
+ * ```
83
91
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.openPrivacyContract.html
84
92
  */
85
93
  openPrivacyContract(option?: openPrivacyContract.Option): void
@@ -5,6 +5,7 @@ declare module '../../index' {
5
5
  interface Option {
6
6
  /**
7
7
  * 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。
8
+ * @default false
8
9
  */
9
10
  withSubscriptions?: boolean
10
11
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -135,7 +136,7 @@ declare module '../../index' {
135
136
  /** 调起客户端小程序设置界面,返回用户设置的操作结果。**设置界面只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
136
137
  *
137
138
  * 注意:[2.3.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为后,才可以跳转打开设置页,管理授权信息。[详情](https://developers.weixin.qq.com/community/develop/doc/000cea2305cc5047af5733de751008)
138
- * @supported weapp, rn, tt
139
+ * @supported weapp, alipay, swan, jd, qq, tt, rn, harmony_hybrid
139
140
  * @example
140
141
  * ```tsx
141
142
  * Taro.openSetting({
@@ -153,7 +154,7 @@ declare module '../../index' {
153
154
  openSetting(option?: openSetting.Option): Promise<openSetting.SuccessCallbackResult>
154
155
 
155
156
  /** 获取用户的当前设置。**返回值中只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
156
- * @supported weapp, rn, tt
157
+ * @supported weapp, alipay, swan, jd, qq, tt, rn, harmony_hybrid
157
158
  * @example
158
159
  * ```tsx
159
160
  * Taro.getSetting({
@@ -0,0 +1,83 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace openStickerSetView {
5
+ interface Option {
6
+ /** 表情专辑链接,可前往[表情开放平台](https://sticker.weixin.qq.com/cgi-bin/mmemoticonwebnode-bin/pages/home),在详情页中的「小程序跳转链接」入口复制 */
7
+ url: Object
8
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
9
+ complete?: (res: TaroGeneral.CallbackResult) => void
10
+ /** 接口调用失败的回调函数 */
11
+ fail?: (res: TaroGeneral.CallbackResult) => void
12
+ /** 接口调用成功的回调函数 */
13
+ success?: (res: TaroGeneral.CallbackResult) => void
14
+ }
15
+ }
16
+
17
+ namespace openStickerIPView {
18
+ interface Option {
19
+ /** 表情IP合辑链接,可前往[表情开放平台](https://sticker.weixin.qq.com/cgi-bin/mmemoticonwebnode-bin/pages/home),在详情页中的「小程序跳转链接」入口复制 */
20
+ url: Object
21
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
22
+ complete?: (res: TaroGeneral.CallbackResult) => void
23
+ /** 接口调用失败的回调函数 */
24
+ fail?: (res: TaroGeneral.CallbackResult) => void
25
+ /** 接口调用成功的回调函数 */
26
+ success?: (res: TaroGeneral.CallbackResult) => void
27
+ }
28
+ }
29
+
30
+ namespace openSingleStickerView {
31
+ interface Option {
32
+ /** 表情链接,可前往(表情开放平台)[https://sticker.weixin.qq.com/cgi-bin/mmemoticonwebnode-bin/pages/home],在详情页中的「小程序跳转链接」入口复制 */
33
+ url: Object
34
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
35
+ complete?: (res: TaroGeneral.CallbackResult) => void
36
+ /** 接口调用失败的回调函数 */
37
+ fail?: (res: TaroGeneral.CallbackResult) => void
38
+ /** 接口调用成功的回调函数 */
39
+ success?: (res: TaroGeneral.CallbackResult) => void
40
+ }
41
+ }
42
+
43
+ interface TaroStatic {
44
+ /** 打开表情专辑
45
+ * @supported weapp
46
+ * @example
47
+ * ```tsx
48
+ * Taro.openStickerSetView({
49
+ * url: '',
50
+ * success(res) {}
51
+ * })
52
+ * ```
53
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/sticker/wx.openStickerSetView.html
54
+ */
55
+ openStickerSetView(option: openStickerSetView.Option): void
56
+
57
+ /** 打开表情IP合辑
58
+ * @supported weapp
59
+ * @example
60
+ * ```tsx
61
+ * Taro.openStickerIPView({
62
+ * url: '',
63
+ * success(res) {}
64
+ * })
65
+ * ```
66
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/sticker/wx.openStickerIPView.html
67
+ */
68
+ openStickerIPView(option: openStickerIPView.Option): void
69
+
70
+ /** 打开单个表情
71
+ * @supported weapp
72
+ * @example
73
+ * ```tsx
74
+ * Taro.openSingleStickerView({
75
+ * url: '',
76
+ * success(res) {}
77
+ * })
78
+ * ```
79
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/sticker/wx.openSingleStickerView.html
80
+ */
81
+ openSingleStickerView(option: openSingleStickerView.Option): void
82
+ }
83
+ }