@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,87 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace chooseInvoiceTitle {
|
|
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
|
+
|
|
14
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
15
|
+
/** 银行账号 */
|
|
16
|
+
bankAccount: string
|
|
17
|
+
/** 银行名称 */
|
|
18
|
+
bankName: string
|
|
19
|
+
/** 单位地址 */
|
|
20
|
+
companyAddress: string
|
|
21
|
+
/** 错误信息 */
|
|
22
|
+
errMsg: string
|
|
23
|
+
/** 抬头税号 */
|
|
24
|
+
taxNumber: string
|
|
25
|
+
/** 手机号码 */
|
|
26
|
+
telephone: string
|
|
27
|
+
/** 抬头名称 */
|
|
28
|
+
title: string
|
|
29
|
+
/** 抬头类型 */
|
|
30
|
+
type: keyof InvoiceType
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** 抬头类型 */
|
|
34
|
+
interface InvoiceType {
|
|
35
|
+
0: '单位'
|
|
36
|
+
1: '个人'
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
namespace chooseInvoice {
|
|
41
|
+
interface Option {
|
|
42
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
43
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
44
|
+
/** 接口调用失败的回调函数 */
|
|
45
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
46
|
+
/** 接口调用成功的回调函数 */
|
|
47
|
+
success?: (result: SuccessCallbackResult) => void
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
51
|
+
/** 用户选中的发票信息,格式为一个 JSON 字符串,包含三个字段: card_id:所选发票卡券的 cardId,encrypt_code:所选发票卡券的加密 code,报销方可以通过 cardId 和 encryptCode 获得报销发票的信息,app_id: 发票方的 appId。 */
|
|
52
|
+
invoiceInfo: string
|
|
53
|
+
/** 调用结果 */
|
|
54
|
+
errMsg: string
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface TaroStatic {
|
|
59
|
+
/** 选择用户的发票抬头。当前小程序必须关联一个公众号,且这个公众号是完成了[微信认证](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1496554031_RD4xe)的,才能调用 chooseInvoiceTitle。
|
|
60
|
+
* @supported weapp
|
|
61
|
+
* @example
|
|
62
|
+
* ```tsx
|
|
63
|
+
* Taro.chooseInvoiceTitle({
|
|
64
|
+
* success: function(res) {}
|
|
65
|
+
* })
|
|
66
|
+
* ```
|
|
67
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoiceTitle.html
|
|
68
|
+
*/
|
|
69
|
+
chooseInvoiceTitle(option?: chooseInvoiceTitle.Option): Promise<chooseInvoiceTitle.SuccessCallbackResult>
|
|
70
|
+
|
|
71
|
+
/** 选择用户已有的发票。
|
|
72
|
+
*
|
|
73
|
+
* **通过 cardId 和 encryptCode 获得报销发票的信息**
|
|
74
|
+
* 请参考[微信电子发票文档](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=21517918939oae3U)中,「查询报销发票信息」部分。
|
|
75
|
+
* 其中 `access_token` 的获取请参考[auth.getAccessToken](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html)文档
|
|
76
|
+
* @supported weapp
|
|
77
|
+
* @example
|
|
78
|
+
* ```tsx
|
|
79
|
+
* Taro.chooseInvoice({
|
|
80
|
+
* success: function (res) {}
|
|
81
|
+
* })
|
|
82
|
+
* ```
|
|
83
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoice.html
|
|
84
|
+
*/
|
|
85
|
+
chooseInvoice(option?: chooseInvoice.Option): Promise<chooseInvoice.SuccessCallbackResult>
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace chooseLicensePlate {
|
|
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
|
+
|
|
14
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
15
|
+
/** 用户选择的车牌号 */
|
|
16
|
+
plateNumber: string
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface TaroStatic {
|
|
21
|
+
/** 选择车牌号
|
|
22
|
+
* @supported weapp
|
|
23
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/license-plate/wx.chooseLicensePlate.html
|
|
24
|
+
*/
|
|
25
|
+
chooseLicensePlate(option?: chooseLicensePlate.Option): Promise<chooseLicensePlate.SuccessCallbackResult>
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace pluginLogin {
|
|
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
|
+
/** 用于换取 openpid 的凭证(有效期五分钟)。插件开发者可以用此 code 在开发者服务器后台调用 [auth.getPluginOpenPId](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/user-info/auth.getPluginOpenPId.html) 换取 openpid。 */
|
|
15
|
+
code: string
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
namespace login {
|
|
20
|
+
interface Option {
|
|
21
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
22
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
23
|
+
/** 接口调用失败的回调函数 */
|
|
24
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
25
|
+
/** 接口调用成功的回调函数 */
|
|
26
|
+
success?: (result: SuccessCallbackResult) => void
|
|
27
|
+
/** 超时时间,单位ms */
|
|
28
|
+
timeout?: number
|
|
29
|
+
/** 未登录时, 是否强制调起登录框
|
|
30
|
+
* @supported tt
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
force?: boolean
|
|
34
|
+
}
|
|
35
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
36
|
+
/** 用户登录凭证(有效期五分钟)。开发者需要在开发者服务器后台调用 [auth.code2Session](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html),使用 code 换取 openid 和 session_key 等信息 */
|
|
37
|
+
code: string
|
|
38
|
+
/** 调用结果 */
|
|
39
|
+
errMsg: string
|
|
40
|
+
/** 用于标识当前设备, 无论登录与否都会返回, 有效期 5 分钟。
|
|
41
|
+
* @supported tt
|
|
42
|
+
*/
|
|
43
|
+
anonymousCode?: string
|
|
44
|
+
/** 判断在当前 APP(头条、抖音等)是否处于登录状态。
|
|
45
|
+
* @supported tt
|
|
46
|
+
*/
|
|
47
|
+
isLogin?: boolean
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
namespace checkSession {
|
|
52
|
+
interface Option {
|
|
53
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
54
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
55
|
+
/** 接口调用失败的回调函数 */
|
|
56
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
57
|
+
/** 接口调用成功的回调函数 */
|
|
58
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface TaroStatic {
|
|
63
|
+
/** **该接口仅在小程序插件中可调用**,调用接口获得插件用户标志凭证(code)。插件可以此凭证换取用于识别用户的标识 openpid。用户不同、宿主小程序不同或插件不同的情况下,该标识均不相同,即当且仅当同一个用户在同一个宿主小程序中使用同一个插件时,openpid 才会相同
|
|
64
|
+
* @supported weapp
|
|
65
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.pluginLogin.html
|
|
66
|
+
*/
|
|
67
|
+
pluginLogin(option?: pluginLogin.Option): Promise<pluginLogin.SuccessCallbackResult>
|
|
68
|
+
|
|
69
|
+
/** 调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户的唯一标识(openid)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
|
|
70
|
+
* @supported weapp, jd, qq, tt, harmony_hybrid
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* Taro.login({
|
|
74
|
+
* success: function (res) {
|
|
75
|
+
* if (res.code) {
|
|
76
|
+
* //发起网络请求
|
|
77
|
+
* Taro.request({
|
|
78
|
+
* url: 'https://test.com/onLogin',
|
|
79
|
+
* data: {
|
|
80
|
+
* code: res.code
|
|
81
|
+
* }
|
|
82
|
+
* })
|
|
83
|
+
* } else {
|
|
84
|
+
* console.log('登录失败!' + res.errMsg)
|
|
85
|
+
* }
|
|
86
|
+
* }
|
|
87
|
+
* })
|
|
88
|
+
* ```
|
|
89
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html
|
|
90
|
+
*/
|
|
91
|
+
login(option?: login.Option): Promise<login.SuccessCallbackResult>
|
|
92
|
+
|
|
93
|
+
/** 检查登录态是否过期。
|
|
94
|
+
*
|
|
95
|
+
* 通过 Taro.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用 Taro.checkSession 接口检测当前用户登录态是否有效。
|
|
96
|
+
*
|
|
97
|
+
* 登录态过期后开发者可以再调用 Taro.login 获取新的用户登录态。调用 Taro.checkSession 成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
|
|
98
|
+
* @supported weapp, swan, qq, tt
|
|
99
|
+
* @example
|
|
100
|
+
* ```tsx
|
|
101
|
+
* Taro.checkSession({
|
|
102
|
+
* success: function () {
|
|
103
|
+
* //session_key 未过期,并且在本生命周期一直有效
|
|
104
|
+
* },
|
|
105
|
+
* fail: function () {
|
|
106
|
+
* // session_key 已经失效,需要重新执行登录流程
|
|
107
|
+
* Taro.login() //重新登录
|
|
108
|
+
* }
|
|
109
|
+
* })
|
|
110
|
+
* ```
|
|
111
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.checkSession.html
|
|
112
|
+
*/
|
|
113
|
+
checkSession(option?: checkSession.Option): Promise<TaroGeneral.CallbackResult>
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace checkIsAddedToMyMiniProgram {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
|
+
/** 接口调用失败的回调函数 */
|
|
9
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 接口调用成功的回调函数 */
|
|
11
|
+
success?: (res: SuccessCallbackResult) => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
15
|
+
/**是否被添加至 「我的小程序」 */
|
|
16
|
+
added: boolean
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface TaroStatic {
|
|
21
|
+
/**
|
|
22
|
+
* 检查小程序是否被添加至 「我的小程序」
|
|
23
|
+
* @supported weapp
|
|
24
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/my-miniprogram/wx.checkIsAddedToMyMiniProgram.html
|
|
25
|
+
*/
|
|
26
|
+
checkIsAddedToMyMiniProgram(option?: checkIsAddedToMyMiniProgram.Option): void
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace showRedPackage {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 封面地址 */
|
|
7
|
+
url: string
|
|
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
|
+
interface TaroStatic {
|
|
18
|
+
/** 拉取h5领取红包封面页。获取参考红包封面地址参考 [微信红包封面开发平台](https://cover.weixin.qq.com/cgi-bin/mmcover-bin/readtemplate?t=page/index#/doc?page=introduce)。
|
|
19
|
+
* @supported weapp
|
|
20
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/redpackage/wx.showRedPackage.html
|
|
21
|
+
*/
|
|
22
|
+
showRedPackage(option?: showRedPackage.Option): Promise<TaroGeneral.CallbackResult>
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace openSetting {
|
|
5
|
+
interface Option {
|
|
6
|
+
/**
|
|
7
|
+
* 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
|
+
withSubscriptions?: boolean
|
|
11
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
12
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
13
|
+
/** 接口调用失败的回调函数 */
|
|
14
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
15
|
+
/** 接口调用成功的回调函数 */
|
|
16
|
+
success?: (result: SuccessCallbackResult) => void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
20
|
+
/** 用户授权结果 */
|
|
21
|
+
authSetting: AuthSetting
|
|
22
|
+
/** 用户订阅消息设置,接口参数 withSubscriptions 值为 true 时才会返回。 */
|
|
23
|
+
subscriptionsSetting: SubscriptionsSetting
|
|
24
|
+
/** 调用结果 */
|
|
25
|
+
errMsg: string
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
namespace getSetting {
|
|
30
|
+
interface Option {
|
|
31
|
+
/**
|
|
32
|
+
* 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。
|
|
33
|
+
*/
|
|
34
|
+
withSubscriptions?: boolean
|
|
35
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
36
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
37
|
+
/** 接口调用失败的回调函数 */
|
|
38
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
39
|
+
/** 接口调用成功的回调函数 */
|
|
40
|
+
success?: (result: SuccessCallbackResult) => void
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
44
|
+
/** 用户授权结果 */
|
|
45
|
+
authSetting: AuthSetting
|
|
46
|
+
/** 用户订阅消息设置,接口参数 withSubscriptions 值为 true 时才会返回。 */
|
|
47
|
+
subscriptionsSetting: SubscriptionsSetting
|
|
48
|
+
/** 在插件中调用时,当前宿主小程序的用户授权结果 */
|
|
49
|
+
miniprogramAuthSetting: AuthSetting
|
|
50
|
+
/** 调用结果 */
|
|
51
|
+
errMsg: string
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** 用户授权设置信息,详情参考[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)
|
|
56
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html
|
|
57
|
+
*/
|
|
58
|
+
interface AuthSetting {
|
|
59
|
+
/** 是否授权用户信息,对应接口 [Taro.getUserInfo](/docs/apis/open-api/user-info/getUserInfo) */
|
|
60
|
+
'scope.userInfo'?: boolean
|
|
61
|
+
/** 是否授权地理位置,对应接口 [Taro.getLocation](/docs/apis/location/getLocation), [Taro.chooseLocation](/docs/apis/location/chooseLocation) */
|
|
62
|
+
'scope.userLocation'?: boolean
|
|
63
|
+
/** 是否授权通讯地址,对应接口 [Taro.chooseAddress](/docs/apis/open-api/address/chooseAddress) */
|
|
64
|
+
'scope.address'?: boolean
|
|
65
|
+
/** 是否授权发票抬头,对应接口 [Taro.chooseInvoiceTitle](/docs/apis/open-api/invoice/chooseInvoiceTitle) */
|
|
66
|
+
'scope.invoiceTitle'?: boolean
|
|
67
|
+
/** 是否授权获取发票,对应接口 [Taro.chooseInvoice](/docs/apis/open-api/invoice/chooseInvoice) */
|
|
68
|
+
'scope.invoice'?: boolean
|
|
69
|
+
/** 是否授权微信运动步数,对应接口 [Taro.getWeRunData](/docs/apis/open-api/werun/getWeRunData) */
|
|
70
|
+
'scope.werun'?: boolean
|
|
71
|
+
/** 是否授权录音功能,对应接口 [Taro.startRecord](/docs/apis/media/recorder/startRecord) */
|
|
72
|
+
'scope.record'?: boolean
|
|
73
|
+
/** 是否授权保存到相册 [Taro.saveImageToPhotosAlbum](/docs/apis/media/image/saveImageToPhotosAlbum), [Taro.saveVideoToPhotosAlbum](/docs/apis/media/video/saveVideoToPhotosAlbum) */
|
|
74
|
+
'scope.writePhotosAlbum'?: boolean
|
|
75
|
+
/** 是否授权摄像头,对应 [camera](/docs/components/media/camera) 组件 */
|
|
76
|
+
'scope.camera'?: boolean
|
|
77
|
+
/** 是否授权小程序在后台运行蓝牙,对应接口 [Taro.openBluetoothAdapterBackground](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/(wx.openBluetoothAdapterBackground).html) */
|
|
78
|
+
'scope.bluetoothBackground'?: boolean
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** 订阅消息设置
|
|
82
|
+
*
|
|
83
|
+
* 注意事项
|
|
84
|
+
* - itemSettings 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。
|
|
85
|
+
* @example
|
|
86
|
+
* ```tsx
|
|
87
|
+
* Taro.getSetting({
|
|
88
|
+
* withSubscriptions: true,
|
|
89
|
+
* success (res) {
|
|
90
|
+
* console.log(res.authSetting)
|
|
91
|
+
* // res.authSetting = {
|
|
92
|
+
* // "scope.userInfo": true,
|
|
93
|
+
* // "scope.userLocation": true
|
|
94
|
+
* // }
|
|
95
|
+
* console.log(res.subscriptionsSetting)
|
|
96
|
+
* // res.subscriptionsSetting = {
|
|
97
|
+
* // mainSwitch: true, // 订阅消息总开关
|
|
98
|
+
* // itemSettings: { // 每一项开关
|
|
99
|
+
* // SYS_MSG_TYPE_INTERACTIVE: 'accept', // 小游戏系统订阅消息
|
|
100
|
+
* // SYS_MSG_TYPE_RANK: 'accept'
|
|
101
|
+
* // zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: 'reject', // 普通一次性订阅消息
|
|
102
|
+
* // ke_OZC_66gZxALLcsuI7ilCJSP2OJ2vWo2ooUPpkWrw: 'ban',
|
|
103
|
+
* // }
|
|
104
|
+
* // }
|
|
105
|
+
* }
|
|
106
|
+
* })
|
|
107
|
+
* ```
|
|
108
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/SubscriptionsSetting.html
|
|
109
|
+
*/
|
|
110
|
+
interface SubscriptionsSetting {
|
|
111
|
+
/** 订阅消息总开关,true 为开启,false 为关闭 */
|
|
112
|
+
mainSwitch: boolean
|
|
113
|
+
/** 每一项订阅消息的订阅状态。itemSettings对象的键为一次性订阅消息的模板id或系统订阅消息的类型
|
|
114
|
+
* - 一次性订阅消息使用方法详见 [Taro.requestSubscribeMessage](/docs/apis/open-api/subscribe-message/requestSubscribeMessage)
|
|
115
|
+
* - 永久订阅消息(仅小游戏可用)使用方法详见 [Taro.requestSubscribeSystemMessage](https://developers.weixin.qq.com/minigame/dev/api/open-api/subscribe-message/wx.requestSubscribeSystemMessage.html)
|
|
116
|
+
* @type "accept" | "reject" | "ban"
|
|
117
|
+
*/
|
|
118
|
+
itemSettings: {
|
|
119
|
+
[TEMPLATE_ID: string]: keyof SubscriptionsSetting.TemplateReflex | string
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
namespace SubscriptionsSetting {
|
|
124
|
+
/** 模版消息订阅类型 */
|
|
125
|
+
interface TemplateReflex {
|
|
126
|
+
/** 表示用户同意订阅该条id对应的模板消息 */
|
|
127
|
+
accept
|
|
128
|
+
/** 表示用户拒绝订阅该条id对应的模板消息 */
|
|
129
|
+
reject
|
|
130
|
+
/** 表示已被后台封禁 */
|
|
131
|
+
ban
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface TaroStatic {
|
|
136
|
+
/** 调起客户端小程序设置界面,返回用户设置的操作结果。**设置界面只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
|
|
137
|
+
*
|
|
138
|
+
* 注意:[2.3.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为后,才可以跳转打开设置页,管理授权信息。[详情](https://developers.weixin.qq.com/community/develop/doc/000cea2305cc5047af5733de751008)
|
|
139
|
+
* @supported weapp, alipay, swan, jd, qq, tt, rn, harmony_hybrid
|
|
140
|
+
* @example
|
|
141
|
+
* ```tsx
|
|
142
|
+
* Taro.openSetting({
|
|
143
|
+
* success: function (res) {
|
|
144
|
+
* console.log(res.authSetting)
|
|
145
|
+
* // res.authSetting = {
|
|
146
|
+
* // "scope.userInfo": true,
|
|
147
|
+
* // "scope.userLocation": true
|
|
148
|
+
* // }
|
|
149
|
+
* }
|
|
150
|
+
* })
|
|
151
|
+
* ```
|
|
152
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.openSetting.html
|
|
153
|
+
*/
|
|
154
|
+
openSetting(option?: openSetting.Option): Promise<openSetting.SuccessCallbackResult>
|
|
155
|
+
|
|
156
|
+
/** 获取用户的当前设置。**返回值中只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
|
|
157
|
+
* @supported weapp, alipay, swan, jd, qq, tt, rn, harmony_hybrid
|
|
158
|
+
* @example
|
|
159
|
+
* ```tsx
|
|
160
|
+
* Taro.getSetting({
|
|
161
|
+
* success: function (res) {
|
|
162
|
+
* console.log(res.authSetting)
|
|
163
|
+
* // res.authSetting = {
|
|
164
|
+
* // "scope.userInfo": true,
|
|
165
|
+
* // "scope.userLocation": true
|
|
166
|
+
* // }
|
|
167
|
+
* }
|
|
168
|
+
* })
|
|
169
|
+
* ```
|
|
170
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.getSetting.html
|
|
171
|
+
*/
|
|
172
|
+
getSetting(option?: getSetting.Option): Promise<getSetting.SuccessCallbackResult>
|
|
173
|
+
}
|
|
174
|
+
}
|