@syncfy/authentication-widget 2.0.0 → 2.1.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/README.md +97 -78
- package/dist/mockServiceWorker.js +344 -344
- package/dist/syncfy-authentication-widget.cjs.js +409 -84
- package/dist/syncfy-authentication-widget.css +54 -1
- package/dist/syncfy-authentication-widget.esm.js +410 -85
- package/dist/syncfy-authentication-widget.umd.js +128 -113
- package/package.json +134 -134
- package/types/main.d.ts +306 -306
package/types/main.d.ts
CHANGED
|
@@ -1,306 +1,306 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type declarations for @syncfy/authentication-widget.
|
|
3
|
-
* The built dist/main.d.ts may be empty when generated by vite-plugin-dts;
|
|
4
|
-
* this file is the canonical source for published types.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export interface Params {
|
|
8
|
-
config?: Record<string, unknown>;
|
|
9
|
-
element?: Element | string;
|
|
10
|
-
enableTestMode?: boolean;
|
|
11
|
-
refreshTokenFunction?: () => Promise<{ token: string; strict?: unknown }>;
|
|
12
|
-
strict?: unknown;
|
|
13
|
-
token: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** Locale option. */
|
|
17
|
-
export type Locale = string;
|
|
18
|
-
|
|
19
|
-
/** Auth argument for headless methods. */
|
|
20
|
-
export interface HeadlessAuth {
|
|
21
|
-
token: string;
|
|
22
|
-
strict?: unknown;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** Account returned by getAccounts. */
|
|
26
|
-
export interface Account {
|
|
27
|
-
account_type: string;
|
|
28
|
-
balance: number;
|
|
29
|
-
currency: string;
|
|
30
|
-
dt_refresh: number;
|
|
31
|
-
id_account_type: string;
|
|
32
|
-
id_account: string;
|
|
33
|
-
id_credential: string;
|
|
34
|
-
id_currency: string;
|
|
35
|
-
id_external: string;
|
|
36
|
-
id_site_organization_type: string;
|
|
37
|
-
id_site_organization: string;
|
|
38
|
-
id_site: string;
|
|
39
|
-
id_user: string;
|
|
40
|
-
is_disable: number;
|
|
41
|
-
name: string;
|
|
42
|
-
number: string;
|
|
43
|
-
site: {
|
|
44
|
-
avatar: string;
|
|
45
|
-
cover: string;
|
|
46
|
-
id_site_organization_type: string;
|
|
47
|
-
id_site_organization: string;
|
|
48
|
-
id_site: string;
|
|
49
|
-
name: string;
|
|
50
|
-
organization: string;
|
|
51
|
-
small_cover: string;
|
|
52
|
-
time_zone: string;
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/** Country returned by getCountries. */
|
|
57
|
-
export interface Country {
|
|
58
|
-
code: string;
|
|
59
|
-
id_country: string;
|
|
60
|
-
name: string;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/** Site (API model) returned by getSite and passed to siteConnection. */
|
|
64
|
-
export interface SiteBase {
|
|
65
|
-
avatar?: string;
|
|
66
|
-
cover?: string;
|
|
67
|
-
endpoint: string;
|
|
68
|
-
id_site_type: string;
|
|
69
|
-
id_site: string;
|
|
70
|
-
is_business: number;
|
|
71
|
-
is_personal: number;
|
|
72
|
-
name: string;
|
|
73
|
-
quickAnswer?: boolean;
|
|
74
|
-
request?: unknown;
|
|
75
|
-
site_organization?: OrganizationSite;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface SiteV1 extends SiteBase {
|
|
79
|
-
version: 1;
|
|
80
|
-
credentials: CredentialInput[];
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export interface SiteV3 extends SiteBase {
|
|
84
|
-
version: 3;
|
|
85
|
-
input: CredentialInputGroup[];
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export interface SiteV4 extends SiteBase {
|
|
89
|
-
version: 4;
|
|
90
|
-
input: V4CredentialInputGroup[];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export type Site = SiteV1 | SiteV3 | SiteV4;
|
|
94
|
-
|
|
95
|
-
/** Credential field (e.g. from getFields). */
|
|
96
|
-
export interface CredentialInput {
|
|
97
|
-
accept?: Array<{ extension: string; mime_type: string }>;
|
|
98
|
-
enabled_by?: string;
|
|
99
|
-
enables?: string[];
|
|
100
|
-
error_label?: string;
|
|
101
|
-
identifier?: boolean;
|
|
102
|
-
label?: string;
|
|
103
|
-
name: string;
|
|
104
|
-
options?: SelectOption[];
|
|
105
|
-
required: boolean;
|
|
106
|
-
token?: boolean;
|
|
107
|
-
translate_error_label?: string;
|
|
108
|
-
translate_label?: string;
|
|
109
|
-
type: string;
|
|
110
|
-
validation?: Validation;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface CredentialInputGroup {
|
|
114
|
-
fields: CredentialInput[];
|
|
115
|
-
label: string;
|
|
116
|
-
name: string;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export interface SelectOption {
|
|
120
|
-
label?: string;
|
|
121
|
-
value?: number | string;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export interface Validation {
|
|
125
|
-
type?: string;
|
|
126
|
-
value?: unknown;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export interface V4CredentialInputGroup {
|
|
130
|
-
fields?: CredentialInput[];
|
|
131
|
-
label?: string;
|
|
132
|
-
name?: string;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/** Organization site returned by getOrganizationSites. */
|
|
136
|
-
export interface OrganizationSite {
|
|
137
|
-
avatar: string;
|
|
138
|
-
cover: string;
|
|
139
|
-
id_country: string;
|
|
140
|
-
id_site_organization: string;
|
|
141
|
-
id_site_organization_type: string;
|
|
142
|
-
name: string;
|
|
143
|
-
sites: Site[];
|
|
144
|
-
small_cover: string;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/** Organization type returned by getOrganizationTypes. */
|
|
148
|
-
export interface OrganizationType {
|
|
149
|
-
id_site_organization_type: string;
|
|
150
|
-
label: string;
|
|
151
|
-
name: string;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/** Socket message payload (e.g. from site.on('socket-message', (data) => ...)). For code 410, data is TwofaMessage. */
|
|
155
|
-
export interface SocketMessage {
|
|
156
|
-
address?: string;
|
|
157
|
-
code: number;
|
|
158
|
-
id_request?: string;
|
|
159
|
-
id_site?: string;
|
|
160
|
-
twofa?: TwofaCredentialInput[];
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/** Site connection returned by siteConnection (SiteV1Service | SiteV3Service | SiteV4Service). */
|
|
164
|
-
export interface HeadlessSiteConnection {
|
|
165
|
-
readonly version: 1 | 3 | 4;
|
|
166
|
-
getFields(updateMode?: boolean): CredentialInput[];
|
|
167
|
-
getFields(index: number, updateMode?: boolean): CredentialInput[];
|
|
168
|
-
getOptions(): CredentialInputGroup[];
|
|
169
|
-
getBackUpFields(updateMode?: boolean): CredentialInput[];
|
|
170
|
-
readonly twofa: HeadlessTwofa | null;
|
|
171
|
-
on(event: string, callback: (...args: unknown[]) => void): void;
|
|
172
|
-
connect(data: Record<string, unknown>): Promise<unknown>;
|
|
173
|
-
connect(
|
|
174
|
-
index: number,
|
|
175
|
-
data: Record<string, unknown>,
|
|
176
|
-
isBackUp?: boolean,
|
|
177
|
-
): Promise<unknown>;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/** Twofa message passed to headless.twofa (e.g. socket 410 data). */
|
|
181
|
-
export interface TwofaMessage {
|
|
182
|
-
address: string;
|
|
183
|
-
code: number;
|
|
184
|
-
id_request?: string;
|
|
185
|
-
id_site?: string;
|
|
186
|
-
twofa: TwofaCredentialInput[];
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/** Twofa credential field (from HeadlessTwofa.getFields). */
|
|
190
|
-
export interface TwofaCredentialInput {
|
|
191
|
-
disabled?: boolean;
|
|
192
|
-
imgBase64File?: string;
|
|
193
|
-
imgURL?: string;
|
|
194
|
-
label: string;
|
|
195
|
-
name: string;
|
|
196
|
-
options?: Array<{
|
|
197
|
-
imgBase64File?: string;
|
|
198
|
-
imgURL?: string;
|
|
199
|
-
label?: string;
|
|
200
|
-
value: number | string;
|
|
201
|
-
}>;
|
|
202
|
-
type: string;
|
|
203
|
-
validation?: Validation;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/** Twofa instance returned by headless.twofa. */
|
|
207
|
-
export interface HeadlessTwofa {
|
|
208
|
-
getFields(): TwofaCredentialInput[];
|
|
209
|
-
displaySubmitButton: boolean;
|
|
210
|
-
data: Record<string, unknown>;
|
|
211
|
-
authenticate(data: Record<string, unknown>): void | Promise<unknown>;
|
|
212
|
-
on(event: string, callback: (...args: unknown[]) => void): void;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/** Credential instance returned by syncCredential and updateCredential. */
|
|
216
|
-
export interface HeadlessCredential {
|
|
217
|
-
on(event: string, callback: (...args: unknown[]) => void): void;
|
|
218
|
-
getCredentialData(): Record<string, unknown>;
|
|
219
|
-
readonly twofa: HeadlessTwofa | null;
|
|
220
|
-
status?: string;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/** Headless API: static methods for use without mounting the widget UI. */
|
|
224
|
-
export interface SyncfyWidgetHeadless {
|
|
225
|
-
getAccounts(
|
|
226
|
-
auth: HeadlessAuth,
|
|
227
|
-
id_credential: string,
|
|
228
|
-
config?: { locale?: Locale },
|
|
229
|
-
): Promise<Account[]>;
|
|
230
|
-
getCountries(
|
|
231
|
-
auth: HeadlessAuth,
|
|
232
|
-
config?: { locale?: Locale },
|
|
233
|
-
): Promise<Country[]>;
|
|
234
|
-
getOrganizationSites(
|
|
235
|
-
auth: HeadlessAuth,
|
|
236
|
-
params?: { is_business?: number; is_personal?: number },
|
|
237
|
-
config?: { locale?: Locale },
|
|
238
|
-
): Promise<OrganizationSite[]>;
|
|
239
|
-
getOrganizationTypes(
|
|
240
|
-
auth: HeadlessAuth,
|
|
241
|
-
config?: { locale?: Locale },
|
|
242
|
-
): Promise<OrganizationType[]>;
|
|
243
|
-
getSite(
|
|
244
|
-
auth: HeadlessAuth,
|
|
245
|
-
id_site: string,
|
|
246
|
-
config?: { locale?: Locale },
|
|
247
|
-
): Promise<Site>;
|
|
248
|
-
siteConnection(
|
|
249
|
-
auth: HeadlessAuth,
|
|
250
|
-
site: Site,
|
|
251
|
-
config?: {
|
|
252
|
-
locale?: Locale;
|
|
253
|
-
quickAnswer?: boolean;
|
|
254
|
-
socketTimeout?: number | string;
|
|
255
|
-
},
|
|
256
|
-
): Promise<HeadlessSiteConnection>;
|
|
257
|
-
syncCredential(
|
|
258
|
-
auth: HeadlessAuth,
|
|
259
|
-
id_credential: string,
|
|
260
|
-
config?: {
|
|
261
|
-
locale?: Locale;
|
|
262
|
-
quickAnswer?: boolean;
|
|
263
|
-
socketTimeout?: number | string;
|
|
264
|
-
},
|
|
265
|
-
): Promise<HeadlessCredential>;
|
|
266
|
-
twofa(
|
|
267
|
-
auth: HeadlessAuth,
|
|
268
|
-
twofaMessage: TwofaMessage,
|
|
269
|
-
id_site: string,
|
|
270
|
-
config?: { locale?: Locale },
|
|
271
|
-
): Promise<HeadlessTwofa>;
|
|
272
|
-
updateCredential(
|
|
273
|
-
auth: HeadlessAuth,
|
|
274
|
-
id_credential: string,
|
|
275
|
-
config?: {
|
|
276
|
-
locale?: Locale;
|
|
277
|
-
quickAnswer?: boolean;
|
|
278
|
-
socketTimeout?: number | string;
|
|
279
|
-
},
|
|
280
|
-
): Promise<HeadlessCredential>;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
export interface SyncfyWidgetInstance {
|
|
284
|
-
on(event: string, callback: (...args: unknown[]) => void): void;
|
|
285
|
-
close: () => void;
|
|
286
|
-
getLastRid: () => string | undefined;
|
|
287
|
-
open: () => void;
|
|
288
|
-
setConfig: (config: unknown) => void;
|
|
289
|
-
setEntrypointCredential: (entrypoint: string) => void;
|
|
290
|
-
setEntrypointSite: (entrypoint: string) => void;
|
|
291
|
-
setEntrypointUpdateCredential: (entrypoint: string) => void;
|
|
292
|
-
setToken: (token: string) => void;
|
|
293
|
-
upsertConfig: (config: unknown) => void;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/** SyncfyWidget is a constructor; `new SyncfyWidget(params)` returns an instance with open(), close(), on(), etc. */
|
|
297
|
-
export interface SyncfyWidgetConstructor {
|
|
298
|
-
new (params: Params | string): SyncfyWidgetInstance;
|
|
299
|
-
getVersion(): string;
|
|
300
|
-
headless: SyncfyWidgetHeadless;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
declare const SyncfyWidget: SyncfyWidgetConstructor;
|
|
304
|
-
|
|
305
|
-
export { SyncfyWidget };
|
|
306
|
-
export default SyncfyWidget;
|
|
1
|
+
/**
|
|
2
|
+
* Type declarations for @syncfy/authentication-widget.
|
|
3
|
+
* The built dist/main.d.ts may be empty when generated by vite-plugin-dts;
|
|
4
|
+
* this file is the canonical source for published types.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface Params {
|
|
8
|
+
config?: Record<string, unknown>;
|
|
9
|
+
element?: Element | string;
|
|
10
|
+
enableTestMode?: boolean;
|
|
11
|
+
refreshTokenFunction?: () => Promise<{ token: string; strict?: unknown }>;
|
|
12
|
+
strict?: unknown;
|
|
13
|
+
token: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Locale option. */
|
|
17
|
+
export type Locale = string;
|
|
18
|
+
|
|
19
|
+
/** Auth argument for headless methods. */
|
|
20
|
+
export interface HeadlessAuth {
|
|
21
|
+
token: string;
|
|
22
|
+
strict?: unknown;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Account returned by getAccounts. */
|
|
26
|
+
export interface Account {
|
|
27
|
+
account_type: string;
|
|
28
|
+
balance: number;
|
|
29
|
+
currency: string;
|
|
30
|
+
dt_refresh: number;
|
|
31
|
+
id_account_type: string;
|
|
32
|
+
id_account: string;
|
|
33
|
+
id_credential: string;
|
|
34
|
+
id_currency: string;
|
|
35
|
+
id_external: string;
|
|
36
|
+
id_site_organization_type: string;
|
|
37
|
+
id_site_organization: string;
|
|
38
|
+
id_site: string;
|
|
39
|
+
id_user: string;
|
|
40
|
+
is_disable: number;
|
|
41
|
+
name: string;
|
|
42
|
+
number: string;
|
|
43
|
+
site: {
|
|
44
|
+
avatar: string;
|
|
45
|
+
cover: string;
|
|
46
|
+
id_site_organization_type: string;
|
|
47
|
+
id_site_organization: string;
|
|
48
|
+
id_site: string;
|
|
49
|
+
name: string;
|
|
50
|
+
organization: string;
|
|
51
|
+
small_cover: string;
|
|
52
|
+
time_zone: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Country returned by getCountries. */
|
|
57
|
+
export interface Country {
|
|
58
|
+
code: string;
|
|
59
|
+
id_country: string;
|
|
60
|
+
name: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Site (API model) returned by getSite and passed to siteConnection. */
|
|
64
|
+
export interface SiteBase {
|
|
65
|
+
avatar?: string;
|
|
66
|
+
cover?: string;
|
|
67
|
+
endpoint: string;
|
|
68
|
+
id_site_type: string;
|
|
69
|
+
id_site: string;
|
|
70
|
+
is_business: number;
|
|
71
|
+
is_personal: number;
|
|
72
|
+
name: string;
|
|
73
|
+
quickAnswer?: boolean;
|
|
74
|
+
request?: unknown;
|
|
75
|
+
site_organization?: OrganizationSite;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface SiteV1 extends SiteBase {
|
|
79
|
+
version: 1;
|
|
80
|
+
credentials: CredentialInput[];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface SiteV3 extends SiteBase {
|
|
84
|
+
version: 3;
|
|
85
|
+
input: CredentialInputGroup[];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface SiteV4 extends SiteBase {
|
|
89
|
+
version: 4;
|
|
90
|
+
input: V4CredentialInputGroup[];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export type Site = SiteV1 | SiteV3 | SiteV4;
|
|
94
|
+
|
|
95
|
+
/** Credential field (e.g. from getFields). */
|
|
96
|
+
export interface CredentialInput {
|
|
97
|
+
accept?: Array<{ extension: string; mime_type: string }>;
|
|
98
|
+
enabled_by?: string;
|
|
99
|
+
enables?: string[];
|
|
100
|
+
error_label?: string;
|
|
101
|
+
identifier?: boolean;
|
|
102
|
+
label?: string;
|
|
103
|
+
name: string;
|
|
104
|
+
options?: SelectOption[];
|
|
105
|
+
required: boolean;
|
|
106
|
+
token?: boolean;
|
|
107
|
+
translate_error_label?: string;
|
|
108
|
+
translate_label?: string;
|
|
109
|
+
type: string;
|
|
110
|
+
validation?: Validation;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface CredentialInputGroup {
|
|
114
|
+
fields: CredentialInput[];
|
|
115
|
+
label: string;
|
|
116
|
+
name: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface SelectOption {
|
|
120
|
+
label?: string;
|
|
121
|
+
value?: number | string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface Validation {
|
|
125
|
+
type?: string;
|
|
126
|
+
value?: unknown;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface V4CredentialInputGroup {
|
|
130
|
+
fields?: CredentialInput[];
|
|
131
|
+
label?: string;
|
|
132
|
+
name?: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Organization site returned by getOrganizationSites. */
|
|
136
|
+
export interface OrganizationSite {
|
|
137
|
+
avatar: string;
|
|
138
|
+
cover: string;
|
|
139
|
+
id_country: string;
|
|
140
|
+
id_site_organization: string;
|
|
141
|
+
id_site_organization_type: string;
|
|
142
|
+
name: string;
|
|
143
|
+
sites: Site[];
|
|
144
|
+
small_cover: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** Organization type returned by getOrganizationTypes. */
|
|
148
|
+
export interface OrganizationType {
|
|
149
|
+
id_site_organization_type: string;
|
|
150
|
+
label: string;
|
|
151
|
+
name: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** Socket message payload (e.g. from site.on('socket-message', (data) => ...)). For code 410, data is TwofaMessage. */
|
|
155
|
+
export interface SocketMessage {
|
|
156
|
+
address?: string;
|
|
157
|
+
code: number;
|
|
158
|
+
id_request?: string;
|
|
159
|
+
id_site?: string;
|
|
160
|
+
twofa?: TwofaCredentialInput[];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Site connection returned by siteConnection (SiteV1Service | SiteV3Service | SiteV4Service). */
|
|
164
|
+
export interface HeadlessSiteConnection {
|
|
165
|
+
readonly version: 1 | 3 | 4;
|
|
166
|
+
getFields(updateMode?: boolean): CredentialInput[];
|
|
167
|
+
getFields(index: number, updateMode?: boolean): CredentialInput[];
|
|
168
|
+
getOptions(): CredentialInputGroup[];
|
|
169
|
+
getBackUpFields(updateMode?: boolean): CredentialInput[];
|
|
170
|
+
readonly twofa: HeadlessTwofa | null;
|
|
171
|
+
on(event: string, callback: (...args: unknown[]) => void): void;
|
|
172
|
+
connect(data: Record<string, unknown>): Promise<unknown>;
|
|
173
|
+
connect(
|
|
174
|
+
index: number,
|
|
175
|
+
data: Record<string, unknown>,
|
|
176
|
+
isBackUp?: boolean,
|
|
177
|
+
): Promise<unknown>;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** Twofa message passed to headless.twofa (e.g. socket 410 data). */
|
|
181
|
+
export interface TwofaMessage {
|
|
182
|
+
address: string;
|
|
183
|
+
code: number;
|
|
184
|
+
id_request?: string;
|
|
185
|
+
id_site?: string;
|
|
186
|
+
twofa: TwofaCredentialInput[];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** Twofa credential field (from HeadlessTwofa.getFields). */
|
|
190
|
+
export interface TwofaCredentialInput {
|
|
191
|
+
disabled?: boolean;
|
|
192
|
+
imgBase64File?: string;
|
|
193
|
+
imgURL?: string;
|
|
194
|
+
label: string;
|
|
195
|
+
name: string;
|
|
196
|
+
options?: Array<{
|
|
197
|
+
imgBase64File?: string;
|
|
198
|
+
imgURL?: string;
|
|
199
|
+
label?: string;
|
|
200
|
+
value: number | string;
|
|
201
|
+
}>;
|
|
202
|
+
type: string;
|
|
203
|
+
validation?: Validation;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** Twofa instance returned by headless.twofa. */
|
|
207
|
+
export interface HeadlessTwofa {
|
|
208
|
+
getFields(): TwofaCredentialInput[];
|
|
209
|
+
displaySubmitButton: boolean;
|
|
210
|
+
data: Record<string, unknown>;
|
|
211
|
+
authenticate(data: Record<string, unknown>): void | Promise<unknown>;
|
|
212
|
+
on(event: string, callback: (...args: unknown[]) => void): void;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Credential instance returned by syncCredential and updateCredential. */
|
|
216
|
+
export interface HeadlessCredential {
|
|
217
|
+
on(event: string, callback: (...args: unknown[]) => void): void;
|
|
218
|
+
getCredentialData(): Record<string, unknown>;
|
|
219
|
+
readonly twofa: HeadlessTwofa | null;
|
|
220
|
+
status?: string;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** Headless API: static methods for use without mounting the widget UI. */
|
|
224
|
+
export interface SyncfyWidgetHeadless {
|
|
225
|
+
getAccounts(
|
|
226
|
+
auth: HeadlessAuth,
|
|
227
|
+
id_credential: string,
|
|
228
|
+
config?: { locale?: Locale },
|
|
229
|
+
): Promise<Account[]>;
|
|
230
|
+
getCountries(
|
|
231
|
+
auth: HeadlessAuth,
|
|
232
|
+
config?: { locale?: Locale },
|
|
233
|
+
): Promise<Country[]>;
|
|
234
|
+
getOrganizationSites(
|
|
235
|
+
auth: HeadlessAuth,
|
|
236
|
+
params?: { is_business?: number; is_personal?: number },
|
|
237
|
+
config?: { locale?: Locale },
|
|
238
|
+
): Promise<OrganizationSite[]>;
|
|
239
|
+
getOrganizationTypes(
|
|
240
|
+
auth: HeadlessAuth,
|
|
241
|
+
config?: { locale?: Locale },
|
|
242
|
+
): Promise<OrganizationType[]>;
|
|
243
|
+
getSite(
|
|
244
|
+
auth: HeadlessAuth,
|
|
245
|
+
id_site: string,
|
|
246
|
+
config?: { locale?: Locale },
|
|
247
|
+
): Promise<Site>;
|
|
248
|
+
siteConnection(
|
|
249
|
+
auth: HeadlessAuth,
|
|
250
|
+
site: Site,
|
|
251
|
+
config?: {
|
|
252
|
+
locale?: Locale;
|
|
253
|
+
quickAnswer?: boolean;
|
|
254
|
+
socketTimeout?: number | string;
|
|
255
|
+
},
|
|
256
|
+
): Promise<HeadlessSiteConnection>;
|
|
257
|
+
syncCredential(
|
|
258
|
+
auth: HeadlessAuth,
|
|
259
|
+
id_credential: string,
|
|
260
|
+
config?: {
|
|
261
|
+
locale?: Locale;
|
|
262
|
+
quickAnswer?: boolean;
|
|
263
|
+
socketTimeout?: number | string;
|
|
264
|
+
},
|
|
265
|
+
): Promise<HeadlessCredential>;
|
|
266
|
+
twofa(
|
|
267
|
+
auth: HeadlessAuth,
|
|
268
|
+
twofaMessage: TwofaMessage,
|
|
269
|
+
id_site: string,
|
|
270
|
+
config?: { locale?: Locale },
|
|
271
|
+
): Promise<HeadlessTwofa>;
|
|
272
|
+
updateCredential(
|
|
273
|
+
auth: HeadlessAuth,
|
|
274
|
+
id_credential: string,
|
|
275
|
+
config?: {
|
|
276
|
+
locale?: Locale;
|
|
277
|
+
quickAnswer?: boolean;
|
|
278
|
+
socketTimeout?: number | string;
|
|
279
|
+
},
|
|
280
|
+
): Promise<HeadlessCredential>;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export interface SyncfyWidgetInstance {
|
|
284
|
+
on(event: string, callback: (...args: unknown[]) => void): void;
|
|
285
|
+
close: () => void;
|
|
286
|
+
getLastRid: () => string | undefined;
|
|
287
|
+
open: () => void;
|
|
288
|
+
setConfig: (config: unknown) => void;
|
|
289
|
+
setEntrypointCredential: (entrypoint: string) => void;
|
|
290
|
+
setEntrypointSite: (entrypoint: string) => void;
|
|
291
|
+
setEntrypointUpdateCredential: (entrypoint: string) => void;
|
|
292
|
+
setToken: (token: string) => void;
|
|
293
|
+
upsertConfig: (config: unknown) => void;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/** SyncfyWidget is a constructor; `new SyncfyWidget(params)` returns an instance with open(), close(), on(), etc. */
|
|
297
|
+
export interface SyncfyWidgetConstructor {
|
|
298
|
+
new (params: Params | string): SyncfyWidgetInstance;
|
|
299
|
+
getVersion(): string;
|
|
300
|
+
headless: SyncfyWidgetHeadless;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
declare const SyncfyWidget: SyncfyWidgetConstructor;
|
|
304
|
+
|
|
305
|
+
export { SyncfyWidget };
|
|
306
|
+
export default SyncfyWidget;
|