diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx index a6d1176087685..45b08ed3c9627 100644 --- a/frontend/src/lib/constants.tsx +++ b/frontend/src/lib/constants.tsx @@ -193,6 +193,7 @@ export const FEATURE_FLAGS = { SESSION_REPLAY_IOS: 'session-replay-ios', // owner: #team-replay YEAR_IN_HOG: 'year-in-hog', // owner: #team-replay SESSION_REPLAY_EXPORT_MOBILE_DATA: 'session-replay-export-mobile-data', // owner: #team-replay + REDIRECT_INGESTION_PRODUCT_ANALYTICS_ONBOARDING: 'redirect-ingestion-product-analytics-onboarding', // owner: @biancayang } as const export type FeatureFlagKey = (typeof FEATURE_FLAGS)[keyof typeof FEATURE_FLAGS] diff --git a/frontend/src/scenes/onboarding/Onboarding.tsx b/frontend/src/scenes/onboarding/Onboarding.tsx index 656435991ab62..85748159d16da 100644 --- a/frontend/src/scenes/onboarding/Onboarding.tsx +++ b/frontend/src/scenes/onboarding/Onboarding.tsx @@ -65,7 +65,7 @@ const OnboardingWrapper = ({ children }: { children: React.ReactNode }): JSX.Ele const OtherProductsStep = steps = [...steps, OtherProductsStep] } - if (featureFlags[FEATURE_FLAGS.INVITE_TEAM_MEMBER_ONBOARDING] == 'test') { + if (featureFlags[FEATURE_FLAGS.INVITE_TEAM_MEMBER_ONBOARDING] === 'test') { const inviteTeammatesStep = steps = [...steps, inviteTeammatesStep] } diff --git a/frontend/src/scenes/onboarding/onboardingLogic.tsx b/frontend/src/scenes/onboarding/onboardingLogic.tsx index 2b37a54db2329..fb4f01026d897 100644 --- a/frontend/src/scenes/onboarding/onboardingLogic.tsx +++ b/frontend/src/scenes/onboarding/onboardingLogic.tsx @@ -1,5 +1,7 @@ import { actions, connect, kea, listeners, path, props, reducers, selectors } from 'kea' import { actionToUrl, combineUrl, router, urlToAction } from 'kea-router' +import { FEATURE_FLAGS } from 'lib/constants' +import { featureFlagLogic, FeatureFlagsSet } from 'lib/logic/featureFlagLogic' import { eventUsageLogic } from 'lib/utils/eventUsageLogic' import { billingLogic } from 'scenes/billing/billingLogic' import { teamLogic } from 'scenes/teamLogic' @@ -27,10 +29,12 @@ export enum OnboardingStepKey { export type AllOnboardingSteps = OnboardingStep[] export type OnboardingStep = JSX.Element -export const getProductUri = (productKey: ProductKey): string => { +export const getProductUri = (productKey: ProductKey, featureFlags: FeatureFlagsSet): string => { switch (productKey) { case ProductKey.PRODUCT_ANALYTICS: - return combineUrl(urls.events(), { onboarding_completed: true }).url + return featureFlags[FEATURE_FLAGS.REDIRECT_INGESTION_PRODUCT_ANALYTICS_ONBOARDING] === 'test' + ? combineUrl(urls.insights(), { onboarding_completed: true }).url + : combineUrl(urls.events(), { onboarding_completed: true }).url case ProductKey.SESSION_REPLAY: return urls.replay() case ProductKey.FEATURE_FLAGS: @@ -46,7 +50,7 @@ export const onboardingLogic = kea([ props({} as OnboardingLogicProps), path(['scenes', 'onboarding', 'onboardingLogic']), connect({ - values: [billingLogic, ['billing'], teamLogic, ['currentTeam']], + values: [billingLogic, ['billing'], teamLogic, ['currentTeam'], featureFlagLogic, ['featureFlags']], actions: [billingLogic, ['loadBillingSuccess'], teamLogic, ['updateCurrentTeamSuccess']], }), actions({ @@ -85,14 +89,6 @@ export const onboardingLogic = kea([ setStepKey: (_, { stepKey }) => stepKey, }, ], - onCompleteOnboardingRedirectUrl: [ - urls.default(), - { - setProductKey: (_, { productKey }) => { - return productKey ? getProductUri(productKey as ProductKey) : urls.default() - }, - }, - ], subscribedDuringOnboarding: [ false, { @@ -101,6 +97,12 @@ export const onboardingLogic = kea([ ], })), selectors({ + onCompleteOnboardingRedirectUrl: [ + (s) => [s.featureFlags, s.productKey], + (featureFlags: FeatureFlagsSet, productKey: string | null) => { + return productKey ? getProductUri(productKey as ProductKey, featureFlags) : urls.default() + }, + ], totalOnboardingSteps: [ (s) => [s.allOnboardingSteps], (allOnboardingSteps: AllOnboardingSteps) => allOnboardingSteps.length, diff --git a/frontend/src/scenes/products/Products.tsx b/frontend/src/scenes/products/Products.tsx index eed399afba9a7..681d7a810bdd8 100644 --- a/frontend/src/scenes/products/Products.tsx +++ b/frontend/src/scenes/products/Products.tsx @@ -5,6 +5,7 @@ import { useActions, useValues } from 'kea' import { router } from 'kea-router' import { LemonCard } from 'lib/lemon-ui/LemonCard/LemonCard' import { Spinner } from 'lib/lemon-ui/Spinner' +import { featureFlagLogic } from 'lib/logic/featureFlagLogic' import { billingLogic } from 'scenes/billing/billingLogic' import { getProductUri } from 'scenes/onboarding/onboardingLogic' import { SceneExport } from 'scenes/sceneTypes' @@ -93,6 +94,7 @@ export function ProductCard({ className?: string }): JSX.Element { const { currentTeam } = useValues(teamLogic) + const { featureFlags } = useValues(featureFlagLogic) const onboardingCompleted = currentTeam?.has_completed_onboarding_for?.[product.type] const vertical = orientation === 'vertical' @@ -113,7 +115,7 @@ export function ProductCard({
{onboardingCompleted ? ( diff --git a/frontend/src/scenes/urls.ts b/frontend/src/scenes/urls.ts index 26452f9e94f5f..bd5cbe5939aec 100644 --- a/frontend/src/scenes/urls.ts +++ b/frontend/src/scenes/urls.ts @@ -64,6 +64,7 @@ export const urls = { `/batch_exports/${id}` + (params ? `?${toParams(params)}` : ''), batchExportEdit: (id: string): string => `/batch_exports/${id}/edit`, ingestionWarnings: (): string => '/data-management/ingestion-warnings', + insights: (): string => '/insights', insightNew: (filters?: AnyPartialFilterType, dashboardId?: DashboardType['id'] | null, query?: string): string => combineUrl('/insights/new', dashboardId ? { dashboard: dashboardId } : {}, { ...(filters ? { filters } : {}),