diff --git a/frontend/src/component/changeRequest/ChangeRequestOverview/ChangeRequestOverview.tsx b/frontend/src/component/changeRequest/ChangeRequestOverview/ChangeRequestOverview.tsx index 68a7a0b1a576..0746576f7ab1 100644 --- a/frontend/src/component/changeRequest/ChangeRequestOverview/ChangeRequestOverview.tsx +++ b/frontend/src/component/changeRequest/ChangeRequestOverview/ChangeRequestOverview.tsx @@ -34,7 +34,6 @@ import { ChangeRequestRejectScheduledDialogue, } from './ChangeRequestScheduledDialogs/changeRequestScheduledDialogs'; import { ScheduleChangeRequestDialog } from './ChangeRequestScheduledDialogs/ScheduleChangeRequestDialog'; -import { usePlausibleTracker } from 'hooks/usePlausibleTracker'; import { PlausibleChangeRequestState } from '../changeRequest.types'; const StyledAsideBox = styled(Box)(({ theme }) => ({ @@ -105,7 +104,6 @@ export const ChangeRequestOverview: FC = () => { const { isChangeRequestConfiguredForReview } = useChangeRequestsEnabled(projectId); const scheduleChangeRequests = useUiFlag('scheduledConfigurationChanges'); - const { trackEvent } = usePlausibleTracker(); if (!changeRequest) { return null; diff --git a/frontend/src/hooks/api/actions/useChangeRequestApi/useChangeRequestApi.ts b/frontend/src/hooks/api/actions/useChangeRequestApi/useChangeRequestApi.ts index 00dddaa01527..d131d321f9d4 100644 --- a/frontend/src/hooks/api/actions/useChangeRequestApi/useChangeRequestApi.ts +++ b/frontend/src/hooks/api/actions/useChangeRequestApi/useChangeRequestApi.ts @@ -1,6 +1,8 @@ import useAPI from '../useApi/useApi'; import { usePlausibleTracker } from '../../../usePlausibleTracker'; import { PlausibleChangeRequestState } from 'component/changeRequest/changeRequest.types'; +import { getUniqueChangeRequestId } from 'utils/unique-change-request-id'; +import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; export interface IChangeSchema { feature: string | null; @@ -30,6 +32,7 @@ export const useChangeRequestApi = () => { const { makeRequest, createRequest, errors, loading } = useAPI({ propagateErrors: true, }); + const { uiConfig } = useUiConfig(); const addChange = async ( project: string, @@ -72,6 +75,7 @@ export const useChangeRequestApi = () => { props: { eventType: payload.state, previousState, + id: getUniqueChangeRequestId(uiConfig, changeRequestId), }, }); diff --git a/frontend/src/utils/unique-change-request-id.ts b/frontend/src/utils/unique-change-request-id.ts new file mode 100644 index 000000000000..15f16fbfe0cc --- /dev/null +++ b/frontend/src/utils/unique-change-request-id.ts @@ -0,0 +1,10 @@ +import { IUiConfig } from 'interfaces/uiConfig'; + +export const getUniqueChangeRequestId = ( + uiConfig: Pick, + changeRequestId: number, +) => { + return `${ + uiConfig.baseUriPath || uiConfig.versionInfo?.instanceId + }/change-requests/${changeRequestId}?version=${uiConfig.versionInfo}`; +};