@corbado/observe 0.8.0 → 0.9.0-next.67-2a142aa
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 +134 -11
- package/dist/index.d.ts +134 -11
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -85,7 +85,7 @@ type Conversion = {
|
|
|
85
85
|
} & UserReference;
|
|
86
86
|
type FlowFinished = {
|
|
87
87
|
flowName: FlowType;
|
|
88
|
-
explicitOutcome?: "skipped" | "visible-auto-skip" | "
|
|
88
|
+
explicitOutcome?: "skipped" | "visible-auto-skip" | "invisible";
|
|
89
89
|
} & UserReference;
|
|
90
90
|
type FlowReset = {
|
|
91
91
|
flowName?: FlowType;
|
|
@@ -160,6 +160,21 @@ interface LowEvent {
|
|
|
160
160
|
ts: number;
|
|
161
161
|
durationMs?: number;
|
|
162
162
|
}
|
|
163
|
+
type TelemetryLevel = "info" | "error";
|
|
164
|
+
/**
|
|
165
|
+
* A diagnostic telemetry entry (a severity level + free-form message) recorded by the integrating
|
|
166
|
+
* app or by the SDK itself. Telemetry rides along in the `telemetry` array of the events endpoint
|
|
167
|
+
* payload, tied to the same session, and is never classified as an auth-flow event.
|
|
168
|
+
*/
|
|
169
|
+
interface TelemetryEntry {
|
|
170
|
+
/** Client-generated idempotency id (uuidv7) so safe resends (retry/beacon) dedupe server-side. */
|
|
171
|
+
id: string;
|
|
172
|
+
level: TelemetryLevel;
|
|
173
|
+
/** Free-form diagnostic message. Truncated client-side. Must not contain credentials or PII. */
|
|
174
|
+
message: string;
|
|
175
|
+
/** Capture time, unix ms. */
|
|
176
|
+
ts: number;
|
|
177
|
+
}
|
|
163
178
|
interface EventBatchMeta {
|
|
164
179
|
sent: number;
|
|
165
180
|
transport: "fetch" | "beacon";
|
|
@@ -180,6 +195,7 @@ interface EventBatch {
|
|
|
180
195
|
events: Event[];
|
|
181
196
|
sdk: SdkInfo;
|
|
182
197
|
lows?: LowEvent[];
|
|
198
|
+
telemetry?: TelemetryEntry[];
|
|
183
199
|
meta?: EventBatchMeta;
|
|
184
200
|
}
|
|
185
201
|
type DeviceType = "web" | "app" | "other";
|
|
@@ -214,6 +230,7 @@ type JavaScriptHighEntropy = {
|
|
|
214
230
|
platform?: string;
|
|
215
231
|
mobile?: boolean;
|
|
216
232
|
platformVersion?: string;
|
|
233
|
+
model?: string;
|
|
217
234
|
};
|
|
218
235
|
type ClientEnvHandleMeta = {
|
|
219
236
|
timestamp: number;
|
|
@@ -279,6 +296,18 @@ interface SdkReliabilityConfig {
|
|
|
279
296
|
* the historical behavior; can be disabled server-side to rely solely on the queue's triggers.
|
|
280
297
|
*/
|
|
281
298
|
tlf: boolean;
|
|
299
|
+
/**
|
|
300
|
+
* Master switch for the diagnostic telemetry stream. When true the SDK sends buffered telemetry
|
|
301
|
+
* entries piggybacked on normal event requests; when false it collects and sends nothing. Defaults
|
|
302
|
+
* to true (telemetry is on out of the box) and can be turned off server-side without a redeploy.
|
|
303
|
+
*/
|
|
304
|
+
telemetry: boolean;
|
|
305
|
+
/**
|
|
306
|
+
* When true (and `telemetry` is enabled), enqueuing a telemetry entry triggers an immediate flush
|
|
307
|
+
* so diagnostics go out promptly (e.g. before a crash/navigation). Defaults to false: a telemetry
|
|
308
|
+
* entry alone never triggers a flush, it only rides the next flush caused by anything else.
|
|
309
|
+
*/
|
|
310
|
+
flushOnTelemetry: boolean;
|
|
282
311
|
/**
|
|
283
312
|
* Event names that trigger an immediate flush when enqueued (e.g. `flow_finished`,
|
|
284
313
|
* `conversion`), so high-value events go out via a normal fetch while the page is still alive
|
|
@@ -291,12 +320,22 @@ interface SdkReliabilityConfig {
|
|
|
291
320
|
retry: SdkRetryConfig;
|
|
292
321
|
}
|
|
293
322
|
|
|
323
|
+
/** Sink that escalates a diagnostic message to the telemetry stream. */
|
|
324
|
+
type TelemetrySink = (level: TelemetryLevel, message: string) => void;
|
|
294
325
|
interface Logger {
|
|
295
326
|
debug(message: string, ...args: unknown[]): void;
|
|
296
327
|
info(message: string, ...args: unknown[]): void;
|
|
297
328
|
warn(message: string, ...args: unknown[]): void;
|
|
298
329
|
error(message: string, ...args: unknown[]): void;
|
|
299
330
|
critical(message: string, ...args: unknown[]): void;
|
|
331
|
+
/**
|
|
332
|
+
* Escalate a diagnostic message to the telemetry stream, if a sink is attached (no-op otherwise).
|
|
333
|
+
* Unlike the level methods, telemetry is delivered to the backend regardless of the `debug` flag.
|
|
334
|
+
* Optional so an integrator-provided custom logger stays valid without implementing it.
|
|
335
|
+
*/
|
|
336
|
+
reportTelemetry?(level: TelemetryLevel, message: string): void;
|
|
337
|
+
/** Attach (or clear) the telemetry sink. Called once by the tracker after the queue exists. */
|
|
338
|
+
setTelemetrySink?(sink: TelemetrySink | undefined): void;
|
|
300
339
|
}
|
|
301
340
|
interface CreateLoggerOptions {
|
|
302
341
|
debug: boolean;
|
|
@@ -553,10 +592,11 @@ type PasswordEnrollmentTypedError = {
|
|
|
553
592
|
type PasswordEnrollmentTypedErrorCode = "requirements_not_fulfilled";
|
|
554
593
|
type PasswordEnrollmentExplicitSpecType = "password-set" | "password-reset";
|
|
555
594
|
type PasswordEnrollmentAutoTrackConfig = {
|
|
556
|
-
explicitSpecType
|
|
557
|
-
inputHtmlField
|
|
595
|
+
explicitSpecType?: PasswordEnrollmentExplicitSpecType;
|
|
596
|
+
inputHtmlField?: HTMLInputElement;
|
|
558
597
|
};
|
|
559
598
|
declare class PasswordEnrollmentOperationFull extends OperationFull {
|
|
599
|
+
readonly clientValidation: StepHelper;
|
|
560
600
|
readonly postResponse: StepHelper<{}, {}, PasswordEnrollmentTypedError>;
|
|
561
601
|
private lowEventTracker?;
|
|
562
602
|
constructor(tracker: CorbadoTracker, autoTrackConfig?: PasswordEnrollmentAutoTrackConfig);
|
|
@@ -641,6 +681,28 @@ declare class AppConfirmationOperationFull extends OperationFull {
|
|
|
641
681
|
constructor(tracker: CorbadoTracker, explicitSpecType?: AppConfirmationOperationSpecType);
|
|
642
682
|
}
|
|
643
683
|
|
|
684
|
+
type ProvideDataOperationSpecType = "signup" | "login" | "recovery" | "enrollment";
|
|
685
|
+
type ProvideDataOperationStart = {
|
|
686
|
+
/** Stable name of the data field collected by this subflow, when known. */
|
|
687
|
+
fieldName?: string;
|
|
688
|
+
explicitSpecType?: ProvideDataOperationSpecType;
|
|
689
|
+
};
|
|
690
|
+
type ProvideDataOperationConfig = ProvideDataOperationStart & {
|
|
691
|
+
/** The input field whose low-level interaction signals should be collected. */
|
|
692
|
+
inputHtmlField?: HTMLInputElement;
|
|
693
|
+
};
|
|
694
|
+
type ProvideDataOperationPostResponseStart = {
|
|
695
|
+
explicitSpecType?: ProvideDataOperationSpecType;
|
|
696
|
+
};
|
|
697
|
+
/** Tracks a user-triggered data submission and its server response. */
|
|
698
|
+
declare class ProvideDataOperationFull extends OperationFull {
|
|
699
|
+
readonly clientValidation: StepHelper;
|
|
700
|
+
readonly postResponse: StepHelper<ProvideDataOperationPostResponseStart>;
|
|
701
|
+
private lowEventTracker?;
|
|
702
|
+
constructor(tracker: CorbadoTracker, config?: ProvideDataOperationConfig);
|
|
703
|
+
destroy(): void;
|
|
704
|
+
}
|
|
705
|
+
|
|
644
706
|
interface TrackerOptions {
|
|
645
707
|
projectId: string;
|
|
646
708
|
apiBaseUrl: string;
|
|
@@ -649,7 +711,10 @@ interface TrackerOptions {
|
|
|
649
711
|
cookieDomain?: string;
|
|
650
712
|
debug?: boolean;
|
|
651
713
|
logger?: Logger;
|
|
714
|
+
/** Minimum time between attaching cached device info to events. */
|
|
652
715
|
deviceInfoDebounceTime?: number;
|
|
716
|
+
/** Per-field collection timeout. Defaults to 200ms. */
|
|
717
|
+
deviceInfoCollectorTimeout?: number;
|
|
653
718
|
defaultTags?: Record<string, string>;
|
|
654
719
|
/**
|
|
655
720
|
* Experiment assignments to seed at init (experiment key → variant). Merged over any persisted
|
|
@@ -664,6 +729,8 @@ interface TrackerOptions {
|
|
|
664
729
|
* It will be removed in a future release.
|
|
665
730
|
*/
|
|
666
731
|
flushInterval?: number;
|
|
732
|
+
/** Generates new Observe session ids; returned values must be UUID-compatible. Existing stored sessions are still reused. */
|
|
733
|
+
sessionIdGenerator?: () => string;
|
|
667
734
|
}
|
|
668
735
|
declare class CorbadoTracker {
|
|
669
736
|
private options;
|
|
@@ -680,12 +747,15 @@ declare class CorbadoTracker {
|
|
|
680
747
|
* (see {@link handleConfig}).
|
|
681
748
|
*/
|
|
682
749
|
private config;
|
|
683
|
-
private
|
|
684
|
-
private deviceInfoDebounceTime;
|
|
685
|
-
private deviceInfoTransmittedLastTime;
|
|
750
|
+
private deviceInfoManager;
|
|
686
751
|
private seq;
|
|
687
752
|
/** Persistent experiment assignments (experiment key → variant), attached to every produced event. */
|
|
688
753
|
private experiments;
|
|
754
|
+
/** Self-instrumentation state: re-entrancy guard, readiness, per-load dedupe, and pre-queue buffer. */
|
|
755
|
+
private telemetryReporting;
|
|
756
|
+
private telemetryReady;
|
|
757
|
+
private readonly reportedTelemetryKeys;
|
|
758
|
+
private pendingSelfTelemetry;
|
|
689
759
|
constructor(options: TrackerOptions);
|
|
690
760
|
/**
|
|
691
761
|
* Cache fresh server config as last-known so the next page load boots with it. When this load
|
|
@@ -735,6 +805,7 @@ declare class CorbadoTracker {
|
|
|
735
805
|
*/
|
|
736
806
|
private resolveExperiments;
|
|
737
807
|
private isTrackingBlocked;
|
|
808
|
+
private createSessionId;
|
|
738
809
|
private getSessionId;
|
|
739
810
|
/**
|
|
740
811
|
* Resolve the session id from localStorage so it survives reloads and is shared across tabs of the
|
|
@@ -746,8 +817,8 @@ declare class CorbadoTracker {
|
|
|
746
817
|
* Return the next sequence number. With session continuity the counter is persisted so ordering
|
|
747
818
|
* survives reloads/redirects; the read-increment-write runs under a cross-tab Web Lock
|
|
748
819
|
* ({@link SEQ_LOCK_NAME}) so two tabs sharing the session cannot allocate the same seq (where Web
|
|
749
|
-
* Locks are unavailable it degrades to the historical best-effort merge).
|
|
750
|
-
* seq order matches `track()` call order within a tab. Every tracked event also bumps the
|
|
820
|
+
* Locks are unavailable or take more than 5ms it degrades to the historical best-effort merge).
|
|
821
|
+
* Lock grants are FIFO, so seq order matches `track()` call order within a tab. Every tracked event also bumps the
|
|
751
822
|
* continuity session's `lastActiveAt`, so the inactivity window measures real user inactivity
|
|
752
823
|
* instead of time-since-page-load (a long-lived active tab must not rotate the session on the next
|
|
753
824
|
* reload). An empty store while this load already has a session id means persistence is failing
|
|
@@ -755,7 +826,6 @@ declare class CorbadoTracker {
|
|
|
755
826
|
* to one session per page load instead of one session per event.
|
|
756
827
|
*/
|
|
757
828
|
private nextSeq;
|
|
758
|
-
private updateDeviceDebounced;
|
|
759
829
|
private resolveTrackingSourcePath;
|
|
760
830
|
trackSubflowStarted(subflowType: SubflowType, data: Record<string, any>, options?: StepOptions): void;
|
|
761
831
|
trackSubflowTrigger(subflowType: SubflowType, data: Record<string, any>, options?: StepOptions): void;
|
|
@@ -767,7 +837,7 @@ declare class CorbadoTracker {
|
|
|
767
837
|
/**
|
|
768
838
|
* Error situations:
|
|
769
839
|
* - Blocked user agent (see `isBlockedUserAgent`): skip with a debug log and return
|
|
770
|
-
* - Any error before the event is enqueued (e.g.
|
|
840
|
+
* - Any error before the event is enqueued (e.g. `JSON.stringify` in debug logging, `queue.enqueue`): log `Failed to process event "<name>" before enqueue`
|
|
771
841
|
*
|
|
772
842
|
* @internal
|
|
773
843
|
*/
|
|
@@ -926,6 +996,35 @@ declare class CorbadoTracker {
|
|
|
926
996
|
* @internal
|
|
927
997
|
*/
|
|
928
998
|
enqueueLowEvent(low: LowEvent): void;
|
|
999
|
+
/**
|
|
1000
|
+
* Record a diagnostic telemetry entry (a `level` + free-form `message`) for the current session.
|
|
1001
|
+
*
|
|
1002
|
+
* @remarks
|
|
1003
|
+
* Telemetry is delivered in the `telemetry` array of the events endpoint payload, tied to the same
|
|
1004
|
+
* session, and is never classified as an auth-flow event. By default a telemetry entry piggybacks
|
|
1005
|
+
* the next normal flush (it does not trigger one on its own); this is server-controlled. Collection
|
|
1006
|
+
* can be turned off server-side via the `telemetry` config flag. Blocked user agents are skipped.
|
|
1007
|
+
*
|
|
1008
|
+
* The message is truncated to {@link TELEMETRY_MESSAGE_MAX} characters. Never pass credentials or
|
|
1009
|
+
* PII — telemetry is for diagnostics only. Like all SDK entry points, this never throws.
|
|
1010
|
+
*/
|
|
1011
|
+
telemetry(level: TelemetryLevel, message: string): void;
|
|
1012
|
+
/** Convenience wrapper for {@link CorbadoTracker.telemetry} at `info` level. */
|
|
1013
|
+
logInfo(message: string): void;
|
|
1014
|
+
/** Convenience wrapper for {@link CorbadoTracker.telemetry} at `error` level. */
|
|
1015
|
+
logError(message: string): void;
|
|
1016
|
+
/**
|
|
1017
|
+
* Escalate an internal SDK diagnostic to the telemetry stream (self-instrumentation). This is the
|
|
1018
|
+
* sink behind {@link Logger.reportTelemetry}; chosen internal failure sites route here so faults
|
|
1019
|
+
* that are otherwise only visible with `debug: true` become observable in the field.
|
|
1020
|
+
*
|
|
1021
|
+
* @remarks
|
|
1022
|
+
* Bounded and deduped per load (a persistent fault — blocked storage, a downed endpoint — cannot
|
|
1023
|
+
* flood the stream), re-entrancy-guarded so it can never recurse, and it never throws into the
|
|
1024
|
+
* host. Diagnostics raised before the queue exists (early boot) are buffered and replayed once the
|
|
1025
|
+
* queue is ready. Messages must be stable and low-cardinality (no raw error objects / PII).
|
|
1026
|
+
*/
|
|
1027
|
+
private reportTelemetry;
|
|
929
1028
|
/**
|
|
930
1029
|
* Synchronously flush any pending events and low events via beacon. Use during page-unload
|
|
931
1030
|
* style teardown where async flushing is unreliable.
|
|
@@ -949,6 +1048,7 @@ declare class CorbadoTracker {
|
|
|
949
1048
|
emailOtpOperationFull(): EmailOtpOperationFull;
|
|
950
1049
|
smsOtpOperationFull(): SmsOtpOperationFull;
|
|
951
1050
|
provideIdentifierOperationFull(inputHtmlField?: HTMLInputElement): OperationFullProvideIdentifierWithCUI;
|
|
1051
|
+
provideDataOperationFull(config?: ProvideDataOperationConfig): ProvideDataOperationFull;
|
|
952
1052
|
socialLoginOperationFull(): SocialLoginOperationFull;
|
|
953
1053
|
appConfirmationOperationFull(explicitSpecType?: AppConfirmationOperationSpecType): AppConfirmationOperationFull;
|
|
954
1054
|
/**
|
|
@@ -1116,6 +1216,12 @@ declare class RequestQueue {
|
|
|
1116
1216
|
private readonly storage?;
|
|
1117
1217
|
private pending;
|
|
1118
1218
|
private lowsQueue;
|
|
1219
|
+
/**
|
|
1220
|
+
* Diagnostic telemetry buffered for the current session. Best-effort and never persisted (like
|
|
1221
|
+
* lows). Attached to the next outgoing batch for this session; a telemetry entry alone never arms
|
|
1222
|
+
* the flush timer (it piggybacks), unless `config.flushOnTelemetry` escalates to an immediate flush.
|
|
1223
|
+
*/
|
|
1224
|
+
private telemetryQueue;
|
|
1119
1225
|
private timer;
|
|
1120
1226
|
private isFlushing;
|
|
1121
1227
|
private destroyed;
|
|
@@ -1160,6 +1266,19 @@ declare class RequestQueue {
|
|
|
1160
1266
|
* - Any error while enqueueing or scheduling the flush timer: log "Failed to enqueue low event"
|
|
1161
1267
|
*/
|
|
1162
1268
|
enqueueLow(low: LowEvent): void;
|
|
1269
|
+
/**
|
|
1270
|
+
* Buffer a diagnostic telemetry entry for delivery with the next event batch.
|
|
1271
|
+
*
|
|
1272
|
+
* @remarks
|
|
1273
|
+
* The master switch `config.telemetry` gates collection: when off, nothing is buffered or sent.
|
|
1274
|
+
* By default a telemetry entry does NOT arm the flush timer — it piggybacks the next flush caused
|
|
1275
|
+
* by events or a lifecycle signal (it is marked dirty so the unload flush picks it up). When
|
|
1276
|
+
* `config.flushOnTelemetry` is on it escalates to an immediate flush.
|
|
1277
|
+
*
|
|
1278
|
+
* Error situations:
|
|
1279
|
+
* - Any error while enqueueing or triggering the flush: log "Failed to enqueue telemetry"
|
|
1280
|
+
*/
|
|
1281
|
+
enqueueTelemetry(entry: TelemetryEntry): void;
|
|
1163
1282
|
private scheduleAfterEnqueue;
|
|
1164
1283
|
private scheduleFlush;
|
|
1165
1284
|
private clearTimer;
|
|
@@ -1179,6 +1298,7 @@ declare class RequestQueue {
|
|
|
1179
1298
|
private attachBatchMeta;
|
|
1180
1299
|
private getDuePending;
|
|
1181
1300
|
private takeLows;
|
|
1301
|
+
private takeTelemetry;
|
|
1182
1302
|
private shouldRequestConfig;
|
|
1183
1303
|
/**
|
|
1184
1304
|
* Handle the server's answer to the config request. With a cached boot config the boot-snapshot
|
|
@@ -1364,6 +1484,9 @@ declare function setExperiments(assignments: Record<string, string>): void;
|
|
|
1364
1484
|
declare function clearExperiment(key: string): void;
|
|
1365
1485
|
declare function clearExperiments(): void;
|
|
1366
1486
|
declare function getExperiments(): Record<string, string>;
|
|
1487
|
+
declare function telemetry(level: TelemetryLevel, message: string): void;
|
|
1488
|
+
declare function logInfo(message: string): void;
|
|
1489
|
+
declare function logError(message: string): void;
|
|
1367
1490
|
declare function destroy(): Promise<void>;
|
|
1368
1491
|
|
|
1369
|
-
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_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, type PasswordLoginCUICeremonyStart, type PasswordLoginCUIGetOptionsFinished, type PasswordLoginCUIGetOptionsStart, type PasswordLoginCUISpecType, type PasswordLoginCUITypedError, 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 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 TrackerOptions, type Transport, type TransportMakeRequestResponse, type TransportOptions, type UserReference, cacheConfig, clearExperiment, clearExperiments, createLogger, destroy, getExperiments, getTracker, init, loadCachedConfig, parseReliabilityConfig, resetSession, setExperiment, setExperiments };
|
|
1492
|
+
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_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, 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 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ type Conversion = {
|
|
|
85
85
|
} & UserReference;
|
|
86
86
|
type FlowFinished = {
|
|
87
87
|
flowName: FlowType;
|
|
88
|
-
explicitOutcome?: "skipped" | "visible-auto-skip" | "
|
|
88
|
+
explicitOutcome?: "skipped" | "visible-auto-skip" | "invisible";
|
|
89
89
|
} & UserReference;
|
|
90
90
|
type FlowReset = {
|
|
91
91
|
flowName?: FlowType;
|
|
@@ -160,6 +160,21 @@ interface LowEvent {
|
|
|
160
160
|
ts: number;
|
|
161
161
|
durationMs?: number;
|
|
162
162
|
}
|
|
163
|
+
type TelemetryLevel = "info" | "error";
|
|
164
|
+
/**
|
|
165
|
+
* A diagnostic telemetry entry (a severity level + free-form message) recorded by the integrating
|
|
166
|
+
* app or by the SDK itself. Telemetry rides along in the `telemetry` array of the events endpoint
|
|
167
|
+
* payload, tied to the same session, and is never classified as an auth-flow event.
|
|
168
|
+
*/
|
|
169
|
+
interface TelemetryEntry {
|
|
170
|
+
/** Client-generated idempotency id (uuidv7) so safe resends (retry/beacon) dedupe server-side. */
|
|
171
|
+
id: string;
|
|
172
|
+
level: TelemetryLevel;
|
|
173
|
+
/** Free-form diagnostic message. Truncated client-side. Must not contain credentials or PII. */
|
|
174
|
+
message: string;
|
|
175
|
+
/** Capture time, unix ms. */
|
|
176
|
+
ts: number;
|
|
177
|
+
}
|
|
163
178
|
interface EventBatchMeta {
|
|
164
179
|
sent: number;
|
|
165
180
|
transport: "fetch" | "beacon";
|
|
@@ -180,6 +195,7 @@ interface EventBatch {
|
|
|
180
195
|
events: Event[];
|
|
181
196
|
sdk: SdkInfo;
|
|
182
197
|
lows?: LowEvent[];
|
|
198
|
+
telemetry?: TelemetryEntry[];
|
|
183
199
|
meta?: EventBatchMeta;
|
|
184
200
|
}
|
|
185
201
|
type DeviceType = "web" | "app" | "other";
|
|
@@ -214,6 +230,7 @@ type JavaScriptHighEntropy = {
|
|
|
214
230
|
platform?: string;
|
|
215
231
|
mobile?: boolean;
|
|
216
232
|
platformVersion?: string;
|
|
233
|
+
model?: string;
|
|
217
234
|
};
|
|
218
235
|
type ClientEnvHandleMeta = {
|
|
219
236
|
timestamp: number;
|
|
@@ -279,6 +296,18 @@ interface SdkReliabilityConfig {
|
|
|
279
296
|
* the historical behavior; can be disabled server-side to rely solely on the queue's triggers.
|
|
280
297
|
*/
|
|
281
298
|
tlf: boolean;
|
|
299
|
+
/**
|
|
300
|
+
* Master switch for the diagnostic telemetry stream. When true the SDK sends buffered telemetry
|
|
301
|
+
* entries piggybacked on normal event requests; when false it collects and sends nothing. Defaults
|
|
302
|
+
* to true (telemetry is on out of the box) and can be turned off server-side without a redeploy.
|
|
303
|
+
*/
|
|
304
|
+
telemetry: boolean;
|
|
305
|
+
/**
|
|
306
|
+
* When true (and `telemetry` is enabled), enqueuing a telemetry entry triggers an immediate flush
|
|
307
|
+
* so diagnostics go out promptly (e.g. before a crash/navigation). Defaults to false: a telemetry
|
|
308
|
+
* entry alone never triggers a flush, it only rides the next flush caused by anything else.
|
|
309
|
+
*/
|
|
310
|
+
flushOnTelemetry: boolean;
|
|
282
311
|
/**
|
|
283
312
|
* Event names that trigger an immediate flush when enqueued (e.g. `flow_finished`,
|
|
284
313
|
* `conversion`), so high-value events go out via a normal fetch while the page is still alive
|
|
@@ -291,12 +320,22 @@ interface SdkReliabilityConfig {
|
|
|
291
320
|
retry: SdkRetryConfig;
|
|
292
321
|
}
|
|
293
322
|
|
|
323
|
+
/** Sink that escalates a diagnostic message to the telemetry stream. */
|
|
324
|
+
type TelemetrySink = (level: TelemetryLevel, message: string) => void;
|
|
294
325
|
interface Logger {
|
|
295
326
|
debug(message: string, ...args: unknown[]): void;
|
|
296
327
|
info(message: string, ...args: unknown[]): void;
|
|
297
328
|
warn(message: string, ...args: unknown[]): void;
|
|
298
329
|
error(message: string, ...args: unknown[]): void;
|
|
299
330
|
critical(message: string, ...args: unknown[]): void;
|
|
331
|
+
/**
|
|
332
|
+
* Escalate a diagnostic message to the telemetry stream, if a sink is attached (no-op otherwise).
|
|
333
|
+
* Unlike the level methods, telemetry is delivered to the backend regardless of the `debug` flag.
|
|
334
|
+
* Optional so an integrator-provided custom logger stays valid without implementing it.
|
|
335
|
+
*/
|
|
336
|
+
reportTelemetry?(level: TelemetryLevel, message: string): void;
|
|
337
|
+
/** Attach (or clear) the telemetry sink. Called once by the tracker after the queue exists. */
|
|
338
|
+
setTelemetrySink?(sink: TelemetrySink | undefined): void;
|
|
300
339
|
}
|
|
301
340
|
interface CreateLoggerOptions {
|
|
302
341
|
debug: boolean;
|
|
@@ -553,10 +592,11 @@ type PasswordEnrollmentTypedError = {
|
|
|
553
592
|
type PasswordEnrollmentTypedErrorCode = "requirements_not_fulfilled";
|
|
554
593
|
type PasswordEnrollmentExplicitSpecType = "password-set" | "password-reset";
|
|
555
594
|
type PasswordEnrollmentAutoTrackConfig = {
|
|
556
|
-
explicitSpecType
|
|
557
|
-
inputHtmlField
|
|
595
|
+
explicitSpecType?: PasswordEnrollmentExplicitSpecType;
|
|
596
|
+
inputHtmlField?: HTMLInputElement;
|
|
558
597
|
};
|
|
559
598
|
declare class PasswordEnrollmentOperationFull extends OperationFull {
|
|
599
|
+
readonly clientValidation: StepHelper;
|
|
560
600
|
readonly postResponse: StepHelper<{}, {}, PasswordEnrollmentTypedError>;
|
|
561
601
|
private lowEventTracker?;
|
|
562
602
|
constructor(tracker: CorbadoTracker, autoTrackConfig?: PasswordEnrollmentAutoTrackConfig);
|
|
@@ -641,6 +681,28 @@ declare class AppConfirmationOperationFull extends OperationFull {
|
|
|
641
681
|
constructor(tracker: CorbadoTracker, explicitSpecType?: AppConfirmationOperationSpecType);
|
|
642
682
|
}
|
|
643
683
|
|
|
684
|
+
type ProvideDataOperationSpecType = "signup" | "login" | "recovery" | "enrollment";
|
|
685
|
+
type ProvideDataOperationStart = {
|
|
686
|
+
/** Stable name of the data field collected by this subflow, when known. */
|
|
687
|
+
fieldName?: string;
|
|
688
|
+
explicitSpecType?: ProvideDataOperationSpecType;
|
|
689
|
+
};
|
|
690
|
+
type ProvideDataOperationConfig = ProvideDataOperationStart & {
|
|
691
|
+
/** The input field whose low-level interaction signals should be collected. */
|
|
692
|
+
inputHtmlField?: HTMLInputElement;
|
|
693
|
+
};
|
|
694
|
+
type ProvideDataOperationPostResponseStart = {
|
|
695
|
+
explicitSpecType?: ProvideDataOperationSpecType;
|
|
696
|
+
};
|
|
697
|
+
/** Tracks a user-triggered data submission and its server response. */
|
|
698
|
+
declare class ProvideDataOperationFull extends OperationFull {
|
|
699
|
+
readonly clientValidation: StepHelper;
|
|
700
|
+
readonly postResponse: StepHelper<ProvideDataOperationPostResponseStart>;
|
|
701
|
+
private lowEventTracker?;
|
|
702
|
+
constructor(tracker: CorbadoTracker, config?: ProvideDataOperationConfig);
|
|
703
|
+
destroy(): void;
|
|
704
|
+
}
|
|
705
|
+
|
|
644
706
|
interface TrackerOptions {
|
|
645
707
|
projectId: string;
|
|
646
708
|
apiBaseUrl: string;
|
|
@@ -649,7 +711,10 @@ interface TrackerOptions {
|
|
|
649
711
|
cookieDomain?: string;
|
|
650
712
|
debug?: boolean;
|
|
651
713
|
logger?: Logger;
|
|
714
|
+
/** Minimum time between attaching cached device info to events. */
|
|
652
715
|
deviceInfoDebounceTime?: number;
|
|
716
|
+
/** Per-field collection timeout. Defaults to 200ms. */
|
|
717
|
+
deviceInfoCollectorTimeout?: number;
|
|
653
718
|
defaultTags?: Record<string, string>;
|
|
654
719
|
/**
|
|
655
720
|
* Experiment assignments to seed at init (experiment key → variant). Merged over any persisted
|
|
@@ -664,6 +729,8 @@ interface TrackerOptions {
|
|
|
664
729
|
* It will be removed in a future release.
|
|
665
730
|
*/
|
|
666
731
|
flushInterval?: number;
|
|
732
|
+
/** Generates new Observe session ids; returned values must be UUID-compatible. Existing stored sessions are still reused. */
|
|
733
|
+
sessionIdGenerator?: () => string;
|
|
667
734
|
}
|
|
668
735
|
declare class CorbadoTracker {
|
|
669
736
|
private options;
|
|
@@ -680,12 +747,15 @@ declare class CorbadoTracker {
|
|
|
680
747
|
* (see {@link handleConfig}).
|
|
681
748
|
*/
|
|
682
749
|
private config;
|
|
683
|
-
private
|
|
684
|
-
private deviceInfoDebounceTime;
|
|
685
|
-
private deviceInfoTransmittedLastTime;
|
|
750
|
+
private deviceInfoManager;
|
|
686
751
|
private seq;
|
|
687
752
|
/** Persistent experiment assignments (experiment key → variant), attached to every produced event. */
|
|
688
753
|
private experiments;
|
|
754
|
+
/** Self-instrumentation state: re-entrancy guard, readiness, per-load dedupe, and pre-queue buffer. */
|
|
755
|
+
private telemetryReporting;
|
|
756
|
+
private telemetryReady;
|
|
757
|
+
private readonly reportedTelemetryKeys;
|
|
758
|
+
private pendingSelfTelemetry;
|
|
689
759
|
constructor(options: TrackerOptions);
|
|
690
760
|
/**
|
|
691
761
|
* Cache fresh server config as last-known so the next page load boots with it. When this load
|
|
@@ -735,6 +805,7 @@ declare class CorbadoTracker {
|
|
|
735
805
|
*/
|
|
736
806
|
private resolveExperiments;
|
|
737
807
|
private isTrackingBlocked;
|
|
808
|
+
private createSessionId;
|
|
738
809
|
private getSessionId;
|
|
739
810
|
/**
|
|
740
811
|
* Resolve the session id from localStorage so it survives reloads and is shared across tabs of the
|
|
@@ -746,8 +817,8 @@ declare class CorbadoTracker {
|
|
|
746
817
|
* Return the next sequence number. With session continuity the counter is persisted so ordering
|
|
747
818
|
* survives reloads/redirects; the read-increment-write runs under a cross-tab Web Lock
|
|
748
819
|
* ({@link SEQ_LOCK_NAME}) so two tabs sharing the session cannot allocate the same seq (where Web
|
|
749
|
-
* Locks are unavailable it degrades to the historical best-effort merge).
|
|
750
|
-
* seq order matches `track()` call order within a tab. Every tracked event also bumps the
|
|
820
|
+
* Locks are unavailable or take more than 5ms it degrades to the historical best-effort merge).
|
|
821
|
+
* Lock grants are FIFO, so seq order matches `track()` call order within a tab. Every tracked event also bumps the
|
|
751
822
|
* continuity session's `lastActiveAt`, so the inactivity window measures real user inactivity
|
|
752
823
|
* instead of time-since-page-load (a long-lived active tab must not rotate the session on the next
|
|
753
824
|
* reload). An empty store while this load already has a session id means persistence is failing
|
|
@@ -755,7 +826,6 @@ declare class CorbadoTracker {
|
|
|
755
826
|
* to one session per page load instead of one session per event.
|
|
756
827
|
*/
|
|
757
828
|
private nextSeq;
|
|
758
|
-
private updateDeviceDebounced;
|
|
759
829
|
private resolveTrackingSourcePath;
|
|
760
830
|
trackSubflowStarted(subflowType: SubflowType, data: Record<string, any>, options?: StepOptions): void;
|
|
761
831
|
trackSubflowTrigger(subflowType: SubflowType, data: Record<string, any>, options?: StepOptions): void;
|
|
@@ -767,7 +837,7 @@ declare class CorbadoTracker {
|
|
|
767
837
|
/**
|
|
768
838
|
* Error situations:
|
|
769
839
|
* - Blocked user agent (see `isBlockedUserAgent`): skip with a debug log and return
|
|
770
|
-
* - Any error before the event is enqueued (e.g.
|
|
840
|
+
* - Any error before the event is enqueued (e.g. `JSON.stringify` in debug logging, `queue.enqueue`): log `Failed to process event "<name>" before enqueue`
|
|
771
841
|
*
|
|
772
842
|
* @internal
|
|
773
843
|
*/
|
|
@@ -926,6 +996,35 @@ declare class CorbadoTracker {
|
|
|
926
996
|
* @internal
|
|
927
997
|
*/
|
|
928
998
|
enqueueLowEvent(low: LowEvent): void;
|
|
999
|
+
/**
|
|
1000
|
+
* Record a diagnostic telemetry entry (a `level` + free-form `message`) for the current session.
|
|
1001
|
+
*
|
|
1002
|
+
* @remarks
|
|
1003
|
+
* Telemetry is delivered in the `telemetry` array of the events endpoint payload, tied to the same
|
|
1004
|
+
* session, and is never classified as an auth-flow event. By default a telemetry entry piggybacks
|
|
1005
|
+
* the next normal flush (it does not trigger one on its own); this is server-controlled. Collection
|
|
1006
|
+
* can be turned off server-side via the `telemetry` config flag. Blocked user agents are skipped.
|
|
1007
|
+
*
|
|
1008
|
+
* The message is truncated to {@link TELEMETRY_MESSAGE_MAX} characters. Never pass credentials or
|
|
1009
|
+
* PII — telemetry is for diagnostics only. Like all SDK entry points, this never throws.
|
|
1010
|
+
*/
|
|
1011
|
+
telemetry(level: TelemetryLevel, message: string): void;
|
|
1012
|
+
/** Convenience wrapper for {@link CorbadoTracker.telemetry} at `info` level. */
|
|
1013
|
+
logInfo(message: string): void;
|
|
1014
|
+
/** Convenience wrapper for {@link CorbadoTracker.telemetry} at `error` level. */
|
|
1015
|
+
logError(message: string): void;
|
|
1016
|
+
/**
|
|
1017
|
+
* Escalate an internal SDK diagnostic to the telemetry stream (self-instrumentation). This is the
|
|
1018
|
+
* sink behind {@link Logger.reportTelemetry}; chosen internal failure sites route here so faults
|
|
1019
|
+
* that are otherwise only visible with `debug: true` become observable in the field.
|
|
1020
|
+
*
|
|
1021
|
+
* @remarks
|
|
1022
|
+
* Bounded and deduped per load (a persistent fault — blocked storage, a downed endpoint — cannot
|
|
1023
|
+
* flood the stream), re-entrancy-guarded so it can never recurse, and it never throws into the
|
|
1024
|
+
* host. Diagnostics raised before the queue exists (early boot) are buffered and replayed once the
|
|
1025
|
+
* queue is ready. Messages must be stable and low-cardinality (no raw error objects / PII).
|
|
1026
|
+
*/
|
|
1027
|
+
private reportTelemetry;
|
|
929
1028
|
/**
|
|
930
1029
|
* Synchronously flush any pending events and low events via beacon. Use during page-unload
|
|
931
1030
|
* style teardown where async flushing is unreliable.
|
|
@@ -949,6 +1048,7 @@ declare class CorbadoTracker {
|
|
|
949
1048
|
emailOtpOperationFull(): EmailOtpOperationFull;
|
|
950
1049
|
smsOtpOperationFull(): SmsOtpOperationFull;
|
|
951
1050
|
provideIdentifierOperationFull(inputHtmlField?: HTMLInputElement): OperationFullProvideIdentifierWithCUI;
|
|
1051
|
+
provideDataOperationFull(config?: ProvideDataOperationConfig): ProvideDataOperationFull;
|
|
952
1052
|
socialLoginOperationFull(): SocialLoginOperationFull;
|
|
953
1053
|
appConfirmationOperationFull(explicitSpecType?: AppConfirmationOperationSpecType): AppConfirmationOperationFull;
|
|
954
1054
|
/**
|
|
@@ -1116,6 +1216,12 @@ declare class RequestQueue {
|
|
|
1116
1216
|
private readonly storage?;
|
|
1117
1217
|
private pending;
|
|
1118
1218
|
private lowsQueue;
|
|
1219
|
+
/**
|
|
1220
|
+
* Diagnostic telemetry buffered for the current session. Best-effort and never persisted (like
|
|
1221
|
+
* lows). Attached to the next outgoing batch for this session; a telemetry entry alone never arms
|
|
1222
|
+
* the flush timer (it piggybacks), unless `config.flushOnTelemetry` escalates to an immediate flush.
|
|
1223
|
+
*/
|
|
1224
|
+
private telemetryQueue;
|
|
1119
1225
|
private timer;
|
|
1120
1226
|
private isFlushing;
|
|
1121
1227
|
private destroyed;
|
|
@@ -1160,6 +1266,19 @@ declare class RequestQueue {
|
|
|
1160
1266
|
* - Any error while enqueueing or scheduling the flush timer: log "Failed to enqueue low event"
|
|
1161
1267
|
*/
|
|
1162
1268
|
enqueueLow(low: LowEvent): void;
|
|
1269
|
+
/**
|
|
1270
|
+
* Buffer a diagnostic telemetry entry for delivery with the next event batch.
|
|
1271
|
+
*
|
|
1272
|
+
* @remarks
|
|
1273
|
+
* The master switch `config.telemetry` gates collection: when off, nothing is buffered or sent.
|
|
1274
|
+
* By default a telemetry entry does NOT arm the flush timer — it piggybacks the next flush caused
|
|
1275
|
+
* by events or a lifecycle signal (it is marked dirty so the unload flush picks it up). When
|
|
1276
|
+
* `config.flushOnTelemetry` is on it escalates to an immediate flush.
|
|
1277
|
+
*
|
|
1278
|
+
* Error situations:
|
|
1279
|
+
* - Any error while enqueueing or triggering the flush: log "Failed to enqueue telemetry"
|
|
1280
|
+
*/
|
|
1281
|
+
enqueueTelemetry(entry: TelemetryEntry): void;
|
|
1163
1282
|
private scheduleAfterEnqueue;
|
|
1164
1283
|
private scheduleFlush;
|
|
1165
1284
|
private clearTimer;
|
|
@@ -1179,6 +1298,7 @@ declare class RequestQueue {
|
|
|
1179
1298
|
private attachBatchMeta;
|
|
1180
1299
|
private getDuePending;
|
|
1181
1300
|
private takeLows;
|
|
1301
|
+
private takeTelemetry;
|
|
1182
1302
|
private shouldRequestConfig;
|
|
1183
1303
|
/**
|
|
1184
1304
|
* Handle the server's answer to the config request. With a cached boot config the boot-snapshot
|
|
@@ -1364,6 +1484,9 @@ declare function setExperiments(assignments: Record<string, string>): void;
|
|
|
1364
1484
|
declare function clearExperiment(key: string): void;
|
|
1365
1485
|
declare function clearExperiments(): void;
|
|
1366
1486
|
declare function getExperiments(): Record<string, string>;
|
|
1487
|
+
declare function telemetry(level: TelemetryLevel, message: string): void;
|
|
1488
|
+
declare function logInfo(message: string): void;
|
|
1489
|
+
declare function logError(message: string): void;
|
|
1367
1490
|
declare function destroy(): Promise<void>;
|
|
1368
1491
|
|
|
1369
|
-
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_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, type PasswordLoginCUICeremonyStart, type PasswordLoginCUIGetOptionsFinished, type PasswordLoginCUIGetOptionsStart, type PasswordLoginCUISpecType, type PasswordLoginCUITypedError, 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 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 TrackerOptions, type Transport, type TransportMakeRequestResponse, type TransportOptions, type UserReference, cacheConfig, clearExperiment, clearExperiments, createLogger, destroy, getExperiments, getTracker, init, loadCachedConfig, parseReliabilityConfig, resetSession, setExperiment, setExperiments };
|
|
1492
|
+
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_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, 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 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 };
|