@corbado/observe 0.10.0 → 0.11.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 +84 -4
- package/dist/index.d.ts +84 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ interface SdkInfo {
|
|
|
4
4
|
}
|
|
5
5
|
type EventType = "predefined" | "custom" | "error" | "identify";
|
|
6
6
|
type AuthMethodType = "identifier-email" | "passkey-login-known-identifier" | "passkey-login-no-identifier" | "passkey-login-cui" | "passkey-login-immediate" | "passkey-enrollment" | "password-login" | "password-login-known-identifier" | "password-login-with-identifier" | "password-enrollment" | "email-otp" | "email-otp-login" | "email-otp-enrollment" | "email-link" | "email-link-login" | "email-link-enrollment" | "sms-otp" | "sms-otp-login" | "sms-otp-enrollment" | "social-google" | "social-apple" | "social-facebook" | "social-other" | "reset-flow" | "provide-data";
|
|
7
|
-
type SubflowType = "passkey-enrollment" | "passkey-login" | "email-otp" | "email-link" | "social-login" | "sms-otp" | "provide-identifier" | "provide-data" | "password-login" | "password-enrollment" | "totp" | "app-confirmation";
|
|
7
|
+
type SubflowType = "passkey-enrollment" | "passkey-login" | "email-otp" | "email-link" | "social-login" | "sms-otp" | "provide-identifier" | "provide-data" | "password-login" | "password-enrollment" | "totp" | "app-confirmation" | "captcha";
|
|
8
8
|
type FlowType = "login" | "signup" | "recovery" | "enrollment" | (string & {});
|
|
9
9
|
type SocialLoginProviderType = "google" | "apple" | "facebook" | "github" | "microsoft" | "other";
|
|
10
10
|
declare enum AuthEventName {
|
|
@@ -59,7 +59,8 @@ type UserReference = {
|
|
|
59
59
|
*/
|
|
60
60
|
type NormalizedError = {
|
|
61
61
|
name?: string;
|
|
62
|
-
|
|
62
|
+
code?: string;
|
|
63
|
+
message?: string;
|
|
63
64
|
};
|
|
64
65
|
type FlowStarted = {
|
|
65
66
|
flowName: FlowType;
|
|
@@ -211,6 +212,12 @@ interface EventBatchMeta {
|
|
|
211
212
|
}
|
|
212
213
|
interface EventMeta {
|
|
213
214
|
trackingSourcePath: string;
|
|
215
|
+
/**
|
|
216
|
+
* Per-tab id (uuidv7, `sessionStorage`-scoped) of the tab that CREATED this event, stamped at
|
|
217
|
+
* `track()` time. Late-flushed events keep the tab they originated in regardless of which page
|
|
218
|
+
* delivers them; the backend uses this to split interleaved multi-tab streams per session.
|
|
219
|
+
*/
|
|
220
|
+
tabId?: string;
|
|
214
221
|
}
|
|
215
222
|
interface EventBatch {
|
|
216
223
|
sessionId: string;
|
|
@@ -481,6 +488,13 @@ declare abstract class OperationFull {
|
|
|
481
488
|
}
|
|
482
489
|
|
|
483
490
|
type PasskeyOperationLoginExplicitSpecType = "passkey-cui" | "passkey-known-identifier" | "passkey-no-identifier"
|
|
491
|
+
/**
|
|
492
|
+
* The `-auto` variants are the same two ceremonies started by the integration rather than by a
|
|
493
|
+
* user gesture — `navigator.credentials.get()` called without user activation, so the passkey
|
|
494
|
+
* prompt appears on its own. Unlike `passkey-immediate` they still run after the auth-method
|
|
495
|
+
* decision is rendered and attribute to the same decision option as their manual counterpart.
|
|
496
|
+
*/
|
|
497
|
+
| "passkey-known-identifier-auto" | "passkey-no-identifier-auto"
|
|
484
498
|
/**
|
|
485
499
|
* WebAuthn immediate mediation (`navigator.credentials.get({ uiMode: "immediate" })`, Chrome 149+):
|
|
486
500
|
* button-triggered, discoverable credentials only (empty allowList). Shows the account picker when
|
|
@@ -769,6 +783,23 @@ declare class AppConfirmationOperationFull extends OperationFull {
|
|
|
769
783
|
constructor(tracker: CorbadoTracker, explicitSpecType?: AppConfirmationOperationSpecType);
|
|
770
784
|
}
|
|
771
785
|
|
|
786
|
+
/**
|
|
787
|
+
* Which captcha widget the integration observed.
|
|
788
|
+
* - `visible`: a widget presenting UI to the user. Can require interaction.
|
|
789
|
+
* - `invisible`: a widget that never presents UI and always solves itself.
|
|
790
|
+
*/
|
|
791
|
+
type CaptchaOperationSpecType = "visible" | "invisible";
|
|
792
|
+
type CaptchaOperationConfig = {
|
|
793
|
+
explicitSpecType?: CaptchaOperationSpecType;
|
|
794
|
+
};
|
|
795
|
+
declare class CaptchaOperationFull extends OperationFull {
|
|
796
|
+
/** Step representing the captcha challenge ceremony. */
|
|
797
|
+
readonly ceremony: StepHelper;
|
|
798
|
+
/** Submission of the captcha token and the server's verdict on it. */
|
|
799
|
+
readonly postResponse: StepHelper;
|
|
800
|
+
constructor(tracker: CorbadoTracker, config?: CaptchaOperationConfig);
|
|
801
|
+
}
|
|
802
|
+
|
|
772
803
|
type ProvideDataOperationSpecType = "signup" | "login" | "recovery" | "enrollment";
|
|
773
804
|
type ProvideDataOperationStart = {
|
|
774
805
|
/** Stable name of the data field collected by this subflow, when known. */
|
|
@@ -839,6 +870,12 @@ declare class CorbadoTracker {
|
|
|
839
870
|
*/
|
|
840
871
|
private config;
|
|
841
872
|
private deviceInfoManager;
|
|
873
|
+
private deviceCollector;
|
|
874
|
+
/**
|
|
875
|
+
* Cached per-tab id stamped onto every event's meta (see {@link EventMeta.tabId}). Resolved
|
|
876
|
+
* lazily from the collector's sessionStorage-backed id; stable for the whole page lifetime.
|
|
877
|
+
*/
|
|
878
|
+
private eventTabId?;
|
|
842
879
|
private seq;
|
|
843
880
|
/**
|
|
844
881
|
* When the continuity record's `lastActiveAt` was last persisted. Throttles that write inside the
|
|
@@ -902,7 +939,7 @@ declare class CorbadoTracker {
|
|
|
902
939
|
*/
|
|
903
940
|
private resolveExperiments;
|
|
904
941
|
private isTrackingBlocked;
|
|
905
|
-
private
|
|
942
|
+
private resolveSessionId;
|
|
906
943
|
/**
|
|
907
944
|
* Resolve the session id from localStorage so it survives reloads and is shared across tabs of the
|
|
908
945
|
* same browser. Rotates after `config.sessionInactivityMs` of inactivity (server-controlled,
|
|
@@ -940,6 +977,11 @@ declare class CorbadoTracker {
|
|
|
940
977
|
*/
|
|
941
978
|
private nextSeq;
|
|
942
979
|
private resolveTrackingSourcePath;
|
|
980
|
+
/**
|
|
981
|
+
* Per-tab id for event meta, cached after the first successful resolution: the id is
|
|
982
|
+
* sessionStorage-backed and stable for the whole page lifetime.
|
|
983
|
+
*/
|
|
984
|
+
private resolveEventTabId;
|
|
943
985
|
trackSubflowStarted(subflowType: SubflowType, data: Record<string, any>, options?: StepOptions): void;
|
|
944
986
|
trackSubflowTrigger(subflowType: SubflowType, data: Record<string, any>, options?: StepOptions): void;
|
|
945
987
|
trackSubflowStepStarted(subflowType: SubflowType, stepName: string, data: Record<string, any>, options?: StepOptions, ignoreAsInteraction?: boolean): void;
|
|
@@ -1167,6 +1209,7 @@ declare class CorbadoTracker {
|
|
|
1167
1209
|
provideDataOperationFull(config?: ProvideDataOperationConfig): ProvideDataOperationFull;
|
|
1168
1210
|
socialLoginOperationFull(): SocialLoginOperationFull;
|
|
1169
1211
|
appConfirmationOperationFull(explicitSpecType?: AppConfirmationOperationSpecType): AppConfirmationOperationFull;
|
|
1212
|
+
captchaOperationFull(config?: CaptchaOperationConfig): CaptchaOperationFull;
|
|
1170
1213
|
/**
|
|
1171
1214
|
* Flush any pending events and release all resources (timers, event listeners).
|
|
1172
1215
|
*
|
|
@@ -1178,6 +1221,38 @@ declare class CorbadoTracker {
|
|
|
1178
1221
|
* resources are released either way.
|
|
1179
1222
|
*/
|
|
1180
1223
|
destroy(): Promise<void>;
|
|
1224
|
+
/**
|
|
1225
|
+
* Return the Observe session id this tracker is currently reporting under.
|
|
1226
|
+
*
|
|
1227
|
+
* @remarks
|
|
1228
|
+
* Use this to route a server-side event into the same session the browser reports to: read the id,
|
|
1229
|
+
* pass it to your own backend, and let the backend use it as the `sessionID` of its ingest call.
|
|
1230
|
+
* Reading it here is the supported path — the storage layout behind it is an implementation detail
|
|
1231
|
+
* that has already changed once (per-tab `sessionStorage` to the cross-tab continuity record).
|
|
1232
|
+
*
|
|
1233
|
+
* The value is **not stable for the lifetime of the page**. It changes on
|
|
1234
|
+
* {@link CorbadoTracker.resetSession}, when this tab adopts a continuity session another tab
|
|
1235
|
+
* rotated to, and when a failed bootstrap recovers. Read it at the moment you need it; never cache
|
|
1236
|
+
* it across a request.
|
|
1237
|
+
*
|
|
1238
|
+
* `undefined` means no session id could be established at all — an environment without Web Crypto,
|
|
1239
|
+
* where tracking is not working either. Skip the server-side event instead of sending an empty id:
|
|
1240
|
+
* the ingest API requires a UUID and would reject the batch.
|
|
1241
|
+
*
|
|
1242
|
+
* @returns The current session id, or `undefined` if none could be established.
|
|
1243
|
+
*
|
|
1244
|
+
* @example
|
|
1245
|
+
* ```typescript
|
|
1246
|
+
* const sessionId = tracker.getSessionId();
|
|
1247
|
+
* if (sessionId) {
|
|
1248
|
+
* await fetch("/api/checkout", {
|
|
1249
|
+
* method: "POST",
|
|
1250
|
+
* body: JSON.stringify({ ...payload, observeSessionId: sessionId }),
|
|
1251
|
+
* });
|
|
1252
|
+
* }
|
|
1253
|
+
* ```
|
|
1254
|
+
*/
|
|
1255
|
+
getSessionId(): string | undefined;
|
|
1181
1256
|
/** @internal */
|
|
1182
1257
|
resetSession(): string;
|
|
1183
1258
|
}
|
|
@@ -1635,6 +1710,11 @@ declare class EventStore {
|
|
|
1635
1710
|
declare function init(options: TrackerOptions): CorbadoTracker;
|
|
1636
1711
|
declare function getTracker(): CorbadoTracker | undefined;
|
|
1637
1712
|
declare function resetSession(): string | undefined;
|
|
1713
|
+
/**
|
|
1714
|
+
* Session id of the global tracker, or `undefined` when no tracker was initialized or no session
|
|
1715
|
+
* could be established. See {@link CorbadoTracker.getSessionId}.
|
|
1716
|
+
*/
|
|
1717
|
+
declare function getSessionId(): string | undefined;
|
|
1638
1718
|
declare function setExperiment(key: string, variant: string): void;
|
|
1639
1719
|
declare function setExperiments(assignments: Record<string, string>): void;
|
|
1640
1720
|
declare function clearExperiment(key: string): void;
|
|
@@ -1645,4 +1725,4 @@ declare function logInfo(message: string): void;
|
|
|
1645
1725
|
declare function logError(message: string): void;
|
|
1646
1726
|
declare function destroy(): Promise<void>;
|
|
1647
1727
|
|
|
1648
|
-
export { type AppConfirmationOperationCeremonyTypedError, AppConfirmationOperationFull, type AppConfirmationOperationRetryReason, type AppConfirmationOperationSpecType, type AppConfirmationOperationStart, 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_DEVICE_INFO_COLLECTOR_TIMEOUT_MS, DEFAULT_FLUSH_INTERVAL_MS, DEFAULT_MAX_ENTRIES, DEFAULT_MAX_SERIALIZED_LENGTH, DEFAULT_RELIABILITY_CONFIG, DEFAULT_SEQ_LOCK_TIMEOUT_MS, DEFAULT_SESSION_INACTIVITY_MS, type DeviceInfo, type DeviceInfoCollectionError, type DeviceInfoDataWeb, type DeviceType, EmailLinkOperationFull, type EmailLinkOperationPostResponseStart, type EmailLinkOperationSendStart, type EmailLinkOperationSpecType, type EmailOTPOperationConfig, 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 FlushReason, type JavaScriptHighEntropy, LocalStorage, type Logger, type LowEvent, type MultiFlowReset, type MultiFlowStarted, type NormalizedError, OUTBOX_LOCK_NAME, OUTBOX_STORAGE_KEY, OperationFull, OperationFullProvideIdentifierWithCUI, type OperationFullProvideIdentifierWithCUIConfig, type OutboxEntry, type PasskeyEnrollmentCeremonyFinished, type PasskeyEnrollmentCeremonyStart, type PasskeyEnrollmentGetOptionsFinished, type PasskeyEnrollmentGetOptionsStart, type PasskeyEnrollmentOperationConfig, PasskeyEnrollmentOperationFull, type PasskeyEnrollmentPostResponseStart, type PasskeyLoginCUIGetOptionsFinished, type PasskeyLoginCUIGetOptionsStart, type PasskeyLoginCUISpecType, type PasskeyLoginCeremonyFinished, type PasskeyLoginCeremonyStart, type PasskeyLoginClientError, type PasskeyLoginFinish, type PasskeyLoginGetOptionsFinished, type PasskeyLoginGetOptionsStart, PasskeyLoginOperationFull, type PasskeyLoginPostResponseStart, type PasskeyLoginStartable, type PasskeyLoginSubmitted, type PasskeyOperationEnrollmentExplicitSpecType, type PasskeyOperationLoginExplicitSpecType, type PasswordEnrollmentAutoTrackConfig, PasswordEnrollmentOperationFull, type PasswordEnrollmentTypedError, type PasswordLoginAutoTrackConfig, type PasswordLoginCUICeremonyStart, type PasswordLoginCUIGetOptionsFinished, type PasswordLoginCUIGetOptionsStart, type PasswordLoginCUISpecType, type PasswordLoginCUITypedError, PasswordLoginOperationFull, type PasswordLoginTypedError, type PredefinedEvent, type ProvideDataOperationConfig, ProvideDataOperationFull, type ProvideDataOperationPostResponseStart, type ProvideDataOperationSpecType, type ProvideDataOperationStart, 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 SmsOTPOperationConfig, type SmsOTPOperationPostResponseStart, type SmsOTPOperationSpecType, SmsOtpOperationFull, type SocialLoginExchangeCodeFinished, type SocialLoginExchangeCodeStart, type SocialLoginGetRedirectUrlFinished, type SocialLoginGetRedirectUrlStart, SocialLoginOperationFull, type SocialLoginProviderType, type SocialLoginSpecType, type StepHelper, type StepOptions, type StorageEngine, type SubflowTrigger, type SubflowType, type TelemetryEntry, type TelemetryLevel, type TelemetrySink, type TrackerOptions, type Transport, type TransportMakeRequestResponse, type TransportOptions, type UserReference, cacheConfig, clearExperiment, clearExperiments, createLogger, destroy, getExperiments, getTracker, init, loadCachedConfig, logError, logInfo, parseReliabilityConfig, resetSession, setExperiment, setExperiments, telemetry };
|
|
1728
|
+
export { type AppConfirmationOperationCeremonyTypedError, AppConfirmationOperationFull, type AppConfirmationOperationRetryReason, type AppConfirmationOperationSpecType, type AppConfirmationOperationStart, 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 CaptchaOperationConfig, CaptchaOperationFull, type CaptchaOperationSpecType, type ClientCapabilities, type ClientEnvHandleMeta, type ClientEnvHandleMetaSource, type Conversion, CookieStorage, CorbadoTracker, type CreateLoggerOptions, type CustomEvent, DEFAULT_DEVICE_INFO_COLLECTOR_TIMEOUT_MS, DEFAULT_FLUSH_INTERVAL_MS, DEFAULT_MAX_ENTRIES, DEFAULT_MAX_SERIALIZED_LENGTH, DEFAULT_RELIABILITY_CONFIG, DEFAULT_SEQ_LOCK_TIMEOUT_MS, DEFAULT_SESSION_INACTIVITY_MS, type DeviceInfo, type DeviceInfoCollectionError, type DeviceInfoDataWeb, type DeviceType, EmailLinkOperationFull, type EmailLinkOperationPostResponseStart, type EmailLinkOperationSendStart, type EmailLinkOperationSpecType, type EmailOTPOperationConfig, 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 FlushReason, type JavaScriptHighEntropy, LocalStorage, type Logger, type LowEvent, type MultiFlowReset, type MultiFlowStarted, type NormalizedError, OUTBOX_LOCK_NAME, OUTBOX_STORAGE_KEY, OperationFull, OperationFullProvideIdentifierWithCUI, type OperationFullProvideIdentifierWithCUIConfig, type OutboxEntry, type PasskeyEnrollmentCeremonyFinished, type PasskeyEnrollmentCeremonyStart, type PasskeyEnrollmentGetOptionsFinished, type PasskeyEnrollmentGetOptionsStart, type PasskeyEnrollmentOperationConfig, PasskeyEnrollmentOperationFull, type PasskeyEnrollmentPostResponseStart, type PasskeyLoginCUIGetOptionsFinished, type PasskeyLoginCUIGetOptionsStart, type PasskeyLoginCUISpecType, type PasskeyLoginCeremonyFinished, type PasskeyLoginCeremonyStart, type PasskeyLoginClientError, type PasskeyLoginFinish, type PasskeyLoginGetOptionsFinished, type PasskeyLoginGetOptionsStart, PasskeyLoginOperationFull, type PasskeyLoginPostResponseStart, type PasskeyLoginStartable, type PasskeyLoginSubmitted, type PasskeyOperationEnrollmentExplicitSpecType, type PasskeyOperationLoginExplicitSpecType, type PasswordEnrollmentAutoTrackConfig, PasswordEnrollmentOperationFull, type PasswordEnrollmentTypedError, type PasswordLoginAutoTrackConfig, type PasswordLoginCUICeremonyStart, type PasswordLoginCUIGetOptionsFinished, type PasswordLoginCUIGetOptionsStart, type PasswordLoginCUISpecType, type PasswordLoginCUITypedError, PasswordLoginOperationFull, type PasswordLoginTypedError, type PredefinedEvent, type ProvideDataOperationConfig, ProvideDataOperationFull, type ProvideDataOperationPostResponseStart, type ProvideDataOperationSpecType, type ProvideDataOperationStart, 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 SmsOTPOperationConfig, type SmsOTPOperationPostResponseStart, type SmsOTPOperationSpecType, SmsOtpOperationFull, type SocialLoginExchangeCodeFinished, type SocialLoginExchangeCodeStart, type SocialLoginGetRedirectUrlFinished, type SocialLoginGetRedirectUrlStart, SocialLoginOperationFull, type SocialLoginProviderType, type SocialLoginSpecType, type StepHelper, type StepOptions, type StorageEngine, type SubflowTrigger, type SubflowType, type TelemetryEntry, type TelemetryLevel, type TelemetrySink, type TrackerOptions, type Transport, type TransportMakeRequestResponse, type TransportOptions, type UserReference, cacheConfig, clearExperiment, clearExperiments, createLogger, destroy, getExperiments, getSessionId, getTracker, init, loadCachedConfig, logError, logInfo, parseReliabilityConfig, resetSession, setExperiment, setExperiments, telemetry };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ interface SdkInfo {
|
|
|
4
4
|
}
|
|
5
5
|
type EventType = "predefined" | "custom" | "error" | "identify";
|
|
6
6
|
type AuthMethodType = "identifier-email" | "passkey-login-known-identifier" | "passkey-login-no-identifier" | "passkey-login-cui" | "passkey-login-immediate" | "passkey-enrollment" | "password-login" | "password-login-known-identifier" | "password-login-with-identifier" | "password-enrollment" | "email-otp" | "email-otp-login" | "email-otp-enrollment" | "email-link" | "email-link-login" | "email-link-enrollment" | "sms-otp" | "sms-otp-login" | "sms-otp-enrollment" | "social-google" | "social-apple" | "social-facebook" | "social-other" | "reset-flow" | "provide-data";
|
|
7
|
-
type SubflowType = "passkey-enrollment" | "passkey-login" | "email-otp" | "email-link" | "social-login" | "sms-otp" | "provide-identifier" | "provide-data" | "password-login" | "password-enrollment" | "totp" | "app-confirmation";
|
|
7
|
+
type SubflowType = "passkey-enrollment" | "passkey-login" | "email-otp" | "email-link" | "social-login" | "sms-otp" | "provide-identifier" | "provide-data" | "password-login" | "password-enrollment" | "totp" | "app-confirmation" | "captcha";
|
|
8
8
|
type FlowType = "login" | "signup" | "recovery" | "enrollment" | (string & {});
|
|
9
9
|
type SocialLoginProviderType = "google" | "apple" | "facebook" | "github" | "microsoft" | "other";
|
|
10
10
|
declare enum AuthEventName {
|
|
@@ -59,7 +59,8 @@ type UserReference = {
|
|
|
59
59
|
*/
|
|
60
60
|
type NormalizedError = {
|
|
61
61
|
name?: string;
|
|
62
|
-
|
|
62
|
+
code?: string;
|
|
63
|
+
message?: string;
|
|
63
64
|
};
|
|
64
65
|
type FlowStarted = {
|
|
65
66
|
flowName: FlowType;
|
|
@@ -211,6 +212,12 @@ interface EventBatchMeta {
|
|
|
211
212
|
}
|
|
212
213
|
interface EventMeta {
|
|
213
214
|
trackingSourcePath: string;
|
|
215
|
+
/**
|
|
216
|
+
* Per-tab id (uuidv7, `sessionStorage`-scoped) of the tab that CREATED this event, stamped at
|
|
217
|
+
* `track()` time. Late-flushed events keep the tab they originated in regardless of which page
|
|
218
|
+
* delivers them; the backend uses this to split interleaved multi-tab streams per session.
|
|
219
|
+
*/
|
|
220
|
+
tabId?: string;
|
|
214
221
|
}
|
|
215
222
|
interface EventBatch {
|
|
216
223
|
sessionId: string;
|
|
@@ -481,6 +488,13 @@ declare abstract class OperationFull {
|
|
|
481
488
|
}
|
|
482
489
|
|
|
483
490
|
type PasskeyOperationLoginExplicitSpecType = "passkey-cui" | "passkey-known-identifier" | "passkey-no-identifier"
|
|
491
|
+
/**
|
|
492
|
+
* The `-auto` variants are the same two ceremonies started by the integration rather than by a
|
|
493
|
+
* user gesture — `navigator.credentials.get()` called without user activation, so the passkey
|
|
494
|
+
* prompt appears on its own. Unlike `passkey-immediate` they still run after the auth-method
|
|
495
|
+
* decision is rendered and attribute to the same decision option as their manual counterpart.
|
|
496
|
+
*/
|
|
497
|
+
| "passkey-known-identifier-auto" | "passkey-no-identifier-auto"
|
|
484
498
|
/**
|
|
485
499
|
* WebAuthn immediate mediation (`navigator.credentials.get({ uiMode: "immediate" })`, Chrome 149+):
|
|
486
500
|
* button-triggered, discoverable credentials only (empty allowList). Shows the account picker when
|
|
@@ -769,6 +783,23 @@ declare class AppConfirmationOperationFull extends OperationFull {
|
|
|
769
783
|
constructor(tracker: CorbadoTracker, explicitSpecType?: AppConfirmationOperationSpecType);
|
|
770
784
|
}
|
|
771
785
|
|
|
786
|
+
/**
|
|
787
|
+
* Which captcha widget the integration observed.
|
|
788
|
+
* - `visible`: a widget presenting UI to the user. Can require interaction.
|
|
789
|
+
* - `invisible`: a widget that never presents UI and always solves itself.
|
|
790
|
+
*/
|
|
791
|
+
type CaptchaOperationSpecType = "visible" | "invisible";
|
|
792
|
+
type CaptchaOperationConfig = {
|
|
793
|
+
explicitSpecType?: CaptchaOperationSpecType;
|
|
794
|
+
};
|
|
795
|
+
declare class CaptchaOperationFull extends OperationFull {
|
|
796
|
+
/** Step representing the captcha challenge ceremony. */
|
|
797
|
+
readonly ceremony: StepHelper;
|
|
798
|
+
/** Submission of the captcha token and the server's verdict on it. */
|
|
799
|
+
readonly postResponse: StepHelper;
|
|
800
|
+
constructor(tracker: CorbadoTracker, config?: CaptchaOperationConfig);
|
|
801
|
+
}
|
|
802
|
+
|
|
772
803
|
type ProvideDataOperationSpecType = "signup" | "login" | "recovery" | "enrollment";
|
|
773
804
|
type ProvideDataOperationStart = {
|
|
774
805
|
/** Stable name of the data field collected by this subflow, when known. */
|
|
@@ -839,6 +870,12 @@ declare class CorbadoTracker {
|
|
|
839
870
|
*/
|
|
840
871
|
private config;
|
|
841
872
|
private deviceInfoManager;
|
|
873
|
+
private deviceCollector;
|
|
874
|
+
/**
|
|
875
|
+
* Cached per-tab id stamped onto every event's meta (see {@link EventMeta.tabId}). Resolved
|
|
876
|
+
* lazily from the collector's sessionStorage-backed id; stable for the whole page lifetime.
|
|
877
|
+
*/
|
|
878
|
+
private eventTabId?;
|
|
842
879
|
private seq;
|
|
843
880
|
/**
|
|
844
881
|
* When the continuity record's `lastActiveAt` was last persisted. Throttles that write inside the
|
|
@@ -902,7 +939,7 @@ declare class CorbadoTracker {
|
|
|
902
939
|
*/
|
|
903
940
|
private resolveExperiments;
|
|
904
941
|
private isTrackingBlocked;
|
|
905
|
-
private
|
|
942
|
+
private resolveSessionId;
|
|
906
943
|
/**
|
|
907
944
|
* Resolve the session id from localStorage so it survives reloads and is shared across tabs of the
|
|
908
945
|
* same browser. Rotates after `config.sessionInactivityMs` of inactivity (server-controlled,
|
|
@@ -940,6 +977,11 @@ declare class CorbadoTracker {
|
|
|
940
977
|
*/
|
|
941
978
|
private nextSeq;
|
|
942
979
|
private resolveTrackingSourcePath;
|
|
980
|
+
/**
|
|
981
|
+
* Per-tab id for event meta, cached after the first successful resolution: the id is
|
|
982
|
+
* sessionStorage-backed and stable for the whole page lifetime.
|
|
983
|
+
*/
|
|
984
|
+
private resolveEventTabId;
|
|
943
985
|
trackSubflowStarted(subflowType: SubflowType, data: Record<string, any>, options?: StepOptions): void;
|
|
944
986
|
trackSubflowTrigger(subflowType: SubflowType, data: Record<string, any>, options?: StepOptions): void;
|
|
945
987
|
trackSubflowStepStarted(subflowType: SubflowType, stepName: string, data: Record<string, any>, options?: StepOptions, ignoreAsInteraction?: boolean): void;
|
|
@@ -1167,6 +1209,7 @@ declare class CorbadoTracker {
|
|
|
1167
1209
|
provideDataOperationFull(config?: ProvideDataOperationConfig): ProvideDataOperationFull;
|
|
1168
1210
|
socialLoginOperationFull(): SocialLoginOperationFull;
|
|
1169
1211
|
appConfirmationOperationFull(explicitSpecType?: AppConfirmationOperationSpecType): AppConfirmationOperationFull;
|
|
1212
|
+
captchaOperationFull(config?: CaptchaOperationConfig): CaptchaOperationFull;
|
|
1170
1213
|
/**
|
|
1171
1214
|
* Flush any pending events and release all resources (timers, event listeners).
|
|
1172
1215
|
*
|
|
@@ -1178,6 +1221,38 @@ declare class CorbadoTracker {
|
|
|
1178
1221
|
* resources are released either way.
|
|
1179
1222
|
*/
|
|
1180
1223
|
destroy(): Promise<void>;
|
|
1224
|
+
/**
|
|
1225
|
+
* Return the Observe session id this tracker is currently reporting under.
|
|
1226
|
+
*
|
|
1227
|
+
* @remarks
|
|
1228
|
+
* Use this to route a server-side event into the same session the browser reports to: read the id,
|
|
1229
|
+
* pass it to your own backend, and let the backend use it as the `sessionID` of its ingest call.
|
|
1230
|
+
* Reading it here is the supported path — the storage layout behind it is an implementation detail
|
|
1231
|
+
* that has already changed once (per-tab `sessionStorage` to the cross-tab continuity record).
|
|
1232
|
+
*
|
|
1233
|
+
* The value is **not stable for the lifetime of the page**. It changes on
|
|
1234
|
+
* {@link CorbadoTracker.resetSession}, when this tab adopts a continuity session another tab
|
|
1235
|
+
* rotated to, and when a failed bootstrap recovers. Read it at the moment you need it; never cache
|
|
1236
|
+
* it across a request.
|
|
1237
|
+
*
|
|
1238
|
+
* `undefined` means no session id could be established at all — an environment without Web Crypto,
|
|
1239
|
+
* where tracking is not working either. Skip the server-side event instead of sending an empty id:
|
|
1240
|
+
* the ingest API requires a UUID and would reject the batch.
|
|
1241
|
+
*
|
|
1242
|
+
* @returns The current session id, or `undefined` if none could be established.
|
|
1243
|
+
*
|
|
1244
|
+
* @example
|
|
1245
|
+
* ```typescript
|
|
1246
|
+
* const sessionId = tracker.getSessionId();
|
|
1247
|
+
* if (sessionId) {
|
|
1248
|
+
* await fetch("/api/checkout", {
|
|
1249
|
+
* method: "POST",
|
|
1250
|
+
* body: JSON.stringify({ ...payload, observeSessionId: sessionId }),
|
|
1251
|
+
* });
|
|
1252
|
+
* }
|
|
1253
|
+
* ```
|
|
1254
|
+
*/
|
|
1255
|
+
getSessionId(): string | undefined;
|
|
1181
1256
|
/** @internal */
|
|
1182
1257
|
resetSession(): string;
|
|
1183
1258
|
}
|
|
@@ -1635,6 +1710,11 @@ declare class EventStore {
|
|
|
1635
1710
|
declare function init(options: TrackerOptions): CorbadoTracker;
|
|
1636
1711
|
declare function getTracker(): CorbadoTracker | undefined;
|
|
1637
1712
|
declare function resetSession(): string | undefined;
|
|
1713
|
+
/**
|
|
1714
|
+
* Session id of the global tracker, or `undefined` when no tracker was initialized or no session
|
|
1715
|
+
* could be established. See {@link CorbadoTracker.getSessionId}.
|
|
1716
|
+
*/
|
|
1717
|
+
declare function getSessionId(): string | undefined;
|
|
1638
1718
|
declare function setExperiment(key: string, variant: string): void;
|
|
1639
1719
|
declare function setExperiments(assignments: Record<string, string>): void;
|
|
1640
1720
|
declare function clearExperiment(key: string): void;
|
|
@@ -1645,4 +1725,4 @@ declare function logInfo(message: string): void;
|
|
|
1645
1725
|
declare function logError(message: string): void;
|
|
1646
1726
|
declare function destroy(): Promise<void>;
|
|
1647
1727
|
|
|
1648
|
-
export { type AppConfirmationOperationCeremonyTypedError, AppConfirmationOperationFull, type AppConfirmationOperationRetryReason, type AppConfirmationOperationSpecType, type AppConfirmationOperationStart, 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_DEVICE_INFO_COLLECTOR_TIMEOUT_MS, DEFAULT_FLUSH_INTERVAL_MS, DEFAULT_MAX_ENTRIES, DEFAULT_MAX_SERIALIZED_LENGTH, DEFAULT_RELIABILITY_CONFIG, DEFAULT_SEQ_LOCK_TIMEOUT_MS, DEFAULT_SESSION_INACTIVITY_MS, type DeviceInfo, type DeviceInfoCollectionError, type DeviceInfoDataWeb, type DeviceType, EmailLinkOperationFull, type EmailLinkOperationPostResponseStart, type EmailLinkOperationSendStart, type EmailLinkOperationSpecType, type EmailOTPOperationConfig, 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 FlushReason, type JavaScriptHighEntropy, LocalStorage, type Logger, type LowEvent, type MultiFlowReset, type MultiFlowStarted, type NormalizedError, OUTBOX_LOCK_NAME, OUTBOX_STORAGE_KEY, OperationFull, OperationFullProvideIdentifierWithCUI, type OperationFullProvideIdentifierWithCUIConfig, type OutboxEntry, type PasskeyEnrollmentCeremonyFinished, type PasskeyEnrollmentCeremonyStart, type PasskeyEnrollmentGetOptionsFinished, type PasskeyEnrollmentGetOptionsStart, type PasskeyEnrollmentOperationConfig, PasskeyEnrollmentOperationFull, type PasskeyEnrollmentPostResponseStart, type PasskeyLoginCUIGetOptionsFinished, type PasskeyLoginCUIGetOptionsStart, type PasskeyLoginCUISpecType, type PasskeyLoginCeremonyFinished, type PasskeyLoginCeremonyStart, type PasskeyLoginClientError, type PasskeyLoginFinish, type PasskeyLoginGetOptionsFinished, type PasskeyLoginGetOptionsStart, PasskeyLoginOperationFull, type PasskeyLoginPostResponseStart, type PasskeyLoginStartable, type PasskeyLoginSubmitted, type PasskeyOperationEnrollmentExplicitSpecType, type PasskeyOperationLoginExplicitSpecType, type PasswordEnrollmentAutoTrackConfig, PasswordEnrollmentOperationFull, type PasswordEnrollmentTypedError, type PasswordLoginAutoTrackConfig, type PasswordLoginCUICeremonyStart, type PasswordLoginCUIGetOptionsFinished, type PasswordLoginCUIGetOptionsStart, type PasswordLoginCUISpecType, type PasswordLoginCUITypedError, PasswordLoginOperationFull, type PasswordLoginTypedError, type PredefinedEvent, type ProvideDataOperationConfig, ProvideDataOperationFull, type ProvideDataOperationPostResponseStart, type ProvideDataOperationSpecType, type ProvideDataOperationStart, 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 SmsOTPOperationConfig, type SmsOTPOperationPostResponseStart, type SmsOTPOperationSpecType, SmsOtpOperationFull, type SocialLoginExchangeCodeFinished, type SocialLoginExchangeCodeStart, type SocialLoginGetRedirectUrlFinished, type SocialLoginGetRedirectUrlStart, SocialLoginOperationFull, type SocialLoginProviderType, type SocialLoginSpecType, type StepHelper, type StepOptions, type StorageEngine, type SubflowTrigger, type SubflowType, type TelemetryEntry, type TelemetryLevel, type TelemetrySink, type TrackerOptions, type Transport, type TransportMakeRequestResponse, type TransportOptions, type UserReference, cacheConfig, clearExperiment, clearExperiments, createLogger, destroy, getExperiments, getTracker, init, loadCachedConfig, logError, logInfo, parseReliabilityConfig, resetSession, setExperiment, setExperiments, telemetry };
|
|
1728
|
+
export { type AppConfirmationOperationCeremonyTypedError, AppConfirmationOperationFull, type AppConfirmationOperationRetryReason, type AppConfirmationOperationSpecType, type AppConfirmationOperationStart, 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 CaptchaOperationConfig, CaptchaOperationFull, type CaptchaOperationSpecType, type ClientCapabilities, type ClientEnvHandleMeta, type ClientEnvHandleMetaSource, type Conversion, CookieStorage, CorbadoTracker, type CreateLoggerOptions, type CustomEvent, DEFAULT_DEVICE_INFO_COLLECTOR_TIMEOUT_MS, DEFAULT_FLUSH_INTERVAL_MS, DEFAULT_MAX_ENTRIES, DEFAULT_MAX_SERIALIZED_LENGTH, DEFAULT_RELIABILITY_CONFIG, DEFAULT_SEQ_LOCK_TIMEOUT_MS, DEFAULT_SESSION_INACTIVITY_MS, type DeviceInfo, type DeviceInfoCollectionError, type DeviceInfoDataWeb, type DeviceType, EmailLinkOperationFull, type EmailLinkOperationPostResponseStart, type EmailLinkOperationSendStart, type EmailLinkOperationSpecType, type EmailOTPOperationConfig, 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 FlushReason, type JavaScriptHighEntropy, LocalStorage, type Logger, type LowEvent, type MultiFlowReset, type MultiFlowStarted, type NormalizedError, OUTBOX_LOCK_NAME, OUTBOX_STORAGE_KEY, OperationFull, OperationFullProvideIdentifierWithCUI, type OperationFullProvideIdentifierWithCUIConfig, type OutboxEntry, type PasskeyEnrollmentCeremonyFinished, type PasskeyEnrollmentCeremonyStart, type PasskeyEnrollmentGetOptionsFinished, type PasskeyEnrollmentGetOptionsStart, type PasskeyEnrollmentOperationConfig, PasskeyEnrollmentOperationFull, type PasskeyEnrollmentPostResponseStart, type PasskeyLoginCUIGetOptionsFinished, type PasskeyLoginCUIGetOptionsStart, type PasskeyLoginCUISpecType, type PasskeyLoginCeremonyFinished, type PasskeyLoginCeremonyStart, type PasskeyLoginClientError, type PasskeyLoginFinish, type PasskeyLoginGetOptionsFinished, type PasskeyLoginGetOptionsStart, PasskeyLoginOperationFull, type PasskeyLoginPostResponseStart, type PasskeyLoginStartable, type PasskeyLoginSubmitted, type PasskeyOperationEnrollmentExplicitSpecType, type PasskeyOperationLoginExplicitSpecType, type PasswordEnrollmentAutoTrackConfig, PasswordEnrollmentOperationFull, type PasswordEnrollmentTypedError, type PasswordLoginAutoTrackConfig, type PasswordLoginCUICeremonyStart, type PasswordLoginCUIGetOptionsFinished, type PasswordLoginCUIGetOptionsStart, type PasswordLoginCUISpecType, type PasswordLoginCUITypedError, PasswordLoginOperationFull, type PasswordLoginTypedError, type PredefinedEvent, type ProvideDataOperationConfig, ProvideDataOperationFull, type ProvideDataOperationPostResponseStart, type ProvideDataOperationSpecType, type ProvideDataOperationStart, 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 SmsOTPOperationConfig, type SmsOTPOperationPostResponseStart, type SmsOTPOperationSpecType, SmsOtpOperationFull, type SocialLoginExchangeCodeFinished, type SocialLoginExchangeCodeStart, type SocialLoginGetRedirectUrlFinished, type SocialLoginGetRedirectUrlStart, SocialLoginOperationFull, type SocialLoginProviderType, type SocialLoginSpecType, type StepHelper, type StepOptions, type StorageEngine, type SubflowTrigger, type SubflowType, type TelemetryEntry, type TelemetryLevel, type TelemetrySink, type TrackerOptions, type Transport, type TransportMakeRequestResponse, type TransportOptions, type UserReference, cacheConfig, clearExperiment, clearExperiments, createLogger, destroy, getExperiments, getSessionId, getTracker, init, loadCachedConfig, logError, logInfo, parseReliabilityConfig, resetSession, setExperiment, setExperiments, telemetry };
|