import { type UserAction, type UserActionsState, type UserActionTimeline, type UserSession } from './insight-user-actions-state.js'; interface RawUserAction { name: string; value: string; time: string; } /** * Preprocesses the raw user actions data from the API into a user actions timeline with the following steps: * - The data is first sorted by most recent and mapped into user actions. * - The actions are then split into sessions based on the ticket creation date. * - The sessions are then stored in the timeline object either as preceding, following or the case creation session. * - The timeline is then filtered to exclude custom actions passed in the state `excludedCustomActions` and empty search queries. * Note: The filtering is done at the end to avoid filtering out actions that would lead to incorrectly split a session into two by creating a gap. * @param state {UserActionsState} - The state of the user actions * @param actions {rawUserAction[]} - The raw user actions array to preprocess * @returns {UserActionTimeline} */ export declare const preprocessUserActionsData: (state: UserActionsState, actions: Array) => UserActionTimeline; /** * Sorts by most recent and maps the raw user actions into user actions. * We use reduce instead of map to drop any actions that could not be parsed. * @param rawUserActions {rawUserAction[]} - The raw user actions to sort and map * @returns {UserAction[]} */ export declare const mapAndSortActionsByMostRecent: (rawUserActions: RawUserAction[]) => UserAction[]; /** * Checks whether an action is within the same session as the latest action based on the specified session inactivity threshold. * @param action {UserAction} - The current action * @param latestTimestampInSession {number} - The timestamp of the latest action in the session * @returns {boolean} */ export declare const isActionWithinSessionThreshold: (action: UserAction, latestTimestampInSession: number) => boolean; /** * Inserts the session in the timeline at the right location. * @param currentSession {UserSession} - The current session * @param ticketCreationDate {number} - The ticket creation date * @param timeline {UserActionTimeline} - The timeline * @returns {void} */ export declare const insertSessionInTimeline: (session: UserSession, ticketCreationDate: number, timeline: UserActionTimeline) => void; /** * Checks whether the action should be excluded from the session based on the excluded custom actions and empty searches. * @param action {UserAction} - The action to check * @param excludedCustomActions {string[]} - The custom actions to exclude * @returns {boolean} */ export declare const shouldExcludeAction: (action: UserAction, excludedCustomActions: string[]) => boolean; /** * Divides actions into sessions and organizes them in the timeline based on the ticket creation date. This function does the following: * 1) Iterates over the actions and groups them into sessions based on the session inactivity threshold. * 2) Inserts the case creation action in the current session. * 3) Filters the actions in the current session to exclude custom actions where the type or value is included in the excludedCustomActions and also empty searches. * 4) Inserts the session in the timeline at the right location. * 5) Returns the timeline with the current session, 2 preceding sessions and 2 following sessions. * @param actions {UserAction[]} - The actions to split * @param ticketCreationDate {string} - The ticket creation date * @param actionsToExclude {string[]} * @returns {UserActionTimeline} - The timeline of user actions (current session and 2 preceding and following sessions) */ export declare const splitActionsIntoTimelineSessions: (actions: UserAction[], ticketCreationDate: number, actionsToExclude: string[]) => UserActionTimeline; export {};