diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a8722409b7..0c56602a7e0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -81,5 +81,6 @@ jobs: SFDX_AUTH_JWT_USERNAME: ${{ secrets.SFDX_AUTH_JWT_USERNAME }} SFDX_AUTH_JWT_KEY_FILE: server.key GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + working-directory: ./packages/quantic - name: Notify Docs run: npm run notify:docs diff --git a/package-lock.json b/package-lock.json index f7754501288..afdd3eb9ed2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45755,7 +45755,7 @@ }, "packages/atomic": { "name": "@coveo/atomic", - "version": "2.62.0", + "version": "2.62.1", "license": "Apache-2.0", "dependencies": { "@coveo/bueno": "0.45.8", @@ -45774,7 +45774,7 @@ }, "devDependencies": { "@babel/core": "7.24.0", - "@coveo/headless": "2.57.0", + "@coveo/headless": "2.57.1", "@coveo/release": "1.0.0", "@fullhuman/postcss-purgecss": "5.0.0", "@rollup/plugin-alias": "5.1.0", @@ -45815,7 +45815,7 @@ "node": ">=12.9.0" }, "peerDependencies": { - "@coveo/headless": "2.57.0" + "@coveo/headless": "2.57.1" } }, "packages/atomic-angular": { @@ -45830,14 +45830,14 @@ "@angular/platform-browser": "17.2.4", "@angular/platform-browser-dynamic": "17.2.4", "@angular/router": "17.2.4", - "@coveo/atomic": "2.62.0", + "@coveo/atomic": "2.62.1", "rxjs": "7.8.1" }, "devDependencies": { "@angular-devkit/build-angular": "17.2.3", "@angular/cli": "17.2.3", "@angular/compiler-cli": "17.2.4", - "@coveo/headless": "2.57.0", + "@coveo/headless": "2.57.1", "@types/jasmine": "5.1.4", "@types/node": "20.11.25", "jasmine-core": "5.1.2", @@ -45851,30 +45851,30 @@ "typescript": "5.3.3" }, "peerDependencies": { - "@coveo/headless": "2.57.0" + "@coveo/headless": "2.57.1" } }, "packages/atomic-angular/projects/atomic-angular": { "name": "@coveo/atomic-angular", - "version": "2.23.3", + "version": "2.23.4", "license": "Apache-2.0", "dependencies": { - "@coveo/atomic": "2.62.0", + "@coveo/atomic": "2.62.1", "tslib": "2.6.2" }, "peerDependencies": { "@angular/common": "14 - 17", "@angular/core": "14 - 17", - "@coveo/headless": "2.57.0" + "@coveo/headless": "2.57.1" } }, "packages/atomic-hosted-page": { "name": "@coveo/atomic-hosted-page", - "version": "0.5.32", + "version": "0.5.33", "license": "Apache-2.0", "dependencies": { "@coveo/bueno": "0.45.8", - "@coveo/headless": "2.57.0", + "@coveo/headless": "2.57.1", "@stencil/core": "4.13.0" }, "devDependencies": { @@ -45885,12 +45885,12 @@ }, "packages/atomic-react": { "name": "@coveo/atomic-react", - "version": "2.8.27", + "version": "2.8.28", "dependencies": { - "@coveo/atomic": "2.62.0" + "@coveo/atomic": "2.62.1" }, "devDependencies": { - "@coveo/headless": "2.57.0", + "@coveo/headless": "2.57.1", "@coveo/release": "1.0.0", "@rollup/plugin-commonjs": "^25.0.0", "@rollup/plugin-node-resolve": "^15.0.0", @@ -45907,7 +45907,7 @@ "rollup-plugin-polyfill-node": "^0.13.0" }, "peerDependencies": { - "@coveo/headless": "2.57.0", + "@coveo/headless": "2.57.1", "react": ">=18.0.0", "react-dom": ">=18.0.0" } @@ -45991,11 +45991,12 @@ }, "packages/headless": { "name": "@coveo/headless", - "version": "2.57.0", + "version": "2.57.1", "license": "Apache-2.0", "dependencies": { "@coveo/bueno": "0.45.8", "@coveo/relay": "0.7.4", + "@coveo/relay-event-types": "7.7.3", "@microsoft/fetch-event-source": "2.0.1", "@reduxjs/toolkit": "2.2.1", "abab": "2.0.6", @@ -46010,7 +46011,6 @@ "undici": "5.28.3" }, "devDependencies": { - "@coveo/relay-event-types": "7.7.3", "@coveo/release": "1.0.0", "@microsoft/api-extractor": "7.42.3", "@microsoft/api-extractor-model": "7.28.13", @@ -46032,10 +46032,10 @@ }, "packages/headless-react": { "name": "@coveo/headless-react", - "version": "0.2.32", + "version": "0.2.33", "license": "Apache-2.0", "dependencies": { - "@coveo/headless": "2.57.0" + "@coveo/headless": "2.57.1" }, "devDependencies": { "@coveo/release": "1.0.0", @@ -46105,8 +46105,7 @@ "packages/headless/node_modules/@coveo/relay-event-types": { "version": "7.7.3", "resolved": "https://registry.npmjs.org/@coveo/relay-event-types/-/relay-event-types-7.7.3.tgz", - "integrity": "sha512-MF3PRrDJZDAo5dYduU28zVRDmANrZ5nylzqpnk5IxoDx5OH4AQHtUNVPe4DtP3LyBr/oNKD+xfdZVyaGB7EvSg==", - "dev": true + "integrity": "sha512-MF3PRrDJZDAo5dYduU28zVRDmANrZ5nylzqpnk5IxoDx5OH4AQHtUNVPe4DtP3LyBr/oNKD+xfdZVyaGB7EvSg==" }, "packages/headless/node_modules/@reduxjs/toolkit": { "version": "2.2.1", @@ -46165,12 +46164,12 @@ }, "packages/quantic": { "name": "@coveo/quantic", - "version": "2.46.11", + "version": "2.46.12", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@coveo/bueno": "0.45.8", - "@coveo/headless": "2.57.0" + "@coveo/headless": "2.57.1" }, "devDependencies": { "@ckeditor/jsdoc-plugins": "39.6.2", @@ -46305,7 +46304,7 @@ "@angular/platform-browser": "17.2.4", "@angular/platform-browser-dynamic": "17.2.4", "@angular/router": "17.2.4", - "@coveo/atomic-angular": "2.23.3", + "@coveo/atomic-angular": "2.23.4", "rxjs": "7.8.1", "tslib": "2.6.2", "zone.js": "0.14.4" @@ -46329,9 +46328,9 @@ "name": "@coveo/atomic-next-samples", "version": "0.0.0", "dependencies": { - "@coveo/atomic": "2.62.0", - "@coveo/atomic-react": "2.8.27", - "@coveo/headless": "2.57.0", + "@coveo/atomic": "2.62.1", + "@coveo/atomic-react": "2.8.28", + "@coveo/headless": "2.57.1", "next": "14.1.3", "react": "18.2.0", "react-dom": "18.2.0" @@ -46350,9 +46349,9 @@ "name": "@coveo/atomic-react-samples", "version": "0.0.0", "dependencies": { - "@coveo/atomic": "2.62.0", - "@coveo/atomic-react": "2.8.27", - "@coveo/headless": "2.57.0", + "@coveo/atomic": "2.62.1", + "@coveo/atomic-react": "2.8.28", + "@coveo/headless": "2.57.1", "react": "18.2.0", "react-dom": "18.2.0" }, @@ -46467,7 +46466,7 @@ "version": "0.0.0", "dependencies": { "@coveo/auth": "1.11.16", - "@coveo/headless": "2.57.0", + "@coveo/headless": "2.57.1", "@testing-library/jest-dom": "6.4.2", "@testing-library/react": "13.3.0", "@testing-library/user-event": "14.5.2", @@ -49795,8 +49794,8 @@ "name": "@coveo/headless-ssr-samples-common", "version": "0.0.0", "dependencies": { - "@coveo/headless": "2.57.0", - "@coveo/headless-react": "0.2.32", + "@coveo/headless": "2.57.1", + "@coveo/headless-react": "0.2.33", "next": "14.1.3", "react": "18.2.0", "react-dom": "18.2.0" @@ -49877,10 +49876,10 @@ "version": "0.1.0", "dependencies": { "@babel/standalone": "7.24.0", - "@coveo/atomic": "2.62.0", - "@coveo/atomic-hosted-page": "0.5.32", - "@coveo/atomic-react": "2.8.27", - "@coveo/headless": "2.57.0", + "@coveo/atomic": "2.62.1", + "@coveo/atomic-hosted-page": "0.5.33", + "@coveo/atomic-react": "2.8.28", + "@coveo/headless": "2.57.1", "react": "18.2.0", "react-dom": "18.2.0" }, @@ -49897,8 +49896,8 @@ "name": "@coveo/atomic-stencil-samples", "version": "0.0.0", "dependencies": { - "@coveo/atomic": "2.62.0", - "@coveo/headless": "2.57.0", + "@coveo/atomic": "2.62.1", + "@coveo/headless": "2.57.1", "@stencil/core": "4.13.0", "stencil-router-v2": "0.6.0" }, @@ -49914,7 +49913,7 @@ "name": "@coveo/atomic-vuejs-samples", "version": "0.0.0", "dependencies": { - "@coveo/atomic": "2.62.0", + "@coveo/atomic": "2.62.1", "vue": "^3.4.15" }, "devDependencies": { diff --git a/packages/atomic-angular/package.json b/packages/atomic-angular/package.json index 917076eb7fb..e32bd081b9a 100644 --- a/packages/atomic-angular/package.json +++ b/packages/atomic-angular/package.json @@ -22,17 +22,17 @@ "@angular/platform-browser": "17.2.4", "@angular/platform-browser-dynamic": "17.2.4", "@angular/router": "17.2.4", - "@coveo/atomic": "2.62.0", + "@coveo/atomic": "2.62.1", "rxjs": "7.8.1" }, "peerDependencies": { - "@coveo/headless": "2.57.0" + "@coveo/headless": "2.57.1" }, "devDependencies": { "@angular-devkit/build-angular": "17.2.3", "@angular/cli": "17.2.3", "@angular/compiler-cli": "17.2.4", - "@coveo/headless": "2.57.0", + "@coveo/headless": "2.57.1", "@types/jasmine": "5.1.4", "@types/node": "20.11.25", "jasmine-core": "5.1.2", diff --git a/packages/atomic-angular/projects/atomic-angular/package.json b/packages/atomic-angular/projects/atomic-angular/package.json index 83378d305c4..b2b8b8a294b 100644 --- a/packages/atomic-angular/projects/atomic-angular/package.json +++ b/packages/atomic-angular/projects/atomic-angular/package.json @@ -1,6 +1,6 @@ { "name": "@coveo/atomic-angular", - "version": "2.23.3", + "version": "2.23.4", "license": "Apache-2.0", "repository": { "url": "https://github.com/coveo/ui-kit" @@ -8,10 +8,10 @@ "peerDependencies": { "@angular/common": "14 - 17", "@angular/core": "14 - 17", - "@coveo/headless": "2.57.0" + "@coveo/headless": "2.57.1" }, "dependencies": { - "@coveo/atomic": "2.62.0", + "@coveo/atomic": "2.62.1", "tslib": "2.6.2" } } diff --git a/packages/atomic-hosted-page/package.json b/packages/atomic-hosted-page/package.json index 12ac43667e6..29def0615dd 100644 --- a/packages/atomic-hosted-page/package.json +++ b/packages/atomic-hosted-page/package.json @@ -1,7 +1,7 @@ { "name": "@coveo/atomic-hosted-page", "description": "Web Component used to inject a Coveo Hosted Search Page in the DOM.", - "version": "0.5.32", + "version": "0.5.33", "repository": { "type": "git", "url": "git+https://github.com/coveo/ui-kit.git", @@ -34,7 +34,7 @@ }, "dependencies": { "@coveo/bueno": "0.45.8", - "@coveo/headless": "2.57.0", + "@coveo/headless": "2.57.1", "@stencil/core": "4.13.0" }, "devDependencies": { diff --git a/packages/atomic-react/package.json b/packages/atomic-react/package.json index 9eb2e2cc4ed..0d42f58616c 100644 --- a/packages/atomic-react/package.json +++ b/packages/atomic-react/package.json @@ -1,7 +1,7 @@ { "name": "@coveo/atomic-react", "sideEffects": false, - "version": "2.8.27", + "version": "2.8.28", "description": "React specific wrapper for the Atomic component library", "repository": { "type": "git", @@ -30,11 +30,11 @@ "recommendation/" ], "dependencies": { - "@coveo/atomic": "2.62.0" + "@coveo/atomic": "2.62.1" }, "devDependencies": { "@coveo/release": "1.0.0", - "@coveo/headless": "2.57.0", + "@coveo/headless": "2.57.1", "@rollup/plugin-commonjs": "^25.0.0", "@rollup/plugin-node-resolve": "^15.0.0", "@rollup/plugin-replace": "^5.0.0", @@ -50,7 +50,7 @@ "@rollup/plugin-terser": "0.4.4" }, "peerDependencies": { - "@coveo/headless": "2.57.0", + "@coveo/headless": "2.57.1", "react": ">=18.0.0", "react-dom": ">=18.0.0" } diff --git a/packages/atomic/CHANGELOG.md b/packages/atomic/CHANGELOG.md index 4a045f9db60..beea89ebc5b 100644 --- a/packages/atomic/CHANGELOG.md +++ b/packages/atomic/CHANGELOG.md @@ -1,3 +1,5 @@ +## 2.62.1 (2024-03-20) + # 2.62.0 (2024-03-20) ### Bug Fixes diff --git a/packages/atomic/package.json b/packages/atomic/package.json index a615ea40c50..11b326af2d7 100644 --- a/packages/atomic/package.json +++ b/packages/atomic/package.json @@ -1,6 +1,6 @@ { "name": "@coveo/atomic", - "version": "2.62.0", + "version": "2.62.1", "description": "A web-component library for building modern UIs interfacing with the Coveo platform", "homepage": "https://docs.coveo.com/en/atomic/latest/", "repository": { @@ -66,7 +66,7 @@ "devDependencies": { "@babel/core": "7.24.0", "@coveo/release": "1.0.0", - "@coveo/headless": "2.57.0", + "@coveo/headless": "2.57.1", "@fullhuman/postcss-purgecss": "5.0.0", "@rollup/plugin-alias": "5.1.0", "@rollup/plugin-replace": "5.0.5", @@ -103,7 +103,7 @@ "typescript": "5.3.3" }, "peerDependencies": { - "@coveo/headless": "2.57.0" + "@coveo/headless": "2.57.1" }, "license": "Apache-2.0", "engines": { diff --git a/packages/atomic/src/components.d.ts b/packages/atomic/src/components.d.ts index de631365264..650fa12fd03 100644 --- a/packages/atomic/src/components.d.ts +++ b/packages/atomic/src/components.d.ts @@ -163,7 +163,7 @@ export namespace Components { */ "numberOfValues": number; /** - * The sort criterion to apply to the returned facet values. Possible values are 'alphanumeric' and 'occurrences'. + * The sort criterion to apply to the returned facet values. Possible values are 'alphanumeric' and 'occurrences'. For this criterion to apply to the top-layer facet values, disable [facet value ordering](https://docs.coveo.com/en/l1qf4156/#facet-value-ordering) in your Dynamic Navigation Experience configuration. */ "sortCriteria": CategoryFacetSortCriterion; /** @@ -4409,7 +4409,7 @@ declare namespace LocalJSX { */ "numberOfValues"?: number; /** - * The sort criterion to apply to the returned facet values. Possible values are 'alphanumeric' and 'occurrences'. + * The sort criterion to apply to the returned facet values. Possible values are 'alphanumeric' and 'occurrences'. For this criterion to apply to the top-layer facet values, disable [facet value ordering](https://docs.coveo.com/en/l1qf4156/#facet-value-ordering) in your Dynamic Navigation Experience configuration. */ "sortCriteria"?: CategoryFacetSortCriterion; /** diff --git a/packages/atomic/src/components/search/facets/atomic-category-facet/atomic-category-facet.tsx b/packages/atomic/src/components/search/facets/atomic-category-facet/atomic-category-facet.tsx index 69b09c2c2c7..7f7e1cb1501 100644 --- a/packages/atomic/src/components/search/facets/atomic-category-facet/atomic-category-facet.tsx +++ b/packages/atomic/src/components/search/facets/atomic-category-facet/atomic-category-facet.tsx @@ -141,6 +141,9 @@ export class AtomicCategoryFacet /** * The sort criterion to apply to the returned facet values. * Possible values are 'alphanumeric' and 'occurrences'. + * For this criterion to apply to the top-layer facet values, disable + * [facet value ordering](https://docs.coveo.com/en/l1qf4156/#facet-value-ordering) + * in your Dynamic Navigation Experience configuration. */ // TODO: add automatic (occurrences when not expanded, alphanumeric when expanded) @Prop({reflect: true}) public sortCriteria: CategoryFacetSortCriterion = diff --git a/packages/headless-react/package.json b/packages/headless-react/package.json index cf9a0208ac7..dea11ffa0c2 100644 --- a/packages/headless-react/package.json +++ b/packages/headless-react/package.json @@ -1,6 +1,6 @@ { "name": "@coveo/headless-react", - "version": "0.2.32", + "version": "0.2.33", "description": "React utilities for SSR (Server Side Rendering) with headless", "homepage": "https://docs.coveo.com/en/headless/latest/", "repository": { @@ -35,7 +35,7 @@ "promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest" }, "dependencies": { - "@coveo/headless": "2.57.0" + "@coveo/headless": "2.57.1" }, "devDependencies": { "@coveo/release": "1.0.0", diff --git a/packages/headless/CHANGELOG.md b/packages/headless/CHANGELOG.md index 249e242b76d..46f72940819 100644 --- a/packages/headless/CHANGELOG.md +++ b/packages/headless/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.57.1 (2024-03-20) + +### Bug Fixes + +- **headless:** move relay-event-types to prd dep ([#3732](https://github.com/coveo/ui-kit/issues/3732)) ([dd341bb](https://github.com/coveo/ui-kit/commits/dd341bbcb880cfae8663b9c81ed5026781d10425)), closes [#3730](https://github.com/coveo/ui-kit/issues/3730) + # 2.57.0 (2024-03-20) ### Features diff --git a/packages/headless/package.json b/packages/headless/package.json index 1aec3682484..70f38928168 100644 --- a/packages/headless/package.json +++ b/packages/headless/package.json @@ -14,7 +14,7 @@ }, "types": "./dist/definitions/index.d.ts", "license": "Apache-2.0", - "version": "2.57.0", + "version": "2.57.1", "files": [ "dist/", "recommendation/", @@ -52,6 +52,7 @@ "dependencies": { "@coveo/bueno": "0.45.8", "@coveo/relay": "0.7.4", + "@coveo/relay-event-types": "7.7.3", "@microsoft/fetch-event-source": "2.0.1", "@reduxjs/toolkit": "2.2.1", "abab": "2.0.6", @@ -66,7 +67,6 @@ "undici": "5.28.3" }, "devDependencies": { - "@coveo/relay-event-types": "7.7.3", "@coveo/release": "1.0.0", "@microsoft/api-extractor": "7.42.3", "@microsoft/api-extractor-model": "7.28.13", diff --git a/packages/headless/src/api/commerce/commerce-api-client.ts b/packages/headless/src/api/commerce/commerce-api-client.ts index bcc8324bc19..61179b540ae 100644 --- a/packages/headless/src/api/commerce/commerce-api-client.ts +++ b/packages/headless/src/api/commerce/commerce-api-client.ts @@ -46,6 +46,12 @@ export interface CommerceAPISuccessResponse { success: T; } +export const isErrorResponse = ( + r: CommerceAPIResponse +): r is CommerceAPIErrorResponse => { + return (r as CommerceAPIErrorResponse).error !== undefined; +}; + export class CommerceAPIClient implements CommerceFacetSearchAPIClient { constructor(private options: CommerceAPIClientOptions) {} diff --git a/packages/headless/src/api/service/insight/query/query-request.ts b/packages/headless/src/api/service/insight/query/query-request.ts index 925df8d5731..3e365a326d8 100644 --- a/packages/headless/src/api/service/insight/query/query-request.ts +++ b/packages/headless/src/api/service/insight/query/query-request.ts @@ -4,6 +4,7 @@ import { NumberOfResultsParam, } from '../../../platform-service-params'; import { + AnalyticsParam, ConstantQueryParam, EnableDidYouMeanParam, FacetsParam, @@ -22,6 +23,7 @@ import { import {InsightQuerySuggestRequest} from '../query-suggest/query-suggest-request'; export type InsightQueryRequest = InsightParam & + AnalyticsParam & CaseContextParam & FacetsParam & QueryParam & diff --git a/packages/headless/src/commerce.index.ts b/packages/headless/src/commerce.index.ts index 63f9ab0a759..49e0e1e64fa 100644 --- a/packages/headless/src/commerce.index.ts +++ b/packages/headless/src/commerce.index.ts @@ -24,7 +24,6 @@ export type {ProductRecommendation} from './api/search/search/product-recommenda // Actions export * from './features/commerce/product-listing/product-listing-actions-loader'; export * from './features/configuration/configuration-actions-loader'; -export * from './features/analytics/search-analytics-actions-loader'; // Controllers export type { diff --git a/packages/headless/src/features/analytics/analytics-utils.ts b/packages/headless/src/features/analytics/analytics-utils.ts index b276eadde12..8330e2f3b75 100644 --- a/packages/headless/src/features/analytics/analytics-utils.ts +++ b/packages/headless/src/features/analytics/analytics-utils.ts @@ -548,20 +548,23 @@ type LogFunction = ( state: StateNeeded ) => Promise | void | null; -const fromLogToLegacyBuilder = - ( +const fromLogToLegacyBuilderFactory = (actionCause: string) => { + const fromLogToLegacyBuilder = ( log: ( client: Client, state: StateNeeded ) => Promise | void | null - ): ((client: Client, state: StateNeeded) => Promise) => - (client, state) => - Promise.resolve({ - description: {actionCause: 'caseAssist'}, - log: async (_metadata: {searchUID: string}) => { - log(client, state); - }, - }); + ): ((client: Client, state: StateNeeded) => Promise) => { + return (client, state) => + Promise.resolve({ + description: {actionCause: actionCause}, + log: async (_metadata: {searchUID: string}) => { + log(client, state); + }, + }); + }; + return fromLogToLegacyBuilder; +}; export const makeAnalyticsAction = makeAnalyticsActionFactory< StateNeededBySearchAnalyticsProvider, @@ -578,17 +581,24 @@ export const makeCaseAssistAnalyticsAction = makeAnalyticsActionFactory< LogFunction >( configureCaseAssistAnalytics, - fromLogToLegacyBuilder, + fromLogToLegacyBuilderFactory('caseAssist'), CaseAssistAnalyticsProvider ); -export const makeInsightAnalyticsAction = makeAnalyticsActionFactory< - StateNeededByInsightAnalyticsProvider, - StateNeededByInsightAnalyticsProvider, - CoveoInsightClient, - InsightAnalyticsProvider, - LogFunction ->(configureInsightAnalytics, fromLogToLegacyBuilder, InsightAnalyticsProvider); +export const makeInsightAnalyticsActionFactory = (actionCause: string) => { + const makeInsightAnalyticsAction = makeAnalyticsActionFactory< + StateNeededByInsightAnalyticsProvider, + StateNeededByInsightAnalyticsProvider, + CoveoInsightClient, + InsightAnalyticsProvider, + LogFunction + >( + configureInsightAnalytics, + fromLogToLegacyBuilderFactory(actionCause), + InsightAnalyticsProvider + ); + return makeInsightAnalyticsAction; +}; export const makeCommerceAnalyticsAction = makeAnalyticsActionFactory< StateNeededByCommerceAnalyticsProvider, diff --git a/packages/headless/src/features/analytics/search-action-cause.ts b/packages/headless/src/features/analytics/search-action-cause.ts index b1b0cc4d474..21948a83e82 100644 --- a/packages/headless/src/features/analytics/search-action-cause.ts +++ b/packages/headless/src/features/analytics/search-action-cause.ts @@ -316,4 +316,40 @@ export enum SearchPageEvents { historyForward = 'historyForward', historyBackward = 'historyBackward', + /** + * Identifies the search event that gets logged when the query context is updated as a result of updating one of the case context fields. + */ + contextChanged = 'contextChanged', + /** + * Identifies the search event that gets logged when a user clicks a rephrase button in a generated answer. + */ + rephraseGeneratedAnswer = 'rephraseGeneratedAnswer', + /** + * Identifies the custom event that gets logged when a user hovers over a generated answer citation. + */ + generatedAnswerSourceHover = 'generatedAnswerSourceHover', + /** + * Identifies the custom event that gets logged when a user submits feedback on a generated answer. + */ + generatedAnswerFeedbackSubmit = 'generatedAnswerFeedbackSubmit', + /** + * Identifies the custom event that gets logged when a user deactivates the RGA feature. + */ + generatedAnswerHideAnswers = 'generatedAnswerHideAnswers', + /** + * Identifies the custom event that gets logged when a user activates the RGA feature. + */ + generatedAnswerShowAnswers = 'generatedAnswerShowAnswers', + /** + * Identifies the custom event that gets logged when a user clicks the copy to clipboard button of a generated answer. + */ + generatedAnswerCopyToClipboard = 'generatedAnswerCopyToClipboard', + /** + * Identifies the custom event that gets logged when the user opens the full search page from the insight panel. + */ + expandToFullUI = 'expandToFullUI', + /** + * Identifies the custom event that gets logged when the user clicks the create article button. + */ + createArticle = 'createArticle', } diff --git a/packages/headless/src/features/attached-results/attached-results-analytics-actions.ts b/packages/headless/src/features/attached-results/attached-results-analytics-actions.ts index 0377755cde3..e5f93575cdb 100644 --- a/packages/headless/src/features/attached-results/attached-results-analytics-actions.ts +++ b/packages/headless/src/features/attached-results/attached-results-analytics-actions.ts @@ -3,15 +3,16 @@ import {Result} from '../../api/search/search/result'; import { analyticsEventItemMetadata, documentIdentifier, - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, partialDocumentInformation, validateResultPayload, } from '../analytics/analytics-utils'; import {analyticsEventCaseContext} from '../analytics/insight-analytics-utils'; +import {SearchPageEvents} from '../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../case-context/case-context-state'; export const logCaseAttach = (result: Result) => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory(SearchPageEvents.caseAttach)({ prefix: 'insight/caseAttach', __legacy__getBuilder: (client, state) => { validateResultPayload(result); @@ -38,7 +39,7 @@ export const logCaseAttach = (result: Result) => }); export const logCaseDetach = (result: Result) => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory(SearchPageEvents.caseDetach)({ prefix: 'insight/caseDetach', __legacy__getBuilder: (client, state) => { return client.logCaseDetach( diff --git a/packages/headless/src/features/commerce/product-listing/product-listing-actions.ts b/packages/headless/src/features/commerce/product-listing/product-listing-actions.ts index 657b017b672..4360a76e777 100644 --- a/packages/headless/src/features/commerce/product-listing/product-listing-actions.ts +++ b/packages/headless/src/features/commerce/product-listing/product-listing-actions.ts @@ -1,6 +1,8 @@ import {createAsyncThunk} from '@reduxjs/toolkit'; -import {AsyncThunkCommerceOptions} from '../../../api/commerce/commerce-api-client'; -import {isErrorResponse} from '../../../api/search/search-api-client'; +import { + AsyncThunkCommerceOptions, + isErrorResponse, +} from '../../../api/commerce/commerce-api-client'; import { CartSection, CommerceContextSection, diff --git a/packages/headless/src/features/commerce/query-suggest/query-suggest-actions.ts b/packages/headless/src/features/commerce/query-suggest/query-suggest-actions.ts index 231f8168df1..8641b737e5d 100644 --- a/packages/headless/src/features/commerce/query-suggest/query-suggest-actions.ts +++ b/packages/headless/src/features/commerce/query-suggest/query-suggest-actions.ts @@ -1,9 +1,11 @@ import {createAsyncThunk} from '@reduxjs/toolkit'; import {getVisitorID} from '../../../api/analytics/coveo-analytics-utils'; -import {AsyncThunkCommerceOptions} from '../../../api/commerce/commerce-api-client'; +import { + AsyncThunkCommerceOptions, + isErrorResponse, +} from '../../../api/commerce/commerce-api-client'; import {QuerySuggestRequest} from '../../../api/commerce/search/query-suggest/query-suggest-request'; import {QuerySuggestSuccessResponse} from '../../../api/commerce/search/query-suggest/query-suggest-response'; -import {isErrorResponse} from '../../../api/search/search-api-client'; import { CartSection, CommerceContextSection, diff --git a/packages/headless/src/features/commerce/search/search-actions.ts b/packages/headless/src/features/commerce/search/search-actions.ts index 5c44142afc0..fc2e4d6307e 100644 --- a/packages/headless/src/features/commerce/search/search-actions.ts +++ b/packages/headless/src/features/commerce/search/search-actions.ts @@ -1,6 +1,8 @@ import {createAsyncThunk} from '@reduxjs/toolkit'; -import {AsyncThunkCommerceOptions} from '../../../api/commerce/commerce-api-client'; -import {isErrorResponse} from '../../../api/search/search-api-client'; +import { + AsyncThunkCommerceOptions, + isErrorResponse, +} from '../../../api/commerce/commerce-api-client'; import {CommerceQuerySection} from '../../../state/state-sections'; import {logQueryError} from '../../search/search-analytics-actions'; import { diff --git a/packages/headless/src/features/did-you-mean/did-you-mean-insight-analytics-actions.ts b/packages/headless/src/features/did-you-mean/did-you-mean-insight-analytics-actions.ts index 3836234fb9b..1bb8aff05ad 100644 --- a/packages/headless/src/features/did-you-mean/did-you-mean-insight-analytics-actions.ts +++ b/packages/headless/src/features/did-you-mean/did-you-mean-insight-analytics-actions.ts @@ -1,18 +1,21 @@ import { InsightAction, - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, } from '../analytics/analytics-utils'; +import {SearchPageEvents} from '../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../case-context/case-context-state'; export const logDidYouMeanClick = (): InsightAction => - makeInsightAnalyticsAction('analytics/didyoumean/click', (client, state) => - client.logDidYouMeanClick( - getCaseContextAnalyticsMetadata(state.insightCaseContext) - ) + makeInsightAnalyticsActionFactory(SearchPageEvents.didyoumeanClick)( + 'analytics/didyoumean/click', + (client, state) => + client.logDidYouMeanClick( + getCaseContextAnalyticsMetadata(state.insightCaseContext) + ) ); export const logDidYouMeanAutomatic = (): InsightAction => - makeInsightAnalyticsAction( + makeInsightAnalyticsActionFactory(SearchPageEvents.didyoumeanAutomatic)( 'analytics/didyoumean/automatic', (client, state) => client.logDidYouMeanAutomatic( diff --git a/packages/headless/src/features/facets/category-facet-set/category-facet-set-insight-analytics-actions.ts b/packages/headless/src/features/facets/category-facet-set/category-facet-set-insight-analytics-actions.ts index 35c399f2fc2..a85fb3a9952 100644 --- a/packages/headless/src/features/facets/category-facet-set/category-facet-set-insight-analytics-actions.ts +++ b/packages/headless/src/features/facets/category-facet-set/category-facet-set-insight-analytics-actions.ts @@ -7,8 +7,9 @@ import { } from '../../../utils/validate-payload'; import { InsightAction, - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, } from '../../analytics/analytics-utils'; +import {SearchPageEvents} from '../../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../../case-context/case-context-state'; import {facetIdDefinition} from '../generic/facet-actions-validation'; import {LogCategoryFacetBreadcrumbActionCreatorPayload} from './category-facet-set-analytics-actions'; @@ -42,7 +43,7 @@ const getCategoryFacetMetadata = ( export const logCategoryFacetBreadcrumb = ( payload: LogCategoryFacetBreadcrumbActionCreatorPayload ): InsightAction => - makeInsightAnalyticsAction( + makeInsightAnalyticsActionFactory(SearchPageEvents.breadcrumbFacet)( 'analytics/categoryFacet/breadcrumb', (client, state) => { validatePayload(payload, categoryFacetBreadcrumbPayloadDefinition); diff --git a/packages/headless/src/features/facets/facet-set/facet-set-insight-analytics-actions.ts b/packages/headless/src/features/facets/facet-set/facet-set-insight-analytics-actions.ts index ac25592136a..a542ec84913 100644 --- a/packages/headless/src/features/facets/facet-set/facet-set-insight-analytics-actions.ts +++ b/packages/headless/src/features/facets/facet-set/facet-set-insight-analytics-actions.ts @@ -5,8 +5,9 @@ import { } from '../../../utils/validate-payload'; import { InsightAction, - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, } from '../../analytics/analytics-utils'; +import {SearchPageEvents} from '../../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../../case-context/case-context-state'; import {facetIdDefinition} from '../generic/facet-actions-validation'; import {RangeFacetSortCriterion} from '../range-facets/generic/interfaces/request'; @@ -19,25 +20,37 @@ import { import {FacetSortCriterion} from './interfaces/request'; export const logFacetShowMore = (facetId: string): InsightAction => - makeInsightAnalyticsAction('analytics/facet/showMore', (client, state) => { - validatePayload(facetId, facetIdDefinition); - const metadata = { - ...buildFacetBaseMetadata(facetId, getStateNeededForFacetMetadata(state)), - ...getCaseContextAnalyticsMetadata(state.insightCaseContext), - }; - return client.logFacetShowMore(metadata); - }); + makeInsightAnalyticsActionFactory(SearchPageEvents.facetShowMore)( + 'analytics/facet/showMore', + (client, state) => { + validatePayload(facetId, facetIdDefinition); + const metadata = { + ...buildFacetBaseMetadata( + facetId, + getStateNeededForFacetMetadata(state) + ), + ...getCaseContextAnalyticsMetadata(state.insightCaseContext), + }; + return client.logFacetShowMore(metadata); + } + ); export const logFacetShowLess = (facetId: string): InsightAction => - makeInsightAnalyticsAction('analytics/facet/showLess', (client, state) => { - validatePayload(facetId, facetIdDefinition); - const metadata = { - ...buildFacetBaseMetadata(facetId, getStateNeededForFacetMetadata(state)), - ...getCaseContextAnalyticsMetadata(state.insightCaseContext), - }; - - return client.logFacetShowLess(metadata); - }); + makeInsightAnalyticsActionFactory(SearchPageEvents.facetShowLess)( + 'analytics/facet/showLess', + (client, state) => { + validatePayload(facetId, facetIdDefinition); + const metadata = { + ...buildFacetBaseMetadata( + facetId, + getStateNeededForFacetMetadata(state) + ), + ...getCaseContextAnalyticsMetadata(state.insightCaseContext), + }; + + return client.logFacetShowLess(metadata); + } + ); export interface LogFacetUpdateSortActionCreatorPayload { /** @@ -54,39 +67,45 @@ export interface LogFacetUpdateSortActionCreatorPayload { export const logFacetUpdateSort = ( payload: LogFacetUpdateSortActionCreatorPayload ): InsightAction => - makeInsightAnalyticsAction('analytics/facet/sortChange', (client, state) => { - validatePayload(payload, { - facetId: facetIdDefinition, - sortCriterion: new Value({ - required: true, - }), - }); - - const {facetId, sortCriterion} = payload; - const stateForAnalytics = getStateNeededForFacetMetadata(state); - - const base = buildFacetBaseMetadata(facetId, stateForAnalytics); - const metadata = { - ...base, - criteria: sortCriterion, - ...getCaseContextAnalyticsMetadata(state.insightCaseContext), - }; - - return client.logFacetUpdateSort(metadata); - }); + makeInsightAnalyticsActionFactory(SearchPageEvents.facetUpdateSort)( + 'analytics/facet/sortChange', + (client, state) => { + validatePayload(payload, { + facetId: facetIdDefinition, + sortCriterion: new Value({ + required: true, + }), + }); + + const {facetId, sortCriterion} = payload; + const stateForAnalytics = getStateNeededForFacetMetadata(state); + + const base = buildFacetBaseMetadata(facetId, stateForAnalytics); + const metadata = { + ...base, + criteria: sortCriterion, + ...getCaseContextAnalyticsMetadata(state.insightCaseContext), + }; + + return client.logFacetUpdateSort(metadata); + } + ); export const logFacetClearAll = (facetId: string): InsightAction => - makeInsightAnalyticsAction('analytics/facet/reset', (client, state) => { - validatePayload(facetId, facetIdDefinition); + makeInsightAnalyticsActionFactory(SearchPageEvents.facetClearAll)( + 'analytics/facet/reset', + (client, state) => { + validatePayload(facetId, facetIdDefinition); - const stateForAnalytics = getStateNeededForFacetMetadata(state); - const metadata = { - ...buildFacetBaseMetadata(facetId, stateForAnalytics), - ...getCaseContextAnalyticsMetadata(state.insightCaseContext), - }; + const stateForAnalytics = getStateNeededForFacetMetadata(state); + const metadata = { + ...buildFacetBaseMetadata(facetId, stateForAnalytics), + ...getCaseContextAnalyticsMetadata(state.insightCaseContext), + }; - return client.logFacetClearAll(metadata); - }); + return client.logFacetClearAll(metadata); + } + ); export interface LogFacetSelectActionCreatorPayload { /** @@ -103,19 +122,22 @@ export interface LogFacetSelectActionCreatorPayload { export const logFacetSelect = ( payload: LogFacetSelectActionCreatorPayload ): InsightAction => - makeInsightAnalyticsAction('analytics/facet/select', (client, state) => { - validatePayload(payload, { - facetId: facetIdDefinition, - facetValue: requiredNonEmptyString, - }); - const stateForAnalytics = getStateNeededForFacetMetadata(state); - const metadata = { - ...buildFacetSelectionChangeMetadata(payload, stateForAnalytics), - ...getCaseContextAnalyticsMetadata(state.insightCaseContext), - }; - - return client.logFacetSelect(metadata); - }); + makeInsightAnalyticsActionFactory(SearchPageEvents.facetSelect)( + 'analytics/facet/select', + (client, state) => { + validatePayload(payload, { + facetId: facetIdDefinition, + facetValue: requiredNonEmptyString, + }); + const stateForAnalytics = getStateNeededForFacetMetadata(state); + const metadata = { + ...buildFacetSelectionChangeMetadata(payload, stateForAnalytics), + ...getCaseContextAnalyticsMetadata(state.insightCaseContext), + }; + + return client.logFacetSelect(metadata); + } + ); export interface LogFacetDeselectActionCreatorPayload { /** @@ -132,35 +154,41 @@ export interface LogFacetDeselectActionCreatorPayload { export const logFacetDeselect = ( payload: LogFacetDeselectActionCreatorPayload ): InsightAction => - makeInsightAnalyticsAction('analytics/facet/deselect', (client, state) => { - validatePayload(payload, { - facetId: facetIdDefinition, - facetValue: requiredNonEmptyString, - }); - const stateForAnalytics = getStateNeededForFacetMetadata(state); - const metadata = { - ...buildFacetSelectionChangeMetadata(payload, stateForAnalytics), - ...getCaseContextAnalyticsMetadata(state.insightCaseContext), - }; - - return client.logFacetDeselect(metadata); - }); + makeInsightAnalyticsActionFactory(SearchPageEvents.facetDeselect)( + 'analytics/facet/deselect', + (client, state) => { + validatePayload(payload, { + facetId: facetIdDefinition, + facetValue: requiredNonEmptyString, + }); + const stateForAnalytics = getStateNeededForFacetMetadata(state); + const metadata = { + ...buildFacetSelectionChangeMetadata(payload, stateForAnalytics), + ...getCaseContextAnalyticsMetadata(state.insightCaseContext), + }; + + return client.logFacetDeselect(metadata); + } + ); export const logFacetBreadcrumb = ( payload: LogFacetBreadcrumbActionCreatorPayload ): InsightAction => - makeInsightAnalyticsAction('analytics/facet/breadcrumb', (client, state) => { - validatePayload(payload, { - facetId: facetIdDefinition, - facetValue: requiredNonEmptyString, - }); - const metadata = { - ...buildFacetSelectionChangeMetadata( - payload, - getStateNeededForFacetMetadata(state) - ), - ...getCaseContextAnalyticsMetadata(state.insightCaseContext), - }; - - return client.logBreadcrumbFacet(metadata); - }); + makeInsightAnalyticsActionFactory(SearchPageEvents.breadcrumbFacet)( + 'analytics/facet/breadcrumb', + (client, state) => { + validatePayload(payload, { + facetId: facetIdDefinition, + facetValue: requiredNonEmptyString, + }); + const metadata = { + ...buildFacetSelectionChangeMetadata( + payload, + getStateNeededForFacetMetadata(state) + ), + ...getCaseContextAnalyticsMetadata(state.insightCaseContext), + }; + + return client.logBreadcrumbFacet(metadata); + } + ); diff --git a/packages/headless/src/features/facets/generic/facet-generic-insight-analytics-actions.ts b/packages/headless/src/features/facets/generic/facet-generic-insight-analytics-actions.ts index c35131c1683..4e2f9677110 100644 --- a/packages/headless/src/features/facets/generic/facet-generic-insight-analytics-actions.ts +++ b/packages/headless/src/features/facets/generic/facet-generic-insight-analytics-actions.ts @@ -1,11 +1,12 @@ import { InsightAction, - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, } from '../../analytics/analytics-utils'; +import {SearchPageEvents} from '../../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../../case-context/case-context-state'; export const logClearBreadcrumbs = (): InsightAction => - makeInsightAnalyticsAction( + makeInsightAnalyticsActionFactory(SearchPageEvents.breadcrumbResetAll)( 'analytics/facet/deselectAllBreadcrumbs', (client, state) => { return client.logBreadcrumbResetAll( diff --git a/packages/headless/src/features/facets/range-facets/date-facet-set/date-facet-insight-analytics-actions.ts b/packages/headless/src/features/facets/range-facets/date-facet-set/date-facet-insight-analytics-actions.ts index 254b34c75d8..52b9dac3d6b 100644 --- a/packages/headless/src/features/facets/range-facets/date-facet-set/date-facet-insight-analytics-actions.ts +++ b/packages/headless/src/features/facets/range-facets/date-facet-set/date-facet-insight-analytics-actions.ts @@ -1,8 +1,9 @@ import {validatePayload} from '../../../../utils/validate-payload'; import { InsightAction, - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, } from '../../../analytics/analytics-utils'; +import {SearchPageEvents} from '../../../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../../../case-context/case-context-state'; import {getRangeFacetMetadata} from '../generic/range-facet-analytics-actions'; import {rangeFacetSelectionPayloadDefinition} from '../generic/range-facet-validate-payload'; @@ -11,7 +12,7 @@ import {LogDateFacetBreadcrumbActionCreatorPayload} from './date-facet-analytics export const logDateFacetBreadcrumb = ( payload: LogDateFacetBreadcrumbActionCreatorPayload ): InsightAction => - makeInsightAnalyticsAction( + makeInsightAnalyticsActionFactory(SearchPageEvents.breadcrumbFacet)( 'analytics/dateFacet/breadcrumb', (client, state) => { validatePayload( diff --git a/packages/headless/src/features/facets/range-facets/numeric-facet-set/numeric-facet-insight-analytics-actions.ts b/packages/headless/src/features/facets/range-facets/numeric-facet-set/numeric-facet-insight-analytics-actions.ts index 8dd3b1d5138..7ca66cb5163 100644 --- a/packages/headless/src/features/facets/range-facets/numeric-facet-set/numeric-facet-insight-analytics-actions.ts +++ b/packages/headless/src/features/facets/range-facets/numeric-facet-set/numeric-facet-insight-analytics-actions.ts @@ -1,8 +1,9 @@ import {validatePayload} from '../../../../utils/validate-payload'; import { InsightAction, - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, } from '../../../analytics/analytics-utils'; +import {SearchPageEvents} from '../../../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../../../case-context/case-context-state'; import {getRangeFacetMetadata} from '../generic/range-facet-insight-analytics-actions'; import {rangeFacetSelectionPayloadDefinition} from '../generic/range-facet-validate-payload'; @@ -11,7 +12,7 @@ import {LogNumericFacetBreadcrumbActionCreatorPayload} from './numeric-facet-ana export const logNumericFacetBreadcrumb = ( payload: LogNumericFacetBreadcrumbActionCreatorPayload ): InsightAction => - makeInsightAnalyticsAction( + makeInsightAnalyticsActionFactory(SearchPageEvents.breadcrumbFacet)( 'analytics/numericFacet/breadcrumb', (client, state) => { validatePayload( diff --git a/packages/headless/src/features/folding/folding-insight-analytics-actions.ts b/packages/headless/src/features/folding/folding-insight-analytics-actions.ts index 2617f90e9bc..adeea3d1203 100644 --- a/packages/headless/src/features/folding/folding-insight-analytics-actions.ts +++ b/packages/headless/src/features/folding/folding-insight-analytics-actions.ts @@ -2,28 +2,34 @@ import {Result} from '../../api/search/search/result'; import { documentIdentifier, InsightAction, - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, partialDocumentInformation, validateResultPayload, } from '../analytics/analytics-utils'; +import {SearchPageEvents} from '../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../case-context/case-context-state'; export const logShowMoreFoldedResults = (result: Result): InsightAction => - makeInsightAnalyticsAction('analytics/folding/showMore', (client, state) => { - validateResultPayload(result); + makeInsightAnalyticsActionFactory(SearchPageEvents.showMoreFoldedResults)( + 'analytics/folding/showMore', + (client, state) => { + validateResultPayload(result); - return client.logShowMoreFoldedResults( - partialDocumentInformation(result, state), - documentIdentifier(result), - getCaseContextAnalyticsMetadata(state.insightCaseContext) - ); - }); + return client.logShowMoreFoldedResults( + partialDocumentInformation(result, state), + documentIdentifier(result), + getCaseContextAnalyticsMetadata(state.insightCaseContext) + ); + } + ); export const logShowLessFoldedResults = (): InsightAction => - makeInsightAnalyticsAction('analytics/folding/showLess', (client, state) => - client.logShowLessFoldedResults( - getCaseContextAnalyticsMetadata(state.insightCaseContext) - ) + makeInsightAnalyticsActionFactory(SearchPageEvents.showLessFoldedResults)( + 'analytics/folding/showLess', + (client, state) => + client.logShowLessFoldedResults( + getCaseContextAnalyticsMetadata(state.insightCaseContext) + ) ); export const insightFoldedResultAnalyticsClient = { diff --git a/packages/headless/src/features/folding/insight-folding-actions.ts b/packages/headless/src/features/folding/insight-folding-actions.ts index a92c344d08e..c913b8ca285 100644 --- a/packages/headless/src/features/folding/insight-folding-actions.ts +++ b/packages/headless/src/features/folding/insight-folding-actions.ts @@ -45,7 +45,7 @@ export const loadCollection = createAsyncThunk< {getState, rejectWithValue, extra: {apiClient}} ) => { const state = getState(); - const actualRequest = buildInsightLoadCollectionRequest( + const actualRequest = await buildInsightLoadCollectionRequest( state, collectionId ); diff --git a/packages/headless/src/features/generated-answer/generated-answer-insight-analytics-actions.ts b/packages/headless/src/features/generated-answer/generated-answer-insight-analytics-actions.ts index db469f8058d..537be46a151 100644 --- a/packages/headless/src/features/generated-answer/generated-answer-insight-analytics-actions.ts +++ b/packages/headless/src/features/generated-answer/generated-answer-insight-analytics-actions.ts @@ -1,8 +1,9 @@ import {Qna} from '@coveo/relay-event-types'; import { InsightAction, - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, } from '../analytics/analytics-utils'; +import {SearchPageEvents} from '../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../case-context/case-context-state'; import { citationSourceSelector, @@ -18,7 +19,7 @@ export type GeneratedAnswerFeedback = //TODO: SFINT-5435 export const logRetryGeneratedAnswer = (): InsightAction => - makeInsightAnalyticsAction( + makeInsightAnalyticsActionFactory(SearchPageEvents.retryGeneratedAnswer)( 'analytics/generatedAnswer/retry', (client, state) => client.logRetryGeneratedAnswer( @@ -30,7 +31,7 @@ export const logRetryGeneratedAnswer = (): InsightAction => export const logRephraseGeneratedAnswer = ( responseFormat: GeneratedResponseFormat ): InsightAction => - makeInsightAnalyticsAction( + makeInsightAnalyticsActionFactory(SearchPageEvents.rephraseGeneratedAnswer)( 'analytics/generatedAnswer/rephrase', (client, state) => { const generativeQuestionAnsweringId = @@ -51,46 +52,50 @@ export const logRephraseGeneratedAnswer = ( export const logOpenGeneratedAnswerSource = ( citationId: string ): InsightAction => - makeInsightAnalyticsAction({ - prefix: 'analytics/generatedAnswer/openAnswerSource', - __legacy__getBuilder: (client, state) => { - const generativeQuestionAnsweringId = - generativeQuestionAnsweringIdSelector(state); - const citation = citationSourceSelector(state, citationId); + makeInsightAnalyticsActionFactory(SearchPageEvents.openGeneratedAnswerSource)( + { + prefix: 'analytics/generatedAnswer/openAnswerSource', + __legacy__getBuilder: (client, state) => { + const generativeQuestionAnsweringId = + generativeQuestionAnsweringIdSelector(state); + const citation = citationSourceSelector(state, citationId); - if (!generativeQuestionAnsweringId || !citation) { - return null; - } - return client.logOpenGeneratedAnswerSource( - { - generativeQuestionAnsweringId, - permanentId: citation.permanentid, - citationId: citation.id, - }, - getCaseContextAnalyticsMetadata(state.insightCaseContext) - ); - }, - analyticsType: 'Qna.CitationClick', - analyticsPayloadBuilder: (state): Qna.CitationClick => { - const generativeQuestionAnsweringId = - generativeQuestionAnsweringIdSelector(state); - return { - answer: { - id: generativeQuestionAnsweringId!, - type: 'CRGA', - }, - citation: { - id: citationId, - }, - }; - }, - }); + if (!generativeQuestionAnsweringId || !citation) { + return null; + } + return client.logOpenGeneratedAnswerSource( + { + generativeQuestionAnsweringId, + permanentId: citation.permanentid, + citationId: citation.id, + }, + getCaseContextAnalyticsMetadata(state.insightCaseContext) + ); + }, + analyticsType: 'Qna.CitationClick', + analyticsPayloadBuilder: (state): Qna.CitationClick => { + const generativeQuestionAnsweringId = + generativeQuestionAnsweringIdSelector(state); + return { + answer: { + id: generativeQuestionAnsweringId!, + type: 'CRGA', + }, + citation: { + id: citationId, + }, + }; + }, + } + ); export const logHoverCitation = ( citationId: string, citationHoverTimeInMs: number ): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory( + SearchPageEvents.generatedAnswerSourceHover + )({ prefix: 'analytics/generatedAnswer/hoverCitation', __legacy__getBuilder: (client, state) => { const generativeQuestionAnsweringId = @@ -128,7 +133,7 @@ export const logHoverCitation = ( }); export const logLikeGeneratedAnswer = (): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory(SearchPageEvents.likeGeneratedAnswer)({ prefix: 'analytics/generatedAnswer/like', __legacy__getBuilder: (client, state) => { const generativeQuestionAnsweringId = @@ -160,7 +165,7 @@ export const logLikeGeneratedAnswer = (): InsightAction => }); export const logDislikeGeneratedAnswer = (): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory(SearchPageEvents.dislikeGeneratedAnswer)({ prefix: 'analytics/generatedAnswer/dislike', __legacy__getBuilder: (client, state) => { const generativeQuestionAnsweringId = @@ -194,7 +199,9 @@ export const logDislikeGeneratedAnswer = (): InsightAction => export const logGeneratedAnswerFeedback = ( feedback: GeneratedAnswerFeedback ): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory( + SearchPageEvents.generatedAnswerFeedbackSubmit + )({ prefix: 'analytics/generatedAnswer/sendFeedback', __legacy__getBuilder: (client, state) => { const generativeQuestionAnsweringId = @@ -230,7 +237,9 @@ export const logGeneratedAnswerFeedback = ( export const logGeneratedAnswerDetailedFeedback = ( details: string ): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory( + SearchPageEvents.generatedAnswerFeedbackSubmit + )({ prefix: 'analytics/generatedAnswer/sendFeedback', __legacy__getBuilder: (client, state) => { const generativeQuestionAnsweringId = @@ -269,7 +278,7 @@ export const logGeneratedAnswerDetailedFeedback = ( export const logGeneratedAnswerStreamEnd = ( answerGenerated: boolean ): InsightAction => - makeInsightAnalyticsAction( + makeInsightAnalyticsActionFactory(SearchPageEvents.generatedAnswerStreamEnd)( 'analytics/generatedAnswer/streamEnd', (client, state) => { const generativeQuestionAnsweringId = @@ -288,7 +297,9 @@ export const logGeneratedAnswerStreamEnd = ( ); export const logGeneratedAnswerShowAnswers = (): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory( + SearchPageEvents.generatedAnswerShowAnswers + )({ prefix: 'analytics/generatedAnswer/show', __legacy__getBuilder: (client, state) => { const generativeQuestionAnsweringId = @@ -318,7 +329,9 @@ export const logGeneratedAnswerShowAnswers = (): InsightAction => }); export const logGeneratedAnswerHideAnswers = (): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory( + SearchPageEvents.generatedAnswerHideAnswers + )({ prefix: 'analytics/generatedAnswer/hide', __legacy__getBuilder: (client, state) => { const generativeQuestionAnsweringId = @@ -348,7 +361,9 @@ export const logGeneratedAnswerHideAnswers = (): InsightAction => }); export const logCopyGeneratedAnswer = (): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory( + SearchPageEvents.generatedAnswerCopyToClipboard + )({ prefix: 'analytics/generatedAnswer/copy', __legacy__getBuilder: (client, state) => { const generativeQuestionAnsweringId = diff --git a/packages/headless/src/features/insight-search/insight-analytics-actions.ts b/packages/headless/src/features/insight-search/insight-analytics-actions.ts index 2825747fbb0..fcacf046d25 100644 --- a/packages/headless/src/features/insight-search/insight-analytics-actions.ts +++ b/packages/headless/src/features/insight-search/insight-analytics-actions.ts @@ -5,8 +5,9 @@ import { } from '../../utils/validate-payload'; import { InsightAction, - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, } from '../analytics/analytics-utils'; +import {SearchPageEvents} from '../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../case-context/case-context-state'; export interface CreateArticleMetadata { @@ -19,7 +20,7 @@ export const logExpandToFullUI = ( fullSearchComponentName: string, triggeredBy: string ): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory(SearchPageEvents.expandToFullUI)({ prefix: 'analytics/expandToFullUI', __legacy__getBuilder: (client, state) => { const metadata = getCaseContextAnalyticsMetadata( @@ -52,7 +53,7 @@ export const logExpandToFullUI = ( export const logInsightCreateArticle = ( createArticleMetadata: CreateArticleMetadata ): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory(SearchPageEvents.createArticle)({ prefix: 'analytics/insight/createArticle', __legacy__getBuilder: (client, state) => { validatePayload(createArticleMetadata, { diff --git a/packages/headless/src/features/insight-search/insight-search-actions.ts b/packages/headless/src/features/insight-search/insight-search-actions.ts index 4b6d133dcad..e537eca793e 100644 --- a/packages/headless/src/features/insight-search/insight-search-actions.ts +++ b/packages/headless/src/features/insight-search/insight-search-actions.ts @@ -31,6 +31,7 @@ import { } from '../../state/state-sections'; import {requiredNonEmptyString} from '../../utils/validate-payload'; import {InsightAction as LegacyInsightAction} from '../analytics/analytics-utils'; +import {SearchPageEvents} from '../analytics/search-action-cause'; import { FetchQuerySuggestionsActionCreatorPayload, FetchQuerySuggestionsThunkReturn, @@ -126,7 +127,8 @@ export const executeSearch = createAsyncThunk< ...config, }); - const request = buildInsightSearchRequest(state); + const eventDescription = buildEventDescription(analyticsAction.next); + const request = await buildInsightSearchRequest(state, eventDescription); const fetched = await processor.fetchFromAPI(request); return await processor.process(fetched); @@ -158,7 +160,8 @@ export const fetchPage = createAsyncThunk< ...config, }); - const request = buildInsightSearchRequest(state); + const eventDescription = buildEventDescription(analyticsAction.next); + const request = await buildInsightSearchRequest(state, eventDescription); const fetched = await processor.fetchFromAPI(request); return await processor.process(fetched); @@ -180,7 +183,14 @@ export const fetchMoreResults = createAsyncThunk< ...config, }); - const request = await buildInsightFetchMoreResultsRequest(state); + const eventDescription = buildEventDescription({ + actionCause: SearchPageEvents.pagerScrolling, + }); + + const request = await buildInsightFetchMoreResultsRequest( + state, + eventDescription + ); const fetched = await processor.fetchFromAPI(request); return await processor.process(fetched); @@ -209,7 +219,11 @@ export const fetchFacetValues = createAsyncThunk< ...config, }); - const request = await buildInsightFetchFacetValuesRequest(state); + const eventDescription = buildEventDescription(analyticsAction.next); + const request = await buildInsightFetchFacetValuesRequest( + state, + eventDescription + ); const fetched = await processor.fetchFromAPI(request); return await processor.process(fetched); @@ -265,3 +279,8 @@ export const addEntryInActionsHistory = (state: StateNeededByExecuteSearch) => { }); } }; + +const buildEventDescription = (action: SearchAction) => ({ + actionCause: action.actionCause, + type: action.actionCause, +}); diff --git a/packages/headless/src/features/insight-search/insight-search-analytics-actions.ts b/packages/headless/src/features/insight-search/insight-search-analytics-actions.ts index c63cd2aef41..e10866458c4 100644 --- a/packages/headless/src/features/insight-search/insight-search-analytics-actions.ts +++ b/packages/headless/src/features/insight-search/insight-search-analytics-actions.ts @@ -1,57 +1,70 @@ import {SearchAPIErrorWithStatusCode} from '../../api/search/search-api-error-response'; import { InsightAction, - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, } from '../analytics/analytics-utils'; +import {SearchPageEvents} from '../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../case-context/case-context-state'; import {getQueryInitialState} from '../query/query-state'; export const logFetchMoreResults = (): InsightAction => - makeInsightAnalyticsAction('search/logFetchMoreResults', (client, state) => - client.logFetchMoreResults( - getCaseContextAnalyticsMetadata(state.insightCaseContext) - ) + makeInsightAnalyticsActionFactory(SearchPageEvents.pagerScrolling)( + 'search/logFetchMoreResults', + (client, state) => + client.logFetchMoreResults( + getCaseContextAnalyticsMetadata(state.insightCaseContext) + ) ); export const logQueryError = ( error: SearchAPIErrorWithStatusCode ): InsightAction => - makeInsightAnalyticsAction('search/queryError', (client, state) => - client.logQueryError({ - ...getCaseContextAnalyticsMetadata(state.insightCaseContext), - query: state.query?.q || getQueryInitialState().q, - aq: '', - cq: '', - dq: '', - errorType: error.type, - errorMessage: error.message, - }) + makeInsightAnalyticsActionFactory(SearchPageEvents.queryError)( + 'search/queryError', + (client, state) => + client.logQueryError({ + ...getCaseContextAnalyticsMetadata(state.insightCaseContext), + query: state.query?.q || getQueryInitialState().q, + aq: '', + cq: '', + dq: '', + errorType: error.type, + errorMessage: error.message, + }) ); export const logContextChanged = ( caseId: string, caseNumber: string ): InsightAction => - makeInsightAnalyticsAction('analytics/contextChanged', (client, state) => { - const meta = { - caseId, - caseNumber, - caseContext: state.insightCaseContext?.caseContext || {}, - }; - client.logContextChanged(meta); - }); + makeInsightAnalyticsActionFactory(SearchPageEvents.contextChanged)( + 'analytics/contextChanged', + (client, state) => { + const meta = { + caseId, + caseNumber, + caseContext: state.insightCaseContext?.caseContext || {}, + }; + client.logContextChanged(meta); + } + ); export const logInsightInterfaceLoad = (): InsightAction => - makeInsightAnalyticsAction('analytics/interface/load', (client, state) => - client.logInterfaceLoad( - getCaseContextAnalyticsMetadata(state.insightCaseContext) - ) + makeInsightAnalyticsActionFactory(SearchPageEvents.interfaceLoad)( + 'analytics/interface/load', + (client, state) => + client.logInterfaceLoad( + getCaseContextAnalyticsMetadata(state.insightCaseContext) + ) ); export const logInsightInterfaceChange = (): InsightAction => - makeInsightAnalyticsAction('analytics/interface/change', (client, state) => { - client.logInterfaceChange({ - ...getCaseContextAnalyticsMetadata(state.insightCaseContext), - interfaceChangeTo: state.configuration.analytics.originLevel2, - }); - }); + makeInsightAnalyticsActionFactory(SearchPageEvents.interfaceChange)( + 'analytics/interface/change', + (client, state) => { + client.logInterfaceChange({ + ...getCaseContextAnalyticsMetadata(state.insightCaseContext), + interfaceChangeTo: state.configuration.analytics.originLevel2, + }); + } + ); diff --git a/packages/headless/src/features/insight-search/insight-search-request.test.ts b/packages/headless/src/features/insight-search/insight-search-request.test.ts index 13120abf812..f26b5cde06f 100644 --- a/packages/headless/src/features/insight-search/insight-search-request.test.ts +++ b/packages/headless/src/features/insight-search/insight-search-request.test.ts @@ -9,7 +9,8 @@ import {buildMockInsightState} from '../../test/mock-insight-state'; import {buildMockNumericFacetRequest} from '../../test/mock-numeric-facet-request'; import {buildMockNumericFacetSlice} from '../../test/mock-numeric-facet-slice'; import {buildMockTabSlice} from '../../test/mock-tab-state'; -import {CollectionId} from '../folding/folding-state'; +import {getConfigurationInitialState} from '../configuration/configuration-state'; +import {CollectionId, getFoldingInitialState} from '../folding/folding-state'; import {maximumNumberOfResultsFromIndex} from '../pagination/pagination-constants'; import { buildInsightSearchRequest, @@ -26,6 +27,53 @@ describe('insight search request', () => { }); describe('when using buildInsightSearchRequest', () => { + it('#buildInsightSearchRequest returns the values extracted from the #configuration state', async () => { + state.configuration = { + ...getConfigurationInitialState(), + accessToken: '123', + organizationId: 'foo', + platformUrl: 'bar', + }; + const params = (await buildInsightSearchRequest(state)).request; + + expect(params.accessToken).toBe(state.configuration.accessToken); + expect(params.organizationId).toBe(state.configuration.organizationId); + expect(params.url).toBe(state.configuration.platformUrl); + }); + + it('#buildInsightSearchRequest returns the state #insightId', async () => { + state.insightConfiguration.insightId = '123'; + const params = (await buildInsightSearchRequest(state)).request; + + expect(params.insightId).toBe(state.insightConfiguration.insightId); + }); + + it('#buildInsightSearchRequest should add the correct analytics section', async () => { + state.configuration.analytics.originLevel3 = 'foo'; + state.configuration.analytics.originContext = 'bar'; + state.configuration.analytics.analyticsMode = 'next'; + state.configuration.analytics.trackingId = '123'; + + const exampleEventDescription = { + actionCause: 'exampleActionCause', + }; + + const request = ( + await buildInsightSearchRequest(state, exampleEventDescription) + ).request.analytics; + + expect(request?.documentReferrer).toBe( + state.configuration.analytics.originLevel3 + ); + expect(request?.originContext).toBe( + state.configuration.analytics.originContext + ); + expect(request?.actionCause).toBe(exampleEventDescription.actionCause); + expect(request?.trackingId).toBe( + state.configuration.analytics.trackingId + ); + }); + it('#buildInsightSearchRequest returns the state #query', async () => { state.query.q = 'hello'; const params = (await buildInsightSearchRequest(state)).request; @@ -33,6 +81,23 @@ describe('insight search request', () => { expect(params.q).toBe(state.query.q); }); + it('#searchRequest.tab holds the #originLevel2', async () => { + const originLevel2 = 'youtube'; + state.configuration.analytics.originLevel2 = originLevel2; + expect((await buildInsightSearchRequest(state)).request.tab).toBe( + originLevel2 + ); + }); + + it('#searchRequest.referrer holds the #originLevel3', async () => { + const originLevel3 = 'www.coveo.com'; + state.configuration.analytics.originLevel3 = originLevel3; + expect( + (await buildInsightSearchRequest(state)).request.analytics + ?.documentReferrer + ).toBe(originLevel3); + }); + it('#buildInsightSearchRequest returns the state #sortCriteria', async () => { state.sortCriteria = 'qre'; const params = (await buildInsightSearchRequest(state)).request; @@ -148,9 +213,87 @@ describe('insight search request', () => { expectedState ); }); + + it('#buildInsightSearchRequest returns the state #caseContext', async () => { + state.insightCaseContext.caseContext = {value: 'foo'}; + + const params = (await buildInsightSearchRequest(state)).request; + expect(params.caseContext).toEqual(state.insightCaseContext.caseContext); + }); + + it('#buildInsightSearchRequest returns the state #didYouMean', async () => { + state.didYouMean.enableDidYouMean = true; + const params = (await buildInsightSearchRequest(state)).request; + + expect(params.enableDidYouMean).toBe(state.didYouMean.enableDidYouMean); + }); + + it('#buildInsightSearchRequest returns the values extracted from the #folding state', async () => { + state.folding = { + ...getFoldingInitialState(), + fields: { + collection: 'foo', + child: 'bar', + parent: 'baz', + }, + filterFieldRange: 3, + }; + const params = (await buildInsightSearchRequest(state)).request; + + expect(params.filterField).toBe(state.folding.fields.collection); + expect(params.childField).toBe(state.folding.fields.parent); + expect(params.parentField).toBe(state.folding.fields.child); + expect(params.filterFieldRange).toBe(state.folding.filterFieldRange); + }); }); describe('when using buildInsightLoadCollectionRequest', () => { + it('#buildInsightLoadCollectionRequest returns the values extracted from the #configuration state', async () => { + state.configuration = { + ...getConfigurationInitialState(), + accessToken: '123', + organizationId: 'foo', + platformUrl: 'bar', + }; + const params = ( + await buildInsightLoadCollectionRequest(state, collectionId) + ).request; + + expect(params.accessToken).toBe(state.configuration.accessToken); + expect(params.organizationId).toBe(state.configuration.organizationId); + expect(params.url).toBe(state.configuration.platformUrl); + }); + + it('#buildInsightLoadCollectionRequest returns the state #insightId', async () => { + state.insightConfiguration.insightId = '123'; + const params = ( + await buildInsightLoadCollectionRequest(state, collectionId) + ).request; + + expect(params.insightId).toBe(state.insightConfiguration.insightId); + }); + + it('#buildInsightLoadCollectionRequest should add the correct analytics section', async () => { + state.configuration.analytics.originLevel3 = 'foo'; + state.configuration.analytics.originContext = 'bar'; + state.configuration.analytics.analyticsMode = 'next'; + state.configuration.analytics.trackingId = '123'; + + const request = ( + await buildInsightLoadCollectionRequest(state, collectionId) + ).request.analytics; + + expect(request?.documentReferrer).toBe( + state.configuration.analytics.originLevel3 + ); + expect(request?.originContext).toBe( + state.configuration.analytics.originContext + ); + expect(request?.trackingId).toBe( + state.configuration.analytics.trackingId + ); + }); + it('#buildInsightLoadCollectionRequest returns the state #query', async () => { state.query.q = 'hello'; const params = ( diff --git a/packages/headless/src/features/insight-search/insight-search-request.ts b/packages/headless/src/features/insight-search/insight-search-request.ts index 2857a0741b1..ce53781d4aa 100644 --- a/packages/headless/src/features/insight-search/insight-search-request.ts +++ b/packages/headless/src/features/insight-search/insight-search-request.ts @@ -1,9 +1,11 @@ +import {EventDescription} from 'coveo.analytics'; import {InsightQueryRequest} from '../../api/service/insight/query/query-request'; import {InsightAppState} from '../../state/insight-app-state'; import { ConfigurationSection, InsightConfigurationSection, } from '../../state/state-sections'; +import {fromAnalyticsStateToAnalyticsParams} from '../configuration/analytics-params'; import {getFacetRequests} from '../facets/generic/interfaces/generic-facet-request'; import {CollectionId} from '../folding/folding-state'; import {maximumNumberOfResultsFromIndex} from '../pagination/pagination-constants'; @@ -13,9 +15,10 @@ type StateNeededBySearchRequest = ConfigurationSection & InsightConfigurationSection & Partial; -export const buildInsightBaseRequest = ( - state: StateNeededBySearchRequest -): MappedSearchRequest => { +export const buildInsightBaseRequest = async ( + state: StateNeededBySearchRequest, + eventDescription?: EventDescription +): Promise> => { const cq = buildConstantQuery(state); const facets = getAllFacets(state); @@ -24,6 +27,11 @@ export const buildInsightBaseRequest = ( organizationId: state.configuration.organizationId, url: state.configuration.platformUrl, insightId: state.insightConfiguration.insightId, + ...(state.configuration.analytics.enabled && + (await fromAnalyticsStateToAnalyticsParams( + state.configuration.analytics, + eventDescription + ))), q: state.query?.q, ...(facets.length && {facets}), caseContext: state.insightCaseContext?.caseContext, @@ -58,9 +66,10 @@ export const buildInsightBaseRequest = ( }); }; -export const buildInsightSearchRequest = ( - state: StateNeededBySearchRequest -): MappedSearchRequest => { +export const buildInsightSearchRequest = async ( + state: StateNeededBySearchRequest, + eventDescription?: EventDescription +): Promise> => { const getNumberOfResultsWithinIndexLimit = () => { if (!state.pagination) { return undefined; @@ -76,7 +85,7 @@ export const buildInsightSearchRequest = ( return state.pagination.numberOfResults; }; - const baseRequest = buildInsightBaseRequest(state); + const baseRequest = await buildInsightBaseRequest(state, eventDescription); return { ...baseRequest, request: { @@ -89,11 +98,11 @@ export const buildInsightSearchRequest = ( }; }; -export const buildInsightLoadCollectionRequest = ( +export const buildInsightLoadCollectionRequest = async ( state: StateNeededBySearchRequest, collectionId: CollectionId -): MappedSearchRequest => { - const baseRequest = buildInsightBaseRequest(state); +): Promise> => { + const baseRequest = await buildInsightBaseRequest(state); return { ...baseRequest, request: { @@ -105,9 +114,13 @@ export const buildInsightLoadCollectionRequest = ( }; export const buildInsightFetchMoreResultsRequest = async ( - state: StateNeededBySearchRequest + state: StateNeededBySearchRequest, + eventDescription?: EventDescription ): Promise> => { - const mappedRequest = await buildInsightSearchRequest(state); + const mappedRequest = await buildInsightSearchRequest( + state, + eventDescription + ); mappedRequest.request = { ...mappedRequest.request, firstResult: @@ -118,9 +131,13 @@ export const buildInsightFetchMoreResultsRequest = async ( }; export const buildInsightFetchFacetValuesRequest = async ( - state: StateNeededBySearchRequest + state: StateNeededBySearchRequest, + eventDescription?: EventDescription ): Promise> => { - const mappedRequest = await buildInsightSearchRequest(state); + const mappedRequest = await buildInsightSearchRequest( + state, + eventDescription + ); mappedRequest.request = { ...mappedRequest.request, numberOfResults: 0, diff --git a/packages/headless/src/features/insight-search/legacy/insight-search-actions.ts b/packages/headless/src/features/insight-search/legacy/insight-search-actions.ts index 31fb35ac81c..e8f4c6a65d6 100644 --- a/packages/headless/src/features/insight-search/legacy/insight-search-actions.ts +++ b/packages/headless/src/features/insight-search/legacy/insight-search-actions.ts @@ -28,7 +28,18 @@ export async function legacyExecuteSearch( analyticsAction, }); - const mappedRequest = buildInsightSearchRequest(state); + const {analyticsClientMiddleware, preprocessRequest, logger} = config.extra; + const {description: eventDescription} = await analyticsAction.prepare({ + getState: () => config.getState(), + analyticsClientMiddleware, + preprocessRequest, + logger, + }); + + const mappedRequest = await buildInsightSearchRequest( + state, + eventDescription + ); const fetched = await processor.fetchFromAPI(mappedRequest); return await processor.process(fetched, mappedRequest); @@ -48,7 +59,18 @@ export async function legacyFetchPage( analyticsAction, }); - const mappedRequest = buildInsightSearchRequest(state); + const {analyticsClientMiddleware, preprocessRequest, logger} = config.extra; + const {description: eventDescription} = await analyticsAction.prepare({ + getState: () => config.getState(), + analyticsClientMiddleware, + preprocessRequest, + logger, + }); + + const mappedRequest = await buildInsightSearchRequest( + state, + eventDescription + ); const fetched = await processor.fetchFromAPI(mappedRequest); return await processor.process(fetched, mappedRequest); @@ -65,7 +87,18 @@ export async function legacyFetchMoreResults( analyticsAction: logFetchMoreResults, }); - const mappedRequest = await buildInsightFetchMoreResultsRequest(state); + const {analyticsClientMiddleware, preprocessRequest, logger} = config.extra; + const {description: eventDescription} = await logFetchMoreResults().prepare({ + getState: () => config.getState(), + analyticsClientMiddleware, + preprocessRequest, + logger, + }); + + const mappedRequest = await buildInsightFetchMoreResultsRequest( + state, + eventDescription + ); const fetched = await processor.fetchFromAPI(mappedRequest); return await processor.process(fetched, mappedRequest); @@ -83,7 +116,18 @@ export async function legacyFetchFacetValues( analyticsAction, }); - const mappedRequest = await buildInsightFetchFacetValuesRequest(state); + const {analyticsClientMiddleware, preprocessRequest, logger} = config.extra; + const {description: eventDescription} = await analyticsAction.prepare({ + getState: () => config.getState(), + analyticsClientMiddleware, + preprocessRequest, + logger, + }); + + const mappedRequest = await buildInsightFetchFacetValuesRequest( + state, + eventDescription + ); const fetched = await processor.fetchFromAPI(mappedRequest); return await processor.process(fetched, mappedRequest); diff --git a/packages/headless/src/features/pagination/pagination-insight-analytics-actions.ts b/packages/headless/src/features/pagination/pagination-insight-analytics-actions.ts index 24d7ce44010..cb82a7aa467 100644 --- a/packages/headless/src/features/pagination/pagination-insight-analytics-actions.ts +++ b/packages/headless/src/features/pagination/pagination-insight-analytics-actions.ts @@ -1,31 +1,38 @@ import {PaginationSection} from '../../state/state-sections'; import { - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, InsightAction, } from '../analytics/analytics-utils'; +import {SearchPageEvents} from '../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../case-context/case-context-state'; import {currentPageSelector} from './pagination-selectors'; export const logPageNumber = (): InsightAction => - makeInsightAnalyticsAction('analytics/pager/number', (client, state) => - client.logPagerNumber({ - pagerNumber: currentPageSelector(state as PaginationSection), - ...getCaseContextAnalyticsMetadata(state.insightCaseContext), - }) + makeInsightAnalyticsActionFactory(SearchPageEvents.pagerNumber)( + 'analytics/pager/number', + (client, state) => + client.logPagerNumber({ + pagerNumber: currentPageSelector(state as PaginationSection), + ...getCaseContextAnalyticsMetadata(state.insightCaseContext), + }) ); export const logPageNext = (): InsightAction => - makeInsightAnalyticsAction('analytics/pager/next', (client, state) => - client.logPagerNext({ - pagerNumber: currentPageSelector(state as PaginationSection), - ...getCaseContextAnalyticsMetadata(state.insightCaseContext), - }) + makeInsightAnalyticsActionFactory(SearchPageEvents.pagerNext)( + 'analytics/pager/next', + (client, state) => + client.logPagerNext({ + pagerNumber: currentPageSelector(state as PaginationSection), + ...getCaseContextAnalyticsMetadata(state.insightCaseContext), + }) ); export const logPagePrevious = (): InsightAction => - makeInsightAnalyticsAction('analytics/pager/previous', (client, state) => - client.logPagerPrevious({ - pagerNumber: currentPageSelector(state as PaginationSection), - ...getCaseContextAnalyticsMetadata(state.insightCaseContext), - }) + makeInsightAnalyticsActionFactory(SearchPageEvents.pagerPrevious)( + 'analytics/pager/previous', + (client, state) => + client.logPagerPrevious({ + pagerNumber: currentPageSelector(state as PaginationSection), + ...getCaseContextAnalyticsMetadata(state.insightCaseContext), + }) ); diff --git a/packages/headless/src/features/product-listing/product-listing-actions.ts b/packages/headless/src/features/product-listing/product-listing-actions.ts index 32d865fd328..d907f043811 100644 --- a/packages/headless/src/features/product-listing/product-listing-actions.ts +++ b/packages/headless/src/features/product-listing/product-listing-actions.ts @@ -1,12 +1,12 @@ import {ArrayValue, StringValue} from '@coveo/bueno'; import {createAction, createAsyncThunk} from '@reduxjs/toolkit'; import {getVisitorID} from '../../api/analytics/coveo-analytics-utils'; +import {isErrorResponse} from '../../api/commerce/commerce-api-client'; import {AsyncThunkProductListingOptions} from '../../api/commerce/product-listings/product-listing-api-client'; import { ProductListingRequest, ProductListingSuccessResponse, } from '../../api/commerce/product-listings/product-listing-request'; -import {isErrorResponse} from '../../api/search/search-api-client'; import { CategoryFacetSection, ConfigurationSection, diff --git a/packages/headless/src/features/product-listing/product-listing-recent-results.ts b/packages/headless/src/features/product-listing/product-listing-recent-results.ts index e06f335cd13..c943d957505 100644 --- a/packages/headless/src/features/product-listing/product-listing-recent-results.ts +++ b/packages/headless/src/features/product-listing/product-listing-recent-results.ts @@ -1,4 +1,4 @@ -import {createAction} from '../..'; +import {createAction} from '@reduxjs/toolkit'; import {validateProductRecommendationPayload} from '../analytics/analytics-utils'; import {ProductRecommendation} from './../../api/search/search/product-recommendation'; diff --git a/packages/headless/src/features/query/query-insight-analytics-actions.ts b/packages/headless/src/features/query/query-insight-analytics-actions.ts index 801cc093517..3751cfc3add 100644 --- a/packages/headless/src/features/query/query-insight-analytics-actions.ts +++ b/packages/headless/src/features/query/query-insight-analytics-actions.ts @@ -1,12 +1,15 @@ import { InsightAction, - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, } from '../analytics/analytics-utils'; +import {SearchPageEvents} from '../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../case-context/case-context-state'; export const logSearchboxSubmit = (): InsightAction => - makeInsightAnalyticsAction('analytics/searchbox/submit', (client, state) => - client.logSearchboxSubmit( - getCaseContextAnalyticsMetadata(state.insightCaseContext) - ) + makeInsightAnalyticsActionFactory(SearchPageEvents.searchboxSubmit)( + 'analytics/searchbox/submit', + (client, state) => + client.logSearchboxSubmit( + getCaseContextAnalyticsMetadata(state.insightCaseContext) + ) ); diff --git a/packages/headless/src/features/question-answering/question-answering-analytics-actions.ts b/packages/headless/src/features/question-answering/question-answering-analytics-actions.ts index e3d2e8a642e..37d4e049e46 100644 --- a/packages/headless/src/features/question-answering/question-answering-analytics-actions.ts +++ b/packages/headless/src/features/question-answering/question-answering-analytics-actions.ts @@ -132,7 +132,10 @@ export const logOpenSmartSnippetInlineLink = ( ): ClickAction => makeAnalyticsAction('analytics/smartSnippet/source/open', (client, state) => { validatePayload(payload, inlineLinkPayloadDefinition()); - const result = answerSourceSelector(state)!; + const result = answerSourceSelector(state); + if (!result) { + return null; + } return client.makeOpenSmartSnippetInlineLink( partialDocumentInformation(result, state), { diff --git a/packages/headless/src/features/question-answering/question-answering-insight-analytics-actions.ts b/packages/headless/src/features/question-answering/question-answering-insight-analytics-actions.ts index 75ced157950..569912bb5c7 100644 --- a/packages/headless/src/features/question-answering/question-answering-insight-analytics-actions.ts +++ b/packages/headless/src/features/question-answering/question-answering-insight-analytics-actions.ts @@ -4,9 +4,10 @@ import { InsightAction, analyticsEventItemMetadata, documentIdentifier, - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, partialDocumentInformation, } from '../analytics/analytics-utils'; +import {SearchPageEvents} from '../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../case-context/case-context-state'; import {SmartSnippetFeedback} from './question-answering-analytics-actions'; import { @@ -22,7 +23,7 @@ import { } from './question-answering-selectors'; export const logExpandSmartSnippet = (): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory(SearchPageEvents.expandSmartSnippet)({ prefix: 'analytics/smartSnippet/expand', __legacy__getBuilder: (client, state) => { return client.logExpandSmartSnippet( @@ -42,7 +43,7 @@ export const logExpandSmartSnippet = (): InsightAction => }); export const logCollapseSmartSnippet = (): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory(SearchPageEvents.collapseSmartSnippet)({ prefix: 'analytics/smartSnippet/collapse', __legacy__getBuilder: (client, state) => { return client.logCollapseSmartSnippet( @@ -62,7 +63,7 @@ export const logCollapseSmartSnippet = (): InsightAction => }); export const logLikeSmartSnippet = (): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory(SearchPageEvents.likeSmartSnippet)({ prefix: 'analytics/smartSnippet/like', __legacy__getBuilder: (client, state) => { return client.logLikeSmartSnippet( @@ -84,7 +85,7 @@ export const logLikeSmartSnippet = (): InsightAction => }); export const logDislikeSmartSnippet = (): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory(SearchPageEvents.dislikeSmartSnippet)({ prefix: 'analytics/smartSnippet/dislike', __legacy__getBuilder: (client, state) => { return client.logDislikeSmartSnippet( @@ -106,7 +107,7 @@ export const logDislikeSmartSnippet = (): InsightAction => }); export const logOpenSmartSnippetSource = (): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory(SearchPageEvents.openSmartSnippetSource)({ prefix: 'analytics/smartSnippet/source/open', __legacy__getBuilder: (client, state) => { const result = answerSourceSelector(state)!; @@ -132,46 +133,45 @@ export const logOpenSmartSnippetSource = (): InsightAction => export const logOpenSmartSnippetInlineLink = ( payload: QuestionAnsweringInlineLinkActionCreatorPayload ): InsightAction => - makeInsightAnalyticsAction( - 'analytics/smartSnippet/source/open', - (client, state) => { - validatePayload(payload, inlineLinkPayloadDefinition()); - const result = answerSourceSelector(state)!; - return client.logOpenSmartSnippetInlineLink( - partialDocumentInformation(result, state), - { - ...documentIdentifier(result), - ...payload, - }, - getCaseContextAnalyticsMetadata(state.insightCaseContext) - ); - } - ); + makeInsightAnalyticsActionFactory( + SearchPageEvents.openSmartSnippetInlineLink + )('analytics/smartSnippet/source/open', (client, state) => { + validatePayload(payload, inlineLinkPayloadDefinition()); + const result = answerSourceSelector(state)!; + return client.logOpenSmartSnippetInlineLink( + partialDocumentInformation(result, state), + { + ...documentIdentifier(result), + ...payload, + }, + getCaseContextAnalyticsMetadata(state.insightCaseContext) + ); + }); //TODO: SFINT-5435 export const logOpenSmartSnippetFeedbackModal = (): InsightAction => - makeInsightAnalyticsAction( - 'analytics/smartSnippet/feedbackModal/open', - (client, state) => - client.logOpenSmartSnippetFeedbackModal( - getCaseContextAnalyticsMetadata(state.insightCaseContext) - ) + makeInsightAnalyticsActionFactory( + SearchPageEvents.openSmartSnippetFeedbackModal + )('analytics/smartSnippet/feedbackModal/open', (client, state) => + client.logOpenSmartSnippetFeedbackModal( + getCaseContextAnalyticsMetadata(state.insightCaseContext) + ) ); //TODO: SFINT-5435 export const logCloseSmartSnippetFeedbackModal = (): InsightAction => - makeInsightAnalyticsAction( - 'analytics/smartSnippet/feedbackModal/close', - (client, state) => - client.logCloseSmartSnippetFeedbackModal( - getCaseContextAnalyticsMetadata(state.insightCaseContext) - ) + makeInsightAnalyticsActionFactory( + SearchPageEvents.closeSmartSnippetFeedbackModal + )('analytics/smartSnippet/feedbackModal/close', (client, state) => + client.logCloseSmartSnippetFeedbackModal( + getCaseContextAnalyticsMetadata(state.insightCaseContext) + ) ); export const logSmartSnippetFeedback = ( feedback: SmartSnippetFeedback ): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory(SearchPageEvents.sendSmartSnippetReason)({ prefix: 'analytics/smartSnippet/sendFeedback', __legacy__getBuilder: (client, state) => { return client.logSmartSnippetFeedbackReason( @@ -198,7 +198,7 @@ export const logSmartSnippetFeedback = ( export const logSmartSnippetDetailedFeedback = ( details: string ): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory(SearchPageEvents.sendSmartSnippetReason)({ prefix: 'analytics/smartSnippet/sendFeedback', __legacy__getBuilder: (client, state) => { return client.logSmartSnippetFeedbackReason( @@ -226,7 +226,9 @@ export const logSmartSnippetDetailedFeedback = ( export const logExpandSmartSnippetSuggestion = ( payload: QuestionAnsweringUniqueIdentifierActionCreatorPayload ): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory( + SearchPageEvents.expandSmartSnippetSuggestion + )({ prefix: 'analytics/smartSnippetSuggestion/expand', __legacy__getBuilder: (client, state) => { validateQuestionAnsweringActionCreatorPayload(payload); @@ -262,7 +264,9 @@ export const logExpandSmartSnippetSuggestion = ( export const logCollapseSmartSnippetSuggestion = ( payload: QuestionAnsweringUniqueIdentifierActionCreatorPayload ): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory( + SearchPageEvents.collapseSmartSnippetSuggestion + )({ prefix: 'analytics/smartSnippetSuggestion/collapse', __legacy__getBuilder: (client, state) => { validateQuestionAnsweringActionCreatorPayload(payload); @@ -297,7 +301,9 @@ export const logCollapseSmartSnippetSuggestion = ( export const logOpenSmartSnippetSuggestionSource = ( payload: QuestionAnsweringUniqueIdentifierActionCreatorPayload ): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory( + SearchPageEvents.openSmartSnippetSuggestionSource + )({ prefix: 'analytics/smartSnippetSuggestion/source/open', __legacy__getBuilder: (client, state) => { validatePayload(payload, uniqueIdentifierPayloadDefinition()); @@ -344,37 +350,36 @@ export const logOpenSmartSnippetSuggestionInlineLink = ( identifier: QuestionAnsweringUniqueIdentifierActionCreatorPayload, link: QuestionAnsweringInlineLinkActionCreatorPayload ): InsightAction => - makeInsightAnalyticsAction( - 'analytics/smartSnippetSuggestion/source/open', - (client, state) => { - validatePayload(identifier, uniqueIdentifierPayloadDefinition()); - validatePayload(link, inlineLinkPayloadDefinition()); - - const relatedQuestion = relatedQuestionSelector( - state, - identifier.questionAnswerId - ); - if (!relatedQuestion) { - return null; - } - const source = answerSourceSelector(state, relatedQuestion.documentId); - if (!source) { - return null; - } + makeInsightAnalyticsActionFactory( + SearchPageEvents.openSmartSnippetSuggestionInlineLink + )('analytics/smartSnippetSuggestion/source/open', (client, state) => { + validatePayload(identifier, uniqueIdentifierPayloadDefinition()); + validatePayload(link, inlineLinkPayloadDefinition()); - return client.logOpenSmartSnippetSuggestionInlineLink( - partialDocumentInformation(source, state), - { - question: relatedQuestion.question, - answerSnippet: relatedQuestion.answerSnippet, - documentId: relatedQuestion.documentId, - linkText: link.linkText, - linkURL: link.linkURL, - }, - getCaseContextAnalyticsMetadata(state.insightCaseContext) - ); + const relatedQuestion = relatedQuestionSelector( + state, + identifier.questionAnswerId + ); + if (!relatedQuestion) { + return null; } - ); + const source = answerSourceSelector(state, relatedQuestion.documentId); + if (!source) { + return null; + } + + return client.logOpenSmartSnippetSuggestionInlineLink( + partialDocumentInformation(source, state), + { + question: relatedQuestion.question, + answerSnippet: relatedQuestion.answerSnippet, + documentId: relatedQuestion.documentId, + linkText: link.linkText, + linkURL: link.linkURL, + }, + getCaseContextAnalyticsMetadata(state.insightCaseContext) + ); + }); export const insightSmartSnippetAnalyticsClient = { logExpandSmartSnippet, diff --git a/packages/headless/src/features/result-actions/result-actions-insight-analytics-actions.ts b/packages/headless/src/features/result-actions/result-actions-insight-analytics-actions.ts index e7af05f7131..80cf5c42308 100644 --- a/packages/headless/src/features/result-actions/result-actions-insight-analytics-actions.ts +++ b/packages/headless/src/features/result-actions/result-actions-insight-analytics-actions.ts @@ -4,15 +4,16 @@ import { analyticsEventItemMetadata, documentIdentifier, InsightAction, - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, partialDocumentInformation, validateResultPayload, } from '../analytics/analytics-utils'; import {analyticsEventCaseContext} from '../analytics/insight-analytics-utils'; +import {SearchPageEvents} from '../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../case-context/case-context-state'; export const logCopyToClipboard = (result: Result): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory(SearchPageEvents.copyToClipboard)({ prefix: 'analytics/resultAction/insight/copyToClipboard', __legacy__getBuilder: (client, state) => { validateResultPayload(result); @@ -39,7 +40,7 @@ export const logCopyToClipboard = (result: Result): InsightAction => }); export const logCaseSendEmail = (result: Result): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory(SearchPageEvents.caseSendEmail)({ prefix: 'analytics/resultAction/insight/caseSendEmail', __legacy__getBuilder: (client, state) => { validateResultPayload(result); @@ -66,7 +67,7 @@ export const logCaseSendEmail = (result: Result): InsightAction => }); export const logFeedItemTextPost = (result: Result): InsightAction => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory(SearchPageEvents.feedItemTextPost)({ prefix: 'analytics/resultAction/insight/feedItemTextPost', __legacy__getBuilder: (client, state) => { validateResultPayload(result); diff --git a/packages/headless/src/features/result/result-insight-analytics-actions.ts b/packages/headless/src/features/result/result-insight-analytics-actions.ts index 316f1443c61..d5c00d44896 100644 --- a/packages/headless/src/features/result/result-insight-analytics-actions.ts +++ b/packages/headless/src/features/result/result-insight-analytics-actions.ts @@ -4,14 +4,15 @@ import { partialDocumentInformation, documentIdentifier, validateResultPayload, - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, analyticsEventItemMetadata, } from '../analytics/analytics-utils'; import {analyticsEventCaseContext} from '../analytics/insight-analytics-utils'; +import {SearchPageEvents} from '../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../case-context/case-context-state'; export const logDocumentOpen = (result: Result) => - makeInsightAnalyticsAction({ + makeInsightAnalyticsActionFactory(SearchPageEvents.documentOpen)({ prefix: 'analytics/insight/result/open', __legacy__getBuilder: (client, state) => { validateResultPayload(result); diff --git a/packages/headless/src/features/sort-criteria/sort-criteria-insight-analytics-actions.ts b/packages/headless/src/features/sort-criteria/sort-criteria-insight-analytics-actions.ts index fa54c281909..636a0a4ab10 100644 --- a/packages/headless/src/features/sort-criteria/sort-criteria-insight-analytics-actions.ts +++ b/packages/headless/src/features/sort-criteria/sort-criteria-insight-analytics-actions.ts @@ -1,14 +1,17 @@ import { InsightAction, - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, } from '../analytics/analytics-utils'; +import {SearchPageEvents} from '../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../case-context/case-context-state'; import {getSortCriteriaInitialState} from './sort-criteria-state'; export const logResultsSort = (): InsightAction => - makeInsightAnalyticsAction('analytics/sort/results', (client, state) => - client.logResultsSort({ - resultsSortBy: state.sortCriteria || getSortCriteriaInitialState(), - ...getCaseContextAnalyticsMetadata(state.insightCaseContext), - }) + makeInsightAnalyticsActionFactory(SearchPageEvents.resultsSort)( + 'analytics/sort/results', + (client, state) => + client.logResultsSort({ + resultsSortBy: state.sortCriteria || getSortCriteriaInitialState(), + ...getCaseContextAnalyticsMetadata(state.insightCaseContext), + }) ); diff --git a/packages/headless/src/features/static-filter-set/static-filter-set-insight-analytics-actions.ts b/packages/headless/src/features/static-filter-set/static-filter-set-insight-analytics-actions.ts index d34e2ac72f2..8674731f192 100644 --- a/packages/headless/src/features/static-filter-set/static-filter-set-insight-analytics-actions.ts +++ b/packages/headless/src/features/static-filter-set/static-filter-set-insight-analytics-actions.ts @@ -1,14 +1,15 @@ import { InsightAction, - makeInsightAnalyticsAction, + makeInsightAnalyticsActionFactory, } from '../analytics/analytics-utils'; +import {SearchPageEvents} from '../analytics/search-action-cause'; import {getCaseContextAnalyticsMetadata} from '../case-context/case-context-state'; import {LogStaticFilterToggleValueActionCreatorPayload} from './static-filter-set-actions'; export const logInsightStaticFilterDeselect = ( metadata: LogStaticFilterToggleValueActionCreatorPayload ): InsightAction => - makeInsightAnalyticsAction( + makeInsightAnalyticsActionFactory(SearchPageEvents.staticFilterDeselect)( 'analytics/staticFilter/deselect', (client, state) => client.logStaticFilterDeselect({ diff --git a/packages/quantic/package.json b/packages/quantic/package.json index c36e2dee187..8b508929640 100644 --- a/packages/quantic/package.json +++ b/packages/quantic/package.json @@ -1,6 +1,6 @@ { "name": "@coveo/quantic", - "version": "2.46.11", + "version": "2.46.12", "description": "A Salesforce Lightning Web Component (LWC) library for building modern UIs interfacing with the Coveo platform", "author": "coveo.com", "homepage": "https://coveo.com", @@ -46,7 +46,7 @@ }, "dependencies": { "@coveo/bueno": "0.45.8", - "@coveo/headless": "2.57.0" + "@coveo/headless": "2.57.1" }, "engines": { "node": ">=14.0.0" diff --git a/packages/samples/angular/package.json b/packages/samples/angular/package.json index ec6eb235d96..0711348420d 100644 --- a/packages/samples/angular/package.json +++ b/packages/samples/angular/package.json @@ -19,7 +19,7 @@ "@angular/platform-browser": "17.2.4", "@angular/platform-browser-dynamic": "17.2.4", "@angular/router": "17.2.4", - "@coveo/atomic-angular": "2.23.3", + "@coveo/atomic-angular": "2.23.4", "rxjs": "7.8.1", "tslib": "2.6.2", "zone.js": "0.14.4" diff --git a/packages/samples/atomic-next/package.json b/packages/samples/atomic-next/package.json index f69cb1f69e1..3caa79c1edd 100644 --- a/packages/samples/atomic-next/package.json +++ b/packages/samples/atomic-next/package.json @@ -3,9 +3,9 @@ "version": "0.0.0", "private": true, "dependencies": { - "@coveo/atomic": "2.62.0", - "@coveo/atomic-react": "2.8.27", - "@coveo/headless": "2.57.0", + "@coveo/atomic": "2.62.1", + "@coveo/atomic-react": "2.8.28", + "@coveo/headless": "2.57.1", "next": "14.1.3", "react": "18.2.0", "react-dom": "18.2.0" diff --git a/packages/samples/atomic-react/package.json b/packages/samples/atomic-react/package.json index c8a209677aa..37424d6074a 100644 --- a/packages/samples/atomic-react/package.json +++ b/packages/samples/atomic-react/package.json @@ -4,9 +4,9 @@ "description": "Samples with atomic-react", "private": true, "dependencies": { - "@coveo/atomic": "2.62.0", - "@coveo/atomic-react": "2.8.27", - "@coveo/headless": "2.57.0", + "@coveo/atomic": "2.62.1", + "@coveo/atomic-react": "2.8.28", + "@coveo/headless": "2.57.1", "react": "18.2.0", "react-dom": "18.2.0" }, diff --git a/packages/samples/headless-react/package.json b/packages/samples/headless-react/package.json index 0306868319d..9aed35c0c22 100644 --- a/packages/samples/headless-react/package.json +++ b/packages/samples/headless-react/package.json @@ -5,7 +5,7 @@ "private": true, "dependencies": { "@coveo/auth": "1.11.16", - "@coveo/headless": "2.57.0", + "@coveo/headless": "2.57.1", "@testing-library/jest-dom": "6.4.2", "@testing-library/react": "13.3.0", "@testing-library/user-event": "14.5.2", diff --git a/packages/samples/headless-ssr/package.json b/packages/samples/headless-ssr/package.json index 5b1e8a2bba1..4f7ced09116 100644 --- a/packages/samples/headless-ssr/package.json +++ b/packages/samples/headless-ssr/package.json @@ -8,8 +8,8 @@ "e2e:watch": "cypress open --browser chrome --e2e" }, "dependencies": { - "@coveo/headless-react": "0.2.32", - "@coveo/headless": "2.57.0", + "@coveo/headless-react": "0.2.33", + "@coveo/headless": "2.57.1", "next": "14.1.3", "react": "18.2.0", "react-dom": "18.2.0" diff --git a/packages/samples/iife/package.json b/packages/samples/iife/package.json index feba4e0f81d..69479269ef9 100644 --- a/packages/samples/iife/package.json +++ b/packages/samples/iife/package.json @@ -12,10 +12,10 @@ }, "dependencies": { "@babel/standalone": "7.24.0", - "@coveo/atomic": "2.62.0", - "@coveo/atomic-hosted-page": "0.5.32", - "@coveo/atomic-react": "2.8.27", - "@coveo/headless": "2.57.0", + "@coveo/atomic": "2.62.1", + "@coveo/atomic-hosted-page": "0.5.33", + "@coveo/atomic-react": "2.8.28", + "@coveo/headless": "2.57.1", "react": "18.2.0", "react-dom": "18.2.0" }, diff --git a/packages/samples/stencil/package.json b/packages/samples/stencil/package.json index 31ee0500656..6f9832df2a9 100644 --- a/packages/samples/stencil/package.json +++ b/packages/samples/stencil/package.json @@ -8,8 +8,8 @@ "e2e:watch": "cypress open --browser chrome --e2e" }, "dependencies": { - "@coveo/atomic": "2.62.0", - "@coveo/headless": "2.57.0", + "@coveo/atomic": "2.62.1", + "@coveo/headless": "2.57.1", "@stencil/core": "4.13.0", "stencil-router-v2": "0.6.0" }, diff --git a/packages/samples/vuejs/package.json b/packages/samples/vuejs/package.json index 198e8b74bd6..20d52a7b8b5 100644 --- a/packages/samples/vuejs/package.json +++ b/packages/samples/vuejs/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "vue": "^3.4.15", - "@coveo/atomic": "2.62.0" + "@coveo/atomic": "2.62.1" }, "devDependencies": { "@vitejs/plugin-vue": "^5.0.3",