@spcsn/taro 0.1.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/README.md +12 -0
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -0
- package/index.js +9 -0
- package/package.json +86 -0
- package/types/api/ad/index.d.ts +197 -0
- package/types/api/ai/face.d.ts +133 -0
- package/types/api/ai/inference.d.ts +129 -0
- package/types/api/ai/visionkit.d.ts +874 -0
- package/types/api/alipay/index.d.ts +69 -0
- package/types/api/base/crypto.d.ts +104 -0
- package/types/api/base/debug.d.ts +329 -0
- package/types/api/base/env.d.ts +19 -0
- package/types/api/base/index.d.ts +102 -0
- package/types/api/base/performance.d.ts +258 -0
- package/types/api/base/system.d.ts +742 -0
- package/types/api/base/update.d.ts +130 -0
- package/types/api/base/weapp/app-event.d.ts +265 -0
- package/types/api/base/weapp/life-cycle.d.ts +155 -0
- package/types/api/canvas/index.d.ts +2162 -0
- package/types/api/cloud/index.d.ts +2622 -0
- package/types/api/data-analysis/index.d.ts +122 -0
- package/types/api/device/accelerometer.d.ts +102 -0
- package/types/api/device/accessibility.d.ts +26 -0
- package/types/api/device/battery.d.ts +46 -0
- package/types/api/device/bluetooth-ble.d.ts +601 -0
- package/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/types/api/device/bluetooth.d.ts +463 -0
- package/types/api/device/calendar.d.ts +98 -0
- package/types/api/device/clipboard.d.ts +81 -0
- package/types/api/device/compass.d.ts +105 -0
- package/types/api/device/contact.d.ts +110 -0
- package/types/api/device/gyroscope.d.ts +85 -0
- package/types/api/device/iBeacon.d.ts +168 -0
- package/types/api/device/keyboard.d.ts +97 -0
- package/types/api/device/memory.d.ts +52 -0
- package/types/api/device/motion.d.ts +88 -0
- package/types/api/device/network.d.ts +172 -0
- package/types/api/device/nfc.d.ts +1238 -0
- package/types/api/device/phone.d.ts +30 -0
- package/types/api/device/scan.d.ts +111 -0
- package/types/api/device/screen.d.ts +217 -0
- package/types/api/device/sms.d.ts +26 -0
- package/types/api/device/vibrate.d.ts +51 -0
- package/types/api/device/wifi.d.ts +301 -0
- package/types/api/ext/index.d.ts +64 -0
- package/types/api/files/index.d.ts +1472 -0
- package/types/api/framework/index.d.ts +51 -0
- package/types/api/location/index.d.ts +517 -0
- package/types/api/media/audio.d.ts +1013 -0
- package/types/api/media/background-audio.d.ts +291 -0
- package/types/api/media/camera.d.ts +207 -0
- package/types/api/media/editor.d.ts +239 -0
- package/types/api/media/image.d.ts +469 -0
- package/types/api/media/live.d.ts +461 -0
- package/types/api/media/map.d.ts +638 -0
- package/types/api/media/media-recorder.d.ts +117 -0
- package/types/api/media/recorder.d.ts +317 -0
- package/types/api/media/video-decoder.d.ts +117 -0
- package/types/api/media/video-processing.d.ts +84 -0
- package/types/api/media/video.d.ts +527 -0
- package/types/api/media/voip.d.ts +393 -0
- package/types/api/navigate/index.d.ts +327 -0
- package/types/api/network/download.d.ts +173 -0
- package/types/api/network/mdns.d.ts +191 -0
- package/types/api/network/request.d.ts +480 -0
- package/types/api/network/tcp.d.ts +181 -0
- package/types/api/network/udp.d.ts +218 -0
- package/types/api/network/upload.d.ts +201 -0
- package/types/api/network/websocket.d.ts +383 -0
- package/types/api/open-api/account.d.ts +51 -0
- package/types/api/open-api/address.d.ts +68 -0
- package/types/api/open-api/authorize.d.ts +80 -0
- package/types/api/open-api/card.d.ts +110 -0
- package/types/api/open-api/channels.d.ts +225 -0
- package/types/api/open-api/customer-service.d.ts +45 -0
- package/types/api/open-api/device-voip.d.ts +103 -0
- package/types/api/open-api/facial.d.ts +98 -0
- package/types/api/open-api/favorites.d.ts +101 -0
- package/types/api/open-api/group.d.ts +59 -0
- package/types/api/open-api/invoice.d.ts +87 -0
- package/types/api/open-api/license-plate.d.ts +27 -0
- package/types/api/open-api/login.d.ts +115 -0
- package/types/api/open-api/my-miniprogram.d.ts +28 -0
- package/types/api/open-api/privacy.d.ts +107 -0
- package/types/api/open-api/redpackage.d.ts +24 -0
- package/types/api/open-api/settings.d.ts +174 -0
- package/types/api/open-api/soter.d.ts +184 -0
- package/types/api/open-api/sticker.d.ts +83 -0
- package/types/api/open-api/subscribe-message.d.ts +305 -0
- package/types/api/open-api/user-info.d.ts +182 -0
- package/types/api/open-api/werun.d.ts +101 -0
- package/types/api/payment/index.d.ts +119 -0
- package/types/api/qq/index.d.ts +354 -0
- package/types/api/route/index.d.ts +324 -0
- package/types/api/share/index.d.ts +354 -0
- package/types/api/skyline/index.d.ts +345 -0
- package/types/api/storage/background-fetch.d.ts +131 -0
- package/types/api/storage/cache-manager.d.ts +249 -0
- package/types/api/storage/index.d.ts +405 -0
- 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 +251 -0
- package/types/api/swan/pay.d.ts +139 -0
- package/types/api/taro.extend.d.ts +233 -0
- package/types/api/taro.hooks.d.ts +148 -0
- package/types/api/ui/animation.d.ts +427 -0
- package/types/api/ui/background.d.ts +69 -0
- package/types/api/ui/custom-component.d.ts +23 -0
- package/types/api/ui/fonts.d.ts +77 -0
- package/types/api/ui/interaction.d.ts +281 -0
- package/types/api/ui/menu.d.ts +29 -0
- package/types/api/ui/navigation-bar.d.ts +130 -0
- package/types/api/ui/pull-down-refresh.d.ts +50 -0
- package/types/api/ui/scroll.d.ts +114 -0
- package/types/api/ui/sticky.d.ts +32 -0
- package/types/api/ui/tab-bar.d.ts +196 -0
- package/types/api/ui/window.d.ts +71 -0
- package/types/api/worker/index.d.ts +83 -0
- package/types/api/wxml/index.d.ts +540 -0
- package/types/compile/compiler.d.ts +32 -0
- package/types/compile/config/h5.d.ts +134 -0
- package/types/compile/config/harmony.d.ts +118 -0
- package/types/compile/config/index.d.ts +8 -0
- package/types/compile/config/manifest.d.ts +155 -0
- package/types/compile/config/mini.d.ts +118 -0
- package/types/compile/config/plugin.d.ts +34 -0
- package/types/compile/config/project.d.ts +338 -0
- package/types/compile/config/rn.d.ts +85 -0
- package/types/compile/config/util.d.ts +179 -0
- package/types/compile/hooks.d.ts +13 -0
- package/types/compile/index.d.ts +11 -0
- package/types/compile/viteCompilerContext.d.ts +167 -0
- package/types/global.d.ts +428 -0
- package/types/index.d.ts +190 -0
- package/types/taro.api.d.ts +130 -0
- package/types/taro.component.d.ts +168 -0
- package/types/taro.config.d.ts +712 -0
- package/types/taro.lifecycle.d.ts +220 -0
- package/types/taro.runtime.d.ts +9 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace startSoterAuthentication {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 挑战因子。挑战因子为调用者为此次生物鉴权准备的用于签名的字符串关键识别信息,将作为 `resultJSON` 的一部分,供调用者识别本次请求。例如:如果场景为请求用户对某订单进行授权确认,则可以将订单号填入此参数。 */
|
|
7
|
+
challenge: string
|
|
8
|
+
/** 请求使用的可接受的生物认证方式 */
|
|
9
|
+
requestAuthModes: Array<keyof requestAuthModes>
|
|
10
|
+
/** 验证描述,即识别过程中显示在界面上的对话框提示内容 */
|
|
11
|
+
authContent?: string
|
|
12
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
13
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
14
|
+
/** 接口调用失败的回调函数 */
|
|
15
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
16
|
+
/** 接口调用成功的回调函数 */
|
|
17
|
+
success?: (result: SuccessCallbackResult) => void
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
21
|
+
/** 生物认证方式 */
|
|
22
|
+
authMode: string
|
|
23
|
+
/** 错误码 */
|
|
24
|
+
errCode: number
|
|
25
|
+
/** 错误信息 */
|
|
26
|
+
errMsg: string
|
|
27
|
+
/** 在设备安全区域(TEE)内获得的本机安全信息(如TEE名称版本号等以及防重放参数)以及本次认证信息(仅Android支持,本次认证的指纹ID)。具体说明见下文 */
|
|
28
|
+
resultJSON: string
|
|
29
|
+
/** 用SOTER安全密钥对 `resultJSON` 的签名(SHA256 with RSA/PSS, saltlen=20) */
|
|
30
|
+
resultJSONSignature: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface requestAuthModes {
|
|
34
|
+
/** 指纹识别 */
|
|
35
|
+
fingerPrint
|
|
36
|
+
/** 人脸识别 */
|
|
37
|
+
facial
|
|
38
|
+
/** 声纹识别
|
|
39
|
+
* @supported 暂未支持
|
|
40
|
+
*/
|
|
41
|
+
speech
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
namespace checkIsSupportSoterAuthentication {
|
|
46
|
+
interface Option {
|
|
47
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
48
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
49
|
+
/** 接口调用失败的回调函数 */
|
|
50
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
51
|
+
/** 接口调用成功的回调函数 */
|
|
52
|
+
success?: (result: SuccessCallbackResult) => void
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
56
|
+
/** 该设备支持的可被SOTER识别的生物识别方式 */
|
|
57
|
+
supportMode: Array<keyof requestAuthModes>
|
|
58
|
+
/** 调用信息 */
|
|
59
|
+
errMsg: string
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface requestAuthModes {
|
|
63
|
+
/** 指纹识别 */
|
|
64
|
+
fingerPrint
|
|
65
|
+
/** 人脸识别 */
|
|
66
|
+
facial
|
|
67
|
+
/** 声纹识别
|
|
68
|
+
* @supported 暂未支持
|
|
69
|
+
*/
|
|
70
|
+
speech
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
namespace checkIsSoterEnrolledInDevice {
|
|
75
|
+
interface Option {
|
|
76
|
+
/** 认证方式 */
|
|
77
|
+
checkAuthMode: keyof RequestAuthModes
|
|
78
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
79
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
80
|
+
/** 接口调用失败的回调函数 */
|
|
81
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
82
|
+
/** 接口调用成功的回调函数 */
|
|
83
|
+
success?: (result: SuccessCallbackResult) => void
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface RequestAuthModes {
|
|
87
|
+
/** 指纹识别 */
|
|
88
|
+
fingerPrint
|
|
89
|
+
/** 人脸识别 */
|
|
90
|
+
facial
|
|
91
|
+
/** 声纹识别
|
|
92
|
+
* @supported 暂未支持
|
|
93
|
+
*/
|
|
94
|
+
speech
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
98
|
+
/** 错误信息 */
|
|
99
|
+
errMsg: string
|
|
100
|
+
/** 是否已录入信息 */
|
|
101
|
+
isEnrolled: boolean
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface TaroStatic {
|
|
106
|
+
/** 开始 SOTER 生物认证。验证流程请参考[说明](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/bio-auth.html)。
|
|
107
|
+
*
|
|
108
|
+
* **resultJSON 说明**
|
|
109
|
+
* 此数据为设备TEE中,将传入的challenge和TEE内其他安全信息组成的数据进行组装而来的JSON,对下述字段的解释如下表。例子如下:
|
|
110
|
+
* | 字段名 | 说明 |
|
|
111
|
+
* |---|----|
|
|
112
|
+
* | raw | 调用者传入的challenge |
|
|
113
|
+
* | fid | (仅Android支持)本次生物识别认证的生物信息编号(如指纹识别则是指纹信息在本设备内部编号) |
|
|
114
|
+
* | counter | 防重放特征参数 |
|
|
115
|
+
* | tee_n | TEE名称(如高通或者trustonic等) |
|
|
116
|
+
* | tee_v | TEE版本号 |
|
|
117
|
+
* | fp_n | 指纹以及相关逻辑模块提供商(如FPC等) |
|
|
118
|
+
* | fp_v | 指纹以及相关模块版本号 |
|
|
119
|
+
* | cpu_id | 机器唯一识别ID |
|
|
120
|
+
* | uid | 概念同Android系统定义uid,即应用程序编号 |
|
|
121
|
+
* @supported weapp
|
|
122
|
+
* @example
|
|
123
|
+
* ```tsx
|
|
124
|
+
* Taro.startSoterAuthentication({
|
|
125
|
+
* requestAuthModes: ['fingerPrint'],
|
|
126
|
+
* challenge: '123456',
|
|
127
|
+
* authContent: '请用指纹解锁',
|
|
128
|
+
* success: function (res) { }
|
|
129
|
+
* })
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* ```json
|
|
133
|
+
* {
|
|
134
|
+
* "raw":"msg",
|
|
135
|
+
* "fid":"2",
|
|
136
|
+
* "counter":123,
|
|
137
|
+
* "tee_n":"TEE Name",
|
|
138
|
+
* "tee_v":"TEE Version",
|
|
139
|
+
* "fp_n":"Fingerprint Sensor Name",
|
|
140
|
+
* "fp_v":"Fingerprint Sensor Version",
|
|
141
|
+
* "cpu_id":"CPU Id",
|
|
142
|
+
* "uid":"21"
|
|
143
|
+
* }
|
|
144
|
+
* ```
|
|
145
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.startSoterAuthentication.html
|
|
146
|
+
*/
|
|
147
|
+
startSoterAuthentication(option: startSoterAuthentication.Option): Promise<startSoterAuthentication.SuccessCallbackResult>
|
|
148
|
+
|
|
149
|
+
/** 获取本机支持的 SOTER 生物认证方式
|
|
150
|
+
* @supported weapp
|
|
151
|
+
* @example
|
|
152
|
+
* ```tsx
|
|
153
|
+
* Taro.checkIsSupportSoterAuthentication({
|
|
154
|
+
* success: function (res) {
|
|
155
|
+
* // res.supportMode = [] 不具备任何被SOTER支持的生物识别方式
|
|
156
|
+
* // res.supportMode = ['fingerPrint'] 只支持指纹识别
|
|
157
|
+
* // res.supportMode = ['fingerPrint', 'facial'] 支持指纹识别和人脸识别
|
|
158
|
+
* }
|
|
159
|
+
* })
|
|
160
|
+
* ```
|
|
161
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSupportSoterAuthentication.html
|
|
162
|
+
*/
|
|
163
|
+
checkIsSupportSoterAuthentication(
|
|
164
|
+
option?: checkIsSupportSoterAuthentication.Option,
|
|
165
|
+
): Promise<checkIsSupportSoterAuthentication.SuccessCallbackResult>
|
|
166
|
+
|
|
167
|
+
/** 获取设备内是否录入如指纹等生物信息的接口
|
|
168
|
+
* @supported weapp
|
|
169
|
+
* @example
|
|
170
|
+
* ```tsx
|
|
171
|
+
* Taro.checkIsSoterEnrolledInDevice({
|
|
172
|
+
* checkAuthMode: 'fingerPrint',
|
|
173
|
+
* success: function (res) {
|
|
174
|
+
* console.log(res.isEnrolled)
|
|
175
|
+
* }
|
|
176
|
+
* })
|
|
177
|
+
* ```
|
|
178
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSoterEnrolledInDevice.html
|
|
179
|
+
*/
|
|
180
|
+
checkIsSoterEnrolledInDevice(
|
|
181
|
+
option: checkIsSoterEnrolledInDevice.Option,
|
|
182
|
+
): Promise<checkIsSoterEnrolledInDevice.SuccessCallbackResult>
|
|
183
|
+
}
|
|
184
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace requestSubscribeMessage {
|
|
5
|
+
interface BaseOption {
|
|
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
|
+
*/
|
|
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
|
|
19
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
20
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
21
|
+
/** 接口调用失败的回调函数 */
|
|
22
|
+
fail?: (result: FailCallbackResult) => void
|
|
23
|
+
/** 接口调用成功的回调函数 */
|
|
24
|
+
success?: (result: SuccessCallbackResult) => void
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type AtLeastOne<T, Keys extends keyof T = keyof T> =
|
|
28
|
+
Keys extends keyof T ? T & Required<Pick<T, Keys>> : never;
|
|
29
|
+
|
|
30
|
+
type Option = AtLeastOne<BaseOption, 'tmplIds' | 'entityIds'>;
|
|
31
|
+
|
|
32
|
+
interface FailCallbackResult extends TaroGeneral.CallbackResult {
|
|
33
|
+
/** 接口调用失败错误码 */
|
|
34
|
+
errCode: number
|
|
35
|
+
/** 接口调用失败错误信息 */
|
|
36
|
+
errMsg: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @example
|
|
41
|
+
* 表示用户同意订阅 zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE 这条消息
|
|
42
|
+
*
|
|
43
|
+
* ```json
|
|
44
|
+
* {
|
|
45
|
+
* "errMsg": "requestSubscribeMessage:ok",
|
|
46
|
+
* "zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE": "accept"
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
51
|
+
/** 动态的键,即模板id
|
|
52
|
+
* @name [TEMPLATE_ID]
|
|
53
|
+
* @type "accept" | "reject" | "ban"
|
|
54
|
+
*/
|
|
55
|
+
[TEMPLATE_ID: string]: keyof TemplateReflex | string
|
|
56
|
+
/** 用户订阅操作结果。
|
|
57
|
+
*
|
|
58
|
+
* | 枚举值 | 描述 |
|
|
59
|
+
* | --- | ---- |
|
|
60
|
+
* | subscribe | 订阅成功 |
|
|
61
|
+
*
|
|
62
|
+
* @supported alipay
|
|
63
|
+
*/
|
|
64
|
+
behavior?: string
|
|
65
|
+
/** 一次性订阅,是否勾选 总是保持以上选择,不再询问。
|
|
66
|
+
*
|
|
67
|
+
* | 枚举值 | 描述 |
|
|
68
|
+
* | --- | ---- |
|
|
69
|
+
* | true | 勾选 |
|
|
70
|
+
* | false | 未勾选 |
|
|
71
|
+
*
|
|
72
|
+
* @supported alipay
|
|
73
|
+
*/
|
|
74
|
+
keep?: boolean
|
|
75
|
+
/** 长期性订阅,是否点击 拒绝,不再询问。
|
|
76
|
+
*
|
|
77
|
+
* | 枚举值 | 描述 |
|
|
78
|
+
* | --- | ---- |
|
|
79
|
+
* | true | 点击 |
|
|
80
|
+
* | false | 未点击 |
|
|
81
|
+
*
|
|
82
|
+
* @supported alipay
|
|
83
|
+
*/
|
|
84
|
+
refuse?: boolean
|
|
85
|
+
/** 订阅数据
|
|
86
|
+
* @supported alipay
|
|
87
|
+
*/
|
|
88
|
+
result?: ISubscribeResult
|
|
89
|
+
/** 本次订阅过程是否弹出了订阅面板。
|
|
90
|
+
*
|
|
91
|
+
* | 枚举值 | 描述 |
|
|
92
|
+
* | --- | ---- |
|
|
93
|
+
* | true | 弹出 |
|
|
94
|
+
* | false | 未弹出 |
|
|
95
|
+
*
|
|
96
|
+
* @supported alipay
|
|
97
|
+
*/
|
|
98
|
+
show?: boolean
|
|
99
|
+
/** 接口调用成功时errMsg值为'requestSubscribeMessage:ok' */
|
|
100
|
+
errMsg: string
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface ISubscribeResult {
|
|
104
|
+
/** 订阅成功的模板列表 */
|
|
105
|
+
subscribeEntityIds: string[]
|
|
106
|
+
/** 最终订阅成功的模板列表 */
|
|
107
|
+
subscribedEntityIds: string[]
|
|
108
|
+
/** 未订阅的模板列表 */
|
|
109
|
+
unsubscribedEntityIds: string[]
|
|
110
|
+
/** 本次新增订阅成功的模板列表 */
|
|
111
|
+
currentSubscribedEntityIds: string[]
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** 模版消息订阅类型 */
|
|
115
|
+
interface TemplateReflex {
|
|
116
|
+
/**
|
|
117
|
+
* 表示用户同意订阅该条id对应的模板消息
|
|
118
|
+
* @supported weapp, alipay, tt
|
|
119
|
+
*/
|
|
120
|
+
accept
|
|
121
|
+
/**
|
|
122
|
+
* 表示用户拒绝订阅该条id对应的模板消息
|
|
123
|
+
* @supported weapp, alipay, tt
|
|
124
|
+
*/
|
|
125
|
+
reject
|
|
126
|
+
/**
|
|
127
|
+
* 表示已被后台封禁
|
|
128
|
+
* @supported weapp, tt
|
|
129
|
+
*/
|
|
130
|
+
ban
|
|
131
|
+
/**
|
|
132
|
+
* 表示该模板因为模板标题同名被后台过滤
|
|
133
|
+
* @supported weapp
|
|
134
|
+
*/
|
|
135
|
+
filter
|
|
136
|
+
/** 表示该条 id 对应的模版消息授权失败
|
|
137
|
+
* @supported tt
|
|
138
|
+
*/
|
|
139
|
+
fail
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
namespace requestSubscribeDeviceMessage {
|
|
144
|
+
interface Option {
|
|
145
|
+
/** 需要订阅的消息模板的 id 的集合,一次调用最多可订阅3条消息 */
|
|
146
|
+
tmplIds: string[]
|
|
147
|
+
/** 设备唯一序列号。由厂商分配,长度不能超过128字节。字符只接受数字,大小写字母,下划线(_)和连字符(-)。 */
|
|
148
|
+
sn: string
|
|
149
|
+
/** 设备票据,5分钟内有效。 */
|
|
150
|
+
snTicket: string
|
|
151
|
+
/** 设备型号 id 。通过微信公众平台注册设备获得。 */
|
|
152
|
+
modelId: string
|
|
153
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
154
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
155
|
+
/** 接口调用失败的回调函数 */
|
|
156
|
+
fail?: (result: FailCallbackResult) => void
|
|
157
|
+
/** 接口调用成功的回调函数 */
|
|
158
|
+
success?: (result: SuccessCallbackResult) => void
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
interface FailCallbackResult extends TaroGeneral.CallbackResult {
|
|
162
|
+
/** 接口调用失败错误码,有可能为空 */
|
|
163
|
+
errCode: number
|
|
164
|
+
/** 接口调用失败错误信息 */
|
|
165
|
+
errMsg: string
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* @example
|
|
170
|
+
* 表示用户同意订阅 zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE 这条消息
|
|
171
|
+
* ```json
|
|
172
|
+
* {
|
|
173
|
+
* "errMsg": "requestSubscribeDeviceMessage:ok",
|
|
174
|
+
* "zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE": "accept"
|
|
175
|
+
* }
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
179
|
+
/** [TEMPLATE_ID]是动态的键,即模板id
|
|
180
|
+
* @name [TEMPLATE_ID]
|
|
181
|
+
* @type "accept" | "reject" | "ban" | "filter" | "acceptWithAudio"
|
|
182
|
+
*/
|
|
183
|
+
[TEMPLATE_ID: string]: keyof TemplateReflex | string
|
|
184
|
+
/** 接口调用成功时errMsg值为'requestSubscribeMessage:ok' */
|
|
185
|
+
errMsg: string
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** 模版消息订阅类型 */
|
|
189
|
+
interface TemplateReflex {
|
|
190
|
+
/** 表示用户同意订阅该条id对应的模板消息 */
|
|
191
|
+
accept
|
|
192
|
+
/** 表示用户拒绝订阅该条id对应的模板消息 */
|
|
193
|
+
reject
|
|
194
|
+
/** 表示已被后台封禁 */
|
|
195
|
+
ban
|
|
196
|
+
/** 表示该模板因为模板标题同名被后台过滤 */
|
|
197
|
+
filter
|
|
198
|
+
/** 表示用户接收订阅消息并开启了语音提醒 */
|
|
199
|
+
acceptWithAudio
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
namespace unsubscribeMessage {
|
|
204
|
+
interface Option {
|
|
205
|
+
/** 需要取消订阅的消息模板 id 集合(注意:1、一次性模板 id 和长期性模板 id 不可同时使用,2、一次最多传入三个模板 id)。 */
|
|
206
|
+
entityIds: string[]
|
|
207
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
208
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
209
|
+
/** 接口调用失败的回调函数 */
|
|
210
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
211
|
+
/** 接口调用成功的回调函数 */
|
|
212
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
interface TaroStatic {
|
|
217
|
+
/** 请求订阅消息
|
|
218
|
+
*
|
|
219
|
+
* 注意:[2.8.2](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为或者发起支付回调后,才可以调起订阅消息界面。
|
|
220
|
+
* @supported weapp, tt
|
|
221
|
+
* @example
|
|
222
|
+
* ```tsx
|
|
223
|
+
* Taro.requestSubscribeMessage({
|
|
224
|
+
* tmplIds: [''],
|
|
225
|
+
* success: function (res) { }
|
|
226
|
+
* })
|
|
227
|
+
* ```
|
|
228
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html
|
|
229
|
+
*/
|
|
230
|
+
requestSubscribeMessage(
|
|
231
|
+
option: requestSubscribeMessage.Option
|
|
232
|
+
): Promise<requestSubscribeMessage.SuccessCallbackResult | requestSubscribeMessage.FailCallbackResult>
|
|
233
|
+
|
|
234
|
+
/** 订阅设备消息接口,调用后弹出授权框,用户同意后会允许开发者给用户发送订阅模版消息。当用户点击“允许”按钮时,模板消息会被添加到用户的小程序设置页,通过 wx.getSetting 接口可获取用户对相关模板消息的订阅状态。
|
|
235
|
+
* @supported weapp
|
|
236
|
+
* @example
|
|
237
|
+
* ```tsx
|
|
238
|
+
* Taro.requestSubscribeDeviceMessage({
|
|
239
|
+
* tmplIds: ['xxxxx'],
|
|
240
|
+
* sn: 'xxxx',
|
|
241
|
+
* snTicket: 'xxxxx',
|
|
242
|
+
* modelId: 'xxx',
|
|
243
|
+
* success(res) {
|
|
244
|
+
* console.log(res)
|
|
245
|
+
* },
|
|
246
|
+
* fail(res) {
|
|
247
|
+
* console.log(res)
|
|
248
|
+
* }
|
|
249
|
+
* })
|
|
250
|
+
* ```
|
|
251
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeDeviceMessage.html
|
|
252
|
+
*/
|
|
253
|
+
requestSubscribeDeviceMessage(
|
|
254
|
+
option: requestSubscribeDeviceMessage.Option
|
|
255
|
+
): Promise<requestSubscribeDeviceMessage.SuccessCallbackResult | requestSubscribeDeviceMessage.FailCallbackResult>
|
|
256
|
+
|
|
257
|
+
/** 取消当前用户已订阅的消息
|
|
258
|
+
* @supported alipay
|
|
259
|
+
* @example
|
|
260
|
+
* ```tsx
|
|
261
|
+
* Taro.unsubscribeMessage({
|
|
262
|
+
* entityIds: [
|
|
263
|
+
* 'ac768fca1ce245ccae9404bb5243c49b',
|
|
264
|
+
* '9aa357acb7c6434aba294aded1cdfb7c',
|
|
265
|
+
* ],
|
|
266
|
+
* success(res) {
|
|
267
|
+
* console.log(res);
|
|
268
|
+
* },
|
|
269
|
+
* fail(err) {
|
|
270
|
+
* console.log(err);
|
|
271
|
+
* }
|
|
272
|
+
* })
|
|
273
|
+
* ```
|
|
274
|
+
* @see https://opendocs.alipay.com/mini/07vg26?pathHash=8c9630ac
|
|
275
|
+
*/
|
|
276
|
+
unsubscribeMessage(option: unsubscribeMessage.Option): void
|
|
277
|
+
|
|
278
|
+
/** 小程序消息订阅服务,包括取消订阅和查询订阅;订阅操作详见 [form 表单](https://smartprogram.baidu.com/docs/develop/component/formlist_form/)。
|
|
279
|
+
* @supported swan
|
|
280
|
+
* @example
|
|
281
|
+
* ```tsx
|
|
282
|
+
* Taro.subscribeService({
|
|
283
|
+
* templateId: 'BD0003',
|
|
284
|
+
* subscribeId: '8026',
|
|
285
|
+
* type: 'query',
|
|
286
|
+
* success(res) {
|
|
287
|
+
* Taro.showModal({
|
|
288
|
+
* title: 'success',
|
|
289
|
+
* content: JSON.stringify(res)
|
|
290
|
+
* })
|
|
291
|
+
* },
|
|
292
|
+
* fail(err) {
|
|
293
|
+
* Taro.showModal({
|
|
294
|
+
* title: 'fail',
|
|
295
|
+
* content: JSON.stringify(err)
|
|
296
|
+
* })
|
|
297
|
+
* }
|
|
298
|
+
* })
|
|
299
|
+
* ```
|
|
300
|
+
* @see https://smartprogram.baidu.com/docs/develop/api/open/swan-subscribeService/
|
|
301
|
+
*/
|
|
302
|
+
subscribeService(option: subscribeService.Option): void
|
|
303
|
+
|
|
304
|
+
}
|
|
305
|
+
}
|