coveo.analytics
Advanced tools
Comparing version 2.23.4 to 2.23.5
@@ -51,2 +51,4 @@ import { AnalyticsClient, ClientOptions } from '../client/analytics'; | ||
logDocumentOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier, metadata?: CaseMetadata): Promise<void | import("../events").ClickEventResponse>; | ||
logCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier, metadata?: CaseMetadata): Promise<void | import("../events").ClickEventResponse>; | ||
logDocumentQuickview(info: PartialDocumentInformation, identifier: DocumentIdentifier, caseMetadata?: CaseMetadata): Promise<void | import("../events").ClickEventResponse>; | ||
logCustomEvent(event: SearchPageEvents | InsightEvents, metadata?: Record<string, any>): Promise<void | import("../events").CustomEventResponse>; | ||
@@ -53,0 +55,0 @@ logSearchEvent(event: SearchPageEvents | InsightEvents, metadata?: Record<string, any>): Promise<void | import("../events").SearchEventResponse>; |
@@ -151,2 +151,4 @@ import { ClientOptions, AnalyticsClient } from '../client/analytics'; | ||
makeOpenSmartSnippetSuggestionSource(info: PartialDocumentInformation, snippet: SmartSnippetSuggestionMeta): EventBuilder<ClickEventResponse>; | ||
makeCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier): EventBuilder<ClickEventResponse>; | ||
logCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<void | ClickEventResponse>; | ||
logOpenSmartSnippetSuggestionSource(info: PartialDocumentInformation, snippet: SmartSnippetSuggestionMeta): Promise<void | ClickEventResponse>; | ||
@@ -153,0 +155,0 @@ makeOpenSmartSnippetInlineLink(info: PartialDocumentInformation, identifierAndLink: DocumentIdentifier & SmartSnippetLinkMeta): EventBuilder<ClickEventResponse>; |
@@ -70,3 +70,4 @@ import { DocumentInformation, FacetStateRequest } from '../events'; | ||
showMoreFoldedResults = "showMoreFoldedResults", | ||
showLessFoldedResults = "showLessFoldedResults" | ||
showLessFoldedResults = "showLessFoldedResults", | ||
copyToClipboard = "copyToClipboard" | ||
} | ||
@@ -73,0 +74,0 @@ export declare const CustomEventsTypes: Partial<Record<SearchPageEvents | InsightEvents, string>>; |
{ | ||
"name": "coveo.analytics", | ||
"version": "2.23.4", | ||
"version": "2.23.5", | ||
"description": "📈 Coveo analytics client (node and browser compatible) ", | ||
@@ -5,0 +5,0 @@ "main": "dist/library.js", |
@@ -321,2 +321,17 @@ import {mockFetch} from '../../tests/fetchMock'; | ||
}); | ||
it('should send proper payload for #copyToClipboard', async () => { | ||
await client.logCopyToClipboard(fakeDocInfo, fakeDocID); | ||
expectMatchDocumentPayload(SearchPageEvents.copyToClipboard, fakeDocInfo, fakeDocID); | ||
}); | ||
it('should send proper payload for #documentQuickview', async () => { | ||
const expectedMetadata = { | ||
...fakeDocID, | ||
documentTitle: fakeDocInfo.documentTitle, | ||
documentURL: fakeDocInfo.documentUrl, | ||
}; | ||
await client.logDocumentQuickview(fakeDocInfo, fakeDocID); | ||
expectMatchDocumentPayload(SearchPageEvents.documentQuickview, fakeDocInfo, expectedMetadata); | ||
}); | ||
}); | ||
@@ -679,2 +694,26 @@ | ||
}); | ||
it('should send proper payload for #copyToClipboard', async () => { | ||
const metadata = baseCaseMetadata; | ||
const expectedMetadata = { | ||
...fakeDocID, | ||
...expectedBaseCaseMetadata, | ||
}; | ||
await client.logCopyToClipboard(fakeDocInfo, fakeDocID, metadata); | ||
expectMatchDocumentPayload(SearchPageEvents.copyToClipboard, fakeDocInfo, expectedMetadata); | ||
}); | ||
it('should send proper payload for #documentQuickview', async () => { | ||
const metadata = baseCaseMetadata; | ||
const expectedMetadata = { | ||
...fakeDocID, | ||
...expectedBaseCaseMetadata, | ||
documentTitle: fakeDocInfo.documentTitle, | ||
documentURL: fakeDocInfo.documentUrl, | ||
}; | ||
await client.logDocumentQuickview(fakeDocInfo, fakeDocID, metadata); | ||
expectMatchDocumentPayload(SearchPageEvents.documentQuickview, fakeDocInfo, expectedMetadata); | ||
}); | ||
}); | ||
@@ -681,0 +720,0 @@ |
@@ -224,8 +224,39 @@ import CoveoAnalyticsClient, {AnalyticsClient, ClientOptions} from '../client/analytics'; | ||
return this.logClickEvent( | ||
SearchPageEvents.documentOpen, | ||
info, | ||
identifier, | ||
metadata ? generateMetadataToSend(metadata, false) : undefined); | ||
SearchPageEvents.documentOpen, | ||
info, | ||
identifier, | ||
metadata ? generateMetadataToSend(metadata, false) : undefined | ||
); | ||
} | ||
public logCopyToClipboard( | ||
info: PartialDocumentInformation, | ||
identifier: DocumentIdentifier, | ||
metadata?: CaseMetadata | ||
) { | ||
return this.logClickEvent( | ||
SearchPageEvents.copyToClipboard, | ||
info, | ||
identifier, | ||
metadata ? generateMetadataToSend(metadata, false) : undefined | ||
); | ||
} | ||
public logDocumentQuickview( | ||
info: PartialDocumentInformation, | ||
identifier: DocumentIdentifier, | ||
caseMetadata?: CaseMetadata | ||
) { | ||
const metadata = { | ||
documentTitle: info.documentTitle, | ||
documentURL: info.documentUrl, | ||
}; | ||
return this.logClickEvent( | ||
SearchPageEvents.documentQuickview, | ||
info, | ||
identifier, | ||
caseMetadata ? {...generateMetadataToSend(caseMetadata, false), ...metadata} : metadata | ||
); | ||
} | ||
public async logCustomEvent(event: SearchPageEvents | InsightEvents, metadata?: Record<string, any>) { | ||
@@ -232,0 +263,0 @@ const customData = {...this.provider.getBaseMetadata(), ...metadata}; |
@@ -1177,2 +1177,7 @@ import {CoveoSearchPageClient, EventDescription, SearchPageClientProvider} from './searchPageClient'; | ||
it('should send proper payload for #logCopyToClipboard', async () => { | ||
await client.logCopyToClipboard(fakeDocInfo, fakeDocID); | ||
expectMatchDocumentPayload(SearchPageEvents.copyToClipboard, fakeDocInfo, fakeDocID); | ||
}); | ||
it('should send proper payload for #makeOpenSmartSnippetSource', async () => { | ||
@@ -1179,0 +1184,0 @@ const built = client.makeOpenSmartSnippetSource(fakeDocInfo, fakeDocID); |
@@ -606,2 +606,10 @@ import CoveoAnalyticsClient, {ClientOptions, AnalyticsClient} from '../client/analytics'; | ||
public makeCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier) { | ||
return this.makeClickEvent(SearchPageEvents.copyToClipboard, info, identifier); | ||
} | ||
public logCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier) { | ||
return this.makeCopyToClipboard(info, identifier).log(); | ||
} | ||
public logOpenSmartSnippetSuggestionSource(info: PartialDocumentInformation, snippet: SmartSnippetSuggestionMeta) { | ||
@@ -608,0 +616,0 @@ return this.makeOpenSmartSnippetSuggestionSource(info, snippet).log(); |
@@ -277,2 +277,6 @@ import {DocumentInformation, FacetStateRequest} from '../events'; | ||
showLessFoldedResults = 'showLessFoldedResults', | ||
/** | ||
* Identifies the click event that gets logged when a user clicks the Copy To Clipboard result action. | ||
*/ | ||
copyToClipboard = 'copyToClipboard', | ||
} | ||
@@ -279,0 +283,0 @@ |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1976825
98228