coveo.analytics 2.30.44 → 2.30.46
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/README.md +41 -41
- package/dist/browser.mjs +72 -18
- package/dist/coveoua.browser.js +1 -1
- package/dist/coveoua.browser.js.map +1 -1
- package/dist/coveoua.debug.js +103 -30
- package/dist/coveoua.debug.js.map +1 -1
- package/dist/coveoua.js +1 -1
- package/dist/coveoua.js.map +1 -1
- package/dist/definitions/caseAssist/caseAssistActions.d.ts +4 -1
- package/dist/definitions/caseAssist/caseAssistClient.d.ts +12 -1
- package/dist/definitions/client/analytics.d.ts +2 -2
- package/dist/definitions/insight/insightClient.d.ts +2 -0
- package/dist/definitions/version.d.ts +1 -1
- package/dist/library.cjs +200 -37
- package/dist/library.es.js +72 -18
- package/dist/library.js +200 -37
- package/dist/library.mjs +200 -37
- package/dist/react-native.es.js +72 -18
- package/package.json +7 -7
- package/src/caseAssist/caseAssistActions.ts +4 -1
- package/src/caseAssist/caseAssistClient.spec.ts +64 -40
- package/src/caseAssist/caseAssistClient.ts +67 -6
- package/src/client/analytics.spec.ts +1 -1
- package/src/client/analytics.ts +11 -11
- package/src/client/analyticsBeaconClient.spec.ts +10 -10
- package/src/client/analyticsBeaconClient.ts +4 -4
- package/src/client/analyticsFetchClient.ts +1 -1
- package/src/client/analyticsRequestClient.ts +1 -1
- package/src/client/measurementProtocolMapper.ts +2 -2
- package/src/client/measurementProtocolMapping/baseMeasurementProtocolMapper.ts +1 -1
- package/src/client/measurementProtocolMapping/commerceMeasurementProtocolMapper.ts +5 -5
- package/src/client/noopAnalytics.ts +1 -1
- package/src/client/utils.spec.ts +6 -6
- package/src/coveoua/browser.ts +2 -2
- package/src/coveoua/plugins.ts +1 -1
- package/src/coveoua/simpleanalytics.spec.ts +5 -5
- package/src/coveoua/simpleanalytics.ts +1 -1
- package/src/donottrack.spec.ts +1 -1
- package/src/history.spec.ts +1 -1
- package/src/insight/insightClient.spec.ts +42 -8
- package/src/insight/insightClient.ts +82 -63
- package/src/plugins/ec.spec.ts +6 -6
- package/src/plugins/ec.ts +5 -5
- package/src/plugins/link.spec.ts +5 -5
- package/src/plugins/link.ts +1 -1
- package/src/plugins/svc.ts +1 -1
- package/src/searchPage/searchPageClient.spec.ts +3 -3
- package/src/searchPage/searchPageClient.ts +27 -24
- package/src/searchPage/searchPageEvents.ts +2 -1
- package/src/version.ts +1 -1
package/src/client/utils.spec.ts
CHANGED
|
@@ -9,7 +9,7 @@ describe('utils', () => {
|
|
|
9
9
|
`truncateUrl('${URL_PLAIN}', %d) truncates to exactly that length`,
|
|
10
10
|
(limit) => {
|
|
11
11
|
expect(truncateUrl(URL_PLAIN, limit)).toBe(URL_PLAIN.substring(0, limit));
|
|
12
|
-
}
|
|
12
|
+
},
|
|
13
13
|
);
|
|
14
14
|
|
|
15
15
|
/** Decoded: `'http://test/ ¿OKツ😅#fine'` */
|
|
@@ -20,7 +20,7 @@ describe('utils', () => {
|
|
|
20
20
|
`truncateUrl('${URL_WITH_ESCAPES}', %d) truncates to the exact limit outside of codepoints`,
|
|
21
21
|
(limit) => {
|
|
22
22
|
expect(truncateUrl(URL_WITH_ESCAPES, limit)).toBe(URL_WITH_ESCAPES.substring(0, limit));
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
it.each([
|
|
@@ -32,7 +32,7 @@ describe('utils', () => {
|
|
|
32
32
|
`truncateUrl('${URL_WITH_ESCAPES}', %d) does not break up single-byte codepoints`,
|
|
33
33
|
(limit, expectedLength) => {
|
|
34
34
|
expect(truncateUrl(URL_WITH_ESCAPES, limit)).toBe(URL_WITH_ESCAPES.substring(0, expectedLength));
|
|
35
|
-
}
|
|
35
|
+
},
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
it.each([
|
|
@@ -62,7 +62,7 @@ describe('utils', () => {
|
|
|
62
62
|
`truncateUrl('${URL_WITH_ESCAPES}', %d) does not break up three-byte codepoints`,
|
|
63
63
|
(limit, expectedLength) => {
|
|
64
64
|
expect(truncateUrl(URL_WITH_ESCAPES, limit)).toBe(URL_WITH_ESCAPES.substring(0, expectedLength));
|
|
65
|
-
}
|
|
65
|
+
},
|
|
66
66
|
);
|
|
67
67
|
|
|
68
68
|
it.each([
|
|
@@ -105,9 +105,9 @@ describe('utils', () => {
|
|
|
105
105
|
`truncateUrl('${URL_WITH_INVALID_ESCAPES}', %d) only checks for percent with invalid escapes`,
|
|
106
106
|
(limit, expectedLength) => {
|
|
107
107
|
expect(truncateUrl(URL_WITH_INVALID_ESCAPES, limit)).toBe(
|
|
108
|
-
URL_WITH_INVALID_ESCAPES.substring(0, expectedLength)
|
|
108
|
+
URL_WITH_INVALID_ESCAPES.substring(0, expectedLength),
|
|
109
109
|
);
|
|
110
|
-
}
|
|
110
|
+
},
|
|
111
111
|
);
|
|
112
112
|
});
|
|
113
113
|
});
|
package/src/coveoua/browser.ts
CHANGED
|
@@ -6,13 +6,13 @@ declare const self: any;
|
|
|
6
6
|
const promise = (window as any)['Promise'];
|
|
7
7
|
if (!(promise instanceof Function) && !global) {
|
|
8
8
|
console.error(
|
|
9
|
-
`This script uses window.Promise which is not supported in your browser. Consider adding a polyfill like "es6-promise"
|
|
9
|
+
`This script uses window.Promise which is not supported in your browser. Consider adding a polyfill like "es6-promise".`,
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
12
|
const fetch = (window as any)['fetch'];
|
|
13
13
|
if (!(fetch instanceof Function) && !global) {
|
|
14
14
|
console.error(
|
|
15
|
-
`This script uses window.fetch which is not supported in your browser. Consider adding a polyfill like "fetch"
|
|
15
|
+
`This script uses window.fetch which is not supported in your browser. Consider adding a polyfill like "fetch".`,
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
|
package/src/coveoua/plugins.ts
CHANGED
|
@@ -16,7 +16,7 @@ export class Plugins {
|
|
|
16
16
|
const pluginClass = this.registeredPluginsMap[name];
|
|
17
17
|
if (!pluginClass) {
|
|
18
18
|
throw new Error(
|
|
19
|
-
`No plugin named "${name}" is currently registered. If you use a custom plugin, use 'provide' first
|
|
19
|
+
`No plugin named "${name}" is currently registered. If you use a custom plugin, use 'provide' first.`,
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
this.requiredPlugins[name] = new (pluginClass as any)(options);
|
|
@@ -63,7 +63,7 @@ describe('simpleanalytics', () => {
|
|
|
63
63
|
|
|
64
64
|
it('throws when initializing with a token that is not a string nor a AnalyticClient', () => {
|
|
65
65
|
expect(() => coveoua('init', {})).toThrow(
|
|
66
|
-
`You must pass either your token or a valid object when you call 'init'
|
|
66
|
+
`You must pass either your token or a valid object when you call 'init'`,
|
|
67
67
|
);
|
|
68
68
|
});
|
|
69
69
|
|
|
@@ -165,7 +165,7 @@ describe('simpleanalytics', () => {
|
|
|
165
165
|
|
|
166
166
|
it(`throw if the initForProxy receive an endpoint that is not a string`, () => {
|
|
167
167
|
expect(() => coveoua('initForProxy', {})).toThrow(
|
|
168
|
-
`You must pass a string as the endpoint parameter when you call 'initForProxy'
|
|
168
|
+
`You must pass a string as the endpoint parameter when you call 'initForProxy'`,
|
|
169
169
|
);
|
|
170
170
|
});
|
|
171
171
|
});
|
|
@@ -484,7 +484,7 @@ describe('simpleanalytics', () => {
|
|
|
484
484
|
coveoua('init', 'MYTOKEN', {plugins: []});
|
|
485
485
|
|
|
486
486
|
expect(() => coveoua('require', 'test')).toThrow(
|
|
487
|
-
`No plugin named "test" is currently registered. If you use a custom plugin, use 'provide' first
|
|
487
|
+
`No plugin named "test" is currently registered. If you use a custom plugin, use 'provide' first.`,
|
|
488
488
|
);
|
|
489
489
|
});
|
|
490
490
|
});
|
|
@@ -506,7 +506,7 @@ describe('simpleanalytics', () => {
|
|
|
506
506
|
coveoua('reset');
|
|
507
507
|
|
|
508
508
|
expect(() => coveoua('init', 'MYTOKEN', {plugins: ['test']})).toThrow(
|
|
509
|
-
`No plugin named "test" is currently registered. If you use a custom plugin, use 'provide' first
|
|
509
|
+
`No plugin named "test" is currently registered. If you use a custom plugin, use 'provide' first.`,
|
|
510
510
|
);
|
|
511
511
|
});
|
|
512
512
|
|
|
@@ -529,7 +529,7 @@ describe('simpleanalytics', () => {
|
|
|
529
529
|
coveoua('init', 'SOME TOKEN', {plugins: ['svc']});
|
|
530
530
|
|
|
531
531
|
expect(() => coveoua('potato')).toThrow(
|
|
532
|
-
`The action "potato" does not exist. Available actions: init, set, send, onLoad, callPlugin, reset, require, provide, version
|
|
532
|
+
`The action "potato" does not exist. Available actions: init, set, send, onLoad, callPlugin, reset, require, provide, version.`,
|
|
533
533
|
);
|
|
534
534
|
});
|
|
535
535
|
|
|
@@ -42,7 +42,7 @@ export class CoveoUA {
|
|
|
42
42
|
const pluginOptions: PluginOptions = {client: this.client};
|
|
43
43
|
this.plugins.clearRequired();
|
|
44
44
|
this.getPluginKeys(optionsOrEndpoint).forEach((pluginKey) =>
|
|
45
|
-
this.plugins.require(pluginKey, pluginOptions)
|
|
45
|
+
this.plugins.require(pluginKey, pluginOptions),
|
|
46
46
|
);
|
|
47
47
|
this.client.registerBeforeSendEventHook((eventType, payload) => ({
|
|
48
48
|
...payload,
|
package/src/donottrack.spec.ts
CHANGED
package/src/history.spec.ts
CHANGED
|
@@ -162,6 +162,16 @@ describe('InsightClient', () => {
|
|
|
162
162
|
expectMatchPayload(SearchPageEvents.interfaceLoad);
|
|
163
163
|
});
|
|
164
164
|
|
|
165
|
+
it('should send proper payload for #recentQueryClick', async () => {
|
|
166
|
+
await client.logRecentQueryClick();
|
|
167
|
+
expectMatchPayload(SearchPageEvents.recentQueryClick);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it('should send proper payload for #clearRecentQueries', async () => {
|
|
171
|
+
await client.logClearRecentQueries();
|
|
172
|
+
expectMatchCustomEventPayload(SearchPageEvents.clearRecentQueries);
|
|
173
|
+
});
|
|
174
|
+
|
|
165
175
|
it('should send proper payload for #interfaceChange', async () => {
|
|
166
176
|
await client.logInterfaceChange({
|
|
167
177
|
interfaceChangeTo: 'bob',
|
|
@@ -443,7 +453,7 @@ describe('InsightClient', () => {
|
|
|
443
453
|
await client.logCollapseSmartSnippetSuggestion(exampleSmartSnippetSuggestion);
|
|
444
454
|
expectMatchCustomEventPayload(
|
|
445
455
|
SearchPageEvents.collapseSmartSnippetSuggestion,
|
|
446
|
-
exampleSmartSnippetSuggestion
|
|
456
|
+
exampleSmartSnippetSuggestion,
|
|
447
457
|
);
|
|
448
458
|
});
|
|
449
459
|
|
|
@@ -480,7 +490,7 @@ describe('InsightClient', () => {
|
|
|
480
490
|
expectMatchDocumentPayload(
|
|
481
491
|
SearchPageEvents.openSmartSnippetSuggestionSource,
|
|
482
492
|
fakeDocInfo,
|
|
483
|
-
expectedMetadata
|
|
493
|
+
expectedMetadata,
|
|
484
494
|
);
|
|
485
495
|
});
|
|
486
496
|
|
|
@@ -502,7 +512,7 @@ describe('InsightClient', () => {
|
|
|
502
512
|
expectMatchDocumentPayload(
|
|
503
513
|
SearchPageEvents.openSmartSnippetSuggestionInlineLink,
|
|
504
514
|
fakeDocInfo,
|
|
505
|
-
expectedMetadata
|
|
515
|
+
expectedMetadata,
|
|
506
516
|
);
|
|
507
517
|
});
|
|
508
518
|
it('should send proper payload for #showMoreFoldedResults', async () => {
|
|
@@ -581,7 +591,7 @@ describe('InsightClient', () => {
|
|
|
581
591
|
await client.logGeneratedAnswerCopyToClipboard(exampleGeneratedAnswerMetadata);
|
|
582
592
|
expectMatchCustomEventPayload(
|
|
583
593
|
SearchPageEvents.generatedAnswerCopyToClipboard,
|
|
584
|
-
exampleGeneratedAnswerMetadata
|
|
594
|
+
exampleGeneratedAnswerMetadata,
|
|
585
595
|
);
|
|
586
596
|
});
|
|
587
597
|
|
|
@@ -631,7 +641,7 @@ describe('InsightClient', () => {
|
|
|
631
641
|
await client.logGeneratedAnswerFeedbackSubmit(exampleGeneratedAnswerMetadata);
|
|
632
642
|
expectMatchCustomEventPayload(
|
|
633
643
|
SearchPageEvents.generatedAnswerFeedbackSubmit,
|
|
634
|
-
exampleGeneratedAnswerMetadata
|
|
644
|
+
exampleGeneratedAnswerMetadata,
|
|
635
645
|
);
|
|
636
646
|
});
|
|
637
647
|
|
|
@@ -693,7 +703,7 @@ describe('InsightClient', () => {
|
|
|
693
703
|
await client.logGeneratedAnswerFeedbackSubmitV2(exampleGeneratedAnswerMetadata);
|
|
694
704
|
expectMatchCustomEventPayload(
|
|
695
705
|
SearchPageEvents.generatedAnswerFeedbackSubmitV2,
|
|
696
|
-
exampleGeneratedAnswerMetadata
|
|
706
|
+
exampleGeneratedAnswerMetadata,
|
|
697
707
|
);
|
|
698
708
|
});
|
|
699
709
|
});
|
|
@@ -711,6 +721,30 @@ describe('InsightClient', () => {
|
|
|
711
721
|
expectMatchPayload(SearchPageEvents.interfaceLoad, expectedMetadata);
|
|
712
722
|
});
|
|
713
723
|
|
|
724
|
+
it('should send proper payload for #recentQueryClick', async () => {
|
|
725
|
+
const metadata = baseCaseMetadata;
|
|
726
|
+
|
|
727
|
+
const expectedMetadata = {
|
|
728
|
+
...expectedBaseCaseMetadata,
|
|
729
|
+
context_Case_Subject: 'test subject',
|
|
730
|
+
context_Case_Description: 'test description',
|
|
731
|
+
};
|
|
732
|
+
await client.logRecentQueryClick(metadata);
|
|
733
|
+
expectMatchPayload(SearchPageEvents.recentQueryClick, expectedMetadata);
|
|
734
|
+
});
|
|
735
|
+
|
|
736
|
+
it('should send proper payload for #clearRecentQueries', async () => {
|
|
737
|
+
const metadata = baseCaseMetadata;
|
|
738
|
+
|
|
739
|
+
const expectedMetadata = {
|
|
740
|
+
...expectedBaseCaseMetadata,
|
|
741
|
+
context_Case_Subject: 'test subject',
|
|
742
|
+
context_Case_Description: 'test description',
|
|
743
|
+
};
|
|
744
|
+
await client.logClearRecentQueries(metadata);
|
|
745
|
+
expectMatchCustomEventPayload(SearchPageEvents.clearRecentQueries, expectedMetadata);
|
|
746
|
+
});
|
|
747
|
+
|
|
714
748
|
it('should send proper payload for #interfaceChange', async () => {
|
|
715
749
|
const metadata = {
|
|
716
750
|
...baseCaseMetadata,
|
|
@@ -1263,7 +1297,7 @@ describe('InsightClient', () => {
|
|
|
1263
1297
|
expectMatchDocumentPayload(
|
|
1264
1298
|
SearchPageEvents.openSmartSnippetSuggestionSource,
|
|
1265
1299
|
fakeDocInfo,
|
|
1266
|
-
expectedMetadata
|
|
1300
|
+
expectedMetadata,
|
|
1267
1301
|
);
|
|
1268
1302
|
});
|
|
1269
1303
|
|
|
@@ -1286,7 +1320,7 @@ describe('InsightClient', () => {
|
|
|
1286
1320
|
expectMatchDocumentPayload(
|
|
1287
1321
|
SearchPageEvents.openSmartSnippetSuggestionInlineLink,
|
|
1288
1322
|
fakeDocInfo,
|
|
1289
|
-
expectedMetadata
|
|
1323
|
+
expectedMetadata,
|
|
1290
1324
|
);
|
|
1291
1325
|
});
|
|
1292
1326
|
|