UNPKG

coveo-search-ui-extensions

Version:

Small generic components to extend the functionality of Coveo's Search UI framework.

86 lines (85 loc) 3.31 kB
import { Component, IComponentBindings } from 'coveo-search-ui'; import './Strings'; /** * Initialization options of the **UserActivity** class. */ export interface IUserActivityOptions { /** * Identifier of the user from which Clicked Documents are shown. * * **Require** */ userId: string; /** * Identifies whenever the current Ticket was created to place the creation event in the timeline. * If it is provided, the timeline will focus on that event, * showing the session that corresponds to the date and time, if it is available, as well as 2 sessions more recent, * and 2 sessions prior to the case creation session. * If it is not provided or if the date is too old for the User Actions available, * the timeline will show the last 5 sessions available focusing on the most recent session. * * The format can either be * - an epoch number (number of milliseconds since January 1, 1970), * - a Date string that can be parsed by JavaScript's Date object * - a JavaScript Date */ ticketCreationDateTime: Date; /** * List of causes or event types to exclude from custom events being displayed. * * Default: `[ticket_create_start, ticket_field_update, ticket_next_stage, ticket_classification_click]` */ customActionsExclude: string[]; } export declare class UserActivity extends Component { element: HTMLElement; options: IUserActivityOptions; bindings: IComponentBindings; static readonly ID = "UserActivity"; static readonly options: IUserActivityOptions; private static clickable_uri_ids; private sessions; private sessionsToDisplay; private caseSubmitSession; private caseSubmitSessionIndex; private hasExpandedActions; private userProfileModel; /** * Create an instance of the **UserActivity** class. Initialize is needed the **UserProfileModel** and fetch user actions related to the **UserId**. * * @param element Element on which to bind the component. * @param options Initialization options of the component. * @param bindings Bindings of the Search-UI environment. */ constructor(element: HTMLElement, options: IUserActivityOptions, bindings: IComponentBindings); static parseDate(value: string | number): Date | null; private filterActions; private shouldExcludeCustomAction; private isPartOfTheSameSession; private splitActionsBySessions; private buildSessionsToDisplay; private buildTicketCreatedAction; private findCaseSubmitSession; private findSessionIncludingCaseSubmit; private findPotentialSessionJustBeforeCaseSubmit; private findSurroundingSessions; private render; private buildActivitySection; private buildNoActionsMessage; private buildSessionsItems; private buildFoldedSession; private buildSessionItem; private buildSessionHeader; private buildSessionContent; private buildFoldedActions; private buildActionListItem; private buildSearchEvent; private buildClickEvent; private buildViewEvent; private buildCustomEvent; private buildTicketCreated; private buildFooterElement; private buildTitleElement; private buildTitleSection; private buildIcon; }