coveo.analytics 2.19.3 → 2.19.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coveoua.browser.js +1 -1
- package/dist/coveoua.browser.js.map +1 -1
- package/dist/coveoua.js +1 -1
- package/dist/coveoua.js.map +1 -1
- package/dist/definitions/caseAssist/caseAssistClient.d.ts +5 -1
- package/dist/definitions/client/measurementProtocolMapping/commerceMeasurementProtocolMapper.d.ts +2 -2
- package/dist/definitions/client/measurementProtocolMapping/serviceMeasurementProtocolMapper.d.ts +2 -1
- package/dist/definitions/coveoua/headless.d.ts +1 -1
- package/dist/definitions/coveoua/library.d.ts +1 -1
- package/dist/definitions/searchPage/searchPageClient.d.ts +1 -0
- package/dist/definitions/searchPage/searchPageEvents.d.ts +1 -0
- package/dist/definitions/src/coveoua/headless.d.ts +1 -1
- package/dist/definitions/src/coveoua/library.d.ts +1 -1
- package/dist/library.es.js +26 -13
- package/dist/library.js +298 -460
- package/dist/react-native.es.js +10 -10
- package/package.json +4 -1
- package/src/caseAssist/caseAssistClient.spec.ts +13 -4
- package/src/caseAssist/caseAssistClient.ts +25 -3
- package/src/coveoua/headless.ts +1 -1
- package/src/coveoua/library.ts +1 -1
- package/src/searchPage/searchPageClient.spec.ts +5 -0
- package/src/searchPage/searchPageClient.ts +4 -0
- package/src/searchPage/searchPageEvents.ts +4 -0
- package/dist/definitions/src/client/location.d.ts +0 -1
package/dist/react-native.es.js
CHANGED
|
@@ -2,18 +2,18 @@ import { fetch } from 'cross-fetch';
|
|
|
2
2
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
3
3
|
|
|
4
4
|
/*! *****************************************************************************
|
|
5
|
-
Copyright (c) Microsoft Corporation.
|
|
6
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
7
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
8
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
Copyright (c) Microsoft Corporation.
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
13
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
7
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
8
|
+
purpose with or without fee is hereby granted.
|
|
14
9
|
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
11
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
12
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
13
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
14
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
15
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
16
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
17
17
|
***************************************************************************** */
|
|
18
18
|
|
|
19
19
|
function __rest(s, e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coveo.analytics",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.6",
|
|
4
4
|
"description": "📈 Coveo analytics client (node and browser compatible) ",
|
|
5
5
|
"main": "dist/library.js",
|
|
6
6
|
"module": "dist/library.es.js",
|
|
@@ -57,6 +57,9 @@
|
|
|
57
57
|
"tsjs": "1.0.3",
|
|
58
58
|
"typescript": "^3.8.3"
|
|
59
59
|
},
|
|
60
|
+
"overrides": {
|
|
61
|
+
"plist": "3.0.5"
|
|
62
|
+
},
|
|
60
63
|
"files": [
|
|
61
64
|
"dist/**/*.d.ts",
|
|
62
65
|
"dist/**/*.js",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {CaseAssistClient} from './caseAssistClient';
|
|
1
|
+
import {CaseAssistClient, CaseAssistClientProvider} from './caseAssistClient';
|
|
2
2
|
import {
|
|
3
3
|
CaseAssistActions,
|
|
4
4
|
CaseAssistEvents,
|
|
@@ -13,8 +13,13 @@ import {TicketProperties} from '../plugins/svc';
|
|
|
13
13
|
const {fetchMock, fetchMockBeforeEach} = mockFetch();
|
|
14
14
|
|
|
15
15
|
describe('CaseAssistClient', () => {
|
|
16
|
+
const defaultSearchHub = 'origin-level-1';
|
|
16
17
|
let client: CaseAssistClient;
|
|
17
18
|
|
|
19
|
+
const provider: CaseAssistClientProvider = {
|
|
20
|
+
getOriginLevel1: () => defaultSearchHub,
|
|
21
|
+
};
|
|
22
|
+
|
|
18
23
|
beforeEach(() => {
|
|
19
24
|
fetchMockBeforeEach();
|
|
20
25
|
|
|
@@ -29,9 +34,12 @@ describe('CaseAssistClient', () => {
|
|
|
29
34
|
});
|
|
30
35
|
|
|
31
36
|
const initClient = () => {
|
|
32
|
-
return new CaseAssistClient(
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
return new CaseAssistClient(
|
|
38
|
+
{
|
|
39
|
+
enableAnalytics: true,
|
|
40
|
+
},
|
|
41
|
+
provider
|
|
42
|
+
);
|
|
35
43
|
};
|
|
36
44
|
|
|
37
45
|
const noTicket: Record<string, unknown> = undefined;
|
|
@@ -82,6 +90,7 @@ describe('CaseAssistClient', () => {
|
|
|
82
90
|
|
|
83
91
|
expectMatchActionPayload(content, actionName, actionData);
|
|
84
92
|
expectMatchTicketPayload(content, ticket);
|
|
93
|
+
expectMatchProperty(content, 'searchHub', defaultSearchHub);
|
|
85
94
|
};
|
|
86
95
|
|
|
87
96
|
const expectMatchActionPayload = (
|
|
@@ -16,6 +16,10 @@ import {
|
|
|
16
16
|
UpdateCaseFieldMetadata,
|
|
17
17
|
} from './caseAssistActions';
|
|
18
18
|
|
|
19
|
+
export interface CaseAssistClientProvider {
|
|
20
|
+
getOriginLevel1: () => string;
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
export interface CaseAssistClientOptions extends ClientOptions {
|
|
20
24
|
enableAnalytics?: boolean;
|
|
21
25
|
}
|
|
@@ -24,7 +28,7 @@ export class CaseAssistClient {
|
|
|
24
28
|
public coveoAnalyticsClient: AnalyticsClient;
|
|
25
29
|
private svc: SVCPlugin;
|
|
26
30
|
|
|
27
|
-
constructor(private options: Partial<CaseAssistClientOptions
|
|
31
|
+
constructor(private options: Partial<CaseAssistClientOptions>, private provider?: CaseAssistClientProvider) {
|
|
28
32
|
const analyticsEnabled = options.enableAnalytics ?? true;
|
|
29
33
|
|
|
30
34
|
this.coveoAnalyticsClient = analyticsEnabled ? new CoveoAnalyticsClient(options) : new NoopAnalytics();
|
|
@@ -108,10 +112,28 @@ export class CaseAssistClient {
|
|
|
108
112
|
}
|
|
109
113
|
|
|
110
114
|
private sendFlowStartEvent() {
|
|
111
|
-
return this.coveoAnalyticsClient.sendEvent(
|
|
115
|
+
return this.coveoAnalyticsClient.sendEvent(
|
|
116
|
+
'event',
|
|
117
|
+
'svc',
|
|
118
|
+
CaseAssistEvents.flowStart,
|
|
119
|
+
this.provider
|
|
120
|
+
? {
|
|
121
|
+
searchHub: this.provider.getOriginLevel1(),
|
|
122
|
+
}
|
|
123
|
+
: null
|
|
124
|
+
);
|
|
112
125
|
}
|
|
113
126
|
|
|
114
127
|
private sendClickEvent() {
|
|
115
|
-
return this.coveoAnalyticsClient.sendEvent(
|
|
128
|
+
return this.coveoAnalyticsClient.sendEvent(
|
|
129
|
+
'event',
|
|
130
|
+
'svc',
|
|
131
|
+
CaseAssistEvents.click,
|
|
132
|
+
this.provider
|
|
133
|
+
? {
|
|
134
|
+
searchHub: this.provider.getOriginLevel1(),
|
|
135
|
+
}
|
|
136
|
+
: null
|
|
137
|
+
);
|
|
116
138
|
}
|
|
117
139
|
}
|
package/src/coveoua/headless.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export {CoveoSearchPageClient, SearchPageClientProvider} from '../searchPage/searchPageClient';
|
|
2
|
-
export {CaseAssistClient} from '../caseAssist/caseAssistClient';
|
|
2
|
+
export {CaseAssistClient, CaseAssistClientProvider} from '../caseAssist/caseAssistClient';
|
|
3
3
|
export {CoveoAnalyticsClient, AnalyticsClientSendEventHook} from '../client/analytics';
|
|
4
4
|
export {PreprocessAnalyticsRequest} from '../client/analyticsRequestClient';
|
|
5
5
|
export * as history from '../history';
|
package/src/coveoua/library.ts
CHANGED
|
@@ -8,6 +8,6 @@ export {PreprocessAnalyticsRequest} from '../client/analyticsRequestClient';
|
|
|
8
8
|
export {IRuntimeEnvironment} from '../client/runtimeEnvironment';
|
|
9
9
|
export {CoveoUA, getCurrentClient, handleOneAnalyticsEvent} from './simpleanalytics';
|
|
10
10
|
export {CoveoSearchPageClient, SearchPageClientProvider} from '../searchPage/searchPageClient';
|
|
11
|
-
export {CaseAssistClient} from '../caseAssist/caseAssistClient';
|
|
11
|
+
export {CaseAssistClient, CaseAssistClientProvider} from '../caseAssist/caseAssistClient';
|
|
12
12
|
|
|
13
13
|
export {analytics, donottrack, history, SimpleAnalytics, storage};
|
|
@@ -527,6 +527,11 @@ describe('SearchPageClient', () => {
|
|
|
527
527
|
});
|
|
528
528
|
});
|
|
529
529
|
|
|
530
|
+
it('should send proper payload for #logOpenSmartSnippetSource', async () => {
|
|
531
|
+
await client.logOpenSmartSnippetSource(fakeDocInfo, fakeDocID);
|
|
532
|
+
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSource, fakeDocInfo, fakeDocID);
|
|
533
|
+
});
|
|
534
|
+
|
|
530
535
|
it('should send proper payload for #logRecentQueryClick', async () => {
|
|
531
536
|
await client.logRecentQueryClick();
|
|
532
537
|
expectMatchPayload(SearchPageEvents.recentQueryClick);
|
|
@@ -286,6 +286,10 @@ export class CoveoSearchPageClient {
|
|
|
286
286
|
return this.logCustomEvent(SearchPageEvents.collapseSmartSnippetSuggestion, {documentId});
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
+
public logOpenSmartSnippetSource(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
290
|
+
return this.logClickEvent(SearchPageEvents.openSmartSnippetSource, info, identifier);
|
|
291
|
+
}
|
|
292
|
+
|
|
289
293
|
public logRecentQueryClick() {
|
|
290
294
|
return this.logSearchEvent(SearchPageEvents.recentQueryClick);
|
|
291
295
|
}
|
|
@@ -213,6 +213,10 @@ export enum SearchPageEvents {
|
|
|
213
213
|
* Identifies the custom event that gets logged when a snippet suggestion for a related question is collapsed.
|
|
214
214
|
*/
|
|
215
215
|
collapseSmartSnippetSuggestion = 'collapseSmartSnippetSuggestion',
|
|
216
|
+
/**
|
|
217
|
+
* Identifies the custom event that gets logged when a user clicks on the source of an answer in a smart snippet.
|
|
218
|
+
*/
|
|
219
|
+
openSmartSnippetSource = 'openSmartSnippetSource',
|
|
216
220
|
/**
|
|
217
221
|
* Identifies the search event that gets logged when a recent queries list item gets clicked.
|
|
218
222
|
*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getFormattedLocation: (location: Location) => string;
|