-
Notifications
You must be signed in to change notification settings - Fork 39
feat(headless): added redux analytics actions for attach citations feature #6805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SimonMilord
wants to merge
21
commits into
main
Choose a base branch
from
SFINT-6550
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
d751d0b
updated coveo analytics to include citations attach events
SimonMilord 20cbe2a
added analytics actions for attach citation document
SimonMilord c8edeb0
added redux action and modified state and slice to support attaching …
SimonMilord a94b567
added slice test and some improvements
SimonMilord 3eb0bfa
applied feedback
SimonMilord 68bd4c5
Merge branch 'main' into SFINT-6550
SimonMilord 4b9d451
reverted changes to redux actions, no longer doing those.
SimonMilord f669665
Merge branch 'SFINT-6550' of https://github.com/coveo/ui-kit into SFI…
SimonMilord 8553215
applied feedback
SimonMilord abbf38a
Merge branch 'main' into SFINT-6550
SimonMilord 54169f0
lockfile update, dedupe
SimonMilord a4b590e
Merge branch 'SFINT-6550' of https://github.com/coveo/ui-kit into SFI…
SimonMilord e11572a
Merge branch 'main' into SFINT-6550
SimonMilord ba2dd1f
changed the param of the analytics from result to citation
SimonMilord ff42126
Merge branch 'SFINT-6550' of https://github.com/coveo/ui-kit into SFI…
SimonMilord 56136ef
improved the analytic
SimonMilord 41ce274
added new detach action for citations
SimonMilord bcd9613
Merge branch 'main' into SFINT-6550
SimonMilord f7b657e
some feedback applied
SimonMilord 2f3a605
Merge branch 'SFINT-6550' of https://github.com/coveo/ui-kit into SFI…
SimonMilord a136a9e
fixed the urihash sent to analytics
SimonMilord File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,15 +1,20 @@ | ||||||||||||||||||||||||||||||||
| import type {InsightPanel} from '@coveo/relay-event-types'; | ||||||||||||||||||||||||||||||||
| import type {Result} from '../../api/search/search/result.js'; | ||||||||||||||||||||||||||||||||
| import type {GeneratedAnswerCitation} from '../../index.js'; | ||||||||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||||||||
| analyticsEventItemMetadata, | ||||||||||||||||||||||||||||||||
| analyticsEventItemMetadataForCitations, | ||||||||||||||||||||||||||||||||
| citationDocumentIdentifier, | ||||||||||||||||||||||||||||||||
| documentIdentifier, | ||||||||||||||||||||||||||||||||
| makeInsightAnalyticsActionFactory, | ||||||||||||||||||||||||||||||||
| partialCitationInformation, | ||||||||||||||||||||||||||||||||
| partialDocumentInformation, | ||||||||||||||||||||||||||||||||
| validateResultPayload, | ||||||||||||||||||||||||||||||||
| } from '../analytics/analytics-utils.js'; | ||||||||||||||||||||||||||||||||
| import {analyticsEventCaseContext} from '../analytics/insight-analytics-utils.js'; | ||||||||||||||||||||||||||||||||
| import {SearchPageEvents} from '../analytics/search-action-cause.js'; | ||||||||||||||||||||||||||||||||
| import {getCaseContextAnalyticsMetadata} from '../case-context/case-context-state.js'; | ||||||||||||||||||||||||||||||||
| import {generativeQuestionAnsweringIdSelector} from '../generated-answer/generated-answer-selectors.js'; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| export const logCaseAttach = (result: Result) => | ||||||||||||||||||||||||||||||||
| makeInsightAnalyticsActionFactory(SearchPageEvents.caseAttach)({ | ||||||||||||||||||||||||||||||||
|
|
@@ -55,3 +60,51 @@ export const logCaseDetach = (result: Result) => | |||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| export const logCitationDocumentAttach = (citation: GeneratedAnswerCitation) => | ||||||||||||||||||||||||||||||||
| makeInsightAnalyticsActionFactory( | ||||||||||||||||||||||||||||||||
| SearchPageEvents.generatedAnswerCitationDocumentAttach | ||||||||||||||||||||||||||||||||
| )({ | ||||||||||||||||||||||||||||||||
| prefix: 'insight/generatedAnswerCitationDocumentAttach', | ||||||||||||||||||||||||||||||||
| __legacy__getBuilder: (client, state) => { | ||||||||||||||||||||||||||||||||
| const metadata = getCaseContextAnalyticsMetadata( | ||||||||||||||||||||||||||||||||
| state.insightCaseContext | ||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||
| const generativeQuestionAnsweringId = | ||||||||||||||||||||||||||||||||
| generativeQuestionAnsweringIdSelector(state); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| if (!generativeQuestionAnsweringId || !citation) { | ||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| const citationPayload = { | ||||||||||||||||||||||||||||||||
| generativeQuestionAnsweringId, | ||||||||||||||||||||||||||||||||
| citationId: citation.id, | ||||||||||||||||||||||||||||||||
| documentId: citationDocumentIdentifier(citation), | ||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||
| return client.logGeneratedAnswerCitationDocumentAttach( | ||||||||||||||||||||||||||||||||
| partialCitationInformation(citation, state), | ||||||||||||||||||||||||||||||||
| citationPayload, | ||||||||||||||||||||||||||||||||
| metadata | ||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| export const logCitationDocumentDetach = (citation: GeneratedAnswerCitation) => | ||||||||||||||||||||||||||||||||
| makeInsightAnalyticsActionFactory(SearchPageEvents.caseDetach)({ | ||||||||||||||||||||||||||||||||
| prefix: 'insight/caseDetach', | ||||||||||||||||||||||||||||||||
| __legacy__getBuilder: (client, state) => { | ||||||||||||||||||||||||||||||||
| const uriHash = citation.fields?.urihash || ''; | ||||||||||||||||||||||||||||||||
| return client.logCaseDetach( | ||||||||||||||||||||||||||||||||
| uriHash, | ||||||||||||||||||||||||||||||||
| getCaseContextAnalyticsMetadata(state.insightCaseContext) | ||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
|
Comment on lines
+96
to
+102
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
we need to add this here once the coveo UA is updated |
||||||||||||||||||||||||||||||||
| analyticsType: 'InsightPanel.DetachItem', | ||||||||||||||||||||||||||||||||
| analyticsPayloadBuilder: (state): InsightPanel.DetachItem => { | ||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||
| itemMetadata: analyticsEventItemMetadataForCitations(citation, state), | ||||||||||||||||||||||||||||||||
| context: analyticsEventCaseContext(state), | ||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.