Ensure all onboarding exit states are captured as details in the onboarding table

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9075
GitOrigin-RevId: fe44e8042c4663ffe8e5c26449b4757b1c4ebbbf
This commit is contained in:
Aaysha 2023-05-12 13:13:09 +05:30 committed by hasura-bot
parent 426e8aed42
commit 06276b0055
6 changed files with 43 additions and 49 deletions

View File

@ -12,8 +12,11 @@ import {
usePrefetchNeonOnboardingTemplateData,
useEmitOnboardingEvents,
} from '../../../hooks';
import { NEON_TEMPLATE_BASE_PATH } from '../../../constants';
import { persistSkippedOnboarding } from '../../../utils';
import {
NEON_TEMPLATE_BASE_PATH,
skippedNeonOnboardingVariables,
} from '../../../constants';
import { emitOnboardingEvent } from '../../../utils';
export function NeonOnboarding(props: {
dispatch: Dispatch;
@ -26,7 +29,7 @@ export function NeonOnboarding(props: {
const { dispatch, dismiss, proceed, setStepperIndex } = props;
const onSkipHandler = () => {
persistSkippedOnboarding();
emitOnboardingEvent(skippedNeonOnboardingVariables);
dismiss();
};

View File

@ -6,8 +6,9 @@ import { HasuraLogoFull } from '../../../../../new-components/HasuraLogo';
import { Analytics } from '../../../../Analytics';
import { NeonIcon } from './NeonIcon';
import _push from '../../../../../components/Services/Data/push';
import { persistSkippedOnboarding } from '../../utils';
import { emitOnboardingEvent } from '../../utils';
import { Dispatch } from '../../../../../types';
import { skippedNeonOnboardingToConnectOtherDB } from '../../constants';
const iconMap = {
refresh: <MdRefresh />,
@ -52,7 +53,7 @@ export function NeonBanner(props: Props) {
it registers that user skipped onboarding and take them directly to connect database page*/
const onClickConnectOtherDB = () => {
dispatch(_push('/data/manage/connect'));
persistSkippedOnboarding();
emitOnboardingEvent(skippedNeonOnboardingToConnectOtherDB);
dismiss();
};

View File

@ -1,8 +1,11 @@
import React, { useEffect, useState, useMemo } from 'react';
import { Button } from '../../../../../new-components/Button';
import { LS_KEYS, removeLSItem } from '../../../../../utils/localStorage';
import { emitOnboardingEvent, persistSkippedOnboarding } from '../../utils';
import { getUseCaseExperimentOnboardingVariables } from '../../constants';
import { emitOnboardingEvent } from '../../utils';
import {
getUseCaseExperimentOnboardingVariables,
skippedUseCaseExperimentOnboarding,
} from '../../constants';
import { Analytics, trackCustomEvent } from '../../../../Analytics';
import { Dispatch } from '../../../../../types';
import _push from '../../../../../components/Services/Data/push';
@ -153,7 +156,7 @@ export const UseCaseScreen = (props: UseCaseScreenProps) => {
onClick={() => {
props.dismiss();
removeLSItem(LS_KEYS.useCaseExperimentOnboarding);
persistSkippedOnboarding();
emitOnboardingEvent(skippedUseCaseExperimentOnboarding);
}}
>
Skip

View File

@ -84,7 +84,16 @@ export const onboardingCompleteVariables = {
kind: 'onboarding_complete',
};
export const skippedOnboardingVariables = {
export const skippedOnboardingThroughURLParamVariables = {
...mutationVariables,
kind: 'skipped_neon_onboarding_through_url_param',
};
export const skippedNeonOnboardingToConnectOtherDB = {
...mutationVariables,
kind: 'skipped_neon_onboarding_to_connect_other_db',
};
export const skippedNeonOnboardingVariables = {
...mutationVariables,
kind: 'skipped_onboarding',
};
@ -94,11 +103,6 @@ export const skippedOnboardingWizardVariables = {
kind: 'skipped_onboarding_wizard',
};
export const skippedNeonOnboardingVariables = {
...mutationVariables,
kind: 'skipped_neon_onboarding',
};
export const neonOAuthStartVariables = {
...mutationVariables,
kind: 'neon_login_start',
@ -159,6 +163,11 @@ export const useCaseExperimentOnboarding = {
kind: 'onboarded_through_use_case_experiment',
};
export const skippedUseCaseExperimentOnboarding = {
...mutationVariables,
kind: 'skipped_use_case_experiment_onboarding',
};
export const getUseCaseExperimentOnboardingVariables = (useCase: UseCases) => ({
...useCaseExperimentOnboarding,
subkind: useCase,

View File

@ -5,7 +5,7 @@ import { HasuraMetadataV3 } from '../../../metadata/types';
import { reactQueryClient } from '../../../lib/reactQuery';
import { programmaticallyTraceError } from '../../Analytics';
import {
skippedOnboardingVariables,
skippedNeonOnboardingVariables,
onboardingCompleteVariables,
templateSummaryRunQueryClickVariables,
templateSummaryRunQuerySkipVariables,
@ -16,8 +16,7 @@ import {
fetchAllOnboardingDataQueryVariables,
oneClickDeploymentOnboardingShown,
useCaseExperimentOnboarding,
skippedOnboardingWizardVariables,
skippedNeonOnboardingVariables,
skippedOnboardingThroughURLParamVariables,
} from './constants';
import { WizardState } from './hooks/useWizardState';
import { OnboardingResponseData, UserOnboarding } from './types';
@ -27,7 +26,7 @@ export function shouldShowOnboarding(onboardingData: UserOnboarding) {
const userActivity = onboardingData?.activity;
if (
userActivity?.[skippedOnboardingVariables.kind]?.value === 'true' ||
userActivity?.[skippedNeonOnboardingVariables.kind]?.value === 'true' ||
userActivity?.[onboardingCompleteVariables.kind]?.value === 'true' ||
userActivity?.[hasuraSourceCreationStartVariables.kind]?.value === 'true' ||
userActivity?.[templateSummaryRunQuerySkipVariables.kind]?.value ===
@ -41,7 +40,7 @@ export function shouldShowOnboarding(onboardingData: UserOnboarding) {
return false;
}
if (getLSItem(LS_KEYS.skipOnboarding) === 'true') {
persistOnboardingType(skippedOnboardingWizardVariables);
emitOnboardingEvent(skippedOnboardingThroughURLParamVariables);
return false;
}
return true;
@ -105,36 +104,6 @@ const cloudHeaders = {
'content-type': 'application/json',
};
// persist skipped onboarding in the database
export const persistSkippedOnboarding = () => {
// mutate server data
cloudDataServiceApiClient<ResponseDataOnMutation, ResponseDataOnMutation>(
trackOnboardingActivityMutation,
skippedOnboardingVariables,
cloudHeaders
).catch(error => {
programmaticallyTraceError(error);
throw error;
});
};
type OnboardingType =
| typeof skippedOnboardingWizardVariables
| typeof skippedOnboardingVariables
| typeof skippedNeonOnboardingVariables;
export const persistOnboardingType = (variables: OnboardingType) => {
// mutate server data
cloudDataServiceApiClient<ResponseDataOnMutation, ResponseDataOnMutation>(
trackOnboardingActivityMutation,
variables,
cloudHeaders
).catch(error => {
programmaticallyTraceError(error);
throw error;
});
};
export const emitOnboardingEvent = (variables: Record<string, unknown>) => {
// mutate server data
cloudDataServiceApiClient<ResponseDataOnMutation, ResponseDataOnMutation>(

9
frontend/snapshots.js Normal file
View File

@ -0,0 +1,9 @@
{
"$schema": "http://json-schema.org/schema",
"cli": "nx",
"title": "Chromatic executor",
"description": "",
"type": "object",
"properties": {},
"required": []
}