@corbado/observe 0.0.0-next.local.1772615508
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/dist/cdn/script.global.js +1 -0
- package/dist/index.d.mts +1068 -0
- package/dist/index.d.ts +1068 -0
- package/dist/index.global.js +36 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +36 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1068 @@
|
|
|
1
|
+
interface User {
|
|
2
|
+
id?: string;
|
|
3
|
+
email?: string;
|
|
4
|
+
username?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
interface SdkInfo {
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
}
|
|
12
|
+
type EventType = "predefined" | "custom" | "error" | "identify";
|
|
13
|
+
type LoginMethodType = "identifier-email" | "passkey" | "passkey-conditional-ui" | "password" | "email-otp" | "email-link" | "phone-otp" | "switch-method" | "reset-flow" | "social-google" | "social-apple" | "social-facebook" | "social-other";
|
|
14
|
+
type SocialLoginProviderType = "google" | "apple" | "facebook" | "github" | "microsoft" | "other";
|
|
15
|
+
declare enum AuthEventName {
|
|
16
|
+
LoginVisible = "login_visible",
|
|
17
|
+
LoginReset = "login_reset",
|
|
18
|
+
LoginMethodsDecision = "login_method_decision_offered",
|
|
19
|
+
AuthDecisionVisible = "auth_decision_visible",
|
|
20
|
+
AuthDecisionFinished = "auth_decision_finished",
|
|
21
|
+
ProvideIdentifierStarted = "provide_identifier_started",
|
|
22
|
+
ProvideIdentifierSubmitted = "provide_identifier_submitted",
|
|
23
|
+
ProvideIdentifierFinished = "provide_identifier_finished",
|
|
24
|
+
ProvideIdentifierError = "provide_identifier_error",
|
|
25
|
+
PasswordLoginStartable = "password_login_startable",
|
|
26
|
+
PasswordLoginStarted = "password_login_started",
|
|
27
|
+
PasswordLoginSubmitted = "password_login_submitted",
|
|
28
|
+
PasswordLoginFinished = "password_login_finished",
|
|
29
|
+
PasswordLoginError = "password_login_error",
|
|
30
|
+
PasswordLoginForgotPasswordClicked = "password_login_forgot_password_clicked",
|
|
31
|
+
PasskeyLoginStartable = "passkey_login_startable",
|
|
32
|
+
PasskeyLoginStarted = "passkey_login_started",
|
|
33
|
+
PasskeyLoginSubmitted = "passkey_login_submitted",
|
|
34
|
+
PasskeyLoginFinished = "passkey_login_finished",
|
|
35
|
+
PasskeyLoginError = "passkey_login_error",
|
|
36
|
+
CUILoginStartable = "cui_login_startable",
|
|
37
|
+
CUILoginStarted = "cui_login_started",
|
|
38
|
+
CUILoginSubmitted = "cui_login_submitted",
|
|
39
|
+
CUILoginFinished = "cui_login_finished",
|
|
40
|
+
CUILoginError = "cui_login_error",
|
|
41
|
+
SocialLoginStarted = "social_login_started",
|
|
42
|
+
SocialLoginFinished = "social_login_finished",
|
|
43
|
+
SocialLoginError = "social_login_error",
|
|
44
|
+
LoginFinish = "login_finish",
|
|
45
|
+
SignupVisible = "signup_visible",
|
|
46
|
+
SignupFinish = "signup_finish",
|
|
47
|
+
SecurityEnrollmentStarted = "security_enrollment_started",
|
|
48
|
+
SecurityEnrollmentFinished = "security_enrollment_finished",
|
|
49
|
+
PasskeyEnrollmentStartable = "passkey_enrollment_startable",
|
|
50
|
+
PasskeyEnrollmentStarted = "passkey_enrollment_started",
|
|
51
|
+
PasskeyEnrollmentSubmitted = "passkey_enrollment_submitted",
|
|
52
|
+
PasskeyEnrollmentFinished = "passkey_enrollment_finished",
|
|
53
|
+
PasskeyEnrollmentSkipped = "passkey_enrollment_skipped",
|
|
54
|
+
PasskeyEnrollmentError = "passkey_enrollment_error",
|
|
55
|
+
AccountRecoveryStarted = "account_recovery_started",
|
|
56
|
+
AccountRecoveryFinished = "account_recovery_finished",
|
|
57
|
+
EmailLinkStartable = "email_link_startable",
|
|
58
|
+
EmailLinkSubmitted = "email_link_submitted",
|
|
59
|
+
EmailLinkFinished = "email_link_finished",
|
|
60
|
+
EmailLinkError = "email_link_error",
|
|
61
|
+
EmailOTPStartable = "email_otp_startable",
|
|
62
|
+
EmailOTPStarted = "email_otp_started",
|
|
63
|
+
EmailOTPSubmitted = "email_otp_submitted",
|
|
64
|
+
EmailOTPFinished = "email_otp_finished",
|
|
65
|
+
EmailOTPError = "email_otp_error",
|
|
66
|
+
EmailOTPResent = "email_otp_resent",
|
|
67
|
+
SetPasswordStartable = "set_password_startable",
|
|
68
|
+
SetPasswordStarted = "set_password_started",
|
|
69
|
+
SetPasswordSubmitted = "set_password_submitted",
|
|
70
|
+
SetPasswordFinished = "set_password_finished",
|
|
71
|
+
SetPasswordError = "set_password_error"
|
|
72
|
+
}
|
|
73
|
+
interface BaseEvent {
|
|
74
|
+
timestamp: number;
|
|
75
|
+
seq: number;
|
|
76
|
+
type: EventType;
|
|
77
|
+
user?: UserReference;
|
|
78
|
+
contexts?: Record<string, unknown>;
|
|
79
|
+
tags?: Record<string, string>;
|
|
80
|
+
deviceInfo?: DeviceInfo;
|
|
81
|
+
}
|
|
82
|
+
type WithSubFlowId<T> = T & {
|
|
83
|
+
subFlowId?: string;
|
|
84
|
+
};
|
|
85
|
+
type UserReference = {
|
|
86
|
+
userId?: string;
|
|
87
|
+
identifier?: string;
|
|
88
|
+
crossEnvironmentTransactionID?: string;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Serializable error shape produced by {@link normalizeError}.
|
|
92
|
+
* All error event payloads use this instead of raw Error objects.
|
|
93
|
+
*/
|
|
94
|
+
type NormalizedError = {
|
|
95
|
+
name?: string;
|
|
96
|
+
message: string;
|
|
97
|
+
};
|
|
98
|
+
interface LoginVisible {
|
|
99
|
+
/**
|
|
100
|
+
* Where the login form is shown (e.g. `"account"`, `"checkout"`).
|
|
101
|
+
*/
|
|
102
|
+
touchpoint?: string;
|
|
103
|
+
identifierPrefillingExisted?: boolean;
|
|
104
|
+
}
|
|
105
|
+
type IdentifierProvided = UserReference & {
|
|
106
|
+
availableMethods?: string[];
|
|
107
|
+
preferredMethod?: string | null;
|
|
108
|
+
};
|
|
109
|
+
type ProvideIdentifierStart = {};
|
|
110
|
+
type ProvideIdentifierError = UserReference & {
|
|
111
|
+
errorCode?: string;
|
|
112
|
+
error?: any;
|
|
113
|
+
};
|
|
114
|
+
type ProvideIdentifierFinish = UserReference & {
|
|
115
|
+
identifierPrefillingCreated?: boolean;
|
|
116
|
+
};
|
|
117
|
+
interface PasswordLoginStartable {
|
|
118
|
+
explicitSpecType?: "pre-identifier" | "post-identifier";
|
|
119
|
+
}
|
|
120
|
+
interface PasswordLoginStarted {
|
|
121
|
+
explicitSpecType?: "pre-identifier" | "post-identifier";
|
|
122
|
+
}
|
|
123
|
+
type PasswordLoginFinish = {};
|
|
124
|
+
type LoginStepPasswordErrorCode = 'invalid_password' | 'unknown';
|
|
125
|
+
type PasswordLoginError = {
|
|
126
|
+
errorCode?: LoginStepPasswordErrorCode;
|
|
127
|
+
error?: any;
|
|
128
|
+
};
|
|
129
|
+
type PasskeyLoginClientError = {
|
|
130
|
+
error: any;
|
|
131
|
+
};
|
|
132
|
+
type PasskeyLoginStart = {
|
|
133
|
+
explicitSpecType: "passkey-cui" | "passkey-identifier" | "passkey-button";
|
|
134
|
+
conditional: boolean;
|
|
135
|
+
} & PasskeyLoginStartable;
|
|
136
|
+
type PasskeyLoginStartable = {
|
|
137
|
+
assertionOptions: string;
|
|
138
|
+
};
|
|
139
|
+
type PasskeyLoginSubmitted = {
|
|
140
|
+
assertionResponse: string;
|
|
141
|
+
};
|
|
142
|
+
type PasskeyLoginFinish = UserReference & {};
|
|
143
|
+
type SocialLoginStart = {
|
|
144
|
+
explicitSpecType: "pre-identifier" | "post-identifier";
|
|
145
|
+
provider: SocialLoginProviderType;
|
|
146
|
+
};
|
|
147
|
+
type SocialLoginFinish = UserReference & {
|
|
148
|
+
provider: SocialLoginProviderType;
|
|
149
|
+
};
|
|
150
|
+
type SocialLoginError = UserReference & {
|
|
151
|
+
errorCode: string;
|
|
152
|
+
};
|
|
153
|
+
type LoginReset = {};
|
|
154
|
+
type LoginFinish = UserReference & {};
|
|
155
|
+
type LoginMethodDecision = {
|
|
156
|
+
decisionName: string;
|
|
157
|
+
availableMethods: LoginMethodType[];
|
|
158
|
+
explicitDecisionValue?: string;
|
|
159
|
+
};
|
|
160
|
+
type AuthDecisionVisible = {
|
|
161
|
+
decisionName: string;
|
|
162
|
+
options: string[];
|
|
163
|
+
};
|
|
164
|
+
type AuthDecisionFinished = {
|
|
165
|
+
decisionName: string;
|
|
166
|
+
options: string[];
|
|
167
|
+
explicitDecisionValue?: string;
|
|
168
|
+
};
|
|
169
|
+
type SignupVisible = {
|
|
170
|
+
touchpoint?: string;
|
|
171
|
+
};
|
|
172
|
+
type SignupFinish = UserReference & {};
|
|
173
|
+
type PasskeyEnrollmentStartable = {};
|
|
174
|
+
type PasskeyEnrollmentStarted = {
|
|
175
|
+
conditional: boolean;
|
|
176
|
+
auto: boolean;
|
|
177
|
+
attestationOptions: string;
|
|
178
|
+
};
|
|
179
|
+
type PasskeyEnrollmentSubmitted = {
|
|
180
|
+
conditional: boolean;
|
|
181
|
+
auto: boolean;
|
|
182
|
+
attestationResponse: string;
|
|
183
|
+
};
|
|
184
|
+
type PasskeyEnrollmentFinished = {};
|
|
185
|
+
type PasskeyEnrollmentError = {
|
|
186
|
+
errorCode?: string;
|
|
187
|
+
error?: unknown;
|
|
188
|
+
};
|
|
189
|
+
interface PredefinedEvent extends BaseEvent {
|
|
190
|
+
type: "predefined";
|
|
191
|
+
name: string;
|
|
192
|
+
data: Record<string, unknown>;
|
|
193
|
+
}
|
|
194
|
+
interface CustomEvent extends BaseEvent {
|
|
195
|
+
type: "custom";
|
|
196
|
+
name: string;
|
|
197
|
+
data?: Record<string, unknown>;
|
|
198
|
+
}
|
|
199
|
+
type Event = PredefinedEvent | CustomEvent;
|
|
200
|
+
interface EventBatch {
|
|
201
|
+
sessionId: string;
|
|
202
|
+
events: Event[];
|
|
203
|
+
sdk: SdkInfo;
|
|
204
|
+
}
|
|
205
|
+
type DeviceType = "web" | "app" | "other";
|
|
206
|
+
interface DeviceInfo {
|
|
207
|
+
type: DeviceType;
|
|
208
|
+
clientEnvHandle: string;
|
|
209
|
+
clientEnvHandleMeta: ClientEnvHandleMeta;
|
|
210
|
+
data: DeviceInfoDataWeb;
|
|
211
|
+
}
|
|
212
|
+
interface DeviceInfoDataWeb {
|
|
213
|
+
bluetoothAvailable?: boolean;
|
|
214
|
+
conditionalMediationAvailable?: boolean;
|
|
215
|
+
userVerifyingPlatformAuthenticatorAvailable?: boolean;
|
|
216
|
+
clientCapabilities?: ClientCapabilities;
|
|
217
|
+
javaScriptHighEntropy?: JavaScriptHighEntropy;
|
|
218
|
+
privateMode?: boolean;
|
|
219
|
+
webdriver?: boolean;
|
|
220
|
+
}
|
|
221
|
+
type ClientCapabilities = Record<string, string>;
|
|
222
|
+
type JavaScriptHighEntropy = {
|
|
223
|
+
platform?: string;
|
|
224
|
+
mobile?: boolean;
|
|
225
|
+
platformVersion?: string;
|
|
226
|
+
};
|
|
227
|
+
type ClientEnvHandleMeta = {
|
|
228
|
+
timestamp: number;
|
|
229
|
+
source: ClientEnvHandleMetaSource;
|
|
230
|
+
};
|
|
231
|
+
type ClientEnvHandleMetaSource = "localstorage" | "cookie" | "native";
|
|
232
|
+
type SecurityEnrollmentStarted = {
|
|
233
|
+
touchpoint: string;
|
|
234
|
+
} & UserReference;
|
|
235
|
+
type AccountRecoveryStarted = {
|
|
236
|
+
touchpoint: string;
|
|
237
|
+
};
|
|
238
|
+
type EmailOTPStartable = {};
|
|
239
|
+
type EmailOTPStarted = {};
|
|
240
|
+
type EmailOTPSubmitted = {};
|
|
241
|
+
type EmailOTPFinished = {};
|
|
242
|
+
type EmailOTPError = {
|
|
243
|
+
errorCode: string;
|
|
244
|
+
};
|
|
245
|
+
type EmailOTPResent = {};
|
|
246
|
+
type EmailLinkStartable = {
|
|
247
|
+
crossEnvironmentTransactionID?: string;
|
|
248
|
+
} & UserReference;
|
|
249
|
+
type EmailLinkSubmitted = {
|
|
250
|
+
crossEnvironmentTransactionID?: string;
|
|
251
|
+
};
|
|
252
|
+
type EmailLinkFinished = {} & UserReference;
|
|
253
|
+
type EmailLinkError = {
|
|
254
|
+
errorCode: string;
|
|
255
|
+
};
|
|
256
|
+
type SetPasswordStartable = {};
|
|
257
|
+
type SetPasswordStarted = {};
|
|
258
|
+
type SetPasswordSubmitted = {};
|
|
259
|
+
type SetPasswordFinished = {};
|
|
260
|
+
type SetPasswordError = {
|
|
261
|
+
errorCode: string;
|
|
262
|
+
origin: "client" | "server";
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
declare class PasskeyOperationLogin {
|
|
266
|
+
private tracker;
|
|
267
|
+
constructor(tracker: CorbadoTracker, data: PasskeyLoginStart, tags?: Record<string, string>, contexts?: Record<string, any>);
|
|
268
|
+
started(data: PasskeyLoginStart, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
269
|
+
submitted(data: PasskeyLoginSubmitted, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
270
|
+
finished(data: PasskeyLoginFinish, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
271
|
+
clientError(data: PasskeyLoginClientError, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
272
|
+
serverErrorUnknown(error?: any, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
declare class PasskeyOperationEnrollment {
|
|
276
|
+
private tracker;
|
|
277
|
+
constructor(tracker: CorbadoTracker, data: PasskeyEnrollmentStartable, tags?: Record<string, string>, contexts?: Record<string, any>);
|
|
278
|
+
startable(data: PasskeyEnrollmentStartable, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
279
|
+
started(data: PasskeyEnrollmentStarted, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
280
|
+
submitted(data: PasskeyEnrollmentSubmitted, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
281
|
+
finished(data: PasskeyEnrollmentFinished, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
282
|
+
skipped(data: {}, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
283
|
+
clientError(data: PasskeyEnrollmentError, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
284
|
+
serverErrorUnknown(error?: any, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
declare class ProvideIdentifierOperation {
|
|
288
|
+
private tracker;
|
|
289
|
+
private patternDetector?;
|
|
290
|
+
constructor(tracker: CorbadoTracker, inputHtmlField?: HTMLInputElement);
|
|
291
|
+
destroy(): void;
|
|
292
|
+
identifierStarted(data: ProvideIdentifierStart, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
293
|
+
identifierSubmitted(data: {}, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
294
|
+
identifierFinished(data: ProvideIdentifierFinish, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
295
|
+
identifierError(data: ProvideIdentifierError, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
296
|
+
conditionalUIStartable(data: PasskeyLoginStartable, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
297
|
+
conditionalUISubmitted(data: PasskeyLoginSubmitted, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
298
|
+
conditionalUIFinished(data: PasskeyLoginFinish, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
299
|
+
conditionalUIClientError(data: PasskeyLoginClientError, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
300
|
+
conditionalUIServerErrorConditionalUICredentialDeleted(tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
301
|
+
conditionalUIServerErrorUnknown(error?: any, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
declare class PasswordOperationLogin {
|
|
305
|
+
private tracker;
|
|
306
|
+
private patternDetector?;
|
|
307
|
+
constructor(tracker: CorbadoTracker, inputHtmlField?: HTMLInputElement);
|
|
308
|
+
startable(data: PasswordLoginStartable, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
309
|
+
started(data: PasswordLoginStarted, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
310
|
+
submitted(data: {}, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
311
|
+
finished(data: PasswordLoginFinish, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
312
|
+
error(data: PasswordLoginError, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
313
|
+
/**
|
|
314
|
+
* Fire when the user clicks on the "Forgot password" link during the password login flow.
|
|
315
|
+
*/
|
|
316
|
+
forgotPasswordClicked(data: {}, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
317
|
+
destroy(): void;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
declare class SocialOperationLogin {
|
|
321
|
+
private tracker;
|
|
322
|
+
constructor(tracker: CorbadoTracker);
|
|
323
|
+
started(data: SocialLoginStart, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
324
|
+
finished(data: SocialLoginFinish, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
325
|
+
error(data: SocialLoginError, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
declare class EmailOTPOperation {
|
|
329
|
+
private tracker;
|
|
330
|
+
constructor(tracker: CorbadoTracker);
|
|
331
|
+
startable(data?: EmailOTPStartable, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
332
|
+
started(data?: EmailOTPStarted, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
333
|
+
submitted(data?: EmailOTPSubmitted, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
334
|
+
finished(data?: EmailOTPFinished, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
335
|
+
error(data: EmailOTPError, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
336
|
+
resent(data?: EmailOTPResent, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
declare class EmailLinkOperation {
|
|
340
|
+
private tracker;
|
|
341
|
+
constructor(tracker: CorbadoTracker);
|
|
342
|
+
/**
|
|
343
|
+
* Fire when the email containing the link has been sent to the user.
|
|
344
|
+
*/
|
|
345
|
+
startable(data?: EmailLinkStartable, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
346
|
+
/**
|
|
347
|
+
* Fire when the link has been opened and right before the verification process starts.
|
|
348
|
+
*/
|
|
349
|
+
submitted(data?: EmailLinkSubmitted, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
350
|
+
/**
|
|
351
|
+
* Fire when the verification process has been completed successfully.
|
|
352
|
+
*/
|
|
353
|
+
finished(data?: EmailLinkFinished, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
354
|
+
/**
|
|
355
|
+
* Fire when an error occurs during the verification process.
|
|
356
|
+
*/
|
|
357
|
+
error(data: EmailLinkError, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
declare class SetPasswordOperation {
|
|
361
|
+
private tracker;
|
|
362
|
+
private patternDetector?;
|
|
363
|
+
constructor(tracker: CorbadoTracker, inputHtmlField?: HTMLInputElement);
|
|
364
|
+
startable(data?: SetPasswordStartable, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
365
|
+
started(data?: SetPasswordStarted, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
366
|
+
submitted(data?: SetPasswordSubmitted, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
367
|
+
finished(data?: SetPasswordFinished, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
368
|
+
error(data: SetPasswordError, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
369
|
+
destroy(): void;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
interface TrackerOptions {
|
|
373
|
+
projectId: string;
|
|
374
|
+
apiBaseUrl: string;
|
|
375
|
+
apiEventPath?: string;
|
|
376
|
+
storage?: "cookie" | "local";
|
|
377
|
+
debug?: boolean;
|
|
378
|
+
deviceInfoDebounceTime?: number;
|
|
379
|
+
defaultTags?: Record<string, string>;
|
|
380
|
+
applicationId?: string;
|
|
381
|
+
}
|
|
382
|
+
declare class CorbadoTracker {
|
|
383
|
+
private options;
|
|
384
|
+
private queue;
|
|
385
|
+
private sessionId;
|
|
386
|
+
private storage;
|
|
387
|
+
private sessionStorage;
|
|
388
|
+
private deviceInfoCollector;
|
|
389
|
+
private deviceInfoDebounceTime;
|
|
390
|
+
private deviceInfoTransmittedLastTime;
|
|
391
|
+
private seq;
|
|
392
|
+
constructor(options: TrackerOptions);
|
|
393
|
+
private applicationTag;
|
|
394
|
+
private debugMessage;
|
|
395
|
+
private isTrackingBlocked;
|
|
396
|
+
private getSessionId;
|
|
397
|
+
private updateDeviceDebounced;
|
|
398
|
+
/** @internal */
|
|
399
|
+
track(name: AuthEventName, data: Record<string, any>, userReference?: UserReference, tags?: Record<string, string>, contexts?: Record<string, any>, explicitTimestamp?: number): Promise<void>;
|
|
400
|
+
/**
|
|
401
|
+
* Track when the login UI becomes visible to the user.
|
|
402
|
+
*
|
|
403
|
+
* @remarks
|
|
404
|
+
* Trigger this event when your login form or login page is rendered and visible.
|
|
405
|
+
* Use the `touchpoint` field to distinguish where the login appears
|
|
406
|
+
* (e.g. a dedicated login page vs. an inline checkout login).
|
|
407
|
+
*
|
|
408
|
+
* @param data - Event payload.
|
|
409
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
410
|
+
*
|
|
411
|
+
* @example
|
|
412
|
+
* ```typescript
|
|
413
|
+
* tracker.loginVisible({ touchpoint: "account" });
|
|
414
|
+
* ```
|
|
415
|
+
*/
|
|
416
|
+
loginVisible(data: LoginVisible, tags?: Record<string, string>): void;
|
|
417
|
+
/**
|
|
418
|
+
* Create a trackable identifier-provision operation without immediately firing an event.
|
|
419
|
+
*
|
|
420
|
+
* @remarks
|
|
421
|
+
* Returns a {@link ProvideIdentifierOperation} that you can drive through
|
|
422
|
+
* `identifierStarted` → `identifierSubmitted` → `identifierFinished` / `identifierError`.
|
|
423
|
+
* Pass an `inputHtmlField` to auto-instrument keystroke and paste detection on the identifier input.
|
|
424
|
+
*
|
|
425
|
+
* @param inputHtmlField - Optional HTML input element to instrument for interaction detection.
|
|
426
|
+
* @returns A {@link ProvideIdentifierOperation} instance.
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* ```typescript
|
|
430
|
+
* const op = tracker.provideIdentifierStartable(document.getElementById("email") as HTMLInputElement);
|
|
431
|
+
* op.identifierStarted();
|
|
432
|
+
* ```
|
|
433
|
+
*/
|
|
434
|
+
provideIdentifierStartable(inputHtmlField?: HTMLInputElement): ProvideIdentifierOperation;
|
|
435
|
+
/**
|
|
436
|
+
* Track the start of the identifier-provision step and return the operation handle.
|
|
437
|
+
*
|
|
438
|
+
* @remarks
|
|
439
|
+
* Call this when the user begins entering their identifier (email, phone, username).
|
|
440
|
+
* The returned {@link ProvideIdentifierOperation} lets you continue tracking through
|
|
441
|
+
* submission, completion, or error.
|
|
442
|
+
*
|
|
443
|
+
* @param data - Event payload (currently empty, reserved for future fields).
|
|
444
|
+
* @param inputHtmlField - Optional HTML input element to instrument for interaction detection.
|
|
445
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
446
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
447
|
+
* @returns A {@link ProvideIdentifierOperation} instance.
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* ```typescript
|
|
451
|
+
* const op = tracker.provideIdentifierStarted({}, emailInput);
|
|
452
|
+
* ```
|
|
453
|
+
*/
|
|
454
|
+
provideIdentifierStarted(data?: ProvideIdentifierStart, inputHtmlField?: HTMLInputElement, tags?: Record<string, string>, contexts?: Record<string, any>): ProvideIdentifierOperation;
|
|
455
|
+
/**
|
|
456
|
+
* Track when the user submits their identifier.
|
|
457
|
+
*
|
|
458
|
+
* @remarks
|
|
459
|
+
* Fire this event after the user confirms their identifier (e.g. clicks "Continue"
|
|
460
|
+
* or presses Enter). This sits between the started and finished/error events.
|
|
461
|
+
*
|
|
462
|
+
* @param data - Event payload (currently empty, reserved for future fields).
|
|
463
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
464
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
465
|
+
*
|
|
466
|
+
* @example
|
|
467
|
+
* ```typescript
|
|
468
|
+
* tracker.provideIdentifierSubmitted({});
|
|
469
|
+
* ```
|
|
470
|
+
*/
|
|
471
|
+
provideIdentifierSubmitted(data: {}, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
472
|
+
/**
|
|
473
|
+
* Track when identifier provision completes successfully.
|
|
474
|
+
*
|
|
475
|
+
* @remarks
|
|
476
|
+
* Fire this after the backend has validated the identifier and returned
|
|
477
|
+
* the available authentication methods. Include `availableMethods` and
|
|
478
|
+
* `preferredMethod` so downstream analytics can evaluate method selection.
|
|
479
|
+
*
|
|
480
|
+
* @param data - Event payload containing the user reference and available methods.
|
|
481
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
482
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* ```typescript
|
|
486
|
+
* tracker.provideIdentifierFinished({
|
|
487
|
+
* identifier: "user@example.com",
|
|
488
|
+
* availableMethods: ["passkey", "password"],
|
|
489
|
+
* preferredMethod: "passkey",
|
|
490
|
+
* });
|
|
491
|
+
* ```
|
|
492
|
+
*/
|
|
493
|
+
provideIdentifierFinished(data: ProvideIdentifierFinish, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
494
|
+
/**
|
|
495
|
+
* Track when identifier provision fails.
|
|
496
|
+
*
|
|
497
|
+
* @remarks
|
|
498
|
+
* Fire this when the identifier lookup or validation returns an error
|
|
499
|
+
* (e.g. unknown user, rate limit, network failure).
|
|
500
|
+
*
|
|
501
|
+
* @param data - Event payload containing the user reference and error details.
|
|
502
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
503
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
504
|
+
*
|
|
505
|
+
* @example
|
|
506
|
+
* ```typescript
|
|
507
|
+
* tracker.provideIdentifierError({
|
|
508
|
+
* identifier: "user@example.com",
|
|
509
|
+
* error: "user_not_found",
|
|
510
|
+
* });
|
|
511
|
+
* ```
|
|
512
|
+
*/
|
|
513
|
+
provideIdentifierError(data: ProvideIdentifierError, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
514
|
+
/**
|
|
515
|
+
* Track when the login flow is reset.
|
|
516
|
+
*
|
|
517
|
+
* @remarks
|
|
518
|
+
* Fire this event when the user navigates back to the beginning of the login flow,
|
|
519
|
+
* for example by clicking a "Back" button or choosing "Try another method".
|
|
520
|
+
* This signals that the current authentication attempt was abandoned.
|
|
521
|
+
*
|
|
522
|
+
* @param data - Event payload (currently empty, reserved for future fields).
|
|
523
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
524
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
525
|
+
*
|
|
526
|
+
* @example
|
|
527
|
+
* ```typescript
|
|
528
|
+
* tracker.loginReset();
|
|
529
|
+
* ```
|
|
530
|
+
*/
|
|
531
|
+
loginReset(data?: LoginReset, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
532
|
+
/**
|
|
533
|
+
* Create a trackable password-login operation and mark it as startable.
|
|
534
|
+
*
|
|
535
|
+
* @remarks
|
|
536
|
+
* Returns a {@link PasswordOperationLogin} that you can drive through the
|
|
537
|
+
* `started` → `submitted` → `finished` / `error` lifecycle.
|
|
538
|
+
* Pass an `inputHtmlField` to auto-instrument the password input for
|
|
539
|
+
* interaction detection (e.g. paste, password-manager usage).
|
|
540
|
+
*
|
|
541
|
+
* @param inputHtmlField - Optional HTML input element to instrument.
|
|
542
|
+
* @param data
|
|
543
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
544
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
545
|
+
* @returns A {@link PasswordOperationLogin} instance.
|
|
546
|
+
*
|
|
547
|
+
* @example
|
|
548
|
+
* ```typescript
|
|
549
|
+
* const op = tracker.passwordLoginStartable(document.getElementById("password") as HTMLInputElement);
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
passwordLoginStartable(inputHtmlField?: HTMLInputElement, data?: PasswordLoginStartable, tags?: Record<string, string>, contexts?: Record<string, any>): PasswordOperationLogin;
|
|
553
|
+
/**
|
|
554
|
+
* Track the start of a password login attempt.
|
|
555
|
+
*
|
|
556
|
+
* @remarks
|
|
557
|
+
* Fire this when the user begins entering their password.
|
|
558
|
+
* Use the payload fields to record whether a password manager
|
|
559
|
+
* was detected or the keyboard was used for input.
|
|
560
|
+
*
|
|
561
|
+
* @param data - Event payload with optional interaction metadata.
|
|
562
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
563
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
564
|
+
* @returns A {@link PasswordOperationLogin} instance.
|
|
565
|
+
*
|
|
566
|
+
* @example
|
|
567
|
+
* ```typescript
|
|
568
|
+
* const op = tracker.passwordLoginStarted({ passwordManagerUsed: true });
|
|
569
|
+
* ```
|
|
570
|
+
*/
|
|
571
|
+
passwordLoginStarted(data?: PasswordLoginStarted, tags?: Record<string, string>, contexts?: Record<string, any>): PasswordOperationLogin;
|
|
572
|
+
/**
|
|
573
|
+
* Track when the user submits their password.
|
|
574
|
+
*
|
|
575
|
+
* @remarks
|
|
576
|
+
* Fire this after the user confirms their password entry (e.g. clicks
|
|
577
|
+
* "Sign in" or presses Enter). This sits between the started and
|
|
578
|
+
* finished/error events.
|
|
579
|
+
*
|
|
580
|
+
* @param data - Event payload (currently empty, reserved for future fields).
|
|
581
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
582
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
583
|
+
*
|
|
584
|
+
* @example
|
|
585
|
+
* ```typescript
|
|
586
|
+
* tracker.passwordLoginSubmitted({});
|
|
587
|
+
* ```
|
|
588
|
+
*/
|
|
589
|
+
passwordLoginSubmitted(data: {}, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
590
|
+
/**
|
|
591
|
+
* Track when a password login completes successfully.
|
|
592
|
+
*
|
|
593
|
+
* @remarks
|
|
594
|
+
* Fire this after the backend has verified the password and the user
|
|
595
|
+
* is authenticated.
|
|
596
|
+
*
|
|
597
|
+
* @param data - Event payload (currently empty, reserved for future fields).
|
|
598
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
599
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
600
|
+
*
|
|
601
|
+
* @example
|
|
602
|
+
* ```typescript
|
|
603
|
+
* tracker.passwordLoginFinished({});
|
|
604
|
+
* ```
|
|
605
|
+
*/
|
|
606
|
+
passwordLoginFinished(data: PasswordLoginFinish, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
607
|
+
/**
|
|
608
|
+
* Track when a password login attempt fails.
|
|
609
|
+
*
|
|
610
|
+
* @remarks
|
|
611
|
+
* Fire this when password verification fails (e.g. invalid password,
|
|
612
|
+
* account locked, server error).
|
|
613
|
+
*
|
|
614
|
+
* @param data - Event payload (currently empty, reserved for future fields).
|
|
615
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
616
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
617
|
+
*
|
|
618
|
+
* @example
|
|
619
|
+
* ```typescript
|
|
620
|
+
* tracker.passwordLoginError({});
|
|
621
|
+
* ```
|
|
622
|
+
*/
|
|
623
|
+
passwordLoginError(data: PasswordLoginError, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
624
|
+
/**
|
|
625
|
+
* Track the start of a passkey (WebAuthn) login and return the operation handle.
|
|
626
|
+
*
|
|
627
|
+
* @remarks
|
|
628
|
+
* Fire this when a passkey authentication ceremony begins.
|
|
629
|
+
* Set `conditional` to `true` for Conditional UI (autofill) flows, or `false`
|
|
630
|
+
* for an explicit "Sign in with passkey" button click.
|
|
631
|
+
* The returned {@link PasskeyOperationLogin} manages the remaining lifecycle events
|
|
632
|
+
* (submitted, finished, error) automatically.
|
|
633
|
+
*
|
|
634
|
+
* @param data - Event payload including the `conditional` flag.
|
|
635
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
636
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
637
|
+
* @returns A {@link PasskeyOperationLogin} instance.
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
* ```typescript
|
|
641
|
+
* const op = tracker.passkeyLoginStart({ conditional: false });
|
|
642
|
+
* ```
|
|
643
|
+
*/
|
|
644
|
+
passkeyLoginStart(data: PasskeyLoginStart, tags?: Record<string, string>, contexts?: Record<string, any>): PasskeyOperationLogin;
|
|
645
|
+
/**
|
|
646
|
+
* Track the start of a social login (OAuth / OpenID Connect) flow.
|
|
647
|
+
*
|
|
648
|
+
* @remarks
|
|
649
|
+
* Fire this when the user initiates a social login (e.g. clicks "Sign in with Google").
|
|
650
|
+
* Specify the `provider` (e.g. `"google"`, `"apple"`) so analytics can break down
|
|
651
|
+
* conversion by provider.
|
|
652
|
+
*
|
|
653
|
+
* @param data - Event payload containing the social `provider` name.
|
|
654
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
655
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
656
|
+
* @returns A {@link SocialOperationLogin} instance.
|
|
657
|
+
*
|
|
658
|
+
* @example
|
|
659
|
+
* ```typescript
|
|
660
|
+
* const op = tracker.socialLoginStart({ provider: "google" });
|
|
661
|
+
* ```
|
|
662
|
+
*/
|
|
663
|
+
socialLoginStart(data: SocialLoginStart, tags?: Record<string, string>, contexts?: Record<string, any>): SocialOperationLogin;
|
|
664
|
+
/**
|
|
665
|
+
* Track when a social login attempt fails.
|
|
666
|
+
*
|
|
667
|
+
* @remarks
|
|
668
|
+
* Fire this when the OAuth callback returns an error or when token
|
|
669
|
+
* exchange with the social provider fails.
|
|
670
|
+
*
|
|
671
|
+
* @param data - Event payload containing the user reference and `errorCode`.
|
|
672
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
673
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
674
|
+
*
|
|
675
|
+
* @example
|
|
676
|
+
* ```typescript
|
|
677
|
+
* tracker.socialLoginError({ errorCode: "OAuthAccountNotLinked" });
|
|
678
|
+
* ```
|
|
679
|
+
*/
|
|
680
|
+
socialLoginError(data: SocialLoginError, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
681
|
+
/**
|
|
682
|
+
* Track when a social login completes successfully.
|
|
683
|
+
*
|
|
684
|
+
* @remarks
|
|
685
|
+
* Fire this after the social provider callback succeeds and the user
|
|
686
|
+
* is authenticated. Include the `provider` and user reference.
|
|
687
|
+
*
|
|
688
|
+
* @param data - Event payload containing the `provider` and user reference.
|
|
689
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
690
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
691
|
+
*
|
|
692
|
+
* @example
|
|
693
|
+
* ```typescript
|
|
694
|
+
* tracker.socialLoginFinish({ provider: "google" });
|
|
695
|
+
* ```
|
|
696
|
+
*/
|
|
697
|
+
socialLoginFinish(data: SocialLoginFinish, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
698
|
+
/**
|
|
699
|
+
* Track when the overall login flow finishes successfully.
|
|
700
|
+
*
|
|
701
|
+
* @remarks
|
|
702
|
+
* Fire this as the final event of a successful login, regardless of the
|
|
703
|
+
* authentication method used. This closes the login funnel that started
|
|
704
|
+
* with {@link loginVisible}.
|
|
705
|
+
*
|
|
706
|
+
* @param data - Event payload (currently empty, reserved for future fields).
|
|
707
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
708
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* ```typescript
|
|
712
|
+
* tracker.loginFinish();
|
|
713
|
+
* ```
|
|
714
|
+
*/
|
|
715
|
+
loginFinish(data?: LoginFinish, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
716
|
+
/**
|
|
717
|
+
* Track when the signup UI becomes visible to the user.
|
|
718
|
+
*
|
|
719
|
+
* @remarks
|
|
720
|
+
* Trigger this event when your signup form or registration page is rendered
|
|
721
|
+
* and visible. Optionally use the `touchpoint` field to distinguish where the
|
|
722
|
+
* signup appears (e.g. a dedicated registration page vs. an inline checkout signup).
|
|
723
|
+
*
|
|
724
|
+
* @param data - Event payload with an optional `touchpoint`.
|
|
725
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
726
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
727
|
+
*
|
|
728
|
+
* @example
|
|
729
|
+
* ```typescript
|
|
730
|
+
* tracker.signupVisible({});
|
|
731
|
+
* ```
|
|
732
|
+
*/
|
|
733
|
+
signupVisible(data: SignupVisible, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
734
|
+
/**
|
|
735
|
+
* Track when the signup flow completes and associate the new user.
|
|
736
|
+
*
|
|
737
|
+
* @remarks
|
|
738
|
+
* Fire this after a new account has been created. If `userId` and/or
|
|
739
|
+
* `identifier` are provided they are extracted and attached as a
|
|
740
|
+
* {@link UserReference} so subsequent events can be correlated to this user.
|
|
741
|
+
*
|
|
742
|
+
* @param data - Event payload, optionally containing `userId` and/or `identifier`.
|
|
743
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
744
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
745
|
+
*
|
|
746
|
+
* @example
|
|
747
|
+
* ```typescript
|
|
748
|
+
* tracker.signupFinish({});
|
|
749
|
+
* ```
|
|
750
|
+
*/
|
|
751
|
+
signupFinish(data: SignupFinish, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
752
|
+
/**
|
|
753
|
+
* Track when the user is offered a choice between login methods.
|
|
754
|
+
*
|
|
755
|
+
* @remarks
|
|
756
|
+
* Fire this when your UI presents multiple authentication methods and the
|
|
757
|
+
* user must choose one. Record `availableMethods` using {@link LoginMethodType}
|
|
758
|
+
* values and, if applicable, the `explicitDecisionValue` the user selected.
|
|
759
|
+
*
|
|
760
|
+
* @param data - Event payload with `decisionName`, `availableMethods`, and optional `explicitDecisionValue`.
|
|
761
|
+
*
|
|
762
|
+
* @example
|
|
763
|
+
* ```typescript
|
|
764
|
+
* tracker.loginMethodsDecisionOffered({
|
|
765
|
+
* decisionName: "d1",
|
|
766
|
+
* availableMethods: ["passkey-conditional-ui", "identifier-email", "social-google"],
|
|
767
|
+
* });
|
|
768
|
+
* ```
|
|
769
|
+
*/
|
|
770
|
+
loginMethodsDecisionOffered(data: LoginMethodDecision): void;
|
|
771
|
+
authDecisionVisible(data: AuthDecisionVisible): void;
|
|
772
|
+
authDecisionFinished(data: AuthDecisionFinished): void;
|
|
773
|
+
/**
|
|
774
|
+
* Track when a security enrollment flow starts.
|
|
775
|
+
*
|
|
776
|
+
* @remarks
|
|
777
|
+
* Fire this when the user begins enrolling a new security credential
|
|
778
|
+
* (e.g. passkey, MFA device). The `touchpoint` indicates where enrollment
|
|
779
|
+
* was triggered (e.g. `"post-account"`, `"settings"`), and the `userId`
|
|
780
|
+
* is extracted as a {@link UserReference}.
|
|
781
|
+
*
|
|
782
|
+
* @param data - Event payload with `touchpoint` and `userId`.
|
|
783
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
784
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
785
|
+
*
|
|
786
|
+
* @example
|
|
787
|
+
* ```typescript
|
|
788
|
+
* tracker.securityEnrollmentStarted({ touchpoint: "post-account", userId: "usr_123" });
|
|
789
|
+
* ```
|
|
790
|
+
*/
|
|
791
|
+
securityEnrollmentStarted(data: SecurityEnrollmentStarted, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
792
|
+
/**
|
|
793
|
+
* Track when a security enrollment completes successfully.
|
|
794
|
+
*
|
|
795
|
+
* @remarks
|
|
796
|
+
* Fire this after the new security credential has been registered
|
|
797
|
+
* and persisted.
|
|
798
|
+
*
|
|
799
|
+
* @param data - Event payload (currently empty, reserved for future fields).
|
|
800
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
801
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
802
|
+
*
|
|
803
|
+
* @example
|
|
804
|
+
* ```typescript
|
|
805
|
+
* tracker.securityEnrollmentFinished({});
|
|
806
|
+
* ```
|
|
807
|
+
*/
|
|
808
|
+
securityEnrollmentFinished(data: {}, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
809
|
+
/**
|
|
810
|
+
* Create a trackable passkey enrollment operation and mark it as startable.
|
|
811
|
+
*
|
|
812
|
+
* @remarks
|
|
813
|
+
* Returns a {@link PasskeyOperationEnrollment} that manages the full
|
|
814
|
+
* enrollment lifecycle: `started` → `submitted` → `finished` / `error` / `skipped`.
|
|
815
|
+
* Call this when the user reaches a point where passkey enrollment can be offered.
|
|
816
|
+
*
|
|
817
|
+
* @param data - Event payload (currently empty, reserved for future fields).
|
|
818
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
819
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
820
|
+
* @returns A {@link PasskeyOperationEnrollment} instance.
|
|
821
|
+
*
|
|
822
|
+
* @example
|
|
823
|
+
* ```typescript
|
|
824
|
+
* const op = tracker.passkeyEnrollmentStartable({});
|
|
825
|
+
* ```
|
|
826
|
+
*/
|
|
827
|
+
passkeyEnrollmentStartable(data: PasskeyEnrollmentStartable, tags?: Record<string, string>, contexts?: Record<string, any>): PasskeyOperationEnrollment;
|
|
828
|
+
/**
|
|
829
|
+
* Track when an account recovery flow starts.
|
|
830
|
+
*
|
|
831
|
+
* @remarks
|
|
832
|
+
* Fire this when the user initiates account recovery (e.g. "Forgot password",
|
|
833
|
+
* "Can't sign in"). Use the `touchpoint` field to indicate where recovery was
|
|
834
|
+
* triggered.
|
|
835
|
+
*
|
|
836
|
+
* @param data - Event payload with `touchpoint`.
|
|
837
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
838
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
839
|
+
*
|
|
840
|
+
* @example
|
|
841
|
+
* ```typescript
|
|
842
|
+
* tracker.accountRecoveryStarted({ touchpoint: "login" });
|
|
843
|
+
* ```
|
|
844
|
+
*/
|
|
845
|
+
accountRecoveryStarted(data: AccountRecoveryStarted, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
846
|
+
/**
|
|
847
|
+
* Track when an account recovery flow completes successfully.
|
|
848
|
+
*
|
|
849
|
+
* @remarks
|
|
850
|
+
* Fire this after the user has successfully recovered access to their account.
|
|
851
|
+
*
|
|
852
|
+
* @param data - Event payload (currently empty, reserved for future fields).
|
|
853
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
854
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
855
|
+
*
|
|
856
|
+
* @example
|
|
857
|
+
* ```typescript
|
|
858
|
+
* tracker.accountRecoveryFinished({});
|
|
859
|
+
* ```
|
|
860
|
+
*/
|
|
861
|
+
accountRecoveryFinished(data: {}, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
862
|
+
/**
|
|
863
|
+
* Track when an email link flow starts.
|
|
864
|
+
*
|
|
865
|
+
* @remarks
|
|
866
|
+
* Fire this when the email has been sent out to the user and the verification process begins.
|
|
867
|
+
* If fired from an un-authenticated context, we recommend to include a `crossEnvironmentTransactionID` in `data`.
|
|
868
|
+
* This can be any idea that you have again available when the email link flow submits (after the user clicks the link in the email).
|
|
869
|
+
*
|
|
870
|
+
* @param data - Event payload containing the user reference.
|
|
871
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
872
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
873
|
+
*
|
|
874
|
+
* @example
|
|
875
|
+
* ```typescript
|
|
876
|
+
* tracker.emailLinkStarted({ userId: "usr_123" });
|
|
877
|
+
* ```
|
|
878
|
+
*/
|
|
879
|
+
emailLinkStartable(data: EmailLinkStartable, tags?: Record<string, string>, contexts?: Record<string, any>): EmailLinkOperation;
|
|
880
|
+
emailLinkSubmitted(data: EmailLinkSubmitted, tags?: Record<string, string>, contexts?: Record<string, any>): EmailLinkOperation;
|
|
881
|
+
emailLinkFinished(data: EmailLinkFinished, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
882
|
+
emailLinkError(data: EmailLinkError, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
883
|
+
/**
|
|
884
|
+
* Create a trackable email OTP operation and mark it as startable.
|
|
885
|
+
*
|
|
886
|
+
* @remarks
|
|
887
|
+
* Returns an {@link EmailOTPOperation} that manages the full email OTP
|
|
888
|
+
* lifecycle: `started` → `submitted` → `finished` / `error`, plus `resent`.
|
|
889
|
+
* Call this when the user reaches a point where email OTP authentication
|
|
890
|
+
* can be offered (e.g. after identifier provision returns email OTP as
|
|
891
|
+
* an available method).
|
|
892
|
+
*
|
|
893
|
+
* @param data - Event payload (currently empty, reserved for future fields).
|
|
894
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
895
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
896
|
+
* @returns An {@link EmailOTPOperation} instance.
|
|
897
|
+
*
|
|
898
|
+
* @example
|
|
899
|
+
* ```typescript
|
|
900
|
+
* const op = tracker.emailOTPStartable({});
|
|
901
|
+
* ```
|
|
902
|
+
*/
|
|
903
|
+
emailOTPStartable(data?: EmailOTPStartable, tags?: Record<string, string>, contexts?: Record<string, any>): EmailOTPOperation;
|
|
904
|
+
/**
|
|
905
|
+
* Track the start of an email OTP authentication flow.
|
|
906
|
+
*
|
|
907
|
+
* @remarks
|
|
908
|
+
* Fire this when the email OTP flow begins — typically when the OTP email
|
|
909
|
+
* is sent to the user. The returned {@link EmailOTPOperation} lets you
|
|
910
|
+
* continue tracking through submission, completion, error, or resend.
|
|
911
|
+
*
|
|
912
|
+
* @param data - Event payload (currently empty, reserved for future fields).
|
|
913
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
914
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
915
|
+
* @returns An {@link EmailOTPOperation} instance.
|
|
916
|
+
*
|
|
917
|
+
* @example
|
|
918
|
+
* ```typescript
|
|
919
|
+
* const op = tracker.emailOTPStarted({});
|
|
920
|
+
* ```
|
|
921
|
+
*/
|
|
922
|
+
emailOTPStarted(data?: EmailOTPStarted, tags?: Record<string, string>, contexts?: Record<string, any>): EmailOTPOperation;
|
|
923
|
+
/**
|
|
924
|
+
* Track when the user submits an email OTP code.
|
|
925
|
+
*
|
|
926
|
+
* @remarks
|
|
927
|
+
* Fire this after the user enters and submits the OTP code for verification.
|
|
928
|
+
* This sits between the started and finished/error events.
|
|
929
|
+
*
|
|
930
|
+
* @param data - Event payload (currently empty, reserved for future fields).
|
|
931
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
932
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
933
|
+
*
|
|
934
|
+
* @example
|
|
935
|
+
* ```typescript
|
|
936
|
+
* tracker.emailOTPSubmitted({});
|
|
937
|
+
* ```
|
|
938
|
+
*/
|
|
939
|
+
emailOTPSubmitted(data?: EmailOTPSubmitted, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
940
|
+
/**
|
|
941
|
+
* Track when email OTP verification completes successfully.
|
|
942
|
+
*
|
|
943
|
+
* @remarks
|
|
944
|
+
* Fire this after the backend has verified the OTP code and the user
|
|
945
|
+
* is authenticated.
|
|
946
|
+
*
|
|
947
|
+
* @param data - Event payload (currently empty, reserved for future fields).
|
|
948
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
949
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
950
|
+
*
|
|
951
|
+
* @example
|
|
952
|
+
* ```typescript
|
|
953
|
+
* tracker.emailOTPFinished({});
|
|
954
|
+
* ```
|
|
955
|
+
*/
|
|
956
|
+
emailOTPFinished(data?: EmailOTPFinished, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
957
|
+
/**
|
|
958
|
+
* Track when email OTP verification fails.
|
|
959
|
+
*
|
|
960
|
+
* @remarks
|
|
961
|
+
* Fire this when OTP code verification fails (e.g. invalid code, expired code,
|
|
962
|
+
* rate limit exceeded).
|
|
963
|
+
*
|
|
964
|
+
* @param data - Event payload containing the `errorCode`.
|
|
965
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
966
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
967
|
+
*
|
|
968
|
+
* @example
|
|
969
|
+
* ```typescript
|
|
970
|
+
* tracker.emailOTPError({ errorCode: "invalid_code" });
|
|
971
|
+
* ```
|
|
972
|
+
*/
|
|
973
|
+
emailOTPError(data: EmailOTPError, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
974
|
+
/**
|
|
975
|
+
* Track when an email OTP code is resent.
|
|
976
|
+
*
|
|
977
|
+
* @remarks
|
|
978
|
+
* Fire this when the user requests a new OTP code (e.g. clicks "Resend code").
|
|
979
|
+
* This helps measure how often users need to request a new code.
|
|
980
|
+
*
|
|
981
|
+
* @param data - Event payload (currently empty, reserved for future fields).
|
|
982
|
+
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
983
|
+
* @param contexts - Optional contextual metadata attached to the event.
|
|
984
|
+
*
|
|
985
|
+
* @example
|
|
986
|
+
* ```typescript
|
|
987
|
+
* tracker.emailOTPResent({});
|
|
988
|
+
* ```
|
|
989
|
+
*/
|
|
990
|
+
emailOTPResent(data?: EmailOTPResent, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
991
|
+
setPasswordStartable(inputHtmlField?: HTMLInputElement, tags?: Record<string, string>, contexts?: Record<string, any>): SetPasswordOperation;
|
|
992
|
+
setPasswordStarted(data?: SetPasswordStarted, tags?: Record<string, string>, contexts?: Record<string, any>): SetPasswordOperation;
|
|
993
|
+
setPasswordSubmitted(data?: SetPasswordSubmitted, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
994
|
+
setPasswordFinished(data?: SetPasswordFinished, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
995
|
+
setPasswordError(data: SetPasswordError, tags?: Record<string, string>, contexts?: Record<string, any>): void;
|
|
996
|
+
/** @internal */
|
|
997
|
+
resetSession(): string;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
declare const SDK_NAME = "@corbado/observe";
|
|
1001
|
+
declare const SDK_VERSION: string;
|
|
1002
|
+
|
|
1003
|
+
interface TransportMakeRequestResponse {
|
|
1004
|
+
statusCode?: number;
|
|
1005
|
+
headers?: Record<string, string | null>;
|
|
1006
|
+
}
|
|
1007
|
+
interface Transport {
|
|
1008
|
+
send(batch: EventBatch): Promise<TransportMakeRequestResponse>;
|
|
1009
|
+
sendBeacon?(batch: EventBatch): boolean;
|
|
1010
|
+
flush(timeout?: number): Promise<boolean>;
|
|
1011
|
+
}
|
|
1012
|
+
interface TransportOptions {
|
|
1013
|
+
url: string;
|
|
1014
|
+
headers?: Record<string, string>;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
interface QueueOptions {
|
|
1018
|
+
batchSize?: number;
|
|
1019
|
+
flushInterval?: number;
|
|
1020
|
+
}
|
|
1021
|
+
declare class RequestQueue {
|
|
1022
|
+
private transport;
|
|
1023
|
+
private readonly projectId;
|
|
1024
|
+
private sessionId;
|
|
1025
|
+
private readonly sdk;
|
|
1026
|
+
private options;
|
|
1027
|
+
private queue;
|
|
1028
|
+
private timer;
|
|
1029
|
+
private isFlushing;
|
|
1030
|
+
private onVisibilityChange;
|
|
1031
|
+
private onPageHide;
|
|
1032
|
+
constructor(transport: Transport, projectId: string, sessionId: string, sdk: SdkInfo, options?: QueueOptions);
|
|
1033
|
+
setSessionId(sessionId: string): void;
|
|
1034
|
+
enqueue(event: Event): void;
|
|
1035
|
+
flush(): Promise<void>;
|
|
1036
|
+
private setupLifecycleHooks;
|
|
1037
|
+
private flushSync;
|
|
1038
|
+
destroy(): void;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
interface StorageEngine {
|
|
1042
|
+
getItem<T>(key: string): T | null;
|
|
1043
|
+
setItem<T>(key: string, value: T): void;
|
|
1044
|
+
removeItem(key: string): void;
|
|
1045
|
+
}
|
|
1046
|
+
declare class LocalStorage implements StorageEngine {
|
|
1047
|
+
getItem<T>(key: string): T | null;
|
|
1048
|
+
setItem<T>(key: string, value: T): void;
|
|
1049
|
+
removeItem(key: string): void;
|
|
1050
|
+
}
|
|
1051
|
+
declare class CookieStorage implements StorageEngine {
|
|
1052
|
+
private domain?;
|
|
1053
|
+
constructor(domain?: string | undefined);
|
|
1054
|
+
getItem<T>(key: string): T | null;
|
|
1055
|
+
setItem<T>(key: string, value: T): void;
|
|
1056
|
+
removeItem(key: string): void;
|
|
1057
|
+
}
|
|
1058
|
+
declare class SessionStorage implements StorageEngine {
|
|
1059
|
+
getItem<T>(key: string): T | null;
|
|
1060
|
+
setItem<T>(key: string, value: T): void;
|
|
1061
|
+
removeItem(key: string): void;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
declare function init(options: TrackerOptions): CorbadoTracker;
|
|
1065
|
+
declare function getTracker(): CorbadoTracker | undefined;
|
|
1066
|
+
declare function resetSession(): string | undefined;
|
|
1067
|
+
|
|
1068
|
+
export { type AccountRecoveryStarted, type AuthDecisionFinished, type AuthDecisionVisible, AuthEventName, type BaseEvent, type ClientCapabilities, type ClientEnvHandleMeta, type ClientEnvHandleMetaSource, CookieStorage, CorbadoTracker, type CustomEvent, type DeviceInfo, type DeviceInfoDataWeb, type DeviceType, type EmailLinkError, type EmailLinkFinished, EmailLinkOperation, type EmailLinkStartable, type EmailLinkSubmitted, type EmailOTPError, type EmailOTPFinished, EmailOTPOperation, type EmailOTPResent, type EmailOTPStartable, type EmailOTPStarted, type EmailOTPSubmitted, type Event, type EventBatch, type EventType, type IdentifierProvided, type JavaScriptHighEntropy, LocalStorage, type LoginFinish, type LoginMethodDecision, type LoginMethodType, type LoginReset, type LoginStepPasswordErrorCode, type LoginVisible, type NormalizedError, type PasskeyEnrollmentError, type PasskeyEnrollmentFinished, type PasskeyEnrollmentStartable, type PasskeyEnrollmentStarted, type PasskeyEnrollmentSubmitted, type PasskeyLoginClientError, type PasskeyLoginFinish, type PasskeyLoginStart, type PasskeyLoginStartable, type PasskeyLoginSubmitted, PasskeyOperationEnrollment, PasskeyOperationLogin, type PasswordLoginError, type PasswordLoginFinish, type PasswordLoginStartable, type PasswordLoginStarted, PasswordOperationLogin, type PredefinedEvent, type ProvideIdentifierError, type ProvideIdentifierFinish, ProvideIdentifierOperation, type ProvideIdentifierStart, type QueueOptions, RequestQueue, SDK_NAME, SDK_VERSION, type SdkInfo, type SecurityEnrollmentStarted, SessionStorage, type SetPasswordError, type SetPasswordFinished, SetPasswordOperation, type SetPasswordStartable, type SetPasswordStarted, type SetPasswordSubmitted, type SignupFinish, type SignupVisible, type SocialLoginError, type SocialLoginFinish, type SocialLoginProviderType, type SocialLoginStart, SocialOperationLogin, type StorageEngine, type TrackerOptions, type Transport, type TransportMakeRequestResponse, type TransportOptions, type User, type UserReference, type WithSubFlowId, getTracker, init, resetSession };
|