@tarojs/taro 3.5.0-canary.1 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/html.css +50 -14
  2. package/html5.css +167 -64
  3. package/index.js +3 -4
  4. package/package.json +21 -11
  5. package/types/api/ad/index.d.ts +2 -2
  6. package/types/api/ai/face.d.ts +133 -0
  7. package/types/api/ai/visionkit.d.ts +303 -0
  8. package/types/api/base/crypto.d.ts +90 -0
  9. package/types/api/base/debug.d.ts +152 -13
  10. package/types/api/base/env.d.ts +2 -1
  11. package/types/api/base/index.d.ts +11 -3
  12. package/types/api/base/performance.d.ts +195 -0
  13. package/types/api/base/system.d.ts +541 -103
  14. package/types/api/base/update.d.ts +60 -8
  15. package/types/api/base/weapp/app-event.d.ts +99 -37
  16. package/types/api/base/weapp/life-cycle.d.ts +142 -2
  17. package/types/api/canvas/index.d.ts +151 -137
  18. package/types/api/cloud/index.d.ts +17 -2
  19. package/types/api/data-analysis/index.d.ts +1 -1
  20. package/types/api/device/accelerometer.d.ts +6 -6
  21. package/types/api/device/accessibility.d.ts +26 -0
  22. package/types/api/device/battery.d.ts +2 -2
  23. package/types/api/device/{ble.d.ts → bluetooth-ble.d.ts} +228 -62
  24. package/types/api/device/bluetooth-peripheral.d.ts +430 -0
  25. package/types/api/device/bluetooth.d.ts +67 -2
  26. package/types/api/device/calendar.d.ts +88 -0
  27. package/types/api/device/clipboard.d.ts +2 -2
  28. package/types/api/device/compass.d.ts +3 -3
  29. package/types/api/device/contact.d.ts +74 -50
  30. package/types/api/device/gyroscope.d.ts +6 -6
  31. package/types/api/device/iBeacon.d.ts +33 -19
  32. package/types/api/{ui → device}/keyboard.d.ts +1 -1
  33. package/types/api/device/{performance.d.ts → memory.d.ts} +5 -5
  34. package/types/api/device/motion.d.ts +3 -3
  35. package/types/api/device/network.d.ts +56 -15
  36. package/types/api/device/nfc.d.ts +1089 -13
  37. package/types/api/device/phone.d.ts +1 -1
  38. package/types/api/device/scan.d.ts +1 -1
  39. package/types/api/device/screen.d.ts +42 -14
  40. package/types/api/device/vibrate.d.ts +6 -2
  41. package/types/api/device/wifi.d.ts +44 -9
  42. package/types/api/ext/index.d.ts +2 -2
  43. package/types/api/files/index.d.ts +392 -205
  44. package/types/api/framework/index.d.ts +5 -4
  45. package/types/api/location/index.d.ts +156 -53
  46. package/types/api/media/audio.d.ts +629 -38
  47. package/types/api/media/background-audio.d.ts +9 -9
  48. package/types/api/media/camera.d.ts +41 -22
  49. package/types/api/media/editor.d.ts +22 -2
  50. package/types/api/media/image.d.ts +64 -35
  51. package/types/api/media/live.d.ts +66 -6
  52. package/types/api/media/map.d.ts +474 -54
  53. package/types/api/media/media-recorder.d.ts +92 -0
  54. package/types/api/media/recorder.d.ts +21 -21
  55. package/types/api/media/video-decoder.d.ts +117 -0
  56. package/types/api/media/video-processing.d.ts +11 -7
  57. package/types/api/media/video.d.ts +47 -18
  58. package/types/api/media/voip.d.ts +290 -0
  59. package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +65 -27
  60. package/types/api/network/download.d.ts +61 -19
  61. package/types/api/network/request.d.ts +129 -41
  62. package/types/api/network/tcp.d.ts +181 -0
  63. package/types/api/network/udp.d.ts +154 -83
  64. package/types/api/network/upload.d.ts +55 -28
  65. package/types/api/network/websocket.d.ts +20 -19
  66. package/types/api/open-api/address.d.ts +1 -1
  67. package/types/api/open-api/authorize.d.ts +42 -3
  68. package/types/api/open-api/channels.d.ts +178 -0
  69. package/types/api/open-api/facial.d.ts +3 -0
  70. package/types/api/open-api/favorites.d.ts +100 -0
  71. package/types/api/open-api/group.d.ts +59 -0
  72. package/types/api/open-api/invoice.d.ts +2 -2
  73. package/types/api/open-api/license-plate.d.ts +27 -0
  74. package/types/api/open-api/login.d.ts +21 -0
  75. package/types/api/open-api/redpackage.d.ts +24 -0
  76. package/types/api/open-api/settings.d.ts +82 -17
  77. package/types/api/open-api/soter.d.ts +2 -2
  78. package/types/api/open-api/subscribe-message.d.ts +89 -4
  79. package/types/api/open-api/user-info.d.ts +56 -19
  80. package/types/api/open-api/werun.d.ts +33 -6
  81. package/types/api/payment/index.d.ts +119 -0
  82. package/types/api/route/index.d.ts +18 -14
  83. package/types/api/share/index.d.ts +192 -9
  84. package/types/api/storage/index.d.ts +38 -92
  85. package/types/api/swan/index.d.ts +1 -1
  86. package/types/api/ui/animation.d.ts +105 -155
  87. package/types/api/ui/background.d.ts +4 -2
  88. package/types/api/ui/custom-component.d.ts +1 -1
  89. package/types/api/ui/fonts.d.ts +27 -31
  90. package/types/api/ui/interaction.d.ts +6 -6
  91. package/types/api/ui/menu.d.ts +1 -1
  92. package/types/api/ui/navigation-bar.d.ts +6 -5
  93. package/types/api/ui/pull-down-refresh.d.ts +2 -2
  94. package/types/api/ui/scroll.d.ts +75 -7
  95. package/types/api/ui/sticky.d.ts +4 -4
  96. package/types/api/ui/tab-bar.d.ts +8 -8
  97. package/types/api/ui/window.d.ts +22 -2
  98. package/types/api/worker/index.d.ts +9 -1
  99. package/types/api/wxml/index.d.ts +116 -112
  100. package/types/compile.d.ts +57 -6
  101. package/types/global.d.ts +142 -111
  102. package/types/taro.api.d.ts +79 -62
  103. package/types/taro.component.d.ts +21 -65
  104. package/types/taro.config.d.ts +31 -0
  105. package/types/taro.extend.d.ts +31 -18
  106. package/types/taro.hooks.d.ts +55 -3
  107. package/types/taro.lifecycle.d.ts +21 -14
  108. package/LICENSE +0 -21
  109. package/types/api/open-api/payment.d.ts +0 -61
@@ -4,7 +4,7 @@ declare module '../../index' {
4
4
  namespace requestSubscribeMessage {
5
5
  interface Option {
6
6
  /** 需要订阅的消息模板的id的集合(注意:iOS客户端7.0.6版本、Android客户端7.0.7版本之后的一次性订阅/长期订阅才支持多个模板消息,iOS客户端7.0.5版本、Android客户端7.0.6版本之前的一次订阅只支持一个模板消息)消息模板id在[微信公众平台(mp.weixin.qq.com)-功能-订阅消息]中配置 */
7
- tmplIds: any[]
7
+ tmplIds: string[]
8
8
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
9
9
  complete?: (res: TaroGeneral.CallbackResult) => void
10
10
  /** 接口调用失败的回调函数 */
@@ -36,19 +36,81 @@ declare module '../../index' {
36
36
  * @name [TEMPLATE_ID]
37
37
  * @type "accept" | "reject" | "ban"
38
38
  */
39
- [TEMPLATE_ID: string]: keyof template_reflex | string
39
+ [TEMPLATE_ID: string]: keyof TemplateReflex | string
40
40
  /** 接口调用成功时errMsg值为'requestSubscribeMessage:ok' */
41
41
  errMsg: string
42
42
  }
43
43
 
44
44
  /** 模版消息订阅类型 */
45
- interface template_reflex {
45
+ interface TemplateReflex {
46
46
  /** 表示用户同意订阅该条id对应的模板消息 */
47
47
  accept
48
48
  /** 表示用户拒绝订阅该条id对应的模板消息 */
49
49
  reject
50
50
  /** 表示已被后台封禁 */
51
51
  ban
52
+ /** 表示该模板因为模板标题同名被后台过滤 */
53
+ filter
54
+ }
55
+ }
56
+
57
+ namespace requestSubscribeDeviceMessage {
58
+ interface Option {
59
+ /** 需要订阅的消息模板的 id 的集合,一次调用最多可订阅3条消息 */
60
+ tmplIds: string[]
61
+ /** 设备唯一序列号。由厂商分配,长度不能超过128字节。字符只接受数字,大小写字母,下划线(_)和连字符(-)。 */
62
+ sn: string
63
+ /** 设备票据,5分钟内有效。 */
64
+ snTicket: string
65
+ /** 设备型号 id 。通过微信公众平台注册设备获得。 */
66
+ modelId: string
67
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
68
+ complete?: (res: TaroGeneral.CallbackResult) => void
69
+ /** 接口调用失败的回调函数 */
70
+ fail?: (result: FailCallbackResult) => void
71
+ /** 接口调用成功的回调函数 */
72
+ success?: (result: SuccessCallbackResult) => void
73
+ }
74
+
75
+ interface FailCallbackResult extends TaroGeneral.CallbackResult {
76
+ /** 接口调用失败错误码,有可能为空 */
77
+ errCode: number
78
+ /** 接口调用失败错误信息 */
79
+ errMsg: string
80
+ }
81
+
82
+ /**
83
+ * @example
84
+ * 表示用户同意订阅 zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE 这条消息
85
+ * ```json
86
+ * {
87
+ * "errMsg": "requestSubscribeDeviceMessage:ok",
88
+ * "zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE": "accept"
89
+ * }
90
+ * ```
91
+ */
92
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
93
+ /** [TEMPLATE_ID]是动态的键,即模板id
94
+ * @name [TEMPLATE_ID]
95
+ * @type "accept" | "reject" | "ban" | "filter" | "acceptWithAudio"
96
+ */
97
+ [TEMPLATE_ID: string]: keyof TemplateReflex | string
98
+ /** 接口调用成功时errMsg值为'requestSubscribeMessage:ok' */
99
+ errMsg: string
100
+ }
101
+
102
+ /** 模版消息订阅类型 */
103
+ interface TemplateReflex {
104
+ /** 表示用户同意订阅该条id对应的模板消息 */
105
+ accept
106
+ /** 表示用户拒绝订阅该条id对应的模板消息 */
107
+ reject
108
+ /** 表示已被后台封禁 */
109
+ ban
110
+ /** 表示该模板因为模板标题同名被后台过滤 */
111
+ filter
112
+ /** 表示用户接收订阅消息并开启了语音提醒 */
113
+ acceptWithAudio
52
114
  }
53
115
  }
54
116
 
@@ -56,7 +118,7 @@ declare module '../../index' {
56
118
  /** 请求订阅消息
57
119
  *
58
120
  * 注意:[2.8.2](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为或者发起支付回调后,才可以调起订阅消息界面。
59
- * @supported weapp
121
+ * @supported weapp, tt
60
122
  * @example
61
123
  * ```tsx
62
124
  * Taro.requestSubscribeMessage({
@@ -69,5 +131,28 @@ declare module '../../index' {
69
131
  requestSubscribeMessage(
70
132
  option: requestSubscribeMessage.Option
71
133
  ): Promise<requestSubscribeMessage.SuccessCallbackResult | requestSubscribeMessage.FailCallbackResult>
134
+
135
+ /** 订阅设备消息接口,调用后弹出授权框,用户同意后会允许开发者给用户发送订阅模版消息。当用户点击“允许”按钮时,模板消息会被添加到用户的小程序设置页,通过 wx.getSetting 接口可获取用户对相关模板消息的订阅状态。
136
+ * @supported weapp, tt
137
+ * @example
138
+ * ```tsx
139
+ * Taro.requestSubscribeDeviceMessage({
140
+ * tmplIds: ['xxxxx'],
141
+ * sn: 'xxxx',
142
+ * snTicket: 'xxxxx',
143
+ * modelId: 'xxx',
144
+ * success(res) {
145
+ * console.log(res)
146
+ * },
147
+ * fail(res) {
148
+ * console.log(res)
149
+ * }
150
+ * })
151
+ * ```
152
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeDeviceMessage.html
153
+ */
154
+ requestSubscribeDeviceMessage(
155
+ option: requestSubscribeDeviceMessage.Option
156
+ ): Promise<requestSubscribeDeviceMessage.SuccessCallbackResult | requestSubscribeDeviceMessage.FailCallbackResult>
72
157
  }
73
158
  }
@@ -8,7 +8,7 @@ declare module '../../index' {
8
8
  /** 接口调用失败的回调函数 */
9
9
  fail?: (res: TaroGeneral.CallbackResult) => void
10
10
  /** 显示用户信息的语言 */
11
- lang?: keyof UserInfo.language
11
+ lang?: keyof UserInfo.Language
12
12
  /** 接口调用成功的回调函数 */
13
13
  success?: (result: SuccessCallbackResult) => void
14
14
  /** 是否带上登录态信息。当 withCredentials 为 true 时,要求此前有调用过 Taro.login 且登录态尚未过期,此时返回的数据会包含 encryptedData, iv 等敏感信息;当 withCredentials 为 false 时,不要求有登录态,返回的数据不包含 encryptedData, iv 等敏感信息。 */
@@ -18,9 +18,9 @@ declare module '../../index' {
18
18
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
19
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
20
  cloudID?: string
21
- /** 包括敏感数据在内的完整用户信息的加密数据,详见 [用户数据的签名验证和加解密]((signature#加密数据解密算法)) */
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
22
  encryptedData: string
23
- /** 加密算法的初始向量,详见 [用户数据的签名验证和加解密]((signature#加密数据解密算法)) */
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
24
  iv: string
25
25
  /** 不包括敏感信息的原始数据字符串,用于计算签名 */
26
26
  rawData: string
@@ -36,7 +36,7 @@ declare module '../../index' {
36
36
  namespace getUserProfile {
37
37
  interface Option {
38
38
  /** 显示用户信息的语言 */
39
- lang?: keyof UserInfo.language
39
+ lang?: keyof UserInfo.Language
40
40
  /** 声明获取用户个人信息后的用途,不超过30个字符 */
41
41
  desc: string
42
42
  /** 接口调用成功的回调函数 */
@@ -48,7 +48,18 @@ declare module '../../index' {
48
48
  }
49
49
 
50
50
  interface SuccessCallbackResult extends getUserInfo.SuccessCallbackResult {
51
- //
51
+ /** 用户信息对象 */
52
+ userInfo: UserInfo
53
+ /** 不包括敏感信息的原始数据字符串,用于计算签名 */
54
+ rawData: string
55
+ /** 使用 sha1( rawData + sessionkey ) 得到字符串,用于校验用户信息,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
56
+ signature: string
57
+ /** 包括敏感数据在内的完整用户信息的加密数据,详见 [用户数据的签名验证和加解密](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) */
58
+ encryptedData: string
59
+ /** 加密算法的初始向量,详见 [用户数据的签名验证和加解密](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) */
60
+ iv: string
61
+ /** 敏感数据对应的云 ID,开通云开发的小程序才会返回,可通过云调用直接获取开放数据,详细 [见云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */
62
+ cloudID: string
52
63
  }
53
64
  }
54
65
 
@@ -56,30 +67,30 @@ declare module '../../index' {
56
67
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/UserInfo.html
57
68
  */
58
69
  interface UserInfo {
70
+ /** 用户昵称 */
71
+ nickName: string
59
72
  /** 用户头像图片的 URL。URL 最后一个数值代表正方形头像大小(有 0、46、64、96、132 数值可选,0 代表 640x640 的正方形头像,46 表示 46x46 的正方形头像,剩余数值以此类推。默认132),用户没有头像时该项为空。若用户更换头像,原有头像 URL 将失效。 */
60
73
  avatarUrl: string
61
- /** 用户所在城市 */
62
- city: string
63
- /** 用户所在国家 */
74
+ /** 用户性别。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
75
+ gender?: keyof UserInfo.Gender
76
+ /** 用户所在国家。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
64
77
  country: string
65
- /** 用户性别 */
66
- gender: keyof UserInfo.gender
67
- /** 显示 country,province,city 所用的语言 */
68
- language: keyof UserInfo.language
69
- /** 用户昵称 */
70
- nickName: string
71
- /** 用户所在省份 */
78
+ /** 用户所在省份。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
72
79
  province: string
80
+ /** 用户所在城市。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
81
+ city: string
82
+ /** 显示 country,province,city 所用的语言。强制返回 “zh_CN”,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
83
+ language: keyof UserInfo.Language
73
84
  }
74
85
 
75
86
  namespace UserInfo {
76
- interface language {
87
+ interface Language {
77
88
  en: '英文'
78
89
  zh_CN: '简体中文'
79
90
  zh_TW: '繁体中文'
80
91
  }
81
92
 
82
- interface gender {
93
+ interface Gender {
83
94
  0: '未知'
84
95
  1: '男性'
85
96
  2: '女性'
@@ -91,10 +102,11 @@ declare module '../../index' {
91
102
  *
92
103
  * **接口调整说明**
93
104
  * 在用户未授权过的情况下调用此接口,将不再出现授权弹窗,会直接进入 fail 回调(详见[《公告》](https://developers.weixin.qq.com/community/develop/doc/0000a26e1aca6012e896a517556c01))。在用户已授权的情况下调用此接口,可成功获取用户信息。
94
- * @supported weapp
105
+ * @supported weapp, tt
95
106
  * @example
96
107
  * ```tsx
97
108
  * // 必须是在用户已经授权的情况下调用
109
+ *
98
110
  * Taro.getUserInfo({
99
111
  * success: function(res) {
100
112
  * var userInfo = res.userInfo
@@ -108,7 +120,7 @@ declare module '../../index' {
108
120
  * })
109
121
  * ```
110
122
  *
111
- * 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法))
123
+ * 敏感数据有两种获取方式,一是使用 [加密数据解密算法](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) 。
112
124
  * 获取得到的开放数据为以下 json 结构:
113
125
  *
114
126
  * ```json
@@ -133,6 +145,31 @@ declare module '../../index' {
133
145
 
134
146
  /**
135
147
  * 获取用户信息。每次请求都会弹出授权窗口,用户同意后返回 `userInfo`。
148
+ *
149
+ * 若开发者需要获取用户的个人信息(头像、昵称、性别与地区),可以通过 Taro.getUserProfile 接口进行获取,
150
+ *
151
+ * 微信该接口从基础库 **2.10.4** 版本开始支持,该接口只返回用户个人信息,不包含用户身份标识符。该接口中 desc 属性(声明获取用户个人信息后的用途)后续会展示在弹窗中,请开发者谨慎填写。
152
+ *
153
+ * 开发者每次通过该接口获取用户个人信息均需用户确认,请开发者妥善保管用户快速填写的头像昵称,避免重复弹窗。
154
+ *
155
+ * [微信端调整背景和说明,请参考文档](https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801)
156
+ * @supported weapp, tt
157
+ * @example
158
+ * 推荐使用 Taro.getUserProfile 获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
159
+ *
160
+ * ```tsx
161
+ * Taro.getUserProfile({
162
+ * desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
163
+ * success: (res) => {
164
+ * // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
165
+ * this.setState({
166
+ * userInfo: res.userInfo,
167
+ * hasUserInfo: true
168
+ * })
169
+ * }
170
+ * })
171
+ * ```
172
+ * @since 2.2.17+,3.0.29+
136
173
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html
137
174
  */
138
175
  getUserProfile(option: getUserProfile.Option): Promise<getUserProfile.SuccessCallbackResult>
@@ -1,19 +1,40 @@
1
1
  import Taro from '../../index'
2
2
 
3
3
  declare module '../../index' {
4
- namespace getWeRunData {
4
+ namespace shareToWeRun {
5
5
  interface Option {
6
+ /** 运动数据列表 */
7
+ recordList: record[]
6
8
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
7
9
  complete?: (res: TaroGeneral.CallbackResult) => void
8
10
  /** 接口调用失败的回调函数 */
9
11
  fail?: (res: TaroGeneral.CallbackResult) => void
10
12
  /** 接口调用成功的回调函数 */
11
- success?: (result: SuccessCallback) => void
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
12
24
  }
25
+ }
13
26
 
14
- type SuccessCallback = (
15
- result: SuccessCallbackResult,
16
- ) => void
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
+ }
17
38
 
18
39
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
19
40
  /** 敏感数据对应的云 ID,开通云开发的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */
@@ -28,6 +49,12 @@ declare module '../../index' {
28
49
  }
29
50
 
30
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
+
31
58
  /** 获取用户过去三十天微信运动步数。需要先调用 Taro.login 接口。步数信息会在用户主动进入小程序时更新。
32
59
  * @supported weapp
33
60
  * @example
@@ -43,7 +70,7 @@ declare module '../../index' {
43
70
  * ```
44
71
  *
45
72
  * **开放数据 JSON 结构**
46
- * 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法))
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) 。
47
74
  * 获取得到的开放数据为以下 json 结构:
48
75
  *
49
76
  * ```json
@@ -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
+ }
@@ -68,6 +68,10 @@ declare module '../../index' {
68
68
  }
69
69
  }
70
70
 
71
+ /** 页面间事件通信通道
72
+ * @supported weapp
73
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.html
74
+ */
71
75
  interface EventChannel {
72
76
  /** 触发一个事件
73
77
  * @supported weapp
@@ -79,31 +83,31 @@ declare module '../../index' {
79
83
  /** 事件参数 */
80
84
  ...args: any
81
85
  ): void
82
- /** 取消监听一个事件。给出第二个参数时,只取消给出的监听函数,否则取消所有监听函数
86
+ /** 持续监听一个事件
83
87
  * @supported weapp
84
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.off.html
88
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.on.html
85
89
  */
86
- off(
90
+ on(
87
91
  /** 事件名称 */
88
92
  eventName: string,
89
93
  /** 事件监听函数 */
90
94
  fn: TaroGeneral.EventCallback,
91
95
  ): void
92
- /** 持续监听一个事件
96
+ /** 监听一个事件一次,触发后失效
93
97
  * @supported weapp
94
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.on.html
98
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.once.html
95
99
  */
96
- on(
100
+ once(
97
101
  /** 事件名称 */
98
102
  eventName: string,
99
103
  /** 事件监听函数 */
100
104
  fn: TaroGeneral.EventCallback,
101
105
  ): void
102
- /** 监听一个事件一次,触发后失效
106
+ /** 取消监听一个事件。给出第二个参数时,只取消给出的监听函数,否则取消所有监听函数
103
107
  * @supported weapp
104
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.once.html
108
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.off.html
105
109
  */
106
- once(
110
+ off(
107
111
  /** 事件名称 */
108
112
  eventName: string,
109
113
  /** 事件监听函数 */
@@ -113,7 +117,7 @@ declare module '../../index' {
113
117
 
114
118
  interface TaroStatic {
115
119
  /** 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
116
- * @supported weapp, h5, rn
120
+ * @supported weapp, h5, rn, tt
117
121
  * @example
118
122
  * ```json
119
123
  * {
@@ -139,7 +143,7 @@ declare module '../../index' {
139
143
  switchTab(option: switchTab.Option): Promise<TaroGeneral.CallbackResult>
140
144
 
141
145
  /** 关闭所有页面,打开到应用内的某个页面
142
- * @supported weapp, h5, rn
146
+ * @supported weapp, h5, rn, tt
143
147
  * @example
144
148
  * ```tsx
145
149
  * Taro.reLaunch({
@@ -151,7 +155,7 @@ declare module '../../index' {
151
155
  reLaunch(option: reLaunch.Option): Promise<TaroGeneral.CallbackResult>
152
156
 
153
157
  /** 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。
154
- * @supported weapp, h5, rn
158
+ * @supported weapp, h5, rn, tt
155
159
  * @example
156
160
  * ```tsx
157
161
  * Taro.redirectTo({
@@ -163,7 +167,7 @@ declare module '../../index' {
163
167
  redirectTo(option: redirectTo.Option): Promise<TaroGeneral.CallbackResult>
164
168
 
165
169
  /** 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 Taro.navigateBack 可以返回到原页面。小程序中页面栈最多十层。
166
- * @supported weapp, h5, rn
170
+ * @supported weapp, h5, rn, tt
167
171
  * @example
168
172
  * ```tsx
169
173
  * Taro.navigateTo({
@@ -189,7 +193,7 @@ declare module '../../index' {
189
193
  navigateTo(option: navigateTo.Option): Promise<TaroGeneral.CallbackResult>
190
194
 
191
195
  /** 关闭当前页面,返回上一页面或多级页面。可通过 getCurrentPages 获取当前的页面栈,决定需要返回几层。
192
- * @supported weapp, h5, rn
196
+ * @supported weapp, h5, rn, tt
193
197
  * @example
194
198
  * ```tsx
195
199
  * // 注意:调用 navigateTo 跳转时,调用该方法的页面会被加入堆栈,而 redirectTo 方法则不会。见下方示例代码