@tarojs/taro 4.0.0-canary.8 → 4.0.0
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 +38 -17
- package/types/api/base/debug.d.ts +8 -8
- package/types/api/base/env.d.ts +2 -2
- package/types/api/base/index.d.ts +3 -3
- package/types/api/base/performance.d.ts +1 -1
- package/types/api/base/system.d.ts +6 -6
- package/types/api/base/weapp/app-event.d.ts +10 -10
- package/types/api/base/weapp/life-cycle.d.ts +1 -1
- package/types/api/canvas/index.d.ts +367 -63
- package/types/api/device/battery.d.ts +1 -1
- package/types/api/device/clipboard.d.ts +2 -2
- package/types/api/device/keyboard.d.ts +1 -1
- package/types/api/device/network.d.ts +3 -3
- package/types/api/device/phone.d.ts +1 -1
- package/types/api/device/screen.d.ts +2 -2
- package/types/api/files/index.d.ts +7 -7
- package/types/api/framework/index.d.ts +2 -2
- package/types/api/location/index.d.ts +4 -4
- package/types/api/media/audio.d.ts +21 -12
- package/types/api/media/background-audio.d.ts +1 -1
- package/types/api/media/image.d.ts +10 -10
- package/types/api/media/video.d.ts +11 -11
- package/types/api/navigate/index.d.ts +1 -1
- package/types/api/network/download.d.ts +5 -5
- package/types/api/network/request.d.ts +8 -8
- package/types/api/network/upload.d.ts +7 -7
- package/types/api/network/websocket.d.ts +8 -8
- package/types/api/open-api/account.d.ts +1 -1
- package/types/api/open-api/address.d.ts +13 -5
- package/types/api/open-api/authorize.d.ts +1 -1
- package/types/api/open-api/channels.d.ts +16 -0
- package/types/api/open-api/device-voip.d.ts +40 -0
- package/types/api/open-api/invoice.d.ts +1 -1
- package/types/api/open-api/login.d.ts +15 -2
- package/types/api/open-api/privacy.d.ts +8 -0
- package/types/api/open-api/settings.d.ts +3 -2
- package/types/api/open-api/sticker.d.ts +83 -0
- package/types/api/open-api/subscribe-message.d.ts +148 -6
- package/types/api/open-api/user-info.d.ts +6 -1
- package/types/api/qq/index.d.ts +306 -1
- package/types/api/route/index.d.ts +5 -5
- package/types/api/storage/index.d.ts +10 -10
- package/types/api/swan/bookshelf.d.ts +307 -0
- package/types/api/swan/download-package.d.ts +80 -0
- package/types/api/swan/index.d.ts +151 -0
- package/types/api/swan/pay.d.ts +139 -0
- package/types/api/taro.extend.d.ts +3 -2
- package/types/api/taro.hooks.d.ts +9 -9
- package/types/api/ui/animation.d.ts +32 -32
- package/types/api/ui/custom-component.d.ts +1 -1
- package/types/api/ui/fonts.d.ts +1 -1
- package/types/api/ui/interaction.d.ts +6 -6
- package/types/api/ui/menu.d.ts +1 -1
- package/types/api/ui/navigation-bar.d.ts +2 -2
- package/types/api/ui/pull-down-refresh.d.ts +2 -2
- package/types/api/ui/scroll.d.ts +1 -1
- package/types/api/ui/tab-bar.d.ts +8 -8
- package/types/api/ui/window.d.ts +2 -2
- package/types/api/wxml/index.d.ts +30 -24
- package/types/compile/compiler.d.ts +6 -2
- package/types/compile/config/h5.d.ts +9 -4
- package/types/compile/config/harmony.d.ts +43 -7
- package/types/compile/config/index.d.ts +1 -0
- package/types/compile/config/mini.d.ts +2 -16
- package/types/compile/config/project.d.ts +26 -8
- package/types/compile/config/rn.d.ts +22 -1
- package/types/compile/index.d.ts +8 -0
- package/types/compile/viteCompilerContext.d.ts +7 -3
- package/types/global.d.ts +2 -1
- package/types/index.d.ts +91 -46
- package/types/taro.api.d.ts +22 -14
- package/types/taro.component.d.ts +3 -0
- package/types/taro.config.d.ts +13 -4
- package/types/taro.lifecycle.d.ts +3 -0
- package/types/taro.runtime.d.ts +9 -0
|
@@ -138,22 +138,22 @@ declare module '../../index' {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/** WebSocket 任务,可通过 [Taro.connectSocket()](/docs/apis/network/websocket/SocketTask) 接口创建返回。
|
|
141
|
-
* @supported weapp, h5, rn, alipay, swan
|
|
141
|
+
* @supported weapp, h5, rn, alipay, swan, harmony_hybrid
|
|
142
142
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html
|
|
143
143
|
*/
|
|
144
144
|
interface SocketTask {
|
|
145
145
|
/** 通过 WebSocket 连接发送数据
|
|
146
|
-
* @supported weapp, h5, rn, alipay, swan, tt
|
|
146
|
+
* @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
|
|
147
147
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.send.html
|
|
148
148
|
*/
|
|
149
149
|
send(option: SocketTask.SendOption): void
|
|
150
150
|
/** 关闭 WebSocket 连接
|
|
151
|
-
* @supported weapp, h5, rn, alipay, swan, tt
|
|
151
|
+
* @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
|
|
152
152
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.close.html
|
|
153
153
|
*/
|
|
154
154
|
close(option: SocketTask.CloseOption): void
|
|
155
155
|
/** 监听 WebSocket 连接打开事件
|
|
156
|
-
* @supported weapp, h5, rn, alipay, swan, tt
|
|
156
|
+
* @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
|
|
157
157
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onOpen.html
|
|
158
158
|
*/
|
|
159
159
|
onOpen(
|
|
@@ -161,7 +161,7 @@ declare module '../../index' {
|
|
|
161
161
|
callback: SocketTask.OnOpenCallback
|
|
162
162
|
): void
|
|
163
163
|
/** 监听 WebSocket 连接关闭事件
|
|
164
|
-
* @supported weapp, h5, rn, alipay, swan, tt
|
|
164
|
+
* @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
|
|
165
165
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onClose.html
|
|
166
166
|
*/
|
|
167
167
|
onClose(
|
|
@@ -169,7 +169,7 @@ declare module '../../index' {
|
|
|
169
169
|
callback: SocketTask.OnCloseCallback
|
|
170
170
|
): void
|
|
171
171
|
/** 监听 WebSocket 错误事件
|
|
172
|
-
* @supported weapp, h5, rn, alipay, swan, tt
|
|
172
|
+
* @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
|
|
173
173
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onError.html
|
|
174
174
|
*/
|
|
175
175
|
onError(
|
|
@@ -177,7 +177,7 @@ declare module '../../index' {
|
|
|
177
177
|
callback: SocketTask.OnErrorCallback
|
|
178
178
|
): void
|
|
179
179
|
/** 监听 WebSocket 接受到服务器的消息事件
|
|
180
|
-
* @supported weapp, h5, rn, alipay, swan, tt
|
|
180
|
+
* @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
|
|
181
181
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onMessage.html
|
|
182
182
|
*/
|
|
183
183
|
onMessage<T = any>(
|
|
@@ -320,7 +320,7 @@ declare module '../../index' {
|
|
|
320
320
|
* **并发数**
|
|
321
321
|
* - 1.7.0 及以上版本,最多可以同时存在 5 个 WebSocket 连接。
|
|
322
322
|
* - 1.7.0 以下版本,一个小程序同时只能有一个 WebSocket 连接,如果当前已存在一个 WebSocket 连接,会自动关闭该连接,并重新创建一个 WebSocket 连接。
|
|
323
|
-
* @supported weapp, h5, rn, alipay, swan
|
|
323
|
+
* @supported weapp, h5, rn, alipay, swan, harmony_hybrid
|
|
324
324
|
* @example
|
|
325
325
|
* ```tsx
|
|
326
326
|
* Taro.connectSocket({
|
|
@@ -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,
|
|
58
|
+
* @supported weapp, swan, qq, tt, rn
|
|
59
59
|
* @example
|
|
60
60
|
* ```tsx
|
|
61
61
|
* // 可以通过 Taro.getSetting 先查询一下用户是否授权了 "scope.record" 这个 scope
|
|
@@ -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,
|
|
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,
|
|
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
|
+
}
|
|
@@ -3,8 +3,19 @@ import Taro from '../../index'
|
|
|
3
3
|
declare module '../../index' {
|
|
4
4
|
namespace requestSubscribeMessage {
|
|
5
5
|
interface Option {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* 需要订阅的消息模板的id的集合(注意:iOS客户端7.0.6版本、Android客户端7.0.7版本之后的一次性订阅/长期订阅才支持多个模板消息,iOS客户端7.0.5版本、Android客户端7.0.6版本之前的一次订阅只支持一个模板消息)消息模板id在[微信公众平台(mp.weixin.qq.com)-功能-订阅消息]中配置
|
|
8
|
+
* @supported weapp, tt
|
|
9
|
+
*/
|
|
7
10
|
tmplIds: string[]
|
|
11
|
+
/** 需要订阅的消息模板 id 集合(注意:1、一次性模板 id 和长期性模板 id 不可同时使用,2、一次最多传入三个模板 id
|
|
12
|
+
* @supported alipay
|
|
13
|
+
*/
|
|
14
|
+
entityIds: string[]
|
|
15
|
+
/** 模板小程序 appId,仅在服务商代调用场景下需要传入
|
|
16
|
+
* @supported alipay
|
|
17
|
+
*/
|
|
18
|
+
thirdTypeAppId?: string
|
|
8
19
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
9
20
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
10
21
|
/** 接口调用失败的回调函数 */
|
|
@@ -37,20 +48,90 @@ declare module '../../index' {
|
|
|
37
48
|
* @type "accept" | "reject" | "ban"
|
|
38
49
|
*/
|
|
39
50
|
[TEMPLATE_ID: string]: keyof TemplateReflex | string
|
|
51
|
+
/** 用户订阅操作结果。
|
|
52
|
+
*
|
|
53
|
+
* | 枚举值 | 描述 |
|
|
54
|
+
* | --- | ---- |
|
|
55
|
+
* | subscribe | 订阅成功 |
|
|
56
|
+
*
|
|
57
|
+
* @supported alipay
|
|
58
|
+
*/
|
|
59
|
+
behavior?: string
|
|
60
|
+
/** 一次性订阅,是否勾选 总是保持以上选择,不再询问。
|
|
61
|
+
*
|
|
62
|
+
* | 枚举值 | 描述 |
|
|
63
|
+
* | --- | ---- |
|
|
64
|
+
* | true | 勾选 |
|
|
65
|
+
* | false | 未勾选 |
|
|
66
|
+
*
|
|
67
|
+
* @supported alipay
|
|
68
|
+
*/
|
|
69
|
+
keep?: boolean
|
|
70
|
+
/** 长期性订阅,是否点击 拒绝,不再询问。
|
|
71
|
+
*
|
|
72
|
+
* | 枚举值 | 描述 |
|
|
73
|
+
* | --- | ---- |
|
|
74
|
+
* | true | 点击 |
|
|
75
|
+
* | false | 未点击 |
|
|
76
|
+
*
|
|
77
|
+
* @supported alipay
|
|
78
|
+
*/
|
|
79
|
+
refuse?: boolean
|
|
80
|
+
/** 订阅数据
|
|
81
|
+
* @supported alipay
|
|
82
|
+
*/
|
|
83
|
+
result?: ISubscribeResult
|
|
84
|
+
/** 本次订阅过程是否弹出了订阅面板。
|
|
85
|
+
*
|
|
86
|
+
* | 枚举值 | 描述 |
|
|
87
|
+
* | --- | ---- |
|
|
88
|
+
* | true | 弹出 |
|
|
89
|
+
* | false | 未弹出 |
|
|
90
|
+
*
|
|
91
|
+
* @supported alipay
|
|
92
|
+
*/
|
|
93
|
+
show?: boolean
|
|
40
94
|
/** 接口调用成功时errMsg值为'requestSubscribeMessage:ok' */
|
|
41
95
|
errMsg: string
|
|
42
96
|
}
|
|
43
97
|
|
|
98
|
+
interface ISubscribeResult {
|
|
99
|
+
/** 订阅成功的模板列表 */
|
|
100
|
+
subscribeEntityIds: string[]
|
|
101
|
+
/** 最终订阅成功的模板列表 */
|
|
102
|
+
subscribedEntityIds: string[]
|
|
103
|
+
/** 未订阅的模板列表 */
|
|
104
|
+
unsubscribedEntityIds: string[]
|
|
105
|
+
/** 本次新增订阅成功的模板列表 */
|
|
106
|
+
currentSubscribedEntityIds: string[]
|
|
107
|
+
}
|
|
108
|
+
|
|
44
109
|
/** 模版消息订阅类型 */
|
|
45
110
|
interface TemplateReflex {
|
|
46
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* 表示用户同意订阅该条id对应的模板消息
|
|
113
|
+
* @supported weapp, alipay, tt
|
|
114
|
+
*/
|
|
47
115
|
accept
|
|
48
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* 表示用户拒绝订阅该条id对应的模板消息
|
|
118
|
+
* @supported weapp, alipay, tt
|
|
119
|
+
*/
|
|
49
120
|
reject
|
|
50
|
-
/**
|
|
121
|
+
/**
|
|
122
|
+
* 表示已被后台封禁
|
|
123
|
+
* @supported weapp, tt
|
|
124
|
+
*/
|
|
51
125
|
ban
|
|
52
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* 表示该模板因为模板标题同名被后台过滤
|
|
128
|
+
* @supported weapp
|
|
129
|
+
*/
|
|
53
130
|
filter
|
|
131
|
+
/** 表示该条 id 对应的模版消息授权失败
|
|
132
|
+
* @supported tt
|
|
133
|
+
*/
|
|
134
|
+
fail
|
|
54
135
|
}
|
|
55
136
|
}
|
|
56
137
|
|
|
@@ -114,6 +195,19 @@ declare module '../../index' {
|
|
|
114
195
|
}
|
|
115
196
|
}
|
|
116
197
|
|
|
198
|
+
namespace unsubscribeMessage {
|
|
199
|
+
interface Option {
|
|
200
|
+
/** 需要取消订阅的消息模板 id 集合(注意:1、一次性模板 id 和长期性模板 id 不可同时使用,2、一次最多传入三个模板 id)。 */
|
|
201
|
+
entityIds: string[]
|
|
202
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
203
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
204
|
+
/** 接口调用失败的回调函数 */
|
|
205
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
206
|
+
/** 接口调用成功的回调函数 */
|
|
207
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
117
211
|
interface TaroStatic {
|
|
118
212
|
/** 请求订阅消息
|
|
119
213
|
*
|
|
@@ -133,7 +227,7 @@ declare module '../../index' {
|
|
|
133
227
|
): Promise<requestSubscribeMessage.SuccessCallbackResult | requestSubscribeMessage.FailCallbackResult>
|
|
134
228
|
|
|
135
229
|
/** 订阅设备消息接口,调用后弹出授权框,用户同意后会允许开发者给用户发送订阅模版消息。当用户点击“允许”按钮时,模板消息会被添加到用户的小程序设置页,通过 wx.getSetting 接口可获取用户对相关模板消息的订阅状态。
|
|
136
|
-
* @supported weapp
|
|
230
|
+
* @supported weapp
|
|
137
231
|
* @example
|
|
138
232
|
* ```tsx
|
|
139
233
|
* Taro.requestSubscribeDeviceMessage({
|
|
@@ -154,5 +248,53 @@ declare module '../../index' {
|
|
|
154
248
|
requestSubscribeDeviceMessage(
|
|
155
249
|
option: requestSubscribeDeviceMessage.Option
|
|
156
250
|
): Promise<requestSubscribeDeviceMessage.SuccessCallbackResult | requestSubscribeDeviceMessage.FailCallbackResult>
|
|
251
|
+
|
|
252
|
+
/** 取消当前用户已订阅的消息
|
|
253
|
+
* @supported alipay
|
|
254
|
+
* @example
|
|
255
|
+
* ```tsx
|
|
256
|
+
* Taro.unsubscribeMessage({
|
|
257
|
+
* entityIds: [
|
|
258
|
+
* 'ac768fca1ce245ccae9404bb5243c49b',
|
|
259
|
+
* '9aa357acb7c6434aba294aded1cdfb7c',
|
|
260
|
+
* ],
|
|
261
|
+
* success(res) {
|
|
262
|
+
* console.log(res);
|
|
263
|
+
* },
|
|
264
|
+
* fail(err) {
|
|
265
|
+
* console.log(err);
|
|
266
|
+
* }
|
|
267
|
+
* })
|
|
268
|
+
* ```
|
|
269
|
+
* @see https://opendocs.alipay.com/mini/07vg26?pathHash=8c9630ac
|
|
270
|
+
*/
|
|
271
|
+
unsubscribeMessage(option: unsubscribeMessage.Option): void
|
|
272
|
+
|
|
273
|
+
/** 小程序消息订阅服务,包括取消订阅和查询订阅;订阅操作详见 [form 表单](https://smartprogram.baidu.com/docs/develop/component/formlist_form/)。
|
|
274
|
+
* @supported swan
|
|
275
|
+
* @example
|
|
276
|
+
* ```tsx
|
|
277
|
+
* Taro.subscribeService({
|
|
278
|
+
* templateId: 'BD0003',
|
|
279
|
+
* subscribeId: '8026',
|
|
280
|
+
* type: 'query',
|
|
281
|
+
* success(res) {
|
|
282
|
+
* Taro.showModal({
|
|
283
|
+
* title: 'success',
|
|
284
|
+
* content: JSON.stringify(res)
|
|
285
|
+
* })
|
|
286
|
+
* },
|
|
287
|
+
* fail(err) {
|
|
288
|
+
* Taro.showModal({
|
|
289
|
+
* title: 'fail',
|
|
290
|
+
* content: JSON.stringify(err)
|
|
291
|
+
* })
|
|
292
|
+
* }
|
|
293
|
+
* })
|
|
294
|
+
* ```
|
|
295
|
+
* @see https://smartprogram.baidu.com/docs/develop/api/open/swan-subscribeService/
|
|
296
|
+
*/
|
|
297
|
+
subscribeService(option: subscribeService.Option): void
|
|
298
|
+
|
|
157
299
|
}
|
|
158
300
|
}
|
|
@@ -39,6 +39,11 @@ declare module '../../index' {
|
|
|
39
39
|
lang?: keyof UserInfo.Language
|
|
40
40
|
/** 声明获取用户个人信息后的用途,不超过30个字符 */
|
|
41
41
|
desc: string
|
|
42
|
+
/** 当宿主未登录时,是否强制拉起登录框
|
|
43
|
+
* @supported tt
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
force?: boolean
|
|
42
47
|
/** 接口调用成功的回调函数 */
|
|
43
48
|
success?: (result: SuccessCallbackResult) => void
|
|
44
49
|
/** 接口调用失败的回调函数 */
|
|
@@ -102,7 +107,7 @@ declare module '../../index' {
|
|
|
102
107
|
*
|
|
103
108
|
* **接口调整说明**
|
|
104
109
|
* 在用户未授权过的情况下调用此接口,将不再出现授权弹窗,会直接进入 fail 回调(详见[《公告》](https://developers.weixin.qq.com/community/develop/doc/0000a26e1aca6012e896a517556c01))。在用户已授权的情况下调用此接口,可成功获取用户信息。
|
|
105
|
-
* @supported weapp, tt
|
|
110
|
+
* @supported weapp, jd, qq, tt, harmony_hybrid
|
|
106
111
|
* @example
|
|
107
112
|
* ```tsx
|
|
108
113
|
* // 必须是在用户已经授权的情况下调用
|