import type { SetOptional } from 'type-fest';
import type { CompanyTypesValue } from './models/api/company-types-value';
import type { DecisionMakerType } from './models/api/decision-maker-type';
import type { LegalEntityAssociation, LegalEntityAssociationType } from './models/api/legal-entity-association';
import type { LegalEntityType } from './models/api/legal-entity-type';
import type { TaskIdentifier } from '../stores/globalStore/globalStore';
/**
 * A recursive type representing any valid Mixpanel property value.
 * This can be a primitive, a nested object, or an array of properties.
 */
export type MixpanelProperty = string | number | boolean | null | undefined | {
    [key: string]: MixpanelProperty;
} | string[] | number[] | boolean[] | {
    [key: string]: MixpanelProperty;
}[];
/**
 * Level of the funnel that is relevant for this event
 */
type ActionLevel = 'journey' | 'task' | 'page' | 'field';
type PerformanceActionType = 'resolve' | 'reject';
/**
 * The type of action associated with the event
 */
export type ActionType = 'start' | 'submit' | 'save' | 'add' | 'edit' | 'remove' | 'open' | 'close' | 'next' | 'back' | 'skip' | 'download' | 'upload' | 'sign' | 'navigate' | 'blur' | 'input' | 'focus' | 'change' | 'select' | 'alert' | 'cancel' | 'verify' | PerformanceActionType;
/**
 * The base event properties that are sent with every event
 */
export type BaseEventProperties = {
    category: 'onboarding';
    subCategory: 'hosted onboarding';
    capabilities?: string[];
    componentName?: string;
    countryCode?: string;
    entityType?: LegalEntityType;
    associatedLegalEntityType?: LegalEntityType;
    associatedLegalEntityId?: string;
    locale?: string;
    sdkVersion?: string;
    task?: TaskIdentifier;
    userAgent?: string;
};
type RequiredExcept<T, K extends keyof T> = Required<Omit<T, K>> & Partial<Pick<T, K>>;
type OptionalBaseEventProperties = 'associatedLegalEntityType' | 'associatedLegalEntityId';
/**
 * Additional event properties
 */
export interface AdditionalEventProperties {
    actionType: ActionType;
    actionLevel: ActionLevel;
    entityType?: LegalEntityType;
    task?: string;
    page?: string;
    field?: string;
    returnType?: 'backend' | 'validation' | (string & {});
    returnValue?: string | string[];
    toPage?: string;
    content?: string;
    label?: string;
    documentType?: string;
    fileExtention?: string[];
    additionalData?: {
        [key: string]: MixpanelProperty;
    };
    'Experiment name'?: string;
    'Variant name'?: string;
    legalEntityName?: string;
    companyStructure?: CompanyTypesValue;
    usedAdditionalAddress?: boolean;
    industryCode?: string;
    countryOfRegistration?: string;
    roles?: DecisionMakerType[] | LegalEntityAssociationType[];
    noOfDecisionMakers?: number;
    remainingDecisionMakers?: LegalEntityAssociation[];
}
/**
 * Name of the tracked event
 * Can be either a custom name or one of the pre-defined values
 */
export type EventName = 'Clicked button' | 'Clicked accordion' | 'Success' | 'Encountered error' | 'Landed on page' | 'Interacted with form field' | 'Opened modal' | 'Closed modal' | 'Performance' | '$experiment_started';
export type AnalyticsEventPayload = RequiredExcept<BaseEventProperties, OptionalBaseEventProperties> & AdditionalEventProperties;
export type EventType = 'add_event';
export type EventQueueItem = {
    type: EventType;
    name: EventName;
    properties?: AnalyticsEventPayload;
};
type UserEventCallback = (eventQueueItem: EventQueueItem) => void;
export declare class UserEvents {
    private readonly queue;
    private readonly subscriptions;
    /** payload of commmon props sent in every event */
    private baseTrackingPayload;
    /** properties not set with every event but that may be shared between some events
     * ex. `page` value for `Interacted with form field` events
     */
    private sharedEventProperties;
    constructor();
    protected add(...args: EventQueueItem[]): void;
    protected notifySubscribers(): void;
    /**
     * Adds an analytics event with all base event properties.
     */
    addEvent(eventName: EventName, properties: AdditionalEventProperties): void;
    /**
     * Adds an event with context specific to journey-related events
     */
    addJourneyEvent(eventName: EventName, properties: SetOptional<AdditionalEventProperties, 'actionLevel'>): void;
    /**
     * Adds an event with context specific to task-related events
     */
    addTaskEvent(eventName: EventName, properties: SetOptional<AdditionalEventProperties, 'actionLevel'>): void;
    /**
     * Adds an event with context specific to page-related events
     */
    addPageEvent(eventName: EventName, properties: SetOptional<AdditionalEventProperties, 'actionLevel'>): void;
    /**
     * Adds an event with context specific to field-related events
     */
    addFieldEvent(eventName: EventName, properties: SetOptional<AdditionalEventProperties, 'actionLevel'> & {
        field: string;
    }): void;
    /**
     * Tracks an experiment for Mixpanel experiment reporting
     */
    trackExperiment({ name, variant }: {
        name: string;
        variant: string;
    }): void;
    /**
     * Subscribes a callback to analytics events. It gets called every time
     * one of the above public methods get called, and the event data is passed back as an array.
     * The callback must have a single argument which is an array of [eventName, eventPayload?].
     * @example
     * ```js
     * const callback = ([eventName, eventPayload]) => console.log(eventName, eventPayload);
     * this.subscribe(callback);
     *
     * const exampleEventPayload = { count: 1, segmentation: { foo: 'bar' } };
     * this.addEvent('exampleEventDidOccur', exampleEventPayload);
     *
     * // `callback` will get called with `['exampleEventDidOccur', exampleEventPayload]`
     * ```
     */
    subscribe(callback: UserEventCallback): void;
    /**
     * Sets params that are sent on every event
     * */
    updateBaseTrackingPayload(baseTrackingPayload: Partial<BaseEventProperties>): void;
    /**
     * Sets params that may be shared between events
     * */
    updateSharedEventProperties: (props: Record<string, MixpanelProperty>) => void;
    /**
     * Removes a subscribed callback
     */
    unsubscribe(callback: UserEventCallback): void;
}
export declare const createUserEvents: () => UserEvents;
export {};
