The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Pass Billing Checkout var in url to bypass credit card (#9283)
Félix Malfait97f5a5b8a586
diff --git a/README.md b/README.mdindex 191012dc465..258f6f41032 100644--- a/README.md+++ b/README.md@@ -31,6 +31,13 @@ We felt the need for a CRM platform that empowers rather than constrains. We bel<br># Demo++<!--+You can use the following url to sign up to the cloud version without providing a credit card:++<a href="https://demo.twenty.com/?billingCheckoutSession={"plan":"PRO","recurringInterval":"MONTHLY","requirePaymentMethod":false,"skipPlanPage":true}">https://demo.twenty.com/?billingCheckoutSession={"plan":"PRO","recurringInterval":"MONTHLY","requirePaymentMethod":false,"skipPlanPage":true}</a>++-->Go to <a href="https://demo.twenty.com/">demo.twenty.com</a> and login with the following credentials:```diff --git a/packages/twenty-front/package.json b/packages/twenty-front/package.jsonindex 76ae9c72fa6..3e91a2eea1a 100644--- a/packages/twenty-front/package.json+++ b/packages/twenty-front/package.json@@ -48,6 +48,7 @@"buffer": "^6.0.3","docx": "^9.1.0","file-saver": "^2.0.5",+ "recoil-sync": "^0.2.0","transliteration": "^2.3.5"},"devDependencies": {diff --git a/packages/twenty-front/src/generated/graphql.tsx b/packages/twenty-front/src/generated/graphql.tsxindex 6290fbfcd3b..d06c6140b1e 100644--- a/packages/twenty-front/src/generated/graphql.tsx+++ b/packages/twenty-front/src/generated/graphql.tsx@@ -115,6 +115,13 @@ export type Billing = {isBillingEnabled: Scalars['Boolean'];};+/** The different billing plans available */+export enum BillingPlanKey {+ Base = 'BASE',+ Enterprise = 'ENTERPRISE',+ Pro = 'PRO'+}+export type BillingSubscription = {__typename?: 'BillingSubscription';id: Scalars['UUID'];@@ -182,6 +189,30 @@ export type ComputeStepOutputSchemaInput = {step: Scalars['JSON'];};+export type CreateFieldInput = {+ defaultValue?: InputMaybe<Scalars['JSON']>;+ description?: InputMaybe<Scalars['String']>;+ icon?: InputMaybe<Scalars['String']>;+ isActive?: InputMaybe<Scalars['Boolean']>;+ isCustom?: InputMaybe<Scalars['Boolean']>;+ isLabelSyncedWithName?: InputMaybe<Scalars['Boolean']>;+ isNullable?: InputMaybe<Scalars['Boolean']>;+ isRemoteCreation?: InputMaybe<Scalars['Boolean']>;+ isSystem?: InputMaybe<Scalars['Boolean']>;+ isUnique?: InputMaybe<Scalars['Boolean']>;+ label: Scalars['String'];+ name: Scalars['String'];+ objectMetadataId: Scalars['String'];+ options?: InputMaybe<Scalars['JSON']>;+ settings?: InputMaybe<Scalars['JSON']>;+ type: FieldMetadataType;+};++export type CreateOneFieldMetadataInput = {+ /** The record to create */+ field: CreateFieldInput;+};+export type CreateServerlessFunctionInput = {description?: InputMaybe<Scalars['String']>;name: Scalars['String'];@@ -205,6 +236,11 @@ export type CursorPaging = {last?: InputMaybe<Scalars['Int']>;};+export type DeleteOneFieldInput = {+ /** The id of the field to delete. */+ id: Scalars['UUID'];+};+export type DeleteOneObjectInput = {/** The id of the record to delete. */id: Scalars['UUID'];@@ -447,12 +483,14 @@ export type Mutation = {computeStepOutputSchema: Scalars['JSON'];createOIDCIdentityProvider: SetupSsoOutput;createOneAppToken: AppToken;+ createOneField: Field;createOneObject: Object;createOneServerlessFunction: ServerlessFunction;createSAMLIdentityProvider: SetupSsoOutput;createWorkflowVersionStep: WorkflowAction;deactivateWorkflowVersion: Scalars['Boolean'];deleteCurrentWorkspace: Workspace;+ deleteOneField: Field;deleteOneObject: Object;deleteOneServerlessFunction: ServerlessFunction;deleteSSOIdentityProvider: DeleteSsoOutput;@@ -478,6 +516,7 @@ export type Mutation = {switchWorkspace: PublicWorkspaceDataOutput;track: Analytics;updateBillingSubscription: UpdateBillingEntity;+ updateOneField: Field;updateOneObject: Object;updateOneServerlessFunction: ServerlessFunction;updatePasswordViaResetToken: InvalidatePassword;@@ -528,7 +567,9 @@ export type MutationChallengeArgs = {export type MutationCheckoutSessionArgs = {+ plan?: BillingPlanKey;recurringInterval: SubscriptionInterval;+ requirePaymentMethod?: Scalars['Boolean'];successUrlPath?: InputMaybe<Scalars['String']>;};@@ -543,6 +584,11 @@ export type MutationCreateOidcIdentityProviderArgs = {};+export type MutationCreateOneFieldArgs = {+ input: CreateOneFieldMetadataInput;+};++export type MutationCreateOneServerlessFunctionArgs = {input: CreateServerlessFunctionInput;};@@ -563,6 +609,11 @@ export type MutationDeactivateWorkflowVersionArgs = {};+export type MutationDeleteOneFieldArgs = {+ input: DeleteOneFieldInput;+};++export type MutationDeleteOneObjectArgs = {input: DeleteOneObjectInput;};@@ -665,6 +716,11 @@ export type MutationTrackArgs = {};+export type MutationUpdateOneFieldArgs = {+ input: UpdateOneFieldMetadataInput;+};++export type MutationUpdateOneObjectArgs = {input: UpdateOneObjectInput;};@@ -825,6 +881,8 @@ export type Query = {clientConfig: ClientConfig;currentUser: User;currentWorkspace: Workspace;+ field: Field;+ fields: FieldConnection;findAvailableWorkspacesByEmail: Array<AvailableWorkspaceOutput>;findManyServerlessFunctions: Array<ServerlessFunction>;findOneServerlessFunction: ServerlessFunction;@@ -1241,6 +1299,22 @@ export type UpdateBillingEntity = {success: Scalars['Boolean'];};+export type UpdateFieldInput = {+ defaultValue?: InputMaybe<Scalars['JSON']>;+ description?: InputMaybe<Scalars['String']>;+ icon?: InputMaybe<Scalars['String']>;+ isActive?: InputMaybe<Scalars['Boolean']>;+ isCustom?: InputMaybe<Scalars['Boolean']>;+ isLabelSyncedWithName?: InputMaybe<Scalars['Boolean']>;+ isNullable?: InputMaybe<Scalars['Boolean']>;+ isSystem?: InputMaybe<Scalars['Boolean']>;+ isUnique?: InputMaybe<Scalars['Boolean']>;+ label?: InputMaybe<Scalars['String']>;+ name?: InputMaybe<Scalars['String']>;+ options?: InputMaybe<Scalars['JSON']>;+ settings?: InputMaybe<Scalars['JSON']>;+};+export type UpdateObjectPayload = {description?: InputMaybe<Scalars['String']>;icon?: InputMaybe<Scalars['String']>;@@ -1255,6 +1329,13 @@ export type UpdateObjectPayload = {shortcut?: InputMaybe<Scalars['String']>;};+export type UpdateOneFieldMetadataInput = {+ /** The id of the record to update */+ id: Scalars['UUID'];+ /** The record to update */+ update: UpdateFieldInput;+};+export type UpdateOneObjectInput = {/** The id of the object to update */id: Scalars['UUID'];@@ -1944,6 +2025,8 @@ export type BillingPortalSessionQuery = { __typename?: 'Query', billingPortalSesexport type CheckoutSessionMutationVariables = Exact<{recurringInterval: SubscriptionInterval;successUrlPath?: InputMaybe<Scalars['String']>;+ plan: BillingPlanKey;+ requirePaymentMethod: Scalars['Boolean'];}>;@@ -3234,10 +3317,12 @@ export type BillingPortalSessionQueryHookResult = ReturnType<typeof useBillingPoexport type BillingPortalSessionLazyQueryHookResult = ReturnType<typeof useBillingPortalSessionLazyQuery>;export type BillingPortalSessionQueryResult = Apollo.QueryResult<BillingPortalSessionQuery, BillingPortalSessionQueryVariables>;export const CheckoutSessionDocument = gql`- mutation CheckoutSession($recurringInterval: SubscriptionInterval!, $successUrlPath: String) {+ mutation CheckoutSession($recurringInterval: SubscriptionInterval!, $successUrlPath: String, $plan: BillingPlanKey!, $requirePaymentMethod: Boolean!) {checkoutSession(recurringInterval: $recurringIntervalsuccessUrlPath: $successUrlPath+ plan: $plan+ requirePaymentMethod: $requirePaymentMethod) {url}@@ -3260,6 +3345,8 @@ export type CheckoutSessionMutationFn = Apollo.MutationFunction<CheckoutSessionM* variables: {* recurringInterval: // value for 'recurringInterval'* successUrlPath: // value for 'successUrlPath'+ * plan: // value for 'plan'+ * requirePaymentMethod: // value for 'requirePaymentMethod'* },* });*/diff --git a/packages/twenty-front/src/modules/activities/copilot/right-drawer/states/copilotQueryState.ts b/packages/twenty-front/src/modules/activities/copilot/right-drawer/states/copilotQueryState.tsindex ee56e8b0fe8..b2782ace42b 100644--- a/packages/twenty-front/src/modules/activities/copilot/right-drawer/states/copilotQueryState.ts+++ b/packages/twenty-front/src/modules/activities/copilot/right-drawer/states/copilotQueryState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const copilotQueryState = createState({key: 'activities/copilot-query',diff --git a/packages/twenty-front/src/modules/activities/emails/states/lastViewableEmailThreadIdState.ts b/packages/twenty-front/src/modules/activities/emails/states/lastViewableEmailThreadIdState.tsindex 4e90b960566..2bcf9c1e2f4 100644--- a/packages/twenty-front/src/modules/activities/emails/states/lastViewableEmailThreadIdState.ts+++ b/packages/twenty-front/src/modules/activities/emails/states/lastViewableEmailThreadIdState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const emailThreadIdWhenEmailThreadWasClosedState = createState<string | nulldiff --git a/packages/twenty-front/src/modules/activities/states/activityTargetableEntityArrayState.ts b/packages/twenty-front/src/modules/activities/states/activityTargetableEntityArrayState.tsindex 0d6e06ab468..c251913b9bd 100644--- a/packages/twenty-front/src/modules/activities/states/activityTargetableEntityArrayState.ts+++ b/packages/twenty-front/src/modules/activities/states/activityTargetableEntityArrayState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { ActivityTargetableObject } from '../types/ActivityTargetableEntity';diff --git a/packages/twenty-front/src/modules/activities/states/canCreateActivityState.ts b/packages/twenty-front/src/modules/activities/states/canCreateActivityState.tsindex 5da7f60e1c6..709399107cc 100644--- a/packages/twenty-front/src/modules/activities/states/canCreateActivityState.ts+++ b/packages/twenty-front/src/modules/activities/states/canCreateActivityState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const canCreateActivityState = createState<boolean>({key: 'canCreateActivityState',diff --git a/packages/twenty-front/src/modules/activities/states/isActivityInCreateModeState.ts b/packages/twenty-front/src/modules/activities/states/isActivityInCreateModeState.tsindex 61aaf33d36d..4ae973044ee 100644--- a/packages/twenty-front/src/modules/activities/states/isActivityInCreateModeState.ts+++ b/packages/twenty-front/src/modules/activities/states/isActivityInCreateModeState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isActivityInCreateModeState = createState<boolean>({key: 'isActivityInCreateModeState',diff --git a/packages/twenty-front/src/modules/activities/states/isCreatingActivityInDBState.ts b/packages/twenty-front/src/modules/activities/states/isCreatingActivityInDBState.tsindex 278b2430c17..30e111a6634 100644--- a/packages/twenty-front/src/modules/activities/states/isCreatingActivityInDBState.ts+++ b/packages/twenty-front/src/modules/activities/states/isCreatingActivityInDBState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isUpsertingActivityInDBState = createState<boolean>({key: 'isUpsertingActivityInDBState',diff --git a/packages/twenty-front/src/modules/app/components/App.tsx b/packages/twenty-front/src/modules/app/components/App.tsxindex f760ee9f6fb..af4c1eec010 100644--- a/packages/twenty-front/src/modules/app/components/App.tsx+++ b/packages/twenty-front/src/modules/app/components/App.tsx@@ -7,26 +7,29 @@ import { ExceptionHandlerProvider } from '@/error-handler/components/ExceptionHaimport { SnackBarProviderScope } from '@/ui/feedback/snack-bar-manager/scopes/SnackBarProviderScope';import { HelmetProvider } from 'react-helmet-async';import { RecoilRoot } from 'recoil';+import { RecoilURLSyncJSON } from 'recoil-sync';import { IconsProvider } from 'twenty-ui';export const App = () => {return (<RecoilRoot>- <AppErrorBoundary>- <CaptchaProvider>- <RecoilDebugObserverEffect />- <ApolloDevLogEffect />- <SnackBarProviderScope snackBarManagerScopeId="snack-bar-manager">- <IconsProvider>- <ExceptionHandlerProvider>- <HelmetProvider>- <AppRouter />- </HelmetProvider>- </ExceptionHandlerProvider>- </IconsProvider>- </SnackBarProviderScope>- </CaptchaProvider>- </AppErrorBoundary>+ <RecoilURLSyncJSON location={{ part: 'queryParams' }}>+ <AppErrorBoundary>+ <CaptchaProvider>+ <RecoilDebugObserverEffect />+ <ApolloDevLogEffect />+ <SnackBarProviderScope snackBarManagerScopeId="snack-bar-manager">+ <IconsProvider>+ <ExceptionHandlerProvider>+ <HelmetProvider>+ <AppRouter />+ </HelmetProvider>+ </ExceptionHandlerProvider>+ </IconsProvider>+ </SnackBarProviderScope>+ </CaptchaProvider>+ </AppErrorBoundary>+ </RecoilURLSyncJSON></RecoilRoot>);};diff --git a/packages/twenty-front/src/modules/auth/hooks/useAuth.ts b/packages/twenty-front/src/modules/auth/hooks/useAuth.tsindex 659cab893b8..d28d49d59e0 100644--- a/packages/twenty-front/src/modules/auth/hooks/useAuth.ts+++ b/packages/twenty-front/src/modules/auth/hooks/useAuth.ts@@ -43,16 +43,17 @@ import { getTimeFormatFromWorkspaceTimeFormat } from '@/localization/utils/getTiimport { currentUserState } from '../states/currentUserState';import { tokenPairState } from '../states/tokenPairState';+import { BillingCheckoutSession } from '@/auth/types/billingCheckoutSession.type';import { isMultiWorkspaceEnabledState } from '@/client-config/states/isMultiWorkspaceEnabledState';import { useIsCurrentLocationOnAWorkspaceSubdomain } from '@/domain-manager/hooks/useIsCurrentLocationOnAWorkspaceSubdomain';import { useLastAuthenticatedWorkspaceDomain } from '@/domain-manager/hooks/useLastAuthenticatedWorkspaceDomain';import { useReadWorkspaceSubdomainFromCurrentLocation } from '@/domain-manager/hooks/useReadWorkspaceSubdomainFromCurrentLocation';+import { useRedirect } from '@/domain-manager/hooks/useRedirect';+import { useRedirectToWorkspaceDomain } from '@/domain-manager/hooks/useRedirectToWorkspaceDomain';import { domainConfigurationState } from '@/domain-manager/states/domainConfigurationState';import { isAppWaitingForFreshObjectMetadataState } from '@/object-metadata/states/isAppWaitingForFreshObjectMetadataState';-import { workspaceAuthProvidersState } from '@/workspace/states/workspaceAuthProvidersState';import { AppPath } from '@/types/AppPath';-import { useRedirectToWorkspaceDomain } from '@/domain-manager/hooks/useRedirectToWorkspaceDomain';-import { useRedirect } from '@/domain-manager/hooks/useRedirect';+import { workspaceAuthProvidersState } from '@/workspace/states/workspaceAuthProvidersState';export const useAuth = () => {const setTokenPair = useSetRecoilState(tokenPairState);@@ -382,6 +383,7 @@ export const useAuth = () => {params: {workspacePersonalInviteToken?: string;workspaceInviteHash?: string;+ billingCheckoutSession?: BillingCheckoutSession;},) => {const url = new URL(`${REACT_APP_SERVER_BASE_URL}${path}`);@@ -394,6 +396,12 @@ export const useAuth = () => {params.workspacePersonalInviteToken,);}+ if (isDefined(params.billingCheckoutSession)) {+ url.searchParams.set(+ 'billingCheckoutSessionState',+ JSON.stringify(params.billingCheckoutSession),+ );+ }if (isDefined(workspaceSubdomain)) {url.searchParams.set('workspaceSubdomain', workspaceSubdomain);@@ -408,6 +416,7 @@ export const useAuth = () => {(params: {workspacePersonalInviteToken?: string;workspaceInviteHash?: string;+ billingCheckoutSession?: BillingCheckoutSession;}) => {redirect(buildRedirectUrl('/auth/google', params));},@@ -418,6 +427,7 @@ export const useAuth = () => {(params: {workspacePersonalInviteToken?: string;workspaceInviteHash?: string;+ billingCheckoutSession?: BillingCheckoutSession;}) => {redirect(buildRedirectUrl('/auth/microsoft', params));},diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useSignInWithGoogle.test.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useSignInWithGoogle.test.tsindex 6cb9f84ed8e..5a7072ceaca 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useSignInWithGoogle.test.ts+++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useSignInWithGoogle.test.ts@@ -1,7 +1,9 @@-import { renderHook } from '@testing-library/react';-import { useParams, useSearchParams } from 'react-router-dom';import { useAuth } from '@/auth/hooks/useAuth';import { useSignInWithGoogle } from '@/auth/sign-in-up/hooks/useSignInWithGoogle';+import { renderHook } from '@testing-library/react';+import { useParams, useSearchParams } from 'react-router-dom';+import { BillingPlanKey, SubscriptionInterval } from '~/generated/graphql';+import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';jest.mock('react-router-dom', () => ({useParams: jest.fn(),@@ -13,10 +15,24 @@ jest.mock('@/auth/hooks/useAuth', () => ({}));describe('useSignInWithGoogle', () => {+ const mockBillingCheckoutSession = {+ plan: BillingPlanKey.Pro,+ interval: SubscriptionInterval.Month,+ requirePaymentMethod: true,+ skipPlanPage: false,+ };++ const Wrapper = getJestMetadataAndApolloMocksWrapper({+ apolloMocks: [],+ });+it('should call signInWithGoogle with correct params', () => {const signInWithGoogleMock = jest.fn();const mockUseParams = { workspaceInviteHash: 'testHash' };- const mockSearchParams = new URLSearchParams('inviteToken=testToken');++ const mockSearchParams = new URLSearchParams(+ 'inviteToken=testToken&billingCheckoutSessionState={"plan":"Pro","interval":"Month","requirePaymentMethod":true,"skipPlanPage":false}',+ );(useParams as jest.Mock).mockReturnValue(mockUseParams);(useSearchParams as jest.Mock).mockReturnValue([mockSearchParams]);@@ -24,12 +40,15 @@ describe('useSignInWithGoogle', () => {signInWithGoogle: signInWithGoogleMock,});- const { result } = renderHook(() => useSignInWithGoogle());+ const { result } = renderHook(() => useSignInWithGoogle(), {+ wrapper: Wrapper,+ });result.current.signInWithGoogle();expect(signInWithGoogleMock).toHaveBeenCalledWith({workspaceInviteHash: 'testHash',workspacePersonalInviteToken: 'testToken',+ billingCheckoutSession: mockBillingCheckoutSession,});});@@ -44,12 +63,15 @@ describe('useSignInWithGoogle', () => {signInWithGoogle: signInWithGoogleMock,});- const { result } = renderHook(() => useSignInWithGoogle());+ const { result } = renderHook(() => useSignInWithGoogle(), {+ wrapper: Wrapper,+ });result.current.signInWithGoogle();expect(signInWithGoogleMock).toHaveBeenCalledWith({workspaceInviteHash: 'testHash',workspacePersonalInviteToken: undefined,+ billingCheckoutSession: mockBillingCheckoutSession,});});});diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useSignInWithMicrosoft.test.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useSignInWithMicrosoft.test.tsindex 3200e8a546b..98c9ea52776 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useSignInWithMicrosoft.test.ts+++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useSignInWithMicrosoft.test.ts@@ -1,7 +1,8 @@-import { renderHook } from '@testing-library/react';-import { useParams, useSearchParams } from 'react-router-dom';import { useAuth } from '@/auth/hooks/useAuth';import { useSignInWithMicrosoft } from '@/auth/sign-in-up/hooks/useSignInWithMicrosoft';+import { renderHook } from '@testing-library/react';+import { useParams, useSearchParams } from 'react-router-dom';+import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';jest.mock('react-router-dom', () => ({useParams: jest.fn(),@@ -13,6 +14,17 @@ jest.mock('@/auth/hooks/useAuth', () => ({}));describe('useSignInWithMicrosoft', () => {+ const Wrapper = getJestMetadataAndApolloMocksWrapper({+ apolloMocks: [],+ });++ const mockBillingCheckoutSession = {+ plan: 'PRO',+ interval: 'Month',+ requirePaymentMethod: true,+ skipPlanPage: false,+ };+it('should call signInWithMicrosoft with the correct parameters', () => {const workspaceInviteHashMock = 'testHash';const inviteTokenMock = 'testToken';@@ -28,12 +40,15 @@ describe('useSignInWithMicrosoft', () => {signInWithMicrosoft: signInWithMicrosoftMock,});- const { result } = renderHook(() => useSignInWithMicrosoft());+ const { result } = renderHook(() => useSignInWithMicrosoft(), {+ wrapper: Wrapper,+ });result.current.signInWithMicrosoft();expect(signInWithMicrosoftMock).toHaveBeenCalledWith({workspaceInviteHash: workspaceInviteHashMock,workspacePersonalInviteToken: inviteTokenMock,+ billingCheckoutSession: mockBillingCheckoutSession,});});@@ -49,10 +64,13 @@ describe('useSignInWithMicrosoft', () => {signInWithMicrosoft: signInWithMicrosoftMock,});- const { result } = renderHook(() => useSignInWithMicrosoft());+ const { result } = renderHook(() => useSignInWithMicrosoft(), {+ wrapper: Wrapper,+ });result.current.signInWithMicrosoft();expect(signInWithMicrosoftMock).toHaveBeenCalledWith({+ billingCheckoutSession: mockBillingCheckoutSession,workspaceInviteHash: workspaceInviteHashMock,workspacePersonalInviteToken: undefined,});diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInWithGoogle.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInWithGoogle.tsindex 58ce165f750..26908402e4d 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInWithGoogle.ts+++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInWithGoogle.ts@@ -1,15 +1,27 @@import { useParams, useSearchParams } from 'react-router-dom';import { useAuth } from '@/auth/hooks/useAuth';+import { BillingCheckoutSession } from '@/auth/types/billingCheckoutSession.type';export const useSignInWithGoogle = () => {const workspaceInviteHash = useParams().workspaceInviteHash;const [searchParams] = useSearchParams();const workspacePersonalInviteToken =searchParams.get('inviteToken') ?? undefined;+ const billingCheckoutSession = {+ plan: 'PRO',+ interval: 'Month',+ requirePaymentMethod: true,+ skipPlanPage: false,+ } as BillingCheckoutSession;+const { signInWithGoogle } = useAuth();return {signInWithGoogle: () =>- signInWithGoogle({ workspaceInviteHash, workspacePersonalInviteToken }),+ signInWithGoogle({+ workspaceInviteHash,+ workspacePersonalInviteToken,+ billingCheckoutSession,+ }),};};diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInWithMicrosoft.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInWithMicrosoft.tsindex 2f471c176c8..513f77ac66a 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInWithMicrosoft.ts+++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInWithMicrosoft.ts@@ -1,18 +1,23 @@import { useParams, useSearchParams } from 'react-router-dom';import { useAuth } from '@/auth/hooks/useAuth';+import { billingCheckoutSessionState } from '@/auth/states/billingCheckoutSessionState';+import { useRecoilValue } from 'recoil';export const useSignInWithMicrosoft = () => {const workspaceInviteHash = useParams().workspaceInviteHash;const [searchParams] = useSearchParams();const workspacePersonalInviteToken =searchParams.get('inviteToken') ?? undefined;+ const billingCheckoutSession = useRecoilValue(billingCheckoutSessionState);+const { signInWithMicrosoft } = useAuth();return {signInWithMicrosoft: () =>signInWithMicrosoft({workspaceInviteHash,workspacePersonalInviteToken,+ billingCheckoutSession,}),};};diff --git a/packages/twenty-front/src/modules/auth/states/availableIdentityProviderForAuthState.ts b/packages/twenty-front/src/modules/auth/states/availableIdentityProviderForAuthState.tsindex d3100a826b3..a8ecdfd937a 100644--- a/packages/twenty-front/src/modules/auth/states/availableIdentityProviderForAuthState.ts+++ b/packages/twenty-front/src/modules/auth/states/availableIdentityProviderForAuthState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { UserExists } from '~/generated/graphql';export const availableSSOIdentityProvidersForAuthState = createState<diff --git a/packages/twenty-front/src/modules/auth/states/billingCheckoutSessionState.ts b/packages/twenty-front/src/modules/auth/states/billingCheckoutSessionState.tsnew file mode 100644index 00000000000..acfe231a970--- /dev/null+++ b/packages/twenty-front/src/modules/auth/states/billingCheckoutSessionState.ts@@ -0,0 +1,39 @@+import { BillingCheckoutSession } from '@/auth/types/billingCheckoutSession.type';+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,+ },+ effects: [+ syncEffect({+ refine: (value: unknown) => {+ if (+ typeof value === 'object' &&+ value !== null &&+ 'plan' in value &&+ 'interval' in value &&+ 'requirePaymentMethod' in value &&+ 'skipPlanPage' in value+ ) {+ return {+ type: 'success',+ value: value as BillingCheckoutSession,+ warnings: [],+ } as const;+ }+ return {+ type: 'failure',+ message: 'Invalid BillingCheckoutSessionState',+ path: [] as any,+ } as const;+ },+ }),+ ],+});diff --git a/packages/twenty-front/src/modules/auth/states/currentUserState.ts b/packages/twenty-front/src/modules/auth/states/currentUserState.tsindex 26880ddaef2..72f11157a1d 100644--- a/packages/twenty-front/src/modules/auth/states/currentUserState.ts+++ b/packages/twenty-front/src/modules/auth/states/currentUserState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { User } from '~/generated/graphql';diff --git a/packages/twenty-front/src/modules/auth/states/currentWorkspaceMemberState.ts b/packages/twenty-front/src/modules/auth/states/currentWorkspaceMemberState.tsindex 4af6c5b8f22..33013f12421 100644--- a/packages/twenty-front/src/modules/auth/states/currentWorkspaceMemberState.ts+++ b/packages/twenty-front/src/modules/auth/states/currentWorkspaceMemberState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { WorkspaceMember } from '@/workspace-member/types/WorkspaceMember';diff --git a/packages/twenty-front/src/modules/auth/states/currentWorkspaceMembersStates.ts b/packages/twenty-front/src/modules/auth/states/currentWorkspaceMembersStates.tsindex a8059259a3e..160e786b6b2 100644--- a/packages/twenty-front/src/modules/auth/states/currentWorkspaceMembersStates.ts+++ b/packages/twenty-front/src/modules/auth/states/currentWorkspaceMembersStates.ts@@ -1,5 +1,5 @@import { CurrentWorkspaceMember } from '@/auth/states/currentWorkspaceMemberState';-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const currentWorkspaceMembersState = createState<CurrentWorkspaceMember[]diff --git a/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts b/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.tsindex c06276c126e..872c6af93ef 100644--- a/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts+++ b/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { Workspace } from '~/generated/graphql';diff --git a/packages/twenty-front/src/modules/auth/states/isCurrentUserLoadingState.ts b/packages/twenty-front/src/modules/auth/states/isCurrentUserLoadingState.tsindex 0a62d92ab4c..242739b7b17 100644--- a/packages/twenty-front/src/modules/auth/states/isCurrentUserLoadingState.ts+++ b/packages/twenty-front/src/modules/auth/states/isCurrentUserLoadingState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isCurrentUserLoadedState = createState<boolean>({key: 'isCurrentUserLoadedState',diff --git a/packages/twenty-front/src/modules/auth/states/isVerifyPendingState.ts b/packages/twenty-front/src/modules/auth/states/isVerifyPendingState.tsindex 567910389ba..0e554b0c8c8 100644--- a/packages/twenty-front/src/modules/auth/states/isVerifyPendingState.ts+++ b/packages/twenty-front/src/modules/auth/states/isVerifyPendingState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isVerifyPendingState = createState<boolean>({key: 'isVerifyPendingState',diff --git a/packages/twenty-front/src/modules/auth/states/previousUrlState.ts b/packages/twenty-front/src/modules/auth/states/previousUrlState.tsindex 1de274fb18c..951436d3307 100644--- a/packages/twenty-front/src/modules/auth/states/previousUrlState.ts+++ b/packages/twenty-front/src/modules/auth/states/previousUrlState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const previousUrlState = createState<string>({key: 'previousUrlState',diff --git a/packages/twenty-front/src/modules/auth/states/signInUpModeState.ts b/packages/twenty-front/src/modules/auth/states/signInUpModeState.tsindex 98da3b608df..398fe2604bf 100644--- a/packages/twenty-front/src/modules/auth/states/signInUpModeState.ts+++ b/packages/twenty-front/src/modules/auth/states/signInUpModeState.ts@@ -1,5 +1,5 @@-import { createState } from 'twenty-ui';import { SignInUpMode } from '@/auth/types/signInUpMode';+import { createState } from '@ui/utilities/state/utils/createState';export const signInUpModeState = createState<SignInUpMode>({key: 'signInUpModeState',diff --git a/packages/twenty-front/src/modules/auth/states/signInUpStepState.ts b/packages/twenty-front/src/modules/auth/states/signInUpStepState.tsindex b3f3c408187..81a4023719b 100644--- a/packages/twenty-front/src/modules/auth/states/signInUpStepState.ts+++ b/packages/twenty-front/src/modules/auth/states/signInUpStepState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export enum SignInUpStep {Init = 'init',diff --git a/packages/twenty-front/src/modules/auth/states/tokenPairState.ts b/packages/twenty-front/src/modules/auth/states/tokenPairState.tsindex 718e67ad627..2d8d597e4f8 100644--- a/packages/twenty-front/src/modules/auth/states/tokenPairState.ts+++ b/packages/twenty-front/src/modules/auth/states/tokenPairState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { AuthTokenPair } from '~/generated/graphql';import { cookieStorageEffect } from '~/utils/recoil-effects';diff --git a/packages/twenty-front/src/modules/auth/states/workspacePublicDataState.ts b/packages/twenty-front/src/modules/auth/states/workspacePublicDataState.tsindex f4866fa653c..64bafed36b6 100644--- a/packages/twenty-front/src/modules/auth/states/workspacePublicDataState.ts+++ b/packages/twenty-front/src/modules/auth/states/workspacePublicDataState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { PublicWorkspaceDataOutput } from '~/generated/graphql';export const workspacePublicDataState =diff --git a/packages/twenty-front/src/modules/auth/states/workspaces.ts b/packages/twenty-front/src/modules/auth/states/workspaces.tsindex da0d270bb39..e38a4a146ad 100644--- a/packages/twenty-front/src/modules/auth/states/workspaces.ts+++ b/packages/twenty-front/src/modules/auth/states/workspaces.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { Workspace } from '~/generated/graphql';diff --git a/packages/twenty-front/src/modules/auth/types/billingCheckoutSession.type.ts b/packages/twenty-front/src/modules/auth/types/billingCheckoutSession.type.tsnew file mode 100644index 00000000000..a634e17e2d4--- /dev/null+++ b/packages/twenty-front/src/modules/auth/types/billingCheckoutSession.type.ts@@ -0,0 +1,9 @@+import { SubscriptionInterval } from '~/generated-metadata/graphql';+import { BillingPlanKey } from '~/generated/graphql';++export type BillingCheckoutSession = {+ plan: BillingPlanKey;+ interval: SubscriptionInterval;+ requirePaymentMethod: boolean;+ skipPlanPage: boolean;+};diff --git a/packages/twenty-front/src/modules/billing/graphql/checkoutSession.ts b/packages/twenty-front/src/modules/billing/graphql/checkoutSession.tsindex 53821543cef..91820e9f040 100644--- a/packages/twenty-front/src/modules/billing/graphql/checkoutSession.ts+++ b/packages/twenty-front/src/modules/billing/graphql/checkoutSession.ts@@ -4,10 +4,14 @@ export const CHECKOUT_SESSION = gql`mutation CheckoutSession($recurringInterval: SubscriptionInterval!$successUrlPath: String+ $plan: BillingPlanKey!+ $requirePaymentMethod: Boolean!) {checkoutSession(recurringInterval: $recurringIntervalsuccessUrlPath: $successUrlPath+ plan: $plan+ requirePaymentMethod: $requirePaymentMethod) {url}diff --git a/packages/twenty-front/src/modules/captcha/states/captchaTokenState.ts b/packages/twenty-front/src/modules/captcha/states/captchaTokenState.tsindex 24289cac6c6..7ec02e49489 100644--- a/packages/twenty-front/src/modules/captcha/states/captchaTokenState.ts+++ b/packages/twenty-front/src/modules/captcha/states/captchaTokenState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const captchaTokenState = createState<string | undefined>({key: 'captchaTokenState',diff --git a/packages/twenty-front/src/modules/captcha/states/isCaptchaScriptLoadedState.ts b/packages/twenty-front/src/modules/captcha/states/isCaptchaScriptLoadedState.tsindex 0db486bbe78..f6fa69169e8 100644--- a/packages/twenty-front/src/modules/captcha/states/isCaptchaScriptLoadedState.ts+++ b/packages/twenty-front/src/modules/captcha/states/isCaptchaScriptLoadedState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isCaptchaScriptLoadedState = createState<boolean>({key: 'isCaptchaScriptLoadedState',diff --git a/packages/twenty-front/src/modules/captcha/states/isRequestingCaptchaTokenState.ts b/packages/twenty-front/src/modules/captcha/states/isRequestingCaptchaTokenState.tsindex df7daeb4ddb..86f4e9f6a03 100644--- a/packages/twenty-front/src/modules/captcha/states/isRequestingCaptchaTokenState.ts+++ b/packages/twenty-front/src/modules/captcha/states/isRequestingCaptchaTokenState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isRequestingCaptchaTokenState = createState<boolean>({key: 'isRequestingCaptchaTokenState',diff --git a/packages/twenty-front/src/modules/chrome-extension-sidecar/states/isLoadingTokensFromExtensionState.ts b/packages/twenty-front/src/modules/chrome-extension-sidecar/states/isLoadingTokensFromExtensionState.tsindex e04798f1999..91525e5626e 100644--- a/packages/twenty-front/src/modules/chrome-extension-sidecar/states/isLoadingTokensFromExtensionState.ts+++ b/packages/twenty-front/src/modules/chrome-extension-sidecar/states/isLoadingTokensFromExtensionState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isLoadingTokensFromExtensionState = createState<boolean | null>({key: 'isLoadingTokensFromExtensionState',diff --git a/packages/twenty-front/src/modules/client-config/states/apiConfigState.ts b/packages/twenty-front/src/modules/client-config/states/apiConfigState.tsindex 9a01493e4f8..77e8295c7a1 100644--- a/packages/twenty-front/src/modules/client-config/states/apiConfigState.ts+++ b/packages/twenty-front/src/modules/client-config/states/apiConfigState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { ApiConfig } from '~/generated/graphql';diff --git a/packages/twenty-front/src/modules/client-config/states/authProvidersState.ts b/packages/twenty-front/src/modules/client-config/states/authProvidersState.tsindex d56572b5a96..46646c40d96 100644--- a/packages/twenty-front/src/modules/client-config/states/authProvidersState.ts+++ b/packages/twenty-front/src/modules/client-config/states/authProvidersState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { AuthProviders } from '~/generated/graphql';diff --git a/packages/twenty-front/src/modules/client-config/states/billingState.ts b/packages/twenty-front/src/modules/client-config/states/billingState.tsindex 5634c510b33..b188943b090 100644--- a/packages/twenty-front/src/modules/client-config/states/billingState.ts+++ b/packages/twenty-front/src/modules/client-config/states/billingState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { Billing } from '~/generated/graphql';diff --git a/packages/twenty-front/src/modules/client-config/states/captchaProviderState.ts b/packages/twenty-front/src/modules/client-config/states/captchaProviderState.tsindex 2440f11a458..ca312acf047 100644--- a/packages/twenty-front/src/modules/client-config/states/captchaProviderState.ts+++ b/packages/twenty-front/src/modules/client-config/states/captchaProviderState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { Captcha } from '~/generated/graphql';diff --git a/packages/twenty-front/src/modules/client-config/states/chromeExtensionIdState.ts b/packages/twenty-front/src/modules/client-config/states/chromeExtensionIdState.tsindex bec5ae986aa..b29db3633b4 100644--- a/packages/twenty-front/src/modules/client-config/states/chromeExtensionIdState.ts+++ b/packages/twenty-front/src/modules/client-config/states/chromeExtensionIdState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const chromeExtensionIdState = createState<string | null | undefined>({key: 'chromeExtensionIdState',diff --git a/packages/twenty-front/src/modules/client-config/states/clientConfigApiStatusState.ts b/packages/twenty-front/src/modules/client-config/states/clientConfigApiStatusState.tsindex 08793188ff1..9f5f6f9e5d3 100644--- a/packages/twenty-front/src/modules/client-config/states/clientConfigApiStatusState.ts+++ b/packages/twenty-front/src/modules/client-config/states/clientConfigApiStatusState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';type ClientConfigApiStatus = {isLoaded: boolean;diff --git a/packages/twenty-front/src/modules/client-config/states/isAnalyticsEnabledState.ts b/packages/twenty-front/src/modules/client-config/states/isAnalyticsEnabledState.tsindex 50c0f5c89c2..f21835209a0 100644--- a/packages/twenty-front/src/modules/client-config/states/isAnalyticsEnabledState.ts+++ b/packages/twenty-front/src/modules/client-config/states/isAnalyticsEnabledState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isAnalyticsEnabledState = createState<boolean>({key: 'isAnalyticsEnabled',diff --git a/packages/twenty-front/src/modules/client-config/states/isDebugModeState.ts b/packages/twenty-front/src/modules/client-config/states/isDebugModeState.tsindex b2efbf8fc88..037661f1a72 100644--- a/packages/twenty-front/src/modules/client-config/states/isDebugModeState.ts+++ b/packages/twenty-front/src/modules/client-config/states/isDebugModeState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isDebugModeState = createState<boolean>({key: 'isDebugModeState',diff --git a/packages/twenty-front/src/modules/client-config/states/isDeveloperDefaultSignInPrefilledState.ts b/packages/twenty-front/src/modules/client-config/states/isDeveloperDefaultSignInPrefilledState.tsindex 5f4d82bed79..30839339afa 100644--- a/packages/twenty-front/src/modules/client-config/states/isDeveloperDefaultSignInPrefilledState.ts+++ b/packages/twenty-front/src/modules/client-config/states/isDeveloperDefaultSignInPrefilledState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isDeveloperDefaultSignInPrefilledState = createState<boolean>({key: 'isDeveloperDefaultSignInPrefilledState',diff --git a/packages/twenty-front/src/modules/client-config/states/isMultiWorkspaceEnabledState.ts b/packages/twenty-front/src/modules/client-config/states/isMultiWorkspaceEnabledState.tsindex 4749eeab9e4..a18c415f535 100644--- a/packages/twenty-front/src/modules/client-config/states/isMultiWorkspaceEnabledState.ts+++ b/packages/twenty-front/src/modules/client-config/states/isMultiWorkspaceEnabledState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isMultiWorkspaceEnabledState = createState<boolean>({key: 'isMultiWorkspaceEnabled',diff --git a/packages/twenty-front/src/modules/client-config/states/isSSOEnabledState.ts b/packages/twenty-front/src/modules/client-config/states/isSSOEnabledState.tsindex 3242678c3d3..7d40b673350 100644--- a/packages/twenty-front/src/modules/client-config/states/isSSOEnabledState.ts+++ b/packages/twenty-front/src/modules/client-config/states/isSSOEnabledState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isSSOEnabledState = createState<boolean>({key: 'isSSOEnabledState',diff --git a/packages/twenty-front/src/modules/client-config/states/sentryConfigState.ts b/packages/twenty-front/src/modules/client-config/states/sentryConfigState.tsindex 19ca0359955..5046ce9b631 100644--- a/packages/twenty-front/src/modules/client-config/states/sentryConfigState.ts+++ b/packages/twenty-front/src/modules/client-config/states/sentryConfigState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { Sentry } from '~/generated/graphql';diff --git a/packages/twenty-front/src/modules/client-config/states/supportChatState.ts b/packages/twenty-front/src/modules/client-config/states/supportChatState.tsindex cca337ba581..81d7fb901c3 100644--- a/packages/twenty-front/src/modules/client-config/states/supportChatState.ts+++ b/packages/twenty-front/src/modules/client-config/states/supportChatState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { Support } from '~/generated/graphql';diff --git a/packages/twenty-front/src/modules/command-menu/states/commandMenuSearchState.ts b/packages/twenty-front/src/modules/command-menu/states/commandMenuSearchState.tsindex 61f580a8ae1..b7315d5d08f 100644--- a/packages/twenty-front/src/modules/command-menu/states/commandMenuSearchState.ts+++ b/packages/twenty-front/src/modules/command-menu/states/commandMenuSearchState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const commandMenuSearchState = createState<string>({key: 'command-menu/commandMenuSearchState',diff --git a/packages/twenty-front/src/modules/context-store/states/mainContextStoreComponentInstanceId.ts b/packages/twenty-front/src/modules/context-store/states/mainContextStoreComponentInstanceId.tsindex 461c03be896..2a1fffbb280 100644--- a/packages/twenty-front/src/modules/context-store/states/mainContextStoreComponentInstanceId.ts+++ b/packages/twenty-front/src/modules/context-store/states/mainContextStoreComponentInstanceId.ts@@ -1,5 +1,5 @@import { CONTEXT_STORE_INSTANCE_ID_DEFAULT_VALUE } from '@/context-store/constants/ContextStoreInstanceIdDefaultValue';-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const mainContextStoreComponentInstanceIdState = createState<string>({key: 'mainContextStoreComponentInstanceIdState',diff --git a/packages/twenty-front/src/modules/domain-manager/states/domainConfigurationState.ts b/packages/twenty-front/src/modules/domain-manager/states/domainConfigurationState.tsindex 89dc124042b..0ea281bcedb 100644--- a/packages/twenty-front/src/modules/domain-manager/states/domainConfigurationState.ts+++ b/packages/twenty-front/src/modules/domain-manager/states/domainConfigurationState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { ClientConfig } from '~/generated/graphql';export const domainConfigurationState = createState<diff --git a/packages/twenty-front/src/modules/domain-manager/states/lastAuthenticatedWorkspaceDomainState.ts b/packages/twenty-front/src/modules/domain-manager/states/lastAuthenticatedWorkspaceDomainState.tsindex 6d8e458a33c..67c44f43f27 100644--- a/packages/twenty-front/src/modules/domain-manager/states/lastAuthenticatedWorkspaceDomainState.ts+++ b/packages/twenty-front/src/modules/domain-manager/states/lastAuthenticatedWorkspaceDomainState.ts@@ -1,5 +1,5 @@+import { createState } from '@ui/utilities/state/utils/createState';import { cookieStorageEffect } from '~/utils/recoil-effects';-import { createState } from 'twenty-ui';export const lastAuthenticatedWorkspaceDomainState = createState<| {diff --git a/packages/twenty-front/src/modules/localization/states/dateTimeFormatState.ts b/packages/twenty-front/src/modules/localization/states/dateTimeFormatState.tsindex 2392151e3a5..60bd66c61b0 100644--- a/packages/twenty-front/src/modules/localization/states/dateTimeFormatState.ts+++ b/packages/twenty-front/src/modules/localization/states/dateTimeFormatState.ts@@ -1,7 +1,7 @@import { DateFormat } from '@/localization/constants/DateFormat';import { TimeFormat } from '@/localization/constants/TimeFormat';import { detectTimeZone } from '@/localization/utils/detectTimeZone';-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const dateTimeFormatState = createState<{timeZone: string;diff --git a/packages/twenty-front/src/modules/navigation/states/currentMobileNavigationDrawerState.ts b/packages/twenty-front/src/modules/navigation/states/currentMobileNavigationDrawerState.tsindex c376b195310..540c6fad16d 100644--- a/packages/twenty-front/src/modules/navigation/states/currentMobileNavigationDrawerState.ts+++ b/packages/twenty-front/src/modules/navigation/states/currentMobileNavigationDrawerState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const currentMobileNavigationDrawerState = createState<'main' | 'settings'diff --git a/packages/twenty-front/src/modules/object-metadata/states/isAppWaitingForFreshObjectMetadataState.ts b/packages/twenty-front/src/modules/object-metadata/states/isAppWaitingForFreshObjectMetadataState.tsindex 2cbe59765fd..e5eb2538077 100644--- a/packages/twenty-front/src/modules/object-metadata/states/isAppWaitingForFreshObjectMetadataState.ts+++ b/packages/twenty-front/src/modules/object-metadata/states/isAppWaitingForFreshObjectMetadataState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isAppWaitingForFreshObjectMetadataState = createState<boolean>({key: 'isAppWaitingForFreshObjectMetadataState',diff --git a/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsState.ts b/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsState.tsindex 5c247fe0e1e..57545e5b1b5 100644--- a/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsState.ts+++ b/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/states/aggregateDropdownState.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/states/aggregateDropdownState.tsindex 31eeb84fc7a..310f9db0d8d 100644--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/states/aggregateDropdownState.ts+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/states/aggregateDropdownState.ts@@ -1,5 +1,5 @@import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';type AggregateOperation = {operation: AGGREGATE_OPERATIONS | null;diff --git a/packages/twenty-front/src/modules/object-record/record-field/states/lastShowPageRecordId.ts b/packages/twenty-front/src/modules/object-record/record-field/states/lastShowPageRecordId.tsindex dce923b37bd..42e159bbd08 100644--- a/packages/twenty-front/src/modules/object-record/record-field/states/lastShowPageRecordId.ts+++ b/packages/twenty-front/src/modules/object-record/record-field/states/lastShowPageRecordId.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const lastShowPageRecordIdState = createState<string | null>({key: 'lastShowPageRecordIdState',diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexFieldDefinitionsState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexFieldDefinitionsState.tsindex 1b260d3c9c2..dfd92d42e7a 100644--- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexFieldDefinitionsState.ts+++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexFieldDefinitionsState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { FieldMetadata } from '@/object-record/record-field/types/FieldMetadata';import { ColumnDefinition } from '@/object-record/record-table/types/ColumnDefinition';diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexFiltersState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexFiltersState.tsindex fc346210923..6af60488756 100644--- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexFiltersState.ts+++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexFiltersState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { Filter } from '@/object-record/object-filter-dropdown/types/Filter';diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexIsCompactModeActiveState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexIsCompactModeActiveState.tsindex cd1d83fbb89..3cc57f14f9e 100644--- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexIsCompactModeActiveState.ts+++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexIsCompactModeActiveState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const recordIndexIsCompactModeActiveState = createState<boolean>({key: 'recordIndexIsCompactModeActiveState',diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexKanbanAggregateOperationState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexKanbanAggregateOperationState.tsindex 9b60fae0c92..664a6755cb6 100644--- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexKanbanAggregateOperationState.ts+++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexKanbanAggregateOperationState.ts@@ -1,5 +1,5 @@import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export type KanbanAggregateOperation = {operation?: AGGREGATE_OPERATIONS | null;diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexKanbanFieldMetadataIdState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexKanbanFieldMetadataIdState.tsindex f1527934d48..bb28f4ad052 100644--- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexKanbanFieldMetadataIdState.ts+++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexKanbanFieldMetadataIdState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const recordIndexKanbanFieldMetadataIdState = createState<string | null>({diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexSortsState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexSortsState.tsindex 57088c8e567..2d839afdd7a 100644--- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexSortsState.ts+++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexSortsState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { Sort } from '@/object-record/object-sort-dropdown/types/Sort';diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexViewFilterGroupsState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexViewFilterGroupsState.tsindex 978614756ca..ea07e363d4f 100644--- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexViewFilterGroupsState.ts+++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexViewFilterGroupsState.ts@@ -1,5 +1,5 @@import { ViewFilterGroup } from '@/views/types/ViewFilterGroup';-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const recordIndexViewFilterGroupsState = createState<ViewFilterGroup[]>({key: 'recordIndexViewFilterGroupsState',diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexViewTypeState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexViewTypeState.tsindex 49b032c860d..ad8fbfc5c21 100644--- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexViewTypeState.ts+++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexViewTypeState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { ViewType } from '@/views/types/ViewType';diff --git a/packages/twenty-front/src/modules/object-record/record-right-drawer/states/isNewViewableRecordLoading.ts b/packages/twenty-front/src/modules/object-record/record-right-drawer/states/isNewViewableRecordLoading.tsindex 904677204cc..7e5b6e2bc44 100644--- a/packages/twenty-front/src/modules/object-record/record-right-drawer/states/isNewViewableRecordLoading.ts+++ b/packages/twenty-front/src/modules/object-record/record-right-drawer/states/isNewViewableRecordLoading.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isNewViewableRecordLoadingState = createState<boolean>({key: 'activities/is-new-viewable-record-loading',diff --git a/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordIdState.ts b/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordIdState.tsindex c75e6cf8a8a..ae72a94359b 100644--- a/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordIdState.ts+++ b/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordIdState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const viewableRecordIdState = createState<string | null>({key: 'activities/viewable-record-id',diff --git a/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordNameSingularState.ts b/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordNameSingularState.tsindex 3116430e10c..6e0e5a6eaef 100644--- a/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordNameSingularState.ts+++ b/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordNameSingularState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const viewableRecordNameSingularState = createState<string | null>({key: 'activities/viewable-record-name-singular',diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/__tests__/useUpsertTableRecordInGroup.test.tsx b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/__tests__/useUpsertTableRecordInGroup.test.tsxindex ee690ec18b8..84ab424776b 100644--- a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/__tests__/useUpsertTableRecordInGroup.test.tsx+++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/__tests__/useUpsertTableRecordInGroup.test.tsx@@ -1,7 +1,7 @@import { renderHook } from '@testing-library/react';+import { createState } from '@ui/utilities/state/utils/createState';import { ReactNode, act } from 'react';import { RecoilRoot } from 'recoil';-import { createState } from 'twenty-ui';import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';import { CoreObjectNamePlural } from '@/object-metadata/types/CoreObjectNamePlural';diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/__tests__/useUpsertTableRecordNoGroup.test.tsx b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/__tests__/useUpsertTableRecordNoGroup.test.tsxindex d1f29e2c9af..ac3e65e8992 100644--- a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/__tests__/useUpsertTableRecordNoGroup.test.tsx+++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/__tests__/useUpsertTableRecordNoGroup.test.tsx@@ -1,7 +1,7 @@import { renderHook } from '@testing-library/react';+import { createState } from '@ui/utilities/state/utils/createState';import { ReactNode, act } from 'react';import { RecoilRoot } from 'recoil';-import { createState } from 'twenty-ui';import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';import { CoreObjectNamePlural } from '@/object-metadata/types/CoreObjectNamePlural';diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/isRemoveSortingModalOpenState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/isRemoveSortingModalOpenState.tsindex 9f8627f2a4d..542c069d2a1 100644--- a/packages/twenty-front/src/modules/object-record/record-table/states/isRemoveSortingModalOpenState.ts+++ b/packages/twenty-front/src/modules/object-record/record-table/states/isRemoveSortingModalOpenState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isRemoveSortingModalOpenState = createState<boolean>({key: 'isRemoveSortingModalOpenState',diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/isSoftFocusUsingMouseState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/isSoftFocusUsingMouseState.tsindex d25f46faa3b..4d295db425f 100644--- a/packages/twenty-front/src/modules/object-record/record-table/states/isSoftFocusUsingMouseState.ts+++ b/packages/twenty-front/src/modules/object-record/record-table/states/isSoftFocusUsingMouseState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isSoftFocusUsingMouseState = createState<boolean>({key: 'isSoftFocusUsingMouseState',diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/preview/states/settingsPreviewRecordIdState.ts b/packages/twenty-front/src/modules/settings/data-model/fields/preview/states/settingsPreviewRecordIdState.tsindex 68a5bbff960..a810c8c002b 100644--- a/packages/twenty-front/src/modules/settings/data-model/fields/preview/states/settingsPreviewRecordIdState.ts+++ b/packages/twenty-front/src/modules/settings/data-model/fields/preview/states/settingsPreviewRecordIdState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const settingsPreviewRecordIdState = createState<string | null>({key: 'settingsPreviewRecordIdState',diff --git a/packages/twenty-front/src/modules/settings/developers/states/generatedApiKeyTokenState.ts b/packages/twenty-front/src/modules/settings/developers/states/generatedApiKeyTokenState.tsindex 6129e451c4f..0fc6a43a420 100644--- a/packages/twenty-front/src/modules/settings/developers/states/generatedApiKeyTokenState.ts+++ b/packages/twenty-front/src/modules/settings/developers/states/generatedApiKeyTokenState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const apiKeyTokenState = createState<string | null>({key: 'apiKeyTokenState',diff --git a/packages/twenty-front/src/modules/settings/security/states/SSOIdentitiesProvidersState.ts b/packages/twenty-front/src/modules/settings/security/states/SSOIdentitiesProvidersState.tsindex 76dc7cfdfbd..db9cd89fbc9 100644--- a/packages/twenty-front/src/modules/settings/security/states/SSOIdentitiesProvidersState.ts+++ b/packages/twenty-front/src/modules/settings/security/states/SSOIdentitiesProvidersState.ts@@ -1,7 +1,7 @@/* @license Enterprise */import { SSOIdentityProvider } from '@/settings/security/types/SSOIdentityProvider';-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const SSOIdentitiesProvidersState = createState<Omit<SSOIdentityProvider, '__typename'>[]diff --git a/packages/twenty-front/src/modules/spreadsheet-import/states/spreadsheetImportDialogState.ts b/packages/twenty-front/src/modules/spreadsheet-import/states/spreadsheetImportDialogState.tsindex fceda6736ca..4aad187facf 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/states/spreadsheetImportDialogState.ts+++ b/packages/twenty-front/src/modules/spreadsheet-import/states/spreadsheetImportDialogState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { SpreadsheetImportDialogOptions } from '../types';diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/states/activeDropdownFocusIdState.ts b/packages/twenty-front/src/modules/ui/layout/dropdown/states/activeDropdownFocusIdState.tsindex fca8a5ba6f6..17cf76ba630 100644--- a/packages/twenty-front/src/modules/ui/layout/dropdown/states/activeDropdownFocusIdState.ts+++ b/packages/twenty-front/src/modules/ui/layout/dropdown/states/activeDropdownFocusIdState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const activeDropdownFocusIdState = createState<string | null>({key: 'activeDropdownFocusIdState',diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/states/previousDropdownFocusIdState.ts b/packages/twenty-front/src/modules/ui/layout/dropdown/states/previousDropdownFocusIdState.tsindex e311d1f3fe4..060d78a191e 100644--- a/packages/twenty-front/src/modules/ui/layout/dropdown/states/previousDropdownFocusIdState.ts+++ b/packages/twenty-front/src/modules/ui/layout/dropdown/states/previousDropdownFocusIdState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const previousDropdownFocusIdState = createState<string | null>({key: 'previousDropdownFocusIdState',diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerAnimationCompletedState.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerAnimationCompletedState.tsindex 3e1cb030a30..61d75e2d5c6 100644--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerAnimationCompletedState.ts+++ b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerAnimationCompletedState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isRightDrawerAnimationCompletedState = createState<boolean>({key: 'isRightDrawerAnimationCompletedState',diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerMinimizedState.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerMinimizedState.tsindex 9b212403061..822f909c022 100644--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerMinimizedState.ts+++ b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerMinimizedState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isRightDrawerMinimizedState = createState<boolean>({key: 'ui/layout/is-right-drawer-minimized',diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerOpenState.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerOpenState.tsindex b0149a5881a..0fad6afabfe 100644--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerOpenState.ts+++ b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerOpenState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isRightDrawerOpenState = createState<boolean>({key: 'ui/layout/is-right-drawer-open',diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/messageThreadState.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/messageThreadState.tsindex 2e1febcf6e2..77f9cd76a8c 100644--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/messageThreadState.ts+++ b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/messageThreadState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { MessageThread } from '@/activities/emails/types/MessageThread';diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerCloseEventsState.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerCloseEventsState.tsindex ac0813d8ea9..9601f157214 100644--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerCloseEventsState.ts+++ b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerCloseEventsState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const rightDrawerCloseEventState = createState<Event | null>({key: 'rightDrawerCloseEventState',diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerHeaderDropdownButtonState.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerHeaderDropdownButtonState.tsindex a0f2a84965e..e61330290b1 100644--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerHeaderDropdownButtonState.ts+++ b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerHeaderDropdownButtonState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { RightDrawerTopBarDropdownButtons } from '@/ui/layout/right-drawer/types/RightDrawerTopBarDropdownButtons';diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerPageState.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerPageState.tsindex 0cbcdee85f4..441988db3a5 100644--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerPageState.ts+++ b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerPageState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { RightDrawerPages } from '../types/RightDrawerPages';diff --git a/packages/twenty-front/src/modules/ui/layout/states/isDefaultLayoutAuthModalVisibleState.ts b/packages/twenty-front/src/modules/ui/layout/states/isDefaultLayoutAuthModalVisibleState.tsindex c181a6a7d57..7054e811ef3 100644--- a/packages/twenty-front/src/modules/ui/layout/states/isDefaultLayoutAuthModalVisibleState.ts+++ b/packages/twenty-front/src/modules/ui/layout/states/isDefaultLayoutAuthModalVisibleState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const isDefaultLayoutAuthModalVisibleState = createState<boolean>({key: 'isDefaultLayoutAuthModalVisibleState',diff --git a/packages/twenty-front/src/modules/ui/navigation/states/navigationMemorizedUrlState.ts b/packages/twenty-front/src/modules/ui/navigation/states/navigationMemorizedUrlState.tsindex bb8318ecd95..b8b68189132 100644--- a/packages/twenty-front/src/modules/ui/navigation/states/navigationMemorizedUrlState.ts+++ b/packages/twenty-front/src/modules/ui/navigation/states/navigationMemorizedUrlState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const navigationMemorizedUrlState = createState<string>({key: 'navigationMemorizedUrlState',diff --git a/packages/twenty-front/src/modules/ui/navigation/step-bar/states/stepBarInternalState.ts b/packages/twenty-front/src/modules/ui/navigation/step-bar/states/stepBarInternalState.tsindex d2bf60d6083..e25c33352fa 100644--- a/packages/twenty-front/src/modules/ui/navigation/step-bar/states/stepBarInternalState.ts+++ b/packages/twenty-front/src/modules/ui/navigation/step-bar/states/stepBarInternalState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export type StepsState = {activeStep: number;diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/currentHotkeyScopeState.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/currentHotkeyScopeState.tsindex 6b41a6705ed..61b8165f012 100644--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/currentHotkeyScopeState.ts+++ b/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/currentHotkeyScopeState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { INITIAL_HOTKEYS_SCOPE } from '../../constants/InitialHotkeysScope';import { HotkeyScope } from '../../types/HotkeyScope';diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/internalHotkeysEnabledScopesState.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/internalHotkeysEnabledScopesState.tsindex e2e06b62f46..9478ec88674 100644--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/internalHotkeysEnabledScopesState.ts+++ b/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/internalHotkeysEnabledScopesState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const internalHotkeysEnabledScopesState = createState<string[]>({key: 'internalHotkeysEnabledScopesState',diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/pendingHotkeysState.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/pendingHotkeysState.tsindex 13e1cc652c3..d4d8db3b1c3 100644--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/pendingHotkeysState.ts+++ b/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/pendingHotkeysState.ts@@ -1,5 +1,5 @@+import { createState } from '@ui/utilities/state/utils/createState';import { Keys } from 'react-hotkeys-hook/dist/types';-import { createState } from 'twenty-ui';export const pendingHotkeyState = createState<Keys | null>({key: 'pendingHotkeyState',diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/previousHotkeyScopeState.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/previousHotkeyScopeState.tsindex 3e438fef1b9..4585d8f32be 100644--- a/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/previousHotkeyScopeState.ts+++ b/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/previousHotkeyScopeState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { HotkeyScope } from '../../types/HotkeyScope';diff --git a/packages/twenty-front/src/modules/ui/utilities/loading-state/states/currentPageLocationState.ts b/packages/twenty-front/src/modules/ui/utilities/loading-state/states/currentPageLocationState.tsindex 601831e5a31..0deeeb3dd8b 100644--- a/packages/twenty-front/src/modules/ui/utilities/loading-state/states/currentPageLocationState.ts+++ b/packages/twenty-front/src/modules/ui/utilities/loading-state/states/currentPageLocationState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const currentPageLocationState = createState<string>({key: 'currentPageLocationState',diff --git a/packages/twenty-front/src/modules/workflow/states/openOverrideWorkflowDraftConfirmationModalState.ts b/packages/twenty-front/src/modules/workflow/states/openOverrideWorkflowDraftConfirmationModalState.tsindex 1320a964207..97da85be3d1 100644--- a/packages/twenty-front/src/modules/workflow/states/openOverrideWorkflowDraftConfirmationModalState.ts+++ b/packages/twenty-front/src/modules/workflow/states/openOverrideWorkflowDraftConfirmationModalState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const openOverrideWorkflowDraftConfirmationModalState =createState<boolean>({diff --git a/packages/twenty-front/src/modules/workflow/states/workflowCreateStepFromParentStepIdState.ts b/packages/twenty-front/src/modules/workflow/states/workflowCreateStepFromParentStepIdState.tsindex 4e64010b963..95752ce60ea 100644--- a/packages/twenty-front/src/modules/workflow/states/workflowCreateStepFromParentStepIdState.ts+++ b/packages/twenty-front/src/modules/workflow/states/workflowCreateStepFromParentStepIdState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const workflowCreateStepFromParentStepIdState = createState<string | undefineddiff --git a/packages/twenty-front/src/modules/workflow/states/workflowDiagramState.ts b/packages/twenty-front/src/modules/workflow/states/workflowDiagramState.tsindex 5f51bf85c61..2d2f22a7c83 100644--- a/packages/twenty-front/src/modules/workflow/states/workflowDiagramState.ts+++ b/packages/twenty-front/src/modules/workflow/states/workflowDiagramState.ts@@ -1,5 +1,5 @@import { WorkflowDiagram } from '@/workflow/types/WorkflowDiagram';-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const workflowDiagramState = createState<WorkflowDiagram | undefined>({key: 'workflowDiagramState',diff --git a/packages/twenty-front/src/modules/workflow/states/workflowDiagramTriggerNodeSelectionState.ts b/packages/twenty-front/src/modules/workflow/states/workflowDiagramTriggerNodeSelectionState.tsindex 91630a30046..06e64aded0c 100644--- a/packages/twenty-front/src/modules/workflow/states/workflowDiagramTriggerNodeSelectionState.ts+++ b/packages/twenty-front/src/modules/workflow/states/workflowDiagramTriggerNodeSelectionState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const workflowDiagramTriggerNodeSelectionState = createState<string | undefineddiff --git a/packages/twenty-front/src/modules/workflow/states/workflowIdState.ts b/packages/twenty-front/src/modules/workflow/states/workflowIdState.tsindex 112729ea416..f107f5dd4bf 100644--- a/packages/twenty-front/src/modules/workflow/states/workflowIdState.ts+++ b/packages/twenty-front/src/modules/workflow/states/workflowIdState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const workflowIdState = createState<string | undefined>({key: 'workflowIdState',diff --git a/packages/twenty-front/src/modules/workflow/states/workflowLastCreatedStepIdState.ts b/packages/twenty-front/src/modules/workflow/states/workflowLastCreatedStepIdState.tsindex e39718e9cc2..998ac7a8641 100644--- a/packages/twenty-front/src/modules/workflow/states/workflowLastCreatedStepIdState.ts+++ b/packages/twenty-front/src/modules/workflow/states/workflowLastCreatedStepIdState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const workflowLastCreatedStepIdState = createState<string | undefined>({key: 'workflowLastCreatedStepIdState',diff --git a/packages/twenty-front/src/modules/workflow/states/workflowReactFlowRefState.ts b/packages/twenty-front/src/modules/workflow/states/workflowReactFlowRefState.tsindex 7a56abac0bf..579eff7db8f 100644--- a/packages/twenty-front/src/modules/workflow/states/workflowReactFlowRefState.ts+++ b/packages/twenty-front/src/modules/workflow/states/workflowReactFlowRefState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { RefObject } from 'react';export const workflowReactFlowRefState =diff --git a/packages/twenty-front/src/modules/workflow/states/workflowSelectedNodeState.ts b/packages/twenty-front/src/modules/workflow/states/workflowSelectedNodeState.tsindex d920489d673..b393f8627c1 100644--- a/packages/twenty-front/src/modules/workflow/states/workflowSelectedNodeState.ts+++ b/packages/twenty-front/src/modules/workflow/states/workflowSelectedNodeState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const workflowSelectedNodeState = createState<string | undefined>({key: 'workflowSelectedNodeState',diff --git a/packages/twenty-front/src/modules/workflow/states/workflowVersionIdState.ts b/packages/twenty-front/src/modules/workflow/states/workflowVersionIdState.tsindex 2894697965d..f72cb3933f8 100644--- a/packages/twenty-front/src/modules/workflow/states/workflowVersionIdState.ts+++ b/packages/twenty-front/src/modules/workflow/states/workflowVersionIdState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const workflowVersionIdState = createState<string | undefined>({key: 'workflowVersionIdState',diff --git a/packages/twenty-front/src/modules/workspace-invitation/states/workspaceInvitationsStates.ts b/packages/twenty-front/src/modules/workspace-invitation/states/workspaceInvitationsStates.tsindex 8f550a1ad2c..80b84c3abb8 100644--- a/packages/twenty-front/src/modules/workspace-invitation/states/workspaceInvitationsStates.ts+++ b/packages/twenty-front/src/modules/workspace-invitation/states/workspaceInvitationsStates.ts@@ -1,5 +1,5 @@-import { createState } from 'twenty-ui';import { WorkspaceInvitation } from '@/workspace-member/types/WorkspaceMember';+import { createState } from '@ui/utilities/state/utils/createState';export const workspaceInvitationsState = createState<Omit<WorkspaceInvitation, '__typename'>[]diff --git a/packages/twenty-front/src/modules/workspace/states/workspaceAuthProvidersState.ts b/packages/twenty-front/src/modules/workspace/states/workspaceAuthProvidersState.tsindex 43b360a0cbe..69384bbb52b 100644--- a/packages/twenty-front/src/modules/workspace/states/workspaceAuthProvidersState.ts+++ b/packages/twenty-front/src/modules/workspace/states/workspaceAuthProvidersState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';import { AuthProviders } from '~/generated/graphql';diff --git a/packages/twenty-front/src/pages/onboarding/ChooseYourPlan.tsx b/packages/twenty-front/src/pages/onboarding/ChooseYourPlan.tsxindex 15f8a4d79cc..493a8dfaec9 100644--- a/packages/twenty-front/src/pages/onboarding/ChooseYourPlan.tsx+++ b/packages/twenty-front/src/pages/onboarding/ChooseYourPlan.tsx@@ -1,6 +1,7 @@import { SubTitle } from '@/auth/components/SubTitle';import { Title } from '@/auth/components/Title';import { useAuth } from '@/auth/hooks/useAuth';+import { billingCheckoutSessionState } from '@/auth/states/billingCheckoutSessionState';import { SubscriptionBenefit } from '@/billing/components/SubscriptionBenefit';import { SubscriptionCard } from '@/billing/components/SubscriptionCard';import { billingState } from '@/client-config/states/billingState';@@ -10,7 +11,7 @@ import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import styled from '@emotion/styled';import { isNonEmptyString, isNumber } from '@sniptt/guards';import { useState } from 'react';-import { useRecoilValue } from 'recoil';+import { useRecoilState, useRecoilValue } from 'recoil';import {ActionLink,CAL_LINK,@@ -77,8 +78,6 @@ const benefits = [export const ChooseYourPlan = () => {const billing = useRecoilValue(billingState);- const [planSelected, setPlanSelected] = useState(SubscriptionInterval.Month);-const [isSubmitting, setIsSubmitting] = useState(false);const { enqueueSnackBar } = useSnackBar();@@ -87,12 +86,44 @@ export const ChooseYourPlan = () => {variables: { product: 'base-plan' },});+ const [billingCheckoutSession, setBillingCheckoutSession] = useRecoilState(+ billingCheckoutSessionState,+ );+const [checkoutSession] = useCheckoutSessionMutation();- const handlePlanChange = (type?: SubscriptionInterval) => {+ const handleCheckoutSession = async () => {+ setIsSubmitting(true);+ const { data } = await checkoutSession({+ variables: {+ recurringInterval: billingCheckoutSession.interval,+ successUrlPath: AppPath.PlanRequiredSuccess,+ plan: billingCheckoutSession.plan,+ requirePaymentMethod: billingCheckoutSession.requirePaymentMethod,+ },+ });+ setIsSubmitting(false);+ if (!data?.checkoutSession.url) {+ enqueueSnackBar(+ 'Checkout session error. Please retry or contact Twenty team',+ {+ variant: SnackBarVariant.Error,+ },+ );+ return;+ }+ window.location.replace(data.checkoutSession.url);+ };++ const handleIntervalChange = (type?: SubscriptionInterval) => {return () => {- if (isNonEmptyString(type) && planSelected !== type) {- setPlanSelected(type);+ if (isNonEmptyString(type) && billingCheckoutSession.interval !== type) {+ setBillingCheckoutSession({+ plan: billingCheckoutSession.plan,+ interval: type,+ requirePaymentMethod: billingCheckoutSession.requirePaymentMethod,+ skipPlanPage: false,+ });}};};@@ -121,26 +152,13 @@ export const ChooseYourPlan = () => {return 'Cancel anytime';};- const handleButtonClick = async () => {- setIsSubmitting(true);- const { data } = await checkoutSession({- variables: {- recurringInterval: planSelected,- successUrlPath: AppPath.PlanRequiredSuccess,- },- });- setIsSubmitting(false);- if (!data?.checkoutSession.url) {- enqueueSnackBar(- 'Checkout session error. Please retry or contact Twenty team',- {- variant: SnackBarVariant.Error,- },- );- return;- }- window.location.replace(data.checkoutSession.url);- };+ if (billingCheckoutSession.skipPlanPage && !isSubmitting) {+ handleCheckoutSession();+ }++ if (billingCheckoutSession.skipPlanPage || isSubmitting) {+ return <Loader />;+ }return (prices?.getProductPrices?.productPrices && (@@ -152,8 +170,10 @@ export const ChooseYourPlan = () => {<StyledChoosePlanContainer>{prices.getProductPrices.productPrices.map((price, index) => (<CardPicker- checked={price.recurringInterval === planSelected}- handleChange={handlePlanChange(price.recurringInterval)}+ checked={+ price.recurringInterval === billingCheckoutSession.interval+ }+ handleChange={handleIntervalChange(price.recurringInterval)}key={index}><SubscriptionCard@@ -171,7 +191,7 @@ export const ChooseYourPlan = () => {</StyledBenefitsContainer><MainButtontitle="Continue"- onClick={handleButtonClick}+ onClick={handleCheckoutSession}width={200}Icon={() => isSubmitting && <Loader />}disabled={isSubmitting}diff --git a/packages/twenty-front/src/pages/settings/data-model/states/updatedObjectSlugState.ts b/packages/twenty-front/src/pages/settings/data-model/states/updatedObjectSlugState.tsindex be64d0b5003..6140293dcbb 100644--- a/packages/twenty-front/src/pages/settings/data-model/states/updatedObjectSlugState.ts+++ b/packages/twenty-front/src/pages/settings/data-model/states/updatedObjectSlugState.ts@@ -1,4 +1,4 @@-import { createState } from 'twenty-ui';+import { createState } from '@ui/utilities/state/utils/createState';export const updatedObjectSlugState = createState<string>({key: 'updatedObjectSlugState',diff --git a/packages/twenty-front/src/testing/decorators/PageDecorator.tsx b/packages/twenty-front/src/testing/decorators/PageDecorator.tsxindex 97232ffc1ed..1fcbce56fbc 100644--- a/packages/twenty-front/src/testing/decorators/PageDecorator.tsx+++ b/packages/twenty-front/src/testing/decorators/PageDecorator.tsx@@ -23,9 +23,9 @@ import { mockedApolloClient } from '~/testing/mockedApolloClient';import { RecoilDebugObserverEffect } from '@/debug/components/RecoilDebugObserver';import { ObjectMetadataItemsProvider } from '@/object-metadata/components/ObjectMetadataItemsProvider';import { PrefetchDataProvider } from '@/prefetch/components/PrefetchDataProvider';+import { WorkspaceProviderEffect } from '@/workspace/components/WorkspaceProviderEffect';import { IconsProvider } from 'twenty-ui';import { FullHeightStorybookLayout } from '../FullHeightStorybookLayout';-import { WorkspaceProviderEffect } from '@/workspace/components/WorkspaceProviderEffect';export type PageDecoratorArgs = {routePath: string;diff --git a/packages/twenty-server/src/engine/core-modules/auth/controllers/google-auth.controller.ts b/packages/twenty-server/src/engine/core-modules/auth/controllers/google-auth.controller.tsindex bb5414f0826..31b83489f46 100644--- a/packages/twenty-server/src/engine/core-modules/auth/controllers/google-auth.controller.ts+++ b/packages/twenty-server/src/engine/core-modules/auth/controllers/google-auth.controller.ts@@ -8,9 +8,10 @@ import {} from '@nestjs/common';import { InjectRepository } from '@nestjs/typeorm';-import { Repository } from 'typeorm';import { Response } from 'express';+import { Repository } from 'typeorm';+import { AuthException } from 'src/engine/core-modules/auth/auth.exception';import { AuthOAuthExceptionFilter } from 'src/engine/core-modules/auth/filters/auth-oauth-exception.filter';import { AuthRestApiExceptionFilter } from 'src/engine/core-modules/auth/filters/auth-rest-api-exception.filter';import { GoogleOauthGuard } from 'src/engine/core-modules/auth/guards/google-oauth.guard';@@ -18,9 +19,8 @@ import { GoogleProviderEnabledGuard } from 'src/engine/core-modules/auth/guards/import { AuthService } from 'src/engine/core-modules/auth/services/auth.service';import { GoogleRequest } from 'src/engine/core-modules/auth/strategies/google.auth.strategy';import { LoginTokenService } from 'src/engine/core-modules/auth/token/services/login-token.service';-import { AuthException } from 'src/engine/core-modules/auth/auth.exception';-import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';import { DomainManagerService } from 'src/engine/core-modules/domain-manager/service/domain-manager.service';+import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';@Controller('auth/google')@@ -55,6 +55,7 @@ export class GoogleAuthController {workspaceInviteHash,workspacePersonalInviteToken,targetWorkspaceSubdomain,+ billingCheckoutSessionState,} = req.user;const signInUpParams = {@@ -106,6 +107,7 @@ export class GoogleAuthController {this.authService.computeRedirectURI(loginToken.token,workspace.subdomain,+ billingCheckoutSessionState,),);} catch (err) {diff --git a/packages/twenty-server/src/engine/core-modules/auth/controllers/microsoft-auth.controller.ts b/packages/twenty-server/src/engine/core-modules/auth/controllers/microsoft-auth.controller.tsindex 3d12f2a9123..131c5620757 100644--- a/packages/twenty-server/src/engine/core-modules/auth/controllers/microsoft-auth.controller.ts+++ b/packages/twenty-server/src/engine/core-modules/auth/controllers/microsoft-auth.controller.ts@@ -11,15 +11,15 @@ import { InjectRepository } from '@nestjs/typeorm';import { Response } from 'express';import { Repository } from 'typeorm';+import { AuthException } from 'src/engine/core-modules/auth/auth.exception';import { AuthRestApiExceptionFilter } from 'src/engine/core-modules/auth/filters/auth-rest-api-exception.filter';import { MicrosoftOAuthGuard } from 'src/engine/core-modules/auth/guards/microsoft-oauth.guard';import { MicrosoftProviderEnabledGuard } from 'src/engine/core-modules/auth/guards/microsoft-provider-enabled.guard';import { AuthService } from 'src/engine/core-modules/auth/services/auth.service';import { MicrosoftRequest } from 'src/engine/core-modules/auth/strategies/microsoft.auth.strategy';import { LoginTokenService } from 'src/engine/core-modules/auth/token/services/login-token.service';-import { AuthException } from 'src/engine/core-modules/auth/auth.exception';-import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';import { DomainManagerService } from 'src/engine/core-modules/domain-manager/service/domain-manager.service';+import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';@Controller('auth/microsoft')@@ -90,6 +90,7 @@ export class MicrosoftAuthController {this.authService.computeRedirectURI(loginToken.token,workspace.subdomain,+ signInUpParams.billingCheckoutSessionState,),);} catch (err) {diff --git a/packages/twenty-server/src/engine/core-modules/auth/guards/google-oauth.guard.ts b/packages/twenty-server/src/engine/core-modules/auth/guards/google-oauth.guard.tsindex 8f2f6b95c02..2cb7e93a1b0 100644--- a/packages/twenty-server/src/engine/core-modules/auth/guards/google-oauth.guard.ts+++ b/packages/twenty-server/src/engine/core-modules/auth/guards/google-oauth.guard.ts@@ -45,6 +45,14 @@ export class GoogleOauthGuard extends AuthGuard('google') {request.params.workspaceSubdomain = request.query.workspaceSubdomain;}+ if (+ request.query.billingCheckoutSessionState &&+ typeof request.query.billingCheckoutSessionState === 'string'+ ) {+ request.params.billingCheckoutSessionState =+ request.query.billingCheckoutSessionState;+ }+return (await super.canActivate(context)) as boolean;}}diff --git a/packages/twenty-server/src/engine/core-modules/auth/guards/microsoft-oauth.guard.ts b/packages/twenty-server/src/engine/core-modules/auth/guards/microsoft-oauth.guard.tsindex 049f147898d..6a2d40faf2c 100644--- a/packages/twenty-server/src/engine/core-modules/auth/guards/microsoft-oauth.guard.ts+++ b/packages/twenty-server/src/engine/core-modules/auth/guards/microsoft-oauth.guard.ts@@ -33,6 +33,14 @@ export class MicrosoftOAuthGuard extends AuthGuard('microsoft') {request.params.workspaceSubdomain = request.query.workspaceSubdomain;}+ if (+ request.query.billingCheckoutSessionState &&+ typeof request.query.billingCheckoutSessionState === 'string'+ ) {+ request.params.billingCheckoutSessionState =+ request.query.billingCheckoutSessionState;+ }+return (await super.canActivate(context)) as boolean;}}diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts b/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.tsindex a045f40de3b..9a17c69f877 100644--- a/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts+++ b/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts@@ -28,6 +28,7 @@ import { AuthorizeApp } from 'src/engine/core-modules/auth/dto/authorize-app.entimport { AuthorizeAppInput } from 'src/engine/core-modules/auth/dto/authorize-app.input';import { AvailableWorkspaceOutput } from 'src/engine/core-modules/auth/dto/available-workspaces.output';import { ChallengeInput } from 'src/engine/core-modules/auth/dto/challenge.input';+import { AuthTokens } from 'src/engine/core-modules/auth/dto/token.entity';import { UpdatePassword } from 'src/engine/core-modules/auth/dto/update-password.entity';import {UserExists,@@ -46,7 +47,6 @@ import { userValidator } from 'src/engine/core-modules/user/user.validate';import { WorkspaceInvitationService } from 'src/engine/core-modules/workspace-invitation/services/workspace-invitation.service';import { WorkspaceAuthProvider } from 'src/engine/core-modules/workspace/types/workspace.type';import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';-import { AuthTokens } from 'src/engine/core-modules/auth/dto/token.entity';@Injectable()// eslint-disable-next-line @nx/workspace-inject-workspace-repository@@ -171,6 +171,7 @@ export class AuthService {fromSSO: boolean;targetWorkspaceSubdomain?: string;authProvider?: WorkspaceAuthProvider;+ billingCheckoutSessionState?: string;}) {return await this.signInUpService.signInUp({email,@@ -413,11 +414,18 @@ export class AuthService {return workspace;}- computeRedirectURI(loginToken: string, subdomain?: string) {+ computeRedirectURI(+ loginToken: string,+ subdomain?: string,+ billingCheckoutSessionState?: string,+ ) {const url = this.domainManagerService.buildWorkspaceURL({subdomain,pathname: '/verify',- searchParams: { loginToken },+ searchParams: {+ loginToken,+ ...(billingCheckoutSessionState ? { billingCheckoutSessionState } : {}),+ },});return url.toString();diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts b/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.tsindex e86e60a7f65..53a8028cb80 100644--- a/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts+++ b/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts@@ -35,8 +35,8 @@ import {import { workspaceValidator } from 'src/engine/core-modules/workspace/workspace.validate';import { getDomainNameByEmail } from 'src/utils/get-domain-name-by-email';import { getImageBufferFromUrl } from 'src/utils/image';-import { isWorkEmail } from 'src/utils/is-work-email';import { isDefined } from 'src/utils/is-defined';+import { isWorkEmail } from 'src/utils/is-work-email';export type SignInUpServiceInput = {email: string;diff --git a/packages/twenty-server/src/engine/core-modules/auth/strategies/google.auth.strategy.ts b/packages/twenty-server/src/engine/core-modules/auth/strategies/google.auth.strategy.tsindex 5e20e1a600f..b673e744995 100644--- a/packages/twenty-server/src/engine/core-modules/auth/strategies/google.auth.strategy.ts+++ b/packages/twenty-server/src/engine/core-modules/auth/strategies/google.auth.strategy.ts@@ -18,6 +18,7 @@ export type GoogleRequest = Omit<workspaceInviteHash?: string;workspacePersonalInviteToken?: string;targetWorkspaceSubdomain?: string;+ billingCheckoutSessionState?: string;};};@@ -39,6 +40,12 @@ export class GoogleStrategy extends PassportStrategy(Strategy, 'google') {state: JSON.stringify({workspaceInviteHash: req.params.workspaceInviteHash,workspaceSubdomain: req.params.workspaceSubdomain,+ ...(req.params.billingCheckoutSessionState+ ? {+ billingCheckoutSessionState:+ req.params.billingCheckoutSessionState,+ }+ : {}),...(req.params.workspacePersonalInviteToken? {workspacePersonalInviteToken:@@ -72,6 +79,7 @@ export class GoogleStrategy extends PassportStrategy(Strategy, 'google') {workspaceInviteHash: state.workspaceInviteHash,workspacePersonalInviteToken: state.workspacePersonalInviteToken,targetWorkspaceSubdomain: state.workspaceSubdomain,+ billingCheckoutSessionState: state.billingCheckoutSessionState,};done(null, user);diff --git a/packages/twenty-server/src/engine/core-modules/auth/strategies/microsoft.auth.strategy.ts b/packages/twenty-server/src/engine/core-modules/auth/strategies/microsoft.auth.strategy.tsindex 39077fb6d06..1ae2afb3cbe 100644--- a/packages/twenty-server/src/engine/core-modules/auth/strategies/microsoft.auth.strategy.ts+++ b/packages/twenty-server/src/engine/core-modules/auth/strategies/microsoft.auth.strategy.ts@@ -22,6 +22,7 @@ export type MicrosoftRequest = Omit<workspaceInviteHash?: string;workspacePersonalInviteToken?: string;targetWorkspaceSubdomain?: string;+ billingCheckoutSessionState?: string;};};@@ -43,6 +44,12 @@ export class MicrosoftStrategy extends PassportStrategy(Strategy, 'microsoft') {state: JSON.stringify({workspaceInviteHash: req.params.workspaceInviteHash,workspaceSubdomain: req.params.workspaceSubdomain,+ ...(req.params.billingCheckoutSessionState+ ? {+ billingCheckoutSessionState:+ req.params.billingCheckoutSessionState,+ }+ : {}),...(req.params.workspacePersonalInviteToken? {workspacePersonalInviteToken:@@ -86,6 +93,7 @@ export class MicrosoftStrategy extends PassportStrategy(Strategy, 'microsoft') {workspaceInviteHash: state.workspaceInviteHash,workspacePersonalInviteToken: state.workspacePersonalInviteToken,targetWorkspaceSubdomain: state.workspaceSubdomain,+ billingCheckoutSessionState: state.billingCheckoutSessionState,};done(null, user);diff --git a/packages/twenty-server/src/engine/core-modules/billing/billing.resolver.ts b/packages/twenty-server/src/engine/core-modules/billing/billing.resolver.tsindex 4dcc92f96c9..df2d4469de0 100644--- a/packages/twenty-server/src/engine/core-modules/billing/billing.resolver.ts+++ b/packages/twenty-server/src/engine/core-modules/billing/billing.resolver.ts@@ -56,7 +56,13 @@ export class BillingResolver {async checkoutSession(@AuthWorkspace() workspace: Workspace,@AuthUser() user: User,- @Args() { recurringInterval, successUrlPath }: CheckoutSessionInput,+ @Args()+ {+ recurringInterval,+ successUrlPath,+ plan,+ requirePaymentMethod,+ }: CheckoutSessionInput,) {const productPrice = await this.stripeService.getStripePrice(AvailableProduct.BasePlan,@@ -75,6 +81,8 @@ export class BillingResolver {workspace,productPrice.stripePriceId,successUrlPath,+ plan,+ requirePaymentMethod,),};}diff --git a/packages/twenty-server/src/engine/core-modules/billing/dto/checkout-session.input.ts b/packages/twenty-server/src/engine/core-modules/billing/dto/checkout-session.input.tsindex 9371eee8f24..b5c882be2b6 100644--- a/packages/twenty-server/src/engine/core-modules/billing/dto/checkout-session.input.ts+++ b/packages/twenty-server/src/engine/core-modules/billing/dto/checkout-session.input.ts@@ -1,16 +1,32 @@import { ArgsType, Field } from '@nestjs/graphql';-import { IsNotEmpty, IsOptional, IsString } from 'class-validator';-import Stripe from 'stripe';+import {+ IsBoolean,+ IsEnum,+ IsNotEmpty,+ IsOptional,+ IsString,+} from 'class-validator';+import { BillingPlanKey } from 'src/engine/core-modules/billing/enums/billing-plan-key.enum';import { SubscriptionInterval } from 'src/engine/core-modules/billing/enums/billing-subscription-interval.enum';@ArgsType()export class CheckoutSessionInput {@Field(() => SubscriptionInterval)- @IsString()+ @IsEnum(SubscriptionInterval)@IsNotEmpty()- recurringInterval: Stripe.Price.Recurring.Interval;+ recurringInterval: SubscriptionInterval;++ @Field(() => BillingPlanKey, { defaultValue: BillingPlanKey.PRO })+ @IsEnum(BillingPlanKey)+ @IsOptional()+ plan?: BillingPlanKey;++ @Field(() => Boolean, { defaultValue: true })+ @IsBoolean()+ @IsOptional()+ requirePaymentMethod?: boolean;@Field(() => String, { nullable: true })@IsString()diff --git a/packages/twenty-server/src/engine/core-modules/billing/enums/billing-plan-key.enum.ts b/packages/twenty-server/src/engine/core-modules/billing/enums/billing-plan-key.enum.tsindex 2f8aa1eb128..55b4e2ad696 100644--- a/packages/twenty-server/src/engine/core-modules/billing/enums/billing-plan-key.enum.ts+++ b/packages/twenty-server/src/engine/core-modules/billing/enums/billing-plan-key.enum.ts@@ -1,4 +1,12 @@+import { registerEnumType } from '@nestjs/graphql';+export enum BillingPlanKey {- BASE_PLAN = 'BASE_PLAN',- PRO_PLAN = 'PRO_PLAN',+ BASE = 'BASE',+ PRO = 'PRO',+ ENTERPRISE = 'ENTERPRISE',}++registerEnumType(BillingPlanKey, {+ name: 'BillingPlanKey',+ description: 'The different billing plans available',+});diff --git a/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts b/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.tsindex 44b26626d0a..f422b07dc89 100644--- a/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts+++ b/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts@@ -4,6 +4,7 @@ import { InjectRepository } from '@nestjs/typeorm';import { Repository } from 'typeorm';import { BillingSubscription } from 'src/engine/core-modules/billing/entities/billing-subscription.entity';+import { BillingPlanKey } from 'src/engine/core-modules/billing/enums/billing-plan-key.enum';import { BillingSubscriptionService } from 'src/engine/core-modules/billing/services/billing-subscription.service';import { StripeService } from 'src/engine/core-modules/billing/stripe/stripe.service';import { DomainManagerService } from 'src/engine/core-modules/domain-manager/service/domain-manager.service';@@ -30,6 +31,8 @@ export class BillingPortalWorkspaceService {workspace: Workspace,priceId: string,successUrlPath?: string,+ plan?: BillingPlanKey,+ requirePaymentMethod?: boolean,): Promise<string> {const frontBaseUrl = this.domainManagerService.getBaseUrl();const cancelUrl = frontBaseUrl.toString();@@ -57,6 +60,8 @@ export class BillingPortalWorkspaceService {successUrl,cancelUrl,stripeCustomerId,+ plan,+ requirePaymentMethod,);assert(session.url, 'Error: missing checkout.session.url');diff --git a/packages/twenty-server/src/engine/core-modules/billing/services/billing-webhook-product.service.ts b/packages/twenty-server/src/engine/core-modules/billing/services/billing-webhook-product.service.tsindex 1c9fcf85904..084a4759b88 100644--- a/packages/twenty-server/src/engine/core-modules/billing/services/billing-webhook-product.service.ts+++ b/packages/twenty-server/src/engine/core-modules/billing/services/billing-webhook-product.service.ts@@ -52,9 +52,9 @@ export class BillingWebhookProductService {isValidBillingPlanKey(planKey?: string) {switch (planKey) {- case BillingPlanKey.BASE_PLAN:+ case BillingPlanKey.BASE:return true;- case BillingPlanKey.PRO_PLAN:+ case BillingPlanKey.PRO:return true;default:return false;diff --git a/packages/twenty-server/src/engine/core-modules/billing/stripe/stripe.service.ts b/packages/twenty-server/src/engine/core-modules/billing/stripe/stripe.service.tsindex 62d66fb7991..cd837ae8f4c 100644--- a/packages/twenty-server/src/engine/core-modules/billing/stripe/stripe.service.ts+++ b/packages/twenty-server/src/engine/core-modules/billing/stripe/stripe.service.ts@@ -5,6 +5,7 @@ import Stripe from 'stripe';import { ProductPriceEntity } from 'src/engine/core-modules/billing/dto/product-price.entity';import { BillingSubscriptionItem } from 'src/engine/core-modules/billing/entities/billing-subscription-item.entity';import { AvailableProduct } from 'src/engine/core-modules/billing/enums/billing-available-product.enum';+import { BillingPlanKey } from 'src/engine/core-modules/billing/enums/billing-plan-key.enum';import { DomainManagerService } from 'src/engine/core-modules/domain-manager/service/domain-manager.service';import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';import { User } from 'src/engine/core-modules/user/user.entity';@@ -90,6 +91,8 @@ export class StripeService {successUrl?: string,cancelUrl?: string,stripeCustomerId?: string,+ plan: BillingPlanKey = BillingPlanKey.PRO,+ requirePaymentMethod = true,): Promise<Stripe.Checkout.Session> {return await this.stripe.checkout.sessions.create({line_items: [@@ -102,18 +105,22 @@ export class StripeService {subscription_data: {metadata: {workspaceId,+ plan,},trial_period_days: this.environmentService.get('BILLING_FREE_TRIAL_DURATION_IN_DAYS',),},- automatic_tax: { enabled: true },- tax_id_collection: { enabled: true },+ automatic_tax: { enabled: !!requirePaymentMethod },+ tax_id_collection: { enabled: !!requirePaymentMethod },customer: stripeCustomerId,customer_update: stripeCustomerId ? { name: 'auto' } : undefined,customer_email: stripeCustomerId ? undefined : user.email,success_url: successUrl,cancel_url: cancelUrl,+ payment_method_collection: requirePaymentMethod+ ? 'always'+ : 'if_required',});}diff --git a/yarn.lock b/yarn.lockindex 00f102542e1..0b46335c9ac 100644--- a/yarn.lock+++ b/yarn.lock@@ -11576,6 +11576,13 @@ __metadata:languageName: nodelinkType: hard+"@recoiljs/refine@npm:^0.1.1":+ version: 0.1.1+ resolution: "@recoiljs/refine@npm:0.1.1"+ checksum: 10c0/27ca1c4ea500b1b99a3af5ee48d6749310e5138e83b87ddfb41304e2222fa64567acb985f340334ab73980202ab277a0f133c40817fbec786076c06bfb3f5363+ languageName: node+ linkType: hard+"@redis/bloom@npm:1.2.0, @redis/bloom@npm:^1.2.0":version: 1.2.0resolution: "@redis/bloom@npm:1.2.0"@@ -40639,6 +40646,18 @@ __metadata:languageName: nodelinkType: hard+"recoil-sync@npm:^0.2.0":+ version: 0.2.0+ resolution: "recoil-sync@npm:0.2.0"+ dependencies:+ "@recoiljs/refine": "npm:^0.1.1"+ transit-js: "npm:^0.8.874"+ peerDependencies:+ recoil: ">=0.7.3"+ checksum: 10c0/f3a671a3cfcecadb5bbb22d47b3b040721be1013ee91d4fa0570a64ca1707eb68e818b291a82e133551adf4a2dd2fc9a0715d550c1f1e3db82f3b8d9169e2a5a+ languageName: node+ linkType: hard+"recoil@npm:^0.7.7":version: 0.7.7resolution: "recoil@npm:0.7.7"@@ -44346,6 +44365,13 @@ __metadata:languageName: nodelinkType: hard+"transit-js@npm:^0.8.874":+ version: 0.8.874+ resolution: "transit-js@npm:0.8.874"+ checksum: 10c0/6ca0b413f1e3780a4a56b9bbde54b67a2ffefda1c052f8dc68bf28c1a3df4c29baa6f17f60484c9f2fb056a8c7dcd1fe04d24e091fb99afe1525e4d4406ad58a+ languageName: node+ linkType: hard+"transliteration@npm:^2.3.5":version: 2.3.5resolution: "transliteration@npm:2.3.5"@@ -44879,6 +44905,7 @@ __metadata:buffer: "npm:^6.0.3"docx: "npm:^9.1.0"file-saver: "npm:^2.0.5"+ recoil-sync: "npm:^0.2.0"transliteration: "npm:^2.3.5"languageName: unknownlinkType: soft