coveo.analytics 2.18.62 → 2.18.65
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/caseAssistActions.d.ts +3 -0
- package/dist/definitions/searchPage/searchPageClient.d.ts +1 -1
- package/dist/library.es.js +2 -1
- package/dist/library.js +2 -1
- package/package.json +1 -1
- package/src/caseAssist/caseAssistActions.ts +3 -0
- package/src/caseAssist/caseAssistClient.spec.ts +61 -24
- package/src/client/analytics.ts +2 -0
- package/src/searchPage/searchPageClient.ts +2 -2
|
@@ -58,6 +58,7 @@ export interface FieldSuggestion {
|
|
|
58
58
|
value: string;
|
|
59
59
|
confidence: number;
|
|
60
60
|
};
|
|
61
|
+
autoSelection?: boolean;
|
|
61
62
|
}
|
|
62
63
|
export interface DocumentSuggestion {
|
|
63
64
|
suggestionId: string;
|
|
@@ -69,4 +70,6 @@ export interface DocumentSuggestion {
|
|
|
69
70
|
documentUrl: string;
|
|
70
71
|
documentPosition: number;
|
|
71
72
|
};
|
|
73
|
+
fromQuickview?: boolean;
|
|
74
|
+
openDocument?: boolean;
|
|
72
75
|
}
|
|
@@ -6,7 +6,7 @@ export interface SearchPageClientProvider {
|
|
|
6
6
|
getSearchEventRequestPayload: () => Omit<SearchEventRequest, 'actionCause' | 'searchQueryUid'>;
|
|
7
7
|
getSearchUID: () => string;
|
|
8
8
|
getPipeline: () => string;
|
|
9
|
-
getOriginContext
|
|
9
|
+
getOriginContext?: () => string;
|
|
10
10
|
getOriginLevel1: () => string;
|
|
11
11
|
getOriginLevel2: () => string;
|
|
12
12
|
getOriginLevel3: () => string;
|
package/dist/library.es.js
CHANGED
|
@@ -1465,8 +1465,9 @@ class CoveoSearchPageClient {
|
|
|
1465
1465
|
});
|
|
1466
1466
|
}
|
|
1467
1467
|
getOrigins() {
|
|
1468
|
+
var _a, _b;
|
|
1468
1469
|
return {
|
|
1469
|
-
originContext: this.provider.getOriginContext(),
|
|
1470
|
+
originContext: (_b = (_a = this.provider).getOriginContext) === null || _b === void 0 ? void 0 : _b.call(_a),
|
|
1470
1471
|
originLevel1: this.provider.getOriginLevel1(),
|
|
1471
1472
|
originLevel2: this.provider.getOriginLevel2(),
|
|
1472
1473
|
originLevel3: this.provider.getOriginLevel3(),
|
package/dist/library.js
CHANGED
|
@@ -84160,8 +84160,9 @@ var CoveoSearchPageClient = (function () {
|
|
|
84160
84160
|
});
|
|
84161
84161
|
};
|
|
84162
84162
|
CoveoSearchPageClient.prototype.getOrigins = function () {
|
|
84163
|
+
var _a, _b;
|
|
84163
84164
|
return {
|
|
84164
|
-
originContext: this.provider.getOriginContext(),
|
|
84165
|
+
originContext: (_b = (_a = this.provider).getOriginContext) === null || _b === void 0 ? void 0 : _b.call(_a),
|
|
84165
84166
|
originLevel1: this.provider.getOriginLevel1(),
|
|
84166
84167
|
originLevel2: this.provider.getOriginLevel2(),
|
|
84167
84168
|
originLevel3: this.provider.getOriginLevel3(),
|
package/package.json
CHANGED
|
@@ -71,6 +71,7 @@ export interface FieldSuggestion {
|
|
|
71
71
|
value: string;
|
|
72
72
|
confidence: number;
|
|
73
73
|
};
|
|
74
|
+
autoSelection?: boolean;
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
export interface DocumentSuggestion {
|
|
@@ -83,4 +84,6 @@ export interface DocumentSuggestion {
|
|
|
83
84
|
documentUrl: string;
|
|
84
85
|
documentPosition: number;
|
|
85
86
|
};
|
|
87
|
+
fromQuickview?: boolean;
|
|
88
|
+
openDocument?: boolean;
|
|
86
89
|
}
|
|
@@ -50,26 +50,30 @@ describe('CaseAssistClient', () => {
|
|
|
50
50
|
},
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
const fakeFieldSuggestion: FieldSuggestion
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
const fakeFieldSuggestion = (): FieldSuggestion => {
|
|
54
|
+
return {
|
|
55
|
+
classification: {
|
|
56
|
+
value: 'some-field-value',
|
|
57
|
+
confidence: 0.5,
|
|
58
|
+
},
|
|
59
|
+
classificationId: 'field-suggestion-id',
|
|
60
|
+
fieldName: 'some-field',
|
|
61
|
+
responseId: 'field-suggestion-response-id',
|
|
62
|
+
};
|
|
61
63
|
};
|
|
62
64
|
|
|
63
|
-
const fakeDocumentSuggestion: DocumentSuggestion
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
65
|
+
const fakeDocumentSuggestion = (): DocumentSuggestion => {
|
|
66
|
+
return {
|
|
67
|
+
responseId: 'document-suggestion-response-id',
|
|
68
|
+
suggestionId: 'document-suggestion-id',
|
|
69
|
+
suggestion: {
|
|
70
|
+
documentPosition: 0,
|
|
71
|
+
documentTitle: 'the document title',
|
|
72
|
+
documentUri: 'some-document-uri',
|
|
73
|
+
documentUriHash: 'documenturihash',
|
|
74
|
+
documentUrl: 'some-document-url',
|
|
75
|
+
},
|
|
76
|
+
};
|
|
73
77
|
};
|
|
74
78
|
|
|
75
79
|
const expectMatchPayload = (actionName: CaseAssistActions, actionData: Object, ticket: TicketProperties) => {
|
|
@@ -181,20 +185,53 @@ describe('CaseAssistClient', () => {
|
|
|
181
185
|
|
|
182
186
|
it('should send proper payload for #logSelectFieldSuggestion', async () => {
|
|
183
187
|
await client.logSelectFieldSuggestion({
|
|
184
|
-
suggestion: fakeFieldSuggestion,
|
|
188
|
+
suggestion: fakeFieldSuggestion(),
|
|
185
189
|
ticket: fakeTicket,
|
|
186
190
|
});
|
|
187
191
|
|
|
188
|
-
expectMatchPayload(CaseAssistActions.fieldSuggestionClick, fakeFieldSuggestion, fakeTicket);
|
|
192
|
+
expectMatchPayload(CaseAssistActions.fieldSuggestionClick, fakeFieldSuggestion(), fakeTicket);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
it('should send proper payload for #logSelectFieldSuggestion when the autoSelection property is set to true', async () => {
|
|
196
|
+
const myFakeFieldSuggestion = fakeFieldSuggestion();
|
|
197
|
+
myFakeFieldSuggestion.autoSelection = true;
|
|
198
|
+
await client.logSelectFieldSuggestion({
|
|
199
|
+
suggestion: myFakeFieldSuggestion,
|
|
200
|
+
ticket: fakeTicket,
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
expectMatchPayload(CaseAssistActions.fieldSuggestionClick, myFakeFieldSuggestion, fakeTicket);
|
|
189
204
|
});
|
|
190
205
|
|
|
191
206
|
it('should send proper payload for #logSelectDocumentSuggestion', async () => {
|
|
192
207
|
await client.logSelectDocumentSuggestion({
|
|
193
|
-
suggestion: fakeDocumentSuggestion,
|
|
208
|
+
suggestion: fakeDocumentSuggestion(),
|
|
209
|
+
ticket: fakeTicket,
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
expectMatchPayload(CaseAssistActions.suggestionClick, fakeDocumentSuggestion(), fakeTicket);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it('should send proper payload for #logSelectDocumentSuggestion when the fromQuickview property is set to true', async () => {
|
|
216
|
+
const myFakeDocumentSuggestion = fakeDocumentSuggestion();
|
|
217
|
+
myFakeDocumentSuggestion.fromQuickview = true;
|
|
218
|
+
await client.logSelectDocumentSuggestion({
|
|
219
|
+
suggestion: myFakeDocumentSuggestion,
|
|
220
|
+
ticket: fakeTicket,
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
expectMatchPayload(CaseAssistActions.suggestionClick, myFakeDocumentSuggestion, fakeTicket);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
it('should send proper payload for #logSelectDocumentSuggestion when the openDocument property is set to true', async () => {
|
|
227
|
+
const myFakeDocumentSuggestion = fakeDocumentSuggestion();
|
|
228
|
+
myFakeDocumentSuggestion.openDocument = true;
|
|
229
|
+
await client.logSelectDocumentSuggestion({
|
|
230
|
+
suggestion: myFakeDocumentSuggestion,
|
|
194
231
|
ticket: fakeTicket,
|
|
195
232
|
});
|
|
196
233
|
|
|
197
|
-
expectMatchPayload(CaseAssistActions.suggestionClick,
|
|
234
|
+
expectMatchPayload(CaseAssistActions.suggestionClick, myFakeDocumentSuggestion, fakeTicket);
|
|
198
235
|
});
|
|
199
236
|
|
|
200
237
|
it('should send proper payload for #logRateDocumentSuggestion', async () => {
|
|
@@ -202,14 +239,14 @@ describe('CaseAssistClient', () => {
|
|
|
202
239
|
|
|
203
240
|
await client.logRateDocumentSuggestion({
|
|
204
241
|
rating,
|
|
205
|
-
suggestion: fakeDocumentSuggestion,
|
|
242
|
+
suggestion: fakeDocumentSuggestion(),
|
|
206
243
|
ticket: fakeTicket,
|
|
207
244
|
});
|
|
208
245
|
|
|
209
246
|
expectMatchPayload(
|
|
210
247
|
CaseAssistActions.suggestionRate,
|
|
211
248
|
{
|
|
212
|
-
...fakeDocumentSuggestion,
|
|
249
|
+
...fakeDocumentSuggestion(),
|
|
213
250
|
rate: rating,
|
|
214
251
|
},
|
|
215
252
|
fakeTicket
|
package/src/client/analytics.ts
CHANGED
|
@@ -320,6 +320,7 @@ export class CoveoAnalyticsClient implements AnalyticsClient, VisitorIdProvider
|
|
|
320
320
|
}
|
|
321
321
|
|
|
322
322
|
async getVisit(): Promise<VisitResponse> {
|
|
323
|
+
// deepcode ignore Ssrf: url is supplied by script owner
|
|
323
324
|
const response = await fetch(`${this.baseUrl}/analytics/visit`);
|
|
324
325
|
const visit = (await response.json()) as VisitResponse;
|
|
325
326
|
this.visitorId = visit.visitorId;
|
|
@@ -327,6 +328,7 @@ export class CoveoAnalyticsClient implements AnalyticsClient, VisitorIdProvider
|
|
|
327
328
|
}
|
|
328
329
|
|
|
329
330
|
async getHealth(): Promise<HealthResponse> {
|
|
331
|
+
// deepcode ignore Ssrf: url is supplied by script owner
|
|
330
332
|
const response = await fetch(`${this.baseUrl}/analytics/monitoring/health`);
|
|
331
333
|
return (await response.json()) as HealthResponse;
|
|
332
334
|
}
|
|
@@ -33,7 +33,7 @@ export interface SearchPageClientProvider {
|
|
|
33
33
|
getSearchEventRequestPayload: () => Omit<SearchEventRequest, 'actionCause' | 'searchQueryUid'>;
|
|
34
34
|
getSearchUID: () => string;
|
|
35
35
|
getPipeline: () => string;
|
|
36
|
-
getOriginContext
|
|
36
|
+
getOriginContext?: () => string;
|
|
37
37
|
getOriginLevel1: () => string;
|
|
38
38
|
getOriginLevel2: () => string;
|
|
39
39
|
getOriginLevel3: () => string;
|
|
@@ -384,7 +384,7 @@ export class CoveoSearchPageClient {
|
|
|
384
384
|
|
|
385
385
|
private getOrigins() {
|
|
386
386
|
return {
|
|
387
|
-
originContext: this.provider.getOriginContext(),
|
|
387
|
+
originContext: this.provider.getOriginContext?.(),
|
|
388
388
|
originLevel1: this.provider.getOriginLevel1(),
|
|
389
389
|
originLevel2: this.provider.getOriginLevel2(),
|
|
390
390
|
originLevel3: this.provider.getOriginLevel3(),
|