mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
console: hide onboarding for users who onboarded before onboarding was launched
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7168 GitOrigin-RevId: 8e119129b2a910fefd692e93a19007cdfd564bf5
This commit is contained in:
parent
adf565fe3d
commit
7f0e4b2092
@ -19,6 +19,10 @@ export const fetchAllOnboardingDataQuery = `
|
||||
activity
|
||||
target
|
||||
}
|
||||
users {
|
||||
id
|
||||
created_at
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
|
@ -8,6 +8,11 @@ import {
|
||||
} from '../constants';
|
||||
import { OnboardingResponseData } from '../types';
|
||||
|
||||
const userMock = {
|
||||
id: '59300b64-fb3a-4f17-8a0f-6f698569eade',
|
||||
created_at: '2022-11-02T13:31:32.526653286Z',
|
||||
};
|
||||
|
||||
export const mockOnboardingData: Record<
|
||||
string,
|
||||
OnboardingResponseData['data']
|
||||
@ -22,6 +27,7 @@ export const mockOnboardingData: Record<
|
||||
target: 'cloud_console',
|
||||
},
|
||||
],
|
||||
users: [userMock],
|
||||
},
|
||||
/**
|
||||
* config to hide wizard as hasura data source created
|
||||
@ -59,6 +65,7 @@ export const mockOnboardingData: Record<
|
||||
target: 'cloud_console',
|
||||
},
|
||||
],
|
||||
users: [userMock],
|
||||
},
|
||||
/**
|
||||
* config to hide wizard as run query clicked
|
||||
@ -100,6 +107,7 @@ export const mockOnboardingData: Record<
|
||||
target: 'cloud_console',
|
||||
},
|
||||
],
|
||||
users: [userMock],
|
||||
},
|
||||
/**
|
||||
* config to hide wizard as user skipped onboarding
|
||||
@ -129,6 +137,7 @@ export const mockOnboardingData: Record<
|
||||
target: 'cloud_console',
|
||||
},
|
||||
],
|
||||
users: [userMock],
|
||||
},
|
||||
/**
|
||||
* config to hide wizard as user completed onboarding
|
||||
@ -158,6 +167,7 @@ export const mockOnboardingData: Record<
|
||||
target: 'cloud_console',
|
||||
},
|
||||
],
|
||||
users: [userMock],
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -3,8 +3,14 @@ export type UserOnboarding = {
|
||||
target: string;
|
||||
};
|
||||
|
||||
export type User = {
|
||||
id: string;
|
||||
created_at: string;
|
||||
};
|
||||
|
||||
export type OnboardingResponseData = {
|
||||
data: {
|
||||
user_onboarding: UserOnboarding[];
|
||||
users: User[];
|
||||
};
|
||||
};
|
||||
|
@ -65,7 +65,14 @@ export function getWizardState(
|
||||
// if onbarding data is not present due to api error, or data loading state, then hide the wizard
|
||||
// this early return is required to distinguish between server errors vs data not being present for user
|
||||
// if the request is successful and data is not present for the given user, then we should show the onboarding wizard
|
||||
if (!onboardingData) return 'hidden';
|
||||
if (!onboardingData?.data) return 'hidden';
|
||||
|
||||
// if user created account before the launch of onboarding wizard (Oct 17, 2022),
|
||||
// hide the wizard and survey
|
||||
const userCreatedAt = new Date(onboardingData.data.users[0].created_at);
|
||||
if (userCreatedAt.getTime() < 1666008600000) {
|
||||
return 'hidden';
|
||||
}
|
||||
|
||||
// transform the onboarding data if present, to a consumable format
|
||||
const transformedOnboardingData = onboardingDataTransformFn(onboardingData);
|
||||
|
Loading…
Reference in New Issue
Block a user