Skip to content

Commit

Permalink
remove eventUserLogic usage
Browse files Browse the repository at this point in the history
  • Loading branch information
zlwaterfield committed Mar 18, 2024
1 parent 728ed10 commit c8dfe68
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const ActivationTask = ({
}: ActivationTaskType): JSX.Element => {
const displaySideAction = !completed && !skipped && canSkip
const { runTask, skipTask } = useActions(activationLogic)
const { reportActivationSideBarTaskClicked, reportActivationSideBarTaskSkipped } = useActions(eventUsageLogic)
const { reportActivationSideBarTaskClicked } = useActions(eventUsageLogic)

const content = (
<div className="my-4 mx-2">
Expand All @@ -87,11 +87,6 @@ const ActivationTask = ({
</div>
)

const handleSkip = (): void => {
skipTask(id)
reportActivationSideBarTaskSkipped(id)
}

const params: Partial<LemonButtonWithSideActionProps> = {
id,
fullWidth: true,
Expand Down Expand Up @@ -119,7 +114,7 @@ const ActivationTask = ({
sideAction={{
icon: <IconX />,
tooltip: 'Skip task',
onClick: () => handleSkip(),
onClick: () => skipTask(id),
}}
>
{content}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
import api from 'lib/api'
import { permanentlyMount } from 'lib/utils/kea-logic-builders'
import posthog from 'posthog-js'
import { membersLogic } from 'scenes/organization/membersLogic'
import { pluginsLogic } from 'scenes/plugins/pluginsLogic'
import { savedInsightsLogic } from 'scenes/saved-insights/savedInsightsLogic'
Expand All @@ -24,7 +25,7 @@ export enum ActivationTasks {
SetupSessionRecordings = 'setup_session_recordings',
TrackCustomEvents = 'track_custom_events',
InstallFirstApp = 'install_first_app',
SetupReverseProxy = 'setup_reverse_proxy',
SetUpReverseProxy = 'set_up_reverse_proxy',
}

export type ActivationTaskType = {
Expand Down Expand Up @@ -280,14 +281,14 @@ export const activationLogic = kea<activationLogicType>([
skipped: skippedTasks.includes(ActivationTasks.InstallFirstApp),
})
break
case ActivationTasks.SetupReverseProxy:
case ActivationTasks.SetUpReverseProxy:
tasks.push({
id: ActivationTasks.SetupReverseProxy,
id: ActivationTasks.SetUpReverseProxy,
name: 'Set up a reverse proxy',
description: 'Sent your events from your own domain to avoid tracking blockers',
completed: false,
canSkip: true,
skipped: skippedTasks.includes(ActivationTasks.SetupReverseProxy),
skipped: skippedTasks.includes(ActivationTasks.SetUpReverseProxy),
url: 'https://posthog.com/docs/advanced/proxy',
})
break
Expand Down Expand Up @@ -351,6 +352,9 @@ export const activationLogic = kea<activationLogicType>([
}
},
skipTask: ({ id }) => {
posthog.capture('activation sidebar task skipped', {
key: id,
})
if (values.currentTeam?.id) {
actions.addSkippedTask(values.currentTeam.id, id)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { actions, kea, listeners, path, reducers } from 'kea'
import { actionToUrl, router, urlToAction } from 'kea-router'
import { windowValues } from 'kea-window-values'
import posthog from 'posthog-js'

import { SidePanelTab } from '~/types'

Expand Down Expand Up @@ -55,10 +56,12 @@ export const sidePanelStateLogic = kea<sidePanelStateLogicType>([
listeners(({ actions, values }) => ({
// NOTE: We explicitly reference the actions instead of connecting so that people don't accidentally
// use this logic instead of sidePanelStateLogic
openSidePanel: () => {
openSidePanel: ({ tab }) => {
posthog.capture('activation sidebar closed', { tab })
actions.setSidePanelOpen(true)
},
closeSidePanel: ({ tab }) => {
posthog.capture('activation sidebar opened', { tab })
if (!tab) {
// If we aren't specifiying the tab we always close
actions.setSidePanelOpen(false)
Expand Down
19 changes: 0 additions & 19 deletions frontend/src/lib/utils/eventUsageLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import {
SessionPlayerData,
SessionRecordingPlayerTab,
SessionRecordingUsageType,
SidePanelTab,
Survey,
} from '~/types'

Expand Down Expand Up @@ -458,10 +457,7 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportInstanceSettingChange: (name: string, value: string | boolean | number) => ({ name, value }),
reportAxisUnitsChanged: (properties: Record<string, any>) => ({ ...properties }),
reportTeamSettingChange: (name: string, value: any) => ({ name, value }),
reportActivationSideBarOpened: (tab: SidePanelTab) => ({ tab }),
reportActivationSideBarClosed: (tab?: SidePanelTab) => ({ tab }),
reportActivationSideBarTaskClicked: (key: string) => ({ key }),
reportActivationSideBarTaskSkipped: (key: string) => ({ key }),
reportBillingUpgradeClicked: (plan: string) => ({ plan }),
reportRoleCreated: (role: string) => ({ role }),
reportResourceAccessLevelUpdated: (resourceType: Resource, roleName: string, accessLevel: AccessLevel) => ({
Expand Down Expand Up @@ -1087,26 +1083,11 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
value,
})
},
reportActivationSideBarOpened: ({ tab }) => {
posthog.capture('activation sidebar opened', {
tab,
})
},
reportActivationSideBarClosed: ({ tab }) => {
posthog.capture('activation sidebar closed', {
tab,
})
},
reportActivationSideBarTaskClicked: ({ key }) => {
posthog.capture('activation sidebar task clicked', {
key,
})
},
reportActivationSideBarTaskSkipped: ({ key }) => {
posthog.capture('activation sidebar task skipped', {
key,
})
},
reportBillingUpgradeClicked: ({ plan }) => {
posthog.capture('billing upgrade button clicked', {
plan,
Expand Down

0 comments on commit c8dfe68

Please sign in to comment.