coveo.analytics 2.20.24 → 2.20.26
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/coveoua/library.d.ts +1 -1
- package/dist/definitions/insight/insightClient.d.ts +24 -24
- package/dist/definitions/insight/insightEvents.d.ts +25 -7
- package/dist/definitions/searchPage/searchPageClient.d.ts +154 -73
- package/dist/definitions/src/coveoua/library.d.ts +1 -1
- package/dist/library.es.js +432 -150
- package/dist/library.js +477 -186
- package/package.json +1 -1
- package/src/coveoua/library.ts +6 -1
- package/src/insight/insightClient.spec.ts +495 -151
- package/src/insight/insightClient.ts +131 -91
- package/src/insight/insightEvents.ts +37 -6
- package/src/searchPage/searchPageClient.spec.ts +650 -5
- package/src/searchPage/searchPageClient.ts +460 -97
|
@@ -4,7 +4,19 @@ import {NoopAnalytics} from '../client/noopAnalytics';
|
|
|
4
4
|
import {CustomEventsTypes, SearchPageEvents, StaticFilterToggleValueMetadata} from '../searchPage/searchPageEvents';
|
|
5
5
|
import {CoveoInsightClient, InsightClientProvider} from './insightClient';
|
|
6
6
|
import doNotTrack from '../donottrack';
|
|
7
|
-
import {InsightEvents} from './insightEvents';
|
|
7
|
+
import {InsightEvents, InsightStaticFilterToggleValueMetadata} from './insightEvents';
|
|
8
|
+
|
|
9
|
+
const baseCaseMetadata = {
|
|
10
|
+
caseId: '1234',
|
|
11
|
+
caseNumber: '5678',
|
|
12
|
+
caseContext: {Case_Subject: 'test subject', Case_Description: 'test description'},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const expectedBaseCaseMetadata = {
|
|
16
|
+
CaseId: '1234',
|
|
17
|
+
CaseNumber: '5678',
|
|
18
|
+
CaseSubject: 'test subject',
|
|
19
|
+
};
|
|
8
20
|
|
|
9
21
|
jest.mock('../donottrack', () => {
|
|
10
22
|
return {
|
|
@@ -103,182 +115,514 @@ describe('InsightClient', () => {
|
|
|
103
115
|
fetchMock.reset();
|
|
104
116
|
});
|
|
105
117
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
118
|
+
describe('when the case metadata is not included', () => {
|
|
119
|
+
it('should send proper payload for #interfaceLoad', async () => {
|
|
120
|
+
await client.logInterfaceLoad();
|
|
121
|
+
expectMatchPayload(SearchPageEvents.interfaceLoad);
|
|
122
|
+
});
|
|
110
123
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
124
|
+
it('should send proper payload for #interfaceChange', async () => {
|
|
125
|
+
await client.logInterfaceChange({
|
|
126
|
+
interfaceChangeTo: 'bob',
|
|
127
|
+
});
|
|
128
|
+
expectMatchPayload(SearchPageEvents.interfaceChange, {interfaceChangeTo: 'bob'});
|
|
114
129
|
});
|
|
115
|
-
expectMatchPayload(SearchPageEvents.interfaceChange, {interfaceChangeTo: 'bob'});
|
|
116
|
-
});
|
|
117
130
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
131
|
+
it('should send proper payload for #fetchMoreResults', async () => {
|
|
132
|
+
await client.logFetchMoreResults();
|
|
133
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerScrolling, {type: 'getMoreResults'});
|
|
134
|
+
});
|
|
122
135
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
136
|
+
it('should send proper payload for #staticFilterDeselect', async () => {
|
|
137
|
+
const meta: StaticFilterToggleValueMetadata = {
|
|
138
|
+
staticFilterId: 'filetypes',
|
|
139
|
+
staticFilterValue: {
|
|
140
|
+
caption: 'Youtube',
|
|
141
|
+
expression: '@filetype="youtubevideo"',
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
await client.logStaticFilterDeselect(meta);
|
|
145
|
+
|
|
146
|
+
expectMatchPayload(SearchPageEvents.staticFilterDeselect, meta);
|
|
147
|
+
});
|
|
132
148
|
|
|
133
|
-
|
|
134
|
-
|
|
149
|
+
it('should send proper payload for #breadcrumbResetAll', async () => {
|
|
150
|
+
await client.logBreadcrumbResetAll();
|
|
151
|
+
expectMatchPayload(SearchPageEvents.breadcrumbResetAll);
|
|
152
|
+
});
|
|
135
153
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
154
|
+
it('should send proper payload for #breadcrumbFacet', async () => {
|
|
155
|
+
const meta = {
|
|
156
|
+
facetField: '@foo',
|
|
157
|
+
facetId: 'bar',
|
|
158
|
+
facetTitle: 'title',
|
|
159
|
+
facetValue: 'qwerty',
|
|
160
|
+
};
|
|
161
|
+
await client.logBreadcrumbFacet(meta);
|
|
162
|
+
expectMatchPayload(SearchPageEvents.breadcrumbFacet, meta);
|
|
163
|
+
});
|
|
140
164
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
await client.logBreadcrumbFacet(meta);
|
|
149
|
-
expectMatchPayload(SearchPageEvents.breadcrumbFacet, meta);
|
|
150
|
-
});
|
|
165
|
+
it('should send proper payload for #logFacetSelect', async () => {
|
|
166
|
+
const meta = {
|
|
167
|
+
facetField: '@foo',
|
|
168
|
+
facetId: 'bar',
|
|
169
|
+
facetTitle: 'title',
|
|
170
|
+
facetValue: 'qwerty',
|
|
171
|
+
};
|
|
151
172
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
});
|
|
173
|
+
await client.logFacetSelect(meta);
|
|
174
|
+
expectMatchPayload(SearchPageEvents.facetSelect, meta);
|
|
175
|
+
});
|
|
156
176
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
await client.logBreadcrumbFacet(meta);
|
|
165
|
-
expectMatchPayload(SearchPageEvents.breadcrumbFacet, meta);
|
|
166
|
-
});
|
|
177
|
+
it('should send proper payload for #logFacetDeselect', async () => {
|
|
178
|
+
const meta = {
|
|
179
|
+
facetField: '@foo',
|
|
180
|
+
facetId: 'bar',
|
|
181
|
+
facetTitle: 'title',
|
|
182
|
+
facetValue: 'qwerty',
|
|
183
|
+
};
|
|
167
184
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
facetId: 'bar',
|
|
172
|
-
facetTitle: 'title',
|
|
173
|
-
facetValue: 'qwerty',
|
|
174
|
-
};
|
|
185
|
+
await client.logFacetDeselect(meta);
|
|
186
|
+
expectMatchPayload(SearchPageEvents.facetDeselect, meta);
|
|
187
|
+
});
|
|
175
188
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
189
|
+
it('should send proper payload for #logFacetUpdateSort', async () => {
|
|
190
|
+
const meta = {
|
|
191
|
+
facetField: '@foo',
|
|
192
|
+
facetId: 'bar',
|
|
193
|
+
facetTitle: 'title',
|
|
194
|
+
criteria: 'bazz',
|
|
195
|
+
};
|
|
196
|
+
await client.logFacetUpdateSort(meta);
|
|
197
|
+
expectMatchPayload(SearchPageEvents.facetUpdateSort, meta);
|
|
198
|
+
});
|
|
179
199
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
200
|
+
it('should send proper payload for #logFacetClearAll', async () => {
|
|
201
|
+
const meta = {
|
|
202
|
+
facetField: '@foo',
|
|
203
|
+
facetId: 'bar',
|
|
204
|
+
facetTitle: 'title',
|
|
205
|
+
};
|
|
206
|
+
await client.logFacetClearAll(meta);
|
|
207
|
+
expectMatchPayload(SearchPageEvents.facetClearAll, meta);
|
|
208
|
+
});
|
|
187
209
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
210
|
+
it('should send proper payload for #logFacetShowMore', async () => {
|
|
211
|
+
const meta = {
|
|
212
|
+
facetField: '@foo',
|
|
213
|
+
facetId: 'bar',
|
|
214
|
+
facetTitle: 'title',
|
|
215
|
+
};
|
|
216
|
+
await client.logFacetShowMore(meta);
|
|
217
|
+
expectMatchCustomEventPayload(SearchPageEvents.facetShowMore, meta);
|
|
218
|
+
});
|
|
191
219
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
});
|
|
220
|
+
it('should send proper payload for #logFacetShowLess', async () => {
|
|
221
|
+
const meta = {
|
|
222
|
+
facetField: '@foo',
|
|
223
|
+
facetId: 'bar',
|
|
224
|
+
facetTitle: 'title',
|
|
225
|
+
};
|
|
226
|
+
await client.logFacetShowLess(meta);
|
|
227
|
+
expectMatchCustomEventPayload(SearchPageEvents.facetShowLess, meta);
|
|
228
|
+
});
|
|
202
229
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
230
|
+
it('should send proper payload for #logQueryError', async () => {
|
|
231
|
+
const meta = {
|
|
232
|
+
query: 'q',
|
|
233
|
+
aq: 'aq',
|
|
234
|
+
cq: 'cq',
|
|
235
|
+
dq: 'dq',
|
|
236
|
+
errorMessage: 'boom',
|
|
237
|
+
errorType: 'a bad one',
|
|
238
|
+
};
|
|
239
|
+
await client.logQueryError(meta);
|
|
240
|
+
expectMatchCustomEventPayload(SearchPageEvents.queryError, meta);
|
|
241
|
+
});
|
|
212
242
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
};
|
|
219
|
-
await client.logFacetShowMore(meta);
|
|
220
|
-
expectMatchCustomEventPayload(SearchPageEvents.facetShowMore, meta);
|
|
221
|
-
});
|
|
243
|
+
it('should send proper payload for #logPagerNumber', async () => {
|
|
244
|
+
const meta = {pagerNumber: 123};
|
|
245
|
+
await client.logPagerNumber(meta);
|
|
246
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerNumber, meta);
|
|
247
|
+
});
|
|
222
248
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
};
|
|
229
|
-
await client.logFacetShowLess(meta);
|
|
230
|
-
expectMatchCustomEventPayload(SearchPageEvents.facetShowLess, meta);
|
|
231
|
-
});
|
|
249
|
+
it('should send proper payload for #logPagerNext', async () => {
|
|
250
|
+
const meta = {pagerNumber: 123};
|
|
251
|
+
await client.logPagerNext(meta);
|
|
252
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerNext, meta);
|
|
253
|
+
});
|
|
232
254
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
dq: 'dq',
|
|
239
|
-
errorMessage: 'boom',
|
|
240
|
-
errorType: 'a bad one',
|
|
241
|
-
};
|
|
242
|
-
await client.logQueryError(meta);
|
|
243
|
-
expectMatchCustomEventPayload(SearchPageEvents.queryError, meta);
|
|
244
|
-
});
|
|
255
|
+
it('should send proper payload for #logPagerPrevious', async () => {
|
|
256
|
+
const meta = {pagerNumber: 123};
|
|
257
|
+
await client.logPagerPrevious(meta);
|
|
258
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerPrevious, meta);
|
|
259
|
+
});
|
|
245
260
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
});
|
|
261
|
+
it('should send proper payload for #didyoumeanAutomatic', async () => {
|
|
262
|
+
await client.logDidYouMeanAutomatic();
|
|
263
|
+
expectMatchPayload(SearchPageEvents.didyoumeanAutomatic);
|
|
264
|
+
});
|
|
251
265
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
});
|
|
266
|
+
it('should send proper payload for #didyoumeanClick', async () => {
|
|
267
|
+
await client.logDidYouMeanClick();
|
|
268
|
+
expectMatchPayload(SearchPageEvents.didyoumeanClick);
|
|
269
|
+
});
|
|
257
270
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
});
|
|
271
|
+
it('should send proper payload for #resultsSort', async () => {
|
|
272
|
+
await client.logResultsSort({resultsSortBy: 'date ascending'});
|
|
273
|
+
expectMatchPayload(SearchPageEvents.resultsSort, {resultsSortBy: 'date ascending'});
|
|
274
|
+
});
|
|
263
275
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
276
|
+
it('should send proper payload for #searchboxSubmit', async () => {
|
|
277
|
+
await client.logSearchboxSubmit();
|
|
278
|
+
expectMatchPayload(SearchPageEvents.searchboxSubmit);
|
|
279
|
+
});
|
|
267
280
|
});
|
|
268
281
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
});
|
|
282
|
+
describe('when the case metadata is included', () => {
|
|
283
|
+
it('should send proper payload for #interfaceLoad', async () => {
|
|
284
|
+
const metadata = baseCaseMetadata;
|
|
273
285
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
286
|
+
const expectedMetadata = {
|
|
287
|
+
...expectedBaseCaseMetadata,
|
|
288
|
+
context_Case_Subject: 'test subject',
|
|
289
|
+
context_Case_Description: 'test description',
|
|
290
|
+
};
|
|
291
|
+
await client.logInterfaceLoad(metadata);
|
|
292
|
+
expectMatchPayload(SearchPageEvents.interfaceLoad, expectedMetadata);
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
it('should send proper payload for #interfaceChange', async () => {
|
|
296
|
+
const metadata = {
|
|
297
|
+
...baseCaseMetadata,
|
|
298
|
+
interfaceChangeTo: 'bob',
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
const expectedMetadata = {
|
|
302
|
+
...expectedBaseCaseMetadata,
|
|
303
|
+
context_Case_Subject: 'test subject',
|
|
304
|
+
context_Case_Description: 'test description',
|
|
305
|
+
interfaceChangeTo: 'bob',
|
|
306
|
+
};
|
|
307
|
+
await client.logInterfaceChange(metadata);
|
|
308
|
+
expectMatchPayload(SearchPageEvents.interfaceChange, expectedMetadata);
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
it('should send proper payload for #fetchMoreResults', async () => {
|
|
312
|
+
const metadata = {
|
|
313
|
+
...baseCaseMetadata,
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
const expectedMetadata = {
|
|
317
|
+
...expectedBaseCaseMetadata,
|
|
318
|
+
context_Case_Subject: 'test subject',
|
|
319
|
+
context_Case_Description: 'test description',
|
|
320
|
+
type: 'getMoreResults',
|
|
321
|
+
};
|
|
322
|
+
await client.logFetchMoreResults(metadata);
|
|
323
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerScrolling, expectedMetadata);
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
it('should send proper payload for #staticFilterDeselect', async () => {
|
|
327
|
+
const metadata: InsightStaticFilterToggleValueMetadata = {
|
|
328
|
+
...baseCaseMetadata,
|
|
329
|
+
staticFilterId: 'filetypes',
|
|
330
|
+
staticFilterValue: {
|
|
331
|
+
caption: 'Youtube',
|
|
332
|
+
expression: '@filetype="youtubevideo"',
|
|
333
|
+
},
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const expectedMetadata = {
|
|
337
|
+
...expectedBaseCaseMetadata,
|
|
338
|
+
context_Case_Subject: 'test subject',
|
|
339
|
+
context_Case_Description: 'test description',
|
|
340
|
+
staticFilterId: 'filetypes',
|
|
341
|
+
staticFilterValue: {
|
|
342
|
+
caption: 'Youtube',
|
|
343
|
+
expression: '@filetype="youtubevideo"',
|
|
344
|
+
},
|
|
345
|
+
};
|
|
346
|
+
await client.logStaticFilterDeselect(metadata);
|
|
347
|
+
|
|
348
|
+
expectMatchPayload(SearchPageEvents.staticFilterDeselect, expectedMetadata);
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
it('should send proper payload for #breadcrumbResetAll', async () => {
|
|
352
|
+
const metadata = baseCaseMetadata;
|
|
278
353
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
354
|
+
const expectedMetadata = {
|
|
355
|
+
...expectedBaseCaseMetadata,
|
|
356
|
+
context_Case_Subject: 'test subject',
|
|
357
|
+
context_Case_Description: 'test description',
|
|
358
|
+
};
|
|
359
|
+
await client.logBreadcrumbResetAll(metadata);
|
|
360
|
+
expectMatchPayload(SearchPageEvents.breadcrumbResetAll, expectedMetadata);
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
it('should send proper payload for #breadcrumbFacet', async () => {
|
|
364
|
+
const metadata = {
|
|
365
|
+
...baseCaseMetadata,
|
|
366
|
+
facetField: '@foo',
|
|
367
|
+
facetId: 'bar',
|
|
368
|
+
facetTitle: 'title',
|
|
369
|
+
facetValue: 'qwerty',
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
const expectedMetadata = {
|
|
373
|
+
...expectedBaseCaseMetadata,
|
|
374
|
+
context_Case_Subject: 'test subject',
|
|
375
|
+
context_Case_Description: 'test description',
|
|
376
|
+
facetField: '@foo',
|
|
377
|
+
facetId: 'bar',
|
|
378
|
+
facetTitle: 'title',
|
|
379
|
+
facetValue: 'qwerty',
|
|
380
|
+
};
|
|
381
|
+
await client.logBreadcrumbFacet(metadata);
|
|
382
|
+
expectMatchPayload(SearchPageEvents.breadcrumbFacet, expectedMetadata);
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
it('should send proper payload for #logFacetSelect', async () => {
|
|
386
|
+
const metadata = {
|
|
387
|
+
...baseCaseMetadata,
|
|
388
|
+
facetField: '@foo',
|
|
389
|
+
facetId: 'bar',
|
|
390
|
+
facetTitle: 'title',
|
|
391
|
+
facetValue: 'qwerty',
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
const expectedMetadata = {
|
|
395
|
+
...expectedBaseCaseMetadata,
|
|
396
|
+
context_Case_Subject: 'test subject',
|
|
397
|
+
context_Case_Description: 'test description',
|
|
398
|
+
facetField: '@foo',
|
|
399
|
+
facetId: 'bar',
|
|
400
|
+
facetTitle: 'title',
|
|
401
|
+
facetValue: 'qwerty',
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
await client.logFacetSelect(metadata);
|
|
405
|
+
expectMatchPayload(SearchPageEvents.facetSelect, expectedMetadata);
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
it('should send proper payload for #logFacetDeselect', async () => {
|
|
409
|
+
const metadata = {
|
|
410
|
+
...baseCaseMetadata,
|
|
411
|
+
facetField: '@foo',
|
|
412
|
+
facetId: 'bar',
|
|
413
|
+
facetTitle: 'title',
|
|
414
|
+
facetValue: 'qwerty',
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
const expectedMetadata = {
|
|
418
|
+
...expectedBaseCaseMetadata,
|
|
419
|
+
context_Case_Subject: 'test subject',
|
|
420
|
+
context_Case_Description: 'test description',
|
|
421
|
+
facetField: '@foo',
|
|
422
|
+
facetId: 'bar',
|
|
423
|
+
facetTitle: 'title',
|
|
424
|
+
facetValue: 'qwerty',
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
await client.logFacetDeselect(metadata);
|
|
428
|
+
expectMatchPayload(SearchPageEvents.facetDeselect, expectedMetadata);
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
it('should send proper payload for #logFacetUpdateSort', async () => {
|
|
432
|
+
const metadata = {
|
|
433
|
+
...baseCaseMetadata,
|
|
434
|
+
facetField: '@foo',
|
|
435
|
+
facetId: 'bar',
|
|
436
|
+
facetTitle: 'title',
|
|
437
|
+
criteria: 'bazz',
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
const expectedMetadata = {
|
|
441
|
+
...expectedBaseCaseMetadata,
|
|
442
|
+
context_Case_Subject: 'test subject',
|
|
443
|
+
context_Case_Description: 'test description',
|
|
444
|
+
facetField: '@foo',
|
|
445
|
+
facetId: 'bar',
|
|
446
|
+
facetTitle: 'title',
|
|
447
|
+
criteria: 'bazz',
|
|
448
|
+
};
|
|
449
|
+
await client.logFacetUpdateSort(metadata);
|
|
450
|
+
expectMatchPayload(SearchPageEvents.facetUpdateSort, expectedMetadata);
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
it('should send proper payload for #logFacetClearAll', async () => {
|
|
454
|
+
const metadata = {
|
|
455
|
+
...baseCaseMetadata,
|
|
456
|
+
facetField: '@foo',
|
|
457
|
+
facetId: 'bar',
|
|
458
|
+
facetTitle: 'title',
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
const expectedMetadata = {
|
|
462
|
+
...expectedBaseCaseMetadata,
|
|
463
|
+
context_Case_Subject: 'test subject',
|
|
464
|
+
context_Case_Description: 'test description',
|
|
465
|
+
facetField: '@foo',
|
|
466
|
+
facetId: 'bar',
|
|
467
|
+
facetTitle: 'title',
|
|
468
|
+
};
|
|
469
|
+
await client.logFacetClearAll(metadata);
|
|
470
|
+
expectMatchPayload(SearchPageEvents.facetClearAll, expectedMetadata);
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
it('should send proper payload for #logFacetShowMore', async () => {
|
|
474
|
+
const metadata = {
|
|
475
|
+
...baseCaseMetadata,
|
|
476
|
+
facetField: '@foo',
|
|
477
|
+
facetId: 'bar',
|
|
478
|
+
facetTitle: 'title',
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
const expectedMetadata = {
|
|
482
|
+
...expectedBaseCaseMetadata,
|
|
483
|
+
facetField: '@foo',
|
|
484
|
+
facetId: 'bar',
|
|
485
|
+
facetTitle: 'title',
|
|
486
|
+
};
|
|
487
|
+
await client.logFacetShowMore(metadata);
|
|
488
|
+
expectMatchCustomEventPayload(SearchPageEvents.facetShowMore, expectedMetadata);
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
it('should send proper payload for #logFacetShowLess', async () => {
|
|
492
|
+
const metadata = {
|
|
493
|
+
...baseCaseMetadata,
|
|
494
|
+
facetField: '@foo',
|
|
495
|
+
facetId: 'bar',
|
|
496
|
+
facetTitle: 'title',
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
const expectedMetadata = {
|
|
500
|
+
...expectedBaseCaseMetadata,
|
|
501
|
+
facetField: '@foo',
|
|
502
|
+
facetId: 'bar',
|
|
503
|
+
facetTitle: 'title',
|
|
504
|
+
};
|
|
505
|
+
await client.logFacetShowLess(metadata);
|
|
506
|
+
expectMatchCustomEventPayload(SearchPageEvents.facetShowLess, expectedMetadata);
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
it('should send proper payload for #logQueryError', async () => {
|
|
510
|
+
const metadata = {
|
|
511
|
+
...baseCaseMetadata,
|
|
512
|
+
query: 'q',
|
|
513
|
+
aq: 'aq',
|
|
514
|
+
cq: 'cq',
|
|
515
|
+
dq: 'dq',
|
|
516
|
+
errorMessage: 'boom',
|
|
517
|
+
errorType: 'a bad one',
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
const expectedMetadata = {
|
|
521
|
+
...expectedBaseCaseMetadata,
|
|
522
|
+
query: 'q',
|
|
523
|
+
aq: 'aq',
|
|
524
|
+
cq: 'cq',
|
|
525
|
+
dq: 'dq',
|
|
526
|
+
errorMessage: 'boom',
|
|
527
|
+
errorType: 'a bad one',
|
|
528
|
+
};
|
|
529
|
+
await client.logQueryError(metadata);
|
|
530
|
+
expectMatchCustomEventPayload(SearchPageEvents.queryError, expectedMetadata);
|
|
531
|
+
});
|
|
532
|
+
|
|
533
|
+
it('should send proper payload for #logPagerNumber', async () => {
|
|
534
|
+
const metadata = {
|
|
535
|
+
...baseCaseMetadata,
|
|
536
|
+
pagerNumber: 123,
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
const expectedMetadata = {
|
|
540
|
+
...expectedBaseCaseMetadata,
|
|
541
|
+
pagerNumber: 123,
|
|
542
|
+
};
|
|
543
|
+
await client.logPagerNumber(metadata);
|
|
544
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerNumber, expectedMetadata);
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
it('should send proper payload for #logPagerNext', async () => {
|
|
548
|
+
const metadata = {
|
|
549
|
+
...baseCaseMetadata,
|
|
550
|
+
pagerNumber: 123,
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
const expectedMetadata = {
|
|
554
|
+
...expectedBaseCaseMetadata,
|
|
555
|
+
pagerNumber: 123,
|
|
556
|
+
};
|
|
557
|
+
await client.logPagerNext(metadata);
|
|
558
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerNext, expectedMetadata);
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
it('should send proper payload for #logPagerPrevious', async () => {
|
|
562
|
+
const metadata = {
|
|
563
|
+
...baseCaseMetadata,
|
|
564
|
+
pagerNumber: 123,
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
const expectedMetadata = {
|
|
568
|
+
...expectedBaseCaseMetadata,
|
|
569
|
+
pagerNumber: 123,
|
|
570
|
+
};
|
|
571
|
+
await client.logPagerPrevious(metadata);
|
|
572
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerPrevious, expectedMetadata);
|
|
573
|
+
});
|
|
574
|
+
|
|
575
|
+
it('should send proper payload for #didyoumeanAutomatic', async () => {
|
|
576
|
+
const metadata = baseCaseMetadata;
|
|
577
|
+
|
|
578
|
+
const expectedMetadata = {
|
|
579
|
+
...expectedBaseCaseMetadata,
|
|
580
|
+
context_Case_Subject: 'test subject',
|
|
581
|
+
context_Case_Description: 'test description',
|
|
582
|
+
};
|
|
583
|
+
await client.logDidYouMeanAutomatic(metadata);
|
|
584
|
+
expectMatchPayload(SearchPageEvents.didyoumeanAutomatic, expectedMetadata);
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
it('should send proper payload for #didyoumeanClick', async () => {
|
|
588
|
+
const metadata = baseCaseMetadata;
|
|
589
|
+
|
|
590
|
+
const expectedMetadata = {
|
|
591
|
+
...expectedBaseCaseMetadata,
|
|
592
|
+
context_Case_Subject: 'test subject',
|
|
593
|
+
context_Case_Description: 'test description',
|
|
594
|
+
};
|
|
595
|
+
await client.logDidYouMeanClick(metadata);
|
|
596
|
+
expectMatchPayload(SearchPageEvents.didyoumeanClick, expectedMetadata);
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
it('should send proper payload for #resultsSort', async () => {
|
|
600
|
+
const metadata = {
|
|
601
|
+
...baseCaseMetadata,
|
|
602
|
+
resultsSortBy: 'date ascending',
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
const expectedMetadata = {
|
|
606
|
+
...expectedBaseCaseMetadata,
|
|
607
|
+
context_Case_Subject: 'test subject',
|
|
608
|
+
context_Case_Description: 'test description',
|
|
609
|
+
resultsSortBy: 'date ascending',
|
|
610
|
+
};
|
|
611
|
+
await client.logResultsSort(metadata);
|
|
612
|
+
expectMatchPayload(SearchPageEvents.resultsSort, expectedMetadata);
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
it('should send proper payload for #searchboxSubmit', async () => {
|
|
616
|
+
const metadata = baseCaseMetadata;
|
|
617
|
+
|
|
618
|
+
const expectedMetadata = {
|
|
619
|
+
...expectedBaseCaseMetadata,
|
|
620
|
+
context_Case_Subject: 'test subject',
|
|
621
|
+
context_Case_Description: 'test description',
|
|
622
|
+
};
|
|
623
|
+
await client.logSearchboxSubmit(metadata);
|
|
624
|
+
expectMatchPayload(SearchPageEvents.searchboxSubmit, expectedMetadata);
|
|
625
|
+
});
|
|
282
626
|
});
|
|
283
627
|
|
|
284
628
|
it('should enable analytics tracking by default', () => {
|