Update ChooseYourPlan page with new trial period options (#9628)
### Context - Update /plan-required page to let users get free trial without credit card plan - Update usePageChangeEffectNavigateLocation to redirect paused and canceled subscription (suspended workspace) to /settings/billing page ### To do - [x] Update usePageChangeEffectNavigateLocation test - [x] Update ChooseYourPlan sb test closes #9520 --------- Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
This commit is contained in:
@ -19,7 +19,6 @@ describe('useSignInWithGoogle', () => {
|
||||
plan: BillingPlanKey.Pro,
|
||||
interval: SubscriptionInterval.Month,
|
||||
requirePaymentMethod: true,
|
||||
skipPlanPage: false,
|
||||
};
|
||||
|
||||
const Wrapper = getJestMetadataAndApolloMocksWrapper({
|
||||
@ -31,7 +30,7 @@ describe('useSignInWithGoogle', () => {
|
||||
const mockUseParams = { workspaceInviteHash: 'testHash' };
|
||||
|
||||
const mockSearchParams = new URLSearchParams(
|
||||
'inviteToken=testToken&billingCheckoutSessionState={"plan":"Pro","interval":"Month","requirePaymentMethod":true,"skipPlanPage":false}',
|
||||
'inviteToken=testToken&billingCheckoutSessionState={"plan":"Pro","interval":"Month","requirePaymentMethod":true}',
|
||||
);
|
||||
|
||||
(useParams as jest.Mock).mockReturnValue(mockUseParams);
|
||||
|
||||
@ -22,7 +22,6 @@ describe('useSignInWithMicrosoft', () => {
|
||||
plan: 'PRO',
|
||||
interval: 'Month',
|
||||
requirePaymentMethod: true,
|
||||
skipPlanPage: false,
|
||||
};
|
||||
|
||||
it('should call signInWithMicrosoft with the correct parameters', () => {
|
||||
|
||||
@ -12,7 +12,6 @@ export const useSignInWithGoogle = () => {
|
||||
plan: 'PRO',
|
||||
interval: 'Month',
|
||||
requirePaymentMethod: true,
|
||||
skipPlanPage: false,
|
||||
} as BillingCheckoutSession;
|
||||
|
||||
const { signInWithGoogle } = useAuth();
|
||||
|
||||
@ -1,16 +1,11 @@
|
||||
import { BillingCheckoutSession } from '@/auth/types/billingCheckoutSession.type';
|
||||
import { BILLING_CHECKOUT_SESSION_DEFAULT_VALUE } from '@/billing/constants/BillingCheckoutSessionDefaultValue';
|
||||
import { createState } from '@ui/utilities/state/utils/createState';
|
||||
import { syncEffect } from 'recoil-sync';
|
||||
import { BillingPlanKey, SubscriptionInterval } from '~/generated/graphql';
|
||||
|
||||
export const billingCheckoutSessionState = createState<BillingCheckoutSession>({
|
||||
key: 'billingCheckoutSessionState',
|
||||
defaultValue: {
|
||||
plan: BillingPlanKey.Pro,
|
||||
interval: SubscriptionInterval.Month,
|
||||
requirePaymentMethod: true,
|
||||
skipPlanPage: false,
|
||||
},
|
||||
defaultValue: BILLING_CHECKOUT_SESSION_DEFAULT_VALUE,
|
||||
effects: [
|
||||
syncEffect({
|
||||
refine: (value: unknown) => {
|
||||
@ -19,8 +14,7 @@ export const billingCheckoutSessionState = createState<BillingCheckoutSession>({
|
||||
value !== null &&
|
||||
'plan' in value &&
|
||||
'interval' in value &&
|
||||
'requirePaymentMethod' in value &&
|
||||
'skipPlanPage' in value
|
||||
'requirePaymentMethod' in value
|
||||
) {
|
||||
return {
|
||||
type: 'success',
|
||||
|
||||
@ -5,5 +5,4 @@ export type BillingCheckoutSession = {
|
||||
plan: BillingPlanKey;
|
||||
interval: SubscriptionInterval;
|
||||
requirePaymentMethod: boolean;
|
||||
skipPlanPage: boolean;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user