Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

coveo.analytics

Package Overview
Dependencies
Maintainers
16
Versions
259
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coveo.analytics - npm Package Compare versions

Comparing version 2.23.6 to 2.23.7

23

dist/definitions/client/analytics.d.ts

@@ -1,2 +0,2 @@

import { AnyEventResponse, ClickEventRequest, ClickEventResponse, CustomEventRequest, CustomEventResponse, EventType, HealthResponse, SearchEventRequest, SearchEventResponse, ViewEventRequest, ViewEventResponse, VisitResponse, VariableArgumentsPayload } from '../events';
import { AnyEventResponse, ClickEventRequest, ClickEventResponse, CustomEventRequest, CustomEventResponse, EventType, HealthResponse, SearchEventRequest, SearchEventResponse, ViewEventRequest, ViewEventResponse, VisitResponse, VariableArgumentsPayload, PreparedClickEventRequest, PreparedCustomEventRequest, PreparedViewEventRequest, PreparedSearchEventRequest } from '../events';
import { PreprocessAnalyticsRequest, VisitorIdProvider } from './analyticsRequestClient';

@@ -27,9 +27,17 @@ import { IRuntimeEnvironment } from './runtimeEnvironment';

};
export interface PreparedEvent<TPreparedRequest, TCompleteRequest, TResponse extends AnyEventResponse> extends BufferedRequest {
log(remainingPayload: Omit<TCompleteRequest, keyof TPreparedRequest>): Promise<TResponse | void>;
}
export interface AnalyticsClient {
getPayload(eventType: string, ...payload: VariableArgumentsPayload): Promise<any>;
getParameters(eventType: string, ...payload: VariableArgumentsPayload): Promise<any>;
makeEvent<TPreparedRequest, TCompleteRequest, TResponse extends AnyEventResponse>(eventType: string, ...payload: VariableArgumentsPayload): Promise<PreparedEvent<TPreparedRequest, TCompleteRequest, TResponse>>;
sendEvent(eventType: string, ...payload: VariableArgumentsPayload): Promise<AnyEventResponse | void>;
makeSearchEvent(request: PreparedSearchEventRequest): Promise<PreparedEvent<PreparedSearchEventRequest, SearchEventRequest, SearchEventResponse>>;
sendSearchEvent(request: SearchEventRequest): Promise<SearchEventResponse | void>;
makeClickEvent(request: PreparedClickEventRequest): Promise<PreparedEvent<PreparedClickEventRequest, ClickEventRequest, ClickEventResponse>>;
sendClickEvent(request: ClickEventRequest): Promise<ClickEventResponse | void>;
makeCustomEvent(request: PreparedCustomEventRequest): Promise<PreparedEvent<PreparedCustomEventRequest, CustomEventRequest, CustomEventResponse>>;
sendCustomEvent(request: CustomEventRequest): Promise<CustomEventResponse | void>;
makeViewEvent(request: PreparedViewEventRequest): Promise<PreparedEvent<PreparedViewEventRequest, ViewEventRequest, ViewEventResponse>>;
sendViewEvent(request: ViewEventRequest): Promise<ViewEventResponse | void>;

@@ -71,3 +79,4 @@ getVisit(): Promise<VisitResponse>;

resolvePayloadForParameters(eventType: EventType | string, parameters: any): Promise<any>;
sendEvent(eventType: EventType | string, ...payload: VariableArgumentsPayload): Promise<AnyEventResponse | void>;
makeEvent<TPreparedRequest, TCompleteRequest, TResponse extends AnyEventResponse>(eventType: EventType | string, ...payload: VariableArgumentsPayload): Promise<PreparedEvent<TPreparedRequest, TCompleteRequest, TResponse>>;
sendEvent(eventType: EventType | string, ...payload: VariableArgumentsPayload): Promise<void | SearchEventResponse | ClickEventResponse | CustomEventResponse | ViewEventResponse>;
private deferExecution;

@@ -77,5 +86,9 @@ private sendFromBufferWithFetch;

deleteHttpOnlyVisitorId(): void;
sendSearchEvent(request: SearchEventRequest): Promise<SearchEventResponse | void>;
sendClickEvent(request: ClickEventRequest): Promise<ClickEventResponse | void>;
sendCustomEvent(request: CustomEventRequest): Promise<CustomEventResponse | void>;
makeSearchEvent(request: PreparedSearchEventRequest): Promise<PreparedEvent<PreparedSearchEventRequest, SearchEventRequest, SearchEventResponse>>;
sendSearchEvent({ searchQueryUid, ...preparedRequest }: SearchEventRequest): Promise<void | SearchEventResponse>;
makeClickEvent(request: PreparedClickEventRequest): Promise<PreparedEvent<PreparedClickEventRequest, ClickEventRequest, ClickEventResponse>>;
sendClickEvent({ searchQueryUid, ...preparedRequest }: ClickEventRequest): Promise<void | ClickEventResponse>;
makeCustomEvent(request: PreparedCustomEventRequest): Promise<PreparedEvent<PreparedCustomEventRequest, CustomEventRequest, CustomEventResponse>>;
sendCustomEvent({ lastSearchQueryUid, ...preparedRequest }: CustomEventRequest): Promise<void | CustomEventResponse>;
makeViewEvent(request: PreparedViewEventRequest): Promise<PreparedEvent<PreparedViewEventRequest, ViewEventRequest, ViewEventResponse>>;
sendViewEvent(request: ViewEventRequest): Promise<ViewEventResponse | void>;

@@ -82,0 +95,0 @@ getVisit(): Promise<VisitResponse>;

@@ -1,3 +0,3 @@

import { AnalyticsClient } from './analytics';
import { AnyEventResponse, SearchEventResponse, ClickEventResponse, CustomEventResponse, VisitResponse, HealthResponse, ViewEventResponse } from '../events';
import { AnalyticsClient, PreparedEvent } from './analytics';
import { AnyEventResponse, SearchEventResponse, ClickEventResponse, CustomEventResponse, VisitResponse, HealthResponse, ViewEventResponse, EventType, PreparedSearchEventRequest, SearchEventRequest, ClickEventRequest, CustomEventRequest, PreparedClickEventRequest, PreparedCustomEventRequest, PreparedViewEventRequest, ViewEventRequest } from '../events';
import { NoopRuntime } from './runtimeEnvironment';

@@ -7,6 +7,11 @@ export declare class NoopAnalytics implements AnalyticsClient {

getParameters(): Promise<any>;
makeEvent<TPreparedRequest, TCompleteRequest, TResponse extends AnyEventResponse>(eventType: EventType | string): Promise<PreparedEvent<TPreparedRequest, TCompleteRequest, TResponse>>;
sendEvent(): Promise<AnyEventResponse | void>;
makeSearchEvent(): Promise<PreparedEvent<PreparedSearchEventRequest, SearchEventRequest, SearchEventResponse>>;
sendSearchEvent(): Promise<SearchEventResponse | void>;
makeClickEvent(): Promise<PreparedEvent<PreparedClickEventRequest, ClickEventRequest, ClickEventResponse>>;
sendClickEvent(): Promise<ClickEventResponse | void>;
makeCustomEvent(): Promise<PreparedEvent<PreparedCustomEventRequest, CustomEventRequest, CustomEventResponse>>;
sendCustomEvent(): Promise<CustomEventResponse | void>;
makeViewEvent(): Promise<PreparedEvent<PreparedViewEventRequest, ViewEventRequest, ViewEventResponse>>;
sendViewEvent(): Promise<ViewEventResponse | void>;

@@ -13,0 +18,0 @@ getVisit(): Promise<VisitResponse>;

@@ -57,2 +57,4 @@ export declare type IRequestPayload = Record<string, any>;

}
export interface PreparedSearchEventRequest extends Omit<SearchEventRequest, 'searchQueryUid'> {
}
export interface DocumentInformation {

@@ -74,2 +76,4 @@ documentUri: string;

}
export interface PreparedClickEventRequest extends Omit<ClickEventRequest, 'searchQueryUid'> {
}
export interface CustomEventRequest extends EventBaseRequest {

@@ -80,2 +84,4 @@ eventType: string;

}
export interface PreparedCustomEventRequest extends Omit<CustomEventRequest, 'lastSearchQueryUid'> {
}
export interface ViewEventRequest extends EventBaseRequest {

@@ -89,2 +95,4 @@ location?: string;

}
export interface PreparedViewEventRequest extends ViewEventRequest {
}
export interface DefaultEventResponse {

@@ -91,0 +99,0 @@ visitId: string;

@@ -25,3 +25,5 @@ import { ClientOptions, AnalyticsClient } from '../client/analytics';

description: EventDescription;
log: () => Promise<T | void>;
log(metadata: {
searchUID: string;
}): Promise<T | void>;
}

@@ -35,111 +37,111 @@ export declare class CoveoSearchPageClient {

enable(): void;
makeInterfaceLoad(): EventBuilder<SearchEventResponse>;
makeInterfaceLoad(): Promise<EventBuilder<SearchEventResponse>>;
logInterfaceLoad(): Promise<void | SearchEventResponse>;
makeRecommendationInterfaceLoad(): EventBuilder<SearchEventResponse>;
makeRecommendationInterfaceLoad(): Promise<EventBuilder<SearchEventResponse>>;
logRecommendationInterfaceLoad(): Promise<void | SearchEventResponse>;
makeRecommendation(): EventBuilder<CustomEventResponse>;
makeRecommendation(): Promise<EventBuilder<CustomEventResponse>>;
logRecommendation(): Promise<void | CustomEventResponse>;
makeRecommendationOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier): EventBuilder<ClickEventResponse>;
makeRecommendationOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<EventBuilder<ClickEventResponse>>;
logRecommendationOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<void | ClickEventResponse>;
makeStaticFilterClearAll(meta: StaticFilterMetadata): EventBuilder<SearchEventResponse>;
makeStaticFilterClearAll(meta: StaticFilterMetadata): Promise<EventBuilder<SearchEventResponse>>;
logStaticFilterClearAll(meta: StaticFilterMetadata): Promise<void | SearchEventResponse>;
makeStaticFilterSelect(meta: StaticFilterToggleValueMetadata): EventBuilder<SearchEventResponse>;
makeStaticFilterSelect(meta: StaticFilterToggleValueMetadata): Promise<EventBuilder<SearchEventResponse>>;
logStaticFilterSelect(meta: StaticFilterToggleValueMetadata): Promise<void | SearchEventResponse>;
makeStaticFilterDeselect(meta: StaticFilterToggleValueMetadata): EventBuilder<SearchEventResponse>;
makeStaticFilterDeselect(meta: StaticFilterToggleValueMetadata): Promise<EventBuilder<SearchEventResponse>>;
logStaticFilterDeselect(meta: StaticFilterToggleValueMetadata): Promise<void | SearchEventResponse>;
makeFetchMoreResults(): EventBuilder<CustomEventResponse>;
makeFetchMoreResults(): Promise<EventBuilder<CustomEventResponse>>;
logFetchMoreResults(): Promise<void | CustomEventResponse>;
makeInterfaceChange(metadata: InterfaceChangeMetadata): EventBuilder<SearchEventResponse>;
makeInterfaceChange(metadata: InterfaceChangeMetadata): Promise<EventBuilder<SearchEventResponse>>;
logInterfaceChange(metadata: InterfaceChangeMetadata): Promise<void | SearchEventResponse>;
makeDidYouMeanAutomatic(): EventBuilder<SearchEventResponse>;
makeDidYouMeanAutomatic(): Promise<EventBuilder<SearchEventResponse>>;
logDidYouMeanAutomatic(): Promise<void | SearchEventResponse>;
makeDidYouMeanClick(): EventBuilder<SearchEventResponse>;
makeDidYouMeanClick(): Promise<EventBuilder<SearchEventResponse>>;
logDidYouMeanClick(): Promise<void | SearchEventResponse>;
makeResultsSort(metadata: ResultsSortMetadata): EventBuilder<SearchEventResponse>;
makeResultsSort(metadata: ResultsSortMetadata): Promise<EventBuilder<SearchEventResponse>>;
logResultsSort(metadata: ResultsSortMetadata): Promise<void | SearchEventResponse>;
makeSearchboxSubmit(): EventBuilder<SearchEventResponse>;
makeSearchboxSubmit(): Promise<EventBuilder<SearchEventResponse>>;
logSearchboxSubmit(): Promise<void | SearchEventResponse>;
makeSearchboxClear(): EventBuilder<SearchEventResponse>;
makeSearchboxClear(): Promise<EventBuilder<SearchEventResponse>>;
logSearchboxClear(): Promise<void | SearchEventResponse>;
makeSearchboxAsYouType(): EventBuilder<SearchEventResponse>;
makeSearchboxAsYouType(): Promise<EventBuilder<SearchEventResponse>>;
logSearchboxAsYouType(): Promise<void | SearchEventResponse>;
makeBreadcrumbFacet(metadata: FacetMetadata | FacetRangeMetadata | CategoryFacetMetadata): EventBuilder<SearchEventResponse>;
makeBreadcrumbFacet(metadata: FacetMetadata | FacetRangeMetadata | CategoryFacetMetadata): Promise<EventBuilder<SearchEventResponse>>;
logBreadcrumbFacet(metadata: FacetMetadata | FacetRangeMetadata | CategoryFacetMetadata): Promise<void | SearchEventResponse>;
makeBreadcrumbResetAll(): EventBuilder<SearchEventResponse>;
makeBreadcrumbResetAll(): Promise<EventBuilder<SearchEventResponse>>;
logBreadcrumbResetAll(): Promise<void | SearchEventResponse>;
makeDocumentQuickview(info: PartialDocumentInformation, identifier: DocumentIdentifier): EventBuilder<ClickEventResponse>;
makeDocumentQuickview(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<EventBuilder<ClickEventResponse>>;
logDocumentQuickview(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<void | ClickEventResponse>;
makeDocumentOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier): EventBuilder<ClickEventResponse>;
makeDocumentOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<EventBuilder<ClickEventResponse>>;
logDocumentOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<void | ClickEventResponse>;
makeOmniboxAnalytics(meta: OmniboxSuggestionsMetadata): EventBuilder<SearchEventResponse>;
makeOmniboxAnalytics(meta: OmniboxSuggestionsMetadata): Promise<EventBuilder<SearchEventResponse>>;
logOmniboxAnalytics(meta: OmniboxSuggestionsMetadata): Promise<void | SearchEventResponse>;
makeOmniboxFromLink(meta: OmniboxSuggestionsMetadata): EventBuilder<SearchEventResponse>;
makeOmniboxFromLink(meta: OmniboxSuggestionsMetadata): Promise<EventBuilder<SearchEventResponse>>;
logOmniboxFromLink(meta: OmniboxSuggestionsMetadata): Promise<void | SearchEventResponse>;
makeSearchFromLink(): EventBuilder<SearchEventResponse>;
makeSearchFromLink(): Promise<EventBuilder<SearchEventResponse>>;
logSearchFromLink(): Promise<void | SearchEventResponse>;
makeTriggerNotify(meta: TriggerNotifyMetadata): EventBuilder<CustomEventResponse>;
makeTriggerNotify(meta: TriggerNotifyMetadata): Promise<EventBuilder<CustomEventResponse>>;
logTriggerNotify(meta: TriggerNotifyMetadata): Promise<void | CustomEventResponse>;
makeTriggerExecute(meta: TriggerExecuteMetadata): EventBuilder<CustomEventResponse>;
makeTriggerExecute(meta: TriggerExecuteMetadata): Promise<EventBuilder<CustomEventResponse>>;
logTriggerExecute(meta: TriggerExecuteMetadata): Promise<void | CustomEventResponse>;
makeTriggerQuery(): EventBuilder<CustomEventResponse>;
makeTriggerQuery(): Promise<EventBuilder<CustomEventResponse>>;
logTriggerQuery(): Promise<void | CustomEventResponse>;
makeUndoTriggerQuery(meta: UndoTriggerRedirectMetadata): EventBuilder<SearchEventResponse>;
makeUndoTriggerQuery(meta: UndoTriggerRedirectMetadata): Promise<EventBuilder<SearchEventResponse>>;
logUndoTriggerQuery(meta: UndoTriggerRedirectMetadata): Promise<void | SearchEventResponse>;
makeTriggerRedirect(meta: TriggerRedirectMetadata): EventBuilder<CustomEventResponse>;
makeTriggerRedirect(meta: TriggerRedirectMetadata): Promise<EventBuilder<CustomEventResponse>>;
logTriggerRedirect(meta: TriggerRedirectMetadata): Promise<void | CustomEventResponse>;
makePagerResize(meta: PagerResizeMetadata): EventBuilder<CustomEventResponse>;
makePagerResize(meta: PagerResizeMetadata): Promise<EventBuilder<CustomEventResponse>>;
logPagerResize(meta: PagerResizeMetadata): Promise<void | CustomEventResponse>;
makePagerNumber(meta: PagerMetadata): EventBuilder<CustomEventResponse>;
makePagerNumber(meta: PagerMetadata): Promise<EventBuilder<CustomEventResponse>>;
logPagerNumber(meta: PagerMetadata): Promise<void | CustomEventResponse>;
makePagerNext(meta: PagerMetadata): EventBuilder<CustomEventResponse>;
makePagerNext(meta: PagerMetadata): Promise<EventBuilder<CustomEventResponse>>;
logPagerNext(meta: PagerMetadata): Promise<void | CustomEventResponse>;
makePagerPrevious(meta: PagerMetadata): EventBuilder<CustomEventResponse>;
makePagerPrevious(meta: PagerMetadata): Promise<EventBuilder<CustomEventResponse>>;
logPagerPrevious(meta: PagerMetadata): Promise<void | CustomEventResponse>;
makePagerScrolling(): EventBuilder<CustomEventResponse>;
makePagerScrolling(): Promise<EventBuilder<CustomEventResponse>>;
logPagerScrolling(): Promise<void | CustomEventResponse>;
makeFacetClearAll(meta: FacetBaseMeta): EventBuilder<SearchEventResponse>;
makeFacetClearAll(meta: FacetBaseMeta): Promise<EventBuilder<SearchEventResponse>>;
logFacetClearAll(meta: FacetBaseMeta): Promise<void | SearchEventResponse>;
makeFacetSearch(meta: FacetBaseMeta): EventBuilder<SearchEventResponse>;
makeFacetSearch(meta: FacetBaseMeta): Promise<EventBuilder<SearchEventResponse>>;
logFacetSearch(meta: FacetBaseMeta): Promise<void | SearchEventResponse>;
makeFacetSelect(meta: FacetMetadata): EventBuilder<SearchEventResponse>;
makeFacetSelect(meta: FacetMetadata): Promise<EventBuilder<SearchEventResponse>>;
logFacetSelect(meta: FacetMetadata): Promise<void | SearchEventResponse>;
makeFacetDeselect(meta: FacetMetadata): EventBuilder<SearchEventResponse>;
makeFacetDeselect(meta: FacetMetadata): Promise<EventBuilder<SearchEventResponse>>;
logFacetDeselect(meta: FacetMetadata): Promise<void | SearchEventResponse>;
makeFacetExclude(meta: FacetMetadata): EventBuilder<SearchEventResponse>;
makeFacetExclude(meta: FacetMetadata): Promise<EventBuilder<SearchEventResponse>>;
logFacetExclude(meta: FacetMetadata): Promise<void | SearchEventResponse>;
makeFacetUnexclude(meta: FacetMetadata): EventBuilder<SearchEventResponse>;
makeFacetUnexclude(meta: FacetMetadata): Promise<EventBuilder<SearchEventResponse>>;
logFacetUnexclude(meta: FacetMetadata): Promise<void | SearchEventResponse>;
makeFacetSelectAll(meta: FacetBaseMeta): EventBuilder<SearchEventResponse>;
makeFacetSelectAll(meta: FacetBaseMeta): Promise<EventBuilder<SearchEventResponse>>;
logFacetSelectAll(meta: FacetBaseMeta): Promise<void | SearchEventResponse>;
makeFacetUpdateSort(meta: FacetSortMeta): EventBuilder<SearchEventResponse>;
makeFacetUpdateSort(meta: FacetSortMeta): Promise<EventBuilder<SearchEventResponse>>;
logFacetUpdateSort(meta: FacetSortMeta): Promise<void | SearchEventResponse>;
makeFacetShowMore(meta: FacetBaseMeta): EventBuilder<CustomEventResponse>;
makeFacetShowMore(meta: FacetBaseMeta): Promise<EventBuilder<CustomEventResponse>>;
logFacetShowMore(meta: FacetBaseMeta): Promise<void | CustomEventResponse>;
makeFacetShowLess(meta: FacetBaseMeta): EventBuilder<CustomEventResponse>;
makeFacetShowLess(meta: FacetBaseMeta): Promise<EventBuilder<CustomEventResponse>>;
logFacetShowLess(meta: FacetBaseMeta): Promise<void | CustomEventResponse>;
makeQueryError(meta: QueryErrorMeta): EventBuilder<CustomEventResponse>;
makeQueryError(meta: QueryErrorMeta): Promise<EventBuilder<CustomEventResponse>>;
logQueryError(meta: QueryErrorMeta): Promise<void | CustomEventResponse>;
makeQueryErrorBack(): EventBuilder<SearchEventResponse>;
makeQueryErrorBack(): Promise<EventBuilder<SearchEventResponse>>;
logQueryErrorBack(): Promise<void | SearchEventResponse>;
makeQueryErrorRetry(): EventBuilder<SearchEventResponse>;
makeQueryErrorRetry(): Promise<EventBuilder<SearchEventResponse>>;
logQueryErrorRetry(): Promise<void | SearchEventResponse>;
makeQueryErrorClear(): EventBuilder<SearchEventResponse>;
makeQueryErrorClear(): Promise<EventBuilder<SearchEventResponse>>;
logQueryErrorClear(): Promise<void | SearchEventResponse>;
makeLikeSmartSnippet(): EventBuilder<CustomEventResponse>;
makeLikeSmartSnippet(): Promise<EventBuilder<CustomEventResponse>>;
logLikeSmartSnippet(): Promise<void | CustomEventResponse>;
makeDislikeSmartSnippet(): EventBuilder<CustomEventResponse>;
makeDislikeSmartSnippet(): Promise<EventBuilder<CustomEventResponse>>;
logDislikeSmartSnippet(): Promise<void | CustomEventResponse>;
makeExpandSmartSnippet(): EventBuilder<CustomEventResponse>;
makeExpandSmartSnippet(): Promise<EventBuilder<CustomEventResponse>>;
logExpandSmartSnippet(): Promise<void | CustomEventResponse>;
makeCollapseSmartSnippet(): EventBuilder<CustomEventResponse>;
makeCollapseSmartSnippet(): Promise<EventBuilder<CustomEventResponse>>;
logCollapseSmartSnippet(): Promise<void | CustomEventResponse>;
makeOpenSmartSnippetFeedbackModal(): EventBuilder<CustomEventResponse>;
makeOpenSmartSnippetFeedbackModal(): Promise<EventBuilder<CustomEventResponse>>;
logOpenSmartSnippetFeedbackModal(): Promise<void | CustomEventResponse>;
makeCloseSmartSnippetFeedbackModal(): EventBuilder<CustomEventResponse>;
makeCloseSmartSnippetFeedbackModal(): Promise<EventBuilder<CustomEventResponse>>;
logCloseSmartSnippetFeedbackModal(): Promise<void | CustomEventResponse>;
makeSmartSnippetFeedbackReason(reason: SmartSnippetFeedbackReason, details?: string): EventBuilder<CustomEventResponse>;
makeSmartSnippetFeedbackReason(reason: SmartSnippetFeedbackReason, details?: string): Promise<EventBuilder<CustomEventResponse>>;
logSmartSnippetFeedbackReason(reason: SmartSnippetFeedbackReason, details?: string): Promise<void | CustomEventResponse>;
makeExpandSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier): EventBuilder<CustomEventResponse>;
makeExpandSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier): Promise<EventBuilder<CustomEventResponse>>;
logExpandSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier): Promise<void | CustomEventResponse>;
makeCollapseSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier): EventBuilder<CustomEventResponse>;
makeCollapseSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier): Promise<EventBuilder<CustomEventResponse>>;
logCollapseSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier): Promise<void | CustomEventResponse>;

@@ -150,40 +152,36 @@ private makeShowMoreSmartSnippetSuggestion;

logShowLessSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta): Promise<void | CustomEventResponse>;
makeOpenSmartSnippetSource(info: PartialDocumentInformation, identifier: DocumentIdentifier): EventBuilder<ClickEventResponse>;
makeOpenSmartSnippetSource(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<EventBuilder<ClickEventResponse>>;
logOpenSmartSnippetSource(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<void | ClickEventResponse>;
makeOpenSmartSnippetSuggestionSource(info: PartialDocumentInformation, snippet: SmartSnippetSuggestionMeta): EventBuilder<ClickEventResponse>;
makeCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier): EventBuilder<ClickEventResponse>;
makeOpenSmartSnippetSuggestionSource(info: PartialDocumentInformation, snippet: SmartSnippetSuggestionMeta): Promise<EventBuilder<ClickEventResponse>>;
makeCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<EventBuilder<ClickEventResponse>>;
logCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<void | ClickEventResponse>;
logOpenSmartSnippetSuggestionSource(info: PartialDocumentInformation, snippet: SmartSnippetSuggestionMeta): Promise<void | ClickEventResponse>;
makeOpenSmartSnippetInlineLink(info: PartialDocumentInformation, identifierAndLink: DocumentIdentifier & SmartSnippetLinkMeta): EventBuilder<ClickEventResponse>;
makeOpenSmartSnippetInlineLink(info: PartialDocumentInformation, identifierAndLink: DocumentIdentifier & SmartSnippetLinkMeta): Promise<EventBuilder<ClickEventResponse>>;
logOpenSmartSnippetInlineLink(info: PartialDocumentInformation, identifierAndLink: DocumentIdentifier & SmartSnippetLinkMeta): Promise<void | ClickEventResponse>;
makeOpenSmartSnippetSuggestionInlineLink(info: PartialDocumentInformation, snippetAndLink: SmartSnippetSuggestionMeta & SmartSnippetLinkMeta): EventBuilder<ClickEventResponse>;
makeOpenSmartSnippetSuggestionInlineLink(info: PartialDocumentInformation, snippetAndLink: SmartSnippetSuggestionMeta & SmartSnippetLinkMeta): Promise<EventBuilder<ClickEventResponse>>;
logOpenSmartSnippetSuggestionInlineLink(info: PartialDocumentInformation, snippetAndLink: SmartSnippetSuggestionMeta & SmartSnippetLinkMeta): Promise<void | ClickEventResponse>;
makeRecentQueryClick(): EventBuilder<SearchEventResponse>;
makeRecentQueryClick(): Promise<EventBuilder<SearchEventResponse>>;
logRecentQueryClick(): Promise<void | SearchEventResponse>;
makeClearRecentQueries(): EventBuilder<CustomEventResponse>;
makeClearRecentQueries(): Promise<EventBuilder<CustomEventResponse>>;
logClearRecentQueries(): Promise<void | CustomEventResponse>;
makeRecentResultClick(info: PartialDocumentInformation, identifier: DocumentIdentifier): EventBuilder<CustomEventResponse>;
makeRecentResultClick(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<EventBuilder<CustomEventResponse>>;
logRecentResultClick(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<void | CustomEventResponse>;
makeClearRecentResults(): EventBuilder<CustomEventResponse>;
makeClearRecentResults(): Promise<EventBuilder<CustomEventResponse>>;
logClearRecentResults(): Promise<void | CustomEventResponse>;
makeNoResultsBack(): EventBuilder<SearchEventResponse>;
makeNoResultsBack(): Promise<EventBuilder<SearchEventResponse>>;
logNoResultsBack(): Promise<void | SearchEventResponse>;
makeShowMoreFoldedResults(info: PartialDocumentInformation, identifier: DocumentIdentifier): EventBuilder<ClickEventResponse>;
makeShowMoreFoldedResults(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<EventBuilder<ClickEventResponse>>;
logShowMoreFoldedResults(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<void | ClickEventResponse>;
makeShowLessFoldedResults(): EventBuilder<CustomEventResponse>;
makeShowLessFoldedResults(): Promise<EventBuilder<CustomEventResponse>>;
logShowLessFoldedResults(): Promise<void | CustomEventResponse>;
makeCustomEvent(event: SearchPageEvents, metadata?: Record<string, any>, eventType?: string): EventBuilder<CustomEventResponse>;
private makeEventDescription;
makeCustomEvent(event: SearchPageEvents, metadata?: Record<string, any>, eventType?: string): Promise<EventBuilder<CustomEventResponse>>;
logCustomEvent(event: SearchPageEvents, metadata?: Record<string, any>, eventType?: string): Promise<void | CustomEventResponse>;
makeCustomEventWithType(eventValue: string, eventType: string, metadata?: Record<string, any>): {
description: Pick<SearchEventRequest, "actionCause" | "customData">;
log: () => Promise<void | CustomEventResponse>;
};
makeCustomEventWithType(eventValue: string, eventType: string, metadata?: Record<string, any>): Promise<EventBuilder<CustomEventResponse>>;
logCustomEventWithType(eventValue: string, eventType: string, metadata?: Record<string, any>): Promise<void | CustomEventResponse>;
logSearchEvent(event: SearchPageEvents, metadata?: Record<string, any>): Promise<void | SearchEventResponse>;
private makeDescription;
makeSearchEvent(event: SearchPageEvents, metadata?: Record<string, any>): EventBuilder<SearchEventResponse>;
makeSearchEvent(event: SearchPageEvents, metadata?: Record<string, any>): Promise<EventBuilder<SearchEventResponse>>;
makeClickEvent(event: SearchPageEvents, info: PartialDocumentInformation, identifier: DocumentIdentifier, metadata?: Record<string, any>): Promise<EventBuilder<ClickEventResponse>>;
logClickEvent(event: SearchPageEvents, info: PartialDocumentInformation, identifier: DocumentIdentifier, metadata?: Record<string, any>): Promise<void | ClickEventResponse>;
makeClickEvent(event: SearchPageEvents, info: PartialDocumentInformation, identifier: DocumentIdentifier, metadata?: Record<string, any>): EventBuilder<ClickEventResponse>;
private getBaseSearchEventRequest;
private getBaseCustomEventRequest;
private getBaseEventRequest;

@@ -190,0 +188,0 @@ private getOrigins;

{
"name": "coveo.analytics",
"version": "2.23.6",
"version": "2.23.7",
"description": "📈 Coveo analytics client (node and browser compatible) ",

@@ -5,0 +5,0 @@ "main": "dist/library.js",

@@ -16,2 +16,6 @@ import {

VariableArgumentsPayload,
PreparedClickEventRequest,
PreparedCustomEventRequest,
PreparedViewEventRequest,
PreparedSearchEventRequest,
} from '../events';

@@ -62,9 +66,30 @@ import {IAnalyticsClientOptions, PreprocessAnalyticsRequest, VisitorIdProvider} from './analyticsRequestClient';

export interface PreparedEvent<TPreparedRequest, TCompleteRequest, TResponse extends AnyEventResponse>
extends BufferedRequest {
log(remainingPayload: Omit<TCompleteRequest, keyof TPreparedRequest>): Promise<TResponse | void>;
}
export interface AnalyticsClient {
getPayload(eventType: string, ...payload: VariableArgumentsPayload): Promise<any>;
getParameters(eventType: string, ...payload: VariableArgumentsPayload): Promise<any>;
makeEvent<TPreparedRequest, TCompleteRequest, TResponse extends AnyEventResponse>(
eventType: string,
...payload: VariableArgumentsPayload
): Promise<PreparedEvent<TPreparedRequest, TCompleteRequest, TResponse>>;
sendEvent(eventType: string, ...payload: VariableArgumentsPayload): Promise<AnyEventResponse | void>;
makeSearchEvent(
request: PreparedSearchEventRequest
): Promise<PreparedEvent<PreparedSearchEventRequest, SearchEventRequest, SearchEventResponse>>;
sendSearchEvent(request: SearchEventRequest): Promise<SearchEventResponse | void>;
makeClickEvent(
request: PreparedClickEventRequest
): Promise<PreparedEvent<PreparedClickEventRequest, ClickEventRequest, ClickEventResponse>>;
sendClickEvent(request: ClickEventRequest): Promise<ClickEventResponse | void>;
makeCustomEvent(
request: PreparedCustomEventRequest
): Promise<PreparedEvent<PreparedCustomEventRequest, CustomEventRequest, CustomEventResponse>>;
sendCustomEvent(request: CustomEventRequest): Promise<CustomEventResponse | void>;
makeViewEvent(
request: PreparedViewEventRequest
): Promise<PreparedEvent<PreparedViewEventRequest, ViewEventRequest, ViewEventResponse>>;
sendViewEvent(request: ViewEventRequest): Promise<ViewEventResponse | void>;

@@ -290,6 +315,6 @@ getVisit(): Promise<VisitResponse>;

async sendEvent(
async makeEvent<TPreparedRequest, TCompleteRequest, TResponse extends AnyEventResponse>(
eventType: EventType | string,
...payload: VariableArgumentsPayload
): Promise<AnyEventResponse | void> {
): Promise<PreparedEvent<TPreparedRequest, TCompleteRequest, TResponse>> {
const {newEventType: eventTypeToSend = eventType as EventType} = this.eventTypeMapping[eventType] || {};

@@ -300,12 +325,21 @@

this.bufferedRequests.push({
return {
eventType: eventTypeToSend,
payload: payloadToSend,
});
log: async (remainingPayload) => {
this.bufferedRequests.push(<BufferedRequest>{
eventType: eventTypeToSend,
payload: {...payloadToSend, ...remainingPayload},
});
await Promise.all(
this.afterSendHooks.map((hook) => hook(eventType, {...parametersToSend, ...remainingPayload}))
);
await this.deferExecution();
return (await this.sendFromBufferWithFetch()) as TResponse | void;
},
};
}
await Promise.all(this.afterSendHooks.map((hook) => hook(eventType, parametersToSend)));
await this.deferExecution();
return await this.sendFromBufferWithFetch();
async sendEvent(eventType: EventType | string, ...payload: VariableArgumentsPayload) {
return (await this.makeEvent<any, any, AnyEventResponse>(eventType, ...payload)).log({});
}

@@ -335,16 +369,41 @@

async sendSearchEvent(request: SearchEventRequest): Promise<SearchEventResponse | void> {
return this.sendEvent(EventType.search, request);
async makeSearchEvent(request: PreparedSearchEventRequest) {
return this.makeEvent<PreparedSearchEventRequest, SearchEventRequest, SearchEventResponse>(
EventType.search,
request
);
}
async sendClickEvent(request: ClickEventRequest): Promise<ClickEventResponse | void> {
return this.sendEvent(EventType.click, request);
async sendSearchEvent({searchQueryUid, ...preparedRequest}: SearchEventRequest) {
return (await this.makeSearchEvent(preparedRequest)).log({searchQueryUid});
}
async sendCustomEvent(request: CustomEventRequest): Promise<CustomEventResponse | void> {
return this.sendEvent(EventType.custom, request);
async makeClickEvent(request: PreparedClickEventRequest) {
return this.makeEvent<PreparedClickEventRequest, ClickEventRequest, ClickEventResponse>(
EventType.click,
request
);
}
async sendClickEvent({searchQueryUid, ...preparedRequest}: ClickEventRequest) {
return (await this.makeClickEvent(preparedRequest)).log({searchQueryUid});
}
async makeCustomEvent(request: PreparedCustomEventRequest) {
return this.makeEvent<PreparedCustomEventRequest, CustomEventRequest, CustomEventResponse>(
EventType.custom,
request
);
}
async sendCustomEvent({lastSearchQueryUid, ...preparedRequest}: CustomEventRequest) {
return (await this.makeCustomEvent(preparedRequest)).log({lastSearchQueryUid});
}
async makeViewEvent(request: PreparedViewEventRequest) {
return this.makeEvent<PreparedViewEventRequest, ViewEventRequest, ViewEventResponse>(EventType.view, request);
}
async sendViewEvent(request: ViewEventRequest): Promise<ViewEventResponse | void> {
return this.sendEvent(EventType.view, request);
return (await this.makeViewEvent(request)).log({});
}

@@ -351,0 +410,0 @@

@@ -1,2 +0,2 @@

import {AnalyticsClient} from './analytics';
import {AnalyticsClient, PreparedEvent} from './analytics';
import {

@@ -10,2 +10,11 @@ AnyEventResponse,

ViewEventResponse,
EventType,
PreparedSearchEventRequest,
SearchEventRequest,
ClickEventRequest,
CustomEventRequest,
PreparedClickEventRequest,
PreparedCustomEventRequest,
PreparedViewEventRequest,
ViewEventRequest,
} from '../events';

@@ -21,14 +30,31 @@ import {NoopRuntime} from './runtimeEnvironment';

}
makeEvent<TPreparedRequest, TCompleteRequest, TResponse extends AnyEventResponse>(
eventType: EventType | string
): Promise<PreparedEvent<TPreparedRequest, TCompleteRequest, TResponse>> {
return Promise.resolve({eventType: eventType as EventType, payload: null, log: () => Promise.resolve()});
}
sendEvent(): Promise<AnyEventResponse | void> {
return Promise.resolve();
}
makeSearchEvent() {
return this.makeEvent<PreparedSearchEventRequest, SearchEventRequest, SearchEventResponse>(EventType.search);
}
sendSearchEvent(): Promise<SearchEventResponse | void> {
return Promise.resolve();
}
makeClickEvent() {
return this.makeEvent<PreparedClickEventRequest, ClickEventRequest, ClickEventResponse>(EventType.click);
}
sendClickEvent(): Promise<ClickEventResponse | void> {
return Promise.resolve();
}
makeCustomEvent() {
return this.makeEvent<PreparedCustomEventRequest, CustomEventRequest, CustomEventResponse>(EventType.custom);
}
sendCustomEvent(): Promise<CustomEventResponse | void> {
return Promise.resolve();
}
makeViewEvent() {
return this.makeEvent<PreparedViewEventRequest, ViewEventRequest, ViewEventResponse>(EventType.view);
}
sendViewEvent(): Promise<ViewEventResponse | void> {

@@ -35,0 +61,0 @@ return Promise.resolve();

@@ -71,2 +71,4 @@ export type IRequestPayload = Record<string, any>;

export interface PreparedSearchEventRequest extends Omit<SearchEventRequest, 'searchQueryUid'> {}
export interface DocumentInformation {

@@ -90,2 +92,4 @@ documentUri: string;

export interface PreparedClickEventRequest extends Omit<ClickEventRequest, 'searchQueryUid'> {}
export interface CustomEventRequest extends EventBaseRequest {

@@ -97,2 +101,4 @@ eventType: string;

export interface PreparedCustomEventRequest extends Omit<CustomEventRequest, 'lastSearchQueryUid'> {}
export interface ViewEventRequest extends EventBaseRequest {

@@ -107,2 +113,4 @@ location?: string;

export interface PreparedViewEventRequest extends ViewEventRequest {}
export interface DefaultEventResponse {

@@ -109,0 +117,0 @@ visitId: string;

@@ -90,4 +90,14 @@ import {CoveoSearchPageClient, EventDescription, SearchPageClientProvider} from './searchPageClient';

const customDataFromMiddleware = {helloFromMiddleware: 1234};
const initClient = () => {
return new CoveoSearchPageClient({}, provider);
return new CoveoSearchPageClient(
{
beforeSendHooks: [
(_, payload) =>
Promise.resolve({...payload, customData: {...payload.customData, ...customDataFromMiddleware}}),
],
},
provider
);
};

@@ -109,8 +119,10 @@

const [, {body}] = fetchMock.lastCall();
const customData = {foo: 'bar', ...meta};
expect(JSON.parse(body.toString())).toMatchObject({
const customData = {foo: 'bar', ...customDataFromMiddleware, ...meta};
expect(JSON.parse(body.toString())).toEqual({
queryText: 'queryText',
responseTime: 123,
searchQueryUid: provider.getSearchUID(),
queryPipeline: 'my-pipeline',
actionCause,
anonymous: false,
customData,

@@ -120,2 +132,3 @@ facetState: fakeFacetState,

clientId: 'visitor-id',
userAgent: expect.any(String),
...expectOrigins(),

@@ -127,4 +140,4 @@ ...expectSplitTestRun(),

const expectMatchDescription = (description: EventDescription, actionCause: SearchPageEvents, meta = {}) => {
const customData = {foo: 'bar', ...meta};
expect(description).toMatchObject({
const customData = {foo: 'bar', ...customDataFromMiddleware, ...meta};
expect(description).toEqual({
actionCause,

@@ -137,4 +150,5 @@ customData,

const [, {body}] = fetchMock.lastCall();
const customData = {foo: 'bar', ...meta};
expect(JSON.parse(body.toString())).toMatchObject({
const customData = {foo: 'bar', ...customDataFromMiddleware, ...meta};
expect(JSON.parse(body.toString())).toEqual({
anonymous: false,
actionCause,

@@ -145,2 +159,5 @@ customData,

clientId: 'visitor-id',
facetState: fakeFacetState,
searchQueryUid: provider.getSearchUID(),
userAgent: expect.any(String),
...doc,

@@ -158,4 +175,5 @@ ...expectOrigins(),

const [, {body}] = fetchMock.lastCall();
const customData = {foo: 'bar', ...meta};
expect(JSON.parse(body.toString())).toMatchObject({
const customData = {foo: 'bar', ...customDataFromMiddleware, ...meta};
expect(JSON.parse(body.toString())).toEqual({
anonymous: false,
eventValue: actionCause,

@@ -167,2 +185,4 @@ eventType,

clientId: 'visitor-id',
facetState: fakeFacetState,
userAgent: expect.any(String),
...expectOrigins(),

@@ -175,4 +195,5 @@ ...expectSplitTestRun(),

const [, {body}] = fetchMock.lastCall();
const customData = {foo: 'bar', ...meta};
expect(JSON.parse(body.toString())).toMatchObject({
const customData = {foo: 'bar', ...customDataFromMiddleware, ...meta};
expect(JSON.parse(body.toString())).toEqual({
anonymous: false,
eventValue,

@@ -184,2 +205,4 @@ eventType,

clientId: 'visitor-id',
facetState: fakeFacetState,
userAgent: expect.any(String),
...expectOrigins(),

@@ -196,4 +219,4 @@ ...expectSplitTestRun(),

it('should send proper payload for #makeInterfaceLoad', async () => {
const built = client.makeInterfaceLoad();
await built.log();
const built = await client.makeInterfaceLoad();
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.interfaceLoad);

@@ -211,4 +234,4 @@ expectMatchDescription(built.description, SearchPageEvents.interfaceLoad);

it('should send proper payload for #makeInterfaceChange', async () => {
const built = client.makeInterfaceChange({interfaceChangeTo: 'bob'});
await built.log();
const built = await client.makeInterfaceChange({interfaceChangeTo: 'bob'});
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.interfaceChange, {interfaceChangeTo: 'bob'});

@@ -224,4 +247,4 @@ expectMatchDescription(built.description, SearchPageEvents.interfaceChange, {interfaceChangeTo: 'bob'});

it('should send proper payload for #makeDidyoumeanAutomatic', async () => {
const built = client.makeDidYouMeanAutomatic();
await built.log();
const built = await client.makeDidYouMeanAutomatic();
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.didyoumeanAutomatic);

@@ -237,4 +260,4 @@ expectMatchDescription(built.description, SearchPageEvents.didyoumeanAutomatic);

it('should send proper payload for #makeDidyoumeanClick', async () => {
const built = client.makeDidYouMeanClick();
await built.log();
const built = await client.makeDidYouMeanClick();
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.didyoumeanClick);

@@ -250,4 +273,4 @@ expectMatchDescription(built.description, SearchPageEvents.didyoumeanClick);

it('should send proper payload for #makeResultsSort', async () => {
const built = client.makeResultsSort({resultsSortBy: 'date ascending'});
await built.log();
const built = await client.makeResultsSort({resultsSortBy: 'date ascending'});
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.resultsSort, {resultsSortBy: 'date ascending'});

@@ -263,4 +286,4 @@ expectMatchDescription(built.description, SearchPageEvents.resultsSort, {resultsSortBy: 'date ascending'});

it('should send proper payload for #makeSearchboxSubmit', async () => {
const built = client.makeSearchboxSubmit();
await built.log();
const built = await client.makeSearchboxSubmit();
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.searchboxSubmit);

@@ -276,4 +299,4 @@ expectMatchDescription(built.description, SearchPageEvents.searchboxSubmit);

it('should send proper payload for #makeSearchboxClear', async () => {
const built = client.makeSearchboxClear();
await built.log();
const built = await client.makeSearchboxClear();
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.searchboxClear);

@@ -289,4 +312,4 @@ expectMatchDescription(built.description, SearchPageEvents.searchboxClear);

it('should send proper payload for #makeSearchboxAsYouType', async () => {
const built = client.makeSearchboxAsYouType();
await built.log();
const built = await client.makeSearchboxAsYouType();
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.searchboxAsYouType);

@@ -302,4 +325,4 @@ expectMatchDescription(built.description, SearchPageEvents.searchboxAsYouType);

it('should send proper payload for #makeDocumentQuickview', async () => {
const built = client.makeDocumentQuickview(fakeDocInfo, fakeDocID);
await built.log();
const built = await client.makeDocumentQuickview(fakeDocInfo, fakeDocID);
await built.log({searchUID: provider.getSearchUID()});
expectMatchDocumentPayload(SearchPageEvents.documentQuickview, fakeDocInfo, fakeDocID);

@@ -315,4 +338,4 @@ expectMatchDescription(built.description, SearchPageEvents.documentQuickview, {...fakeDocID});

it('should send proper payload for #makeDocumentOpen', async () => {
const built = client.makeDocumentOpen(fakeDocInfo, fakeDocID);
await built.log();
const built = await client.makeDocumentOpen(fakeDocInfo, fakeDocID);
await built.log({searchUID: provider.getSearchUID()});
expectMatchDocumentPayload(SearchPageEvents.documentOpen, fakeDocInfo, fakeDocID);

@@ -328,4 +351,4 @@ expectMatchDescription(built.description, SearchPageEvents.documentOpen, {...fakeDocID});

it('should send proper payload for #makeShowMoreFoldedResults', async () => {
const built = client.makeShowMoreFoldedResults(fakeDocInfo, fakeDocID);
await built.log();
const built = await client.makeShowMoreFoldedResults(fakeDocInfo, fakeDocID);
await built.log({searchUID: provider.getSearchUID()});
expectMatchDocumentPayload(SearchPageEvents.showMoreFoldedResults, fakeDocInfo, fakeDocID);

@@ -341,4 +364,4 @@ expectMatchDescription(built.description, SearchPageEvents.showMoreFoldedResults, fakeDocID);

it('should send proper payload for #makeShowLessFoldedResults', async () => {
const built = client.makeShowLessFoldedResults();
await built.log();
const built = await client.makeShowLessFoldedResults();
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.showLessFoldedResults);

@@ -368,4 +391,4 @@ expectMatchDescription(built.description, SearchPageEvents.showLessFoldedResults);

};
const built = client.makeOmniboxAnalytics(meta);
await built.log();
const built = await client.makeOmniboxAnalytics(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.omniboxAnalytics, meta);

@@ -395,4 +418,4 @@ expectMatchDescription(built.description, SearchPageEvents.omniboxAnalytics, meta);

};
const built = client.makeOmniboxFromLink(meta);
await built.log();
const built = await client.makeOmniboxFromLink(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.omniboxFromLink, meta);

@@ -408,4 +431,4 @@ expectMatchDescription(built.description, SearchPageEvents.omniboxFromLink, meta);

it('should send proper payload for #makeSearchFromLink', async () => {
const built = client.makeSearchFromLink();
await built.log();
const built = await client.makeSearchFromLink();
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.searchFromLink);

@@ -427,4 +450,4 @@ expectMatchDescription(built.description, SearchPageEvents.searchFromLink);

};
const built = client.makeTriggerNotify(meta);
await built.log();
const built = await client.makeTriggerNotify(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.triggerNotify, meta);

@@ -452,4 +475,4 @@ expectMatchDescription(built.description, SearchPageEvents.triggerNotify, meta);

};
const built = client.makeTriggerExecute(meta);
await built.log();
const built = await client.makeTriggerExecute(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.triggerExecute, meta);

@@ -471,4 +494,4 @@ expectMatchDescription(built.description, SearchPageEvents.triggerExecute, meta);

};
const built = client.makeTriggerQuery();
await built.log();
const built = await client.makeTriggerQuery();
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.triggerQuery, meta, 'queryPipelineTriggers');

@@ -490,4 +513,4 @@ expectMatchDescription(built.description, SearchPageEvents.triggerQuery, meta);

};
const built = client.makeUndoTriggerQuery(meta);
await built.log();
const built = await client.makeUndoTriggerQuery(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.undoTriggerQuery, meta);

@@ -500,2 +523,3 @@ expectMatchDescription(built.description, SearchPageEvents.undoTriggerQuery, meta);

redirectedTo: 'foo',
query: provider.getSearchEventRequestPayload().queryText,
};

@@ -509,5 +533,6 @@ await client.logTriggerRedirect(meta);

redirectedTo: 'foo',
query: provider.getSearchEventRequestPayload().queryText,
};
const built = client.makeTriggerRedirect(meta);
await built.log();
const built = await client.makeTriggerRedirect(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.triggerRedirect, meta);

@@ -529,4 +554,4 @@ expectMatchDescription(built.description, SearchPageEvents.triggerRedirect, meta);

};
const built = client.makePagerResize(meta);
await built.log();
const built = await client.makePagerResize(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.pagerResize, meta);

@@ -544,4 +569,4 @@ expectMatchDescription(built.description, SearchPageEvents.pagerResize, meta);

const meta = {pagerNumber: 123};
const built = client.makePagerNumber(meta);
await built.log();
const built = await client.makePagerNumber(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.pagerNumber, meta);

@@ -559,4 +584,4 @@ expectMatchDescription(built.description, SearchPageEvents.pagerNumber, meta);

const meta = {pagerNumber: 123};
const built = client.makePagerNext(meta);
await built.log();
const built = await client.makePagerNext(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.pagerNext, meta);

@@ -574,4 +599,4 @@ expectMatchDescription(built.description, SearchPageEvents.pagerNext, meta);

const meta = {pagerNumber: 123};
const built = client.makePagerPrevious(meta);
await built.log();
const built = await client.makePagerPrevious(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.pagerPrevious, meta);

@@ -587,4 +612,4 @@ expectMatchDescription(built.description, SearchPageEvents.pagerPrevious, meta);

it('should send proper payload for #makePagerScrolling', async () => {
const built = client.makePagerScrolling();
await built.log();
const built = await client.makePagerScrolling();
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.pagerScrolling);

@@ -603,4 +628,4 @@ expectMatchDescription(built.description, SearchPageEvents.pagerScrolling);

const staticFilterId = 'filetypes';
const built = client.makeStaticFilterClearAll({staticFilterId});
await built.log();
const built = await client.makeStaticFilterClearAll({staticFilterId});
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.staticFilterClearAll, {staticFilterId});

@@ -631,4 +656,4 @@ expectMatchDescription(built.description, SearchPageEvents.staticFilterClearAll, {staticFilterId});

};
const built = client.makeStaticFilterSelect(meta);
await built.log();
const built = await client.makeStaticFilterSelect(meta);
await built.log({searchUID: provider.getSearchUID()});

@@ -660,4 +685,4 @@ expectMatchPayload(SearchPageEvents.staticFilterSelect, meta);

};
const built = client.makeStaticFilterDeselect(meta);
await built.log();
const built = await client.makeStaticFilterDeselect(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.staticFilterDeselect, meta);

@@ -683,4 +708,4 @@ expectMatchDescription(built.description, SearchPageEvents.staticFilterDeselect, meta);

};
const built = client.makeFacetSearch(meta);
await built.log();
const built = await client.makeFacetSearch(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.facetSearch, meta);

@@ -710,3 +735,3 @@ expectMatchDescription(built.description, SearchPageEvents.facetSearch, meta);

const built = await client.makeFacetSelect(meta);
await built.log();
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.facetSelect, meta);

@@ -736,4 +761,4 @@ expectMatchDescription(built.description, SearchPageEvents.facetSelect, meta);

const built = client.makeFacetDeselect(meta);
await built.log();
const built = await client.makeFacetDeselect(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.facetDeselect, meta);

@@ -761,4 +786,4 @@ expectMatchDescription(built.description, SearchPageEvents.facetDeselect, meta);

};
const built = client.makeFacetExclude(meta);
await built.log();
const built = await client.makeFacetExclude(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.facetExclude, meta);

@@ -786,4 +811,4 @@ expectMatchDescription(built.description, SearchPageEvents.facetExclude, meta);

};
const built = client.makeFacetUnexclude(meta);
await built.log();
const built = await client.makeFacetUnexclude(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.facetUnexclude, meta);

@@ -809,4 +834,4 @@ expectMatchDescription(built.description, SearchPageEvents.facetUnexclude, meta);

};
const built = client.makeFacetSelectAll(meta);
await built.log();
const built = await client.makeFacetSelectAll(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.facetSelectAll, meta);

@@ -834,4 +859,4 @@ expectMatchDescription(built.description, SearchPageEvents.facetSelectAll, meta);

};
const built = client.makeFacetUpdateSort(meta);
await built.log();
const built = await client.makeFacetUpdateSort(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.facetUpdateSort, meta);

@@ -857,4 +882,4 @@ expectMatchDescription(built.description, SearchPageEvents.facetUpdateSort, meta);

};
const built = client.makeFacetShowMore(meta);
await built.log();
const built = await client.makeFacetShowMore(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.facetShowMore, meta);

@@ -880,4 +905,4 @@ expectMatchDescription(built.description, SearchPageEvents.facetShowMore, meta);

};
const built = client.makeFacetShowLess(meta);
await built.log();
const built = await client.makeFacetShowLess(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.facetShowLess, meta);

@@ -909,4 +934,4 @@ expectMatchDescription(built.description, SearchPageEvents.facetShowLess, meta);

};
const built = client.makeQueryError(meta);
await built.log();
const built = await client.makeQueryError(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.queryError, meta);

@@ -922,4 +947,4 @@ expectMatchDescription(built.description, SearchPageEvents.queryError, meta);

it('should send proper payload for #makeQueryErrorBack', async () => {
const built = client.makeQueryErrorBack();
await built.log();
const built = await client.makeQueryErrorBack();
await built.log({searchUID: provider.getSearchUID()});

@@ -936,4 +961,4 @@ expectMatchPayload(SearchPageEvents.queryErrorBack);

it('should send proper payload for #makeQueryErrorRetry', async () => {
const built = client.makeQueryErrorRetry();
await built.log();
const built = await client.makeQueryErrorRetry();
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.queryErrorRetry);

@@ -949,4 +974,4 @@ expectMatchDescription(built.description, SearchPageEvents.queryErrorRetry);

it('should send proper payload for #makeQueryErrorClear', async () => {
const built = client.makeQueryErrorClear();
await built.log();
const built = await client.makeQueryErrorClear();
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.queryErrorClear);

@@ -962,4 +987,4 @@ expectMatchDescription(built.description, SearchPageEvents.queryErrorClear);

it('should send proper payload for #makeRecommendationInterfaceLoad', async () => {
const built = client.makeRecommendationInterfaceLoad();
await built.log();
const built = await client.makeRecommendationInterfaceLoad();
await built.log({searchUID: provider.getSearchUID()});
expectMatchPayload(SearchPageEvents.recommendationInterfaceLoad);

@@ -975,4 +1000,4 @@ expectMatchDescription(built.description, SearchPageEvents.recommendationInterfaceLoad);

it('should send proper payload for #makeRecommendation', async () => {
const built = client.makeRecommendation();
await built.log();
const built = await client.makeRecommendation();
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.recommendation);

@@ -987,4 +1012,4 @@ });

it('should send proper payload for #makeRecommendationOpen', async () => {
const built = client.makeRecommendationOpen(fakeDocInfo, fakeDocID);
await built.log();
const built = await client.makeRecommendationOpen(fakeDocInfo, fakeDocID);
await built.log({searchUID: provider.getSearchUID()});
expectMatchDocumentPayload(SearchPageEvents.recommendationOpen, fakeDocInfo, fakeDocID);

@@ -1000,6 +1025,6 @@ expectMatchDescription(built.description, SearchPageEvents.recommendationOpen, {...fakeDocID});

it('should send proper payload for #makeFetchMoreResults', async () => {
const built = client.makeFetchMoreResults();
await built.log();
const built = await client.makeFetchMoreResults();
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.pagerScrolling, {type: 'getMoreResults'});
expectMatchDescription(built.description, SearchPageEvents.pagerScrolling);
expectMatchDescription(built.description, SearchPageEvents.pagerScrolling, {type: 'getMoreResults'});
});

@@ -1013,4 +1038,4 @@

it('should send proper payload for #makeLikeSmartSnippet', async () => {
const built = client.makeLikeSmartSnippet();
await built.log();
const built = await client.makeLikeSmartSnippet();
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.likeSmartSnippet);

@@ -1026,4 +1051,4 @@ expectMatchDescription(built.description, SearchPageEvents.likeSmartSnippet);

it('should send proper payload for #makeDislikeSmartSnippet', async () => {
const built = client.makeDislikeSmartSnippet();
await built.log();
const built = await client.makeDislikeSmartSnippet();
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.dislikeSmartSnippet);

@@ -1039,4 +1064,4 @@ expectMatchDescription(built.description, SearchPageEvents.dislikeSmartSnippet);

it('should send proper payload for #makeExpandSmartSnippet', async () => {
const built = client.makeExpandSmartSnippet();
await built.log();
const built = await client.makeExpandSmartSnippet();
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippet);

@@ -1052,4 +1077,4 @@ expectMatchDescription(built.description, SearchPageEvents.expandSmartSnippet);

it('should send proper payload for #makeCollapseSmartSnippet', async () => {
const built = client.makeCollapseSmartSnippet();
await built.log();
const built = await client.makeCollapseSmartSnippet();
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippet);

@@ -1065,4 +1090,4 @@ expectMatchDescription(built.description, SearchPageEvents.collapseSmartSnippet);

it('should send proper payload for #makeOpenSmartSnippetFeedbackModal', async () => {
const built = client.makeOpenSmartSnippetFeedbackModal();
await built.log();
const built = await client.makeOpenSmartSnippetFeedbackModal();
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.openSmartSnippetFeedbackModal);

@@ -1078,4 +1103,4 @@ expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetFeedbackModal);

it('should send proper payload for #makeCloseSmartSnippetFeedbackModal', async () => {
const built = client.makeCloseSmartSnippetFeedbackModal();
await built.log();
const built = await client.makeCloseSmartSnippetFeedbackModal();
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.closeSmartSnippetFeedbackModal);

@@ -1094,4 +1119,4 @@ expectMatchDescription(built.description, SearchPageEvents.closeSmartSnippetFeedbackModal);

it('should send proper payload for #makeSmartSnippetFeedbackReason', async () => {
const built = client.makeSmartSnippetFeedbackReason('does_not_answer', 'this is irrelevant');
await built.log();
const built = await client.makeSmartSnippetFeedbackReason('does_not_answer', 'this is irrelevant');
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.sendSmartSnippetReason, {

@@ -1121,3 +1146,3 @@ details: 'this is irrelevant',

it('should send proper payload for #makeExpandSmartSnippetSuggestion', async () => {
const built = client.makeExpandSmartSnippetSuggestion({
const built = await client.makeExpandSmartSnippetSuggestion({
question: 'Abc',

@@ -1127,3 +1152,3 @@ answerSnippet: 'Def',

});
await built.log();
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippetSuggestion, {

@@ -1155,3 +1180,3 @@ question: 'Abc',

it('should send proper payload for #makeCollapseSmartSnippetSuggestion', async () => {
const built = client.makeCollapseSmartSnippetSuggestion({
const built = await client.makeCollapseSmartSnippetSuggestion({
question: 'Abc',

@@ -1161,3 +1186,3 @@ answerSnippet: 'Def',

});
await built.log();
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippetSuggestion, {

@@ -1183,7 +1208,7 @@ question: 'Abc',

it('should send proper payload for #makeExpandSmartSnippetSuggestion when called with only the documentId', async () => {
const built = client.makeExpandSmartSnippetSuggestion({
const built = await client.makeExpandSmartSnippetSuggestion({
contentIdKey: 'permanentid',
contentIdValue: 'foo',
});
await built.log();
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippetSuggestion, {

@@ -1205,4 +1230,7 @@ documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},

it('should send proper payload for #makeCollapseSmartSnippetSuggestion when called with only the documentId', async () => {
const built = client.makeCollapseSmartSnippetSuggestion({contentIdKey: 'permanentid', contentIdValue: 'foo'});
await built.log();
const built = await client.makeCollapseSmartSnippetSuggestion({
contentIdKey: 'permanentid',
contentIdValue: 'foo',
});
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippetSuggestion, {

@@ -1225,2 +1253,3 @@ documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},

answerSnippet: 'Def',
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
});

@@ -1253,4 +1282,4 @@ });

it('should send proper payload for #makeOpenSmartSnippetSource', async () => {
const built = client.makeOpenSmartSnippetSource(fakeDocInfo, fakeDocID);
await built.log();
const built = await client.makeOpenSmartSnippetSource(fakeDocInfo, fakeDocID);
await built.log({searchUID: provider.getSearchUID()});
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSource, fakeDocInfo, fakeDocID);

@@ -1278,6 +1307,8 @@ expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetSource, {...fakeDocID});

answerSnippet: 'Def',
contentIDKey: 'permanentid',
contentIDValue: 'foo',
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
};
const built = client.makeOpenSmartSnippetSuggestionSource(fakeDocInfo, meta);
await built.log();
const built = await client.makeOpenSmartSnippetSuggestionSource(fakeDocInfo, meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSuggestionSource, fakeDocInfo, meta);

@@ -1303,4 +1334,4 @@ expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetSuggestionSource, meta);

};
const built = client.makeOpenSmartSnippetInlineLink(fakeDocInfo, meta);
await built.log();
const built = await client.makeOpenSmartSnippetInlineLink(fakeDocInfo, meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetInlineLink, fakeDocInfo, meta);

@@ -1330,2 +1361,4 @@ expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetInlineLink, meta);

answerSnippet: 'Def',
contentIDKey: 'permanentid',
contentIDValue: 'foo',
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},

@@ -1335,4 +1368,4 @@ linkText: 'Some text',

};
const built = client.makeOpenSmartSnippetSuggestionInlineLink(fakeDocInfo, meta);
await built.log();
const built = await client.makeOpenSmartSnippetSuggestionInlineLink(fakeDocInfo, meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSuggestionInlineLink, fakeDocInfo, meta);

@@ -1348,4 +1381,4 @@ expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetSuggestionInlineLink, meta);

it('should send proper payload for #makeRecentQueryClick', async () => {
const built = client.makeRecentQueryClick();
await built.log();
const built = await client.makeRecentQueryClick();
await built.log({searchUID: provider.getSearchUID()});

@@ -1362,4 +1395,4 @@ expectMatchPayload(SearchPageEvents.recentQueryClick);

it('should send proper payload for #makeClearRecentQueries', async () => {
const built = client.makeClearRecentQueries();
await built.log();
const built = await client.makeClearRecentQueries();
await built.log({searchUID: provider.getSearchUID()});

@@ -1379,4 +1412,4 @@ expectMatchCustomEventPayload(SearchPageEvents.clearRecentQueries);

it('should send proper payload for #makeRecentResultClick', async () => {
const built = client.makeRecentResultClick(fakeDocInfo, fakeDocID);
await built.log();
const built = await client.makeRecentResultClick(fakeDocInfo, fakeDocID);
await built.log({searchUID: provider.getSearchUID()});

@@ -1400,4 +1433,4 @@ expectMatchCustomEventPayload(SearchPageEvents.recentResultClick, {

it('should send proper payload for #makeNoResultsBack', async () => {
const built = client.makeNoResultsBack();
await built.log();
const built = await client.makeNoResultsBack();
await built.log({searchUID: provider.getSearchUID()});

@@ -1414,4 +1447,4 @@ expectMatchPayload(SearchPageEvents.noResultsBack);

it('should send proper payload for #makeClearRecentResults', async () => {
const built = client.makeClearRecentResults();
await built.log();
const built = await client.makeClearRecentResults();
await built.log({searchUID: provider.getSearchUID()});

@@ -1428,4 +1461,4 @@ expectMatchCustomEventPayload(SearchPageEvents.clearRecentResults);

it('should send proper payload for #makeCustomEventWithType', async () => {
const built = client.makeCustomEventWithType('foo', 'bar', {buzz: 'bazz'});
await built.log();
const built = await client.makeCustomEventWithType('foo', 'bar', {buzz: 'bazz'});
await built.log({searchUID: provider.getSearchUID()});

@@ -1432,0 +1465,0 @@ expectMatchCustomEventWithTypePayload('foo', 'bar', {buzz: 'bazz'});

@@ -1,5 +0,4 @@

import CoveoAnalyticsClient, {ClientOptions, AnalyticsClient} from '../client/analytics';
import CoveoAnalyticsClient, {ClientOptions, AnalyticsClient, PreparedEvent} from '../client/analytics';
import {
SearchEventRequest,
ClickEventRequest,
CustomEventRequest,

@@ -10,2 +9,4 @@ SearchEventResponse,

CustomEventResponse,
PreparedClickEventRequest,
PreparedSearchEventRequest,
} from '../events';

@@ -68,3 +69,3 @@ import {

description: EventDescription;
log: () => Promise<T | void>;
log(metadata: {searchUID: string}): Promise<T | void>;
}

@@ -96,4 +97,4 @@

public logInterfaceLoad() {
return this.makeInterfaceLoad().log();
public async logInterfaceLoad() {
return (await this.makeInterfaceLoad()).log({searchUID: this.provider.getSearchUID()});
}

@@ -105,4 +106,4 @@

public logRecommendationInterfaceLoad() {
return this.makeRecommendationInterfaceLoad().log();
public async logRecommendationInterfaceLoad() {
return (await this.makeRecommendationInterfaceLoad()).log({searchUID: this.provider.getSearchUID()});
}

@@ -114,4 +115,4 @@

public logRecommendation() {
return this.makeRecommendation().log();
public async logRecommendation() {
return (await this.makeRecommendation()).log({searchUID: this.provider.getSearchUID()});
}

@@ -123,4 +124,4 @@

public logRecommendationOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
return this.makeRecommendationOpen(info, identifier).log();
public async logRecommendationOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
return (await this.makeRecommendationOpen(info, identifier)).log({searchUID: this.provider.getSearchUID()});
}

@@ -132,4 +133,4 @@

public logStaticFilterClearAll(meta: StaticFilterMetadata) {
return this.makeStaticFilterClearAll(meta).log();
public async logStaticFilterClearAll(meta: StaticFilterMetadata) {
return (await this.makeStaticFilterClearAll(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -141,4 +142,4 @@

public logStaticFilterSelect(meta: StaticFilterToggleValueMetadata) {
return this.makeStaticFilterSelect(meta).log();
public async logStaticFilterSelect(meta: StaticFilterToggleValueMetadata) {
return (await this.makeStaticFilterSelect(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -150,4 +151,4 @@

public logStaticFilterDeselect(meta: StaticFilterToggleValueMetadata) {
return this.makeStaticFilterDeselect(meta).log();
public async logStaticFilterDeselect(meta: StaticFilterToggleValueMetadata) {
return (await this.makeStaticFilterDeselect(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -159,4 +160,4 @@

public logFetchMoreResults() {
return this.makeFetchMoreResults().log();
public async logFetchMoreResults() {
return (await this.makeFetchMoreResults()).log({searchUID: this.provider.getSearchUID()});
}

@@ -168,4 +169,4 @@

public logInterfaceChange(metadata: InterfaceChangeMetadata) {
return this.makeInterfaceChange(metadata).log();
public async logInterfaceChange(metadata: InterfaceChangeMetadata) {
return (await this.makeInterfaceChange(metadata)).log({searchUID: this.provider.getSearchUID()});
}

@@ -177,4 +178,4 @@

public logDidYouMeanAutomatic() {
return this.makeDidYouMeanAutomatic().log();
public async logDidYouMeanAutomatic() {
return (await this.makeDidYouMeanAutomatic()).log({searchUID: this.provider.getSearchUID()});
}

@@ -186,4 +187,4 @@

public logDidYouMeanClick() {
return this.makeDidYouMeanClick().log();
public async logDidYouMeanClick() {
return (await this.makeDidYouMeanClick()).log({searchUID: this.provider.getSearchUID()});
}

@@ -195,4 +196,4 @@

public logResultsSort(metadata: ResultsSortMetadata) {
return this.makeResultsSort(metadata).log();
public async logResultsSort(metadata: ResultsSortMetadata) {
return (await this.makeResultsSort(metadata)).log({searchUID: this.provider.getSearchUID()});
}

@@ -204,4 +205,4 @@

public logSearchboxSubmit() {
return this.makeSearchboxSubmit().log();
public async logSearchboxSubmit() {
return (await this.makeSearchboxSubmit()).log({searchUID: this.provider.getSearchUID()});
}

@@ -213,4 +214,4 @@

public logSearchboxClear() {
return this.makeSearchboxClear().log();
public async logSearchboxClear() {
return (await this.makeSearchboxClear()).log({searchUID: this.provider.getSearchUID()});
}

@@ -222,4 +223,4 @@

public logSearchboxAsYouType() {
return this.makeSearchboxAsYouType().log();
public async logSearchboxAsYouType() {
return (await this.makeSearchboxAsYouType()).log({searchUID: this.provider.getSearchUID()});
}

@@ -231,4 +232,4 @@

public logBreadcrumbFacet(metadata: FacetMetadata | FacetRangeMetadata | CategoryFacetMetadata) {
return this.makeBreadcrumbFacet(metadata).log();
public async logBreadcrumbFacet(metadata: FacetMetadata | FacetRangeMetadata | CategoryFacetMetadata) {
return (await this.makeBreadcrumbFacet(metadata)).log({searchUID: this.provider.getSearchUID()});
}

@@ -240,4 +241,4 @@

public logBreadcrumbResetAll() {
return this.makeBreadcrumbResetAll().log();
public async logBreadcrumbResetAll() {
return (await this.makeBreadcrumbResetAll()).log({searchUID: this.provider.getSearchUID()});
}

@@ -249,4 +250,4 @@

public logDocumentQuickview(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
return this.makeDocumentQuickview(info, identifier).log();
public async logDocumentQuickview(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
return (await this.makeDocumentQuickview(info, identifier)).log({searchUID: this.provider.getSearchUID()});
}

@@ -258,4 +259,4 @@

public logDocumentOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
return this.makeDocumentOpen(info, identifier).log();
public async logDocumentOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
return (await this.makeDocumentOpen(info, identifier)).log({searchUID: this.provider.getSearchUID()});
}

@@ -267,4 +268,4 @@

public logOmniboxAnalytics(meta: OmniboxSuggestionsMetadata) {
return this.makeOmniboxAnalytics(meta).log();
public async logOmniboxAnalytics(meta: OmniboxSuggestionsMetadata) {
return (await this.makeOmniboxAnalytics(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -276,4 +277,4 @@

public logOmniboxFromLink(meta: OmniboxSuggestionsMetadata) {
return this.makeOmniboxFromLink(meta).log();
public async logOmniboxFromLink(meta: OmniboxSuggestionsMetadata) {
return (await this.makeOmniboxFromLink(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -285,4 +286,4 @@

public logSearchFromLink() {
return this.makeSearchFromLink().log();
public async logSearchFromLink() {
return (await this.makeSearchFromLink()).log({searchUID: this.provider.getSearchUID()});
}

@@ -294,4 +295,4 @@

public logTriggerNotify(meta: TriggerNotifyMetadata) {
return this.makeTriggerNotify(meta).log();
public async logTriggerNotify(meta: TriggerNotifyMetadata) {
return (await this.makeTriggerNotify(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -303,4 +304,4 @@

public logTriggerExecute(meta: TriggerExecuteMetadata) {
return this.makeTriggerExecute(meta).log();
public async logTriggerExecute(meta: TriggerExecuteMetadata) {
return (await this.makeTriggerExecute(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -316,4 +317,4 @@

public logTriggerQuery() {
return this.makeTriggerQuery().log();
public async logTriggerQuery() {
return (await this.makeTriggerQuery()).log({searchUID: this.provider.getSearchUID()});
}

@@ -325,4 +326,4 @@

public logUndoTriggerQuery(meta: UndoTriggerRedirectMetadata) {
return this.makeUndoTriggerQuery(meta).log();
public async logUndoTriggerQuery(meta: UndoTriggerRedirectMetadata) {
return (await this.makeUndoTriggerQuery(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -337,4 +338,4 @@

public logTriggerRedirect(meta: TriggerRedirectMetadata) {
return this.makeTriggerRedirect(meta).log();
public async logTriggerRedirect(meta: TriggerRedirectMetadata) {
return (await this.makeTriggerRedirect(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -346,4 +347,4 @@

public logPagerResize(meta: PagerResizeMetadata) {
return this.makePagerResize(meta).log();
public async logPagerResize(meta: PagerResizeMetadata) {
return (await this.makePagerResize(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -355,4 +356,4 @@

public logPagerNumber(meta: PagerMetadata) {
return this.makePagerNumber(meta).log();
public async logPagerNumber(meta: PagerMetadata) {
return (await this.makePagerNumber(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -364,4 +365,4 @@

public logPagerNext(meta: PagerMetadata) {
return this.makePagerNext(meta).log();
public async logPagerNext(meta: PagerMetadata) {
return (await this.makePagerNext(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -373,4 +374,4 @@

public logPagerPrevious(meta: PagerMetadata) {
return this.makePagerPrevious(meta).log();
public async logPagerPrevious(meta: PagerMetadata) {
return (await this.makePagerPrevious(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -382,4 +383,4 @@

public logPagerScrolling() {
return this.makePagerScrolling().log();
public async logPagerScrolling() {
return (await this.makePagerScrolling()).log({searchUID: this.provider.getSearchUID()});
}

@@ -391,4 +392,4 @@

public logFacetClearAll(meta: FacetBaseMeta) {
return this.makeFacetClearAll(meta).log();
public async logFacetClearAll(meta: FacetBaseMeta) {
return (await this.makeFacetClearAll(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -400,4 +401,4 @@

public logFacetSearch(meta: FacetBaseMeta) {
return this.makeFacetSearch(meta).log();
public async logFacetSearch(meta: FacetBaseMeta) {
return (await this.makeFacetSearch(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -409,4 +410,4 @@

public logFacetSelect(meta: FacetMetadata) {
return this.makeFacetSelect(meta).log();
public async logFacetSelect(meta: FacetMetadata) {
return (await this.makeFacetSelect(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -418,4 +419,4 @@

public logFacetDeselect(meta: FacetMetadata) {
return this.makeFacetDeselect(meta).log();
public async logFacetDeselect(meta: FacetMetadata) {
return (await this.makeFacetDeselect(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -427,4 +428,4 @@

public logFacetExclude(meta: FacetMetadata) {
return this.makeFacetExclude(meta).log();
public async logFacetExclude(meta: FacetMetadata) {
return (await this.makeFacetExclude(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -436,4 +437,4 @@

public logFacetUnexclude(meta: FacetMetadata) {
return this.makeFacetUnexclude(meta).log();
public async logFacetUnexclude(meta: FacetMetadata) {
return (await this.makeFacetUnexclude(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -445,4 +446,4 @@

public logFacetSelectAll(meta: FacetBaseMeta) {
return this.makeFacetSelectAll(meta).log();
public async logFacetSelectAll(meta: FacetBaseMeta) {
return (await this.makeFacetSelectAll(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -454,4 +455,4 @@

public logFacetUpdateSort(meta: FacetSortMeta) {
return this.makeFacetUpdateSort(meta).log();
public async logFacetUpdateSort(meta: FacetSortMeta) {
return (await this.makeFacetUpdateSort(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -463,4 +464,4 @@

public logFacetShowMore(meta: FacetBaseMeta) {
return this.makeFacetShowMore(meta).log();
public async logFacetShowMore(meta: FacetBaseMeta) {
return (await this.makeFacetShowMore(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -472,4 +473,4 @@

public logFacetShowLess(meta: FacetBaseMeta) {
return this.makeFacetShowLess(meta).log();
public async logFacetShowLess(meta: FacetBaseMeta) {
return (await this.makeFacetShowLess(meta)).log({searchUID: this.provider.getSearchUID()});
}

@@ -481,11 +482,12 @@

public logQueryError(meta: QueryErrorMeta) {
return this.makeQueryError(meta).log();
public async logQueryError(meta: QueryErrorMeta) {
return (await this.makeQueryError(meta)).log({searchUID: this.provider.getSearchUID()});
}
public makeQueryErrorBack(): EventBuilder<SearchEventResponse> {
public async makeQueryErrorBack(): Promise<EventBuilder<SearchEventResponse>> {
const customEventBuilder = await this.makeCustomEvent(SearchPageEvents.queryErrorBack);
return {
description: this.makeDescription(SearchPageEvents.queryErrorBack),
description: customEventBuilder.description,
log: async () => {
await this.logCustomEvent(SearchPageEvents.queryErrorBack);
await customEventBuilder.log({searchUID: this.provider.getSearchUID()});
return this.logSearchEvent(SearchPageEvents.queryErrorBack);

@@ -496,11 +498,12 @@ },

public logQueryErrorBack() {
return this.makeQueryErrorBack().log();
public async logQueryErrorBack() {
return (await this.makeQueryErrorBack()).log({searchUID: this.provider.getSearchUID()});
}
public makeQueryErrorRetry(): EventBuilder<SearchEventResponse> {
public async makeQueryErrorRetry(): Promise<EventBuilder<SearchEventResponse>> {
const customEventBuilder = await this.makeCustomEvent(SearchPageEvents.queryErrorRetry);
return {
description: this.makeDescription(SearchPageEvents.queryErrorRetry),
description: customEventBuilder.description,
log: async () => {
await this.logCustomEvent(SearchPageEvents.queryErrorRetry);
await customEventBuilder.log({searchUID: this.provider.getSearchUID()});
return this.logSearchEvent(SearchPageEvents.queryErrorRetry);

@@ -511,11 +514,12 @@ },

public logQueryErrorRetry() {
return this.makeQueryErrorRetry().log();
public async logQueryErrorRetry() {
return (await this.makeQueryErrorRetry()).log({searchUID: this.provider.getSearchUID()});
}
public makeQueryErrorClear(): EventBuilder<SearchEventResponse> {
public async makeQueryErrorClear(): Promise<EventBuilder<SearchEventResponse>> {
const customEventBuilder = await this.makeCustomEvent(SearchPageEvents.queryErrorClear);
return {
description: this.makeDescription(SearchPageEvents.queryErrorClear),
description: customEventBuilder.description,
log: async () => {
await this.logCustomEvent(SearchPageEvents.queryErrorClear);
await customEventBuilder.log({searchUID: this.provider.getSearchUID()});
return this.logSearchEvent(SearchPageEvents.queryErrorClear);

@@ -526,4 +530,4 @@ },

public logQueryErrorClear() {
return this.makeQueryErrorClear().log();
public async logQueryErrorClear() {
return (await this.makeQueryErrorClear()).log({searchUID: this.provider.getSearchUID()});
}

@@ -535,4 +539,4 @@

public logLikeSmartSnippet() {
return this.makeLikeSmartSnippet().log();
public async logLikeSmartSnippet() {
return (await this.makeLikeSmartSnippet()).log({searchUID: this.provider.getSearchUID()});
}

@@ -544,4 +548,4 @@

public logDislikeSmartSnippet() {
return this.makeDislikeSmartSnippet().log();
public async logDislikeSmartSnippet() {
return (await this.makeDislikeSmartSnippet()).log({searchUID: this.provider.getSearchUID()});
}

@@ -553,4 +557,4 @@

public logExpandSmartSnippet() {
return this.makeExpandSmartSnippet().log();
public async logExpandSmartSnippet() {
return (await this.makeExpandSmartSnippet()).log({searchUID: this.provider.getSearchUID()});
}

@@ -562,4 +566,4 @@

public logCollapseSmartSnippet() {
return this.makeCollapseSmartSnippet().log();
public async logCollapseSmartSnippet() {
return (await this.makeCollapseSmartSnippet()).log({searchUID: this.provider.getSearchUID()});
}

@@ -571,4 +575,4 @@

public logOpenSmartSnippetFeedbackModal() {
return this.makeOpenSmartSnippetFeedbackModal().log();
public async logOpenSmartSnippetFeedbackModal() {
return (await this.makeOpenSmartSnippetFeedbackModal()).log({searchUID: this.provider.getSearchUID()});
}

@@ -580,4 +584,4 @@

public logCloseSmartSnippetFeedbackModal() {
return this.makeCloseSmartSnippetFeedbackModal().log();
public async logCloseSmartSnippetFeedbackModal() {
return (await this.makeCloseSmartSnippetFeedbackModal()).log({searchUID: this.provider.getSearchUID()});
}

@@ -589,4 +593,6 @@

public logSmartSnippetFeedbackReason(reason: SmartSnippetFeedbackReason, details?: string) {
return this.makeSmartSnippetFeedbackReason(reason, details).log();
public async logSmartSnippetFeedbackReason(reason: SmartSnippetFeedbackReason, details?: string) {
return (await this.makeSmartSnippetFeedbackReason(reason, details)).log({
searchUID: this.provider.getSearchUID(),
});
}

@@ -601,4 +607,4 @@

public logExpandSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier) {
return this.makeExpandSmartSnippetSuggestion(snippet).log();
public async logExpandSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier) {
return (await this.makeExpandSmartSnippetSuggestion(snippet)).log({searchUID: this.provider.getSearchUID()});
}

@@ -613,4 +619,6 @@

public logCollapseSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier) {
return this.makeCollapseSmartSnippetSuggestion(snippet).log();
public async logCollapseSmartSnippetSuggestion(
snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier
) {
return (await this.makeCollapseSmartSnippetSuggestion(snippet)).log({searchUID: this.provider.getSearchUID()});
}

@@ -628,4 +636,4 @@

*/
public logShowMoreSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta) {
return this.makeShowMoreSmartSnippetSuggestion(snippet).log();
public async logShowMoreSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta) {
return (await this.makeShowMoreSmartSnippetSuggestion(snippet)).log({searchUID: this.provider.getSearchUID()});
}

@@ -643,4 +651,4 @@

*/
public logShowLessSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta) {
return this.makeShowLessSmartSnippetSuggestion(snippet).log();
public async logShowLessSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta) {
return (await this.makeShowLessSmartSnippetSuggestion(snippet)).log({searchUID: this.provider.getSearchUID()});
}

@@ -652,4 +660,4 @@

public logOpenSmartSnippetSource(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
return this.makeOpenSmartSnippetSource(info, identifier).log();
public async logOpenSmartSnippetSource(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
return (await this.makeOpenSmartSnippetSource(info, identifier)).log({searchUID: this.provider.getSearchUID()});
}

@@ -670,8 +678,13 @@

public logCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
return this.makeCopyToClipboard(info, identifier).log();
public async logCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
return (await this.makeCopyToClipboard(info, identifier)).log({searchUID: this.provider.getSearchUID()});
}
public logOpenSmartSnippetSuggestionSource(info: PartialDocumentInformation, snippet: SmartSnippetSuggestionMeta) {
return this.makeOpenSmartSnippetSuggestionSource(info, snippet).log();
public async logOpenSmartSnippetSuggestionSource(
info: PartialDocumentInformation,
snippet: SmartSnippetSuggestionMeta
) {
return (await this.makeOpenSmartSnippetSuggestionSource(info, snippet)).log({
searchUID: this.provider.getSearchUID(),
});
}

@@ -691,7 +704,9 @@

public logOpenSmartSnippetInlineLink(
public async logOpenSmartSnippetInlineLink(
info: PartialDocumentInformation,
identifierAndLink: DocumentIdentifier & SmartSnippetLinkMeta
) {
return this.makeOpenSmartSnippetInlineLink(info, identifierAndLink).log();
return (await this.makeOpenSmartSnippetInlineLink(info, identifierAndLink)).log({
searchUID: this.provider.getSearchUID(),
});
}

@@ -714,7 +729,9 @@

public logOpenSmartSnippetSuggestionInlineLink(
public async logOpenSmartSnippetSuggestionInlineLink(
info: PartialDocumentInformation,
snippetAndLink: SmartSnippetSuggestionMeta & SmartSnippetLinkMeta
) {
return this.makeOpenSmartSnippetSuggestionInlineLink(info, snippetAndLink).log();
return (await this.makeOpenSmartSnippetSuggestionInlineLink(info, snippetAndLink)).log({
searchUID: this.provider.getSearchUID(),
});
}

@@ -726,4 +743,4 @@

public logRecentQueryClick() {
return this.makeRecentQueryClick().log();
public async logRecentQueryClick() {
return (await this.makeRecentQueryClick()).log({searchUID: this.provider.getSearchUID()});
}

@@ -735,4 +752,4 @@

public logClearRecentQueries() {
return this.makeClearRecentQueries().log();
public async logClearRecentQueries() {
return (await this.makeClearRecentQueries()).log({searchUID: this.provider.getSearchUID()});
}

@@ -744,4 +761,4 @@

public logRecentResultClick(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
return this.makeRecentResultClick(info, identifier).log();
public async logRecentResultClick(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
return (await this.makeRecentResultClick(info, identifier)).log({searchUID: this.provider.getSearchUID()});
}

@@ -753,4 +770,4 @@

public logClearRecentResults() {
return this.makeClearRecentResults().log();
public async logClearRecentResults() {
return (await this.makeClearRecentResults()).log({searchUID: this.provider.getSearchUID()});
}

@@ -762,4 +779,4 @@

public logNoResultsBack() {
return this.makeNoResultsBack().log();
public async logNoResultsBack() {
return (await this.makeNoResultsBack()).log({searchUID: this.provider.getSearchUID()});
}

@@ -771,4 +788,4 @@

public logShowMoreFoldedResults(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
return this.makeShowMoreFoldedResults(info, identifier).log();
public async logShowMoreFoldedResults(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
return (await this.makeShowMoreFoldedResults(info, identifier)).log({searchUID: this.provider.getSearchUID()});
}

@@ -780,27 +797,33 @@

public logShowLessFoldedResults() {
return this.makeShowLessFoldedResults().log();
public async logShowLessFoldedResults() {
return (await this.makeShowLessFoldedResults()).log({searchUID: this.provider.getSearchUID()});
}
public makeCustomEvent(
private makeEventDescription(
preparedEvent: PreparedEvent<unknown, unknown, AnyEventResponse>,
actionCause: SearchPageEvents
): EventDescription {
return {actionCause, customData: preparedEvent.payload?.customData};
}
public async makeCustomEvent(
event: SearchPageEvents,
metadata?: Record<string, any>,
eventType: string = CustomEventsTypes[event]!
): EventBuilder<CustomEventResponse> {
): Promise<EventBuilder<CustomEventResponse>> {
this.coveoAnalyticsClient.getParameters;
const customData = {...this.provider.getBaseMetadata(), ...metadata};
const request: CustomEventRequest = {
...(await this.getBaseEventRequest(customData)),
eventType,
eventValue: event,
};
const preparedEvent = await this.coveoAnalyticsClient.makeCustomEvent(request);
return {
description: this.makeDescription(event, metadata),
log: async () => {
const payload: CustomEventRequest = {
...(await this.getBaseCustomEventRequest(customData)),
eventType,
eventValue: event,
};
return this.coveoAnalyticsClient.sendCustomEvent(payload);
},
description: this.makeEventDescription(preparedEvent, event),
log: ({searchUID}) => preparedEvent.log({lastSearchQueryUid: searchUID}),
};
}
public logCustomEvent(
public async logCustomEvent(
event: SearchPageEvents,

@@ -810,40 +833,46 @@ metadata?: Record<string, any>,

) {
return this.makeCustomEvent(event, metadata, eventType).log();
return (await this.makeCustomEvent(event, metadata, eventType)).log({searchUID: this.provider.getSearchUID()});
}
public makeCustomEventWithType(eventValue: string, eventType: string, metadata?: Record<string, any>) {
public async makeCustomEventWithType(
eventValue: string,
eventType: string,
metadata?: Record<string, any>
): Promise<EventBuilder<CustomEventResponse>> {
const customData = {...this.provider.getBaseMetadata(), ...metadata};
const payload: CustomEventRequest = {
...(await this.getBaseEventRequest(customData)),
eventType,
eventValue,
};
const preparedEvent = await this.coveoAnalyticsClient.makeCustomEvent(payload);
return {
description: <EventDescription>{actionCause: eventValue, customData},
log: async () => {
const payload: CustomEventRequest = {
...(await this.getBaseCustomEventRequest(customData)),
eventType,
eventValue,
};
return this.coveoAnalyticsClient.sendCustomEvent(payload);
},
description: this.makeEventDescription(preparedEvent, eventValue as SearchPageEvents),
log: ({searchUID}) => preparedEvent.log({lastSearchQueryUid: searchUID}),
};
}
public logCustomEventWithType(eventValue: string, eventType: string, metadata?: Record<string, any>) {
return this.makeCustomEventWithType(eventValue, eventType, metadata).log();
public async logCustomEventWithType(eventValue: string, eventType: string, metadata?: Record<string, any>) {
return (await this.makeCustomEventWithType(eventValue, eventType, metadata)).log({
searchUID: this.provider.getSearchUID(),
});
}
public async logSearchEvent(event: SearchPageEvents, metadata?: Record<string, any>) {
return this.coveoAnalyticsClient.sendSearchEvent(await this.getBaseSearchEventRequest(event, metadata));
return (await this.makeSearchEvent(event, metadata)).log({searchUID: this.provider.getSearchUID()});
}
private makeDescription(actionCause: SearchPageEvents, metadata?: Record<string, any>): EventDescription {
return {actionCause, customData: {...this.provider.getBaseMetadata(), ...metadata}};
}
public makeSearchEvent(event: SearchPageEvents, metadata?: Record<string, any>): EventBuilder<SearchEventResponse> {
public async makeSearchEvent(
event: SearchPageEvents,
metadata?: Record<string, any>
): Promise<EventBuilder<SearchEventResponse>> {
const request = await this.getBaseSearchEventRequest(event, metadata);
const preparedEvent = await this.coveoAnalyticsClient.makeSearchEvent(request);
return {
description: this.makeDescription(event, metadata),
log: () => this.logSearchEvent(event, metadata),
description: this.makeEventDescription(preparedEvent, event),
log: ({searchUID}) => preparedEvent.log({searchQueryUid: searchUID}),
};
}
public async logClickEvent(
public async makeClickEvent(
event: SearchPageEvents,

@@ -853,15 +882,17 @@ info: PartialDocumentInformation,

metadata?: Record<string, any>
) {
const payload: ClickEventRequest = {
): Promise<EventBuilder<ClickEventResponse>> {
const request: PreparedClickEventRequest = {
...info,
...(await this.getBaseEventRequest({...identifier, ...metadata})),
searchQueryUid: this.provider.getSearchUID(),
queryPipeline: this.provider.getPipeline(),
actionCause: event,
};
return this.coveoAnalyticsClient.sendClickEvent(payload);
const preparedEvent = await this.coveoAnalyticsClient.makeClickEvent(request);
return {
description: this.makeEventDescription(preparedEvent, event),
log: ({searchUID}) => preparedEvent.log({searchQueryUid: searchUID}),
};
}
public makeClickEvent(
public async logClickEvent(
event: SearchPageEvents,

@@ -871,7 +902,6 @@ info: PartialDocumentInformation,

metadata?: Record<string, any>
): EventBuilder<ClickEventResponse> {
return {
description: this.makeDescription(event, {...identifier, ...metadata}),
log: () => this.logClickEvent(event, info, identifier, metadata),
};
) {
return (await this.makeClickEvent(event, info, identifier, metadata)).log({
searchUID: this.provider.getSearchUID(),
});
}

@@ -882,7 +912,6 @@

metadata?: Record<string, any>
): Promise<SearchEventRequest> {
): Promise<PreparedSearchEventRequest> {
return {
...(await this.getBaseEventRequest(metadata)),
...this.provider.getSearchEventRequestPayload(),
searchQueryUid: this.provider.getSearchUID(),
queryPipeline: this.provider.getPipeline(),

@@ -893,9 +922,2 @@ actionCause: event,

private async getBaseCustomEventRequest(metadata?: Record<string, any>) {
return {
...(await this.getBaseEventRequest(metadata)),
lastSearchQueryUid: this.provider.getSearchUID(),
};
}
private async getBaseEventRequest(metadata?: Record<string, any>) {

@@ -902,0 +924,0 @@ const customData = {...this.provider.getBaseMetadata(), ...metadata};

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc