Skip to content
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

Feat: Add user to group, add invited and dialog event mixpanel #2828

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions packages/frontend-2/components/invite/Banner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
text
:full-width="block"
:disabled="loading"
@click="$emit('processed', false, token)"
@click="onDeclineClick(token)"
>
Decline
</FormButton>
Expand All @@ -31,7 +31,7 @@
class="px-4"
:icon-left="CheckIcon"
:disabled="loading"
@click="$emit('processed', true, token)"
@click="onAcceptClick(token)"
>
Accept
</FormButton>
Expand Down Expand Up @@ -59,8 +59,9 @@ import {
useNavigateToLogin,
useNavigateToRegistration
} from '~/lib/common/helpers/route'
import { useMixpanel } from '~~/lib/core/composables/mp'

defineEmits<{
const emit = defineEmits<{
processed: [accept: boolean, token: Optional<string>]
}>()

Expand Down Expand Up @@ -91,6 +92,7 @@ const { isLoggedIn } = useActiveUser()
const postAuthRedirect = usePostAuthRedirect()
const goToLogin = useNavigateToLogin()
const goToSignUp = useNavigateToRegistration()
const mixpanel = useMixpanel()

const token = computed(
() => props.invite?.token || (route.query.token as Optional<string>)
Expand Down Expand Up @@ -140,4 +142,27 @@ const onLoginSignupClick = async () => {
await goToSignUp({ query })
}
}

const onDeclineClick = (token?: string) => {
emit('processed', false, token)
if (props.invite.workspace) {
mixpanel.track('Invite Action', {
accepted: false,
// eslint-disable-next-line camelcase
workspace_id: props.invite.workspace.id
})
}
}

const onAcceptClick = (token?: string) => {
emit('processed', true, token)
if (props.invite.workspace) {
mixpanel.track('Invite Action', {
accepted: true,
// eslint-disable-next-line camelcase
workspace_id: props.invite.workspace.id
})
mixpanel.add_group('workspace_id', props.invite.workspace.id)
}
}
</script>
5 changes: 5 additions & 0 deletions packages/frontend-2/components/settings/Dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ const onWorkspaceMenuItemClick = (id: string, target: string, disabled?: boolean
if (disabled) return
targetWorkspaceId.value = id
targetMenuItem.value = target
mixpanel.track('Workspace Settings Menuitem Clicked', {
// eslint-disable-next-line camelcase
workspace_id: id,
item: target
})
}

const openWorkspaceCreateDialog = () => {
Expand Down
5 changes: 4 additions & 1 deletion packages/frontend-2/lib/workspaces/composables/management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,11 @@ export const useProcessWorkspaceInvite = () => {
})
mp.track('Invite Action', {
type: 'workspace invite',
accepted: input.accept
accepted: input.accept,
// eslint-disable-next-line camelcase
workspace_id: workspaceId
})
mp.add_group('workspace_id', workspaceId)
} else {
const err = getFirstErrorMessage(errors)
const preventErrorToasts = isFunction(options?.preventErrorToasts)
Expand Down