@tarojs/taro 3.5.0-canary.1 → 3.5.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.
Files changed (109) hide show
  1. package/html.css +50 -14
  2. package/html5.css +167 -64
  3. package/index.js +3 -4
  4. package/package.json +21 -11
  5. package/types/api/ad/index.d.ts +2 -2
  6. package/types/api/ai/face.d.ts +133 -0
  7. package/types/api/ai/visionkit.d.ts +303 -0
  8. package/types/api/base/crypto.d.ts +90 -0
  9. package/types/api/base/debug.d.ts +152 -13
  10. package/types/api/base/env.d.ts +2 -1
  11. package/types/api/base/index.d.ts +11 -3
  12. package/types/api/base/performance.d.ts +195 -0
  13. package/types/api/base/system.d.ts +541 -103
  14. package/types/api/base/update.d.ts +60 -8
  15. package/types/api/base/weapp/app-event.d.ts +99 -37
  16. package/types/api/base/weapp/life-cycle.d.ts +142 -2
  17. package/types/api/canvas/index.d.ts +151 -137
  18. package/types/api/cloud/index.d.ts +17 -2
  19. package/types/api/data-analysis/index.d.ts +1 -1
  20. package/types/api/device/accelerometer.d.ts +6 -6
  21. package/types/api/device/accessibility.d.ts +26 -0
  22. package/types/api/device/battery.d.ts +2 -2
  23. package/types/api/device/{ble.d.ts → bluetooth-ble.d.ts} +228 -62
  24. package/types/api/device/bluetooth-peripheral.d.ts +430 -0
  25. package/types/api/device/bluetooth.d.ts +67 -2
  26. package/types/api/device/calendar.d.ts +88 -0
  27. package/types/api/device/clipboard.d.ts +2 -2
  28. package/types/api/device/compass.d.ts +3 -3
  29. package/types/api/device/contact.d.ts +74 -50
  30. package/types/api/device/gyroscope.d.ts +6 -6
  31. package/types/api/device/iBeacon.d.ts +33 -19
  32. package/types/api/{ui → device}/keyboard.d.ts +1 -1
  33. package/types/api/device/{performance.d.ts → memory.d.ts} +5 -5
  34. package/types/api/device/motion.d.ts +3 -3
  35. package/types/api/device/network.d.ts +56 -15
  36. package/types/api/device/nfc.d.ts +1089 -13
  37. package/types/api/device/phone.d.ts +1 -1
  38. package/types/api/device/scan.d.ts +1 -1
  39. package/types/api/device/screen.d.ts +42 -14
  40. package/types/api/device/vibrate.d.ts +6 -2
  41. package/types/api/device/wifi.d.ts +44 -9
  42. package/types/api/ext/index.d.ts +2 -2
  43. package/types/api/files/index.d.ts +392 -205
  44. package/types/api/framework/index.d.ts +5 -4
  45. package/types/api/location/index.d.ts +156 -53
  46. package/types/api/media/audio.d.ts +629 -38
  47. package/types/api/media/background-audio.d.ts +9 -9
  48. package/types/api/media/camera.d.ts +41 -22
  49. package/types/api/media/editor.d.ts +22 -2
  50. package/types/api/media/image.d.ts +64 -35
  51. package/types/api/media/live.d.ts +66 -6
  52. package/types/api/media/map.d.ts +474 -54
  53. package/types/api/media/media-recorder.d.ts +92 -0
  54. package/types/api/media/recorder.d.ts +21 -21
  55. package/types/api/media/video-decoder.d.ts +117 -0
  56. package/types/api/media/video-processing.d.ts +11 -7
  57. package/types/api/media/video.d.ts +47 -18
  58. package/types/api/media/voip.d.ts +290 -0
  59. package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +65 -27
  60. package/types/api/network/download.d.ts +61 -19
  61. package/types/api/network/request.d.ts +129 -41
  62. package/types/api/network/tcp.d.ts +181 -0
  63. package/types/api/network/udp.d.ts +154 -83
  64. package/types/api/network/upload.d.ts +55 -28
  65. package/types/api/network/websocket.d.ts +20 -19
  66. package/types/api/open-api/address.d.ts +1 -1
  67. package/types/api/open-api/authorize.d.ts +42 -3
  68. package/types/api/open-api/channels.d.ts +178 -0
  69. package/types/api/open-api/facial.d.ts +3 -0
  70. package/types/api/open-api/favorites.d.ts +100 -0
  71. package/types/api/open-api/group.d.ts +59 -0
  72. package/types/api/open-api/invoice.d.ts +2 -2
  73. package/types/api/open-api/license-plate.d.ts +27 -0
  74. package/types/api/open-api/login.d.ts +21 -0
  75. package/types/api/open-api/redpackage.d.ts +24 -0
  76. package/types/api/open-api/settings.d.ts +82 -17
  77. package/types/api/open-api/soter.d.ts +2 -2
  78. package/types/api/open-api/subscribe-message.d.ts +89 -4
  79. package/types/api/open-api/user-info.d.ts +56 -19
  80. package/types/api/open-api/werun.d.ts +33 -6
  81. package/types/api/payment/index.d.ts +119 -0
  82. package/types/api/route/index.d.ts +18 -14
  83. package/types/api/share/index.d.ts +192 -9
  84. package/types/api/storage/index.d.ts +38 -92
  85. package/types/api/swan/index.d.ts +1 -1
  86. package/types/api/ui/animation.d.ts +105 -155
  87. package/types/api/ui/background.d.ts +4 -2
  88. package/types/api/ui/custom-component.d.ts +1 -1
  89. package/types/api/ui/fonts.d.ts +27 -31
  90. package/types/api/ui/interaction.d.ts +6 -6
  91. package/types/api/ui/menu.d.ts +1 -1
  92. package/types/api/ui/navigation-bar.d.ts +6 -5
  93. package/types/api/ui/pull-down-refresh.d.ts +2 -2
  94. package/types/api/ui/scroll.d.ts +75 -7
  95. package/types/api/ui/sticky.d.ts +4 -4
  96. package/types/api/ui/tab-bar.d.ts +8 -8
  97. package/types/api/ui/window.d.ts +22 -2
  98. package/types/api/worker/index.d.ts +9 -1
  99. package/types/api/wxml/index.d.ts +116 -112
  100. package/types/compile.d.ts +57 -6
  101. package/types/global.d.ts +142 -111
  102. package/types/taro.api.d.ts +79 -62
  103. package/types/taro.component.d.ts +21 -65
  104. package/types/taro.config.d.ts +31 -0
  105. package/types/taro.extend.d.ts +31 -18
  106. package/types/taro.hooks.d.ts +55 -3
  107. package/types/taro.lifecycle.d.ts +21 -14
  108. package/LICENSE +0 -21
  109. package/types/api/open-api/payment.d.ts +0 -61
@@ -0,0 +1,178 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace reserveChannelsLive {
5
+ interface Option {
6
+ /** 预告 id,通过 [getChannelsLiveNoticeInfo](./getChannelsLiveNoticeInfo) 接口获取 */
7
+ noticeId: string
8
+ }
9
+ }
10
+
11
+ namespace openChannelsUserProfile {
12
+ interface Option {
13
+ /** 视频号 id */
14
+ finderUserName: string
15
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
16
+ complete?: (res: TaroGeneral.CallbackResult) => void
17
+ /** 接口调用失败的回调函数 */
18
+ fail?: (res: TaroGeneral.CallbackResult) => void
19
+ /** 接口调用成功的回调函数 */
20
+ success?: (result: TaroGeneral.CallbackResult) => void
21
+ }
22
+ }
23
+
24
+ namespace openChannelsLive {
25
+ interface Option {
26
+ /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
27
+ finderUserName: string
28
+ /** 直播 feedId,通过 getChannelsLiveInfo 接口获取 */
29
+ feedId?: string
30
+ /** 直播 nonceId,通过 getChannelsLiveInfo 接口获取 */
31
+ nonceId?: string
32
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
33
+ complete?: (res: TaroGeneral.CallbackResult) => void
34
+ /** 接口调用失败的回调函数 */
35
+ fail?: (res: TaroGeneral.CallbackResult) => void
36
+ /** 接口调用成功的回调函数 */
37
+ success?: (result: TaroGeneral.CallbackResult) => void
38
+ }
39
+ }
40
+
41
+ namespace openChannelsEvent {
42
+ interface Option {
43
+ /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
44
+ finderUserName: string
45
+ /** 活动 id */
46
+ eventId: string
47
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
48
+ complete?: (res: TaroGeneral.CallbackResult) => void
49
+ /** 接口调用失败的回调函数 */
50
+ fail?: (res: TaroGeneral.CallbackResult) => void
51
+ /** 接口调用成功的回调函数 */
52
+ success?: (result: TaroGeneral.CallbackResult) => void
53
+ }
54
+ }
55
+
56
+ namespace openChannelsActivity {
57
+ interface Option {
58
+ /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
59
+ finderUserName: string
60
+ /** 视频 feedId */
61
+ feedId: string
62
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
63
+ complete?: (res: TaroGeneral.CallbackResult) => void
64
+ /** 接口调用失败的回调函数 */
65
+ fail?: (res: TaroGeneral.CallbackResult) => void
66
+ /** 接口调用成功的回调函数 */
67
+ success?: (result: TaroGeneral.CallbackResult) => void
68
+ }
69
+ }
70
+
71
+ namespace getChannelsLiveNoticeInfo {
72
+ interface Option {
73
+ /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
74
+ finderUserName: string
75
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
76
+ complete?: (res: TaroGeneral.CallbackResult) => void
77
+ /** 接口调用失败的回调函数 */
78
+ fail?: (res: TaroGeneral.CallbackResult) => void
79
+ /** 接口调用成功的回调函数 */
80
+ success?: (result: SuccessCallbackResult) => void
81
+ }
82
+
83
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
84
+ /** 预告 nonceId */
85
+ nonceId: string
86
+ /** 预告状态:0可用 1取消 2已用 */
87
+ status: keyof Status | number
88
+ /** 开始时间 */
89
+ startTime: string
90
+ /** 直播封面 */
91
+ headUrl: string
92
+ /** 视频号昵称 */
93
+ nickname: string
94
+ /** 是否可预约 */
95
+ reservable: boolean
96
+ }
97
+ interface Status {
98
+ /** 可用 */
99
+ 0
100
+ /** 取消 */
101
+ 1
102
+ /** 已用 */
103
+ 2
104
+ }
105
+ }
106
+
107
+ namespace getChannelsLiveInfo {
108
+ interface Option {
109
+ /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
110
+ finderUserName: string
111
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
112
+ complete?: (res: TaroGeneral.CallbackResult) => void
113
+ /** 接口调用失败的回调函数 */
114
+ fail?: (res: TaroGeneral.CallbackResult) => void
115
+ /** 接口调用成功的回调函数 */
116
+ success?: (result: SuccessCallbackResult) => void
117
+ }
118
+
119
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
120
+ /** 直播 feedId */
121
+ feedId: string
122
+ /** 直播 nonceId */
123
+ nonceId: string
124
+ /** 直播主题 */
125
+ description: string
126
+ /** 直播状态,2直播中,3直播结束 */
127
+ status: keyof Status | number
128
+ /** 视频号头像 */
129
+ headUrl: string
130
+ /** 视频号昵称 */
131
+ nickname: string
132
+ }
133
+ interface Status {
134
+ /** 直播中 */
135
+ 2
136
+ /** 直播结束 */
137
+ 3
138
+ }
139
+ }
140
+
141
+ interface TaroStatic {
142
+ /** 预约视频号直播
143
+ * @supported weapp
144
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.reserveChannelsLive.html
145
+ */
146
+ reserveChannelsLive(option?: reserveChannelsLive.Option): void
147
+ /** 打开视频号主页
148
+ * @supported weapp
149
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsUserProfile.html
150
+ */
151
+ openChannelsUserProfile(option?: openChannelsUserProfile.Option): Promise<TaroGeneral.CallbackResult>
152
+ /** 打开视频号直播
153
+ * @supported weapp
154
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsLive.html
155
+ */
156
+ openChannelsLive(option?: openChannelsLive.Option): Promise<TaroGeneral.CallbackResult>
157
+ /** 打开视频号活动页
158
+ * @supported weapp
159
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsEvent.html
160
+ */
161
+ openChannelsEvent(option?: openChannelsEvent.Option): Promise<TaroGeneral.CallbackResult>
162
+ /** 打开视频号视频
163
+ * @supported weapp
164
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsActivity.html
165
+ */
166
+ openChannelsActivity(option?: openChannelsActivity.Option): Promise<TaroGeneral.CallbackResult>
167
+ /** 获取视频号直播预告信息
168
+ * @supported weapp
169
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.getChannelsLiveNoticeInfo.html
170
+ */
171
+ getChannelsLiveNoticeInfo(option?: getChannelsLiveNoticeInfo.Option): Promise<getChannelsLiveNoticeInfo.SuccessCallbackResult>
172
+ /** 获取视频号直播信息
173
+ * @supported weapp
174
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.getChannelsLiveInfo.html
175
+ */
176
+ getChannelsLiveInfo(option?: getChannelsLiveInfo.Option): Promise<getChannelsLiveInfo.SuccessCallbackResult>
177
+ }
178
+ }
@@ -72,6 +72,7 @@ declare module '../../index' {
72
72
 
73
73
  interface TaroStatic {
74
74
  /** 检查是否支持面部识别
75
+ * @deprecated
75
76
  * @supported weapp
76
77
  */
77
78
  checkIsSupportFacialRecognition(
@@ -79,6 +80,7 @@ declare module '../../index' {
79
80
  ): Promise<checkIsSupportFacialRecognition.CallbackResult>
80
81
 
81
82
  /** 开始人脸识别认证
83
+ * @deprecated
82
84
  * @supported weapp
83
85
  */
84
86
  startFacialRecognitionVerify(
@@ -86,6 +88,7 @@ declare module '../../index' {
86
88
  ): Promise<startFacialRecognitionVerify.CallbackResult>
87
89
 
88
90
  /** 开始人脸识别认证并上传认证视频
91
+ * @deprecated
89
92
  * @supported weapp
90
93
  */
91
94
  startFacialRecognitionVerifyAndUploadVideo(
@@ -0,0 +1,100 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace addVideoToFavorites {
5
+ interface Option {
6
+ /** 要收藏的视频地址,必须为本地路径或临时路径 */
7
+ videoPath: string
8
+ /** 缩略图路径,若留空则使用视频首帧 */
9
+ thumbPath?: string
10
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
11
+ complete?: (res: TaroGeneral.CallbackResult) => void
12
+ /** 接口调用失败的回调函数 */
13
+ fail?: (res: TaroGeneral.CallbackResult) => void
14
+ /** 接口调用成功的回调函数 */
15
+ success?: (res: TaroGeneral.CallbackResult) => void
16
+ }
17
+ }
18
+
19
+ namespace addFileToFavorites {
20
+ interface Option {
21
+ /** 要收藏的文件地址,必须为本地路径或临时路径 */
22
+ filePath: string
23
+ /** 自定义文件名,若留空则使用filePath中的文件名 */
24
+ fileName?: string
25
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
26
+ complete?: (res: TaroGeneral.CallbackResult) => void
27
+ /** 接口调用失败的回调函数 */
28
+ fail?: (res: TaroGeneral.CallbackResult) => void
29
+ /** 接口调用成功的回调函数 */
30
+ success?: (res: TaroGeneral.CallbackResult) => void
31
+ }
32
+ }
33
+
34
+ interface TaroStatic {
35
+ /** 收藏视频
36
+ * @supported weapp
37
+ * @example
38
+ * ```tsx
39
+ * // callback 写法
40
+ * Taro.downloadFile({
41
+ * url: URL, // 下载url
42
+ * success (res) {
43
+ * // 下载完成后收藏
44
+ * Taro.addVideoToFavorites({
45
+ * videoPath: res.tempFilePath,
46
+ * success() {},
47
+ * fail: console.error,
48
+ * })
49
+ * },
50
+ * fail: console.error,
51
+ * })
52
+ * ```
53
+ * @example
54
+ * ```tsx
55
+ * // async await 写法
56
+ * const { tempFilePath } = await Taro.downloadFile({
57
+ * url: URL, // 下载url
58
+ * })
59
+ * // 下载完成后收藏
60
+ * await Taro.addVideoToFavorites({
61
+ * videoPath: res.tempFilePath,
62
+ * })
63
+ * ```
64
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/favorites/wx.addVideoToFavorites.html
65
+ */
66
+ addVideoToFavorites(option?: addVideoToFavorites.Option): Promise<TaroGeneral.CallbackResult>
67
+ /** 预约视频号直播
68
+ * @supported weapp
69
+ * @example
70
+ * ```tsx
71
+ * // callback 写法
72
+ * Taro.downloadFile({
73
+ * url: URL, // 下载url
74
+ * success (res) {
75
+ * // 下载完成后收藏
76
+ * Taro.addFileToFavorites({
77
+ * filePath: res.tempFilePath,
78
+ * success() {},
79
+ * fail: console.error,
80
+ * })
81
+ * },
82
+ * fail: console.error,
83
+ * })
84
+ * ```
85
+ * @example
86
+ * ```tsx
87
+ * // async await 写法
88
+ * const { tempFilePath } = await Taro.downloadFile({
89
+ * url: URL, // 下载url
90
+ * })
91
+ * // 下载完成后收藏
92
+ * await Taro.addFileToFavorites({
93
+ * filePath: res.tempFilePath,
94
+ * })
95
+ * ```
96
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/favorites/wx.addFileToFavorites.html
97
+ */
98
+ addFileToFavorites(option?: addFileToFavorites.Option): Promise<TaroGeneral.CallbackResult>
99
+ }
100
+ }
@@ -0,0 +1,59 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace getGroupEnterInfo {
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
+ errMsg: string
17
+ /** 包括敏感数据在内的完整转发信息的加密数据,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
18
+ encryptedData: string
19
+ /** 加密算法的初始向量,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
20
+ iv: string
21
+ /** 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */
22
+ cloudID?: string
23
+ }
24
+ }
25
+
26
+ interface TaroStatic {
27
+ /** 获取微信群聊场景下的小程序启动信息。群聊场景包括群聊小程序消息卡片、群待办、群工具。可用于获取当前群的 opengid。
28
+ *
29
+ * **Tips**
30
+ * - 如需要展示群名称,小程序可以使用[开放数据组件](/docs/components/open/open-data)
31
+ * - 小游戏可以通过 `Taro.getGroupInfo` 接口获取群名称
32
+ * @supported weapp
33
+ * @example
34
+ * ```tsx
35
+ * Taro.getGroupEnterInfo({
36
+ * success(res) {
37
+ * // res
38
+ * {
39
+ * errMsg: 'getGroupEnterInfo:ok',
40
+ * encryptedData: '',
41
+ * iv: ''
42
+ * }
43
+ * },
44
+ * fail() { }
45
+ * })
46
+ * ```
47
+ *
48
+ * 敏感数据有两种获取方式,一是使用 [加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#%E5%8A%A0%E5%AF%86%E6%95%B0%E6%8D%AE%E8%A7%A3%E5%AF%86%E7%AE%97%E6%B3%95) 。 获取得到的开放数据为以下 json 结构(其中 opengid 为当前群的唯一标识):
49
+ *
50
+ * ```json
51
+ * {
52
+ * "opengid": "OPENGID"
53
+ * }
54
+ * ```
55
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/group/wx.getGroupEnterInfo.html
56
+ */
57
+ getGroupEnterInfo(option?: getGroupEnterInfo.Option): Promise<TaroGeneral.CallbackResult>
58
+ }
59
+ }
@@ -27,11 +27,11 @@ declare module '../../index' {
27
27
  /** 抬头名称 */
28
28
  title: string
29
29
  /** 抬头类型 */
30
- type: keyof invoice_type
30
+ type: keyof InvoiceType
31
31
  }
32
32
 
33
33
  /** 抬头类型 */
34
- interface invoice_type {
34
+ interface InvoiceType {
35
35
  0: '单位'
36
36
  1: '个人'
37
37
  }
@@ -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
+ }
@@ -1,6 +1,21 @@
1
1
  import Taro from '../../index'
2
2
 
3
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
+
4
19
  namespace login {
5
20
  interface Option {
6
21
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -32,6 +47,12 @@ declare module '../../index' {
32
47
  }
33
48
 
34
49
  interface TaroStatic {
50
+ /** **该接口仅在小程序插件中可调用**,调用接口获得插件用户标志凭证(code)。插件可以此凭证换取用于识别用户的标识 openpid。用户不同、宿主小程序不同或插件不同的情况下,该标识均不相同,即当且仅当同一个用户在同一个宿主小程序中使用同一个插件时,openpid 才会相同
51
+ * @supported weapp
52
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.pluginLogin.html
53
+ */
54
+ pluginLogin(option?: pluginLogin.Option): Promise<pluginLogin.SuccessCallbackResult>
55
+
35
56
  /** 调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户的唯一标识(openid)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
36
57
  * @supported weapp
37
58
  * @example
@@ -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
+ }
@@ -5,7 +5,6 @@ declare module '../../index' {
5
5
  interface Option {
6
6
  /**
7
7
  * 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。
8
- * 最低版本:2.10.3
9
8
  */
10
9
  withSubscriptions?: boolean
11
10
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -19,6 +18,8 @@ declare module '../../index' {
19
18
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
20
19
  /** 用户授权结果 */
21
20
  authSetting: AuthSetting
21
+ /** 用户订阅消息设置,接口参数 withSubscriptions 值为 true 时才会返回。 */
22
+ subscriptionsSetting: SubscriptionsSetting
22
23
  /** 调用结果 */
23
24
  errMsg: string
24
25
  }
@@ -26,6 +27,10 @@ declare module '../../index' {
26
27
 
27
28
  namespace getSetting {
28
29
  interface Option {
30
+ /**
31
+ * 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。
32
+ */
33
+ withSubscriptions?: boolean
29
34
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
30
35
  complete?: (res: TaroGeneral.CallbackResult) => void
31
36
  /** 接口调用失败的回调函数 */
@@ -37,6 +42,10 @@ declare module '../../index' {
37
42
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
38
43
  /** 用户授权结果 */
39
44
  authSetting: AuthSetting
45
+ /** 用户订阅消息设置,接口参数 withSubscriptions 值为 true 时才会返回。 */
46
+ subscriptionsSetting: SubscriptionsSetting
47
+ /** 在插件中调用时,当前宿主小程序的用户授权结果 */
48
+ miniprogramAuthSetting: AuthSetting
40
49
  /** 调用结果 */
41
50
  errMsg: string
42
51
  }
@@ -46,31 +55,87 @@ declare module '../../index' {
46
55
  * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html
47
56
  */
48
57
  interface AuthSetting {
49
- /** 是否授权通讯地址,对应接口 [wx.chooseAddress](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/address/wx.chooseAddress.html) */
50
- 'scope.address'?: boolean
51
- /** 是否授权摄像头,对应[[camera](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html)](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html) 组件 */
52
- 'scope.camera'?: boolean
53
- /** 是否授权获取发票,对应接口 [wx.chooseInvoice](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoice.html) */
54
- 'scope.invoice'?: boolean
55
- /** 是否授权发票抬头,对应接口 [wx.chooseInvoiceTitle](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoiceTitle.html) */
56
- 'scope.invoiceTitle'?: boolean
57
- /** 是否授权录音功能,对应接口 [wx.startRecord](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.startRecord.html) */
58
- 'scope.record'?: boolean
59
- /** 是否授权用户信息,对应接口 [wx.getUserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html) */
58
+ /** 是否授权用户信息,对应接口 [Taro.getUserInfo](/docs/apis/open-api/user-info/getUserInfo) */
60
59
  'scope.userInfo'?: boolean
61
- /** 是否授权地理位置,对应接口 [wx.getLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html), [wx.chooseLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.chooseLocation.html) */
60
+ /** 是否授权地理位置,对应接口 [Taro.getLocation](/docs/apis/location/getLocation), [Taro.chooseLocation](/docs/apis/location/chooseLocation) */
62
61
  'scope.userLocation'?: boolean
63
- /** 是否授权微信运动步数,对应接口 [wx.getWeRunData](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html) */
62
+ /** 是否授权通讯地址,对应接口 [Taro.chooseAddress](/docs/apis/open-api/address/chooseAddress) */
63
+ 'scope.address'?: boolean
64
+ /** 是否授权发票抬头,对应接口 [Taro.chooseInvoiceTitle](/docs/apis/open-api/invoice/chooseInvoiceTitle) */
65
+ 'scope.invoiceTitle'?: boolean
66
+ /** 是否授权获取发票,对应接口 [Taro.chooseInvoice](/docs/apis/open-api/invoice/chooseInvoice) */
67
+ 'scope.invoice'?: boolean
68
+ /** 是否授权微信运动步数,对应接口 [Taro.getWeRunData](/docs/apis/open-api/werun/getWeRunData) */
64
69
  'scope.werun'?: boolean
65
- /** 是否授权保存到相册 [wx.saveImageToPhotosAlbum](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html), [wx.saveVideoToPhotosAlbum](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.saveVideoToPhotosAlbum.html) */
70
+ /** 是否授权录音功能,对应接口 [Taro.startRecord](/docs/apis/media/recorder/startRecord) */
71
+ 'scope.record'?: boolean
72
+ /** 是否授权保存到相册 [Taro.saveImageToPhotosAlbum](/docs/apis/media/image/saveImageToPhotosAlbum), [Taro.saveVideoToPhotosAlbum](/docs/apis/media/video/saveVideoToPhotosAlbum) */
66
73
  'scope.writePhotosAlbum'?: boolean
74
+ /** 是否授权摄像头,对应 [camera](/docs/components/media/camera) 组件 */
75
+ 'scope.camera'?: boolean
76
+ /** 是否授权小程序在后台运行蓝牙,对应接口 [Taro.openBluetoothAdapterBackground](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/(wx.openBluetoothAdapterBackground).html) */
77
+ 'scope.bluetoothBackground'?: boolean
78
+ }
79
+
80
+ /** 订阅消息设置
81
+ *
82
+ * 注意事项
83
+ * - itemSettings 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。
84
+ * @example
85
+ * ```tsx
86
+ * Taro.getSetting({
87
+ * withSubscriptions: true,
88
+ * success (res) {
89
+ * console.log(res.authSetting)
90
+ * // res.authSetting = {
91
+ * // "scope.userInfo": true,
92
+ * // "scope.userLocation": true
93
+ * // }
94
+ * console.log(res.subscriptionsSetting)
95
+ * // res.subscriptionsSetting = {
96
+ * // mainSwitch: true, // 订阅消息总开关
97
+ * // itemSettings: { // 每一项开关
98
+ * // SYS_MSG_TYPE_INTERACTIVE: 'accept', // 小游戏系统订阅消息
99
+ * // SYS_MSG_TYPE_RANK: 'accept'
100
+ * // zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: 'reject', // 普通一次性订阅消息
101
+ * // ke_OZC_66gZxALLcsuI7ilCJSP2OJ2vWo2ooUPpkWrw: 'ban',
102
+ * // }
103
+ * // }
104
+ * }
105
+ * })
106
+ * ```
107
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/SubscriptionsSetting.html
108
+ */
109
+ interface SubscriptionsSetting {
110
+ /** 订阅消息总开关,true 为开启,false 为关闭 */
111
+ mainSwitch: boolean
112
+ /** 每一项订阅消息的订阅状态。itemSettings对象的键为一次性订阅消息的模板id或系统订阅消息的类型
113
+ * - 一次性订阅消息使用方法详见 [Taro.requestSubscribeMessage](/docs/apis/open-api/subscribe-message/requestSubscribeMessage)
114
+ * - 永久订阅消息(仅小游戏可用)使用方法详见 [Taro.requestSubscribeSystemMessage](https://developers.weixin.qq.com/minigame/dev/api/open-api/subscribe-message/wx.requestSubscribeSystemMessage.html)
115
+ * @type "accept" | "reject" | "ban"
116
+ */
117
+ itemSettings: {
118
+ [TEMPLATE_ID: string]: keyof SubscriptionsSetting.TemplateReflex | string
119
+ }
120
+ }
121
+
122
+ namespace SubscriptionsSetting {
123
+ /** 模版消息订阅类型 */
124
+ interface TemplateReflex {
125
+ /** 表示用户同意订阅该条id对应的模板消息 */
126
+ accept
127
+ /** 表示用户拒绝订阅该条id对应的模板消息 */
128
+ reject
129
+ /** 表示已被后台封禁 */
130
+ ban
131
+ }
67
132
  }
68
133
 
69
134
  interface TaroStatic {
70
135
  /** 调起客户端小程序设置界面,返回用户设置的操作结果。**设置界面只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
71
136
  *
72
137
  * 注意:[2.3.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为后,才可以跳转打开设置页,管理授权信息。[详情](https://developers.weixin.qq.com/community/develop/doc/000cea2305cc5047af5733de751008)
73
- * @supported weapp
138
+ * @supported weapp, rn, tt
74
139
  * @example
75
140
  * ```tsx
76
141
  * Taro.openSetting({
@@ -88,7 +153,7 @@ declare module '../../index' {
88
153
  openSetting(option?: openSetting.Option): Promise<openSetting.SuccessCallbackResult>
89
154
 
90
155
  /** 获取用户的当前设置。**返回值中只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
91
- * @supported weapp
156
+ * @supported weapp, rn, tt
92
157
  * @example
93
158
  * ```tsx
94
159
  * Taro.getSetting({
@@ -74,7 +74,7 @@ declare module '../../index' {
74
74
  namespace checkIsSoterEnrolledInDevice {
75
75
  interface Option {
76
76
  /** 认证方式 */
77
- checkAuthMode: keyof requestAuthModes
77
+ checkAuthMode: keyof RequestAuthModes
78
78
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
79
79
  complete?: (res: TaroGeneral.CallbackResult) => void
80
80
  /** 接口调用失败的回调函数 */
@@ -83,7 +83,7 @@ declare module '../../index' {
83
83
  success?: (result: SuccessCallbackResult) => void
84
84
  }
85
85
 
86
- interface requestAuthModes {
86
+ interface RequestAuthModes {
87
87
  /** 指纹识别 */
88
88
  fingerPrint
89
89
  /** 人脸识别 */