Skip to content

Commit

Permalink
Fix: Invite banner mixpanel event (#3704)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikehrn authored Dec 17, 2024
1 parent 0115e65 commit cb134f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 0 additions & 7 deletions packages/frontend-2/components/invite/Banner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ const onDeclineClick = (token?: string) => {
mixpanel.track('Invite Action', {
accepted: false,
type: 'workspace invite',
location: 'invite banner',
// eslint-disable-next-line camelcase
workspace_id: props.invite.workspace.id
})
Expand All @@ -159,12 +158,6 @@ const onDeclineClick = (token?: string) => {
const onAcceptClick = (token?: string) => {
emit('processed', true, token)
if (props.invite.workspace) {
mixpanel.track('Workspace Joined', {
location: 'invite banner',
// eslint-disable-next-line camelcase
workspace_id: props.invite.workspace.id
})
mixpanel.track('Invite Action', {
accepted: true,
type: 'workspace invite',
Expand Down
9 changes: 9 additions & 0 deletions packages/frontend-2/components/workspace/invite/Banner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type { Optional } from '@speckle/shared'
import type { WorkspaceInviteBanner_PendingWorkspaceCollaboratorFragment } from '~/lib/common/generated/gql/graphql'
import { useWorkspaceInviteManager } from '~/lib/workspaces/composables/management'
import { graphql } from '~~/lib/common/generated/gql'
import { useMixpanel } from '~~/lib/core/composables/mp'
graphql(`
fragment WorkspaceInviteBanner_PendingWorkspaceCollaborator on PendingWorkspaceCollaborator {
Expand Down Expand Up @@ -51,11 +52,19 @@ const { loading, accept, decline } = useWorkspaceInviteManager(
}
)
const mixpanel = useMixpanel()
const processInvite = async (shouldAccept: boolean, token: Optional<string>) => {
if (!token) return
if (shouldAccept) {
await accept()
mixpanel.track('Workspace Joined', {
location: 'invite banner',
// eslint-disable-next-line camelcase
workspace_id: props.invite.workspaceId
})
} else {
await decline()
}
Expand Down

0 comments on commit cb134f3

Please sign in to comment.