fix billingCheckoutSession query param + enable redirect on workspace… (#11509)

… during onboarding



fixes : https://github.com/twentyhq/core-team-issues/issues/668
This commit is contained in:
Etienne
2025-04-10 16:47:40 +02:00
committed by GitHub
parent d69932c6c4
commit ee5aa2393d
20 changed files with 151 additions and 92 deletions

View File

@ -0,0 +1,32 @@
import { animateModalState } from '@/auth/states/animateModalState';
import { billingCheckoutSessionState } from '@/auth/states/billingCheckoutSessionState';
import { BILLING_CHECKOUT_SESSION_DEFAULT_VALUE } from '@/billing/constants/BillingCheckoutSessionDefaultValue';
import { useRecoilCallback } from 'recoil';
export const useBuildSearchParamsFromUrlSyncedStates = () => {
const buildSearchParamsFromUrlSyncedStates = useRecoilCallback(
({ snapshot }) =>
async () => {
const animateModal = snapshot.getLoadable(animateModalState).getValue();
const billingCheckoutSession = snapshot
.getLoadable(billingCheckoutSessionState)
.getValue();
const output = {
...(billingCheckoutSession !== BILLING_CHECKOUT_SESSION_DEFAULT_VALUE
? {
billingCheckoutSession: JSON.stringify(billingCheckoutSession),
}
: {}),
...(animateModal === false ? { animateModal: 'false' } : {}),
};
return output;
},
[],
);
return {
buildSearchParamsFromUrlSyncedStates,
};
};