5095 move onboardingstatus computation from frontend to backend (#5954)

- move front `onboardingStatus` computing to server side
- add logic to `useSetNextOnboardingStatus`
- update some missing redirections in
`usePageChangeEffectNavigateLocation`
- separate subscriptionStatus from onboardingStatus
This commit is contained in:
martmull
2024-06-28 17:32:02 +02:00
committed by GitHub
parent 1a66db5bff
commit b8f33f6f59
78 changed files with 1767 additions and 1763 deletions

View File

@ -19,6 +19,7 @@ import { ActionLink } from '@/ui/navigation/link/components/ActionLink';
import { CAL_LINK } from '@/ui/navigation/link/constants/Cal';
import {
ProductPriceEntity,
SubscriptionInterval,
useCheckoutSessionMutation,
useGetProductPricesQuery,
} from '~/generated/graphql';
@ -75,7 +76,7 @@ const benefits = [
export const ChooseYourPlan = () => {
const billing = useRecoilValue(billingState);
const [planSelected, setPlanSelected] = useState('month');
const [planSelected, setPlanSelected] = useState(SubscriptionInterval.Month);
const [isSubmitting, setIsSubmitting] = useState(false);
@ -87,7 +88,7 @@ export const ChooseYourPlan = () => {
const [checkoutSession] = useCheckoutSessionMutation();
const handlePlanChange = (type?: string) => {
const handlePlanChange = (type?: SubscriptionInterval) => {
return () => {
if (isNonEmptyString(type) && planSelected !== type) {
setPlanSelected(type);
@ -101,11 +102,11 @@ export const ChooseYourPlan = () => {
price: ProductPriceEntity,
prices: ProductPriceEntity[],
): string => {
if (price.recurringInterval !== 'year') {
if (price.recurringInterval !== SubscriptionInterval.Year) {
return 'Cancel anytime';
}
const monthPrice = prices.filter(
(price) => price.recurringInterval === 'month',
(price) => price.recurringInterval === SubscriptionInterval.Month,
)?.[0];
if (
isDefined(monthPrice) &&