@tarojs/taro 3.6.9-alpha.1 → 3.6.9-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro",
3
- "version": "3.6.9-alpha.1",
3
+ "version": "3.6.9-alpha.11",
4
4
  "description": "Taro framework",
5
5
  "homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
6
6
  "main": "index.js",
@@ -21,15 +21,11 @@
21
21
  "author": "O2Team",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@tarojs/api": "3.6.9-alpha.1",
25
- "@tarojs/runtime": "3.6.9-alpha.1"
24
+ "@tarojs/api": "3.6.9-alpha.11",
25
+ "@tarojs/runtime": "3.6.9-alpha.11"
26
26
  },
27
27
  "devDependencies": {
28
- "postcss": "^8.4.18",
29
- "@tarojs/helper": "3.6.9-alpha.1"
30
- },
31
- "peerDependencies": {
32
- "postcss": "^8.4.18"
28
+ "@tarojs/helper": "3.6.9-alpha.11"
33
29
  },
34
30
  "peerDependenciesMeta": {
35
31
  "@types/react": {
@@ -41,6 +37,9 @@
41
37
  "@types/webpack-dev-server": {
42
38
  "optional": true
43
39
  },
40
+ "postcss": {
41
+ "optional": true
42
+ },
44
43
  "vue": {
45
44
  "optional": true
46
45
  }
@@ -0,0 +1,133 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace getInferenceEnvInfo {
5
+ interface Option {
6
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
7
+ complete?: (res: TaroGeneral.CallbackResult) => void
8
+ /** 接口调用失败的回调函数 */
9
+ fail?: (res: TaroGeneral.CallbackResult) => void
10
+ /** 接口调用成功的回调函数 */
11
+ success?: (result: SuccessCallbackResult) => void
12
+ }
13
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
14
+ /** AI推理引擎版本*/
15
+ ver: string
16
+ }
17
+ }
18
+
19
+ namespace createInferenceSession {
20
+ interface Option {
21
+ /** 模型文件路径,目前只执行后缀为.onnx格式(支持代码包路径,和本地文件系统路径) */
22
+ model: string
23
+ /** 推理精度,有效值为 0 - 4。
24
+ * 一般来说,使用的precesionLevel等级越低,推理速度越快,但可能会损失精度。
25
+ * 推荐开发者在开发时,在效果满足需求时优先使用更低精度以提高推理速度,节约能耗。
26
+ */
27
+ precesionLevel?: PrecesionLevel
28
+ /** 是否生成量化模型推理 */
29
+ allowQuantize?: boolean
30
+ /** 是否使用NPU推理,仅对IOS有效 */
31
+ allowNPU?: boolean
32
+ /** 输入典型分辨率 */
33
+ typicalShape?: boolean
34
+ }
35
+
36
+ interface PrecesionLevel {
37
+ /** 使用fp16 存储浮点,fp16计算,Winograd 算法也采取fp16 计算,开启近似math计算 */
38
+ 0
39
+ /** 使用fp16 存储浮点,fp16计算,禁用 Winograd 算法,开启近似math计算 */
40
+ 1
41
+ /** 使用fp16 存储浮点,fp32计算,开启 Winograd,开启近似math计算 */
42
+ 2
43
+ /** 使用fp32 存储浮点,fp32计算,开启 Winograd,开启近似math计算 */
44
+ 3
45
+ /** 使用fp32 存储浮点,fp32计算,开启 Winograd,关闭近似math计算 */
46
+ 4
47
+ }
48
+ }
49
+
50
+ interface InferenceSession {
51
+ /** 销毁 InferenceSession 实例
52
+ * @supported weapp
53
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.destroy.html
54
+ */
55
+ destroy(): void
56
+ /** 取消监听模型加载失败事件. 传入指定回调函数则只取消指定回调,不传则取消所有回调
57
+ * @supported weapp
58
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.offError.html
59
+ */
60
+ offError(callback?: InferenceSession.OffErrorCallback): void
61
+ /** 取消监听模型加载完成事件
62
+ * @supported weapp
63
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.offLoad.html
64
+ */
65
+ offLoad(callback?: InferenceSession.OffLoadCallback): void
66
+ /** 监听模型加载失败事件
67
+ * @supported weapp
68
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.onError.html
69
+ */
70
+ onError(callback: InferenceSession.OnLoadCallback): void
71
+ /** 监听模型加载完成事件
72
+ * @supported weapp
73
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.onLoad.html
74
+ */
75
+ onLoad(callback: InferenceSession.OnLoadCallback): void
76
+ /** 运行推断
77
+ * 需要在 session.onLoad 回调后使用。接口参数为 Tensors 对象,返回 Promise。
78
+ * 一个 InferenceSession 被创建完成后可以重复多次调用 InferenceSession.run(), 直到调用 session.destroy() 进行销毁。
79
+ * @supported weapp
80
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.destroy.html
81
+ */
82
+ run(option: InferenceSession.Tensors): Promise<InferenceSession.Tensors>
83
+ }
84
+
85
+ namespace InferenceSession {
86
+ interface Type {
87
+ 'uint8'
88
+ 'int8'
89
+ 'uint32'
90
+ 'int32'
91
+ 'float32'
92
+ }
93
+ interface Tensor {
94
+ /** Tensor shape (Tensor 形状,例如 [1, 3, 224, 224] 即表示一个4唯Tensor,每个维度的长度分别为1, 3, 224, 224) */
95
+ shape: number[]
96
+ /** Tensor 值,一段 ArrayBuffer */
97
+ data: ArrayBuffer
98
+ /** ArrayBuffer 值的类型,合法值有 uint8, int8, uint32, int32, float32 */
99
+ type: keyof Type
100
+ }
101
+
102
+ interface Tensors {
103
+ [key: string]: Tensor
104
+ }
105
+
106
+ /** 模型加载失败回调函数。*/
107
+ type OffErrorCallback = (res: TaroGeneral.CallbackResult) => void
108
+ /** 模型加载完成回调函数 */
109
+ type OffLoadCallback = (res: TaroGeneral.CallbackResult) => void
110
+ /** 模型加载失败回调函数 */
111
+ type OnLoadCallback = (res: TaroGeneral.CallbackResult) => void
112
+ /** 模型加载完成回调函数 */
113
+ type OnLoadCallback = (res: TaroGeneral.CallbackResult) => void
114
+ }
115
+
116
+ interface TaroStatic {
117
+ /** 获取通用AI推理引擎版本
118
+ * @supported weapp
119
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/wx.getInferenceEnvInfo.html
120
+ */
121
+ getInferenceEnvInfo(
122
+ option: getInferenceEnvInfo.Option
123
+ ): void
124
+
125
+ /** 创建 AI 推理 Session
126
+ * @supported weapp
127
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/wx.createInferenceSession.html
128
+ */
129
+ createInferenceSession(
130
+ option: createInferenceSession.Option
131
+ ): InferenceSession
132
+ }
133
+ }
@@ -15,6 +15,42 @@ declare module '../../index' {
15
15
  response: string
16
16
  }
17
17
  }
18
+ namespace tradePay {
19
+ interface Option {
20
+ /** 接入小程序支付时传入此参数。此参数为支付宝交易号,注意参数有大小写区分(调用 小程序支付 时必填) */
21
+ tradeNO?: string
22
+ /** 完整的支付参数拼接成的字符串,从服务端获取(调用 支付宝预授权 时必填) */
23
+ orderStr?: string
24
+ /** 接口调用成功的回调函数 */
25
+ success?: (res: SuccessCallbackResult) => void
26
+ /** 接口调用失败的回调函数 */
27
+ fail?: (res: TaroGeneral.CallbackResult) => void
28
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
29
+ complete?:(res: TaroGeneral.CallbackResult) => void
30
+ }
31
+ interface ResultCode {
32
+ /** 无权限调用(N22104) */
33
+ 4
34
+ /** 订单处理成功 */
35
+ 9000
36
+ /** 正在处理中。支付结果未知(有可能已经支付成功) */
37
+ 8000
38
+ /** 订单处理失败 */
39
+ 4000
40
+ /** 用户中途取消 */
41
+ 6001
42
+ /** 网络连接出错 */
43
+ 6002
44
+ /** 处理结果未知(有可能已经成功) */
45
+ 6004
46
+ }
47
+ interface SuccessCallbackResult {
48
+ /** success 回调函数会携带一个 Object 类型的对象,其属性如下: */
49
+ response: {
50
+ resultCode: ResultCode
51
+ }
52
+ }
53
+ }
18
54
  interface TaroStatic {
19
55
  /**
20
56
  * 此接口可获取支付宝会员的基础信息(头像图片地址、昵称、性别、国家码、省份、所在市区),接入方法请参考 获取会员基础信息介绍。如需获取支付宝会员标识(user_id),请调用 my.getAuthCode 和 alipay.system.oauth.token 接口。
@@ -22,5 +58,12 @@ declare module '../../index' {
22
58
  * @see https://docs.alipay.com/mini/api/ch8chh
23
59
  */
24
60
  getOpenUserInfo(Option: getOpenUserInfo.Option): Promise<getOpenUserInfo.SuccessCallbackResult>
61
+
62
+ /**
63
+ * 此接口是用于发起支付的 API,此 API 暂仅支持企业支付宝小程序使用
64
+ * @supported alipay
65
+ * @see https://opendocs.alipay.com/mini/api/openapi-pay
66
+ */
67
+ tradePay(Option: tradePay.Option): Promise<tradePay.SuccessCallbackResult>
25
68
  }
26
69
  }
@@ -155,6 +155,52 @@ declare module '../../index' {
155
155
  }
156
156
  }
157
157
 
158
+ namespace preloadWebview {
159
+ interface Option {
160
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
161
+ complete?: (res: TaroGeneral.CallbackResult) => void
162
+ /** 接口调用失败的回调函数 */
163
+ fail?: (res: TaroGeneral.CallbackResult) => void
164
+ /** 接口调用成功的回调函数 */
165
+ success?: (res: TaroGeneral.CallbackResult) => void
166
+ }
167
+ }
168
+
169
+ namespace preloadSkylineView {
170
+ interface Option {
171
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
172
+ complete?: (res: TaroGeneral.CallbackResult) => void
173
+ /** 接口调用失败的回调函数 */
174
+ fail?: (res: TaroGeneral.CallbackResult) => void
175
+ /** 接口调用成功的回调函数 */
176
+ success?: (res: TaroGeneral.CallbackResult) => void
177
+ }
178
+ }
179
+
180
+ namespace preloadAssets {
181
+ interface AssetsObjectType {
182
+ /** 字体 */
183
+ font
184
+ /** 图片 */
185
+ image
186
+ }
187
+ interface AssetsObject {
188
+ /** 类型 */
189
+ type: keyof AssetsObjectType
190
+ /** 资源地址 */
191
+ src: string
192
+ }
193
+ interface Option {
194
+ data: AssetsObjectType[]
195
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
196
+ complete?: (res: TaroGeneral.CallbackResult) => void
197
+ /** 接口调用失败的回调函数 */
198
+ fail?: (res: TaroGeneral.CallbackResult) => void
199
+ /** 接口调用成功的回调函数 */
200
+ success?: (res: TaroGeneral.CallbackResult) => void
201
+ }
202
+ }
203
+
158
204
  interface TaroStatic {
159
205
  /** 小程序测速上报。使用前,需要在小程序管理后台配置。 详情参见[小程序测速](https://developers.weixin.qq.com/miniprogram/dev/framework/performanceReport/index.html)指南。
160
206
  * @supported weapp
@@ -174,6 +220,23 @@ declare module '../../index' {
174
220
  dimensions?: string | string[],
175
221
  ): void
176
222
 
223
+ /** 预加载下个页面的 WebView
224
+ * @supported weapp
225
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadWebview.html
226
+ */
227
+ preloadWebview(option: preloadWebview.Option): Promise<TaroGeneral.CallbackResult>
228
+
229
+ /**预加载下个页面所需要的 Skyline 运行环境
230
+ * @supported weapp
231
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadSkylineView.html
232
+ */
233
+ preloadSkylineView(option: preloadSkylineView.Option): Promise<TaroGeneral.CallbackResult>
234
+
235
+ /** 为视图层预加载媒体资源文件, 目前支持:font,image
236
+ * @supported weapp
237
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadAssets.html
238
+ */
239
+ preloadAssets(option: preloadAssets.Option): Promise<TaroGeneral.CallbackResult>
177
240
  /** 小程序测速上报。使用前,需要在小程序管理后台配置。 详情参见[小程序测速](https://developers.weixin.qq.com/miniprogram/dev/framework/performanceReport/index.html)指南。
178
241
  *
179
242
  * **注意**
@@ -351,6 +351,50 @@ declare module '../../index' {
351
351
  }
352
352
  }
353
353
 
354
+ namespace getSkylineInfoSync {
355
+ interface Result {
356
+ /** 当前运行环境是否支持 Skyline 渲染引擎 */
357
+ isSupported: boolean
358
+ /** 当前运行环境 Skyline 渲染引擎 的版本号,形如 0.9.7 */
359
+ version: string
360
+ /** 当前运行环境不支持 Skyline 渲染引擎 的原因,仅在 isSupported 为 false 时出现 */
361
+ reason?: string
362
+ }
363
+ }
364
+
365
+ namespace getSkylineInfo {
366
+ interface Option {
367
+ /** 接口调用成功的回调函数 */
368
+ success?: (res: Result) => void
369
+ /** 接口调用失败的回调函数 */
370
+ fail?: (res: TaroGeneral.CallbackResult) => void
371
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
372
+ complete?: (res: TaroGeneral.CallbackResult | Result) => void
373
+ }
374
+ interface Result {
375
+ /** 当前运行环境是否支持 Skyline 渲染引擎 */
376
+ isSupported: boolean
377
+ /** 当前运行环境 Skyline 渲染引擎 的版本号,形如 0.9.7 */
378
+ version: string
379
+ /** 当前运行环境不支持 Skyline 渲染引擎 的原因,仅在 isSupported 为 false 时出现 */
380
+ reason?: string
381
+ }
382
+ }
383
+
384
+ namespace getRendererUserAgent {
385
+ interface Option {
386
+ /** 接口调用成功的回调函数 */
387
+ success?: (res: Result) => void
388
+ /** 接口调用失败的回调函数 */
389
+ fail?: (res: TaroGeneral.CallbackResult) => void
390
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
391
+ complete?: (res: TaroGeneral.CallbackResult | Result) => void
392
+ }
393
+ interface Result {
394
+ userAgent: string
395
+ }
396
+ }
397
+
354
398
  namespace getDeviceInfo {
355
399
  interface Result {
356
400
  /** 应用二进制接口类型(仅 Android 支持) */
@@ -575,6 +619,27 @@ declare module '../../index' {
575
619
  */
576
620
  getSystemInfo(res?: getSystemInfo.Option): Promise<getSystemInfo.Result>
577
621
 
622
+ /** 获取当前运行环境对于 Skyline 渲染引擎 的支持情况
623
+ * 基础库 2.26.2 开始支持
624
+ * @supported weapp
625
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSkylineInfoSync.html
626
+ */
627
+ getSkylineInfoSync(): getSkylineInfoSync.Result
628
+
629
+ /** 获取当前运行环境对于 Skyline 渲染引擎 的支持情况
630
+ * 基础库 2.26.2 开始支持
631
+ * @supported weapp
632
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSkylineInfo.html
633
+ */
634
+ getSkylineInfo(option?: getSkylineInfo.Option): Promise<getSkylineInfo.Result>
635
+
636
+ /** 获取 Webview 小程序的 UserAgent
637
+ * 基础库 2.26.3 开始支持
638
+ * @supported weapp
639
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getRendererUserAgent.html
640
+ */
641
+ getRendererUserAgent(option?: getRendererUserAgent.Option): Promise<getRendererUserAgent.Result>
642
+
578
643
  /** 获取设备基础信息
579
644
  * @supported weapp, h5
580
645
  * @h5 不支持 abi、benchmarkLevel
@@ -53,6 +53,41 @@ declare module '../../index' {
53
53
  ) => void
54
54
  }
55
55
 
56
+ namespace onScreenRecordingStateChanged {
57
+ interface ScreenRecordingState {
58
+ /** 开始录屏 */
59
+ start
60
+ /** 结束录屏 */
61
+ stop
62
+ }
63
+ /** 用户录屏事件的监听函数 */
64
+ type Callback = (
65
+ /** 录屏状态 */
66
+ state: keyof ScreenRecordingState,
67
+ ) => void
68
+ }
69
+
70
+ namespace getScreenRecordingState {
71
+ interface Option {
72
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
73
+ complete?: (res: TaroGeneral.CallbackResult) => void
74
+ /** 接口调用失败的回调函数 */
75
+ fail?: (res: TaroGeneral.CallbackResult) => void
76
+ /** 接口调用成功的回调函数 */
77
+ success?: (option: SuccessCallbackResult) => void
78
+ }
79
+ interface ScreenRecordingState {
80
+ /** 开始录屏 */
81
+ start
82
+ /** 结束录屏 */
83
+ stop
84
+ }
85
+ interface SuccessCallbackResult {
86
+ /** 录屏状态 */
87
+ state: keyof ScreenRecordingState
88
+ }
89
+ }
90
+
56
91
  namespace getScreenBrightness {
57
92
  interface Option {
58
93
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -116,6 +151,15 @@ declare module '../../index' {
116
151
  callback: onUserCaptureScreen.Callback,
117
152
  ): void
118
153
 
154
+ /** 监听用户录屏事件
155
+ * @supported weapp
156
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.onScreenRecordingStateChanged.html
157
+ */
158
+ onScreenRecordingStateChanged(
159
+ /** 用户录屏事件的监听函数 */
160
+ callback: onScreenRecordingStateChanged.Callback
161
+ ): void
162
+
119
163
  /** 用户主动截屏事件。取消事件监听。
120
164
  * @supported weapp, tt
121
165
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offUserCaptureScreen.html
@@ -125,6 +169,23 @@ declare module '../../index' {
125
169
  callback: onUserCaptureScreen.Callback,
126
170
  ): void
127
171
 
172
+ /** 取消用户录屏事件的监听函数
173
+ * @supported weapp
174
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offScreenRecordingStateChanged.html
175
+ */
176
+ offScreenRecordingStateChanged(
177
+ /** 用户录屏事件的监听函数 */
178
+ callback: onScreenRecordingStateChanged.Callback
179
+ ): void
180
+
181
+ /** 查询用户是否在录屏
182
+ * @supported weapp
183
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenRecordingState.html
184
+ */
185
+ getScreenRecordingState(
186
+ option?: getScreenRecordingState.Option
187
+ ): Promise<getScreenRecordingState.SuccessCallbackResult>
188
+
128
189
  /**
129
190
  * 获取屏幕亮度。
130
191
  *
@@ -0,0 +1,26 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace sendSms {
5
+ interface Option {
6
+ /** 预填到发送短信面板的手机号 */
7
+ phoneNumber?: string
8
+ /** 预填到发送短信面板的内容 */
9
+ content?: string
10
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
11
+ complete?: (res: TaroGeneral.CallbackResult) => void
12
+ /** 接口调用失败的回调函数 */
13
+ fail?: (res: TaroGeneral.CallbackResult) => void
14
+ /** 接口调用成功的回调函数 */
15
+ success?: (res: TaroGeneral.CallbackResult) => void
16
+ }
17
+ }
18
+
19
+ interface TaroStatic {
20
+ /** 拉起手机发送短信界面
21
+ * @supported weap
22
+ * @see declare module '../../index'
23
+ */
24
+ sendSms(option: sendSms.Option): Promise<TaroGeneral.CallbackResul>
25
+ }
26
+ }
@@ -18,11 +18,23 @@ declare module '../../index' {
18
18
  interface Option {
19
19
  /** 需要预览的图片链接列表。 */
20
20
  urls: string[]
21
- /** 当前显示图片的链接 */
22
- current?: string
23
- /** @support weapp 最低版本:2.13.0。是否显示长按菜单,默认值:true */
21
+ /**
22
+ * 微信端为当前显示图片的链接,支付宝端为当前显示图片的索引值
23
+ */
24
+ current?: string | number
25
+ /**
26
+ * 是否支持长按下载图片
27
+ * @supported alipay 基础库: 1.13.0
28
+ */
29
+ enablesavephoto?: boolean
30
+ /**
31
+ * 是否在右下角显示下载入口
32
+ * @supported alipay 基础库: 1.13.0
33
+ */
34
+ enableShowPhotoDownload?: boolean
35
+ /** @supported weapp 最低版本:2.13.0。是否显示长按菜单,默认值:true */
24
36
  showmenu?: boolean
25
- /** @support weapp 最低版本:2.13.0。origin: 发送完整的referrer; no-referrer: 不发送。格式固定为 https://servicewechat.com/{appid}/{version}/page-frame.html,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本;默认值:no-referrer */
37
+ /** @supported weapp 最低版本:2.13.0。origin: 发送完整的referrer; no-referrer: 不发送。格式固定为 https://servicewechat.com/{appid}/{version}/page-frame.html,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本;默认值:no-referrer */
26
38
  referrerPolicy?: string
27
39
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
28
40
  complete?: (res: TaroGeneral.CallbackResult) => void
@@ -46,7 +58,7 @@ declare module '../../index' {
46
58
  /** 需要预览的资源列表 */
47
59
  sources: Sources[]
48
60
  /** 当前显示的资源序号,默认值:0 */
49
- current?: number
61
+ current?: number
50
62
  /** 是否显示长按菜单 2.13.0,默认值:true */
51
63
  showmenu?: boolean
52
64
  /** origin: 发送完整的referrer; no-referrer: 不发送。格式固定为 https://servicewechat.com/{appid}/{version}/page-frame.html,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本;默认值:no-referrer */
@@ -202,6 +202,98 @@ declare module '../../index' {
202
202
  }
203
203
  }
204
204
 
205
+ namespace join1v1Chat {
206
+ interface Caller {
207
+ /** 昵称 */
208
+ nickname: string
209
+ /** 头像 */
210
+ headImage?: string
211
+ /** 小程序内 openid */
212
+ openid: string
213
+ }
214
+ interface Listener {
215
+ /** 昵称 */
216
+ nickname: string
217
+ /** 头像 */
218
+ headImage?: string
219
+ /** 小程序内 openid */
220
+ openid: string
221
+ }
222
+ interface RoomType {
223
+ /** 语音通话 */
224
+ voice
225
+ /** 视频通话 */
226
+ video
227
+ }
228
+ interface Option {
229
+ /** 呼叫方信息 */
230
+ caller: Caller
231
+ /** 接听方信息 */
232
+ listener: Listener
233
+ /** 窗口背景色
234
+ * @default 0
235
+ */
236
+ backgroundType?: keyof setEnable1v1Chat.ColorType
237
+ /** 通话类型 */
238
+ roomType?: keyof RoomType
239
+ /** 小窗样式
240
+ * @default 1
241
+ */
242
+ minWindowType?: keyof setEnable1v1Chat.ColorType
243
+ /** 不允许切换到语音通话
244
+ * @default false
245
+ */
246
+ disableSwitchVoice?: boolean
247
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
248
+ complete?: (res: TaroGeneral.CallbackResult) => void
249
+ /** 接口调用失败的回调函数 */
250
+ fail?: (res: TaroGeneral.CallbackResult) => void
251
+ /** 接口调用成功的回调函数 */
252
+ success?: (res: TaroGeneral.CallbackResult) => void
253
+ }
254
+ interface ChatErrCode {
255
+ /** 未开通双人通话 */
256
+ [-20000]
257
+ /** 当前设备不支持 */
258
+ [-20001]
259
+ /** 正在通话中 */
260
+ [-20002]
261
+ /** 其它小程序正在通话中 */
262
+ [-20003]
263
+ /** 内部系统错误 */
264
+ [-30000]
265
+ /** 微信缺失相机权限 */
266
+ [-30001]
267
+ /** 微信缺失录音权限 */
268
+ [-30002]
269
+ /** 小程序缺失录音权限 */
270
+ [-30003]
271
+ /** 小程序缺失相机权限 */
272
+ [-30004]
273
+ /** 当前已在房间内 */
274
+ [-1]
275
+ /** 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 */
276
+ [-2]
277
+ /** 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 */
278
+ [-3]
279
+ /** 系统错误 */
280
+ [-1000]
281
+ }
282
+ interface FailCallbackResult extends TaroGeneral.CallbackResult {
283
+ /** 错误信息 */
284
+ errMsg: string
285
+ /** 错误码 */
286
+ errCode: keyof ChatErrCode
287
+ }
288
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
289
+ /** 错误码 */
290
+ errCode: number
291
+ /** 调用结果 */
292
+ errMsg: string
293
+ }
294
+ type Promised = FailCallbackResult | SuccessCallbackResult
295
+ }
296
+
205
297
  namespace exitVoIPChat {
206
298
  interface Option {
207
299
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -264,6 +356,12 @@ declare module '../../index' {
264
356
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatStateChanged.html
265
357
  */
266
358
  offVoIPChatStateChanged(callback: onVoIPChatStateChanged.Callback): void
359
+ /**
360
+ * 取消监听实时语音通话成员通话状态变化事件
361
+ * @supported weapp
362
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatSpeakersChanged.html
363
+ */
364
+ offVoIPChatSpeakersChanged(callback: onVoIPChatSpeakersChanged.Callback): void
267
365
  /** 取消监听实时语音通话成员在线状态变化事件
268
366
  * @supported weapp
269
367
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatMembersChanged.html
@@ -281,6 +379,11 @@ declare module '../../index' {
281
379
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.joinVoIPChat.html
282
380
  */
283
381
  joinVoIPChat(option: joinVoIPChat.Option): Promise<joinVoIPChat.Promised>
382
+ /**加入(创建)双人通话
383
+ * @supported weapp
384
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.join1v1Chat.html
385
+ */
386
+ join1v1Chat(option: join1v1Chat.Option): Promise<join1v1Chat.Promised>
284
387
  /** 退出(销毁)实时语音通话
285
388
  * @supported weapp
286
389
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.exitVoIPChat.html