@spcsn/taro 0.1.2 → 1.0.1
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 +13 -6
- package/dist/index.js +223 -1
- package/dist/index.js.map +1 -1
- package/package.json +17 -48
- package/types/api/ad/index.d.ts +3 -6
- package/types/api/base/debug.d.ts +8 -8
- package/types/api/base/env.d.ts +3 -3
- package/types/api/base/index.d.ts +3 -3
- package/types/api/base/performance.d.ts +5 -5
- package/types/api/base/system.d.ts +8 -16
- package/types/api/base/update.d.ts +6 -6
- package/types/api/base/weapp/app-event.d.ts +12 -12
- package/types/api/base/weapp/life-cycle.d.ts +1 -1
- package/types/api/canvas/index.d.ts +71 -72
- package/types/api/data-analysis/index.d.ts +1 -1
- package/types/api/device/accelerometer.d.ts +4 -4
- package/types/api/device/accessibility.d.ts +1 -1
- package/types/api/device/battery.d.ts +2 -2
- package/types/api/device/bluetooth-ble.d.ts +14 -14
- package/types/api/device/bluetooth-peripheral.d.ts +15 -15
- package/types/api/device/bluetooth.d.ts +11 -11
- package/types/api/device/calendar.d.ts +2 -2
- package/types/api/device/clipboard.d.ts +2 -4
- package/types/api/device/compass.d.ts +4 -4
- package/types/api/device/gyroscope.d.ts +4 -4
- package/types/api/device/iBeacon.d.ts +7 -7
- package/types/api/device/keyboard.d.ts +3 -3
- package/types/api/device/memory.d.ts +2 -2
- package/types/api/device/motion.d.ts +4 -4
- package/types/api/device/network.d.ts +5 -20
- package/types/api/device/nfc.d.ts +17 -17
- package/types/api/device/phone.d.ts +1 -1
- package/types/api/device/scan.d.ts +1 -1
- package/types/api/device/screen.d.ts +6 -6
- package/types/api/device/sms.d.ts +1 -1
- package/types/api/device/vibrate.d.ts +2 -2
- package/types/api/device/wifi.d.ts +10 -10
- package/types/api/ext/index.d.ts +2 -2
- package/types/api/files/index.d.ts +46 -46
- package/types/api/framework/index.d.ts +2 -2
- package/types/api/location/index.d.ts +38 -45
- package/types/api/media/audio.d.ts +30 -30
- package/types/api/media/background-audio.d.ts +1 -1
- package/types/api/media/camera.d.ts +12 -25
- package/types/api/media/image.d.ts +8 -13
- package/types/api/media/map.d.ts +15 -15
- package/types/api/media/recorder.d.ts +11 -11
- package/types/api/media/video.d.ts +19 -21
- package/types/api/navigate/index.d.ts +2 -2
- package/types/api/network/download.d.ts +7 -8
- package/types/api/network/request.d.ts +14 -33
- package/types/api/network/upload.d.ts +7 -9
- package/types/api/network/websocket.d.ts +14 -14
- package/types/api/open-api/account.d.ts +1 -1
- package/types/api/open-api/address.d.ts +5 -5
- package/types/api/open-api/authorize.d.ts +1 -1
- package/types/api/open-api/login.d.ts +5 -5
- package/types/api/open-api/settings.d.ts +2 -2
- package/types/api/open-api/subscribe-message.d.ts +15 -15
- package/types/api/open-api/user-info.d.ts +2 -3
- package/types/api/payment/index.d.ts +1 -1
- package/types/api/route/index.d.ts +5 -8
- package/types/api/share/index.d.ts +3 -3
- package/types/api/storage/background-fetch.d.ts +6 -9
- package/types/api/storage/index.d.ts +11 -11
- package/types/api/taro.extend.d.ts +7 -24
- package/types/api/taro.hooks.d.ts +8 -33
- package/types/api/ui/animation.d.ts +33 -36
- package/types/api/ui/background.d.ts +2 -4
- package/types/api/ui/custom-component.d.ts +1 -1
- package/types/api/ui/fonts.d.ts +1 -10
- 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 +5 -7
- package/types/api/ui/pull-down-refresh.d.ts +2 -3
- package/types/api/ui/scroll.d.ts +3 -4
- 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 +19 -23
- package/types/compile/compiler.d.ts +4 -10
- package/types/compile/config/index.d.ts +0 -3
- package/types/compile/config/mini.d.ts +17 -39
- package/types/compile/config/plugin.d.ts +14 -4
- package/types/compile/config/project.d.ts +23 -61
- package/types/compile/config/util.d.ts +18 -73
- package/types/compile/index.d.ts +16 -1
- package/types/compile/viteCompilerContext.d.ts +18 -52
- package/types/global.d.ts +1 -12
- package/types/index.d.ts +0 -11
- package/types/taro.api.d.ts +0 -9
- package/types/taro.component.d.ts +0 -2
- package/types/taro.config.d.ts +0 -120
- package/types/taro.runtime.d.ts +7 -3
- package/types/api/alipay/index.d.ts +0 -69
- package/types/api/qq/index.d.ts +0 -354
- package/types/api/swan/bookshelf.d.ts +0 -307
- package/types/api/swan/download-package.d.ts +0 -80
- package/types/api/swan/index.d.ts +0 -251
- package/types/api/swan/pay.d.ts +0 -139
- package/types/compile/config/h5.d.ts +0 -134
- package/types/compile/config/harmony.d.ts +0 -118
- package/types/compile/config/rn.d.ts +0 -85
|
@@ -1,80 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import Taro from '../../index'
|
|
2
|
-
|
|
3
|
-
declare module '../../index' {
|
|
4
|
-
namespace setPageInfo {
|
|
5
|
-
interface Option {
|
|
6
|
-
/** 页面标题 */
|
|
7
|
-
title: string
|
|
8
|
-
/** 页面关键字 */
|
|
9
|
-
keywords: string
|
|
10
|
-
/** 页面描述信息 */
|
|
11
|
-
description: string
|
|
12
|
-
/** 原始发布时间(年-月-日 时:分:秒 带有前导零) */
|
|
13
|
-
releaseDate?: string
|
|
14
|
-
/** 文章(内容)标题(适用于当前页面是图文、视频类的展示形式,文章标题需要准确标识当前文章的主要信息点;至少6个字,不可以全英文。) */
|
|
15
|
-
articleTitle?: string
|
|
16
|
-
/** 图片线上地址,用于信息流投放后的封面显示,最多3张,单图片最大2M;封面图建议尺寸:高>=210px & 宽>=375px;最小尺寸:高>=146px & 宽>=218px。多张图时,用数组表示 */
|
|
17
|
-
image?: string | Array<string>
|
|
18
|
-
/** 视频信息,多个视频时,用数组表示 */
|
|
19
|
-
video?: Video
|
|
20
|
-
/** 浏览信息 */
|
|
21
|
-
visit?: Visit
|
|
22
|
-
/** 点赞量,若页面未统计可为空 */
|
|
23
|
-
likes?: string
|
|
24
|
-
/** 评论量,若页面未统计可为空 */
|
|
25
|
-
comments?: string
|
|
26
|
-
/** 收藏量,若页面未统计可为空 */
|
|
27
|
-
collects?: string
|
|
28
|
-
/** 分享量,若页面未统计可为空 */
|
|
29
|
-
shares?: string
|
|
30
|
-
/** 关注量,若页面未统计可为空 */
|
|
31
|
-
followers?: string
|
|
32
|
-
/** 接口调用成功的回调函数 */
|
|
33
|
-
success?: () => any
|
|
34
|
-
/** 接口调用失败的回调函数 */
|
|
35
|
-
fail?: (err: any) => any
|
|
36
|
-
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
37
|
-
complete?: () => any
|
|
38
|
-
}
|
|
39
|
-
type Video = {
|
|
40
|
-
/** 视频地址 */
|
|
41
|
-
url: string
|
|
42
|
-
/** 视频时长(单位为秒) */
|
|
43
|
-
duration: string
|
|
44
|
-
/** 视频封面图 */
|
|
45
|
-
image: string
|
|
46
|
-
}
|
|
47
|
-
type Visit = {
|
|
48
|
-
/** 页面的浏览量(不去重用户) */
|
|
49
|
-
pv?: string
|
|
50
|
-
/** 页面的点击量(去重用户) */
|
|
51
|
-
uv?: string
|
|
52
|
-
/** 页面的用户人均停留时长,以秒为单位。 */
|
|
53
|
-
sessionDuration?: string
|
|
54
|
-
}
|
|
55
|
-
}
|
|
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
|
-
}
|
|
167
|
-
interface TaroStatic {
|
|
168
|
-
/**
|
|
169
|
-
* 百度智能小程序可接入百度搜索和百度 App,setPageInfo 负责为小程序设置各类页面基础信息,包括标题、关键字、页面描述以及图片信息、视频信息等。开发者为智能小程序设置完备的页面基础信息,有助于智能小程序在搜索引擎和信息流中得到更加有效的展示和分发。
|
|
170
|
-
* @supported swan
|
|
171
|
-
* @example
|
|
172
|
-
* ```tsx
|
|
173
|
-
* Taro.setPageInfo({
|
|
174
|
-
* title: '晒元宵节活动红包,爱奇艺60张年卡、600张季卡等你拿!-百度贴吧',
|
|
175
|
-
* keywords: '百度,百度贴吧,好运中国年,60,晒元,宵节',
|
|
176
|
-
* description: '晒元宵节活动红包,爱..昨天的百度APP元宵节活动中,共发出2亿现金红包、含151万个手气现金大奖和240辆红旗轿车,谁是好运锦鲤,快来分享!马上惊喜升级~摇中红包的锦鲤们即刻晒出红包金额截图,我们将会抽取660位好运锦鲤',
|
|
177
|
-
* articleTitle: '晒元宵节活动红包,爱奇艺60张年卡、600张季卡等你拿!',
|
|
178
|
-
* releaseDate: '2019-01-02 12:01:30',
|
|
179
|
-
* image: [
|
|
180
|
-
* 'https://c.hiphotos.baidu.com/forum/w%3D480/sign=73c62dda83b1cb133e693d1bed5456da/f33725109313b07e8dee163d02d7912396dd8cfe.jpg',
|
|
181
|
-
* 'https://hiphotos.baidu.com/fex/%70%69%63/item/43a7d933c895d143e7b745607ef082025baf07ab.jpg'
|
|
182
|
-
* ],
|
|
183
|
-
* video: [{
|
|
184
|
-
* url: 'https://www.baidu.com/mx/v12.mp4',
|
|
185
|
-
* duration: '100',
|
|
186
|
-
* image: 'https://smartprogram.baidu.com/docs/img/image-scaleToFill.png'
|
|
187
|
-
* }],
|
|
188
|
-
* visit: {
|
|
189
|
-
* pv: '1000',
|
|
190
|
-
* uv: '100',
|
|
191
|
-
* sessionDuration: '130'
|
|
192
|
-
* },
|
|
193
|
-
* likes: '75',
|
|
194
|
-
* comments: '13',
|
|
195
|
-
* collects: '23',
|
|
196
|
-
* shares: '8',
|
|
197
|
-
* followers: '35',
|
|
198
|
-
* success: res => {
|
|
199
|
-
* console.log('setPageInfo success');
|
|
200
|
-
* },
|
|
201
|
-
* fail: err => {
|
|
202
|
-
* console.log('setPageInfo fail', err);
|
|
203
|
-
* }
|
|
204
|
-
* })
|
|
205
|
-
* ```
|
|
206
|
-
* @see https://smartprogram.baidu.com/docs/develop/api/open/swan-setPageInfo/
|
|
207
|
-
*/
|
|
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
|
|
250
|
-
}
|
|
251
|
-
}
|
package/types/api/swan/pay.d.ts
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import type Webpack from 'webpack'
|
|
2
|
-
import type Chain from 'webpack-chain'
|
|
3
|
-
import type webpackDevServer from 'webpack-dev-server'
|
|
4
|
-
import type HtmlWebpackPlugin from 'html-webpack-plugin'
|
|
5
|
-
import type { IOption, IPostcssOption, IUrlLoaderOption } from './util'
|
|
6
|
-
import type { OutputOptions as RollupOutputOptions } from 'rollup'
|
|
7
|
-
import type { Compiler, CompilerTypes, CompilerWebpackTypes } from '../compiler'
|
|
8
|
-
import type { OutputExt } from './project'
|
|
9
|
-
import type { ServerOptions as ViteServerOptions } from 'vite'
|
|
10
|
-
|
|
11
|
-
export interface IH5RouterConfig {
|
|
12
|
-
/** 配置路由模式 */
|
|
13
|
-
mode?: 'hash' | 'browser' | 'multi'
|
|
14
|
-
/** 配置自定义路由 */
|
|
15
|
-
customRoutes?: IOption
|
|
16
|
-
/** 配置路由基准路径 */
|
|
17
|
-
basename?: string
|
|
18
|
-
lazyload?: boolean | ((pagename: string) => boolean)
|
|
19
|
-
renamePagename?: (pagename: string) => string
|
|
20
|
-
forcePath?: string
|
|
21
|
-
/** 加上这个参数,可以解决返回页面的时候白屏的问题,但是某些不支持 :has() 选择器的浏览器会有问题 */
|
|
22
|
-
enhanceAnimation?: boolean
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
|
|
26
|
-
/** 设置输出解析文件的目录(默认值:'/')*/
|
|
27
|
-
publicPath?: string
|
|
28
|
-
|
|
29
|
-
/** h5 编译后的静态文件目录(默认值:'static') */
|
|
30
|
-
staticDirectory?: string
|
|
31
|
-
|
|
32
|
-
/** 编译后非 entry 的 js 文件的存放目录,主要影响动态引入的 pages 的存放路径(默认值:'chunk') */
|
|
33
|
-
chunkDirectory?: string
|
|
34
|
-
|
|
35
|
-
webpack?: ((webpackConfig: Webpack.Configuration, webpack) => Webpack.Configuration) | Webpack.Configuration
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* 自定义 Webpack 配置
|
|
39
|
-
* @param chain [webpackChain](https://github.com/neutrinojs/webpack-chain) 对象
|
|
40
|
-
* @param webpack webpack 实例
|
|
41
|
-
*/
|
|
42
|
-
webpackChain?: (chain: Chain, webpack: typeof Webpack) => void
|
|
43
|
-
|
|
44
|
-
/** webpack 编译模式下,可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/)
|
|
45
|
-
* vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/)
|
|
46
|
-
*/
|
|
47
|
-
output?: T extends 'vite'
|
|
48
|
-
? Pick<RollupOutputOptions, 'chunkFileNames' | 'assetFileNames'> & OutputExt
|
|
49
|
-
: Webpack.Configuration['output']
|
|
50
|
-
|
|
51
|
-
/** 路由相关的配置 */
|
|
52
|
-
router?: IH5RouterConfig
|
|
53
|
-
|
|
54
|
-
/** 预览服务的配置,可以更改端口等参数。具体配置参考 [webpack-dev-server](https://webpack.js.org/configuration/dev-server) */
|
|
55
|
-
// 修改后:同时支持 Webpack 和 Vite
|
|
56
|
-
devServer?: T extends 'vite' ? ViteServerOptions : webpackDevServer.Configuration
|
|
57
|
-
|
|
58
|
-
/** 用于控制是否生成 js、css 对应的 sourceMap (默认值:watch 模式下为 true,否则为 false) */
|
|
59
|
-
enableSourceMap?: boolean
|
|
60
|
-
|
|
61
|
-
/** 具体配置请参考 [Webpack devtool](https://webpack.js.org/configuration/devtool/#devtool) 配置 (默认值:'cheap-module-eval-source-map')*/
|
|
62
|
-
sourceMapType?:
|
|
63
|
-
| 'none'
|
|
64
|
-
| 'eval'
|
|
65
|
-
| 'cheap-eval-source-map'
|
|
66
|
-
| 'cheap-module-eval-source-map'
|
|
67
|
-
| 'eval-source-map'
|
|
68
|
-
| 'cheap-source-map'
|
|
69
|
-
| 'cheap-module-source-map'
|
|
70
|
-
| 'inline-cheap-source-map'
|
|
71
|
-
| 'inline-cheap-module-source-map'
|
|
72
|
-
| 'source-map'
|
|
73
|
-
| 'inline-source-map'
|
|
74
|
-
| 'hidden-source-map'
|
|
75
|
-
| 'nosources-source-map'
|
|
76
|
-
|
|
77
|
-
/** extract 功能开关,开启后将使用 mini-css-extract-plugin 分离 css 文件,可通过 h5.miniCssExtractPluginOption 对插件进行配置 (默认值:watch 模式下为 false,否则为 true) */
|
|
78
|
-
enableExtract?: boolean
|
|
79
|
-
|
|
80
|
-
/** [css-loader](https://github.com/webpack-contrib/css-loader) 的附加配置 */
|
|
81
|
-
cssLoaderOption?: IOption
|
|
82
|
-
|
|
83
|
-
/** [style-loader](https://github.com/webpack-contrib/style-loader) 的附加配置 */
|
|
84
|
-
styleLoaderOption?: IOption
|
|
85
|
-
|
|
86
|
-
/** [sass-loader](https://github.com/webpack-contrib/sass-loader) 的附加配置 */
|
|
87
|
-
sassLoaderOption?: IOption
|
|
88
|
-
|
|
89
|
-
/** [less-loader](https://github.com/webpack-contrib/less-loader) 的附加配置 */
|
|
90
|
-
lessLoaderOption?: IOption
|
|
91
|
-
|
|
92
|
-
/** [stylus-loader](https://github.com/shama/stylus-loader) 的附加配置 */
|
|
93
|
-
stylusLoaderOption?: IOption
|
|
94
|
-
|
|
95
|
-
/** 针对 mp4 | webm | ogg | mp3 | wav | flac | aac 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */
|
|
96
|
-
mediaUrlLoaderOption?: IUrlLoaderOption
|
|
97
|
-
|
|
98
|
-
/** 针对 woff | woff2 | eot | ttf | otf 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */
|
|
99
|
-
fontUrlLoaderOption?: IUrlLoaderOption
|
|
100
|
-
|
|
101
|
-
/** 针对 png | jpg | jpeg | gif | bpm | svg 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */
|
|
102
|
-
imageUrlLoaderOption?: IUrlLoaderOption
|
|
103
|
-
|
|
104
|
-
/** [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) 的附加配置 */
|
|
105
|
-
miniCssExtractPluginOption?: IOption
|
|
106
|
-
|
|
107
|
-
/** 配置需要额外的经由 Taro 预设的 postcss 编译的模块 */
|
|
108
|
-
esnextModules?: string[]
|
|
109
|
-
|
|
110
|
-
/** 用于控制在 H5 端是否使用兼容性组件库,详情请看 [React 兼容性组件库](https://taro-docs.jd.com/docs/h5#react-兼容性组件库)。(默认值:false) */
|
|
111
|
-
useHtmlComponents?: boolean
|
|
112
|
-
|
|
113
|
-
/** 用于控制在 H5 端是否使用旧版本适配器,旧版本采用全局注册组件,懒加载组件相关依赖;新版本适配器会自动注册相关组件,不再需要引入 @spcsn/taro-components/loader 中的全局 defineCustomElements 方法。(默认值:false) */
|
|
114
|
-
useDeprecatedAdapterComponent?: boolean
|
|
115
|
-
|
|
116
|
-
/** 配置 postcss 相关插件 */
|
|
117
|
-
postcss?: IPostcssOption<'h5'>
|
|
118
|
-
|
|
119
|
-
/** html-webpack-plugin 的具体配置 */
|
|
120
|
-
htmlPluginOption?: HtmlWebpackPlugin.Options
|
|
121
|
-
|
|
122
|
-
/** Web 编译过程的相关配置 */
|
|
123
|
-
compile?: {
|
|
124
|
-
exclude?: any[]
|
|
125
|
-
include?: any[]
|
|
126
|
-
/** 对应 Babel transform 插件的 filter 配置。只在 vite 编译模式下有效 */
|
|
127
|
-
filter?: (filename: string) => boolean
|
|
128
|
-
}
|
|
129
|
-
/** 生成的代码是否要兼容旧版浏览器,值为 true 时,会去读取 package.json 的 browserslist 字段。只在 vite 编译模式下有效 */
|
|
130
|
-
legacy?: T extends 'vite' ? boolean : undefined
|
|
131
|
-
|
|
132
|
-
/** 使用的编译工具。可选值:webpack5、vite */
|
|
133
|
-
compiler?: Compiler<T>
|
|
134
|
-
}
|