@tarojs/taro 3.8.0-canary.0 → 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/html.css +9 -0
- package/package.json +16 -4
- package/types/api/ad/index.d.ts +6 -18
- package/types/api/ai/inference.d.ts +4 -8
- package/types/api/ai/visionkit.d.ts +625 -54
- package/types/api/base/debug.d.ts +8 -8
- package/types/api/base/env.d.ts +1 -1
- package/types/api/base/index.d.ts +3 -3
- package/types/api/base/performance.d.ts +5 -5
- 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 +389 -72
- package/types/api/data-analysis/index.d.ts +51 -1
- package/types/api/device/accelerometer.d.ts +8 -6
- package/types/api/device/accessibility.d.ts +1 -1
- package/types/api/device/battery.d.ts +3 -3
- package/types/api/device/bluetooth-ble.d.ts +40 -17
- package/types/api/device/bluetooth-peripheral.d.ts +26 -26
- package/types/api/device/bluetooth.d.ts +37 -13
- package/types/api/device/calendar.d.ts +11 -1
- package/types/api/device/clipboard.d.ts +17 -17
- package/types/api/device/compass.d.ts +5 -5
- package/types/api/device/gyroscope.d.ts +4 -4
- package/types/api/device/iBeacon.d.ts +10 -8
- package/types/api/device/keyboard.d.ts +7 -5
- package/types/api/device/memory.d.ts +3 -4
- package/types/api/device/motion.d.ts +8 -6
- package/types/api/device/network.d.ts +12 -6
- package/types/api/device/nfc.d.ts +13 -13
- package/types/api/device/phone.d.ts +1 -1
- package/types/api/device/scan.d.ts +5 -3
- package/types/api/device/screen.d.ts +28 -12
- package/types/api/device/sms.d.ts +1 -1
- package/types/api/device/vibrate.d.ts +5 -5
- package/types/api/device/wifi.d.ts +25 -13
- package/types/api/files/index.d.ts +73 -43
- package/types/api/framework/index.d.ts +2 -2
- package/types/api/location/index.d.ts +167 -19
- package/types/api/media/audio.d.ts +71 -42
- package/types/api/media/background-audio.d.ts +1 -1
- package/types/api/media/camera.d.ts +6 -3
- package/types/api/media/image.d.ts +5 -5
- package/types/api/media/video.d.ts +11 -11
- package/types/api/navigate/index.d.ts +3 -1
- package/types/api/network/download.d.ts +7 -15
- package/types/api/network/request.d.ts +7 -7
- package/types/api/network/upload.d.ts +9 -17
- 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 +42 -2
- package/types/api/open-api/invoice.d.ts +1 -1
- package/types/api/open-api/login.d.ts +16 -3
- package/types/api/open-api/my-miniprogram.d.ts +2 -2
- package/types/api/open-api/privacy.d.ts +107 -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 +8 -5
- package/types/api/skyline/index.d.ts +59 -0
- package/types/api/storage/background-fetch.d.ts +63 -11
- package/types/api/storage/cache-manager.d.ts +61 -10
- package/types/api/storage/index.d.ts +125 -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 +15 -6
- 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 +4 -3
- 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 +5 -5
- 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 +19 -19
- package/types/compile/compiler.d.ts +9 -4
- package/types/compile/config/h5.d.ts +23 -10
- package/types/compile/config/harmony.d.ts +82 -0
- package/types/compile/config/index.d.ts +1 -0
- package/types/compile/config/mini.d.ts +58 -30
- package/types/compile/config/plugin.d.ts +34 -0
- package/types/compile/config/project.d.ts +26 -13
- package/types/compile/config/util.d.ts +22 -8
- package/types/compile/viteCompilerContext.d.ts +155 -0
- package/types/global.d.ts +3 -1
- package/types/index.d.ts +92 -44
- package/types/taro.api.d.ts +24 -13
- package/types/taro.component.d.ts +2 -1
- package/types/taro.config.d.ts +47 -6
- package/types/taro.lifecycle.d.ts +3 -0
- package/types/taro.runtime.d.ts +9 -0
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* Taro.openPrivacyContract({
|
|
86
|
+
* success: () => {}, // 打开成功
|
|
87
|
+
* fail: () => {}, // 打开失败
|
|
88
|
+
* complete: () => {}
|
|
89
|
+
* })
|
|
90
|
+
* ```
|
|
91
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.openPrivacyContract.html
|
|
92
|
+
*/
|
|
93
|
+
openPrivacyContract(option?: openPrivacyContract.Option): void
|
|
94
|
+
/**
|
|
95
|
+
* 模拟隐私接口调用,并触发隐私弹窗逻辑。隐私合规开发指南详情可见《小程序隐私协议开发指南》
|
|
96
|
+
* @supported weapp
|
|
97
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.requirePrivacyAuthorize.html
|
|
98
|
+
*/
|
|
99
|
+
requirePrivacyAuthorize(option?: requirePrivacyAuthorize.Option): void
|
|
100
|
+
/**
|
|
101
|
+
* 监听隐私接口需要用户授权事件。当需要用户进行隐私授权时会触发。触发该事件时,开发者需要弹出隐私协议说明,并在用户同意或拒绝授权后调用回调接口 resolve 触发原隐私接口或组件继续执行。隐私合规开发指南详情可见《小程序隐私协议开发指南》
|
|
102
|
+
* @supported weapp
|
|
103
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.onNeedPrivacyAuthorization.html
|
|
104
|
+
*/
|
|
105
|
+
onNeedPrivacyAuthorization(listener: onNeedPrivacyAuthorization.Listener): void
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -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
|
* // 必须是在用户已经授权的情况下调用
|