@corbado/observe 0.0.1-next.8 → 0.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/dist/cdn/script.global.js +1 -1
- package/dist/index.d.mts +401 -776
- package/dist/index.d.ts +401 -776
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +9 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,74 +1,29 @@
|
|
|
1
|
-
interface User {
|
|
2
|
-
id?: string;
|
|
3
|
-
email?: string;
|
|
4
|
-
username?: string;
|
|
5
|
-
name?: string;
|
|
6
|
-
[key: string]: unknown;
|
|
7
|
-
}
|
|
8
1
|
interface SdkInfo {
|
|
9
2
|
name: string;
|
|
10
3
|
version: string;
|
|
11
4
|
}
|
|
12
5
|
type EventType = "predefined" | "custom" | "error" | "identify";
|
|
13
|
-
type
|
|
6
|
+
type AuthMethodType = "identifier-email" | "passkey-login-known-identifier" | "passkey-login-no-identifier" | "passkey-login-cui" | "passkey-enrollment" | "password-login-known-identifier" | "password-login-with-identifier" | "password-enrollment" | "email-otp-login" | "email-otp-enrollment" | "email-link-login" | "email-link-enrollment" | "social-google" | "social-apple" | "social-facebook" | "social-other" | "reset-flow";
|
|
7
|
+
type SubflowType = "passkey-enrollment" | "passkey-login" | "email-otp" | "email-link" | "social-login" | "sms-otp" | "provide-identifier" | "provide-data" | "password-login" | "password-enrollment" | "totp";
|
|
8
|
+
type FlowType = "login" | "signup" | "recovery" | "enrollment";
|
|
14
9
|
type SocialLoginProviderType = "google" | "apple" | "facebook" | "github" | "microsoft" | "other";
|
|
15
10
|
declare enum AuthEventName {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
FlowStarted = "flow_started",
|
|
12
|
+
FlowDecided = "flow_decided",
|
|
13
|
+
FlowFinished = "flow_finished",
|
|
14
|
+
FlowReset = "flow_reset",
|
|
15
|
+
AuthMethodDecisionStarted = "auth_method_decision_started",
|
|
16
|
+
AuthMethodDecisionFinished = "auth_method_decision_finished",
|
|
17
|
+
FlowAutoFinished = "flow_auto_finished",
|
|
18
|
+
AuthDecisionStarted = "auth_decision_started",
|
|
20
19
|
AuthDecisionFinished = "auth_decision_finished",
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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"
|
|
20
|
+
SubflowStepStarted = "subflow_step_started",
|
|
21
|
+
SubflowStepFinished = "subflow_step_finished",
|
|
22
|
+
SubflowStepError = "subflow_step_error",
|
|
23
|
+
SubflowTrigger = "subflow_trigger",
|
|
24
|
+
SubflowError = "subflow_error",
|
|
25
|
+
SubflowStarted = "subflow_started",
|
|
26
|
+
SubflowFinished = "subflow_finished"
|
|
72
27
|
}
|
|
73
28
|
interface BaseEvent {
|
|
74
29
|
timestamp: number;
|
|
@@ -79,9 +34,6 @@ interface BaseEvent {
|
|
|
79
34
|
tags?: Record<string, string>;
|
|
80
35
|
deviceInfo?: DeviceInfo;
|
|
81
36
|
}
|
|
82
|
-
type WithSubFlowId<T> = T & {
|
|
83
|
-
subFlowId?: string;
|
|
84
|
-
};
|
|
85
37
|
type UserReference = {
|
|
86
38
|
userId?: string;
|
|
87
39
|
identifier?: string;
|
|
@@ -95,16 +47,38 @@ type NormalizedError = {
|
|
|
95
47
|
name?: string;
|
|
96
48
|
message: string;
|
|
97
49
|
};
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
* Where the login form is shown (e.g. `"account"`, `"checkout"`).
|
|
101
|
-
*/
|
|
50
|
+
type FlowStarted = {
|
|
51
|
+
flowName: FlowType;
|
|
102
52
|
touchpoint?: string;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
53
|
+
};
|
|
54
|
+
type MultiFlowStarted = {
|
|
55
|
+
flowNames: FlowType[];
|
|
56
|
+
defaultFlowName?: FlowType;
|
|
57
|
+
touchpoint?: string;
|
|
58
|
+
};
|
|
59
|
+
type FlowDecided = {
|
|
60
|
+
flowName: FlowType;
|
|
61
|
+
};
|
|
62
|
+
type FlowFinished = {
|
|
63
|
+
flowName: FlowType;
|
|
64
|
+
explicitOutcome?: "skipped" | "invisible";
|
|
65
|
+
} & UserReference;
|
|
66
|
+
type FlowReset = {
|
|
67
|
+
flowName: FlowType;
|
|
68
|
+
};
|
|
69
|
+
type FlowAutoFinished = {
|
|
70
|
+
flowName: FlowType;
|
|
71
|
+
finishedByFlowName: FlowType;
|
|
72
|
+
} & UserReference;
|
|
73
|
+
type AuthMethodDecisionStarted = {
|
|
74
|
+
decisionName: string;
|
|
75
|
+
options: (AuthMethodType | (string & {}))[];
|
|
76
|
+
explicitDecisionValue?: string;
|
|
77
|
+
};
|
|
78
|
+
type AuthMethodDecisionFinished = {
|
|
79
|
+
decisionName: string;
|
|
80
|
+
options: (AuthMethodType | (string & {}))[];
|
|
81
|
+
explicitDecisionValue?: string;
|
|
108
82
|
};
|
|
109
83
|
type ProvideIdentifierStart = {};
|
|
110
84
|
type ProvideIdentifierError = UserReference & {
|
|
@@ -114,25 +88,9 @@ type ProvideIdentifierError = UserReference & {
|
|
|
114
88
|
type ProvideIdentifierFinish = UserReference & {
|
|
115
89
|
identifierPrefillingCreated?: boolean;
|
|
116
90
|
};
|
|
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
91
|
type PasskeyLoginClientError = {
|
|
130
92
|
error: any;
|
|
131
93
|
};
|
|
132
|
-
type PasskeyLoginStart = {
|
|
133
|
-
explicitSpecType: "passkey-cui" | "passkey-identifier" | "passkey-button";
|
|
134
|
-
conditional: boolean;
|
|
135
|
-
} & PasskeyLoginStartable;
|
|
136
94
|
type PasskeyLoginStartable = {
|
|
137
95
|
assertionOptions: string;
|
|
138
96
|
};
|
|
@@ -140,24 +98,7 @@ type PasskeyLoginSubmitted = {
|
|
|
140
98
|
assertionResponse: string;
|
|
141
99
|
};
|
|
142
100
|
type PasskeyLoginFinish = UserReference & {};
|
|
143
|
-
type
|
|
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 = {
|
|
101
|
+
type AuthDecisionStarted = {
|
|
161
102
|
decisionName: string;
|
|
162
103
|
options: string[];
|
|
163
104
|
};
|
|
@@ -166,25 +107,13 @@ type AuthDecisionFinished = {
|
|
|
166
107
|
options: string[];
|
|
167
108
|
explicitDecisionValue?: string;
|
|
168
109
|
};
|
|
169
|
-
type
|
|
170
|
-
|
|
110
|
+
type StepOptions = {
|
|
111
|
+
userReference?: UserReference;
|
|
112
|
+
explicitTimestamp?: number;
|
|
171
113
|
};
|
|
172
|
-
type
|
|
173
|
-
|
|
174
|
-
|
|
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;
|
|
114
|
+
type SubflowTrigger = {
|
|
115
|
+
actor: "system" | "user";
|
|
116
|
+
explicitSpecType?: string;
|
|
188
117
|
};
|
|
189
118
|
interface PredefinedEvent extends BaseEvent {
|
|
190
119
|
type: "predefined";
|
|
@@ -229,158 +158,222 @@ type ClientEnvHandleMeta = {
|
|
|
229
158
|
source: ClientEnvHandleMetaSource;
|
|
230
159
|
};
|
|
231
160
|
type ClientEnvHandleMetaSource = "localstorage" | "cookie" | "native";
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
161
|
+
|
|
162
|
+
type StepHelper<TStart = {}, TFinished = {}, TTypedError = never> = {
|
|
163
|
+
start: (data: TStart, options?: StepOptions) => void;
|
|
164
|
+
finished: (data: TFinished, options?: StepOptions) => void;
|
|
165
|
+
error: (error: unknown, options?: StepOptions) => void;
|
|
166
|
+
} & ([TTypedError] extends [never] ? {} : {
|
|
167
|
+
errorTyped: (error: TTypedError, options?: StepOptions) => void;
|
|
168
|
+
});
|
|
169
|
+
declare abstract class OperationFull {
|
|
170
|
+
private tracker;
|
|
171
|
+
private operationName;
|
|
172
|
+
constructor(tracker: CorbadoTracker, operationName: SubflowType);
|
|
173
|
+
subflowStart(data: any, options?: StepOptions): void;
|
|
174
|
+
trigger(data: SubflowTrigger, options?: StepOptions): void;
|
|
175
|
+
customStep<TStart = {}, TFinished = {}>(stepName: string): StepHelper<TStart, TFinished>;
|
|
176
|
+
protected subflowStepStarted(stepName: string, data: any, options?: StepOptions): void;
|
|
177
|
+
protected subflowStepFinished(stepName: string, data: any, options?: StepOptions): void;
|
|
178
|
+
protected subflowStepError(stepName: string, data: any, options?: StepOptions): void;
|
|
179
|
+
protected defineStep<TStart = {}, TFinished = {}, TTypedError = never>(stepName: string): StepHelper<TStart, TFinished, TTypedError>;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
type PasskeyOperationLoginExplicitSpecType = "passkey-cui" | "passkey-known-identifier" | "passkey-no-identifier";
|
|
183
|
+
type PasskeyLoginGetOptionsStart = {
|
|
184
|
+
explicitSpecType?: PasskeyOperationLoginExplicitSpecType;
|
|
244
185
|
};
|
|
245
|
-
type
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
} & UserReference;
|
|
249
|
-
type EmailLinkSubmitted = {
|
|
250
|
-
crossEnvironmentTransactionID?: string;
|
|
186
|
+
type PasskeyLoginGetOptionsFinished = {
|
|
187
|
+
explicitSpecType?: PasskeyOperationLoginExplicitSpecType;
|
|
188
|
+
assertionOptions: string;
|
|
251
189
|
};
|
|
252
|
-
type
|
|
253
|
-
|
|
254
|
-
|
|
190
|
+
type PasskeyLoginCeremonyStart = {
|
|
191
|
+
explicitSpecType?: PasskeyOperationLoginExplicitSpecType;
|
|
192
|
+
assertionOptions?: string;
|
|
255
193
|
};
|
|
256
|
-
type
|
|
257
|
-
|
|
258
|
-
type SetPasswordSubmitted = {};
|
|
259
|
-
type SetPasswordFinished = {};
|
|
260
|
-
type SetPasswordError = {
|
|
261
|
-
errorCode: string;
|
|
262
|
-
origin: "client" | "server";
|
|
194
|
+
type PasskeyLoginCeremonyFinished = {
|
|
195
|
+
assertionResponse: string;
|
|
263
196
|
};
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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;
|
|
197
|
+
declare class PasskeyLoginOperationFull extends OperationFull {
|
|
198
|
+
readonly getOptions: StepHelper<PasskeyLoginGetOptionsStart, PasskeyLoginGetOptionsFinished>;
|
|
199
|
+
readonly ceremony: StepHelper<PasskeyLoginCeremonyStart, PasskeyLoginCeremonyFinished>;
|
|
200
|
+
readonly postResponse: StepHelper;
|
|
201
|
+
constructor(tracker: CorbadoTracker);
|
|
273
202
|
}
|
|
274
203
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
204
|
+
type EmailOTPOperationSpecType = "email-otp-login" | "email-otp-enrollment";
|
|
205
|
+
type EmailOTPOperationSendOTPStart = {
|
|
206
|
+
explicitSpecType?: EmailOTPOperationSpecType;
|
|
207
|
+
};
|
|
208
|
+
type EmailOTPOperationPostResponseStart = {
|
|
209
|
+
explicitSpecType?: EmailOTPOperationSpecType;
|
|
210
|
+
};
|
|
211
|
+
declare class EmailOtpOperationFull extends OperationFull {
|
|
212
|
+
readonly send: StepHelper<EmailOTPOperationSendOTPStart>;
|
|
213
|
+
readonly postResponse: StepHelper<EmailOTPOperationPostResponseStart>;
|
|
214
|
+
readonly resend: StepHelper;
|
|
215
|
+
constructor(tracker: CorbadoTracker);
|
|
285
216
|
}
|
|
286
217
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
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;
|
|
218
|
+
type EmailLinkOperationSpecType = "email-link-login" | "email-link-enrollment";
|
|
219
|
+
type EmailLinkOperationSendStart = {
|
|
220
|
+
explicitSpecType?: EmailLinkOperationSpecType;
|
|
221
|
+
};
|
|
222
|
+
type EmailLinkOperationPostResponseStart = {
|
|
223
|
+
explicitSpecType?: EmailLinkOperationSpecType;
|
|
224
|
+
};
|
|
225
|
+
declare class EmailLinkOperationFull extends OperationFull {
|
|
226
|
+
readonly send: StepHelper<EmailLinkOperationSendStart>;
|
|
227
|
+
readonly postResponse: StepHelper<EmailLinkOperationPostResponseStart>;
|
|
228
|
+
readonly resend: StepHelper;
|
|
229
|
+
constructor(tracker: CorbadoTracker);
|
|
302
230
|
}
|
|
303
231
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
232
|
+
type PasskeyOperationEnrollmentExplicitSpecType = "conditional-auto-manual" | "auto-manual" | "manual";
|
|
233
|
+
type PasskeyEnrollmentGetOptionsStart = {
|
|
234
|
+
explicitSpecType?: PasskeyOperationEnrollmentExplicitSpecType;
|
|
235
|
+
};
|
|
236
|
+
type PasskeyEnrollmentGetOptionsFinished = {
|
|
237
|
+
explicitSpecType?: PasskeyOperationEnrollmentExplicitSpecType;
|
|
238
|
+
attestationOptions: string;
|
|
239
|
+
};
|
|
240
|
+
type PasskeyEnrollmentCeremonyStart = {
|
|
241
|
+
explicitSpecType?: PasskeyOperationEnrollmentExplicitSpecType;
|
|
242
|
+
attestationOptions?: string;
|
|
243
|
+
mediation: "conditional" | "optional" | "required";
|
|
244
|
+
};
|
|
245
|
+
type PasskeyEnrollmentCeremonyFinished = {
|
|
246
|
+
attestationResponse: string;
|
|
247
|
+
};
|
|
248
|
+
declare class PasskeyEnrollmentOperationFull extends OperationFull {
|
|
249
|
+
readonly getOptions: StepHelper<PasskeyEnrollmentGetOptionsStart, PasskeyEnrollmentGetOptionsFinished>;
|
|
250
|
+
readonly ceremony: StepHelper<PasskeyEnrollmentCeremonyStart, PasskeyEnrollmentCeremonyFinished>;
|
|
251
|
+
readonly postResponse: StepHelper;
|
|
252
|
+
constructor(tracker: CorbadoTracker);
|
|
318
253
|
}
|
|
319
254
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
255
|
+
interface Logger {
|
|
256
|
+
debug(message: string, ...args: unknown[]): void;
|
|
257
|
+
info(message: string, ...args: unknown[]): void;
|
|
258
|
+
warn(message: string, ...args: unknown[]): void;
|
|
259
|
+
error(message: string, ...args: unknown[]): void;
|
|
260
|
+
critical(message: string, ...args: unknown[]): void;
|
|
261
|
+
}
|
|
262
|
+
interface CreateLoggerOptions {
|
|
263
|
+
debug: boolean;
|
|
326
264
|
}
|
|
265
|
+
declare function createLogger(options: CreateLoggerOptions): Logger;
|
|
327
266
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
267
|
+
type PasswordLoginTypedError = {
|
|
268
|
+
code: PasswordLoginTypedErrorCode;
|
|
269
|
+
};
|
|
270
|
+
type PasswordLoginTypedErrorCode = "invalid_password" | "user_not_found" | "account_locked";
|
|
271
|
+
type PasswordLoginExplicitSpecType = "password-known-identifier" | "password-with-identifier";
|
|
272
|
+
type PasswordLoginAutoTrackConfig = {
|
|
273
|
+
explicitSpecType: PasswordLoginExplicitSpecType;
|
|
274
|
+
inputHtmlField: HTMLInputElement;
|
|
275
|
+
};
|
|
276
|
+
declare class PasswordLoginOperationFull extends OperationFull {
|
|
277
|
+
readonly postResponse: StepHelper<{}, {}, PasswordLoginTypedError>;
|
|
278
|
+
private patternDetector?;
|
|
279
|
+
constructor(tracker: CorbadoTracker, autoTrackConfig?: PasswordLoginAutoTrackConfig);
|
|
280
|
+
destroy(): void;
|
|
337
281
|
}
|
|
338
282
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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;
|
|
283
|
+
type PasswordEnrollmentTypedError = {
|
|
284
|
+
code: PasswordEnrollmentTypedErrorCode;
|
|
285
|
+
};
|
|
286
|
+
type PasswordEnrollmentTypedErrorCode = "requirements_not_fulfilled";
|
|
287
|
+
type PasswordEnrollmentExplicitSpecType = "password-set" | "password-reset";
|
|
288
|
+
type PasswordEnrollmentAutoTrackConfig = {
|
|
289
|
+
explicitSpecType: PasswordEnrollmentExplicitSpecType;
|
|
290
|
+
inputHtmlField: HTMLInputElement;
|
|
291
|
+
};
|
|
292
|
+
declare class PasswordEnrollmentOperationFull extends OperationFull {
|
|
293
|
+
readonly postResponse: StepHelper<{}, {}, PasswordEnrollmentTypedError>;
|
|
294
|
+
private patternDetector?;
|
|
295
|
+
constructor(tracker: CorbadoTracker, autoTrackConfig?: PasswordEnrollmentAutoTrackConfig);
|
|
296
|
+
destroy(): void;
|
|
358
297
|
}
|
|
359
298
|
|
|
360
|
-
|
|
299
|
+
type PasskeyLoginCUITypedError = {
|
|
300
|
+
code: PasskeyLoginCUITypedErrorCode;
|
|
301
|
+
};
|
|
302
|
+
type PasskeyLoginCUITypedErrorCode = "cancel_detected";
|
|
303
|
+
type ProvideIdentifierSpecType = "email";
|
|
304
|
+
type ProvideIdentifierPostResponseStart = {
|
|
305
|
+
explicitSpecType?: ProvideIdentifierSpecType;
|
|
306
|
+
};
|
|
307
|
+
type PasskeyLoginCUISpecType = "passkey-cui";
|
|
308
|
+
type CUICeremonyStart = {
|
|
309
|
+
explicitSpecType?: PasskeyLoginCUISpecType;
|
|
310
|
+
};
|
|
311
|
+
type PasskeyLoginCUIGetOptionsStart = {
|
|
312
|
+
explicitSpecType?: PasskeyLoginCUISpecType;
|
|
313
|
+
};
|
|
314
|
+
type PasskeyLoginCUIGetOptionsFinished = {
|
|
315
|
+
explicitSpecType?: ProvideIdentifierSpecType;
|
|
316
|
+
assertionOptions: string;
|
|
317
|
+
};
|
|
318
|
+
declare class OperationFullProvideIdentifierWithCUI {
|
|
361
319
|
private tracker;
|
|
362
320
|
private patternDetector?;
|
|
321
|
+
readonly cui: {
|
|
322
|
+
trigger: (data: SubflowTrigger, options?: StepOptions) => void;
|
|
323
|
+
getOptions: StepHelper<PasskeyLoginCUIGetOptionsStart, PasskeyLoginCUIGetOptionsFinished>;
|
|
324
|
+
ceremony: StepHelper<CUICeremonyStart, PasskeyLoginCeremonyFinished, PasskeyLoginCUITypedError>;
|
|
325
|
+
postResponse: StepHelper;
|
|
326
|
+
};
|
|
327
|
+
readonly provideIdentifier: {
|
|
328
|
+
trigger: (data: SubflowTrigger, options?: StepOptions) => void;
|
|
329
|
+
postResponse: StepHelper<ProvideIdentifierPostResponseStart>;
|
|
330
|
+
};
|
|
363
331
|
constructor(tracker: CorbadoTracker, inputHtmlField?: HTMLInputElement);
|
|
364
|
-
|
|
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;
|
|
332
|
+
private createStep;
|
|
369
333
|
destroy(): void;
|
|
370
334
|
}
|
|
371
335
|
|
|
336
|
+
type SocialLoginSpecType = "pre-identifier" | "post-identifier";
|
|
337
|
+
type SocialLoginGetRedirectUrlStart = {
|
|
338
|
+
provider?: SocialLoginProviderType;
|
|
339
|
+
explicitSpecType: SocialLoginSpecType;
|
|
340
|
+
};
|
|
341
|
+
type SocialLoginGetRedirectUrlFinished = {};
|
|
342
|
+
type SocialLoginExchangeCodeStart = {
|
|
343
|
+
provider?: SocialLoginProviderType;
|
|
344
|
+
};
|
|
345
|
+
type SocialLoginExchangeCodeFinished = {};
|
|
346
|
+
declare class SocialLoginOperationFull extends OperationFull {
|
|
347
|
+
readonly getRedirectUrl: StepHelper<SocialLoginGetRedirectUrlStart, SocialLoginGetRedirectUrlFinished>;
|
|
348
|
+
readonly exchangeCode: StepHelper<SocialLoginExchangeCodeStart, SocialLoginExchangeCodeFinished>;
|
|
349
|
+
constructor(tracker: CorbadoTracker);
|
|
350
|
+
}
|
|
351
|
+
|
|
372
352
|
interface TrackerOptions {
|
|
373
353
|
projectId: string;
|
|
374
354
|
apiBaseUrl: string;
|
|
375
355
|
apiEventPath?: string;
|
|
376
356
|
storage?: "cookie" | "local";
|
|
357
|
+
cookieDomain?: string;
|
|
377
358
|
debug?: boolean;
|
|
359
|
+
logger?: Logger;
|
|
378
360
|
deviceInfoDebounceTime?: number;
|
|
379
361
|
defaultTags?: Record<string, string>;
|
|
380
362
|
applicationId?: string;
|
|
381
363
|
}
|
|
364
|
+
/**
|
|
365
|
+
* @remarks
|
|
366
|
+
* **Constructor**
|
|
367
|
+
* - If `apiBaseUrl` is non-empty and missing `http://` or `https://`: logs via `logger.critical` (does not throw).
|
|
368
|
+
* - If `apiBaseUrl` is non-empty and ends with `/`: logs via `logger.critical` (does not throw).
|
|
369
|
+
* - Session bootstrap (`getSessionId`): on failure logs `Failed to get session id` and continues with an empty session id (does not throw).
|
|
370
|
+
*
|
|
371
|
+
* **Typed tracking helpers** (`flowStarted`, `flowDecided`, and the other public methods that call `track`)
|
|
372
|
+
* - Error handling for queued events is defined on {@link CorbadoTracker.track}.
|
|
373
|
+
*/
|
|
382
374
|
declare class CorbadoTracker {
|
|
383
375
|
private options;
|
|
376
|
+
private logger;
|
|
384
377
|
private queue;
|
|
385
378
|
private sessionId;
|
|
386
379
|
private storage;
|
|
@@ -390,609 +383,165 @@ declare class CorbadoTracker {
|
|
|
390
383
|
private deviceInfoTransmittedLastTime;
|
|
391
384
|
private seq;
|
|
392
385
|
constructor(options: TrackerOptions);
|
|
386
|
+
/**
|
|
387
|
+
* Returns the logger used by this tracker.
|
|
388
|
+
*/
|
|
389
|
+
getLogger(): Logger;
|
|
393
390
|
private applicationTag;
|
|
394
|
-
private debugMessage;
|
|
395
391
|
private isTrackingBlocked;
|
|
396
392
|
private getSessionId;
|
|
397
393
|
private updateDeviceDebounced;
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
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;
|
|
394
|
+
trackSubflowStarted(subflowType: SubflowType, data: Record<string, any>, options?: StepOptions): void;
|
|
395
|
+
trackSubflowTrigger(subflowType: SubflowType, data: Record<string, any>, options?: StepOptions): void;
|
|
396
|
+
trackSubflowStepStarted(subflowType: SubflowType, stepName: string, data: Record<string, any>, options?: StepOptions): void;
|
|
397
|
+
trackSubflowStepFinished(subflowType: SubflowType, stepName: string, data: Record<string, any>, options?: StepOptions): void;
|
|
398
|
+
trackSubflowStepError(subflowType: SubflowType, stepName: string, data: Record<string, any>, options?: StepOptions): void;
|
|
399
|
+
trackSubflowFinished(subflowType: SubflowType, data: Record<string, any>, options?: StepOptions): void;
|
|
400
|
+
trackSubflowError(subflowType: SubflowType, data: Record<string, any>, options?: StepOptions): void;
|
|
472
401
|
/**
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
*
|
|
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.
|
|
402
|
+
* Error situations:
|
|
403
|
+
* - Blocked user agent (see `isBlockedUserAgent`): skip with a debug log and return
|
|
404
|
+
* - Any error before the event is enqueued (e.g. device info update, `JSON.stringify` in debug logging, `queue.enqueue`): log `Failed to process event "<name>" before enqueue`
|
|
483
405
|
*
|
|
484
|
-
* @
|
|
485
|
-
* ```typescript
|
|
486
|
-
* tracker.provideIdentifierFinished({
|
|
487
|
-
* identifier: "user@example.com",
|
|
488
|
-
* availableMethods: ["passkey", "password"],
|
|
489
|
-
* preferredMethod: "passkey",
|
|
490
|
-
* });
|
|
491
|
-
* ```
|
|
406
|
+
* @internal
|
|
492
407
|
*/
|
|
493
|
-
|
|
408
|
+
track(name: AuthEventName, data: Record<string, any>, userReference?: UserReference, tags?: Record<string, string>, contexts?: Record<string, any>, explicitTimestamp?: number): Promise<void>;
|
|
494
409
|
/**
|
|
495
|
-
* Track when
|
|
410
|
+
* Track when an authentication flow (or flow selection screen) becomes visible.
|
|
496
411
|
*
|
|
497
412
|
* @remarks
|
|
498
|
-
*
|
|
499
|
-
*
|
|
413
|
+
* Call this once when the user first enters an auth touchpoint (for example account login,
|
|
414
|
+
* checkout login, or account recovery). If users can choose between multiple flows
|
|
415
|
+
* (such as login vs signup), pass `flowNames` and optionally `defaultFlowName`.
|
|
500
416
|
*
|
|
501
|
-
* @param data -
|
|
417
|
+
* @param data - Flow metadata, including one flow (`flowName`) or multiple candidates (`flowNames`).
|
|
502
418
|
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
503
|
-
* @param contexts - Optional contextual metadata attached to the event.
|
|
504
419
|
*
|
|
505
420
|
* @example
|
|
506
421
|
* ```typescript
|
|
507
|
-
* tracker.
|
|
508
|
-
*
|
|
509
|
-
*
|
|
422
|
+
* tracker.flowStarted({
|
|
423
|
+
* flowNames: ["login", "signup"],
|
|
424
|
+
* defaultFlowName: "login",
|
|
425
|
+
* touchpoint: "account",
|
|
510
426
|
* });
|
|
511
427
|
* ```
|
|
512
428
|
*/
|
|
513
|
-
|
|
429
|
+
flowStarted(data: FlowStarted | MultiFlowStarted, tags?: Record<string, string>): void;
|
|
514
430
|
/**
|
|
515
|
-
* Track when the
|
|
431
|
+
* Track when the user commits to a specific flow.
|
|
516
432
|
*
|
|
517
433
|
* @remarks
|
|
518
|
-
*
|
|
519
|
-
* for example
|
|
520
|
-
* This signals that the current authentication attempt was abandoned.
|
|
434
|
+
* Use this after presenting alternatives and once you know which path the user takes
|
|
435
|
+
* (for example when identifier checks route to login vs signup).
|
|
521
436
|
*
|
|
522
|
-
* @param data -
|
|
437
|
+
* @param data - Selected flow name.
|
|
523
438
|
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
524
|
-
* @param contexts - Optional contextual metadata attached to the event.
|
|
525
439
|
*
|
|
526
440
|
* @example
|
|
527
441
|
* ```typescript
|
|
528
|
-
* tracker.
|
|
442
|
+
* tracker.flowDecided({flowName: "signup"});
|
|
529
443
|
* ```
|
|
530
444
|
*/
|
|
531
|
-
|
|
445
|
+
flowDecided(data: FlowDecided, tags?: Record<string, string>): void;
|
|
532
446
|
/**
|
|
533
|
-
*
|
|
447
|
+
* Track when a flow successfully completes.
|
|
534
448
|
*
|
|
535
449
|
* @remarks
|
|
536
|
-
*
|
|
537
|
-
*
|
|
538
|
-
*
|
|
539
|
-
* interaction detection (e.g. paste, password-manager usage).
|
|
450
|
+
* Fire this when the user has finished the target flow end-to-end, such as completed login,
|
|
451
|
+
* signup, or recovery. If available, include `userId` and/or `identifier` so the event is
|
|
452
|
+
* linked to a user reference.
|
|
540
453
|
*
|
|
541
|
-
* @param
|
|
542
|
-
* @param data
|
|
454
|
+
* @param data - Finished flow name plus optional user reference fields.
|
|
543
455
|
* @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
456
|
*
|
|
547
457
|
* @example
|
|
548
458
|
* ```typescript
|
|
549
|
-
*
|
|
550
|
-
*
|
|
551
|
-
|
|
552
|
-
|
|
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" });
|
|
459
|
+
* tracker.flowFinished({
|
|
460
|
+
* flowName: "login",
|
|
461
|
+
* userId: "usr_123",
|
|
462
|
+
* identifier: "max@example.com",
|
|
463
|
+
* });
|
|
695
464
|
* ```
|
|
696
465
|
*/
|
|
697
|
-
|
|
466
|
+
flowFinished(data: FlowFinished, tags?: Record<string, string>): void;
|
|
698
467
|
/**
|
|
699
|
-
* Track when
|
|
468
|
+
* Track when an in-progress flow is reset and restarted.
|
|
700
469
|
*
|
|
701
470
|
* @remarks
|
|
702
|
-
*
|
|
703
|
-
*
|
|
704
|
-
* with {@link loginVisible}.
|
|
471
|
+
* Use this when users abandon the current path and return to the beginning of the same flow,
|
|
472
|
+
* for example after switching account/identifier and reopening the first step.
|
|
705
473
|
*
|
|
706
|
-
* @param data -
|
|
474
|
+
* @param data - Flow name being reset.
|
|
707
475
|
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
708
|
-
* @param contexts - Optional contextual metadata attached to the event.
|
|
709
476
|
*
|
|
710
477
|
* @example
|
|
711
478
|
* ```typescript
|
|
712
|
-
* tracker.
|
|
479
|
+
* tracker.flowReset({flowName: "login"});
|
|
713
480
|
* ```
|
|
714
481
|
*/
|
|
715
|
-
|
|
482
|
+
flowReset(data: FlowReset, tags?: Record<string, string>): void;
|
|
716
483
|
/**
|
|
717
|
-
* Track when
|
|
484
|
+
* Track when a flow is considered finished because another flow finished it implicitly.
|
|
718
485
|
*
|
|
719
486
|
* @remarks
|
|
720
|
-
*
|
|
721
|
-
*
|
|
722
|
-
*
|
|
487
|
+
* Use this for automatic completions where no separate explicit finish action happens in the
|
|
488
|
+
* current flow. Set `flowName` to the auto-finished flow and `finishedByFlowName` to the flow
|
|
489
|
+
* that caused it.
|
|
723
490
|
*
|
|
724
|
-
* @param data -
|
|
491
|
+
* @param data - Auto-finished flow, finishing flow, and optional user reference fields.
|
|
725
492
|
* @param tags - Optional key-value tags for filtering and segmentation.
|
|
726
|
-
* @param contexts - Optional contextual metadata attached to the event.
|
|
727
493
|
*
|
|
728
494
|
* @example
|
|
729
495
|
* ```typescript
|
|
730
|
-
* tracker.
|
|
496
|
+
* tracker.flowAutoFinished({
|
|
497
|
+
* flowName: "signup",
|
|
498
|
+
* finishedByFlowName: "login",
|
|
499
|
+
* userId: "usr_123",
|
|
500
|
+
* });
|
|
731
501
|
* ```
|
|
732
502
|
*/
|
|
733
|
-
|
|
503
|
+
flowAutoFinished(data: FlowAutoFinished, tags?: Record<string, string>): void;
|
|
734
504
|
/**
|
|
735
|
-
* Track when
|
|
505
|
+
* Track when you present authentication method choices to the user.
|
|
736
506
|
*
|
|
737
507
|
* @remarks
|
|
738
|
-
*
|
|
739
|
-
*
|
|
740
|
-
*
|
|
508
|
+
* Use this whenever a decision point is shown with a concrete method set, such as
|
|
509
|
+
* identifier entry options (`d1`) or post-identifier options (`d3`). Set
|
|
510
|
+
* `explicitDecisionValue` when the options are re-offered after a user action and you want
|
|
511
|
+
* to capture what triggered that transition.
|
|
741
512
|
*
|
|
742
|
-
* @param data -
|
|
513
|
+
* @param data - Decision identifier, offered options, and optional transition reason.
|
|
743
514
|
* @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
515
|
*
|
|
762
516
|
* @example
|
|
763
517
|
* ```typescript
|
|
764
|
-
* tracker.
|
|
765
|
-
* decisionName: "
|
|
766
|
-
*
|
|
518
|
+
* tracker.authMethodsDecisionStarted({
|
|
519
|
+
* decisionName: "d3",
|
|
520
|
+
* options: ["passkey", "social-google", "password", "reset-flow"],
|
|
767
521
|
* });
|
|
768
522
|
* ```
|
|
769
523
|
*/
|
|
770
|
-
|
|
771
|
-
|
|
524
|
+
authMethodsDecisionStarted(data: AuthMethodDecisionStarted, tags?: Record<string, string>): void;
|
|
525
|
+
authMethodsDecisionFinished(data: AuthMethodDecisionFinished, tags?: Record<string, string>): void;
|
|
526
|
+
authDecisionStarted(data: AuthDecisionStarted): void;
|
|
772
527
|
authDecisionFinished(data: AuthDecisionFinished): void;
|
|
528
|
+
passkeyLoginFullOperation(): PasskeyLoginOperationFull;
|
|
529
|
+
passkeyEnrollmentFullOperation(): PasskeyEnrollmentOperationFull;
|
|
530
|
+
passwordLoginFullOperation(autoTrackConfig?: PasswordLoginAutoTrackConfig): PasswordLoginOperationFull;
|
|
531
|
+
passwordEnrollmentFullOperation(autoTrackConfig?: PasswordEnrollmentAutoTrackConfig): PasswordEnrollmentOperationFull;
|
|
532
|
+
emailLinkOperationFull(): EmailLinkOperationFull;
|
|
533
|
+
emailOtpOperationFull(): EmailOtpOperationFull;
|
|
534
|
+
provideIdentifierOperationFull(inputHtmlField?: HTMLInputElement): OperationFullProvideIdentifierWithCUI;
|
|
535
|
+
socialLoginOperationFull(): SocialLoginOperationFull;
|
|
773
536
|
/**
|
|
774
|
-
*
|
|
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.
|
|
537
|
+
* Flush any pending events and release all resources (timers, event listeners).
|
|
959
538
|
*
|
|
960
539
|
* @remarks
|
|
961
|
-
*
|
|
962
|
-
*
|
|
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
|
-
* ```
|
|
540
|
+
* After calling destroy, the tracker must not be used. Operation objects
|
|
541
|
+
* returned by factory methods (e.g. `passwordLoginFullOperation`) that hold
|
|
542
|
+
* DOM references must be destroyed separately by the caller.
|
|
972
543
|
*/
|
|
973
|
-
|
|
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;
|
|
544
|
+
destroy(): Promise<void>;
|
|
996
545
|
/** @internal */
|
|
997
546
|
resetSession(): string;
|
|
998
547
|
}
|
|
@@ -1010,6 +559,7 @@ interface Transport {
|
|
|
1010
559
|
flush(timeout?: number): Promise<boolean>;
|
|
1011
560
|
}
|
|
1012
561
|
interface TransportOptions {
|
|
562
|
+
logger: Logger;
|
|
1013
563
|
url: string;
|
|
1014
564
|
headers?: Record<string, string>;
|
|
1015
565
|
}
|
|
@@ -1018,9 +568,12 @@ interface QueueOptions {
|
|
|
1018
568
|
batchSize?: number;
|
|
1019
569
|
flushInterval?: number;
|
|
1020
570
|
}
|
|
571
|
+
/**
|
|
572
|
+
* @remarks When `window` is defined, `visibilitychange` (when the document becomes hidden) and `pagehide` trigger a synchronous beacon flush (`flushSync`). Any thrown error in that path is logged as "Unexpected error in queue flushSync".
|
|
573
|
+
*/
|
|
1021
574
|
declare class RequestQueue {
|
|
575
|
+
private readonly logger;
|
|
1022
576
|
private transport;
|
|
1023
|
-
private readonly projectId;
|
|
1024
577
|
private sessionId;
|
|
1025
578
|
private readonly sdk;
|
|
1026
579
|
private options;
|
|
@@ -1029,12 +582,26 @@ declare class RequestQueue {
|
|
|
1029
582
|
private isFlushing;
|
|
1030
583
|
private onVisibilityChange;
|
|
1031
584
|
private onPageHide;
|
|
1032
|
-
constructor(
|
|
585
|
+
constructor(logger: Logger, transport: Transport, sessionId: string, sdk: SdkInfo, options?: QueueOptions);
|
|
1033
586
|
setSessionId(sessionId: string): void;
|
|
587
|
+
/**
|
|
588
|
+
* Error situations:
|
|
589
|
+
* - Any error while enqueueing or scheduling flush (including a synchronous throw from `flush`): log "Failed to enqueue event"
|
|
590
|
+
*/
|
|
1034
591
|
enqueue(event: Event): void;
|
|
592
|
+
/**
|
|
593
|
+
* Error situations:
|
|
594
|
+
* - Queue is empty: return without calling transport.send
|
|
595
|
+
* - A flush is already in progress: return without calling transport.send again
|
|
596
|
+
* - transport.send rejects or throws, or any other error in the try block: log "Unexpected error in queue flush"
|
|
597
|
+
*/
|
|
1035
598
|
flush(): Promise<void>;
|
|
1036
599
|
private setupLifecycleHooks;
|
|
1037
600
|
private flushSync;
|
|
601
|
+
/**
|
|
602
|
+
* Error situations:
|
|
603
|
+
* - Timer clearance or event listener removal throws: log "Failed to destroy queue lifecycle hooks"
|
|
604
|
+
*/
|
|
1038
605
|
destroy(): void;
|
|
1039
606
|
}
|
|
1040
607
|
|
|
@@ -1044,25 +611,83 @@ interface StorageEngine {
|
|
|
1044
611
|
removeItem(key: string): void;
|
|
1045
612
|
}
|
|
1046
613
|
declare class LocalStorage implements StorageEngine {
|
|
614
|
+
private logger;
|
|
615
|
+
constructor(logger: Logger);
|
|
616
|
+
/**
|
|
617
|
+
* Error situations:
|
|
618
|
+
* - localStorage is not available: return null
|
|
619
|
+
* - localStorage.getItem throws: catch exception, log error and return null
|
|
620
|
+
* - JSON.parse throws: catch exception, log error and return null
|
|
621
|
+
*/
|
|
1047
622
|
getItem<T>(key: string): T | null;
|
|
623
|
+
/**
|
|
624
|
+
* Error situations:
|
|
625
|
+
* - localStorage is not available: return without writing
|
|
626
|
+
* - localStorage.setItem throws: catch exception and log error
|
|
627
|
+
* - JSON.stringify throws: catch exception and log error
|
|
628
|
+
*/
|
|
1048
629
|
setItem<T>(key: string, value: T): void;
|
|
630
|
+
/**
|
|
631
|
+
* Error situations:
|
|
632
|
+
* - localStorage is not available: return without writing
|
|
633
|
+
* - localStorage.removeItem throws: catch exception and log error
|
|
634
|
+
*/
|
|
1049
635
|
removeItem(key: string): void;
|
|
1050
636
|
}
|
|
1051
637
|
declare class CookieStorage implements StorageEngine {
|
|
638
|
+
private logger;
|
|
1052
639
|
private domain?;
|
|
1053
|
-
constructor(domain?: string | undefined);
|
|
640
|
+
constructor(logger: Logger, domain?: string | undefined);
|
|
641
|
+
/**
|
|
642
|
+
* Error situations:
|
|
643
|
+
* - document is not available: return null
|
|
644
|
+
* - document.cookie read throws: catch exception, log error and return null
|
|
645
|
+
* - decodeURIComponent throws: catch exception, log error and return null
|
|
646
|
+
* - JSON.parse throws: catch exception, log error and return null
|
|
647
|
+
*/
|
|
1054
648
|
getItem<T>(key: string): T | null;
|
|
649
|
+
/**
|
|
650
|
+
* Error situations:
|
|
651
|
+
* - document is not available: return without writing
|
|
652
|
+
* - document.cookie write throws: catch exception and log error
|
|
653
|
+
* - JSON.stringify throws: catch exception and log error
|
|
654
|
+
*/
|
|
1055
655
|
setItem<T>(key: string, value: T): void;
|
|
656
|
+
/**
|
|
657
|
+
* Error situations:
|
|
658
|
+
* - document is not available: return without writing
|
|
659
|
+
* - document.cookie write throws: catch exception and log error
|
|
660
|
+
*/
|
|
1056
661
|
removeItem(key: string): void;
|
|
1057
662
|
}
|
|
1058
663
|
declare class SessionStorage implements StorageEngine {
|
|
664
|
+
private logger;
|
|
665
|
+
constructor(logger: Logger);
|
|
666
|
+
/**
|
|
667
|
+
* Error situations:
|
|
668
|
+
* - sessionStorage is not available: return null
|
|
669
|
+
* - sessionStorage.getItem throws: catch exception, log error and return null
|
|
670
|
+
* - JSON.parse throws: catch exception, log error and return null
|
|
671
|
+
*/
|
|
1059
672
|
getItem<T>(key: string): T | null;
|
|
673
|
+
/**
|
|
674
|
+
* Error situations:
|
|
675
|
+
* - sessionStorage is not available: return without writing
|
|
676
|
+
* - sessionStorage.setItem throws: catch exception and log error
|
|
677
|
+
* - JSON.stringify throws: catch exception and log error
|
|
678
|
+
*/
|
|
1060
679
|
setItem<T>(key: string, value: T): void;
|
|
680
|
+
/**
|
|
681
|
+
* Error situations:
|
|
682
|
+
* - sessionStorage is not available: return without writing
|
|
683
|
+
* - sessionStorage.removeItem throws: catch exception and log error
|
|
684
|
+
*/
|
|
1061
685
|
removeItem(key: string): void;
|
|
1062
686
|
}
|
|
1063
687
|
|
|
1064
688
|
declare function init(options: TrackerOptions): CorbadoTracker;
|
|
1065
689
|
declare function getTracker(): CorbadoTracker | undefined;
|
|
1066
690
|
declare function resetSession(): string | undefined;
|
|
691
|
+
declare function destroy(): Promise<void>;
|
|
1067
692
|
|
|
1068
|
-
export { type
|
|
693
|
+
export { type AuthDecisionFinished, type AuthDecisionStarted, AuthEventName, type AuthMethodDecisionFinished, type AuthMethodDecisionStarted, type AuthMethodType, type BaseEvent, type ClientCapabilities, type ClientEnvHandleMeta, type ClientEnvHandleMetaSource, CookieStorage, CorbadoTracker, type CreateLoggerOptions, type CustomEvent, type DeviceInfo, type DeviceInfoDataWeb, type DeviceType, EmailLinkOperationFull, type EmailLinkOperationPostResponseStart, type EmailLinkOperationSendStart, type EmailLinkOperationSpecType, type EmailOTPOperationPostResponseStart, type EmailOTPOperationSendOTPStart, type EmailOTPOperationSpecType, EmailOtpOperationFull, type Event, type EventBatch, type EventType, type FlowAutoFinished, type FlowDecided, type FlowFinished, type FlowReset, type FlowStarted, type FlowType, type JavaScriptHighEntropy, LocalStorage, type Logger, type MultiFlowStarted, type NormalizedError, OperationFull, OperationFullProvideIdentifierWithCUI, type PasskeyEnrollmentCeremonyFinished, type PasskeyEnrollmentCeremonyStart, type PasskeyEnrollmentGetOptionsFinished, type PasskeyEnrollmentGetOptionsStart, PasskeyEnrollmentOperationFull, type PasskeyLoginCUIGetOptionsFinished, type PasskeyLoginCUIGetOptionsStart, type PasskeyLoginCUISpecType, type PasskeyLoginCeremonyFinished, type PasskeyLoginCeremonyStart, type PasskeyLoginClientError, type PasskeyLoginFinish, type PasskeyLoginGetOptionsFinished, type PasskeyLoginGetOptionsStart, PasskeyLoginOperationFull, type PasskeyLoginStartable, type PasskeyLoginSubmitted, type PasskeyOperationEnrollmentExplicitSpecType, type PasskeyOperationLoginExplicitSpecType, type PasswordEnrollmentAutoTrackConfig, PasswordEnrollmentOperationFull, type PasswordEnrollmentTypedError, type PasswordLoginAutoTrackConfig, PasswordLoginOperationFull, type PasswordLoginTypedError, type PredefinedEvent, type ProvideIdentifierError, type ProvideIdentifierFinish, type ProvideIdentifierPostResponseStart, type ProvideIdentifierSpecType, type ProvideIdentifierStart, type QueueOptions, RequestQueue, SDK_NAME, SDK_VERSION, type SdkInfo, SessionStorage, type SocialLoginExchangeCodeFinished, type SocialLoginExchangeCodeStart, type SocialLoginGetRedirectUrlFinished, type SocialLoginGetRedirectUrlStart, SocialLoginOperationFull, type SocialLoginProviderType, type SocialLoginSpecType, type StepHelper, type StepOptions, type StorageEngine, type SubflowTrigger, type SubflowType, type TrackerOptions, type Transport, type TransportMakeRequestResponse, type TransportOptions, type UserReference, createLogger, destroy, getTracker, init, resetSession };
|