@tarojs/taro 3.3.13 → 3.3.17

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 (98) hide show
  1. package/package.json +5 -5
  2. package/types/api/ad/index.d.ts +34 -28
  3. package/types/api/alipay/index.d.ts +11 -7
  4. package/types/api/base/debug.d.ts +60 -54
  5. package/types/api/base/env.d.ts +12 -8
  6. package/types/api/base/index.d.ts +87 -83
  7. package/types/api/base/system.d.ts +59 -54
  8. package/types/api/base/update.d.ts +37 -33
  9. package/types/api/base/weapp/app-event.d.ts +147 -131
  10. package/types/api/base/weapp/life-cycle.d.ts +14 -10
  11. package/types/api/canvas/index.d.ts +116 -111
  12. package/types/api/cloud/index.d.ts +99 -94
  13. package/types/api/data-analysis/index.d.ts +68 -64
  14. package/types/api/device/accelerometer.d.ts +57 -50
  15. package/types/api/device/battery.d.ts +19 -15
  16. package/types/api/device/ble.d.ts +241 -228
  17. package/types/api/device/bluetooth.d.ts +207 -194
  18. package/types/api/device/clipboard.d.ts +48 -43
  19. package/types/api/device/compass.d.ts +55 -48
  20. package/types/api/device/contact.d.ts +13 -9
  21. package/types/api/device/gyroscope.d.ts +41 -35
  22. package/types/api/device/iBeacon.d.ts +79 -73
  23. package/types/api/device/motion.d.ts +42 -37
  24. package/types/api/device/network.d.ts +80 -42
  25. package/types/api/device/nfc.d.ts +105 -96
  26. package/types/api/device/performance.d.ts +32 -18
  27. package/types/api/device/phone.d.ts +20 -15
  28. package/types/api/device/scan.d.ts +31 -26
  29. package/types/api/device/screen.d.ts +74 -67
  30. package/types/api/device/vibrate.d.ts +31 -25
  31. package/types/api/device/wifi.d.ts +151 -140
  32. package/types/api/ext/index.d.ts +44 -39
  33. package/types/api/files/index.d.ts +219 -209
  34. package/types/api/framework/index.d.ts +25 -20
  35. package/types/api/location/index.d.ts +140 -136
  36. package/types/api/media/audio.d.ts +135 -127
  37. package/types/api/media/background-audio.d.ts +135 -126
  38. package/types/api/media/camera.d.ts +30 -26
  39. package/types/api/media/editor.d.ts +35 -33
  40. package/types/api/media/image.d.ts +163 -150
  41. package/types/api/media/live.d.ts +88 -82
  42. package/types/api/media/map.d.ts +47 -43
  43. package/types/api/media/recorder.d.ts +90 -84
  44. package/types/api/media/video-processing.d.ts +10 -6
  45. package/types/api/media/video.d.ts +63 -58
  46. package/types/api/network/download.d.ts +40 -30
  47. package/types/api/network/mdns.d.ts +104 -91
  48. package/types/api/network/request.d.ts +83 -79
  49. package/types/api/network/udp.d.ts +20 -16
  50. package/types/api/network/upload.d.ts +66 -56
  51. package/types/api/network/websocket.d.ts +201 -194
  52. package/types/api/open-api/account.d.ts +18 -14
  53. package/types/api/open-api/address.d.ts +27 -23
  54. package/types/api/open-api/authorize.d.ts +30 -26
  55. package/types/api/open-api/card.d.ts +55 -51
  56. package/types/api/open-api/customer-service.d.ts +21 -17
  57. package/types/api/open-api/facial.d.ts +28 -24
  58. package/types/api/open-api/invoice.d.ts +38 -34
  59. package/types/api/open-api/login.d.ts +56 -52
  60. package/types/api/open-api/navigate.d.ts +79 -75
  61. package/types/api/open-api/payment.d.ts +34 -30
  62. package/types/api/open-api/settings.d.ts +49 -45
  63. package/types/api/open-api/soter.d.ts +92 -86
  64. package/types/api/open-api/subscribe-message.d.ts +24 -20
  65. package/types/api/open-api/user-info.d.ts +60 -57
  66. package/types/api/open-api/werun.d.ts +50 -46
  67. package/types/api/route/index.d.ts +122 -118
  68. package/types/api/share/index.d.ts +68 -64
  69. package/types/api/storage/background-fetch.d.ts +40 -35
  70. package/types/api/storage/index.d.ts +267 -262
  71. package/types/api/swan/index.d.ts +47 -42
  72. package/types/api/ui/animation.d.ts +21 -17
  73. package/types/api/ui/background.d.ts +38 -34
  74. package/types/api/ui/custom-component.d.ts +22 -18
  75. package/types/api/ui/fonts.d.ts +26 -21
  76. package/types/api/ui/interaction.d.ts +159 -150
  77. package/types/api/ui/keyboard.d.ts +59 -55
  78. package/types/api/ui/menu.d.ts +10 -6
  79. package/types/api/ui/navigation-bar.d.ts +67 -63
  80. package/types/api/ui/pull-down-refresh.d.ts +33 -29
  81. package/types/api/ui/scroll.d.ts +30 -26
  82. package/types/api/ui/sticky.d.ts +22 -19
  83. package/types/api/ui/tab-bar.d.ts +101 -97
  84. package/types/api/ui/window.d.ts +24 -18
  85. package/types/api/worker/index.d.ts +28 -24
  86. package/types/api/wxml/index.d.ts +42 -38
  87. package/types/compile.d.ts +1 -5
  88. package/types/global.d.ts +392 -0
  89. package/types/index.d.ts +12 -98
  90. package/types/taro.api.d.ts +94 -0
  91. package/types/taro.component.d.ts +10 -57
  92. package/types/taro.config.d.ts +28 -6
  93. package/types/taro.extend.d.ts +50 -75
  94. package/types/taro.hooks.d.ts +68 -67
  95. package/types/taro.lifecycle.d.ts +47 -28
  96. package/types/api/ad/index.ts +0 -6
  97. package/types/api/alipay/index.ts +0 -7
  98. package/types/api/index.d.ts +0 -352
@@ -1,4 +1,6 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace startSoterAuthentication {
3
5
  interface Option {
4
6
  /** 挑战因子。挑战因子为调用者为此次生物鉴权准备的用于签名的字符串关键识别信息,将作为 `resultJSON` 的一部分,供调用者识别本次请求。例如:如果场景为请求用户对某订单进行授权确认,则可以将订单号填入此参数。 */
@@ -8,14 +10,14 @@ declare namespace Taro {
8
10
  /** 验证描述,即识别过程中显示在界面上的对话框提示内容 */
9
11
  authContent?: string
10
12
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
11
- complete?: (res: General.CallbackResult) => void
13
+ complete?: (res: TaroGeneral.CallbackResult) => void
12
14
  /** 接口调用失败的回调函数 */
13
- fail?: (res: General.CallbackResult) => void
15
+ fail?: (res: TaroGeneral.CallbackResult) => void
14
16
  /** 接口调用成功的回调函数 */
15
17
  success?: (result: SuccessCallbackResult) => void
16
18
  }
17
19
 
18
- interface SuccessCallbackResult extends General.CallbackResult {
20
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
19
21
  /** 生物认证方式 */
20
22
  authMode: string
21
23
  /** 错误码 */
@@ -40,60 +42,17 @@ declare namespace Taro {
40
42
  }
41
43
  }
42
44
 
43
- /** 开始 SOTER 生物认证。验证流程请参考[说明](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/bio-auth.html)。
44
- *
45
- * **resultJSON 说明**
46
- * 此数据为设备TEE中,将传入的challenge和TEE内其他安全信息组成的数据进行组装而来的JSON,对下述字段的解释如下表。例子如下:
47
- * | 字段名 | 说明 |
48
- * |---|----|
49
- * | raw | 调用者传入的challenge |
50
- * | fid | (仅Android支持)本次生物识别认证的生物信息编号(如指纹识别则是指纹信息在本设备内部编号) |
51
- * | counter | 防重放特征参数 |
52
- * | tee_n | TEE名称(如高通或者trustonic等) |
53
- * | tee_v | TEE版本号 |
54
- * | fp_n | 指纹以及相关逻辑模块提供商(如FPC等) |
55
- * | fp_v | 指纹以及相关模块版本号 |
56
- * | cpu_id | 机器唯一识别ID |
57
- * | uid | 概念同Android系统定义uid,即应用程序编号 |
58
- * @supported weapp
59
- * @example
60
- * ```tsx
61
- * Taro.startSoterAuthentication({
62
- * requestAuthModes: ['fingerPrint'],
63
- * challenge: '123456',
64
- * authContent: '请用指纹解锁',
65
- * success: function (res) { }
66
- * })
67
- * ```
68
- *
69
- * ```json
70
- * {
71
- * "raw":"msg",
72
- * "fid":"2",
73
- * "counter":123,
74
- * "tee_n":"TEE Name",
75
- * "tee_v":"TEE Version",
76
- * "fp_n":"Fingerprint Sensor Name",
77
- * "fp_v":"Fingerprint Sensor Version",
78
- * "cpu_id":"CPU Id",
79
- * "uid":"21"
80
- * }
81
- * ```
82
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.startSoterAuthentication.html
83
- */
84
- function startSoterAuthentication(option: startSoterAuthentication.Option): Promise<startSoterAuthentication.SuccessCallbackResult>
85
-
86
45
  namespace checkIsSupportSoterAuthentication {
87
46
  interface Option {
88
47
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
89
- complete?: (res: General.CallbackResult) => void
48
+ complete?: (res: TaroGeneral.CallbackResult) => void
90
49
  /** 接口调用失败的回调函数 */
91
- fail?: (res: General.CallbackResult) => void
50
+ fail?: (res: TaroGeneral.CallbackResult) => void
92
51
  /** 接口调用成功的回调函数 */
93
52
  success?: (result: SuccessCallbackResult) => void
94
53
  }
95
54
 
96
- interface SuccessCallbackResult extends General.CallbackResult {
55
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
97
56
  /** 该设备支持的可被SOTER识别的生物识别方式 */
98
57
  supportMode: Array<keyof requestAuthModes>
99
58
  /** 调用信息 */
@@ -111,31 +70,15 @@ declare namespace Taro {
111
70
  speech
112
71
  }
113
72
  }
114
- /** 获取本机支持的 SOTER 生物认证方式
115
- * @supported weapp
116
- * @example
117
- * ```tsx
118
- * Taro.checkIsSupportSoterAuthentication({
119
- * success: function (res) {
120
- * // res.supportMode = [] 不具备任何被SOTER支持的生物识别方式
121
- * // res.supportMode = ['fingerPrint'] 只支持指纹识别
122
- * // res.supportMode = ['fingerPrint', 'facial'] 支持指纹识别和人脸识别
123
- * }
124
- * })
125
- * ```
126
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSupportSoterAuthentication.html
127
- */
128
- function checkIsSupportSoterAuthentication(
129
- option?: checkIsSupportSoterAuthentication.Option,
130
- ): Promise<checkIsSupportSoterAuthentication.SuccessCallbackResult>
73
+
131
74
  namespace checkIsSoterEnrolledInDevice {
132
75
  interface Option {
133
76
  /** 认证方式 */
134
77
  checkAuthMode: keyof requestAuthModes
135
78
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
136
- complete?: (res: General.CallbackResult) => void
79
+ complete?: (res: TaroGeneral.CallbackResult) => void
137
80
  /** 接口调用失败的回调函数 */
138
- fail?: (res: General.CallbackResult) => void
81
+ fail?: (res: TaroGeneral.CallbackResult) => void
139
82
  /** 接口调用成功的回调函数 */
140
83
  success?: (result: SuccessCallbackResult) => void
141
84
  }
@@ -151,7 +94,7 @@ declare namespace Taro {
151
94
  speech
152
95
  }
153
96
 
154
- interface SuccessCallbackResult extends General.CallbackResult {
97
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
155
98
  /** 错误信息 */
156
99
  errMsg: string
157
100
  /** 是否已录入信息 */
@@ -159,20 +102,83 @@ declare namespace Taro {
159
102
  }
160
103
  }
161
104
 
162
- /** 获取设备内是否录入如指纹等生物信息的接口
163
- * @supported weapp
164
- * @example
165
- * ```tsx
166
- * Taro.checkIsSoterEnrolledInDevice({
167
- * checkAuthMode: 'fingerPrint',
168
- * success: function (res) {
169
- * console.log(res.isEnrolled)
170
- * }
171
- * })
172
- * ```
173
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSoterEnrolledInDevice.html
174
- */
175
- function checkIsSoterEnrolledInDevice(
176
- option: checkIsSoterEnrolledInDevice.Option,
177
- ): Promise<checkIsSoterEnrolledInDevice.SuccessCallbackResult>
105
+ interface TaroStatic {
106
+ /** 开始 SOTER 生物认证。验证流程请参考[说明](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/bio-auth.html)。
107
+ *
108
+ * **resultJSON 说明**
109
+ * 此数据为设备TEE中,将传入的challenge和TEE内其他安全信息组成的数据进行组装而来的JSON,对下述字段的解释如下表。例子如下:
110
+ * | 字段名 | 说明 |
111
+ * |---|----|
112
+ * | raw | 调用者传入的challenge |
113
+ * | fid | (仅Android支持)本次生物识别认证的生物信息编号(如指纹识别则是指纹信息在本设备内部编号) |
114
+ * | counter | 防重放特征参数 |
115
+ * | tee_n | TEE名称(如高通或者trustonic等) |
116
+ * | tee_v | TEE版本号 |
117
+ * | fp_n | 指纹以及相关逻辑模块提供商(如FPC等) |
118
+ * | fp_v | 指纹以及相关模块版本号 |
119
+ * | cpu_id | 机器唯一识别ID |
120
+ * | uid | 概念同Android系统定义uid,即应用程序编号 |
121
+ * @supported weapp
122
+ * @example
123
+ * ```tsx
124
+ * Taro.startSoterAuthentication({
125
+ * requestAuthModes: ['fingerPrint'],
126
+ * challenge: '123456',
127
+ * authContent: '请用指纹解锁',
128
+ * success: function (res) { }
129
+ * })
130
+ * ```
131
+ *
132
+ * ```json
133
+ * {
134
+ * "raw":"msg",
135
+ * "fid":"2",
136
+ * "counter":123,
137
+ * "tee_n":"TEE Name",
138
+ * "tee_v":"TEE Version",
139
+ * "fp_n":"Fingerprint Sensor Name",
140
+ * "fp_v":"Fingerprint Sensor Version",
141
+ * "cpu_id":"CPU Id",
142
+ * "uid":"21"
143
+ * }
144
+ * ```
145
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.startSoterAuthentication.html
146
+ */
147
+ startSoterAuthentication(option: startSoterAuthentication.Option): Promise<startSoterAuthentication.SuccessCallbackResult>
148
+
149
+ /** 获取本机支持的 SOTER 生物认证方式
150
+ * @supported weapp
151
+ * @example
152
+ * ```tsx
153
+ * Taro.checkIsSupportSoterAuthentication({
154
+ * success: function (res) {
155
+ * // res.supportMode = [] 不具备任何被SOTER支持的生物识别方式
156
+ * // res.supportMode = ['fingerPrint'] 只支持指纹识别
157
+ * // res.supportMode = ['fingerPrint', 'facial'] 支持指纹识别和人脸识别
158
+ * }
159
+ * })
160
+ * ```
161
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSupportSoterAuthentication.html
162
+ */
163
+ checkIsSupportSoterAuthentication(
164
+ option?: checkIsSupportSoterAuthentication.Option,
165
+ ): Promise<checkIsSupportSoterAuthentication.SuccessCallbackResult>
166
+
167
+ /** 获取设备内是否录入如指纹等生物信息的接口
168
+ * @supported weapp
169
+ * @example
170
+ * ```tsx
171
+ * Taro.checkIsSoterEnrolledInDevice({
172
+ * checkAuthMode: 'fingerPrint',
173
+ * success: function (res) {
174
+ * console.log(res.isEnrolled)
175
+ * }
176
+ * })
177
+ * ```
178
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSoterEnrolledInDevice.html
179
+ */
180
+ checkIsSoterEnrolledInDevice(
181
+ option: checkIsSoterEnrolledInDevice.Option,
182
+ ): Promise<checkIsSoterEnrolledInDevice.SuccessCallbackResult>
183
+ }
178
184
  }
@@ -1,17 +1,19 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace requestSubscribeMessage {
3
5
  interface Option {
4
6
  /** 需要订阅的消息模板的id的集合(注意:iOS客户端7.0.6版本、Android客户端7.0.7版本之后的一次性订阅/长期订阅才支持多个模板消息,iOS客户端7.0.5版本、Android客户端7.0.6版本之前的一次订阅只支持一个模板消息)消息模板id在[微信公众平台(mp.weixin.qq.com)-功能-订阅消息]中配置 */
5
7
  tmplIds: any[]
6
8
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
7
- complete?: (res: General.CallbackResult) => void
9
+ complete?: (res: TaroGeneral.CallbackResult) => void
8
10
  /** 接口调用失败的回调函数 */
9
11
  fail?: (result: FailCallbackResult) => void
10
12
  /** 接口调用成功的回调函数 */
11
13
  success?: (result: SuccessCallbackResult) => void
12
14
  }
13
15
 
14
- interface FailCallbackResult extends General.CallbackResult {
16
+ interface FailCallbackResult extends TaroGeneral.CallbackResult {
15
17
  /** 接口调用失败错误码 */
16
18
  errCode: number
17
19
  /** 接口调用失败错误信息 */
@@ -29,7 +31,7 @@ declare namespace Taro {
29
31
  * }
30
32
  * ```
31
33
  */
32
- interface SuccessCallbackResult extends General.CallbackResult {
34
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
33
35
  /** 动态的键,即模板id
34
36
  * @name [TEMPLATE_ID]
35
37
  * @type "accept" | "reject" | "ban"
@@ -50,20 +52,22 @@ declare namespace Taro {
50
52
  }
51
53
  }
52
54
 
53
- /** 请求订阅消息
54
- *
55
- * 注意:[2.8.2](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为或者发起支付回调后,才可以调起订阅消息界面。
56
- * @supported weapp
57
- * @example
58
- * ```tsx
59
- * Taro.requestSubscribeMessage({
60
- * tmplIds: [''],
61
- * success: function (res) { }
62
- * })
63
- * ```
64
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html
65
- */
66
- function requestSubscribeMessage(
67
- option: requestSubscribeMessage.Option
68
- ): Promise<requestSubscribeMessage.SuccessCallbackResult | requestSubscribeMessage.FailCallbackResult>
55
+ interface TaroStatic {
56
+ /** 请求订阅消息
57
+ *
58
+ * 注意:[2.8.2](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为或者发起支付回调后,才可以调起订阅消息界面。
59
+ * @supported weapp
60
+ * @example
61
+ * ```tsx
62
+ * Taro.requestSubscribeMessage({
63
+ * tmplIds: [''],
64
+ * success: function (res) { }
65
+ * })
66
+ * ```
67
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html
68
+ */
69
+ requestSubscribeMessage(
70
+ option: requestSubscribeMessage.Option
71
+ ): Promise<requestSubscribeMessage.SuccessCallbackResult | requestSubscribeMessage.FailCallbackResult>
72
+ }
69
73
  }
@@ -1,10 +1,12 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace getUserInfo {
3
5
  interface Option {
4
6
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
5
- complete?: (res: General.CallbackResult) => void
7
+ complete?: (res: TaroGeneral.CallbackResult) => void
6
8
  /** 接口调用失败的回调函数 */
7
- fail?: (res: General.CallbackResult) => void
9
+ fail?: (res: TaroGeneral.CallbackResult) => void
8
10
  /** 显示用户信息的语言 */
9
11
  lang?: keyof UserInfo.language
10
12
  /** 接口调用成功的回调函数 */
@@ -13,7 +15,7 @@ declare namespace Taro {
13
15
  withCredentials?: boolean
14
16
  }
15
17
 
16
- interface SuccessCallbackResult extends General.CallbackResult {
18
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
17
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) */
18
20
  cloudID?: string
19
21
  /** 包括敏感数据在内的完整用户信息的加密数据,详见 [用户数据的签名验证和加解密]((signature#加密数据解密算法)) */
@@ -40,9 +42,9 @@ declare namespace Taro {
40
42
  /** 接口调用成功的回调函数 */
41
43
  success?: (result: SuccessCallbackResult) => void
42
44
  /** 接口调用失败的回调函数 */
43
- fail?: (res: General.CallbackResult) => void
45
+ fail?: (res: TaroGeneral.CallbackResult) => void
44
46
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
45
- complete?: (res: General.CallbackResult) => void
47
+ complete?: (res: TaroGeneral.CallbackResult) => void
46
48
  }
47
49
 
48
50
  interface SuccessCallbackResult extends getUserInfo.SuccessCallbackResult {
@@ -50,57 +52,6 @@ declare namespace Taro {
50
52
  }
51
53
  }
52
54
 
53
- /** 获取用户信息。
54
- *
55
- * **接口调整说明**
56
- * 在用户未授权过的情况下调用此接口,将不再出现授权弹窗,会直接进入 fail 回调(详见[《公告》](https://developers.weixin.qq.com/community/develop/doc/0000a26e1aca6012e896a517556c01))。在用户已授权的情况下调用此接口,可成功获取用户信息。
57
- * @supported weapp
58
- * @example
59
- * ```tsx
60
- * // 必须是在用户已经授权的情况下调用
61
- * Taro.getUserInfo({
62
- * success: function(res) {
63
- * var userInfo = res.userInfo
64
- * var nickName = userInfo.nickName
65
- * var avatarUrl = userInfo.avatarUrl
66
- * var gender = userInfo.gender //性别 0:未知、1:男、2:女
67
- * var province = userInfo.province
68
- * var city = userInfo.city
69
- * var country = userInfo.country
70
- * }
71
- * })
72
- * ```
73
- *
74
- * 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) 。
75
- * 获取得到的开放数据为以下 json 结构:
76
- *
77
- * ```json
78
- * {
79
- * "openId": "OPENID",
80
- * "nickName": "NICKNAME",
81
- * "gender": GENDER,
82
- * "city": "CITY",
83
- * "province": "PROVINCE",
84
- * "country": "COUNTRY",
85
- * "avatarUrl": "AVATARURL",
86
- * "unionId": "UNIONID",
87
- * "watermark": {
88
- * "appid":"APPID",
89
- * "timestamp": TIMESTAMP
90
- * }
91
- * }
92
- * ```
93
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html
94
- */
95
- function getUserInfo(option?: getUserInfo.Option): Promise<getUserInfo.SuccessCallbackResult>
96
-
97
- /**
98
- * 获取用户信息。每次请求都会弹出授权窗口,用户同意后返回 `userInfo`。
99
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html
100
- */
101
- function getUserProfile(option: getUserProfile.Option): Promise<getUserProfile.SuccessCallbackResult>
102
-
103
-
104
55
  /** 用户信息
105
56
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/UserInfo.html
106
57
  */
@@ -134,4 +85,56 @@ declare namespace Taro {
134
85
  2: '女性'
135
86
  }
136
87
  }
88
+
89
+ interface TaroStatic {
90
+ /** 获取用户信息。
91
+ *
92
+ * **接口调整说明**
93
+ * 在用户未授权过的情况下调用此接口,将不再出现授权弹窗,会直接进入 fail 回调(详见[《公告》](https://developers.weixin.qq.com/community/develop/doc/0000a26e1aca6012e896a517556c01))。在用户已授权的情况下调用此接口,可成功获取用户信息。
94
+ * @supported weapp
95
+ * @example
96
+ * ```tsx
97
+ * // 必须是在用户已经授权的情况下调用
98
+ * Taro.getUserInfo({
99
+ * success: function(res) {
100
+ * var userInfo = res.userInfo
101
+ * var nickName = userInfo.nickName
102
+ * var avatarUrl = userInfo.avatarUrl
103
+ * var gender = userInfo.gender //性别 0:未知、1:男、2:女
104
+ * var province = userInfo.province
105
+ * var city = userInfo.city
106
+ * var country = userInfo.country
107
+ * }
108
+ * })
109
+ * ```
110
+ *
111
+ * 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) 。
112
+ * 获取得到的开放数据为以下 json 结构:
113
+ *
114
+ * ```json
115
+ * {
116
+ * "openId": "OPENID",
117
+ * "nickName": "NICKNAME",
118
+ * "gender": GENDER,
119
+ * "city": "CITY",
120
+ * "province": "PROVINCE",
121
+ * "country": "COUNTRY",
122
+ * "avatarUrl": "AVATARURL",
123
+ * "unionId": "UNIONID",
124
+ * "watermark": {
125
+ * "appid":"APPID",
126
+ * "timestamp": TIMESTAMP
127
+ * }
128
+ * }
129
+ * ```
130
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html
131
+ */
132
+ getUserInfo(option?: getUserInfo.Option): Promise<getUserInfo.SuccessCallbackResult>
133
+
134
+ /**
135
+ * 获取用户信息。每次请求都会弹出授权窗口,用户同意后返回 `userInfo`。
136
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html
137
+ */
138
+ getUserProfile(option: getUserProfile.Option): Promise<getUserProfile.SuccessCallbackResult>
139
+ }
137
140
  }
@@ -1,10 +1,12 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace getWeRunData {
3
5
  interface Option {
4
6
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
5
- complete?: (res: General.CallbackResult) => void
7
+ complete?: (res: TaroGeneral.CallbackResult) => void
6
8
  /** 接口调用失败的回调函数 */
7
- fail?: (res: General.CallbackResult) => void
9
+ fail?: (res: TaroGeneral.CallbackResult) => void
8
10
  /** 接口调用成功的回调函数 */
9
11
  success?: (result: SuccessCallback) => void
10
12
  }
@@ -13,7 +15,7 @@ declare namespace Taro {
13
15
  result: SuccessCallbackResult,
14
16
  ) => void
15
17
 
16
- interface SuccessCallbackResult extends General.CallbackResult {
18
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
17
19
  /** 敏感数据对应的云 ID,开通云开发的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */
18
20
  cloudID?: string
19
21
  /** 包括敏感数据在内的完整用户信息的加密数据,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html)。解密后得到的数据结构见后文 */
@@ -25,46 +27,48 @@ declare namespace Taro {
25
27
  }
26
28
  }
27
29
 
28
- /** 获取用户过去三十天微信运动步数。需要先调用 Taro.login 接口。步数信息会在用户主动进入小程序时更新。
29
- * @supported weapp
30
- * @example
31
- * ```tsx
32
- * Taro.getWeRunData({
33
- * success: function (res) {
34
- * // encryptedData 到开发者后台解密开放数据
35
- * const encryptedData = res.encryptedData
36
- * // 或拿 cloudID 通过云调用直接获取开放数据
37
- * const cloudID = res.cloudID
38
- * }
39
- * })
40
- * ```
41
- *
42
- * **开放数据 JSON 结构**
43
- * 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法))
44
- * 获取得到的开放数据为以下 json 结构:
45
- *
46
- * ```json
47
- * {
48
- * "stepInfoList": [
49
- * {
50
- * "timestamp": 1445866601,
51
- * "step": 100
52
- * },
53
- * {
54
- * "timestamp": 1445876601,
55
- * "step": 120
56
- * }
57
- * ]
58
- * }
59
- * ```
60
- *
61
- * stepInfoList 中,每一项结构如下:
62
- *
63
- * | 属性 | 类型 | 说明 |
64
- * | --- | ---- | --- |
65
- * | timestamp | number | 时间戳,表示数据对应的时间 |
66
- * | step | number | 微信运动步数 |
67
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html
68
- */
69
- function getWeRunData(option?: getWeRunData.Option): Promise<getWeRunData.SuccessCallbackResult>
30
+ interface TaroStatic {
31
+ /** 获取用户过去三十天微信运动步数。需要先调用 Taro.login 接口。步数信息会在用户主动进入小程序时更新。
32
+ * @supported weapp
33
+ * @example
34
+ * ```tsx
35
+ * Taro.getWeRunData({
36
+ * success: function (res) {
37
+ * // encryptedData 到开发者后台解密开放数据
38
+ * const encryptedData = res.encryptedData
39
+ * // 或拿 cloudID 通过云调用直接获取开放数据
40
+ * const cloudID = res.cloudID
41
+ * }
42
+ * })
43
+ * ```
44
+ *
45
+ * **开放数据 JSON 结构**
46
+ * 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法))
47
+ * 获取得到的开放数据为以下 json 结构:
48
+ *
49
+ * ```json
50
+ * {
51
+ * "stepInfoList": [
52
+ * {
53
+ * "timestamp": 1445866601,
54
+ * "step": 100
55
+ * },
56
+ * {
57
+ * "timestamp": 1445876601,
58
+ * "step": 120
59
+ * }
60
+ * ]
61
+ * }
62
+ * ```
63
+ *
64
+ * stepInfoList 中,每一项结构如下:
65
+ *
66
+ * | 属性 | 类型 | 说明 |
67
+ * | --- | ---- | --- |
68
+ * | timestamp | number | 时间戳,表示数据对应的时间 |
69
+ * | step | number | 微信运动步数 |
70
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html
71
+ */
72
+ getWeRunData(option?: getWeRunData.Option): Promise<getWeRunData.SuccessCallbackResult>
73
+ }
70
74
  }