@tarojs/taro 4.0.0-canary.8 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/package.json +38 -17
  2. package/types/api/base/debug.d.ts +8 -8
  3. package/types/api/base/env.d.ts +2 -2
  4. package/types/api/base/index.d.ts +3 -3
  5. package/types/api/base/performance.d.ts +1 -1
  6. package/types/api/base/system.d.ts +6 -6
  7. package/types/api/base/weapp/app-event.d.ts +10 -10
  8. package/types/api/base/weapp/life-cycle.d.ts +1 -1
  9. package/types/api/canvas/index.d.ts +367 -63
  10. package/types/api/device/battery.d.ts +1 -1
  11. package/types/api/device/clipboard.d.ts +2 -2
  12. package/types/api/device/keyboard.d.ts +1 -1
  13. package/types/api/device/network.d.ts +3 -3
  14. package/types/api/device/phone.d.ts +1 -1
  15. package/types/api/device/screen.d.ts +2 -2
  16. package/types/api/files/index.d.ts +7 -7
  17. package/types/api/framework/index.d.ts +2 -2
  18. package/types/api/location/index.d.ts +4 -4
  19. package/types/api/media/audio.d.ts +21 -12
  20. package/types/api/media/background-audio.d.ts +1 -1
  21. package/types/api/media/image.d.ts +10 -10
  22. package/types/api/media/video.d.ts +11 -11
  23. package/types/api/navigate/index.d.ts +1 -1
  24. package/types/api/network/download.d.ts +5 -5
  25. package/types/api/network/request.d.ts +8 -8
  26. package/types/api/network/upload.d.ts +7 -7
  27. package/types/api/network/websocket.d.ts +8 -8
  28. package/types/api/open-api/account.d.ts +1 -1
  29. package/types/api/open-api/address.d.ts +13 -5
  30. package/types/api/open-api/authorize.d.ts +1 -1
  31. package/types/api/open-api/channels.d.ts +16 -0
  32. package/types/api/open-api/device-voip.d.ts +40 -0
  33. package/types/api/open-api/invoice.d.ts +1 -1
  34. package/types/api/open-api/login.d.ts +15 -2
  35. package/types/api/open-api/privacy.d.ts +8 -0
  36. package/types/api/open-api/settings.d.ts +3 -2
  37. package/types/api/open-api/sticker.d.ts +83 -0
  38. package/types/api/open-api/subscribe-message.d.ts +148 -6
  39. package/types/api/open-api/user-info.d.ts +6 -1
  40. package/types/api/qq/index.d.ts +306 -1
  41. package/types/api/route/index.d.ts +5 -5
  42. package/types/api/storage/index.d.ts +10 -10
  43. package/types/api/swan/bookshelf.d.ts +307 -0
  44. package/types/api/swan/download-package.d.ts +80 -0
  45. package/types/api/swan/index.d.ts +151 -0
  46. package/types/api/swan/pay.d.ts +139 -0
  47. package/types/api/taro.extend.d.ts +3 -2
  48. package/types/api/taro.hooks.d.ts +9 -9
  49. package/types/api/ui/animation.d.ts +32 -32
  50. package/types/api/ui/custom-component.d.ts +1 -1
  51. package/types/api/ui/fonts.d.ts +1 -1
  52. package/types/api/ui/interaction.d.ts +6 -6
  53. package/types/api/ui/menu.d.ts +1 -1
  54. package/types/api/ui/navigation-bar.d.ts +2 -2
  55. package/types/api/ui/pull-down-refresh.d.ts +2 -2
  56. package/types/api/ui/scroll.d.ts +1 -1
  57. package/types/api/ui/tab-bar.d.ts +8 -8
  58. package/types/api/ui/window.d.ts +2 -2
  59. package/types/api/wxml/index.d.ts +30 -24
  60. package/types/compile/compiler.d.ts +6 -2
  61. package/types/compile/config/h5.d.ts +9 -4
  62. package/types/compile/config/harmony.d.ts +43 -7
  63. package/types/compile/config/index.d.ts +1 -0
  64. package/types/compile/config/mini.d.ts +2 -16
  65. package/types/compile/config/project.d.ts +26 -8
  66. package/types/compile/config/rn.d.ts +22 -1
  67. package/types/compile/index.d.ts +8 -0
  68. package/types/compile/viteCompilerContext.d.ts +7 -3
  69. package/types/global.d.ts +2 -1
  70. package/types/index.d.ts +91 -46
  71. package/types/taro.api.d.ts +22 -14
  72. package/types/taro.component.d.ts +3 -0
  73. package/types/taro.config.d.ts +13 -4
  74. package/types/taro.lifecycle.d.ts +3 -0
  75. package/types/taro.runtime.d.ts +9 -0
@@ -0,0 +1,307 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace insertBookshelf {
5
+ interface Option {
6
+ /** 添加的内容分类 */
7
+ category: keyof Category | string
8
+ /** 要添加到书架内容的 id,支持传多个,最多 100 条;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) */
9
+ contentIds: string[]
10
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
11
+ complete?: (res: TaroGeneral.CallbackResult) => void
12
+ /** 接口调用失败的回调函数 */
13
+ fail?: (res: TaroGeneral.CallbackResult) => void
14
+ /** 接口调用成功的回调函数 */
15
+ success?: (res: SuccessCallbackResult) => void
16
+ }
17
+ interface Category {
18
+ /** 专栏模板 */
19
+ article
20
+ /** 文档模板 */
21
+ doc
22
+ /** 动漫模板 */
23
+ cartoon
24
+ /** 影音模板 */
25
+ av
26
+ }
27
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
28
+ /** 添加到书架的结果列表 */
29
+ list: IListItem[]
30
+ }
31
+ interface IListItem {
32
+ /** 内容的唯一标识 */
33
+ contentId: string
34
+ /** 添加状态:值为 0 时是失败,为 1 时是成功 */
35
+ status: keyof Status
36
+ /** 添加信息 */
37
+ msg: string
38
+ }
39
+ interface Status {
40
+ /** 失败 */
41
+ 0
42
+ /** 成功 */
43
+ 1
44
+ }
45
+ }
46
+
47
+ namespace deleteBookshelf {
48
+ interface Option {
49
+ /** 要删除的内容分类 */
50
+ category: keyof Category | string
51
+ /** 要删除书架内容的 id,支持传多个,最多 100 条;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符)。支持批量删除的同一个 category 下的多个 id,不同 category 下的 id 请分别调用该接口删除 */
52
+ contentIds: string[]
53
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
54
+ complete?: (res: TaroGeneral.CallbackResult) => void
55
+ /** 接口调用失败的回调函数 */
56
+ fail?: (res: TaroGeneral.CallbackResult) => void
57
+ /** 接口调用成功的回调函数 */
58
+ success?: (res: SuccessCallbackResult) => void
59
+ }
60
+ interface Category {
61
+ /** 专栏模板 */
62
+ article
63
+ /** 文档模板 */
64
+ doc
65
+ /** 动漫模板 */
66
+ cartoon
67
+ /** 影音模板 */
68
+ av
69
+ }
70
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
71
+ /** 添加到书架的结果列表 */
72
+ list: IListItem[]
73
+ }
74
+ interface IListItem {
75
+ /** 内容的唯一标识 */
76
+ contentId: string
77
+ /** 删除状态:值为 0 时是失败,为 1 时是成功 */
78
+ status: keyof Status
79
+ /** 删除信息 */
80
+ msg: string
81
+ }
82
+ interface Status {
83
+ /** 失败 */
84
+ 0
85
+ /** 成功 */
86
+ 1
87
+ }
88
+ }
89
+
90
+ namespace queryBookshelf {
91
+ interface Option {
92
+ /** 要查询内容的 id,支持传多个,最多 100 条;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) */
93
+ contentIds: string[]
94
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
95
+ complete?: (res: TaroGeneral.CallbackResult) => void
96
+ /** 接口调用失败的回调函数 */
97
+ fail?: (res: TaroGeneral.CallbackResult) => void
98
+ /** 接口调用成功的回调函数 */
99
+ success?: (res: TaroGeneral.CallbackResult) => void
100
+ }
101
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
102
+ /** 查询的内容结果列表 */
103
+ list: IListItem[]
104
+ }
105
+ interface IListItem {
106
+ /** 内容的唯一标识 */
107
+ contentId: string
108
+ /** 状态 */
109
+ status: keyof Status
110
+ }
111
+ interface Status {
112
+ /** 不存在 */
113
+ 0
114
+ /** 存在 */
115
+ 1
116
+ }
117
+ }
118
+
119
+ namespace updateBookshelfReadTime {
120
+ interface Option {
121
+ /** 添加的内容分类 */
122
+ category: keyof Category | string
123
+ /** 要更新内容的 id;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) */
124
+ contentIds: string[]
125
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
126
+ complete?: (res: TaroGeneral.CallbackResult) => void
127
+ /** 接口调用失败的回调函数 */
128
+ fail?: (res: TaroGeneral.CallbackResult) => void
129
+ /** 接口调用成功的回调函数 */
130
+ success?: (res: SuccessCallbackResult) => void
131
+ }
132
+ interface Category {
133
+ /** 专栏模板 */
134
+ article
135
+ /** 文档模板 */
136
+ doc
137
+ /** 动漫模板 */
138
+ cartoon
139
+ /** 影音模板 */
140
+ av
141
+ }
142
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
143
+ /** 更新状态 */
144
+ status: keyof Status
145
+ /** 更新的结果信息 */
146
+ msg: string
147
+ }
148
+ interface Status {
149
+ /** 失败 */
150
+ 0
151
+ /** 成功 */
152
+ 1
153
+ }
154
+ }
155
+
156
+ namespace navigateToBookshelf {
157
+ interface Option {
158
+ /** 跳转到指定的内容分类
159
+ * @supported swan
160
+ */
161
+ category: keyof Category | string
162
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
163
+ complete?: (res: TaroGeneral.CallbackResult) => void
164
+ /** 接口调用失败的回调函数 */
165
+ fail?: (res: TaroGeneral.CallbackResult) => void
166
+ /** 接口调用成功的回调函数 */
167
+ success?: (res: TaroGeneral.CallbackResult) => void
168
+ }
169
+ interface Category {
170
+ /** 专栏模板 */
171
+ article
172
+ /** 文档模板 */
173
+ doc
174
+ /** 动漫模板 */
175
+ cartoon
176
+ /** 影音模板 */
177
+ av
178
+ }
179
+ }
180
+
181
+ interface TaroStatic {
182
+ /** 添加内容到宿主书架
183
+ * @supported swan, qq
184
+ * @swan (需宿主支持书架入口)
185
+ * @example
186
+ * ```tsx
187
+ * Taro.insertBookshelf({
188
+ * category: 'doc',
189
+ * contentIds: ['test1', 'test2'],
190
+ * success(res) {
191
+ * Taro.showModal({
192
+ * title: 'success',
193
+ * content: JSON.stringify(res)
194
+ * })
195
+ * },
196
+ * fail(err) {
197
+ * Taro.showModal({
198
+ * title: 'fail',
199
+ * content: JSON.stringify(err)
200
+ * })
201
+ * }
202
+ * })
203
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-insertBookshelf/
204
+ */
205
+ insertBookshelf(option: insertBookshelf.Option): void
206
+
207
+ /** 删除书架中的内容(需宿主支持书架入口)
208
+ * @supported swan
209
+ * @example
210
+ * ```tsx
211
+ * Taro.deleteBookshelf({
212
+ * category: 'doc',
213
+ * contentIds: ['test1', 'test2'],
214
+ * success(res) {
215
+ * Taro.showModal({
216
+ * title: 'success',
217
+ * content: JSON.stringify(res)
218
+ * })
219
+ * },
220
+ * fail(err) {
221
+ * Taro.showModal({
222
+ * title: 'fail',
223
+ * content: JSON.stringify(err)
224
+ * })
225
+ * }
226
+ * })
227
+ * ```
228
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-deleteBookshelf/
229
+ */
230
+ deleteBookshelf(option: deleteBookshelf.Option): void
231
+
232
+ /** 查询宿主书架的相关内容
233
+ * @supported swan, qq
234
+ * @swan (需宿主支持书架入口)
235
+ * @example
236
+ * ```tsx
237
+ * Taro.queryBookshelf({
238
+ * contentIds: ['test1', 'test2'],
239
+ * success(res) {
240
+ * Taro.showModal({
241
+ * title: 'success',
242
+ * content: JSON.stringify(res)
243
+ * })
244
+ * },
245
+ * fail(err) {
246
+ * Taro.showModal({
247
+ * title: 'fail',
248
+ * content: JSON.stringify(err)
249
+ * })
250
+ * }
251
+ * })
252
+ * ```
253
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-queryBookshelf/
254
+ */
255
+ queryBookshelf(option: queryBookshelf.Option): void
256
+
257
+ /** 更新已加入宿主书架的内容的阅读时间
258
+ * @supported swan, qq
259
+ * @swan (需宿主支持书架入口)
260
+ * @example
261
+ * ```tsx
262
+ * Taro.updateBookshelfReadTime({
263
+ * category: 'doc',
264
+ * contentIds: 'test1',
265
+ * success(res) {
266
+ * Taro.showModal({
267
+ * title: 'success',
268
+ * content: JSON.stringify(res)
269
+ * })
270
+ * },
271
+ * fail(err) {
272
+ * Taro.showModal({
273
+ * title: 'fail',
274
+ * content: JSON.stringify(err)
275
+ * })
276
+ * }
277
+ * })
278
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-queryBookshelf/
279
+ */
280
+ updateBookshelfReadTime(option: updateBookshelfReadTime.Option): void
281
+
282
+ /** 跳转到宿主书架
283
+ * @supported swan
284
+ * @swan (需宿主支持书架入口)
285
+ * @example
286
+ * ```tsx
287
+ * Taro.navigateToBookshelf({
288
+ * category: 'article',
289
+ * contentIds: 'test1',
290
+ * success(res) {
291
+ * Taro.showModal({
292
+ * title: 'navigateToBookshelf',
293
+ * content: 'success'
294
+ * })
295
+ * },
296
+ * fail(err) {
297
+ * Taro.showModal({
298
+ * title: 'fail',
299
+ * content: JSON.stringify(err)
300
+ * })
301
+ * }
302
+ * })
303
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-navigateToBookshelf/
304
+ */
305
+ navigateToBookshelf(option: navigateToBookshelf.Option): void
306
+ }
307
+ }
@@ -0,0 +1,80 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace downloadPackage {
5
+ interface Option {
6
+ /** 预下载的小程序的 appKey */
7
+ appKey: string
8
+ /** 预下载的小程序的 pageUrl ,默认值为小程序的首页页面 */
9
+ pageUrl?: string
10
+ /** 接口调用成功的回调函数 */
11
+ success?: (res: TaroGeneral.CallbackResult) => any
12
+ /** 接口调用失败的回调函数 */
13
+ fail?: (err: TaroGeneral.CallbackResult) => any
14
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
15
+ complete?: (res: TaroGeneral.CallbackResult) => any
16
+ }
17
+ }
18
+
19
+ namespace downloadPackages {
20
+ interface Option {
21
+ /** 预下载的小程序的列表。 */
22
+ pageList: IPageItem[]
23
+ /** 接口调用成功的回调函数 */
24
+ success?: (res: SuccessCallbackResult) => any
25
+ /** 接口调用失败的回调函数 */
26
+ fail?: (err: TaroGeneral.CallbackResult) => any
27
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
28
+ complete?: (res: TaroGeneral.CallbackResult) => any
29
+ }
30
+ interface IPageItem {
31
+ /** 预下载的小程序的 appKey */
32
+ appKey: string
33
+ /** 页面路径 */
34
+ pages: string[]
35
+ }
36
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
37
+ /** 小程序包预下载结果回调 */
38
+ [key: string]: IAppKeyResult[]
39
+ }
40
+ interface IAppKeyResult {
41
+ /** 页面路径 */
42
+ pageUrl: string
43
+ /** 预下载能力调用结果。值为 "0" 时是成功,非 "0" 时是失败 */
44
+ status: string
45
+ /** 预下载结果信息 */
46
+ message: string
47
+ }
48
+ }
49
+
50
+ namespace loadSubPackage {
51
+ interface Option {
52
+ /** 接口调用成功的回调函数 */
53
+ success?: (res: TaroGeneral.CallbackResult) => any
54
+ /** 接口调用失败的回调函数 */
55
+ fail?: (err: TaroGeneral.CallbackResult) => any
56
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
57
+ complete?: (res: TaroGeneral.CallbackResult) => any
58
+ }
59
+ }
60
+
61
+ interface TaroStatic {
62
+ /** 针对在小程序中调用其他小程序的场景,预下载其他小程序的包内容。
63
+ * Web 态说明:Web 态不支持预下载的能力。
64
+ * @supported swan
65
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-downloadPackage/
66
+ */
67
+ downloadPackage(option: downloadPackage.Option): void
68
+ /** 针对在小程序中调用其他小程序的场景,预下载其他小程序的包内容。
69
+ * Web 态说明:Web 态不支持预下载的能力。
70
+ * @supported swan
71
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-downloadPackages/
72
+ */
73
+ downloadPackages(option: downloadPackages.Option): void
74
+ /** 提前下载好子包的资源,目录结构配置参考[分包加载](https://smartprogram.baidu.com/docs/develop/framework/subpackages/)。
75
+ * @supported swan
76
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-loadSubPackage/
77
+ */
78
+ loadSubPackage(option: loadSubPackage.Option): void
79
+ }
80
+ }
@@ -54,6 +54,116 @@ declare module '../../index' {
54
54
  }
55
55
  }
56
56
 
57
+ namespace setMetaDescription {
58
+ interface Option {
59
+ /** 需要设置的 description 内容 */
60
+ content: string
61
+ /** 接口调用成功的回调函数 */
62
+ success?: (res: any) => any
63
+ /** 接口调用失败的回调函数 */
64
+ fail?: (err: any) => any
65
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
66
+ complete?: (res: any) => any
67
+ }
68
+ }
69
+
70
+ namespace setMetaKeywords {
71
+ interface Option {
72
+ /** 需要设置的 keywords 内容 */
73
+ content: string
74
+ /** 接口调用成功的回调函数 */
75
+ success?: (res: any) => any
76
+ /** 接口调用失败的回调函数 */
77
+ fail?: (err: any) => any
78
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
79
+ complete?: (res: any) => any
80
+ }
81
+ }
82
+
83
+ namespace setDocumentTitle {
84
+ interface Option {
85
+ /** 页面中 title 标签中的内容 */
86
+ title: string
87
+ /** 接口调用成功的回调函数 */
88
+ success?: (res: any) => any
89
+ /** 接口调用失败的回调函数 */
90
+ fail?: (err: any) => any
91
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
92
+ complete?: (res: any) => any
93
+ }
94
+ }
95
+
96
+ namespace getSystemRiskInfo {
97
+ interface Option {
98
+ /** 接口调用成功的回调函数 */
99
+ success?: (res: SuccessCallbackResult) => any
100
+ /** 接口调用失败的回调函数 */
101
+ fail?: (err: any) => any
102
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
103
+ complete?: (res: any) => any
104
+ }
105
+ interface SuccessCallbackResult {
106
+ /** 用于获取风控信息的加密信息对象。
107
+ * 要获取风控信息,需要和[风控检测](https://smartprogram.baidu.com/docs/develop/serverapi/open_risk_power/#detectrisk/)接口联合使用,并作为风控检测接口的 xtoken 参数传入。
108
+ */
109
+ content: Object
110
+ }
111
+ interface IContent {
112
+ key: string
113
+ value: string
114
+ }
115
+ }
116
+
117
+ namespace getFavorStatus {
118
+ interface Option {
119
+ /** 接口调用成功的回调函数 */
120
+ success?: (res: SuccessCallbackResult) => any
121
+ /** 接口调用失败的回调函数 */
122
+ fail?: (err: any) => any
123
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
124
+ complete?: (res: any) => any
125
+ }
126
+ interface SuccessCallbackResult {
127
+ /** 用户关注关注状态,1表示已关注,0表示未关注 */
128
+ isFavor: string
129
+ }
130
+ }
131
+
132
+ namespace getTopStatus {
133
+ interface Option {
134
+ /** 接口调用成功的回调函数 */
135
+ success?: (res: SuccessCallbackResult) => any
136
+ /** 接口调用失败的回调函数 */
137
+ fail?: (err: any) => any
138
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
139
+ complete?: (res: any) => any
140
+ }
141
+ interface SuccessCallbackResult {
142
+ /** 置顶状态 */
143
+ isTop: boolean
144
+ }
145
+ }
146
+
147
+ namespace openBdboxWebview {
148
+ interface Option {
149
+ /** 跳转百度 App 特定页面的 scheme 的 module */
150
+ module?: string
151
+ /** 跳转百度 App 特定页面的 scheme 的 action */
152
+ action?: string
153
+ /** 跳转百度 App 特定页面的 scheme 的 path */
154
+ path?: string
155
+ /** 跳转百度 App 特定页面的 scheme 的 authority */
156
+ authority?: string
157
+ /** 跳转百度 App 特定页面的 scheme 的参数 */
158
+ parameters?: Object
159
+ /** 接口调用成功的回调函数 */
160
+ success?: (res: any) => any
161
+ /** 接口调用失败的回调函数 */
162
+ fail?: (err: any) => any
163
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
164
+ complete?: (res: any) => any
165
+ }
166
+ }
57
167
  interface TaroStatic {
58
168
  /**
59
169
  * 百度智能小程序可接入百度搜索和百度 App,setPageInfo 负责为小程序设置各类页面基础信息,包括标题、关键字、页面描述以及图片信息、视频信息等。开发者为智能小程序设置完备的页面基础信息,有助于智能小程序在搜索引擎和信息流中得到更加有效的展示和分发。
@@ -96,5 +206,46 @@ declare module '../../index' {
96
206
  * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-setPageInfo/
97
207
  */
98
208
  setPageInfo(option: setPageInfo.Option): void
209
+ /** 设置 web 版小程序 description meta 信息。此方法为 web 版小程序专用方法,使用前需判断方法是否存在。
210
+ * @supported swan
211
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-setMetaDescription/
212
+ */
213
+ setMetaDescription(option: setMetaDescription.Option): void
214
+ /** 设置 web 版小程序 keywords meta 信息。此方法为 web 版小程序专用方法,使用前需判断方法是否存在。
215
+ * @supported swan
216
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-setMetaKeywords/
217
+ */
218
+ setMetaKeywords(option: setMetaKeywords.Option): void
219
+ /** 动态设置当前页面的标题。此方法为 web 版小程序专用方法,使用前需判断方法是否存在。
220
+ * @supported swan
221
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-setDocumentTitle/
222
+ */
223
+ setDocumentTitle(option: setDocumentTitle.Option): void
224
+ /** 获取用于得到风控信息的加密信息对象。更多小程序风控能力参见[风控服务](https://smartprogram.baidu.com/docs/develop/serverapi/open_risk_power/)。
225
+ * Web 态说明:Web 态小程序暂不支持获取用于得到风控信息的加密信息对象。
226
+ * @supported swan
227
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-getSystemRiskInfo/
228
+ */
229
+ getSystemRiskInfo(option: getSystemRiskInfo.Option): void
230
+ /** 获取小程序用户关注状态。
231
+ * Web 态说明:Web 态小程序暂不支持关注小程序。
232
+ * @supported swan
233
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-getFavorStatus/
234
+ */
235
+ getFavorStatus(option: getFavorStatus.Option): void
236
+ /** 获取小程序用户置顶状态。
237
+ * Web 态说明:Web 态小程序暂不支持获取置顶状态,降级调起百度 App。
238
+ * @supported swan
239
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-getTopStatus/
240
+ */
241
+ getTopStatus(option: getTopStatus.Option): void
242
+ /** 小程序跳转百度 App 内特定页面。接入本 API 的开发者,需要了解跳转页面的 scheme,并根据文档调用 API 完成跳转。可在百度 App 中,通过将跳转页面 scheme 生成对应二维码,并使用百度 APP 相机扫描二维码调起的方式,来确保 scheme 是否正确。
243
+ * Web 态说明:
244
+ * 1.由于浏览器的限制,Web 态暂时无法准确获取跳转百度 App 成功 / 失败状态,会执行失败回调;
245
+ * 2.在用户未安装手百、部分第三方浏览器封禁百度 App 的情况下,Web 态会尝试降级调起应用商店。
246
+ * @supported swan
247
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-openBdboxWebview/
248
+ */
249
+ openBdboxWebview(option: openBdboxWebview.Option): void
99
250
  }
100
251
  }
@@ -0,0 +1,139 @@
1
+ import { Interface } from 'node:readline'
2
+ import Taro from '../../index'
3
+
4
+ declare module '../../index' {
5
+
6
+ namespace requestPolymerPayment {
7
+ interface Option {
8
+ /** 订单信息 */
9
+ orderInfo: OrderInfo
10
+ /** 接口调用成功的回调函数 */
11
+ success?: (res: TaroGeneral.CallbackResult) => any
12
+ /** 接口调用失败的回调函数 */
13
+ fail?: (err: FailCallbackResult) => any
14
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
15
+ complete?: (res: TaroGeneral.CallbackResult) => any
16
+ }
17
+ interface OrderInfo {
18
+ /** 跳转百度收银台支付必带参数之一,是百度收银台的财务结算凭证,与账号绑定的结算协议一一对应,每笔交易将结算到 dealId 对应的协议主体。
19
+ * 详见[核心参数获取与组装](https://smartprogram.baidu.com/docs/develop/function/parameter/)。
20
+ */
21
+ dealId: string
22
+ /** 支付能力开通后分配的支付 appKey,用以表示应用身份的唯一 ID ,在应用审核通过后进行分配,一经分配后不会发生更改,来唯一确定一个应用。
23
+ * 详见[核心参数获取与组装](https://smartprogram.baidu.com/docs/develop/function/parameter/)。
24
+ */
25
+ appKey: string
26
+ /** 订单金额(单位:人民币分)。注:小程序测试包测试金额不可超过 1000 分 */
27
+ totalAmount: string
28
+ /** 小程序开发者系统创建的唯一订单 ID ,当支付状态发生变化时,会通过此订单 ID 通知开发者。 */
29
+ tpOrderId: string
30
+ /** 通知开发者支付状态的回调地址,必须是合法的 URL ,与开发者平台填写的支付回调地址作用一致,未填写的以平台回调地址为准 */
31
+ notifyUrl?: string
32
+ /** 订单的名称。 */
33
+ dealTitle: string
34
+ /** 用于区分验签字段范围,signFieldsRange 的值:0:原验签字段 appKey+dealId+tpOrderId;1:包含 totalAmount 的验签,验签字段包括appKey+dealId+tpOrderId+totalAmount。固定值为 1 。 */
35
+ signFieldsRange: string
36
+ /** 对appKey+dealId+totalAmount+tpOrderId进行 RSA 加密后的签名,防止订单被伪造。
37
+ * 签名过程见[签名与验签](https://smartprogram.baidu.com/docs/develop/function/sign_v2/)。
38
+ */
39
+ rsaSign: string
40
+ /** 订单详细信息,需要是一个可解析为 JSON Object 的字符串。
41
+ * 字段内容见: [bizInfo 组装](https://smartprogram.baidu.com/docs/develop/function/parameter/#%E9%80%9A%E7%94%A8%E5%8F%82%E6%95%B0%E7%BB%84%E8%A3%85)。
42
+ */
43
+ bizInfo?: string
44
+ /** 当前页面 path。Web 态小程序支付成功后跳回的页面路径,例如:'/pages/payResult/payResult' */
45
+ payResultUrl?: string
46
+ /**
47
+ * 内嵌支付组件返回的支付信息加密 key,与[内嵌支付组件](https://smartprogram.baidu.com/docs/develop/component/inline_payment_panel)配套使用,此值不传或者传空时默认调起支付面板。
48
+ */
49
+ inlinePaySign?: string
50
+ /** 平台营销信息,此处传可使用平台券的 spuid,支持通过英文逗号分割传入多个 spuid 值,仅与百度合作平台类目券的开发者需要填写 */
51
+ promotionTag?: string
52
+ }
53
+
54
+ interface FailCallbackResult extends TaroGeneral.CallbackResult {
55
+ /** 错误码 */
56
+ errCode: number
57
+ /** 详细错误信息。
58
+ * 注: 目前仅在内嵌支付组件调起 swan.requestPolymerPayment 时,选择数字人民币 APP 渠道支付且用户未下载数字人民币 APP 时,返回具体错误信息 data。
59
+ */
60
+ data: DetailFailData
61
+ }
62
+ interface DetailFailData {
63
+ /** 详细错误码。20014 表示【未下载数字人民币 APP】 */
64
+ subErrCode: number
65
+ /** 详细错误信息 */
66
+ subErrMsg: string
67
+ }
68
+ }
69
+
70
+ namespace getOptimalPriceInfo {
71
+ interface Option {
72
+ /** 商品信息 */
73
+ productsInfo: ProductInfo[]
74
+ /** 接口调用成功的回调函数 */
75
+ success?: (res: SuccessCallbackResult) => any
76
+ /** 接口调用失败的回调函数 */
77
+ fail?: (err: TaroGeneral.CallbackResult) => any
78
+ }
79
+
80
+ interface ProductInfo {
81
+ /** 支付的 appKey */
82
+ appKey: string
83
+ /** 商品信息 */
84
+ products: Product[]
85
+ }
86
+ interface Product {
87
+ /** 商品单价(原价) */
88
+ amount: number
89
+ /** 商品标识 */
90
+ promotionTag?: string
91
+ /** 开发者自定义商品 ID,在success回调中,会与减免信息一起返回。*/
92
+ productId: string
93
+ }
94
+
95
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
96
+ /** 商品信息 */
97
+ productsInfo: ProductInfoSuccess[]
98
+ }
99
+ interface ProductInfoSuccess {
100
+ /** 支付的 appKey */
101
+ appKey: string
102
+ /** 减免后的商品信息 */
103
+ products: ProductSuccess[]
104
+ }
105
+ interface ProductSuccess {
106
+ /** 商品单价(原价) */
107
+ amount: number
108
+ /** 开发者自定义商品 ID */
109
+ productId: string
110
+ /** 商品标识 */
111
+ promotionTag: string
112
+ /** 百度平台券减免金额 */
113
+ reduceAmount: number
114
+ /** 百度平台券减免后金额 */
115
+ afterPayAmount: number
116
+ }
117
+ }
118
+
119
+ interface TaroStatic {
120
+ /**
121
+ * 1)百度收银台,聚合了主流的百度钱包、微信、支付宝、网银等多种支付渠道,方便开发者一站式快速接入多种支付渠道,让百度用户能在智能小程序场景下,直接完成支付、交易闭环,提升用户支付体验的同时,提高智能小程序的订单转化率。
122
+ * 2)上述支付渠道在 C 端收银台有两种展示方式,开发者可以选择其中一种实现。
123
+ * 方式一:将支付渠道内嵌在小程序提单页面中,实现方式参考文档[inline-payment-panel内嵌支付组件](https://smartprogram.baidu.com/docs/develop/component/inline_payment_panel/)。
124
+ * 方式二:在用户确认订单后,调起收银台半屏面板承载支付渠道,实现方式参考文档调起[百度收银台](https://smartprogram.baidu.com/docs/develop/function/tune_up_2.0/#%E7%99%BE%E5%BA%A6%E6%94%B6%E9%93%B6%E5%8F%B0%E6%8E%A5%E5%8F%A32-0-%E8%AF%B4%E6%98%8E)。
125
+ *
126
+ * Web 态说明:为了保证用户交易行为全流程闭环体验,在 Web 态下调用该方法会做打开百度 App 对应小程序页面的降级处理。
127
+ * @supported swan
128
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/payment_swan-requestPolymerPayment/
129
+ */
130
+ requestPolymerPayment(option: requestPolymerPayment.Option): void
131
+ /** 获取商品使用百度平台券后的价格
132
+ * 通过百度收银台支付的商品,用户在支付时可以享受百度平台券提供的优惠。
133
+ * 使用 API swan.getOptimalPriceInfo 可以提前获知用户在支付时享受的优惠价格。(当用户有多张平台券时,按照平台最优优惠价格计算,与支付时默认选中的优惠券对应的优惠一致)
134
+ * @supported swan
135
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/payment_swan-getOptimalPriceInfo/
136
+ */
137
+ getOptimalPriceInfo(option: getOptimalPriceInfo.Option): void
138
+ }
139
+ }