coveo-search-ui-extensions
Version:
Small generic components to extend the functionality of Coveo's Search UI framework.
110 lines (109 loc) • 3.1 kB
TypeScript
import { Component, IComponentBindings } from 'coveo-search-ui';
import './Strings';
/**
* Initialization options of the **UserActions** class.
*/
export interface IUserActionsOptions {
/**
* Identifier of the user from which Clicked Documents are shown.
*
* **Require**
*/
userId: string;
/**
* Label of the button used to open the user actions.
*
* Default: `User Actions`
*/
buttonLabel: string;
/**
* Label of the summary section.
*
* Default: `Session Summary`
*/
summaryLabel: string;
/**
* Label of the activity section.
*
* Default: `User Activity Timeline`
*/
activityLabel: string;
/**
* Whether or not to add the ViewedByCustomer component
*
* Default: `True`
*/
viewedByCustomer: Boolean;
/**
* Whether or not the UserAction component should be displayed
* Can be used to use ViewedByCustomer alone.
*
* Default: `False`
*/
hidden: Boolean;
/**
* Whether or not the UserAction component should use the CoveoSearchUI ResponsiveManager
* Inoperant if `hidden` is true.
*
* Default: `True`
*/
useResponsiveManager: Boolean;
}
/**
* Display a panel that contains a summary of a user session and that also contains detailed information about user actions.
*/
export declare class UserActions extends Component {
element: HTMLElement;
options: IUserActionsOptions;
bindings: IComponentBindings;
/**
* Identifier of the Search-UI component.
*/
static readonly ID = "UserActions";
static readonly Events: {
Hide: string;
Show: string;
};
/**
* Default initialization options of the **UserActions** class.
*/
static readonly options: IUserActionsOptions;
private static readonly USER_ACTION_OPENED;
private isOpened;
/**
* Create an instance of the **UserActions** 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: IUserActionsOptions, bindings: IComponentBindings);
/**
* Collapse the panel.
*/
hide(): void;
/**
* Open the panel.
*/
show(): Promise<void>;
/**
* Toggle the visibility of the panel.
*/
toggle(): Promise<void>;
private buildAccordionHeader;
private buildAccordion;
private buildCoveoElement;
/**
* Initialize child Search-UI component and pass down critical options.
*
* @param element Parent element of each child that would be initialize.
*/
private initializeSearchUIComponents;
private renderLoading;
private render;
private renderNoActions;
private renderEnablePrompt;
private showViewedByCustomer;
private tagViewsOfUser;
private inferResultListLayout;
}