coveo.analytics 2.30.55 → 2.31.0
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 +37 -43
- package/dist/browser.mjs +525 -357
- package/dist/coveoua.browser.js +1 -1
- package/dist/coveoua.browser.js.map +1 -1
- package/dist/coveoua.debug.js +559 -359
- package/dist/coveoua.debug.js.map +1 -1
- package/dist/coveoua.js +1 -1
- package/dist/coveoua.js.map +1 -1
- package/dist/definitions/client/analytics.d.ts +3 -2
- package/dist/definitions/client/runtimeEnvironment.d.ts +1 -1
- package/dist/definitions/donottrack.d.ts +1 -0
- package/dist/definitions/react-native/index.d.ts +1 -1
- package/dist/definitions/searchPage/searchPageClient.d.ts +3 -1
- package/dist/definitions/searchPage/searchPageEvents.d.ts +6 -0
- package/dist/definitions/version.d.ts +1 -1
- package/dist/library.cjs +15367 -3699
- package/dist/library.es.js +525 -357
- package/dist/library.js +15367 -3699
- package/dist/library.mjs +15367 -3699
- package/dist/react-native.es.js +646 -460
- package/modules/package.json +9 -9
- package/package.json +60 -91
- package/react-native/package.json +7 -7
- package/src/caseAssist/caseAssistActions.ts +51 -50
- package/src/caseAssist/caseAssistClient.spec.ts +328 -297
- package/src/caseAssist/caseAssistClient.ts +201 -185
- package/src/client/analytics.spec.ts +724 -703
- package/src/client/analytics.ts +677 -602
- package/src/client/analyticsBeaconClient.spec.ts +195 -188
- package/src/client/analyticsBeaconClient.ts +99 -88
- package/src/client/analyticsFetchClient.ts +77 -61
- package/src/client/analyticsRequestClient.ts +17 -17
- package/src/client/location.ts +3 -3
- package/src/client/measurementProtocolMapper.ts +54 -45
- package/src/client/measurementProtocolMapping/baseMeasurementProtocolMapper.ts +48 -44
- package/src/client/measurementProtocolMapping/commerceMeasurementProtocolMapper.ts +133 -121
- package/src/client/measurementProtocolMapping/serviceMeasurementProtocolMapper.ts +17 -17
- package/src/client/noopAnalytics.ts +80 -68
- package/src/client/runtimeEnvironment.ts +50 -41
- package/src/client/utils.spec.ts +112 -97
- package/src/client/utils.ts +39 -39
- package/src/cookieutils.spec.ts +59 -0
- package/src/cookieutils.ts +40 -39
- package/src/coveoua/browser.ts +14 -12
- package/src/coveoua/library.ts +4 -4
- package/src/coveoua/plugins.ts +36 -34
- package/src/coveoua/simpleanalytics.spec.ts +467 -452
- package/src/coveoua/simpleanalytics.ts +146 -140
- package/src/detector.ts +17 -17
- package/src/donottrack.spec.ts +199 -121
- package/src/donottrack.ts +31 -8
- package/src/events.ts +86 -79
- package/src/formatting/format-array-for-coveo-custom-data.spec.ts +13 -12
- package/src/formatting/format-array-for-coveo-custom-data.ts +18 -18
- package/src/formatting/format-omnibox-metadata.ts +16 -12
- package/src/history.spec.ts +197 -195
- package/src/history.ts +143 -133
- package/src/hook/addDefaultValues.ts +13 -8
- package/src/hook/enhanceViewEvent.ts +17 -17
- package/src/insight/insightClient.spec.ts +1848 -1717
- package/src/insight/insightClient.ts +866 -761
- package/src/insight/insightEvents.ts +57 -56
- package/src/plugins/BasePlugin.ts +125 -121
- package/src/plugins/ec.spec.ts +457 -429
- package/src/plugins/ec.ts +202 -199
- package/src/plugins/link.spec.ts +183 -159
- package/src/plugins/link.ts +88 -85
- package/src/plugins/svc.spec.ts +161 -155
- package/src/plugins/svc.ts +93 -91
- package/src/react-native/index.ts +5 -1
- package/src/react-native/react-native-runtime.ts +33 -33
- package/src/react-native/react-native-utils.ts +1 -1
- package/src/react-native/react-native.spec.ts +22 -21
- package/src/searchPage/searchPageClient.spec.ts +1944 -1766
- package/src/searchPage/searchPageClient.ts +1261 -1029
- package/src/searchPage/searchPageEvents.ts +529 -500
- package/src/storage.spec.ts +51 -51
- package/src/storage.ts +47 -47
- package/dist/definitions/bundle/browser-fetch.d.ts +0 -1
- package/dist/definitions/src/coveoua/browser.d.ts +0 -6
- package/dist/definitions/src/coveoua/headless.d.ts +0 -6
- package/dist/definitions/src/coveoua/library.d.ts +0 -17
- package/dist/definitions/src/coveoua/plugins.d.ts +0 -10
- package/dist/definitions/src/coveoua/simpleanalytics.d.ts +0 -33
- package/dist/definitions/src/react-native/index.d.ts +0 -3
- package/dist/definitions/src/react-native/react-native-runtime.d.ts +0 -19
|
@@ -1,30 +1,31 @@
|
|
|
1
|
+
import {vi} from 'vitest';
|
|
1
2
|
import CoveoAnalyticsClient from '../client/analytics';
|
|
2
3
|
import {ReactNativeRuntime} from './react-native-runtime';
|
|
3
4
|
|
|
4
5
|
describe('ReactNativeRuntime', () => {
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
let runtimeEnvironment: ReactNativeRuntime;
|
|
7
|
+
let client: CoveoAnalyticsClient;
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
client = new CoveoAnalyticsClient({runtimeEnvironment});
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
runtimeEnvironment = new ReactNativeRuntime({
|
|
11
|
+
storage: {
|
|
12
|
+
getItem: vi.fn(),
|
|
13
|
+
setItem: vi.fn(),
|
|
14
|
+
removeItem: vi.fn(),
|
|
15
|
+
},
|
|
17
16
|
});
|
|
17
|
+
client = new CoveoAnalyticsClient({runtimeEnvironment});
|
|
18
|
+
});
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
it('should call "storage.getItem" when getting the visitor ID', async () => {
|
|
21
|
+
vi.spyOn(runtimeEnvironment.storage, 'getItem');
|
|
22
|
+
await client.getCurrentVisitorId();
|
|
23
|
+
expect(runtimeEnvironment.storage.getItem).toHaveBeenCalled();
|
|
24
|
+
});
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
it('should call "storage.getItem" when getting the visitor ID', async () => {
|
|
27
|
+
vi.spyOn(runtimeEnvironment.storage, 'setItem');
|
|
28
|
+
await client.setCurrentVisitorId('testVisitorId');
|
|
29
|
+
expect(runtimeEnvironment.storage.setItem).toHaveBeenCalled();
|
|
30
|
+
});
|
|
30
31
|
});
|