-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
95 lines (87 loc) · 3.02 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import React from 'react';
import type { InitData, FormField, FieldValue, Sender,PermissionRequestMessage } from 'global-input-message';
export * from 'global-input-message';
export function useGlobalInputApp(config: ConfigData | (() => ConfigData), canConnect?: boolean, configId?: any): GlobalInputData;
export function getGlobalInputState(): GlobalInputState;
interface RegisteredInfo {
session: string;
url: string;
}
interface GlobalInputState {
isLoading: boolean;
isReady: boolean;
isError: boolean;
isClosed: boolean;
isConnected: boolean;
isConnectionDenied: boolean;
initData: InitData;
senders: Sender[];
registeredInfo?: RegisteredInfo|null;
}
export type OnchangeFunction = (evt: FieldChanged) => void;
export interface ConfigData {
initData: InitData | (() => InitData);
onchange?: OnchangeFunction;
options?: ConnectOptions;
codeAES?: string;
initSocket?:(socket:any)=>void;
}
export interface ConnectOptions {
apikey?: string;
url?: string;
securityGroup?: string;
client?: string;
onRegistered?: (connectionCode: string) => void;
onRegisterFailed?: () => void;
onSenderConnected?: (sender: Sender, senders: Sender[]) => void;
onSenderDisconnected?: (sender: Sender, senders: Sender[]) => void;
onInputPermission?: (permissionMessage: PermissionRequestMessage, senders: Sender[], allow: () => void, deny: (reason?: string) => void) => void;
onError?: (message: string) => void;
}
export interface FieldChanged {
field: FormField;
initData: InitData;
sendInitData: SendInitDataFunction;
sendValue: SendValueFunction
}
export type SendValueFunction = (fieldId: string, valueToSet: FieldValue, fieldIndex?: number) => void;
export type SendInitDataFunction = (initData: InitData) => void;
export type ConnectQRProps = {
size?: number,
level?: "L" | "M" | "Q" | "H",
label?: React.ReactNode,
loading?: React.ReactNode,
maxSize?: number;
vspace?: number;
hspace?: number;
mobile:GlobalInputData;
onClickCode?: (code: string) => void;
};
export interface GlobalInputData {
connectionCode: string;
registeredInfo?: RegisteredInfo;
pairingCode: string;
field: FormField;
errorMessage: string;
isLoading: boolean;
isReady: boolean;
isError: boolean;
isClosed: boolean;
isConnected: boolean;
isDisconnected:boolean;
isConnectionDenied: boolean;
initData: InitData;
senders: Sender[];
sender:Sender;
sendValue: SendValueFunction;
sendInitData: SendInitDataFunction;
setOnchange: (onchange: OnchangeFunction) => void;
close: () => void;
restart: (config?: ConfigData) => void;
setClientAppLaunched: (listener:(data:any)=>void ) => void;
}
export function generateRandomString(length?: number): string;
export function encrypt(content: string, password: string): string;
export function decrypt(content: string, password: string): string;
export const ConnectQR:React.FC<ConnectQRProps>;
export const PairingQR:React.FC<ConnectQRProps>;