From d06029a49bd7062df982728d93a3f4eea1549cb2 Mon Sep 17 00:00:00 2001 From: Rita Date: Mon, 23 Sep 2024 09:59:39 +0200 Subject: [PATCH] refactor(structure): update telemetry names and event properties --- .../banners/DraftLiveEditBanner.tsx | 9 +++------ .../DraftLiveEditBanner.telemetry.ts | 20 +++++++------------ 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/packages/sanity/src/structure/panes/document/documentPanel/banners/DraftLiveEditBanner.tsx b/packages/sanity/src/structure/panes/document/documentPanel/banners/DraftLiveEditBanner.tsx index d14e71c9a4b..e48bd253e3f 100644 --- a/packages/sanity/src/structure/panes/document/documentPanel/banners/DraftLiveEditBanner.tsx +++ b/packages/sanity/src/structure/panes/document/documentPanel/banners/DraftLiveEditBanner.tsx @@ -13,10 +13,7 @@ import { import {Button} from '../../../../../ui-components' import {structureLocaleNamespace} from '../../../../i18n' -import { - DiscardedLiveEditDraft, - PublishedLiveEditDraft, -} from './__telemetry__/DraftLiveEditBanner.telemetry' +import {ResolvedLiveEdit} from './__telemetry__/DraftLiveEditBanner.telemetry' import {Banner} from './Banner' interface DraftLiveEditBannerProps { @@ -40,13 +37,13 @@ export function DraftLiveEditBanner({ const handlePublish = useCallback(() => { publish.execute() setPublishing(true) - telemetry.log(PublishedLiveEditDraft) + telemetry.log(ResolvedLiveEdit, {liveEditResolveType: 'publish'}) }, [publish, telemetry]) const handleDiscard = useCallback(() => { discardChanges.execute() setDiscarding(true) - telemetry.log(DiscardedLiveEditDraft) + telemetry.log(ResolvedLiveEdit, {liveEditResolveType: 'discard'}) }, [discardChanges, telemetry]) useEffect(() => { diff --git a/packages/sanity/src/structure/panes/document/documentPanel/banners/__telemetry__/DraftLiveEditBanner.telemetry.ts b/packages/sanity/src/structure/panes/document/documentPanel/banners/__telemetry__/DraftLiveEditBanner.telemetry.ts index 3b30a6aec0f..107c4ce4302 100644 --- a/packages/sanity/src/structure/panes/document/documentPanel/banners/__telemetry__/DraftLiveEditBanner.telemetry.ts +++ b/packages/sanity/src/structure/panes/document/documentPanel/banners/__telemetry__/DraftLiveEditBanner.telemetry.ts @@ -1,21 +1,15 @@ import {defineEvent} from '@sanity/telemetry' +interface TypeInfo { + liveEditResolveType: 'publish' | 'discard' +} + /** * When a draft in a live edit document is published * @internal */ -export const PublishedLiveEditDraft = defineEvent({ - name: 'Resolve liveEdit by publishing draft', - version: 1, - description: 'User published a draft when a draft of a live edit document to continue editing', -}) - -/* - * When a draft in a live edit document is discarded - * @internal - */ -export const DiscardedLiveEditDraft = defineEvent({ - name: 'Resolve liveEdit by discarding draftt', +export const ResolvedLiveEdit = defineEvent({ + name: 'Resolved LiveEdit Draft', version: 1, - description: 'User discarded a draft when a draft of a live edit document to continue editing', + description: 'User resolved a draft of a live edit document to continue editing', })