The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Replace Accounts with App preferences behind a feature flag (#27708)
nitinb9c2963438bc
diff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql b/packages/twenty-client-sdk/src/metadata/generated/schema.graphqlindex 1c482a15062..bf7a59df9fc 100644--- a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.graphql@@ -2072,6 +2072,7 @@ enum FeatureFlagKey {IS_AI_CHAT_INBOX_ENABLEDIS_AI_CHAT_SHARING_DROPDOWN_ENABLEDIS_APPLICATION_WORKFLOWS_ENABLED+ IS_APP_PREFERENCES_ENABLEDIS_ASYNC_CSV_EXPORT_ENABLEDIS_CALENDAR_SYNC_SKIP_UNCHANGED_RECORDS_ENABLEDIS_CONFIGURABLE_SEARCH_FIELDS_ENABLEDdiff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.ts b/packages/twenty-client-sdk/src/metadata/generated/schema.tsindex 5faeb5c45a7..386e3c05d74 100644--- a/packages/twenty-client-sdk/src/metadata/generated/schema.ts+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.ts@@ -1331,7 +1331,7 @@ export interface FeatureFlag {__typename: 'FeatureFlag'}-export type FeatureFlagKey = 'IS_AI_CHAT_INBOX_ENABLED' | 'IS_AI_CHAT_SHARING_DROPDOWN_ENABLED' | 'IS_APPLICATION_WORKFLOWS_ENABLED' | 'IS_ASYNC_CSV_EXPORT_ENABLED' | 'IS_CALENDAR_SYNC_SKIP_UNCHANGED_RECORDS_ENABLED' | 'IS_CONFIGURABLE_SEARCH_FIELDS_ENABLED' | 'IS_CONVERSATIONS_TAB_ENABLED' | 'IS_DEFERRED_WORKSPACE_MIGRATION_ACTIONS_ENABLED' | 'IS_INITIAL_OBJECT_VIEW_ENABLED' | 'IS_JSON_FILTER_ENABLED' | 'IS_LOGS_SETTINGS_SECTION_ENABLED' | 'IS_MESSAGE_CAMPAIGN_ENABLED' | 'IS_RECORD_CREATION_FORM_ENABLED' | 'IS_RECORD_LEVEL_SHARING_ENABLED' | 'IS_RECORD_SHARE_VISIBILITY_GATING_ENABLED' | 'IS_REST_METADATA_API_NEW_FORMAT_DIRECT' | 'IS_VALIDATION_RULES_ENABLED' | 'IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED' | 'IS_WORKFLOW_SEND_CHAT_MESSAGE_ENABLED'+export type FeatureFlagKey = 'IS_AI_CHAT_INBOX_ENABLED' | 'IS_AI_CHAT_SHARING_DROPDOWN_ENABLED' | 'IS_APPLICATION_WORKFLOWS_ENABLED' | 'IS_APP_PREFERENCES_ENABLED' | 'IS_ASYNC_CSV_EXPORT_ENABLED' | 'IS_CALENDAR_SYNC_SKIP_UNCHANGED_RECORDS_ENABLED' | 'IS_CONFIGURABLE_SEARCH_FIELDS_ENABLED' | 'IS_CONVERSATIONS_TAB_ENABLED' | 'IS_DEFERRED_WORKSPACE_MIGRATION_ACTIONS_ENABLED' | 'IS_INITIAL_OBJECT_VIEW_ENABLED' | 'IS_JSON_FILTER_ENABLED' | 'IS_LOGS_SETTINGS_SECTION_ENABLED' | 'IS_MESSAGE_CAMPAIGN_ENABLED' | 'IS_RECORD_CREATION_FORM_ENABLED' | 'IS_RECORD_LEVEL_SHARING_ENABLED' | 'IS_RECORD_SHARE_VISIBILITY_GATING_ENABLED' | 'IS_REST_METADATA_API_NEW_FORMAT_DIRECT' | 'IS_VALIDATION_RULES_ENABLED' | 'IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED' | 'IS_WORKFLOW_SEND_CHAT_MESSAGE_ENABLED'export interface Field {applicationId: Scalars['UUID']@@ -11442,6 +11442,7 @@ export const enumFeatureFlagKey = {IS_AI_CHAT_INBOX_ENABLED: 'IS_AI_CHAT_INBOX_ENABLED' as const,IS_AI_CHAT_SHARING_DROPDOWN_ENABLED: 'IS_AI_CHAT_SHARING_DROPDOWN_ENABLED' as const,IS_APPLICATION_WORKFLOWS_ENABLED: 'IS_APPLICATION_WORKFLOWS_ENABLED' as const,+ IS_APP_PREFERENCES_ENABLED: 'IS_APP_PREFERENCES_ENABLED' as const,IS_ASYNC_CSV_EXPORT_ENABLED: 'IS_ASYNC_CSV_EXPORT_ENABLED' as const,IS_CALENDAR_SYNC_SKIP_UNCHANGED_RECORDS_ENABLED: 'IS_CALENDAR_SYNC_SKIP_UNCHANGED_RECORDS_ENABLED' as const,IS_CONFIGURABLE_SEARCH_FIELDS_ENABLED: 'IS_CONFIGURABLE_SEARCH_FIELDS_ENABLED' as const,diff --git a/packages/twenty-front/src/generated-admin/graphql.ts b/packages/twenty-front/src/generated-admin/graphql.tsindex 574695b986a..291304e0dac 100644--- a/packages/twenty-front/src/generated-admin/graphql.ts+++ b/packages/twenty-front/src/generated-admin/graphql.ts@@ -479,6 +479,7 @@ export enum FeatureFlagKey {IS_AI_CHAT_INBOX_ENABLED = 'IS_AI_CHAT_INBOX_ENABLED',IS_AI_CHAT_SHARING_DROPDOWN_ENABLED = 'IS_AI_CHAT_SHARING_DROPDOWN_ENABLED',IS_APPLICATION_WORKFLOWS_ENABLED = 'IS_APPLICATION_WORKFLOWS_ENABLED',+ IS_APP_PREFERENCES_ENABLED = 'IS_APP_PREFERENCES_ENABLED',IS_ASYNC_CSV_EXPORT_ENABLED = 'IS_ASYNC_CSV_EXPORT_ENABLED',IS_CALENDAR_SYNC_SKIP_UNCHANGED_RECORDS_ENABLED = 'IS_CALENDAR_SYNC_SKIP_UNCHANGED_RECORDS_ENABLED',IS_CONFIGURABLE_SEARCH_FIELDS_ENABLED = 'IS_CONFIGURABLE_SEARCH_FIELDS_ENABLED',diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.tsindex 743dec949c0..dcdfca32815 100644--- a/packages/twenty-front/src/generated-metadata/graphql.ts+++ b/packages/twenty-front/src/generated-metadata/graphql.ts@@ -2190,6 +2190,7 @@ export enum FeatureFlagKey {IS_AI_CHAT_INBOX_ENABLED = 'IS_AI_CHAT_INBOX_ENABLED',IS_AI_CHAT_SHARING_DROPDOWN_ENABLED = 'IS_AI_CHAT_SHARING_DROPDOWN_ENABLED',IS_APPLICATION_WORKFLOWS_ENABLED = 'IS_APPLICATION_WORKFLOWS_ENABLED',+ IS_APP_PREFERENCES_ENABLED = 'IS_APP_PREFERENCES_ENABLED',IS_ASYNC_CSV_EXPORT_ENABLED = 'IS_ASYNC_CSV_EXPORT_ENABLED',IS_CALENDAR_SYNC_SKIP_UNCHANGED_RECORDS_ENABLED = 'IS_CALENDAR_SYNC_SKIP_UNCHANGED_RECORDS_ENABLED',IS_CONFIGURABLE_SEARCH_FIELDS_ENABLED = 'IS_CONFIGURABLE_SEARCH_FIELDS_ENABLED',@@ -9701,7 +9702,7 @@ export type MyCalendarChannelsQuery = { __typename?: 'Query', myCalendarChannelsexport type MyConnectedAccountsQueryVariables = Exact<{ [key: string]: never; }>;-export type MyConnectedAccountsQuery = { __typename?: 'Query', myConnectedAccounts: Array<{ __typename?: 'ConnectedAccountPublicDTO', id: string, handle: string, provider: string, authFailedAt?: string | null, authFailedReason?: string | null, archivedAt?: string | null, scopes?: Array<string> | null, handleAliases?: Array<string> | null, lastSignedInAt?: string | null, userWorkspaceId: string, connectionProviderId?: string | null, name?: string | null, visibility: string, lastCredentialsRefreshedAt?: string | null, createdAt: string, updatedAt: string, connectionParameters?: { __typename?: 'PublicImapSmtpCaldavConnectionParameters', IMAP?: { __typename?: 'PublicConnectionParametersOutput', host: string, port: number, connectionSecurity?: EmailConnectionSecurity | null, username?: string | null } | null, SMTP?: { __typename?: 'PublicConnectionParametersOutput', host: string, port: number, connectionSecurity?: EmailConnectionSecurity | null, username?: string | null } | null, CALDAV?: { __typename?: 'PublicConnectionParametersOutput', host: string, username?: string | null } | null } | null }> };+export type MyConnectedAccountsQuery = { __typename?: 'Query', myConnectedAccounts: Array<{ __typename?: 'ConnectedAccountPublicDTO', id: string, handle: string, provider: string, authFailedAt?: string | null, authFailedReason?: string | null, archivedAt?: string | null, scopes?: Array<string> | null, handleAliases?: Array<string> | null, lastSignedInAt?: string | null, userWorkspaceId: string, connectionProviderId?: string | null, applicationId?: string | null, name?: string | null, visibility: string, lastCredentialsRefreshedAt?: string | null, createdAt: string, updatedAt: string, connectionParameters?: { __typename?: 'PublicImapSmtpCaldavConnectionParameters', IMAP?: { __typename?: 'PublicConnectionParametersOutput', host: string, port: number, connectionSecurity?: EmailConnectionSecurity | null, username?: string | null } | null, SMTP?: { __typename?: 'PublicConnectionParametersOutput', host: string, port: number, connectionSecurity?: EmailConnectionSecurity | null, username?: string | null } | null, CALDAV?: { __typename?: 'PublicConnectionParametersOutput', host: string, username?: string | null } | null } | null }> };export type MyMessageChannelsQueryVariables = Exact<{connectedAccountId?: InputMaybe<Scalars['UUID']['input']>;@@ -11015,7 +11016,7 @@ export const UpdateMessageChannelDocument = {"kind":"Document","definitions":[{"export const UpdateMessageFoldersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateMessageFolders"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateMessageFoldersInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateMessageFolders"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isSynced"}},{"kind":"Field","name":{"kind":"Name","value":"pendingSyncAction"}}]}}]}}]} as unknown as DocumentNode<UpdateMessageFoldersMutation, UpdateMessageFoldersMutationVariables>;export const GetConnectedImapSmtpCaldavAccountDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetConnectedImapSmtpCaldavAccount"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getConnectedImapSmtpCaldavAccount"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"handle"}},{"kind":"Field","name":{"kind":"Name","value":"provider"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}},{"kind":"Field","name":{"kind":"Name","value":"connectionParameters"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"IMAP"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"host"}},{"kind":"Field","name":{"kind":"Name","value":"port"}},{"kind":"Field","name":{"kind":"Name","value":"connectionSecurity"}},{"kind":"Field","name":{"kind":"Name","value":"username"}}]}},{"kind":"Field","name":{"kind":"Name","value":"SMTP"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"host"}},{"kind":"Field","name":{"kind":"Name","value":"username"}},{"kind":"Field","name":{"kind":"Name","value":"port"}},{"kind":"Field","name":{"kind":"Name","value":"connectionSecurity"}}]}},{"kind":"Field","name":{"kind":"Name","value":"CALDAV"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"host"}},{"kind":"Field","name":{"kind":"Name","value":"port"}},{"kind":"Field","name":{"kind":"Name","value":"connectionSecurity"}},{"kind":"Field","name":{"kind":"Name","value":"username"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetConnectedImapSmtpCaldavAccountQuery, GetConnectedImapSmtpCaldavAccountQueryVariables>;export const MyCalendarChannelsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MyCalendarChannels"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"connectedAccountId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"myCalendarChannels"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"connectedAccountId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"connectedAccountId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"handle"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"syncStatus"}},{"kind":"Field","name":{"kind":"Name","value":"syncStage"}},{"kind":"Field","name":{"kind":"Name","value":"syncStageStartedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isContactAutoCreationEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"contactAutoCreationPolicy"}},{"kind":"Field","name":{"kind":"Name","value":"isSyncEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"connectedAccountId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}}]} as unknown as DocumentNode<MyCalendarChannelsQuery, MyCalendarChannelsQueryVariables>;-export const MyConnectedAccountsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MyConnectedAccounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"myConnectedAccounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"handle"}},{"kind":"Field","name":{"kind":"Name","value":"provider"}},{"kind":"Field","name":{"kind":"Name","value":"authFailedAt"}},{"kind":"Field","name":{"kind":"Name","value":"authFailedReason"}},{"kind":"Field","name":{"kind":"Name","value":"archivedAt"}},{"kind":"Field","name":{"kind":"Name","value":"scopes"}},{"kind":"Field","name":{"kind":"Name","value":"handleAliases"}},{"kind":"Field","name":{"kind":"Name","value":"lastSignedInAt"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}},{"kind":"Field","name":{"kind":"Name","value":"connectionProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"lastCredentialsRefreshedAt"}},{"kind":"Field","name":{"kind":"Name","value":"connectionParameters"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"IMAP"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"host"}},{"kind":"Field","name":{"kind":"Name","value":"port"}},{"kind":"Field","name":{"kind":"Name","value":"connectionSecurity"}},{"kind":"Field","name":{"kind":"Name","value":"username"}}]}},{"kind":"Field","name":{"kind":"Name","value":"SMTP"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"host"}},{"kind":"Field","name":{"kind":"Name","value":"port"}},{"kind":"Field","name":{"kind":"Name","value":"connectionSecurity"}},{"kind":"Field","name":{"kind":"Name","value":"username"}}]}},{"kind":"Field","name":{"kind":"Name","value":"CALDAV"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"host"}},{"kind":"Field","name":{"kind":"Name","value":"username"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}}]} as unknown as DocumentNode<MyConnectedAccountsQuery, MyConnectedAccountsQueryVariables>;+export const MyConnectedAccountsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MyConnectedAccounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"myConnectedAccounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"handle"}},{"kind":"Field","name":{"kind":"Name","value":"provider"}},{"kind":"Field","name":{"kind":"Name","value":"authFailedAt"}},{"kind":"Field","name":{"kind":"Name","value":"authFailedReason"}},{"kind":"Field","name":{"kind":"Name","value":"archivedAt"}},{"kind":"Field","name":{"kind":"Name","value":"scopes"}},{"kind":"Field","name":{"kind":"Name","value":"handleAliases"}},{"kind":"Field","name":{"kind":"Name","value":"lastSignedInAt"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}},{"kind":"Field","name":{"kind":"Name","value":"connectionProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"lastCredentialsRefreshedAt"}},{"kind":"Field","name":{"kind":"Name","value":"connectionParameters"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"IMAP"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"host"}},{"kind":"Field","name":{"kind":"Name","value":"port"}},{"kind":"Field","name":{"kind":"Name","value":"connectionSecurity"}},{"kind":"Field","name":{"kind":"Name","value":"username"}}]}},{"kind":"Field","name":{"kind":"Name","value":"SMTP"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"host"}},{"kind":"Field","name":{"kind":"Name","value":"port"}},{"kind":"Field","name":{"kind":"Name","value":"connectionSecurity"}},{"kind":"Field","name":{"kind":"Name","value":"username"}}]}},{"kind":"Field","name":{"kind":"Name","value":"CALDAV"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"host"}},{"kind":"Field","name":{"kind":"Name","value":"username"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}}]} as unknown as DocumentNode<MyConnectedAccountsQuery, MyConnectedAccountsQueryVariables>;export const MyMessageChannelsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MyMessageChannels"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"connectedAccountId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"myMessageChannels"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"connectedAccountId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"connectedAccountId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"handle"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"isContactAutoCreationEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"contactAutoCreationPolicy"}},{"kind":"Field","name":{"kind":"Name","value":"messageFolderImportPolicy"}},{"kind":"Field","name":{"kind":"Name","value":"excludeNonProfessionalEmails"}},{"kind":"Field","name":{"kind":"Name","value":"excludeGroupEmails"}},{"kind":"Field","name":{"kind":"Name","value":"isSyncEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"syncStatus"}},{"kind":"Field","name":{"kind":"Name","value":"syncStage"}},{"kind":"Field","name":{"kind":"Name","value":"syncStageStartedAt"}},{"kind":"Field","name":{"kind":"Name","value":"connectedAccountId"}},{"kind":"Field","name":{"kind":"Name","value":"connectedAccount"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"handle"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}}]} as unknown as DocumentNode<MyMessageChannelsQuery, MyMessageChannelsQueryVariables>;export const MyMessageFoldersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MyMessageFolders"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"messageChannelId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"myMessageFolders"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"messageChannelId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"messageChannelId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isSynced"}},{"kind":"Field","name":{"kind":"Name","value":"isSentFolder"}},{"kind":"Field","name":{"kind":"Name","value":"parentFolderId"}},{"kind":"Field","name":{"kind":"Name","value":"externalId"}},{"kind":"Field","name":{"kind":"Name","value":"pendingSyncAction"}},{"kind":"Field","name":{"kind":"Name","value":"messageChannelId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}}]} as unknown as DocumentNode<MyMessageFoldersQuery, MyMessageFoldersQueryVariables>;export const ClaimApplicationRegistrationOwnershipDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ClaimApplicationRegistrationOwnership"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"applicationRegistrationId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"claimApplicationRegistrationOwnership"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"applicationRegistrationId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"applicationRegistrationId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<ClaimApplicationRegistrationOwnershipMutation, ClaimApplicationRegistrationOwnershipMutationVariables>;diff --git a/packages/twenty-front/src/modules/accounts/types/ConnectedAccount.ts b/packages/twenty-front/src/modules/accounts/types/ConnectedAccount.tsindex 13288d49be0..db00a40d6fe 100644--- a/packages/twenty-front/src/modules/accounts/types/ConnectedAccount.ts+++ b/packages/twenty-front/src/modules/accounts/types/ConnectedAccount.ts@@ -16,6 +16,7 @@ export type ConnectedAccount = {lastSignedInAt: string | null;userWorkspaceId: string;connectionProviderId: string | null;+ applicationId: string | null;name: string | null;// Connection-row visibility — distinct from the `scopes` array above// (those are upstream-granted OAuth permissions).diff --git a/packages/twenty-front/src/modules/app/components/SettingsRoutes.tsx b/packages/twenty-front/src/modules/app/components/SettingsRoutes.tsxindex 83ee0566b56..308f5f1ab43 100644--- a/packages/twenty-front/src/modules/app/components/SettingsRoutes.tsx+++ b/packages/twenty-front/src/modules/app/components/SettingsRoutes.tsx@@ -413,6 +413,12 @@ const SettingsAccounts = lazy(() =>})),);+const SettingsAccountDetail = lazy(() =>+ import('~/pages/settings/accounts/SettingsAccountDetail').then((module) => ({+ default: module.SettingsAccountDetail,+ })),+);+const SettingsAccountsEmails = lazy(() =>import('~/pages/settings/accounts/SettingsAccountsEmails').then((module) => ({default: module.SettingsAccountsEmails,@@ -754,6 +760,10 @@ const createSettingsRouteElements = ({}><Route path={SettingsPath.Accounts} element={<SettingsAccounts />} />+ <Route+ path={SettingsPath.AccountDetail}+ element={<SettingsAccountDetail />}+ /><Routepath={SettingsPath.AccountsEmails}element={<SettingsAccountsEmails />}diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsLegacySections.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsLegacySections.tsxnew file mode 100644index 00000000000..ed90d374987--- /dev/null+++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsLegacySections.tsx@@ -0,0 +1,30 @@+import { SettingsAccountsBlocklistSection } from '@/settings/accounts/components/SettingsAccountsBlocklistSection';+import { SettingsAccountsConnectedAccountsListCard } from '@/settings/accounts/components/SettingsAccountsConnectedAccountsListCard';+import { SettingsAccountsSettingsSection } from '@/settings/accounts/components/SettingsAccountsSettingsSection';+import { useMyConnectedAccounts } from '@/settings/accounts/hooks/useMyConnectedAccounts';+import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';+import { useLingui } from '@lingui/react/macro';+import { Section } from 'twenty-ui/components/layout';++export const SettingsAccountsLegacySections = () => {+ const { t } = useLingui();+ const { accounts, loading } = useMyConnectedAccounts();++ if (loading) {+ return <SettingsSectionSkeletonLoader />;+ }++ return (+ <>+ <Section.Root>+ <Section.Header+ title={t`Connected accounts`}+ description={t`Manage your internet accounts.`}+ />+ <SettingsAccountsConnectedAccountsListCard accounts={accounts} />+ </Section.Root>+ <SettingsAccountsBlocklistSection />+ <SettingsAccountsSettingsSection />+ </>+ );+};diff --git a/packages/twenty-front/src/modules/settings/accounts/components/__stories__/mockedDropdownConnectedAccount.ts b/packages/twenty-front/src/modules/settings/accounts/components/__stories__/mockedDropdownConnectedAccount.tsindex 272d4fe52bd..c80514239c6 100644--- a/packages/twenty-front/src/modules/settings/accounts/components/__stories__/mockedDropdownConnectedAccount.ts+++ b/packages/twenty-front/src/modules/settings/accounts/components/__stories__/mockedDropdownConnectedAccount.ts@@ -18,6 +18,7 @@ export const mockedDropdownConnectedAccount: ConnectedAccount = {lastSignedInAt: null,userWorkspaceId: 'user-workspace',connectionProviderId: null,+ applicationId: null,name: null,visibility: 'user',lastCredentialsRefreshedAt: null,diff --git a/packages/twenty-front/src/modules/settings/accounts/graphql/queries/getMyConnectedAccounts.ts b/packages/twenty-front/src/modules/settings/accounts/graphql/queries/getMyConnectedAccounts.tsindex 73b53e51833..1b2fe100d60 100644--- a/packages/twenty-front/src/modules/settings/accounts/graphql/queries/getMyConnectedAccounts.ts+++ b/packages/twenty-front/src/modules/settings/accounts/graphql/queries/getMyConnectedAccounts.ts@@ -14,6 +14,7 @@ export const GET_MY_CONNECTED_ACCOUNTS = gql`lastSignedInAtuserWorkspaceIdconnectionProviderId+ applicationIdnamevisibilitylastCredentialsRefreshedAtdiff --git a/packages/twenty-front/src/modules/settings/accounts/hooks/useMyConnectedAccounts.ts b/packages/twenty-front/src/modules/settings/accounts/hooks/useMyConnectedAccounts.tsindex 0578dac26ba..ecfaf5b186a 100644--- a/packages/twenty-front/src/modules/settings/accounts/hooks/useMyConnectedAccounts.ts+++ b/packages/twenty-front/src/modules/settings/accounts/hooks/useMyConnectedAccounts.ts@@ -22,7 +22,11 @@ const EMAIL_AND_CALENDAR_PROVIDERS: ReadonlySet<ConnectedAccountProvider> =// providers (OIDC, SAML) and app-managed OAuth (APP) also live in// connectedAccount, but they're surfaced elsewhere — keep them off this// page by filtering to the email/calendar provider set.-export const useMyConnectedAccounts = () => {+export const useMyConnectedAccounts = ({+ providers = EMAIL_AND_CALENDAR_PROVIDERS,+}: {+ providers?: ReadonlySet<ConnectedAccountProvider>;+} = {}) => {const apolloClient = useApolloClient();const { data, loading: accountsLoading } = useQuery<{@@ -42,7 +46,7 @@ export const useMyConnectedAccounts = () => {}return data.myConnectedAccounts- .filter((account) => EMAIL_AND_CALENDAR_PROVIDERS.has(account.provider))+ .filter((account) => providers.has(account.provider)).map((account) => ({...account,messageChannels: messageChannels.filter(@@ -52,7 +56,7 @@ export const useMyConnectedAccounts = () => {(channel) => channel.connectedAccountId === account.id,),}));- }, [data, messageChannels, calendarChannels]);+ }, [data, messageChannels, calendarChannels, providers]);return {accounts,diff --git a/packages/twenty-front/src/modules/settings/admin-panel/constants/SettingsAdminFeatureFlagMetadata.ts b/packages/twenty-front/src/modules/settings/admin-panel/constants/SettingsAdminFeatureFlagMetadata.tsindex 84c9cad4d79..6da094cbabd 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/constants/SettingsAdminFeatureFlagMetadata.ts+++ b/packages/twenty-front/src/modules/settings/admin-panel/constants/SettingsAdminFeatureFlagMetadata.ts@@ -84,4 +84,8 @@ export const SETTINGS_ADMIN_FEATURE_FLAG_METADATA: Record<label: msg`AI chat inbox`,description: msg`Turn the AI tab into an inbox to triage, assign, snooze and follow chats, and let workflows route agent questions to a member.`,},+ [FeatureFlagKey.IS_APP_PREFERENCES_ENABLED]: {+ label: msg`App preferences`,+ description: msg`Replace the Accounts settings with App preferences, built around accounts and the apps that use them.`,+ },};diff --git a/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAccountGroupTableRow.tsx b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAccountGroupTableRow.tsxnew file mode 100644index 00000000000..228b42d54a8--- /dev/null+++ b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAccountGroupTableRow.tsx@@ -0,0 +1,99 @@+import { SettingsAccountGroupUsedBy } from '@/settings/app-preferences/components/SettingsAccountGroupUsedBy';+import { SettingsAppPreferencesRowDropdownMenu } from '@/settings/app-preferences/components/SettingsAppPreferencesRowDropdownMenu';+import { SettingsConnectedAccountIcon } from '@/settings/accounts/components/SettingsConnectedAccountIcon';+import { SettingsConnectedAccountSyncStatus } from '@/settings/app-preferences/components/SettingsConnectedAccountSyncStatus';+import { SETTINGS_ACCOUNT_GROUP_TABLE_GRID_TEMPLATE_COLUMNS } from '@/settings/app-preferences/constants/SettingsAccountGroupTableGridTemplateColumns';+import { SyncStatus } from '@/settings/accounts/constants/SyncStatus';+import { type ConnectedAccountGroup } from '@/settings/app-preferences/types/ConnectedAccountGroup';+import { computeSyncStatus } from '@/settings/accounts/utils/computeSyncStatus';+import { getConnectedAccountSettingsChannels } from '@/settings/app-preferences/utils/getConnectedAccountSettingsChannels';+import { TableCell } from '@/ui/layout/table/components/TableCell';+import { TableRow } from '@/ui/layout/table/components/TableRow';+import { UndecoratedLink } from '@/ui/navigation/link/components/UndecoratedLink/UndecoratedLink';+import { SettingsPath } from 'twenty-shared/types';+import { getSettingsPath, isDefined } from 'twenty-shared/utils';+import { OverflowingTextWithTooltip } from 'twenty-ui/primitives/typography';+import { themeCssVariables, useTheme } from 'twenty-ui/theme';+import { useNavigateSettings } from '~/hooks/useNavigateSettings';++const SYNC_STATUSES_NEEDING_ACTION: ReadonlySet<SyncStatus> = new Set([+ SyncStatus.FAILED,+ SyncStatus.PENDING_CONFIGURATION,+]);++type SettingsAccountGroupTableRowProps = {+ group: ConnectedAccountGroup;+};++export const SettingsAccountGroupTableRow = ({+ group,+}: SettingsAccountGroupTableRowProps) => {+ const theme = useTheme();+ const navigateSettings = useNavigateSettings();+ const { nativeAccount } = group;++ const ProviderIcon = SettingsConnectedAccountIcon({+ account: nativeAccount ?? group.appAccounts[0],+ });+ const { messageChannel, calendarChannel } =+ getConnectedAccountSettingsChannels(nativeAccount);+ const hasSettings = isDefined(messageChannel) || isDefined(calendarChannel);+ const needsAction =+ isDefined(nativeAccount) &&+ (isDefined(nativeAccount.archivedAt) ||+ SYNC_STATUSES_NEEDING_ACTION.has(+ computeSyncStatus(+ nativeAccount.messageChannels[0],+ nativeAccount.calendarChannels[0],+ ),+ ));++ const accountCell = (+ <TableCell+ color={themeCssVariables.font.color.primary}+ gap={themeCssVariables.spacing[2]}+ minWidth="0"+ >+ <ProviderIcon size={theme.icon.size.md} stroke={theme.icon.stroke.sm} />+ <OverflowingTextWithTooltip text={group.handle} />+ {needsAction && (+ <SettingsConnectedAccountSyncStatus account={nativeAccount} />+ )}+ </TableCell>+ );++ return (+ <TableRow+ gridTemplateColumns={SETTINGS_ACCOUNT_GROUP_TABLE_GRID_TEMPLATE_COLUMNS}+ onClick={+ hasSettings+ ? () =>+ navigateSettings(SettingsPath.AccountDetail, {+ connectedAccountId: group.id,+ })+ : undefined+ }+ >+ {hasSettings ? (+ <UndecoratedLink+ to={getSettingsPath(SettingsPath.AccountDetail, {+ connectedAccountId: group.id,+ })}+ onClick={(event) => event.stopPropagation()}+ >+ {accountCell}+ </UndecoratedLink>+ ) : (+ accountCell+ )}+ <TableCell align="right">+ <SettingsAccountGroupUsedBy group={group} />+ </TableCell>+ <TableCell align="right" onClick={(event) => event.stopPropagation()}>+ {isDefined(nativeAccount) && (+ <SettingsAppPreferencesRowDropdownMenu account={nativeAccount} />+ )}+ </TableCell>+ </TableRow>+ );+};diff --git a/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAccountGroupUsedBy.tsx b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAccountGroupUsedBy.tsxnew file mode 100644index 00000000000..a71e074420e--- /dev/null+++ b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAccountGroupUsedBy.tsx@@ -0,0 +1,137 @@+import { AppChip } from '@/applications/components/AppChip';+import { getApplicationDisplayName } from '@/applications/utils/getApplicationDisplayName';+import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';+import { type ConnectedAccountGroup } from '@/settings/app-preferences/types/ConnectedAccountGroup';+import { getConnectedAccountSettingsChannels } from '@/settings/app-preferences/utils/getConnectedAccountSettingsChannels';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { styled } from '@linaria/react';+import { useLingui } from '@lingui/react/macro';+import { type ReactNode } from 'react';+import { ConnectedAccountProvider } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';+import {+ IconCalendarEvent,+ IconGmail,+ IconGoogleCalendar,+ IconMail,+ IconMicrosoftOutlook,+} from 'twenty-ui/icon';+import { Tooltip } from 'twenty-ui/primitives/surfaces';+import { themeCssVariables, useTheme } from 'twenty-ui/theme';++const StyledUsedBy = styled.div`+ align-items: center;+ display: flex;+ gap: ${themeCssVariables.spacing[2]};+`;++const StyledUsage = styled.span`+ display: flex;+`;++type Usage = {+ key: string;+ title: string;+ icon: ReactNode;+};++type SettingsAccountGroupUsedByProps = {+ group: ConnectedAccountGroup;+};++export const SettingsAccountGroupUsedBy = ({+ group,+}: SettingsAccountGroupUsedByProps) => {+ const { t } = useLingui();+ const theme = useTheme();+ const currentWorkspace = useAtomStateValue(currentWorkspaceState);+ const iconSize = theme.icon.size.md;++ const { messageChannel, calendarChannel } =+ getConnectedAccountSettingsChannels(group.nativeAccount);+ const usesEmails = isDefined(messageChannel);+ const usesCalendar = isDefined(calendarChannel);++ const getNativeUsages = (): (Usage | undefined)[] => {+ switch (group.nativeAccount?.provider) {+ case ConnectedAccountProvider.GOOGLE:+ return [+ usesEmails+ ? {+ key: 'gmail',+ title: t`Gmail`,+ icon: <IconGmail size={iconSize} />,+ }+ : undefined,+ usesCalendar+ ? {+ key: 'google-calendar',+ title: t`Google Calendar`,+ icon: <IconGoogleCalendar size={iconSize} />,+ }+ : undefined,+ ];+ case ConnectedAccountProvider.MICROSOFT:+ return [+ usesEmails || usesCalendar+ ? {+ key: 'outlook',+ title: t`Outlook`,+ icon: <IconMicrosoftOutlook size={iconSize} />,+ }+ : undefined,+ ];+ case ConnectedAccountProvider.IMAP_SMTP_CALDAV:+ return [+ usesEmails+ ? {+ key: 'emails',+ title: t`Emails`,+ icon: <IconMail size={iconSize} />,+ }+ : undefined,+ usesCalendar+ ? {+ key: 'calendar',+ title: t`Calendar`,+ icon: <IconCalendarEvent size={iconSize} />,+ }+ : undefined,+ ];+ default:+ return [];+ }+ };++ const applicationIds = new Set(+ group.appAccounts.map((account) => account.applicationId).filter(isDefined),+ );++ const appUsages = [...applicationIds].map((applicationId): Usage => {+ const application = currentWorkspace?.installedApplications.find(+ (installedApplication) => installedApplication.id === applicationId,+ );++ return {+ key: applicationId,+ title: isDefined(application)+ ? getApplicationDisplayName({ application, currentWorkspace })+ : t`Application`,+ icon: <AppChip applicationId={applicationId} chipOnly />,+ };+ });++ return (+ <StyledUsedBy>+ {[...getNativeUsages().filter(isDefined), ...appUsages].map(+ ({ key, title, icon }) => (+ <Tooltip key={key} content={title}>+ <StyledUsage role="img" aria-label={title}>+ {icon}+ </StyledUsage>+ </Tooltip>+ ),+ )}+ </StyledUsedBy>+ );+};diff --git a/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAccountGroupsSection.tsx b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAccountGroupsSection.tsxnew file mode 100644index 00000000000..60c1757a10d--- /dev/null+++ b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAccountGroupsSection.tsx@@ -0,0 +1,77 @@+import { SettingsAccountGroupTableRow } from '@/settings/app-preferences/components/SettingsAccountGroupTableRow';+import { SettingsAccountsListEmptyStateCard } from '@/settings/accounts/components/SettingsAccountsListEmptyStateCard';+import { SETTINGS_ACCOUNT_GROUP_TABLE_GRID_TEMPLATE_COLUMNS } from '@/settings/app-preferences/constants/SettingsAccountGroupTableGridTemplateColumns';+import { useMyAccountGroups } from '@/settings/app-preferences/hooks/useMyAccountGroups';+import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';+import { Table } from '@/ui/layout/table/components/Table';+import { TableHeader } from '@/ui/layout/table/components/TableHeader';+import { TableRow } from '@/ui/layout/table/components/TableRow';+import { styled } from '@linaria/react';+import { useLingui } from '@lingui/react/macro';+import { SettingsPath } from 'twenty-shared/types';+import { Section } from 'twenty-ui/components/layout';+import { IconPlus } from 'twenty-ui/icon';+import { Button } from 'twenty-ui/primitives/input';+import { themeCssVariables } from 'twenty-ui/theme';+import { useNavigateSettings } from '~/hooks/useNavigateSettings';++const StyledTableRows = styled.div`+ padding-bottom: ${themeCssVariables.spacing[2]};+ padding-top: ${themeCssVariables.spacing[2]};+`;++const StyledAddAccountContainer = styled.div`+ border-top: 1px solid ${themeCssVariables.border.color.light};+ display: flex;+ justify-content: flex-end;+ padding-top: ${themeCssVariables.spacing[2]};+`;++export const SettingsAccountGroupsSection = () => {+ const { t } = useLingui();+ const navigateSettings = useNavigateSettings();+ const { groups, loading } = useMyAccountGroups();++ if (loading) {+ return <SettingsSectionSkeletonLoader />;+ }++ return (+ <Section.Root>+ <Section.Header+ title={t`Accounts`}+ description={t`Shared accounts between apps`}+ />+ {groups.length === 0 ? (+ <SettingsAccountsListEmptyStateCard />+ ) : (+ <>+ <Table>+ <TableRow+ gridTemplateColumns={+ SETTINGS_ACCOUNT_GROUP_TABLE_GRID_TEMPLATE_COLUMNS+ }+ >+ <TableHeader>{t`Account`}</TableHeader>+ <TableHeader align="right">{t`Used by`}</TableHeader>+ <TableHeader />+ </TableRow>+ <StyledTableRows>+ {groups.map((group) => (+ <SettingsAccountGroupTableRow key={group.id} group={group} />+ ))}+ </StyledTableRows>+ </Table>+ <StyledAddAccountContainer>+ <Button+ startIcon={<IconPlus />}+ size="sm"+ onClick={() => navigateSettings(SettingsPath.NewAccount)}+ variant="outline"+ >{t`Add account`}</Button>+ </StyledAddAccountContainer>+ </>+ )}+ </Section.Root>+ );+};diff --git a/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAppPreferencesRowDropdownMenu.tsx b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAppPreferencesRowDropdownMenu.tsxnew file mode 100644index 00000000000..17d383c62c6--- /dev/null+++ b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAppPreferencesRowDropdownMenu.tsx@@ -0,0 +1,177 @@+import { DropdownRoot } from '@/ui/layout/dropdown/components/DropdownRoot';+import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';+import { type ConnectedAccount } from '@/accounts/types/ConnectedAccount';+import { useApolloClient, useMutation } from '@apollo/client/react';+import {+ CalendarChannelSyncStage,+ ConnectedAccountProvider,+ MessageChannelSyncStage,+ SettingsPath,+} from 'twenty-shared/types';+import { getSettingsPath, isDefined } from 'twenty-shared/utils';++import { useTriggerProviderReconnect } from '@/settings/accounts/hooks/useTriggerProviderReconnect';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';+import { Trans, useLingui } from '@lingui/react/macro';+import {+ IconAt,+ IconDotsVertical,+ IconPlayerPlay,+ IconRefresh,+ IconTrash,+ IconUnlink,+} from 'twenty-ui/icon';+import { LightIconButton } from 'twenty-ui/components/input';+import { Dropdown } from 'twenty-ui/components/navigation';+import { Link } from 'react-router-dom';+import { DELETE_CONNECTED_ACCOUNT } from '@/settings/accounts/graphql/mutations/deleteConnectedAccount';+import { DISCONNECT_CONNECTED_ACCOUNT } from '@/settings/accounts/graphql/mutations/disconnectConnectedAccount';+import { isConnectedAccountEligibleForProviderReconnect } from '@/settings/accounts/utils/isConnectedAccountEligibleForProviderReconnect';++type SettingsAppPreferencesRowDropdownMenuProps = {+ account: ConnectedAccount;+};++export const SettingsAppPreferencesRowDropdownMenu = ({+ account,+}: SettingsAppPreferencesRowDropdownMenuProps) => {+ const dropdownId = `settings-account-row-${account.id}`;+ const deleteAccountModalId = `delete-account-modal-${account.id}`;+ const disconnectAccountModalId = `disconnect-account-modal-${account.id}`;+ const accountHandle = account.handle;++ const { t } = useLingui();+ const { openDialog } = useDialog();++ const apolloClient = useApolloClient();+ const [deleteConnectedAccountMutation] = useMutation(+ DELETE_CONNECTED_ACCOUNT,+ );+ const [disconnectConnectedAccountMutation] = useMutation(+ DISCONNECT_CONNECTED_ACCOUNT,+ );+ const { triggerProviderReconnect } = useTriggerProviderReconnect();++ const hasPendingConfiguration =+ account.messageChannels.some(+ (channel) =>+ channel.syncStage === MessageChannelSyncStage.PENDING_CONFIGURATION,+ ) ||+ account.calendarChannels.some(+ (channel) =>+ channel.syncStage === CalendarChannelSyncStage.PENDING_CONFIGURATION,+ );++ const isEligibleForProviderReconnect =+ isConnectedAccountEligibleForProviderReconnect(account);++ const deleteAccount = async () => {+ await deleteConnectedAccountMutation({+ variables: { id: account.id },+ });+ await apolloClient.refetchQueries({ include: 'active' });+ };++ const disconnectAccount = async () => {+ await disconnectConnectedAccountMutation({+ variables: { id: account.id },+ });+ await apolloClient.refetchQueries({ include: 'active' });+ };++ return (+ <>+ <DropdownRoot type="menu" dropdownId={dropdownId}>+ <Dropdown.Trigger+ render={+ <LightIconButton emphasis="subtle" aria-label={t`More options`}>+ <IconDotsVertical />+ </LightIconButton>+ }+ />+ <DropdownContent side="right" align="start">+ <Dropdown.Section>+ {hasPendingConfiguration && (+ <Dropdown.ActionItem+ startIcon={<IconPlayerPlay />}+ render={+ <Link+ to={getSettingsPath(SettingsPath.AccountsConfiguration, {+ connectedAccountId: account.id,+ })}+ />+ }+ >{t`Complete setup`}</Dropdown.ActionItem>+ )}+ {account.provider === ConnectedAccountProvider.IMAP_SMTP_CALDAV && (+ <Dropdown.ActionItem+ startIcon={<IconAt />}+ render={+ <Link+ to={getSettingsPath(+ SettingsPath.EditImapSmtpCaldavConnection,+ {+ connectedAccountId: account.id,+ },+ )}+ />+ }+ >{t`Connection settings`}</Dropdown.ActionItem>+ )}+ {isEligibleForProviderReconnect && (+ <Dropdown.ActionItem+ startIcon={<IconRefresh />}+ onClick={() => {+ triggerProviderReconnect(account.provider, account.id, {+ loginHint: account.handle,+ });+ }}+ >{t`Reconnect`}</Dropdown.ActionItem>+ )}+ {!isDefined(account.archivedAt) && (+ <Dropdown.ActionItem+ startIcon={<IconUnlink />}+ onClick={() => {+ openDialog(disconnectAccountModalId);+ }}+ >{t`Disconnect account`}</Dropdown.ActionItem>+ )}+ <Dropdown.ActionItem+ color="danger"+ startIcon={<IconTrash />}+ onClick={() => {+ openDialog(deleteAccountModalId);+ }}+ >{t`Delete account and synced data`}</Dropdown.ActionItem>+ </Dropdown.Section>+ </DropdownContent>+ </DropdownRoot>+ <ConfirmationDialog+ dialogId={disconnectAccountModalId}+ title={t`Disconnect account`}+ subtitle={+ <Trans>+ Syncing will stop and this account's credentials will be removed.+ Your emails and events will be retained and available after you+ reconnect.+ </Trans>+ }+ onConfirmClick={disconnectAccount}+ confirmButtonText={t`Disconnect account`}+ />+ <ConfirmationDialog+ dialogId={deleteAccountModalId}+ title={t`Delete account and synced data?`}+ subtitle={+ <Trans>+ This permanently deletes {accountHandle} and all of its synced+ emails and events. This action cannot be undone.+ </Trans>+ }+ onConfirmClick={deleteAccount}+ confirmButtonText={t`Delete account and data`}+ />+ </>+ );+};diff --git a/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsConnectedAccountSyncStatus.tsx b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsConnectedAccountSyncStatus.tsxnew file mode 100644index 00000000000..768d1775da0--- /dev/null+++ b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsConnectedAccountSyncStatus.tsx@@ -0,0 +1,44 @@+import { type ConnectedAccount } from '@/accounts/types/ConnectedAccount';+import { SyncStatus } from '@/settings/accounts/constants/SyncStatus';+import { computeSyncStatus } from '@/settings/accounts/utils/computeSyncStatus';+import { useLingui } from '@lingui/react/macro';+import { isDefined } from 'twenty-shared/utils';+import { Status } from 'twenty-ui/primitives/data-display';++type SettingsConnectedAccountSyncStatusProps = {+ account: Pick<+ ConnectedAccount,+ 'archivedAt' | 'messageChannels' | 'calendarChannels'+ >;+};++export const SettingsConnectedAccountSyncStatus = ({+ account,+}: SettingsConnectedAccountSyncStatusProps) => {+ const { t } = useLingui();++ if (isDefined(account.archivedAt)) {+ return <Status color="gray" weight="medium">{t`Sync paused`}</Status>;+ }++ switch (+ computeSyncStatus(account.messageChannels[0], account.calendarChannels[0])+ ) {+ case SyncStatus.FAILED:+ return <Status color="red" weight="medium">{t`Sync failed`}</Status>;+ case SyncStatus.SYNCED:+ return <Status color="green" weight="medium">{t`Synced`}</Status>;+ case SyncStatus.NOT_SYNCED:+ return <Status color="orange" weight="medium">{t`Not synced`}</Status>;+ case SyncStatus.IMPORTING:+ return (+ <Status color="turquoise" weight="medium" loading>+ {t`Importing`}+ </Status>+ );+ case SyncStatus.PENDING_CONFIGURATION:+ return (+ <Status color="orange" weight="medium">{t`Setup incomplete`}</Status>+ );+ }+};diff --git a/packages/twenty-front/src/modules/settings/app-preferences/constants/SettingsAccountGroupTabListComponentId.ts b/packages/twenty-front/src/modules/settings/app-preferences/constants/SettingsAccountGroupTabListComponentId.tsnew file mode 100644index 00000000000..84ff9319c45--- /dev/null+++ b/packages/twenty-front/src/modules/settings/app-preferences/constants/SettingsAccountGroupTabListComponentId.ts@@ -0,0 +1,2 @@+export const SETTINGS_ACCOUNT_GROUP_TAB_LIST_COMPONENT_ID =+ 'settings-account-group-tab-list';diff --git a/packages/twenty-front/src/modules/settings/app-preferences/constants/SettingsAccountGroupTableGridTemplateColumns.ts b/packages/twenty-front/src/modules/settings/app-preferences/constants/SettingsAccountGroupTableGridTemplateColumns.tsnew file mode 100644index 00000000000..85ddf681039--- /dev/null+++ b/packages/twenty-front/src/modules/settings/app-preferences/constants/SettingsAccountGroupTableGridTemplateColumns.ts@@ -0,0 +1,3 @@+import { themeCssVariables } from 'twenty-ui/theme';++export const SETTINGS_ACCOUNT_GROUP_TABLE_GRID_TEMPLATE_COLUMNS = `minmax(0, 1fr) auto ${themeCssVariables.spacing[8]}`;diff --git a/packages/twenty-front/src/modules/settings/app-preferences/hooks/useMyAccountGroups.ts b/packages/twenty-front/src/modules/settings/app-preferences/hooks/useMyAccountGroups.tsnew file mode 100644index 00000000000..3d291274dd7--- /dev/null+++ b/packages/twenty-front/src/modules/settings/app-preferences/hooks/useMyAccountGroups.ts@@ -0,0 +1,29 @@+import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';+import { useMyConnectedAccounts } from '@/settings/accounts/hooks/useMyConnectedAccounts';+import { groupConnectedAccountsByNativeAccount } from '@/settings/app-preferences/utils/groupConnectedAccountsByNativeAccount';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { ConnectedAccountProvider } from 'twenty-shared/types';++const ACCOUNT_GROUP_PROVIDERS: ReadonlySet<ConnectedAccountProvider> = new Set([+ ConnectedAccountProvider.GOOGLE,+ ConnectedAccountProvider.MICROSOFT,+ ConnectedAccountProvider.IMAP_SMTP_CALDAV,+ ConnectedAccountProvider.APP,+]);++export const useMyAccountGroups = () => {+ const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState);+ const { accounts, loading } = useMyConnectedAccounts({+ providers: ACCOUNT_GROUP_PROVIDERS,+ });++ return {+ groups: groupConnectedAccountsByNativeAccount(+ accounts.filter(+ (account) =>+ account.userWorkspaceId === currentWorkspaceMember?.userWorkspaceId,+ ),+ ),+ loading,+ };+};diff --git a/packages/twenty-front/src/modules/settings/app-preferences/types/ConnectedAccountGroup.ts b/packages/twenty-front/src/modules/settings/app-preferences/types/ConnectedAccountGroup.tsnew file mode 100644index 00000000000..a2f32533bba--- /dev/null+++ b/packages/twenty-front/src/modules/settings/app-preferences/types/ConnectedAccountGroup.ts@@ -0,0 +1,8 @@+import { type ConnectedAccount } from '@/accounts/types/ConnectedAccount';++export type ConnectedAccountGroup<TConnectedAccount = ConnectedAccount> = {+ id: string;+ handle: string;+ nativeAccount?: TConnectedAccount;+ appAccounts: TConnectedAccount[];+};diff --git a/packages/twenty-front/src/modules/settings/app-preferences/utils/__tests__/getConnectedAccountSettingsChannels.test.ts b/packages/twenty-front/src/modules/settings/app-preferences/utils/__tests__/getConnectedAccountSettingsChannels.test.tsnew file mode 100644index 00000000000..1ddbe1b0709--- /dev/null+++ b/packages/twenty-front/src/modules/settings/app-preferences/utils/__tests__/getConnectedAccountSettingsChannels.test.ts@@ -0,0 +1,69 @@+import { getConnectedAccountSettingsChannels } from '@/settings/app-preferences/utils/getConnectedAccountSettingsChannels';+import {+ CalendarChannelSyncStage,+ MessageChannelSyncStage,+ MessageChannelType,+} from 'twenty-shared/types';++describe('getConnectedAccountSettingsChannels', () => {+ it('returns the mailbox and the calendar of the account', () => {+ const mailbox = {+ id: 'mailbox',+ type: MessageChannelType.EMAIL,+ syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING,+ };+ const calendar = {+ id: 'calendar',+ syncStage: CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING,+ };++ expect(+ getConnectedAccountSettingsChannels({+ messageChannels: [mailbox],+ calendarChannels: [calendar],+ }),+ ).toEqual({ messageChannel: mailbox, calendarChannel: calendar });+ });++ it('skips channels that still need setup', () => {+ expect(+ getConnectedAccountSettingsChannels({+ messageChannels: [+ {+ id: 'mailbox',+ type: MessageChannelType.EMAIL,+ syncStage: MessageChannelSyncStage.PENDING_CONFIGURATION,+ },+ ],+ calendarChannels: [+ {+ id: 'calendar',+ syncStage: CalendarChannelSyncStage.PENDING_CONFIGURATION,+ },+ ],+ }),+ ).toEqual({ messageChannel: undefined, calendarChannel: undefined });+ });++ it('skips message channels that are not mailboxes', () => {+ expect(+ getConnectedAccountSettingsChannels({+ messageChannels: [+ {+ id: 'group-inbox',+ type: MessageChannelType.EMAIL_GROUP,+ syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING,+ },+ ],+ calendarChannels: [],+ }),+ ).toEqual({ messageChannel: undefined, calendarChannel: undefined });+ });++ it('returns nothing when there is no account', () => {+ expect(getConnectedAccountSettingsChannels(undefined)).toEqual({+ messageChannel: undefined,+ calendarChannel: undefined,+ });+ });+});diff --git a/packages/twenty-front/src/modules/settings/app-preferences/utils/__tests__/groupConnectedAccountsByNativeAccount.test.ts b/packages/twenty-front/src/modules/settings/app-preferences/utils/__tests__/groupConnectedAccountsByNativeAccount.test.tsnew file mode 100644index 00000000000..6a70c9ea39d--- /dev/null+++ b/packages/twenty-front/src/modules/settings/app-preferences/utils/__tests__/groupConnectedAccountsByNativeAccount.test.ts@@ -0,0 +1,94 @@+import { groupConnectedAccountsByNativeAccount } from '@/settings/app-preferences/utils/groupConnectedAccountsByNativeAccount';+import { ConnectedAccountProvider } from 'twenty-shared/types';++describe('groupConnectedAccountsByNativeAccount', () => {+ it('attaches app connections to the native account with the same email, ignoring case and spaces', () => {+ const google = {+ id: 'google',+ handle: '[email protected]',+ provider: ConnectedAccountProvider.GOOGLE,+ };+ const fathom = {+ id: 'fathom',+ handle: ' [email protected] ',+ provider: ConnectedAccountProvider.APP,+ };++ expect(groupConnectedAccountsByNativeAccount([fathom, google])).toEqual([+ {+ id: 'google',+ handle: '[email protected]',+ nativeAccount: google,+ appAccounts: [fathom],+ },+ ]);+ });++ it('keeps native accounts with the same email on separate rows', () => {+ const google = {+ id: 'google',+ handle: '[email protected]',+ provider: ConnectedAccountProvider.GOOGLE,+ };+ const imap = {+ id: 'imap',+ handle: '[email protected]',+ provider: ConnectedAccountProvider.IMAP_SMTP_CALDAV,+ };+ const fathom = {+ id: 'fathom',+ handle: '[email protected]',+ provider: ConnectedAccountProvider.APP,+ };++ expect(+ groupConnectedAccountsByNativeAccount([google, imap, fathom]),+ ).toEqual([+ {+ id: 'google',+ handle: '[email protected]',+ nativeAccount: google,+ appAccounts: [fathom],+ },+ {+ id: 'imap',+ handle: '[email protected]',+ nativeAccount: imap,+ appAccounts: [],+ },+ ]);+ });++ it('groups app connections without a native account by email', () => {+ const fathom = {+ id: 'fathom',+ handle: '[email protected]',+ provider: ConnectedAccountProvider.APP,+ };+ const granola = {+ id: 'granola',+ handle: '[email protected]',+ provider: ConnectedAccountProvider.APP,+ };+ const otherFathom = {+ id: 'other-fathom',+ handle: '[email protected]',+ provider: ConnectedAccountProvider.APP,+ };++ expect(+ groupConnectedAccountsByNativeAccount([fathom, granola, otherFathom]),+ ).toEqual([+ {+ id: 'fathom',+ handle: '[email protected]',+ appAccounts: [fathom, granola],+ },+ {+ id: 'other-fathom',+ handle: '[email protected]',+ appAccounts: [otherFathom],+ },+ ]);+ });+});diff --git a/packages/twenty-front/src/modules/settings/app-preferences/utils/getConnectedAccountSettingsChannels.ts b/packages/twenty-front/src/modules/settings/app-preferences/utils/getConnectedAccountSettingsChannels.tsnew file mode 100644index 00000000000..477e21ecdff--- /dev/null+++ b/packages/twenty-front/src/modules/settings/app-preferences/utils/getConnectedAccountSettingsChannels.ts@@ -0,0 +1,29 @@+import { type CalendarChannel } from '@/accounts/types/CalendarChannel';+import { type MessageChannel } from '@/accounts/types/MessageChannel';+import {+ CalendarChannelSyncStage,+ MessageChannelSyncStage,+ MessageChannelType,+} from 'twenty-shared/types';++export const getConnectedAccountSettingsChannels = <+ TMessageChannel extends Pick<MessageChannel, 'type' | 'syncStage'>,+ TCalendarChannel extends Pick<CalendarChannel, 'syncStage'>,+>(+ account:+ | {+ messageChannels: TMessageChannel[];+ calendarChannels: TCalendarChannel[];+ }+ | undefined,+) => ({+ messageChannel: account?.messageChannels.find(+ (channel) =>+ channel.type === MessageChannelType.EMAIL &&+ channel.syncStage !== MessageChannelSyncStage.PENDING_CONFIGURATION,+ ),+ calendarChannel: account?.calendarChannels.find(+ (channel) =>+ channel.syncStage !== CalendarChannelSyncStage.PENDING_CONFIGURATION,+ ),+});diff --git a/packages/twenty-front/src/modules/settings/app-preferences/utils/groupConnectedAccountsByNativeAccount.ts b/packages/twenty-front/src/modules/settings/app-preferences/utils/groupConnectedAccountsByNativeAccount.tsnew file mode 100644index 00000000000..c3cdb2c28d6--- /dev/null+++ b/packages/twenty-front/src/modules/settings/app-preferences/utils/groupConnectedAccountsByNativeAccount.ts@@ -0,0 +1,48 @@+import { type ConnectedAccount } from '@/accounts/types/ConnectedAccount';+import { type ConnectedAccountGroup } from '@/settings/app-preferences/types/ConnectedAccountGroup';+import { ConnectedAccountProvider } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';++const normalizeHandle = (handle: string) => handle.trim().toLowerCase();++export const groupConnectedAccountsByNativeAccount = <+ TConnectedAccount extends Pick<+ ConnectedAccount,+ 'id' | 'handle' | 'provider'+ >,+>(+ accounts: TConnectedAccount[],+): ConnectedAccountGroup<TConnectedAccount>[] => {+ const groups: ConnectedAccountGroup<TConnectedAccount>[] = accounts+ .filter((account) => account.provider !== ConnectedAccountProvider.APP)+ .map((nativeAccount) => ({+ id: nativeAccount.id,+ handle: nativeAccount.handle,+ nativeAccount,+ appAccounts: [],+ }));++ const appAccounts = accounts.filter(+ (account) => account.provider === ConnectedAccountProvider.APP,+ );++ for (const appAccount of appAccounts) {+ const group = groups.find(+ (candidate) =>+ normalizeHandle(candidate.handle) ===+ normalizeHandle(appAccount.handle),+ );++ if (isDefined(group)) {+ group.appAccounts.push(appAccount);+ } else {+ groups.push({+ id: appAccount.id,+ handle: appAccount.handle,+ appAccounts: [appAccount],+ });+ }+ }++ return groups;+};diff --git a/packages/twenty-front/src/modules/settings/hooks/__tests__/useSettingsNavigationItems.test.tsx b/packages/twenty-front/src/modules/settings/hooks/__tests__/useSettingsNavigationItems.test.tsxindex 410c1dae91d..e6583d749bb 100644--- a/packages/twenty-front/src/modules/settings/hooks/__tests__/useSettingsNavigationItems.test.tsx+++ b/packages/twenty-front/src/modules/settings/hooks/__tests__/useSettingsNavigationItems.test.tsx@@ -6,12 +6,14 @@ import { MemoryRouter } from 'react-router-dom';import { SettingsPath } from 'twenty-shared/types';import {type Billing,+ FeatureFlagKey,OnboardingStatus,PermissionFlagType,} from '~/generated-metadata/graphql';import { currentUserState } from '@/auth/states/currentUserState';import { currentUserWorkspaceState } from '@/auth/states/currentUserWorkspaceState';+import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { billingState } from '@/client-config/states/billingState';import {jotaiStore,@@ -22,7 +24,9 @@ import { I18nProvider } from '@lingui/react';import { Provider as JotaiProvider } from 'jotai';import { SOURCE_LOCALE } from 'twenty-shared/translations';import { ToastProvider } from 'twenty-ui/components/feedback';+import { IconApps, IconAt } from 'twenty-ui/icon';import { messages } from '~/locales/generated/en';+import { mockCurrentWorkspace } from '~/testing/mock-data/users';i18n.load({[SOURCE_LOCALE]: messages,@@ -76,6 +80,16 @@ const setPermissionFlags = (permissionFlags: PermissionFlagType[]) => {});};+const getAccountsItem = () => {+ const { result } = renderHook(() => useSettingsNavigationItems(), {+ wrapper: Wrapper,+ });++ return result.current+ .find((section) => section.label === 'User')+ ?.items.find((item) => item.path === SettingsPath.Accounts);+};+describe('useSettingsNavigationItems', () => {beforeEach(() => {resetJotaiStore();@@ -191,4 +205,34 @@ describe('useSettingsNavigationItems', () => {.every((item) => !item.isHidden),).toBe(true);});++ it('should show Accounts with Emails and Calendars when app preferences are off', () => {+ setPermissionFlags([PermissionFlagType.CONNECTED_ACCOUNTS]);++ const accountsItem = getAccountsItem();++ expect(accountsItem?.label).toBe('Accounts');+ expect(accountsItem?.Icon).toBe(IconAt);+ expect(accountsItem?.subItems?.map((subItem) => subItem.path)).toEqual([+ SettingsPath.AccountsEmails,+ SettingsPath.AccountsCalendars,+ ]);+ });++ it('should show App preferences without sub-items when app preferences are on', () => {+ setPermissionFlags([PermissionFlagType.CONNECTED_ACCOUNTS]);+ jotaiStore.set(currentWorkspaceState.atom, {+ ...mockCurrentWorkspace,+ featureFlags: [+ { key: FeatureFlagKey.IS_APP_PREFERENCES_ENABLED, value: true },+ ],+ });++ const accountsItem = getAccountsItem();++ expect(accountsItem?.label).toBe('App preferences');+ expect(accountsItem?.Icon).toBe(IconApps);+ expect(accountsItem?.isHidden).toBe(false);+ expect(accountsItem?.subItems).toBeUndefined();+ });});diff --git a/packages/twenty-front/src/modules/settings/hooks/useSettingsNavigationItems.tsx b/packages/twenty-front/src/modules/settings/hooks/useSettingsNavigationItems.tsxindex c713806dbb0..f3cace2da53 100644--- a/packages/twenty-front/src/modules/settings/hooks/useSettingsNavigationItems.tsx+++ b/packages/twenty-front/src/modules/settings/hooks/useSettingsNavigationItems.tsx@@ -7,6 +7,7 @@ import { billingState } from '@/client-config/states/billingState';import { supportChatState } from '@/client-config/states/supportChatState';import { permissionFlagMapSelector } from '@/settings/roles/states/permissionFlagMapSelector';import { getDocumentationUrl } from '@/support/utils/getDocumentationUrl';+import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';import { type NavigationDrawerItemModifier } from '@/ui/navigation/navigation-drawer/types/NavigationDrawerItemModifier';import { type NavigationDrawerItemIndentationLevel } from '@/ui/navigation/navigation-drawer/types/NavigationDrawerItemIndentationLevel';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';@@ -33,7 +34,10 @@ import {IconUserCircle,IconUsers,} from 'twenty-ui/icon';-import { PermissionFlagType } from '~/generated-metadata/graphql';+import {+ FeatureFlagKey,+ PermissionFlagType,+} from '~/generated-metadata/graphql';import { openUrlInNewTab } from '~/utils/openUrlInNewTab';export type SettingsNavigationSection = {@@ -71,6 +75,9 @@ const useSettingsNavigationItems = (): SettingsNavigationSection[] => {isNonEmptyString(supportChat.supportFrontChatId);const permissionFlagMap = useAtomStateValue(permissionFlagMapSelector);+ const isAppPreferencesEnabled = useIsFeatureEnabled(+ FeatureFlagKey.IS_APP_PREFERENCES_ENABLED,+ );return [{@@ -87,28 +94,30 @@ const useSettingsNavigationItems = (): SettingsNavigationSection[] => {Icon: IconColorSwatch,},{- label: t`Accounts`,+ label: isAppPreferencesEnabled ? t`App preferences` : t`Accounts`,path: SettingsPath.Accounts,- Icon: IconAt,+ Icon: isAppPreferencesEnabled ? IconApps : IconAt,isHidden: !permissionFlagMap[PermissionFlagType.CONNECTED_ACCOUNTS],- subItems: [- {- label: t`Emails`,- path: SettingsPath.AccountsEmails,- Icon: IconMail,- isHidden:- !permissionFlagMap[PermissionFlagType.CONNECTED_ACCOUNTS],- indentationLevel: 2,- },- {- label: t`Calendars`,- path: SettingsPath.AccountsCalendars,- Icon: IconCalendarEvent,- isHidden:- !permissionFlagMap[PermissionFlagType.CONNECTED_ACCOUNTS],- indentationLevel: 2,- },- ],+ subItems: isAppPreferencesEnabled+ ? undefined+ : [+ {+ label: t`Emails`,+ path: SettingsPath.AccountsEmails,+ Icon: IconMail,+ isHidden:+ !permissionFlagMap[PermissionFlagType.CONNECTED_ACCOUNTS],+ indentationLevel: 2,+ },+ {+ label: t`Calendars`,+ path: SettingsPath.AccountsCalendars,+ Icon: IconCalendarEvent,+ isHidden:+ !permissionFlagMap[PermissionFlagType.CONNECTED_ACCOUNTS],+ indentationLevel: 2,+ },+ ],},],},diff --git a/packages/twenty-front/src/modules/side-panel/pages/__stories__/SidePanelComposerPages.stories.tsx b/packages/twenty-front/src/modules/side-panel/pages/__stories__/SidePanelComposerPages.stories.tsxindex c37652f0922..64d81309e0c 100644--- a/packages/twenty-front/src/modules/side-panel/pages/__stories__/SidePanelComposerPages.stories.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/__stories__/SidePanelComposerPages.stories.tsx@@ -40,6 +40,7 @@ const storyConnectedAccounts = [lastSignedInAt: '2026-08-24T08:00:00.000Z',userWorkspaceId: '20202020-0687-4c41-b707-ed1bfca972a7',connectionProviderId: null,+ applicationId: null,name: 'Tim Apple',visibility: 'SHARE_EVERYTHING',lastCredentialsRefreshedAt: '2026-08-24T08:00:00.000Z',@@ -59,6 +60,7 @@ const storyConnectedAccounts = [lastSignedInAt: '2026-08-23T08:00:00.000Z',userWorkspaceId: '20202020-0687-4c41-b707-ed1bfca972a7',connectionProviderId: null,+ applicationId: null,name: 'Tim Apple',visibility: 'SHARE_EVERYTHING',lastCredentialsRefreshedAt: '2026-08-23T08:00:00.000Z',diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionEmailBase.stories.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionEmailBase.stories.tsxindex 88054f36af8..33442d501aa 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionEmailBase.stories.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionEmailBase.stories.tsx@@ -32,6 +32,7 @@ const mockedConnectedAccounts = [lastSignedInAt: null,userWorkspaceId: '20202020-0687-4c41-b707-ed1bfca972a7',connectionProviderId: null,+ applicationId: null,name: 'Tim Apple',visibility: 'SHARE_EVERYTHING',lastCredentialsRefreshedAt: null,diff --git a/packages/twenty-front/src/pages/settings/accounts/SettingsAccountDetail.tsx b/packages/twenty-front/src/pages/settings/accounts/SettingsAccountDetail.tsxnew file mode 100644index 00000000000..efe324e3fe7--- /dev/null+++ b/packages/twenty-front/src/pages/settings/accounts/SettingsAccountDetail.tsx@@ -0,0 +1,125 @@+import { SettingsAccountsCalendarChannelDetails } from '@/settings/accounts/components/SettingsAccountsCalendarChannelDetails';+import { SettingsAccountsMessageChannelDetails } from '@/settings/accounts/components/SettingsAccountsMessageChannelDetails';+import { SettingsConnectedAccountIcon } from '@/settings/accounts/components/SettingsConnectedAccountIcon';+import { SETTINGS_ACCOUNT_GROUP_TAB_LIST_COMPONENT_ID } from '@/settings/app-preferences/constants/SettingsAccountGroupTabListComponentId';+import { useMyAccountGroups } from '@/settings/app-preferences/hooks/useMyAccountGroups';+import { settingsAccountsSelectedMessageChannelState } from '@/settings/accounts/states/settingsAccountsSelectedMessageChannelState';+import { getConnectedAccountSettingsChannels } from '@/settings/app-preferences/utils/getConnectedAccountSettingsChannels';+import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';+import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';+import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';+import { SettingsTabBar } from '@/settings/components/layout/SettingsTabBar';+import { useSettingsActiveTabId } from '@/settings/components/layout/useSettingsActiveTabId';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';+import { useLingui } from '@lingui/react/macro';+import { Navigate, useParams } from 'react-router-dom';+import { SettingsPath } from 'twenty-shared/types';+import { getSettingsPath, isDefined } from 'twenty-shared/utils';+import { IconCalendarEvent, IconMail } from 'twenty-ui/icon';+import { useTheme } from 'twenty-ui/theme';+import { FeatureFlagKey } from '~/generated-metadata/graphql';+import { SettingsAccountsConfigurationSelectedMessageChannelEffect } from '~/pages/settings/accounts/SettingsAccountsConfigurationSelectedMessageChannelEffect';++export const SettingsAccountDetail = () => {+ const { t } = useLingui();+ const theme = useTheme();+ const isAppPreferencesEnabled = useIsFeatureEnabled(+ FeatureFlagKey.IS_APP_PREFERENCES_ENABLED,+ );+ const { connectedAccountId } = useParams<{ connectedAccountId: string }>();+ const { groups, loading } = useMyAccountGroups();+ const settingsAccountsSelectedMessageChannel = useAtomStateValue(+ settingsAccountsSelectedMessageChannelState,+ );++ const nativeAccount = groups.find(+ (group) => group.nativeAccount?.id === connectedAccountId,+ )?.nativeAccount;+ const { messageChannel, calendarChannel } =+ getConnectedAccountSettingsChannels(nativeAccount);++ const tabs = [+ isDefined(messageChannel)+ ? { id: 'emails', title: t`Emails`, Icon: IconMail }+ : undefined,+ isDefined(calendarChannel)+ ? { id: 'calendar', title: t`Calendar`, Icon: IconCalendarEvent }+ : undefined,+ ].filter(isDefined);++ const activeTabId = useSettingsActiveTabId(+ SETTINGS_ACCOUNT_GROUP_TAB_LIST_COMPONENT_ID,+ tabs.map((tab) => tab.id),+ );++ if (!isAppPreferencesEnabled || (!loading && tabs.length === 0)) {+ return <Navigate to={getSettingsPath(SettingsPath.Accounts)} replace />;+ }++ const ProviderIcon = isDefined(nativeAccount)+ ? SettingsConnectedAccountIcon({ account: nativeAccount })+ : undefined;++ const renderContent = () => {+ if (activeTabId === 'emails' && isDefined(messageChannel)) {+ return (+ <>+ <SettingsAccountsConfigurationSelectedMessageChannelEffect+ messageChannel={messageChannel}+ />+ {settingsAccountsSelectedMessageChannel?.id === messageChannel.id ? (+ <SettingsAccountsMessageChannelDetails+ messageChannel={messageChannel}+ />+ ) : (+ <SettingsSectionSkeletonLoader />+ )}+ </>+ );+ }++ if (activeTabId === 'calendar' && isDefined(calendarChannel)) {+ return (+ <SettingsAccountsCalendarChannelDetails+ calendarChannel={calendarChannel}+ />+ );+ }++ return <SettingsSectionSkeletonLoader />;+ };++ return (+ <SettingsPageLayout+ title={nativeAccount?.handle}+ icon={+ isDefined(ProviderIcon) ? (+ <ProviderIcon size={theme.icon.size.md} />+ ) : undefined+ }+ links={[+ {+ children: t`User`,+ href: getSettingsPath(SettingsPath.ProfilePage),+ },+ {+ children: t`App preferences`,+ href: getSettingsPath(SettingsPath.Accounts),+ },+ { children: nativeAccount?.handle },+ ]}+ secondaryBar={+ tabs.length > 0 ? (+ <SettingsTabBar+ aria-label={t`Account settings`}+ tabs={tabs}+ componentInstanceId={SETTINGS_ACCOUNT_GROUP_TAB_LIST_COMPONENT_ID}+ />+ ) : undefined+ }+ >+ <SettingsPageContainer>{renderContent()}</SettingsPageContainer>+ </SettingsPageLayout>+ );+};diff --git a/packages/twenty-front/src/pages/settings/accounts/SettingsAccounts.tsx b/packages/twenty-front/src/pages/settings/accounts/SettingsAccounts.tsxindex 6867ed1a5b9..3ddaf685304 100644--- a/packages/twenty-front/src/pages/settings/accounts/SettingsAccounts.tsx+++ b/packages/twenty-front/src/pages/settings/accounts/SettingsAccounts.tsx@@ -1,48 +1,41 @@+import { SettingsAccountGroupsSection } from '@/settings/app-preferences/components/SettingsAccountGroupsSection';import { SettingsAccountsBlocklistSection } from '@/settings/accounts/components/SettingsAccountsBlocklistSection';-import { SettingsAccountsConnectedAccountsListCard } from '@/settings/accounts/components/SettingsAccountsConnectedAccountsListCard';-import { SettingsAccountsSettingsSection } from '@/settings/accounts/components/SettingsAccountsSettingsSection';-import { useMyConnectedAccounts } from '@/settings/accounts/hooks/useMyConnectedAccounts';+import { SettingsAccountsLegacySections } from '@/settings/accounts/components/SettingsAccountsLegacySections';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';-import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';+import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { useLingui } from '@lingui/react/macro';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath } from 'twenty-shared/utils';-import { Section } from 'twenty-ui/components/layout';+import { FeatureFlagKey } from '~/generated-metadata/graphql';export const SettingsAccounts = () => {const { t } = useLingui();- const { accounts: allAccounts, loading } = useMyConnectedAccounts();+ const isAppPreferencesEnabled = useIsFeatureEnabled(+ FeatureFlagKey.IS_APP_PREFERENCES_ENABLED,+ );+ const pageTitle = isAppPreferencesEnabled ? t`App preferences` : t`Account`;return (<SettingsPageLayout- title={t`Account`}+ title={pageTitle}links={[{children: t`User`,href: getSettingsPath(SettingsPath.ProfilePage),},- { children: t`Account` },+ { children: pageTitle },]}><SettingsPageContainer>- {loading ? (- <SettingsSectionSkeletonLoader />- ) : (+ {isAppPreferencesEnabled ? (<>- <Section.Root>- <Section.Header- title={t`Connected accounts`}- description={t`Manage your internet accounts.`}- />- <SettingsAccountsConnectedAccountsListCard- accounts={allAccounts}- />- </Section.Root>+ <SettingsAccountGroupsSection /><SettingsAccountsBlocklistSection />- <SettingsAccountsSettingsSection /></>+ ) : (+ <SettingsAccountsLegacySections />)}</SettingsPageContainer></SettingsPageLayout>diff --git a/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsCalendars.tsx b/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsCalendars.tsxindex b0d973ad36c..88690d23c86 100644--- a/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsCalendars.tsx+++ b/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsCalendars.tsx@@ -6,14 +6,20 @@ import { SettingsPageContainer } from '@/settings/components/SettingsPageContainimport { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { SettingsTabBar } from '@/settings/components/layout/SettingsTabBar';+import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';import { useLingui } from '@lingui/react/macro';import { useMemo } from 'react';+import { Navigate } from 'react-router-dom';import { CalendarChannelSyncStage, SettingsPath } from 'twenty-shared/types';import { getSettingsPath } from 'twenty-shared/utils';import { Section } from 'twenty-ui/components/layout';+import { FeatureFlagKey } from '~/generated-metadata/graphql';export const SettingsAccountsCalendars = () => {const { t } = useLingui();+ const isAppPreferencesEnabled = useIsFeatureEnabled(+ FeatureFlagKey.IS_APP_PREFERENCES_ENABLED,+ );const { channels: allCalendarChannels, loading } = useMyCalendarChannels();@@ -31,6 +37,10 @@ export const SettingsAccountsCalendars = () => {title: calendarChannel.handle,}));+ if (isAppPreferencesEnabled) {+ return <Navigate to={getSettingsPath(SettingsPath.Accounts)} replace />;+ }+const renderContent = () => {if (loading) {return <SettingsSectionSkeletonLoader />;diff --git a/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsEmails.tsx b/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsEmails.tsxindex b6458e3ba4e..2279d960bc7 100644--- a/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsEmails.tsx+++ b/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsEmails.tsx@@ -6,8 +6,10 @@ import { SettingsPageContainer } from '@/settings/components/SettingsPageContainimport { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { SettingsTabBar } from '@/settings/components/layout/SettingsTabBar';+import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';import { useLingui } from '@lingui/react/macro';import { useMemo } from 'react';+import { Navigate } from 'react-router-dom';import {MessageChannelSyncStage,MessageChannelType,@@ -15,9 +17,13 @@ import {} from 'twenty-shared/types';import { getSettingsPath } from 'twenty-shared/utils';import { Section } from 'twenty-ui/components/layout';+import { FeatureFlagKey } from '~/generated-metadata/graphql';export const SettingsAccountsEmails = () => {const { t } = useLingui();+ const isAppPreferencesEnabled = useIsFeatureEnabled(+ FeatureFlagKey.IS_APP_PREFERENCES_ENABLED,+ );const { channels: allMessageChannels, loading } = useMyMessageChannels();@@ -38,6 +44,10 @@ export const SettingsAccountsEmails = () => {title: messageChannel.handle,}));+ if (isAppPreferencesEnabled) {+ return <Navigate to={getSettingsPath(SettingsPath.Accounts)} replace />;+ }+const renderContent = () => {if (loading) {return <SettingsSectionSkeletonLoader />;diff --git a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountDetail.stories.tsx b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountDetail.stories.tsxnew file mode 100644index 00000000000..e965a4e5c6d--- /dev/null+++ b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountDetail.stories.tsx@@ -0,0 +1,67 @@+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { expect, userEvent, within } from 'storybook/test';++import {+ PageDecorator,+ type PageDecoratorArgs,+} from '~/testing/decorators/PageDecorator';++import { SettingsAccountDetail } from '~/pages/settings/accounts/SettingsAccountDetail';+import {+ ACCOUNT_GROUPS_GRAPHQL_HANDLERS,+ FATHOM_ONLY_ACCOUNT_ID,+ GOOGLE_ACCOUNT_ID,+ seedAccountGroupsStory,+} from '~/pages/settings/accounts/__stories__/mockedAccountGroups';++const meta: Meta<PageDecoratorArgs> = {+ title: 'Pages/Settings/Accounts/SettingsAccountDetail',+ component: SettingsAccountDetail,+ decorators: [PageDecorator],+ args: {+ routePath: '/settings/accounts/detail/:connectedAccountId',+ routeParams: { ':connectedAccountId': GOOGLE_ACCOUNT_ID },+ additionalRoutes: ['/settings/accounts'],+ },+ beforeEach: seedAccountGroupsStory,+ parameters: {+ layout: 'fullscreen',+ msw: { handlers: ACCOUNT_GROUPS_GRAPHQL_HANDLERS },+ },+};++export default meta;++export type Story = StoryObj<typeof SettingsAccountDetail>;++export const EmailsAndCalendarTabs: Story = {+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);++ await userEvent.click(+ await canvas.findByTestId('tab-emails', undefined, { timeout: 3000 }),+ );++ expect(canvas.getByText('App preferences')).toBeVisible();+ expect(await canvas.findByText('Visibility')).toBeVisible();++ await userEvent.click(canvas.getByTestId('tab-calendar'));++ expect(await canvas.findByText('Event visibility')).toBeVisible();+ },+};++export const AccountWithoutSettingsGoesBackToAccounts: Story = {+ args: {+ routeParams: { ':connectedAccountId': FATHOM_ONLY_ACCOUNT_ID },+ },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);++ expect(+ await canvas.findByText('Navigated to /settings/accounts', undefined, {+ timeout: 3000,+ }),+ ).toBeVisible();+ },+};diff --git a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccounts.stories.tsx b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccounts.stories.tsxindex 4ac57b01e1d..6190c9a8225 100644--- a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccounts.stories.tsx+++ b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccounts.stories.tsx@@ -1,5 +1,6 @@import { type Meta, type StoryObj } from '@storybook/react-vite';-import { within } from 'storybook/test';+import { expect, userEvent, waitFor, within } from 'storybook/test';+import { isDefined } from 'twenty-shared/utils';import {PageDecorator,@@ -8,6 +9,12 @@ import {import { graphqlMocks } from '~/testing/graphqlMocks';import { SettingsAccounts } from '~/pages/settings/accounts/SettingsAccounts';+import {+ ACCOUNT_GROUPS_GRAPHQL_HANDLERS,+ GOOGLE_ACCOUNT_ID,+ deleteConnectedAccount,+ seedAccountGroupsStory,+} from '~/pages/settings/accounts/__stories__/mockedAccountGroups';const meta: Meta<PageDecoratorArgs> = {title: 'Pages/Settings/Accounts/SettingsAccounts',@@ -26,6 +33,28 @@ export default meta;export type Story = StoryObj<typeof SettingsAccounts>;+const getAccountRow = (canvasElement: HTMLElement, handle: string) => {+ const row = within(canvasElement)+ .getByText(handle)+ .closest<HTMLElement>('[data-table-row]');++ if (!isDefined(row)) {+ throw new Error(`No account row for ${handle}`);+ }++ return within(row);+};++const accountGroupsStory: Story = {+ args: {+ additionalRoutes: ['/settings/accounts/detail/:connectedAccountId'],+ },+ beforeEach: seedAccountGroupsStory,+ parameters: {+ msw: { handlers: ACCOUNT_GROUPS_GRAPHQL_HANDLERS },+ },+};+export const Default: Story = {play: async ({ canvasElement }) => {const canvas = within(canvasElement);@@ -33,5 +62,117 @@ export const Default: Story = {await canvas.findByText('Connected accounts', undefined, {timeout: 3000,});++ expect(canvas.queryByText('App preferences')).not.toBeInTheDocument();+ },+};++export const AccountsGroupedByEmail: Story = {+ ...accountGroupsStory,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);++ await canvas.findByText('Used by', undefined, { timeout: 3000 });++ expect(canvas.getAllByText('App preferences').length).toBeGreaterThan(0);+ expect(canvas.queryByText('Connected accounts')).not.toBeInTheDocument();++ const timRow = getAccountRow(canvasElement, '[email protected]');++ expect(timRow.getByRole('img', { name: 'Gmail' })).toBeVisible();+ expect(timRow.getByRole('img', { name: 'Google Calendar' })).toBeVisible();+ expect(timRow.getByRole('img', { name: 'Fathom' })).toBeVisible();+ expect(+ timRow.queryByRole('img', { name: 'Granola' }),+ ).not.toBeInTheDocument();+ expect(canvas.getByRole('link', { name: '[email protected]' })).toHaveAttribute(+ 'href',+ `/settings/accounts/detail/${GOOGLE_ACCOUNT_ID}`,+ );+ expect(canvas.queryByText('[email protected]')).not.toBeInTheDocument();++ const outlookRow = getAccountRow(canvasElement, '[email protected]');++ expect(outlookRow.getAllByRole('img', { name: 'Outlook' })).toHaveLength(1);++ const notesRow = getAccountRow(canvasElement, '[email protected]');++ expect(notesRow.getByRole('img', { name: 'Fathom' })).toBeVisible();+ expect(+ notesRow.queryByRole('img', { name: 'Gmail' }),+ ).not.toBeInTheDocument();+ expect(+ notesRow.queryByRole('button', { name: 'More options' }),+ ).not.toBeInTheDocument();+ expect(+ canvas.queryByRole('link', { name: '[email protected]' }),+ ).not.toBeInTheDocument();++ expect(canvas.getByText('[email protected]')).toBeVisible();+ expect(canvas.queryByText('[email protected]')).not.toBeInTheDocument();+ },+};++export const RowOpensAccountPage: Story = {+ ...accountGroupsStory,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);++ await canvas.findByText('Used by', undefined, { timeout: 3000 });+ await userEvent.click(+ getAccountRow(canvasElement, '[email protected]').getByRole('img', {+ name: 'Gmail',+ }),+ );++ expect(+ await canvas.findByText(+ 'Navigated to /settings/accounts/detail/:connectedAccountId',+ ),+ ).toBeVisible();+ },+};++export const DeleteKeepsAppConnections: Story = {+ ...accountGroupsStory,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const body = within(canvasElement.ownerDocument.body);++ await canvas.findByText('Used by', undefined, { timeout: 3000 });++ const openDeleteDialog = async () => {+ await userEvent.click(+ getAccountRow(canvasElement, '[email protected]').getByRole('button', {+ name: 'More options',+ }),+ );+ expect(body.queryByText('Emails settings')).not.toBeInTheDocument();+ await userEvent.click(+ await body.findByText('Delete account and synced data'),+ );+ };++ await openDeleteDialog();+ await userEvent.click(await body.findByRole('button', { name: /Cancel/ }));++ expect(canvas.queryByText(/Navigated to/)).not.toBeInTheDocument();++ await openDeleteDialog();+ await userEvent.click(+ await body.findByRole('button', { name: /Delete account and data/ }),+ );++ const remainingRow = await waitFor(() =>+ getAccountRow(canvasElement, '[email protected]'),+ );++ expect(remainingRow.getByRole('img', { name: 'Fathom' })).toBeVisible();+ expect(+ remainingRow.queryByRole('button', { name: 'More options' }),+ ).not.toBeInTheDocument();+ expect(canvas.queryByText('[email protected]')).not.toBeInTheDocument();+ expect(deleteConnectedAccount.mock.calls).toEqual([[GOOGLE_ACCOUNT_ID]]);+ expect(canvas.queryByText(/Navigated to/)).not.toBeInTheDocument();},};diff --git a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountsCalendars.stories.tsx b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountsCalendars.stories.tsxindex f5e56a3c90d..c48c2a3c287 100644--- a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountsCalendars.stories.tsx+++ b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountsCalendars.stories.tsx@@ -1,6 +1,8 @@import { type Meta, type StoryObj } from '@storybook/react-vite';import { HttpResponse, graphql } from 'msw';+import { expect, within } from 'storybook/test';import { SettingsAccountsCalendars } from '~/pages/settings/accounts/SettingsAccountsCalendars';+import { seedAccountGroupsStory } from '~/pages/settings/accounts/__stories__/mockedAccountGroups';import {PageDecorator,@@ -48,6 +50,7 @@ export const TwoConnectedAccounts: Story = {lastSignedInAt: null,userWorkspaceId: '20202020-03f2-4d83-b0d5-2ec2bcee72d4',connectionProviderId: null,+ applicationId: null,name: 'Test User',visibility: 'SHARE_EVERYTHING',lastCredentialsRefreshedAt: null,@@ -104,3 +107,19 @@ export const TwoConnectedAccounts: Story = {},},};++export const RedirectsToAppPreferencesWhenFlagIsOn: Story = {+ args: {+ additionalRoutes: ['/settings/accounts'],+ },+ beforeEach: seedAccountGroupsStory,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);++ expect(+ await canvas.findByText('Navigated to /settings/accounts', undefined, {+ timeout: 3000,+ }),+ ).toBeVisible();+ },+};diff --git a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountsEmails.stories.tsx b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountsEmails.stories.tsxindex 3b1b659c088..e2a6060c9be 100644--- a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountsEmails.stories.tsx+++ b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountsEmails.stories.tsx@@ -1,5 +1,6 @@import { type Meta, type StoryObj } from '@storybook/react-vite';import { HttpResponse, graphql } from 'msw';+import { expect, within } from 'storybook/test';import {PageDecorator,@@ -8,6 +9,7 @@ import {import { graphqlMocks } from '~/testing/graphqlMocks';import { SettingsAccountsEmails } from '~/pages/settings/accounts/SettingsAccountsEmails';+import { seedAccountGroupsStory } from '~/pages/settings/accounts/__stories__/mockedAccountGroups';const meta: Meta<PageDecoratorArgs> = {title: 'Pages/Settings/Accounts/SettingsAccountsEmails',@@ -49,6 +51,7 @@ export const TwoConnectedAccounts: Story = {lastSignedInAt: null,userWorkspaceId: '20202020-03f2-4d83-b0d5-2ec2bcee72d4',connectionProviderId: null,+ applicationId: null,name: 'Test User',visibility: 'SHARE_EVERYTHING',lastCredentialsRefreshedAt: null,@@ -111,3 +114,19 @@ export const TwoConnectedAccounts: Story = {},},};++export const RedirectsToAppPreferencesWhenFlagIsOn: Story = {+ args: {+ additionalRoutes: ['/settings/accounts'],+ },+ beforeEach: seedAccountGroupsStory,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);++ expect(+ await canvas.findByText('Navigated to /settings/accounts', undefined, {+ timeout: 3000,+ }),+ ).toBeVisible();+ },+};diff --git a/packages/twenty-front/src/pages/settings/accounts/__stories__/mockedAccountGroups.ts b/packages/twenty-front/src/pages/settings/accounts/__stories__/mockedAccountGroups.tsnew file mode 100644index 00000000000..45fdc67223f--- /dev/null+++ b/packages/twenty-front/src/pages/settings/accounts/__stories__/mockedAccountGroups.ts@@ -0,0 +1,278 @@+import { HttpResponse, graphql } from 'msw';+import { fn } from 'storybook/test';++import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';+import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';+import { getEmptyPageInfo } from '@/object-record/cache/utils/getEmptyPageInfo';+import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';+import { FeatureFlagKey } from '~/generated-metadata/graphql';+import { graphqlMocks } from '~/testing/graphqlMocks';+import { mockedApolloClient } from '~/testing/mockedApolloClient';+import {+ mockCurrentWorkspace,+ mockedWorkspaceMemberData,+} from '~/testing/mock-data/users';++const MY_USER_WORKSPACE_ID = '20202020-1a2b-4c3d-8e4f-000000000001';+const TEAMMATE_USER_WORKSPACE_ID = '20202020-1a2b-4c3d-8e4f-000000000002';+const FATHOM_APPLICATION_ID = '20202020-1a2b-4c3d-8e4f-000000000021';+const GRANOLA_APPLICATION_ID = '20202020-1a2b-4c3d-8e4f-000000000022';+const CREATED_AT = '2026-09-01T00:00:00.000Z';++export const GOOGLE_ACCOUNT_ID = '20202020-1a2b-4c3d-8e4f-000000000011';+export const FATHOM_ONLY_ACCOUNT_ID = '20202020-1a2b-4c3d-8e4f-000000000013';+const FATHOM_ACCOUNT_ID = '20202020-1a2b-4c3d-8e4f-000000000012';+const MICROSOFT_ACCOUNT_ID = '20202020-1a2b-4c3d-8e4f-000000000014';+const MY_SHARED_ACCOUNT_ID = '20202020-1a2b-4c3d-8e4f-000000000015';+const TEAMMATE_ACCOUNT_ID = '20202020-1a2b-4c3d-8e4f-000000000016';+const EMAIL_GROUP_ACCOUNT_ID = '20202020-1a2b-4c3d-8e4f-000000000017';++const buildConnectedAccount = (account: {+ id: string;+ handle: string;+ provider: string;+ userWorkspaceId: string;+ applicationId?: string;+ visibility?: string;+}) => ({+ __typename: 'ConnectedAccountPublicDTO',+ authFailedAt: null,+ authFailedReason: null,+ archivedAt: null,+ scopes: null,+ handleAliases: null,+ lastSignedInAt: null,+ connectionProviderId: null,+ applicationId: null,+ name: null,+ visibility: 'user',+ lastCredentialsRefreshedAt: null,+ connectionParameters: null,+ createdAt: CREATED_AT,+ updatedAt: CREATED_AT,+ ...account,+});++const buildMessageChannel = (id: string, connectedAccountId: string) => ({+ __typename: 'MessageChannel',+ id,+ handle: 'mailbox',+ displayName: null,+ visibility: 'SHARE_EVERYTHING',+ type: 'EMAIL',+ isContactAutoCreationEnabled: true,+ contactAutoCreationPolicy: 'SENT',+ messageFolderImportPolicy: 'ALL_FOLDERS',+ excludeNonProfessionalEmails: false,+ excludeGroupEmails: false,+ isSyncEnabled: true,+ syncStatus: 'ACTIVE',+ syncStage: 'MESSAGE_LIST_FETCH_PENDING',+ syncStageStartedAt: null,+ connectedAccountId,+ connectedAccount: {+ __typename: 'ConnectedAccountHandleDTO',+ id: connectedAccountId,+ handle: 'mailbox',+ },+ createdAt: CREATED_AT,+ updatedAt: CREATED_AT,+});++const buildCalendarChannel = (id: string, connectedAccountId: string) => ({+ __typename: 'CalendarChannel',+ id,+ handle: 'calendar',+ visibility: 'SHARE_EVERYTHING',+ isContactAutoCreationEnabled: false,+ contactAutoCreationPolicy: 'AS_PARTICIPANT_AND_ORGANIZER',+ isSyncEnabled: true,+ syncStatus: 'ACTIVE',+ syncStage: 'CALENDAR_EVENT_LIST_FETCH_PENDING',+ syncStageStartedAt: null,+ connectedAccountId,+ createdAt: CREATED_AT,+ updatedAt: CREATED_AT,+});++const CONNECTED_ACCOUNTS = [+ buildConnectedAccount({+ id: GOOGLE_ACCOUNT_ID,+ handle: '[email protected]',+ provider: 'google',+ userWorkspaceId: MY_USER_WORKSPACE_ID,+ }),+ buildConnectedAccount({+ id: FATHOM_ACCOUNT_ID,+ handle: '[email protected]',+ provider: 'app',+ userWorkspaceId: MY_USER_WORKSPACE_ID,+ applicationId: FATHOM_APPLICATION_ID,+ }),+ buildConnectedAccount({+ id: FATHOM_ONLY_ACCOUNT_ID,+ handle: '[email protected]',+ provider: 'app',+ userWorkspaceId: MY_USER_WORKSPACE_ID,+ applicationId: FATHOM_APPLICATION_ID,+ }),+ buildConnectedAccount({+ id: MICROSOFT_ACCOUNT_ID,+ handle: '[email protected]',+ provider: 'microsoft',+ userWorkspaceId: MY_USER_WORKSPACE_ID,+ }),+ buildConnectedAccount({+ id: MY_SHARED_ACCOUNT_ID,+ handle: '[email protected]',+ provider: 'app',+ userWorkspaceId: MY_USER_WORKSPACE_ID,+ applicationId: FATHOM_APPLICATION_ID,+ visibility: 'workspace',+ }),+ buildConnectedAccount({+ id: TEAMMATE_ACCOUNT_ID,+ handle: '[email protected]',+ provider: 'app',+ userWorkspaceId: TEAMMATE_USER_WORKSPACE_ID,+ applicationId: GRANOLA_APPLICATION_ID,+ visibility: 'workspace',+ }),+ buildConnectedAccount({+ id: EMAIL_GROUP_ACCOUNT_ID,+ handle: '[email protected]',+ provider: 'email_group',+ userWorkspaceId: MY_USER_WORKSPACE_ID,+ visibility: 'workspace',+ }),+];++const MESSAGE_CHANNELS = [+ buildMessageChannel(+ '20202020-1a2b-4c3d-8e4f-000000000031',+ GOOGLE_ACCOUNT_ID,+ ),+ buildMessageChannel(+ '20202020-1a2b-4c3d-8e4f-000000000032',+ FATHOM_ONLY_ACCOUNT_ID,+ ),+ buildMessageChannel(+ '20202020-1a2b-4c3d-8e4f-000000000033',+ MICROSOFT_ACCOUNT_ID,+ ),+];++const CALENDAR_CHANNELS = [+ buildCalendarChannel(+ '20202020-1a2b-4c3d-8e4f-000000000041',+ GOOGLE_ACCOUNT_ID,+ ),+ buildCalendarChannel(+ '20202020-1a2b-4c3d-8e4f-000000000042',+ MICROSOFT_ACCOUNT_ID,+ ),+];++const deletedAccountIds = new Set<string>();++export const deleteConnectedAccount = fn();++export const ACCOUNT_GROUPS_GRAPHQL_HANDLERS = [+ graphql.query('MyConnectedAccounts', () =>+ HttpResponse.json({+ data: {+ myConnectedAccounts: CONNECTED_ACCOUNTS.filter(+ (account) => !deletedAccountIds.has(account.id),+ ),+ },+ }),+ ),+ graphql.query('MyMessageChannels', () =>+ HttpResponse.json({+ data: {+ myMessageChannels: MESSAGE_CHANNELS.filter(+ (channel) => !deletedAccountIds.has(channel.connectedAccountId),+ ),+ },+ }),+ ),+ graphql.query('MyCalendarChannels', () =>+ HttpResponse.json({+ data: {+ myCalendarChannels: CALENDAR_CHANNELS.filter(+ (channel) => !deletedAccountIds.has(channel.connectedAccountId),+ ),+ },+ }),+ ),+ graphql.mutation('DeleteConnectedAccount', ({ variables }) => {+ deleteConnectedAccount(variables.id);+ deletedAccountIds.add(variables.id);++ return HttpResponse.json({+ data: {+ deleteConnectedAccount: {+ __typename: 'ConnectedAccountPublicDTO',+ id: variables.id,+ },+ },+ });+ }),+ graphql.query('FindManyBlocklists', () =>+ HttpResponse.json({+ data: {+ blocklists: {+ __typename: 'BlocklistConnection',+ edges: [],+ pageInfo: getEmptyPageInfo(),+ totalCount: 0,+ },+ },+ }),+ ),+ ...graphqlMocks.handlers,+];++export const seedAccountGroupsStory = async () => {+ deletedAccountIds.clear();+ deleteConnectedAccount.mockClear();+ await mockedApolloClient.clearStore();++ const previousWorkspace = jotaiStore.get(currentWorkspaceState.atom);+ const previousWorkspaceMember = jotaiStore.get(+ currentWorkspaceMemberState.atom,+ );++ jotaiStore.set(currentWorkspaceState.atom, {+ ...mockCurrentWorkspace,+ installedApplications: [+ {+ id: FATHOM_APPLICATION_ID,+ universalIdentifier: FATHOM_APPLICATION_ID,+ name: 'Fathom',+ logoUrl: null,+ },+ {+ id: GRANOLA_APPLICATION_ID,+ universalIdentifier: GRANOLA_APPLICATION_ID,+ name: 'Granola',+ logoUrl: null,+ },+ ],+ featureFlags: [+ {+ key: FeatureFlagKey.IS_APP_PREFERENCES_ENABLED,+ value: true,+ },+ ],+ });+ jotaiStore.set(currentWorkspaceMemberState.atom, {+ ...mockedWorkspaceMemberData,+ userWorkspaceId: MY_USER_WORKSPACE_ID,+ });++ return () => {+ jotaiStore.set(currentWorkspaceState.atom, previousWorkspace);+ jotaiStore.set(currentWorkspaceMemberState.atom, previousWorkspaceMember);+ };+};diff --git a/packages/twenty-shared/src/types/FeatureFlagKey.ts b/packages/twenty-shared/src/types/FeatureFlagKey.tsindex 9fe433dbef6..55b4e5c3e20 100644--- a/packages/twenty-shared/src/types/FeatureFlagKey.ts+++ b/packages/twenty-shared/src/types/FeatureFlagKey.ts@@ -18,4 +18,5 @@ export enum FeatureFlagKey {IS_CALENDAR_SYNC_SKIP_UNCHANGED_RECORDS_ENABLED = 'IS_CALENDAR_SYNC_SKIP_UNCHANGED_RECORDS_ENABLED',IS_RECORD_SHARE_VISIBILITY_GATING_ENABLED = 'IS_RECORD_SHARE_VISIBILITY_GATING_ENABLED',IS_AI_CHAT_INBOX_ENABLED = 'IS_AI_CHAT_INBOX_ENABLED',+ IS_APP_PREFERENCES_ENABLED = 'IS_APP_PREFERENCES_ENABLED',}diff --git a/packages/twenty-shared/src/types/SettingsPath.ts b/packages/twenty-shared/src/types/SettingsPath.tsindex c449a5de4d6..b11f41f4663 100644--- a/packages/twenty-shared/src/types/SettingsPath.ts+++ b/packages/twenty-shared/src/types/SettingsPath.ts@@ -3,6 +3,7 @@ export enum SettingsPath {TwoFactorAuthenticationStrategyConfig = 'profile/two-factor-authentication/:twoFactorAuthenticationStrategy',Experience = 'experience',Accounts = 'accounts',+ AccountDetail = 'accounts/detail/:connectedAccountId',NewAccount = 'accounts/new',AccountsConfiguration = 'accounts/configuration/:connectedAccountId',AccountsCalendars = 'accounts/calendars',