coveo.analytics 2.19.5 → 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/coveoua/headless.d.ts +1 -1
- package/dist/definitions/coveoua/library.d.ts +1 -1
- 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 +12 -3
- package/dist/library.js +12 -3
- package/package.json +1 -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
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { AnalyticsClient, ClientOptions } from '../client/analytics';
|
|
2
2
|
import { CaseCancelledMetadata, CaseCreatedMetadata, CaseSolvedMetadata, EnterInterfaceMetadata, MoveToNextCaseStepMetadata, RateDocumentSuggestionMetadata, SelectDocumentSuggestionMetadata, SelectFieldSuggestionMetadata, UpdateCaseFieldMetadata } from './caseAssistActions';
|
|
3
|
+
export interface CaseAssistClientProvider {
|
|
4
|
+
getOriginLevel1: () => string;
|
|
5
|
+
}
|
|
3
6
|
export interface CaseAssistClientOptions extends ClientOptions {
|
|
4
7
|
enableAnalytics?: boolean;
|
|
5
8
|
}
|
|
6
9
|
export declare class CaseAssistClient {
|
|
7
10
|
private options;
|
|
11
|
+
private provider?;
|
|
8
12
|
coveoAnalyticsClient: AnalyticsClient;
|
|
9
13
|
private svc;
|
|
10
|
-
constructor(options: Partial<CaseAssistClientOptions
|
|
14
|
+
constructor(options: Partial<CaseAssistClientOptions>, provider?: CaseAssistClientProvider | undefined);
|
|
11
15
|
disable(): void;
|
|
12
16
|
enable(): void;
|
|
13
17
|
logEnterInterface(meta: EnterInterfaceMetadata): Promise<void | import("../events").SearchEventResponse | import("../events").ClickEventResponse | import("../events").CustomEventResponse | import("../events").ViewEventResponse>;
|
|
@@ -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';
|
|
@@ -8,5 +8,5 @@ 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
|
export { analytics, donottrack, history, SimpleAnalytics, storage };
|
|
@@ -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';
|
|
@@ -8,5 +8,5 @@ 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
|
export { analytics, donottrack, history, SimpleAnalytics, storage };
|
package/dist/library.es.js
CHANGED
|
@@ -1654,9 +1654,10 @@ var CaseCancelledReasons;
|
|
|
1654
1654
|
})(CaseCancelledReasons || (CaseCancelledReasons = {}));
|
|
1655
1655
|
|
|
1656
1656
|
class CaseAssistClient {
|
|
1657
|
-
constructor(options) {
|
|
1657
|
+
constructor(options, provider) {
|
|
1658
1658
|
var _a;
|
|
1659
1659
|
this.options = options;
|
|
1660
|
+
this.provider = provider;
|
|
1660
1661
|
const analyticsEnabled = (_a = options.enableAnalytics) !== null && _a !== void 0 ? _a : true;
|
|
1661
1662
|
this.coveoAnalyticsClient = analyticsEnabled ? new CoveoAnalyticsClient(options) : new NoopAnalytics();
|
|
1662
1663
|
this.svc = new SVCPlugin({ client: this.coveoAnalyticsClient });
|
|
@@ -1724,10 +1725,18 @@ class CaseAssistClient {
|
|
|
1724
1725
|
return this.sendClickEvent();
|
|
1725
1726
|
}
|
|
1726
1727
|
sendFlowStartEvent() {
|
|
1727
|
-
return this.coveoAnalyticsClient.sendEvent('event', 'svc', CaseAssistEvents.flowStart
|
|
1728
|
+
return this.coveoAnalyticsClient.sendEvent('event', 'svc', CaseAssistEvents.flowStart, this.provider
|
|
1729
|
+
? {
|
|
1730
|
+
searchHub: this.provider.getOriginLevel1(),
|
|
1731
|
+
}
|
|
1732
|
+
: null);
|
|
1728
1733
|
}
|
|
1729
1734
|
sendClickEvent() {
|
|
1730
|
-
return this.coveoAnalyticsClient.sendEvent('event', 'svc', CaseAssistEvents.click
|
|
1735
|
+
return this.coveoAnalyticsClient.sendEvent('event', 'svc', CaseAssistEvents.click, this.provider
|
|
1736
|
+
? {
|
|
1737
|
+
searchHub: this.provider.getOriginLevel1(),
|
|
1738
|
+
}
|
|
1739
|
+
: null);
|
|
1731
1740
|
}
|
|
1732
1741
|
}
|
|
1733
1742
|
|
package/dist/library.js
CHANGED
|
@@ -84034,9 +84034,10 @@ var CaseCancelledReasons;
|
|
|
84034
84034
|
})(CaseCancelledReasons || (CaseCancelledReasons = {}));
|
|
84035
84035
|
|
|
84036
84036
|
var CaseAssistClient = (function () {
|
|
84037
|
-
function CaseAssistClient(options) {
|
|
84037
|
+
function CaseAssistClient(options, provider) {
|
|
84038
84038
|
var _a;
|
|
84039
84039
|
this.options = options;
|
|
84040
|
+
this.provider = provider;
|
|
84040
84041
|
var analyticsEnabled = (_a = options.enableAnalytics) !== null && _a !== void 0 ? _a : true;
|
|
84041
84042
|
this.coveoAnalyticsClient = analyticsEnabled ? new CoveoAnalyticsClient(options) : new NoopAnalytics();
|
|
84042
84043
|
this.svc = new SVCPlugin({ client: this.coveoAnalyticsClient });
|
|
@@ -84104,10 +84105,18 @@ var CaseAssistClient = (function () {
|
|
|
84104
84105
|
return this.sendClickEvent();
|
|
84105
84106
|
};
|
|
84106
84107
|
CaseAssistClient.prototype.sendFlowStartEvent = function () {
|
|
84107
|
-
return this.coveoAnalyticsClient.sendEvent('event', 'svc', CaseAssistEvents.flowStart
|
|
84108
|
+
return this.coveoAnalyticsClient.sendEvent('event', 'svc', CaseAssistEvents.flowStart, this.provider
|
|
84109
|
+
? {
|
|
84110
|
+
searchHub: this.provider.getOriginLevel1(),
|
|
84111
|
+
}
|
|
84112
|
+
: null);
|
|
84108
84113
|
};
|
|
84109
84114
|
CaseAssistClient.prototype.sendClickEvent = function () {
|
|
84110
|
-
return this.coveoAnalyticsClient.sendEvent('event', 'svc', CaseAssistEvents.click
|
|
84115
|
+
return this.coveoAnalyticsClient.sendEvent('event', 'svc', CaseAssistEvents.click, this.provider
|
|
84116
|
+
? {
|
|
84117
|
+
searchHub: this.provider.getOriginLevel1(),
|
|
84118
|
+
}
|
|
84119
|
+
: null);
|
|
84111
84120
|
};
|
|
84112
84121
|
return CaseAssistClient;
|
|
84113
84122
|
}());
|
package/package.json
CHANGED
|
@@ -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};
|