@spcsn/taro 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -0
- package/index.js +9 -0
- package/package.json +86 -0
- package/types/api/ad/index.d.ts +197 -0
- package/types/api/ai/face.d.ts +133 -0
- package/types/api/ai/inference.d.ts +129 -0
- package/types/api/ai/visionkit.d.ts +874 -0
- package/types/api/alipay/index.d.ts +69 -0
- package/types/api/base/crypto.d.ts +104 -0
- package/types/api/base/debug.d.ts +329 -0
- package/types/api/base/env.d.ts +19 -0
- package/types/api/base/index.d.ts +102 -0
- package/types/api/base/performance.d.ts +258 -0
- package/types/api/base/system.d.ts +742 -0
- package/types/api/base/update.d.ts +130 -0
- package/types/api/base/weapp/app-event.d.ts +265 -0
- package/types/api/base/weapp/life-cycle.d.ts +155 -0
- package/types/api/canvas/index.d.ts +2162 -0
- package/types/api/cloud/index.d.ts +2622 -0
- package/types/api/data-analysis/index.d.ts +122 -0
- package/types/api/device/accelerometer.d.ts +102 -0
- package/types/api/device/accessibility.d.ts +26 -0
- package/types/api/device/battery.d.ts +46 -0
- package/types/api/device/bluetooth-ble.d.ts +601 -0
- package/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/types/api/device/bluetooth.d.ts +463 -0
- package/types/api/device/calendar.d.ts +98 -0
- package/types/api/device/clipboard.d.ts +81 -0
- package/types/api/device/compass.d.ts +105 -0
- package/types/api/device/contact.d.ts +110 -0
- package/types/api/device/gyroscope.d.ts +85 -0
- package/types/api/device/iBeacon.d.ts +168 -0
- package/types/api/device/keyboard.d.ts +97 -0
- package/types/api/device/memory.d.ts +52 -0
- package/types/api/device/motion.d.ts +88 -0
- package/types/api/device/network.d.ts +172 -0
- package/types/api/device/nfc.d.ts +1238 -0
- package/types/api/device/phone.d.ts +30 -0
- package/types/api/device/scan.d.ts +111 -0
- package/types/api/device/screen.d.ts +217 -0
- package/types/api/device/sms.d.ts +26 -0
- package/types/api/device/vibrate.d.ts +51 -0
- package/types/api/device/wifi.d.ts +301 -0
- package/types/api/ext/index.d.ts +64 -0
- package/types/api/files/index.d.ts +1472 -0
- package/types/api/framework/index.d.ts +51 -0
- package/types/api/location/index.d.ts +517 -0
- package/types/api/media/audio.d.ts +1013 -0
- package/types/api/media/background-audio.d.ts +291 -0
- package/types/api/media/camera.d.ts +207 -0
- package/types/api/media/editor.d.ts +239 -0
- package/types/api/media/image.d.ts +469 -0
- package/types/api/media/live.d.ts +461 -0
- package/types/api/media/map.d.ts +638 -0
- package/types/api/media/media-recorder.d.ts +117 -0
- package/types/api/media/recorder.d.ts +317 -0
- package/types/api/media/video-decoder.d.ts +117 -0
- package/types/api/media/video-processing.d.ts +84 -0
- package/types/api/media/video.d.ts +527 -0
- package/types/api/media/voip.d.ts +393 -0
- package/types/api/navigate/index.d.ts +327 -0
- package/types/api/network/download.d.ts +173 -0
- package/types/api/network/mdns.d.ts +191 -0
- package/types/api/network/request.d.ts +480 -0
- package/types/api/network/tcp.d.ts +181 -0
- package/types/api/network/udp.d.ts +218 -0
- package/types/api/network/upload.d.ts +201 -0
- package/types/api/network/websocket.d.ts +383 -0
- package/types/api/open-api/account.d.ts +51 -0
- package/types/api/open-api/address.d.ts +68 -0
- package/types/api/open-api/authorize.d.ts +80 -0
- package/types/api/open-api/card.d.ts +110 -0
- package/types/api/open-api/channels.d.ts +225 -0
- package/types/api/open-api/customer-service.d.ts +45 -0
- package/types/api/open-api/device-voip.d.ts +103 -0
- package/types/api/open-api/facial.d.ts +98 -0
- package/types/api/open-api/favorites.d.ts +101 -0
- package/types/api/open-api/group.d.ts +59 -0
- package/types/api/open-api/invoice.d.ts +87 -0
- package/types/api/open-api/license-plate.d.ts +27 -0
- package/types/api/open-api/login.d.ts +115 -0
- package/types/api/open-api/my-miniprogram.d.ts +28 -0
- package/types/api/open-api/privacy.d.ts +107 -0
- package/types/api/open-api/redpackage.d.ts +24 -0
- package/types/api/open-api/settings.d.ts +174 -0
- package/types/api/open-api/soter.d.ts +184 -0
- package/types/api/open-api/sticker.d.ts +83 -0
- package/types/api/open-api/subscribe-message.d.ts +305 -0
- package/types/api/open-api/user-info.d.ts +182 -0
- package/types/api/open-api/werun.d.ts +101 -0
- package/types/api/payment/index.d.ts +119 -0
- package/types/api/qq/index.d.ts +354 -0
- package/types/api/route/index.d.ts +324 -0
- package/types/api/share/index.d.ts +354 -0
- package/types/api/skyline/index.d.ts +345 -0
- package/types/api/storage/background-fetch.d.ts +131 -0
- package/types/api/storage/cache-manager.d.ts +249 -0
- package/types/api/storage/index.d.ts +405 -0
- package/types/api/swan/bookshelf.d.ts +307 -0
- package/types/api/swan/download-package.d.ts +80 -0
- package/types/api/swan/index.d.ts +251 -0
- package/types/api/swan/pay.d.ts +139 -0
- package/types/api/taro.extend.d.ts +233 -0
- package/types/api/taro.hooks.d.ts +148 -0
- package/types/api/ui/animation.d.ts +427 -0
- package/types/api/ui/background.d.ts +69 -0
- package/types/api/ui/custom-component.d.ts +23 -0
- package/types/api/ui/fonts.d.ts +77 -0
- package/types/api/ui/interaction.d.ts +281 -0
- package/types/api/ui/menu.d.ts +29 -0
- package/types/api/ui/navigation-bar.d.ts +130 -0
- package/types/api/ui/pull-down-refresh.d.ts +50 -0
- package/types/api/ui/scroll.d.ts +114 -0
- package/types/api/ui/sticky.d.ts +32 -0
- package/types/api/ui/tab-bar.d.ts +196 -0
- package/types/api/ui/window.d.ts +71 -0
- package/types/api/worker/index.d.ts +83 -0
- package/types/api/wxml/index.d.ts +540 -0
- package/types/compile/compiler.d.ts +32 -0
- package/types/compile/config/h5.d.ts +134 -0
- package/types/compile/config/harmony.d.ts +118 -0
- package/types/compile/config/index.d.ts +8 -0
- package/types/compile/config/manifest.d.ts +155 -0
- package/types/compile/config/mini.d.ts +118 -0
- package/types/compile/config/plugin.d.ts +34 -0
- package/types/compile/config/project.d.ts +338 -0
- package/types/compile/config/rn.d.ts +85 -0
- package/types/compile/config/util.d.ts +179 -0
- package/types/compile/hooks.d.ts +13 -0
- package/types/compile/index.d.ts +11 -0
- package/types/compile/viteCompilerContext.d.ts +167 -0
- package/types/global.d.ts +428 -0
- package/types/index.d.ts +190 -0
- package/types/taro.api.d.ts +130 -0
- package/types/taro.component.d.ts +168 -0
- package/types/taro.config.d.ts +712 -0
- package/types/taro.lifecycle.d.ts +220 -0
- package/types/taro.runtime.d.ts +9 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace getUserInfo {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
|
+
/** 接口调用失败的回调函数 */
|
|
9
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 显示用户信息的语言 */
|
|
11
|
+
lang?: keyof UserInfo.Language
|
|
12
|
+
/** 接口调用成功的回调函数 */
|
|
13
|
+
success?: (result: SuccessCallbackResult) => void
|
|
14
|
+
/** 是否带上登录态信息。当 withCredentials 为 true 时,要求此前有调用过 Taro.login 且登录态尚未过期,此时返回的数据会包含 encryptedData, iv 等敏感信息;当 withCredentials 为 false 时,不要求有登录态,返回的数据不包含 encryptedData, iv 等敏感信息。 */
|
|
15
|
+
withCredentials?: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
19
|
+
/** 敏感数据对应的云 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) */
|
|
20
|
+
cloudID?: string
|
|
21
|
+
/** 包括敏感数据在内的完整用户信息的加密数据,详见 [用户数据的签名验证和加解密](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) */
|
|
22
|
+
encryptedData: string
|
|
23
|
+
/** 加密算法的初始向量,详见 [用户数据的签名验证和加解密](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) */
|
|
24
|
+
iv: string
|
|
25
|
+
/** 不包括敏感信息的原始数据字符串,用于计算签名 */
|
|
26
|
+
rawData: string
|
|
27
|
+
/** 使用 sha1( rawData + sessionkey ) 得到字符串,用于校验用户信息,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
|
|
28
|
+
signature: string
|
|
29
|
+
/** 用户信息对象,不包含 openid 等敏感信息 */
|
|
30
|
+
userInfo: UserInfo
|
|
31
|
+
/** 调用结果 */
|
|
32
|
+
errMsg: string
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
namespace getUserProfile {
|
|
37
|
+
interface Option {
|
|
38
|
+
/** 显示用户信息的语言 */
|
|
39
|
+
lang?: keyof UserInfo.Language
|
|
40
|
+
/** 声明获取用户个人信息后的用途,不超过30个字符 */
|
|
41
|
+
desc: string
|
|
42
|
+
/** 当宿主未登录时,是否强制拉起登录框
|
|
43
|
+
* @supported tt
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
force?: boolean
|
|
47
|
+
/** 接口调用成功的回调函数 */
|
|
48
|
+
success?: (result: SuccessCallbackResult) => void
|
|
49
|
+
/** 接口调用失败的回调函数 */
|
|
50
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
51
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
52
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface SuccessCallbackResult extends getUserInfo.SuccessCallbackResult {
|
|
56
|
+
/** 用户信息对象 */
|
|
57
|
+
userInfo: UserInfo
|
|
58
|
+
/** 不包括敏感信息的原始数据字符串,用于计算签名 */
|
|
59
|
+
rawData: string
|
|
60
|
+
/** 使用 sha1( rawData + sessionkey ) 得到字符串,用于校验用户信息,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
|
|
61
|
+
signature: string
|
|
62
|
+
/** 包括敏感数据在内的完整用户信息的加密数据,详见 [用户数据的签名验证和加解密](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) */
|
|
63
|
+
encryptedData: string
|
|
64
|
+
/** 加密算法的初始向量,详见 [用户数据的签名验证和加解密](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) */
|
|
65
|
+
iv: string
|
|
66
|
+
/** 敏感数据对应的云 ID,开通云开发的小程序才会返回,可通过云调用直接获取开放数据,详细 [见云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */
|
|
67
|
+
cloudID: string
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** 用户信息
|
|
72
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/UserInfo.html
|
|
73
|
+
*/
|
|
74
|
+
interface UserInfo {
|
|
75
|
+
/** 用户昵称 */
|
|
76
|
+
nickName: string
|
|
77
|
+
/** 用户头像图片的 URL。URL 最后一个数值代表正方形头像大小(有 0、46、64、96、132 数值可选,0 代表 640x640 的正方形头像,46 表示 46x46 的正方形头像,剩余数值以此类推。默认132),用户没有头像时该项为空。若用户更换头像,原有头像 URL 将失效。 */
|
|
78
|
+
avatarUrl: string
|
|
79
|
+
/** 用户性别。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
|
|
80
|
+
gender?: keyof UserInfo.Gender
|
|
81
|
+
/** 用户所在国家。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
|
|
82
|
+
country: string
|
|
83
|
+
/** 用户所在省份。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
|
|
84
|
+
province: string
|
|
85
|
+
/** 用户所在城市。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
|
|
86
|
+
city: string
|
|
87
|
+
/** 显示 country,province,city 所用的语言。强制返回 “zh_CN”,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
|
|
88
|
+
language: keyof UserInfo.Language
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
namespace UserInfo {
|
|
92
|
+
interface Language {
|
|
93
|
+
en: '英文'
|
|
94
|
+
zh_CN: '简体中文'
|
|
95
|
+
zh_TW: '繁体中文'
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
interface Gender {
|
|
99
|
+
0: '未知'
|
|
100
|
+
1: '男性'
|
|
101
|
+
2: '女性'
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface TaroStatic {
|
|
106
|
+
/** 获取用户信息。
|
|
107
|
+
*
|
|
108
|
+
* **接口调整说明**
|
|
109
|
+
* 在用户未授权过的情况下调用此接口,将不再出现授权弹窗,会直接进入 fail 回调(详见[《公告》](https://developers.weixin.qq.com/community/develop/doc/0000a26e1aca6012e896a517556c01))。在用户已授权的情况下调用此接口,可成功获取用户信息。
|
|
110
|
+
* @supported weapp, jd, qq, tt, harmony_hybrid
|
|
111
|
+
* @example
|
|
112
|
+
* ```tsx
|
|
113
|
+
* // 必须是在用户已经授权的情况下调用
|
|
114
|
+
*
|
|
115
|
+
* Taro.getUserInfo({
|
|
116
|
+
* success: function(res) {
|
|
117
|
+
* var userInfo = res.userInfo
|
|
118
|
+
* var nickName = userInfo.nickName
|
|
119
|
+
* var avatarUrl = userInfo.avatarUrl
|
|
120
|
+
* var gender = userInfo.gender //性别 0:未知、1:男、2:女
|
|
121
|
+
* var province = userInfo.province
|
|
122
|
+
* var city = userInfo.city
|
|
123
|
+
* var country = userInfo.country
|
|
124
|
+
* }
|
|
125
|
+
* })
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* 敏感数据有两种获取方式,一是使用 [加密数据解密算法](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) 。
|
|
129
|
+
* 获取得到的开放数据为以下 json 结构:
|
|
130
|
+
*
|
|
131
|
+
* ```json
|
|
132
|
+
* {
|
|
133
|
+
* "openId": "OPENID",
|
|
134
|
+
* "nickName": "NICKNAME",
|
|
135
|
+
* "gender": GENDER,
|
|
136
|
+
* "city": "CITY",
|
|
137
|
+
* "province": "PROVINCE",
|
|
138
|
+
* "country": "COUNTRY",
|
|
139
|
+
* "avatarUrl": "AVATARURL",
|
|
140
|
+
* "unionId": "UNIONID",
|
|
141
|
+
* "watermark": {
|
|
142
|
+
* "appid":"APPID",
|
|
143
|
+
* "timestamp": TIMESTAMP
|
|
144
|
+
* }
|
|
145
|
+
* }
|
|
146
|
+
* ```
|
|
147
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html
|
|
148
|
+
*/
|
|
149
|
+
getUserInfo(option?: getUserInfo.Option): Promise<getUserInfo.SuccessCallbackResult>
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* 获取用户信息。每次请求都会弹出授权窗口,用户同意后返回 `userInfo`。
|
|
153
|
+
*
|
|
154
|
+
* 若开发者需要获取用户的个人信息(头像、昵称、性别与地区),可以通过 Taro.getUserProfile 接口进行获取,
|
|
155
|
+
*
|
|
156
|
+
* 微信该接口从基础库 **2.10.4** 版本开始支持,该接口只返回用户个人信息,不包含用户身份标识符。该接口中 desc 属性(声明获取用户个人信息后的用途)后续会展示在弹窗中,请开发者谨慎填写。
|
|
157
|
+
*
|
|
158
|
+
* 开发者每次通过该接口获取用户个人信息均需用户确认,请开发者妥善保管用户快速填写的头像昵称,避免重复弹窗。
|
|
159
|
+
*
|
|
160
|
+
* [微信端调整背景和说明,请参考文档](https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801)
|
|
161
|
+
* @supported weapp, tt
|
|
162
|
+
* @example
|
|
163
|
+
* 推荐使用 Taro.getUserProfile 获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
|
|
164
|
+
*
|
|
165
|
+
* ```tsx
|
|
166
|
+
* Taro.getUserProfile({
|
|
167
|
+
* desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
|
168
|
+
* success: (res) => {
|
|
169
|
+
* // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
|
|
170
|
+
* this.setState({
|
|
171
|
+
* userInfo: res.userInfo,
|
|
172
|
+
* hasUserInfo: true
|
|
173
|
+
* })
|
|
174
|
+
* }
|
|
175
|
+
* })
|
|
176
|
+
* ```
|
|
177
|
+
* @since 2.2.17+,3.0.29+
|
|
178
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html
|
|
179
|
+
*/
|
|
180
|
+
getUserProfile(option: getUserProfile.Option): Promise<getUserProfile.SuccessCallbackResult>
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace shareToWeRun {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 运动数据列表 */
|
|
7
|
+
recordList: record[]
|
|
8
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
9
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 接口调用失败的回调函数 */
|
|
11
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
12
|
+
/** 接口调用成功的回调函数 */
|
|
13
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
14
|
+
}
|
|
15
|
+
interface record {
|
|
16
|
+
/** 运动项目id */
|
|
17
|
+
typeId: number
|
|
18
|
+
/** 运动时长 */
|
|
19
|
+
time: number
|
|
20
|
+
/** 运动距离 */
|
|
21
|
+
distance: number
|
|
22
|
+
/** 消耗卡路里 */
|
|
23
|
+
calorie: number
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
namespace getWeRunData {
|
|
28
|
+
interface Option {
|
|
29
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
30
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
31
|
+
/** 接口调用失败的回调函数 */
|
|
32
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
33
|
+
/** 接口调用成功的回调函数 */
|
|
34
|
+
success?: (
|
|
35
|
+
result: SuccessCallbackResult,
|
|
36
|
+
) => void
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
40
|
+
/** 敏感数据对应的云 ID,开通云开发的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */
|
|
41
|
+
cloudID?: string
|
|
42
|
+
/** 包括敏感数据在内的完整用户信息的加密数据,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html)。解密后得到的数据结构见后文 */
|
|
43
|
+
encryptedData: string
|
|
44
|
+
/** 加密算法的初始向量,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
|
|
45
|
+
iv: string
|
|
46
|
+
/** 调用结果 */
|
|
47
|
+
errMsg: string
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface TaroStatic {
|
|
52
|
+
/** 分享数据到微信运动。
|
|
53
|
+
* @supported weapp
|
|
54
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.shareToWeRun.html
|
|
55
|
+
*/
|
|
56
|
+
shareToWeRun(option?: shareToWeRun.Option): Promise<TaroGeneral.CallbackResult>
|
|
57
|
+
|
|
58
|
+
/** 获取用户过去三十天微信运动步数。需要先调用 Taro.login 接口。步数信息会在用户主动进入小程序时更新。
|
|
59
|
+
* @supported weapp
|
|
60
|
+
* @example
|
|
61
|
+
* ```tsx
|
|
62
|
+
* Taro.getWeRunData({
|
|
63
|
+
* success: function (res) {
|
|
64
|
+
* // 拿 encryptedData 到开发者后台解密开放数据
|
|
65
|
+
* const encryptedData = res.encryptedData
|
|
66
|
+
* // 或拿 cloudID 通过云调用直接获取开放数据
|
|
67
|
+
* const cloudID = res.cloudID
|
|
68
|
+
* }
|
|
69
|
+
* })
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* **开放数据 JSON 结构**
|
|
73
|
+
* 敏感数据有两种获取方式,一是使用 [加密数据解密算法](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) 。
|
|
74
|
+
* 获取得到的开放数据为以下 json 结构:
|
|
75
|
+
*
|
|
76
|
+
* ```json
|
|
77
|
+
* {
|
|
78
|
+
* "stepInfoList": [
|
|
79
|
+
* {
|
|
80
|
+
* "timestamp": 1445866601,
|
|
81
|
+
* "step": 100
|
|
82
|
+
* },
|
|
83
|
+
* {
|
|
84
|
+
* "timestamp": 1445876601,
|
|
85
|
+
* "step": 120
|
|
86
|
+
* }
|
|
87
|
+
* ]
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* stepInfoList 中,每一项结构如下:
|
|
92
|
+
*
|
|
93
|
+
* | 属性 | 类型 | 说明 |
|
|
94
|
+
* | --- | ---- | --- |
|
|
95
|
+
* | timestamp | number | 时间戳,表示数据对应的时间 |
|
|
96
|
+
* | step | number | 微信运动步数 |
|
|
97
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html
|
|
98
|
+
*/
|
|
99
|
+
getWeRunData(option?: getWeRunData.Option): Promise<getWeRunData.SuccessCallbackResult>
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace requestPayment {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 时间戳,从 1970 年 1 月 1 日 00:00:00 至今的秒数,即当前的时间 */
|
|
7
|
+
timeStamp: string
|
|
8
|
+
/** 随机字符串,长度为32个字符以下 */
|
|
9
|
+
nonceStr: string
|
|
10
|
+
/** 统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=*** */
|
|
11
|
+
package: string
|
|
12
|
+
/** 签名算法 */
|
|
13
|
+
signType?: keyof SignType
|
|
14
|
+
/** 签名,具体签名方案参见 [小程序支付接口文档](https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=3) */
|
|
15
|
+
paySign: string
|
|
16
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
17
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
18
|
+
/** 接口调用失败的回调函数 */
|
|
19
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
20
|
+
/** 接口调用成功的回调函数 */
|
|
21
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface SignType {
|
|
25
|
+
/** 仅在微信支付 v2 版本接口适用 */
|
|
26
|
+
MD5
|
|
27
|
+
/** 仅在微信支付 v2 版本接口适用 */
|
|
28
|
+
'HMAC-SHA256'
|
|
29
|
+
/** 仅在微信支付 v3 版本接口适用 */
|
|
30
|
+
RSA
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
namespace requestOrderPayment {
|
|
35
|
+
interface Option {
|
|
36
|
+
/** 时间戳,从 1970 年 1 月 1 日 00:00:00 至今的秒数,即当前的时间 */
|
|
37
|
+
timeStamp: string
|
|
38
|
+
/** 随机字符串,长度为32个字符以下 */
|
|
39
|
+
nonceStr: string
|
|
40
|
+
/** 统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=*** */
|
|
41
|
+
package: string
|
|
42
|
+
/** 订单信息,仅在需要校验的场景下需要传递,具体见[接口说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent2/API/order/requestOrderPayment) */
|
|
43
|
+
orderInfo?
|
|
44
|
+
/** 外部 APP 用户 ID */
|
|
45
|
+
extUserUin?: string
|
|
46
|
+
/** 签名算法 */
|
|
47
|
+
signType?: keyof SignType
|
|
48
|
+
/** 签名,具体签名方案参见 [小程序支付接口文档](https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=3) */
|
|
49
|
+
paySign: string
|
|
50
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
51
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
52
|
+
/** 接口调用失败的回调函数 */
|
|
53
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
54
|
+
/** 接口调用成功的回调函数 */
|
|
55
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface SignType {
|
|
59
|
+
/** 仅在微信支付 v2 版本接口适用 */
|
|
60
|
+
MD5
|
|
61
|
+
/** 仅在微信支付 v2 版本接口适用 */
|
|
62
|
+
'HMAC-SHA256'
|
|
63
|
+
/** 仅在微信支付 v3 版本接口适用 */
|
|
64
|
+
RSA
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface TaroStatic {
|
|
69
|
+
/** 发起微信支付。了解更多信息,请查看[微信支付接口文档](https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_3&index=1)
|
|
70
|
+
* @supported weapp, h5
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* Taro.requestPayment({
|
|
74
|
+
* timeStamp: '',
|
|
75
|
+
* nonceStr: '',
|
|
76
|
+
* package: '',
|
|
77
|
+
* signType: 'MD5',
|
|
78
|
+
* paySign: '',
|
|
79
|
+
* success: function (res) { },
|
|
80
|
+
* fail: function (res) { }
|
|
81
|
+
* })
|
|
82
|
+
* ```
|
|
83
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.requestPayment.html
|
|
84
|
+
*/
|
|
85
|
+
requestPayment(option: requestPayment.Option): Promise<TaroGeneral.CallbackResult>
|
|
86
|
+
|
|
87
|
+
/** 创建自定义版交易组件订单,并发起支付。 仅接入了[自定义版交易组件](https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent2/Introduction2)的小程序需要使用,普通小程序可直接使用 `Taro.requestPayment`。
|
|
88
|
+
* @supported weapp
|
|
89
|
+
* @example
|
|
90
|
+
* 除 orderInfo 以外,其余字段与 [Taro.requestPayment](./requestPayment) 一致
|
|
91
|
+
*
|
|
92
|
+
* ```tsx
|
|
93
|
+
* Taro.requestOrderPayment({
|
|
94
|
+
* orderInfo: {},
|
|
95
|
+
* timeStamp: '',
|
|
96
|
+
* nonceStr: '',
|
|
97
|
+
* package: '',
|
|
98
|
+
* signType: 'MD5',
|
|
99
|
+
* paySign: '',
|
|
100
|
+
* success (res) { },
|
|
101
|
+
* fail (res) { }
|
|
102
|
+
* })
|
|
103
|
+
* ```
|
|
104
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.requestOrderPayment.html
|
|
105
|
+
*/
|
|
106
|
+
requestOrderPayment(option: requestOrderPayment.Option): Promise<TaroGeneral.CallbackResult>
|
|
107
|
+
|
|
108
|
+
/** 支付各个安全场景验证人脸
|
|
109
|
+
* @supported weapp
|
|
110
|
+
* @deprecated
|
|
111
|
+
* @example
|
|
112
|
+
* ```tsx
|
|
113
|
+
* Taro.faceVerifyForPay(params).then(...)
|
|
114
|
+
* ```
|
|
115
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/payment/wx.faceVerifyForPay.html
|
|
116
|
+
*/
|
|
117
|
+
faceVerifyForPay(option: any): Promise<any>
|
|
118
|
+
}
|
|
119
|
+
}
|