@corbado/observe 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/script.global.js +1 -1
- package/dist/index.d.mts +122 -15
- package/dist/index.d.ts +122 -15
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ interface SdkInfo {
|
|
|
3
3
|
version: string;
|
|
4
4
|
}
|
|
5
5
|
type EventType = "predefined" | "custom" | "error" | "identify";
|
|
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";
|
|
6
|
+
type AuthMethodType = "identifier-email" | "passkey-login-known-identifier" | "passkey-login-no-identifier" | "passkey-login-cui" | "passkey-login-immediate" | "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
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
8
|
type FlowType = "login" | "signup" | "recovery" | "enrollment" | (string & {});
|
|
9
9
|
type SocialLoginProviderType = "google" | "apple" | "facebook" | "github" | "microsoft" | "other";
|
|
@@ -264,6 +264,12 @@ interface SdkReliabilityConfig {
|
|
|
264
264
|
tph: boolean;
|
|
265
265
|
/** Flush-trigger switch: flush pending events when the integrator calls `destroy()`. Defaults to true. */
|
|
266
266
|
td: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Flush-trigger switch: keepalive flush requested by low-event tracker teardown on `pagehide`
|
|
269
|
+
* (delivers lows batched after the queue's own lifecycle flush already ran). Defaults to true —
|
|
270
|
+
* the historical behavior; can be disabled server-side to rely solely on the queue's triggers.
|
|
271
|
+
*/
|
|
272
|
+
tlf: boolean;
|
|
267
273
|
/**
|
|
268
274
|
* Event names that trigger an immediate flush when enqueued (e.g. `flow_finished`,
|
|
269
275
|
* `conversion`), so high-value events go out via a normal fetch while the page is still alive
|
|
@@ -276,6 +282,75 @@ interface SdkReliabilityConfig {
|
|
|
276
282
|
retry: SdkRetryConfig;
|
|
277
283
|
}
|
|
278
284
|
|
|
285
|
+
interface Logger {
|
|
286
|
+
debug(message: string, ...args: unknown[]): void;
|
|
287
|
+
info(message: string, ...args: unknown[]): void;
|
|
288
|
+
warn(message: string, ...args: unknown[]): void;
|
|
289
|
+
error(message: string, ...args: unknown[]): void;
|
|
290
|
+
critical(message: string, ...args: unknown[]): void;
|
|
291
|
+
}
|
|
292
|
+
interface CreateLoggerOptions {
|
|
293
|
+
debug: boolean;
|
|
294
|
+
}
|
|
295
|
+
declare function createLogger(options: CreateLoggerOptions): Logger;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Where low events go. `flushKeepalive` is requested on `pagehide` teardown so lows batched after
|
|
299
|
+
* the queue's own lifecycle flush still get out; operations wire it to the client's
|
|
300
|
+
* `lowEventFlushKeepalive()`, which is gated by the server-controlled `tlf` trigger switch
|
|
301
|
+
* (default true = historical behavior, can be disabled remotely).
|
|
302
|
+
*/
|
|
303
|
+
interface LowEventSink {
|
|
304
|
+
enqueueLowEvent(low: LowEvent): void;
|
|
305
|
+
flushKeepalive(): void;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Collects window-scoped "low" events around a WebAuthn ceremony: window focus/blur, document
|
|
310
|
+
* visibility changes and visualviewport resize/scroll (batched). The listener set mirrors
|
|
311
|
+
* connect-react's `installLowEventWindowListeners`; the event names match
|
|
312
|
+
* {@link LowEventInputTracker}'s vocabulary.
|
|
313
|
+
*
|
|
314
|
+
* Unlike {@link LowEventInputTracker} (anchored to an input field, active for the owning
|
|
315
|
+
* operation's lifetime), this tracker is armed only for the ceremony window: the owning operation
|
|
316
|
+
* arms it on `ceremony.start()` and schedules disarming shortly after the ceremony settles, so
|
|
317
|
+
* signals from the picker closing (focus return, dismiss animations) are still captured.
|
|
318
|
+
*
|
|
319
|
+
* Never triggers a flush — low events ride along on the queue's existing flush triggers.
|
|
320
|
+
*/
|
|
321
|
+
declare class LowEventWindowTracker {
|
|
322
|
+
private logger;
|
|
323
|
+
private sink;
|
|
324
|
+
private armed;
|
|
325
|
+
private destroyed;
|
|
326
|
+
private disarmTimer;
|
|
327
|
+
private resizeBatcher;
|
|
328
|
+
private scrollBatcher;
|
|
329
|
+
private boundHandlers;
|
|
330
|
+
constructor(logger: Logger, sink: LowEventSink);
|
|
331
|
+
/** Start listening. Idempotent; cancels a pending scheduled disarm (ceremony retry). */
|
|
332
|
+
arm(): void;
|
|
333
|
+
/**
|
|
334
|
+
* Disarm after `delayMs`. The tail keeps the listeners alive briefly after the ceremony settles:
|
|
335
|
+
* focus return and picker dismiss animations land after the WebAuthn promise resolves/rejects.
|
|
336
|
+
*/
|
|
337
|
+
scheduleDisarm(delayMs: number): void;
|
|
338
|
+
/** Stop listening and flush the viewport batchers into the queue. Idempotent. */
|
|
339
|
+
disarm(): void;
|
|
340
|
+
/** Disarm and refuse any further arming; for the owning operation's destroy(). */
|
|
341
|
+
destroy(): void;
|
|
342
|
+
private cancelScheduledDisarm;
|
|
343
|
+
private pushLow;
|
|
344
|
+
private handleVisibilityChange;
|
|
345
|
+
private flushBatchers;
|
|
346
|
+
private wrapHandler;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* How long window low-event listeners stay armed after a ceremony settles: focus return and
|
|
351
|
+
* picker dismiss animations land shortly after the WebAuthn promise resolves/rejects.
|
|
352
|
+
*/
|
|
353
|
+
declare const CEREMONY_LOW_EVENT_TAIL_MS = 1500;
|
|
279
354
|
type StepHelper<TStart = {}, TFinished = {}, TTypedError = never> = {
|
|
280
355
|
start: (data: TStart, options?: StepOptions) => void;
|
|
281
356
|
finished: (data: TFinished, options?: StepOptions) => void;
|
|
@@ -293,10 +368,23 @@ declare abstract class OperationFull {
|
|
|
293
368
|
protected subflowStepStarted(stepName: string, data: any, options?: StepOptions): void;
|
|
294
369
|
protected subflowStepFinished(stepName: string, data: any, options?: StepOptions): void;
|
|
295
370
|
protected subflowStepError(stepName: string, data: any, options?: StepOptions): void;
|
|
371
|
+
/**
|
|
372
|
+
* Decorate a (ceremony) step so window low-event collection follows its lifecycle: `start` arms
|
|
373
|
+
* the tracker, `finished`/`error`/`errorTyped` schedule disarming after
|
|
374
|
+
* {@link CEREMONY_LOW_EVENT_TAIL_MS}. A `start` during the tail (ceremony retry) keeps the
|
|
375
|
+
* tracker armed.
|
|
376
|
+
*/
|
|
377
|
+
protected withWindowLowEvents<S extends StepHelper<never, never, never>>(step: S, windowTracker: LowEventWindowTracker): S;
|
|
296
378
|
protected defineStep<TStart = {}, TFinished = {}, TTypedError = never>(stepName: string): StepHelper<TStart, TFinished, TTypedError>;
|
|
297
379
|
}
|
|
298
380
|
|
|
299
|
-
type PasskeyOperationLoginExplicitSpecType = "passkey-cui" | "passkey-known-identifier" | "passkey-no-identifier"
|
|
381
|
+
type PasskeyOperationLoginExplicitSpecType = "passkey-cui" | "passkey-known-identifier" | "passkey-no-identifier"
|
|
382
|
+
/**
|
|
383
|
+
* WebAuthn immediate mediation (`navigator.credentials.get({ uiMode: "immediate" })`, Chrome 149+):
|
|
384
|
+
* button-triggered, discoverable credentials only (empty allowList). Shows the account picker when
|
|
385
|
+
* a local credential exists, otherwise rejects instantly with NotAllowedError and shows no UI.
|
|
386
|
+
*/
|
|
387
|
+
| "passkey-immediate";
|
|
300
388
|
type PasskeyLoginGetOptionsStart = {
|
|
301
389
|
explicitSpecType?: PasskeyOperationLoginExplicitSpecType;
|
|
302
390
|
};
|
|
@@ -315,7 +403,14 @@ declare class PasskeyLoginOperationFull extends OperationFull {
|
|
|
315
403
|
readonly getOptions: StepHelper<PasskeyLoginGetOptionsStart, PasskeyLoginGetOptionsFinished>;
|
|
316
404
|
readonly ceremony: StepHelper<PasskeyLoginCeremonyStart, PasskeyLoginCeremonyFinished>;
|
|
317
405
|
readonly postResponse: StepHelper;
|
|
406
|
+
private lowEventTracker;
|
|
318
407
|
constructor(tracker: CorbadoTracker);
|
|
408
|
+
/**
|
|
409
|
+
* @deprecated `subflow_trigger` is not supported for passkey-login and will be removed in the
|
|
410
|
+
* next major version.
|
|
411
|
+
*/
|
|
412
|
+
trigger(data: SubflowTrigger, options?: StepOptions): void;
|
|
413
|
+
destroy(): void;
|
|
319
414
|
}
|
|
320
415
|
|
|
321
416
|
type EmailOTPOperationSpecType = "email-otp-login" | "email-otp-enrollment";
|
|
@@ -366,21 +461,11 @@ declare class PasskeyEnrollmentOperationFull extends OperationFull {
|
|
|
366
461
|
readonly getOptions: StepHelper<PasskeyEnrollmentGetOptionsStart, PasskeyEnrollmentGetOptionsFinished>;
|
|
367
462
|
readonly ceremony: StepHelper<PasskeyEnrollmentCeremonyStart, PasskeyEnrollmentCeremonyFinished>;
|
|
368
463
|
readonly postResponse: StepHelper;
|
|
464
|
+
private lowEventTracker;
|
|
369
465
|
constructor(tracker: CorbadoTracker);
|
|
466
|
+
destroy(): void;
|
|
370
467
|
}
|
|
371
468
|
|
|
372
|
-
interface Logger {
|
|
373
|
-
debug(message: string, ...args: unknown[]): void;
|
|
374
|
-
info(message: string, ...args: unknown[]): void;
|
|
375
|
-
warn(message: string, ...args: unknown[]): void;
|
|
376
|
-
error(message: string, ...args: unknown[]): void;
|
|
377
|
-
critical(message: string, ...args: unknown[]): void;
|
|
378
|
-
}
|
|
379
|
-
interface CreateLoggerOptions {
|
|
380
|
-
debug: boolean;
|
|
381
|
-
}
|
|
382
|
-
declare function createLogger(options: CreateLoggerOptions): Logger;
|
|
383
|
-
|
|
384
469
|
type PasswordLoginTypedError = {
|
|
385
470
|
code: PasswordLoginTypedErrorCode;
|
|
386
471
|
};
|
|
@@ -394,6 +479,11 @@ declare class PasswordLoginOperationFull extends OperationFull {
|
|
|
394
479
|
readonly postResponse: StepHelper<{}, {}, PasswordLoginTypedError>;
|
|
395
480
|
private lowEventTracker?;
|
|
396
481
|
constructor(tracker: CorbadoTracker, autoTrackConfig?: PasswordLoginAutoTrackConfig);
|
|
482
|
+
/**
|
|
483
|
+
* @deprecated `subflow_trigger` is not supported for password-login and will be removed in the
|
|
484
|
+
* next major version.
|
|
485
|
+
*/
|
|
486
|
+
trigger(data: SubflowTrigger, options?: StepOptions): void;
|
|
397
487
|
destroy(): void;
|
|
398
488
|
}
|
|
399
489
|
|
|
@@ -436,12 +526,20 @@ declare class OperationFullProvideIdentifierWithCUI {
|
|
|
436
526
|
private tracker;
|
|
437
527
|
private lowEventTracker?;
|
|
438
528
|
readonly cui: {
|
|
529
|
+
/**
|
|
530
|
+
* @deprecated `subflow_trigger` is not supported for the CUI part of provide-identifier and
|
|
531
|
+
* will be removed in the next major version.
|
|
532
|
+
*/
|
|
439
533
|
trigger: (data: SubflowTrigger, options?: StepOptions) => void;
|
|
440
534
|
getOptions: StepHelper<PasskeyLoginCUIGetOptionsStart, PasskeyLoginCUIGetOptionsFinished>;
|
|
441
535
|
ceremony: StepHelper<CUICeremonyStart, PasskeyLoginCeremonyFinished, PasskeyLoginCUITypedError>;
|
|
442
536
|
postResponse: StepHelper;
|
|
443
537
|
};
|
|
444
538
|
readonly provideIdentifier: {
|
|
539
|
+
/**
|
|
540
|
+
* @deprecated `subflow_trigger` is not supported for provide-identifier and will be removed
|
|
541
|
+
* in the next major version.
|
|
542
|
+
*/
|
|
445
543
|
trigger: (data: SubflowTrigger, options?: StepOptions) => void;
|
|
446
544
|
postResponse: StepHelper<ProvideIdentifierPostResponseStart>;
|
|
447
545
|
};
|
|
@@ -707,6 +805,14 @@ declare class CorbadoTracker {
|
|
|
707
805
|
* @internal
|
|
708
806
|
*/
|
|
709
807
|
flushKeepalive(): void;
|
|
808
|
+
/**
|
|
809
|
+
* Keepalive flush requested by a low-event tracker's `pagehide` teardown. Gated by the
|
|
810
|
+
* server-controlled trigger switch `tlf` (boot-snapshot, default true = historical behavior):
|
|
811
|
+
* disabling it server-side makes low-event delivery rely solely on the queue's own triggers.
|
|
812
|
+
*
|
|
813
|
+
* @internal
|
|
814
|
+
*/
|
|
815
|
+
lowEventFlushKeepalive(): void;
|
|
710
816
|
passkeyLoginFullOperation(): PasskeyLoginOperationFull;
|
|
711
817
|
passkeyEnrollmentFullOperation(): PasskeyEnrollmentOperationFull;
|
|
712
818
|
passwordLoginFullOperation(autoTrackConfig?: PasswordLoginAutoTrackConfig): PasswordLoginOperationFull;
|
|
@@ -881,6 +987,7 @@ declare class RequestQueue {
|
|
|
881
987
|
private lowsQueue;
|
|
882
988
|
private timer;
|
|
883
989
|
private isFlushing;
|
|
990
|
+
private destroyed;
|
|
884
991
|
/**
|
|
885
992
|
* True when something was enqueued (or recovered) since the last sync flush. visibilitychange,
|
|
886
993
|
* pagehide and per-input flushKeepalive calls all funnel into flushSync; this flag makes the
|
|
@@ -1108,4 +1215,4 @@ declare function getTracker(): CorbadoTracker | undefined;
|
|
|
1108
1215
|
declare function resetSession(): string | undefined;
|
|
1109
1216
|
declare function destroy(): Promise<void>;
|
|
1110
1217
|
|
|
1111
|
-
export { type AuthDecisionFinished, type AuthDecisionStarted, AuthEventName, type AuthMethodDecisionFinished, type AuthMethodDecisionStarted, type AuthMethodType, type BaseEvent, CONFIG_BOUNDS, CONFIG_REQUEST_HEADER, CONFIG_STORAGE_KEY, type ClientCapabilities, type ClientEnvHandleMeta, type ClientEnvHandleMetaSource, type Conversion, CookieStorage, CorbadoTracker, type CreateLoggerOptions, type CustomEvent, DEFAULT_FLUSH_INTERVAL_MS, DEFAULT_MAX_ENTRIES, DEFAULT_MAX_SERIALIZED_LENGTH, DEFAULT_RELIABILITY_CONFIG, DEFAULT_SESSION_INACTIVITY_MS, type DeviceInfo, type DeviceInfoCollectionError, type DeviceInfoDataWeb, type DeviceType, EmailLinkOperationFull, type EmailLinkOperationPostResponseStart, type EmailLinkOperationSendStart, type EmailLinkOperationSpecType, type EmailOTPOperationPostResponseStart, type EmailOTPOperationSendOTPStart, type EmailOTPOperationSpecType, EmailOtpOperationFull, type Event, type EventBatch, type EventBatchMeta, type EventMeta, EventStore, type EventType, type FlowAutoFinished, type FlowDecided, type FlowFinished, type FlowReset, type FlowStarted, type FlowType, type JavaScriptHighEntropy, LocalStorage, type Logger, type LowEvent, type MultiFlowReset, type MultiFlowStarted, type NormalizedError, OUTBOX_LOCK_NAME, OUTBOX_STORAGE_KEY, OperationFull, OperationFullProvideIdentifierWithCUI, type OutboxEntry, 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, type SdkReliabilityConfig, type SdkRetryConfig, 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, cacheConfig, createLogger, destroy, getTracker, init, loadCachedConfig, parseReliabilityConfig, resetSession };
|
|
1218
|
+
export { type AuthDecisionFinished, type AuthDecisionStarted, AuthEventName, type AuthMethodDecisionFinished, type AuthMethodDecisionStarted, type AuthMethodType, type BaseEvent, CEREMONY_LOW_EVENT_TAIL_MS, CONFIG_BOUNDS, CONFIG_REQUEST_HEADER, CONFIG_STORAGE_KEY, type ClientCapabilities, type ClientEnvHandleMeta, type ClientEnvHandleMetaSource, type Conversion, CookieStorage, CorbadoTracker, type CreateLoggerOptions, type CustomEvent, DEFAULT_FLUSH_INTERVAL_MS, DEFAULT_MAX_ENTRIES, DEFAULT_MAX_SERIALIZED_LENGTH, DEFAULT_RELIABILITY_CONFIG, DEFAULT_SESSION_INACTIVITY_MS, type DeviceInfo, type DeviceInfoCollectionError, type DeviceInfoDataWeb, type DeviceType, EmailLinkOperationFull, type EmailLinkOperationPostResponseStart, type EmailLinkOperationSendStart, type EmailLinkOperationSpecType, type EmailOTPOperationPostResponseStart, type EmailOTPOperationSendOTPStart, type EmailOTPOperationSpecType, EmailOtpOperationFull, type Event, type EventBatch, type EventBatchMeta, type EventMeta, EventStore, type EventType, type FlowAutoFinished, type FlowDecided, type FlowFinished, type FlowReset, type FlowStarted, type FlowType, type JavaScriptHighEntropy, LocalStorage, type Logger, type LowEvent, type MultiFlowReset, type MultiFlowStarted, type NormalizedError, OUTBOX_LOCK_NAME, OUTBOX_STORAGE_KEY, OperationFull, OperationFullProvideIdentifierWithCUI, type OutboxEntry, 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, type SdkReliabilityConfig, type SdkRetryConfig, 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, cacheConfig, createLogger, destroy, getTracker, init, loadCachedConfig, parseReliabilityConfig, resetSession };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ interface SdkInfo {
|
|
|
3
3
|
version: string;
|
|
4
4
|
}
|
|
5
5
|
type EventType = "predefined" | "custom" | "error" | "identify";
|
|
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";
|
|
6
|
+
type AuthMethodType = "identifier-email" | "passkey-login-known-identifier" | "passkey-login-no-identifier" | "passkey-login-cui" | "passkey-login-immediate" | "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
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
8
|
type FlowType = "login" | "signup" | "recovery" | "enrollment" | (string & {});
|
|
9
9
|
type SocialLoginProviderType = "google" | "apple" | "facebook" | "github" | "microsoft" | "other";
|
|
@@ -264,6 +264,12 @@ interface SdkReliabilityConfig {
|
|
|
264
264
|
tph: boolean;
|
|
265
265
|
/** Flush-trigger switch: flush pending events when the integrator calls `destroy()`. Defaults to true. */
|
|
266
266
|
td: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Flush-trigger switch: keepalive flush requested by low-event tracker teardown on `pagehide`
|
|
269
|
+
* (delivers lows batched after the queue's own lifecycle flush already ran). Defaults to true —
|
|
270
|
+
* the historical behavior; can be disabled server-side to rely solely on the queue's triggers.
|
|
271
|
+
*/
|
|
272
|
+
tlf: boolean;
|
|
267
273
|
/**
|
|
268
274
|
* Event names that trigger an immediate flush when enqueued (e.g. `flow_finished`,
|
|
269
275
|
* `conversion`), so high-value events go out via a normal fetch while the page is still alive
|
|
@@ -276,6 +282,75 @@ interface SdkReliabilityConfig {
|
|
|
276
282
|
retry: SdkRetryConfig;
|
|
277
283
|
}
|
|
278
284
|
|
|
285
|
+
interface Logger {
|
|
286
|
+
debug(message: string, ...args: unknown[]): void;
|
|
287
|
+
info(message: string, ...args: unknown[]): void;
|
|
288
|
+
warn(message: string, ...args: unknown[]): void;
|
|
289
|
+
error(message: string, ...args: unknown[]): void;
|
|
290
|
+
critical(message: string, ...args: unknown[]): void;
|
|
291
|
+
}
|
|
292
|
+
interface CreateLoggerOptions {
|
|
293
|
+
debug: boolean;
|
|
294
|
+
}
|
|
295
|
+
declare function createLogger(options: CreateLoggerOptions): Logger;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Where low events go. `flushKeepalive` is requested on `pagehide` teardown so lows batched after
|
|
299
|
+
* the queue's own lifecycle flush still get out; operations wire it to the client's
|
|
300
|
+
* `lowEventFlushKeepalive()`, which is gated by the server-controlled `tlf` trigger switch
|
|
301
|
+
* (default true = historical behavior, can be disabled remotely).
|
|
302
|
+
*/
|
|
303
|
+
interface LowEventSink {
|
|
304
|
+
enqueueLowEvent(low: LowEvent): void;
|
|
305
|
+
flushKeepalive(): void;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Collects window-scoped "low" events around a WebAuthn ceremony: window focus/blur, document
|
|
310
|
+
* visibility changes and visualviewport resize/scroll (batched). The listener set mirrors
|
|
311
|
+
* connect-react's `installLowEventWindowListeners`; the event names match
|
|
312
|
+
* {@link LowEventInputTracker}'s vocabulary.
|
|
313
|
+
*
|
|
314
|
+
* Unlike {@link LowEventInputTracker} (anchored to an input field, active for the owning
|
|
315
|
+
* operation's lifetime), this tracker is armed only for the ceremony window: the owning operation
|
|
316
|
+
* arms it on `ceremony.start()` and schedules disarming shortly after the ceremony settles, so
|
|
317
|
+
* signals from the picker closing (focus return, dismiss animations) are still captured.
|
|
318
|
+
*
|
|
319
|
+
* Never triggers a flush — low events ride along on the queue's existing flush triggers.
|
|
320
|
+
*/
|
|
321
|
+
declare class LowEventWindowTracker {
|
|
322
|
+
private logger;
|
|
323
|
+
private sink;
|
|
324
|
+
private armed;
|
|
325
|
+
private destroyed;
|
|
326
|
+
private disarmTimer;
|
|
327
|
+
private resizeBatcher;
|
|
328
|
+
private scrollBatcher;
|
|
329
|
+
private boundHandlers;
|
|
330
|
+
constructor(logger: Logger, sink: LowEventSink);
|
|
331
|
+
/** Start listening. Idempotent; cancels a pending scheduled disarm (ceremony retry). */
|
|
332
|
+
arm(): void;
|
|
333
|
+
/**
|
|
334
|
+
* Disarm after `delayMs`. The tail keeps the listeners alive briefly after the ceremony settles:
|
|
335
|
+
* focus return and picker dismiss animations land after the WebAuthn promise resolves/rejects.
|
|
336
|
+
*/
|
|
337
|
+
scheduleDisarm(delayMs: number): void;
|
|
338
|
+
/** Stop listening and flush the viewport batchers into the queue. Idempotent. */
|
|
339
|
+
disarm(): void;
|
|
340
|
+
/** Disarm and refuse any further arming; for the owning operation's destroy(). */
|
|
341
|
+
destroy(): void;
|
|
342
|
+
private cancelScheduledDisarm;
|
|
343
|
+
private pushLow;
|
|
344
|
+
private handleVisibilityChange;
|
|
345
|
+
private flushBatchers;
|
|
346
|
+
private wrapHandler;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* How long window low-event listeners stay armed after a ceremony settles: focus return and
|
|
351
|
+
* picker dismiss animations land shortly after the WebAuthn promise resolves/rejects.
|
|
352
|
+
*/
|
|
353
|
+
declare const CEREMONY_LOW_EVENT_TAIL_MS = 1500;
|
|
279
354
|
type StepHelper<TStart = {}, TFinished = {}, TTypedError = never> = {
|
|
280
355
|
start: (data: TStart, options?: StepOptions) => void;
|
|
281
356
|
finished: (data: TFinished, options?: StepOptions) => void;
|
|
@@ -293,10 +368,23 @@ declare abstract class OperationFull {
|
|
|
293
368
|
protected subflowStepStarted(stepName: string, data: any, options?: StepOptions): void;
|
|
294
369
|
protected subflowStepFinished(stepName: string, data: any, options?: StepOptions): void;
|
|
295
370
|
protected subflowStepError(stepName: string, data: any, options?: StepOptions): void;
|
|
371
|
+
/**
|
|
372
|
+
* Decorate a (ceremony) step so window low-event collection follows its lifecycle: `start` arms
|
|
373
|
+
* the tracker, `finished`/`error`/`errorTyped` schedule disarming after
|
|
374
|
+
* {@link CEREMONY_LOW_EVENT_TAIL_MS}. A `start` during the tail (ceremony retry) keeps the
|
|
375
|
+
* tracker armed.
|
|
376
|
+
*/
|
|
377
|
+
protected withWindowLowEvents<S extends StepHelper<never, never, never>>(step: S, windowTracker: LowEventWindowTracker): S;
|
|
296
378
|
protected defineStep<TStart = {}, TFinished = {}, TTypedError = never>(stepName: string): StepHelper<TStart, TFinished, TTypedError>;
|
|
297
379
|
}
|
|
298
380
|
|
|
299
|
-
type PasskeyOperationLoginExplicitSpecType = "passkey-cui" | "passkey-known-identifier" | "passkey-no-identifier"
|
|
381
|
+
type PasskeyOperationLoginExplicitSpecType = "passkey-cui" | "passkey-known-identifier" | "passkey-no-identifier"
|
|
382
|
+
/**
|
|
383
|
+
* WebAuthn immediate mediation (`navigator.credentials.get({ uiMode: "immediate" })`, Chrome 149+):
|
|
384
|
+
* button-triggered, discoverable credentials only (empty allowList). Shows the account picker when
|
|
385
|
+
* a local credential exists, otherwise rejects instantly with NotAllowedError and shows no UI.
|
|
386
|
+
*/
|
|
387
|
+
| "passkey-immediate";
|
|
300
388
|
type PasskeyLoginGetOptionsStart = {
|
|
301
389
|
explicitSpecType?: PasskeyOperationLoginExplicitSpecType;
|
|
302
390
|
};
|
|
@@ -315,7 +403,14 @@ declare class PasskeyLoginOperationFull extends OperationFull {
|
|
|
315
403
|
readonly getOptions: StepHelper<PasskeyLoginGetOptionsStart, PasskeyLoginGetOptionsFinished>;
|
|
316
404
|
readonly ceremony: StepHelper<PasskeyLoginCeremonyStart, PasskeyLoginCeremonyFinished>;
|
|
317
405
|
readonly postResponse: StepHelper;
|
|
406
|
+
private lowEventTracker;
|
|
318
407
|
constructor(tracker: CorbadoTracker);
|
|
408
|
+
/**
|
|
409
|
+
* @deprecated `subflow_trigger` is not supported for passkey-login and will be removed in the
|
|
410
|
+
* next major version.
|
|
411
|
+
*/
|
|
412
|
+
trigger(data: SubflowTrigger, options?: StepOptions): void;
|
|
413
|
+
destroy(): void;
|
|
319
414
|
}
|
|
320
415
|
|
|
321
416
|
type EmailOTPOperationSpecType = "email-otp-login" | "email-otp-enrollment";
|
|
@@ -366,21 +461,11 @@ declare class PasskeyEnrollmentOperationFull extends OperationFull {
|
|
|
366
461
|
readonly getOptions: StepHelper<PasskeyEnrollmentGetOptionsStart, PasskeyEnrollmentGetOptionsFinished>;
|
|
367
462
|
readonly ceremony: StepHelper<PasskeyEnrollmentCeremonyStart, PasskeyEnrollmentCeremonyFinished>;
|
|
368
463
|
readonly postResponse: StepHelper;
|
|
464
|
+
private lowEventTracker;
|
|
369
465
|
constructor(tracker: CorbadoTracker);
|
|
466
|
+
destroy(): void;
|
|
370
467
|
}
|
|
371
468
|
|
|
372
|
-
interface Logger {
|
|
373
|
-
debug(message: string, ...args: unknown[]): void;
|
|
374
|
-
info(message: string, ...args: unknown[]): void;
|
|
375
|
-
warn(message: string, ...args: unknown[]): void;
|
|
376
|
-
error(message: string, ...args: unknown[]): void;
|
|
377
|
-
critical(message: string, ...args: unknown[]): void;
|
|
378
|
-
}
|
|
379
|
-
interface CreateLoggerOptions {
|
|
380
|
-
debug: boolean;
|
|
381
|
-
}
|
|
382
|
-
declare function createLogger(options: CreateLoggerOptions): Logger;
|
|
383
|
-
|
|
384
469
|
type PasswordLoginTypedError = {
|
|
385
470
|
code: PasswordLoginTypedErrorCode;
|
|
386
471
|
};
|
|
@@ -394,6 +479,11 @@ declare class PasswordLoginOperationFull extends OperationFull {
|
|
|
394
479
|
readonly postResponse: StepHelper<{}, {}, PasswordLoginTypedError>;
|
|
395
480
|
private lowEventTracker?;
|
|
396
481
|
constructor(tracker: CorbadoTracker, autoTrackConfig?: PasswordLoginAutoTrackConfig);
|
|
482
|
+
/**
|
|
483
|
+
* @deprecated `subflow_trigger` is not supported for password-login and will be removed in the
|
|
484
|
+
* next major version.
|
|
485
|
+
*/
|
|
486
|
+
trigger(data: SubflowTrigger, options?: StepOptions): void;
|
|
397
487
|
destroy(): void;
|
|
398
488
|
}
|
|
399
489
|
|
|
@@ -436,12 +526,20 @@ declare class OperationFullProvideIdentifierWithCUI {
|
|
|
436
526
|
private tracker;
|
|
437
527
|
private lowEventTracker?;
|
|
438
528
|
readonly cui: {
|
|
529
|
+
/**
|
|
530
|
+
* @deprecated `subflow_trigger` is not supported for the CUI part of provide-identifier and
|
|
531
|
+
* will be removed in the next major version.
|
|
532
|
+
*/
|
|
439
533
|
trigger: (data: SubflowTrigger, options?: StepOptions) => void;
|
|
440
534
|
getOptions: StepHelper<PasskeyLoginCUIGetOptionsStart, PasskeyLoginCUIGetOptionsFinished>;
|
|
441
535
|
ceremony: StepHelper<CUICeremonyStart, PasskeyLoginCeremonyFinished, PasskeyLoginCUITypedError>;
|
|
442
536
|
postResponse: StepHelper;
|
|
443
537
|
};
|
|
444
538
|
readonly provideIdentifier: {
|
|
539
|
+
/**
|
|
540
|
+
* @deprecated `subflow_trigger` is not supported for provide-identifier and will be removed
|
|
541
|
+
* in the next major version.
|
|
542
|
+
*/
|
|
445
543
|
trigger: (data: SubflowTrigger, options?: StepOptions) => void;
|
|
446
544
|
postResponse: StepHelper<ProvideIdentifierPostResponseStart>;
|
|
447
545
|
};
|
|
@@ -707,6 +805,14 @@ declare class CorbadoTracker {
|
|
|
707
805
|
* @internal
|
|
708
806
|
*/
|
|
709
807
|
flushKeepalive(): void;
|
|
808
|
+
/**
|
|
809
|
+
* Keepalive flush requested by a low-event tracker's `pagehide` teardown. Gated by the
|
|
810
|
+
* server-controlled trigger switch `tlf` (boot-snapshot, default true = historical behavior):
|
|
811
|
+
* disabling it server-side makes low-event delivery rely solely on the queue's own triggers.
|
|
812
|
+
*
|
|
813
|
+
* @internal
|
|
814
|
+
*/
|
|
815
|
+
lowEventFlushKeepalive(): void;
|
|
710
816
|
passkeyLoginFullOperation(): PasskeyLoginOperationFull;
|
|
711
817
|
passkeyEnrollmentFullOperation(): PasskeyEnrollmentOperationFull;
|
|
712
818
|
passwordLoginFullOperation(autoTrackConfig?: PasswordLoginAutoTrackConfig): PasswordLoginOperationFull;
|
|
@@ -881,6 +987,7 @@ declare class RequestQueue {
|
|
|
881
987
|
private lowsQueue;
|
|
882
988
|
private timer;
|
|
883
989
|
private isFlushing;
|
|
990
|
+
private destroyed;
|
|
884
991
|
/**
|
|
885
992
|
* True when something was enqueued (or recovered) since the last sync flush. visibilitychange,
|
|
886
993
|
* pagehide and per-input flushKeepalive calls all funnel into flushSync; this flag makes the
|
|
@@ -1108,4 +1215,4 @@ declare function getTracker(): CorbadoTracker | undefined;
|
|
|
1108
1215
|
declare function resetSession(): string | undefined;
|
|
1109
1216
|
declare function destroy(): Promise<void>;
|
|
1110
1217
|
|
|
1111
|
-
export { type AuthDecisionFinished, type AuthDecisionStarted, AuthEventName, type AuthMethodDecisionFinished, type AuthMethodDecisionStarted, type AuthMethodType, type BaseEvent, CONFIG_BOUNDS, CONFIG_REQUEST_HEADER, CONFIG_STORAGE_KEY, type ClientCapabilities, type ClientEnvHandleMeta, type ClientEnvHandleMetaSource, type Conversion, CookieStorage, CorbadoTracker, type CreateLoggerOptions, type CustomEvent, DEFAULT_FLUSH_INTERVAL_MS, DEFAULT_MAX_ENTRIES, DEFAULT_MAX_SERIALIZED_LENGTH, DEFAULT_RELIABILITY_CONFIG, DEFAULT_SESSION_INACTIVITY_MS, type DeviceInfo, type DeviceInfoCollectionError, type DeviceInfoDataWeb, type DeviceType, EmailLinkOperationFull, type EmailLinkOperationPostResponseStart, type EmailLinkOperationSendStart, type EmailLinkOperationSpecType, type EmailOTPOperationPostResponseStart, type EmailOTPOperationSendOTPStart, type EmailOTPOperationSpecType, EmailOtpOperationFull, type Event, type EventBatch, type EventBatchMeta, type EventMeta, EventStore, type EventType, type FlowAutoFinished, type FlowDecided, type FlowFinished, type FlowReset, type FlowStarted, type FlowType, type JavaScriptHighEntropy, LocalStorage, type Logger, type LowEvent, type MultiFlowReset, type MultiFlowStarted, type NormalizedError, OUTBOX_LOCK_NAME, OUTBOX_STORAGE_KEY, OperationFull, OperationFullProvideIdentifierWithCUI, type OutboxEntry, 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, type SdkReliabilityConfig, type SdkRetryConfig, 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, cacheConfig, createLogger, destroy, getTracker, init, loadCachedConfig, parseReliabilityConfig, resetSession };
|
|
1218
|
+
export { type AuthDecisionFinished, type AuthDecisionStarted, AuthEventName, type AuthMethodDecisionFinished, type AuthMethodDecisionStarted, type AuthMethodType, type BaseEvent, CEREMONY_LOW_EVENT_TAIL_MS, CONFIG_BOUNDS, CONFIG_REQUEST_HEADER, CONFIG_STORAGE_KEY, type ClientCapabilities, type ClientEnvHandleMeta, type ClientEnvHandleMetaSource, type Conversion, CookieStorage, CorbadoTracker, type CreateLoggerOptions, type CustomEvent, DEFAULT_FLUSH_INTERVAL_MS, DEFAULT_MAX_ENTRIES, DEFAULT_MAX_SERIALIZED_LENGTH, DEFAULT_RELIABILITY_CONFIG, DEFAULT_SESSION_INACTIVITY_MS, type DeviceInfo, type DeviceInfoCollectionError, type DeviceInfoDataWeb, type DeviceType, EmailLinkOperationFull, type EmailLinkOperationPostResponseStart, type EmailLinkOperationSendStart, type EmailLinkOperationSpecType, type EmailOTPOperationPostResponseStart, type EmailOTPOperationSendOTPStart, type EmailOTPOperationSpecType, EmailOtpOperationFull, type Event, type EventBatch, type EventBatchMeta, type EventMeta, EventStore, type EventType, type FlowAutoFinished, type FlowDecided, type FlowFinished, type FlowReset, type FlowStarted, type FlowType, type JavaScriptHighEntropy, LocalStorage, type Logger, type LowEvent, type MultiFlowReset, type MultiFlowStarted, type NormalizedError, OUTBOX_LOCK_NAME, OUTBOX_STORAGE_KEY, OperationFull, OperationFullProvideIdentifierWithCUI, type OutboxEntry, 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, type SdkReliabilityConfig, type SdkRetryConfig, 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, cacheConfig, createLogger, destroy, getTracker, init, loadCachedConfig, parseReliabilityConfig, resetSession };
|