@corbado/observe 0.4.0 → 0.5.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/index.d.mts CHANGED
@@ -38,6 +38,13 @@ interface BaseEvent {
38
38
  user?: UserReference;
39
39
  contexts?: Record<string, unknown>;
40
40
  tags?: Record<string, string>;
41
+ /**
42
+ * Experiment assignments active for this event, as a map of experiment key → variant value (e.g.
43
+ * `{ button_color: "blue" }`). First-class, prefix-free representation of A/B-test exposure: the
44
+ * backend attaches these to the flow. Resolved per event from the tracker's persistent assignments
45
+ * (see `setExperiment`) merged with any per-call override.
46
+ */
47
+ experiments?: Record<string, string>;
41
48
  deviceInfo?: DeviceInfo;
42
49
  meta?: EventMeta;
43
50
  }
@@ -130,6 +137,8 @@ type AuthDecisionFinished = {
130
137
  type StepOptions = {
131
138
  userReference?: UserReference;
132
139
  explicitTimestamp?: number;
140
+ /** Per-call experiment override (experiment key → variant), merged over the persistent assignments. */
141
+ experiments?: Record<string, string>;
133
142
  };
134
143
  type SubflowTrigger = {
135
144
  actor: "system" | "user";
@@ -470,10 +479,19 @@ type PasswordLoginTypedError = {
470
479
  code: PasswordLoginTypedErrorCode;
471
480
  };
472
481
  type PasswordLoginTypedErrorCode = "invalid_password" | "user_not_found" | "account_locked";
473
- type PasswordLoginExplicitSpecType = "password-known-identifier" | "password-with-identifier";
474
482
  type PasswordLoginAutoTrackConfig = {
475
- explicitSpecType: PasswordLoginExplicitSpecType;
483
+ explicitSpecType: "password-known-identifier";
484
+ /** The password input field. */
476
485
  inputHtmlField: HTMLInputElement;
486
+ } | {
487
+ explicitSpecType: "password-with-identifier";
488
+ /** The password input field. */
489
+ inputHtmlField: HTMLInputElement;
490
+ /**
491
+ * The identifier (e.g. email) input field. Accepted but not tracked yet — low-event
492
+ * tracking for a second field lands together with per-field attribution.
493
+ */
494
+ identifierInputHtmlField?: HTMLInputElement;
477
495
  };
478
496
  declare class PasswordLoginOperationFull extends OperationFull {
479
497
  readonly postResponse: StepHelper<{}, {}, PasswordLoginTypedError>;
@@ -574,6 +592,11 @@ interface TrackerOptions {
574
592
  logger?: Logger;
575
593
  deviceInfoDebounceTime?: number;
576
594
  defaultTags?: Record<string, string>;
595
+ /**
596
+ * Experiment assignments to seed at init (experiment key → variant). Merged over any persisted
597
+ * assignments and then attached to every event the tracker produces (see {@link CorbadoTracker.setExperiment}).
598
+ */
599
+ experiments?: Record<string, string>;
577
600
  applicationId?: string;
578
601
  /**
579
602
  * @deprecated The flush interval is server-controlled via the SDK reliability config
@@ -598,6 +621,8 @@ declare class CorbadoTracker {
598
621
  private deviceInfoDebounceTime;
599
622
  private deviceInfoTransmittedLastTime;
600
623
  private seq;
624
+ /** Persistent experiment assignments (experiment key → variant), attached to every produced event. */
625
+ private experiments;
601
626
  constructor(options: TrackerOptions);
602
627
  /**
603
628
  * Cache fresh server config as last-known. Boot-snapshot model: the config is NOT applied to this
@@ -610,6 +635,40 @@ declare class CorbadoTracker {
610
635
  */
611
636
  getLogger(): Logger;
612
637
  private applicationTag;
638
+ /**
639
+ * Register the user's variant for an experiment (e.g. `setExperiment("button_color", "blue")`).
640
+ *
641
+ * @remarks
642
+ * Corbado Observe does not assign variants — your app decides, and this records the assignment so
643
+ * Observe can attribute flows to it. The assignment persists (localStorage) across reloads and
644
+ * `resetSession`, and is attached to every event the tracker produces until you change or clear it.
645
+ * Multiple experiments can be active at once. Set it close to where the variant actually affects the
646
+ * user (or use the per-call `experiments` argument on a tracking method) to avoid over-attributing
647
+ * exposure; call {@link clearExperiment} when it no longer applies (e.g. on logout).
648
+ *
649
+ * Never throws: invalid input is ignored with a debug log.
650
+ */
651
+ setExperiment(key: string, variant: string): void;
652
+ /**
653
+ * Register several experiment assignments at once (experiment key → variant). Additive: existing
654
+ * assignments for other keys are kept. See {@link setExperiment}.
655
+ */
656
+ setExperiments(assignments: Record<string, string>): void;
657
+ /** Remove a single experiment assignment. */
658
+ clearExperiment(key: string): void;
659
+ /** Remove all experiment assignments. */
660
+ clearExperiments(): void;
661
+ /** Returns a copy of the currently active experiment assignments. */
662
+ getExperiments(): Record<string, string>;
663
+ private static isValidExperimentKey;
664
+ private static isValidExperimentVariant;
665
+ private loadPersistedExperiments;
666
+ private persistExperiments;
667
+ /**
668
+ * Resolves the experiments to attach to one event: the persistent assignments with any per-call
669
+ * override merged on top. Returns undefined when there are none (so the field is omitted).
670
+ */
671
+ private resolveExperiments;
613
672
  private isTrackingBlocked;
614
673
  private getSessionId;
615
674
  /**
@@ -645,7 +704,7 @@ declare class CorbadoTracker {
645
704
  *
646
705
  * @internal
647
706
  */
648
- track(name: AuthEventName, data: Record<string, any>, userReference?: UserReference, tags?: Record<string, string>, contexts?: Record<string, any>, explicitTimestamp?: number): Promise<void>;
707
+ track(name: AuthEventName, data: Record<string, any>, userReference?: UserReference, tags?: Record<string, string>, contexts?: Record<string, any>, explicitTimestamp?: number, experiments?: Record<string, string>): Promise<void>;
649
708
  /**
650
709
  * Track when an authentication flow (or flow selection screen) becomes visible.
651
710
  *
@@ -666,7 +725,7 @@ declare class CorbadoTracker {
666
725
  * });
667
726
  * ```
668
727
  */
669
- flowStarted(data: FlowStarted | MultiFlowStarted, tags?: Record<string, string>): void;
728
+ flowStarted(data: FlowStarted | MultiFlowStarted, tags?: Record<string, string>, experiments?: Record<string, string>): void;
670
729
  /**
671
730
  * Track when the user commits to a specific flow.
672
731
  *
@@ -682,7 +741,7 @@ declare class CorbadoTracker {
682
741
  * tracker.flowDecided({flowName: "signup"});
683
742
  * ```
684
743
  */
685
- flowDecided(data: FlowDecided, tags?: Record<string, string>): void;
744
+ flowDecided(data: FlowDecided, tags?: Record<string, string>, experiments?: Record<string, string>): void;
686
745
  /**
687
746
  * Track a business/marketing conversion that is not part of an authentication flow.
688
747
  *
@@ -705,7 +764,7 @@ declare class CorbadoTracker {
705
764
  * });
706
765
  * ```
707
766
  */
708
- conversion(data: Conversion, tags?: Record<string, string>): void;
767
+ conversion(data: Conversion, tags?: Record<string, string>, experiments?: Record<string, string>): void;
709
768
  /**
710
769
  * Track when a flow successfully completes.
711
770
  *
@@ -726,7 +785,7 @@ declare class CorbadoTracker {
726
785
  * });
727
786
  * ```
728
787
  */
729
- flowFinished(data: FlowFinished, tags?: Record<string, string>): void;
788
+ flowFinished(data: FlowFinished, tags?: Record<string, string>, experiments?: Record<string, string>): void;
730
789
  /**
731
790
  * Track when an in-progress flow is reset and restarted.
732
791
  *
@@ -742,7 +801,7 @@ declare class CorbadoTracker {
742
801
  * tracker.flowReset({flowName: "login"});
743
802
  * ```
744
803
  */
745
- flowReset(data: FlowReset | MultiFlowReset, tags?: Record<string, string>): void;
804
+ flowReset(data: FlowReset | MultiFlowReset, tags?: Record<string, string>, experiments?: Record<string, string>): void;
746
805
  /**
747
806
  * Track when a flow is considered finished because another flow finished it implicitly.
748
807
  *
@@ -763,7 +822,7 @@ declare class CorbadoTracker {
763
822
  * });
764
823
  * ```
765
824
  */
766
- flowAutoFinished(data: FlowAutoFinished, tags?: Record<string, string>): void;
825
+ flowAutoFinished(data: FlowAutoFinished, tags?: Record<string, string>, experiments?: Record<string, string>): void;
767
826
  /**
768
827
  * Track when you present authentication method choices to the user.
769
828
  *
@@ -784,10 +843,10 @@ declare class CorbadoTracker {
784
843
  * });
785
844
  * ```
786
845
  */
787
- authMethodsDecisionStarted(data: AuthMethodDecisionStarted, tags?: Record<string, string>): void;
788
- authMethodsDecisionFinished(data: AuthMethodDecisionFinished, tags?: Record<string, string>): void;
789
- authDecisionStarted(data: AuthDecisionStarted): void;
790
- authDecisionFinished(data: AuthDecisionFinished): void;
846
+ authMethodsDecisionStarted(data: AuthMethodDecisionStarted, tags?: Record<string, string>, experiments?: Record<string, string>): void;
847
+ authMethodsDecisionFinished(data: AuthMethodDecisionFinished, tags?: Record<string, string>, experiments?: Record<string, string>): void;
848
+ authDecisionStarted(data: AuthDecisionStarted, tags?: Record<string, string>, experiments?: Record<string, string>): void;
849
+ authDecisionFinished(data: AuthDecisionFinished, tags?: Record<string, string>, experiments?: Record<string, string>): void;
791
850
  /**
792
851
  * Enqueue a "low" event (granular DOM/window/visualviewport/PWM signal) for the current session.
793
852
  *
@@ -1213,6 +1272,11 @@ declare class EventStore {
1213
1272
  declare function init(options: TrackerOptions): CorbadoTracker;
1214
1273
  declare function getTracker(): CorbadoTracker | undefined;
1215
1274
  declare function resetSession(): string | undefined;
1275
+ declare function setExperiment(key: string, variant: string): void;
1276
+ declare function setExperiments(assignments: Record<string, string>): void;
1277
+ declare function clearExperiment(key: string): void;
1278
+ declare function clearExperiments(): void;
1279
+ declare function getExperiments(): Record<string, string>;
1216
1280
  declare function destroy(): Promise<void>;
1217
1281
 
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 };
1282
+ 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, clearExperiment, clearExperiments, createLogger, destroy, getExperiments, getTracker, init, loadCachedConfig, parseReliabilityConfig, resetSession, setExperiment, setExperiments };
package/dist/index.d.ts CHANGED
@@ -38,6 +38,13 @@ interface BaseEvent {
38
38
  user?: UserReference;
39
39
  contexts?: Record<string, unknown>;
40
40
  tags?: Record<string, string>;
41
+ /**
42
+ * Experiment assignments active for this event, as a map of experiment key → variant value (e.g.
43
+ * `{ button_color: "blue" }`). First-class, prefix-free representation of A/B-test exposure: the
44
+ * backend attaches these to the flow. Resolved per event from the tracker's persistent assignments
45
+ * (see `setExperiment`) merged with any per-call override.
46
+ */
47
+ experiments?: Record<string, string>;
41
48
  deviceInfo?: DeviceInfo;
42
49
  meta?: EventMeta;
43
50
  }
@@ -130,6 +137,8 @@ type AuthDecisionFinished = {
130
137
  type StepOptions = {
131
138
  userReference?: UserReference;
132
139
  explicitTimestamp?: number;
140
+ /** Per-call experiment override (experiment key → variant), merged over the persistent assignments. */
141
+ experiments?: Record<string, string>;
133
142
  };
134
143
  type SubflowTrigger = {
135
144
  actor: "system" | "user";
@@ -470,10 +479,19 @@ type PasswordLoginTypedError = {
470
479
  code: PasswordLoginTypedErrorCode;
471
480
  };
472
481
  type PasswordLoginTypedErrorCode = "invalid_password" | "user_not_found" | "account_locked";
473
- type PasswordLoginExplicitSpecType = "password-known-identifier" | "password-with-identifier";
474
482
  type PasswordLoginAutoTrackConfig = {
475
- explicitSpecType: PasswordLoginExplicitSpecType;
483
+ explicitSpecType: "password-known-identifier";
484
+ /** The password input field. */
476
485
  inputHtmlField: HTMLInputElement;
486
+ } | {
487
+ explicitSpecType: "password-with-identifier";
488
+ /** The password input field. */
489
+ inputHtmlField: HTMLInputElement;
490
+ /**
491
+ * The identifier (e.g. email) input field. Accepted but not tracked yet — low-event
492
+ * tracking for a second field lands together with per-field attribution.
493
+ */
494
+ identifierInputHtmlField?: HTMLInputElement;
477
495
  };
478
496
  declare class PasswordLoginOperationFull extends OperationFull {
479
497
  readonly postResponse: StepHelper<{}, {}, PasswordLoginTypedError>;
@@ -574,6 +592,11 @@ interface TrackerOptions {
574
592
  logger?: Logger;
575
593
  deviceInfoDebounceTime?: number;
576
594
  defaultTags?: Record<string, string>;
595
+ /**
596
+ * Experiment assignments to seed at init (experiment key → variant). Merged over any persisted
597
+ * assignments and then attached to every event the tracker produces (see {@link CorbadoTracker.setExperiment}).
598
+ */
599
+ experiments?: Record<string, string>;
577
600
  applicationId?: string;
578
601
  /**
579
602
  * @deprecated The flush interval is server-controlled via the SDK reliability config
@@ -598,6 +621,8 @@ declare class CorbadoTracker {
598
621
  private deviceInfoDebounceTime;
599
622
  private deviceInfoTransmittedLastTime;
600
623
  private seq;
624
+ /** Persistent experiment assignments (experiment key → variant), attached to every produced event. */
625
+ private experiments;
601
626
  constructor(options: TrackerOptions);
602
627
  /**
603
628
  * Cache fresh server config as last-known. Boot-snapshot model: the config is NOT applied to this
@@ -610,6 +635,40 @@ declare class CorbadoTracker {
610
635
  */
611
636
  getLogger(): Logger;
612
637
  private applicationTag;
638
+ /**
639
+ * Register the user's variant for an experiment (e.g. `setExperiment("button_color", "blue")`).
640
+ *
641
+ * @remarks
642
+ * Corbado Observe does not assign variants — your app decides, and this records the assignment so
643
+ * Observe can attribute flows to it. The assignment persists (localStorage) across reloads and
644
+ * `resetSession`, and is attached to every event the tracker produces until you change or clear it.
645
+ * Multiple experiments can be active at once. Set it close to where the variant actually affects the
646
+ * user (or use the per-call `experiments` argument on a tracking method) to avoid over-attributing
647
+ * exposure; call {@link clearExperiment} when it no longer applies (e.g. on logout).
648
+ *
649
+ * Never throws: invalid input is ignored with a debug log.
650
+ */
651
+ setExperiment(key: string, variant: string): void;
652
+ /**
653
+ * Register several experiment assignments at once (experiment key → variant). Additive: existing
654
+ * assignments for other keys are kept. See {@link setExperiment}.
655
+ */
656
+ setExperiments(assignments: Record<string, string>): void;
657
+ /** Remove a single experiment assignment. */
658
+ clearExperiment(key: string): void;
659
+ /** Remove all experiment assignments. */
660
+ clearExperiments(): void;
661
+ /** Returns a copy of the currently active experiment assignments. */
662
+ getExperiments(): Record<string, string>;
663
+ private static isValidExperimentKey;
664
+ private static isValidExperimentVariant;
665
+ private loadPersistedExperiments;
666
+ private persistExperiments;
667
+ /**
668
+ * Resolves the experiments to attach to one event: the persistent assignments with any per-call
669
+ * override merged on top. Returns undefined when there are none (so the field is omitted).
670
+ */
671
+ private resolveExperiments;
613
672
  private isTrackingBlocked;
614
673
  private getSessionId;
615
674
  /**
@@ -645,7 +704,7 @@ declare class CorbadoTracker {
645
704
  *
646
705
  * @internal
647
706
  */
648
- track(name: AuthEventName, data: Record<string, any>, userReference?: UserReference, tags?: Record<string, string>, contexts?: Record<string, any>, explicitTimestamp?: number): Promise<void>;
707
+ track(name: AuthEventName, data: Record<string, any>, userReference?: UserReference, tags?: Record<string, string>, contexts?: Record<string, any>, explicitTimestamp?: number, experiments?: Record<string, string>): Promise<void>;
649
708
  /**
650
709
  * Track when an authentication flow (or flow selection screen) becomes visible.
651
710
  *
@@ -666,7 +725,7 @@ declare class CorbadoTracker {
666
725
  * });
667
726
  * ```
668
727
  */
669
- flowStarted(data: FlowStarted | MultiFlowStarted, tags?: Record<string, string>): void;
728
+ flowStarted(data: FlowStarted | MultiFlowStarted, tags?: Record<string, string>, experiments?: Record<string, string>): void;
670
729
  /**
671
730
  * Track when the user commits to a specific flow.
672
731
  *
@@ -682,7 +741,7 @@ declare class CorbadoTracker {
682
741
  * tracker.flowDecided({flowName: "signup"});
683
742
  * ```
684
743
  */
685
- flowDecided(data: FlowDecided, tags?: Record<string, string>): void;
744
+ flowDecided(data: FlowDecided, tags?: Record<string, string>, experiments?: Record<string, string>): void;
686
745
  /**
687
746
  * Track a business/marketing conversion that is not part of an authentication flow.
688
747
  *
@@ -705,7 +764,7 @@ declare class CorbadoTracker {
705
764
  * });
706
765
  * ```
707
766
  */
708
- conversion(data: Conversion, tags?: Record<string, string>): void;
767
+ conversion(data: Conversion, tags?: Record<string, string>, experiments?: Record<string, string>): void;
709
768
  /**
710
769
  * Track when a flow successfully completes.
711
770
  *
@@ -726,7 +785,7 @@ declare class CorbadoTracker {
726
785
  * });
727
786
  * ```
728
787
  */
729
- flowFinished(data: FlowFinished, tags?: Record<string, string>): void;
788
+ flowFinished(data: FlowFinished, tags?: Record<string, string>, experiments?: Record<string, string>): void;
730
789
  /**
731
790
  * Track when an in-progress flow is reset and restarted.
732
791
  *
@@ -742,7 +801,7 @@ declare class CorbadoTracker {
742
801
  * tracker.flowReset({flowName: "login"});
743
802
  * ```
744
803
  */
745
- flowReset(data: FlowReset | MultiFlowReset, tags?: Record<string, string>): void;
804
+ flowReset(data: FlowReset | MultiFlowReset, tags?: Record<string, string>, experiments?: Record<string, string>): void;
746
805
  /**
747
806
  * Track when a flow is considered finished because another flow finished it implicitly.
748
807
  *
@@ -763,7 +822,7 @@ declare class CorbadoTracker {
763
822
  * });
764
823
  * ```
765
824
  */
766
- flowAutoFinished(data: FlowAutoFinished, tags?: Record<string, string>): void;
825
+ flowAutoFinished(data: FlowAutoFinished, tags?: Record<string, string>, experiments?: Record<string, string>): void;
767
826
  /**
768
827
  * Track when you present authentication method choices to the user.
769
828
  *
@@ -784,10 +843,10 @@ declare class CorbadoTracker {
784
843
  * });
785
844
  * ```
786
845
  */
787
- authMethodsDecisionStarted(data: AuthMethodDecisionStarted, tags?: Record<string, string>): void;
788
- authMethodsDecisionFinished(data: AuthMethodDecisionFinished, tags?: Record<string, string>): void;
789
- authDecisionStarted(data: AuthDecisionStarted): void;
790
- authDecisionFinished(data: AuthDecisionFinished): void;
846
+ authMethodsDecisionStarted(data: AuthMethodDecisionStarted, tags?: Record<string, string>, experiments?: Record<string, string>): void;
847
+ authMethodsDecisionFinished(data: AuthMethodDecisionFinished, tags?: Record<string, string>, experiments?: Record<string, string>): void;
848
+ authDecisionStarted(data: AuthDecisionStarted, tags?: Record<string, string>, experiments?: Record<string, string>): void;
849
+ authDecisionFinished(data: AuthDecisionFinished, tags?: Record<string, string>, experiments?: Record<string, string>): void;
791
850
  /**
792
851
  * Enqueue a "low" event (granular DOM/window/visualviewport/PWM signal) for the current session.
793
852
  *
@@ -1213,6 +1272,11 @@ declare class EventStore {
1213
1272
  declare function init(options: TrackerOptions): CorbadoTracker;
1214
1273
  declare function getTracker(): CorbadoTracker | undefined;
1215
1274
  declare function resetSession(): string | undefined;
1275
+ declare function setExperiment(key: string, variant: string): void;
1276
+ declare function setExperiments(assignments: Record<string, string>): void;
1277
+ declare function clearExperiment(key: string): void;
1278
+ declare function clearExperiments(): void;
1279
+ declare function getExperiments(): Record<string, string>;
1216
1280
  declare function destroy(): Promise<void>;
1217
1281
 
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 };
1282
+ 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, clearExperiment, clearExperiments, createLogger, destroy, getExperiments, getTracker, init, loadCachedConfig, parseReliabilityConfig, resetSession, setExperiment, setExperiments };