@tarojs/taro 3.6.22 → 3.6.23
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/package.json +8 -4
- package/types/api/base/debug.d.ts +8 -8
- package/types/api/base/env.d.ts +1 -1
- package/types/api/base/index.d.ts +3 -3
- package/types/api/base/system.d.ts +6 -6
- package/types/api/base/weapp/app-event.d.ts +10 -10
- package/types/api/base/weapp/life-cycle.d.ts +1 -1
- package/types/api/canvas/index.d.ts +367 -63
- package/types/api/device/battery.d.ts +1 -1
- package/types/api/device/clipboard.d.ts +2 -2
- package/types/api/device/keyboard.d.ts +1 -1
- package/types/api/device/network.d.ts +3 -3
- package/types/api/device/phone.d.ts +1 -1
- package/types/api/device/screen.d.ts +2 -2
- package/types/api/files/index.d.ts +7 -7
- package/types/api/framework/index.d.ts +2 -2
- package/types/api/location/index.d.ts +4 -4
- package/types/api/media/audio.d.ts +11 -11
- package/types/api/media/background-audio.d.ts +1 -1
- package/types/api/media/image.d.ts +5 -5
- package/types/api/media/video.d.ts +11 -11
- package/types/api/navigate/index.d.ts +1 -1
- package/types/api/network/download.d.ts +5 -5
- package/types/api/network/request.d.ts +7 -7
- package/types/api/network/upload.d.ts +7 -7
- package/types/api/network/websocket.d.ts +8 -8
- package/types/api/open-api/account.d.ts +1 -1
- package/types/api/open-api/address.d.ts +13 -5
- package/types/api/open-api/authorize.d.ts +1 -1
- package/types/api/open-api/bookshelf.d.ts +307 -0
- package/types/api/open-api/channels.d.ts +16 -0
- package/types/api/open-api/device-voip.d.ts +40 -0
- package/types/api/open-api/invoice.d.ts +1 -1
- package/types/api/open-api/login.d.ts +15 -2
- package/types/api/open-api/privacy.d.ts +8 -0
- package/types/api/open-api/settings.d.ts +3 -2
- package/types/api/open-api/sticker.d.ts +83 -0
- package/types/api/open-api/subscribe-message.d.ts +148 -6
- package/types/api/open-api/user-info.d.ts +6 -1
- package/types/api/qq/index.d.ts +306 -1
- package/types/api/route/index.d.ts +5 -5
- package/types/api/storage/index.d.ts +10 -10
- package/types/api/swan/download-package.d.ts +80 -0
- package/types/api/swan/index.d.ts +151 -0
- package/types/api/swan/pay.d.ts +139 -0
- package/types/api/taro.extend.d.ts +2 -1
- package/types/api/taro.hooks.d.ts +9 -9
- package/types/api/ui/animation.d.ts +32 -32
- package/types/api/ui/custom-component.d.ts +1 -1
- package/types/api/ui/fonts.d.ts +1 -1
- package/types/api/ui/interaction.d.ts +6 -6
- package/types/api/ui/menu.d.ts +1 -1
- package/types/api/ui/navigation-bar.d.ts +2 -2
- package/types/api/ui/pull-down-refresh.d.ts +2 -2
- package/types/api/ui/scroll.d.ts +1 -1
- package/types/api/ui/tab-bar.d.ts +8 -8
- package/types/api/ui/window.d.ts +2 -2
- package/types/api/wxml/index.d.ts +17 -17
- package/types/global.d.ts +2 -1
- package/types/index.d.ts +89 -43
- package/types/taro.api.d.ts +22 -14
- package/types/taro.config.d.ts +6 -2
- package/types/taro.runtime.d.ts +9 -0
|
@@ -153,7 +153,7 @@ declare module '../../index' {
|
|
|
153
153
|
|
|
154
154
|
interface TaroStatic {
|
|
155
155
|
/** Taro.setStorage 的同步版本
|
|
156
|
-
* @supported weapp, alipay, swan, jd, qq, tt, h5
|
|
156
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
157
157
|
* @example
|
|
158
158
|
* ```tsx
|
|
159
159
|
* Taro.setStorage({
|
|
@@ -177,7 +177,7 @@ declare module '../../index' {
|
|
|
177
177
|
): void
|
|
178
178
|
|
|
179
179
|
/** 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
|
|
180
|
-
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
180
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony_hybrid
|
|
181
181
|
* @example
|
|
182
182
|
* ```tsx
|
|
183
183
|
* Taro.setStorage({
|
|
@@ -204,7 +204,7 @@ declare module '../../index' {
|
|
|
204
204
|
): void
|
|
205
205
|
|
|
206
206
|
/** Taro.removeStorage 的同步版本
|
|
207
|
-
* @supported weapp, alipay, swan, jd, qq, tt, h5
|
|
207
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
208
208
|
* @example
|
|
209
209
|
* ```tsx
|
|
210
210
|
* try {
|
|
@@ -221,7 +221,7 @@ declare module '../../index' {
|
|
|
221
221
|
): void
|
|
222
222
|
|
|
223
223
|
/** 从本地缓存中移除指定 key
|
|
224
|
-
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
224
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony_hybrid
|
|
225
225
|
* @example
|
|
226
226
|
* ```tsx
|
|
227
227
|
* Taro.removeStorage({
|
|
@@ -236,7 +236,7 @@ declare module '../../index' {
|
|
|
236
236
|
removeStorage(option: removeStorage.Option): Promise<TaroGeneral.CallbackResult>
|
|
237
237
|
|
|
238
238
|
/** Taro.getStorage 的同步版本
|
|
239
|
-
* @supported weapp, alipay, swan, jd, qq, tt, h5
|
|
239
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
240
240
|
* @example
|
|
241
241
|
* ```tsx
|
|
242
242
|
* try {
|
|
@@ -256,7 +256,7 @@ declare module '../../index' {
|
|
|
256
256
|
): T
|
|
257
257
|
|
|
258
258
|
/** Taro.getStorageInfo 的同步版本
|
|
259
|
-
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
259
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony_hybrid
|
|
260
260
|
* @example
|
|
261
261
|
* ```tsx
|
|
262
262
|
* try {
|
|
@@ -273,7 +273,7 @@ declare module '../../index' {
|
|
|
273
273
|
getStorageInfoSync(): getStorageInfoSync.Option
|
|
274
274
|
|
|
275
275
|
/** 异步获取当前storage的相关信息
|
|
276
|
-
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
276
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony_hybrid
|
|
277
277
|
* @example
|
|
278
278
|
* ```tsx
|
|
279
279
|
* Taro.getStorageInfo({
|
|
@@ -289,7 +289,7 @@ declare module '../../index' {
|
|
|
289
289
|
getStorageInfo(option?: getStorageInfo.Option): Promise<TaroGeneral.CallbackResult>
|
|
290
290
|
|
|
291
291
|
/** 从本地缓存中异步获取指定 key 的内容
|
|
292
|
-
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
292
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony_hybrid
|
|
293
293
|
* @example
|
|
294
294
|
* ```tsx
|
|
295
295
|
* Taro.getStorage({
|
|
@@ -313,7 +313,7 @@ declare module '../../index' {
|
|
|
313
313
|
): void
|
|
314
314
|
|
|
315
315
|
/** Taro.clearStorage 的同步版本
|
|
316
|
-
* @supported weapp, alipay, swan, jd, qq, tt, h5
|
|
316
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
317
317
|
* @example
|
|
318
318
|
* ```tsx
|
|
319
319
|
* try {
|
|
@@ -327,7 +327,7 @@ declare module '../../index' {
|
|
|
327
327
|
clearStorageSync(): void
|
|
328
328
|
|
|
329
329
|
/** 清理本地数据缓存
|
|
330
|
-
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
330
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony_hybrid
|
|
331
331
|
* @example
|
|
332
332
|
* ```tsx
|
|
333
333
|
* Taro.clearStorage()
|
|
@@ -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 '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
|
+
}
|
|
@@ -45,6 +45,7 @@ declare module '../index' {
|
|
|
45
45
|
[TaroGeneral.ENV_TYPE.TT]: TaroGeneral.ENV_TYPE.TT
|
|
46
46
|
[TaroGeneral.ENV_TYPE.QQ]: TaroGeneral.ENV_TYPE.QQ
|
|
47
47
|
[TaroGeneral.ENV_TYPE.JD]: TaroGeneral.ENV_TYPE.JD
|
|
48
|
+
[TaroGeneral.ENV_TYPE.HARMONYHYBRID]: TaroGeneral.ENV_TYPE.HARMONYHYBRID
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
namespace interceptorify {
|
|
@@ -97,7 +98,7 @@ declare module '../index' {
|
|
|
97
98
|
}): void
|
|
98
99
|
|
|
99
100
|
/** 小程序获取和 Taro 相关的 App 信息
|
|
100
|
-
* @supported weapp, alipay, jd, qq, swan, tt, h5
|
|
101
|
+
* @supported weapp, alipay, jd, qq, swan, tt, h5, harmony_hybrid
|
|
101
102
|
*/
|
|
102
103
|
getAppInfo(): getAppInfo.AppInfo
|
|
103
104
|
|
|
@@ -46,7 +46,7 @@ declare module '../index' {
|
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* 当前是 tab 页时,tab 被点击时的回调。
|
|
49
|
-
* @supported weapp, h5, rn
|
|
49
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
50
50
|
*/
|
|
51
51
|
useTabItemTap(callback: (payload: TabItemTapObject) => void): void
|
|
52
52
|
|
|
@@ -73,45 +73,45 @@ declare module '../index' {
|
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* 小程序初始化完成时的回调。
|
|
76
|
-
* @supported weapp, h5
|
|
76
|
+
* @supported weapp, h5, harmony_hybrid
|
|
77
77
|
*/
|
|
78
78
|
useLaunch(callback: (options: getLaunchOptionsSync.LaunchOptions) => void): void
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* 小程序发生脚本错误或 API 调用报错时触发的回调。
|
|
82
|
-
* @supported weapp, h5
|
|
82
|
+
* @supported weapp, h5, harmony_hybrid
|
|
83
83
|
*/
|
|
84
84
|
useError(callback: (error: string) => void): void
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* 小程序有未处理的 Promise reject 时触发。也可以使用 Taro.onUnhandledRejection 绑定监听。
|
|
88
|
-
* @supported weapp, alipay, h5
|
|
88
|
+
* @supported weapp, alipay, h5, harmony_hybrid
|
|
89
89
|
*/
|
|
90
90
|
useUnhandledRejection(callback: (error: { reason: Error, promise: Promise<Error> }) => void): void
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
* 小程序要打开的页面不存在时触发的回调。
|
|
94
|
-
* @supported weapp, h5
|
|
94
|
+
* @supported weapp, h5, harmony_hybrid
|
|
95
95
|
* @h5 多页面模式不支持该方法
|
|
96
96
|
*/
|
|
97
97
|
usePageNotFound(callback: (res: { path: string, query: Record<any, any>, isEntryPage: boolean, [key: string]: any }) => void): void
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
100
|
* 页面加载完成时的回调。
|
|
101
|
-
* @supported weapp, h5
|
|
101
|
+
* @supported weapp, h5, harmony_hybrid
|
|
102
102
|
*/
|
|
103
103
|
useLoad<T extends {} = Record<string, any>>(callback: (param: T) => void): void
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
106
|
* 页面卸载时的回调。
|
|
107
|
-
* @supported weapp, h5
|
|
107
|
+
* @supported weapp, h5, harmony_hybrid
|
|
108
108
|
*/
|
|
109
109
|
useUnload(callback: () => void): void
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
112
|
* 页面初次渲染完成的回调。
|
|
113
113
|
* 此时页面已经准备妥当,可以和视图层进行交互。
|
|
114
|
-
* @supported weapp, h5
|
|
114
|
+
* @supported weapp, h5, harmony_hybrid
|
|
115
115
|
*/
|
|
116
116
|
useReady(callback: () => void): void
|
|
117
117
|
|
|
@@ -135,7 +135,7 @@ declare module '../index' {
|
|
|
135
135
|
|
|
136
136
|
/**
|
|
137
137
|
* 下拉中断时的回调。
|
|
138
|
-
* @supported alipay, h5
|
|
138
|
+
* @supported alipay, h5, harmony_hybrid
|
|
139
139
|
*/
|
|
140
140
|
usePullIntercept(callback: () => void): void
|
|
141
141
|
}
|