@ftvs/jssdk 1.2.0 → 1.4.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 +201 -32
- package/lib/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -77,7 +77,7 @@ declare function chooseImage(): Promise<ChooseImageResult>;
|
|
|
77
77
|
* @category 路由
|
|
78
78
|
* @example
|
|
79
79
|
* ```javascript
|
|
80
|
-
* await ftv.
|
|
80
|
+
* await ftv.closeWebView();
|
|
81
81
|
* ```
|
|
82
82
|
*/
|
|
83
83
|
declare function closeWebView(): Promise<void>;
|
|
@@ -105,12 +105,6 @@ interface ConfigPayload {
|
|
|
105
105
|
* 服务端分配的 AppSecret。
|
|
106
106
|
*/
|
|
107
107
|
appSecret: string;
|
|
108
|
-
/**
|
|
109
|
-
* 是否启用埋点工具。
|
|
110
|
-
*
|
|
111
|
-
* @default false
|
|
112
|
-
*/
|
|
113
|
-
track?: boolean | string | TrackOptions;
|
|
114
108
|
/**
|
|
115
109
|
* 是否开启 debug 模式。
|
|
116
110
|
*
|
|
@@ -129,7 +123,6 @@ interface ConfigPayload {
|
|
|
129
123
|
* await ftv.config({
|
|
130
124
|
* appId: 'xxxx',
|
|
131
125
|
* appSecret: 'xxxxxx',
|
|
132
|
-
* track: true,
|
|
133
126
|
* debug: process.env.NODE_ENV === 'development',
|
|
134
127
|
* });
|
|
135
128
|
* ```
|
|
@@ -187,6 +180,46 @@ interface DefaultAddressResult {
|
|
|
187
180
|
*/
|
|
188
181
|
declare function defaultAddress(): Promise<DefaultAddressResult>;
|
|
189
182
|
|
|
183
|
+
interface GetAppInfoResult {
|
|
184
|
+
/**
|
|
185
|
+
* 设备Id
|
|
186
|
+
*/
|
|
187
|
+
deviceId: string;
|
|
188
|
+
/**
|
|
189
|
+
* 维度
|
|
190
|
+
*/
|
|
191
|
+
latitude: string;
|
|
192
|
+
/**
|
|
193
|
+
* 经度
|
|
194
|
+
*/
|
|
195
|
+
longitude: string;
|
|
196
|
+
/**
|
|
197
|
+
* 网络类型
|
|
198
|
+
*/
|
|
199
|
+
netType: string;
|
|
200
|
+
/**
|
|
201
|
+
* 是否已经登录
|
|
202
|
+
*/
|
|
203
|
+
isLogin: boolean;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* 获取App信息。
|
|
207
|
+
* @category 基础
|
|
208
|
+
* @example
|
|
209
|
+
* ```javascript
|
|
210
|
+
* const res = await ftv.getAppInfo();
|
|
211
|
+
* // 结果类似:
|
|
212
|
+
* //{
|
|
213
|
+
* // "deviceId": "9afe0aab4be06ce5",
|
|
214
|
+
* // "isLogin": true,
|
|
215
|
+
* // "latitude": "26.61858",
|
|
216
|
+
* // "longitude": "106.64360",
|
|
217
|
+
* // "netType": "WIFI"
|
|
218
|
+
* }
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
declare function getAppInfo(): Promise<GetAppInfoResult>;
|
|
222
|
+
|
|
190
223
|
interface GetAuthCodePayload {
|
|
191
224
|
/**
|
|
192
225
|
* 应用id
|
|
@@ -215,6 +248,26 @@ interface GetAuthCodeResult {
|
|
|
215
248
|
*/
|
|
216
249
|
declare function getAuthCode(payload: GetAuthCodePayload): Promise<GetAuthCodeResult>;
|
|
217
250
|
|
|
251
|
+
interface GetTokenResult {
|
|
252
|
+
/**
|
|
253
|
+
* 令牌,返回空字符串表示没有登录
|
|
254
|
+
*/
|
|
255
|
+
token: string;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* 获取token令牌
|
|
259
|
+
* @category 开放接口 > 用户信息
|
|
260
|
+
* @example
|
|
261
|
+
* ```javascript
|
|
262
|
+
* const res = await ftv.getAuthToken();
|
|
263
|
+
* // 结果类似:
|
|
264
|
+
* // {
|
|
265
|
+
* // token: 'xxxxxxxxxxxxxxxxxx'
|
|
266
|
+
* // }
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
declare function getAuthToken(): Promise<GetTokenResult>;
|
|
270
|
+
|
|
218
271
|
interface Environment {
|
|
219
272
|
/**
|
|
220
273
|
* 是否在未来电视客户端中。
|
|
@@ -283,26 +336,7 @@ declare function getEnvSync(): Environment;
|
|
|
283
336
|
*/
|
|
284
337
|
declare function getEnv(): Promise<Environment>;
|
|
285
338
|
|
|
286
|
-
|
|
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
|
-
|
|
339
|
+
declare type OneOrMany<T> = T | T[];
|
|
306
340
|
declare type OneData<T> = {
|
|
307
341
|
[K in keyof T]: any;
|
|
308
342
|
};
|
|
@@ -407,6 +441,16 @@ interface NavigateToPayLoad {
|
|
|
407
441
|
*/
|
|
408
442
|
declare function navigateTo(payload: NavigateToPayLoad): Promise<void>;
|
|
409
443
|
|
|
444
|
+
/**
|
|
445
|
+
* 去登录页。
|
|
446
|
+
* @category 基础
|
|
447
|
+
* @example
|
|
448
|
+
* ```javascript
|
|
449
|
+
* await ftv.openLoginPage();
|
|
450
|
+
* ```
|
|
451
|
+
*/
|
|
452
|
+
declare function openLoginPage(): Promise<void>;
|
|
453
|
+
|
|
410
454
|
interface RequestFaceAuthenticationPayload {
|
|
411
455
|
/**
|
|
412
456
|
* 内部认证`0` 属于多彩未来电视的服务使用
|
|
@@ -438,6 +482,115 @@ interface RequestFaceAuthenticationResult {
|
|
|
438
482
|
*/
|
|
439
483
|
declare function requestFaceAuthentication(payload: RequestFaceAuthenticationPayload): Promise<RequestFaceAuthenticationResult>;
|
|
440
484
|
|
|
485
|
+
interface paramsData {
|
|
486
|
+
/**
|
|
487
|
+
* 标题
|
|
488
|
+
*/
|
|
489
|
+
title: string;
|
|
490
|
+
/**
|
|
491
|
+
* 内容
|
|
492
|
+
*/
|
|
493
|
+
content: string;
|
|
494
|
+
}
|
|
495
|
+
interface RequestPaymentPayload {
|
|
496
|
+
/**
|
|
497
|
+
* 业务名称
|
|
498
|
+
*/
|
|
499
|
+
orgName: string;
|
|
500
|
+
/**
|
|
501
|
+
* 订单号
|
|
502
|
+
*/
|
|
503
|
+
orderNo: string;
|
|
504
|
+
/**
|
|
505
|
+
* 金额
|
|
506
|
+
*/
|
|
507
|
+
orderAmt: number;
|
|
508
|
+
/**
|
|
509
|
+
* 支付状态标签
|
|
510
|
+
* `0 不展示`
|
|
511
|
+
*
|
|
512
|
+
*/
|
|
513
|
+
amtType?: string;
|
|
514
|
+
/**
|
|
515
|
+
* 开放平台APPID
|
|
516
|
+
*/
|
|
517
|
+
openAppId?: string;
|
|
518
|
+
/**
|
|
519
|
+
* 支付二维码生成参数
|
|
520
|
+
*/
|
|
521
|
+
qrCode: string;
|
|
522
|
+
/**
|
|
523
|
+
* 支付类型
|
|
524
|
+
* number `1 微信 2 支付宝`
|
|
525
|
+
*/
|
|
526
|
+
qrType: 1 | 2;
|
|
527
|
+
/**
|
|
528
|
+
* `paramsData:{content: string;title: string}`;
|
|
529
|
+
*
|
|
530
|
+
* 
|
|
531
|
+
*/
|
|
532
|
+
params: OneOrMany<paramsData>;
|
|
533
|
+
}
|
|
534
|
+
interface RequestPaymentResult {
|
|
535
|
+
/**
|
|
536
|
+
* 支付状态
|
|
537
|
+
*/
|
|
538
|
+
status: boolean;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* 支付。
|
|
542
|
+
*
|
|
543
|
+
* @category 开放接口 > 支付
|
|
544
|
+
* @example
|
|
545
|
+
* ```javascript
|
|
546
|
+
* const res = await ftv.requestPayment({
|
|
547
|
+
* "orgName": "静脉采血",
|
|
548
|
+
* "orderNo": "2024121029777035859353601",
|
|
549
|
+
* "orderAmt": 0.01,
|
|
550
|
+
* "qrCode": "weixin://wxpay/bizpayurl?pr=rr0QIYVz1",
|
|
551
|
+
* "qrType": 1,
|
|
552
|
+
* "params": [
|
|
553
|
+
* {
|
|
554
|
+
* "title": "订单名称",
|
|
555
|
+
* "content": "静脉采血"
|
|
556
|
+
* },
|
|
557
|
+
* {
|
|
558
|
+
* "title": "订单编号",
|
|
559
|
+
* "content": "2024121029777035859353601"
|
|
560
|
+
* },
|
|
561
|
+
* {
|
|
562
|
+
* "title": "创建时间",
|
|
563
|
+
* "content": "2024-08-12 15:26:18"
|
|
564
|
+
* }
|
|
565
|
+
* ]
|
|
566
|
+
* });
|
|
567
|
+
* // 结果类似:
|
|
568
|
+
* // {
|
|
569
|
+
* // status: true
|
|
570
|
+
* // }
|
|
571
|
+
* ```
|
|
572
|
+
*/
|
|
573
|
+
declare function requestPayment(payload: RequestPaymentPayload): Promise<RequestPaymentResult>;
|
|
574
|
+
|
|
575
|
+
interface ReturnToControlPayload {
|
|
576
|
+
/**
|
|
577
|
+
* 是否管控
|
|
578
|
+
*/
|
|
579
|
+
hijack: boolean;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* 路由权限管控。
|
|
583
|
+
*
|
|
584
|
+
* @category 路由
|
|
585
|
+
* @example
|
|
586
|
+
* ```javascript
|
|
587
|
+
* await ftv.returnToControl({
|
|
588
|
+
* hijack: true
|
|
589
|
+
* });
|
|
590
|
+
* ```
|
|
591
|
+
*/
|
|
592
|
+
declare function returnToControl(payload: ReturnToControlPayload): Promise<void>;
|
|
593
|
+
|
|
441
594
|
interface SelectFamilyResult {
|
|
442
595
|
/**
|
|
443
596
|
* 打开状态
|
|
@@ -481,23 +634,31 @@ type _ftv_ConfigPayload = ConfigPayload;
|
|
|
481
634
|
declare const _ftv_config: typeof config;
|
|
482
635
|
type _ftv_DefaultAddressResult = DefaultAddressResult;
|
|
483
636
|
declare const _ftv_defaultAddress: typeof defaultAddress;
|
|
637
|
+
type _ftv_GetAppInfoResult = GetAppInfoResult;
|
|
638
|
+
declare const _ftv_getAppInfo: typeof getAppInfo;
|
|
484
639
|
type _ftv_GetAuthCodePayload = GetAuthCodePayload;
|
|
485
640
|
type _ftv_GetAuthCodeResult = GetAuthCodeResult;
|
|
486
641
|
declare const _ftv_getAuthCode: typeof getAuthCode;
|
|
642
|
+
type _ftv_GetTokenResult = GetTokenResult;
|
|
643
|
+
declare const _ftv_getAuthToken: typeof getAuthToken;
|
|
487
644
|
declare const _ftv_getEnv: typeof getEnv;
|
|
488
645
|
type _ftv_Environment = Environment;
|
|
489
646
|
declare const _ftv_getEnvSync: typeof getEnvSync;
|
|
490
|
-
type _ftv_GetTokenResult = GetTokenResult;
|
|
491
|
-
declare const _ftv_getAuthToken: typeof getAuthToken;
|
|
492
647
|
type _ftv_GetUserInfoPayload = GetUserInfoPayload;
|
|
493
648
|
type _ftv_GetUserInfoResult = GetUserInfoResult;
|
|
494
649
|
declare const _ftv_getUserInfo: typeof getUserInfo;
|
|
495
650
|
declare const _ftv_navigateBack: typeof navigateBack;
|
|
496
651
|
type _ftv_NavigateToPayLoad = NavigateToPayLoad;
|
|
497
652
|
declare const _ftv_navigateTo: typeof navigateTo;
|
|
653
|
+
declare const _ftv_openLoginPage: typeof openLoginPage;
|
|
498
654
|
type _ftv_RequestFaceAuthenticationPayload = RequestFaceAuthenticationPayload;
|
|
499
655
|
type _ftv_RequestFaceAuthenticationResult = RequestFaceAuthenticationResult;
|
|
500
656
|
declare const _ftv_requestFaceAuthentication: typeof requestFaceAuthentication;
|
|
657
|
+
type _ftv_RequestPaymentPayload = RequestPaymentPayload;
|
|
658
|
+
type _ftv_RequestPaymentResult = RequestPaymentResult;
|
|
659
|
+
declare const _ftv_requestPayment: typeof requestPayment;
|
|
660
|
+
type _ftv_ReturnToControlPayload = ReturnToControlPayload;
|
|
661
|
+
declare const _ftv_returnToControl: typeof returnToControl;
|
|
501
662
|
type _ftv_SelectFamilyResult = SelectFamilyResult;
|
|
502
663
|
declare const _ftv_selectFamily: typeof selectFamily;
|
|
503
664
|
declare namespace _ftv {
|
|
@@ -512,23 +673,31 @@ declare namespace _ftv {
|
|
|
512
673
|
_ftv_config as config,
|
|
513
674
|
_ftv_DefaultAddressResult as DefaultAddressResult,
|
|
514
675
|
_ftv_defaultAddress as defaultAddress,
|
|
676
|
+
_ftv_GetAppInfoResult as GetAppInfoResult,
|
|
677
|
+
_ftv_getAppInfo as getAppInfo,
|
|
515
678
|
_ftv_GetAuthCodePayload as GetAuthCodePayload,
|
|
516
679
|
_ftv_GetAuthCodeResult as GetAuthCodeResult,
|
|
517
680
|
_ftv_getAuthCode as getAuthCode,
|
|
681
|
+
_ftv_GetTokenResult as GetTokenResult,
|
|
682
|
+
_ftv_getAuthToken as getAuthToken,
|
|
518
683
|
_ftv_getEnv as getEnv,
|
|
519
684
|
_ftv_Environment as Environment,
|
|
520
685
|
_ftv_getEnvSync as getEnvSync,
|
|
521
|
-
_ftv_GetTokenResult as GetTokenResult,
|
|
522
|
-
_ftv_getAuthToken as getAuthToken,
|
|
523
686
|
_ftv_GetUserInfoPayload as GetUserInfoPayload,
|
|
524
687
|
_ftv_GetUserInfoResult as GetUserInfoResult,
|
|
525
688
|
_ftv_getUserInfo as getUserInfo,
|
|
526
689
|
_ftv_navigateBack as navigateBack,
|
|
527
690
|
_ftv_NavigateToPayLoad as NavigateToPayLoad,
|
|
528
691
|
_ftv_navigateTo as navigateTo,
|
|
692
|
+
_ftv_openLoginPage as openLoginPage,
|
|
529
693
|
_ftv_RequestFaceAuthenticationPayload as RequestFaceAuthenticationPayload,
|
|
530
694
|
_ftv_RequestFaceAuthenticationResult as RequestFaceAuthenticationResult,
|
|
531
695
|
_ftv_requestFaceAuthentication as requestFaceAuthentication,
|
|
696
|
+
_ftv_RequestPaymentPayload as RequestPaymentPayload,
|
|
697
|
+
_ftv_RequestPaymentResult as RequestPaymentResult,
|
|
698
|
+
_ftv_requestPayment as requestPayment,
|
|
699
|
+
_ftv_ReturnToControlPayload as ReturnToControlPayload,
|
|
700
|
+
_ftv_returnToControl as returnToControl,
|
|
532
701
|
_ftv_SelectFamilyResult as SelectFamilyResult,
|
|
533
702
|
_ftv_selectFamily as selectFamily,
|
|
534
703
|
};
|