@ftvs/jssdk 1.1.0 → 1.2.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
  /**
@@ -50,7 +121,7 @@ interface ConfigPayload {
50
121
  debug?: boolean;
51
122
  }
52
123
  /**
53
- * 注入权限验证配置。`appId`、`appSecret` 请通过钉钉向 `熊小川` 申请。
124
+ * 注入权限验证配置。`appId`、`appSecret` 请先申请。
54
125
  *
55
126
  * @category 基础
56
127
  * @example
@@ -65,6 +136,57 @@ interface ConfigPayload {
65
136
  */
66
137
  declare function config(payload: ConfigPayload): Promise<void>;
67
138
 
139
+ interface DefaultAddressResult {
140
+ /**
141
+ * 省份名字
142
+ *
143
+ */
144
+ proName: string;
145
+ /**
146
+ * 省份code
147
+ *
148
+ */
149
+ proCode: string;
150
+ /**
151
+ * 城市名字
152
+ *
153
+ */
154
+ cityName: string;
155
+ /**
156
+ * 城市code
157
+ *
158
+ */
159
+ cityCode: string;
160
+ /**
161
+ * 区划名字
162
+ *
163
+ */
164
+ dirName: string;
165
+ /**
166
+ * 区划code
167
+ *
168
+ */
169
+ dirCode: string;
170
+ }
171
+ /**
172
+ * 获取默认区划地址。
173
+ * @category 开放接口 > 地址
174
+ * @example
175
+ * ```javascript
176
+ * const res = await ftv.defaultAddress();
177
+ * // 结果类似:
178
+ * //{
179
+ * //"proCode":"520000",
180
+ * //"cityName":"贵阳市",
181
+ * //"cityCode":"520100",
182
+ * //"dirCode":"520115",
183
+ * //"proName":"贵州省",
184
+ * //"dirName":"观山湖区"
185
+ * //}
186
+ * ```
187
+ */
188
+ declare function defaultAddress(): Promise<DefaultAddressResult>;
189
+
68
190
  interface GetAuthCodePayload {
69
191
  /**
70
192
  * 应用id
@@ -161,6 +283,26 @@ declare function getEnvSync(): Environment;
161
283
  */
162
284
  declare function getEnv(): Promise<Environment>;
163
285
 
286
+ interface GetTokenResult {
287
+ /**
288
+ * 令牌,返回空字符串表示没有登录
289
+ */
290
+ token: string;
291
+ }
292
+ /**
293
+ * 获取token令牌
294
+ * @category 开放接口 > 用户信息
295
+ * @example
296
+ * ```javascript
297
+ * const res = await ftv.getAuthToken();
298
+ * // 结果类似:
299
+ * // {
300
+ * // token: 'xxxxxxxxxxxxxxxxxx'
301
+ * // }
302
+ * ```
303
+ */
304
+ declare function getAuthToken(): Promise<GetTokenResult>;
305
+
164
306
  declare type OneData<T> = {
165
307
  [K in keyof T]: any;
166
308
  };
@@ -171,9 +313,9 @@ interface GetUserInfoPayload {
171
313
  */
172
314
  authCode: string;
173
315
  /**
174
- * 是否需要实名信息
316
+ * 是否需要敏感信息
175
317
  */
176
- isAuth?: boolean;
318
+ withCredentials?: boolean;
177
319
  }
178
320
  interface GetUserInfoResult {
179
321
  /**
@@ -233,7 +375,6 @@ declare function getUserInfo(payload: GetUserInfoPayload): Promise<GetUserInfoRe
233
375
  /**
234
376
  * 客户端浏览器返回上一页,当浏览器栈无上一级时,关闭当前浏览器。
235
377
  *
236
- * @mp
237
378
  * @category 路由
238
379
  * @example
239
380
  * ```javascript
@@ -266,236 +407,36 @@ interface NavigateToPayLoad {
266
407
  */
267
408
  declare function navigateTo(payload: NavigateToPayLoad): Promise<void>;
268
409
 
269
- interface PlayVideoPayload {
410
+ interface RequestFaceAuthenticationPayload {
270
411
  /**
271
- * 视频地址。
412
+ * 内部认证`0` 属于多彩未来电视的服务使用
413
+ * 三方认证`1` 非多彩未来电视的服务使用
272
414
  */
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 {
289
- /**
290
- * 二级地级行政区(地级市、地区、自治州、盟)
291
- *
292
- */
293
- city?: string;
415
+ authCheckType: '0' | '1';
294
416
  /**
295
- * 三级县级行政区(市辖区、县级市、县、自治县、旗、自治旗、林区、特区)
296
- *
417
+ * 三方认证使用用户openId
297
418
  */
298
- county?: string;
299
- /**
300
- * 是否是默认地址
301
- *
302
- */
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;
419
+ openId?: string;
334
420
  }
335
- interface AddressAddResult {
421
+ interface RequestFaceAuthenticationResult {
336
422
  /**
337
- * 操作状态
338
- *
423
+ * 包含认证信息的加密数据。根据需要直接传给后端即可。返回空字符串则是认证失败
339
424
  */
340
- status: boolean;
425
+ encryptedData: string;
341
426
  }
342
427
  /**
343
- * 新增或修改地址。
344
- * @category 开放接口 > 地址
428
+ * 人脸认证
429
+ * @category 开放接口 > 授权
345
430
  * @example
346
431
  * ```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
- * });
432
+ * const res = await ftv.requestFaceAuthentication();
358
433
  * // 结果类似:
359
434
  * // {
360
- * // status: true
435
+ * // encryptedData: '4088a70bc2ed4b0aac7a904aeaf3819e'
361
436
  * // }
362
437
  * ```
363
438
  */
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>;
448
-
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;
475
- /**
476
- * 区划code
477
- *
478
- */
479
- dirCode: string;
480
- }
481
- /**
482
- * 获取默认区划地址。
483
- * @category 开放接口 > 地址
484
- * @example
485
- * ```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
- * //}
496
- * ```
497
- */
498
- declare function defaultAddress(): Promise<DefaultAddressResult>;
439
+ declare function requestFaceAuthentication(payload: RequestFaceAuthenticationPayload): Promise<RequestFaceAuthenticationResult>;
499
440
 
500
441
  interface SelectFamilyResult {
501
442
  /**
@@ -530,64 +471,64 @@ interface SelectFamilyResult {
530
471
  */
531
472
  declare function selectFamily(): Promise<SelectFamilyResult>;
532
473
 
533
- declare const _ftv_closeWindow: typeof closeWindow;
474
+ type _ftv_AddressSelectionResult = AddressSelectionResult;
475
+ declare const _ftv_addressSelection: typeof addressSelection;
476
+ type _ftv_ChooseImageResult = ChooseImageResult;
477
+ declare const _ftv_chooseImage: typeof chooseImage;
478
+ declare const _ftv_closeWebView: typeof closeWebView;
534
479
  type _ftv_TrackOptions = TrackOptions;
535
480
  type _ftv_ConfigPayload = ConfigPayload;
536
481
  declare const _ftv_config: typeof config;
482
+ type _ftv_DefaultAddressResult = DefaultAddressResult;
483
+ declare const _ftv_defaultAddress: typeof defaultAddress;
537
484
  type _ftv_GetAuthCodePayload = GetAuthCodePayload;
538
485
  type _ftv_GetAuthCodeResult = GetAuthCodeResult;
539
486
  declare const _ftv_getAuthCode: typeof getAuthCode;
540
487
  declare const _ftv_getEnv: typeof getEnv;
541
488
  type _ftv_Environment = Environment;
542
489
  declare const _ftv_getEnvSync: typeof getEnvSync;
490
+ type _ftv_GetTokenResult = GetTokenResult;
491
+ declare const _ftv_getAuthToken: typeof getAuthToken;
543
492
  type _ftv_GetUserInfoPayload = GetUserInfoPayload;
544
493
  type _ftv_GetUserInfoResult = GetUserInfoResult;
545
494
  declare const _ftv_getUserInfo: typeof getUserInfo;
546
495
  declare const _ftv_navigateBack: typeof navigateBack;
547
496
  type _ftv_NavigateToPayLoad = NavigateToPayLoad;
548
497
  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;
498
+ type _ftv_RequestFaceAuthenticationPayload = RequestFaceAuthenticationPayload;
499
+ type _ftv_RequestFaceAuthenticationResult = RequestFaceAuthenticationResult;
500
+ declare const _ftv_requestFaceAuthentication: typeof requestFaceAuthentication;
560
501
  type _ftv_SelectFamilyResult = SelectFamilyResult;
561
502
  declare const _ftv_selectFamily: typeof selectFamily;
562
503
  declare namespace _ftv {
563
504
  export {
564
- _ftv_closeWindow as closeWindow,
505
+ _ftv_AddressSelectionResult as AddressSelectionResult,
506
+ _ftv_addressSelection as addressSelection,
507
+ _ftv_ChooseImageResult as ChooseImageResult,
508
+ _ftv_chooseImage as chooseImage,
509
+ _ftv_closeWebView as closeWebView,
565
510
  _ftv_TrackOptions as TrackOptions,
566
511
  _ftv_ConfigPayload as ConfigPayload,
567
512
  _ftv_config as config,
513
+ _ftv_DefaultAddressResult as DefaultAddressResult,
514
+ _ftv_defaultAddress as defaultAddress,
568
515
  _ftv_GetAuthCodePayload as GetAuthCodePayload,
569
516
  _ftv_GetAuthCodeResult as GetAuthCodeResult,
570
517
  _ftv_getAuthCode as getAuthCode,
571
518
  _ftv_getEnv as getEnv,
572
519
  _ftv_Environment as Environment,
573
520
  _ftv_getEnvSync as getEnvSync,
521
+ _ftv_GetTokenResult as GetTokenResult,
522
+ _ftv_getAuthToken as getAuthToken,
574
523
  _ftv_GetUserInfoPayload as GetUserInfoPayload,
575
524
  _ftv_GetUserInfoResult as GetUserInfoResult,
576
525
  _ftv_getUserInfo as getUserInfo,
577
526
  _ftv_navigateBack as navigateBack,
578
527
  _ftv_NavigateToPayLoad as NavigateToPayLoad,
579
528
  _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,
529
+ _ftv_RequestFaceAuthenticationPayload as RequestFaceAuthenticationPayload,
530
+ _ftv_RequestFaceAuthenticationResult as RequestFaceAuthenticationResult,
531
+ _ftv_requestFaceAuthentication as requestFaceAuthentication,
591
532
  _ftv_SelectFamilyResult as SelectFamilyResult,
592
533
  _ftv_selectFamily as selectFamily,
593
534
  };