Skip to content

Commit

Permalink
fix: remove geolocation from session replay onboarding (#22341)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed May 25, 2024
1 parent a095c1d commit 896a46c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 16 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion frontend/src/scenes/onboarding/Onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ const SessionReplayOnboarding = (): JSX.Element => {
subtitle="Choose the framework your frontend is built on, or use our all-purpose JavaScript library. If you already have the snippet installed, you can skip this step!"
stepKey={OnboardingStepKey.INSTALL}
/>
<OnboardingProductConfiguration stepKey={OnboardingStepKey.PRODUCT_CONFIGURATION} options={configOptions} />
<OnboardingProductConfiguration
stepKey={OnboardingStepKey.PRODUCT_CONFIGURATION}
options={configOptions}
product={ProductKey.SESSION_REPLAY}
/>
</OnboardingWrapper>
)
}
Expand Down
37 changes: 23 additions & 14 deletions frontend/src/scenes/onboarding/OnboardingProductConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { useActions, useValues } from 'kea'
import React, { useEffect, useRef } from 'react'
import { pipelineDefaultEnabledLogic } from 'scenes/pipeline/pipelineDefaultEnabledLogic'

import { ProductKey } from '~/types'

import { OnboardingStepKey } from './onboardingLogic'
import { onboardingProductConfigurationLogic, ProductConfigOption } from './onboardingProductConfigurationLogic'
import { OnboardingStep } from './OnboardingStep'
Expand All @@ -29,9 +31,12 @@ type ConfigOption =
export const OnboardingProductConfiguration = ({
stepKey = OnboardingStepKey.PRODUCT_CONFIGURATION,
options,
product,
}: {
stepKey?: OnboardingStepKey
options: (ProductConfigOption | undefined)[]
// which product is being configured
product?: ProductKey
}): JSX.Element | null => {
const { configOptions } = useValues(onboardingProductConfigurationLogic)
const { pipelineDefaultEnabled } = useValues(pipelineDefaultEnabledLogic)
Expand Down Expand Up @@ -66,20 +71,24 @@ export const OnboardingProductConfiguration = ({
setConfigOptions(updatedConfigOptions)
},
})),
...pipelineDefaultEnabled.map((item) => {
return {
title: item.title,
description: item.description,
type: 'plugin' as PluginType,
value: item.enabled,
onChange: (enabled: boolean) => {
toggleEnabled({
id: item.id,
enabled: enabled,
})
},
}
}),
...pipelineDefaultEnabled
.filter((plugin) => {
return !(product && plugin?.productOnboardingDenyList?.includes(product))
})
.map((item) => {
return {
title: item.title,
description: item.description,
type: 'plugin' as PluginType,
value: item.enabled,
onChange: (enabled: boolean) => {
toggleEnabled({
id: item.id,
enabled: enabled,
})
},
}
}),
]

return combinedList.length > 0 ? (
Expand Down
11 changes: 10 additions & 1 deletion frontend/src/scenes/pipeline/pipelineDefaultEnabledLogic.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
import { connect, kea, path, selectors } from 'kea'

import { ProductKey } from '~/types'

import type { pipelineDefaultEnabledLogicType } from './pipelineDefaultEnabledLogicType'
import { pipelineTransformationsLogic } from './transformationsLogic'

interface PluginContent {
title: string
description: string
// which onboarding pages should this plugin be hidden on
// e.g. geolocation doesn't apply to session replay
productOnboardingDenyList?: ProductKey[]
}

type PluginContentMapping = Record<string, PluginContent>
const pluginContentMapping: PluginContentMapping = {
export const pluginContentMapping: PluginContentMapping = {
GeoIP: {
title: 'Capture location information',
description:
'Enrich PostHog events and persons with IP location data. This is useful for understanding where your users are coming from. This setting can be found under data pipeline.',
productOnboardingDenyList: [ProductKey.SESSION_REPLAY],
},
}

export interface DefaultEnabledType {
title: string
description?: string
productOnboardingDenyList?: ProductKey[]
id: number
enabled: boolean
}
Expand All @@ -45,6 +53,7 @@ export const pipelineDefaultEnabledLogic = kea<pipelineDefaultEnabledLogicType>(
return {
title: pluginContent?.title || plugin.name,
description: pluginContent?.description || plugin.description,
productOnboardingDenyList: pluginContent?.productOnboardingDenyList,
id: pluginConfig.id,
enabled: pluginConfig.enabled,
}
Expand Down

0 comments on commit 896a46c

Please sign in to comment.