@ftvs/jssdk 1.1.0 → 1.3.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/lib/index.d.ts CHANGED
@@ -1,15 +1,86 @@
1
1
  declare function invokeNativeMethod<T>(methodName: string, args?: any): Promise<T>;
2
2
 
3
+ interface AddressSelectionResult {
4
+ /**
5
+ * 省份名字
6
+ *
7
+ */
8
+ proName: string;
9
+ /**
10
+ * 省份code
11
+ *
12
+ */
13
+ proCode: string;
14
+ /**
15
+ * 城市名字
16
+ *
17
+ */
18
+ cityName: string;
19
+ /**
20
+ * 城市code
21
+ *
22
+ */
23
+ cityCode: string;
24
+ /**
25
+ * 区划名字
26
+ *
27
+ */
28
+ dirName: string;
29
+ /**
30
+ * 区划code
31
+ *
32
+ */
33
+ dirCode: string;
34
+ }
35
+ /**
36
+ * 客户端地址选择器。
37
+ * @category 开放接口 > 地址
38
+ * @example
39
+ * ```javascript
40
+ * const res = await ftv.addressSelection();
41
+ * // 结果类似:
42
+ * //{
43
+ * //"proCode":"520000",
44
+ * //"cityName":"贵阳市",
45
+ * //"cityCode":"520100",
46
+ * //"dirCode":"520115",
47
+ * //"proName":"贵州省",
48
+ * //"dirName":"观山湖区"
49
+ * //}
50
+ * ```
51
+ */
52
+ declare function addressSelection(): Promise<AddressSelectionResult>;
53
+
54
+ interface ChooseImageResult {
55
+ /**
56
+ * base64的图片资源字符串,需要在字符串前拼接`data:image/jpeg;base64,`
57
+ */
58
+ base64Image: string;
59
+ }
60
+ /**
61
+ * 拍摄照片
62
+ * @category 媒体 > 图片
63
+ * @example
64
+ * ```javascript
65
+ * const res = await ftv.chooseImage();
66
+ * // 结果类似:
67
+ * // {
68
+ * // base64Image: '/9j/4AAQSkZJRgABAQAAAQABAAD/4QAwRXhpZgAATU0AKgAAAAgAAQExAAIAAAAOAAAAGgAAAAB3d3cubWVpdHUuY29tAP/bAEMAAwICAwICAwMDAwQDAwQFCAUFBAQFCgcHBggMCgwMCwoLCw0OEhANDhEOCwsQFhARExQVFRUMDxcYFhQYEhQVFP/bAEMBAwQEBQQFCQUFCRQNCw0UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUF'
69
+ * // }
70
+ * ```
71
+ */
72
+ declare function chooseImage(): Promise<ChooseImageResult>;
73
+
3
74
  /**
4
75
  * 关闭当前浏览器。
5
76
  *
6
77
  * @category 路由
7
78
  * @example
8
79
  * ```javascript
9
- * await ftv.closeWindow();
80
+ * await ftv.closeWebView();
10
81
  * ```
11
82
  */
12
- declare function closeWindow(): Promise<void>;
83
+ declare function closeWebView(): Promise<void>;
13
84
 
14
85
  interface TrackOptions {
15
86
  /**
@@ -34,12 +105,6 @@ interface ConfigPayload {
34
105
  * 服务端分配的 AppSecret。
35
106
  */
36
107
  appSecret: string;
37
- /**
38
- * 是否启用埋点工具。
39
- *
40
- * @default false
41
- */
42
- track?: boolean | string | TrackOptions;
43
108
  /**
44
109
  * 是否开启 debug 模式。
45
110
  *
@@ -50,7 +115,7 @@ interface ConfigPayload {
50
115
  debug?: boolean;
51
116
  }
52
117
  /**
53
- * 注入权限验证配置。`appId`、`appSecret` 请通过钉钉向 `熊小川` 申请。
118
+ * 注入权限验证配置。`appId`、`appSecret` 请先申请。
54
119
  *
55
120
  * @category 基础
56
121
  * @example
@@ -58,13 +123,63 @@ interface ConfigPayload {
58
123
  * await ftv.config({
59
124
  * appId: 'xxxx',
60
125
  * appSecret: 'xxxxxx',
61
- * track: true,
62
126
  * debug: process.env.NODE_ENV === 'development',
63
127
  * });
64
128
  * ```
65
129
  */
66
130
  declare function config(payload: ConfigPayload): Promise<void>;
67
131
 
132
+ interface DefaultAddressResult {
133
+ /**
134
+ * 省份名字
135
+ *
136
+ */
137
+ proName: string;
138
+ /**
139
+ * 省份code
140
+ *
141
+ */
142
+ proCode: string;
143
+ /**
144
+ * 城市名字
145
+ *
146
+ */
147
+ cityName: string;
148
+ /**
149
+ * 城市code
150
+ *
151
+ */
152
+ cityCode: string;
153
+ /**
154
+ * 区划名字
155
+ *
156
+ */
157
+ dirName: string;
158
+ /**
159
+ * 区划code
160
+ *
161
+ */
162
+ dirCode: string;
163
+ }
164
+ /**
165
+ * 获取默认区划地址。
166
+ * @category 开放接口 > 地址
167
+ * @example
168
+ * ```javascript
169
+ * const res = await ftv.defaultAddress();
170
+ * // 结果类似:
171
+ * //{
172
+ * //"proCode":"520000",
173
+ * //"cityName":"贵阳市",
174
+ * //"cityCode":"520100",
175
+ * //"dirCode":"520115",
176
+ * //"proName":"贵州省",
177
+ * //"dirName":"观山湖区"
178
+ * //}
179
+ * ```
180
+ */
181
+ declare function defaultAddress(): Promise<DefaultAddressResult>;
182
+
68
183
  interface GetAuthCodePayload {
69
184
  /**
70
185
  * 应用id
@@ -93,6 +208,26 @@ interface GetAuthCodeResult {
93
208
  */
94
209
  declare function getAuthCode(payload: GetAuthCodePayload): Promise<GetAuthCodeResult>;
95
210
 
211
+ interface GetTokenResult {
212
+ /**
213
+ * 令牌,返回空字符串表示没有登录
214
+ */
215
+ token: string;
216
+ }
217
+ /**
218
+ * 获取token令牌
219
+ * @category 开放接口 > 用户信息
220
+ * @example
221
+ * ```javascript
222
+ * const res = await ftv.getAuthToken();
223
+ * // 结果类似:
224
+ * // {
225
+ * // token: 'xxxxxxxxxxxxxxxxxx'
226
+ * // }
227
+ * ```
228
+ */
229
+ declare function getAuthToken(): Promise<GetTokenResult>;
230
+
96
231
  interface Environment {
97
232
  /**
98
233
  * 是否在未来电视客户端中。
@@ -171,9 +306,9 @@ interface GetUserInfoPayload {
171
306
  */
172
307
  authCode: string;
173
308
  /**
174
- * 是否需要实名信息
309
+ * 是否需要敏感信息
175
310
  */
176
- isAuth?: boolean;
311
+ withCredentials?: boolean;
177
312
  }
178
313
  interface GetUserInfoResult {
179
314
  /**
@@ -233,7 +368,6 @@ declare function getUserInfo(payload: GetUserInfoPayload): Promise<GetUserInfoRe
233
368
  /**
234
369
  * 客户端浏览器返回上一页,当浏览器栈无上一级时,关闭当前浏览器。
235
370
  *
236
- * @mp
237
371
  * @category 路由
238
372
  * @example
239
373
  * ```javascript
@@ -266,236 +400,55 @@ interface NavigateToPayLoad {
266
400
  */
267
401
  declare function navigateTo(payload: NavigateToPayLoad): Promise<void>;
268
402
 
269
- interface PlayVideoPayload {
270
- /**
271
- * 视频地址。
272
- */
273
- url: string;
274
- }
275
- /**
276
- * 播放视频。
277
- *
278
- * @category 媒体 > 视频
279
- * @example
280
- * ```javascript
281
- * await ftv.playVideo({
282
- * url: 'https://dcb-cdn.oss-cn-beijing.aliyuncs.com/386fdc3e8a1cd6c5ea91e446d975e367.mp4',
283
- * });
284
- * ```
285
- */
286
- declare function playVideo(payload: PlayVideoPayload): Promise<void>;
287
-
288
- interface AddressAddPayload {
403
+ interface RequestFaceAuthenticationPayload {
289
404
  /**
290
- * 二级地级行政区(地级市、地区、自治州、盟)
291
- *
405
+ * 内部认证`0` 属于多彩未来电视的服务使用
406
+ * 三方认证`1` 非多彩未来电视的服务使用
292
407
  */
293
- city?: string;
408
+ authCheckType: '0' | '1';
294
409
  /**
295
- * 三级县级行政区(市辖区、县级市、县、自治县、旗、自治旗、林区、特区)
296
- *
297
- */
298
- county?: string;
299
- /**
300
- * 是否是默认地址
301
- *
410
+ * 三方认证使用用户openId
302
411
  */
303
- defaultFlag?: string;
304
- /**
305
- * 详情地址及门牌号
306
- *
307
- */
308
- detail?: string;
309
- /**
310
- * 区划编码
311
- *
312
- */
313
- districtCode?: string;
314
- /**
315
- * 地址Id,新增的时候不传,修改的时候必传
316
- *
317
- */
318
- id?: string;
319
- /**
320
- * 手机号
321
- *
322
- */
323
- phoneNo?: string;
324
- /**
325
- * 一级省级行政区(省、自治区、直辖市、特别行政区)
326
- *
327
- */
328
- province?: string;
329
- /**
330
- * 收件人
331
- *
332
- */
333
- receiver?: string;
412
+ openId?: string;
334
413
  }
335
- interface AddressAddResult {
414
+ interface RequestFaceAuthenticationResult {
336
415
  /**
337
- * 操作状态
338
- *
416
+ * 包含认证信息的加密数据。根据需要直接传给后端即可。返回空字符串则是认证失败
339
417
  */
340
- status: boolean;
418
+ encryptedData: string;
341
419
  }
342
420
  /**
343
- * 新增或修改地址。
344
- * @category 开放接口 > 地址
421
+ * 人脸认证
422
+ * @category 开放接口 > 授权
345
423
  * @example
346
424
  * ```javascript
347
- * const res = await ftv.addressAdd({{
348
- * id: "",
349
- * defaultFlag: "0",
350
- * detail: "大DJ的",
351
- * phoneNo: "14755555555",
352
- * receiver: "李三",
353
- * districtCode: "130102",
354
- * province: "河北省",
355
- * city: "石家庄市",
356
- * county: "长安区"
357
- * });
425
+ * const res = await ftv.requestFaceAuthentication();
358
426
  * // 结果类似:
359
427
  * // {
360
- * // status: true
428
+ * // encryptedData: '4088a70bc2ed4b0aac7a904aeaf3819e'
361
429
  * // }
362
430
  * ```
363
431
  */
364
- declare function addressAdd(payload: AddressAddPayload): Promise<AddressAddResult>;
365
-
366
- interface AddressListResult {
367
- /**
368
- * 地址数据Json
369
- *
370
- */
371
- addressList: string[];
372
- }
373
- /**
374
- * 返回地址列表至少包含:姓名、电话、是否为默认、省市区名称和编码、详细地址。。
375
- * @category 开放接口 > 地址
376
- * @example
377
- * ```javascript
378
- * const res = await ftv.addressList();
379
- * // 结果类似:
380
- * //{addressList: "[{"city":"石家庄市",
381
- * //"cityCode":"130100",
382
- * //"county":"长安区",
383
- * //"dcbUserId":"bb5760886dcb9c1201asas",
384
- * //"defaultFlag":0,
385
- * //"detail":"大DJ的",
386
- * //"districtCode":"130102",
387
- * //"id":"8aaa8c387fd09607017fa55552",
388
- * //"phoneNo":"14755555555",
389
- * //"province":"河北省",
390
- * //"provinceCode":"130000",
391
- * //"receiver":"李三",
392
- * //"serviceFlag":1}]"
393
- * //}
394
- * ```
395
- */
396
- declare function addressList(): Promise<AddressListResult>;
397
-
398
- interface AddressSelectionResult {
399
- /**
400
- * 省份名字
401
- *
402
- */
403
- proName: string;
404
- /**
405
- * 省份code
406
- *
407
- */
408
- proCode: string;
409
- /**
410
- * 城市名字
411
- *
412
- */
413
- cityName: string;
414
- /**
415
- * 城市code
416
- *
417
- */
418
- cityCode: string;
419
- /**
420
- * 区划名字
421
- *
422
- */
423
- dirName: string;
424
- /**
425
- * 区划code
426
- *
427
- */
428
- dirCode: string;
429
- }
430
- /**
431
- * 客户端地址选择器。
432
- * @category 开放接口 > 地址
433
- * @example
434
- * ```javascript
435
- * const res = await ftv.addressSelection();
436
- * // 结果类似:
437
- * //{
438
- * //"proCode":"520000",
439
- * //"cityName":"贵阳市",
440
- * //"cityCode":"520100",
441
- * //"dirCode":"520115",
442
- * //"proName":"贵州省",
443
- * //"dirName":"观山湖区"
444
- * //}
445
- * ```
446
- */
447
- declare function addressSelection(): Promise<AddressSelectionResult>;
432
+ declare function requestFaceAuthentication(payload: RequestFaceAuthenticationPayload): Promise<RequestFaceAuthenticationResult>;
448
433
 
449
- interface DefaultAddressResult {
450
- /**
451
- * 省份名字
452
- *
453
- */
454
- proName: string;
455
- /**
456
- * 省份code
457
- *
458
- */
459
- proCode: string;
460
- /**
461
- * 城市名字
462
- *
463
- */
464
- cityName: string;
465
- /**
466
- * 城市code
467
- *
468
- */
469
- cityCode: string;
470
- /**
471
- * 区划名字
472
- *
473
- */
474
- dirName: string;
434
+ interface ReturnToControlPayload {
475
435
  /**
476
- * 区划code
477
- *
436
+ * 是否管控
478
437
  */
479
- dirCode: string;
438
+ hijack: boolean;
480
439
  }
481
440
  /**
482
- * 获取默认区划地址。
483
- * @category 开放接口 > 地址
441
+ * 路由权限管控。
442
+ *
443
+ * @category 路由
484
444
  * @example
485
445
  * ```javascript
486
- * const res = await ftv.defaultAddress();
487
- * // 结果类似:
488
- * //{
489
- * //"proCode":"520000",
490
- * //"cityName":"贵阳市",
491
- * //"cityCode":"520100",
492
- * //"dirCode":"520115",
493
- * //"proName":"贵州省",
494
- * //"dirName":"观山湖区"
495
- * //}
446
+ * await ftv.returnToControl({
447
+ * hijack: true
448
+ * });
496
449
  * ```
497
450
  */
498
- declare function defaultAddress(): Promise<DefaultAddressResult>;
451
+ declare function returnToControl(payload: ReturnToControlPayload): Promise<void>;
499
452
 
500
453
  interface SelectFamilyResult {
501
454
  /**
@@ -530,13 +483,21 @@ interface SelectFamilyResult {
530
483
  */
531
484
  declare function selectFamily(): Promise<SelectFamilyResult>;
532
485
 
533
- declare const _ftv_closeWindow: typeof closeWindow;
486
+ type _ftv_AddressSelectionResult = AddressSelectionResult;
487
+ declare const _ftv_addressSelection: typeof addressSelection;
488
+ type _ftv_ChooseImageResult = ChooseImageResult;
489
+ declare const _ftv_chooseImage: typeof chooseImage;
490
+ declare const _ftv_closeWebView: typeof closeWebView;
534
491
  type _ftv_TrackOptions = TrackOptions;
535
492
  type _ftv_ConfigPayload = ConfigPayload;
536
493
  declare const _ftv_config: typeof config;
494
+ type _ftv_DefaultAddressResult = DefaultAddressResult;
495
+ declare const _ftv_defaultAddress: typeof defaultAddress;
537
496
  type _ftv_GetAuthCodePayload = GetAuthCodePayload;
538
497
  type _ftv_GetAuthCodeResult = GetAuthCodeResult;
539
498
  declare const _ftv_getAuthCode: typeof getAuthCode;
499
+ type _ftv_GetTokenResult = GetTokenResult;
500
+ declare const _ftv_getAuthToken: typeof getAuthToken;
540
501
  declare const _ftv_getEnv: typeof getEnv;
541
502
  type _ftv_Environment = Environment;
542
503
  declare const _ftv_getEnvSync: typeof getEnvSync;
@@ -546,28 +507,30 @@ declare const _ftv_getUserInfo: typeof getUserInfo;
546
507
  declare const _ftv_navigateBack: typeof navigateBack;
547
508
  type _ftv_NavigateToPayLoad = NavigateToPayLoad;
548
509
  declare const _ftv_navigateTo: typeof navigateTo;
549
- type _ftv_PlayVideoPayload = PlayVideoPayload;
550
- declare const _ftv_playVideo: typeof playVideo;
551
- type _ftv_AddressAddPayload = AddressAddPayload;
552
- type _ftv_AddressAddResult = AddressAddResult;
553
- declare const _ftv_addressAdd: typeof addressAdd;
554
- type _ftv_AddressListResult = AddressListResult;
555
- declare const _ftv_addressList: typeof addressList;
556
- type _ftv_AddressSelectionResult = AddressSelectionResult;
557
- declare const _ftv_addressSelection: typeof addressSelection;
558
- type _ftv_DefaultAddressResult = DefaultAddressResult;
559
- declare const _ftv_defaultAddress: typeof defaultAddress;
510
+ type _ftv_RequestFaceAuthenticationPayload = RequestFaceAuthenticationPayload;
511
+ type _ftv_RequestFaceAuthenticationResult = RequestFaceAuthenticationResult;
512
+ declare const _ftv_requestFaceAuthentication: typeof requestFaceAuthentication;
513
+ type _ftv_ReturnToControlPayload = ReturnToControlPayload;
514
+ declare const _ftv_returnToControl: typeof returnToControl;
560
515
  type _ftv_SelectFamilyResult = SelectFamilyResult;
561
516
  declare const _ftv_selectFamily: typeof selectFamily;
562
517
  declare namespace _ftv {
563
518
  export {
564
- _ftv_closeWindow as closeWindow,
519
+ _ftv_AddressSelectionResult as AddressSelectionResult,
520
+ _ftv_addressSelection as addressSelection,
521
+ _ftv_ChooseImageResult as ChooseImageResult,
522
+ _ftv_chooseImage as chooseImage,
523
+ _ftv_closeWebView as closeWebView,
565
524
  _ftv_TrackOptions as TrackOptions,
566
525
  _ftv_ConfigPayload as ConfigPayload,
567
526
  _ftv_config as config,
527
+ _ftv_DefaultAddressResult as DefaultAddressResult,
528
+ _ftv_defaultAddress as defaultAddress,
568
529
  _ftv_GetAuthCodePayload as GetAuthCodePayload,
569
530
  _ftv_GetAuthCodeResult as GetAuthCodeResult,
570
531
  _ftv_getAuthCode as getAuthCode,
532
+ _ftv_GetTokenResult as GetTokenResult,
533
+ _ftv_getAuthToken as getAuthToken,
571
534
  _ftv_getEnv as getEnv,
572
535
  _ftv_Environment as Environment,
573
536
  _ftv_getEnvSync as getEnvSync,
@@ -577,17 +540,11 @@ declare namespace _ftv {
577
540
  _ftv_navigateBack as navigateBack,
578
541
  _ftv_NavigateToPayLoad as NavigateToPayLoad,
579
542
  _ftv_navigateTo as navigateTo,
580
- _ftv_PlayVideoPayload as PlayVideoPayload,
581
- _ftv_playVideo as playVideo,
582
- _ftv_AddressAddPayload as AddressAddPayload,
583
- _ftv_AddressAddResult as AddressAddResult,
584
- _ftv_addressAdd as addressAdd,
585
- _ftv_AddressListResult as AddressListResult,
586
- _ftv_addressList as addressList,
587
- _ftv_AddressSelectionResult as AddressSelectionResult,
588
- _ftv_addressSelection as addressSelection,
589
- _ftv_DefaultAddressResult as DefaultAddressResult,
590
- _ftv_defaultAddress as defaultAddress,
543
+ _ftv_RequestFaceAuthenticationPayload as RequestFaceAuthenticationPayload,
544
+ _ftv_RequestFaceAuthenticationResult as RequestFaceAuthenticationResult,
545
+ _ftv_requestFaceAuthentication as requestFaceAuthentication,
546
+ _ftv_ReturnToControlPayload as ReturnToControlPayload,
547
+ _ftv_returnToControl as returnToControl,
591
548
  _ftv_SelectFamilyResult as SelectFamilyResult,
592
549
  _ftv_selectFamily as selectFamily,
593
550
  };