From afe47a30b06c87734e6d977f20b95eb58a3dd196 Mon Sep 17 00:00:00 2001 From: Louis Bompart Date: Thu, 10 Oct 2024 14:01:11 -0400 Subject: [PATCH] feat(headless): remove visitorId (#4485) https://coveord.atlassian.net/browse/KIT-3623 The visitorId is deprecated on all SearchAPIs endpoints (unrelated to EventProtocol), as the clientId replaces it. @coveo/service-core, I did it on your APIs, but could you confirm that the clientId is being correctly used and passed along? --- packages/headless/src/api/platform-service-params.ts | 4 ---- .../search/facet-search/base/base-facet-search-request.ts | 3 +-- packages/headless/src/api/search/html/html-api-client.ts | 3 --- packages/headless/src/api/search/html/html-request.ts | 5 ++--- packages/headless/src/api/search/plan/plan-request.ts | 2 -- .../src/api/search/query-suggest/query-suggest-request.ts | 2 -- .../api/search/recommendation/recommendation-request.ts | 2 -- .../headless/src/api/search/search-api-client.test.ts | 6 ------ packages/headless/src/api/search/search/search-request.ts | 2 -- .../insight/query-suggest/query-suggest-request.ts | 7 +------ .../category-facet-search-request-builder.test.ts | 1 - .../specific-facet-search-request-builder.test.ts | 1 - .../insight-search/insight-query-suggest-request.ts | 6 +----- .../insight-result-preview-request-builder.test.ts | 1 - .../insight-result-preview-request-builder.ts | 7 +------ .../src/features/query-suggest/query-suggest-actions.ts | 6 +----- .../src/features/recommendation/recommendation-actions.ts | 8 +------- .../result-preview/result-preview-request-builder.test.ts | 1 - .../result-preview/result-preview-request-builder.ts | 6 +----- .../legacy/search-and-folding-request.test.ts | 8 ++++---- .../legacy/search-and-folding-request.ts | 6 +----- .../search-and-folding/search-and-folding-request.test.ts | 8 ++++---- .../search-and-folding/search-and-folding-request.ts | 3 --- .../headless/src/features/search/search-request.test.ts | 8 ++++---- .../standalone-search-box-set-actions.ts | 4 ---- .../src/test/mock-result-preview-request-builder.ts | 1 - 26 files changed, 22 insertions(+), 89 deletions(-) diff --git a/packages/headless/src/api/platform-service-params.ts b/packages/headless/src/api/platform-service-params.ts index 75849c72276..ca23e822d8f 100644 --- a/packages/headless/src/api/platform-service-params.ts +++ b/packages/headless/src/api/platform-service-params.ts @@ -28,10 +28,6 @@ export interface ClientIDParam { clientId?: string; } -export interface VisitorIDParam { - visitorId?: string; -} - export interface FoldingParam { filterField?: string; parentField?: string; diff --git a/packages/headless/src/api/search/facet-search/base/base-facet-search-request.ts b/packages/headless/src/api/search/facet-search/base/base-facet-search-request.ts index 6d5d9674b94..456d9812903 100644 --- a/packages/headless/src/api/search/facet-search/base/base-facet-search-request.ts +++ b/packages/headless/src/api/search/facet-search/base/base-facet-search-request.ts @@ -1,4 +1,4 @@ -import {BaseParam, VisitorIDParam} from '../../../platform-service-params.js'; +import {BaseParam} from '../../../platform-service-params.js'; import {AuthenticationParam} from '../../search-api-params.js'; import {SearchRequest} from '../../search/search-request.js'; @@ -16,7 +16,6 @@ export interface FacetSearchRequestOptions { export interface BaseFacetSearchRequest extends FacetSearchRequestOptions, BaseParam, - VisitorIDParam, AuthenticationParam { field: string; searchContext?: SearchRequest; diff --git a/packages/headless/src/api/search/html/html-api-client.ts b/packages/headless/src/api/search/html/html-api-client.ts index bbc7b405e13..1145979467f 100644 --- a/packages/headless/src/api/search/html/html-api-client.ts +++ b/packages/headless/src/api/search/html/html-api-client.ts @@ -41,9 +41,6 @@ export const buildContentURL = (req: HtmlRequest, path: string) => { if (req.requestedOutputSize !== undefined) { url.addParam('requestedOutputSize', `${req.requestedOutputSize}`); } - if (req.visitorId !== undefined) { - url.addParam('visitorId', `${req.visitorId}`); - } return url.href; }; diff --git a/packages/headless/src/api/search/html/html-request.ts b/packages/headless/src/api/search/html/html-request.ts index 19b91020907..90fea551b28 100644 --- a/packages/headless/src/api/search/html/html-request.ts +++ b/packages/headless/src/api/search/html/html-request.ts @@ -1,4 +1,4 @@ -import {BaseParam, VisitorIDParam} from '../../platform-service-params.js'; +import {BaseParam} from '../../platform-service-params.js'; import {AuthenticationParam} from '../search-api-params.js'; export interface HtmlRequestOptions { @@ -8,8 +8,7 @@ export interface HtmlRequestOptions { export type HtmlRequest = BaseParam & HtmlRequestOptions & - AuthenticationParam & - VisitorIDParam & { + AuthenticationParam & { enableNavigation: boolean; requestedOutputSize: number; q: string; diff --git a/packages/headless/src/api/search/plan/plan-request.ts b/packages/headless/src/api/search/plan/plan-request.ts index c3f94208456..8ef74e3e7d2 100644 --- a/packages/headless/src/api/search/plan/plan-request.ts +++ b/packages/headless/src/api/search/plan/plan-request.ts @@ -2,7 +2,6 @@ import { BaseParam, ContextParam, LocaleParam, - VisitorIDParam, } from '../../platform-service-params.js'; import { AnalyticsParam, @@ -20,6 +19,5 @@ export type PlanRequest = BaseParam & PipelineParam & LocaleParam & TimezoneParam & - VisitorIDParam & AnalyticsParam & AuthenticationParam; diff --git a/packages/headless/src/api/search/query-suggest/query-suggest-request.ts b/packages/headless/src/api/search/query-suggest/query-suggest-request.ts index 7a53eb3fbf0..280f49ad90b 100644 --- a/packages/headless/src/api/search/query-suggest/query-suggest-request.ts +++ b/packages/headless/src/api/search/query-suggest/query-suggest-request.ts @@ -2,7 +2,6 @@ import { BaseParam, ContextParam, LocaleParam, - VisitorIDParam, } from '../../platform-service-params.js'; import { ActionsHistoryParam, @@ -24,7 +23,6 @@ export type QuerySuggestRequest = BaseParam & LocaleParam & TimezoneParam & ActionsHistoryParam & - VisitorIDParam & AuthenticationParam & AnalyticsParam & { count: number; diff --git a/packages/headless/src/api/search/recommendation/recommendation-request.ts b/packages/headless/src/api/search/recommendation/recommendation-request.ts index 74be238a1c1..9da006cd8c6 100644 --- a/packages/headless/src/api/search/recommendation/recommendation-request.ts +++ b/packages/headless/src/api/search/recommendation/recommendation-request.ts @@ -4,7 +4,6 @@ import { DictionaryFieldContextParam, LocaleParam, NumberOfResultsParam, - VisitorIDParam, } from '../../platform-service-params.js'; import { ActionsHistoryParam, @@ -35,7 +34,6 @@ export type RecommendationRequest = BaseParam & ReferrerParam & LocaleParam & TimezoneParam & - VisitorIDParam & AnalyticsParam & AuthenticationParam & NumberOfResultsParam; diff --git a/packages/headless/src/api/search/search-api-client.test.ts b/packages/headless/src/api/search/search-api-client.test.ts index 6aaf39bcc35..ef84f8da43f 100644 --- a/packages/headless/src/api/search/search-api-client.test.ts +++ b/packages/headless/src/api/search/search-api-client.test.ts @@ -251,7 +251,6 @@ describe('search api client', () => { fieldsToInclude: state.fields.fieldsToInclude, pipeline: state.pipeline, searchHub: state.searchHub, - visitorId: expect.any(String), }, preprocessRequest: NoopPreprocessRequest, requestMetadata: {method: 'search'}, @@ -346,7 +345,6 @@ describe('search api client', () => { searchHub: state.searchHub, timezone: state.configuration.search.timezone, locale: state.configuration.search.locale, - visitorId: expect.any(String), }, preprocessRequest: NoopPreprocessRequest, requestMetadata: {method: 'plan'}, @@ -416,7 +414,6 @@ describe('search api client', () => { timezone: state.configuration.search.timezone, locale: state.configuration.search.locale, actionsHistory: expect.any(Array), - visitorId: expect.any(String), }, preprocessRequest: NoopPreprocessRequest, requestMetadata: {method: 'querySuggest'}, @@ -570,7 +567,6 @@ describe('search api client', () => { ignoreValues: [], searchContext: { ...searchRequest, - visitorId: expect.any(String), analytics: { ...searchRequest.analytics, clientId: expect.any(String), @@ -622,7 +618,6 @@ it calls PlatformClient.call with the category facet search params`, async () => ignorePaths: [], searchContext: { ...searchRequest, - visitorId: expect.any(String), analytics: { ...searchRequest.analytics, clientId: expect.any(String), @@ -685,7 +680,6 @@ it calls PlatformClient.call with the category facet search params`, async () => actionsHistory: expect.any(Array), tab: originLevel2, referrer: originLevel3, - visitorId: expect.any(String), numberOfResults: recommendationState.pagination.numberOfResults, }, preprocessRequest: NoopPreprocessRequest, diff --git a/packages/headless/src/api/search/search/search-request.ts b/packages/headless/src/api/search/search/search-request.ts index 2a7c1f0ccac..f73c4847f86 100644 --- a/packages/headless/src/api/search/search/search-request.ts +++ b/packages/headless/src/api/search/search/search-request.ts @@ -6,7 +6,6 @@ import { FoldingParam, LocaleParam, NumberOfResultsParam, - VisitorIDParam, } from '../../platform-service-params.js'; import { ActionsHistoryParam, @@ -54,7 +53,6 @@ export type SearchRequest = BaseParam & PipelineParam & SearchHubParam & FacetOptionsParam & - VisitorIDParam & DebugParam & LocaleParam & FoldingParam & diff --git a/packages/headless/src/api/service/insight/query-suggest/query-suggest-request.ts b/packages/headless/src/api/service/insight/query-suggest/query-suggest-request.ts index fc747775f5b..7fd1cd140f1 100644 --- a/packages/headless/src/api/service/insight/query-suggest/query-suggest-request.ts +++ b/packages/headless/src/api/service/insight/query-suggest/query-suggest-request.ts @@ -1,8 +1,4 @@ -import { - ContextParam, - LocaleParam, - VisitorIDParam, -} from '../../../platform-service-params.js'; +import {ContextParam, LocaleParam} from '../../../platform-service-params.js'; import { ActionsHistoryParam, AnalyticsParam, @@ -18,7 +14,6 @@ export type InsightQuerySuggestRequest = InsightParam & LocaleParam & TimezoneParam & ActionsHistoryParam & - VisitorIDParam & AuthenticationParam & AnalyticsParam & { count: number; diff --git a/packages/headless/src/features/facets/facet-search-set/category/category-facet-search-request-builder.test.ts b/packages/headless/src/features/facets/facet-search-set/category/category-facet-search-request-builder.test.ts index 1c96d91c92f..d27c5d84a9a 100644 --- a/packages/headless/src/features/facets/facet-search-set/category/category-facet-search-request-builder.test.ts +++ b/packages/headless/src/features/facets/facet-search-set/category/category-facet-search-request-builder.test.ts @@ -91,7 +91,6 @@ describe('#buildCategoryFacetSearchRequest', () => { expect((await buildParams()).searchContext).toEqual({ ...request, - visitorId: expect.any(String), analytics: { ...request.analytics, clientId: expect.any(String), diff --git a/packages/headless/src/features/facets/facet-search-set/specific/specific-facet-search-request-builder.test.ts b/packages/headless/src/features/facets/facet-search-set/specific/specific-facet-search-request-builder.test.ts index 878792f7dbe..8b2d80a2da6 100644 --- a/packages/headless/src/features/facets/facet-search-set/specific/specific-facet-search-request-builder.test.ts +++ b/packages/headless/src/features/facets/facet-search-set/specific/specific-facet-search-request-builder.test.ts @@ -80,7 +80,6 @@ describe('#buildSpecificFacetSearchRequest', () => { expect((await buildParams()).searchContext).toEqual({ ...request, - visitorId: expect.any(String), analytics: { ...request.analytics, clientId: expect.any(String), diff --git a/packages/headless/src/features/insight-search/insight-query-suggest-request.ts b/packages/headless/src/features/insight-search/insight-query-suggest-request.ts index 54d01b43016..e8a8866d8da 100644 --- a/packages/headless/src/features/insight-search/insight-query-suggest-request.ts +++ b/packages/headless/src/features/insight-search/insight-query-suggest-request.ts @@ -1,7 +1,4 @@ -import { - historyStore, - getVisitorID, -} from '../../api/analytics/coveo-analytics-utils.js'; +import {historyStore} from '../../api/analytics/coveo-analytics-utils.js'; import {getOrganizationEndpoint} from '../../api/platform-client.js'; import {InsightQuerySuggestRequest} from '../../api/service/insight/query-suggest/query-suggest-request.js'; import {InsightAppState} from '../../state/insight-app-state.js'; @@ -37,7 +34,6 @@ export const buildInsightQuerySuggestRequest = async ( context: s.insightCaseContext.caseContext, }), ...(s.configuration.analytics.enabled && { - visitorId: await getVisitorID(s.configuration.analytics), ...(s.configuration.analytics.enabled && (await fromAnalyticsStateToAnalyticsParams(s.configuration.analytics))), }), diff --git a/packages/headless/src/features/insight-search/insight-result-preview-request-builder.test.ts b/packages/headless/src/features/insight-search/insight-result-preview-request-builder.test.ts index 20d5de08561..420c9ddc2f8 100644 --- a/packages/headless/src/features/insight-search/insight-result-preview-request-builder.test.ts +++ b/packages/headless/src/features/insight-search/insight-result-preview-request-builder.test.ts @@ -45,7 +45,6 @@ describe('ResultPreviewRequestBuilder', () => { requestedOutputSize: 0, uniqueId: '1', url: expectedUrl, - visitorId: expect.any(String), }); }); }); diff --git a/packages/headless/src/features/insight-search/insight-result-preview-request-builder.ts b/packages/headless/src/features/insight-search/insight-result-preview-request-builder.ts index 23308859f2e..8afc2d0a50d 100644 --- a/packages/headless/src/features/insight-search/insight-result-preview-request-builder.ts +++ b/packages/headless/src/features/insight-search/insight-result-preview-request-builder.ts @@ -1,4 +1,3 @@ -import {getVisitorID} from '../../api/analytics/coveo-analytics-utils.js'; import {getOrganizationEndpoint} from '../../api/platform-client.js'; import { HtmlRequest, @@ -15,8 +14,7 @@ export async function buildInsightResultPreviewRequest( state: StateNeededByInsightHtmlEndpoint, options: HtmlRequestOptions ): Promise { - const {accessToken, organizationId, analytics, environment} = - state.configuration; + const {accessToken, organizationId, environment} = state.configuration; const {insightId} = state.insightConfiguration; const q = state.query?.q || ''; @@ -32,9 +30,6 @@ export async function buildInsightResultPreviewRequest( accessToken, organizationId, enableNavigation: false, - ...(analytics.enabled && { - visitorId: await getVisitorID(state.configuration.analytics), - }), q, ...options, requestedOutputSize: options.requestedOutputSize || 0, diff --git a/packages/headless/src/features/query-suggest/query-suggest-actions.ts b/packages/headless/src/features/query-suggest/query-suggest-actions.ts index 9333740bd6d..eb57d0f069c 100644 --- a/packages/headless/src/features/query-suggest/query-suggest-actions.ts +++ b/packages/headless/src/features/query-suggest/query-suggest-actions.ts @@ -1,9 +1,6 @@ import {NumberValue} from '@coveo/bueno'; import {createAction, createAsyncThunk} from '@reduxjs/toolkit'; -import { - getVisitorID, - historyStore, -} from '../../api/analytics/coveo-analytics-utils.js'; +import {historyStore} from '../../api/analytics/coveo-analytics-utils.js'; import {getSearchApiBaseUrl} from '../../api/platform-client.js'; import {QuerySuggestRequest} from '../../api/search/query-suggest/query-suggest-request.js'; import {QuerySuggestSuccessResponse} from '../../api/search/query-suggest/query-suggest-response.js'; @@ -181,7 +178,6 @@ export const buildQuerySuggestRequest = async ( ...(s.searchHub && {searchHub: s.searchHub}), tab: s.configuration.analytics.originLevel2, ...(s.configuration.analytics.enabled && { - visitorId: await getVisitorID(s.configuration.analytics), ...(s.configuration.analytics.enabled && s.configuration.analytics.analyticsMode === 'legacy' ? await legacyFromAnalyticsStateToAnalyticsParams( diff --git a/packages/headless/src/features/recommendation/recommendation-actions.ts b/packages/headless/src/features/recommendation/recommendation-actions.ts index cf9c4203af9..28aa86e7f4f 100644 --- a/packages/headless/src/features/recommendation/recommendation-actions.ts +++ b/packages/headless/src/features/recommendation/recommendation-actions.ts @@ -1,8 +1,5 @@ import {createAction, createAsyncThunk} from '@reduxjs/toolkit'; -import { - getVisitorID, - historyStore, -} from '../../api/analytics/coveo-analytics-utils.js'; +import {historyStore} from '../../api/analytics/coveo-analytics-utils.js'; import {getSearchApiBaseUrl} from '../../api/platform-client.js'; import {RecommendationRequest} from '../../api/search/recommendation/recommendation-request.js'; import { @@ -119,9 +116,6 @@ export const buildRecommendationRequest = async ( ...(s.fields && { fieldsToInclude: s.fields.fieldsToInclude, }), - ...(s.configuration.analytics.enabled && { - visitorId: await getVisitorID(s.configuration.analytics), - }), ...(s.configuration.analytics.enabled && (await buildAnalyticsSection(s, recommendationInterfaceLoad()))), ...(s.configuration.search.authenticationProviders.length && { diff --git a/packages/headless/src/features/result-preview/result-preview-request-builder.test.ts b/packages/headless/src/features/result-preview/result-preview-request-builder.test.ts index 6dd8e079446..760a2dbe5e4 100644 --- a/packages/headless/src/features/result-preview/result-preview-request-builder.test.ts +++ b/packages/headless/src/features/result-preview/result-preview-request-builder.test.ts @@ -34,7 +34,6 @@ describe('ResultPreviewRequestBuilder', () => { requestedOutputSize: 0, uniqueId: '1', url: getSearchApiBaseUrl(''), - visitorId: expect.any(String), }); }); }); diff --git a/packages/headless/src/features/result-preview/result-preview-request-builder.ts b/packages/headless/src/features/result-preview/result-preview-request-builder.ts index e50f61173eb..de52c4f16f4 100644 --- a/packages/headless/src/features/result-preview/result-preview-request-builder.ts +++ b/packages/headless/src/features/result-preview/result-preview-request-builder.ts @@ -1,4 +1,3 @@ -import {getVisitorID} from '../../api/analytics/coveo-analytics-utils.js'; import {getSearchApiBaseUrl} from '../../api/platform-client.js'; import { HtmlRequest, @@ -18,7 +17,7 @@ export async function buildResultPreviewRequest( state: StateNeededByHtmlEndpoint, options: HtmlRequestOptions ): Promise { - const {search, accessToken, organizationId, analytics} = state.configuration; + const {search, accessToken, organizationId} = state.configuration; const q = state.query?.q || ''; return { @@ -31,9 +30,6 @@ export async function buildResultPreviewRequest( accessToken, organizationId, enableNavigation: false, - ...(analytics.enabled && { - visitorId: await getVisitorID(state.configuration.analytics), - }), q, ...options, requestedOutputSize: options.requestedOutputSize || 0, diff --git a/packages/headless/src/features/search-and-folding/legacy/search-and-folding-request.test.ts b/packages/headless/src/features/search-and-folding/legacy/search-and-folding-request.test.ts index e5f0184d0f9..73339845968 100644 --- a/packages/headless/src/features/search-and-folding/legacy/search-and-folding-request.test.ts +++ b/packages/headless/src/features/search-and-folding/legacy/search-and-folding-request.test.ts @@ -109,9 +109,9 @@ describe('buildSearchAndFoldingLoadCollectionRequest', () => { state.configuration.analytics.enabled = true; }); - it('#visitorId is included in the request', async () => { + it('#analytics is included in the request', async () => { const request = await buildSearchAndFoldingLoadCollectionRequest(state); - expect(request.visitorId).toBeDefined(); + expect(request.analytics).toBeDefined(); }); it('#actionsHistory is included in the request', async () => { @@ -127,9 +127,9 @@ describe('buildSearchAndFoldingLoadCollectionRequest', () => { state.configuration.analytics.enabled = false; }); - it('#visitorId is not included in the request', async () => { + it('#analytics is not included in the request', async () => { const request = await buildSearchAndFoldingLoadCollectionRequest(state); - expect(request.visitorId).toBeUndefined(); + expect(request.analytics).toBeUndefined(); }); it('#actionsHistory is not included in the request', async () => { diff --git a/packages/headless/src/features/search-and-folding/legacy/search-and-folding-request.ts b/packages/headless/src/features/search-and-folding/legacy/search-and-folding-request.ts index af50580e28a..adb97c31477 100644 --- a/packages/headless/src/features/search-and-folding/legacy/search-and-folding-request.ts +++ b/packages/headless/src/features/search-and-folding/legacy/search-and-folding-request.ts @@ -1,9 +1,6 @@ import {isNullOrUndefined} from '@coveo/bueno'; import {EventDescription} from 'coveo.analytics'; -import { - getVisitorID, - historyStore, -} from '../../../api/analytics/coveo-analytics-utils.js'; +import {historyStore} from '../../../api/analytics/coveo-analytics-utils.js'; import {getSearchApiBaseUrl} from '../../../api/platform-client.js'; import {SearchRequest} from '../../../api/search/search/search-request.js'; import {SearchAppState} from '../../../state/search-app-state.js'; @@ -32,7 +29,6 @@ export const buildSearchAndFoldingLoadCollectionRequest = async ( referrer: state.configuration.analytics.originLevel3, timezone: state.configuration.search.timezone, ...(state.configuration.analytics.enabled && { - visitorId: await getVisitorID(state.configuration.analytics), actionsHistory: historyStore.getHistory(), }), ...(state.advancedSearchQueries?.aq && { diff --git a/packages/headless/src/features/search-and-folding/search-and-folding-request.test.ts b/packages/headless/src/features/search-and-folding/search-and-folding-request.test.ts index afc14e627d1..3c6a73dbcc5 100644 --- a/packages/headless/src/features/search-and-folding/search-and-folding-request.test.ts +++ b/packages/headless/src/features/search-and-folding/search-and-folding-request.test.ts @@ -140,12 +140,12 @@ describe('buildSearchAndFoldingLoadCollectionRequest', () => { state.configuration.analytics.enabled = true; }); - it('#visitorId is included in the request', async () => { + it('#analytics is included in the request', async () => { const request = buildSearchAndFoldingLoadCollectionRequest( state, buildMockNavigatorContextProvider()() ); - expect(request.visitorId).toBeDefined(); + expect(request.analytics).toBeDefined(); }); }); @@ -156,12 +156,12 @@ describe('buildSearchAndFoldingLoadCollectionRequest', () => { state.configuration.analytics.enabled = false; }); - it('#visitorId is not included in the request', async () => { + it('#analytics is not included in the request', async () => { const request = buildSearchAndFoldingLoadCollectionRequest( state, buildMockNavigatorContextProvider()() ); - expect(request.visitorId).toBeUndefined(); + expect(request.analytics).not.toBeDefined(); }); it('#actionsHistory is not included in the request', async () => { diff --git a/packages/headless/src/features/search-and-folding/search-and-folding-request.ts b/packages/headless/src/features/search-and-folding/search-and-folding-request.ts index 08353ff2493..67c541f0c6c 100644 --- a/packages/headless/src/features/search-and-folding/search-and-folding-request.ts +++ b/packages/headless/src/features/search-and-folding/search-and-folding-request.ts @@ -29,9 +29,6 @@ export const buildSearchAndFoldingLoadCollectionRequest = ( tab: state.configuration.analytics.originLevel2, referrer: navigatorContext.referrer, timezone: state.configuration.search.timezone, - ...(state.configuration.analytics.enabled && { - visitorId: navigatorContext.clientId, - }), ...(state.advancedSearchQueries?.aq && { aq: state.advancedSearchQueries.aq, }), diff --git a/packages/headless/src/features/search/search-request.test.ts b/packages/headless/src/features/search/search-request.test.ts index 09620be2785..cfa14d194d2 100644 --- a/packages/headless/src/features/search/search-request.test.ts +++ b/packages/headless/src/features/search/search-request.test.ts @@ -458,19 +458,19 @@ describe('search request', () => { }); }); - it('should send visitorId if analytics is enable', async () => { + it('should send analytics if analytics is enable', async () => { state.configuration.analytics.enabled = true; expect( (await buildSearchRequest(state, buildMockNavigatorContextProvider()())) - .request.visitorId + .request.analytics ).toBeDefined(); }); - it('should not send visitorId if analytics is disabled', async () => { + it('should not send analytics if analytics is disabled', async () => { state.configuration.analytics.enabled = false; expect( (await buildSearchRequest(state, buildMockNavigatorContextProvider()())) - .request.visitorId + .request.analytics ).not.toBeDefined(); }); diff --git a/packages/headless/src/features/standalone-search-box-set/standalone-search-box-set-actions.ts b/packages/headless/src/features/standalone-search-box-set/standalone-search-box-set-actions.ts index a3210c29584..7d77a96dac3 100644 --- a/packages/headless/src/features/standalone-search-box-set/standalone-search-box-set-actions.ts +++ b/packages/headless/src/features/standalone-search-box-set/standalone-search-box-set-actions.ts @@ -1,6 +1,5 @@ import {BooleanValue, StringValue} from '@coveo/bueno'; import {createAction, createAsyncThunk} from '@reduxjs/toolkit'; -import {getVisitorID} from '../../api/analytics/coveo-analytics-utils.js'; import {getSearchApiBaseUrl} from '../../api/platform-client.js'; import {ExecutionPlan} from '../../api/search/plan/plan-endpoint.js'; import {PlanRequest} from '../../api/search/plan/plan-request.js'; @@ -188,9 +187,6 @@ export const buildPlanRequest = async ( ...(state.context && {context: state.context.contextValues}), ...(state.pipeline && {pipeline: state.pipeline}), ...(state.searchHub && {searchHub: state.searchHub}), - ...(state.configuration.analytics.enabled && { - visitorId: await getVisitorID(state.configuration.analytics), - }), ...(state.configuration.analytics.enabled && state.configuration.analytics.analyticsMode === 'legacy' ? await legacyFromAnalyticsStateToAnalyticsParams( diff --git a/packages/headless/src/test/mock-result-preview-request-builder.ts b/packages/headless/src/test/mock-result-preview-request-builder.ts index 7e3bd51376d..00d05a046e6 100644 --- a/packages/headless/src/test/mock-result-preview-request-builder.ts +++ b/packages/headless/src/test/mock-result-preview-request-builder.ts @@ -13,7 +13,6 @@ export async function buildMockResultPreviewRequest( accessToken: 'access-token-xxxxx', organizationId: 'some-org-id', enableNavigation: false, - visitorId: 'visitor-id', q: 'query', requestedOutputSize: options.requestedOutputSize || 0, ...options,