The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Replace frontend snackbars with twenty-ui toasts (#25664)
Raphaël Bosib99496205a23
diff --git a/packages/twenty-front/src/hooks/__tests__/useCopyToClipboard.test.tsx b/packages/twenty-front/src/hooks/__tests__/useCopyToClipboard.test.tsxindex 4e175556899..d7e242868d8 100644--- a/packages/twenty-front/src/hooks/__tests__/useCopyToClipboard.test.tsx+++ b/packages/twenty-front/src/hooks/__tests__/useCopyToClipboard.test.tsx@@ -4,14 +4,11 @@ import { act, renderHook } from '@testing-library/react';import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';-const mockEnqueueSuccessSnackBar = jest.fn();-const mockEnqueueErrorSnackBar = jest.fn();--jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({- enqueueSuccessSnackBar: mockEnqueueSuccessSnackBar,- enqueueErrorSnackBar: mockEnqueueErrorSnackBar,- }),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));const mockWriteText = jest.fn();@@ -41,7 +38,7 @@ describe('useCopyToClipboard', () => {});describe('copyToClipboard', () => {- it('should copy the text and enqueue the default success snack bar', async () => {+ it('should copy the text and enqueue the default success toast', async () => {const { result } = renderUseCopyToClipboard();await act(async () => {@@ -49,8 +46,11 @@ describe('useCopyToClipboard', () => {});expect(mockWriteText).toHaveBeenCalledWith('hello clipboard');- expect(mockEnqueueSuccessSnackBar).toHaveBeenCalledWith(- expect.objectContaining({ message: 'Copied to clipboard' }),+ expect(mockEnqueueToast).toHaveBeenCalledWith(+ expect.objectContaining({+ variant: 'success',+ children: 'Copied to clipboard',+ }),);});@@ -61,38 +61,43 @@ describe('useCopyToClipboard', () => {await result.current.copyToClipboard('hello', 'Email copied');});- expect(mockEnqueueSuccessSnackBar).toHaveBeenCalledWith(- expect.objectContaining({ message: 'Email copied' }),+ expect(mockEnqueueToast).toHaveBeenCalledWith(+ expect.objectContaining({+ variant: 'success',+ children: 'Email copied',+ }),);});});- describe('copyToClipboardWithoutSuccessSnackBar', () => {- it('should copy the text without enqueuing any snack bar', async () => {+ describe('copyToClipboardWithoutSuccessToast', () => {+ it('should copy the text without enqueuing any toast', async () => {const { result } = renderUseCopyToClipboard();await act(async () => {- await result.current.copyToClipboardWithoutSuccessSnackBar(+ await result.current.copyToClipboardWithoutSuccessToast('hello clipboard',);});expect(mockWriteText).toHaveBeenCalledWith('hello clipboard');- expect(mockEnqueueSuccessSnackBar).not.toHaveBeenCalled();- expect(mockEnqueueErrorSnackBar).not.toHaveBeenCalled();+ expect(mockEnqueueToast).not.toHaveBeenCalled();});- it('should enqueue an error snack bar when the write fails', async () => {+ it('should enqueue an error toast when the write fails', async () => {mockWriteText.mockRejectedValue(new Error('denied'));const { result } = renderUseCopyToClipboard();await act(async () => {- await result.current.copyToClipboardWithoutSuccessSnackBar('hello');+ await result.current.copyToClipboardWithoutSuccessToast('hello');});- expect(mockEnqueueErrorSnackBar).toHaveBeenCalledWith(- expect.objectContaining({ message: "Couldn't copy to clipboard" }),+ expect(mockEnqueueToast).toHaveBeenCalledWith(+ expect.objectContaining({+ variant: 'error',+ children: "Couldn't copy to clipboard",+ }),);});@@ -102,11 +107,13 @@ describe('useCopyToClipboard', () => {const { result } = renderUseCopyToClipboard();await act(async () => {- await result.current.copyToClipboardWithoutSuccessSnackBar('hello');+ await result.current.copyToClipboardWithoutSuccessToast('hello');});expect(mockWriteText).not.toHaveBeenCalled();- expect(mockEnqueueErrorSnackBar).toHaveBeenCalled();+ expect(mockEnqueueToast).toHaveBeenCalledWith(+ expect.objectContaining({ variant: 'error' }),+ );});});});diff --git a/packages/twenty-front/src/hooks/useCopyToClipboard.tsx b/packages/twenty-front/src/hooks/useCopyToClipboard.tsxindex 5c840d02b80..9dd42bc193e 100644--- a/packages/twenty-front/src/hooks/useCopyToClipboard.tsx+++ b/packages/twenty-front/src/hooks/useCopyToClipboard.tsx@@ -1,12 +1,12 @@-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useLingui } from '@lingui/react/macro';+import { useContext } from 'react';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { IconCopy, IconExclamationCircle } from 'twenty-ui/icon';-import { useContext } from 'react';import { ThemeContext } from 'twenty-ui/theme-constants';export const useCopyToClipboard = () => {const { theme } = useContext(ThemeContext);- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { t } = useLingui();const writeToClipboard = async (@@ -14,12 +14,11 @@ export const useCopyToClipboard = () => {successMessage: string | null,) => {if (!window.isSecureContext) {- enqueueErrorSnackBar({- message: t`Clipboard requires a secure connection (HTTPS). Please access this app over HTTPS to enable copying.`,- options: {- icon: <IconExclamationCircle size={16} color="red" />,- duration: 6000,- },+ enqueueToast({+ variant: 'error',+ children: t`Clipboard requires a secure connection (HTTPS). Please access this app over HTTPS to enable copying.`,+ icon: <IconExclamationCircle size={16} color="red" />,+ duration: 6000,});return;@@ -32,20 +31,18 @@ export const useCopyToClipboard = () => {return;}- enqueueSuccessSnackBar({- message: successMessage,- options: {- icon: <IconCopy size={theme.icon.size.md} />,- duration: 2000,- },+ enqueueToast({+ variant: 'success',+ children: successMessage,+ icon: <IconCopy size={theme.icon.size.md} />,+ duration: 2000,});} catch {- enqueueErrorSnackBar({- message: t`Couldn't copy to clipboard`,- options: {- icon: <IconExclamationCircle size={16} color="red" />,- duration: 2000,- },+ enqueueToast({+ variant: 'error',+ children: t`Couldn't copy to clipboard`,+ icon: <IconExclamationCircle size={16} color="red" />,+ duration: 2000,});}};@@ -53,8 +50,8 @@ export const useCopyToClipboard = () => {const copyToClipboard = async (valueAsString: string, message?: string) =>await writeToClipboard(valueAsString, message || t`Copied to clipboard`);- const copyToClipboardWithoutSuccessSnackBar = async (valueAsString: string) =>+ const copyToClipboardWithoutSuccessToast = async (valueAsString: string) =>await writeToClipboard(valueAsString, null);- return { copyToClipboard, copyToClipboardWithoutSuccessSnackBar };+ return { copyToClipboard, copyToClipboardWithoutSuccessToast };};diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventsCard.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventsCard.tsxindex 71f0e1e17bf..f14abb0e1c8 100644--- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventsCard.tsx+++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventsCard.tsx@@ -1,3 +1,4 @@+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { CalendarEventsCardContent } from '@/activities/calendar/components/CalendarEventsCardContent';import { TIMELINE_CALENDAR_EVENTS_DEFAULT_PAGE_SIZE } from '@/activities/calendar/constants/Calendar';import { getTimelineCalendarEventsFromObjectRecord } from '@/activities/calendar/graphql/queries/getTimelineCalendarEventsFromObjectRecord';@@ -10,14 +11,20 @@ import { type TimelineCalendarEventsWithTotal } from '~/generated/graphql';export const CalendarEventsCard = () => {const targetRecord = useTargetRecord();- const { data, firstQueryLoading, isFetchingMore, fetchMoreRecords, refetch } =- useCustomResolver<TimelineCalendarEventsWithTotal>(- getTimelineCalendarEventsFromObjectRecord,- 'getTimelineCalendarEventsFromObjectRecord',- 'timelineCalendarEvents',- targetRecord,- TIMELINE_CALENDAR_EVENTS_DEFAULT_PAGE_SIZE,- );+ const {+ data,+ error,+ firstQueryLoading,+ isFetchingMore,+ fetchMoreRecords,+ refetch,+ } = useCustomResolver<TimelineCalendarEventsWithTotal>({+ query: getTimelineCalendarEventsFromObjectRecord,+ queryName: 'getTimelineCalendarEventsFromObjectRecord',+ objectName: 'timelineCalendarEvents',+ activityTargetableObject: targetRecord,+ pageSize: TIMELINE_CALENDAR_EVENTS_DEFAULT_PAGE_SIZE,+ });useSubscribeTimelineToParticipantChanges({queryId: `calendar-${targetRecord.id}`,@@ -43,6 +50,8 @@ export const CalendarEventsCard = () => {return (<>+ <ToastOnQueryErrorEffect error={error} />+<WidgetHeaderCountEffect count={totalNumberOfCalendarEvents} /><CalendarEventsCardContentfirstQueryLoading={firstQueryLoading}diff --git a/packages/twenty-front/src/modules/activities/calendar/components/__stories__/Calendar.stories.tsx b/packages/twenty-front/src/modules/activities/calendar/components/__stories__/Calendar.stories.tsxindex 29f4b1ee972..5a778539389 100644--- a/packages/twenty-front/src/modules/activities/calendar/components/__stories__/Calendar.stories.tsx+++ b/packages/twenty-front/src/modules/activities/calendar/components/__stories__/Calendar.stories.tsx@@ -1,18 +1,18 @@-import { getOperationName } from '~/utils/getOperationName';import { type Meta, type StoryObj } from '@storybook/react-vite';import { HttpResponse, graphql } from 'msw';+import { getOperationName } from '~/utils/getOperationName';import { CalendarEventsCard } from '@/activities/calendar/components/CalendarEventsCard';import { getTimelineCalendarEventsFromObjectRecord } from '@/activities/calendar/graphql/queries/getTimelineCalendarEventsFromObjectRecord';-import { CoreObjectNameSingular } from 'twenty-shared/types';import { LayoutRenderingProvider } from '@/ui/layout/contexts/LayoutRenderingContext';+import { CoreObjectNameSingular } from 'twenty-shared/types';import { ComponentDecorator } from 'twenty-ui/testing';import { PageLayoutType } from '~/generated-metadata/graphql';+import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';import { mockedTimelineCalendarEvents } from '~/testing/mock-data/timeline-calendar-events';-import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';const meta: Meta<typeof CalendarEventsCard> = {title: 'Modules/Activities/Calendar/CalendarEventsCard',@@ -21,7 +21,7 @@ const meta: Meta<typeof CalendarEventsCard> = {MemoryRouterDecorator,ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,(Story) => (<LayoutRenderingProvidervalue={{diff --git a/packages/twenty-front/src/modules/activities/calendar/hooks/__tests__/useCalendarEventComposer.test.ts b/packages/twenty-front/src/modules/activities/calendar/hooks/__tests__/useCalendarEventComposer.test.tsindex d8f5ed8192b..631685d0641 100644--- a/packages/twenty-front/src/modules/activities/calendar/hooks/__tests__/useCalendarEventComposer.test.ts+++ b/packages/twenty-front/src/modules/activities/calendar/hooks/__tests__/useCalendarEventComposer.test.ts@@ -48,8 +48,11 @@ jest.mock('@/object-record/hooks/useFindOneRecord', () => ({useFindOneRecord: () => ({ record: mockContextRecord.current }),}));-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({ enqueueErrorSnackBar: jest.fn() }),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));jest.mock('@/settings/accounts/hooks/useMyConnectedAccounts', () => ({diff --git a/packages/twenty-front/src/modules/activities/calendar/hooks/useCalendarEventComposer.ts b/packages/twenty-front/src/modules/activities/calendar/hooks/useCalendarEventComposer.tsindex 4ba86addec9..de206acf17a 100644--- a/packages/twenty-front/src/modules/activities/calendar/hooks/useCalendarEventComposer.ts+++ b/packages/twenty-front/src/modules/activities/calendar/hooks/useCalendarEventComposer.ts@@ -1,8 +1,8 @@import { getMissingCreateCalendarEventScopes } from '@/accounts/utils/hasMissingCreateCalendarEventScopes';import { useCalendarEventTargetObjectMetadataItems } from '@/activities/calendar/hooks/useCalendarEventTargetObjectMetadataItems';import { useCreateCalendarEvent } from '@/activities/calendar/hooks/useCreateCalendarEvent';-import { useRefetchTimelineCalendarEvents } from '@/activities/calendar/hooks/useRefetchTimelineCalendarEvents';import { useCreateCalendarEventTargets } from '@/activities/calendar/hooks/useCreateCalendarEventTargets';+import { useRefetchTimelineCalendarEvents } from '@/activities/calendar/hooks/useRefetchTimelineCalendarEvents';import { isCalendarEventComposerCreatingState } from '@/activities/calendar/states/isCalendarEventComposerCreatingState';import { type CalendarEventComposerInitialValues } from '@/activities/calendar/types/CalendarEventComposerInitialValues';import { type CalendarEventComposerTarget } from '@/activities/calendar/types/CalendarEventComposerTarget';@@ -18,17 +18,17 @@ import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';import { searchRecordStoreFamilyState } from '@/object-record/record-picker/multiple-record-picker/states/searchRecordStoreComponentFamilyState';import { type RecordPickerPickableMorphItem } from '@/object-record/record-picker/types/RecordPickerPickableMorphItem';import { useMyConnectedAccounts } from '@/settings/accounts/hooks/useMyConnectedAccounts';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { isNonEmptyString } from '@sniptt/guards';import { t } from '@lingui/core/macro';+import { isNonEmptyString } from '@sniptt/guards';import { useStore } from 'jotai';import { useCallback, useState } from 'react';+import { Temporal } from 'temporal-polyfill';import { MAX_EMAIL_RECIPIENTS } from 'twenty-shared/constants';import { CoreObjectNameSingular } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { type SelectOption } from 'twenty-ui/primitives/input';-import { Temporal } from 'temporal-polyfill';export const useCalendarEventComposer = ({initialValues,@@ -41,7 +41,7 @@ export const useCalendarEventComposer = ({const { createCalendarEvent, loading: isCreating } = useCreateCalendarEvent();const { refetchTimelineCalendarEvents } = useRefetchTimelineCalendarEvents();const { createCalendarEventTargets } = useCreateCalendarEventTargets();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const store = useStore();const isCalendarEventComposerCreating = useAtomStateValue(isCalendarEventComposerCreatingState,@@ -280,8 +280,9 @@ export const useCalendarEventComposer = ({// links existed, so an event related only through them stays invisible.await refetchTimelineCalendarEvents();} else {- enqueueErrorSnackBar({- message: t`Failed to link the related records to this event`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to link the related records to this event`,});}}@@ -300,7 +301,7 @@ export const useCalendarEventComposer = ({dates.endsAt,dates.startsAt,description,- enqueueErrorSnackBar,+ enqueueToast,isFullDay,location,onCreated,diff --git a/packages/twenty-front/src/modules/activities/calendar/hooks/useCreateCalendarEvent.ts b/packages/twenty-front/src/modules/activities/calendar/hooks/useCreateCalendarEvent.tsindex e9989ea96cb..ddd8d99ddf4 100644--- a/packages/twenty-front/src/modules/activities/calendar/hooks/useCreateCalendarEvent.ts+++ b/packages/twenty-front/src/modules/activities/calendar/hooks/useCreateCalendarEvent.ts@@ -1,9 +1,9 @@import { CREATE_CALENDAR_EVENT } from '@/activities/calendar/graphql/mutations/createCalendarEvent';import { useRefetchTimelineCalendarEvents } from '@/activities/calendar/hooks/useRefetchTimelineCalendarEvents';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { useCallback } from 'react';+import { useToast } from 'twenty-ui/primitives/feedback';import {type CreateCalendarEventInput,type CreateCalendarEventOutput,@@ -12,7 +12,7 @@ import {export const useCreateCalendarEvent = () => {const { refetchTimelineCalendarEvents } = useRefetchTimelineCalendarEvents();- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [createCalendarEventMutation, { loading }] = useMutation<{ createCalendarEvent: CreateCalendarEventOutput },@@ -27,8 +27,9 @@ export const useCreateCalendarEvent = () => {});if (!result.data?.createCalendarEvent.success) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:result.data?.createCalendarEvent.error ??t`Failed to create calendar event`,});@@ -36,8 +37,9 @@ export const useCreateCalendarEvent = () => {return { success: false };}- enqueueSuccessSnackBar({- message: t`Calendar event created successfully`,+ enqueueToast({+ variant: 'success',+ children: t`Calendar event created successfully`,});await refetchTimelineCalendarEvents();@@ -48,19 +50,15 @@ export const useCreateCalendarEvent = () => {result.data.createCalendarEvent.calendarEventId ?? undefined,};} catch {- enqueueErrorSnackBar({- message: t`Failed to create calendar event`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to create calendar event`,});return { success: false };}},- [- refetchTimelineCalendarEvents,- createCalendarEventMutation,- enqueueErrorSnackBar,- enqueueSuccessSnackBar,- ],+ [refetchTimelineCalendarEvents, createCalendarEventMutation, enqueueToast],);return { createCalendarEvent, loading };diff --git a/packages/twenty-front/src/modules/activities/emails/components/EmailsCard.tsx b/packages/twenty-front/src/modules/activities/emails/components/EmailsCard.tsxindex 09b2fe611d9..300b43df808 100644--- a/packages/twenty-front/src/modules/activities/emails/components/EmailsCard.tsx+++ b/packages/twenty-front/src/modules/activities/emails/components/EmailsCard.tsx@@ -1,3 +1,4 @@+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { CoreObjectNameSingular } from 'twenty-shared/types';import { EmailsCardContent } from '@/activities/emails/components/EmailsCardContent';@@ -12,14 +13,20 @@ import { type TimelineThreadsWithTotal } from '~/generated/graphql';export const EmailsCard = () => {const targetRecord = useTargetRecord();- const { data, firstQueryLoading, isFetchingMore, fetchMoreRecords, refetch } =- useCustomResolver<TimelineThreadsWithTotal>(- getTimelineThreadsFromObjectRecord,- 'getTimelineThreadsFromObjectRecord',- 'timelineThreads',- targetRecord,- TIMELINE_THREADS_DEFAULT_PAGE_SIZE,- );+ const {+ data,+ error,+ firstQueryLoading,+ isFetchingMore,+ fetchMoreRecords,+ refetch,+ } = useCustomResolver<TimelineThreadsWithTotal>({+ query: getTimelineThreadsFromObjectRecord,+ queryName: 'getTimelineThreadsFromObjectRecord',+ objectName: 'timelineThreads',+ activityTargetableObject: targetRecord,+ pageSize: TIMELINE_THREADS_DEFAULT_PAGE_SIZE,+ });useSubscribeTimelineToParticipantChanges({queryId: `emails-${targetRecord.id}`,@@ -45,6 +52,8 @@ export const EmailsCard = () => {return (<>+ <ToastOnQueryErrorEffect error={error} />+<WidgetHeaderCountEffect count={totalNumberOfThreads} /><EmailsCardContentfirstQueryLoading={firstQueryLoading}diff --git a/packages/twenty-front/src/modules/activities/emails/hooks/__tests__/useEmailComposerState.test.tsx b/packages/twenty-front/src/modules/activities/emails/hooks/__tests__/useEmailComposerState.test.tsxindex 9e0d2008ec7..d20a684cc88 100644--- a/packages/twenty-front/src/modules/activities/emails/hooks/__tests__/useEmailComposerState.test.tsx+++ b/packages/twenty-front/src/modules/activities/emails/hooks/__tests__/useEmailComposerState.test.tsx@@ -5,14 +5,11 @@ import { type ReactNode } from 'react';import { SEND_EMAIL } from '@/activities/emails/graphql/mutations/sendEmail';import { useEmailComposerState } from '@/activities/emails/hooks/useEmailComposerState';-const mockEnqueueSuccessSnackBar = jest.fn();-const mockEnqueueErrorSnackBar = jest.fn();--jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({- enqueueSuccessSnackBar: mockEnqueueSuccessSnackBar,- enqueueErrorSnackBar: mockEnqueueErrorSnackBar,- }),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));jest.mock('@/object-metadata/hooks/useApolloCoreClient', () => ({@@ -119,7 +116,9 @@ describe('useEmailComposerState', () => {});expect(onSent).toHaveBeenCalledWith('message-thread-1');- expect(mockEnqueueErrorSnackBar).not.toHaveBeenCalled();+ expect(mockEnqueueToast).not.toHaveBeenCalledWith(+ expect.objectContaining({ variant: 'error' }),+ );});it('drops a picked alias when the reply moves to another account', () => {diff --git a/packages/twenty-front/src/modules/activities/emails/hooks/__tests__/usePersistedCampaignDraft.test.tsx b/packages/twenty-front/src/modules/activities/emails/hooks/__tests__/usePersistedCampaignDraft.test.tsxindex ccc248d6f3e..f3947ac0e47 100644--- a/packages/twenty-front/src/modules/activities/emails/hooks/__tests__/usePersistedCampaignDraft.test.tsx+++ b/packages/twenty-front/src/modules/activities/emails/hooks/__tests__/usePersistedCampaignDraft.test.tsx@@ -3,14 +3,16 @@ import { act, renderHook } from '@testing-library/react';import { usePersistedCampaignDraft } from '@/activities/emails/hooks/usePersistedCampaignDraft';const mockUpdateOneRecord = jest.fn().mockResolvedValue({});-const mockEnqueueErrorSnackBar = jest.fn();jest.mock('@/object-record/hooks/useUpdateOneRecord', () => ({useUpdateOneRecord: () => ({ updateOneRecord: mockUpdateOneRecord }),}));-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({ enqueueErrorSnackBar: mockEnqueueErrorSnackBar }),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));const campaignId = '20202020-0000-4000-8000-000000000001';diff --git a/packages/twenty-front/src/modules/activities/emails/hooks/useCancelMessageCampaign.ts b/packages/twenty-front/src/modules/activities/emails/hooks/useCancelMessageCampaign.tsindex 3dfc86ffa24..0af68aecd6e 100644--- a/packages/twenty-front/src/modules/activities/emails/hooks/useCancelMessageCampaign.ts+++ b/packages/twenty-front/src/modules/activities/emails/hooks/useCancelMessageCampaign.ts@@ -1,12 +1,12 @@-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { CANCEL_MESSAGE_CAMPAIGN } from '@/activities/emails/graphql/mutations/cancelMessageCampaign';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { plural, t } from '@lingui/core/macro';import { MessageCampaignStatus } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import {type CancelMessageCampaignMutation,type CancelMessageCampaignMutationVariables,@@ -18,7 +18,7 @@ export const useCancelMessageCampaign = () => {CancelMessageCampaignMutationVariables>(CANCEL_MESSAGE_CAMPAIGN);- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { upsertRecordsInStore } = useUpsertRecordsInStore();const cancelMessageCampaign = async ({@@ -38,7 +38,10 @@ export const useCancelMessageCampaign = () => {const canceled = result.data?.cancelMessageCampaign;if (!isDefined(canceled)) {- enqueueErrorSnackBar({ message: t`Failed to cancel campaign` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to cancel campaign`,+ });return false;}@@ -57,15 +60,17 @@ export const useCancelMessageCampaign = () => {});if (wasScheduled) {- enqueueSuccessSnackBar({- message: t`Campaign unscheduled and back in your drafts`,+ enqueueToast({+ variant: 'success',+ children: t`Campaign unscheduled and back in your drafts`,});return true;}- enqueueSuccessSnackBar({- message: plural(canceled.canceledMessageCount, {+ enqueueToast({+ variant: 'success',+ children: plural(canceled.canceledMessageCount, {one: `Campaign canceled, ${canceled.canceledMessageCount} pending email stopped`,other: `Campaign canceled, ${canceled.canceledMessageCount} pending emails stopped`,}),@@ -73,9 +78,7 @@ export const useCancelMessageCampaign = () => {return true;} catch (error) {- enqueueErrorSnackBar({- ...(CombinedGraphQLErrors.is(error) ? { apolloError: error } : {}),- });+ enqueueToast(getToastOptionsFromError({ error }));return false;}diff --git a/packages/twenty-front/src/modules/activities/emails/hooks/usePersistedCampaignDraft.ts b/packages/twenty-front/src/modules/activities/emails/hooks/usePersistedCampaignDraft.tsindex cf7c98d0ea3..9167cd82df9 100644--- a/packages/twenty-front/src/modules/activities/emails/hooks/usePersistedCampaignDraft.ts+++ b/packages/twenty-front/src/modules/activities/emails/hooks/usePersistedCampaignDraft.ts@@ -4,7 +4,7 @@ import { CoreObjectNameSingular } from 'twenty-shared/types';import { type MessageCampaign } from '@/activities/emails/types/MessageCampaign';import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';import { useRecordSeededDraft } from '@/object-record/record-seeded-draft/hooks/useRecordSeededDraft';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useToast } from 'twenty-ui/primitives/feedback';type UsePersistedCampaignDraftArgs<TDraft extends object> = {campaignId: string;@@ -20,7 +20,7 @@ export const usePersistedCampaignDraft = <TDraft extends object>({toUpdateOneRecordInput,}: UsePersistedCampaignDraftArgs<TDraft>) => {const { updateOneRecord } = useUpdateOneRecord();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { draft, updateDraft, flush, draftResyncKey } = useRecordSeededDraft({upstreamDraft: initialDraft(),@@ -30,7 +30,10 @@ export const usePersistedCampaignDraft = <TDraft extends object>({idToUpdate: campaignId,updateOneRecordInput: toUpdateOneRecordInput(nextDraft),}).catch(() =>- enqueueErrorSnackBar({ message: t`Failed to save the campaign` }),+ enqueueToast({+ variant: 'error',+ children: t`Failed to save the campaign`,+ }),);},});diff --git a/packages/twenty-front/src/modules/activities/emails/hooks/useSendEmail.ts b/packages/twenty-front/src/modules/activities/emails/hooks/useSendEmail.tsindex 226614741c8..04238cf4e6b 100644--- a/packages/twenty-front/src/modules/activities/emails/hooks/useSendEmail.ts+++ b/packages/twenty-front/src/modules/activities/emails/hooks/useSendEmail.ts@@ -5,8 +5,8 @@ import { type EmailAttachment } from 'twenty-shared/types';import { SEND_EMAIL } from '@/activities/emails/graphql/mutations/sendEmail';import { getTimelineThreadsFromObjectRecord } from '@/activities/emails/graphql/queries/getTimelineThreadsFromObjectRecord';import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { t } from '@lingui/core/macro';+import { useToast } from 'twenty-ui/primitives/feedback';import {type SendEmailMutation,type SendEmailMutationVariables,@@ -38,7 +38,7 @@ export const useSendEmail = () => {SendEmailMutationVariables>(SEND_EMAIL);- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const sendEmail = useCallback(async (params: SendEmailParams): Promise<SendEmailResult> => {@@ -61,8 +61,9 @@ export const useSendEmail = () => {});if (result.data?.sendEmail.success) {- enqueueSuccessSnackBar({- message: t`Email sent successfully`,+ enqueueToast({+ variant: 'success',+ children: t`Email sent successfully`,});await apolloCoreClient.refetchQueries({@@ -80,25 +81,19 @@ export const useSendEmail = () => {};}- enqueueErrorSnackBar({- message: result.data?.sendEmail.error ?? t`Failed to send email`,+ enqueueToast({+ variant: 'error',+ children: result.data?.sendEmail.error ?? t`Failed to send email`,});return { success: false, messageThreadId: null };} catch {- enqueueErrorSnackBar({- message: t`Failed to send email`,- });+ enqueueToast({ variant: 'error', children: t`Failed to send email` });return { success: false, messageThreadId: null };}},- [- sendEmailMutation,- enqueueSuccessSnackBar,- enqueueErrorSnackBar,- apolloCoreClient,- ],+ [sendEmailMutation, enqueueToast, apolloCoreClient],);return { sendEmail, loading };diff --git a/packages/twenty-front/src/modules/activities/emails/hooks/useSendMessageCampaign.ts b/packages/twenty-front/src/modules/activities/emails/hooks/useSendMessageCampaign.tsindex b2ddbe82e68..1df62676cc6 100644--- a/packages/twenty-front/src/modules/activities/emails/hooks/useSendMessageCampaign.ts+++ b/packages/twenty-front/src/modules/activities/emails/hooks/useSendMessageCampaign.ts@@ -1,22 +1,22 @@-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { SEND_MESSAGE_CAMPAIGN } from '@/activities/emails/graphql/mutations/sendMessageCampaign';import { buildExcludedRecipientReasons } from '@/activities/emails/utils/buildExcludedRecipientReasons';import { formatCampaignSendTime } from '@/activities/emails/utils/formatCampaignSendTime';-import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useDateTimeFormat } from '@/localization/hooks/useDateTimeFormat';import { useNumberFormat } from '@/localization/hooks/useNumberFormat';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { plural, t } from '@lingui/core/macro';import { isNonEmptyString } from '@sniptt/guards';import { MessageCampaignStatus } from 'twenty-shared/types';-import { dateLocaleState } from '~/localization/states/dateLocaleState';+import { useToast } from 'twenty-ui/primitives/feedback';import {type SendMessageCampaignMutation,type SendMessageCampaignMutationVariables,} from '~/generated-metadata/graphql';+import { dateLocaleState } from '~/localization/states/dateLocaleState';type SendMessageCampaignParams = {campaignId: string;@@ -30,7 +30,7 @@ export const useSendMessageCampaign = () => {SendMessageCampaignMutationVariables>(SEND_MESSAGE_CAMPAIGN);- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { upsertRecordsInStore } = useUpsertRecordsInStore();const { formatNumber } = useNumberFormat();const { dateFormat, timeFormat, timeZone } = useDateTimeFormat();@@ -49,7 +49,10 @@ export const useSendMessageCampaign = () => {const queued = result.data?.sendMessageCampaign;if (!queued) {- enqueueErrorSnackBar({ message: t`Failed to send campaign` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to send campaign`,+ });return false;}@@ -84,14 +87,16 @@ export const useSendMessageCampaign = () => {localeCatalog,});- enqueueSuccessSnackBar({- message: wasAlreadyScheduled+ enqueueToast({+ variant: 'success',+ children: wasAlreadyScheduled? t`Campaign moved to ${sendTime}`: t`Campaign scheduled for ${sendTime}`,});} else if (queuedCount === 0) {- enqueueErrorSnackBar({- message: t`No recipients to send to (${skipReasons})`,+ enqueueToast({+ variant: 'error',+ children: t`No recipients to send to (${skipReasons})`,});} else {const queuedMessage = plural(queuedCount, {@@ -99,8 +104,9 @@ export const useSendMessageCampaign = () => {other: `Campaign queued to ${formatNumber(queuedCount)} recipients`,});- enqueueSuccessSnackBar({- message:+ enqueueToast({+ variant: 'success',+ children:skipReasons.length > 0? t`${queuedMessage}, skipping ${skipReasons}`: queuedMessage,@@ -109,9 +115,7 @@ export const useSendMessageCampaign = () => {return true;} catch (error) {- enqueueErrorSnackBar({- ...(CombinedGraphQLErrors.is(error) ? { apolloError: error } : {}),- });+ enqueueToast(getToastOptionsFromError({ error }));return false;}diff --git a/packages/twenty-front/src/modules/activities/emails/hooks/useSendMessageCampaignTest.ts b/packages/twenty-front/src/modules/activities/emails/hooks/useSendMessageCampaignTest.tsindex 082035a5974..8ab01b5ba20 100644--- a/packages/twenty-front/src/modules/activities/emails/hooks/useSendMessageCampaignTest.ts+++ b/packages/twenty-front/src/modules/activities/emails/hooks/useSendMessageCampaignTest.ts@@ -1,9 +1,9 @@-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { SEND_MESSAGE_CAMPAIGN_TEST } from '@/activities/emails/graphql/mutations/sendMessageCampaignTest';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { t } from '@lingui/core/macro';+import { useToast } from 'twenty-ui/primitives/feedback';import {type SendMessageCampaignTestMutation,type SendMessageCampaignTestMutationVariables,@@ -23,7 +23,7 @@ export const useSendMessageCampaignTest = () => {SendMessageCampaignTestMutationVariables>(SEND_MESSAGE_CAMPAIGN_TEST);- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const sendMessageCampaignTest = async (params: SendMessageCampaignTestParams,@@ -34,20 +34,22 @@ export const useSendMessageCampaignTest = () => {});if (!result.data?.sendMessageCampaignTest) {- enqueueErrorSnackBar({ message: t`Failed to send test email` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to send test email`,+ });return false;}- enqueueSuccessSnackBar({- message: t`Test email sent to ${params.toAddress}`,+ enqueueToast({+ variant: 'success',+ children: t`Test email sent to ${params.toAddress}`,});return true;} catch (error) {- enqueueErrorSnackBar({- ...(CombinedGraphQLErrors.is(error) ? { apolloError: error } : {}),- });+ enqueueToast(getToastOptionsFromError({ error }));return false;}diff --git a/packages/twenty-front/src/modules/activities/emails/hooks/useUploadEmailAttachment.ts b/packages/twenty-front/src/modules/activities/emails/hooks/useUploadEmailAttachment.tsindex 194e71f9017..3aae5e2ae39 100644--- a/packages/twenty-front/src/modules/activities/emails/hooks/useUploadEmailAttachment.ts+++ b/packages/twenty-front/src/modules/activities/emails/hooks/useUploadEmailAttachment.ts@@ -4,13 +4,13 @@ import { type EmailAttachment } from 'twenty-shared/types';import { MAX_ATTACHMENT_SIZE } from '@/advanced-text-editor/utils/maxAttachmentSize';import { useDirectFileUpload } from '@/file/hooks/useDirectFileUpload';import { formatFileSize } from '@/file/utils/formatFileSize';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useToast } from 'twenty-ui/primitives/feedback';import { FileFolder } from '~/generated-metadata/graphql';import { logError } from '~/utils/logError';export const useUploadEmailAttachment = () => {const { uploadFile: directUploadFile } = useDirectFileUpload();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { t } = useLingui();const uploadEmailAttachment = async (@@ -21,8 +21,9 @@ export const useUploadEmailAttachment = () => {const fileName = file.name;const maxUploadSize = formatFileSize(MAX_ATTACHMENT_SIZE);- enqueueErrorSnackBar({- message: t`File "${fileName}" exceeds ${maxUploadSize}`,+ enqueueToast({+ variant: 'error',+ children: t`File "${fileName}" exceeds ${maxUploadSize}`,});return null;@@ -39,8 +40,9 @@ export const useUploadEmailAttachment = () => {const fileName = file.name;- enqueueSuccessSnackBar({- message: t`File "${fileName}" uploaded successfully`,+ enqueueToast({+ variant: 'success',+ children: t`File "${fileName}" uploaded successfully`,});return attachment;@@ -49,8 +51,9 @@ export const useUploadEmailAttachment = () => {const fileNameForError = file.name;- enqueueErrorSnackBar({- message: t`Failed to upload "${fileNameForError}"`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to upload "${fileNameForError}"`,});return null;diff --git a/packages/twenty-front/src/modules/activities/emails/hooks/useUploadEmailImage.ts b/packages/twenty-front/src/modules/activities/emails/hooks/useUploadEmailImage.tsindex 1c9d5565b84..87e690e234a 100644--- a/packages/twenty-front/src/modules/activities/emails/hooks/useUploadEmailImage.ts+++ b/packages/twenty-front/src/modules/activities/emails/hooks/useUploadEmailImage.ts@@ -4,14 +4,14 @@ import { FileFolder } from '~/generated-metadata/graphql';import { type UploadedImage } from '@/advanced-text-editor/types/UploadedImage';import { MAX_ATTACHMENT_SIZE } from '@/advanced-text-editor/utils/maxAttachmentSize';-import { formatFileSize } from '@/file/utils/formatFileSize';import { useDirectFileUpload } from '@/file/hooks/useDirectFileUpload';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { formatFileSize } from '@/file/utils/formatFileSize';+import { useToast } from 'twenty-ui/primitives/feedback';import { logError } from '~/utils/logError';export const useUploadEmailImage = () => {const { uploadFile } = useDirectFileUpload();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const uploadEmailImage = async (file: File): Promise<UploadedImage> => {if (@@ -19,7 +19,7 @@ export const useUploadEmailImage = () => {file.type as (typeof EMAIL_IMAGE_MIME_TYPES)[number],)) {- enqueueErrorSnackBar({ message: t`Unsupported image format` });+ enqueueToast({ variant: 'error', children: t`Unsupported image format` });throw new Error(`Unsupported email image MIME type: ${file.type}`);}@@ -28,8 +28,9 @@ export const useUploadEmailImage = () => {const fileName = file.name;const maxUploadSize = formatFileSize(MAX_ATTACHMENT_SIZE);- enqueueErrorSnackBar({- message: t`Image "${fileName}" exceeds ${maxUploadSize}`,+ enqueueToast({+ variant: 'error',+ children: t`Image "${fileName}" exceeds ${maxUploadSize}`,});throw new Error('Email image exceeds the maximum upload size');@@ -45,7 +46,10 @@ export const useUploadEmailImage = () => {const fileName = file.name;logError(`Failed to upload email image "${fileName}": ${error}`);- enqueueErrorSnackBar({ message: t`Failed to upload "${fileName}"` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to upload "${fileName}"`,+ });throw error;}diff --git a/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientChipMenuContent.tsx b/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientChipMenuContent.tsxindex 90b44b8c9dd..c39d1b6a089 100644--- a/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientChipMenuContent.tsx+++ b/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientChipMenuContent.tsx@@ -8,11 +8,11 @@ import { MenuItem, MenuItemAvatar } from 'twenty-ui/primitives/navigation';import { type EmailRecipientResolution } from '@/activities/emails/recipients/hooks/useEmailRecipientsResolution';import { type EmailRecipient } from '@/activities/emails/recipients/types/EmailRecipient';import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';+import { useToast } from 'twenty-ui/primitives/feedback';import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';import { getAbsoluteImageUrl } from '~/utils/image/getAbsoluteImageUrl';@@ -36,7 +36,7 @@ export const EmailRecipientChipMenuContent = ({const { t } = useLingui();const { closeDropdown } = useCloseDropdown();const { copyToClipboard } = useCopyToClipboard();- const { enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { createOneRecord: createPerson } = useCreateOneRecord({objectNameSingular: CoreObjectNameSingular.Person,@@ -65,7 +65,7 @@ export const EmailRecipientChipMenuContent = ({});if (isDefined(createdPerson)) {- enqueueSuccessSnackBar({ message: t`Person created` });+ enqueueToast({ variant: 'success', children: t`Person created` });}};diff --git a/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientSuggestionMenuItem.tsx b/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientSuggestionMenuItem.tsxindex 952bb6f3d80..5225c0a435f 100644--- a/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientSuggestionMenuItem.tsx+++ b/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientSuggestionMenuItem.tsx@@ -1,7 +1,7 @@import { Avatar } from 'twenty-ui/primitives/data-display';import { MenuItemSelectAvatar } from 'twenty-ui/primitives/navigation';-import { type EmailRecipientSuggestion } from '@/activities/emails/recipients/hooks/useEmailRecipientSuggestions';+import { type EmailRecipientSuggestion } from '@/activities/emails/recipients/types/EmailRecipientSuggestion';import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';import { isSelectedItemIdComponentFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState';import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue';diff --git a/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientSuggestionsDropdownContent.tsx b/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientSuggestionsDropdownContent.tsxindex 9009a8ea5f9..be9da7c4827 100644--- a/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientSuggestionsDropdownContent.tsx+++ b/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientSuggestionsDropdownContent.tsx@@ -2,7 +2,7 @@ import { useLingui } from '@lingui/react/macro';import { MenuItem } from 'twenty-ui/primitives/navigation';import { EmailRecipientSuggestionMenuItem } from '@/activities/emails/recipients/components/EmailRecipientSuggestionMenuItem';-import { type EmailRecipientSuggestion } from '@/activities/emails/recipients/hooks/useEmailRecipientSuggestions';+import { type EmailRecipientSuggestion } from '@/activities/emails/recipients/types/EmailRecipientSuggestion';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList';diff --git a/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientsFieldInput.tsx b/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientsFieldInput.tsxindex 4076767f63c..06f62c3f999 100644--- a/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientsFieldInput.tsx+++ b/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientsFieldInput.tsx@@ -1,3 +1,5 @@+import { type EmailRecipientSuggestion } from '@/activities/emails/recipients/types/EmailRecipientSuggestion';+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { pointerIntersection } from '@dnd-kit/collision';import { useDroppable } from '@dnd-kit/react';import { styled } from '@linaria/react';@@ -27,10 +29,7 @@ import {import { EmailRecipientSuggestionsDropdownContent } from '@/activities/emails/recipients/components/EmailRecipientSuggestionsDropdownContent';import { useEmailRecipientsField } from '@/activities/emails/recipients/hooks/useEmailRecipientsField';import { useEmailRecipientsResolution } from '@/activities/emails/recipients/hooks/useEmailRecipientsResolution';-import {- type EmailRecipientSuggestion,- useEmailRecipientSuggestions,-} from '@/activities/emails/recipients/hooks/useEmailRecipientSuggestions';+import { useEmailRecipientSuggestions } from '@/activities/emails/recipients/hooks/useEmailRecipientSuggestions';import { type EmailComposerContextRecord } from '@/activities/emails/recipients/types/EmailComposerContextRecord';import { type EmailRecipient } from '@/activities/emails/recipients/types/EmailRecipient';import { type EmailRecipientsFieldId } from '@/activities/emails/recipients/types/EmailRecipientsFieldId';@@ -200,7 +199,7 @@ export const EmailRecipientsFieldInput = ({recipients,});- const { suggestions } = useEmailRecipientSuggestions({+ const { suggestions, error } = useEmailRecipientSuggestions({searchInput: isEditing ? '' : suggestionsSearchInput,excludedRecipientKeys: excludedSuggestionKeys,contextRecord,@@ -627,33 +626,36 @@ export const EmailRecipientsFieldInput = ({}return (- <FormFieldInputContainer>- <Dropdown- dropdownId={suggestionsDropdownId}- dropdownPlacement="bottom-start"- dropdownOffset={{ y: 4 }}- disableClickForClickableComponent- clickableComponentWidth="100%"- onClose={resetSelectedItem}- clickableComponent={- <StyledRowContainer- ref={droppableRef}- $isDropTarget={isActiveDropField}- data-drop-target={isActiveDropField}- onMouseDown={handleRowMouseDown}- >- {rowChildren}- </StyledRowContainer>- }- dropdownComponents={- <EmailRecipientSuggestionsDropdownContent- suggestions={suggestions}- selectableListInstanceId={suggestionsDropdownId}- focusId={suggestionsDropdownId}- onPick={handlePickSuggestion}- />- }- />- </FormFieldInputContainer>+ <>+ <ToastOnQueryErrorEffect error={error} />+ <FormFieldInputContainer>+ <Dropdown+ dropdownId={suggestionsDropdownId}+ dropdownPlacement="bottom-start"+ dropdownOffset={{ y: 4 }}+ disableClickForClickableComponent+ clickableComponentWidth="100%"+ onClose={resetSelectedItem}+ clickableComponent={+ <StyledRowContainer+ ref={droppableRef}+ $isDropTarget={isActiveDropField}+ data-drop-target={isActiveDropField}+ onMouseDown={handleRowMouseDown}+ >+ {rowChildren}+ </StyledRowContainer>+ }+ dropdownComponents={+ <EmailRecipientSuggestionsDropdownContent+ suggestions={suggestions}+ selectableListInstanceId={suggestionsDropdownId}+ focusId={suggestionsDropdownId}+ onPick={handlePickSuggestion}+ />+ }+ />+ </FormFieldInputContainer>+ </>);};diff --git a/packages/twenty-front/src/modules/activities/emails/recipients/hooks/useEmailRecipientSuggestions.ts b/packages/twenty-front/src/modules/activities/emails/recipients/hooks/useEmailRecipientSuggestions.tsindex 48004df9319..968b1507696 100644--- a/packages/twenty-front/src/modules/activities/emails/recipients/hooks/useEmailRecipientSuggestions.ts+++ b/packages/twenty-front/src/modules/activities/emails/recipients/hooks/useEmailRecipientSuggestions.ts@@ -1,3 +1,4 @@+import { type EmailRecipientSuggestion } from '@/activities/emails/recipients/types/EmailRecipientSuggestion';import { t } from '@lingui/core/macro';import { isNonEmptyString } from '@sniptt/guards';import { CoreObjectNameSingular } from 'twenty-shared/types';@@ -6,7 +7,6 @@ import { isDefined } from 'twenty-shared/utils';import { EMAIL_RECIPIENT_MEMBER_SUGGESTIONS_LIMIT } from '@/activities/emails/recipients/constants/EmailRecipientMemberSuggestionsLimit';import { EMAIL_RECIPIENT_PEOPLE_SUGGESTIONS_LIMIT } from '@/activities/emails/recipients/constants/EmailRecipientPeopleSuggestionsLimit';import { type EmailComposerContextRecord } from '@/activities/emails/recipients/types/EmailComposerContextRecord';-import { type EmailRecipient } from '@/activities/emails/recipients/types/EmailRecipient';import { type EmailRecipientPerson } from '@/activities/emails/recipients/types/EmailRecipientPerson';import { getEmailRecipientKey } from '@/activities/emails/recipients/utils/getEmailRecipientKey';import { getEmailRecipientPersonFromRecord } from '@/activities/emails/recipients/utils/getEmailRecipientPersonFromRecord';@@ -17,15 +17,6 @@ import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';import { useObjectRecordSearchRecords } from '@/object-record/hooks/useObjectRecordSearchRecords';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-export type EmailRecipientSuggestion = {- suggestionId: string;- recipient: EmailRecipient;- label: string;- secondaryText: string;- avatarUrl: string | null;- avatarColorSeed: string;-};-type UseEmailRecipientSuggestionsArgs = {searchInput: string;excludedRecipientKeys: string[];@@ -119,7 +110,7 @@ export const useEmailRecipientSuggestions = ({skip: !isDefined(contextCompanyId),});- const { searchRecords } = useObjectRecordSearchRecords({+ const { searchRecords, error } = useObjectRecordSearchRecords({objectNameSingulars: [CoreObjectNameSingular.Person,CoreObjectNameSingular.WorkspaceMember,@@ -235,7 +226,7 @@ export const useEmailRecipientSuggestions = ({!excludedKeySet.has(literalKey);if (!bufferIsAddableAddress) {- return { suggestions: dedupedRecordSuggestions };+ return { suggestions: dedupedRecordSuggestions, error };}const exactMatchSuggestion = dedupedRecordSuggestions.find(@@ -253,6 +244,7 @@ export const useEmailRecipientSuggestions = ({};return {+ error,suggestions: [firstSuggestion,...dedupedRecordSuggestions.filter(diff --git a/packages/twenty-front/src/modules/activities/emails/recipients/types/EmailRecipientSuggestion.ts b/packages/twenty-front/src/modules/activities/emails/recipients/types/EmailRecipientSuggestion.tsnew file mode 100644index 00000000000..43600266439--- /dev/null+++ b/packages/twenty-front/src/modules/activities/emails/recipients/types/EmailRecipientSuggestion.ts@@ -0,0 +1,10 @@+import { type EmailRecipient } from '@/activities/emails/recipients/types/EmailRecipient';++export type EmailRecipientSuggestion = {+ suggestionId: string;+ recipient: EmailRecipient;+ label: string;+ secondaryText: string;+ avatarUrl: string | null;+ avatarColorSeed: string;+};diff --git a/packages/twenty-front/src/modules/activities/hooks/__tests__/useCustomResolver.test.tsx b/packages/twenty-front/src/modules/activities/hooks/__tests__/useCustomResolver.test.tsxindex 455152b886b..c6b202399eb 100644--- a/packages/twenty-front/src/modules/activities/hooks/__tests__/useCustomResolver.test.tsx+++ b/packages/twenty-front/src/modules/activities/hooks/__tests__/useCustomResolver.test.tsx@@ -11,10 +11,6 @@ jest.mock('@/object-metadata/hooks/useApolloCoreClient', () => ({useApolloCoreClient: jest.fn(() => ({})),}));-jest.mock('@/apollo/hooks/useSnackBarOnQueryError', () => ({- useSnackBarOnQueryError: jest.fn(),-}));-const useQueryMock = jest.requireMock('@apollo/client/react').useQuery;describe('useCustomResolver', () => {@@ -33,13 +29,16 @@ describe('useCustomResolver', () => {it('queries the timeline resolver by object name and record id for any object', () => {renderHook(() =>- useCustomResolver(- getTimelineThreadsFromObjectRecord,- 'getTimelineThreadsFromObjectRecord',- 'timelineThreads',- { id: 'record-id', targetObjectNameSingular: 'peopleList' },- 10,- ),+ useCustomResolver({+ query: getTimelineThreadsFromObjectRecord,+ queryName: 'getTimelineThreadsFromObjectRecord',+ objectName: 'timelineThreads',+ activityTargetableObject: {+ id: 'record-id',+ targetObjectNameSingular: 'peopleList',+ },+ pageSize: 10,+ }),);expect(useQueryMock).toHaveBeenCalledWith(diff --git a/packages/twenty-front/src/modules/activities/hooks/useCustomResolver.ts b/packages/twenty-front/src/modules/activities/hooks/useCustomResolver.tsindex 480cad40919..f68e0ccbb05 100644--- a/packages/twenty-front/src/modules/activities/hooks/useCustomResolver.ts+++ b/packages/twenty-front/src/modules/activities/hooks/useCustomResolver.ts@@ -1,5 +1,6 @@import {type DocumentNode,+ type ErrorLike,type OperationVariables,type TypedDocumentNode,} from '@apollo/client';@@ -7,7 +8,6 @@ import { useQuery } from '@apollo/client/react';import { useState } from 'react';import { type ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';-import { useSnackBarOnQueryError } from '@/apollo/hooks/useSnackBarOnQueryError';import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';type CustomResolverQueryResult<@@ -22,15 +22,22 @@ export const useCustomResolver = <T extends {[key: string]: any;},->(+>({+ query,+ queryName,+ objectName,+ activityTargetableObject,+ pageSize,+}: {query:| DocumentNode- | TypedDocumentNode<CustomResolverQueryResult<T>, OperationVariables>,- queryName: string,- objectName: string,- activityTargetableObject: ActivityTargetableObject,- pageSize: number,-): {+ | TypedDocumentNode<CustomResolverQueryResult<T>, OperationVariables>;+ queryName: string;+ objectName: string;+ activityTargetableObject: ActivityTargetableObject;+ pageSize: number;+}): {+ error: ErrorLike | undefined;data: CustomResolverQueryResult<T> | undefined;firstQueryLoading: boolean;isFetchingMore: boolean;@@ -62,8 +69,6 @@ export const useCustomResolver = <const firstQueryLoading = loading && !data;- useSnackBarOnQueryError(error);-const fetchMoreRecords = async () => {if (page.hasNextPage && !isFetchingMore && !firstQueryLoading) {setIsFetchingMore(true);@@ -110,6 +115,7 @@ export const useCustomResolver = <};return {+ error,data,firstQueryLoading,isFetchingMore,diff --git a/packages/twenty-front/src/modules/activities/tasks/components/__stories__/TaskGroups.stories.tsx b/packages/twenty-front/src/modules/activities/tasks/components/__stories__/TaskGroups.stories.tsxindex f21d7a15ce9..6d0ab441ae1 100644--- a/packages/twenty-front/src/modules/activities/tasks/components/__stories__/TaskGroups.stories.tsx+++ b/packages/twenty-front/src/modules/activities/tasks/components/__stories__/TaskGroups.stories.tsx@@ -2,13 +2,13 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';import { TaskGroups } from '@/activities/tasks/components/TaskGroups';import { type ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';+import { getRecordFromRecordNode } from '@/object-record/cache/utils/getRecordFromRecordNode';import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext';import { TabListComponentInstanceContext } from '@/ui/layout/tab-list/states/contexts/TabListComponentInstanceContext';import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';import { SidePanelDecorator } from '~/testing/decorators/SidePanelDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';-import { getRecordFromRecordNode } from '@/object-record/cache/utils/getRecordFromRecordNode';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';import { mockedPersonRecords } from '~/testing/mock-data/generated/data/people/mock-people-data';@@ -30,7 +30,7 @@ const meta: Meta<typeof TaskGroups> = {ComponentWithRouterDecorator,ObjectMetadataItemsDecorator,SidePanelDecorator,- SnackBarDecorator,+ ToastDecorator,],};diff --git a/packages/twenty-front/src/modules/activities/tasks/components/__stories__/TaskList.stories.tsx b/packages/twenty-front/src/modules/activities/tasks/components/__stories__/TaskList.stories.tsxindex bd819dfe738..2c0fb454c14 100644--- a/packages/twenty-front/src/modules/activities/tasks/components/__stories__/TaskList.stories.tsx+++ b/packages/twenty-front/src/modules/activities/tasks/components/__stories__/TaskList.stories.tsx@@ -8,7 +8,7 @@ import { ContextStoreDecorator } from '~/testing/decorators/ContextStoreDecoratoimport { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';import { SidePanelDecorator } from '~/testing/decorators/SidePanelDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';import { mockedTaskRecords } from '~/testing/mock-data/generated/data/tasks/mock-tasks-data';@@ -24,7 +24,7 @@ const meta: Meta<typeof TaskList> = {ContextStoreDecorator,MemoryRouterDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,SidePanelDecorator,],args: {diff --git a/packages/twenty-front/src/modules/activities/timeline-activities/components/__stories__/TimelineActivities.stories.tsx b/packages/twenty-front/src/modules/activities/timeline-activities/components/__stories__/TimelineActivities.stories.tsxindex 92031398ada..3ee71dccb17 100644--- a/packages/twenty-front/src/modules/activities/timeline-activities/components/__stories__/TimelineActivities.stories.tsx+++ b/packages/twenty-front/src/modules/activities/timeline-activities/components/__stories__/TimelineActivities.stories.tsx@@ -3,14 +3,14 @@ import { HttpResponse, graphql } from 'msw';import { TimelineCard } from '@/activities/timeline-activities/components/TimelineCard';import { TimelineActivityContext } from '@/activities/timeline-activities/contexts/TimelineActivityContext';-import { CoreObjectNameSingular } from 'twenty-shared/types';import { LayoutRenderingProvider } from '@/ui/layout/contexts/LayoutRenderingContext';+import { CoreObjectNameSingular } from 'twenty-shared/types';import { ComponentDecorator } from 'twenty-ui/testing';import { PageLayoutType } from '~/generated-metadata/graphql';+import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { mockedTimelineActivityRecords } from '~/testing/mock-data/generated/data/timelineActivities/mock-timelineActivities-data';-import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';const meta: Meta<typeof TimelineCard> = {title: 'Modules/TimelineActivities/TimelineCard',@@ -19,7 +19,7 @@ const meta: Meta<typeof TimelineCard> = {MemoryRouterDecorator,ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,(Story) => {return (<LayoutRenderingProviderdiff --git a/packages/twenty-front/src/modules/activities/timeline-activities/rows/calendar/components/__stories__/EventCardCalendarEvent.stories.tsx b/packages/twenty-front/src/modules/activities/timeline-activities/rows/calendar/components/__stories__/EventCardCalendarEvent.stories.tsxindex b687e035bb5..30f71bd5bc3 100644--- a/packages/twenty-front/src/modules/activities/timeline-activities/rows/calendar/components/__stories__/EventCardCalendarEvent.stories.tsx+++ b/packages/twenty-front/src/modules/activities/timeline-activities/rows/calendar/components/__stories__/EventCardCalendarEvent.stories.tsx@@ -5,7 +5,7 @@ import { ComponentDecorator } from 'twenty-ui/testing';import { EventCardCalendarEvent } from '@/activities/timeline-activities/rows/calendar/components/EventCardCalendarEvent';import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const meta: Meta<typeof EventCardCalendarEvent> = {title: 'Modules/TimelineActivities/Rows/CalendarEvent/EventCardCalendarEvent',@@ -14,7 +14,7 @@ const meta: Meta<typeof EventCardCalendarEvent> = {MemoryRouterDecorator,ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,],};diff --git a/packages/twenty-front/src/modules/activities/timeline-activities/rows/main-object/components/__stories__/EventRowMainObjectUpdated.stories.tsx b/packages/twenty-front/src/modules/activities/timeline-activities/rows/main-object/components/__stories__/EventRowMainObjectUpdated.stories.tsxindex 48f358da501..1f1f53076cf 100644--- a/packages/twenty-front/src/modules/activities/timeline-activities/rows/main-object/components/__stories__/EventRowMainObjectUpdated.stories.tsx+++ b/packages/twenty-front/src/modules/activities/timeline-activities/rows/main-object/components/__stories__/EventRowMainObjectUpdated.stories.tsx@@ -3,7 +3,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { getTestEnrichedObjectMetadataItemsMock } from '~/testing/utils/getTestEnrichedObjectMetadataItemsMock';const meta: Meta<typeof EventRowMainObjectUpdated> = {@@ -40,7 +40,7 @@ const meta: Meta<typeof EventRowMainObjectUpdated> = {decorators: [ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,RouterDecorator,],};diff --git a/packages/twenty-front/src/modules/activities/timeline-activities/rows/message/components/__stories__/EventCardMessage.stories.tsx b/packages/twenty-front/src/modules/activities/timeline-activities/rows/message/components/__stories__/EventCardMessage.stories.tsxindex 311d55bef96..e9b38116d5b 100644--- a/packages/twenty-front/src/modules/activities/timeline-activities/rows/message/components/__stories__/EventCardMessage.stories.tsx+++ b/packages/twenty-front/src/modules/activities/timeline-activities/rows/message/components/__stories__/EventCardMessage.stories.tsx@@ -8,7 +8,7 @@ import { TimelineActivityContext } from '@/activities/timeline-activities/conteximport { EventCardMessage } from '@/activities/timeline-activities/rows/message/components/EventCardMessage';import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const meta: Meta<typeof EventCardMessage> = {title: 'Modules/TimelineActivities/Rows/Message/EventCardMessage',@@ -17,7 +17,7 @@ const meta: Meta<typeof EventCardMessage> = {MemoryRouterDecorator,ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,(Story) => (<TimelineActivityContext.Provider value={{ recordId: 'mock-id' }}><Story />diff --git a/packages/twenty-front/src/modules/advanced-text-editor/components/__stories__/AdvancedTextEditor.stories.tsx b/packages/twenty-front/src/modules/advanced-text-editor/components/__stories__/AdvancedTextEditor.stories.tsxindex ce2e830a5b8..22c4f06156e 100644--- a/packages/twenty-front/src/modules/advanced-text-editor/components/__stories__/AdvancedTextEditor.stories.tsx+++ b/packages/twenty-front/src/modules/advanced-text-editor/components/__stories__/AdvancedTextEditor.stories.tsx@@ -4,10 +4,10 @@ import { type AdvancedTextEditorProfile } from '@/advanced-text-editor/types/Advimport { buildFullRichTextWithVariableTagExtensions } from '@/advanced-text-editor/utils/buildFullRichTextExtensions';import { type Meta, type StoryObj } from '@storybook/react-vite';import { expect, fn, userEvent, waitFor } from 'storybook/test';-import { isDefined, TIPTAP_DOCUMENT_SCHEMA_VERSION } from 'twenty-shared/utils';+import { TIPTAP_DOCUMENT_SCHEMA_VERSION, isDefined } from 'twenty-shared/utils';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/WorkflowStepActionDrawerDecorator';import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';@@ -89,7 +89,7 @@ const meta: Meta<typeof EditorWrapper> = {WorkflowStepDecorator,ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,RouterDecorator,WorkspaceDecorator,],diff --git a/packages/twenty-front/src/modules/advanced-text-editor/components/__stories__/FormAdvancedTextFieldInput.stories.tsx b/packages/twenty-front/src/modules/advanced-text-editor/components/__stories__/FormAdvancedTextFieldInput.stories.tsxindex 788108588df..5b2e205fb86 100644--- a/packages/twenty-front/src/modules/advanced-text-editor/components/__stories__/FormAdvancedTextFieldInput.stories.tsx+++ b/packages/twenty-front/src/modules/advanced-text-editor/components/__stories__/FormAdvancedTextFieldInput.stories.tsx@@ -2,12 +2,12 @@ import { FormAdvancedTextFieldInput } from '@/advanced-text-editor/components/Foimport { type AdvancedTextEditorProfile } from '@/advanced-text-editor/types/AdvancedTextEditorProfile';import { buildFullRichTextWithVariableTagExtensions } from '@/advanced-text-editor/utils/buildFullRichTextExtensions';import { type Meta, type StoryObj } from '@storybook/react-vite';-import { graphql, HttpResponse } from 'msw';+import { HttpResponse, graphql } from 'msw';import { expect, fn, userEvent, within } from 'storybook/test';import { TIPTAP_DOCUMENT_SCHEMA_VERSION } from 'twenty-shared/utils';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/WorkflowStepActionDrawerDecorator';import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';@@ -113,7 +113,7 @@ const meta: Meta<typeof FormAdvancedTextFieldInput> = {WorkflowStepDecorator,ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,RouterDecorator,WorkspaceDecorator,],diff --git a/packages/twenty-front/src/modules/ai/components/__stories__/AiChatMessage.stories.tsx b/packages/twenty-front/src/modules/ai/components/__stories__/AiChatMessage.stories.tsxindex 9eae38d1bd9..ff6370aeb55 100644--- a/packages/twenty-front/src/modules/ai/components/__stories__/AiChatMessage.stories.tsx+++ b/packages/twenty-front/src/modules/ai/components/__stories__/AiChatMessage.stories.tsx@@ -20,7 +20,7 @@ import { currentAiChatThreadState } from '@/ai/states/currentAiChatThreadState';import { styled } from '@linaria/react';import { useStore } from 'jotai';import { RootDecorator } from '~/testing/decorators/RootDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const StyledConversationContainer = styled.div`display: flex;@@ -301,7 +301,7 @@ const meta: Meta<typeof AiChatMessage> = {decorators: [ComponentDecorator,RootDecorator,- SnackBarDecorator,+ ToastDecorator,AgentChatInstanceDecorator,],parameters: {diff --git a/packages/twenty-front/src/modules/ai/components/__stories__/AiChatQuestionCard.stories.tsx b/packages/twenty-front/src/modules/ai/components/__stories__/AiChatQuestionCard.stories.tsxindex c0c70887bb6..fa1007c5de2 100644--- a/packages/twenty-front/src/modules/ai/components/__stories__/AiChatQuestionCard.stories.tsx+++ b/packages/twenty-front/src/modules/ai/components/__stories__/AiChatQuestionCard.stories.tsx@@ -13,7 +13,7 @@ import { type AgentChatPendingQuestion } from '@/ai/types/AgentChatPendingQuestiimport { styled } from '@linaria/react';import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';import { RootDecorator } from '~/testing/decorators/RootDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const StyledContainer = styled.div`max-width: 400px;@@ -120,7 +120,7 @@ const meta: Meta<typeof AiChatQuestionCard> = {</StoreSeeder></AgentChatComponentInstanceContext.Provider>),- SnackBarDecorator,+ ToastDecorator,ComponentDecorator,MemoryRouterDecorator,RootDecorator,diff --git a/packages/twenty-front/src/modules/ai/components/__stories__/AiChatTab.stories.tsx b/packages/twenty-front/src/modules/ai/components/__stories__/AiChatTab.stories.tsxindex 69598b5b468..fbd52079c49 100644--- a/packages/twenty-front/src/modules/ai/components/__stories__/AiChatTab.stories.tsx+++ b/packages/twenty-front/src/modules/ai/components/__stories__/AiChatTab.stories.tsx@@ -11,10 +11,10 @@ import { AgentChatComponentInstanceContext } from '@/ai/contexts/AgentChatComponimport { AiChatSurfaceContext } from '@/ai/contexts/AiChatSurfaceContext';import { hasRequestedWorkspaceSetupChatState } from '@/onboarding/states/hasRequestedWorkspaceSetupChatState';import { shouldOpenAiChatAfterOnboardingState } from '@/onboarding/states/shouldOpenAiChatAfterOnboardingState';-import { RootDecorator } from '~/testing/decorators/RootDecorator';-import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';+import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';+import { RootDecorator } from '~/testing/decorators/RootDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const WorkspaceSetupChatStory = () => {const store = useStore();@@ -50,7 +50,7 @@ const meta = {decorators: [ComponentDecorator,RootDecorator,- SnackBarDecorator,+ ToastDecorator,MemoryRouterDecorator,],parameters: { container: { width: 480, height: 700 } },diff --git a/packages/twenty-front/src/modules/ai/components/__stories__/CodeExecutionDisplay.stories.tsx b/packages/twenty-front/src/modules/ai/components/__stories__/CodeExecutionDisplay.stories.tsxindex 78dca7bd078..bcb296eb8ec 100644--- a/packages/twenty-front/src/modules/ai/components/__stories__/CodeExecutionDisplay.stories.tsx+++ b/packages/twenty-front/src/modules/ai/components/__stories__/CodeExecutionDisplay.stories.tsx@@ -4,7 +4,7 @@ import { ComponentDecorator } from 'twenty-ui/testing';import { CodeExecutionDisplay } from '@/ai/components/CodeExecutionDisplay';import { ARGOS_CAPTURE_DISABLED } from '~/testing/constants/ArgosCaptureDisabled';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const samplePythonCode = `import pandas as pdimport matplotlib.pyplot as plt@@ -31,7 +31,7 @@ plt.savefig('revenue_chart.png')`;const meta: Meta<typeof CodeExecutionDisplay> = {title: 'Modules/AI/CodeExecutionDisplay',component: CodeExecutionDisplay,- decorators: [SnackBarDecorator, ComponentDecorator],+ decorators: [ToastDecorator, ComponentDecorator],parameters: {argos: ARGOS_CAPTURE_DISABLED,container: { width: 600 },diff --git a/packages/twenty-front/src/modules/ai/components/__stories__/TerminalOutput.stories.tsx b/packages/twenty-front/src/modules/ai/components/__stories__/TerminalOutput.stories.tsxindex 61b7e0cbbd6..72cbd41050e 100644--- a/packages/twenty-front/src/modules/ai/components/__stories__/TerminalOutput.stories.tsx+++ b/packages/twenty-front/src/modules/ai/components/__stories__/TerminalOutput.stories.tsx@@ -3,12 +3,12 @@ import { expect, userEvent, within } from 'storybook/test';import { ComponentDecorator } from 'twenty-ui/testing';import { TerminalOutput } from '@/ai/components/TerminalOutput';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const meta: Meta<typeof TerminalOutput> = {title: 'Modules/AI/TerminalOutput',component: TerminalOutput,- decorators: [SnackBarDecorator, ComponentDecorator],+ decorators: [ToastDecorator, ComponentDecorator],parameters: {container: { width: 500 },},diff --git a/packages/twenty-front/src/modules/ai/dictation/components/AiChatDictationEffect.tsx b/packages/twenty-front/src/modules/ai/dictation/components/AiChatDictationEffect.tsxindex d872724bc2a..d9ba45792df 100644--- a/packages/twenty-front/src/modules/ai/dictation/components/AiChatDictationEffect.tsx+++ b/packages/twenty-front/src/modules/ai/dictation/components/AiChatDictationEffect.tsx@@ -13,9 +13,9 @@ import { getDictationLanguage } from '@/ai/dictation/utils/getDictationLanguage'import { readDictationSurface } from '@/ai/dictation/utils/readDictationSurface';import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';import { useListenToBrowserEvent } from '@/browser-event/hooks/useListenToBrowserEvent';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';+import { useToast } from 'twenty-ui/primitives/feedback';type AiChatDictationEffectProps = {onInterimText: (text: string) => void;@@ -35,7 +35,7 @@ export const AiChatDictationEffect = ({const setHasWebSpeechProvenSilent = useSetAtomState(hasWebSpeechProvenSilentState,);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { isIOS } = useMemo(() => readDictationSurface(), []);@@ -93,8 +93,9 @@ export const AiChatDictationEffect = ({if (event.reason === 'engine-silent' && isIOS) {setHasWebSpeechProvenSilent(true);}- enqueueErrorSnackBar({- message: getDictationFailureMessage(event.reason),+ enqueueToast({+ variant: 'error',+ children: getDictationFailureMessage(event.reason),});break;}@@ -106,7 +107,7 @@ export const AiChatDictationEffect = ({onFinalText,setIsDictationRecording,setHasWebSpeechProvenSilent,- enqueueErrorSnackBar,+ enqueueToast,]);// Both send paths dispatch this, so dictation does not have to be lifted intodiff --git a/packages/twenty-front/src/modules/ai/dictation/components/__tests__/AiChatDictationEffect.test.tsx b/packages/twenty-front/src/modules/ai/dictation/components/__tests__/AiChatDictationEffect.test.tsxindex 5b58cb4eedd..1c392d813d0 100644--- a/packages/twenty-front/src/modules/ai/dictation/components/__tests__/AiChatDictationEffect.test.tsx+++ b/packages/twenty-front/src/modules/ai/dictation/components/__tests__/AiChatDictationEffect.test.tsx@@ -10,8 +10,11 @@ type SpeechRecognitionTestWindow = {SpeechRecognition?: WebSpeechRecognitionConstructor;};-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({ enqueueErrorSnackBar: jest.fn() }),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));const renderEffect = () =>diff --git a/packages/twenty-front/src/modules/ai/hooks/useAgentChat.ts b/packages/twenty-front/src/modules/ai/hooks/useAgentChat.tsindex 5ef3f565a5b..75161722a8b 100644--- a/packages/twenty-front/src/modules/ai/hooks/useAgentChat.ts+++ b/packages/twenty-front/src/modules/ai/hooks/useAgentChat.ts@@ -1,3 +1,5 @@+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';+import { useToast } from 'twenty-ui/primitives/feedback';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useApolloClient } from '@apollo/client/react';import { t } from '@lingui/core/macro';@@ -39,7 +41,6 @@ import { isAiChatCreditsExhaustedError } from '@/ai/utils/isAiChatCreditsExhaustimport { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { useListenToBrowserEvent } from '@/browser-event/hooks/useListenToBrowserEvent';import { dispatchBrowserEvent } from '@/browser-event/utils/dispatchBrowserEvent';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';@@ -56,7 +57,7 @@ export const useAgentChat = (const { getBrowsingContext } = useGetBrowsingContext();const { applyOptimisticUnarchive } = useOptimisticallyUnarchiveOnSend();const apolloClient = useApolloClient();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const setCurrentAiChatThread = useSetAtomState(currentAiChatThreadState);const { projectAiChatThreadToUrl } = useProjectAiChatThreadToUrl();const store = useStore();@@ -85,8 +86,9 @@ export const useAgentChat = (}if (aiModels.length === 0) {- enqueueErrorSnackBar({- message: t`No AI provider is configured on this instance.`,+ enqueueToast({+ variant: 'error',+ children: t`No AI provider is configured on this instance.`,});return;@@ -272,7 +274,7 @@ export const useAgentChat = (setAgentChatDraftsByThreadId,modelIdForRequest,aiModels,- enqueueErrorSnackBar,+ enqueueToast,setCurrentAiChatThread,apolloClient,applyOptimisticUnarchive,@@ -304,11 +306,9 @@ export const useAgentChat = (variables: { threadId },});} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));}- }, [store, apolloClient, enqueueErrorSnackBar]);+ }, [store, apolloClient, enqueueToast]);useListenToBrowserEvent({eventName: AGENT_CHAT_STOP_EVENT_NAME,diff --git a/packages/twenty-front/src/modules/ai/hooks/useAiChatFileUpload.ts b/packages/twenty-front/src/modules/ai/hooks/useAiChatFileUpload.tsindex 78a96f6809c..ccf65a90741 100644--- a/packages/twenty-front/src/modules/ai/hooks/useAiChatFileUpload.ts+++ b/packages/twenty-front/src/modules/ai/hooks/useAiChatFileUpload.ts@@ -1,10 +1,10 @@import { agentChatSelectedFilesState } from '@/ai/states/agentChatSelectedFilesState';import { agentChatUploadedFilesState } from '@/ai/states/agentChatUploadedFilesState';import { useDirectFileUpload } from '@/file/hooks/useDirectFileUpload';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { useLingui } from '@lingui/react/macro';import { isDefined, isNonEmptyArray } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { type AgentChatFileUIPart } from '@/ai/types/agent-chat-file-ui-part.type';import { FileFolder } from '~/generated-metadata/graphql';@@ -12,7 +12,7 @@ import { FileFolder } from '~/generated-metadata/graphql';export const useAiChatFileUpload = () => {const { uploadFile: directUploadFile } = useDirectFileUpload();const { t } = useLingui();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const setAgentChatSelectedFiles = useSetAtomState(agentChatSelectedFilesState,);@@ -35,8 +35,9 @@ export const useAiChatFileUpload = () => {};} catch {const fileName = file.name;- enqueueErrorSnackBar({- message: t`Failed to upload file: ${fileName}`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to upload file: ${fileName}`,});return null;} finally {@@ -74,8 +75,9 @@ export const useAiChatFileUpload = () => {(result) => result.status === 'rejected',).length;if (failedCount > 0) {- enqueueErrorSnackBar({- message: t`${failedCount} file(s) failed to upload`,+ enqueueToast({+ variant: 'error',+ children: t`${failedCount} file(s) failed to upload`,});}};diff --git a/packages/twenty-front/src/modules/ai/hooks/useChatThreadArchiveActions.ts b/packages/twenty-front/src/modules/ai/hooks/useChatThreadArchiveActions.tsindex d7d6acf032b..ce29e4ba48a 100644--- a/packages/twenty-front/src/modules/ai/hooks/useChatThreadArchiveActions.ts+++ b/packages/twenty-front/src/modules/ai/hooks/useChatThreadArchiveActions.ts@@ -1,8 +1,8 @@-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { useApplyAgentChatThreadUpdate } from '@/ai/hooks/useApplyAgentChatThreadUpdate';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';+import { useToast } from 'twenty-ui/primitives/feedback';import {ArchiveChatThreadDocument,UnarchiveChatThreadDocument,@@ -10,7 +10,7 @@ import {export const useChatThreadArchiveActions = () => {const { applyAgentChatThreadUpdate } = useApplyAgentChatThreadUpdate();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [archiveMutation] = useMutation(ArchiveChatThreadDocument);const [unarchiveMutation] = useMutation(UnarchiveChatThreadDocument);@@ -27,9 +27,7 @@ export const useChatThreadArchiveActions = () => {});}} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));}};@@ -45,9 +43,7 @@ export const useChatThreadArchiveActions = () => {});}} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));}};diff --git a/packages/twenty-front/src/modules/ai/hooks/useDeleteChatThread.ts b/packages/twenty-front/src/modules/ai/hooks/useDeleteChatThread.tsindex 143078fbf01..7ab4432907f 100644--- a/packages/twenty-front/src/modules/ai/hooks/useDeleteChatThread.ts+++ b/packages/twenty-front/src/modules/ai/hooks/useDeleteChatThread.ts@@ -1,26 +1,26 @@-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { useStore } from 'jotai';+import { useProjectAiChatThreadToUrl } from '@/ai/hooks/useProjectAiChatThreadToUrl';import {AGENT_CHAT_NEW_THREAD_DRAFT_KEY,agentChatDraftsByThreadIdState,} from '@/ai/states/agentChatDraftsByThreadIdState';-import { useProjectAiChatThreadToUrl } from '@/ai/hooks/useProjectAiChatThreadToUrl';import { agentChatInputState } from '@/ai/states/agentChatInputState';-import { agentChatVisibleThreadsSelector } from '@/ai/states/selectors/agentChatVisibleThreadsSelector';import { currentAiChatThreadState } from '@/ai/states/currentAiChatThreadState';+import { agentChatVisibleThreadsSelector } from '@/ai/states/selectors/agentChatVisibleThreadsSelector';import { sortChatThreadsByLastActivityDesc } from '@/ai/utils/sortChatThreadsByLastActivityDesc';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useUpdateMetadataStoreDraft } from '@/metadata-store/hooks/useUpdateMetadataStoreDraft';import { shouldOpenAiChatAfterOnboardingState } from '@/onboarding/states/shouldOpenAiChatAfterOnboardingState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';-import { DeleteChatThreadDocument } from '~/generated-metadata/graphql';import { tipTapDocumentToMarkdown } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';+import { DeleteChatThreadDocument } from '~/generated-metadata/graphql';export const useDeleteChatThread = () => {const { removeFromDraft, applyChanges } = useUpdateMetadataStoreDraft();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const setCurrentAiChatThread = useSetAtomState(currentAiChatThreadState);const setAgentChatInput = useSetAtomState(agentChatInputState);const { projectAiChatThreadToUrl } = useProjectAiChatThreadToUrl();@@ -68,9 +68,7 @@ export const useDeleteChatThread = () => {);}} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));}};diff --git a/packages/twenty-front/src/modules/ai/hooks/useRenameChatThread.ts b/packages/twenty-front/src/modules/ai/hooks/useRenameChatThread.tsindex 52128e96388..bc906095eff 100644--- a/packages/twenty-front/src/modules/ai/hooks/useRenameChatThread.ts+++ b/packages/twenty-front/src/modules/ai/hooks/useRenameChatThread.ts@@ -1,13 +1,13 @@import { useMutation } from '@apollo/client/react';-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useApplyAgentChatThreadUpdate } from '@/ai/hooks/useApplyAgentChatThreadUpdate';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';+import { useToast } from 'twenty-ui/primitives/feedback';import { RenameChatThreadDocument } from '~/generated-metadata/graphql';export const useRenameChatThread = () => {const { applyAgentChatThreadUpdate } = useApplyAgentChatThreadUpdate();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [renameChatThreadMutation] = useMutation(RenameChatThreadDocument);@@ -32,9 +32,7 @@ export const useRenameChatThread = () => {return true;} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));return false;}diff --git a/packages/twenty-front/src/modules/ai/hooks/useSubmitQuestionAnswer.ts b/packages/twenty-front/src/modules/ai/hooks/useSubmitQuestionAnswer.tsindex be58fba7c23..958d877d1b7 100644--- a/packages/twenty-front/src/modules/ai/hooks/useSubmitQuestionAnswer.ts+++ b/packages/twenty-front/src/modules/ai/hooks/useSubmitQuestionAnswer.ts@@ -18,18 +18,19 @@ import { agentChatSelectedFilesState } from '@/ai/states/agentChatSelectedFilesSimport { agentChatUploadedFilesState } from '@/ai/states/agentChatUploadedFilesState';import { AiChatErrorCode } from '@/ai/utils/aiChatErrorCode';import { isAiChatCreditsExhaustedError } from '@/ai/utils/isAiChatCreditsExhaustedError';-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';-import { markWorkspaceCreditsExhausted } from '@/workspace/utils/updateWorkspaceResourceCreditCap';import { markQuestionAnswered } from '@/ai/utils/markQuestionAnswered';import { markQuestionPending } from '@/ai/utils/markQuestionPending';+import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { dispatchBrowserEvent } from '@/browser-event/utils/dispatchBrowserEvent';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';+import { markWorkspaceCreditsExhausted } from '@/workspace/utils/updateWorkspaceResourceCreditCap';+import { useToast } from 'twenty-ui/primitives/feedback';import { isGraphqlErrorOfType } from '~/utils/is-graphql-error-of-type.util';export const useSubmitQuestionAnswer = () => {const apolloClient = useApolloClient();const store = useStore();- const { enqueueErrorSnackBar, enqueueInfoSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { modelIdForRequest } = useAgentChatModelId();const submitAnswer = useCallback(@@ -53,8 +54,9 @@ export const useSubmitQuestionAnswer = () => {);if (isNonEmptyArray(agentChatSelectedFiles)) {- enqueueInfoSnackBar({- message: t`Wait for files to finish uploading before answering.`,+ enqueueToast({+ variant: 'info',+ children: t`Wait for files to finish uploading before answering.`,});return;@@ -132,18 +134,10 @@ export const useSubmitQuestionAnswer = () => {);}- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));}},- [- apolloClient,- store,- enqueueErrorSnackBar,- enqueueInfoSnackBar,- modelIdForRequest,- ],+ [apolloClient, store, enqueueToast, modelIdForRequest],);return { submitAnswer };diff --git a/packages/twenty-front/src/modules/apollo/components/ToastOnQueryErrorEffect.tsx b/packages/twenty-front/src/modules/apollo/components/ToastOnQueryErrorEffect.tsxnew file mode 100644index 00000000000..12ed7c56c79--- /dev/null+++ b/packages/twenty-front/src/modules/apollo/components/ToastOnQueryErrorEffect.tsx@@ -0,0 +1,27 @@+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';+import { type ErrorLike } from '@apollo/client';+import { useEffect } from 'react';+import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';++type ToastOnQueryErrorEffectProps = {+ error: ErrorLike | undefined;+ message?: string;+};++export const ToastOnQueryErrorEffect = ({+ error,+ message,+}: ToastOnQueryErrorEffectProps) => {+ const { enqueueToast } = useToast();++ useEffect(() => {+ if (!isDefined(error)) {+ return;+ }++ enqueueToast(getToastOptionsFromError({ error, children: message }));+ }, [error, enqueueToast, message]);++ return null;+};diff --git a/packages/twenty-front/src/modules/apollo/hooks/__tests__/useApolloFactory.test.tsx b/packages/twenty-front/src/modules/apollo/hooks/__tests__/useApolloFactory.test.tsxindex ee8bc909095..bbfca1c138e 100644--- a/packages/twenty-front/src/modules/apollo/hooks/__tests__/useApolloFactory.test.tsx+++ b/packages/twenty-front/src/modules/apollo/hooks/__tests__/useApolloFactory.test.tsx@@ -3,7 +3,7 @@ import { CombinedGraphQLErrors } from '@apollo/client/errors';import { act, renderHook } from '@testing-library/react';import fetchMock, { enableFetchMocks } from 'jest-fetch-mock';import { MemoryRouter, useLocation } from 'react-router-dom';-import { SnackBarComponentInstanceContext } from '@/ui/feedback/snack-bar-manager/contexts/SnackBarComponentInstanceContext';+import { ToastProvider } from 'twenty-ui/primitives/feedback';import { useApolloFactory } from '@/apollo/hooks/useApolloFactory';import { clearSessionGeneration } from '@/auth/utils/clearSessionGeneration';import { getSessionGeneration } from '@/auth/utils/getSessionGeneration';@@ -27,11 +27,7 @@ const Wrapper = ({ children }: { children: React.ReactNode }) => (initialEntries={['/welcome', '/verify', '/opportunities']}initialIndex={2}>- <SnackBarComponentInstanceContext.Provider- value={{ instanceId: 'test-instance-id' }}- >- {children}- </SnackBarComponentInstanceContext.Provider>+ <ToastProvider>{children}</ToastProvider></MemoryRouter>);diff --git a/packages/twenty-front/src/modules/apollo/hooks/useApolloFactory.ts b/packages/twenty-front/src/modules/apollo/hooks/useApolloFactory.tsindex 946ca567590..e826c081012 100644--- a/packages/twenty-front/src/modules/apollo/hooks/useApolloFactory.ts+++ b/packages/twenty-front/src/modules/apollo/hooks/useApolloFactory.ts@@ -5,20 +5,20 @@ import { useLocation, useNavigate } from 'react-router-dom';import { ApolloFactory, type Options } from '@/apollo/services/apollo.factory';import { ONGOING_USER_CREATION_PATHS } from '@/auth/constants/OngoingUserCreationPaths';import { currentUserState } from '@/auth/states/currentUserState';-import { isCookieAuthActiveState } from '@/auth/states/isCookieAuthActiveState';import { currentUserWorkspaceState } from '@/auth/states/currentUserWorkspaceState';import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';+import { isCookieAuthActiveState } from '@/auth/states/isCookieAuthActiveState';import { returnToPathState } from '@/auth/states/returnToPathState';import { clearSessionGeneration } from '@/auth/utils/clearSessionGeneration';import { isValidReturnToPath } from '@/auth/utils/isValidReturnToPath';import { appVersionState } from '@/client-config/states/appVersionState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { AppPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { REACT_APP_SERVER_BASE_URL } from '~/config';import { useUpdateEffect } from '~/hooks/useUpdateEffect';import { isMatchingLocation } from '~/utils/isMatchingLocation';@@ -45,7 +45,7 @@ export const useApolloFactory = (options: Partial<Options> = {}) => {const locationRef = useRef(location);locationRef.current = location;- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const apolloClient = useMemo(() => {apolloRef.current = new ApolloFactory({@@ -88,19 +88,17 @@ export const useApolloFactory = (options: Partial<Options> = {}) => {}},onAppVersionMismatch: (message) => {- enqueueErrorSnackBar({- message,- options: {- dedupeKey: 'app-version-mismatch',- },+ enqueueToast({+ variant: 'error',+ children: message,+ dedupeKey: 'app-version-mismatch',});},onPayloadTooLarge: (message) => {- enqueueErrorSnackBar({- message,- options: {- dedupeKey: 'payload-too-large',- },+ enqueueToast({+ variant: 'error',+ children: message,+ dedupeKey: 'payload-too-large',});},extraLinks: [],@@ -115,7 +113,7 @@ export const useApolloFactory = (options: Partial<Options> = {}) => {setCurrentWorkspaceMember,setCurrentWorkspace,setReturnToPath,- enqueueErrorSnackBar,+ enqueueToast,]);useUpdateEffect(() => {diff --git a/packages/twenty-front/src/modules/apollo/hooks/useSnackBarOnQueryError.ts b/packages/twenty-front/src/modules/apollo/hooks/useSnackBarOnQueryError.tsdeleted file mode 100644index 6c56b92fa1d..00000000000--- a/packages/twenty-front/src/modules/apollo/hooks/useSnackBarOnQueryError.ts+++ /dev/null@@ -1,30 +0,0 @@-import { CombinedGraphQLErrors } from '@apollo/client/errors';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { useEffect } from 'react';--// Utility hook to show an error snackbar when a query returns an error.-// Replaces the removed onError callback from useQuery in Apollo v4.-//-// TODO: Consider moving generic error→snackbar handling into the centralized-// Apollo error link (apollo.factory.ts) which already handles auth errors,-// Sentry, retries, etc. This would eliminate the need for per-component-// useEffect calls. Keep this hook only for call sites that need a custom-// error message (e.g. useWebhookForm, SettingsAdminWorkerMetricsGraph).-export const useSnackBarOnQueryError = (- error: Error | CombinedGraphQLErrors | undefined,- message?: string,-) => {- const { enqueueErrorSnackBar } = useSnackBar();-- useEffect(() => {- if (!error) return;-- enqueueErrorSnackBar(- message- ? { message }- : CombinedGraphQLErrors.is(error)- ? { apolloError: error }- : { message: error.message },- );- }, [error, enqueueErrorSnackBar, message]);-};diff --git a/packages/twenty-front/src/modules/app/components/App.tsx b/packages/twenty-front/src/modules/app/components/App.tsxindex 7c2c1a25ade..9f3ac6f323a 100644--- a/packages/twenty-front/src/modules/app/components/App.tsx+++ b/packages/twenty-front/src/modules/app/components/App.tsx@@ -5,13 +5,13 @@ import { ApolloDevLogEffect } from '@/debug/components/ApolloDevLogEffect';import { AppErrorBoundary } from '@/error-handler/components/AppErrorBoundary';import { AppRootErrorFallback } from '@/error-handler/components/AppRootErrorFallback';import { ExceptionHandlerProvider } from '@/error-handler/components/ExceptionHandlerProvider';-import { SnackBarComponentInstanceContext } from '@/ui/feedback/snack-bar-manager/contexts/SnackBarComponentInstanceContext';import { ClickOutsideListenerContext } from '@/ui/utilities/pointer-event/contexts/ClickOutsideListenerContext';import { i18n } from '@lingui/core';import { I18nProvider } from '@lingui/react';import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { Provider as JotaiProvider } from 'jotai';import { HelmetProvider } from '@dr.pogodin/react-helmet';+import { ToastProvider } from 'twenty-ui/primitives/feedback';import { IconsProvider } from 'twenty-ui/icon';import { initialI18nActivate } from '~/utils/i18n/initialI18nActivate';@@ -28,9 +28,7 @@ export const App = () => {<I18nProvider i18n={i18n}><LocaleDirectionProvider><ApolloDevLogEffect />- <SnackBarComponentInstanceContext.Provider- value={{ instanceId: 'snack-bar-manager' }}- >+ <ToastProvider><IconsProvider><ExceptionHandlerProvider><HelmetProvider>@@ -42,7 +40,7 @@ export const App = () => {</HelmetProvider></ExceptionHandlerProvider></IconsProvider>- </SnackBarComponentInstanceContext.Provider>+ </ToastProvider></LocaleDirectionProvider></I18nProvider></I18nActivationGate>diff --git a/packages/twenty-front/src/modules/app/components/RootAppProviders.tsx b/packages/twenty-front/src/modules/app/components/RootAppProviders.tsxindex bde3d25c454..5e842700128 100644--- a/packages/twenty-front/src/modules/app/components/RootAppProviders.tsx+++ b/packages/twenty-front/src/modules/app/components/RootAppProviders.tsx@@ -13,7 +13,7 @@ import { PromiseRejectionEffect } from '@/error-handler/components/PromiseRejectimport { UserMetadataProviderInitialEffect } from '@/metadata-store/effect-components/UserMetadataProviderInitialEffect';import { DialogManager } from '@/ui/feedback/dialog-manager/components/DialogManager';import { DialogComponentInstanceContext } from '@/ui/feedback/dialog-manager/contexts/DialogComponentInstanceContext';-import { SnackBarProvider } from '@/ui/feedback/snack-bar-manager/components/SnackBarProvider';+import { AppToaster } from '@/ui/feedback/toast/components/AppToaster';import { PageFavicon } from '@/ui/utilities/page-favicon/components/PageFavicon';import { PageTitle } from '@/ui/utilities/page-title/components/PageTitle';import { WorkspaceProviderEffect } from '@/workspace/components/WorkspaceProviderEffect';@@ -29,25 +29,24 @@ export const RootAppProviders = () => {<UserMetadataProviderInitialEffect /><WorkspaceProviderEffect /><AuthProvider>- <SnackBarProvider>- <ErrorMessageEffect />- <DialogComponentInstanceContext.Provider- value={{ instanceId: 'dialog-manager' }}- >- <DialogManager>- <StrictMode>- <PromiseRejectionEffect />- <PageTitle title={pageTitle} />- <PageFavicon />- <Outlet />- <InitializeQueryParamStateEffect />- <TrackPageViewEffect />- <RequestFreshCaptchaTokenEffect />- <SignOutOnOtherTabSignOutEffect />- </StrictMode>- </DialogManager>- </DialogComponentInstanceContext.Provider>- </SnackBarProvider>+ <AppToaster />+ <ErrorMessageEffect />+ <DialogComponentInstanceContext.Provider+ value={{ instanceId: 'dialog-manager' }}+ >+ <DialogManager>+ <StrictMode>+ <PromiseRejectionEffect />+ <PageTitle title={pageTitle} />+ <PageFavicon />+ <Outlet />+ <InitializeQueryParamStateEffect />+ <TrackPageViewEffect />+ <RequestFreshCaptchaTokenEffect />+ <SignOutOnOtherTabSignOutEffect />+ </StrictMode>+ </DialogManager>+ </DialogComponentInstanceContext.Provider></AuthProvider></CaptchaProvider></SharedAppProviders>diff --git a/packages/twenty-front/src/modules/app/components/WorkspaceAppProviders.tsx b/packages/twenty-front/src/modules/app/components/WorkspaceAppProviders.tsxindex fa4b1c68fbd..5163b8ebf32 100644--- a/packages/twenty-front/src/modules/app/components/WorkspaceAppProviders.tsx+++ b/packages/twenty-front/src/modules/app/components/WorkspaceAppProviders.tsx@@ -2,12 +2,12 @@ import { StrictMode } from 'react';import { Outlet, useLocation } from 'react-router-dom';import { AgentChatProvider } from '@/ai/components/AgentChatProvider';-import { ApplicationsLoadEffect } from '@/applications/components/ApplicationsLoadEffect';import { TrackPageViewEffect } from '@/analytics/components/TrackPageViewEffect';import { SharedAppProviders } from '@/app/components/SharedAppProviders';import { GotoHotkeysEffectsProvider } from '@/app/effect-components/GotoHotkeysEffectsProvider';import { InitializeQueryParamStateEffect } from '@/app/effect-components/InitializeQueryParamStateEffect';import { PageChangeEffect } from '@/app/effect-components/PageChangeEffect';+import { ApplicationsLoadEffect } from '@/applications/components/ApplicationsLoadEffect';import { AuthProvider } from '@/auth/components/AuthProvider';import { SignOutOnOtherTabSignOutEffect } from '@/auth/effect-components/SignOutOnOtherTabSignOutEffect';import { CaptchaProvider } from '@/captcha/components/CaptchaProvider';@@ -31,7 +31,7 @@ import { SSEProvider } from '@/sse-db-event/components/SSEProvider';import { SupportChatEffect } from '@/support/components/SupportChatEffect';import { DialogManager } from '@/ui/feedback/dialog-manager/components/DialogManager';import { DialogComponentInstanceContext } from '@/ui/feedback/dialog-manager/contexts/DialogComponentInstanceContext';-import { SnackBarProvider } from '@/ui/feedback/snack-bar-manager/components/SnackBarProvider';+import { AppToaster } from '@/ui/feedback/toast/components/AppToaster';import { GlobalFilePreviewModal } from '@/ui/field/display/components/GlobalFilePreviewModal';import { UserThemeProviderEffect } from '@/ui/theme/components/UserThemeProviderEffect';import { UserUiScaleProviderEffect } from '@/ui/theme/components/UserUiScaleProviderEffect';@@ -63,30 +63,29 @@ export const WorkspaceAppProviders = () => {<ContextStoreComponentInstanceContext.Providervalue={{ instanceId: MAIN_CONTEXT_STORE_INSTANCE_ID }}>- <SnackBarProvider>- <ErrorMessageEffect />- <AgentChatProvider>- <DialogComponentInstanceContext.Provider- value={{ instanceId: 'dialog-manager' }}- >- <DialogManager>- <StrictMode>- <PromiseRejectionEffect />- <EndTrialAfterPaymentMethodGater />- <GotoHotkeysEffectsProvider />- <PageTitle title={pageTitle} />- <PageFavicon />- <RecordCreationFormProvider>- <Outlet />- <GlobalFilePreviewModal />- <CommandMenuConfirmationModalManager />- <CommandRunner />- </RecordCreationFormProvider>- </StrictMode>- </DialogManager>- </DialogComponentInstanceContext.Provider>- </AgentChatProvider>- </SnackBarProvider>+ <AppToaster />+ <ErrorMessageEffect />+ <AgentChatProvider>+ <DialogComponentInstanceContext.Provider+ value={{ instanceId: 'dialog-manager' }}+ >+ <DialogManager>+ <StrictMode>+ <PromiseRejectionEffect />+ <EndTrialAfterPaymentMethodGater />+ <GotoHotkeysEffectsProvider />+ <PageTitle title={pageTitle} />+ <PageFavicon />+ <RecordCreationFormProvider>+ <Outlet />+ <GlobalFilePreviewModal />+ <CommandMenuConfirmationModalManager />+ <CommandRunner />+ </RecordCreationFormProvider>+ </StrictMode>+ </DialogManager>+ </DialogComponentInstanceContext.Provider>+ </AgentChatProvider></ContextStoreComponentInstanceContext.Provider><SupportChatEffect /><InitializeQueryParamStateEffect />diff --git a/packages/twenty-front/src/modules/auth/components/TwoFactorAuthenticationProvisionEffect.tsx b/packages/twenty-front/src/modules/auth/components/TwoFactorAuthenticationProvisionEffect.tsxindex 6a649758ee3..b7dd0a30414 100644--- a/packages/twenty-front/src/modules/auth/components/TwoFactorAuthenticationProvisionEffect.tsx+++ b/packages/twenty-front/src/modules/auth/components/TwoFactorAuthenticationProvisionEffect.tsx@@ -2,19 +2,19 @@ import { loginTokenState } from '@/auth/states/loginTokenState';import { qrCodeState } from '@/auth/states/qrCode';import { useOrigin } from '@/domain-manager/hooks/useOrigin';import { useCurrentUserWorkspaceTwoFactorAuthentication } from '@/settings/two-factor-authentication/hooks/useCurrentUserWorkspaceTwoFactorAuthentication';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { useLingui } from '@lingui/react/macro';import { useEffect } from 'react';-import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { AppPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { useNavigateApp } from '~/hooks/useNavigateApp';-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';export const TwoFactorAuthenticationSetupEffect = () => {const { initiateCurrentUserWorkspaceOtpProvisioning } =useCurrentUserWorkspaceTwoFactorAuthentication();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const navigate = useNavigateApp();const { origin } = useOrigin();@@ -32,11 +32,10 @@ export const TwoFactorAuthenticationSetupEffect = () => {const handleTwoFactorAuthenticationProvisioningInitiation = async () => {try {if (!loginToken) {- enqueueErrorSnackBar({- message: t`Login token missing. Two Factor Authentication setup can not be initiated.`,- options: {- dedupeKey: 'invalid-session-dedupe-key',- },+ enqueueToast({+ variant: 'error',+ children: t`Login token missing. Two Factor Authentication setup can not be initiated.`,+ dedupeKey: 'invalid-session-dedupe-key',});return navigate(AppPath.SignInUp);}@@ -56,12 +55,10 @@ export const TwoFactorAuthenticationSetupEffect = () => {initiateOTPProvisioningResult.data?.initiateOTPProvisioning.uri,);} catch {- enqueueErrorSnackBar({- message: t`Two factor authentication provisioning failed.`,- options: {- dedupeKey:- 'two-factor-authentication-provisioning-initiation-failed',- },+ enqueueToast({+ variant: 'error',+ children: t`Two factor authentication provisioning failed.`,+ dedupeKey: 'two-factor-authentication-provisioning-initiation-failed',});}};diff --git a/packages/twenty-front/src/modules/auth/components/VerifyEmailEffect.tsx b/packages/twenty-front/src/modules/auth/components/VerifyEmailEffect.tsxindex 130448346f4..266079b4bdd 100644--- a/packages/twenty-front/src/modules/auth/components/VerifyEmailEffect.tsx+++ b/packages/twenty-front/src/modules/auth/components/VerifyEmailEffect.tsx@@ -4,7 +4,7 @@ import { useVerifyLogin } from '@/auth/hooks/useVerifyLogin';import { clientConfigApiStatusState } from '@/client-config/states/clientConfigApiStatusState';import { useIsCurrentLocationOnAWorkspace } from '@/domain-manager/hooks/useIsCurrentLocationOnAWorkspace';import { useRedirectToWorkspaceDomain } from '@/domain-manager/hooks/useRedirectToWorkspaceDomain';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { CombinedGraphQLErrors } from '@apollo/client/errors';@@ -13,6 +13,7 @@ import { useEffect } from 'react';import { useSearchParams } from 'react-router-dom';import { AppPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast, type ToastOptions } from 'twenty-ui/primitives/feedback';import { useNavigateApp } from '~/hooks/useNavigateApp';import { getWorkspaceUrl } from '~/utils/getWorkspaceUrl';import { isGraphqlErrorOfType } from '~/utils/is-graphql-error-of-type.util';@@ -21,13 +22,16 @@ type VerifyEmailEffectProps = {onError: () => void;};+const EMAIL_VERIFICATION_ERROR_DEDUPE_KEY =+ 'email-verification-error-dedupe-key';+export const VerifyEmailEffect = ({ onError }: VerifyEmailEffectProps) => {const {verifyEmailAndGetLoginToken,verifyEmailAndGetWorkspaceAgnosticToken,} = useAuth();- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [searchParams] = useSearchParams();@@ -49,21 +53,19 @@ export const VerifyEmailEffect = ({ onError }: VerifyEmailEffectProps) => {useEffect(() => {const verifyEmailToken = async () => {if (!email || !emailVerificationToken) {- enqueueErrorSnackBar({- message: t`Invalid email verification link.`,- options: {- dedupeKey: 'email-verification-link-dedupe-key',- },+ enqueueToast({+ variant: 'error',+ children: t`Invalid email verification link.`,+ dedupeKey: 'email-verification-link-dedupe-key',});return navigate(AppPath.SignInUp);}- const successSnackbarParams = {- message: t`Email verified.`,- options: {- dedupeKey: 'email-verification-dedupe-key',- },- };+ const successToastOptions = {+ variant: 'success',+ children: t`Email verified.`,+ dedupeKey: 'email-verification-dedupe-key',+ } satisfies ToastOptions;try {if (!isOnAWorkspace) {@@ -72,7 +74,7 @@ export const VerifyEmailEffect = ({ onError }: VerifyEmailEffectProps) => {email,);- enqueueSuccessSnackBar(successSnackbarParams);+ enqueueToast(successToastOptions);return navigate(AppPath.SignInUp);}@@ -82,7 +84,7 @@ export const VerifyEmailEffect = ({ onError }: VerifyEmailEffectProps) => {email,);- enqueueSuccessSnackBar(successSnackbarParams);+ enqueueToast(successToastOptions);const workspaceUrl = getWorkspaceUrl(workspaceUrls);if (workspaceUrl.slice(0, -1) !== window.location.origin) {@@ -97,14 +99,18 @@ export const VerifyEmailEffect = ({ onError }: VerifyEmailEffectProps) => {await verifyLoginToken(loginToken.token);} catch (error) {- enqueueErrorSnackBar({- ...(CombinedGraphQLErrors.is(error)- ? { apolloError: error }- : { message: t`Email verification failed` }),- options: {- dedupeKey: 'email-verification-error-dedupe-key',- },- });+ enqueueToast(+ CombinedGraphQLErrors.is(error)+ ? getToastOptionsFromError({+ error,+ dedupeKey: EMAIL_VERIFICATION_ERROR_DEDUPE_KEY,+ })+ : {+ variant: 'error',+ children: t`Email verification failed`,+ dedupeKey: EMAIL_VERIFICATION_ERROR_DEDUPE_KEY,+ },+ );if (isGraphqlErrorOfType(error, 'EMAIL_ALREADY_VERIFIED')) {navigate(AppPath.SignInUp);}diff --git a/packages/twenty-front/src/modules/auth/components/__stories__/VerifyEmail.stories.tsx b/packages/twenty-front/src/modules/auth/components/__stories__/VerifyEmail.stories.tsxindex 1ecdf73811e..915f86a5120 100644--- a/packages/twenty-front/src/modules/auth/components/__stories__/VerifyEmail.stories.tsx+++ b/packages/twenty-front/src/modules/auth/components/__stories__/VerifyEmail.stories.tsx@@ -1,12 +1,12 @@import { type VerifyEmail } from '@/auth/components/VerifyEmail';+import { EmailVerificationSent } from '@/auth/sign-in-up/components/EmailVerificationSent';import { type Meta, type StoryObj } from '@storybook/react-vite';import { MemoryRouter, Route, Routes } from 'react-router-dom';+import { ModalContent } from 'twenty-ui/primitives/surfaces';// Mock component that just renders the error state of VerifyEmail directly// (since normal VerifyEmail has async logic that's hard to test in Storybook)-import { EmailVerificationSent } from '@/auth/sign-in-up/components/EmailVerificationSent';-import { ModalContent } from 'twenty-ui/primitives/surfaces';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const VerifyEmailErrorState = ({ email = '[email protected]' }) => {return (@@ -25,7 +25,7 @@ const meta: Meta<typeof VerifyEmailErrorState> = {<Story /></div>),- SnackBarDecorator,+ ToastDecorator,],parameters: {codeSection: {@@ -66,5 +66,5 @@ export const IntegratedExample: StoryObj<typeof VerifyEmail> = {},},},- decorators: [SnackBarDecorator],+ decorators: [ToastDecorator],};diff --git a/packages/twenty-front/src/modules/auth/components/__tests__/VerifyEmail.test.tsx b/packages/twenty-front/src/modules/auth/components/__tests__/VerifyEmail.test.tsxindex a9da94512cb..4e766acae3c 100644--- a/packages/twenty-front/src/modules/auth/components/__tests__/VerifyEmail.test.tsx+++ b/packages/twenty-front/src/modules/auth/components/__tests__/VerifyEmail.test.tsx@@ -20,8 +20,6 @@ const verifyEmailAndGetWorkspaceAgnosticTokenMock = jest.fn();const verifyEmailAndGetLoginTokenMock = jest.fn();const verifyLoginTokenMock = jest.fn();const redirectToWorkspaceDomainMock = jest.fn();-const enqueueSuccessSnackBarMock = jest.fn();-const enqueueErrorSnackBarMock = jest.fn();let isOnAWorkspaceValue = false;@@ -53,11 +51,11 @@ jest.mock('~/hooks/useNavigateApp', () => ({useNavigateApp: () => navigateMock,}));-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({- enqueueSuccessSnackBar: enqueueSuccessSnackBarMock,- enqueueErrorSnackBar: enqueueErrorSnackBarMock,- }),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));// Rendered by VerifyEmail in the error state; isolate it from Apollo.@@ -121,7 +119,9 @@ describe('VerifyEmail', () => {await waitFor(() => {expect(navigateMock).toHaveBeenCalledWith(AppPath.SignInUp);});- expect(enqueueSuccessSnackBarMock).toHaveBeenCalled();+ expect(mockEnqueueToast).toHaveBeenCalledWith(+ expect.objectContaining({ variant: 'success' }),+ );});it('does not hand off to the SignInUp page when the verification fails', async () => {@@ -132,7 +132,9 @@ describe('VerifyEmail', () => {renderVerifyEmail(VERIFY_EMAIL_URL);await waitFor(() => {- expect(enqueueErrorSnackBarMock).toHaveBeenCalled();+ expect(mockEnqueueToast).toHaveBeenCalledWith(+ expect.objectContaining({ variant: 'error' }),+ );});expect(navigateMock).not.toHaveBeenCalledWith(AppPath.SignInUp);});diff --git a/packages/twenty-front/src/modules/auth/hooks/__tests__/useAuth.test.tsx b/packages/twenty-front/src/modules/auth/hooks/__tests__/useAuth.test.tsxindex dea9cdc1d07..7d470e7919f 100644--- a/packages/twenty-front/src/modules/auth/hooks/__tests__/useAuth.test.tsx+++ b/packages/twenty-front/src/modules/auth/hooks/__tests__/useAuth.test.tsx@@ -20,7 +20,7 @@ import {currentWorkspaceState,} from '@/auth/states/currentWorkspaceState';import { returnToPathState } from '@/auth/states/returnToPathState';-import { SnackBarComponentInstanceContext } from '@/ui/feedback/snack-bar-manager/contexts/SnackBarComponentInstanceContext';+import { ToastProvider } from 'twenty-ui/primitives/feedback';import { renderHook } from '@testing-library/react';import { getDefaultStore } from 'jotai';import { WorkspaceActivationStatus } from 'twenty-shared/workspace';@@ -72,11 +72,7 @@ jest.mock('@/domain-manager/hooks/useLastAuthenticatedWorkspaceDomain', () => ({const Wrapper = ({ children }: { children: ReactNode }) => (<MockedProvider mocks={Object.values(mocks)}><MemoryRouter>- <SnackBarComponentInstanceContext.Provider- value={{ instanceId: 'test-instance-id' }}- >- {children}- </SnackBarComponentInstanceContext.Provider>+ <ToastProvider>{children}</ToastProvider></MemoryRouter></MockedProvider>);diff --git a/packages/twenty-front/src/modules/auth/hooks/__tests__/useRedeemSsoExchangeToken.test.ts b/packages/twenty-front/src/modules/auth/hooks/__tests__/useRedeemSsoExchangeToken.test.tsindex 69482ca5b01..1d454e5ab74 100644--- a/packages/twenty-front/src/modules/auth/hooks/__tests__/useRedeemSsoExchangeToken.test.ts+++ b/packages/twenty-front/src/modules/auth/hooks/__tests__/useRedeemSsoExchangeToken.test.ts@@ -2,11 +2,11 @@ import { renderHook } from '@testing-library/react';import { Provider as JotaiProvider } from 'jotai';import { isAppEffectRedirectEnabledState } from '@/app/states/isAppEffectRedirectEnabledState';-import { isCookieAuthActiveState } from '@/auth/states/isCookieAuthActiveState';import { useRedeemSsoExchangeToken } from '@/auth/hooks/useRedeemSsoExchangeToken';+import { isCookieAuthActiveState } from '@/auth/states/isCookieAuthActiveState';import { clearSessionGeneration } from '@/auth/utils/clearSessionGeneration';import { getSessionGeneration } from '@/auth/utils/getSessionGeneration';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import {jotaiStore,resetJotaiStore,@@ -19,8 +19,11 @@ jest.mock('@apollo/client/react', () => ({useMutation: () => [mockGetAuthTokensFromSsoExchangeToken],}));-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: jest.fn(),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));const renderHooks = () => {@@ -43,18 +46,12 @@ const freshTokenPair = {};describe('useRedeemSsoExchangeToken', () => {- const mockEnqueueErrorSnackBar = jest.fn();-beforeEach(() => {jest.clearAllMocks();localStorage.clear();clearSessionGeneration();resetJotaiStore();- (useSnackBar as jest.Mock).mockReturnValue({- enqueueErrorSnackBar: mockEnqueueErrorSnackBar,- });-mockGetAuthTokensFromSsoExchangeToken.mockResolvedValue({data: {getAuthTokensFromSSOExchangeToken: { tokens: freshTokenPair },@@ -107,7 +104,7 @@ describe('useRedeemSsoExchangeToken', () => {expect(getSessionGeneration()).toBeNull();});- it('should snackbar when redemption fails', async () => {+ it('should toast when redemption fails', async () => {mockGetAuthTokensFromSsoExchangeToken.mockRejectedValueOnce(new Error('Invalid SSO exchange token'),);@@ -116,8 +113,9 @@ describe('useRedeemSsoExchangeToken', () => {await result.current.redeemSsoExchangeToken('sso-exchange-token');- expect(mockEnqueueErrorSnackBar).toHaveBeenCalledWith({- message: 'Invalid SSO exchange token',+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'Invalid SSO exchange token',});expect(jotaiStore.get(isAppEffectRedirectEnabledState.atom)).toBe(true);});diff --git a/packages/twenty-front/src/modules/auth/hooks/__tests__/useVerifyLogin.test.ts b/packages/twenty-front/src/modules/auth/hooks/__tests__/useVerifyLogin.test.tsindex f42eab5d276..dfe363a24d5 100644--- a/packages/twenty-front/src/modules/auth/hooks/__tests__/useVerifyLogin.test.ts+++ b/packages/twenty-front/src/modules/auth/hooks/__tests__/useVerifyLogin.test.ts@@ -1,18 +1,17 @@+import { CombinedGraphQLErrors } from '@apollo/client/errors';import { i18n } from '@lingui/core';import { I18nProvider } from '@lingui/react';-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { renderHook } from '@testing-library/react';import { Provider as JotaiProvider } from 'jotai';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { AppPath } from 'twenty-shared/types';-import { useNavigateApp } from '~/hooks/useNavigateApp';import { useAuth } from '@/auth/hooks/useAuth';import { useVerifyLogin } from '@/auth/hooks/useVerifyLogin';import {jotaiStore,resetJotaiStore,} from '@/ui/utilities/state/jotai/jotaiStore';+import { AppPath } from 'twenty-shared/types';+import { useNavigateApp } from '~/hooks/useNavigateApp';import { SOURCE_LOCALE } from 'twenty-shared/translations';import { dynamicActivate } from '~/utils/i18n/dynamicActivate';@@ -21,8 +20,11 @@ jest.mock('../useAuth', () => ({useAuth: jest.fn(),}));-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: jest.fn(),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));jest.mock('~/hooks/useNavigateApp', () => ({@@ -44,7 +46,7 @@ const renderHooks = () => {describe('useVerifyLogin', () => {const mockGetAuthTokensFromLoginToken = jest.fn();- const mockEnqueueErrorSnackBar = jest.fn();+const mockNavigate = jest.fn();beforeEach(() => {@@ -56,10 +58,6 @@ describe('useVerifyLogin', () => {getAuthTokensFromLoginToken: mockGetAuthTokensFromLoginToken,});- (useSnackBar as jest.Mock).mockReturnValue({- enqueueErrorSnackBar: mockEnqueueErrorSnackBar,- });-(useNavigateApp as jest.Mock).mockReturnValue(mockNavigate);});@@ -79,15 +77,24 @@ describe('useVerifyLogin', () => {await result.current.verifyLoginToken('test-token');- expect(mockEnqueueErrorSnackBar).toHaveBeenCalledWith({- message: 'Authentication failed',+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'Authentication failed',});expect(mockNavigate).toHaveBeenCalledWith(AppPath.SignInUp);});- it('should preserve a GraphQL verification error for the snackbar', async () => {+ it('should display the user-friendly GraphQL verification message', async () => {const error = new CombinedGraphQLErrors({- errors: [{ message: 'Session could not be created' }],+ errors: [+ {+ message: 'Session could not be created',+ extensions: {+ userFriendlyMessage:+ 'Your session has expired. Please sign in again.',+ },+ },+ ],});mockGetAuthTokensFromLoginToken.mockRejectedValueOnce(error);@@ -95,8 +102,9 @@ describe('useVerifyLogin', () => {await result.current.verifyLoginToken('test-token');- expect(mockEnqueueErrorSnackBar).toHaveBeenCalledWith({- apolloError: error,+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'Your session has expired. Please sign in again.',});expect(mockNavigate).toHaveBeenCalledWith(AppPath.SignInUp);});diff --git a/packages/twenty-front/src/modules/auth/hooks/useRedeemSsoExchangeToken.ts b/packages/twenty-front/src/modules/auth/hooks/useRedeemSsoExchangeToken.tsindex a4e9e1010ff..d3fbd03d140 100644--- a/packages/twenty-front/src/modules/auth/hooks/useRedeemSsoExchangeToken.ts+++ b/packages/twenty-front/src/modules/auth/hooks/useRedeemSsoExchangeToken.ts@@ -1,15 +1,15 @@import { isAppEffectRedirectEnabledState } from '@/app/states/isAppEffectRedirectEnabledState';import { useMarkSessionActive } from '@/auth/hooks/useMarkSessionActive';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { useCallback } from 'react';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { GetAuthTokensFromSsoExchangeTokenDocument } from '~/generated-metadata/graphql';export const useRedeemSsoExchangeToken = () => {- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const markSessionActive = useMarkSessionActive();const setIsAppEffectRedirectEnabled = useSetAtomState(isAppEffectRedirectEnabledState,@@ -35,11 +35,7 @@ export const useRedeemSsoExchangeToken = () => {markSessionActive();} catch (error: unknown) {- enqueueErrorSnackBar(- CombinedGraphQLErrors.is(error)- ? { apolloError: error }- : { message: error instanceof Error ? error.message : undefined },- );+ enqueueToast(getToastOptionsFromError({ error }));} finally {setIsAppEffectRedirectEnabled(true);}@@ -48,7 +44,7 @@ export const useRedeemSsoExchangeToken = () => {getAuthTokensFromSsoExchangeToken,markSessionActive,setIsAppEffectRedirectEnabled,- enqueueErrorSnackBar,+ enqueueToast,],);diff --git a/packages/twenty-front/src/modules/auth/hooks/useVerifyLogin.ts b/packages/twenty-front/src/modules/auth/hooks/useVerifyLogin.tsindex 9eae73ef5f6..5ad9caefd3d 100644--- a/packages/twenty-front/src/modules/auth/hooks/useVerifyLogin.ts+++ b/packages/twenty-front/src/modules/auth/hooks/useVerifyLogin.ts@@ -1,14 +1,15 @@import { isAppEffectRedirectEnabledState } from '@/app/states/isAppEffectRedirectEnabledState';import { useAuth } from '@/auth/hooks/useAuth';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useLingui } from '@lingui/react/macro';import { AppPath } from 'twenty-shared/types';+import { useToast } from 'twenty-ui/primitives/feedback';import { useNavigateApp } from '~/hooks/useNavigateApp';export const useVerifyLogin = () => {- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const navigate = useNavigateApp();const setIsAppEffectRedirectEnabled = useSetAtomState(isAppEffectRedirectEnabledState,@@ -22,12 +23,10 @@ export const useVerifyLogin = () => {try {await getAuthTokensFromLoginToken(loginToken);} catch (error) {- enqueueErrorSnackBar(+ enqueueToast(CombinedGraphQLErrors.is(error)- ? { apolloError: error }- : {- message: t`Authentication failed`,- },+ ? getToastOptionsFromError({ error })+ : { variant: 'error', children: t`Authentication failed` },);navigate(AppPath.SignInUp);} finally {diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/__stories__/EmailVerificationSent.stories.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/__stories__/EmailVerificationSent.stories.tsxindex f1a54108272..e2484c5cb4f 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/components/__stories__/EmailVerificationSent.stories.tsx+++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/__stories__/EmailVerificationSent.stories.tsx@@ -3,7 +3,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';import { EmailVerificationSent } from '@/auth/sign-in-up/components/EmailVerificationSent';import { ModalContent } from 'twenty-ui/primitives/surfaces';import { ComponentDecorator } from 'twenty-ui/testing';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const RenderWithModalContent = (args: React.ComponentProps<typeof EmailVerificationSent>,@@ -18,7 +18,7 @@ const RenderWithModalContent = (const meta: Meta<typeof EmailVerificationSent> = {title: 'Modules/Auth/EmailVerificationSent',component: EmailVerificationSent,- decorators: [ComponentDecorator, SnackBarDecorator],+ decorators: [ComponentDecorator, ToastDecorator],parameters: {codeSection: {docs: 'This component should always be wrapped with ModalContent in the app.\n\nCorrect usage:\n```tsx\n<ModalContent isVerticallyCentered isHorizontallyCentered>\n <EmailVerificationSent email={email} />\n</ModalContent>\n```\n',diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationVerification.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationVerification.tsxindex 108b31e1325..1185d84b525 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationVerification.tsx+++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationVerification.tsx@@ -1,6 +1,8 @@-import { styled } from '@linaria/react';-import { useAuth } from '@/auth/hooks/useAuth';+import {+ StyledTwoFactorInstructions,+ StyledTwoFactorMainContent,+} from '@/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationStyles';import {type OTPFormValues,useTwoFactorAuthenticationForm,@@ -10,14 +12,12 @@ import {SignInUpStep,signInUpStepState,} from '@/auth/states/signInUpStepState';-import {- StyledTwoFactorInstructions,- StyledTwoFactorMainContent,-} from '@/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationStyles';import { useReadCaptchaToken } from '@/captcha/hooks/useReadCaptchaToken';-import { ONBOARDING_CONTENT_BLOCK_WIDTH } from '@/onboarding/constants/OnboardingContentBlockWidth';import { useCaptcha } from '@/client-config/hooks/useCaptcha';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { ONBOARDING_CONTENT_BLOCK_WIDTH } from '@/onboarding/constants/OnboardingContentBlockWidth';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';+import { styled } from '@linaria/react';import { Trans, useLingui } from '@lingui/react/macro';import { OTPInput, type SlotProps } from 'input-otp';import { useState } from 'react';@@ -27,8 +27,8 @@ import { MainButton } from 'twenty-ui/primitives/input';import { ClickToActionLink } from 'twenty-ui/primitives/navigation';import { themeCssVariables } from 'twenty-ui/theme-constants';import { useNavigateApp } from '~/hooks/useNavigateApp';-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';++import { useToast } from 'twenty-ui/primitives/feedback';const StyledForm = styled.form`align-items: center;@@ -170,7 +170,7 @@ export const SignInUpTOTPVerification = () => {const [isLoading, setIsLoading] = useState<boolean>(false);const { getAuthTokensFromOTP } = useAuth();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const navigate = useNavigateApp();const { readCaptchaToken } = useReadCaptchaToken();@@ -185,8 +185,9 @@ export const SignInUpTOTPVerification = () => {setIsLoading(true);try {if (!isCaptchaReady) {- enqueueErrorSnackBar({- message: t`Captcha (anti-bot check) is still loading, try again`,+ enqueueToast({+ variant: 'error',+ children: t`Captcha (anti-bot check) is still loading, try again`,});setIsLoading(false);return;@@ -202,11 +203,10 @@ export const SignInUpTOTPVerification = () => {} catch {form.setValue('otp', '');- enqueueErrorSnackBar({- message: t`Invalid verification code. Please try again.`,- options: {- dedupeKey: 'invalid-otp-dedupe-key',- },+ enqueueToast({+ variant: 'error',+ children: t`Invalid verification code. Please try again.`,+ dedupeKey: 'invalid-otp-dedupe-key',});} finally {setIsLoading(false);diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useHandleResetPassword.test.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useHandleResetPassword.test.tsindex 22a1da8b879..ac619b1cdf0 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useHandleResetPassword.test.ts+++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useHandleResetPassword.test.ts@@ -1,21 +1,26 @@import { i18n } from '@lingui/core';import { I18nProvider } from '@lingui/react';import { act, renderHook } from '@testing-library/react';-import { type ReactNode, createElement } from 'react';import { Provider as JotaiProvider } from 'jotai';+import { type ReactNode, createElement } from 'react';import { useHandleResetPassword } from '@/auth/sign-in-up/hooks/useHandleResetPassword';import { workspacePublicDataState } from '@/auth/states/workspacePublicDataState';import { useReadCaptchaToken } from '@/captcha/hooks/useReadCaptchaToken';import { useCaptcha } from '@/client-config/hooks/useCaptcha';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';-import { SOURCE_LOCALE } from 'twenty-shared/translations';import { useMutation } from '@apollo/client/react';+import { SOURCE_LOCALE } from 'twenty-shared/translations';import { type PublicWorkspaceData } from '~/generated-metadata/graphql';import { dynamicActivate } from '~/utils/i18n/dynamicActivate';-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar');+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),+}));jest.mock('@apollo/client/react');jest.mock('@/captcha/hooks/useReadCaptchaToken');jest.mock('@/client-config/hooks/useCaptcha');@@ -53,17 +58,11 @@ const renderHooksWithoutWorkspace = () => {};describe('useHandleResetPassword', () => {- const enqueueErrorSnackBarMock = jest.fn();- const enqueueSuccessSnackBarMock = jest.fn();const emailPasswordResetLinkMock = jest.fn();beforeEach(() => {jest.clearAllMocks();- (useSnackBar as jest.Mock).mockReturnValue({- enqueueErrorSnackBar: enqueueErrorSnackBarMock,- enqueueSuccessSnackBar: enqueueSuccessSnackBarMock,- });(useMutation as unknown as jest.Mock).mockReturnValue([emailPasswordResetLinkMock,]);@@ -77,8 +76,9 @@ describe('useHandleResetPassword', () => {const { result } = renderHooks();await act(() => result.current.handleResetPassword('')());- expect(enqueueErrorSnackBarMock).toHaveBeenCalledWith({- message: 'Invalid email',+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'Invalid email',});});@@ -97,8 +97,9 @@ describe('useHandleResetPassword', () => {captchaToken: 'mock-captcha-token',},});- expect(enqueueSuccessSnackBarMock).toHaveBeenCalledWith({- message:+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'success',+ children:'If this email is registered, a password reset link has been sent',});});@@ -117,8 +118,9 @@ describe('useHandleResetPassword', () => {captchaToken: 'mock-captcha-token',},});- expect(enqueueSuccessSnackBarMock).toHaveBeenCalledWith({- message:+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'success',+ children:'If this email is registered, a password reset link has been sent',});});@@ -129,8 +131,9 @@ describe('useHandleResetPassword', () => {const { result } = renderHooks();await act(() => result.current.handleResetPassword('[email protected]')());- expect(enqueueErrorSnackBarMock).toHaveBeenCalledWith({- message: 'Captcha (anti-bot check) is still loading, try again',+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'Captcha (anti-bot check) is still loading, try again',});expect(emailPasswordResetLinkMock).not.toHaveBeenCalled();});@@ -143,7 +146,10 @@ describe('useHandleResetPassword', () => {const { result } = renderHooks();await act(() => result.current.handleResetPassword('[email protected]')());- expect(enqueueErrorSnackBarMock).toHaveBeenCalledWith({});+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'An error occurred.',+ });});it('should show error message in case of request error', async () => {@@ -153,8 +159,9 @@ describe('useHandleResetPassword', () => {const { result } = renderHooks();await act(() => result.current.handleResetPassword('[email protected]')());- expect(enqueueErrorSnackBarMock).toHaveBeenCalledWith({- message: errorMessage,+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: errorMessage,});});});diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useSignInUp.test.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useSignInUp.test.tsxindex b8ed878b94e..174564d2473 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useSignInUp.test.tsx+++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useSignInUp.test.tsx@@ -7,8 +7,8 @@ import { I18nProvider } from '@lingui/react';import { Provider as JotaiProvider } from 'jotai';import { useAuth } from '@/auth/hooks/useAuth';-import { type Form } from '@/auth/sign-in-up/hooks/useSignInUpForm';import { useSignInUp } from '@/auth/sign-in-up/hooks/useSignInUp';+import { type Form } from '@/auth/sign-in-up/hooks/useSignInUpForm';import { signInUpModeState } from '@/auth/states/signInUpModeState';import { workspacePublicDataState } from '@/auth/states/workspacePublicDataState';import { SignInUpMode } from '@/auth/types/signInUpMode';@@ -24,8 +24,11 @@ jest.mock('@/domain-manager/hooks/useIsCurrentLocationOnAWorkspace', () => ({useIsCurrentLocationOnAWorkspace: () => ({ isOnAWorkspace: true }),}));-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({ enqueueErrorSnackBar: jest.fn() }),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));jest.mock('@/client-config/hooks/useCaptcha', () => ({diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useSso.test.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useSso.test.tsxindex 44207b4007c..2c5bea2bb36 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useSso.test.tsx+++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useSso.test.tsx@@ -1,22 +1,22 @@import { GET_AUTHORIZATION_URL_FOR_SSO } from '@/auth/graphql/mutations/getAuthorizationUrlForSSO';import { useSso } from '@/auth/sign-in-up/hooks/useSso';import { useRedirect } from '@/domain-manager/hooks/useRedirect';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { MockedProvider } from '@apollo/client/testing/react';import { renderHook } from '@testing-library/react';import { MemoryRouter } from 'react-router-dom';-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar');+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),+}));jest.mock('@/domain-manager/hooks/useRedirect');jest.mock('~/generated/graphql');-const mockEnqueueErrorSnackBar = jest.fn();const mockRedirect = jest.fn();-(useSnackBar as jest.Mock).mockReturnValue({- enqueueErrorSnackBar: mockEnqueueErrorSnackBar,-});(useRedirect as jest.Mock).mockReturnValue({redirect: mockRedirect,});@@ -75,7 +75,7 @@ describe('useSso', () => {expect(mockRedirect).toHaveBeenCalledWith('http://example.com');});- it('should enqueue error snackbar when URL retrieval fails', async () => {+ it('should enqueue error toast when URL retrieval fails', async () => {const { result } = renderHook(() => useSso(), {wrapper: Wrapper,});@@ -83,10 +83,9 @@ describe('useSso', () => {await result.current.redirectToSsoLoginPage(identityProviderId);- expect(mockEnqueueErrorSnackBar).toHaveBeenCalledWith({- apolloError: new CombinedGraphQLErrors({- errors: [{ message: 'Error message' }],- }),+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'An error occurred.',});});});diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useHandleResendEmailVerificationToken.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useHandleResendEmailVerificationToken.tsindex f3588d26623..1cc16c8d0e4 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useHandleResendEmailVerificationToken.ts+++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useHandleResendEmailVerificationToken.ts@@ -1,14 +1,14 @@import { useCallback } from 'react';import { useOrigin } from '@/domain-manager/hooks/useOrigin';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { CombinedGraphQLErrors } from '@apollo/client/errors';-import { t } from '@lingui/core/macro';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useMutation } from '@apollo/client/react';+import { t } from '@lingui/core/macro';+import { useToast } from 'twenty-ui/primitives/feedback';import { ResendEmailVerificationTokenDocument } from '~/generated-metadata/graphql';export const useHandleResendEmailVerificationToken = () => {- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [resendEmailVerificationToken, { loading }] = useMutation(ResendEmailVerificationTokenDocument,);@@ -18,9 +18,7 @@ export const useHandleResendEmailVerificationToken = () => {(email: string | null) => {return async () => {if (!email) {- enqueueErrorSnackBar({- message: t`Invalid email`,- });+ enqueueToast({ variant: 'error', children: t`Invalid email` });return;}@@ -33,27 +31,19 @@ export const useHandleResendEmailVerificationToken = () => {});if (data?.resendEmailVerificationToken?.success === true) {- enqueueSuccessSnackBar({- message: t`Email verification link resent!`,+ enqueueToast({+ variant: 'success',+ children: t`Email verification link resent!`,});} else {- enqueueErrorSnackBar({});+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}} catch (error) {- enqueueErrorSnackBar(- CombinedGraphQLErrors.is(error)- ? { apolloError: error }- : { message: error instanceof Error ? error.message : undefined },- );+ enqueueToast(getToastOptionsFromError({ error }));}};},- [- enqueueErrorSnackBar,- enqueueSuccessSnackBar,- resendEmailVerificationToken,- origin,- ],+ [enqueueToast, resendEmailVerificationToken, origin],);return { handleResendEmailVerificationToken, loading };diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useHandleResetPassword.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useHandleResetPassword.tsindex 1bb214b27ac..d26eafe9b69 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useHandleResetPassword.ts+++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useHandleResetPassword.ts@@ -4,15 +4,15 @@ import { currentUserState } from '@/auth/states/currentUserState';import { workspacePublicDataState } from '@/auth/states/workspacePublicDataState';import { useReadCaptchaToken } from '@/captcha/hooks/useReadCaptchaToken';import { useCaptcha } from '@/client-config/hooks/useCaptcha';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { CombinedGraphQLErrors } from '@apollo/client/errors';-import { useLingui } from '@lingui/react/macro';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useMutation } from '@apollo/client/react';+import { useLingui } from '@lingui/react/macro';+import { useToast } from 'twenty-ui/primitives/feedback';import { EmailPasswordResetLinkDocument } from '~/generated-metadata/graphql';-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';export const useHandleResetPassword = () => {- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [emailPasswordResetLink] = useMutation(EmailPasswordResetLinkDocument);const workspacePublicData = useAtomStateValue(workspacePublicDataState);const currentUser = useAtomStateValue(currentUserState);@@ -25,15 +25,14 @@ export const useHandleResetPassword = () => {(email = currentUser?.email) => {return async () => {if (!email) {- enqueueErrorSnackBar({- message: t`Invalid email`,- });+ enqueueToast({ variant: 'error', children: t`Invalid email` });return;}if (!isCaptchaReady) {- enqueueErrorSnackBar({- message: t`Captcha (anti-bot check) is still loading, try again`,+ enqueueToast({+ variant: 'error',+ children: t`Captcha (anti-bot check) is still loading, try again`,});return;}@@ -48,26 +47,22 @@ export const useHandleResetPassword = () => {});if (data?.emailPasswordResetLink?.success === true) {- enqueueSuccessSnackBar({- message: t`If this email is registered, a password reset link has been sent`,+ enqueueToast({+ variant: 'success',+ children: t`If this email is registered, a password reset link has been sent`,});} else {- enqueueErrorSnackBar({});+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}} catch (error) {- enqueueErrorSnackBar(- CombinedGraphQLErrors.is(error)- ? { apolloError: error }- : { message: error instanceof Error ? error.message : undefined },- );+ enqueueToast(getToastOptionsFromError({ error }));}};},[currentUser?.email,workspacePublicData?.id,- enqueueErrorSnackBar,- enqueueSuccessSnackBar,+ enqueueToast,t,emailPasswordResetLink,isCaptchaReady,diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUp.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUp.tsindex 05b2768047c..95adbeb9618 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUp.ts+++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUp.ts@@ -2,34 +2,35 @@ import { useCallback, useState } from 'react';import { type SubmitHandler, type UseFormReturn } from 'react-hook-form';import { useLocation, useParams, useSearchParams } from 'react-router-dom';+import { useAuth } from '@/auth/hooks/useAuth';import { type Form } from '@/auth/sign-in-up/hooks/useSignInUpForm';import { lastAuthenticatedMethodState } from '@/auth/states/lastAuthenticatedMethodState';import { signInUpModeState } from '@/auth/states/signInUpModeState';-import { workspacePublicDataState } from '@/auth/states/workspacePublicDataState';import {SignInUpStep,signInUpStepState,} from '@/auth/states/signInUpStepState';+import { workspacePublicDataState } from '@/auth/states/workspacePublicDataState';import { AuthenticatedMethod } from '@/auth/types/AuthenticatedMethod.enum';import { SignInUpMode } from '@/auth/types/signInUpMode';import { useReadCaptchaToken } from '@/captcha/hooks/useReadCaptchaToken';import { useCaptcha } from '@/client-config/hooks/useCaptcha';import { useBuildSearchParamsFromUrlSyncedStates } from '@/domain-manager/hooks/useBuildSearchParamsFromUrlSyncedStates';import { useIsCurrentLocationOnAWorkspace } from '@/domain-manager/hooks/useIsCurrentLocationOnAWorkspace';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { isErrorLike } from '@apollo/client/errors';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';+import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';+import { useLingui } from '@lingui/react/macro';import { AppPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { buildAppPathWithQueryParams } from '~/utils/buildAppPathWithQueryParams';import { isMatchingLocation } from '~/utils/isMatchingLocation';-import { useAuth } from '@/auth/hooks/useAuth';-import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';export const useSignInUp = (form: UseFormReturn<Form>) => {- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { t } = useLingui();const [signInUpStep, setSignInUpStep] = useAtomState(signInUpStepState);@@ -72,13 +73,12 @@ export const useSignInUp = (form: UseFormReturn<Form>) => {const errorMsgUserAlreadyExist = t`An error occurred while checking user existence`;const continueWithCredentials = useCallback(async () => {if (!form.getValues('email')) {- return enqueueErrorSnackBar({- message: t`Email is required`,- });+ return enqueueToast({ variant: 'error', children: t`Email is required` });}if (!isCaptchaReady) {- return enqueueErrorSnackBar({- message: t`Captcha (anti-bot check) is still loading, try again`,+ return enqueueToast({+ variant: 'error',+ children: t`Captcha (anti-bot check) is still loading, try again`,});}try {@@ -92,7 +92,7 @@ export const useSignInUp = (form: UseFormReturn<Form>) => {});if (isDefined(error)) {- return enqueueErrorSnackBar({ apolloError: error });+ return enqueueToast(getToastOptionsFromError({ error }));}setSignInUpMode(@@ -102,13 +102,13 @@ export const useSignInUp = (form: UseFormReturn<Form>) => {);setSignInUpStep(SignInUpStep.Password);} catch {- enqueueErrorSnackBar({ message: errorMsgUserAlreadyExist });+ enqueueToast({ variant: 'error', children: errorMsgUserAlreadyExist });}}, [readCaptchaToken,form,isCaptchaReady,- enqueueErrorSnackBar,+ enqueueToast,t,checkUserExistsQuery,setSignInUpMode,@@ -123,8 +123,9 @@ export const useSignInUp = (form: UseFormReturn<Form>) => {}if (!isCaptchaReady) {- return enqueueErrorSnackBar({- message: t`Captcha (anti-bot check) is still loading, try again`,+ return enqueueToast({+ variant: 'error',+ children: t`Captcha (anti-bot check) is still loading, try again`,});}@@ -182,9 +183,7 @@ export const useSignInUp = (form: UseFormReturn<Form>) => {verifyEmailRedirectPath,});} catch (error: unknown) {- enqueueErrorSnackBar({- ...(isErrorLike(error) ? { apolloError: error } : {}),- });+ enqueueToast(getToastOptionsFromError({ error }));}},[@@ -198,7 +197,7 @@ export const useSignInUp = (form: UseFormReturn<Form>) => {signUpWithCredentialsInWorkspace,workspaceInviteHash,workspacePersonalInviteToken,- enqueueErrorSnackBar,+ enqueueToast,buildSearchParamsFromUrlSyncedStates,isOnAWorkspace,workspacePublicData,diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignUpInNewWorkspace.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignUpInNewWorkspace.tsindex 6fedcafcde0..90404c86bf1 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignUpInNewWorkspace.ts+++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignUpInNewWorkspace.ts@@ -1,18 +1,19 @@import { useAuth } from '@/auth/hooks/useAuth';import { isMultiWorkspaceEnabledState } from '@/client-config/states/isMultiWorkspaceEnabledState';import { useRedirectToWorkspaceDomain } from '@/domain-manager/hooks/useRedirectToWorkspaceDomain';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { CombinedGraphQLErrors } from '@apollo/client/errors';-import { AppPath } from 'twenty-shared/types';import { useMutation } from '@apollo/client/react';+import { useLingui } from '@lingui/react/macro';+import { AppPath } from 'twenty-shared/types';+import { assertIsDefinedOrThrow, isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import {SignUpInNewWorkspaceDocument,UploadNewWorkspaceLogoDocument,} from '~/generated-metadata/graphql';import { getWorkspaceUrl } from '~/utils/getWorkspaceUrl';-import { assertIsDefinedOrThrow, isDefined } from 'twenty-shared/utils';-import { useLingui } from '@lingui/react/macro';export const useSignUpInNewWorkspace = () => {const { redirectToWorkspaceDomain } = useRedirectToWorkspaceDomain();@@ -20,7 +21,7 @@ export const useSignUpInNewWorkspace = () => {const isMultiWorkspaceEnabled = useAtomStateValue(isMultiWorkspaceEnabledState,);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { t } = useLingui();const [signUpInNewWorkspaceMutation] = useMutation(@@ -53,16 +54,17 @@ export const useSignUpInNewWorkspace = () => {variables: { workspaceId, file: logo },});} catch (logoUploadError) {- enqueueErrorSnackBar(- CombinedGraphQLErrors.is(logoUploadError)- ? { apolloError: logoUploadError }- : {- message:- logoUploadError instanceof Error- ? logoUploadError.message- : t`Workspace logo upload failed`,- },- );+ if (CombinedGraphQLErrors.is(logoUploadError)) {+ enqueueToast(getToastOptionsFromError({ error: logoUploadError }));+ } else {+ enqueueToast({+ variant: 'error',+ children:+ logoUploadError instanceof Error+ ? logoUploadError.message+ : t`Workspace logo upload failed`,+ });+ }}}@@ -82,16 +84,17 @@ export const useSignUpInNewWorkspace = () => {return true;} catch (error) {- enqueueErrorSnackBar(- CombinedGraphQLErrors.is(error)- ? { apolloError: error }- : {- message:- error instanceof Error- ? error.message- : t`Workspace creation failed`,- },- );+ if (CombinedGraphQLErrors.is(error)) {+ enqueueToast(getToastOptionsFromError({ error }));+ } else {+ enqueueToast({+ variant: 'error',+ children:+ error instanceof Error+ ? error.message+ : t`Workspace creation failed`,+ });+ }return false;}diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSso.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSso.tsindex baf3b5dfaa1..52e8e00aa65 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSso.ts+++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSso.ts@@ -1,17 +1,19 @@/* @license Enterprise */import { useRedirect } from '@/domain-manager/hooks/useRedirect';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';+import { useApolloClient } from '@apollo/client/react';-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useParams } from 'react-router-dom';++import { useToast } from 'twenty-ui/primitives/feedback';import { GetAuthorizationUrlForSsoDocument } from '~/generated-metadata/graphql';export const useSso = () => {const apolloClient = useApolloClient();const workspaceInviteHash = useParams().workspaceInviteHash;- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { redirect } = useRedirect();const redirectToSsoLoginPage = async (identityProviderId: string) => {let authorizationUrlForSsoResult;@@ -26,11 +28,7 @@ export const useSso = () => {},});} catch (error: unknown) {- return enqueueErrorSnackBar(- CombinedGraphQLErrors.is(error)- ? { apolloError: error }- : { message: error instanceof Error ? error.message : undefined },- );+ return enqueueToast(getToastOptionsFromError({ error }));}const authorizationURL =diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useWorkspaceFromInviteHash.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useWorkspaceFromInviteHash.tsindex ab94d6dffea..899870b2dc0 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useWorkspaceFromInviteHash.ts+++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useWorkspaceFromInviteHash.ts@@ -4,17 +4,18 @@ import { useParams } from 'react-router-dom';import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';+import { useToast } from 'twenty-ui/primitives/feedback';+import { useQuery } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { AppPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';-import { useQuery } from '@apollo/client/react';import { GetWorkspaceFromInviteHashDocument } from '~/generated-metadata/graphql';import { useNavigateApp } from '~/hooks/useNavigateApp';export const useWorkspaceFromInviteHash = () => {- const { enqueueErrorSnackBar, enqueueInfoSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const navigate = useNavigateApp();const workspaceInviteHash = useParams().workspaceInviteHash;const currentWorkspace = useAtomStateValue(currentWorkspaceState);@@ -32,10 +33,10 @@ export const useWorkspaceFromInviteHash = () => {useEffect(() => {if (error) {- enqueueErrorSnackBar({ apolloError: error });+ enqueueToast(getToastOptionsFromError({ error }));navigate(AppPath.Index);}- }, [error, enqueueErrorSnackBar, navigate]);+ }, [error, enqueueToast, navigate]);// TODO: Rework this useEffect - Charles will refactor as part of auth reworkuseEffect(() => {@@ -51,8 +52,9 @@ export const useWorkspaceFromInviteHash = () => {setHasRedirected(true);const workspaceDisplayName = inviteWorkspace.displayName;initiallyLoggedIn &&- enqueueInfoSnackBar({- message: workspaceDisplayName+ enqueueToast({+ variant: 'info',+ children: workspaceDisplayName? t`You already belong to the workspace ${workspaceDisplayName}`: t`You already belong to this workspace`,});@@ -63,7 +65,7 @@ export const useWorkspaceFromInviteHash = () => {currentWorkspace,hasRedirected,initiallyLoggedIn,- enqueueInfoSnackBar,+ enqueueToast,navigate,]);return {diff --git a/packages/twenty-front/src/modules/command-menu-item/components/__stories__/RecordIndexCommandMenuDropdown.stories.tsx b/packages/twenty-front/src/modules/command-menu-item/components/__stories__/RecordIndexCommandMenuDropdown.stories.tsxindex df9ca7284bf..57c7b0b819c 100644--- a/packages/twenty-front/src/modules/command-menu-item/components/__stories__/RecordIndexCommandMenuDropdown.stories.tsx+++ b/packages/twenty-front/src/modules/command-menu-item/components/__stories__/RecordIndexCommandMenuDropdown.stories.tsx@@ -15,7 +15,7 @@ import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { RouterDecorator } from 'twenty-ui/testing';import { ContextStoreDecorator } from '~/testing/decorators/ContextStoreDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const meta: Meta<typeof RecordIndexCommandMenuDropdown> = {title: 'Modules/CommandMenu/RecordIndexCommandMenuDropdown',@@ -57,7 +57,7 @@ const meta: Meta<typeof RecordIndexCommandMenuDropdown> = {},ContextStoreDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,RouterDecorator,],};diff --git a/packages/twenty-front/src/modules/command-menu-item/components/__stories__/RecordShowSidePanelCommandMenuDropdown.stories.tsx b/packages/twenty-front/src/modules/command-menu-item/components/__stories__/RecordShowSidePanelCommandMenuDropdown.stories.tsxindex 8533ab499be..e7365cdadef 100644--- a/packages/twenty-front/src/modules/command-menu-item/components/__stories__/RecordShowSidePanelCommandMenuDropdown.stories.tsx+++ b/packages/twenty-front/src/modules/command-menu-item/components/__stories__/RecordShowSidePanelCommandMenuDropdown.stories.tsx@@ -14,7 +14,7 @@ import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';import { ContextStoreDecorator } from '~/testing/decorators/ContextStoreDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { JestContextStoreSetter } from '~/testing/jest/JestContextStoreSetter';const meta: Meta<typeof RecordPageSidePanelCommandMenuDropdown> = {@@ -59,7 +59,7 @@ const meta: Meta<typeof RecordPageSidePanelCommandMenuDropdown> = {ComponentDecorator,ContextStoreDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,RouterDecorator,],args: {diff --git a/packages/twenty-front/src/modules/command-menu-item/display/components/CommandMenuItemErrorBoundary.tsx b/packages/twenty-front/src/modules/command-menu-item/display/components/CommandMenuItemErrorBoundary.tsxindex 4ba8ff34de1..ebb2708c029 100644--- a/packages/twenty-front/src/modules/command-menu-item/display/components/CommandMenuItemErrorBoundary.tsx+++ b/packages/twenty-front/src/modules/command-menu-item/display/components/CommandMenuItemErrorBoundary.tsx@@ -1,8 +1,8 @@import { CommandComponentInstanceContext } from '@/command-menu-item/engine-command/states/contexts/CommandComponentInstanceContext';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';import { type ReactNode } from 'react';import { ErrorBoundary } from 'react-error-boundary';+import { useToast } from 'twenty-ui/primitives/feedback';type CommandMenuItemErrorBoundaryProps = {children: ReactNode;@@ -15,14 +15,14 @@ export const CommandMenuItemErrorBoundary = ({shouldReportToSentry = false,onError,}: CommandMenuItemErrorBoundaryProps) => {- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const commandMenuItemId = useAvailableComponentInstanceIdOrThrow(CommandComponentInstanceContext,);const handleError = async (error: Error) => {- enqueueErrorSnackBar({ message: error.message });+ enqueueToast({ variant: 'error', children: error.message });if (shouldReportToSentry) {try {diff --git a/packages/twenty-front/src/modules/command-menu-item/display/components/__stories__/SidePanelCommandMenuItemDisplayPage.stories.tsx b/packages/twenty-front/src/modules/command-menu-item/display/components/__stories__/SidePanelCommandMenuItemDisplayPage.stories.tsxindex 4acb7fd35f9..57b7b338409 100644--- a/packages/twenty-front/src/modules/command-menu-item/display/components/__stories__/SidePanelCommandMenuItemDisplayPage.stories.tsx+++ b/packages/twenty-front/src/modules/command-menu-item/display/components/__stories__/SidePanelCommandMenuItemDisplayPage.stories.tsx@@ -6,21 +6,22 @@ import {type StoryObj,} from '@storybook/react-vite';import { Provider as JotaiProvider } from 'jotai';-import { graphql, HttpResponse } from 'msw';+import { HttpResponse, graphql } from 'msw';+import { useState, type PropsWithChildren } from 'react';import { Context as ResponsiveContext } from 'react-responsive';import { MemoryRouter } from 'react-router-dom';import { expect, fn, spyOn, userEvent, waitFor, within } from 'storybook/test';import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';-import { CommandMenuContext } from '@/command-menu-item/contexts/CommandMenuContext';import { EMPTY_COMMAND_MENU_CONTEXT_API } from '@/command-menu-item/constants/EmptyCommandMenuContextApi';+import { CommandMenuContext } from '@/command-menu-item/contexts/CommandMenuContext';import { SidePanelCommandMenuItemDisplayPage } from '@/command-menu-item/display/components/SidePanelCommandMenuItemDisplayPage';import { commandMenuPinnedInlineLayoutFamilyState } from '@/command-menu-item/display/states/commandMenuPinnedInlineLayoutFamilyState';import { CommandMenuComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuComponentInstanceContext';import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId';import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState';import { sidePanelSearchState } from '@/side-panel/states/sidePanelSearchState';-import { SnackBarProvider } from '@/ui/feedback/snack-bar-manager/components/SnackBarProvider';+import { AppToaster } from '@/ui/feedback/toast/components/AppToaster';import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';import { navigationDrawerActiveTabState } from '@/ui/navigation/states/navigationDrawerActiveTabState';import { NAVIGATION_DRAWER_TABS } from '@/ui/navigation/states/navigationDrawerTabs';@@ -30,25 +31,38 @@ import { focusStackState } from '@/ui/utilities/focus/states/focusStackState';import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { type ColorScheme } from '@/workspace-member/types/WorkspaceMember';-import { ContextStoreDecorator } from '~/testing/decorators/ContextStoreDecorator';-import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';-import { mockedWorkspaceMemberData } from '~/testing/mock-data/users';import {CommandMenuItemAvailabilityType,EngineComponentKey,type CommandMenuItemFieldsFragment,} from '~/generated-metadata/graphql';+import { ContextStoreDecorator } from '~/testing/decorators/ContextStoreDecorator';+import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';+import { mockedWorkspaceMemberData } from '~/testing/mock-data/users';const PINNED_ITEM_WIDTH = 100;-// CI zeroes animation durations, which would immediately dismiss snackbars.+// CI zeroes animation durations, which would immediately dismiss toasts.const StyledStoryContainer = styled.div`[role='status'] * {animation: none !important;}`;+const ToastStoryContainer = ({ children }: PropsWithChildren) => {+ const [toastContainer, setToastContainer] = useState<HTMLDivElement | null>(+ null,+ );++ return (+ <StyledStoryContainer ref={setToastContainer}>+ <AppToaster container={toastContainer} />+ {children}+ </StyledStoryContainer>+ );+};+const createCommandMenuItem = (overrides: Partial<CommandMenuItemFieldsFragment> &Pick<CommandMenuItemFieldsFragment, 'id' | 'label'>,@@ -179,11 +193,9 @@ const createDecorator =}}><BaseThemeProvider>- <StyledStoryContainer>- <SnackBarProvider>- <Story />- </SnackBarProvider>- </StyledStoryContainer>+ <ToastStoryContainer>+ <Story />+ </ToastStoryContainer></BaseThemeProvider></CommandMenuContext.Provider></CommandMenuComponentInstanceContext.Provider>@@ -199,7 +211,7 @@ const meta: Meta<typeof SidePanelCommandMenuItemDisplayPage> = {decorators: [ContextStoreDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,],};diff --git a/packages/twenty-front/src/modules/command-menu-item/edit/hooks/useResetCommandMenuItemToDefault.ts b/packages/twenty-front/src/modules/command-menu-item/edit/hooks/useResetCommandMenuItemToDefault.tsindex 1e52ef86d80..86a0722d050 100644--- a/packages/twenty-front/src/modules/command-menu-item/edit/hooks/useResetCommandMenuItemToDefault.ts+++ b/packages/twenty-front/src/modules/command-menu-item/edit/hooks/useResetCommandMenuItemToDefault.ts@@ -10,7 +10,7 @@ import { commandMenuItemsDraftState } from '@/command-menu-item/edit/states/commimport { RESET_COMMAND_MENU_ITEM } from '@/command-menu-item/graphql/mutations/resetCommandMenuItem';import { useMetadataErrorHandler } from '@/metadata-error-handler/hooks/useMetadataErrorHandler';import { useUpdateMetadataStoreDraft } from '@/metadata-store/hooks/useUpdateMetadataStoreDraft';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useToast } from 'twenty-ui/primitives/feedback';import {type ResetCommandMenuItemMutation,type ResetCommandMenuItemMutationVariables,@@ -24,7 +24,7 @@ export const useResetCommandMenuItemToDefault = () => {>(RESET_COMMAND_MENU_ITEM);const { updateInDraft, applyChanges } = useUpdateMetadataStoreDraft();const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const resetCommandMenuItemToDefault = useCallback(async (id: string) => {@@ -57,7 +57,7 @@ export const useResetCommandMenuItemToDefault = () => {operationType: CrudOperationType.UPDATE,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}}},@@ -67,7 +67,7 @@ export const useResetCommandMenuItemToDefault = () => {applyChanges,store,handleMetadataError,- enqueueErrorSnackBar,+ enqueueToast,],);diff --git a/packages/twenty-front/src/modules/command-menu-item/engine-command/components/HeadlessEngineCommandWrapperEffect.tsx b/packages/twenty-front/src/modules/command-menu-item/engine-command/components/HeadlessEngineCommandWrapperEffect.tsxindex f8658dd6b20..174b1c7f1f9 100644--- a/packages/twenty-front/src/modules/command-menu-item/engine-command/components/HeadlessEngineCommandWrapperEffect.tsx+++ b/packages/twenty-front/src/modules/command-menu-item/engine-command/components/HeadlessEngineCommandWrapperEffect.tsx@@ -1,11 +1,10 @@-import { CombinedGraphQLErrors } from '@apollo/client/errors';-import { useIsHeadlessEngineCommandEffectInitialized } from '@/command-menu-item/engine-command/hooks/useIsHeadlessEngineCommandEffectInitialized';import { useUnmountCommand } from '@/command-menu-item/engine-command/hooks/useUnmountEngineCommand';import { CommandComponentInstanceContext } from '@/command-menu-item/engine-command/states/contexts/CommandComponentInstanceContext';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';import { useEffect } from 'react';+import { useToast } from 'twenty-ui/primitives/feedback';export type HeadlessEngineCommandWrapperEffectProps = {execute: () => void | Promise<unknown>;@@ -25,7 +24,7 @@ export const HeadlessEngineCommandWrapperEffect = ({const unmountCommand = useUnmountCommand();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();useEffect(() => {if (isInitializedRef.current || !ready) {@@ -38,9 +37,7 @@ export const HeadlessEngineCommandWrapperEffect = ({try {await execute();} catch (error) {- enqueueErrorSnackBar({- ...(CombinedGraphQLErrors.is(error) ? { apolloError: error } : {}),- });+ enqueueToast(getToastOptionsFromError({ error }));} finally {// Unmount even on failure, otherwise the headless command stays mounted// and can never be triggered again.@@ -56,7 +53,7 @@ export const HeadlessEngineCommandWrapperEffect = ({setIsInitialized,commandMenuItemId,unmountCommand,- enqueueErrorSnackBar,+ enqueueToast,]);return null;diff --git a/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/dashboard/components/DuplicateDashboardSingleRecordCommand.tsx b/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/dashboard/components/DuplicateDashboardSingleRecordCommand.tsxindex 595d5d7dede..9f0f06878c3 100644--- a/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/dashboard/components/DuplicateDashboardSingleRecordCommand.tsx+++ b/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/dashboard/components/DuplicateDashboardSingleRecordCommand.tsx@@ -1,11 +1,11 @@import { HeadlessEngineCommandWrapperEffect } from '@/command-menu-item/engine-command/components/HeadlessEngineCommandWrapperEffect';import { useHeadlessCommandContextApi } from '@/command-menu-item/engine-command/hooks/useHeadlessCommandContextApi';import { useDuplicateDashboard } from '@/dashboards/hooks/useDuplicateDashboard';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useLingui } from '@lingui/react/macro';import { isNonEmptyString } from '@sniptt/guards';import { AppPath, CoreObjectNameSingular } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { useNavigateApp } from '~/hooks/useNavigateApp';export const DuplicateDashboardSingleRecordCommand = () => {@@ -14,7 +14,7 @@ export const DuplicateDashboardSingleRecordCommand = () => {const recordId = selectedRecords[0]?.id;const { duplicateDashboard } = useDuplicateDashboard();const navigate = useNavigateApp();- const { enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { t } = useLingui();if (!isDefined(recordId)) {@@ -25,8 +25,9 @@ export const DuplicateDashboardSingleRecordCommand = () => {const result = await duplicateDashboard(recordId);if (isDefined(result) && isNonEmptyString(result.id)) {- enqueueSuccessSnackBar({- message: t`Dashboard duplicated successfully`,+ enqueueToast({+ variant: 'success',+ children: t`Dashboard duplicated successfully`,});navigate(AppPath.RecordShowPage, {diff --git a/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/message-list/components/DuplicateMessageListSingleRecordCommand.tsx b/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/message-list/components/DuplicateMessageListSingleRecordCommand.tsxindex a9694eedbe4..73c0e6a8f02 100644--- a/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/message-list/components/DuplicateMessageListSingleRecordCommand.tsx+++ b/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/message-list/components/DuplicateMessageListSingleRecordCommand.tsx@@ -1,12 +1,12 @@import { HeadlessEngineCommandWrapperEffect } from '@/command-menu-item/engine-command/components/HeadlessEngineCommandWrapperEffect';import { useHeadlessCommandContextApi } from '@/command-menu-item/engine-command/hooks/useHeadlessCommandContextApi';import { useDuplicateMessageList } from '@/command-menu-item/engine-command/record/single-record/message-list/hooks/useDuplicateMessageList';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { plural } from '@lingui/core/macro';import { useLingui } from '@lingui/react/macro';import { isNonEmptyString } from '@sniptt/guards';import { AppPath, CoreObjectNameSingular } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { useNavigateApp } from '~/hooks/useNavigateApp';export const DuplicateMessageListSingleRecordCommand = () => {@@ -15,7 +15,7 @@ export const DuplicateMessageListSingleRecordCommand = () => {const recordId = selectedRecords[0]?.id;const { duplicateMessageList } = useDuplicateMessageList();const navigate = useNavigateApp();- const { enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { t } = useLingui();if (!isDefined(recordId)) {@@ -28,8 +28,9 @@ export const DuplicateMessageListSingleRecordCommand = () => {if (isDefined(result) && isNonEmptyString(result.id)) {const memberCount = result.memberCount;- enqueueSuccessSnackBar({- message: t`List duplicated with ${plural(memberCount, {+ enqueueToast({+ variant: 'success',+ children: t`List duplicated with ${plural(memberCount, {one: '# member',other: '# members',})}`,diff --git a/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/message-list/hooks/useDuplicateMessageList.ts b/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/message-list/hooks/useDuplicateMessageList.tsindex b11cc793a19..f5ab0fc92f8 100644--- a/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/message-list/hooks/useDuplicateMessageList.ts+++ b/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/message-list/hooks/useDuplicateMessageList.ts@@ -1,11 +1,11 @@import { useMetadataErrorHandler } from '@/metadata-error-handler/hooks/useMetadataErrorHandler';import { useAddDuplicatedRecordToCache } from '@/object-record/cache/hooks/useAddDuplicatedRecordToCache';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { CoreObjectNameSingular, CrudOperationType } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { DuplicateMessageListDocument } from '~/generated-metadata/graphql';export const useDuplicateMessageList = () => {@@ -16,7 +16,7 @@ export const useDuplicateMessageList = () => {const [mutate] = useMutation(DuplicateMessageListDocument);const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const duplicateMessageList = async (messageListId: string) => {try {@@ -44,7 +44,10 @@ export const useDuplicateMessageList = () => {operationType: CrudOperationType.CREATE,});} else {- enqueueErrorSnackBar({ message: t`Failed to duplicate list` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to duplicate list`,+ });}return undefined;diff --git a/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/workflow/components/DuplicateWorkflowSingleRecordCommand.tsx b/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/workflow/components/DuplicateWorkflowSingleRecordCommand.tsxindex 89779f799f9..af7f77a4333 100644--- a/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/workflow/components/DuplicateWorkflowSingleRecordCommand.tsx+++ b/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/workflow/components/DuplicateWorkflowSingleRecordCommand.tsx@@ -1,12 +1,12 @@import { HeadlessEngineCommandWrapperEffect } from '@/command-menu-item/engine-command/components/HeadlessEngineCommandWrapperEffect';import { useHeadlessCommandContextApi } from '@/command-menu-item/engine-command/hooks/useHeadlessCommandContextApi';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useDuplicateWorkflow } from '@/workflow/hooks/useDuplicateWorkflow';import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';import { useLingui } from '@lingui/react/macro';import { isNonEmptyString } from '@sniptt/guards';import { AppPath, CoreObjectNameSingular } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { useNavigateApp } from '~/hooks/useNavigateApp';export const DuplicateWorkflowSingleRecordCommand = () => {@@ -16,7 +16,7 @@ export const DuplicateWorkflowSingleRecordCommand = () => {const workflow = useWorkflowWithCurrentVersion(recordId ?? '');const { duplicateWorkflow } = useDuplicateWorkflow();const navigate = useNavigateApp();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { t } = useLingui();if (!isDefined(recordId)) {@@ -34,8 +34,9 @@ export const DuplicateWorkflowSingleRecordCommand = () => {});if (isDefined(result) && isNonEmptyString(result.workflowId)) {- enqueueSuccessSnackBar({- message: t`Workflow duplicated successfully`,+ enqueueToast({+ variant: 'success',+ children: t`Workflow duplicated successfully`,});navigate(AppPath.RecordShowPage, {@@ -43,8 +44,9 @@ export const DuplicateWorkflowSingleRecordCommand = () => {objectRecordId: result.workflowId,});} else {- enqueueErrorSnackBar({- message: t`Failed to duplicate workflow`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to duplicate workflow`,});}};diff --git a/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx b/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsxindex 49845db653e..95a85cd652f 100644--- a/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx+++ b/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx@@ -11,7 +11,7 @@ import { metadataStoreState } from '@/metadata-store/states/metadataStoreState';import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';import { mockedCommandMenuItems } from '~/testing/mock-data/generated/metadata/command-menu-items/mock-command-menu-items-data';import {@@ -21,25 +21,24 @@ import {} from '~/testing/mock-data/users';import { sleep } from '~/utils/sleep';+import { type SidePanelCommandMenuItemDisplayPage } from '@/command-menu-item/display/components/SidePanelCommandMenuItemDisplayPage';import { CommandMenuComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuComponentInstanceContext';import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId';import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState';import { contextStoreCurrentPageTypeComponentState } from '@/context-store/states/contextStoreCurrentPageTypeComponentState';import { contextStoreCurrentViewTypeComponentState } from '@/context-store/states/contextStoreCurrentViewTypeComponentState';import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext';-import { ContextStorePageType } from 'twenty-shared/types';import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType';import { objectMetadataItemsSelector } from '@/object-metadata/states/objectMetadataItemsSelector';import { RecordComponentInstanceContextsWrapper } from '@/object-record/components/RecordComponentInstanceContextsWrapper';import { SidePanelRouter } from '@/side-panel/components/SidePanelRouter';-import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId';import { SIDE_PANEL_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelComponentInstanceId';-import { type SidePanelCommandMenuItemDisplayPage } from '@/command-menu-item/display/components/SidePanelCommandMenuItemDisplayPage';+import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId';import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState';import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState';import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext';import { HttpResponse, graphql } from 'msw';-import { SidePanelPages } from 'twenty-shared/types';+import { ContextStorePageType, SidePanelPages } from 'twenty-shared/types';import { IconDotsVertical, IconPlus } from 'twenty-ui/icon';import { JestContextStoreSetter } from '~/testing/jest/JestContextStoreSetter';@@ -132,7 +131,7 @@ const meta: Meta<typeof SidePanelCommandMenuItemDisplayPage> = {},ContextStoreDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,ComponentWithRouterDecorator,],parameters: {diff --git a/packages/twenty-front/src/modules/dashboards/hooks/useDuplicateDashboard.ts b/packages/twenty-front/src/modules/dashboards/hooks/useDuplicateDashboard.tsindex 66eec1f8604..f4ed61f451f 100644--- a/packages/twenty-front/src/modules/dashboards/hooks/useDuplicateDashboard.ts+++ b/packages/twenty-front/src/modules/dashboards/hooks/useDuplicateDashboard.ts@@ -1,11 +1,11 @@import { useMetadataErrorHandler } from '@/metadata-error-handler/hooks/useMetadataErrorHandler';import { useAddDuplicatedRecordToCache } from '@/object-record/cache/hooks/useAddDuplicatedRecordToCache';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { CoreObjectNameSingular, CrudOperationType } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { DuplicateDashboardDocument } from '~/generated-metadata/graphql';export const useDuplicateDashboard = () => {@@ -16,7 +16,7 @@ export const useDuplicateDashboard = () => {const [mutate] = useMutation(DuplicateDashboardDocument);const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const duplicateDashboard = async (dashboardId: string) => {try {@@ -39,7 +39,10 @@ export const useDuplicateDashboard = () => {operationType: CrudOperationType.CREATE,});} else {- enqueueErrorSnackBar({ message: t`Failed to duplicate dashboard` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to duplicate dashboard`,+ });}return undefined;diff --git a/packages/twenty-front/src/modules/error-handler/components/ErrorMessageEffect.tsx b/packages/twenty-front/src/modules/error-handler/components/ErrorMessageEffect.tsxindex 0d242c3c122..98cc45502ca 100644--- a/packages/twenty-front/src/modules/error-handler/components/ErrorMessageEffect.tsx+++ b/packages/twenty-front/src/modules/error-handler/components/ErrorMessageEffect.tsx@@ -1,27 +1,26 @@import { useEffect } from 'react';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useSearchParams } from 'react-router-dom';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';export const ErrorMessageEffect = () => {- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [searchParams, setSearchParams] = useSearchParams();const errorMessage = searchParams.get('errorMessage');useEffect(() => {if (isDefined(errorMessage)) {- enqueueErrorSnackBar({- message: errorMessage,- options: {- dedupeKey: 'error-message-dedupe-key',- },+ enqueueToast({+ variant: 'error',+ children: errorMessage,+ dedupeKey: 'error-message-dedupe-key',});const newSearchParams = new URLSearchParams(searchParams);newSearchParams.delete('errorMessage');setSearchParams(newSearchParams);}- }, [enqueueErrorSnackBar, errorMessage, searchParams, setSearchParams]);+ }, [enqueueToast, errorMessage, searchParams, setSearchParams]);return <></>;};diff --git a/packages/twenty-front/src/modules/error-handler/components/PromiseRejectionEffect.tsx b/packages/twenty-front/src/modules/error-handler/components/PromiseRejectionEffect.tsxindex b29f7051cae..a219350d522 100644--- a/packages/twenty-front/src/modules/error-handler/components/PromiseRejectionEffect.tsx+++ b/packages/twenty-front/src/modules/error-handler/components/PromiseRejectionEffect.tsx@@ -1,7 +1,7 @@import { useCallback, useEffect } from 'react';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { checkIfItsAViteStaleChunkLazyLoadingError } from '@/error-handler/utils/checkIfItsAViteStaleChunkLazyLoadingError';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import {CombinedGraphQLErrors,CombinedProtocolErrors,@@ -12,6 +12,7 @@ import {UnconventionalError,} from '@apollo/client/errors';import { isDefined, type CustomError } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';const isApolloError = (error: unknown): boolean =>CombinedGraphQLErrors.is(error) ||@@ -29,15 +30,13 @@ const hasErrorCode = (};export const PromiseRejectionEffect = () => {- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const handlePromiseRejection = useCallback(async (event: PromiseRejectionEvent) => {const error = event.reason;if (isApolloError(error)) {- enqueueErrorSnackBar({- apolloError: error,- });+ enqueueToast(getToastOptionsFromError({ error }));return; // already handled by apolloLink}@@ -50,9 +49,7 @@ export const PromiseRejectionEffect = () => {checkIfItsAViteStaleChunkLazyLoadingError(error);if (!isAbortError && !isViteStaleChunkLazyLoadingError) {- enqueueErrorSnackBar(- error instanceof Error ? { message: error.message } : {},- );+ enqueueToast(getToastOptionsFromError({ error }));}try {@@ -70,7 +67,7 @@ export const PromiseRejectionEffect = () => {console.error('Failed to capture exception with Sentry:', sentryError);}},- [enqueueErrorSnackBar],+ [enqueueToast],);useEffect(() => {diff --git a/packages/twenty-front/src/modules/error-handler/components/__tests__/PromiseRejectionEffect.test.tsx b/packages/twenty-front/src/modules/error-handler/components/__tests__/PromiseRejectionEffect.test.tsxindex a52ed4b321f..b4488bbd9a6 100644--- a/packages/twenty-front/src/modules/error-handler/components/__tests__/PromiseRejectionEffect.test.tsx+++ b/packages/twenty-front/src/modules/error-handler/components/__tests__/PromiseRejectionEffect.test.tsx@@ -6,10 +6,11 @@ jest.mock('@sentry/react', () => ({captureException: jest.fn(),}));-const enqueueErrorSnackBar = jest.fn();+const mockEnqueueToast = jest.fn();-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({ enqueueErrorSnackBar }),+jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));const { captureException } = jest.requireMock('@sentry/react');@@ -27,21 +28,22 @@ describe('PromiseRejectionEffect', () => {render(<PromiseRejectionEffect />);});- it('should not snackbar a stale chunk error', async () => {+ it('should not toast a stale chunk error', async () => {dispatchUnhandledRejection(new Error('Importing a module script failed.'));await waitFor(() => {expect(captureException).toHaveBeenCalledTimes(1);});- expect(enqueueErrorSnackBar).not.toHaveBeenCalled();+ expect(mockEnqueueToast).not.toHaveBeenCalled();});- it('should still snackbar an unrelated error', async () => {+ it('should still toast an unrelated error', async () => {dispatchUnhandledRejection(new Error('Some unrelated error'));- expect(enqueueErrorSnackBar).toHaveBeenCalledWith({- message: 'Some unrelated error',+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'Some unrelated error',});await waitFor(() => {@@ -49,20 +51,23 @@ describe('PromiseRejectionEffect', () => {});});- it('should not snackbar an abort error', async () => {+ it('should not toast an abort error', async () => {dispatchUnhandledRejection({ name: 'AbortError' });await waitFor(() => {expect(captureException).toHaveBeenCalledTimes(1);});- expect(enqueueErrorSnackBar).not.toHaveBeenCalled();+ expect(mockEnqueueToast).not.toHaveBeenCalled();});- it('should snackbar a generic message when the reason is not an Error', async () => {+ it('should toast a generic message when the reason is not an Error', async () => {dispatchUnhandledRejection('something went wrong');- expect(enqueueErrorSnackBar).toHaveBeenCalledWith({});+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'An error occurred.',+ });await waitFor(() => {expect(captureException).toHaveBeenCalledTimes(1);diff --git a/packages/twenty-front/src/modules/error-handler/utils/__tests__/getToastOptionsFromError.test.tsx b/packages/twenty-front/src/modules/error-handler/utils/__tests__/getToastOptionsFromError.test.tsxnew file mode 100644index 00000000000..f0a6ca73753--- /dev/null+++ b/packages/twenty-front/src/modules/error-handler/utils/__tests__/getToastOptionsFromError.test.tsx@@ -0,0 +1,38 @@+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';++describe('getToastOptionsFromError', () => {+ it('preserves custom content, actions, and delivery options', () => {+ const action = <a href="/help">Get help</a>;+ const onClose = jest.fn();++ expect(+ getToastOptionsFromError({+ error: new Error('Connection lost'),+ children: 'Try again later',+ description: 'Your changes are still here',+ action,+ duration: 10000,+ dedupeKey: 'connection',+ onClose,+ }),+ ).toEqual({+ variant: 'error',+ children: 'Try again later',+ description: 'Your changes are still here',+ action,+ duration: 10000,+ dedupeKey: 'connection',+ onClose,+ });+ expect(onClose).not.toHaveBeenCalled();+ });++ it('suppresses aborted requests even when custom content is provided', () => {+ expect(+ getToastOptionsFromError({+ error: new DOMException('Request aborted', 'AbortError'),+ children: 'Try again later',+ }),+ ).toBeUndefined();+ });+});diff --git a/packages/twenty-front/src/modules/error-handler/utils/getToastOptionsFromError.tsx b/packages/twenty-front/src/modules/error-handler/utils/getToastOptionsFromError.tsxnew file mode 100644index 00000000000..93933338ea2--- /dev/null+++ b/packages/twenty-front/src/modules/error-handler/utils/getToastOptionsFromError.tsx@@ -0,0 +1,52 @@+import { isErrorLike } from '@apollo/client/errors';+import { t } from '@lingui/core/macro';+import { AppPath } from 'twenty-shared/types';+import { getAppPath, isDefined } from 'twenty-shared/utils';+import { type ToastOptions } from 'twenty-ui/primitives/feedback';+import { Button } from 'twenty-ui/primitives/input';++import { getConflictingRecordFromApolloError } from '~/utils/get-conflicting-record-from-apollo-error.util';+import { getErrorMessageFromApolloError } from '~/utils/get-error-message-from-apollo-error.util';++type GetToastOptionsFromErrorParams = Omit<ToastOptions, 'variant'> & {+ error: unknown;+};++export const getToastOptionsFromError = ({+ error,+ ...options+}: GetToastOptionsFromErrorParams): ToastOptions | undefined => {+ const errorLike = isErrorLike(error) ? error : undefined;++ if (errorLike?.name === 'AbortError') {+ return;+ }++ const conflictingRecord = isDefined(errorLike)+ ? getConflictingRecordFromApolloError(errorLike)+ : null;++ return {+ ...options,+ children:+ options.children ??+ (isDefined(errorLike)+ ? getErrorMessageFromApolloError(errorLike)+ : t`An error occurred.`),+ action:+ options.action ??+ (isDefined(conflictingRecord) ? (+ <Button+ to={getAppPath(AppPath.RecordShowPage, {+ objectNameSingular: conflictingRecord.conflictingObjectNameSingular,+ objectRecordId: conflictingRecord.conflictingRecordId,+ })}+ title={t`View existing record`}+ ariaLabel={t`View existing record`}+ variant="tertiary"+ size="small"+ />+ ) : undefined),+ variant: 'error',+ };+};diff --git a/packages/twenty-front/src/modules/front-components/components/FrontComponentLoadErrorSnackBarEffect.tsx b/packages/twenty-front/src/modules/front-components/components/FrontComponentLoadErrorSnackBarEffect.tsxdeleted file mode 100644index a81905c883a..00000000000--- a/packages/twenty-front/src/modules/front-components/components/FrontComponentLoadErrorSnackBarEffect.tsx+++ /dev/null@@ -1,24 +0,0 @@-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { t } from '@lingui/core/macro';-import { useEffect } from 'react';-import { isDefined } from 'twenty-shared/utils';--type FrontComponentLoadErrorSnackBarEffectProps = {- errorMessage?: string;-};--export const FrontComponentLoadErrorSnackBarEffect = ({- errorMessage,-}: FrontComponentLoadErrorSnackBarEffectProps) => {- const { enqueueErrorSnackBar } = useSnackBar();-- useEffect(() => {- if (isDefined(errorMessage)) {- enqueueErrorSnackBar({- message: t`Failed to load front component: ${errorMessage}`,- });- }- }, [errorMessage, enqueueErrorSnackBar]);-- return null;-};diff --git a/packages/twenty-front/src/modules/front-components/components/FrontComponentLoadErrorToastEffect.tsx b/packages/twenty-front/src/modules/front-components/components/FrontComponentLoadErrorToastEffect.tsxnew file mode 100644index 00000000000..f9c8341ac76--- /dev/null+++ b/packages/twenty-front/src/modules/front-components/components/FrontComponentLoadErrorToastEffect.tsx@@ -0,0 +1,25 @@+import { t } from '@lingui/core/macro';+import { useEffect } from 'react';+import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';++type FrontComponentLoadErrorToastEffectProps = {+ errorMessage?: string;+};++export const FrontComponentLoadErrorToastEffect = ({+ errorMessage,+}: FrontComponentLoadErrorToastEffectProps) => {+ const { enqueueToast } = useToast();++ useEffect(() => {+ if (isDefined(errorMessage)) {+ enqueueToast({+ variant: 'error',+ children: t`Failed to load front component: ${errorMessage}`,+ });+ }+ }, [errorMessage, enqueueToast]);++ return null;+};diff --git a/packages/twenty-front/src/modules/front-components/components/FrontComponentRenderer.tsx b/packages/twenty-front/src/modules/front-components/components/FrontComponentRenderer.tsxindex 768c22b821d..60506d57b76 100644--- a/packages/twenty-front/src/modules/front-components/components/FrontComponentRenderer.tsx+++ b/packages/twenty-front/src/modules/front-components/components/FrontComponentRenderer.tsx@@ -1,19 +1,19 @@import { FrontComponentApplicationTokenPairEffect } from '@/front-components/components/FrontComponentApplicationTokenPairEffect';-import { FrontComponentLoadErrorSnackBarEffect } from '@/front-components/components/FrontComponentLoadErrorSnackBarEffect';+import { FrontComponentLoadErrorToastEffect } from '@/front-components/components/FrontComponentLoadErrorToastEffect';import { FrontComponentRendererProvider } from '@/front-components/components/FrontComponentRendererProvider';import { useFrontComponentExecutionContext } from '@/front-components/hooks/useFrontComponentExecutionContext';-import { useFrontComponentMediaSession } from '@/front-components/media-session/hooks/useFrontComponentMediaSession';import { useOnApplicationSdkClientChecksumsUpdated } from '@/front-components/hooks/useOnApplicationSdkClientChecksumsUpdated';import { useOnFrontComponentUpdated } from '@/front-components/hooks/useOnFrontComponentUpdated';+import { useFrontComponentMediaSession } from '@/front-components/media-session/hooks/useFrontComponentMediaSession';import { getFingerprintedRestUrl } from '@/front-components/utils/getFingerprintedRestUrl';import { getSdkClientUrls } from '@/front-components/utils/getSdkClientUrls';import { useGetLogicFunctionHttpUrl } from '@/settings/logic-functions/hooks/useGetLogicFunctionHttpUrl';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useQuery } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { type ReactNode, useCallback, useContext, useMemo } from 'react';import { FrontComponentRenderer as SharedFrontComponentRenderer } from 'twenty-front-component-renderer';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { ThemeContext } from 'twenty-ui/theme-constants';import { REACT_APP_SERVER_BASE_URL } from '~/config';import {@@ -63,7 +63,7 @@ export const FrontComponentRenderer = ({return (<>- <FrontComponentLoadErrorSnackBarEffect errorMessage={error?.message} />+ <FrontComponentLoadErrorToastEffect errorMessage={error?.message} />{loading && loadingFallback}{!loading &&(!isDefined(frontComponent) || isDefined(error)) &&@@ -89,7 +89,7 @@ const FrontComponentRendererContent = ({loadingFallback,}: FrontComponentRendererContentProps) => {const { colorScheme } = useContext(ThemeContext);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { functionsBaseUrl } = useGetLogicFunctionHttpUrl();const {@@ -120,11 +120,12 @@ const FrontComponentRendererContent = ({return;}- enqueueErrorSnackBar({- message: t`Failed to load front component: ${error.message}`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to load front component: ${error.message}`,});},- [enqueueErrorSnackBar],+ [enqueueToast],);const applicationTokenPair = frontComponent.applicationTokenPair ?? null;diff --git a/packages/twenty-front/src/modules/front-components/hooks/__tests__/useFrontComponentExecutionContext.test.tsx b/packages/twenty-front/src/modules/front-components/hooks/__tests__/useFrontComponentExecutionContext.test.tsxindex ceae37053b6..e5f85b4cf82 100644--- a/packages/twenty-front/src/modules/front-components/hooks/__tests__/useFrontComponentExecutionContext.test.tsx+++ b/packages/twenty-front/src/modules/front-components/hooks/__tests__/useFrontComponentExecutionContext.test.tsx@@ -2,8 +2,8 @@ import { i18n } from '@lingui/core';import { I18nProvider } from '@lingui/react';import { act, renderHook } from '@testing-library/react';import { getDefaultStore } from 'jotai';-import { AppPath, SidePanelPages } from 'twenty-shared/types';import { type AppLocale } from 'twenty-shared/translations';+import { AppPath, SidePanelPages } from 'twenty-shared/types';import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId';import { contextStoreRecordShowParentViewComponentState } from '@/context-store/states/contextStoreRecordShowParentViewComponentState';@@ -41,13 +41,10 @@ const mockOpenFrontComponentInSidePanel = jest.fn();const mockSetSidePanelSearch = jest.fn();const mockGetIcon = jest.fn((name: string) => `icon-${name}`);const mockUnmountEngineCommand = jest.fn();-const mockEnqueueSuccessSnackBar = jest.fn();-const mockEnqueueErrorSnackBar = jest.fn();-const mockEnqueueInfoSnackBar = jest.fn();-const mockEnqueueWarningSnackBar = jest.fn();+const mockCloseSidePanelMenu = jest.fn();const mockSetCommandMenuItemProgress = jest.fn();-const mockCopyToClipboardWithoutSuccessSnackBar = jest.fn();+const mockCopyToClipboardWithoutSuccessToast = jest.fn();const mockDirectUploadFile = jest.fn();const mockSetRecordPageActiveTabId = jest.fn();const mockStorageSet = jest.fn();@@ -119,13 +116,11 @@ jest.mock(}),);-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({- enqueueSuccessSnackBar: mockEnqueueSuccessSnackBar,- enqueueErrorSnackBar: mockEnqueueErrorSnackBar,- enqueueInfoSnackBar: mockEnqueueInfoSnackBar,- enqueueWarningSnackBar: mockEnqueueWarningSnackBar,- }),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));jest.mock('@/side-panel/hooks/useSidePanelMenu', () => ({@@ -158,8 +153,7 @@ jest.mock('@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState', () => ({jest.mock('~/hooks/useCopyToClipboard', () => ({useCopyToClipboard: () => ({- copyToClipboardWithoutSuccessSnackBar:- mockCopyToClipboardWithoutSuccessSnackBar,+ copyToClipboardWithoutSuccessToast: mockCopyToClipboardWithoutSuccessToast,}),}));@@ -815,13 +809,13 @@ describe('useFrontComponentExecutionContext', () => {describe('enqueueSnackbar', () => {it.each([- { variant: 'success' as const, mock: () => mockEnqueueSuccessSnackBar },- { variant: 'error' as const, mock: () => mockEnqueueErrorSnackBar },- { variant: 'info' as const, mock: () => mockEnqueueInfoSnackBar },- { variant: 'warning' as const, mock: () => mockEnqueueWarningSnackBar },+ 'success' as const,+ 'error' as const,+ 'info' as const,+ 'warning' as const,])(- 'should route $variant snackbar to the correct handler',- async ({ variant, mock }) => {+ 'should forward the %s SDK notification to the toaster',+ async (variant) => {const { result } = renderUseFrontComponentExecutionContext({frontComponentId: FRONT_COMPONENT_ID,});@@ -838,13 +832,12 @@ describe('useFrontComponentExecutionContext', () => {);});- expect(mock()).toHaveBeenCalledWith({- message: `${variant} message`,- options: {- duration: 3000,- detailedMessage: 'details',- dedupeKey: 'key-1',- },+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ children: `${variant} message`,+ variant,+ duration: 3000,+ description: 'details',+ dedupeKey: 'key-1',});},);@@ -1102,7 +1095,7 @@ describe('useFrontComponentExecutionContext', () => {);});- expect(mockCopyToClipboardWithoutSuccessSnackBar).toHaveBeenCalledWith(+ expect(mockCopyToClipboardWithoutSuccessToast).toHaveBeenCalledWith('hello clipboard',);});@@ -1124,7 +1117,7 @@ describe('useFrontComponentExecutionContext', () => {);});- expect(mockCopyToClipboardWithoutSuccessSnackBar).not.toHaveBeenCalled();+ expect(mockCopyToClipboardWithoutSuccessToast).not.toHaveBeenCalled();});it('should silently drop payloads exceeding the maximum length', async () => {@@ -1140,7 +1133,7 @@ describe('useFrontComponentExecutionContext', () => {);});- expect(mockCopyToClipboardWithoutSuccessSnackBar).not.toHaveBeenCalled();+ expect(mockCopyToClipboardWithoutSuccessToast).not.toHaveBeenCalled();});it('should rate-limit consecutive calls within one second', async () => {@@ -1157,10 +1150,8 @@ describe('useFrontComponentExecutionContext', () => {);});- expect(mockCopyToClipboardWithoutSuccessSnackBar).toHaveBeenCalledTimes(- 1,- );- expect(mockCopyToClipboardWithoutSuccessSnackBar).toHaveBeenCalledWith(+ expect(mockCopyToClipboardWithoutSuccessToast).toHaveBeenCalledTimes(1);+ expect(mockCopyToClipboardWithoutSuccessToast).toHaveBeenCalledWith('first',);});@@ -1189,14 +1180,12 @@ describe('useFrontComponentExecutionContext', () => {);});- expect(mockCopyToClipboardWithoutSuccessSnackBar).toHaveBeenCalledTimes(- 2,- );- expect(mockCopyToClipboardWithoutSuccessSnackBar).toHaveBeenNthCalledWith(+ expect(mockCopyToClipboardWithoutSuccessToast).toHaveBeenCalledTimes(2);+ expect(mockCopyToClipboardWithoutSuccessToast).toHaveBeenNthCalledWith(1,'first',);- expect(mockCopyToClipboardWithoutSuccessSnackBar).toHaveBeenNthCalledWith(+ expect(mockCopyToClipboardWithoutSuccessToast).toHaveBeenNthCalledWith(2,'second',);diff --git a/packages/twenty-front/src/modules/front-components/hooks/useFrontComponentExecutionContext.ts b/packages/twenty-front/src/modules/front-components/hooks/useFrontComponentExecutionContext.tsindex 68d320904a2..578e87fc900 100644--- a/packages/twenty-front/src/modules/front-components/hooks/useFrontComponentExecutionContext.ts+++ b/packages/twenty-front/src/modules/front-components/hooks/useFrontComponentExecutionContext.ts@@ -2,17 +2,18 @@ import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadatimport { getFieldMetadataItemById } from '@/object-metadata/utils/getFieldMetadataItemById';import { resolveOpenRecordIn } from '@/object-record/record-index/utils/resolveOpenRecordIn';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';-import { isNonEmptyString } from '@sniptt/guards';import { useLingui } from '@lingui/react/macro';+import { isNonEmptyString } from '@sniptt/guards';import { useRef } from 'react';import {buildFrontComponentStorageNamespace,clearFrontComponentStorage,deleteFrontComponentStorageItem,+ setFrontComponentStorageItem,type FrontComponentExecutionContext,type FrontComponentHostCommunicationApi,- setFrontComponentStorageItem,} from 'twenty-front-component-renderer';+import { type AppLocale } from 'twenty-shared/translations';import {AppPath,FieldMetadataType,@@ -21,7 +22,6 @@ import {SidePanelPages,type EnqueueSnackbarParams,} from 'twenty-shared/types';-import { type AppLocale } from 'twenty-shared/translations';import { useOpenAskAiPageWithPreprompt } from '@/ai/hooks/useOpenAskAiPageWithPreprompt';import { currentUserState } from '@/auth/states/currentUserState';@@ -31,32 +31,27 @@ import { commandMenuItemProgressFamilyState } from '@/command-menu-item/states/cimport { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId';import { contextStoreRecordShowParentViewComponentState } from '@/context-store/states/contextStoreRecordShowParentViewComponentState';import { useDirectFileUpload } from '@/file/hooks/useDirectFileUpload';-import { getMediaFileExtension } from '@/front-components/media-session/utils/getMediaFileExtension';import { useRequestApplicationTokenRefresh } from '@/front-components/hooks/useRequestApplicationTokenRefresh';+import { getMediaFileExtension } from '@/front-components/media-session/utils/getMediaFileExtension';+import { setRecordPageActiveTabId } from '@/page-layout/utils/setRecordPageActiveTabId';import { useNavigateSidePanel } from '@/side-panel/hooks/useNavigateSidePanel';import { useOpenComposeEmailInSidePanel } from '@/side-panel/hooks/useOpenComposeEmailInSidePanel';import { useOpenFrontComponentInSidePanel } from '@/side-panel/hooks/useOpenFrontComponentInSidePanel';import { useOpenRecordInSidePanel } from '@/side-panel/hooks/useOpenRecordInSidePanel';import { useOpenRichTextInSidePanel } from '@/side-panel/hooks/useOpenRichTextInSidePanel';-import { useOpenRoutedPageInSidePanel } from '@/side-panel/routing/hooks/useOpenRoutedPageInSidePanel';import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu';-import { setRecordPageActiveTabId } from '@/page-layout/utils/setRecordPageActiveTabId';+import { useOpenRoutedPageInSidePanel } from '@/side-panel/routing/hooks/useOpenRoutedPageInSidePanel';import { sidePanelSearchState } from '@/side-panel/states/sidePanelSearchState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState';import { useStore } from 'jotai';-import {- assertUnreachable,- CustomError,- getAppPath,- isDefined,-} from 'twenty-shared/utils';+import { CustomError, getAppPath, isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { useIcons } from 'twenty-ui/icon';import { useIsMobile } from 'twenty-ui/utilities';+import { FileFolder } from '~/generated-metadata/graphql';import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';import { useNavigateApp } from '~/hooks/useNavigateApp';-import { FileFolder } from '~/generated-metadata/graphql';const FRONT_COMPONENT_CLIPBOARD_MAX_LENGTH = 64 * 1024;const FRONT_COMPONENT_CLIPBOARD_RATE_LIMIT_MS = 1000;@@ -151,14 +146,9 @@ export const useFrontComponentExecutionContext = ({const setSidePanelSearch = useSetAtomState(sidePanelSearchState);const { getIcon } = useIcons();const unmountEngineCommand = useUnmountCommand();- const {- enqueueSuccessSnackBar,- enqueueErrorSnackBar,- enqueueInfoSnackBar,- enqueueWarningSnackBar,- } = useSnackBar();+ const { enqueueToast } = useToast();const { closeSidePanelMenu } = useSidePanelMenu();- const { copyToClipboardWithoutSuccessSnackBar } = useCopyToClipboard();+ const { copyToClipboardWithoutSuccessToast } = useCopyToClipboard();const { uploadFile: uploadFileToFilesField } = useDirectFileUpload();const { i18n } = useLingui();// oxlint-disable-next-line twenty/no-state-useref@@ -411,28 +401,13 @@ export const useFrontComponentExecutionContext = ({detailedMessage,dedupeKey,}: EnqueueSnackbarParams) => {- const snackBarOptions = {+ enqueueToast({+ children: message,+ variant,duration,- detailedMessage,+ description: detailedMessage,dedupeKey,- };-- switch (variant) {- case 'error':- enqueueErrorSnackBar({ message, options: snackBarOptions });- break;- case 'info':- enqueueInfoSnackBar({ message, options: snackBarOptions });- break;- case 'warning':- enqueueWarningSnackBar({ message, options: snackBarOptions });- break;- case 'success':- enqueueSuccessSnackBar({ message, options: snackBarOptions });- break;- default:- assertUnreachable(variant);- }+ });};const executionContext: FrontComponentExecutionContext = {@@ -487,9 +462,9 @@ export const useFrontComponentExecutionContext = ({}lastCopyToClipboardCallAtRef.current = now;- // Front components notify their own users, so a host success snackbar+ // Front components notify their own users, so a host success toast// would show up on top of theirs.- await copyToClipboardWithoutSuccessSnackBar(text);+ await copyToClipboardWithoutSuccessToast(text);};const hostUploadFile: FrontComponentHostCommunicationApi['uploadFile'] =diff --git a/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerBillingSubscriptionPaused.tsx b/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerBillingSubscriptionPaused.tsxindex d3b2a1c5f78..c9508b3629b 100644--- a/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerBillingSubscriptionPaused.tsx+++ b/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerBillingSubscriptionPaused.tsx@@ -1,14 +1,14 @@-import { useSnackBarOnQueryError } from '@/apollo/hooks/useSnackBarOnQueryError';+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { useRedirect } from '@/domain-manager/hooks/useRedirect';import { InformationBanner } from '@/information-banner/components/InformationBanner';import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap';+import { useQuery } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';-import { useQuery } from '@apollo/client/react';import {- PermissionFlagType,BillingPortalSessionDocument,+ PermissionFlagType,} from '~/generated-metadata/graphql';export const InformationBannerBillingSubscriptionPaused = () => {@@ -24,8 +24,6 @@ export const InformationBannerBillingSubscriptionPaused = () => {skip: !hasPermissionToUpdateBillingDetails,});- useSnackBarOnQueryError(error);-const openBillingPortal = () => {if (isDefined(data) && isDefined(data.billingPortalSession.url)) {redirect(data.billingPortalSession.url);@@ -33,18 +31,23 @@ export const InformationBannerBillingSubscriptionPaused = () => {};return (- <InformationBanner- componentInstanceId="information-banner-billing-subscription-paused"- color="danger"- variant="secondary"- message={- hasPermissionToUpdateBillingDetails- ? t`Trial expired. Please update your billing details.`- : t`Trial expired. Please contact your admin`- }- buttonTitle={hasPermissionToUpdateBillingDetails ? t`Update` : undefined}- buttonOnClick={() => openBillingPortal()}- isButtonDisabled={loading || !isDefined(data)}- />+ <>+ <ToastOnQueryErrorEffect error={error} />+ <InformationBanner+ componentInstanceId="information-banner-billing-subscription-paused"+ color="danger"+ variant="secondary"+ message={+ hasPermissionToUpdateBillingDetails+ ? t`Trial expired. Please update your billing details.`+ : t`Trial expired. Please contact your admin`+ }+ buttonTitle={+ hasPermissionToUpdateBillingDetails ? t`Update` : undefined+ }+ buttonOnClick={() => openBillingPortal()}+ isButtonDisabled={loading || !isDefined(data)}+ />+ </>);};diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/__stories__/KeyboardShortcutMenu.stories.tsx b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/__stories__/KeyboardShortcutMenu.stories.tsxindex 3e93b69b103..fc147b02c85 100644--- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/__stories__/KeyboardShortcutMenu.stories.tsx+++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/__stories__/KeyboardShortcutMenu.stories.tsx@@ -1,7 +1,7 @@import { type Meta, type StoryObj } from '@storybook/react-vite';import { expect, within } from 'storybook/test';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { KeyboardShortcutMenu } from '@/keyboard-shortcut-menu/components/KeyboardShortcutMenu';import { useKeyboardShortcutMenu } from '@/keyboard-shortcut-menu/hooks/useKeyboardShortcutMenu';@@ -19,7 +19,7 @@ const meta: Meta<typeof KeyboardShortcutMenu> = {}, [openKeyboardShortcutMenu]);return <Story />;},- SnackBarDecorator,+ ToastDecorator,ComponentWithRouterDecorator,],};diff --git a/packages/twenty-front/src/modules/layout-customization/hooks/__tests__/useEnterLayoutCustomizationMode.test.tsx b/packages/twenty-front/src/modules/layout-customization/hooks/__tests__/useEnterLayoutCustomizationMode.test.tsxindex 183cd75d4b3..18d06017256 100644--- a/packages/twenty-front/src/modules/layout-customization/hooks/__tests__/useEnterLayoutCustomizationMode.test.tsx+++ b/packages/twenty-front/src/modules/layout-customization/hooks/__tests__/useEnterLayoutCustomizationMode.test.tsx@@ -1,5 +1,5 @@import { renderHook } from '@testing-library/react';-import { createStore, Provider as JotaiProvider } from 'jotai';+import { Provider as JotaiProvider, createStore } from 'jotai';import { type ReactNode } from 'react';import { useEnterLayoutCustomizationMode } from '@/layout-customization/hooks/useEnterLayoutCustomizationMode';@@ -13,10 +13,11 @@ jest.mock('@/side-panel/hooks/useNavigateSidePanel', () => ({navigateSidePanel: jest.fn(),}),}));-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({- enqueueWarningSnackBar: jest.fn(),- }),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));const mockUseHasPermissionFlag = useHasPermissionFlag as jest.Mock;diff --git a/packages/twenty-front/src/modules/layout-customization/hooks/useEnterLayoutCustomizationMode.ts b/packages/twenty-front/src/modules/layout-customization/hooks/useEnterLayoutCustomizationMode.tsindex 97da7aca7e7..3107050f3dd 100644--- a/packages/twenty-front/src/modules/layout-customization/hooks/useEnterLayoutCustomizationMode.ts+++ b/packages/twenty-front/src/modules/layout-customization/hooks/useEnterLayoutCustomizationMode.ts@@ -19,14 +19,14 @@ import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlaimport { useNavigateSidePanel } from '@/side-panel/hooks/useNavigateSidePanel';import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState';import { sidePanelPageInfoSelector } from '@/side-panel/states/sidePanelPageInfoSelector';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useToast } from 'twenty-ui/primitives/feedback';import { PermissionFlagType } from '~/generated-metadata/graphql';export const useEnterLayoutCustomizationMode = () => {const store = useStore();const { navigateSidePanel } = useNavigateSidePanel();- const { enqueueWarningSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const hasLayoutsPermission = useHasPermissionFlag(PermissionFlagType.LAYOUTS);const enterLayoutCustomizationMode = useCallback((): boolean => {@@ -54,8 +54,9 @@ export const useEnterLayoutCustomizationMode = () => {);if (isDashboardInEditMode) {- enqueueWarningSnackBar({- message: t`Save or cancel dashboard changes before editing the layout.`,+ enqueueToast({+ variant: 'warning',+ children: t`Save or cancel dashboard changes before editing the layout.`,});return false;@@ -94,7 +95,7 @@ export const useEnterLayoutCustomizationMode = () => {}return true;- }, [enqueueWarningSnackBar, hasLayoutsPermission, navigateSidePanel, store]);+ }, [enqueueToast, hasLayoutsPermission, navigateSidePanel, store]);return { enterLayoutCustomizationMode };};diff --git a/packages/twenty-front/src/modules/layout-customization/hooks/useSaveLayoutCustomization.ts b/packages/twenty-front/src/modules/layout-customization/hooks/useSaveLayoutCustomization.tsindex fbc4226b587..777033c3328 100644--- a/packages/twenty-front/src/modules/layout-customization/hooks/useSaveLayoutCustomization.ts+++ b/packages/twenty-front/src/modules/layout-customization/hooks/useSaveLayoutCustomization.ts@@ -18,11 +18,11 @@ import { convertPageLayoutDraftToUpdateInput } from '@/page-layout/utils/convertimport { convertPageLayoutToTabLayouts } from '@/page-layout/utils/convertPageLayoutToTabLayouts';import { toDraftPageLayout } from '@/page-layout/utils/toDraftPageLayout';import { transformPageLayout } from '@/page-layout/utils/transformPageLayout';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useLingui } from '@lingui/react/macro';import { useStore } from 'jotai';import { useCallback, useState } from 'react';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { isDeeplyEqual } from '~/utils/isDeeplyEqual';import { logError } from '~/utils/logError';@@ -34,7 +34,7 @@ export const useSaveLayoutCustomization = () => {const { saveDraft } = useSaveNavigationMenuItemsDraft();const { saveCommandMenuItemsDraft } = useSaveCommandMenuItemsDraft();const { isDirty: isCommandMenuItemsDirty } = useCommandMenuItemsDraftState();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { updatePageLayoutWithTabsAndWidgets } =useUpdatePageLayoutWithTabsAndWidgets();const { createPendingFieldsWidgetViews } =@@ -135,8 +135,9 @@ export const useSaveLayoutCustomization = () => {}if (hasAnyFailure) {- enqueueErrorSnackBar({- message: t`Some layout changes could not be saved`,+ enqueueToast({+ variant: 'error',+ children: t`Some layout changes could not be saved`,});return;}@@ -144,8 +145,9 @@ export const useSaveLayoutCustomization = () => {exitLayoutCustomizationMode();} catch (error) {logError(error);- enqueueErrorSnackBar({- message: t`Failed to save layout customization`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to save layout customization`,});} finally {setIsSaving(false);@@ -159,7 +161,7 @@ export const useSaveLayoutCustomization = () => {updatePageLayoutWithTabsAndWidgets,savePageLayoutWidgetsData,exitLayoutCustomizationMode,- enqueueErrorSnackBar,+ enqueueToast,store,t,]);diff --git a/packages/twenty-front/src/modules/logic-functions/hooks/usePersistLogicFunction.ts b/packages/twenty-front/src/modules/logic-functions/hooks/usePersistLogicFunction.tsindex a7e22e79b09..529522ecdcb 100644--- a/packages/twenty-front/src/modules/logic-functions/hooks/usePersistLogicFunction.ts+++ b/packages/twenty-front/src/modules/logic-functions/hooks/usePersistLogicFunction.ts@@ -1,18 +1,17 @@import { useCallback } from 'react';+import { CREATE_ONE_LOGIC_FUNCTION } from '@/logic-functions/graphql/mutations/createOneLogicFunction';+import { DELETE_ONE_LOGIC_FUNCTION } from '@/logic-functions/graphql/mutations/deleteOneLogicFunction';import { UPDATE_ONE_LOGIC_FUNCTION } from '@/logic-functions/graphql/mutations/updateOneLogicFunction';+import { FIND_MANY_LOGIC_FUNCTIONS } from '@/logic-functions/graphql/queries/findManyLogicFunctions';import { GET_LOGIC_FUNCTION_SOURCE_CODE } from '@/logic-functions/graphql/queries/getLogicFunctionSourceCode';import { useMetadataErrorHandler } from '@/metadata-error-handler/hooks/useMetadataErrorHandler';import { type MetadataRequestResult } from '@/object-metadata/types/MetadataRequestResult.type';-import { CREATE_ONE_LOGIC_FUNCTION } from '@/logic-functions/graphql/mutations/createOneLogicFunction';-import { DELETE_ONE_LOGIC_FUNCTION } from '@/logic-functions/graphql/mutations/deleteOneLogicFunction';-import { FIND_MANY_LOGIC_FUNCTIONS } from '@/logic-functions/graphql/queries/findManyLogicFunctions';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { useMutation } from '@apollo/client/react';import { CombinedGraphQLErrors } from '@apollo/client/errors';-import { getOperationName } from '~/utils/getOperationName';+import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { CrudOperationType } from 'twenty-shared/types';+import { useToast } from 'twenty-ui/primitives/feedback';import {type CreateOneLogicFunctionMutation,type CreateOneLogicFunctionMutationVariables,@@ -21,10 +20,11 @@ import {type UpdateOneLogicFunctionMutation,type UpdateOneLogicFunctionMutationVariables,} from '~/generated-metadata/graphql';+import { getOperationName } from '~/utils/getOperationName';export const usePersistLogicFunction = () => {const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [createLogicFunctionMutation] = useMutation<CreateOneLogicFunctionMutation,@@ -67,7 +67,7 @@ export const usePersistLogicFunction = () => {operationType: CrudOperationType.CREATE,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}return {@@ -76,7 +76,7 @@ export const usePersistLogicFunction = () => {};}},- [createLogicFunctionMutation, handleMetadataError, enqueueErrorSnackBar],+ [createLogicFunctionMutation, handleMetadataError, enqueueToast],);const updateLogicFunction = useCallback(@@ -103,7 +103,7 @@ export const usePersistLogicFunction = () => {operationType: CrudOperationType.UPDATE,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}return {@@ -112,11 +112,7 @@ export const usePersistLogicFunction = () => {};}},- [- updateLogicFunctionSourceMutation,- handleMetadataError,- enqueueErrorSnackBar,- ],+ [updateLogicFunctionSourceMutation, handleMetadataError, enqueueToast],);const deleteLogicFunction = useCallback(@@ -147,7 +143,7 @@ export const usePersistLogicFunction = () => {operationType: CrudOperationType.DELETE,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}return {@@ -156,7 +152,7 @@ export const usePersistLogicFunction = () => {};}},- [deleteLogicFunctionMutation, handleMetadataError, enqueueErrorSnackBar],+ [deleteLogicFunctionMutation, handleMetadataError, enqueueToast],);return {diff --git a/packages/twenty-front/src/modules/marketplace/hooks/__tests__/useInstallMarketplaceApp.test.tsx b/packages/twenty-front/src/modules/marketplace/hooks/__tests__/useInstallMarketplaceApp.test.tsxindex c476b2330e4..27b0f62c4ff 100644--- a/packages/twenty-front/src/modules/marketplace/hooks/__tests__/useInstallMarketplaceApp.test.tsx+++ b/packages/twenty-front/src/modules/marketplace/hooks/__tests__/useInstallMarketplaceApp.test.tsx@@ -15,13 +15,12 @@ import {const UNIVERSAL_IDENTIFIER = 'application-universal-identifier';const JOB_ID = `install-application.workspace-id.${UNIVERSAL_IDENTIFIER}`;-const mockEnqueueErrorSnackBar = jest.fn();-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({- enqueueErrorSnackBar: mockEnqueueErrorSnackBar,- enqueueSuccessSnackBar: jest.fn(),- }),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));const triggerInstallMock = {@@ -83,8 +82,9 @@ describe('useInstallMarketplaceApp', () => {});await waitFor(() => expect(result.current.isInstalling).toBe(false));- expect(mockEnqueueErrorSnackBar).toHaveBeenCalledWith({- message: 'Manifest validation failed',+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'Manifest validation failed',});});diff --git a/packages/twenty-front/src/modules/marketplace/hooks/useInstallMarketplaceApp.ts b/packages/twenty-front/src/modules/marketplace/hooks/useInstallMarketplaceApp.tsindex e3775902d97..cfdb5d5eaa1 100644--- a/packages/twenty-front/src/modules/marketplace/hooks/useInstallMarketplaceApp.ts+++ b/packages/twenty-front/src/modules/marketplace/hooks/useInstallMarketplaceApp.ts@@ -2,13 +2,13 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { useTrackedQueueJob } from '@/queue-job/hooks/useTrackedQueueJob';import { type TrackedJobStatus } from '@/queue-job/types/TrackedJobStatus';import { isTerminalJobState } from '@/queue-job/utils/isTerminalJobState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { useLazyQuery, useMutation, useQuery } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { isNonEmptyString } from '@sniptt/guards';import { useCallback } from 'react';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import {FindInstallApplicationJobStatusDocument,FindOneApplicationByUniversalIdentifierDocument,@@ -28,7 +28,7 @@ export const useInstallMarketplaceApp = ({universalIdentifier,onCompleted,}: UseInstallMarketplaceAppArgs = {}) => {- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [triggerInstallApplicationJob, { loading: isTriggeringInstall }] =useMutation(TriggerInstallApplicationJobDocument);const [findInstalledApplication] = useLazyQuery(@@ -55,8 +55,9 @@ export const useInstallMarketplaceApp = ({const handleInstallJobSettled = useCallback(async (jobStatus: TrackedJobStatus, trackedUniversalIdentifier: string) => {if (jobStatus.state === JobState.FAILED) {- enqueueErrorSnackBar({- message: isNonEmptyString(jobStatus.failedReason)+ enqueueToast({+ variant: 'error',+ children: isNonEmptyString(jobStatus.failedReason)? jobStatus.failedReason: t`Failed to install the application.`,});@@ -74,12 +75,18 @@ export const useInstallMarketplaceApp = ({installedApplication = result.data?.findOneApplication;} catch {- enqueueErrorSnackBar({ message: t`Failed to load the application.` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to load the application.`,+ });return;}if (!isDefined(installedApplication)) {- enqueueErrorSnackBar({ message: t`Failed to load the application.` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to load the application.`,+ });return;}@@ -97,18 +104,13 @@ export const useInstallMarketplaceApp = ({: currentWorkspace,);- enqueueSuccessSnackBar({- message: t`Application installed successfully.`,+ enqueueToast({+ variant: 'success',+ children: t`Application installed successfully.`,});onCompleted?.(installedApplication);},- [- enqueueErrorSnackBar,- enqueueSuccessSnackBar,- findInstalledApplication,- onCompleted,- setCurrentWorkspace,- ],+ [enqueueToast, findInstalledApplication, onCompleted, setCurrentWorkspace],);const { activeJobId, trackJob } = useTrackedQueueJob({@@ -137,8 +139,9 @@ export const useInstallMarketplaceApp = ({} catch (error) {const graphqlMessage = error instanceof Error ? error.message : undefined;- enqueueErrorSnackBar({- message: graphqlMessage ?? t`Failed to install the application.`,+ enqueueToast({+ variant: 'error',+ children: graphqlMessage ?? t`Failed to install the application.`,});}};diff --git a/packages/twenty-front/src/modules/marketplace/hooks/useUpgradeApplication.ts b/packages/twenty-front/src/modules/marketplace/hooks/useUpgradeApplication.tsindex e4ec203966c..77d673ce872 100644--- a/packages/twenty-front/src/modules/marketplace/hooks/useUpgradeApplication.ts+++ b/packages/twenty-front/src/modules/marketplace/hooks/useUpgradeApplication.ts@@ -1,12 +1,12 @@-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { useState } from 'react';import { isDefined } from 'twenty-shared/utils';-import { useMutation } from '@apollo/client/react';+import { useToast } from 'twenty-ui/primitives/feedback';import { UpgradeApplicationDocument } from '~/generated-metadata/graphql';export const useUpgradeApplication = () => {- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [upgradeApplicationMutation] = useMutation(UpgradeApplicationDocument);const [isUpgrading, setIsUpgrading] = useState(false);@@ -22,8 +22,9 @@ export const useUpgradeApplication = () => {});if (isDefined(result.data)) {- enqueueSuccessSnackBar({- message: t`Application upgraded successfully.`,+ enqueueToast({+ variant: 'success',+ children: t`Application upgraded successfully.`,});return true;@@ -33,8 +34,9 @@ export const useUpgradeApplication = () => {} catch (error) {const graphqlMessage = error instanceof Error ? error.message : undefined;- enqueueErrorSnackBar({- message: graphqlMessage ?? t`Failed to upgrade the application.`,+ enqueueToast({+ variant: 'error',+ children: graphqlMessage ?? t`Failed to upgrade the application.`,});return false;diff --git a/packages/twenty-front/src/modules/metadata-error-handler/hooks/useMetadataErrorHandler.ts b/packages/twenty-front/src/modules/metadata-error-handler/hooks/useMetadataErrorHandler.tsindex b88402e3a16..5ce6ec47a6c 100644--- a/packages/twenty-front/src/modules/metadata-error-handler/hooks/useMetadataErrorHandler.ts+++ b/packages/twenty-front/src/modules/metadata-error-handler/hooks/useMetadataErrorHandler.ts@@ -1,16 +1,17 @@import { type CombinedGraphQLErrors } from '@apollo/client/errors';import { t } from '@lingui/core/macro';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { classifyMetadataError } from '@/metadata-error-handler/utils/classifyMetadataError';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import {type AllMetadataName,WorkspaceMigrationV2ExceptionCode,} from 'twenty-shared/metadata';import { CrudOperationType } from 'twenty-shared/types';+import { useToast } from 'twenty-ui/primitives/feedback';export const useMetadataErrorHandler = () => {- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const TRANSLATED_OPERATION_TYPE = {[CrudOperationType.CREATE]: t`create`,@@ -72,7 +73,7 @@ export const useMetadataErrorHandler = () => {switch (classification.type) {case 'v1':- enqueueErrorSnackBar({ apolloError: classification.error });+ enqueueToast(getToastOptionsFromError({ error: classification.error }));break;case 'v2-validation': {@@ -83,8 +84,9 @@ export const useMetadataErrorHandler = () => {if (targetErrors.length > 0) {targetErrors.forEach((entityError) => {entityError.errors.forEach((validationError) =>- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:validationError.userFriendlyMessage ??validationError.message,}),@@ -103,8 +105,9 @@ export const useMetadataErrorHandler = () => {.map((metadataName) => TRANSLATED_METADATA_NAME[metadataName]).join(', ');- enqueueErrorSnackBar({- message: t`Failed to ${translatedOperationType} ${translatedMetadataName}. Related ${relatedEntityNames} validation failed. Please check your configuration and try again.`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to ${translatedOperationType} ${translatedMetadataName}. Related ${relatedEntityNames} validation failed. Please check your configuration and try again.`,});}@@ -112,8 +115,9 @@ export const useMetadataErrorHandler = () => {targetErrors.length === 0 &&relatedFailingMetadataNames.length === 0) {- enqueueErrorSnackBar({- message: t`Failed to ${translatedOperationType} ${translatedMetadataName}. Please try again.`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to ${translatedOperationType} ${translatedMetadataName}. Please try again.`,});}break;@@ -127,7 +131,7 @@ export const useMetadataErrorHandler = () => {? t`An internal error occurred while validating your changes. Please contact support.`: t`An internal error occurred while applying your changes. Please contact support and try again later.`;- enqueueErrorSnackBar({ message: errorMessage });+ enqueueToast({ variant: 'error', children: errorMessage });break;}}diff --git a/packages/twenty-front/src/modules/navigation-menu-item/edit/hooks/useNavigationMenuItemEditController.ts b/packages/twenty-front/src/modules/navigation-menu-item/edit/hooks/useNavigationMenuItemEditController.tsindex 7d4773846bc..fb593dde838 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/edit/hooks/useNavigationMenuItemEditController.ts+++ b/packages/twenty-front/src/modules/navigation-menu-item/edit/hooks/useNavigationMenuItemEditController.ts@@ -12,9 +12,9 @@ import { navigationMenuItemsDraftState } from '@/navigation-menu-item/common/staimport { buildCreateNavigationMenuItemInput } from '@/navigation-menu-item/common/utils/buildCreateNavigationMenuItemInput';import { computeInsertIndexAndPosition } from '@/navigation-menu-item/common/utils/computeInsertIndexAndPosition';import { useNavigationMenuItemsData } from '@/navigation-menu-item/display/hooks/useNavigationMenuItemsData';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';+import { useToast } from 'twenty-ui/primitives/feedback';export type NewNavigationMenuItemInput = {type: NavigationMenuItemType;@@ -40,7 +40,7 @@ type CreateItemOptions = {// surfaced here and the rejection is swallowed — callers fire-and-forget.export const useNavigationMenuItemEditController = () => {const { t } = useLingui();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const navigationMenuItemEditSection = useAtomStateValue(navigationMenuItemEditSectionState,);@@ -118,10 +118,16 @@ export const useNavigationMenuItemEditController = () => {userWorkspaceId: targetUserWorkspaceId,},]).catch(() =>- enqueueErrorSnackBar({ message: t`Couldn't add to favorites` }),+ enqueueToast({+ variant: 'error',+ children: t`Couldn't add to favorites`,+ }),);} else {- enqueueErrorSnackBar({ message: t`Couldn't add to favorites` });+ enqueueToast({+ variant: 'error',+ children: t`Couldn't add to favorites`,+ });}return id;@@ -145,7 +151,7 @@ export const useNavigationMenuItemEditController = () => {try {await updateManyNavigationMenuItems([{ id, update }]);} catch {- enqueueErrorSnackBar({ message: t`Couldn't update favorite` });+ enqueueToast({ variant: 'error', children: t`Couldn't update favorite` });}};@@ -162,7 +168,7 @@ export const useNavigationMenuItemEditController = () => {try {await deleteManyNavigationMenuItems(ids);} catch {- enqueueErrorSnackBar({ message: t`Couldn't remove favorite` });+ enqueueToast({ variant: 'error', children: t`Couldn't remove favorite` });}};diff --git a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemRecordSubPage.tsx b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemRecordSubPage.tsxindex df117b42079..4ef531b842d 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemRecordSubPage.tsx+++ b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemRecordSubPage.tsx@@ -1,3 +1,4 @@+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { isNonEmptyString } from '@sniptt/guards';import { useLingui } from '@lingui/react/macro';import { useState } from 'react';@@ -18,6 +19,7 @@ export const SidePanelNewSidebarItemRecordSubPage = () => {>(null);const {availableSearchRecords,+ error,isSearchDebouncing,recordSearchLoading,trimmedSearchInput,@@ -37,41 +39,44 @@ export const SidePanelNewSidebarItemRecordSubPage = () => {: t`Type to search records`;return (- <SidePanelSubViewWithSearch- searchPlaceholder={t`Search records...`}- searchValue={recordSearchInput}- onSearchChange={setRecordSearchInput}- rightElement={- <SidePanelObjectFilterDropdown- selectedObjectNameSingular={selectedObjectNameSingular}- onSelectObject={setSelectedObjectNameSingular}- />- }- >- <SidePanelAddToNavigationDroppable>- {({ innerRef, droppableProps, placeholder }) => (- <SidePanelList- selectableItemIds={selectableItemIds}- loading={isRecordSearchLoading}- noResults={isEmpty}- noResultsText={noResultsText}- >- {/* oxlint-disable-next-line react/jsx-props-no-spreading */}- <div ref={innerRef} {...droppableProps}>- <SidePanelGroup heading={t`Results`}>- {availableSearchRecords.map((record, index) => (- <SidePanelNewSidebarItemRecordItem- key={record.recordId}- record={record}- dragIndex={index}- />- ))}- </SidePanelGroup>- {placeholder}- </div>- </SidePanelList>- )}- </SidePanelAddToNavigationDroppable>- </SidePanelSubViewWithSearch>+ <>+ <ToastOnQueryErrorEffect error={error} />+ <SidePanelSubViewWithSearch+ searchPlaceholder={t`Search records...`}+ searchValue={recordSearchInput}+ onSearchChange={setRecordSearchInput}+ rightElement={+ <SidePanelObjectFilterDropdown+ selectedObjectNameSingular={selectedObjectNameSingular}+ onSelectObject={setSelectedObjectNameSingular}+ />+ }+ >+ <SidePanelAddToNavigationDroppable>+ {({ innerRef, droppableProps, placeholder }) => (+ <SidePanelList+ selectableItemIds={selectableItemIds}+ loading={isRecordSearchLoading}+ noResults={isEmpty}+ noResultsText={noResultsText}+ >+ {/* oxlint-disable-next-line react/jsx-props-no-spreading */}+ <div ref={innerRef} {...droppableProps}>+ <SidePanelGroup heading={t`Results`}>+ {availableSearchRecords.map((record, index) => (+ <SidePanelNewSidebarItemRecordItem+ key={record.recordId}+ record={record}+ dragIndex={index}+ />+ ))}+ </SidePanelGroup>+ {placeholder}+ </div>+ </SidePanelList>+ )}+ </SidePanelAddToNavigationDroppable>+ </SidePanelSubViewWithSearch>+ </>);};diff --git a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemSearchResults.tsx b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemSearchResults.tsxindex 586077ad951..ee326b56ac1 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemSearchResults.tsx+++ b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemSearchResults.tsx@@ -1,3 +1,4 @@+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { isNonEmptyString } from '@sniptt/guards';import { useLingui } from '@lingui/react/macro';import { ObjectIconWithViewOverlay } from '@/navigation-menu-item/display/view/components/ObjectIconWithViewOverlay';@@ -50,11 +51,15 @@ export const SidePanelNewSidebarItemSearchResults = ({const { views, objectMetadataIdsWithIndexView, viewIdsAlreadyAdded } =useNavigationMenuObjectMetadataForSection(currentItems);const trimmedSearchValue = searchValue.trim();- const { availableSearchRecords, isSearchDebouncing, recordSearchLoading } =- useAvailableNavigationMenuItemSearchRecords({- searchInput: trimmedSearchValue,- skip: !isNonEmptyString(trimmedSearchValue),- });+ const {+ availableSearchRecords,+ isSearchDebouncing,+ recordSearchLoading,+ error,+ } = useAvailableNavigationMenuItemSearchRecords({+ searchInput: trimmedSearchValue,+ skip: !isNonEmptyString(trimmedSearchValue),+ });const isRecordSearchLoading = recordSearchLoading || isSearchDebouncing;const availableViews = views@@ -180,86 +185,91 @@ export const SidePanelNewSidebarItemSearchResults = ({objectMetadataItems.find((item) => item.id === view.objectMetadataId);return (- <SidePanelAddToNavigationDroppable>- {({ innerRef, droppableProps, placeholder }) => (- <SidePanelList- selectableItemIds={selectableItemIds}- loading={isRecordSearchLoading}- noResults={isEmpty}- noResultsText={t`No results found`}- >- {/* oxlint-disable-next-line react/jsx-props-no-spreading */}- <div ref={innerRef} {...droppableProps}>- <SidePanelGroup heading={t`Objects`}>- {filteredObjectMetadataItems.map((objectMetadataItem, index) => (- <SidePanelObjectMenuItem- key={objectMetadataItem.id}- objectMetadataItem={objectMetadataItem}- onSelect={handleSelectObject}- variant="add"- dragIndex={index}- />- ))}- </SidePanelGroup>- <SidePanelGroup heading={t`Views`}>- {filteredViews.map((view, index) => {- const objectMetadataItem = getObjectMetadataItemForView(view);- const objectIconColor = isDefined(objectMetadataItem)- ? getObjectColorWithFallback(objectMetadataItem)- : undefined;-- return (- <SelectableListItem- key={view.id}- itemId={view.id}- onEnter={() => handleSelectView(view)}- >- <SidePanelItemWithAddToNavigationDrag- customIconContent={- isDefined(objectMetadataItem) ? (- <ObjectIconWithViewOverlay- ObjectIcon={getIcon(objectMetadataItem.icon)}- ViewIcon={getIcon(view.icon)}- objectColor={objectIconColor}- />- ) : undefined- }- icon={- isDefined(objectMetadataItem)- ? undefined- : getIcon(view.icon)- }- label={view.name}- id={view.id}- onClick={() => handleSelectView(view)}- dragIndex={filteredObjectMetadataItems.length + index}- payload={{- type: NavigationMenuItemType.VIEW,- viewId: view.id,- label: view.name,- }}+ <>+ <ToastOnQueryErrorEffect error={error} />+ <SidePanelAddToNavigationDroppable>+ {({ innerRef, droppableProps, placeholder }) => (+ <SidePanelList+ selectableItemIds={selectableItemIds}+ loading={isRecordSearchLoading}+ noResults={isEmpty}+ noResultsText={t`No results found`}+ >+ {/* oxlint-disable-next-line react/jsx-props-no-spreading */}+ <div ref={innerRef} {...droppableProps}>+ <SidePanelGroup heading={t`Objects`}>+ {filteredObjectMetadataItems.map(+ (objectMetadataItem, index) => (+ <SidePanelObjectMenuItem+ key={objectMetadataItem.id}+ objectMetadataItem={objectMetadataItem}+ onSelect={handleSelectObject}+ variant="add"+ dragIndex={index}/>- </SelectableListItem>- );- })}- </SidePanelGroup>- <SidePanelGroup heading={t`Records`}>- {availableSearchRecords.map((record, index) => (- <SidePanelNewSidebarItemRecordItem- key={record.recordId}- record={record}- dragIndex={- filteredObjectMetadataItems.length +- filteredViews.length +- index- }- />- ))}- </SidePanelGroup>- {placeholder}- </div>- </SidePanelList>- )}- </SidePanelAddToNavigationDroppable>+ ),+ )}+ </SidePanelGroup>+ <SidePanelGroup heading={t`Views`}>+ {filteredViews.map((view, index) => {+ const objectMetadataItem = getObjectMetadataItemForView(view);+ const objectIconColor = isDefined(objectMetadataItem)+ ? getObjectColorWithFallback(objectMetadataItem)+ : undefined;++ return (+ <SelectableListItem+ key={view.id}+ itemId={view.id}+ onEnter={() => handleSelectView(view)}+ >+ <SidePanelItemWithAddToNavigationDrag+ customIconContent={+ isDefined(objectMetadataItem) ? (+ <ObjectIconWithViewOverlay+ ObjectIcon={getIcon(objectMetadataItem.icon)}+ ViewIcon={getIcon(view.icon)}+ objectColor={objectIconColor}+ />+ ) : undefined+ }+ icon={+ isDefined(objectMetadataItem)+ ? undefined+ : getIcon(view.icon)+ }+ label={view.name}+ id={view.id}+ onClick={() => handleSelectView(view)}+ dragIndex={filteredObjectMetadataItems.length + index}+ payload={{+ type: NavigationMenuItemType.VIEW,+ viewId: view.id,+ label: view.name,+ }}+ />+ </SelectableListItem>+ );+ })}+ </SidePanelGroup>+ <SidePanelGroup heading={t`Records`}>+ {availableSearchRecords.map((record, index) => (+ <SidePanelNewSidebarItemRecordItem+ key={record.recordId}+ record={record}+ dragIndex={+ filteredObjectMetadataItems.length ++ filteredViews.length ++ index+ }+ />+ ))}+ </SidePanelGroup>+ {placeholder}+ </div>+ </SidePanelList>+ )}+ </SidePanelAddToNavigationDroppable>+ </>);};diff --git a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/hooks/useAvailableNavigationMenuItemSearchRecords.ts b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/hooks/useAvailableNavigationMenuItemSearchRecords.tsindex 528f5d64804..97ba6490674 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/hooks/useAvailableNavigationMenuItemSearchRecords.ts+++ b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/hooks/useAvailableNavigationMenuItemSearchRecords.ts@@ -7,7 +7,7 @@ import { useObjectRecordSearchRecords } from '@/object-record/hooks/useObjectRecimport { useSearchableObjectNameSingulars } from '@/side-panel/hooks/useSearchableObjectNameSingulars';import { isDefined } from 'twenty-shared/utils';-export type NavigationMenuItemSearchRecord = {+type NavigationMenuItemSearchRecord = {recordId: string;objectNameSingular: string;label: string;@@ -34,12 +34,15 @@ export const useAvailableNavigationMenuItemSearchRecords = ({selectedObjectNameSingular,});- const { loading: recordSearchLoading, searchRecords } =- useObjectRecordSearchRecords({- objectNameSingulars: includedObjectNameSingulars,- searchInput: deferredSearchInput,- skip: skip || !isNonEmptyString(deferredSearchInput),- });+ const {+ loading: recordSearchLoading,+ searchRecords,+ error,+ } = useObjectRecordSearchRecords({+ objectNameSingulars: includedObjectNameSingulars,+ searchInput: deferredSearchInput,+ skip: skip || !isNonEmptyString(deferredSearchInput),+ });const recordIdsAlreadyAdded = useMemo(() =>@@ -67,6 +70,7 @@ export const useAvailableNavigationMenuItemSearchRecords = ({);return {+ error,availableSearchRecords,deferredSearchInput,isSearchDebouncing: trimmedSearchInput !== deferredSearchInput,diff --git a/packages/twenty-front/src/modules/navigation/components/__stories__/AppNavigationDrawer.stories.tsx b/packages/twenty-front/src/modules/navigation/components/__stories__/AppNavigationDrawer.stories.tsxindex d2406432686..2a3269678ad 100644--- a/packages/twenty-front/src/modules/navigation/components/__stories__/AppNavigationDrawer.stories.tsx+++ b/packages/twenty-front/src/modules/navigation/components/__stories__/AppNavigationDrawer.stories.tsx@@ -4,11 +4,11 @@ import { MemoryRouter } from 'react-router-dom';import { currentMobileNavigationDrawerState } from '@/navigation/states/currentMobileNavigationDrawerState';import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';-import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';+import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { IconsProviderDecorator } from '~/testing/decorators/IconsProviderDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import {AppNavigationDrawer,@@ -62,7 +62,7 @@ const meta: Meta<StoryArgs> = {/></MemoryRouter>),- SnackBarDecorator,+ ToastDecorator,],component: AppNavigationDrawer,args: { routePath: AppPath.Index },diff --git a/packages/twenty-front/src/modules/object-core/workflows/hooks/useCoreWorkflows.ts b/packages/twenty-front/src/modules/object-core/workflows/hooks/useCoreWorkflows.tsindex 4ce9bd2adf2..3517868f904 100644--- a/packages/twenty-front/src/modules/object-core/workflows/hooks/useCoreWorkflows.ts+++ b/packages/twenty-front/src/modules/object-core/workflows/hooks/useCoreWorkflows.ts@@ -1,23 +1,23 @@import { useState } from 'react';-import { type ErrorLike } from '@apollo/client';import { useQuery } from '@apollo/client/react';-import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { logError } from '~/utils/logError';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { coreWorkflowsFilterSettingsState } from '@/object-core/workflows/states/coreWorkflowsFilterSettingsState';import { buildCoreWorkflowFilterInput } from '@/object-core/workflows/utils/buildCoreWorkflowFilterInput';+import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone';import { sortedFieldByTableFamilyState } from '@/ui/layout/table/states/sortedFieldByTableFamilyState';import { type TableSortValue } from '@/ui/layout/table/types/TableSortValue';import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { useToast } from 'twenty-ui/primitives/feedback';import {CoreWorkflowOrderByDirection,CoreWorkflowOrderByField,GetCoreWorkflowsDocument,} from '~/generated/graphql';+import { logError } from '~/utils/logError';export const CORE_WORKFLOWS_TABLE_ID = 'workflowCore';export const CORE_WORKFLOWS_PAGE_SIZE = 60;@@ -82,7 +82,7 @@ export const useCoreWorkflows = ({);const connection = (data ?? previousData)?.coreWorkflows;- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const fetchNextPage = async () => {if (connection?.pageInfo.hasNextPage !== true || isFetchingMore) {@@ -107,7 +107,7 @@ export const useCoreWorkflows = ({});} catch (fetchMoreError) {logError(`useCoreWorkflows fetchMore error : ${fetchMoreError}`);- enqueueErrorSnackBar({ apolloError: fetchMoreError as ErrorLike });+ enqueueToast(getToastOptionsFromError({ error: fetchMoreError }));} finally {setIsFetchingMore(false);}diff --git a/packages/twenty-front/src/modules/object-core/workflows/hooks/useCreateCoreWorkflow.ts b/packages/twenty-front/src/modules/object-core/workflows/hooks/useCreateCoreWorkflow.tsindex 3cd64394a87..80f94d52d08 100644--- a/packages/twenty-front/src/modules/object-core/workflows/hooks/useCreateCoreWorkflow.ts+++ b/packages/twenty-front/src/modules/object-core/workflows/hooks/useCreateCoreWorkflow.ts@@ -9,7 +9,7 @@ import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClientimport { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';import { useObjectPermissionsForObject } from '@/object-record/hooks/useObjectPermissionsForObject';import { canCreateRecordsForObjectMetadataItem } from '@/object-record/utils/canCreateRecordsForObjectMetadataItem';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useToast } from 'twenty-ui/primitives/feedback';import {type CreateCoreWorkflowMutation,type CreateCoreWorkflowMutationVariables,@@ -37,7 +37,7 @@ export const useCreateCoreWorkflow = () => {const navigate = useNavigateApp();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const canCreateCoreWorkflow = canCreateRecordsForObjectMetadataItem({objectPermissions,@@ -61,7 +61,10 @@ export const useCreateCoreWorkflow = () => {workspaceWorkflowId = data?.createCoreWorkflow.workspaceWorkflowId;} catch (error) {logError(error);- enqueueErrorSnackBar({ message: t`Failed to create workflow` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to create workflow`,+ });return;} finally {@@ -69,7 +72,10 @@ export const useCreateCoreWorkflow = () => {}if (!isDefined(workspaceWorkflowId)) {- enqueueErrorSnackBar({ message: t`Failed to create workflow` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to create workflow`,+ });return;}@@ -81,7 +87,7 @@ export const useCreateCoreWorkflow = () => {}, [createCoreWorkflowMutation,navigate,- enqueueErrorSnackBar,+ enqueueToast,isCreatingCoreWorkflow,]);diff --git a/packages/twenty-front/src/modules/object-core/workflows/hooks/useDeleteSelectedCoreWorkflows.ts b/packages/twenty-front/src/modules/object-core/workflows/hooks/useDeleteSelectedCoreWorkflows.tsindex 163d1cfd635..e2e9673a3f2 100644--- a/packages/twenty-front/src/modules/object-core/workflows/hooks/useDeleteSelectedCoreWorkflows.ts+++ b/packages/twenty-front/src/modules/object-core/workflows/hooks/useDeleteSelectedCoreWorkflows.ts@@ -13,10 +13,10 @@ import {import { getSelectedCoreWorkflowRowIds } from '@/object-core/workflows/utils/getSelectedCoreWorkflowRowIds';import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';-import { CoreObjectNameSingular } from 'twenty-shared/types';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';+import { CoreObjectNameSingular } from 'twenty-shared/types';+import { useToast } from 'twenty-ui/primitives/feedback';import {type DeleteCoreWorkflowsMutation,type DeleteCoreWorkflowsMutationVariables,@@ -42,7 +42,7 @@ export const useDeleteSelectedCoreWorkflows = () => {const { removeNavigationMenuItemsByTargetRecordIds } =useRemoveNavigationMenuItemByTargetRecordId();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [deleteCoreWorkflowsMutation] = useMutation<DeleteCoreWorkflowsMutation,@@ -71,13 +71,19 @@ export const useDeleteSelectedCoreWorkflows = () => {);} catch (error) {logError(error);- enqueueErrorSnackBar({ message: t`Failed to delete workflows` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to delete workflows`,+ });return;}if (!isNonEmptyArray(deletedWorkspaceWorkflowIds)) {- enqueueErrorSnackBar({ message: t`No workflows were deleted` });+ enqueueToast({+ variant: 'error',+ children: t`No workflows were deleted`,+ });return;}diff --git a/packages/twenty-front/src/modules/object-core/workflows/versions/hooks/useRestoreCoreWorkflowVersionAsDraft.ts b/packages/twenty-front/src/modules/object-core/workflows/versions/hooks/useRestoreCoreWorkflowVersionAsDraft.tsindex 4cf086144f7..733b0125bc9 100644--- a/packages/twenty-front/src/modules/object-core/workflows/versions/hooks/useRestoreCoreWorkflowVersionAsDraft.ts+++ b/packages/twenty-front/src/modules/object-core/workflows/versions/hooks/useRestoreCoreWorkflowVersionAsDraft.ts@@ -4,8 +4,8 @@ import { AppPath, CoreObjectNameSingular } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';import { useCoreWorkflowVersions } from '@/object-core/workflows/versions/hooks/useCoreWorkflowVersions';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useCreateDraftFromWorkflowVersion } from '@/workflow/hooks/useCreateDraftFromWorkflowVersion';+import { useToast } from 'twenty-ui/primitives/feedback';import { CoreWorkflowVersionStatus } from '~/generated/graphql';import { useNavigateApp } from '~/hooks/useNavigateApp';@@ -22,7 +22,7 @@ export const useRestoreCoreWorkflowVersionAsDraft = ({useCoreWorkflowVersions(workflowId);const { createDraftFromWorkflowVersion } =useCreateDraftFromWorkflowVersion();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const navigate = useNavigateApp();const hasExistingDraft = coreWorkflowVersions.some(@@ -44,8 +44,9 @@ export const useRestoreCoreWorkflowVersionAsDraft = ({});if (!isDefined(draftWorkflowVersionId)) {- enqueueErrorSnackBar({- message: t`Could not restore this version as draft.`,+ enqueueToast({+ variant: 'error',+ children: t`Could not restore this version as draft.`,});return;@@ -56,8 +57,9 @@ export const useRestoreCoreWorkflowVersionAsDraft = ({objectRecordId: workflowId,});} catch {- enqueueErrorSnackBar({- message: t`Could not restore this version as draft.`,+ enqueueToast({+ variant: 'error',+ children: t`Could not restore this version as draft.`,});} finally {setIsRestoring(false);diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useCreateOneFieldMetadataItem.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useCreateOneFieldMetadataItem.tsindex 7b47b9de4b9..cfcbb86a191 100644--- a/packages/twenty-front/src/modules/object-metadata/hooks/useCreateOneFieldMetadataItem.ts+++ b/packages/twenty-front/src/modules/object-metadata/hooks/useCreateOneFieldMetadataItem.ts@@ -8,11 +8,11 @@ import { useMetadataErrorHandler } from '@/metadata-error-handler/hooks/useMetadimport { useUpdateMetadataStoreDraft } from '@/metadata-store/hooks/useUpdateMetadataStoreDraft';import { type FlatFieldMetadataItem } from '@/metadata-store/types/FlatFieldMetadataItem';import { type MetadataRequestResult } from '@/object-metadata/types/MetadataRequestResult.type';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { t } from '@lingui/core/macro';-import { isDefined } from 'twenty-shared/utils';import { CrudOperationType } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';export const useCreateOneFieldMetadataItem = () => {const [createOneFieldMetadataItemMutation] = useMutation(@@ -20,7 +20,7 @@ export const useCreateOneFieldMetadataItem = () => {);const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { addToDraft, applyChanges } = useUpdateMetadataStoreDraft();const createOneFieldMetadataItem = async (@@ -67,7 +67,7 @@ export const useCreateOneFieldMetadataItem = () => {operationType: CrudOperationType.CREATE,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}return {diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useCreateOneIndexMetadataItem.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useCreateOneIndexMetadataItem.tsindex 5bbfde2bf2b..200c7f3e06d 100644--- a/packages/twenty-front/src/modules/object-metadata/hooks/useCreateOneIndexMetadataItem.ts+++ b/packages/twenty-front/src/modules/object-metadata/hooks/useCreateOneIndexMetadataItem.ts@@ -1,15 +1,15 @@-import { useMutation } from '@apollo/client/react';import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';-import { isDefined } from 'twenty-shared/utils';import { CrudOperationType } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';import { useMetadataErrorHandler } from '@/metadata-error-handler/hooks/useMetadataErrorHandler';import { useUpdateMetadataStoreDraft } from '@/metadata-store/hooks/useUpdateMetadataStoreDraft';import { type FlatIndexMetadataItem } from '@/metadata-store/types/FlatIndexMetadataItem';import { type IndexFieldMetadataItem } from '@/object-metadata/types/IndexFieldMetadataItem';import { type MetadataRequestResult } from '@/object-metadata/types/MetadataRequestResult.type';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useToast } from 'twenty-ui/primitives/feedback';import {type CreateIndexInput,CreateOneIndexMetadataItemDocument,@@ -21,7 +21,7 @@ export const useCreateOneIndexMetadataItem = () => {);const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { addToDraft, applyChanges } = useUpdateMetadataStoreDraft();const createOneIndexMetadataItem = async (@@ -75,7 +75,7 @@ export const useCreateOneIndexMetadataItem = () => {operationType: CrudOperationType.CREATE,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}return {diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useCreateOneObjectMetadataItem.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useCreateOneObjectMetadataItem.tsindex 27d605371f2..53005eb04af 100644--- a/packages/twenty-front/src/modules/object-metadata/hooks/useCreateOneObjectMetadataItem.ts+++ b/packages/twenty-front/src/modules/object-metadata/hooks/useCreateOneObjectMetadataItem.ts@@ -7,19 +7,19 @@ import {FindManyViewsDocument,} from '~/generated-metadata/graphql';-import { useInvalidateMetadataStore } from '@/metadata-store/hooks/useInvalidateMetadataStore';import { useMetadataErrorHandler } from '@/metadata-error-handler/hooks/useMetadataErrorHandler';+import { useInvalidateMetadataStore } from '@/metadata-store/hooks/useInvalidateMetadataStore';import { useUpdateMetadataStoreDraft } from '@/metadata-store/hooks/useUpdateMetadataStoreDraft';import { type FlatFieldMetadataItem } from '@/metadata-store/types/FlatFieldMetadataItem';import { type FlatObjectMetadataItem } from '@/metadata-store/types/FlatObjectMetadataItem';import { splitViewWithRelated } from '@/metadata-store/utils/splitViewWithRelated';import { type MetadataRequestResult } from '@/object-metadata/types/MetadataRequestResult.type';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useLoadCurrentUser } from '@/users/hooks/useLoadCurrentUser';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { t } from '@lingui/core/macro';import { CrudOperationType } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';export const useCreateOneObjectMetadataItem = () => {const [createOneObjectMetadataItemMutation] = useMutation(@@ -28,7 +28,7 @@ export const useCreateOneObjectMetadataItem = () => {const client = useApolloClient();const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { addToDraft, replaceDraft, applyChanges } =useUpdateMetadataStoreDraft();const { invalidateMetadataStore } = useInvalidateMetadataStore();@@ -140,7 +140,7 @@ export const useCreateOneObjectMetadataItem = () => {operationType: CrudOperationType.CREATE,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}return {diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneFieldMetadataItem.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneFieldMetadataItem.tsindex 8c9e0135144..0597c9447ea 100644--- a/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneFieldMetadataItem.ts+++ b/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneFieldMetadataItem.ts@@ -8,12 +8,12 @@ import { type MetadataRequestResult } from '@/object-metadata/types/MetadataRequimport { recordIndexGroupAggregateFieldMetadataItemComponentState } from '@/object-record/record-index/states/recordIndexGroupAggregateFieldMetadataItemComponentState';import { recordIndexGroupAggregateOperationComponentState } from '@/object-record/record-index/states/recordIndexGroupAggregateOperationComponentState';import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { t } from '@lingui/core/macro';import { CrudOperationType } from 'twenty-shared/types';+import { useToast } from 'twenty-ui/primitives/feedback';export const useDeleteOneFieldMetadataItem = () => {const [deleteOneFieldMetadataItemMutation] = useMutation(@@ -21,7 +21,7 @@ export const useDeleteOneFieldMetadataItem = () => {);const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { removeFromDraft, applyChanges } = useUpdateMetadataStoreDraft();const setRecordIndexGroupAggregateOperation = useSetAtomComponentState(@@ -82,7 +82,7 @@ export const useDeleteOneFieldMetadataItem = () => {operationType: CrudOperationType.DELETE,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}return {diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneIndexMetadataItem.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneIndexMetadataItem.tsindex cc2be821c61..0983a846994 100644--- a/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneIndexMetadataItem.ts+++ b/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneIndexMetadataItem.ts@@ -1,12 +1,12 @@-import { useMutation } from '@apollo/client/react';import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { CrudOperationType } from 'twenty-shared/types';import { useMetadataErrorHandler } from '@/metadata-error-handler/hooks/useMetadataErrorHandler';import { useUpdateMetadataStoreDraft } from '@/metadata-store/hooks/useUpdateMetadataStoreDraft';import { type MetadataRequestResult } from '@/object-metadata/types/MetadataRequestResult.type';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useToast } from 'twenty-ui/primitives/feedback';import { DeleteOneIndexMetadataItemDocument } from '~/generated-metadata/graphql';export const useDeleteOneIndexMetadataItem = () => {@@ -15,7 +15,7 @@ export const useDeleteOneIndexMetadataItem = () => {);const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { removeFromDraft, applyChanges } = useUpdateMetadataStoreDraft();const deleteOneIndexMetadataItem = async ({@@ -48,7 +48,7 @@ export const useDeleteOneIndexMetadataItem = () => {operationType: CrudOperationType.DELETE,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}return {diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneObjectMetadataItem.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneObjectMetadataItem.tsindex aec2bd2c56a..7542f0a5da2 100644--- a/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneObjectMetadataItem.ts+++ b/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneObjectMetadataItem.ts@@ -1,15 +1,15 @@import { useMutation } from '@apollo/client/react';import { DeleteOneObjectMetadataItemDocument } from '~/generated-metadata/graphql';-import { useInvalidateMetadataStore } from '@/metadata-store/hooks/useInvalidateMetadataStore';-import { useCleanMorphRelationsTargetingObjectMetadataId } from '@/metadata-store/hooks/useCleanMorphRelationsTargetingObjectMetadataId';import { useMetadataErrorHandler } from '@/metadata-error-handler/hooks/useMetadataErrorHandler';+import { useCleanMorphRelationsTargetingObjectMetadataId } from '@/metadata-store/hooks/useCleanMorphRelationsTargetingObjectMetadataId';+import { useInvalidateMetadataStore } from '@/metadata-store/hooks/useInvalidateMetadataStore';import { useUpdateMetadataStoreDraft } from '@/metadata-store/hooks/useUpdateMetadataStoreDraft';import { type MetadataRequestResult } from '@/object-metadata/types/MetadataRequestResult.type';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { t } from '@lingui/core/macro';import { CrudOperationType } from 'twenty-shared/types';+import { useToast } from 'twenty-ui/primitives/feedback';export const useDeleteOneObjectMetadataItem = () => {const [deleteOneObjectMetadataItemMutation] = useMutation(@@ -17,7 +17,7 @@ export const useDeleteOneObjectMetadataItem = () => {);const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { removeFromDraft, applyChanges } = useUpdateMetadataStoreDraft();const { invalidateMetadataStore } = useInvalidateMetadataStore();const { cleanMorphRelations } =@@ -54,7 +54,7 @@ export const useDeleteOneObjectMetadataItem = () => {operationType: CrudOperationType.DELETE,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}return {diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useUpdateOneFieldMetadataItem.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useUpdateOneFieldMetadataItem.tsindex 16493efda43..c0a7bc6a06f 100644--- a/packages/twenty-front/src/modules/object-metadata/hooks/useUpdateOneFieldMetadataItem.ts+++ b/packages/twenty-front/src/modules/object-metadata/hooks/useUpdateOneFieldMetadataItem.ts@@ -9,12 +9,12 @@ import { useUpdateMetadataStoreDraft } from '@/metadata-store/hooks/useUpdateMetimport { type FlatFieldMetadataItem } from '@/metadata-store/types/FlatFieldMetadataItem';import { lastFieldMetadataItemUpdateState } from '@/object-metadata/states/lastFieldMetadataItemUpdateState';import { type MetadataRequestResult } from '@/object-metadata/types/MetadataRequestResult.type';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { t } from '@lingui/core/macro';-import { isDefined } from 'twenty-shared/utils';import { CrudOperationType } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { v4 as uuidv4 } from 'uuid';export const useUpdateOneFieldMetadataItem = () => {@@ -24,7 +24,7 @@ export const useUpdateOneFieldMetadataItem = () => {const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { updateInDraft, applyChanges } = useUpdateMetadataStoreDraft();const setLastFieldMetadataItemUpdate = useSetAtomState(@@ -97,7 +97,7 @@ export const useUpdateOneFieldMetadataItem = () => {operationType: CrudOperationType.UPDATE,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}return {diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useUpdateOneObjectMetadataItem.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useUpdateOneObjectMetadataItem.tsindex f186b711d18..7cefd2565d7 100644--- a/packages/twenty-front/src/modules/object-metadata/hooks/useUpdateOneObjectMetadataItem.ts+++ b/packages/twenty-front/src/modules/object-metadata/hooks/useUpdateOneObjectMetadataItem.ts@@ -9,11 +9,11 @@ import { useMetadataErrorHandler } from '@/metadata-error-handler/hooks/useMetadimport { useUpdateMetadataStoreDraft } from '@/metadata-store/hooks/useUpdateMetadataStoreDraft';import { type FlatObjectMetadataItem } from '@/metadata-store/types/FlatObjectMetadataItem';import { type MetadataRequestResult } from '@/object-metadata/types/MetadataRequestResult.type';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { t } from '@lingui/core/macro';-import { isDefined } from 'twenty-shared/utils';import { CrudOperationType } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';// TODO: Slice the Apollo store synchronously in the update function instead of subscribing, so we can use update after read in the same function callexport const useUpdateOneObjectMetadataItem = () => {@@ -23,7 +23,7 @@ export const useUpdateOneObjectMetadataItem = () => {const client = useApolloClient();const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { updateInDraft, replaceDraft, applyChanges } =useUpdateMetadataStoreDraft();@@ -79,7 +79,7 @@ export const useUpdateOneObjectMetadataItem = () => {operationType: CrudOperationType.UPDATE,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}return {diff --git a/packages/twenty-front/src/modules/object-record/hooks/useBatchCreateManyRecords.ts b/packages/twenty-front/src/modules/object-record/hooks/useBatchCreateManyRecords.tsindex fc47e30131b..4ec3d46861f 100644--- a/packages/twenty-front/src/modules/object-record/hooks/useBatchCreateManyRecords.ts+++ b/packages/twenty-front/src/modules/object-record/hooks/useBatchCreateManyRecords.ts@@ -1,3 +1,4 @@+import { dispatchObjectRecordOperationBrowserEvent } from '@/browser-event/utils/dispatchObjectRecordOperationBrowserEvent';import { useNumberFormat } from '@/localization/hooks/useNumberFormat';import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';import { DEFAULT_MUTATION_BATCH_SIZE } from '@/object-record/constants/DefaultMutationBatchSize';@@ -7,10 +8,9 @@ import {} from '@/object-record/hooks/useCreateManyRecords';import { useRefetchAggregateQueries } from '@/object-record/hooks/useRefetchAggregateQueries';import { type ObjectRecord } from '@/object-record/types/ObjectRecord';-import { dispatchObjectRecordOperationBrowserEvent } from '@/browser-event/utils/dispatchObjectRecordOperationBrowserEvent';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { t } from '@lingui/core/macro';+import { useToast } from 'twenty-ui/primitives/feedback';export const useBatchCreateManyRecords = <CreatedObjectRecord extends ObjectRecord = ObjectRecord,@@ -41,7 +41,7 @@ export const useBatchCreateManyRecords = <const { refetchAggregateQueries } = useRefetchAggregateQueries();- const { enqueueWarningSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { formatNumber } = useNumberFormat();const batchCreateManyRecords = async ({@@ -86,11 +86,10 @@ export const useBatchCreateManyRecords = <error.message.includes('aborted')) {const formattedCreatedRecordsCount = formatNumber(createdRecordsCount);- enqueueWarningSnackBar({- message: t`Record creation stopped. ${formattedCreatedRecordsCount} records created.`,- options: {- duration: 5000,- },+ enqueueToast({+ variant: 'warning',+ children: t`Record creation stopped. ${formattedCreatedRecordsCount} records created.`,+ duration: 5000,});} else {throw error;diff --git a/packages/twenty-front/src/modules/object-record/hooks/useFindDuplicateRecords.ts b/packages/twenty-front/src/modules/object-record/hooks/useFindDuplicateRecords.tsindex 7ae381d6d9a..bd0070d924f 100644--- a/packages/twenty-front/src/modules/object-record/hooks/useFindDuplicateRecords.ts+++ b/packages/twenty-front/src/modules/object-record/hooks/useFindDuplicateRecords.ts@@ -1,8 +1,7 @@import { useQuery } from '@apollo/client/react';-import { isDefined } from 'twenty-shared/utils';import { useMemo } from 'react';+import { isDefined } from 'twenty-shared/utils';-import { useSnackBarOnQueryError } from '@/apollo/hooks/useSnackBarOnQueryError';import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';import { type ObjectMetadataItemIdentifier } from '@/object-metadata/types/ObjectMetadataItemIdentifier';@@ -49,8 +48,6 @@ export const useFindDuplicateRecords = <T extends ObjectRecord = ObjectRecord>({},);- useSnackBarOnQueryError(error);-const objectResults = data?.[queryResponseField];const results = useMemo(diff --git a/packages/twenty-front/src/modules/object-record/hooks/useHandleFindManyRecordsError.ts b/packages/twenty-front/src/modules/object-record/hooks/useHandleFindManyRecordsError.tsindex 96be9dc99ad..edc97e2dd8c 100644--- a/packages/twenty-front/src/modules/object-record/hooks/useHandleFindManyRecordsError.ts+++ b/packages/twenty-front/src/modules/object-record/hooks/useHandleFindManyRecordsError.ts@@ -1,9 +1,10 @@-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { type ErrorLike } from '@apollo/client';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useCallback } from 'react';++import { useToast } from 'twenty-ui/primitives/feedback';import { logError } from '~/utils/logError';export const useHandleFindManyRecordsError = ({@@ -13,7 +14,7 @@ export const useHandleFindManyRecordsError = ({objectMetadataItem: EnrichedObjectMetadataItem;handleError?: (error?: Error) => void;}) => {- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const handleFindManyRecordsError = useCallback((error: ErrorLike) => {@@ -21,16 +22,10 @@ export const useHandleFindManyRecordsError = ({`useFindManyRecords for "${objectMetadataItem.namePlural}" error : ` +error,);- if (CombinedGraphQLErrors.is(error)) {- enqueueErrorSnackBar({- apolloError: error,- });- } else {- enqueueErrorSnackBar({});- }+ enqueueToast(getToastOptionsFromError({ error }));handleError?.(error as Error);},- [enqueueErrorSnackBar, handleError, objectMetadataItem.namePlural],+ [enqueueToast, handleError, objectMetadataItem.namePlural],);return {diff --git a/packages/twenty-front/src/modules/object-record/hooks/useObjectRecordSearchRecords.ts b/packages/twenty-front/src/modules/object-record/hooks/useObjectRecordSearchRecords.tsindex 795567124c5..bfa5c0b9c2e 100644--- a/packages/twenty-front/src/modules/object-record/hooks/useObjectRecordSearchRecords.ts+++ b/packages/twenty-front/src/modules/object-record/hooks/useObjectRecordSearchRecords.ts@@ -2,11 +2,10 @@ import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMembeimport { MAX_SEARCH_RESULTS } from '@/command-menu/constants/MaxSearchResults';import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';import { useDoObjectMetadataItemsExist } from '@/object-metadata/hooks/useDoObjectMetadataItemsExist';-import { useSnackBarOnQueryError } from '@/apollo/hooks/useSnackBarOnQueryError';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { type WatchQueryFetchPolicy } from '@apollo/client';import { useQuery } from '@apollo/client/react';import { useMemo } from 'react';-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { isDefined } from 'twenty-shared/utils';import {type ObjectRecordFilterInput,@@ -14,7 +13,7 @@ import {} from '~/generated/graphql';// maybe we should look at ObjectMetadataItemIdentifier to update the API even though there are many location to update-export type UseSearchRecordsParams = {+type UseSearchRecordsParams = {objectNameSingulars: string[];limit?: number;onError?: (error?: Error) => void;@@ -50,8 +49,6 @@ export const useObjectRecordSearchRecords = ({client: apolloCoreClient,});- useSnackBarOnQueryError(error);-const effectiveData = loading ? previousData : data;const searchRecords = useMemo(diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/__stories__/ObjectOptionsDropdownContent.stories.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/__stories__/ObjectOptionsDropdownContent.stories.tsxindex c819b8adce1..7888679acb4 100644--- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/__stories__/ObjectOptionsDropdownContent.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/__stories__/ObjectOptionsDropdownContent.stories.tsx@@ -1,7 +1,6 @@import { type Meta, type StoryObj } from '@storybook/react-vite';import { RecordComponentInstanceContextsWrapper } from '@/object-record/components/RecordComponentInstanceContextsWrapper';-import { setTestObjectMetadataItemsInMetadataStore } from '~/testing/utils/setTestObjectMetadataItemsInMetadataStore';import { ObjectOptionsDropdownContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownContent';import { OBJECT_OPTIONS_DROPDOWN_ID } from '@/object-record/object-options-dropdown/constants/ObjectOptionsDropdownId';import { ObjectOptionsDropdownContext } from '@/object-record/object-options-dropdown/states/contexts/ObjectOptionsDropdownContext';@@ -11,6 +10,7 @@ import { useRecordIndexFieldMetadataDerivedStates } from '@/object-record/recordimport { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/DropdownComponentInstanceContext';+import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext';import { ViewType } from '@/views/types/ViewType';import { useEffect } from 'react';@@ -19,9 +19,9 @@ import { ComponentDecorator } from 'twenty-ui/testing';import { ContextStoreDecorator } from '~/testing/decorators/ContextStoreDecorator';import { IconsProviderDecorator } from '~/testing/decorators/IconsProviderDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { getTestEnrichedObjectMetadataItemsMock } from '~/testing/utils/getTestEnrichedObjectMetadataItemsMock';-import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';+import { setTestObjectMetadataItemsInMetadataStore } from '~/testing/utils/setTestObjectMetadataItemsInMetadataStore';const instanceId = 'entity-options-instance';@@ -57,7 +57,7 @@ const meta: Meta<typeof ObjectOptionsDropdownContent> = {},ContextStoreDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,ComponentDecorator,IconsProviderDecorator,],diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/grid/components/__stories__/RecordCalendarGrid.stories.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/grid/components/__stories__/RecordCalendarGrid.stories.tsxindex 8f7b06f4802..743a2bb542a 100644--- a/packages/twenty-front/src/modules/object-record/record-calendar/grid/components/__stories__/RecordCalendarGrid.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-calendar/grid/components/__stories__/RecordCalendarGrid.stories.tsx@@ -23,7 +23,7 @@ import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';import { ContextStoreDecorator } from '~/testing/decorators/ContextStoreDecorator';import { IconsProviderDecorator } from '~/testing/decorators/IconsProviderDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { mockedViews } from '~/testing/mock-data/generated/metadata/views/mock-views-data';import { getTestEnrichedObjectMetadataItemsMock } from '~/testing/utils/getTestEnrichedObjectMetadataItemsMock';import { setTestViewsInMetadataStore } from '~/testing/utils/setTestViewsInMetadataStore';@@ -155,7 +155,7 @@ const meta: Meta<typeof RecordCalendarGrid> = {},ContextStoreDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,ComponentDecorator,IconsProviderDecorator,RouterDecorator,diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/hooks/useRecordCalendarDndKit.ts b/packages/twenty-front/src/modules/object-record/record-calendar/hooks/useRecordCalendarDndKit.tsindex 84aee3ec783..3a0eff6052e 100644--- a/packages/twenty-front/src/modules/object-record/record-calendar/hooks/useRecordCalendarDndKit.ts+++ b/packages/twenty-front/src/modules/object-record/record-calendar/hooks/useRecordCalendarDndKit.ts@@ -6,22 +6,22 @@ import { isDefined } from 'twenty-shared/utils';import { getRecordIdFromRecordCalendarCardDraggableId } from '@/object-record/record-calendar/record-calendar-card/utils/getRecordCalendarCardDraggableId';import { calendarDayRecordIdsComponentFamilySelector } from '@/object-record/record-calendar/states/selectors/calendarDayRecordsComponentFamilySelector';+import { recordCalendarSelectedRecordIdsComponentSelector } from '@/object-record/record-calendar/states/selectors/recordCalendarSelectedRecordIdsComponentSelector';import { useEndRecordDrag } from '@/object-record/record-drag/hooks/useEndRecordDrag';import { useProcessCalendarCardDrop } from '@/object-record/record-drag/hooks/useProcessCalendarCardDrop';import { useStartRecordDrag } from '@/object-record/record-drag/hooks/useStartRecordDrag';+import { originalDragSelectionComponentState } from '@/object-record/record-drag/states/originalDragSelectionComponentState';import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone';import { type DragDropItemData } from '@/ui/utilities/drag-and-drop/types/DragDropItemData';+import { type DragDropProviderDragEndEvent } from '@/ui/utilities/drag-and-drop/types/DragDropProviderDragEndEvent';+import { type DragDropProviderDragMoveEvent } from '@/ui/utilities/drag-and-drop/types/DragDropProviderDragMoveEvent';+import { type DragDropProviderDragStartEvent } from '@/ui/utilities/drag-and-drop/types/DragDropProviderDragStartEvent';import { getDestinationIndex } from '@/ui/utilities/drag-and-drop/utils/getDestinationIndex';import { resolveDropFromPointer } from '@/ui/utilities/drag-and-drop/utils/resolveDropFromPointer';import { useAtomComponentFamilySelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorCallbackState';-import { recordCalendarSelectedRecordIdsComponentSelector } from '@/object-record/record-calendar/states/selectors/recordCalendarSelectedRecordIdsComponentSelector';-import { originalDragSelectionComponentState } from '@/object-record/record-drag/states/originalDragSelectionComponentState';import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState';import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState';-import { type DragDropProviderDragEndEvent } from '@/ui/utilities/drag-and-drop/types/DragDropProviderDragEndEvent';-import { type DragDropProviderDragMoveEvent } from '@/ui/utilities/drag-and-drop/types/DragDropProviderDragMoveEvent';-import { type DragDropProviderDragStartEvent } from '@/ui/utilities/drag-and-drop/types/DragDropProviderDragStartEvent';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useToast } from 'twenty-ui/primitives/feedback';import { logError } from '~/utils/logError';type DragStartPayload = DragDropProviderDragStartEvent<DragDropItemData>;@@ -45,7 +45,7 @@ export const useRecordCalendarDndKit = (): {const { userTimezone } = useUserTimezone();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { startRecordDrag } = useStartRecordDrag();const { endRecordDrag } = useEndRecordDrag();@@ -172,7 +172,7 @@ export const useRecordCalendarDndKit = (): {selectedRecordIds: originalDragSelection,}).catch((error) => {logError(error);- enqueueErrorSnackBar({ message: t`Failed to move record` });+ enqueueToast({ variant: 'error', children: t`Failed to move record` });});clearDragState();diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/duplicate/components/RecordDetailDuplicatesSection.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/duplicate/components/RecordDetailDuplicatesSection.tsxindex 3ae1f991e6e..ecd067a8d52 100644--- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/duplicate/components/RecordDetailDuplicatesSection.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/duplicate/components/RecordDetailDuplicatesSection.tsx@@ -1,3 +1,4 @@+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { useOpenMergeRecordsPageInSidePanel } from '@/side-panel/hooks/useOpenMergeRecordsPageInSidePanel';import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';import { RecordChip } from '@/object-record/components/RecordChip';@@ -7,6 +8,7 @@ import { RecordDetailRecordsListItemContainer } from '@/object-record/record-fieimport { RecordDetailSectionContainer } from '@/object-record/record-field-list/record-detail-section/components/RecordDetailSectionContainer';import { t } from '@lingui/core/macro';+import { isNonEmptyArray } from '@sniptt/guards';import { isDefined } from 'twenty-shared/utils';import { IconArrowMerge } from 'twenty-ui/icon';import { LightIconButton } from 'twenty-ui/primitives/input';@@ -22,7 +24,7 @@ export const RecordDetailDuplicatesSection = ({objectNameSingular,});- const { results: queryResults } = useFindDuplicateRecords({+ const { results: queryResults, error } = useFindDuplicateRecords({objectRecordIds: [objectRecordId],objectNameSingular,skip: !isDefined(objectMetadataItem.duplicateCriteria),@@ -40,35 +42,33 @@ export const RecordDetailDuplicatesSection = ({objectRecordIds: duplicateRecordIds,});- if (- !isDefined(queryResults) ||- !isDefined(queryResults[0]) ||- queryResults[0].length === 0- )- return null;-return (- <RecordDetailSectionContainer- title={t`Duplicates`}- rightAdornment={- <LightIconButton- className="displayOnHover"- Icon={IconArrowMerge}- accent="tertiary"- onClick={openMergeRecordsPageInSidePanel}- />- }- >- <RecordDetailRecordsListContainer>- {queryResults[0].slice(0, 5).map((duplicateRecord) => (- <RecordDetailRecordsListItemContainer key={duplicateRecord.id}>- <RecordChip- record={duplicateRecord}- objectNameSingular={objectNameSingular}+ <>+ <ToastOnQueryErrorEffect error={error} />+ {isNonEmptyArray(duplicateRecords) && (+ <RecordDetailSectionContainer+ title={t`Duplicates`}+ rightAdornment={+ <LightIconButton+ className="displayOnHover"+ Icon={IconArrowMerge}+ accent="tertiary"+ onClick={openMergeRecordsPageInSidePanel}/>- </RecordDetailRecordsListItemContainer>- ))}- </RecordDetailRecordsListContainer>- </RecordDetailSectionContainer>+ }+ >+ <RecordDetailRecordsListContainer>+ {duplicateRecords.slice(0, 5).map((duplicateRecord) => (+ <RecordDetailRecordsListItemContainer key={duplicateRecord.id}>+ <RecordChip+ record={duplicateRecord}+ objectNameSingular={objectNameSingular}+ />+ </RecordDetailRecordsListItemContainer>+ ))}+ </RecordDetailRecordsListContainer>+ </RecordDetailSectionContainer>+ )}+ </>);};diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/duplicate/components/__stories__/RecordDetailDuplicatesSection.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/duplicate/components/__stories__/RecordDetailDuplicatesSection.stories.tsxindex 0998cba22fb..b486a0f773b 100644--- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/duplicate/components/__stories__/RecordDetailDuplicatesSection.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/duplicate/components/__stories__/RecordDetailDuplicatesSection.stories.tsx@@ -1,14 +1,14 @@import { type Meta, type StoryObj } from '@storybook/react-vite';-import { CoreObjectNameSingular } from 'twenty-shared/types';+import { RecordDetailDuplicatesSection } from '@/object-record/record-field-list/record-detail-section/duplicate/components/RecordDetailDuplicatesSection';import { LayoutRenderingProvider } from '@/ui/layout/contexts/LayoutRenderingContext';+import { CoreObjectNameSingular } from 'twenty-shared/types';+import { ComponentDecorator } from 'twenty-ui/testing';+import { PageLayoutType } from '~/generated-metadata/graphql';import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';-import { RecordDetailDuplicatesSection } from '@/object-record/record-field-list/record-detail-section/duplicate/components/RecordDetailDuplicatesSection';-import { ComponentDecorator } from 'twenty-ui/testing';-import { PageLayoutType } from '~/generated-metadata/graphql';import { mockedCompanyRecords } from '~/testing/mock-data/generated/data/companies/mock-companies-data';const meta: Meta<typeof RecordDetailDuplicatesSection> = {@@ -31,7 +31,7 @@ const meta: Meta<typeof RecordDetailDuplicatesSection> = {),ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,MemoryRouterDecorator,],args: {diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/__stories__/RecordDetailRelationSection.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/__stories__/RecordDetailRelationSection.stories.tsxindex c059bb25e47..ce01565859e 100644--- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/__stories__/RecordDetailRelationSection.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/__stories__/RecordDetailRelationSection.stories.tsx@@ -1,21 +1,21 @@import { type Meta, type StoryObj } from '@storybook/react-vite';-import { formatFieldMetadataItemAsFieldDefinition } from '@/object-metadata/utils/formatFieldMetadataItemAsFieldDefinition';-import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext';-import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';-import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { RecordStoreDecorator } from '~/testing/decorators/RecordStoreDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';-import { graphqlMocks } from '~/testing/graphqlMocks';import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext';+import { formatFieldMetadataItemAsFieldDefinition } from '@/object-metadata/utils/formatFieldMetadataItemAsFieldDefinition';+import { getRecordFromRecordNode } from '@/object-record/cache/utils/getRecordFromRecordNode';import { RecordFieldsScopeContextProvider } from '@/object-record/record-field-list/contexts/RecordFieldsScopeContext';import { RecordDetailRelationSection } from '@/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSection';+import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext';import { LayoutRenderingProvider } from '@/ui/layout/contexts/LayoutRenderingContext';import { ComponentDecorator } from 'twenty-ui/testing';import { PageLayoutType } from '~/generated-metadata/graphql';+import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';+import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';+import { RecordStoreDecorator } from '~/testing/decorators/RecordStoreDecorator';import { SidePanelDecorator } from '~/testing/decorators/SidePanelDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';+import { graphqlMocks } from '~/testing/graphqlMocks';import { mockedCompanyRecords } from '~/testing/mock-data/generated/data/companies/mock-companies-data';-import { getRecordFromRecordNode } from '@/object-record/cache/utils/getRecordFromRecordNode';import { mockedPersonRecords } from '~/testing/mock-data/generated/data/people/mock-people-data';import { getTestEnrichedObjectMetadataItemsMock } from '~/testing/utils/getTestEnrichedObjectMetadataItemsMock';@@ -71,7 +71,7 @@ const meta: Meta<typeof RecordDetailRelationSection> = {SidePanelDecorator,ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,MemoryRouterDecorator,],parameters: {diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormMultiRecordPicker.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormMultiRecordPicker.tsxindex eec1d970c3d..f509de7c0a3 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormMultiRecordPicker.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormMultiRecordPicker.tsx@@ -1,5 +1,4 @@import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';-import { FormFieldInputContainer } from '@/ui/input/components/FormFieldInputContainer';import { FormFieldInputInnerContainer } from '@/object-record/record-field/ui/form-types/components/FormFieldInputInnerContainer';import { FormFieldInputRowContainer } from '@/object-record/record-field/ui/form-types/components/FormFieldInputRowContainer';import { FormMultiRecordFieldChips } from '@/object-record/record-field/ui/form-types/components/FormMultiRecordFieldChips';@@ -15,20 +14,21 @@ import {} from '@/object-record/record-field/ui/form-types/utils/getFormMultiRecordPickerDraftValue';import { MultipleRecordPicker } from '@/object-record/record-picker/multiple-record-picker/components/MultipleRecordPicker';import { type RecordPickerPickableMorphItem } from '@/object-record/record-picker/types/RecordPickerPickableMorphItem';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { Field } from 'twenty-ui/primitives/input';+import { FormFieldInputContainer } from '@/ui/input/components/FormFieldInputContainer';import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';-import { useContext, useId, useState } from 'react';import { isNonEmptyArray } from '@sniptt/guards';+import { useContext, useId, useState } from 'react';import { QUERY_MAX_RECORDS } from 'twenty-shared/constants';import { isDefined, isValidUuid } from 'twenty-shared/utils';-import { mapArrayToObject } from '~/utils/array/mapArrayToObject';import { IconChevronDown } from 'twenty-ui/icon';+import { useToast } from 'twenty-ui/primitives/feedback';+import { Field } from 'twenty-ui/primitives/input';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';+import { mapArrayToObject } from '~/utils/array/mapArrayToObject';const StyledFormSelectContainerWrapper = styled.div<{ readonly?: boolean }>`cursor: ${({ readonly }) => (readonly ? 'default' : 'pointer')};@@ -84,7 +84,7 @@ export const FormMultiRecordPicker = ({const variablesDropdownId = `form-multi-record-picker-${componentId}-variables`;const { closeDropdown } = useCloseDropdown();- const { enqueueWarningSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { openFormMultiRecordPicker } = useOpenFormMultiRecordPicker({objectNameSingular,});@@ -138,8 +138,9 @@ export const FormMultiRecordPicker = ({).length;if (selectedRecordCount >= QUERY_MAX_RECORDS) {- enqueueWarningSnackBar({- message: t`You can select at most ${QUERY_MAX_RECORDS} records.`,+ enqueueToast({+ variant: 'warning',+ children: t`You can select at most ${QUERY_MAX_RECORDS} records.`,});return;diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormRecordRichTextFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormRecordRichTextFieldInput.tsxindex 22de2b8ffb0..e7d4f71ba1b 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormRecordRichTextFieldInput.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormRecordRichTextFieldInput.tsx@@ -2,6 +2,7 @@ import { useCreateBlockNote } from '@blocknote/react';import { useLingui } from '@lingui/react/macro';import { useEffect, useId, useState } from 'react';import { isNonEmptyArray } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { Field } from 'twenty-ui/primitives/input';import { BLOCK_SCHEMA } from '@/blocknote-editor/blocks/Schema';@@ -11,7 +12,6 @@ import { countBlocksDeep } from '@/blocknote-editor/utils/countBlocksDeep';import { filterBlocksSupportedBySchema } from '@/blocknote-editor/utils/filterBlocksSupportedBySchema';import { parseInitialBlocknote } from '@/blocknote-editor/utils/parseInitialBlocknote';import { type FieldRichTextValue } from '@/object-record/record-field/ui/types/FieldMetadata';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { FormFieldInputContainer } from '@/ui/input/components/FormFieldInputContainer';import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById';@@ -43,7 +43,7 @@ export const FormRecordRichTextFieldInput = ({const { removeFocusItemFromFocusStackById } =useRemoveFocusItemFromFocusStackById();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [{ initialBlocks, hasUnreadableStoredValue }] = useState(() => {const parsedBlocks = parseInitialBlocknote(@@ -65,8 +65,9 @@ export const FormRecordRichTextFieldInput = ({});const handleUploadFile = async (): Promise<string> => {- enqueueErrorSnackBar({- message: t`Save the record before attaching a file`,+ enqueueToast({+ variant: 'error',+ children: t`Save the record before attaching a file`,});return '';@@ -112,11 +113,12 @@ export const FormRecordRichTextFieldInput = ({useEffect(() => {if (hasUnreadableStoredValue) {- enqueueErrorSnackBar({- message: t`This content was saved in an older format and cannot be edited here`,+ enqueueToast({+ variant: 'error',+ children: t`This content was saved in an older format and cannot be edited here`,});}- }, [hasUnreadableStoredValue, enqueueErrorSnackBar, t]);+ }, [hasUnreadableStoredValue, enqueueToast, t]);return (<FormFieldInputContainer>diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormMultiRecordPicker.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormMultiRecordPicker.stories.tsxindex 33bbd2ee26b..874f87b15d5 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormMultiRecordPicker.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormMultiRecordPicker.stories.tsx@@ -4,7 +4,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';import { expect, fn, userEvent, within } from 'storybook/test';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';@@ -22,7 +22,7 @@ const meta: Meta<typeof FormMultiRecordPicker> = {ObjectMetadataItemsDecorator,ComponentDecorator,WorkspaceDecorator,- SnackBarDecorator,+ ToastDecorator,RouterDecorator,],};diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormRecordRichTextFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormRecordRichTextFieldInput.stories.tsxindex f5e1b417068..be6094e0306 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormRecordRichTextFieldInput.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormRecordRichTextFieldInput.stories.tsx@@ -3,7 +3,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';import { expect, fn, userEvent, waitFor, within } from 'storybook/test';import { ComponentDecorator } from 'twenty-ui/testing';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';const BLOCKNOTE_PARAGRAPH = JSON.stringify([@@ -35,7 +35,7 @@ const meta: Meta<typeof FormRecordRichTextFieldInput> = {component: FormRecordRichTextFieldInput,decorators: [ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,ComponentDecorator,],parameters: {diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormSingleRecordPicker.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormSingleRecordPicker.stories.tsxindex 7d539fada76..1dea14b265a 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormSingleRecordPicker.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormSingleRecordPicker.stories.tsx@@ -4,7 +4,7 @@ import { expect, fn, userEvent, within } from 'storybook/test';import { isDefined } from 'twenty-shared/utils';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';@@ -22,7 +22,7 @@ const meta: Meta<typeof FormSingleRecordPicker> = {ObjectMetadataItemsDecorator,ComponentDecorator,WorkspaceDecorator,- SnackBarDecorator,+ ToastDecorator,],};@@ -62,7 +62,7 @@ export const WithVariables: Story = {WorkflowStepDecorator,ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,RouterDecorator,],play: async ({ canvasElement }) => {diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/hooks/useCreateJunctionRecordWithNestedTarget.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/hooks/useCreateJunctionRecordWithNestedTarget.tsindex 1028d7346bc..d6496a3ebc6 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/hooks/useCreateJunctionRecordWithNestedTarget.ts+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/hooks/useCreateJunctionRecordWithNestedTarget.ts@@ -1,24 +1,24 @@-import { useCallback, useState } from 'react';-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { t } from '@lingui/core/macro';import { useStore } from 'jotai';+import { useCallback, useState } from 'react';import { v4 } from 'uuid';-import { getObjectTypename } from '@/object-record/cache/utils/getObjectTypename';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems';import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';+import { getObjectTypename } from '@/object-record/cache/utils/getObjectTypename';import { useBuildRecordInputFromRLSPredicates } from '@/object-record/hooks/useBuildRecordInputFromRLSPredicates';import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';-import { upsertJunctionRecordInSourceRecordStore } from '@/object-record/record-field/ui/utils/junction/upsertJunctionRecordInSourceRecordStore';-import { type ValidJunctionConfig } from '@/object-record/record-field/ui/utils/junction/types/ValidJunctionConfig';import { findTargetFieldInfo } from '@/object-record/record-field/ui/utils/junction/findTargetFieldInfo';import { getSourceJoinColumnName } from '@/object-record/record-field/ui/utils/junction/getSourceJoinColumnName';+import { type ValidJunctionConfig } from '@/object-record/record-field/ui/utils/junction/types/ValidJunctionConfig';+import { upsertJunctionRecordInSourceRecordStore } from '@/object-record/record-field/ui/utils/junction/upsertJunctionRecordInSourceRecordStore';import { type RecordPickerPickableMorphItem } from '@/object-record/record-picker/types/RecordPickerPickableMorphItem';import { type ObjectRecord } from '@/object-record/types/ObjectRecord';import { buildRecordLabelPayload } from '@/object-record/utils/buildRecordLabelPayload';import { sanitizeRecordInput } from '@/object-record/utils/sanitizeRecordInput';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';type UseCreateJunctionRecordWithNestedTargetArgs = {sourceRecordId: string;@@ -36,7 +36,7 @@ export const useCreateJunctionRecordWithNestedTarget = ({const store = useStore();const [loading, setLoading] = useState(false);const { objectMetadataItems } = useObjectMetadataItems();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { buildRecordInputFromRLSPredicates } =useBuildRecordInputFromRLSPredicates();const { createOneRecord: createJunctionRecord } = useCreateOneRecord({@@ -75,8 +75,9 @@ export const useCreateJunctionRecordWithNestedTarget = ({!isDefined(targetFieldInfo) ||!isDefined(sourceJoinColumnName)) {- enqueueErrorSnackBar({- message: t`The relation configuration could not be resolved.`,+ enqueueToast({+ variant: 'error',+ children: t`The relation configuration could not be resolved.`,});return undefined;}@@ -137,13 +138,7 @@ export const useCreateJunctionRecordWithNestedTarget = ({isMatchingSearchFilter: true,};} catch (error) {- enqueueErrorSnackBar(- CombinedGraphQLErrors.is(error)- ? { apolloError: error }- : error instanceof Error- ? { message: error.message }- : {},- );+ enqueueToast(getToastOptionsFromError({ error }));return undefined;} finally {setLoading(false);@@ -152,7 +147,7 @@ export const useCreateJunctionRecordWithNestedTarget = ({[buildRecordInputFromRLSPredicates,createJunctionRecord,- enqueueErrorSnackBar,+ enqueueToast,junctionConfig,objectMetadataItems,sourceObjectMetadataItem,diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/EmailsFieldDisplay.perf.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/EmailsFieldDisplay.perf.stories.tsxindex 2f9b2e9c386..d4aebe81d7c 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/EmailsFieldDisplay.perf.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/EmailsFieldDisplay.perf.stories.tsx@@ -3,7 +3,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';import { EmailsFieldDisplay } from '@/object-record/record-field/ui/meta-types/display/components/EmailsFieldDisplay';import { ComponentDecorator } from 'twenty-ui/testing';import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { getFieldDecorator } from '~/testing/decorators/getFieldDecorator';import { getProfilingStory } from '~/testing/profiling/utils/getProfilingStory';@@ -16,7 +16,7 @@ const meta: Meta = {additionalEmails: ['[email protected]'],}),ComponentDecorator,- SnackBarDecorator,+ ToastDecorator,],component: EmailsFieldDisplay,args: {},diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/FilesFieldDisplay.perf.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/FilesFieldDisplay.perf.stories.tsxindex 8afc38d8d46..c01e8956357 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/FilesFieldDisplay.perf.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/FilesFieldDisplay.perf.stories.tsx@@ -3,12 +3,12 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';import { FilesDisplay } from '@/ui/field/display/components/FilesDisplay';import { ComponentDecorator } from 'twenty-ui/testing';import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { getProfilingStory } from '~/testing/profiling/utils/getProfilingStory';const meta: Meta<typeof FilesDisplay> = {title: 'UI/Data/Field/Display/FilesFieldDisplay',- decorators: [MemoryRouterDecorator, ComponentDecorator, SnackBarDecorator],+ decorators: [MemoryRouterDecorator, ComponentDecorator, ToastDecorator],component: FilesDisplay,args: {value: [diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/LinksFieldDisplay.perf.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/LinksFieldDisplay.perf.stories.tsxindex cbb8e9f403a..d7f70ac260a 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/LinksFieldDisplay.perf.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/LinksFieldDisplay.perf.stories.tsx@@ -6,7 +6,7 @@ import { FieldFocusContextProvider } from '@/object-record/record-field/ui/conteimport { LinksFieldDisplay } from '@/object-record/record-field/ui/meta-types/display/components/LinksFieldDisplay';import { ComponentDecorator } from 'twenty-ui/testing';import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { getFieldDecorator } from '~/testing/decorators/getFieldDecorator';import { getProfilingStory } from '~/testing/profiling/utils/getProfilingStory';@@ -30,7 +30,7 @@ const meta: Meta = {secondaryLinks: ['https://www.toto.com'],}),ComponentDecorator,- SnackBarDecorator,+ ToastDecorator,],component: LinksFieldDisplay,args: {},diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/PhonesFieldDisplay.perf.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/PhonesFieldDisplay.perf.stories.tsxindex 9050ab15ac1..2e5907efcc8 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/PhonesFieldDisplay.perf.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/PhonesFieldDisplay.perf.stories.tsx@@ -3,7 +3,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';import { PhonesFieldDisplay } from '@/object-record/record-field/ui/meta-types/display/components/PhonesFieldDisplay';import { ComponentDecorator } from 'twenty-ui/testing';import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { getFieldDecorator } from '~/testing/decorators/getFieldDecorator';import { getProfilingStory } from '~/testing/profiling/utils/getProfilingStory';@@ -13,7 +13,7 @@ const meta: Meta = {MemoryRouterDecorator,getFieldDecorator('person', 'phones'),ComponentDecorator,- SnackBarDecorator,+ ToastDecorator,],component: PhonesFieldDisplay,args: {},diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useUploadFilesFieldFile.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useUploadFilesFieldFile.tsindex f64ecadae6c..d927bbe99a7 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useUploadFilesFieldFile.ts+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useUploadFilesFieldFile.ts@@ -1,6 +1,6 @@import { useDirectFileUpload } from '@/file/hooks/useDirectFileUpload';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useLingui } from '@lingui/react/macro';+import { useToast } from 'twenty-ui/primitives/feedback';import { FileFolder } from '~/generated-metadata/graphql';const DEFAULT_VALUE_BEFORE_SERVER_RESPONSE =@@ -8,7 +8,7 @@ const DEFAULT_VALUE_BEFORE_SERVER_RESPONSE =export const useUploadFilesFieldFile = () => {const { uploadFile: directUploadFile } = useDirectFileUpload();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { t } = useLingui();const uploadFile = async (file: File, fieldMetadataId: string) => {@@ -19,8 +19,9 @@ export const useUploadFilesFieldFile = () => {});const fileName = file.name;- enqueueSuccessSnackBar({- message: t`File "${fileName}" uploaded successfully`,+ enqueueToast({+ variant: 'success',+ children: t`File "${fileName}" uploaded successfully`,});return {@@ -32,8 +33,9 @@ export const useUploadFilesFieldFile = () => {} catch (error) {const fileNameForError = file.name;const errorMessage = String(error);- enqueueErrorSnackBar({- message: t`Failed to upload "${fileNameForError}"`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to upload "${fileNameForError}"`,});throw new Error(diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/FilesFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/FilesFieldInput.tsxindex 841dfffc4d7..1810d1cea54 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/FilesFieldInput.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/FilesFieldInput.tsx@@ -10,15 +10,15 @@ import { uploadMultipleFiles } from '@/object-record/record-field/ui/meta-types/import { recordFieldInputIsFieldInErrorComponentState } from '@/object-record/record-field/ui/states/recordFieldInputIsFieldInErrorComponentState';import { type FieldFilesValue } from '@/object-record/record-field/ui/types/FieldMetadata';import { filesFieldValueSchema } from '@/object-record/record-field/ui/validation-schemas/filesFieldValueSchema';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { filePreviewState } from '@/ui/field/display/states/filePreviewState';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';+import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { useLingui } from '@lingui/react/macro';import { useCallback, useContext, useMemo, useState } from 'react';import { MULTI_ITEM_FIELD_DEFAULT_MAX_VALUES } from 'twenty-shared/constants';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { FieldMetadataType } from '~/generated-metadata/graphql';export const FilesFieldInput = () => {@@ -27,7 +27,7 @@ export const FilesFieldInput = () => {const { openFileUpload } = useFileUpload();const { t } = useLingui();const [isUploading, setIsUploading] = useState(false);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const setFilePreview = useSetAtomState(filePreviewState);const isAttachmentPreviewEnabled = useAtomStateValue(isAttachmentPreviewEnabledState,@@ -85,8 +85,9 @@ export const FilesFieldInput = () => {selectedFiles.length > maxNumberOfValues - files.length &&files.length > 0) {- enqueueErrorSnackBar({- message: t`Cannot upload more than ${maxNumberOfValues} files`,+ enqueueToast({+ variant: 'error',+ children: t`Cannot upload more than ${maxNumberOfValues} files`,});return;}@@ -115,7 +116,7 @@ export const FilesFieldInput = () => {openFileUpload,files,maxNumberOfValues,- enqueueErrorSnackBar,+ enqueueToast,t,uploadFile,handleChange,diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/CurrencyFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/CurrencyFieldInput.stories.tsxindex 46cee908fa9..5f0b9e14ca5 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/CurrencyFieldInput.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/CurrencyFieldInput.stories.tsx@@ -8,7 +8,7 @@ import { expect, userEvent, waitFor, within } from 'storybook/test';import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';import { FieldMetadataType } from '~/generated-metadata/graphql';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { NumberFormat } from '@/localization/constants/NumberFormat';import { workspaceMemberFormatPreferencesState } from '@/localization/states/workspaceMemberFormatPreferencesState';@@ -20,8 +20,8 @@ import { getFieldInputEventContextProviderWithJestMocks } from '@/object-record/import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/ui/states/contexts/RecordFieldComponentInstanceContext';import { RECORD_TABLE_CELL_INPUT_ID_PREFIX } from '@/object-record/record-table/constants/RecordTableCellInputIdPrefix';import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';-import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';+import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { CurrencyCode } from 'twenty-shared/constants';import { StorybookFieldInputDropdownFocusIdSetterEffect } from '~/testing/components/StorybookFieldInputDropdownFocusIdSetterEffect';@@ -158,7 +158,7 @@ const meta: Meta = {amountMicros: AMOUNT_MICROS_WITH_CENTS,numberFormat: NumberFormat.DOTS_AND_COMMA,},- decorators: [clearMocksDecorator, SnackBarDecorator],+ decorators: [clearMocksDecorator, ToastDecorator],parameters: {clearMocks: true,},diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/EmailsFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/EmailsFieldInput.stories.tsxindex da70fdb859c..f7af1e48913 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/EmailsFieldInput.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/EmailsFieldInput.stories.tsx@@ -4,8 +4,8 @@ import { expect, fn, userEvent, within } from 'storybook/test';import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext';import { useEmailsField } from '@/object-record/record-field/ui/meta-types/hooks/useEmailsField';-import { getFieldInputEventContextProviderWithJestMocks } from '@/object-record/record-field/ui/meta-types/input/components/__stories__/utils/getFieldInputEventContextProviderWithJestMocks';import { EmailsFieldInput } from '@/object-record/record-field/ui/meta-types/input/components/EmailsFieldInput';+import { getFieldInputEventContextProviderWithJestMocks } from '@/object-record/record-field/ui/meta-types/input/components/__stories__/utils/getFieldInputEventContextProviderWithJestMocks';import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/ui/states/contexts/RecordFieldComponentInstanceContext';import { type FieldEmailsValue } from '@/object-record/record-field/ui/types/FieldMetadata';import { RECORD_TABLE_CELL_INPUT_ID_PREFIX } from '@/object-record/record-table/constants/RecordTableCellInputIdPrefix';@@ -13,7 +13,7 @@ import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFiimport { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';import { FieldMetadataType } from '~/generated-metadata/graphql';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const updateRecord = fn();@@ -100,7 +100,7 @@ const EmailInputWithContext = ({const meta: Meta<typeof EmailInputWithContext> = {title: 'UI/Input/EmailsFieldInput',component: EmailInputWithContext,- decorators: [SnackBarDecorator],+ decorators: [ToastDecorator],};export default meta;diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/NumberFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/NumberFieldInput.stories.tsxindex 06bd4cf39cc..1d5224cfd30 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/NumberFieldInput.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/NumberFieldInput.stories.tsx@@ -8,13 +8,13 @@ import { expect, userEvent, waitFor, within } from 'storybook/test';import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';import { FieldMetadataType } from '~/generated-metadata/graphql';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { RecordFieldsScopeContextProvider } from '@/object-record/record-field-list/contexts/RecordFieldsScopeContext';import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext';import { useNumberField } from '@/object-record/record-field/ui/meta-types/hooks/useNumberField';-import { getFieldInputEventContextProviderWithJestMocks } from '@/object-record/record-field/ui/meta-types/input/components/__stories__/utils/getFieldInputEventContextProviderWithJestMocks';import { NumberFieldInput } from '@/object-record/record-field/ui/meta-types/input/components/NumberFieldInput';+import { getFieldInputEventContextProviderWithJestMocks } from '@/object-record/record-field/ui/meta-types/input/components/__stories__/utils/getFieldInputEventContextProviderWithJestMocks';import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/ui/states/contexts/RecordFieldComponentInstanceContext';import { RECORD_TABLE_CELL_INPUT_ID_PREFIX } from '@/object-record/record-table/constants/RecordTableCellInputIdPrefix';import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';@@ -146,7 +146,7 @@ const meta: Meta = {onTab: { control: false },onShiftTab: { control: false },},- decorators: [clearMocksDecorator, SnackBarDecorator],+ decorators: [clearMocksDecorator, ToastDecorator],parameters: {clearMocks: true,},diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/RelationManyToOneFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/RelationManyToOneFieldInput.stories.tsxindex b103b77337a..c6d28aecaa1 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/RelationManyToOneFieldInput.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/RelationManyToOneFieldInput.stories.tsx@@ -9,28 +9,28 @@ import { expect, userEvent, waitFor, within } from 'storybook/test';import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';import {mockCurrentWorkspace,mockedWorkspaceMemberData,} from '~/testing/mock-data/users';-import { CoreObjectNameSingular, FieldMetadataType } from 'twenty-shared/types';import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext';import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/ui/states/contexts/RecordFieldComponentInstanceContext';import { recordFieldInputLayoutDirectionLoadingComponentState } from '@/object-record/record-field/ui/states/recordFieldInputLayoutDirectionLoadingComponentState';import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';-import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';+import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';+import { CoreObjectNameSingular, FieldMetadataType } from 'twenty-shared/types';import { RelationManyToOneFieldInput } from '@/object-record/record-field/ui/meta-types/input/components/RelationManyToOneFieldInput';+import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';import { mockedCompanyRecords } from '~/testing/mock-data/generated/data/companies/mock-companies-data';import { getMockFieldMetadataItemOrThrow } from '~/testing/utils/getMockFieldMetadataItemOrThrow';import { getMockObjectMetadataItemOrThrow } from '~/testing/utils/getMockObjectMetadataItemOrThrow';import { getFieldInputEventContextProviderWithJestMocks } from './utils/getFieldInputEventContextProviderWithJestMocks';-import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';const personMetadata = getMockObjectMetadataItemOrThrow('person');const companyMetadata = getMockObjectMetadataItemOrThrow('company');@@ -149,7 +149,7 @@ const meta: Meta = {MemoryRouterDecorator,clearMocksDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,],parameters: {clearMocks: true,diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/RelationOneToManyFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/RelationOneToManyFieldInput.stories.tsxindex e858af79f7e..6c1e83f20a4 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/RelationOneToManyFieldInput.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/RelationOneToManyFieldInput.stories.tsx@@ -1,6 +1,6 @@import { type Meta, type StoryObj } from '@storybook/react-vite';-import { useEffect, useMemo } from 'react';import { useSetAtom } from 'jotai';+import { useEffect, useMemo } from 'react';import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';@@ -8,24 +8,24 @@ import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushimport { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { FileUploadDecorator } from '~/testing/decorators/FileUploadDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';import {mockCurrentWorkspace,mockedWorkspaceMemberData,} from '~/testing/mock-data/users';-import { CoreObjectNameSingular, FieldMetadataType } from 'twenty-shared/types';import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext';import { useOpenFieldInputEditMode } from '@/object-record/record-field/ui/hooks/useOpenFieldInputEditMode';import { RelationOneToManyFieldInput } from '@/object-record/record-field/ui/meta-types/input/components/RelationOneToManyFieldInput';import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/ui/states/contexts/RecordFieldComponentInstanceContext';import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector';import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';+import { CoreObjectNameSingular, FieldMetadataType } from 'twenty-shared/types';import { RelationType } from '~/generated-metadata/graphql';+import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';import { getMockFieldMetadataItemOrThrow } from '~/testing/utils/getMockFieldMetadataItemOrThrow';import { getMockObjectMetadataItemOrThrow } from '~/testing/utils/getMockObjectMetadataItemOrThrow';-import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';const personMetadata = getMockObjectMetadataItemOrThrow('person');const companyMetadata = getMockObjectMetadataItemOrThrow('company');@@ -128,7 +128,7 @@ const meta: Meta = {decorators: [MemoryRouterDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,FileUploadDecorator,],parameters: {diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/RichTextFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/RichTextFieldInput.stories.tsxindex d1940f7f507..b4d1afc53c0 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/RichTextFieldInput.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/RichTextFieldInput.stories.tsx@@ -15,7 +15,7 @@ import {} from '@storybook/react-vite';import { FieldMetadataType } from '~/generated-metadata/graphql';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { getFieldInputEventContextProviderWithJestMocks } from './utils/getFieldInputEventContextProviderWithJestMocks';const targetableObjectId = 'test-id';@@ -99,7 +99,7 @@ const meta: Meta = {},decorators: [clearMocksDecorator,- SnackBarDecorator,+ ToastDecorator,ObjectMetadataItemsDecorator,],parameters: {diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/TextFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/TextFieldInput.stories.tsxindex 7dce8e6382f..221831fbffb 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/TextFieldInput.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/TextFieldInput.stories.tsx@@ -5,8 +5,8 @@ import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushimport { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext';import { useTextField } from '@/object-record/record-field/ui/meta-types/hooks/useTextField';-import { getFieldInputEventContextProviderWithJestMocks } from '@/object-record/record-field/ui/meta-types/input/components/__stories__/utils/getFieldInputEventContextProviderWithJestMocks';import { TextFieldInput } from '@/object-record/record-field/ui/meta-types/input/components/TextFieldInput';+import { getFieldInputEventContextProviderWithJestMocks } from '@/object-record/record-field/ui/meta-types/input/components/__stories__/utils/getFieldInputEventContextProviderWithJestMocks';import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/ui/states/contexts/RecordFieldComponentInstanceContext';import { RECORD_TABLE_CELL_INPUT_ID_PREFIX } from '@/object-record/record-table/constants/RecordTableCellInputIdPrefix';import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';@@ -17,7 +17,7 @@ import {type StoryObj,} from '@storybook/react-vite';import { FieldMetadataType } from '~/generated-metadata/graphql';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const TextFieldValueSetterEffect = ({ value }: { value: string }) => {const { setFieldValue } = useTextField();@@ -134,7 +134,7 @@ const meta: Meta = {onTab: { control: false },onShiftTab: { control: false },},- decorators: [clearMocksDecorator, SnackBarDecorator],+ decorators: [clearMocksDecorator, ToastDecorator],parameters: {clearMocks: true,},diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/hooks/useOpenFilesFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/hooks/useOpenFilesFieldInput.tsxindex 89b96433a09..1aeac3234dc 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/hooks/useOpenFilesFieldInput.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/hooks/useOpenFilesFieldInput.tsx@@ -5,20 +5,20 @@ import { filesFieldUploadState } from '@/object-record/record-field/ui/states/fiimport { type FieldFilesValue } from '@/object-record/record-field/ui/types/FieldMetadata';import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector';import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';-import { useStore } from 'jotai';import { useLingui } from '@lingui/react/macro';+import { useStore } from 'jotai';import { useCallback } from 'react';import { MULTI_ITEM_FIELD_DEFAULT_MAX_VALUES } from 'twenty-shared/constants';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';export const useOpenFilesFieldInput = () => {const { openFileUpload } = useFileUpload();const { uploadFile } = useUploadFilesFieldFile();const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { t } = useLingui();const store = useStore();@@ -88,8 +88,9 @@ export const useOpenFilesFieldInput = () => {multiple: true,onUpload: async (selectedFiles: File[]) => {if (selectedFiles.length + currentFileCount > maxNumberOfValues) {- enqueueErrorSnackBar({- message: t`Cannot upload more than ${maxNumberOfValues} files`,+ enqueueToast({+ variant: 'error',+ children: t`Cannot upload more than ${maxNumberOfValues} files`,});store.set(@@ -141,7 +142,7 @@ export const useOpenFilesFieldInput = () => {openFileUpload,uploadFile,pushFocusItemToFocusStack,- enqueueErrorSnackBar,+ enqueueToast,t,store,],diff --git a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/__stories__/RecordInlineCellDisplayMode.stories.tsx b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/__stories__/RecordInlineCellDisplayMode.stories.tsxindex c99fa6d87fa..6ef1194af79 100644--- a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/__stories__/RecordInlineCellDisplayMode.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/__stories__/RecordInlineCellDisplayMode.stories.tsx@@ -14,7 +14,7 @@ import { RecordInlineCellDisplayMode } from '@/object-record/record-inline-cell/import { IconPencil } from 'twenty-ui/icon';import { ComponentDecorator } from 'twenty-ui/testing';import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { getFieldDecorator } from '~/testing/decorators/getFieldDecorator';const getInlineCellContextDecorator =@@ -47,7 +47,7 @@ const meta: Meta<typeof RecordInlineCellDisplayMode> = {}),getInlineCellContextDecorator({}),ComponentDecorator,- SnackBarDecorator,+ ToastDecorator,],args: {isHovered: true,diff --git a/packages/twenty-front/src/modules/object-record/record-list/components/RecordListAddNew.tsx b/packages/twenty-front/src/modules/object-record/record-list/components/RecordListAddNew.tsxindex 87df7a6a4f4..c548e6f7799 100644--- a/packages/twenty-front/src/modules/object-record/record-list/components/RecordListAddNew.tsx+++ b/packages/twenty-front/src/modules/object-record/record-list/components/RecordListAddNew.tsx@@ -6,13 +6,13 @@ import { recordIndexGroupFieldMetadataItemComponentState } from '@/object-recordimport { useRecordListContextOrThrow } from '@/object-record/record-list/contexts/RecordListContext';import { useCreateNewIndexRecord } from '@/object-record/record-table/hooks/useCreateNewIndexRecord';import { canCreateRecordsForObjectMetadataItem } from '@/object-record/utils/canCreateRecordsForObjectMetadataItem';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { useContext } from 'react';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { IconPlus } from 'twenty-ui/icon';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import { logError } from '~/utils/logError';@@ -39,7 +39,7 @@ const StyledAddNewRow = styled.button`export const RecordListAddNew = () => {const { theme } = useContext(ThemeContext);const { objectMetadataItem } = useRecordListContextOrThrow();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { createNewIndexRecord } = useCreateNewIndexRecord({objectMetadataItem,@@ -93,7 +93,7 @@ export const RecordListAddNew = () => {});} catch (error) {logError(error);- enqueueErrorSnackBar({ message: t`Failed to create record` });+ enqueueToast({ variant: 'error', children: t`Failed to create record` });}};diff --git a/packages/twenty-front/src/modules/object-record/record-list/components/__stories__/RecordListRow.stories.tsx b/packages/twenty-front/src/modules/object-record/record-list/components/__stories__/RecordListRow.stories.tsxindex d6cda62892b..b139d5f1f9c 100644--- a/packages/twenty-front/src/modules/object-record/record-list/components/__stories__/RecordListRow.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-list/components/__stories__/RecordListRow.stories.tsx@@ -11,7 +11,7 @@ import { FileUploadDecorator } from '~/testing/decorators/FileUploadDecorator';import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';import { RecordTableDecorator } from '~/testing/decorators/RecordTableDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';import { mockedCompanyRecords } from '~/testing/mock-data/generated/data/companies/mock-companies-data';@@ -46,7 +46,7 @@ const meta: Meta<typeof RecordListRowStory> = {FileUploadDecorator,RecordTableDecorator,ContextStoreDecorator,- SnackBarDecorator,+ ToastDecorator,ObjectMetadataItemsDecorator,],parameters: {diff --git a/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsActions.ts b/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsActions.tsindex 8cd1f774cf5..68407f7e3cf 100644--- a/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsActions.ts+++ b/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsActions.ts@@ -1,15 +1,15 @@import { useLingui } from '@lingui/react/macro';-import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu';import { useMergeManyRecords } from '@/object-record/hooks/useMergeManyRecords';import { useMergeRecordsSelectedRecords } from '@/object-record/record-merge/hooks/useMergeRecordsSelectedRecords';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { AppPath } from 'twenty-shared/types';-import { useNavigateApp } from '~/hooks/useNavigateApp';import { isMergeInProgressState } from '@/object-record/record-merge/states/mergeInProgressState';import { mergeSettingsState } from '@/object-record/record-merge/states/mergeSettingsState';-import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';+import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';+import { AppPath } from 'twenty-shared/types';+import { useToast } from 'twenty-ui/primitives/feedback';+import { useNavigateApp } from '~/hooks/useNavigateApp';type UseMergeRecordsActionsProps = {objectNameSingular: string;@@ -29,7 +29,7 @@ export const useMergeRecordsActions = ({const setIsMergeInProgress = useSetAtomState(isMergeInProgressState);const { t } = useLingui();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { closeSidePanelMenu } = useSidePanelMenu();const navigate = useNavigateApp();@@ -48,8 +48,9 @@ export const useMergeRecordsActions = ({const recordCount = selectedRecords.length;- enqueueSuccessSnackBar({- message: t`Successfully merged ${recordCount} records`,+ enqueueToast({+ variant: 'success',+ children: t`Successfully merged ${recordCount} records`,});closeSidePanelMenu();@@ -58,8 +59,9 @@ export const useMergeRecordsActions = ({objectRecordId: mergedRecord.id,});} catch (error) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:error instanceof Error? error.message: t`Failed to merge records. Please try again.`,diff --git a/packages/twenty-front/src/modules/object-record/record-merge/hooks/usePerformMergePreview.ts b/packages/twenty-front/src/modules/object-record/record-merge/hooks/usePerformMergePreview.tsindex 48bb914f9db..370794f0f82 100644--- a/packages/twenty-front/src/modules/object-record/record-merge/hooks/usePerformMergePreview.ts+++ b/packages/twenty-front/src/modules/object-record/record-merge/hooks/usePerformMergePreview.ts@@ -1,3 +1,4 @@+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { getRecordFromRecordNode } from '@/object-record/cache/utils/getRecordFromRecordNode';import { useMergeManyRecords } from '@/object-record/hooks/useMergeManyRecords';import { useMergeRecordsSelectedRecords } from '@/object-record/record-merge/hooks/useMergeRecordsSelectedRecords';@@ -5,10 +6,9 @@ import { isMergeInProgressState } from '@/object-record/record-merge/states/mergimport { mergeSettingsState } from '@/object-record/record-merge/states/mergeSettingsState';import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';import { type ObjectRecord } from '@/object-record/types/ObjectRecord';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { type ErrorLike } from '@apollo/client';import { useEffect, useState } from 'react';+import { useToast } from 'twenty-ui/primitives/feedback';type UseMergePreviewProps = {objectNameSingular: string;@@ -32,7 +32,7 @@ export const usePerformMergePreview = ({const { selectedRecords } = useMergeRecordsSelectedRecords();const { upsertRecordsInStore } = useUpsertRecordsInStore();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();useEffect(() => {const fetchPreview = async () => {@@ -65,9 +65,7 @@ export const usePerformMergePreview = ({upsertRecordsInStore({ partialRecords: [transformPreviewRecord] });} catch (error) {setMergePreviewRecord(null);- enqueueErrorSnackBar({- apolloError: error as ErrorLike,- });+ enqueueToast(getToastOptionsFromError({ error }));} finally {setIsGeneratingPreview(false);setIsInitialized(true);@@ -85,7 +83,7 @@ export const usePerformMergePreview = ({mergeManyRecords,upsertRecordsInStore,isInitialized,- enqueueErrorSnackBar,+ enqueueToast,]);return {diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPicker.tsx b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPicker.tsxindex 00056e0a6a8..4dcf253674a 100644--- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPicker.tsx+++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPicker.tsx@@ -1,9 +1,7 @@+import { type SingleRecordPickerMenuItemsWithSearchProps } from '@/object-record/record-picker/single-record-picker/types/SingleRecordPickerMenuItemsWithSearchProps';import { useRef } from 'react';-import {- SingleRecordPickerMenuItemsWithSearch,- type SingleRecordPickerMenuItemsWithSearchProps,-} from '@/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItemsWithSearch';+import { SingleRecordPickerMenuItemsWithSearch } from '@/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItemsWithSearch';import { SingleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/single-record-picker/states/contexts/SingleRecordPickerComponentInstanceContext';import { singleRecordPickerSearchFilterComponentState } from '@/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchFilterComponentState';import { type RecordPickerPickableMorphItem } from '@/object-record/record-picker/types/RecordPickerPickableMorphItem';diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItemsWithSearch.tsx b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItemsWithSearch.tsxindex b72fdc7ae8a..894468dea33 100644--- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItemsWithSearch.tsx+++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItemsWithSearch.tsx@@ -1,15 +1,13 @@+import { type SingleRecordPickerMenuItemsWithSearchProps } from '@/object-record/record-picker/single-record-picker/types/SingleRecordPickerMenuItemsWithSearchProps';+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems';import { useObjectPermissions } from '@/object-record/hooks/useObjectPermissions';import { SingleRecordPickerLoadingEffect } from '@/object-record/record-picker/single-record-picker/components/SingleRecordPickerLoadingEffect';-import {- SingleRecordPickerMenuItems,- type SingleRecordPickerMenuItemsProps,-} from '@/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItems';+import { SingleRecordPickerMenuItems } from '@/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItems';import { useSingleRecordPickerRecords } from '@/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerRecords';import { useSingleRecordPickerSearch } from '@/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerSearch';import { SingleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/single-record-picker/states/contexts/SingleRecordPickerComponentInstanceContext';import { singleRecordPickerSearchFilterComponentState } from '@/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchFilterComponentState';-import { type RecordPickerLayoutDirection } from '@/object-record/record-picker/types/RecordPickerLayoutDirection';import { canCreateRecordsForObjectMetadataItem } from '@/object-record/utils/canCreateRecordsForObjectMetadataItem';import { CreateNewButton } from '@/ui/input/relation-picker/components/CreateNewButton';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';@@ -21,18 +19,6 @@ import { isDefined } from 'twenty-shared/utils';import { t } from '@lingui/core/macro';import { IconPlus } from 'twenty-ui/icon';-export type SingleRecordPickerMenuItemsWithSearchProps = {- excludedRecordIds?: string[];- onCreate?: ((searchInput?: string) => void) | (() => void);- objectNameSingulars: string[];- recordPickerInstanceId?: string;- layoutDirection?: RecordPickerLayoutDirection;- focusId: string;-} & Pick<- SingleRecordPickerMenuItemsProps,- 'EmptyIcon' | 'emptyLabel' | 'onCancel' | 'onMorphItemSelected'->;-export const SingleRecordPickerMenuItemsWithSearch = ({EmptyIcon,emptyLabel,@@ -55,7 +41,13 @@ export const SingleRecordPickerMenuItemsWithSearch = ({recordPickerInstanceId,);- const { pickableMorphItems, loading } = useSingleRecordPickerRecords({+ const {+ pickableMorphItems,+ loading,+ selectedRecordsError,+ filteredSelectedRecordsError,+ recordsToSelectError,+ } = useSingleRecordPickerRecords({objectNameSingulars,excludedRecordIds,});@@ -88,6 +80,10 @@ export const SingleRecordPickerMenuItemsWithSearch = ({return (<>+ <ToastOnQueryErrorEffect error={selectedRecordsError} />+ <ToastOnQueryErrorEffect error={filteredSelectedRecordsError} />+ <ToastOnQueryErrorEffect error={recordsToSelectError} />+<SingleRecordPickerLoadingEffect loading={loading} />{layoutDirection === 'search-bar-on-bottom' && (<>diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/__stories__/SingleRecordPicker.stories.tsx b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/__stories__/SingleRecordPicker.stories.tsxindex 8f3622b1795..2c8ff9df5c9 100644--- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/__stories__/SingleRecordPicker.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/__stories__/SingleRecordPicker.stories.tsx@@ -3,7 +3,7 @@ import { expect, userEvent, within } from 'storybook/test';import { CoreObjectNameSingular } from 'twenty-shared/types';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';import { sleep } from '~/utils/sleep';@@ -36,7 +36,7 @@ const meta: Meta<typeof SingleRecordPicker> = {decorators: [ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,],args: {objectNameSingulars: [CoreObjectNameSingular.WorkspaceMember],diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerPerformSearch.ts b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerPerformSearch.tsindex acc51f501e5..a02c86ceb3f 100644--- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerPerformSearch.ts+++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerPerformSearch.ts@@ -1,3 +1,4 @@+import { type ErrorLike } from '@apollo/client';import { useEffect, useMemo } from 'react';import { useStore } from 'jotai';@@ -28,6 +29,9 @@ export const useSingleRecordPickerPerformSearch = ({}): {pickableMorphItems: RecordPickerPickableMorphItem[];loading: boolean;+ selectedRecordsError: ErrorLike | undefined;+ filteredSelectedRecordsError: ErrorLike | undefined;+ recordsToSelectError: ErrorLike | undefined;} => {const store = useStore();const singleRecordPickerInstanceId = useAvailableComponentInstanceIdOrThrow(@@ -61,17 +65,21 @@ export const useSingleRecordPickerPerformSearch = ({? { id: { in: selectedIds } }: undefined;- const { loading: selectedRecordsLoading, searchRecords: selectedRecords } =- useObjectRecordSearchRecords({- objectNameSingulars: readableObjectNameSingulars,- filter: selectedIdsFilter,- skip: !hasSelectedIds,- searchInput: '',- });+ const {+ loading: selectedRecordsLoading,+ searchRecords: selectedRecords,+ error: selectedRecordsError,+ } = useObjectRecordSearchRecords({+ objectNameSingulars: readableObjectNameSingulars,+ filter: selectedIdsFilter,+ skip: !hasSelectedIds,+ searchInput: '',+ });const {loading: filteredSelectedRecordsLoading,searchRecords: filteredSelectedRecords,+ error: filteredSelectedRecordsError,} = useObjectRecordSearchRecords({objectNameSingulars: readableObjectNameSingulars,filter: selectedIdsFilter,@@ -83,14 +91,17 @@ export const useSingleRecordPickerPerformSearch = ({const notFilter = notFilterIds.length? { not: { id: { in: notFilterIds } } }: undefined;- const { loading: recordsToSelectLoading, searchRecords: recordsToSelect } =- useObjectRecordSearchRecords({- objectNameSingulars: readableObjectNameSingulars,- filter: notFilter,- limit: limit ?? DEFAULT_SEARCH_REQUEST_LIMIT,- searchInput: searchFilter,- fetchPolicy: 'cache-and-network',- });+ const {+ loading: recordsToSelectLoading,+ searchRecords: recordsToSelect,+ error: recordsToSelectError,+ } = useObjectRecordSearchRecords({+ objectNameSingulars: readableObjectNameSingulars,+ filter: notFilter,+ limit: limit ?? DEFAULT_SEARCH_REQUEST_LIMIT,+ searchInput: searchFilter,+ fetchPolicy: 'cache-and-network',+ });const allSearchRecords = useMemo(() => [...selectedRecords, ...filteredSelectedRecords, ...recordsToSelect],@@ -160,6 +171,9 @@ export const useSingleRecordPickerPerformSearch = ({});return {+ selectedRecordsError,+ filteredSelectedRecordsError,+ recordsToSelectError,pickableMorphItems,loading:recordsToSelectLoading ||diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerRecords.ts b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerRecords.tsindex 84aa619efae..c5bb35a48e7 100644--- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerRecords.ts+++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerRecords.ts@@ -17,7 +17,7 @@ export const useSingleRecordPickerRecords = ({const singleRecordPickerSelectedId = useAtomComponentStateValue(singleRecordPickerSelectedIdComponentState,);- const { pickableMorphItems, loading } = useSingleRecordPickerPerformSearch({+ return useSingleRecordPickerPerformSearch({searchFilter: singleRecordPickerSearchFilter,selectedIds: singleRecordPickerSelectedId? [singleRecordPickerSelectedId]@@ -25,6 +25,4 @@ export const useSingleRecordPickerRecords = ({excludedRecordIds: excludedRecordIds,objectNameSingulars,});-- return { pickableMorphItems, loading };};diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/types/SingleRecordPickerMenuItemsWithSearchProps.ts b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/types/SingleRecordPickerMenuItemsWithSearchProps.tsnew file mode 100644index 00000000000..d81ad1b18bb--- /dev/null+++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/types/SingleRecordPickerMenuItemsWithSearchProps.ts@@ -0,0 +1,14 @@+import { type SingleRecordPickerMenuItemsProps } from '@/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItems';+import { type RecordPickerLayoutDirection } from '@/object-record/record-picker/types/RecordPickerLayoutDirection';++export type SingleRecordPickerMenuItemsWithSearchProps = {+ excludedRecordIds?: string[];+ onCreate?: ((searchInput?: string) => void) | (() => void);+ objectNameSingulars: string[];+ recordPickerInstanceId?: string;+ layoutDirection?: RecordPickerLayoutDirection;+ focusId: string;+} & Pick<+ SingleRecordPickerMenuItemsProps,+ 'EmptyIcon' | 'emptyLabel' | 'onCancel' | 'onMorphItemSelected'+>;diff --git a/packages/twenty-front/src/modules/object-record/record-table-widget/components/RecordTableWidgetJunctionAddNewRow.tsx b/packages/twenty-front/src/modules/object-record/record-table-widget/components/RecordTableWidgetJunctionAddNewRow.tsxindex 4d5a3656fdb..f301c66e505 100644--- a/packages/twenty-front/src/modules/object-record/record-table-widget/components/RecordTableWidgetJunctionAddNewRow.tsx+++ b/packages/twenty-front/src/modules/object-record/record-table-widget/components/RecordTableWidgetJunctionAddNewRow.tsx@@ -1,15 +1,15 @@import { useObjectMetadataItemById } from '@/object-metadata/hooks/useObjectMetadataItemById';import { useObjectPermissionsForObject } from '@/object-record/hooks/useObjectPermissionsForObject';import { isObjectMetadataReadOnly } from '@/object-record/read-only/utils/isObjectMetadataReadOnly';-import { RecordTableActionRow } from '@/object-record/record-table/record-table-row/components/RecordTableActionRow';import { RecordTableWidgetRelationPickerDropdownContent } from '@/object-record/record-table-widget/components/RecordTableWidgetRelationPickerDropdownContent';import { type RecordTableWidgetJunctionCreateThrough } from '@/object-record/record-table-widget/contexts/RecordTableWidgetContext';import { useCreateJunctionRecordFromTableWidget } from '@/object-record/record-table-widget/hooks/useCreateJunctionRecordFromTableWidget';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { RecordTableActionRow } from '@/object-record/record-table/record-table-row/components/RecordTableActionRow';import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';import { t } from '@lingui/core/macro';import { type RecordGqlOperationFilter } from 'twenty-shared/types';+import { useToast } from 'twenty-ui/primitives/feedback';import { IconPlus } from 'twenty-ui/icon';import { logError } from '~/utils/logError';@@ -25,7 +25,7 @@ export const RecordTableWidgetJunctionAddNewRow = ({targetRecordsFilter = junctionCreateThrough.targetRecordsFilter,}: RecordTableWidgetJunctionAddNewRowProps) => {const { closeDropdown } = useCloseDropdown();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { objectMetadataItem: junctionObjectMetadataItem } =useObjectMetadataItemById({@@ -55,7 +55,7 @@ export const RecordTableWidgetJunctionAddNewRow = ({closeDropdown(dropdownId);createJunctionRecord(targetRecordId).catch((error) => {logError(error);- enqueueErrorSnackBar({ message: t`Failed to add record` });+ enqueueToast({ variant: 'error', children: t`Failed to add record` });});};diff --git a/packages/twenty-front/src/modules/object-record/record-table/__stories__/RecordTable.stories.tsx b/packages/twenty-front/src/modules/object-record/record-table/__stories__/RecordTable.stories.tsxindex ec4f3470c18..513d7667db2 100644--- a/packages/twenty-front/src/modules/object-record/record-table/__stories__/RecordTable.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-table/__stories__/RecordTable.stories.tsx@@ -8,7 +8,7 @@ import { FileUploadDecorator } from '~/testing/decorators/FileUploadDecorator';import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';import { RecordTableDecorator } from '~/testing/decorators/RecordTableDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';import { mockedCompanyRecords } from '~/testing/mock-data/generated/data/companies/mock-companies-data';import { mockedViews } from '~/testing/mock-data/generated/metadata/views/mock-views-data';@@ -25,7 +25,7 @@ const meta: Meta = {FileUploadDecorator,RecordTableDecorator,ContextStoreDecorator,- SnackBarDecorator,+ ToastDecorator,ObjectMetadataItemsDecorator,],args: {diff --git a/packages/twenty-front/src/modules/object-record/record-update-multiple/components/UpdateMultipleRecordsContainer.tsx b/packages/twenty-front/src/modules/object-record/record-update-multiple/components/UpdateMultipleRecordsContainer.tsxindex 37ed6391dbf..3c406a83bb5 100644--- a/packages/twenty-front/src/modules/object-record/record-update-multiple/components/UpdateMultipleRecordsContainer.tsx+++ b/packages/twenty-front/src/modules/object-record/record-update-multiple/components/UpdateMultipleRecordsContainer.tsx@@ -1,9 +1,8 @@import { contextStoreNumberOfSelectedRecordsComponentState } from '@/context-store/states/contextStoreNumberOfSelectedRecordsComponentState';-import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu';import { UpdateMultipleRecordsFooter } from '@/object-record/record-update-multiple/components/UpdateMultipleRecordsFooter';import { UpdateMultipleRecordsForm } from '@/object-record/record-update-multiple/components/UpdateMultipleRecordsForm';import { useUpdateMultipleRecordsActions } from '@/object-record/record-update-multiple/hooks/useUpdateMultipleRecordsActions';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';import { ShowPageContainer } from '@/ui/layout/page/components/ShowPageContainer';@@ -12,6 +11,7 @@ import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useimport { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { useState } from 'react';+import { useToast } from 'twenty-ui/primitives/feedback';import { themeCssVariables } from 'twenty-ui/theme-constants';const UPDATE_MULTIPLE_RECORDS_CONFIRMATION_MODAL_ID =@@ -56,7 +56,7 @@ export const UpdateMultipleRecordsContainer = ({const hasSelectedRecords = contextStoreNumberOfSelectedRecords > 0;const { t } = useLingui();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { openModal } = useModal();const { closeSidePanelMenu } = useSidePanelMenu();@@ -73,8 +73,9 @@ export const UpdateMultipleRecordsContainer = ({await updateRecords(fieldUpdates);closeSidePanelMenu();} catch (error) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:error instanceof Error? error.message: t`Failed to update records. Please try again.`,diff --git a/packages/twenty-front/src/modules/object-record/record-update-multiple/components/__stories__/UpdateMultipleRecordsContainer.stories.tsx b/packages/twenty-front/src/modules/object-record/record-update-multiple/components/__stories__/UpdateMultipleRecordsContainer.stories.tsxindex 34ea043aced..04a55ea0117 100644--- a/packages/twenty-front/src/modules/object-record/record-update-multiple/components/__stories__/UpdateMultipleRecordsContainer.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-update-multiple/components/__stories__/UpdateMultipleRecordsContainer.stories.tsx@@ -17,10 +17,10 @@ import gql from 'graphql-tag';import { useEffect } from 'react';import { expect, userEvent, within } from 'storybook/test';import { ContextStoreDecorator } from '~/testing/decorators/ContextStoreDecorator';+import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';import { RootDecorator } from '~/testing/decorators/RootDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';-import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const UPDATE_MANY_COMPANIES_MUTATION = gql`mutation UpdateManyCompanies(@@ -93,7 +93,7 @@ const meta: Meta<typeof UpdateMultipleRecordsContainer> = {SelectedRecordsSeedDecorator,ContextStoreDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,RootDecorator,],args: {diff --git a/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useOpenObjectRecordsSpreadsheetImportDialog.ts b/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useOpenObjectRecordsSpreadsheetImportDialog.tsindex 4c9335075a1..4fe22de4f9b 100644--- a/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useOpenObjectRecordsSpreadsheetImportDialog.ts+++ b/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useOpenObjectRecordsSpreadsheetImportDialog.ts@@ -1,3 +1,4 @@+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';import { useGenerateDepthRecordGqlFieldsFromObject } from '@/object-record/graphql/record-gql-fields/hooks/useGenerateDepthRecordGqlFieldsFromObject';@@ -10,8 +11,8 @@ import { SPREADSHEET_IMPORT_CREATE_RECORDS_BATCH_SIZE } from '@/spreadsheet-impoimport { useOpenSpreadsheetImportDialog } from '@/spreadsheet-import/hooks/useOpenSpreadsheetImportDialog';import { spreadsheetImportCreatedRecordsProgressState } from '@/spreadsheet-import/states/spreadsheetImportCreatedRecordsProgressState';import { type SpreadsheetImportDialogOptions } from '@/spreadsheet-import/types';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';+import { useToast } from 'twenty-ui/primitives/feedback';export const useOpenObjectRecordsSpreadsheetImportDialog = (objectNameSingular: string,@@ -20,7 +21,7 @@ export const useOpenObjectRecordsSpreadsheetImportDialog = (const { openSpreadsheetImportDialog } = useOpenSpreadsheetImportDialog();const { buildSpreadsheetImportFields } = useBuildSpreadsheetImportFields();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { objectMetadataItem } = useObjectMetadataItem({objectNameSingular,@@ -86,9 +87,7 @@ export const useOpenObjectRecordsSpreadsheetImportDialog = (},});} catch (error: any) {- enqueueErrorSnackBar({- apolloError: error,- });+ enqueueToast(getToastOptionsFromError({ error }));}},spreadsheetImportFields,diff --git a/packages/twenty-front/src/modules/onboarding/components/BookCallOnboardingStepActions.tsx b/packages/twenty-front/src/modules/onboarding/components/BookCallOnboardingStepActions.tsxindex a52b6073bda..1dad8aae80b 100644--- a/packages/twenty-front/src/modules/onboarding/components/BookCallOnboardingStepActions.tsx+++ b/packages/twenty-front/src/modules/onboarding/components/BookCallOnboardingStepActions.tsx@@ -1,13 +1,13 @@-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useCallback, useState } from 'react';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { OnboardingSkipButton } from '@/onboarding/components/OnboardingSkipButton';import { BookCallBookingSuccessEffect } from '@/onboarding/effect-components/BookCallBookingSuccessEffect';import { useCompleteBookCallOnboardingStep } from '@/onboarding/hooks/useCompleteBookCallOnboardingStep';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useToast } from 'twenty-ui/primitives/feedback';export const BookCallOnboardingStepActions = () => {- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const completeBookCallOnboardingStep = useCompleteBookCallOnboardingStep();const [isCompleting, setIsCompleting] = useState(false);@@ -22,12 +22,10 @@ export const BookCallOnboardingStepActions = () => {} catch (error) {setIsCompleting(false);- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));}},- [completeBookCallOnboardingStep, enqueueErrorSnackBar],+ [completeBookCallOnboardingStep, enqueueToast],);const completeStepAfterBooking = useCallback(() => {diff --git a/packages/twenty-front/src/modules/onboarding/components/OnboardingProfilePictureUploader.tsx b/packages/twenty-front/src/modules/onboarding/components/OnboardingProfilePictureUploader.tsxindex 1eb571e774f..32dcabc28d1 100644--- a/packages/twenty-front/src/modules/onboarding/components/OnboardingProfilePictureUploader.tsx+++ b/packages/twenty-front/src/modules/onboarding/components/OnboardingProfilePictureUploader.tsx@@ -1,6 +1,5 @@import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';import { useUpdateWorkspaceMemberSettings } from '@/settings/profile/hooks/useUpdateWorkspaceMemberSettings';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { useMutation } from '@apollo/client/react';@@ -10,6 +9,7 @@ import { isNonEmptyString } from '@sniptt/guards';import { useRef } from 'react';import { FileFolder } from 'twenty-shared/types';import { getImageAbsoluteURI, isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { IconUserCircle } from 'twenty-ui/icon';import { themeCssVariables, useTheme } from 'twenty-ui/theme-constants';import { REACT_APP_SERVER_BASE_URL } from '~/config';@@ -52,7 +52,7 @@ export const OnboardingProfilePictureUploader = ({}: OnboardingProfilePictureUploaderProps) => {const { t } = useLingui();const theme = useTheme();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState);const setCurrentWorkspaceMember = useSetAtomState(currentWorkspaceMemberState,@@ -85,8 +85,9 @@ export const OnboardingProfilePictureUploader = ({: previous,);} catch (error) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:error instanceof Error ? error.message : t`Failed to upload picture`,});}diff --git a/packages/twenty-front/src/modules/onboarding/components/__tests__/BookCallOnboardingStepActions.test.tsx b/packages/twenty-front/src/modules/onboarding/components/__tests__/BookCallOnboardingStepActions.test.tsxindex d8ff2ce486a..d2b525f37d8 100644--- a/packages/twenty-front/src/modules/onboarding/components/__tests__/BookCallOnboardingStepActions.test.tsx+++ b/packages/twenty-front/src/modules/onboarding/components/__tests__/BookCallOnboardingStepActions.test.tsx@@ -7,7 +7,7 @@ import { dynamicActivate } from '~/utils/i18n/dynamicActivate';import { BookCallOnboardingStepActions } from '@/onboarding/components/BookCallOnboardingStepActions';const mockCompleteBookCallOnboardingStep = jest.fn();-const mockEnqueueErrorSnackBar = jest.fn();+const mockCalApi = jest.fn();jest.mock('@calcom/embed-react', () => ({@@ -18,8 +18,11 @@ jest.mock('@/onboarding/hooks/useCompleteBookCallOnboardingStep', () => ({useCompleteBookCallOnboardingStep: () => mockCompleteBookCallOnboardingStep,}));-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({ enqueueErrorSnackBar: mockEnqueueErrorSnackBar }),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));dynamicActivate(SOURCE_LOCALE);@@ -109,7 +112,9 @@ describe('BookCallOnboardingStepActions', () => {});expect(skipButton).not.toBeDisabled();- expect(mockEnqueueErrorSnackBar).toHaveBeenCalled();+ expect(mockEnqueueToast).toHaveBeenCalledWith(+ expect.objectContaining({ variant: 'error', children: 'network error' }),+ );});it('should complete the step once even when the embed emits repeatedly', async () => {diff --git a/packages/twenty-front/src/modules/onboarding/components/__tests__/OnboardingStepLayout.test.tsx b/packages/twenty-front/src/modules/onboarding/components/__tests__/OnboardingStepLayout.test.tsxindex 1f6bbbbb1c3..c863cdacf1f 100644--- a/packages/twenty-front/src/modules/onboarding/components/__tests__/OnboardingStepLayout.test.tsx+++ b/packages/twenty-front/src/modules/onboarding/components/__tests__/OnboardingStepLayout.test.tsx@@ -10,7 +10,7 @@ import { onboardingConfigState } from '@/client-config/states/onboardingConfigStimport { type OnboardingConfig } from '@/client-config/types/OnboardingConfig';import { OnboardingStepLayout } from '@/onboarding/components/OnboardingStepLayout';import { onboardingFreeCreditsState } from '@/onboarding/states/onboardingFreeCreditsState';-import { SnackBarComponentInstanceContext } from '@/ui/feedback/snack-bar-manager/contexts/SnackBarComponentInstanceContext';+import { ToastProvider } from 'twenty-ui/primitives/feedback';import {jotaiStore,resetJotaiStore,@@ -42,11 +42,9 @@ const onboardingConfig: OnboardingConfig = {const Wrapper = ({ children }: { children: ReactNode }) => (<MockedProvider mocks={[]}><JotaiProvider store={jotaiStore}>- <SnackBarComponentInstanceContext.Provider- value={{ instanceId: 'snack-bar-manager' }}- >+ <ToastProvider><I18nProvider i18n={i18n}>{children}</I18nProvider>- </SnackBarComponentInstanceContext.Provider>+ </ToastProvider></JotaiProvider></MockedProvider>);diff --git a/packages/twenty-front/src/modules/onboarding/hooks/__tests__/useGoBackToPreviousOnboardingStep.test.tsx b/packages/twenty-front/src/modules/onboarding/hooks/__tests__/useGoBackToPreviousOnboardingStep.test.tsxindex 708a21f2002..715bbeac374 100644--- a/packages/twenty-front/src/modules/onboarding/hooks/__tests__/useGoBackToPreviousOnboardingStep.test.tsx+++ b/packages/twenty-front/src/modules/onboarding/hooks/__tests__/useGoBackToPreviousOnboardingStep.test.tsx@@ -18,12 +18,11 @@ import {} from '~/generated-metadata/graphql';import { mockedUserData } from '~/testing/mock-data/users';-const mockEnqueueErrorSnackBar = jest.fn();+const mockEnqueueToast = jest.fn();-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({- enqueueErrorSnackBar: mockEnqueueErrorSnackBar,- }),+jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));const buildGoBackMock = ({@@ -57,7 +56,7 @@ const renderGoBackHook = (mocks: readonly MockedResponse[]) => {describe('useGoBackToPreviousOnboardingStep', () => {beforeEach(() => {- mockEnqueueErrorSnackBar.mockClear();+ jest.clearAllMocks();resetJotaiStore();localStorage.clear();jotaiStore.set(currentUserState.atom, {@@ -171,10 +170,10 @@ describe('useGoBackToPreviousOnboardingStep', () => {expect(jotaiStore.get(currentUserState.atom)?.onboardingStatus).toBe(OnboardingStatus.PROFILE_CREATION,);- expect(mockEnqueueErrorSnackBar).not.toHaveBeenCalled();+ expect(mockEnqueueToast).not.toHaveBeenCalled();});- it('should surface a snackbar when the failure is not a stale back target', async () => {+ it('should surface a toast when the failure is not a stale back target', async () => {const { result } = renderGoBackHook([{request: { query: GoBackToPreviousOnboardingStepDocument },@@ -186,6 +185,9 @@ describe('useGoBackToPreviousOnboardingStep', () => {await result.current.goBackToPreviousOnboardingStep();});- expect(mockEnqueueErrorSnackBar).toHaveBeenCalled();+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'An error occurred.',+ });});});diff --git a/packages/twenty-front/src/modules/onboarding/hooks/__tests__/useInviteTeam.test.ts b/packages/twenty-front/src/modules/onboarding/hooks/__tests__/useInviteTeam.test.tsindex 0736910f47d..2083abc1a47 100644--- a/packages/twenty-front/src/modules/onboarding/hooks/__tests__/useInviteTeam.test.ts+++ b/packages/twenty-front/src/modules/onboarding/hooks/__tests__/useInviteTeam.test.ts@@ -36,8 +36,11 @@ jest.mock('@apollo/client/react', () => ({useQuery: () => ({ data: undefined, loading: false }),}));-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({ enqueueSuccessSnackBar: jest.fn() }),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));jest.mock('@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement', () => ({diff --git a/packages/twenty-front/src/modules/onboarding/hooks/useGoBackToPreviousOnboardingStep.ts b/packages/twenty-front/src/modules/onboarding/hooks/useGoBackToPreviousOnboardingStep.tsindex 7e057bcaa0d..0c20f6301a5 100644--- a/packages/twenty-front/src/modules/onboarding/hooks/useGoBackToPreviousOnboardingStep.ts+++ b/packages/twenty-front/src/modules/onboarding/hooks/useGoBackToPreviousOnboardingStep.ts@@ -1,17 +1,20 @@import { currentUserState } from '@/auth/states/currentUserState';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { NO_PREVIOUS_ONBOARDING_STEP_ERROR_CODE } from '@/onboarding/constants/NoPreviousOnboardingStepErrorCode';import { onboardingNavigationDirectionState } from '@/onboarding/states/onboardingNavigationDirectionState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useMutation } from '@apollo/client/react';+import { useStore } from 'jotai';import { useCallback } from 'react';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';+import { GoBackToPreviousOnboardingStepDocument } from '~/generated-metadata/graphql';import { isGraphqlErrorOfType } from '~/utils/is-graphql-error-of-type.util';export const useGoBackToPreviousOnboardingStep = () => {const store = useStore();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [goBackToPreviousOnboardingStepMutation, { loading }] = useMutation(GoBackToPreviousOnboardingStepDocument,);@@ -54,11 +57,9 @@ export const useGoBackToPreviousOnboardingStep = () => {return;}- enqueueErrorSnackBar(- error instanceof Error ? { apolloError: error } : {},- );+ enqueueToast(getToastOptionsFromError({ error }));}- }, [goBackToPreviousOnboardingStepMutation, enqueueErrorSnackBar, store]);+ }, [goBackToPreviousOnboardingStepMutation, enqueueToast, store]);return {goBackToPreviousOnboardingStep,diff --git a/packages/twenty-front/src/modules/onboarding/hooks/useInviteTeam.ts b/packages/twenty-front/src/modules/onboarding/hooks/useInviteTeam.tsindex 6485da18c5d..682babf9e3b 100644--- a/packages/twenty-front/src/modules/onboarding/hooks/useInviteTeam.ts+++ b/packages/twenty-front/src/modules/onboarding/hooks/useInviteTeam.ts@@ -1,25 +1,25 @@-import { onboardingConfigState } from '@/client-config/states/onboardingConfigState';import { isBookCallOnboardingStepEnabledState } from '@/client-config/states/isBookCallOnboardingStepEnabledState';import { isCompanyEnrichmentEnabledState } from '@/client-config/states/isCompanyEnrichmentEnabledState';+import { onboardingConfigState } from '@/client-config/states/onboardingConfigState';import { useSetNextOnboardingStatus } from '@/onboarding/hooks/useSetNextOnboardingStatus';import { onboardingFreeCreditsState } from '@/onboarding/states/onboardingFreeCreditsState';import { waitForCompanyEnrichmentSettlement } from '@/onboarding/utils/waitForCompanyEnrichmentSettlement';import { PageFocusId } from '@/types/PageFocusId';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { useCreateWorkspaceInvitation } from '@/workspace-invitation/hooks/useCreateWorkspaceInvitation';+import { useQuery } from '@apollo/client/react';import { zodResolver } from '@hookform/resolvers/zod';import { useLingui } from '@lingui/react/macro';-import { useQuery } from '@apollo/client/react';import { useStore } from 'jotai';import { useCallback, useEffect, useMemo, useState } from 'react';import { type SubmitHandler, useFieldArray, useForm } from 'react-hook-form';import { Key } from 'ts-key-enum';import { isDefined } from 'twenty-shared/utils';-import { GetInviteSuggestionsDocument } from '~/generated-metadata/graphql';+import { useToast } from 'twenty-ui/primitives/feedback';import { z } from 'zod';+import { GetInviteSuggestionsDocument } from '~/generated-metadata/graphql';const validationSchema = z.object({emails: z.array(z.object({ email: z.union([z.literal(''), z.email()]) })),@@ -29,7 +29,7 @@ type InviteTeamFormInput = z.infer<typeof validationSchema>;export const useInviteTeam = () => {const { t } = useLingui();- const { enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { sendInvitation } = useCreateWorkspaceInvitation();const setNextOnboardingStatus = useSetNextOnboardingStatus();const setOnboardingFreeCredits = useSetAtomState(onboardingFreeCreditsState);@@ -169,11 +169,10 @@ export const useInviteTeam = () => {}));if (emails.length > 0) {- enqueueSuccessSnackBar({- message: t`Invite link sent to email addresses`,- options: {- duration: 2000,- },+ enqueueToast({+ variant: 'success',+ children: t`Invite link sent to email addresses`,+ duration: 2000,});}@@ -192,7 +191,7 @@ export const useInviteTeam = () => {}},[- enqueueSuccessSnackBar,+ enqueueToast,isBookCallOnboardingStepEnabled,isCompanyEnrichmentEnabled,onboardingConfig?.inviteTeamCreditsRewardPerUser,diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useResetPageLayoutTabToDefault.ts b/packages/twenty-front/src/modules/page-layout/hooks/useResetPageLayoutTabToDefault.tsindex bd2b989b44a..b32b71b2853 100644--- a/packages/twenty-front/src/modules/page-layout/hooks/useResetPageLayoutTabToDefault.ts+++ b/packages/twenty-front/src/modules/page-layout/hooks/useResetPageLayoutTabToDefault.ts@@ -7,14 +7,14 @@ import { CrudOperationType } from 'twenty-shared/types';import { useMetadataErrorHandler } from '@/metadata-error-handler/hooks/useMetadataErrorHandler';import { RESET_PAGE_LAYOUT_TAB_TO_DEFAULT } from '@/page-layout/graphql/mutations/resetPageLayoutTabToDefault';import { useRefreshPageLayoutAfterReset } from '@/page-layout/hooks/useRefreshPageLayoutAfterReset';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useToast } from 'twenty-ui/primitives/feedback';export const useResetPageLayoutTabToDefault = (pageLayoutIdFromProps: string,) => {const [resetMutation] = useMutation(RESET_PAGE_LAYOUT_TAB_TO_DEFAULT);const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { refreshPageLayoutAfterReset } = useRefreshPageLayoutAfterReset(pageLayoutIdFromProps,);@@ -31,7 +31,7 @@ export const useResetPageLayoutTabToDefault = (operationType: CrudOperationType.UPDATE,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}}},@@ -39,7 +39,7 @@ export const useResetPageLayoutTabToDefault = (resetMutation,refreshPageLayoutAfterReset,handleMetadataError,- enqueueErrorSnackBar,+ enqueueToast,],);diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useResetPageLayoutToDefault.ts b/packages/twenty-front/src/modules/page-layout/hooks/useResetPageLayoutToDefault.tsindex e7a6d59435c..af541e37c27 100644--- a/packages/twenty-front/src/modules/page-layout/hooks/useResetPageLayoutToDefault.ts+++ b/packages/twenty-front/src/modules/page-layout/hooks/useResetPageLayoutToDefault.ts@@ -6,16 +6,16 @@ import { useCallback } from 'react';import { CrudOperationType } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';-import { useInvalidateMetadataStore } from '@/metadata-store/hooks/useInvalidateMetadataStore';import { useMetadataErrorHandler } from '@/metadata-error-handler/hooks/useMetadataErrorHandler';+import { useInvalidateMetadataStore } from '@/metadata-store/hooks/useInvalidateMetadataStore';import { RESET_PAGE_LAYOUT_TO_DEFAULT } from '@/page-layout/graphql/mutations/resetPageLayoutToDefault';import { pageLayoutIsInitializedComponentState } from '@/page-layout/states/pageLayoutIsInitializedComponentState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useToast } from 'twenty-ui/primitives/feedback';export const useResetPageLayoutToDefault = () => {const [resetMutation] = useMutation(RESET_PAGE_LAYOUT_TO_DEFAULT);const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { invalidateMetadataStore } = useInvalidateMetadataStore();const store = useStore();@@ -41,7 +41,7 @@ export const useResetPageLayoutToDefault = () => {operationType: CrudOperationType.UPDATE,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}}},@@ -50,7 +50,7 @@ export const useResetPageLayoutToDefault = () => {store,invalidateMetadataStore,handleMetadataError,- enqueueErrorSnackBar,+ enqueueToast,],);diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useResetPageLayoutWidgetToDefault.ts b/packages/twenty-front/src/modules/page-layout/hooks/useResetPageLayoutWidgetToDefault.tsindex 9ef2864e1b5..6126528c264 100644--- a/packages/twenty-front/src/modules/page-layout/hooks/useResetPageLayoutWidgetToDefault.ts+++ b/packages/twenty-front/src/modules/page-layout/hooks/useResetPageLayoutWidgetToDefault.ts@@ -7,14 +7,14 @@ import { ResetPageLayoutWidgetToDefaultDocument } from '~/generated-metadata/graimport { useMetadataErrorHandler } from '@/metadata-error-handler/hooks/useMetadataErrorHandler';import { useRefreshPageLayoutAfterReset } from '@/page-layout/hooks/useRefreshPageLayoutAfterReset';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useToast } from 'twenty-ui/primitives/feedback';export const useResetPageLayoutWidgetToDefault = (pageLayoutIdFromProps: string,) => {const [resetMutation] = useMutation(ResetPageLayoutWidgetToDefaultDocument);const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { refreshPageLayoutAfterReset } = useRefreshPageLayoutAfterReset(pageLayoutIdFromProps,);@@ -31,7 +31,7 @@ export const useResetPageLayoutWidgetToDefault = (operationType: CrudOperationType.UPDATE,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}}},@@ -39,7 +39,7 @@ export const useResetPageLayoutWidgetToDefault = (resetMutation,refreshPageLayoutAfterReset,handleMetadataError,- enqueueErrorSnackBar,+ enqueueToast,],);diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useUpdatePageLayoutWithTabsAndWidgets.ts b/packages/twenty-front/src/modules/page-layout/hooks/useUpdatePageLayoutWithTabsAndWidgets.tsindex 267f7a079dd..1223a218f78 100644--- a/packages/twenty-front/src/modules/page-layout/hooks/useUpdatePageLayoutWithTabsAndWidgets.ts+++ b/packages/twenty-front/src/modules/page-layout/hooks/useUpdatePageLayoutWithTabsAndWidgets.ts@@ -6,10 +6,10 @@ import {import { useMetadataErrorHandler } from '@/metadata-error-handler/hooks/useMetadataErrorHandler';import { type MetadataRequestResult } from '@/object-metadata/types/MetadataRequestResult.type';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { t } from '@lingui/core/macro';import { CrudOperationType } from 'twenty-shared/types';+import { useToast } from 'twenty-ui/primitives/feedback';export const useUpdatePageLayoutWithTabsAndWidgets = () => {const [updatePageLayoutWithTabsAndWidgetsMutation] = useMutation(@@ -17,7 +17,7 @@ export const useUpdatePageLayoutWithTabsAndWidgets = () => {);const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const updatePageLayoutWithTabsAndWidgets = async (id: string,@@ -47,7 +47,7 @@ export const useUpdatePageLayoutWithTabsAndWidgets = () => {operationType: CrudOperationType.UPDATE,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}return {diff --git a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-summary/components/__stories__/CallRecordingSummaryBody.stories.tsx b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-summary/components/__stories__/CallRecordingSummaryBody.stories.tsxindex 938d1996691..6ef8d1c11d7 100644--- a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-summary/components/__stories__/CallRecordingSummaryBody.stories.tsx+++ b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-summary/components/__stories__/CallRecordingSummaryBody.stories.tsx@@ -1,9 +1,9 @@import { PAGE_LAYOUT_TEST_INSTANCE_ID } from '@/page-layout/hooks/__tests__/PageLayoutTestWrapper';import { type PageLayout } from '@/page-layout/types/PageLayout';import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget';+import { CallRecordingSummaryBody } from '@/page-layout/widgets/call-recording-summary/components/CallRecordingSummaryBody';import { getCallRecordingWidgetStoryDecorator } from '@/page-layout/widgets/call-recording/testing/getCallRecordingWidgetStoryDecorator';import { type WidgetCallRecordingCandidate } from '@/page-layout/widgets/call-recording/types/WidgetCallRecordingCandidate';-import { CallRecordingSummaryBody } from '@/page-layout/widgets/call-recording-summary/components/CallRecordingSummaryBody';import { type Meta, type StoryObj } from '@storybook/react-vite';import { expect, waitFor, within } from 'storybook/test';import { ComponentDecorator } from 'twenty-ui/testing';@@ -15,7 +15,7 @@ import {} from '~/generated-metadata/graphql';import { CallRecordingStatus } from '~/generated/graphql';import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const SUMMARY_WIDGET_ID = 'summary-widget';const SUMMARY_TAB_ID = 'summary-tab';@@ -127,7 +127,7 @@ const meta: Meta<typeof CallRecordingSummaryBody> = {widgetId: SUMMARY_WIDGET_ID,}),MemoryRouterDecorator,- SnackBarDecorator,+ ToastDecorator,ComponentDecorator,],parameters: {diff --git a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/__stories__/CallRecordingTranscriptBody.stories.tsx b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/__stories__/CallRecordingTranscriptBody.stories.tsxindex ce7e251591c..e0220f6483a 100644--- a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/__stories__/CallRecordingTranscriptBody.stories.tsx+++ b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/__stories__/CallRecordingTranscriptBody.stories.tsx@@ -1,11 +1,11 @@import { PAGE_LAYOUT_TEST_INSTANCE_ID } from '@/page-layout/hooks/__tests__/PageLayoutTestWrapper';import { type PageLayout } from '@/page-layout/types/PageLayout';import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget';+import { CallRecordingTranscriptBody } from '@/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptBody';+import { CALL_RECORDING_TRANSCRIPT_CURRENT_SPOKEN_WORD_DATA_ATTRIBUTE } from '@/page-layout/widgets/call-recording-transcript/constants/CallRecordingTranscriptCurrentSpokenWordDataAttribute';import { getCallRecordingWidgetStoryDecorator } from '@/page-layout/widgets/call-recording/testing/getCallRecordingWidgetStoryDecorator';import { type WidgetCallRecordingCandidate } from '@/page-layout/widgets/call-recording/types/WidgetCallRecordingCandidate';import { getCallRecordingPlaybackMedia } from '@/page-layout/widgets/call-recording/utils/getCallRecordingPlaybackMedia';-import { CallRecordingTranscriptBody } from '@/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptBody';-import { CALL_RECORDING_TRANSCRIPT_CURRENT_SPOKEN_WORD_DATA_ATTRIBUTE } from '@/page-layout/widgets/call-recording-transcript/constants/CallRecordingTranscriptCurrentSpokenWordDataAttribute';import { WidgetHeaderCountEffect } from '@/page-layout/widgets/components/WidgetHeaderCountEffect';import { type Meta, type StoryObj } from '@storybook/react-vite';import { HttpResponse, graphql } from 'msw';@@ -32,7 +32,7 @@ import {} from '~/generated-metadata/graphql';import { CallRecordingStatus } from '~/generated/graphql';import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { MOCK_CALL_RECORDING_AUDIO_DATA_URI } from './mockCallRecordingAudio';import { MOCK_CALL_RECORDING_VIDEO_DATA_URI } from './mockCallRecordingVideo';@@ -337,7 +337,7 @@ const meta: Meta<typeof CallRecordingTranscriptBodyStory> = {widgetId: TRANSCRIPT_WIDGET_ID,}),MemoryRouterDecorator,- SnackBarDecorator,+ ToastDecorator,ComponentDecorator,],parameters: {diff --git a/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/__stories__/RecordPageNoteWidget.stories.tsx b/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/__stories__/RecordPageNoteWidget.stories.tsxindex 3b81f38aa26..a81c5c4701e 100644--- a/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/__stories__/RecordPageNoteWidget.stories.tsx+++ b/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/__stories__/RecordPageNoteWidget.stories.tsx@@ -9,7 +9,6 @@ import {PAGE_LAYOUT_TEST_INSTANCE_ID,PageLayoutTestWrapper,} from '@/page-layout/hooks/__tests__/PageLayoutTestWrapper';-import { useOpenWidgetSettingsInSidePanel } from '@/side-panel/hooks/useOpenWidgetSettingsInSidePanel';import { isDashboardInEditModeComponentState } from '@/page-layout/states/isDashboardInEditModeComponentState';import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState';import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState';@@ -23,13 +22,14 @@ import {import { createDefaultStandaloneRichTextWidget } from '@/page-layout/utils/createDefaultStandaloneRichTextWidget';import { RecordPageAddWidgetSection } from '@/page-layout/widgets/components/RecordPageAddWidgetSection';import { WidgetCardShell } from '@/page-layout/widgets/components/WidgetCardShell';+import { useOpenWidgetSettingsInSidePanel } from '@/side-panel/hooks/useOpenWidgetSettingsInSidePanel';import { SidePanelPageLayoutRecordPageWidgetTypeSelect } from '@/side-panel/pages/page-layout/components/SidePanelPageLayoutRecordPageWidgetTypeSelect';import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState';import { sidePanelPageInfoSelector } from '@/side-panel/states/sidePanelPageInfoSelector';import { LayoutRenderingProvider } from '@/ui/layout/contexts/LayoutRenderingContext';import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { type Meta, type StoryObj } from '@storybook/react-vite';-import { graphql, HttpResponse } from 'msw';+import { HttpResponse, graphql } from 'msw';import { MemoryRouter } from 'react-router-dom';import { expect, userEvent, waitFor, within } from 'storybook/test';import { SidePanelPages } from 'twenty-shared/types';@@ -39,7 +39,7 @@ import {PageLayoutType,WidgetType,} from '~/generated-metadata/graphql';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { getMockObjectMetadataItemOrThrow } from '~/testing/utils/getMockObjectMetadataItemOrThrow';import { getTestEnrichedObjectMetadataItemsMock } from '~/testing/utils/getTestEnrichedObjectMetadataItemsMock';import { setTestObjectMetadataItemsInMetadataStore } from '~/testing/utils/setTestObjectMetadataItemsInMetadataStore';@@ -200,7 +200,7 @@ const meta: Meta<typeof RecordPageNoteWidgetStory> = {);},decorators: [- SnackBarDecorator,+ ToastDecorator,(Story, { args }) => (<MemoryRouter><PageLayoutTestWrapper store={jotaiStore} layoutType={args.layoutType}>diff --git a/packages/twenty-front/src/modules/settings/accounts/components/__stories__/SettingsAccountsCalendarChannelDetails.stories.tsx b/packages/twenty-front/src/modules/settings/accounts/components/__stories__/SettingsAccountsCalendarChannelDetails.stories.tsxindex c3440d1a8c6..201a52b6ea8 100644--- a/packages/twenty-front/src/modules/settings/accounts/components/__stories__/SettingsAccountsCalendarChannelDetails.stories.tsx+++ b/packages/twenty-front/src/modules/settings/accounts/components/__stories__/SettingsAccountsCalendarChannelDetails.stories.tsx@@ -4,7 +4,7 @@ import { SettingsAccountsCalendarChannelDetails } from '@/settings/accounts/compimport { ComponentDecorator } from 'twenty-ui/testing';import { CalendarChannelVisibility } from '~/generated/graphql';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const meta: Meta<typeof SettingsAccountsCalendarChannelDetails> = {title:@@ -13,7 +13,7 @@ const meta: Meta<typeof SettingsAccountsCalendarChannelDetails> = {decorators: [ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,],args: {calendarChannel: {diff --git a/packages/twenty-front/src/modules/settings/accounts/components/__stories__/SettingsAccountsMessageChannelDetails.stories.tsx b/packages/twenty-front/src/modules/settings/accounts/components/__stories__/SettingsAccountsMessageChannelDetails.stories.tsxindex 750d5c7a9b8..84b8dd2aae6 100644--- a/packages/twenty-front/src/modules/settings/accounts/components/__stories__/SettingsAccountsMessageChannelDetails.stories.tsx+++ b/packages/twenty-front/src/modules/settings/accounts/components/__stories__/SettingsAccountsMessageChannelDetails.stories.tsx@@ -1,16 +1,16 @@import { type Meta, type StoryObj } from '@storybook/react-vite';import { expect, within } from 'storybook/test';+import { SettingsAccountsMessageChannelDetails } from '@/settings/accounts/components/SettingsAccountsMessageChannelDetails';import {MessageChannelContactAutoCreationPolicy,MessageChannelType,MessageFolderImportPolicy,} from 'twenty-shared/types';-import { SettingsAccountsMessageChannelDetails } from '@/settings/accounts/components/SettingsAccountsMessageChannelDetails';import { ComponentDecorator } from 'twenty-ui/testing';import { MessageChannelVisibility } from '~/generated/graphql';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const mockedMessageChannel = {id: '20202020-ef5a-4822-9e08-ce6e6a4dcb6a',@@ -30,7 +30,7 @@ const meta: Meta<typeof SettingsAccountsMessageChannelDetails> = {decorators: [ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,],args: {messageChannel: mockedMessageChannel,diff --git a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFoldersCard.tsx b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFoldersCard.tsxindex de437b6cb44..6847b4d794d 100644--- a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFoldersCard.tsx+++ b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFoldersCard.tsx@@ -1,4 +1,5 @@import { type MessageFolder } from '@/accounts/types/MessageFolder';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { SettingsMessageFoldersEmptyStateCard } from '@/settings/accounts/components/message-folders/SettingsMessageFoldersEmptyStateCard';import { SettingsMessageFoldersSkeletonLoader } from '@/settings/accounts/components/message-folders/SettingsMessageFoldersSkeletonLoader';import { SettingsMessageFoldersTreeItem } from '@/settings/accounts/components/message-folders/SettingsMessageFoldersTreeItem';@@ -7,20 +8,20 @@ import { computeToggleAllFoldersState } from '@/settings/accounts/components/mesimport { useMyMessageFolders } from '@/settings/accounts/hooks/useMyMessageFolders';import { useUpdateMessageFoldersSyncStatus } from '@/settings/accounts/hooks/useUpdateMessageFoldersSyncStatus';import { settingsAccountsSelectedMessageChannelState } from '@/settings/accounts/states/settingsAccountsSelectedMessageChannelState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { Table } from '@/ui/layout/table/components/Table';import { TableCell } from '@/ui/layout/table/components/TableCell';-import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useMemo, useState } from 'react';-import { Label } from 'twenty-ui/primitives/typography';import { Checkbox } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';+import { Label } from 'twenty-ui/primitives/typography';import { themeCssVariables } from 'twenty-ui/theme-constants';+import { useToast } from 'twenty-ui/primitives/feedback';+const StyledTreeList = styled.ul`list-style: none;margin: 0;@@ -63,7 +64,7 @@ export const SettingsAccountsMessageFoldersCard = () => {const { t } = useLingui();const [search, setSearch] = useState('');- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const settingsAccountsSelectedMessageChannel = useAtomStateValue(settingsAccountsSelectedMessageChannelState,@@ -100,9 +101,7 @@ export const SettingsAccountsMessageFoldersCard = () => {isSynced: targetSyncState,});} catch (error) {- enqueueErrorSnackBar({- ...(CombinedGraphQLErrors.is(error) ? { apolloError: error } : {}),- });+ enqueueToast(getToastOptionsFromError({ error }));}};@@ -115,9 +114,7 @@ export const SettingsAccountsMessageFoldersCard = () => {isSynced,});} catch (error) {- enqueueErrorSnackBar({- ...(CombinedGraphQLErrors.is(error) ? { apolloError: error } : {}),- });+ enqueueToast(getToastOptionsFromError({ error }));}};diff --git a/packages/twenty-front/src/modules/settings/accounts/hooks/useCreateEmailGroupChannel.ts b/packages/twenty-front/src/modules/settings/accounts/hooks/useCreateEmailGroupChannel.tsindex a8d97ec4f42..b9348cdea30 100644--- a/packages/twenty-front/src/modules/settings/accounts/hooks/useCreateEmailGroupChannel.ts+++ b/packages/twenty-front/src/modules/settings/accounts/hooks/useCreateEmailGroupChannel.ts@@ -5,12 +5,13 @@ import {type MessageChannelType,type MessageChannelVisibility,} from 'twenty-shared/types';+import { useToast } from 'twenty-ui/primitives/feedback';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { CREATE_EMAIL_GROUP_CHANNEL } from '@/settings/accounts/graphql/mutations/createEmailGroupChannel';import { GET_MY_CONNECTED_ACCOUNTS } from '@/settings/accounts/graphql/queries/getMyConnectedAccounts';import { GET_MY_MESSAGE_CHANNELS } from '@/settings/accounts/graphql/queries/getMyMessageChannels';import { GET_ALL_EMAILING_DOMAINS } from '@/settings/emailing-domains/graphql/queries/getAllEmailingDomains';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';type CreateEmailGroupChannelResult = {createEmailGroupChannel: {@@ -35,7 +36,7 @@ type CreateEmailGroupChannelVariables = {};export const useCreateEmailGroupChannel = () => {- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [mutate, { loading, error }] = useMutation<CreateEmailGroupChannelResult,@@ -52,7 +53,7 @@ export const useCreateEmailGroupChannel = () => {mutate({variables: { input: { handle, displayName } },onError: (mutationError) => {- enqueueErrorSnackBar({ apolloError: mutationError });+ enqueueToast(getToastOptionsFromError({ error: mutationError }));},});diff --git a/packages/twenty-front/src/modules/settings/accounts/hooks/useImapSmtpCaldavConnectionForm.ts b/packages/twenty-front/src/modules/settings/accounts/hooks/useImapSmtpCaldavConnectionForm.tsindex 1a5cc938434..9af8ebc3690 100644--- a/packages/twenty-front/src/modules/settings/accounts/hooks/useImapSmtpCaldavConnectionForm.ts+++ b/packages/twenty-front/src/modules/settings/accounts/hooks/useImapSmtpCaldavConnectionForm.ts@@ -2,7 +2,8 @@ import { zodResolver } from '@hookform/resolvers/zod';import { useCallback, useEffect, useMemo } from 'react';import { useForm } from 'react-hook-form';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';+import { useToast } from 'twenty-ui/primitives/feedback';import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';@@ -23,7 +24,6 @@ import {connectionImapSmtpCalDav,connectionImapSmtpCalDavUpdate,} from '@/settings/accounts/validation-schemas/connectionImapSmtpCalDav';-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { isNonEmptyString } from '@sniptt/guards';import { ACCOUNT_TYPES } from 'twenty-shared/constants';import { isDefined } from 'twenty-shared/utils';@@ -80,7 +80,7 @@ export const useImapSmtpCaldavConnectionForm = ({});const { handleSubmit, formState, watch, reset } = formMethods;- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { isSubmitting } = formState;const { connectedAccount, loading: accountLoading } =@@ -183,7 +183,7 @@ export const useImapSmtpCaldavConnectionForm = ({? t`Connection successfully updated`: t`Connection successfully created`;- enqueueSuccessSnackBar({ message: successMessage });+ enqueueToast({ variant: 'success', children: successMessage });const { connectedAccountId: returnedConnectedAccountId } =data?.saveImapSmtpCaldavAccount ?? {};@@ -192,9 +192,7 @@ export const useImapSmtpCaldavConnectionForm = ({connectedAccountId: returnedConnectedAccountId,});} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));}},[@@ -202,9 +200,8 @@ export const useImapSmtpCaldavConnectionForm = ({saveConnection,isEditing,connectedAccountId,- enqueueSuccessSnackBar,+ enqueueToast,navigate,- enqueueErrorSnackBar,],);diff --git a/packages/twenty-front/src/modules/settings/admin-panel/ai/components/SettingsAdminAI.tsx b/packages/twenty-front/src/modules/settings/admin-panel/ai/components/SettingsAdminAI.tsxindex f22652d270d..523db768721 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/ai/components/SettingsAdminAI.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/ai/components/SettingsAdminAI.tsx@@ -1,3 +1,4 @@+import { useToast } from 'twenty-ui/primitives/feedback';import { useMemo, useState } from 'react';import { useMutation, useQuery } from '@apollo/client/react';@@ -36,7 +37,6 @@ import { useUsageValueFormatter } from '@/settings/usage/hooks/useUsageValueFormimport { getPeriodDates } from '@/settings/usage/utils/getPeriodDates';import { getPeriodOptions } from '@/settings/usage/utils/getPeriodOptions';import { type PeriodPreset } from '@/settings/usage/utils/periodPreset';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { Select } from '@/ui/input/components/Select';import { Table } from '@/ui/layout/table/components/Table';@@ -61,7 +61,7 @@ type UsageBreakdownItem = {export const SettingsAdminAI = () => {const apolloAdminClient = useApolloAdminClient();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { refetch: refetchClientConfig } = useClientConfig();const { formatUsageValue } = useUsageValueFormatter();const currentWorkspace = useAtomStateValue(currentWorkspaceState);@@ -149,8 +149,9 @@ export const SettingsAdminAI = () => {});await refetchClientConfig();} catch {- enqueueErrorSnackBar({- message: t`Failed to update default model`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to update default model`,});}};diff --git a/packages/twenty-front/src/modules/settings/admin-panel/apps/components/SettingsAdminApps.tsx b/packages/twenty-front/src/modules/settings/admin-panel/apps/components/SettingsAdminApps.tsxindex 6e78d55e40c..d925c3309e4 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/apps/components/SettingsAdminApps.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/apps/components/SettingsAdminApps.tsx@@ -2,7 +2,6 @@ import { ApplicationDisplay } from '@/applications/components/ApplicationDisplayimport { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';import { SettingsEmptyPlaceholder } from '@/settings/components/SettingsEmptyPlaceholder';import { StyledNameTableCell } from '@/settings/data-model/object-details/components/SettingsObjectItemTableRowStyledComponents';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';@@ -16,25 +15,26 @@ import { useMutation, useQuery } from '@apollo/client/react';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { type ReactNode, useContext, useState } from 'react';-import { useDebounce } from 'use-debounce';+import { SettingsPath } from 'twenty-shared/types';import {assertUnreachable,getSettingsPath,isDefined,} from 'twenty-shared/utils';-import { SettingsPath } from 'twenty-shared/types';import {IconChevronRight,IconDotsVertical,IconPinned,IconRefresh,} from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';+import { Tag } from 'twenty-ui/primitives/data-display';+import { useToast } from 'twenty-ui/primitives/feedback';import { Button, SearchInput } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';import { MenuItemSwitch } from 'twenty-ui/primitives/navigation';+import { H2Title } from 'twenty-ui/primitives/typography';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';-import { Tag } from 'twenty-ui/primitives/data-display';+import { useDebounce } from 'use-debounce';import {type ApplicationRegistrationFragmentFragment,ApplicationRegistrationSourceType,@@ -69,7 +69,7 @@ const SOURCE_TYPE_FILTER_OPTIONS: {export const SettingsAdminApps = () => {const apolloAdminClient = useApolloAdminClient();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [searchQuery, setSearchQuery] = useState('');const [debouncedSearchQuery] = useDebounce(searchQuery, 300);const [showPreInstalledOnly, setShowPreInstalledOnly] = useState(false);@@ -121,12 +121,14 @@ export const SettingsAdminApps = () => {const handleSyncCatalog = async () => {try {await syncMarketplaceCatalog();- enqueueSuccessSnackBar({- message: t`Marketplace catalog synchronization started.`,+ enqueueToast({+ variant: 'success',+ children: t`Marketplace catalog synchronization started.`,});} catch {- enqueueErrorSnackBar({- message: t`Failed to synchronize the marketplace catalog.`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to synchronize the marketplace catalog.`,});}};diff --git a/packages/twenty-front/src/modules/settings/admin-panel/chats/hooks/useAdminChatThreads.ts b/packages/twenty-front/src/modules/settings/admin-panel/chats/hooks/useAdminChatThreads.tsindex ed4dab1465e..474e6197b48 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/chats/hooks/useAdminChatThreads.ts+++ b/packages/twenty-front/src/modules/settings/admin-panel/chats/hooks/useAdminChatThreads.ts@@ -10,10 +10,10 @@ import { adminChatsFilterState } from '@/settings/admin-panel/chats/states/adminimport { adminChatsSearchQueryState } from '@/settings/admin-panel/chats/states/adminChatsSearchQueryState';import { getAdminChatsSortVariables } from '@/settings/admin-panel/chats/utils/getAdminChatsSortVariables';import { GET_ADMIN_CHAT_THREADS } from '@/settings/admin-panel/graphql/queries/getAdminChatThreads';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { sortedFieldByTableFamilyState } from '@/ui/layout/table/states/sortedFieldByTableFamilyState';import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';+import { useToast } from 'twenty-ui/primitives/feedback';import {AdminChatThreadScope,type GetAdminChatThreadsQuery,@@ -24,7 +24,7 @@ const PAGE_SIZE = 25;export const useAdminChatThreads = () => {const apolloAdminClient = useApolloAdminClient();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [adminChatsSearchQuery, setAdminChatsSearchQuery] = useAtomState(adminChatsSearchQueryState,);@@ -103,7 +103,10 @@ export const useAdminChatThreads = () => {},});} catch {- enqueueErrorSnackBar({ message: t`Failed to load more chats.` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to load more chats.`,+ });}};diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminServerAdminAccess.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminServerAdminAccess.tsxindex fd74b6b3f57..5b9412f9620 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminServerAdminAccess.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminServerAdminAccess.tsx@@ -1,7 +1,7 @@+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';import { TwoFactorAuthenticationVerificationCodeDash } from '@/settings/two-factor-authentication/components/TwoFactorAuthenticationVerificationCodeDash';import { TwoFactorAuthenticationVerificationCodeSlot } from '@/settings/two-factor-authentication/components/TwoFactorAuthenticationVerificationCodeSlot';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';@@ -14,8 +14,9 @@ import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { OTPInput } from 'input-otp';import { useState } from 'react';-import { Status } from 'twenty-ui/primitives/data-display';import { IconDotsVertical } from 'twenty-ui/icon';+import { Status } from 'twenty-ui/primitives/data-display';+import { useToast } from 'twenty-ui/primitives/feedback';import { LightIconButton } from 'twenty-ui/primitives/input';import { MenuItem } from 'twenty-ui/primitives/navigation';import { themeCssVariables } from 'twenty-ui/theme-constants';@@ -79,7 +80,7 @@ export const SettingsAdminServerAdminAccess = ({const apolloAdminClient = useApolloAdminClient();const { openModal } = useModal();const { closeDropdown } = useCloseDropdown();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [pendingChange, setPendingChange] =useState<PendingServerAdminChange | null>(null);@@ -127,15 +128,19 @@ export const SettingsAdminServerAdminAccess = ({},});await refetch();- enqueueSuccessSnackBar({- message: t`Server administrator access updated.`,+ enqueueToast({+ variant: 'success',+ children: t`Server administrator access updated.`,});} catch (error) {- enqueueErrorSnackBar({- ...(CombinedGraphQLErrors.is(error)- ? { apolloError: error }- : { message: t`Failed to update server administrator access.` }),- });+ enqueueToast(+ CombinedGraphQLErrors.is(error)+ ? getToastOptionsFromError({ error })+ : {+ variant: 'error',+ children: t`Failed to update server administrator access.`,+ },+ );} finally {setOtp('');setPendingChange(null);diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantModal.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantModal.tsxindex 451ce27cb16..585f7db9fe0 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantModal.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantModal.tsx@@ -1,31 +1,31 @@-import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';+import { CREDIT_GRANT_EXPIRY_OPTIONS } from '@/settings/admin-panel/constants/CreditGrantExpiryOptions';+import { CREDIT_GRANT_TYPE_LABELS } from '@/settings/admin-panel/constants/CreditGrantTypeLabels';+import { GRANTABLE_CREDIT_GRANT_TYPES } from '@/settings/admin-panel/constants/GrantableCreditGrantTypes';+import { GRANT_WORKSPACE_CREDITS } from '@/settings/admin-panel/graphql/mutations/grantWorkspaceCredits';+import { GET_WORKSPACE_BILLING_ADMIN_PANEL } from '@/settings/admin-panel/graphql/queries/getWorkspaceBillingAdminPanel';+import { Select } from '@/ui/input/components/Select';+import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';+import { ModalStatefulWrapper } from '@/ui/layout/modal/components/ModalStatefulWrapper';+import { useModal } from '@/ui/layout/modal/hooks/useModal';import { useMutation } from '@apollo/client/react';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { useState } from 'react';-import { v4 } from 'uuid';import { Button } from 'twenty-ui/primitives/input';import {Section,SectionAlignment,SectionFontColor,} from 'twenty-ui/primitives/layout';-import { themeCssVariables } from 'twenty-ui/theme-constants';import { H1Title, H1TitleFontColor } from 'twenty-ui/primitives/typography';--import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';-import { CREDIT_GRANT_EXPIRY_OPTIONS } from '@/settings/admin-panel/constants/CreditGrantExpiryOptions';-import { CREDIT_GRANT_TYPE_LABELS } from '@/settings/admin-panel/constants/CreditGrantTypeLabels';-import { GRANTABLE_CREDIT_GRANT_TYPES } from '@/settings/admin-panel/constants/GrantableCreditGrantTypes';-import { GRANT_WORKSPACE_CREDITS } from '@/settings/admin-panel/graphql/mutations/grantWorkspaceCredits';-import { GET_WORKSPACE_BILLING_ADMIN_PANEL } from '@/settings/admin-panel/graphql/queries/getWorkspaceBillingAdminPanel';-import { Select } from '@/ui/input/components/Select';-import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';-import { ModalStatefulWrapper } from '@/ui/layout/modal/components/ModalStatefulWrapper';-import { useModal } from '@/ui/layout/modal/hooks/useModal';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { themeCssVariables } from 'twenty-ui/theme-constants';+import { v4 } from 'uuid';import { BillingCreditGrantType } from '~/generated-admin/graphql';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';+import { useToast } from 'twenty-ui/primitives/feedback';+type SettingsAdminWorkspaceCreditGrantModalProps = {modalInstanceId: string;workspaceId: string;@@ -61,7 +61,7 @@ export const SettingsAdminWorkspaceCreditGrantModal = ({}: SettingsAdminWorkspaceCreditGrantModalProps) => {const { t } = useLingui();const { closeModal } = useModal();- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const apolloAdminClient = useApolloAdminClient();const [amount, setAmount] = useState('');@@ -134,14 +134,13 @@ export const SettingsAdminWorkspaceCreditGrantModal = ({},});- enqueueSuccessSnackBar({- message: t`Granted ${parsedAmount} credits to this workspace.`,+ enqueueToast({+ variant: 'success',+ children: t`Granted ${parsedAmount} credits to this workspace.`,});handleClose();} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));}};diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantsTable.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantsTable.tsxindex de87323f98e..5dc1a6bec0b 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantsTable.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantsTable.tsx@@ -1,4 +1,3 @@-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { type MessageDescriptor } from '@lingui/core';import { msg } from '@lingui/core/macro';@@ -9,6 +8,8 @@ import { Tag } from 'twenty-ui/primitives/data-display';import { OverflowingTextWithTooltip } from 'twenty-ui/primitives/surfaces';import { type ThemeColor } from 'twenty-ui/theme';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';+import { useNumberFormat } from '@/localization/hooks/useNumberFormat';import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';import { SettingsAdminWorkspaceCreditGrantRowDropdownMenu } from '@/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantRowDropdownMenu';import { CREDIT_GRANT_TYPE_COLORS } from '@/settings/admin-panel/constants/CreditGrantTypeColors';@@ -20,12 +21,11 @@ import {type CollapsedCreditGrant,} from '@/settings/admin-panel/utils/collapseCreditGrantChains';import { SettingsTableListSection } from '@/settings/components/SettingsTableListSection';-import { useNumberFormat } from '@/localization/hooks/useNumberFormat';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';-import { beautifyExactDate } from '~/utils/date-utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { type WorkspaceBillingAdminPanelQuery } from '~/generated-admin/graphql';+import { beautifyExactDate } from '~/utils/date-utils';type CreditGrant = NonNullable<WorkspaceBillingAdminPanelQuery['workspaceBillingAdminPanel']@@ -68,7 +68,7 @@ export const SettingsAdminWorkspaceCreditGrantsTable = ({}: SettingsAdminWorkspaceCreditGrantsTableProps) => {const { t } = useLingui();const { formatNumber } = useNumberFormat();- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const apolloAdminClient = useApolloAdminClient();const { openModal } = useModal();@@ -105,11 +105,9 @@ export const SettingsAdminWorkspaceCreditGrantsTable = ({variables: { workspaceId, creditGrantId },});- enqueueSuccessSnackBar({ message: t`Credit grant revoked.` });+ enqueueToast({ variant: 'success', children: t`Credit grant revoked.` });} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));} finally {setIsRevoking(false);setGrantPendingRevocation(null);diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/__stories__/SettingsAdminChatAskQuestionsPart.stories.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/__stories__/SettingsAdminChatAskQuestionsPart.stories.tsxindex 32a75028658..a9c2855e149 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/components/__stories__/SettingsAdminChatAskQuestionsPart.stories.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/__stories__/SettingsAdminChatAskQuestionsPart.stories.tsx@@ -5,7 +5,7 @@ import { ComponentDecorator } from 'twenty-ui/testing';import { SettingsAdminChatAskQuestionsPart } from '@/settings/admin-panel/components/SettingsAdminChatAskQuestionsPart';import { type AdminChatThreadMessagePart } from '@/settings/admin-panel/types/AdminChatThreadMessagePart';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const QUESTIONS = [{@@ -52,7 +52,7 @@ const buildPart = (const meta: Meta<typeof SettingsAdminChatAskQuestionsPart> = {title: 'Modules/Settings/AdminPanel/SettingsAdminChatAskQuestionsPart',component: SettingsAdminChatAskQuestionsPart,- decorators: [SnackBarDecorator, ComponentDecorator],+ decorators: [ToastDecorator, ComponentDecorator],parameters: { container: { width: 700 } },argTypes: { part: { control: false }, result: { control: false } },};diff --git a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminQueueJobsTable.tsx b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminQueueJobsTable.tsxindex e84f8ea77d6..c9b17e67785 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminQueueJobsTable.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminQueueJobsTable.tsx@@ -107,14 +107,20 @@ export const SettingsAdminQueueJobsTable = ({fetchPolicy: 'network-only',});- const { retryJobs, isRetrying } = useRetryJobs(queueName, () => {- refetch();- setSelectedJobIds(new Set());+ const { retryJobs, isRetrying } = useRetryJobs({+ queueName,+ onSuccess: () => {+ refetch();+ setSelectedJobIds(new Set());+ },});- const { deleteJobs, isDeleting } = useDeleteJobs(queueName, () => {- refetch();- setSelectedJobIds(new Set());+ const { deleteJobs, isDeleting } = useDeleteJobs({+ queueName,+ onSuccess: () => {+ refetch();+ setSelectedJobIds(new Set());+ },});const jobs = data?.getQueueJobs?.jobs || [];diff --git a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminWorkerMetricsGraph.tsx b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminWorkerMetricsGraph.tsxindex a64ce138e53..776d8391f2e 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminWorkerMetricsGraph.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminWorkerMetricsGraph.tsx@@ -1,17 +1,17 @@-import { isDefined } from 'twenty-shared/utils';-import { SettingsTableCard } from '@/settings/components/SettingsTableCard';+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';import { SettingsAdminWorkerMetricsTooltip } from '@/settings/admin-panel/health-status/components/SettingsAdminWorkerMetricsTooltip';-import { useSnackBarOnQueryError } from '@/apollo/hooks/useSnackBarOnQueryError';+import { SettingsTableCard } from '@/settings/components/SettingsTableCard';+import { useQuery } from '@apollo/client/react';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { ResponsiveLine } from '@nivo/line';import { useContext } from 'react';+import { isDefined } from 'twenty-shared/utils';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';-import { useQuery } from '@apollo/client/react';import {- QueueMetricsTimeRange,GetQueueMetricsDocument,+ QueueMetricsTimeRange,} from '~/generated-admin/graphql';const StyledGraphContainer = styled.div`@@ -61,8 +61,6 @@ export const SettingsAdminWorkerMetricsGraph = ({fetchPolicy: 'no-cache',});- useSnackBarOnQueryError(error);-const metricsData = data?.getQueueMetrics?.data || [];const hasData =metricsData.length > 0 &&@@ -107,6 +105,8 @@ export const SettingsAdminWorkerMetricsGraph = ({return (<>+ <ToastOnQueryErrorEffect error={error} />+<StyledGraphContainer>{loading ? (<StyledNoDataMessage>{t`Loading metrics data...`}</StyledNoDataMessage>diff --git a/packages/twenty-front/src/modules/settings/admin-panel/health-status/hooks/useDeleteJobs.ts b/packages/twenty-front/src/modules/settings/admin-panel/health-status/hooks/useDeleteJobs.tsindex 584ac9bbfc2..6717dfb2a6a 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/health-status/hooks/useDeleteJobs.ts+++ b/packages/twenty-front/src/modules/settings/admin-panel/health-status/hooks/useDeleteJobs.ts@@ -1,16 +1,22 @@import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { useMutation } from '@apollo/client/react';import { plural, t } from '@lingui/core/macro';import { useState } from 'react';import { isDefined } from 'twenty-shared/utils';-import { useMutation } from '@apollo/client/react';+import { useToast } from 'twenty-ui/primitives/feedback';import { DeleteJobsDocument } from '~/generated-admin/graphql';import { getErrorMessageFromApolloError } from '~/utils/get-error-message-from-apollo-error.util';-export const useDeleteJobs = (queueName: string, onSuccess?: () => void) => {+export const useDeleteJobs = ({+ queueName,+ onSuccess,+}: {+ queueName: string;+ onSuccess?: () => void;+}) => {const apolloAdminClient = useApolloAdminClient();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [isDeleting, setIsDeleting] = useState(false);const [deleteJobsMutation] = useMutation(DeleteJobsDocument, {client: apolloAdminClient,@@ -35,21 +41,24 @@ export const useDeleteJobs = (queueName: string, onSuccess?: () => void) => {if (deletedCount > 0) {if (failedResults.length > 0) {- enqueueSuccessSnackBar({- message: plural(deletedCount, {+ enqueueToast({+ variant: 'success',+ children: plural(deletedCount, {one: `Successfully deleted ${deletedCount} job`,other: `Successfully deleted ${deletedCount} jobs`,}),});- enqueueErrorSnackBar({- message: plural(failedResults.length, {+ enqueueToast({+ variant: 'error',+ children: plural(failedResults.length, {one: `# job could not be deleted`,other: `# jobs could not be deleted`,}),});} else {- enqueueSuccessSnackBar({- message: plural(deletedCount, {+ enqueueToast({+ variant: 'success',+ children: plural(deletedCount, {one: `Successfully deleted ${deletedCount} job`,other: `Successfully deleted ${deletedCount} jobs`,}),@@ -64,14 +73,16 @@ export const useDeleteJobs = (queueName: string, onSuccess?: () => void) => {const errorDetails =errorMessages.length > 0 ? `: ${errorMessages[0]}` : '';- enqueueErrorSnackBar({- message: t`No jobs were deleted${errorDetails}`,+ enqueueToast({+ variant: 'error',+ children: t`No jobs were deleted${errorDetails}`,});}}} catch (error) {- enqueueErrorSnackBar({- message: CombinedGraphQLErrors.is(error)+ enqueueToast({+ variant: 'error',+ children: CombinedGraphQLErrors.is(error)? getErrorMessageFromApolloError(error): t`Failed to delete jobs. Please try again later.`,});diff --git a/packages/twenty-front/src/modules/settings/admin-panel/health-status/hooks/useRetryJobs.ts b/packages/twenty-front/src/modules/settings/admin-panel/health-status/hooks/useRetryJobs.tsindex 1350964f633..c8644af2c70 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/health-status/hooks/useRetryJobs.ts+++ b/packages/twenty-front/src/modules/settings/admin-panel/health-status/hooks/useRetryJobs.ts@@ -1,16 +1,22 @@import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { useMutation } from '@apollo/client/react';import { plural, t } from '@lingui/core/macro';import { useState } from 'react';import { isDefined } from 'twenty-shared/utils';-import { useMutation } from '@apollo/client/react';+import { useToast } from 'twenty-ui/primitives/feedback';import { RetryJobsDocument } from '~/generated-admin/graphql';import { getErrorMessageFromApolloError } from '~/utils/get-error-message-from-apollo-error.util';-export const useRetryJobs = (queueName: string, onSuccess?: () => void) => {+export const useRetryJobs = ({+ queueName,+ onSuccess,+}: {+ queueName: string;+ onSuccess?: () => void;+}) => {const apolloAdminClient = useApolloAdminClient();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [isRetrying, setIsRetrying] = useState(false);const [retryJobsMutation] = useMutation(RetryJobsDocument, {client: apolloAdminClient,@@ -34,26 +40,30 @@ export const useRetryJobs = (queueName: string, onSuccess?: () => void) => {const failedResults = results.filter((r) => !r.success);if (retriedCount === -1) {- enqueueSuccessSnackBar({- message: t`All failed jobs have been retried`,+ enqueueToast({+ variant: 'success',+ children: t`All failed jobs have been retried`,});} else if (retriedCount > 0) {if (failedResults.length > 0) {- enqueueSuccessSnackBar({- message: plural(retriedCount, {+ enqueueToast({+ variant: 'success',+ children: plural(retriedCount, {one: `Successfully retried ${retriedCount} job`,other: `Successfully retried ${retriedCount} jobs`,}),});- enqueueErrorSnackBar({- message: plural(failedResults.length, {+ enqueueToast({+ variant: 'error',+ children: plural(failedResults.length, {one: `# job could not be retried`,other: `# jobs could not be retried`,}),});} else {- enqueueSuccessSnackBar({- message: plural(retriedCount, {+ enqueueToast({+ variant: 'success',+ children: plural(retriedCount, {one: `Successfully retried ${retriedCount} job`,other: `Successfully retried ${retriedCount} jobs`,}),@@ -66,16 +76,18 @@ export const useRetryJobs = (queueName: string, onSuccess?: () => void) => {const errorDetails =errorMessages.length > 0 ? `: ${errorMessages[0]}` : '';- enqueueErrorSnackBar({- message: t`No jobs were retried${errorDetails}`,+ enqueueToast({+ variant: 'error',+ children: t`No jobs were retried${errorDetails}`,});}onSuccess?.();}} catch (error) {- enqueueErrorSnackBar({- message: CombinedGraphQLErrors.is(error)+ enqueueToast({+ variant: 'error',+ children: CombinedGraphQLErrors.is(error)? getErrorMessageFromApolloError(error): t`Failed to retry jobs. Please try again later.`,});diff --git a/packages/twenty-front/src/modules/settings/admin-panel/health-status/maintenance-mode/components/SettingsAdminMaintenanceMode.tsx b/packages/twenty-front/src/modules/settings/admin-panel/health-status/maintenance-mode/components/SettingsAdminMaintenanceMode.tsxindex 5b097826ac3..6c1f72ee7db 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/health-status/maintenance-mode/components/SettingsAdminMaintenanceMode.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/health-status/maintenance-mode/components/SettingsAdminMaintenanceMode.tsx@@ -1,16 +1,3 @@-import { useMutation } from '@apollo/client/react';-import { styled } from '@linaria/react';-import { t } from '@lingui/core/macro';-import { isNonEmptyString } from '@sniptt/guards';-import { useCallback } from 'react';-import { isDefined } from 'twenty-shared/utils';-import { Status } from 'twenty-ui/primitives/data-display';-import { IconLink, IconTool } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';-import { Section } from 'twenty-ui/primitives/layout';-import { Card, CardContent } from 'twenty-ui/primitives/surfaces';-import { themeCssVariables } from 'twenty-ui/theme-constants';-import { maintenanceModeState } from '@/client-config/states/maintenanceModeState';import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';import { CLEAR_MAINTENANCE_MODE } from '@/settings/admin-panel/health-status/maintenance-mode/graphql/mutations/clearMaintenanceMode';@@ -18,13 +5,26 @@ import { SET_MAINTENANCE_MODE } from '@/settings/admin-panel/health-status/maintimport { adminPanelMaintenanceModeState } from '@/settings/admin-panel/health-status/maintenance-mode/states/adminPanelMaintenanceModeState';import { SettingsDatePickerInput } from '@/settings/components/SettingsDatePickerInput';import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { InputHint } from 'twenty-ui/primitives/input';import { TextInput } from '@/ui/input/components/TextInput';import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';+import { useMutation } from '@apollo/client/react';+import { styled } from '@linaria/react';+import { t } from '@lingui/core/macro';+import { isNonEmptyString } from '@sniptt/guards';+import { useCallback } from 'react';+import { isDefined } from 'twenty-shared/utils';+import { IconLink, IconTool } from 'twenty-ui/icon';+import { Status } from 'twenty-ui/primitives/data-display';+import { InputHint } from 'twenty-ui/primitives/input';+import { Section } from 'twenty-ui/primitives/layout';+import { Card, CardContent } from 'twenty-ui/primitives/surfaces';+import { H2Title } from 'twenty-ui/primitives/typography';+import { themeCssVariables } from 'twenty-ui/theme-constants';++import { useToast } from 'twenty-ui/primitives/feedback';const StyledFormContainer = styled.div`display: flex;@@ -46,7 +46,7 @@ export const SettingsAdminMaintenanceMode = () => {const setMaintenanceMode = useSetAtomState(maintenanceModeState);const { userTimezone } = useUserTimezone();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [setMaintenanceModeMutation] = useMutation(SET_MAINTENANCE_MODE, {client: apolloAdminClient,@@ -98,15 +98,16 @@ export const SettingsAdminMaintenanceMode = () => {link,});} catch (error: unknown) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:error instanceof Error? error.message: t`Failed to set maintenance mode.`,});}},- [setMaintenanceModeMutation, setMaintenanceMode, enqueueErrorSnackBar],+ [setMaintenanceModeMutation, setMaintenanceMode, enqueueToast],);const handleToggle = useCallback(diff --git a/packages/twenty-front/src/modules/settings/admin-panel/hooks/useHandleImpersonate.ts b/packages/twenty-front/src/modules/settings/admin-panel/hooks/useHandleImpersonate.tsindex eee9fd7808d..cd46f27f787 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/hooks/useHandleImpersonate.ts+++ b/packages/twenty-front/src/modules/settings/admin-panel/hooks/useHandleImpersonate.ts@@ -9,15 +9,15 @@ import { useImpersonationSession } from '@/auth/hooks/useImpersonationSession';import { currentUserState } from '@/auth/states/currentUserState';import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { useRedirectToWorkspaceDomain } from '@/domain-manager/hooks/useRedirectToWorkspaceDomain';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { useToast } from 'twenty-ui/primitives/feedback';import { ImpersonateDocument } from '~/generated-metadata/graphql';import { getWorkspaceUrl } from '~/utils/getWorkspaceUrl';export const useHandleImpersonate = () => {const currentUser = useAtomStateValue(currentUserState);const currentWorkspace = useAtomStateValue(currentWorkspaceState);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { startImpersonating } = useImpersonationSession();const { redirectToWorkspaceDomain } = useRedirectToWorkspaceDomain();const [impersonate] = useMutation(ImpersonateDocument);@@ -27,8 +27,9 @@ export const useHandleImpersonate = () => {const handleImpersonate = async (userId: string, workspaceId: string) => {if (!isDefined(currentUser?.id) || userId === currentUser.id) {- enqueueErrorSnackBar({- message: t`You cannot impersonate your own account`,+ enqueueToast({+ variant: 'error',+ children: t`You cannot impersonate your own account`,});return;@@ -56,8 +57,9 @@ export const useHandleImpersonate = () => {);},onError: (error) => {- enqueueErrorSnackBar({- message: `Failed to impersonate user. ${error.message}`,+ enqueueToast({+ variant: 'error',+ children: `Failed to impersonate user. ${error.message}`,});},}).finally(() => {diff --git a/packages/twenty-front/src/modules/settings/admin-panel/signing-keys/hooks/useRevokeSigningKey.ts b/packages/twenty-front/src/modules/settings/admin-panel/signing-keys/hooks/useRevokeSigningKey.tsindex 129eb28bb65..b0eb6836a23 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/signing-keys/hooks/useRevokeSigningKey.ts+++ b/packages/twenty-front/src/modules/settings/admin-panel/signing-keys/hooks/useRevokeSigningKey.ts@@ -1,16 +1,16 @@import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';import { GET_SIGNING_KEYS } from '@/settings/admin-panel/signing-keys/graphql/queries/getSigningKeys';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { useState } from 'react';+import { useToast } from 'twenty-ui/primitives/feedback';import { RevokeSigningKeyDocument } from '~/generated-admin/graphql';import { getErrorMessageFromApolloError } from '~/utils/get-error-message-from-apollo-error.util';export const useRevokeSigningKey = (onSuccess?: () => void) => {const apolloAdminClient = useApolloAdminClient();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [isRevoking, setIsRevoking] = useState(false);const [revokeSigningKeyMutation] = useMutation(RevokeSigningKeyDocument, {client: apolloAdminClient,@@ -26,11 +26,12 @@ export const useRevokeSigningKey = (onSuccess?: () => void) => {awaitRefetchQueries: true,});- enqueueSuccessSnackBar({ message: t`Signing key revoked` });+ enqueueToast({ variant: 'success', children: t`Signing key revoked` });onSuccess?.();} catch (error) {- enqueueErrorSnackBar({- message: CombinedGraphQLErrors.is(error)+ enqueueToast({+ variant: 'error',+ children: CombinedGraphQLErrors.is(error)? getErrorMessageFromApolloError(error): t`Failed to revoke signing key. Please try again later.`,});diff --git a/packages/twenty-front/src/modules/settings/applications/hooks/__tests__/useUninstallApplication.test.tsx b/packages/twenty-front/src/modules/settings/applications/hooks/__tests__/useUninstallApplication.test.tsxindex f861562d0c9..ddd11475317 100644--- a/packages/twenty-front/src/modules/settings/applications/hooks/__tests__/useUninstallApplication.test.tsx+++ b/packages/twenty-front/src/modules/settings/applications/hooks/__tests__/useUninstallApplication.test.tsx@@ -15,14 +15,12 @@ import {const UNIVERSAL_IDENTIFIER = 'application-universal-identifier';const JOB_ID = `uninstall-application.workspace-id.${UNIVERSAL_IDENTIFIER}-5c98b035-5b09-4550-a4fb-b52056c494d1`;-const mockEnqueueErrorSnackBar = jest.fn();-const mockEnqueueSuccessSnackBar = jest.fn();--jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({- enqueueErrorSnackBar: mockEnqueueErrorSnackBar,- enqueueSuccessSnackBar: mockEnqueueSuccessSnackBar,- }),++const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));const triggerUninstallMock = {@@ -85,8 +83,9 @@ describe('useUninstallApplication', () => {});await waitFor(() => expect(result.current.isUninstalling).toBe(false));- expect(mockEnqueueSuccessSnackBar).toHaveBeenCalledWith({- message: 'Application successfully uninstalled.',+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'success',+ children: 'Application successfully uninstalled.',});expect(onCompleted).toHaveBeenCalledTimes(1);});@@ -117,8 +116,9 @@ describe('useUninstallApplication', () => {});await waitFor(() => expect(result.current.isUninstalling).toBe(false));- expect(mockEnqueueErrorSnackBar).toHaveBeenCalledWith({- message: 'This application cannot be uninstalled.',+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'This application cannot be uninstalled.',});});diff --git a/packages/twenty-front/src/modules/settings/applications/hooks/useUninstallApplication.ts b/packages/twenty-front/src/modules/settings/applications/hooks/useUninstallApplication.tsindex 8b7e4c7b296..c284ac1830e 100644--- a/packages/twenty-front/src/modules/settings/applications/hooks/useUninstallApplication.ts+++ b/packages/twenty-front/src/modules/settings/applications/hooks/useUninstallApplication.ts@@ -2,13 +2,13 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { useTrackedQueueJob } from '@/queue-job/hooks/useTrackedQueueJob';import { type TrackedJobStatus } from '@/queue-job/types/TrackedJobStatus';import { isTerminalJobState } from '@/queue-job/utils/isTerminalJobState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { useMutation, useQuery } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { isNonEmptyString } from '@sniptt/guards';import { useCallback } from 'react';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import {FindUninstallApplicationJobStatusDocument,JobState,@@ -24,7 +24,7 @@ export const useUninstallApplication = ({universalIdentifier,onCompleted,}: UseUninstallApplicationArgs = {}) => {- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [triggerUninstallApplicationJob, { loading: isTriggeringUninstall }] =useMutation(TriggerUninstallApplicationJobDocument);const setCurrentWorkspace = useSetAtomState(currentWorkspaceState);@@ -47,8 +47,9 @@ export const useUninstallApplication = ({const handleUninstallJobSettled = useCallback((jobStatus: TrackedJobStatus, trackedUninstallIdentifier: string) => {if (jobStatus.state === JobState.FAILED) {- enqueueErrorSnackBar({- message: isNonEmptyString(jobStatus.failedReason)+ enqueueToast({+ variant: 'error',+ children: isNonEmptyString(jobStatus.failedReason)? jobStatus.failedReason: t`Error uninstalling application.`,});@@ -69,17 +70,13 @@ export const useUninstallApplication = ({: currentWorkspace,);- enqueueSuccessSnackBar({- message: t`Application successfully uninstalled.`,+ enqueueToast({+ variant: 'success',+ children: t`Application successfully uninstalled.`,});onCompleted?.();},- [- enqueueErrorSnackBar,- enqueueSuccessSnackBar,- onCompleted,- setCurrentWorkspace,- ],+ [enqueueToast, onCompleted, setCurrentWorkspace],);const { activeJobId, trackJob } = useTrackedQueueJob({@@ -108,8 +105,9 @@ export const useUninstallApplication = ({} catch (error) {const graphqlMessage = error instanceof Error ? error.message : undefined;- enqueueErrorSnackBar({- message: graphqlMessage ?? t`Error uninstalling application.`,+ enqueueToast({+ variant: 'error',+ children: graphqlMessage ?? t`Error uninstalling application.`,});}};diff --git a/packages/twenty-front/src/modules/settings/billing/components/AddPaymentMethodForm.tsx b/packages/twenty-front/src/modules/settings/billing/components/AddPaymentMethodForm.tsxindex b6c3608bb98..9abd5b13cd2 100644--- a/packages/twenty-front/src/modules/settings/billing/components/AddPaymentMethodForm.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/AddPaymentMethodForm.tsx@@ -1,8 +1,8 @@import { currentUserState } from '@/auth/states/currentUserState';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { START_SUBSCRIPTION_AFTER_PAYMENT_METHOD_QUERY_PARAM } from '@/settings/billing/constants/StartSubscriptionAfterPaymentMethodQueryParam';import { useStripeAppearance } from '@/settings/billing/hooks/useStripeAppearance';import { useStripePromise } from '@/settings/billing/hooks/useStripePromise';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';@@ -17,7 +17,7 @@ import {import { useState } from 'react';import { useLocation } from 'react-router-dom';import { isDefined } from 'twenty-shared/utils';-import { Info } from 'twenty-ui/primitives/feedback';+import { Info, useToast } from 'twenty-ui/primitives/feedback';import { Button } from 'twenty-ui/primitives/input';import { themeCssVariables } from 'twenty-ui/theme-constants';import { CreateBillingPaymentMethodSetupIntentDocument } from '~/generated-metadata/graphql';@@ -44,7 +44,7 @@ const AddPaymentMethodFormContent = ({}: AddPaymentMethodFormContentProps) => {const stripe = useStripe();const elements = useElements();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [isSubmitting, setIsSubmitting] = useState(false);const location = useLocation();@@ -81,8 +81,9 @@ const AddPaymentMethodFormContent = ({try {const { error: submitError } = await elements.submit();if (isDefined(submitError)) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:submitError.message ??t`Your payment details are incomplete. Please review and retry.`,});@@ -95,8 +96,9 @@ const AddPaymentMethodFormContent = ({const clientSecret =data?.createBillingPaymentMethodSetupIntent?.clientSecret;if (!isDefined(clientSecret)) {- enqueueErrorSnackBar({- message: t`Subscription error. Please retry or contact Twenty team`,+ enqueueToast({+ variant: 'error',+ children: t`Subscription error. Please retry or contact Twenty team`,});setIsSubmitting(false);return;@@ -110,8 +112,9 @@ const AddPaymentMethodFormContent = ({});if (isDefined(error)) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:error.message ??t`We couldn't confirm your payment method. Please retry.`,});@@ -124,10 +127,11 @@ const AddPaymentMethodFormContent = ({}} catch (error) {if (CombinedGraphQLErrors.is(error)) {- enqueueErrorSnackBar({ apolloError: error });+ enqueueToast(getToastOptionsFromError({ error }));} else {- enqueueErrorSnackBar({- message: t`Subscription error. Please retry or contact Twenty team`,+ enqueueToast({+ variant: 'error',+ children: t`Subscription error. Please retry or contact Twenty team`,});}setIsSubmitting(false);diff --git a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitEditForm.tsx b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitEditForm.tsxindex 2028087e40d..59f660519ee 100644--- a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitEditForm.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitEditForm.tsx@@ -3,6 +3,7 @@ import { Trans, useLingui } from '@lingui/react/macro';import { useState } from 'react';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { IconTrash } from 'twenty-ui/icon';import { Button } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';@@ -20,7 +21,6 @@ import { buildUsageLimitFormValues } from '@/settings/billing/utils/buildUsageLiimport { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';import { useNavigateSettings } from '~/hooks/useNavigateSettings';@@ -38,7 +38,7 @@ export const SettingsBillingLimitEditForm = ({}: SettingsBillingLimitEditFormProps) => {const { t } = useLingui();const navigate = useNavigateSettings();- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { usageQuotaDefinitions, loading: definitionsLoading } =useUsageQuotaDefinitions();const { updateUsageLimit, loading: isSaving } = useUpdateUsageLimit();@@ -55,10 +55,13 @@ export const SettingsBillingLimitEditForm = ({const handleDelete = async () => {try {await deleteUsageLimit({ variables: { usageLimitId } });- enqueueSuccessSnackBar({ message: t`Limit deleted.` });+ enqueueToast({ variant: 'success', children: t`Limit deleted.` });navigate(SettingsPath.BillingLimits);} catch {- enqueueErrorSnackBar({ message: t`Failed to delete the limit.` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to delete the limit.`,+ });} finally {closeModal(DELETE_MODAL_ID);}@@ -74,7 +77,7 @@ export const SettingsBillingLimitEditForm = ({variables: { input: { id: usageLimitId, payload: input } },});- enqueueSuccessSnackBar({ message: t`Limit updated.` });+ enqueueToast({ variant: 'success', children: t`Limit updated.` });navigate(SettingsPath.BillingLimits);} catch (error) {const serverMessage =@@ -82,8 +85,9 @@ export const SettingsBillingLimitEditForm = ({? error.errors[0]?.message: undefined;- enqueueErrorSnackBar({- message: serverMessage ?? t`Failed to update the limit.`,+ enqueueToast({+ variant: 'error',+ children: serverMessage ?? t`Failed to update the limit.`,});}};diff --git a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingPageLayout.tsx b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingPageLayout.tsxindex 03f303cf004..081821917a0 100644--- a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingPageLayout.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingPageLayout.tsx@@ -1,10 +1,10 @@+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { Trans, useLingui } from '@lingui/react/macro';import { type ReactNode } from 'react';import { Navigate } from 'react-router-dom';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';-import { useSnackBarOnQueryError } from '@/apollo/hooks/useSnackBarOnQueryError';import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { billingState } from '@/client-config/states/billingState';import { SettingsBillingContentSkeleton } from '@/settings/billing/components/SettingsBillingContentSkeleton';@@ -35,34 +35,46 @@ export const SettingsBillingPageLayout = ({refetch: refetchPlans,} = usePlans({ skip: !isBillingEnabled });- useSnackBarOnQueryError(plansError, t`Failed to load billing plans`);-if (isBillingLoaded && !isBillingEnabled) {- return <Navigate to={getSettingsPath(SettingsPath.General)} replace />;+ return (+ <>+ <ToastOnQueryErrorEffect+ error={plansError}+ message={t`Failed to load billing plans`}+ />+ <Navigate to={getSettingsPath(SettingsPath.General)} replace />+ </>+ );}return (- <SettingsPageLayout- title={t`Billing`}- links={[- {- children: <Trans>Workspace</Trans>,- href: getSettingsPath(SettingsPath.General),- },- { children: <Trans>Billing</Trans> },- ]}- secondaryBar={<SettingsBillingTabBar />}- actionButton={actionButton}- >- {!isDefined(currentWorkspace) ||- !isBillingLoaded ||- (isBillingEnabled && arePlansLoading) ? (- <SettingsBillingContentSkeleton />- ) : isPlansLoaded ? (- children- ) : (- <SettingsBillingPlansErrorState onRetry={() => void refetchPlans()} />- )}- </SettingsPageLayout>+ <>+ <ToastOnQueryErrorEffect+ error={plansError}+ message={t`Failed to load billing plans`}+ />+ <SettingsPageLayout+ title={t`Billing`}+ links={[+ {+ children: <Trans>Workspace</Trans>,+ href: getSettingsPath(SettingsPath.General),+ },+ { children: <Trans>Billing</Trans> },+ ]}+ secondaryBar={<SettingsBillingTabBar />}+ actionButton={actionButton}+ >+ {!isDefined(currentWorkspace) ||+ !isBillingLoaded ||+ (isBillingEnabled && arePlansLoading) ? (+ <SettingsBillingContentSkeleton />+ ) : isPlansLoaded ? (+ children+ ) : (+ <SettingsBillingPlansErrorState onRetry={() => void refetchPlans()} />+ )}+ </SettingsPageLayout>+ </>);};diff --git a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingSubscriptionInfo.tsx b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingSubscriptionInfo.tsxindex e76d4ec53b3..5e4cb65ca1e 100644--- a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingSubscriptionInfo.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingSubscriptionInfo.tsx@@ -1,11 +1,10 @@-import { type CurrentWorkspace } from '@/auth/states/currentWorkspaceState';import { currentWorkspaceMembersState } from '@/auth/states/currentWorkspaceMembersState';--import { BILLING_MODAL_IDS } from '@/settings/billing/constants/BillingModalIds';+import { type CurrentWorkspace } from '@/auth/states/currentWorkspaceState';import { useNumberFormat } from '@/localization/hooks/useNumberFormat';import { SettingsBillingSubscriptionInfoCard } from '@/settings/billing/components/internal/SettingsBillingSubscriptionInfoCard';import { SettingsBillingSubscriptionInfoCardHeaderActions } from '@/settings/billing/components/internal/SettingsBillingSubscriptionInfoCardHeaderActions';import { SettingsBillingSubscriptionInfoModals } from '@/settings/billing/components/internal/SettingsBillingSubscriptionInfoModals';+import { BILLING_MODAL_IDS } from '@/settings/billing/constants/BillingModalIds';import { useApplyCurrentWorkspaceBillingUpdate } from '@/settings/billing/hooks/useApplyCurrentWorkspaceBillingUpdate';import { useBillingSubscriptionCost } from '@/settings/billing/hooks/useBillingSubscriptionCost';import { useBillingWording } from '@/settings/billing/hooks/useBillingWording';@@ -18,11 +17,10 @@ import { useNextBillingPhase } from '@/settings/billing/hooks/useNextBillingPhasimport { useNextPlan } from '@/settings/billing/hooks/useNextPlan';import { useSplitPhaseItemsInPrices } from '@/settings/billing/hooks/useSplitPhaseItemsInPrices';import { billingHasPaymentMethodSelector } from '@/settings/billing/states/billingHasPaymentMethodSelector';+import { isSubscriptionPaymentOverdue } from '@/settings/billing/utils/isSubscriptionPaymentOverdue';import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useModal } from '@/ui/layout/modal/hooks/useModal';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { isSubscriptionPaymentOverdue } from '@/settings/billing/utils/isSubscriptionPaymentOverdue';import { useSubscriptionStatus } from '@/workspace/hooks/useSubscriptionStatus';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';@@ -30,8 +28,8 @@ import { useLingui } from '@lingui/react/macro';import { useState } from 'react';import { isDefined } from 'twenty-shared/utils';import { IconClockPlay, IconCoins, IconTag } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';import { Section } from 'twenty-ui/primitives/layout';+import { H2Title } from 'twenty-ui/primitives/typography';import {BillingPlanKey,CancelSwitchBillingIntervalDocument,@@ -44,6 +42,8 @@ import {} from '~/generated-metadata/graphql';import { beautifyExactDate } from '~/utils/date-utils';+import { useToast } from 'twenty-ui/primitives/feedback';+export const SettingsBillingSubscriptionInfo = ({currentWorkspace,currentBillingSubscription,@@ -66,7 +66,7 @@ export const SettingsBillingSubscriptionInfo = ({const { openModal } = useModal();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { applyCurrentWorkspaceBillingUpdate } =useApplyCurrentWorkspaceBillingUpdate();@@ -374,11 +374,9 @@ export const SettingsBillingSubscriptionInfo = ({try {await action();- enqueueSuccessSnackBar({ message: getSuccessMessage() });+ enqueueToast({ variant: 'success', children: getSuccessMessage() });} catch (error) {- enqueueErrorSnackBar({- message: getErrorMessage(),- });+ enqueueToast({ variant: 'error', children: getErrorMessage() });if (!CombinedGraphQLErrors.is(error)) {throw error;diff --git a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingTrialNoPaymentMethodBanner.tsx b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingTrialNoPaymentMethodBanner.tsxindex cecb75f0fcb..303b5950754 100644--- a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingTrialNoPaymentMethodBanner.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingTrialNoPaymentMethodBanner.tsx@@ -1,6 +1,7 @@-import { useSnackBarOnQueryError } from '@/apollo/hooks/useSnackBarOnQueryError';+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { type CurrentWorkspace } from '@/auth/states/currentWorkspaceState';import { useRedirect } from '@/domain-manager/hooks/useRedirect';+import { getSubscriptionPlanKey } from '@/settings/billing/utils/getSubscriptionPlanKey';import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap';import { useQuery } from '@apollo/client/react';import { t } from '@lingui/core/macro';@@ -13,7 +14,6 @@ import {PermissionFlagType,} from '~/generated-metadata/graphql';import { formatDate } from '~/utils/date-utils';-import { getSubscriptionPlanKey } from '@/settings/billing/utils/getSubscriptionPlanKey';type SettingsBillingTrialNoPaymentMethodBannerProps = {currentBillingSubscription: NonNullable<@@ -37,8 +37,6 @@ export const SettingsBillingTrialNoPaymentMethodBanner = ({skip: !hasPermissionToManageBilling,});- useSnackBarOnQueryError(error);-const openPaymentMethodUpdate = () => {if (isDefined(data?.billingPortalSession.url)) {redirect(data.billingPortalSession.url);@@ -63,14 +61,17 @@ export const SettingsBillingTrialNoPaymentMethodBanner = ({: t`Trial ends soon. Please contact your admin to add card details to keep the ${planName}`;return (- <InlineBanner- color="blue"- message={message}- button={{- title: t`Add card`,- hidden: !hasPermissionToManageBilling,- onClick: openPaymentMethodUpdate,- }}- />+ <>+ <ToastOnQueryErrorEffect error={error} />+ <InlineBanner+ color="blue"+ message={message}+ button={{+ title: t`Add card`,+ hidden: !hasPermissionToManageBilling,+ onClick: openPaymentMethodUpdate,+ }}+ />+ </>);};diff --git a/packages/twenty-front/src/modules/settings/billing/components/UpdatePaymentMethodModal.tsx b/packages/twenty-front/src/modules/settings/billing/components/UpdatePaymentMethodModal.tsxindex 513c0b68c64..673a35e791c 100644--- a/packages/twenty-front/src/modules/settings/billing/components/UpdatePaymentMethodModal.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/UpdatePaymentMethodModal.tsx@@ -2,20 +2,20 @@ import { AddPaymentMethodForm } from '@/settings/billing/components/AddPaymentMeimport { useMarkBillingPaymentMethodAsAdded } from '@/settings/billing/hooks/useMarkBillingPaymentMethodAsAdded';import { useWaitForPaymentRecovery } from '@/settings/billing/hooks/useWaitForPaymentRecovery';import { isSubscriptionPaymentOverdue } from '@/settings/billing/utils/isSubscriptionPaymentOverdue';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { ModalStatefulWrapper } from '@/ui/layout/modal/components/ModalStatefulWrapper';import { useModal } from '@/ui/layout/modal/hooks/useModal';import { useSubscriptionStatus } from '@/workspace/hooks/useSubscriptionStatus';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';+import { useToast } from 'twenty-ui/primitives/feedback';import { Button } from 'twenty-ui/primitives/input';import {Section,SectionAlignment,SectionFontColor,} from 'twenty-ui/primitives/layout';-import { themeCssVariables } from 'twenty-ui/theme-constants';import { H1Title, H1TitleFontColor } from 'twenty-ui/primitives/typography';+import { themeCssVariables } from 'twenty-ui/theme-constants';type UpdatePaymentMethodModalProps = {modalInstanceId: string;@@ -38,7 +38,7 @@ export const UpdatePaymentMethodModal = ({}: UpdatePaymentMethodModalProps) => {const { t } = useLingui();const { closeModal } = useModal();- const { enqueueSuccessSnackBar, enqueueInfoSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const subscriptionStatus = useSubscriptionStatus();const { markBillingPaymentMethodAsAdded } =useMarkBillingPaymentMethodAsAdded();@@ -49,13 +49,14 @@ export const UpdatePaymentMethodModal = ({markBillingPaymentMethodAsAdded();if (!isSubscriptionPaymentOverdue(subscriptionStatus)) {- enqueueSuccessSnackBar({ message: t`Payment method added.` });+ enqueueToast({ variant: 'success', children: t`Payment method added.` });return;}- enqueueInfoSnackBar({- message: t`Payment method added. Retrying your payment...`,+ enqueueToast({+ variant: 'info',+ children: t`Payment method added. Retrying your payment...`,});await waitForPaymentRecovery();diff --git a/packages/twenty-front/src/modules/settings/billing/components/internal/ResourceCreditPriceSelector.tsx b/packages/twenty-front/src/modules/settings/billing/components/internal/ResourceCreditPriceSelector.tsxindex c77c365857c..c875c01aace 100644--- a/packages/twenty-front/src/modules/settings/billing/components/internal/ResourceCreditPriceSelector.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/internal/ResourceCreditPriceSelector.tsx@@ -1,3 +1,4 @@+import { useToast } from 'twenty-ui/primitives/feedback';import { useNumberFormat } from '@/localization/hooks/useNumberFormat';import { ResourceCreditPackagePickerModal } from '@/settings/billing/components/internal/ResourceCreditPackagePickerModal';import { BILLING_MODAL_IDS } from '@/settings/billing/constants/BillingModalIds';@@ -5,7 +6,6 @@ import { useApplyCurrentWorkspaceBillingUpdate } from '@/settings/billing/hooks/import { useBillingWording } from '@/settings/billing/hooks/useBillingWording';import { useCurrentResourceCredit } from '@/settings/billing/hooks/useCurrentResourceCredit';import { useGetResourceCreditUsage } from '@/settings/billing/hooks/useGetResourceCreditUsage';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';import { CombinedGraphQLErrors } from '@apollo/client/errors';@@ -87,7 +87,7 @@ export const ResourceCreditPriceSelector = ({const [selectedPriceId, setSelectedPriceId] = useState<string | undefined>();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [setResourceCreditPrice, { loading: isUpdating }] = useMutation(SetResourceCreditSubscriptionPriceDocument,@@ -309,10 +309,16 @@ export const ResourceCreditPriceSelector = ({onBillingUpdateApplied: refetchResourceCreditUsage,},);- enqueueSuccessSnackBar({ message: t`Resource credits updated.` });+ enqueueToast({+ variant: 'success',+ children: t`Resource credits updated.`,+ });setSelectedPriceId(undefined);} catch (error) {- enqueueErrorSnackBar({ message: t`Failed to update resource credits.` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to update resource credits.`,+ });if (!CombinedGraphQLErrors.is(error)) {throw error;diff --git a/packages/twenty-front/src/modules/settings/billing/effect-components/EndTrialAfterPaymentMethodEffect.tsx b/packages/twenty-front/src/modules/settings/billing/effect-components/EndTrialAfterPaymentMethodEffect.tsxindex d0ca0016672..e26b27f2662 100644--- a/packages/twenty-front/src/modules/settings/billing/effect-components/EndTrialAfterPaymentMethodEffect.tsx+++ b/packages/twenty-front/src/modules/settings/billing/effect-components/EndTrialAfterPaymentMethodEffect.tsx@@ -3,14 +3,14 @@ import { useOpenAskAiThread } from '@/ai/hooks/useOpenAskAiThread';import { START_SUBSCRIPTION_AFTER_PAYMENT_METHOD_QUERY_PARAM } from '@/settings/billing/constants/StartSubscriptionAfterPaymentMethodQueryParam';import { useEndSubscriptionTrialPeriod } from '@/settings/billing/hooks/useEndSubscriptionTrialPeriod';import { isEndingSubscriptionTrialPeriodState } from '@/settings/billing/states/isEndingSubscriptionTrialPeriodState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { useSubscriptionStatus } from '@/workspace/hooks/useSubscriptionStatus';-import { isNonEmptyString } from '@sniptt/guards';import { t } from '@lingui/core/macro';+import { isNonEmptyString } from '@sniptt/guards';import { useCallback, useEffect } from 'react';import { useLocation, useNavigate } from 'react-router-dom';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { SubscriptionStatus } from '~/generated-metadata/graphql';export const EndTrialAfterPaymentMethodEffect = () => {@@ -19,7 +19,7 @@ export const EndTrialAfterPaymentMethodEffect = () => {const subscriptionStatus = useSubscriptionStatus();const { endTrialPeriod } = useEndSubscriptionTrialPeriod();const { openAskAiThread } = useOpenAskAiThread();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const searchParams = new URLSearchParams(location.search);const askAiThreadId = searchParams.get(ASK_AI_THREAD_ID_QUERY_PARAM);@@ -59,8 +59,9 @@ export const EndTrialAfterPaymentMethodEffect = () => {openAskAiThread(askAiThreadId);}} else if (hasPaymentMethod === false) {- enqueueErrorSnackBar({- message: t`No payment method found. Please update your billing details.`,+ enqueueToast({+ variant: 'error',+ children: t`No payment method found. Please update your billing details.`,});}} finally {@@ -71,7 +72,7 @@ export const EndTrialAfterPaymentMethodEffect = () => {askAiThreadId,cleanUpQueryParams,endTrialPeriod,- enqueueErrorSnackBar,+ enqueueToast,openAskAiThread,subscriptionStatus,]);diff --git a/packages/twenty-front/src/modules/settings/billing/hooks/useBillingPortalSession.ts b/packages/twenty-front/src/modules/settings/billing/hooks/useBillingPortalSession.tsindex 12c62feb304..d9f0c257ce1 100644--- a/packages/twenty-front/src/modules/settings/billing/hooks/useBillingPortalSession.ts+++ b/packages/twenty-front/src/modules/settings/billing/hooks/useBillingPortalSession.ts@@ -1,17 +1,17 @@import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { useRedirect } from '@/domain-manager/hooks/useRedirect';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useLazyQuery } from '@apollo/client/react';import { useLingui } from '@lingui/react/macro';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { BillingPortalSessionDocument } from '~/generated-metadata/graphql';export const useBillingPortalSession = (returnUrlPath: string) => {const { t } = useLingui();const currentWorkspace = useAtomStateValue(currentWorkspaceState);const { redirect } = useRedirect();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const hasSubscriptions =(currentWorkspace?.billingSubscriptions.length ?? 0) > 0;@@ -24,8 +24,9 @@ export const useBillingPortalSession = (returnUrlPath: string) => {);const showBillingPortalSessionError = () => {- enqueueErrorSnackBar({- message: t`Billing portal session error. Please retry or contact Twenty team`,+ enqueueToast({+ variant: 'error',+ children: t`Billing portal session error. Please retry or contact Twenty team`,});};diff --git a/packages/twenty-front/src/modules/settings/billing/hooks/useCreditUpgradeAction.ts b/packages/twenty-front/src/modules/settings/billing/hooks/useCreditUpgradeAction.tsindex 6c0fe23a40c..ebedb0f93a5 100644--- a/packages/twenty-front/src/modules/settings/billing/hooks/useCreditUpgradeAction.ts+++ b/packages/twenty-front/src/modules/settings/billing/hooks/useCreditUpgradeAction.ts@@ -1,11 +1,11 @@import { useNumberFormat } from '@/localization/hooks/useNumberFormat';import { useApplyCurrentWorkspaceBillingUpdate } from '@/settings/billing/hooks/useApplyCurrentWorkspaceBillingUpdate';import { useGetNextResourceCreditPrice } from '@/settings/billing/hooks/useGetNextResourceCreditPrice';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import {SetResourceCreditSubscriptionPriceDocument,SubscriptionInterval,@@ -14,8 +14,7 @@ import {export const useCreditUpgradeAction = () => {const nextPrice = useGetNextResourceCreditPrice();const { formatNumber } = useNumberFormat();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar, enqueueInfoSnackBar } =- useSnackBar();+ const { enqueueToast } = useToast();const { applyCurrentWorkspaceBillingUpdate } =useApplyCurrentWorkspaceBillingUpdate();@@ -46,9 +45,7 @@ export const useCreditUpgradeAction = () => {}try {- enqueueInfoSnackBar({- message: t`Upgrading subscription...`,- });+ enqueueToast({ variant: 'info', children: t`Upgrading subscription...` });const { data } = await setResourceCreditSubscriptionPrice({variables: { priceId: nextPrice.stripePriceId },@@ -72,9 +69,12 @@ export const useCreditUpgradeAction = () => {},);- enqueueSuccessSnackBar({ message: t`Credit plan upgraded.` });+ enqueueToast({ variant: 'success', children: t`Credit plan upgraded.` });} catch (error) {- enqueueErrorSnackBar({ message: t`Failed to upgrade credit plan.` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to upgrade credit plan.`,+ });if (!CombinedGraphQLErrors.is(error)) {throw error;diff --git a/packages/twenty-front/src/modules/settings/billing/hooks/useEndSubscriptionTrialPeriod.ts b/packages/twenty-front/src/modules/settings/billing/hooks/useEndSubscriptionTrialPeriod.tsindex e8a82bb06de..8b4f40b0e18 100644--- a/packages/twenty-front/src/modules/settings/billing/hooks/useEndSubscriptionTrialPeriod.ts+++ b/packages/twenty-front/src/modules/settings/billing/hooks/useEndSubscriptionTrialPeriod.ts@@ -3,12 +3,12 @@ import { useRedirect } from '@/domain-manager/hooks/useRedirect';import { START_SUBSCRIPTION_AFTER_PAYMENT_METHOD_QUERY_PARAM } from '@/settings/billing/constants/StartSubscriptionAfterPaymentMethodQueryParam';import { useApplyCurrentWorkspaceBillingUpdate } from '@/settings/billing/hooks/useApplyCurrentWorkspaceBillingUpdate';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useLazyQuery, useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { useState } from 'react';import { useLocation } from 'react-router-dom';import { isDefined } from 'twenty-shared/utils';-import { useLazyQuery, useMutation } from '@apollo/client/react';+import { useToast } from 'twenty-ui/primitives/feedback';import {BillingPortalSessionDocument,EndSubscriptionTrialPeriodDocument,@@ -16,8 +16,7 @@ import {} from '~/generated-metadata/graphql';export const useEndSubscriptionTrialPeriod = () => {- const { enqueueSuccessSnackBar, enqueueErrorSnackBar, enqueueInfoSnackBar } =- useSnackBar();+ const { enqueueToast } = useToast();const [endSubscriptionTrialPeriod] = useMutation(EndSubscriptionTrialPeriodDocument,{@@ -66,8 +65,9 @@ export const useEndSubscriptionTrialPeriod = () => {}}- enqueueErrorSnackBar({- message: t`No payment method found. Please update your billing details.`,+ enqueueToast({+ variant: 'error',+ children: t`No payment method found. Please update your billing details.`,});};@@ -79,8 +79,9 @@ export const useEndSubscriptionTrialPeriod = () => {setIsLoading(true);if (options?.skipPaymentMethodRedirect === true) {- enqueueInfoSnackBar({- message: t`Activating subscription...`,+ enqueueToast({+ variant: 'info',+ children: t`Activating subscription...`,});}@@ -152,14 +153,16 @@ export const useEndSubscriptionTrialPeriod = () => {: previousWorkspace,);- enqueueSuccessSnackBar({- message: t`Subscription activated.`,+ enqueueToast({+ variant: 'success',+ children: t`Subscription activated.`,});return { success: true, hasPaymentMethod: true };} catch {- enqueueErrorSnackBar({- message: t`Error while ending trial period. Please contact Twenty team.`,+ enqueueToast({+ variant: 'error',+ children: t`Error while ending trial period. Please contact Twenty team.`,});return { success: false };} finally {diff --git a/packages/twenty-front/src/modules/settings/billing/hooks/useHandleCheckoutSession.ts b/packages/twenty-front/src/modules/settings/billing/hooks/useHandleCheckoutSession.tsindex d7bb7aaf452..8836f88666e 100644--- a/packages/twenty-front/src/modules/settings/billing/hooks/useHandleCheckoutSession.ts+++ b/packages/twenty-front/src/modules/settings/billing/hooks/useHandleCheckoutSession.ts@@ -1,8 +1,8 @@import { useRedirect } from '@/domain-manager/hooks/useRedirect';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { useState } from 'react';-import { useMutation } from '@apollo/client/react';+import { useToast } from 'twenty-ui/primitives/feedback';import {type BillingPlanKey,type SubscriptionInterval,@@ -22,7 +22,7 @@ export const useHandleCheckoutSession = ({}) => {const { redirect } = useRedirect();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [checkoutSession] = useMutation(CheckoutSessionDocument);@@ -40,15 +40,17 @@ export const useHandleCheckoutSession = ({},});if (!data?.checkoutSession.url) {- enqueueErrorSnackBar({- message: t`Checkout session error. Please retry or contact Twenty team`,+ enqueueToast({+ variant: 'error',+ children: t`Checkout session error. Please retry or contact Twenty team`,});return;}redirect(data.checkoutSession.url);} catch {- enqueueErrorSnackBar({- message: t`Checkout session error. Please retry or contact Twenty team`,+ enqueueToast({+ variant: 'error',+ children: t`Checkout session error. Please retry or contact Twenty team`,});} finally {setIsSubmitting(false);diff --git a/packages/twenty-front/src/modules/settings/billing/hooks/useSubmitSubscriptionPayment.ts b/packages/twenty-front/src/modules/settings/billing/hooks/useSubmitSubscriptionPayment.tsindex 403d3da949b..f2602a5e131 100644--- a/packages/twenty-front/src/modules/settings/billing/hooks/useSubmitSubscriptionPayment.ts+++ b/packages/twenty-front/src/modules/settings/billing/hooks/useSubmitSubscriptionPayment.ts@@ -1,4 +1,4 @@-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';@@ -6,6 +6,7 @@ import { useElements, useStripe } from '@stripe/react-stripe-js';import { useState } from 'react';import { AppPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import {type BillingPlanKey,type SubscriptionInterval,@@ -23,7 +24,7 @@ export const useSubmitSubscriptionPayment = ({}: UseSubmitSubscriptionPaymentParams) => {const stripe = useStripe();const elements = useElements();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [isSubmitting, setIsSubmitting] = useState(false);const [createSubscriptionPaymentIntent] = useMutation(@@ -42,8 +43,9 @@ export const useSubmitSubscriptionPayment = ({try {const { error: submitError } = await elements.submit();if (isDefined(submitError)) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:submitError.message ??t`Your payment details are incomplete. Please review and retry.`,});@@ -58,8 +60,9 @@ export const useSubmitSubscriptionPayment = ({const paymentIntent = data?.createSubscriptionPaymentIntent;if (!isDefined(paymentIntent?.clientSecret)) {- enqueueErrorSnackBar({- message: t`Subscription error. Please retry or contact Twenty team`,+ enqueueToast({+ variant: 'error',+ children: t`Subscription error. Please retry or contact Twenty team`,});setIsSubmitting(false);return;@@ -84,8 +87,9 @@ export const useSubmitSubscriptionPayment = ({});if (isDefined(error)) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:error.message ??t`We couldn't confirm your payment method. Please retry.`,});@@ -93,10 +97,11 @@ export const useSubmitSubscriptionPayment = ({}} catch (error) {if (CombinedGraphQLErrors.is(error)) {- enqueueErrorSnackBar({ apolloError: error });+ enqueueToast(getToastOptionsFromError({ error }));} else {- enqueueErrorSnackBar({- message: t`Subscription error. Please retry or contact Twenty team`,+ enqueueToast({+ variant: 'error',+ children: t`Subscription error. Please retry or contact Twenty team`,});}setIsSubmitting(false);diff --git a/packages/twenty-front/src/modules/settings/billing/hooks/useSwitchBillingPlan.ts b/packages/twenty-front/src/modules/settings/billing/hooks/useSwitchBillingPlan.tsindex 1e2049bba57..66713ecc4ed 100644--- a/packages/twenty-front/src/modules/settings/billing/hooks/useSwitchBillingPlan.ts+++ b/packages/twenty-front/src/modules/settings/billing/hooks/useSwitchBillingPlan.ts@@ -1,11 +1,11 @@import { useApplyCurrentWorkspaceBillingUpdate } from '@/settings/billing/hooks/useApplyCurrentWorkspaceBillingUpdate';import { useBillingWording } from '@/settings/billing/hooks/useBillingWording';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useSubscriptionStatus } from '@/workspace/hooks/useSubscriptionStatus';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { useLingui } from '@lingui/react/macro';import { useState } from 'react';+import { useToast } from 'twenty-ui/primitives/feedback';import {BillingPlanKey,SubscriptionStatus,@@ -15,7 +15,7 @@ import {export const useSwitchBillingPlan = () => {const { t } = useLingui();const subscriptionStatus = useSubscriptionStatus();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { applyCurrentWorkspaceBillingUpdate } =useApplyCurrentWorkspaceBillingUpdate();const { getBeautifiedRenewDate } = useBillingWording();@@ -46,18 +46,21 @@ export const useSwitchBillingPlan = () => {);if (!isBillingUpdateApplied) {- enqueueErrorSnackBar({- message: t`Error while switching subscription.`,+ enqueueToast({+ variant: 'error',+ children: t`Error while switching subscription.`,});return;}- enqueueSuccessSnackBar({- message: getSuccessMessage(targetPlanKey),+ enqueueToast({+ variant: 'success',+ children: getSuccessMessage(targetPlanKey),});} catch (error) {- enqueueErrorSnackBar({- message: t`Error while switching subscription.`,+ enqueueToast({+ variant: 'error',+ children: t`Error while switching subscription.`,});if (!CombinedGraphQLErrors.is(error)) {diff --git a/packages/twenty-front/src/modules/settings/billing/hooks/useWaitForPaymentRecovery.ts b/packages/twenty-front/src/modules/settings/billing/hooks/useWaitForPaymentRecovery.tsxsimilarity index 81%rename from packages/twenty-front/src/modules/settings/billing/hooks/useWaitForPaymentRecovery.tsrename to packages/twenty-front/src/modules/settings/billing/hooks/useWaitForPaymentRecovery.tsxindex 8fe3029dc60..643d0901ffe 100644--- a/packages/twenty-front/src/modules/settings/billing/hooks/useWaitForPaymentRecovery.ts+++ b/packages/twenty-front/src/modules/settings/billing/hooks/useWaitForPaymentRecovery.tsx@@ -3,12 +3,13 @@ import { PAYMENT_RECOVERY_POLLING_MAX_ATTEMPTS } from '@/settings/billing/constaimport { useApplyCurrentWorkspaceBillingUpdate } from '@/settings/billing/hooks/useApplyCurrentWorkspaceBillingUpdate';import { useMarkBillingPaymentMethodAsAdded } from '@/settings/billing/hooks/useMarkBillingPaymentMethodAsAdded';import { waitForSubscriptionRecovery } from '@/settings/billing/utils/waitForSubscriptionRecovery';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useLoadCurrentUser } from '@/users/hooks/useLoadCurrentUser';import { useApolloClient } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';+import { Button } from 'twenty-ui/primitives/input';import { GetCurrentUserDocument } from '~/generated-metadata/graphql';import { logError } from '~/utils/logError';import { sleep } from '~/utils/sleep';@@ -20,7 +21,7 @@ export const useWaitForPaymentRecovery = () => {useApplyCurrentWorkspaceBillingUpdate();const { markBillingPaymentMethodAsAdded } =useMarkBillingPaymentMethodAsAdded();- const { enqueueSuccessSnackBar, enqueueWarningSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const fetchWorkspaceBilling = async () => {const { data } = await client.query({@@ -44,12 +45,18 @@ export const useWaitForPaymentRecovery = () => {});if (recovery.outcome !== 'recovered') {- enqueueWarningSnackBar({- message: t`Your card was saved, but the payment still needs attention.`,- options: {- buttonLabel: t`Go to billing`,- buttonTo: getSettingsPath(SettingsPath.Billing),- },+ enqueueToast({+ variant: 'warning',+ children: t`Your card was saved, but the payment still needs attention.`,+ action: (+ <Button+ title={t`Go to billing`}+ ariaLabel={t`Go to billing`}+ to={getSettingsPath(SettingsPath.Billing)}+ variant="tertiary"+ size="small"+ />+ ),});return;@@ -72,7 +79,7 @@ export const useWaitForPaymentRecovery = () => {// The payment method webhook can still be in flightmarkBillingPaymentMethodAsAdded();- enqueueSuccessSnackBar({ message: t`Payment successful.` });+ enqueueToast({ variant: 'success', children: t`Payment successful.` });};return { waitForPaymentRecovery };diff --git a/packages/twenty-front/src/modules/settings/config-variables/components/ConfigVariableEdit.tsx b/packages/twenty-front/src/modules/settings/config-variables/components/ConfigVariableEdit.tsxindex 6f1fddacecb..afd8b0ec9a1 100644--- a/packages/twenty-front/src/modules/settings/config-variables/components/ConfigVariableEdit.tsx+++ b/packages/twenty-front/src/modules/settings/config-variables/components/ConfigVariableEdit.tsx@@ -1,15 +1,15 @@+import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';+import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';+import { useModal } from '@/ui/layout/modal/hooks/useModal';import { styled } from '@linaria/react';+import { useLingui } from '@lingui/react/macro';+import { type Dispatch, type SetStateAction, useState } from 'react';import { IconCheck, IconPencil, IconX } from 'twenty-ui/icon';-import { H3Title } from 'twenty-ui/primitives/typography';+import { useToast } from 'twenty-ui/primitives/feedback';import { Button } from 'twenty-ui/primitives/input';-import { themeCssVariables } from 'twenty-ui/theme-constants';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useLingui } from '@lingui/react/macro';import { Section } from 'twenty-ui/primitives/layout';-import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';-import { type Dispatch, type SetStateAction, useState } from 'react';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { H3Title } from 'twenty-ui/primitives/typography';+import { themeCssVariables } from 'twenty-ui/theme-constants';const RESET_VARIABLE_MODAL_ID ='reset-application-registration-config-variable-modal';@@ -62,7 +62,7 @@ export const ConfigVariableEdit = ({const { openModal } = useModal();- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [isSubmitting, setIsSubmitting] = useState(false);@@ -70,13 +70,12 @@ export const ConfigVariableEdit = ({try {setIsSubmitting(true);await onSave?.();- enqueueSuccessSnackBar({- message: t`Variable ${title} updated`,+ enqueueToast({+ variant: 'success',+ children: t`Variable ${title} updated`,});} catch {- enqueueErrorSnackBar({- message: t`Error updating variable`,- });+ enqueueToast({ variant: 'error', children: t`Error updating variable` });} finally {setIsSubmitting(false);setIsEditing(false);@@ -87,13 +86,12 @@ export const ConfigVariableEdit = ({try {setIsSubmitting(true);await onConfirmReset?.();- enqueueSuccessSnackBar({- message: t`Variable ${title} reset`,+ enqueueToast({+ variant: 'success',+ children: t`Variable ${title} reset`,});} catch {- enqueueErrorSnackBar({- message: t`Error resetting variable`,- });+ enqueueToast({ variant: 'error', children: t`Error resetting variable` });} finally {setIsSubmitting(false);setIsEditing(false);diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/__stories__/SettingsDataModelFieldSettingsFormCard.stories.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/__stories__/SettingsDataModelFieldSettingsFormCard.stories.tsxindex 2d2f61c989c..5926e4bed3c 100644--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/__stories__/SettingsDataModelFieldSettingsFormCard.stories.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/__stories__/SettingsDataModelFieldSettingsFormCard.stories.tsx@@ -5,7 +5,7 @@ import { FieldMetadataType } from '~/generated-metadata/graphql';import { FormProviderDecorator } from '~/testing/decorators/FormProviderDecorator';import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';import { SettingsDataModelFieldSettingsFormCard } from '@/settings/data-model/fields/forms/components/SettingsDataModelFieldSettingsFormCard';@@ -33,7 +33,7 @@ const meta: Meta<typeof SettingsDataModelFieldSettingsFormCard> = {MemoryRouterDecorator,ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,FormProviderDecorator,],args: {diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/__stories__/SettingsDataModelFieldPreviewWidget.stories.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/__stories__/SettingsDataModelFieldPreviewWidget.stories.tsxindex 3795d825766..12c01cb6a5e 100644--- a/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/__stories__/SettingsDataModelFieldPreviewWidget.stories.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/__stories__/SettingsDataModelFieldPreviewWidget.stories.tsx@@ -7,7 +7,7 @@ import { SettingsDataModelFieldPreviewWidget } from '@/settings/data-model/fieldimport { ComponentDecorator } from 'twenty-ui/testing';import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { getMockFieldMetadataItemOrThrow } from '~/testing/utils/getMockFieldMetadataItemOrThrow';import { getMockObjectMetadataItemOrThrow } from '~/testing/utils/getMockObjectMetadataItemOrThrow';@@ -28,7 +28,7 @@ const meta: Meta<typeof SettingsDataModelFieldPreviewWidget> = {MemoryRouterDecorator,ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,],args: {objectNameSingular: mockedPersonObjectMetadataItem.nameSingular,diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/ObjectSettings.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/ObjectSettings.tsxindex dc4f135ed83..ab9cd5c597f 100644--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/ObjectSettings.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/ObjectSettings.tsx@@ -1,9 +1,8 @@-import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';-+import { isDDLLockedState } from '@/client-config/states/isDDLLockedState';import { useDeleteOneObjectMetadataItem } from '@/object-metadata/hooks/useDeleteOneObjectMetadataItem';import { useGetIsMetadataItemCustom } from '@/object-metadata/hooks/useGetIsMetadataItemCustom';import { useUpdateOneObjectMetadataItem } from '@/object-metadata/hooks/useUpdateOneObjectMetadataItem';-import { isDDLLockedState } from '@/client-config/states/isDDLLockedState';+import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';import { isObjectMetadataReadOnly } from '@/object-record/read-only/utils/isObjectMetadataReadOnly';import { AdvancedSettingsWrapper } from '@/settings/components/AdvancedSettingsWrapper';import { SettingsUpdateDataModelObjectAboutForm } from '@/settings/data-model/object-details/components/SettingsUpdateDataModelObjectAboutForm';@@ -11,20 +10,21 @@ import { SettingsObjectIndexesSection } from '@/settings/data-model/object-detaiimport { SettingsObjectSearchSection } from '@/settings/data-model/object-details/components/tabs/SettingsObjectSearchSection';import { SettingsDataModelObjectSettingsFormCard } from '@/settings/data-model/objects/forms/components/SettingsDataModelObjectSettingsFormCard';import { SettingsTranslationsButton } from '@/settings/translations/components/SettingsTranslationsButton';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';-import { styled } from '@linaria/react';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { SettingsPath } from 'twenty-shared/types';import { IconArchive, IconTrash } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';import { Button } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';+import { H2Title } from 'twenty-ui/primitives/typography';import { themeCssVariables } from 'twenty-ui/theme-constants';import { useNavigateSettings } from '~/hooks/useNavigateSettings';+import { useToast } from 'twenty-ui/primitives/feedback';+type ObjectSettingsProps = {objectMetadataItem: EnrichedObjectMetadataItem;isDeleting: boolean;@@ -60,7 +60,7 @@ export const ObjectSettings = ({const getIsMetadataItemCustom = useGetIsMetadataItemCustom();const { updateOneObjectMetadataItem } = useUpdateOneObjectMetadataItem();const { deleteOneObjectMetadataItem } = useDeleteOneObjectMetadataItem();- const { enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { openModal, closeModal } = useModal();const isDDLLocked = useAtomStateValue(isDDLLockedState);@@ -88,9 +88,7 @@ export const ObjectSettings = ({const result = await deleteOneObjectMetadataItem(objectMetadataItem.id);if (result.status === 'successful') {- enqueueSuccessSnackBar({- message: t`Object deleted`,- });+ enqueueToast({ variant: 'success', children: t`Object deleted` });closeModal(DELETE_OBJECT_MODAL_ID);navigate(SettingsPath.Objects);return;diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectIndexesSection.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectIndexesSection.tsxindex 5e14793b2ad..05022eb6805 100644--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectIndexesSection.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectIndexesSection.tsx@@ -4,7 +4,6 @@ import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/Enricheimport { getCompositeSubFieldLabel } from '@/object-record/object-filter-dropdown/utils/getCompositeSubFieldLabel';import { type CompositeFieldSubFieldName } from '@/settings/data-model/types/CompositeFieldSubFieldName';import { type CompositeFieldType } from '@/settings/data-model/types/CompositeFieldType';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';@@ -17,6 +16,7 @@ import { type ReactNode, useMemo, useState } from 'react';import { MAX_CUSTOM_INDEXES_PER_OBJECT } from 'twenty-shared/constants';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { IconEyeOff, IconPlus } from 'twenty-ui/icon';import { Button, SearchInput } from 'twenty-ui/primitives/input';import {@@ -55,7 +55,7 @@ export const SettingsObjectIndexesSection = ({}: SettingsObjectIndexesSectionProps) => {const { t } = useLingui();const { openModal, closeModal } = useModal();- const { enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { deleteOneIndexMetadataItem } = useDeleteOneIndexMetadataItem();const { objectMetadataItems } = useObjectMetadataItems();@@ -156,7 +156,7 @@ export const SettingsObjectIndexesSection = ({closeModal(DELETE_INDEX_MODAL_ID);if (result.status === 'successful') {- enqueueSuccessSnackBar({ message: t`Index deleted` });+ enqueueToast({ variant: 'success', children: t`Index deleted` });setPendingDelete(null);}};diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectSearchSection.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectSearchSection.tsxindex 85d98b02d39..b9f85e04769 100644--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectSearchSection.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectSearchSection.tsx@@ -3,10 +3,11 @@ import { useUpdateOneObjectMetadataItem } from '@/object-metadata/hooks/useUpdatimport { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';import { SEARCH_VECTOR_FIELD_NAME } from '@/object-record/constants/SearchVectorFieldName';import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';+import { SettingsObjectFieldDataType } from '@/settings/data-model/object-details/components/SettingsObjectFieldDataType';import { canBeSearchable } from '@/settings/data-model/fields/forms/utils/canBeSearchable';+import { type SettingsFieldType } from '@/settings/data-model/types/SettingsFieldType';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';@@ -20,6 +21,7 @@ import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { useContext, useMemo, useState } from 'react';+import { useToast } from 'twenty-ui/primitives/feedback';import { FeatureFlagKey } from '~/generated-metadata/graphql';import {@@ -111,7 +113,7 @@ export const SettingsObjectSearchSection = ({const { updateOneObjectMetadataItem } = useUpdateOneObjectMetadataItem();const { updateOneFieldMetadataItem } = useUpdateOneFieldMetadataItem();const { closeDropdown } = useCloseDropdown();- const { enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const isConfigurableSearchFieldsEnabled = useIsFeatureEnabled(FeatureFlagKey.IS_CONFIGURABLE_SEARCH_FIELDS_ENABLED,@@ -173,8 +175,9 @@ export const SettingsObjectSearchSection = ({});if (result.status === 'successful') {- enqueueSuccessSnackBar({- message: value+ enqueueToast({+ variant: 'success',+ children: value? t`Field added to search`: t`Field removed from search`,});diff --git a/packages/twenty-front/src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx b/packages/twenty-front/src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsxindex 60a5e94501c..96c9545ba1a 100644--- a/packages/twenty-front/src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx+++ b/packages/twenty-front/src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx@@ -1,3 +1,4 @@+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { Controller, FormProvider } from 'react-hook-form';import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';@@ -64,7 +65,15 @@ export const SettingsDevelopersWebhookForm = ({};if ((loading && !isCreationMode) || isDefined(error)) {- return <SettingsSkeletonLoader />;+ return (+ <>+ <ToastOnQueryErrorEffect+ error={error}+ message={t`Failed to load webhook`}+ />+ <SettingsSkeletonLoader />+ </>+ );}const descriptionTextAreaId = `${webhookId}-description`;diff --git a/packages/twenty-front/src/modules/settings/developers/components/__stories__/ApiKeyInput.stories.tsx b/packages/twenty-front/src/modules/settings/developers/components/__stories__/ApiKeyInput.stories.tsxindex 3c704b8e225..d1a0ea4ea9e 100644--- a/packages/twenty-front/src/modules/settings/developers/components/__stories__/ApiKeyInput.stories.tsx+++ b/packages/twenty-front/src/modules/settings/developers/components/__stories__/ApiKeyInput.stories.tsx@@ -2,12 +2,12 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';import { ApiKeyInput } from '@/settings/developers/components/ApiKeyInput';import { ComponentDecorator } from 'twenty-ui/testing';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const meta: Meta<typeof ApiKeyInput> = {title: 'Modules/Settings/Developers/ApiKeys/ApiKeyInput',component: ApiKeyInput,- decorators: [ComponentDecorator, SnackBarDecorator],+ decorators: [ComponentDecorator, ToastDecorator],args: {apiKey:'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ0d2VudHktN2VkOWQyMTItMWMyNS00ZDAyLWJmMjUtNmFlY2NmN2VhNDE5IiwiaWF0IjoxNjk4MTQyODgyLCJleHAiOjE2OTk0MDE1OTksImp0aSI6ImMyMmFiNjQxLTVhOGYtNGQwMC1iMDkzLTk3MzUwYTM2YzZkOSJ9.JIe2TX5IXrdNl3n-kRFp3jyfNUE7unzXZLAzm2Gxl98',diff --git a/packages/twenty-front/src/modules/settings/developers/components/__stories__/SettingsDevelopersWebhookForm.stories.tsx b/packages/twenty-front/src/modules/settings/developers/components/__stories__/SettingsDevelopersWebhookForm.stories.tsxindex 65d94239dd1..c2660dc7dfa 100644--- a/packages/twenty-front/src/modules/settings/developers/components/__stories__/SettingsDevelopersWebhookForm.stories.tsx+++ b/packages/twenty-front/src/modules/settings/developers/components/__stories__/SettingsDevelopersWebhookForm.stories.tsx@@ -1,11 +1,13 @@import { type Meta, type StoryObj } from '@storybook/react-vite';+import { HttpResponse, graphql } from 'msw';import { expect, within } from 'storybook/test';import { SettingsDevelopersWebhookForm } from '@/settings/developers/components/SettingsDevelopersWebhookForm';import { WebhookFormMode } from '@/settings/developers/constants/WebhookFormMode';+import { Toaster } from 'twenty-ui/primitives/feedback';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';@@ -16,7 +18,7 @@ const meta: Meta<typeof SettingsDevelopersWebhookForm> = {ComponentDecorator,RouterDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,],parameters: {msw: graphqlMocks,@@ -25,7 +27,7 @@ const meta: Meta<typeof SettingsDevelopersWebhookForm> = {export default meta;-export type Story = StoryObj<typeof SettingsDevelopersWebhookForm>;+type Story = StoryObj<typeof SettingsDevelopersWebhookForm>;export const CreateMode: Story = {args: {@@ -66,3 +68,38 @@ export const EditMode: Story = {await canvas.findByText('Delete this webhook');},};++export const QueryError: Story = {+ args: {+ mode: WebhookFormMode.Edit,+ webhookId: 'unavailable-webhook',+ },+ decorators: [+ (Story) => (+ <>+ <Story />+ <Toaster getToastProps={() => ({ progress: 100 })} />+ </>+ ),+ ],+ parameters: {+ msw: {+ handlers: [+ graphql.query('GetWebhook', () =>+ HttpResponse.json({+ errors: [{ message: 'Connection lost' }],+ }),+ ),+ ...graphqlMocks.handlers,+ ],+ },+ },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement.ownerDocument.body);+ const toast = await canvas.findByRole('status');++ expect(toast).toHaveTextContent('Failed to load webhook');+ expect(canvas.getAllByRole('status')).toHaveLength(1);+ expect(canvas.queryByText('Connection lost')).not.toBeInTheDocument();+ },+};diff --git a/packages/twenty-front/src/modules/settings/developers/hooks/__tests__/useWebhookForm.test.tsx b/packages/twenty-front/src/modules/settings/developers/hooks/__tests__/useWebhookForm.test.tsxindex 52c12f96e58..8cc5273765f 100644--- a/packages/twenty-front/src/modules/settings/developers/hooks/__tests__/useWebhookForm.test.tsx+++ b/packages/twenty-front/src/modules/settings/developers/hooks/__tests__/useWebhookForm.test.tsx@@ -13,18 +13,16 @@ import { useWebhookForm } from '@/settings/developers/hooks/useWebhookForm';import { WEBHOOK_EMPTY_OPERATION } from '~/pages/settings/developers/webhooks/constants/WebhookEmptyOperation';const mockNavigateSettings = jest.fn();-const mockEnqueueSuccessSnackBar = jest.fn();-const mockEnqueueErrorSnackBar = jest.fn();jest.mock('~/hooks/useNavigateSettings', () => ({useNavigateSettings: () => mockNavigateSettings,}));-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({- enqueueSuccessSnackBar: mockEnqueueSuccessSnackBar,- enqueueErrorSnackBar: mockEnqueueErrorSnackBar,- }),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));const createMockWebhookData = (overrides = {}) => ({@@ -173,8 +171,9 @@ describe('useWebhookForm', () => {await result.current.handleSave(formData);});- expect(mockEnqueueSuccessSnackBar).toHaveBeenCalledWith({- message: 'Webhook https://test.com/webhook created successfully',+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'success',+ children: 'Webhook https://test.com/webhook created successfully',});});@@ -218,8 +217,9 @@ describe('useWebhookForm', () => {await result.current.handleSave(formData);});- expect(mockEnqueueErrorSnackBar).toHaveBeenCalledWith({- apolloError: expect.any(Error),+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'An error occurred.',});});@@ -255,8 +255,9 @@ describe('useWebhookForm', () => {await result.current.handleSave(formData);});- expect(mockEnqueueSuccessSnackBar).toHaveBeenCalledWith({- message: 'Webhook https://test.com/webhook created successfully',+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'success',+ children: 'Webhook https://test.com/webhook created successfully',});});});@@ -313,8 +314,9 @@ describe('useWebhookForm', () => {await result.current.handleSave(formData);});- expect(mockEnqueueSuccessSnackBar).toHaveBeenCalledWith({- message: 'Webhook https://updated.com/webhook updated successfully',+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'success',+ children: 'Webhook https://updated.com/webhook updated successfully',});});@@ -366,8 +368,9 @@ describe('useWebhookForm', () => {await result.current.handleSave(formData);});- expect(mockEnqueueErrorSnackBar).toHaveBeenCalledWith({- apolloError: expect.any(Error),+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'An error occurred.',});});});@@ -440,8 +443,9 @@ describe('useWebhookForm', () => {await result.current.handleDelete();});- expect(mockEnqueueSuccessSnackBar).toHaveBeenCalledWith({- message: 'Webhook deleted successfully',+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'success',+ children: 'Webhook deleted successfully',});});@@ -455,8 +459,9 @@ describe('useWebhookForm', () => {await result.current.handleDelete();});- expect(mockEnqueueErrorSnackBar).toHaveBeenCalledWith({- message: 'Webhook ID is required for deletion',+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'Webhook ID is required for deletion',});});@@ -492,8 +497,9 @@ describe('useWebhookForm', () => {await result.current.handleDelete();});- expect(mockEnqueueErrorSnackBar).toHaveBeenCalledWith({- apolloError: expect.any(Error),+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'An error occurred.',});});});diff --git a/packages/twenty-front/src/modules/settings/developers/hooks/useWebhookForm.ts b/packages/twenty-front/src/modules/settings/developers/hooks/useWebhookForm.tsindex ec3d9bcf50f..a67cc4b002e 100644--- a/packages/twenty-front/src/modules/settings/developers/hooks/useWebhookForm.ts+++ b/packages/twenty-front/src/modules/settings/developers/hooks/useWebhookForm.ts@@ -2,6 +2,7 @@ import { zodResolver } from '@hookform/resolvers/zod';import { useEffect } from 'react';import { useForm } from 'react-hook-form';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { WebhookFormMode } from '@/settings/developers/constants/WebhookFormMode';import { addEmptyOperationIfNecessary } from '@/settings/developers/utils/addEmptyOperationIfNecessary';import {@@ -13,12 +14,10 @@ import {webhookFormSchema,type WebhookFormValues,} from '@/settings/developers/validation-schemas/webhookFormSchema';-import { useSnackBarOnQueryError } from '@/apollo/hooks/useSnackBarOnQueryError';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { useMutation, useQuery } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { SettingsPath } from 'twenty-shared/types';-import { useMutation, useQuery } from '@apollo/client/react';+import { useToast } from 'twenty-ui/primitives/feedback';import {CreateWebhookDocument,DeleteWebhookDocument,@@ -42,7 +41,7 @@ const DEFAULT_FORM_VALUES: WebhookFormValues = {export const useWebhookForm = ({ webhookId, mode }: UseWebhookFormProps) => {const navigate = useNavigateSettings();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const isCreationMode = mode === WebhookFormMode.Create;@@ -86,8 +85,6 @@ export const useWebhookForm = ({ webhookId, mode }: UseWebhookFormProps) => {}}, [webhookData, formConfig]);- useSnackBarOnQueryError(error, t`Failed to load webhook`);-const { isDirty, isValid, isSubmitting } = formConfig.formState;const canSave = isCreationMode? isValid && !isSubmitting@@ -103,8 +100,9 @@ export const useWebhookForm = ({ webhookId, mode }: UseWebhookFormProps) => {? `${createdWebhook?.targetUrl}`: '';- enqueueSuccessSnackBar({- message: t`Webhook ${targetUrl} created successfully`,+ enqueueToast({+ variant: 'success',+ children: t`Webhook ${targetUrl} created successfully`,});navigate(@@ -117,16 +115,15 @@ export const useWebhookForm = ({ webhookId, mode }: UseWebhookFormProps) => {: SETTINGS_API_WEBHOOKS_TABS.TABS_IDS.WEBHOOKS,);} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));}};const handleUpdate = async (formValues: WebhookFormValues) => {if (!webhookId) {- enqueueErrorSnackBar({- message: t`Webhook ID is required for updates`,+ enqueueToast({+ variant: 'error',+ children: t`Webhook ID is required for updates`,});return;}@@ -144,13 +141,12 @@ export const useWebhookForm = ({ webhookId, mode }: UseWebhookFormProps) => {? `${updatedWebhook.targetUrl}`: '';- enqueueSuccessSnackBar({- message: t`Webhook ${targetUrl} updated successfully`,+ enqueueToast({+ variant: 'success',+ children: t`Webhook ${targetUrl} updated successfully`,});} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));}};@@ -189,8 +185,9 @@ export const useWebhookForm = ({ webhookId, mode }: UseWebhookFormProps) => {const handleDelete = async () => {if (!webhookId) {- enqueueErrorSnackBar({- message: t`Webhook ID is required for deletion`,+ enqueueToast({+ variant: 'error',+ children: t`Webhook ID is required for deletion`,});return;}@@ -199,8 +196,9 @@ export const useWebhookForm = ({ webhookId, mode }: UseWebhookFormProps) => {await deleteWebhook({variables: { id: webhookId },});- enqueueSuccessSnackBar({- message: t`Webhook deleted successfully`,+ enqueueToast({+ variant: 'success',+ children: t`Webhook deleted successfully`,});navigate(@@ -211,9 +209,7 @@ export const useWebhookForm = ({ webhookId, mode }: UseWebhookFormProps) => {SETTINGS_API_WEBHOOKS_TABS.TABS_IDS.WEBHOOKS,);} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));}};diff --git a/packages/twenty-front/src/modules/settings/domains/components/SettingPublicDomain.tsx b/packages/twenty-front/src/modules/settings/domains/components/SettingPublicDomain.tsxindex 985a5127068..807b0940aa7 100644--- a/packages/twenty-front/src/modules/settings/domains/components/SettingPublicDomain.tsx+++ b/packages/twenty-front/src/modules/settings/domains/components/SettingPublicDomain.tsx@@ -1,33 +1,34 @@-import { Section } from 'twenty-ui/primitives/layout';-import { IconReload, IconTrash } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';-import { Trans, useLingui } from '@lingui/react/macro';-import { getSettingsPath, isDefined } from 'twenty-shared/utils';-import { SettingsPath } from 'twenty-shared/types';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';+import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';-import { TextInput } from '@/ui/input/components/TextInput';-import { useNavigateSettings } from '~/hooks/useNavigateSettings';-import { Button, ButtonGroup } from 'twenty-ui/primitives/input';-import { styled } from '@linaria/react';+import { CheckPublicDomainValidRecordsEffect } from '@/settings/domains/components/CheckPublicDomainValidRecordsEffect';import { SettingsDomainRecords } from '@/settings/domains/components/SettingsDomainRecords';import { useCheckPublicDomainValidRecords } from '@/settings/domains/hooks/useCheckPublicDomainValidRecords';-import { useMutation, useQuery } from '@apollo/client/react';-import {- CreatePublicDomainDocument,- DeletePublicDomainDocument,- FindManyPublicDomainsDocument,-} from '~/generated-metadata/graphql';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { CheckPublicDomainValidRecordsEffect } from '@/settings/domains/components/CheckPublicDomainValidRecordsEffect';import { selectedApplicationIdForPublicDomainState } from '@/settings/domains/states/selectedApplicationIdForPublicDomainState';import { selectedPublicDomainState } from '@/settings/domains/states/selectedPublicDomainState';+import { getDomainValidationSchema } from '@/settings/domains/utils/getDomainValidationSchema';+import { TextInput } from '@/ui/input/components/TextInput';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { useMutation, useQuery } from '@apollo/client/react';+import { styled } from '@linaria/react';+import { Trans, useLingui } from '@lingui/react/macro';import { useState } from 'react';-import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';-import { getDomainValidationSchema } from '@/settings/domains/utils/getDomainValidationSchema';+import { SettingsPath } from 'twenty-shared/types';+import { getSettingsPath, isDefined } from 'twenty-shared/utils';+import { IconReload, IconTrash } from 'twenty-ui/icon';+import { useToast } from 'twenty-ui/primitives/feedback';+import { Button, ButtonGroup } from 'twenty-ui/primitives/input';+import { Section } from 'twenty-ui/primitives/layout';+import { H2Title } from 'twenty-ui/primitives/typography';import { themeCssVariables } from 'twenty-ui/theme-constants';+import {+ CreatePublicDomainDocument,+ DeletePublicDomainDocument,+ FindManyPublicDomainsDocument,+} from '~/generated-metadata/graphql';+import { useNavigateSettings } from '~/hooks/useNavigateSettings';const StyledButtonGroupContainer = styled.div`> * > :not(:first-of-type) > button {@@ -61,7 +62,7 @@ export const SettingPublicDomain = () => {);const { t } = useLingui();const navigate = useNavigateSettings();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [createPublicDomain, { loading }] = useMutation(CreatePublicDomainDocument,@@ -92,16 +93,14 @@ export const SettingPublicDomain = () => {await deletePublicDomain({variables: { domain: selectedPublicDomain.domain },onCompleted: () => {- enqueueSuccessSnackBar({- message: t`Custom domain successfully deleted`,+ enqueueToast({+ variant: 'success',+ children: t`Custom domain successfully deleted`,});navigate(SettingsPath.Applications);refetchPublicDomains();},- onError: (error) =>- enqueueErrorSnackBar({- apolloError: error,- }),+ onError: (error) => enqueueToast(getToastOptionsFromError({ error })),});};@@ -131,15 +130,14 @@ export const SettingPublicDomain = () => {},onCompleted: (data) => {setSelectedPublicDomain(data.createPublicDomain);- enqueueSuccessSnackBar({- message: t`Custom domain successfully created`,+ enqueueToast({+ variant: 'success',+ children: t`Custom domain successfully created`,});},onError: (error) => {setNewPublicDomainError(error.message);- enqueueErrorSnackBar({- apolloError: error,- });+ enqueueToast(getToastOptionsFromError({ error }));},});};diff --git a/packages/twenty-front/src/modules/settings/domains/components/SettingPublicDomainRowDropdownMenu.tsx b/packages/twenty-front/src/modules/settings/domains/components/SettingPublicDomainRowDropdownMenu.tsxindex 5051c031ab7..7a92f093c1e 100644--- a/packages/twenty-front/src/modules/settings/domains/components/SettingPublicDomainRowDropdownMenu.tsx+++ b/packages/twenty-front/src/modules/settings/domains/components/SettingPublicDomainRowDropdownMenu.tsx@@ -1,13 +1,14 @@-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';+import { useMutation, useQuery } from '@apollo/client/react';import { useLingui } from '@lingui/react/macro';import { IconDotsVertical, IconTrash } from 'twenty-ui/icon';+import { useToast } from 'twenty-ui/primitives/feedback';import { LightIconButton } from 'twenty-ui/primitives/input';import { MenuItem } from 'twenty-ui/primitives/navigation';-import { useMutation, useQuery } from '@apollo/client/react';import {type PublicDomain,DeletePublicDomainDocument,@@ -22,7 +23,7 @@ export const SettingPublicDomainRowDropdownMenu = ({const dropdownId = `settings-public-domain-row-${publicDomain.id}`;const { t } = useLingui();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { closeDropdown } = useCloseDropdown();@@ -38,10 +39,11 @@ export const SettingPublicDomainRowDropdownMenu = ({domain: publicDomain.domain,},onCompleted: () =>- enqueueSuccessSnackBar({- message: t`Custom domain successfully deleted`,+ enqueueToast({+ variant: 'success',+ children: t`Custom domain successfully deleted`,}),- onError: (error) => enqueueErrorSnackBar({ apolloError: error }),+ onError: (error) => enqueueToast(getToastOptionsFromError({ error })),});};diff --git a/packages/twenty-front/src/modules/settings/domains/hooks/useCheckCustomDomainValidRecords.ts b/packages/twenty-front/src/modules/settings/domains/hooks/useCheckCustomDomainValidRecords.tsindex d8484ef2341..40e2fc68d2c 100644--- a/packages/twenty-front/src/modules/settings/domains/hooks/useCheckCustomDomainValidRecords.ts+++ b/packages/twenty-front/src/modules/settings/domains/hooks/useCheckCustomDomainValidRecords.ts@@ -1,16 +1,17 @@-import { useMutation } from '@apollo/client/react';-import { CheckCustomDomainValidRecordsDocument } from '~/generated-metadata/graphql';+import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';+import { customDomainRecordsState } from '@/settings/domains/states/customDomainRecordsState';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';+import { useMutation } from '@apollo/client/react';import { isDefined } from 'twenty-shared/utils';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { customDomainRecordsState } from '@/settings/domains/states/customDomainRecordsState';-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';+import { useToast } from 'twenty-ui/primitives/feedback';+import { CheckCustomDomainValidRecordsDocument } from '~/generated-metadata/graphql';export const useCheckCustomDomainValidRecords = () => {const [checkCustomDomainValidRecords] = useMutation(CheckCustomDomainValidRecordsDocument,);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [currentWorkspace, setCurrentWorkspace] = useAtomState(currentWorkspaceState,);@@ -55,7 +56,7 @@ export const useCheckCustomDomainValidRecords = () => {}},onError: (error) => {- enqueueErrorSnackBar({ apolloError: error });+ enqueueToast(getToastOptionsFromError({ error }));setCustomDomainRecords((currentState) => ({...currentState,isLoading: false,diff --git a/packages/twenty-front/src/modules/settings/domains/hooks/useCheckPublicDomainValidRecords.ts b/packages/twenty-front/src/modules/settings/domains/hooks/useCheckPublicDomainValidRecords.tsindex dd2cd68c7d1..4d526cd9097 100644--- a/packages/twenty-front/src/modules/settings/domains/hooks/useCheckPublicDomainValidRecords.ts+++ b/packages/twenty-front/src/modules/settings/domains/hooks/useCheckPublicDomainValidRecords.ts@@ -1,15 +1,16 @@-import { isDefined } from 'twenty-shared/utils';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { publicDomainRecordsState } from '@/settings/domains/states/publicDomainRecordsState';+import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';import { useMutation } from '@apollo/client/react';+import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { CheckPublicDomainValidRecordsDocument } from '~/generated-metadata/graphql';-import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';export const useCheckPublicDomainValidRecords = () => {const [checkPublicDomainValidRecords] = useMutation(CheckPublicDomainValidRecordsDocument,);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [{ isLoading, publicDomainRecords }, setPublicDomainRecords] =useAtomState(publicDomainRecordsState);@@ -36,7 +37,7 @@ export const useCheckPublicDomainValidRecords = () => {}));},onError: (error) => {- enqueueErrorSnackBar({ apolloError: error });+ enqueueToast(getToastOptionsFromError({ error }));setPublicDomainRecords((currentState) => ({...currentState,isLoading: false,diff --git a/packages/twenty-front/src/modules/settings/domains/hooks/useSettingsCustomDomain.ts b/packages/twenty-front/src/modules/settings/domains/hooks/useSettingsCustomDomain.tsindex 676aa5a86f5..2f0c20fff22 100644--- a/packages/twenty-front/src/modules/settings/domains/hooks/useSettingsCustomDomain.ts+++ b/packages/twenty-front/src/modules/settings/domains/hooks/useSettingsCustomDomain.ts@@ -1,21 +1,22 @@/* @license Enterprise */import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useCheckCustomDomainValidRecords } from '@/settings/domains/hooks/useCheckCustomDomainValidRecords';import { getDomainValidationSchema } from '@/settings/domains/utils/getDomainValidationSchema';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { useLingui } from '@lingui/react/macro';import { useState } from 'react';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { UpdateWorkspaceDocument } from '~/generated-metadata/graphql';export const useSettingsCustomDomain = () => {const { t } = useLingui();const domainSchema = getDomainValidationSchema();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [updateWorkspace] = useMutation(UpdateWorkspaceDocument);const { checkCustomDomainRecords } = useCheckCustomDomainValidRecords();@@ -63,7 +64,10 @@ export const useSettingsCustomDomain = () => {...currentWorkspace,customDomain: domainValue,});- enqueueSuccessSnackBar({ message: t`Custom domain updated` });+ enqueueToast({+ variant: 'success',+ children: t`Custom domain updated`,+ });setIsSubmitting(false);checkCustomDomainRecords(domainValue);},@@ -77,11 +81,7 @@ export const useSettingsCustomDomain = () => {return;}- if (CombinedGraphQLErrors.is(mutationError)) {- enqueueErrorSnackBar({ apolloError: mutationError });- } else {- enqueueErrorSnackBar({});- }+ enqueueToast(getToastOptionsFromError({ error: mutationError }));setIsSubmitting(false);},});diff --git a/packages/twenty-front/src/modules/settings/domains/hooks/useSettingsSubdomain.ts b/packages/twenty-front/src/modules/settings/domains/hooks/useSettingsSubdomain.tsindex 3bc1ddb1318..8cac43edf7f 100644--- a/packages/twenty-front/src/modules/settings/domains/hooks/useSettingsSubdomain.ts+++ b/packages/twenty-front/src/modules/settings/domains/hooks/useSettingsSubdomain.ts@@ -1,7 +1,7 @@import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { useRedirectToWorkspaceDomain } from '@/domain-manager/hooks/useRedirectToWorkspaceDomain';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { getSubdomainValidationSchema } from '@/settings/domains/utils/getSubdomainValidationSchema';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useModal } from '@/ui/layout/modal/hooks/useModal';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';import { CombinedGraphQLErrors } from '@apollo/client/errors';@@ -9,6 +9,7 @@ import { useMutation } from '@apollo/client/react';import { useLingui } from '@lingui/react/macro';import { useState } from 'react';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { UpdateWorkspaceDocument } from '~/generated-metadata/graphql';export const SUBDOMAIN_CHANGE_CONFIRMATION_MODAL_ID =@@ -18,7 +19,7 @@ export const useSettingsSubdomain = () => {const { t } = useLingui();const subdomainSchema = getSubdomainValidationSchema();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [updateWorkspace] = useMutation(UpdateWorkspaceDocument);const { redirectToWorkspaceDomain } = useRedirectToWorkspaceDomain();const { openModal, closeModal } = useModal();@@ -69,11 +70,7 @@ export const useSettingsSubdomain = () => {return;}- if (CombinedGraphQLErrors.is(mutationError)) {- enqueueErrorSnackBar({ apolloError: mutationError });- } else {- enqueueErrorSnackBar({});- }+ enqueueToast(getToastOptionsFromError({ error: mutationError }));setIsSubmitting(false);},onCompleted: async () => {@@ -84,7 +81,7 @@ export const useSettingsSubdomain = () => {).hostname.replace(currentWorkspace.subdomain, subdomain);setCurrentWorkspace({ ...currentWorkspace, subdomain });- enqueueSuccessSnackBar({ message: t`Subdomain updated` });+ enqueueToast({ variant: 'success', children: t`Subdomain updated` });setIsSubmitting(false);await redirectToWorkspaceDomain(currentUrl.toString());diff --git a/packages/twenty-front/src/modules/settings/emailing-domains/components/SettingsEmailingDomainVerifyButton.tsx b/packages/twenty-front/src/modules/settings/emailing-domains/components/SettingsEmailingDomainVerifyButton.tsxindex 8650cee3947..067c9644880 100644--- a/packages/twenty-front/src/modules/settings/emailing-domains/components/SettingsEmailingDomainVerifyButton.tsx+++ b/packages/twenty-front/src/modules/settings/emailing-domains/components/SettingsEmailingDomainVerifyButton.tsx@@ -1,11 +1,11 @@-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { useLingui } from '@lingui/react/macro';--import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { VerifyEmailingDomainDocument } from '~/generated-metadata/graphql';import { IconRefresh } from 'twenty-ui/icon';import { Button } from 'twenty-ui/primitives/input';+import { VerifyEmailingDomainDocument } from '~/generated-metadata/graphql';++import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';+import { useToast } from 'twenty-ui/primitives/feedback';type SettingsEmailingDomainVerifyButtonProps = {emailingDomainId: string;@@ -15,7 +15,7 @@ export const SettingsEmailingDomainVerifyButton = ({emailingDomainId,}: SettingsEmailingDomainVerifyButtonProps) => {const { t } = useLingui();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [verifyEmailingDomain, { loading }] = useMutation(VerifyEmailingDomainDocument,);@@ -23,11 +23,12 @@ export const SettingsEmailingDomainVerifyButton = ({const handleVerify = async () => {try {await verifyEmailingDomain({ variables: { id: emailingDomainId } });- enqueueSuccessSnackBar({ message: t`Started verification process` });- } catch (error) {- enqueueErrorSnackBar({- ...(CombinedGraphQLErrors.is(error) ? { apolloError: error } : {}),+ enqueueToast({+ variant: 'success',+ children: t`Started verification process`,});+ } catch (error) {+ enqueueToast(getToastOptionsFromError({ error }));}};diff --git a/packages/twenty-front/src/modules/settings/enterprise/components/EnterprisePlanModal.tsx b/packages/twenty-front/src/modules/settings/enterprise/components/EnterprisePlanModal.tsxindex f1ae099432e..83caf5b8409 100644--- a/packages/twenty-front/src/modules/settings/enterprise/components/EnterprisePlanModal.tsx+++ b/packages/twenty-front/src/modules/settings/enterprise/components/EnterprisePlanModal.tsx@@ -2,15 +2,14 @@ import { SubTitle } from '@/auth/components/SubTitle';import { Title } from '@/auth/components/Title';import { SubscriptionBenefit } from '@/settings/billing/components/SubscriptionBenefit';import { ENTERPRISE_CHECKOUT_SESSION } from '@/settings/enterprise/graphql/queries/enterpriseCheckoutSession';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { ModalStatefulWrapper } from '@/ui/layout/modal/components/ModalStatefulWrapper';import { useModal } from '@/ui/layout/modal/hooks/useModal';import { useApolloClient } from '@apollo/client/react';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { useState } from 'react';-import { Loader } from 'twenty-ui/primitives/feedback';-import { CardPicker, RadioGroup, MainButton } from 'twenty-ui/primitives/input';+import { Loader, useToast } from 'twenty-ui/primitives/feedback';+import { CardPicker, MainButton, RadioGroup } from 'twenty-ui/primitives/input';import { ModalContent } from 'twenty-ui/primitives/surfaces';import { themeCssVariables } from 'twenty-ui/theme-constants';@@ -90,7 +89,7 @@ const StyledIntervalSubtitle = styled.div`export const EnterprisePlanModal = () => {const { t } = useLingui();const { closeModal } = useModal();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [selectedInterval, setSelectedInterval] =useState<BillingInterval>('monthly');const [isLoading, setIsLoading] = useState(false);@@ -127,14 +126,13 @@ export const EnterprisePlanModal = () => {window.open(checkoutUrl, '_blank', 'noopener');closeModal(ENTERPRISE_PLAN_MODAL_ID);} else {- enqueueErrorSnackBar({- message: t`Could not open Stripe. Please contact support.`,+ enqueueToast({+ variant: 'error',+ children: t`Could not open Stripe. Please contact support.`,});}} catch {- enqueueErrorSnackBar({- message: t`Error opening Stripe`,- });+ enqueueToast({ variant: 'error', children: t`Error opening Stripe` });} finally {setIsLoading(false);}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 05f25cc15c2..509aac02112 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@@ -13,7 +13,7 @@ import {import { currentUserState } from '@/auth/states/currentUserState';import { billingState } from '@/client-config/states/billingState';import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap';-import { SnackBarComponentInstanceContext } from '@/ui/feedback/snack-bar-manager/contexts/SnackBarComponentInstanceContext';+import { ToastProvider } from 'twenty-ui/primitives/feedback';import {jotaiStore,resetJotaiStore,@@ -54,11 +54,7 @@ const Wrapper = ({ children }: { children: ReactNode }) => (<JotaiProvider store={jotaiStore}><MemoryRouter><I18nProvider i18n={i18n}>- <SnackBarComponentInstanceContext.Provider- value={{ instanceId: 'test-scope-id' }}- >- {children}- </SnackBarComponentInstanceContext.Provider>+ <ToastProvider>{children}</ToastProvider></I18nProvider></MemoryRouter></JotaiProvider>diff --git a/packages/twenty-front/src/modules/settings/legal/components/SettingsDpaAgreementsTable.tsx b/packages/twenty-front/src/modules/settings/legal/components/SettingsDpaAgreementsTable.tsxindex 00c4fe01118..f8ce847fa47 100644--- a/packages/twenty-front/src/modules/settings/legal/components/SettingsDpaAgreementsTable.tsx+++ b/packages/twenty-front/src/modules/settings/legal/components/SettingsDpaAgreementsTable.tsx@@ -2,6 +2,7 @@ import { styled } from '@linaria/react';import { Trans, useLingui } from '@lingui/react/macro';import { themeCssVariables } from 'twenty-ui/theme-constants';+import { downloadFile } from '@/activities/files/utils/downloadFile';import {DPA_AGREEMENT_ROW_GRID_COLUMNS,SettingsDpaAgreementRow,@@ -11,8 +12,7 @@ import { Table } from '@/ui/layout/table/components/Table';import { TableBody } from '@/ui/layout/table/components/TableBody';import { TableHeader } from '@/ui/layout/table/components/TableHeader';import { TableRow } from '@/ui/layout/table/components/TableRow';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { downloadFile } from '@/activities/files/utils/downloadFile';+import { useToast } from 'twenty-ui/primitives/feedback';const StyledTableBodyContainer = styled.div`border-bottom: 1px solid ${themeCssVariables.border.color.light};@@ -26,7 +26,7 @@ export const SettingsDpaAgreementsTable = ({agreements,}: SettingsDpaAgreementsTableProps) => {const { t } = useLingui();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const handleDownload = async (agreement: DpaAgreement) => {if (!agreement.downloadUrl) {@@ -39,7 +39,10 @@ export const SettingsDpaAgreementsTable = ({`Twenty-DPA-${agreement.templateVersion}-${agreement.customerLegalEntityName ?? 'copy'}.pdf`,);} catch {- enqueueErrorSnackBar({ message: t`Could not download the document.` });+ enqueueToast({+ variant: 'error',+ children: t`Could not download the document.`,+ });}};diff --git a/packages/twenty-front/src/modules/settings/mcp-and-apis/components/__stories__/PlaygroundSetupForm.stories.tsx b/packages/twenty-front/src/modules/settings/mcp-and-apis/components/__stories__/PlaygroundSetupForm.stories.tsxindex 9838e32db29..abe492fc4ef 100644--- a/packages/twenty-front/src/modules/settings/mcp-and-apis/components/__stories__/PlaygroundSetupForm.stories.tsx+++ b/packages/twenty-front/src/modules/settings/mcp-and-apis/components/__stories__/PlaygroundSetupForm.stories.tsx@@ -1,12 +1,12 @@import { PlaygroundSetupForm } from '@/settings/mcp-and-apis/components/PlaygroundSetupForm';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';import { type Meta, type StoryObj } from '@storybook/react-vite';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const meta: Meta<typeof PlaygroundSetupForm> = {title: 'Modules/Settings/Playground/PlaygroundSetupForm',component: PlaygroundSetupForm,- decorators: [ComponentDecorator, RouterDecorator, SnackBarDecorator],+ decorators: [ComponentDecorator, RouterDecorator, ToastDecorator],parameters: {docs: {description: {diff --git a/packages/twenty-front/src/modules/settings/mcp-and-apis/components/__stories__/SettingsMcpSetup.stories.tsx b/packages/twenty-front/src/modules/settings/mcp-and-apis/components/__stories__/SettingsMcpSetup.stories.tsxindex 4ec4a0f7c42..9ab1c844a9c 100644--- a/packages/twenty-front/src/modules/settings/mcp-and-apis/components/__stories__/SettingsMcpSetup.stories.tsx+++ b/packages/twenty-front/src/modules/settings/mcp-and-apis/components/__stories__/SettingsMcpSetup.stories.tsx@@ -1,12 +1,12 @@import { SettingsMcpSetup } from '@/settings/mcp-and-apis/components/SettingsMcpSetup';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';import { type Meta, type StoryObj } from '@storybook/react-vite';import { ComponentDecorator } from 'twenty-ui/testing';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const meta: Meta<typeof SettingsMcpSetup> = {title: 'Modules/Settings/Playground/SettingsMcpSetup',component: SettingsMcpSetup,- decorators: [ComponentDecorator, SnackBarDecorator],+ decorators: [ComponentDecorator, ToastDecorator],parameters: {docs: {description: {diff --git a/packages/twenty-front/src/modules/settings/mcp-and-apis/hooks/useOpenPlayground.ts b/packages/twenty-front/src/modules/settings/mcp-and-apis/hooks/useOpenPlayground.tsindex d48c3baaedc..e7a5645c7c6 100644--- a/packages/twenty-front/src/modules/settings/mcp-and-apis/hooks/useOpenPlayground.ts+++ b/packages/twenty-front/src/modules/settings/mcp-and-apis/hooks/useOpenPlayground.ts@@ -1,6 +1,6 @@import { useMutation } from '@apollo/client/react';-import { useCallback } from 'react';import { t } from '@lingui/core/macro';+import { useCallback } from 'react';import { SettingsPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';@@ -10,10 +10,10 @@ import {} from '@/settings/mcp-and-apis/states/playgroundApiKeyState';import { type PlaygroundSchemas } from '@/settings/mcp-and-apis/types/PlaygroundSchemas';import { PlaygroundTypes } from '@/settings/mcp-and-apis/types/PlaygroundTypes';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';-import { useNavigateSettings } from '~/hooks/useNavigateSettings';+import { useToast } from 'twenty-ui/primitives/feedback';import { GeneratePlaygroundTokenDocument } from '~/generated-metadata/graphql';+import { useNavigateSettings } from '~/hooks/useNavigateSettings';// Re-mint when less than this remains so the user never lands on a token about to expire.const TOKEN_FRESHNESS_BUFFER_MS = 5 * 60 * 1000;@@ -23,13 +23,14 @@ export const useOpenPlayground = () => {const [playgroundApiKey, setPlaygroundApiKey] = useAtomState(playgroundApiKeyState,);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [generatePlaygroundToken] = useMutation(GeneratePlaygroundTokenDocument,{onError: () => {- enqueueErrorSnackBar({- message: t`Could not open the API playground`,+ enqueueToast({+ variant: 'error',+ children: t`Could not open the API playground`,});},},diff --git a/packages/twenty-front/src/modules/settings/members/components/MemberPermissionsTab.tsx b/packages/twenty-front/src/modules/settings/members/components/MemberPermissionsTab.tsxindex fb08d00d0f0..fb3ead771aa 100644--- a/packages/twenty-front/src/modules/settings/members/components/MemberPermissionsTab.tsx+++ b/packages/twenty-front/src/modules/settings/members/components/MemberPermissionsTab.tsx@@ -1,21 +1,21 @@import { SettingsRolePermissions } from '@/settings/roles/role-permissions/components/SettingsRolePermissions';import { type RoleWithPartialMembers } from '@/settings/roles/types/RoleWithPartialMembers';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { Select } from '@/ui/input/components/Select';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';import { type WorkspaceMember } from '@/workspace-member/types/WorkspaceMember';+import { useMutation } from '@apollo/client/react';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { useState } from 'react';import { SettingsPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';import { IconArrowUpRight, IconUser, useIcons } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';+import { useToast } from 'twenty-ui/primitives/feedback';import { Button } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';+import { H2Title } from 'twenty-ui/primitives/typography';import { themeCssVariables } from 'twenty-ui/theme-constants';-import { useMutation } from '@apollo/client/react';import { UpdateWorkspaceMemberRoleDocument } from '~/generated-metadata/graphql';import { useNavigateSettings } from '~/hooks/useNavigateSettings';@@ -54,7 +54,7 @@ export const MemberPermissionsTab = ({const primaryRole = roles?.[0];const { getIcon } = useIcons();const navigateSettings = useNavigateSettings();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { openModal } = useModal();const [pendingRole, setPendingRole] = useState<RoleWithPartialMembers | null>(null,@@ -92,10 +92,14 @@ export const MemberPermissionsTab = ({},refetchQueries: ['GetRoles'],});- enqueueSuccessSnackBar({ message: t`Role updated successfully` });+ enqueueToast({+ variant: 'success',+ children: t`Role updated successfully`,+ });} catch (error) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:error instanceof Error ? error.message : t`Failed to update role`,});} finally {diff --git a/packages/twenty-front/src/modules/settings/profile/components/DeleteAccount.tsx b/packages/twenty-front/src/modules/settings/profile/components/DeleteAccount.tsxindex 3282f8d8878..0e1a1ccf9c6 100644--- a/packages/twenty-front/src/modules/settings/profile/components/DeleteAccount.tsx+++ b/packages/twenty-front/src/modules/settings/profile/components/DeleteAccount.tsx@@ -2,18 +2,18 @@ import { useAuth } from '@/auth/hooks/useAuth';import { availableWorkspacesState } from '@/auth/states/availableWorkspacesState';import { currentUserState } from '@/auth/states/currentUserState';import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { countAvailableWorkspaces } from '@/auth/utils/availableWorkspacesUtils';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { useMutation } from '@apollo/client/react';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { isDefined } from 'twenty-shared/utils';-import { H2Title } from 'twenty-ui/primitives/typography';+import { useToast } from 'twenty-ui/primitives/feedback';import { Button } from 'twenty-ui/primitives/input';+import { H2Title } from 'twenty-ui/primitives/typography';import { themeCssVariables } from 'twenty-ui/theme-constants';-import { useMutation } from '@apollo/client/react';import {DeleteUserAccountDocument,DeleteUserWorkspaceDocument,@@ -31,7 +31,7 @@ const StyledDangerActions = styled.div`export const DeleteAccount = () => {const { t } = useLingui();const { openModal } = useModal();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [deleteUserAccount] = useMutation(DeleteUserAccountDocument);const [deleteUserFromWorkspace] = useMutation(DeleteUserWorkspaceDocument);@@ -53,8 +53,9 @@ export const DeleteAccount = () => {const leaveWorkspace = async () => {if (!isDefined(currentWorkspaceMemberId)) {- enqueueErrorSnackBar({- message: t`Current workspace member not found.`,+ enqueueToast({+ variant: 'error',+ children: t`Current workspace member not found.`,});return;}diff --git a/packages/twenty-front/src/modules/settings/profile/devices/components/SettingsDeviceSessionRowDropdownMenu.tsx b/packages/twenty-front/src/modules/settings/profile/devices/components/SettingsDeviceSessionRowDropdownMenu.tsxindex f9f0a1342e3..0db13daa21f 100644--- a/packages/twenty-front/src/modules/settings/profile/devices/components/SettingsDeviceSessionRowDropdownMenu.tsx+++ b/packages/twenty-front/src/modules/settings/profile/devices/components/SettingsDeviceSessionRowDropdownMenu.tsx@@ -1,11 +1,11 @@import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';+import { useToast } from 'twenty-ui/primitives/feedback';import { IconDotsVertical, IconLogout } from 'twenty-ui/icon';import { LightIconButton } from 'twenty-ui/primitives/input';import { MenuItem } from 'twenty-ui/primitives/navigation';@@ -23,7 +23,7 @@ export const SettingsDeviceSessionRowDropdownMenu = ({}: SettingsDeviceSessionRowDropdownMenuProps) => {const dropdownId = `settings-device-session-row-${userSessionId}`;- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { closeDropdown } = useCloseDropdown();const [revokeUserSession] = useMutation(RevokeUserSessionDocument, {@@ -35,9 +35,12 @@ export const SettingsDeviceSessionRowDropdownMenu = ({try {await revokeUserSession({ variables: { userSessionId } });- enqueueSuccessSnackBar({ message: t`Device logged out` });+ enqueueToast({ variant: 'success', children: t`Device logged out` });} catch {- enqueueErrorSnackBar({ message: t`Failed to log out this device` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to log out this device`,+ });}};diff --git a/packages/twenty-front/src/modules/settings/profile/devices/components/SettingsProfileDevicesSection.tsx b/packages/twenty-front/src/modules/settings/profile/devices/components/SettingsProfileDevicesSection.tsxindex a5373c847ef..3fe896031a6 100644--- a/packages/twenty-front/src/modules/settings/profile/devices/components/SettingsProfileDevicesSection.tsx+++ b/packages/twenty-front/src/modules/settings/profile/devices/components/SettingsProfileDevicesSection.tsx@@ -1,14 +1,14 @@+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { useMutation, useQuery } from '@apollo/client/react';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';-import { isNonEmptyString } from '@sniptt/guards';+import { isNonEmptyArray, isNonEmptyString } from '@sniptt/guards';-import { useSnackBarOnQueryError } from '@/apollo/hooks/useSnackBarOnQueryError';import { SettingsListCard } from '@/settings/components/SettingsListCard';import { SettingsDeviceSessionRowRightComponent } from '@/settings/profile/devices/components/SettingsDeviceSessionRowRightComponent';import { parseUserAgentDescription } from '@/settings/profile/devices/utils/parseUserAgentDescription';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { useToast } from 'twenty-ui/primitives/feedback';import { IconDeviceDesktop, IconLogout } from 'twenty-ui/icon';import { Button } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';@@ -40,15 +40,13 @@ const StyledButtonContainer = styled.div`export const SettingsProfileDevicesSection = () => {const { t } = useLingui();const { localeCatalog } = useAtomStateValue(dateLocaleState);- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { data, loading, error, refetch } = useQuery(CurrentUserSessionsDocument,{ fetchPolicy: 'network-only' },);- useSnackBarOnQueryError(error);-const [revokeAllOtherUserSessions] = useMutation(RevokeAllOtherUserSessionsDocument,);@@ -59,17 +57,19 @@ export const SettingsProfileDevicesSection = () => {const hasOtherSessions =hasCurrentSession && sessions.some((session) => !session.isCurrent);- if (!loading && sessions.length === 0) {- return null;- }-const handleRevokeAllOtherSessions = async () => {try {await revokeAllOtherUserSessions();- enqueueSuccessSnackBar({ message: t`Logged out all other devices` });+ enqueueToast({+ variant: 'success',+ children: t`Logged out all other devices`,+ });await refetch();} catch {- enqueueErrorSnackBar({ message: t`Failed to log out other devices` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to log out other devices`,+ });}};@@ -97,31 +97,36 @@ export const SettingsProfileDevicesSection = () => {};return (- <Section>- <H2Title- title={t`Devices`}- description={t`Devices with an active session on your account`}- />- <StyledContainer>- <SettingsListCard- items={sessions}- isLoading={loading}- getItemLabel={getSessionLabel}- getItemDescription={getSessionDescription}- RowIcon={IconDeviceDesktop}- RowRightComponent={SettingsDeviceSessionRowRightComponent}- />- {hasOtherSessions && (- <StyledButtonContainer>- <Button- Icon={IconLogout}- title={t`Log out all other devices`}- size="small"- onClick={() => void handleRevokeAllOtherSessions()}+ <>+ <ToastOnQueryErrorEffect error={error} />+ {(loading || isNonEmptyArray(sessions)) && (+ <Section>+ <H2Title+ title={t`Devices`}+ description={t`Devices with an active session on your account`}+ />+ <StyledContainer>+ <SettingsListCard+ items={sessions}+ isLoading={loading}+ getItemLabel={getSessionLabel}+ getItemDescription={getSessionDescription}+ RowIcon={IconDeviceDesktop}+ RowRightComponent={SettingsDeviceSessionRowRightComponent}/>- </StyledButtonContainer>- )}- </StyledContainer>- </Section>+ {hasOtherSessions && (+ <StyledButtonContainer>+ <Button+ Icon={IconLogout}+ title={t`Log out all other devices`}+ size="small"+ onClick={() => void handleRevokeAllOtherSessions()}+ />+ </StyledButtonContainer>+ )}+ </StyledContainer>+ </Section>+ )}+ </>);};diff --git a/packages/twenty-front/src/modules/settings/profile/devices/components/__tests__/SettingsProfileDevicesSection.test.tsx b/packages/twenty-front/src/modules/settings/profile/devices/components/__tests__/SettingsProfileDevicesSection.test.tsxindex 5afebd54078..4a6debc7ec5 100644--- a/packages/twenty-front/src/modules/settings/profile/devices/components/__tests__/SettingsProfileDevicesSection.test.tsx+++ b/packages/twenty-front/src/modules/settings/profile/devices/components/__tests__/SettingsProfileDevicesSection.test.tsx@@ -1,3 +1,5 @@+import { AppToaster } from '@/ui/feedback/toast/components/AppToaster';+import { ThemeProvider } from 'twenty-ui/theme-constants';import { i18n } from '@lingui/core';import { I18nProvider } from '@lingui/react';import { render, screen } from '@testing-library/react';@@ -34,6 +36,34 @@ const Wrapper = getJestMetadataAndApolloMocksWrapper({});describe('SettingsProfileDevicesSection', () => {+ it('displays a query error when no device sessions are available', async () => {+ const ErrorWrapper = getJestMetadataAndApolloMocksWrapper({+ apolloMocks: [+ {+ request: { query: CurrentUserSessionsDocument },+ error: new Error('Could not load devices'),+ },+ ],+ });++ render(+ <I18nProvider i18n={i18n}>+ <ThemeProvider colorScheme="light">+ <MemoryRouter>+ <SettingsProfileDevicesSection />+ <AppToaster />+ </MemoryRouter>+ </ThemeProvider>+ </I18nProvider>,+ { wrapper: ErrorWrapper },+ );++ expect(await screen.findByRole('status')).toHaveTextContent(+ 'Could not load devices',+ );+ expect(screen.queryByText('Devices')).not.toBeInTheDocument();+ });+it('keeps a session row mounted across a re-render of the section', async () => {const tree = (<I18nProvider i18n={i18n}>diff --git a/packages/twenty-front/src/modules/settings/profile/hooks/useUpdateEmail.ts b/packages/twenty-front/src/modules/settings/profile/hooks/useUpdateEmail.tsindex c2256474879..eb478db5610 100644--- a/packages/twenty-front/src/modules/settings/profile/hooks/useUpdateEmail.ts+++ b/packages/twenty-front/src/modules/settings/profile/hooks/useUpdateEmail.ts@@ -3,13 +3,14 @@ import { CombinedGraphQLErrors } from '@apollo/client/errors';import { t } from '@lingui/core/macro';import { currentUserState } from '@/auth/states/currentUserState';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useMutation } from '@apollo/client/react';+import { useToast } from 'twenty-ui/primitives/feedback';import { UpdateUserEmailDocument } from '~/generated-metadata/graphql';export const useUpdateEmail = () => {- const { enqueueErrorSnackBar, enqueueInfoSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const currentUser = useAtomStateValue(currentUserState);@@ -27,12 +28,13 @@ export const useUpdateEmail = () => {},});- enqueueInfoSnackBar({- message: t`Check your inbox to verify your new email address.`,+ enqueueToast({+ variant: 'info',+ children: t`Check your inbox to verify your new email address.`,});} catch (error) {if (CombinedGraphQLErrors.is(error)) {- enqueueErrorSnackBar({ apolloError: error });+ enqueueToast(getToastOptionsFromError({ error }));}}};diff --git a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentWorkspaceMemberPickerDropdown.tsx b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentWorkspaceMemberPickerDropdown.tsxindex 0dd4207ba74..5c4a6e4d009 100644--- a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentWorkspaceMemberPickerDropdown.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentWorkspaceMemberPickerDropdown.tsx@@ -1,3 +1,4 @@+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { CoreObjectNameSingular } from 'twenty-shared/types';import { useObjectRecordSearchRecords } from '@/object-record/hooks/useObjectRecordSearchRecords';import { type SearchRecord } from '~/generated/graphql';@@ -22,11 +23,14 @@ export const SettingsRoleAssignmentWorkspaceMemberPickerDropdown = ({}: SettingsRoleAssignmentWorkspaceMemberPickerDropdownProps) => {const [searchFilter, setSearchFilter] = useState('');- const { loading, searchRecords: workspaceMembers } =- useObjectRecordSearchRecords({- objectNameSingulars: [CoreObjectNameSingular.WorkspaceMember],- searchInput: searchFilter,- });+ const {+ loading,+ searchRecords: workspaceMembers,+ error,+ } = useObjectRecordSearchRecords({+ objectNameSingulars: [CoreObjectNameSingular.WorkspaceMember],+ searchInput: searchFilter,+ });const filteredWorkspaceMembers =workspaceMembers?.filter(@@ -45,21 +49,26 @@ export const SettingsRoleAssignmentWorkspaceMemberPickerDropdown = ({const { t } = useLingui();return (- <DropdownContent widthInPixels={GenericDropdownContentWidth.ExtraLarge}>- <DropdownMenuSearchInput- value={searchFilter}- onChange={handleSearchFilterChange}- placeholder={t`Search`}- />- <DropdownMenuSeparator />- <DropdownMenuItemsContainer hasMaxHeight>- <SettingsRoleAssignmentWorkspaceMemberPickerDropdownContent- loading={loading}- searchFilter={searchFilter}- filteredWorkspaceMembers={filteredWorkspaceMembers as SearchRecord[]}- onSelect={onSelect}+ <>+ <ToastOnQueryErrorEffect error={error} />+ <DropdownContent widthInPixels={GenericDropdownContentWidth.ExtraLarge}>+ <DropdownMenuSearchInput+ value={searchFilter}+ onChange={handleSearchFilterChange}+ placeholder={t`Search`}/>- </DropdownMenuItemsContainer>- </DropdownContent>+ <DropdownMenuSeparator />+ <DropdownMenuItemsContainer hasMaxHeight>+ <SettingsRoleAssignmentWorkspaceMemberPickerDropdownContent+ loading={loading}+ searchFilter={searchFilter}+ filteredWorkspaceMembers={+ filteredWorkspaceMembers as SearchRecord[]+ }+ onSelect={onSelect}+ />+ </DropdownMenuItemsContainer>+ </DropdownContent>+ </>);};diff --git a/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRole.tsx b/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRole.tsxindex 23d4580110e..f4ab84ce930 100644--- a/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRole.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRole.tsx@@ -1,5 +1,7 @@import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';+import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';+import { SettingsTabBar } from '@/settings/components/layout/SettingsTabBar';import { SettingsRoleAssignment } from '@/settings/roles/role-assignment/components/SettingsRoleAssignment';import { SettingsRolePermissions } from '@/settings/roles/role-permissions/components/SettingsRolePermissions';import { SettingsRoleSettings } from '@/settings/roles/role-settings/components/SettingsRoleSettings';@@ -9,20 +11,18 @@ import { useSaveDraftRoleToDB } from '@/settings/roles/role/hooks/useSaveDraftRoimport { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState';import { settingsPersistedRoleFamilyState } from '@/settings/roles/states/settingsPersistedRoleFamilyState';import { settingsRolesIsLoadingState } from '@/settings/roles/states/settingsRolesIsLoadingState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';-import { SettingsTabBar } from '@/settings/components/layout/SettingsTabBar';-import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';import { useWorkspaceSurfaceScopedComponentInstanceId } from '@/ui/layout/hooks/useWorkspaceSurfaceScopedComponentInstanceId';+import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';-import { useLoadCurrentUser } from '@/users/hooks/useLoadCurrentUser';import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState';+import { useLoadCurrentUser } from '@/users/hooks/useLoadCurrentUser';import { t } from '@lingui/core/macro';-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useState } from 'react';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { IconLock, IconSettings, IconUserPlus } from 'twenty-ui/icon';import { useNavigateSettings } from '~/hooks/useNavigateSettings';@@ -66,7 +66,7 @@ export const SettingsRole = ({ roleId, isCreateMode }: SettingsRoleProps) => {const { loadCurrentUser } = useLoadCurrentUser();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { saveDraftRoleToDB } = useSaveDraftRoleToDB({isCreateMode,@@ -120,8 +120,9 @@ export const SettingsRole = ({ roleId, isCreateMode }: SettingsRoleProps) => {);if (isDefined(dirtyFields.label) && dirtyFields.label === '') {- enqueueErrorSnackBar({- message: t`Role name cannot be empty`,+ enqueueToast({+ variant: 'error',+ children: t`Role name cannot be empty`,});return;}diff --git a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthBypassOptionsList.tsx b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthBypassOptionsList.tsxindex 0a855f9dc1b..a751f013357 100644--- a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthBypassOptionsList.tsx+++ b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthBypassOptionsList.tsx@@ -1,21 +1,22 @@import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { authProvidersState } from '@/client-config/states/authProvidersState';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';++import { useMutation } from '@apollo/client/react';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { capitalize } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { IconGoogle, IconMicrosoft, IconPassword } from 'twenty-ui/icon';import { Card } from 'twenty-ui/primitives/surfaces';import { themeCssVariables } from 'twenty-ui/theme-constants';-import { useMutation } from '@apollo/client/react';import {type AuthProviders,UpdateWorkspaceDocument,} from '~/generated-metadata/graphql';-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';const StyledSettingsSecurityOptionsList = styled.div`display: flex;@@ -26,7 +27,7 @@ const StyledSettingsSecurityOptionsList = styled.div`export const SettingsSecurityAuthBypassOptionsList = () => {const { t } = useLingui();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const authProviders = useAtomStateValue(authProvidersState);const [currentWorkspace, setCurrentWorkspace] = useAtomState(@@ -71,9 +72,7 @@ export const SettingsSecurityAuthBypassOptionsList = () => {...currentWorkspace,[key]: currentWorkspace[key],});- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(err) ? err : undefined,- });+ enqueueToast(getToastOptionsFromError({ error: err }));});};diff --git a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsxindex 3db2753186d..7b84a0fdc45 100644--- a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx+++ b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx@@ -2,17 +2,18 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { authProvidersState } from '@/client-config/states/authProvidersState';import { isMultiWorkspaceEnabledState } from '@/client-config/states/isMultiWorkspaceEnabledState';import { useReadDefaultDomainFromConfiguration } from '@/domain-manager/hooks/useReadDefaultDomainFromConfiguration';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect';import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';import { ssoIdentitiesProvidersState } from '@/settings/security/states/ssoIdentitiesProvidersState';import { Select } from '@/ui/input/components/Select';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';+import { useMutation } from '@apollo/client/react';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';-import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';import { ConnectedAccountProvider } from 'twenty-shared/types';import { capitalize } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import {IconGoogle,IconLink,@@ -22,7 +23,6 @@ import {} from 'twenty-ui/icon';import { Card } from 'twenty-ui/primitives/surfaces';import { themeCssVariables } from 'twenty-ui/theme-constants';-import { useMutation } from '@apollo/client/react';import {type AuthProviders,UpdateWorkspaceDocument,@@ -41,7 +41,7 @@ const StyledSettingsSecurityOptionsList = styled.div`export const SettingsSecurityAuthProvidersOptionsList = () => {const { t } = useLingui();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const ssoIdentitiesProviders = useAtomStateValue(ssoIdentitiesProvidersState);const authProviders = useAtomStateValue(authProvidersState);const isMultiWorkspaceEnabled = useAtomStateValue(@@ -87,8 +87,9 @@ export const SettingsSecurityAuthProvidersOptionsList = () => {allAuthProvidersEnabled.filter((isAuthEnabled) => isAuthEnabled).length <=1) {- return enqueueErrorSnackBar({- message: t`At least one authentication method must be enabled`,+ return enqueueToast({+ variant: 'error',+ children: t`At least one authentication method must be enabled`,});}@@ -108,9 +109,7 @@ export const SettingsSecurityAuthProvidersOptionsList = () => {...currentWorkspace,[key]: !currentWorkspace[key],});- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(err) ? err : undefined,- });+ enqueueToast(getToastOptionsFromError({ error: err }));});};@@ -131,9 +130,7 @@ export const SettingsSecurityAuthProvidersOptionsList = () => {isPublicInviteLinkEnabled: value,});} catch (err: any) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(err) ? err : undefined,- });+ enqueueToast(getToastOptionsFromError({ error: err }));}};@@ -192,9 +189,7 @@ export const SettingsSecurityAuthProvidersOptionsList = () => {}: currentWorkspaceValue,);- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(err) ? err : undefined,- });+ enqueueToast(getToastOptionsFromError({ error: err }));});};diff --git a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityEditableProfileFields.tsx b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityEditableProfileFields.tsxindex dfb21bf16bf..ae5b12cdab9 100644--- a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityEditableProfileFields.tsx+++ b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityEditableProfileFields.tsx@@ -1,15 +1,16 @@import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { EDITABLE_PROFILE_FIELDS_DROPDOWN_ID } from '@/settings/security/constants/EditableProfileFields.constants';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { SelectControl } from '@/ui/input/components/SelectControl';import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';-import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';+import { useMutation } from '@apollo/client/react';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';-import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import {IconMail,IconPhoto,@@ -20,7 +21,6 @@ import {import { type SelectOption } from 'twenty-ui/primitives/input';import { MenuItemMultiSelect } from 'twenty-ui/primitives/navigation';import { themeCssVariables } from 'twenty-ui/theme-constants';-import { useMutation } from '@apollo/client/react';import { UpdateWorkspaceDocument } from '~/generated-metadata/graphql';const StyledDropdownContainer = styled.div`@@ -37,7 +37,7 @@ type ProfileFieldOption = {export const SettingsSecurityEditableProfileFields = () => {const { t } = useLingui();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [currentWorkspace, setCurrentWorkspace] = useAtomState(currentWorkspaceState,@@ -80,7 +80,7 @@ export const SettingsSecurityEditableProfileFields = () => {const toggleField = (field: string) => {if (!currentWorkspace?.id) {- enqueueErrorSnackBar({ message: t`User is not logged in` });+ enqueueToast({ variant: 'error', children: t`User is not logged in` });return;}@@ -108,9 +108,7 @@ export const SettingsSecurityEditableProfileFields = () => {setCurrentWorkspace((prev) =>prev ? { ...prev, editableProfileFields: previousFields } : prev,);- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(err) ? err : undefined,- });+ enqueueToast(getToastOptionsFromError({ error: err }));});};diff --git a/packages/twenty-front/src/modules/settings/security/components/SettingsSecuritySettings.tsx b/packages/twenty-front/src/modules/settings/security/components/SettingsSecuritySettings.tsxindex dcae97a4cdf..ccded8af01a 100644--- a/packages/twenty-front/src/modules/settings/security/components/SettingsSecuritySettings.tsx+++ b/packages/twenty-front/src/modules/settings/security/components/SettingsSecuritySettings.tsx@@ -1,7 +1,3 @@-import { styled } from '@linaria/react';-import { useLingui } from '@lingui/react/macro';-import { useDebouncedCallback } from 'use-debounce';-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { authProvidersState } from '@/client-config/states/authProvidersState';import { isClickHouseConfiguredState } from '@/client-config/states/isClickHouseConfiguredState';@@ -12,25 +8,30 @@ import { SettingsOptionCardContentCounter } from '@/settings/components/Settingsimport { SettingsRoleDefaultRole } from '@/settings/roles/components/SettingsRolesDefaultRole';import { SettingsRolesQueryEffect } from '@/settings/roles/components/SettingsRolesQueryEffect';import { useSettingsAllRoles } from '@/settings/roles/hooks/useSettingsAllRoles';-import { SettingsSsoIdentitiesProvidersListCard } from '@/settings/security/components/sso/SettingsSsoIdentitiesProvidersListCard';import { SettingsSecurityAuthBypassOptionsList } from '@/settings/security/components/SettingsSecurityAuthBypassOptionsList';import { SettingsSecurityAuthProvidersOptionsList } from '@/settings/security/components/SettingsSecurityAuthProvidersOptionsList';import { SettingsSecurityEditableProfileFields } from '@/settings/security/components/SettingsSecurityEditableProfileFields';+import { SettingsSsoIdentitiesProvidersListCard } from '@/settings/security/components/sso/SettingsSsoIdentitiesProvidersListCard';import { ssoIdentitiesProvidersState } from '@/settings/security/states/ssoIdentitiesProvidersState';import { ImpersonationSwitch } from '@/settings/workspace/components/ImpersonationSwitch';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';+import { styled } from '@linaria/react';+import { useLingui } from '@lingui/react/macro';import { IconClockHour8, IconHistory, IconTrash } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';import { Section } from 'twenty-ui/primitives/layout';import { Card } from 'twenty-ui/primitives/surfaces';+import { H2Title } from 'twenty-ui/primitives/typography';import { themeCssVariables } from 'twenty-ui/theme-constants';+import { useDebouncedCallback } from 'use-debounce';import { UpdateWorkspaceDocument } from '~/generated-metadata/graphql';import { OrganizationAdornment } from '~/pages/settings/enterprise/components/OrganizationAdornment';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';++import { useToast } from 'twenty-ui/primitives/feedback';+const StyledContainer = styled.div`width: 100%;`;@@ -48,7 +49,7 @@ const StyledSectionContainer = styled.div`export const SettingsSecuritySettings = () => {const { t } = useLingui();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const isMultiWorkspaceEnabled = useAtomStateValue(isMultiWorkspaceEnabledState,@@ -71,9 +72,7 @@ export const SettingsSecuritySettings = () => {},});} catch (err) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(err) ? err : undefined,- });+ enqueueToast(getToastOptionsFromError({ error: err }));}}, 500);@@ -87,9 +86,7 @@ export const SettingsSecuritySettings = () => {},});} catch (err) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(err) ? err : undefined,- });+ enqueueToast(getToastOptionsFromError({ error: err }));}}, 500);diff --git a/packages/twenty-front/src/modules/settings/security/components/TwoFactorAuthenticationSwitch.tsx b/packages/twenty-front/src/modules/settings/security/components/TwoFactorAuthenticationSwitch.tsxindex df2eadd40b8..0dbdfc60c30 100644--- a/packages/twenty-front/src/modules/settings/security/components/TwoFactorAuthenticationSwitch.tsx+++ b/packages/twenty-front/src/modules/settings/security/components/TwoFactorAuthenticationSwitch.tsx@@ -1,15 +1,16 @@import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';-import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';++import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';+import { useToast } from 'twenty-ui/primitives/feedback';import { IconLifebuoy } from 'twenty-ui/icon';-import { useMutation } from '@apollo/client/react';import { UpdateWorkspaceDocument } from '~/generated-metadata/graphql';export const TwoFactorAuthenticationSwitch = () => {- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [currentWorkspace, setCurrentWorkspace] = useAtomState(currentWorkspaceState,);@@ -41,10 +42,12 @@ export const TwoFactorAuthenticationSwitch = () => {...currentWorkspace,isTwoFactorAuthenticationEnforced: !newEnforceValue,});- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(err) ? err : undefined,- message: err?.message,- });+ enqueueToast(+ getToastOptionsFromError({+ error: err,+ children: err?.message,+ }),+ );}};diff --git a/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsApprovedAccessDomainsListCard.tsx b/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsApprovedAccessDomainsListCard.tsxindex a694d059b5a..3c125120d5f 100644--- a/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsApprovedAccessDomainsListCard.tsx+++ b/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsApprovedAccessDomainsListCard.tsx@@ -1,3 +1,4 @@+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { Link, useNavigate } from 'react-router-dom';import { SettingsPath } from 'twenty-shared/types';@@ -8,15 +9,14 @@ import { useGetAddedRelativeDateDescription } from '@/settings/hooks/useGetAddedimport { SettingsSecurityApprovedAccessDomainRowDropdownMenu } from '@/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainRowDropdownMenu';import { SettingsSecurityApprovedAccessDomainValidationEffect } from '@/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainValidationEffect';import { approvedAccessDomainsState } from '@/settings/security/states/ApprovedAccessDomainsState';-import { useSnackBarOnQueryError } from '@/apollo/hooks/useSnackBarOnQueryError';+import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';+import { useQuery } from '@apollo/client/react';import { styled } from '@linaria/react';-import { useEffect } from 'react';import { useLingui } from '@lingui/react/macro';-import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';+import { useEffect } from 'react';import { getSettingsPath } from 'twenty-shared/utils';import { Status } from 'twenty-ui/primitives/data-display';import { IconAt, IconMailCog } from 'twenty-ui/icon';-import { useQuery } from '@apollo/client/react';import { GetApprovedAccessDomainsDocument } from '~/generated-metadata/graphql';const StyledLinkContainer = styled.div`@@ -49,43 +49,46 @@ export const SettingsApprovedAccessDomainsListCard = () => {}}, [domainsData, setApprovedAccessDomains]);- useSnackBarOnQueryError(domainsError);-- return loading || !approvedAccessDomains.length ? (- <StyledLinkContainer>- <Link to={getSettingsPath(SettingsPath.NewApprovedAccessDomain)}>- <SettingsCard- title={t`Add Approved Access Domain`}- Icon={<IconMailCog />}- />- </Link>- </StyledLinkContainer>- ) : (+ return (<>- <SettingsSecurityApprovedAccessDomainValidationEffect />- <SettingsListCard- items={approvedAccessDomains}- getItemLabel={({ domain }) => domain}- getItemDescription={({ createdAt }) =>- getAddedRelativeDateDescription(createdAt)- }- RowIcon={IconAt}- RowRightComponent={({ item: approvedAccessDomain }) => (- <>- {!approvedAccessDomain.isValidated && (- <Status color="orange">{t`Pending`}</Status>- )}- <SettingsSecurityApprovedAccessDomainRowDropdownMenu- approvedAccessDomain={approvedAccessDomain}+ <ToastOnQueryErrorEffect error={domainsError} />+ {loading || !approvedAccessDomains.length ? (+ <StyledLinkContainer>+ <Link to={getSettingsPath(SettingsPath.NewApprovedAccessDomain)}>+ <SettingsCard+ title={t`Add Approved Access Domain`}+ Icon={<IconMailCog />}/>- </>- )}- hasFooter- footerButtonLabel={t`Add Approved Access Domain`}- onFooterButtonClick={() =>- navigate(getSettingsPath(SettingsPath.NewApprovedAccessDomain))- }- />+ </Link>+ </StyledLinkContainer>+ ) : (+ <>+ <SettingsSecurityApprovedAccessDomainValidationEffect />+ <SettingsListCard+ items={approvedAccessDomains}+ getItemLabel={({ domain }) => domain}+ getItemDescription={({ createdAt }) =>+ getAddedRelativeDateDescription(createdAt)+ }+ RowIcon={IconAt}+ RowRightComponent={({ item: approvedAccessDomain }) => (+ <>+ {!approvedAccessDomain.isValidated && (+ <Status color="orange">{t`Pending`}</Status>+ )}+ <SettingsSecurityApprovedAccessDomainRowDropdownMenu+ approvedAccessDomain={approvedAccessDomain}+ />+ </>+ )}+ hasFooter+ footerButtonLabel={t`Add Approved Access Domain`}+ onFooterButtonClick={() =>+ navigate(getSettingsPath(SettingsPath.NewApprovedAccessDomain))+ }+ />+ </>+ )}</>);};diff --git a/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainRowDropdownMenu.tsx b/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainRowDropdownMenu.tsxindex 419eb9d7c9a..3649419691e 100644--- a/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainRowDropdownMenu.tsx+++ b/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainRowDropdownMenu.tsx@@ -1,16 +1,16 @@import { approvedAccessDomainsState } from '@/settings/security/states/ApprovedAccessDomainsState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';+import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { isDefined } from 'twenty-shared/utils';import { IconDotsVertical, IconTrash } from 'twenty-ui/icon';+import { useToast } from 'twenty-ui/primitives/feedback';import { LightIconButton } from 'twenty-ui/primitives/input';import { MenuItem } from 'twenty-ui/primitives/navigation';-import { useMutation } from '@apollo/client/react';import {type ApprovedAccessDomain,DeleteApprovedAccessDomainDocument,@@ -27,7 +27,7 @@ export const SettingsSecurityApprovedAccessDomainRowDropdownMenu = ({const setApprovedAccessDomains = useSetAtomState(approvedAccessDomainsState);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { closeDropdown } = useCloseDropdown();@@ -51,11 +51,10 @@ export const SettingsSecurityApprovedAccessDomainRowDropdownMenu = ({},});if (isDefined(result.error)) {- enqueueErrorSnackBar({- message: t`Could not delete approved access domain`,- options: {- duration: 2000,- },+ enqueueToast({+ variant: 'error',+ children: t`Could not delete approved access domain`,+ duration: 2000,});}};diff --git a/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainValidationEffect.tsx b/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainValidationEffect.tsxindex 1bdb62b433d..dfd587bc3e0 100644--- a/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainValidationEffect.tsx+++ b/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainValidationEffect.tsx@@ -1,18 +1,18 @@import { approvedAccessDomainsState } from '@/settings/security/states/ApprovedAccessDomainsState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';+import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { useEffect } from 'react';import { useSearchParams } from 'react-router-dom';-import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { isDefined } from 'twenty-shared/utils';-import { useMutation } from '@apollo/client/react';+import { useToast } from 'twenty-ui/primitives/feedback';import { ValidateApprovedAccessDomainDocument } from '~/generated-metadata/graphql';export const SettingsSecurityApprovedAccessDomainValidationEffect = () => {const [validateApprovedAccessDomainMutation] = useMutation(ValidateApprovedAccessDomainDocument,);- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [searchParams] = useSearchParams();const approvedAccessDomainId = searchParams.get('wtdId');const validationToken = searchParams.get('validationToken');@@ -37,21 +37,19 @@ export const SettingsSecurityApprovedAccessDomainValidationEffect = () => {: approvedAccessDomain.isValidated,})),);- enqueueSuccessSnackBar({- message: t`Approved access domain validated`,- options: {- dedupeKey: 'approved-access-domain-validation-dedupe-key',- },+ enqueueToast({+ variant: 'success',+ children: t`Approved access domain validated`,+ dedupeKey: 'approved-access-domain-validation-dedupe-key',});},onError: (error) => {- enqueueErrorSnackBar({- message: error?.message+ enqueueToast({+ variant: 'error',+ children: error?.message? error.message: t`Error validating approved access domain`,- options: {- dedupeKey: 'approved-access-domain-validation-error-dedupe-key',- },+ dedupeKey: 'approved-access-domain-validation-error-dedupe-key',});},});diff --git a/packages/twenty-front/src/modules/settings/security/components/sso/SettingsSecuritySsoRowDropdownMenu.tsx b/packages/twenty-front/src/modules/settings/security/components/sso/SettingsSecuritySsoRowDropdownMenu.tsxindex 836747f7d9d..76cb8a48043 100644--- a/packages/twenty-front/src/modules/settings/security/components/sso/SettingsSecuritySsoRowDropdownMenu.tsx+++ b/packages/twenty-front/src/modules/settings/security/components/sso/SettingsSecuritySsoRowDropdownMenu.tsx@@ -1,13 +1,13 @@import { useDeleteSsoIdentityProvider } from '@/settings/security/hooks/useDeleteSsoIdentityProvider';import { useUpdateSsoIdentityProvider } from '@/settings/security/hooks/useUpdateSsoIdentityProvider';import { type SsoIdentityProvider } from '@/settings/security/types/SsoIdentityProvider';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';import { useLingui } from '@lingui/react/macro';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { IconArchive, IconDotsVertical, IconTrash } from 'twenty-ui/icon';import { LightIconButton } from 'twenty-ui/primitives/input';import { MenuItem } from 'twenty-ui/primitives/navigation';@@ -22,7 +22,7 @@ export const SettingsSecuritySsoRowDropdownMenu = ({}: SettingsSecuritySsoRowDropdownMenuProps) => {const dropdownId = `settings-account-row-${ssoIdp.id}`;- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { closeDropdown } = useCloseDropdown();@@ -38,11 +38,10 @@ export const SettingsSecuritySsoRowDropdownMenu = ({identityProviderId,});if (isDefined(result.error)) {- enqueueErrorSnackBar({- message: t`Error deleting SSO Identity Provider`,- options: {- duration: 2000,- },+ enqueueToast({+ variant: 'error',+ children: t`Error deleting SSO Identity Provider`,+ duration: 2000,});}};@@ -58,11 +57,10 @@ export const SettingsSecuritySsoRowDropdownMenu = ({: SsoIdentityProviderStatus.Active,});if (isDefined(result.error)) {- enqueueErrorSnackBar({- message: t`Error editing SSO Identity Provider`,- options: {- duration: 2000,- },+ enqueueToast({+ variant: 'error',+ children: t`Error editing SSO Identity Provider`,+ duration: 2000,});}};diff --git a/packages/twenty-front/src/modules/settings/security/components/sso/SettingsSsoIdentitiesProvidersListCard.tsx b/packages/twenty-front/src/modules/settings/security/components/sso/SettingsSsoIdentitiesProvidersListCard.tsxindex e8e4b05be07..59813e5550d 100644--- a/packages/twenty-front/src/modules/settings/security/components/sso/SettingsSsoIdentitiesProvidersListCard.tsx+++ b/packages/twenty-front/src/modules/settings/security/components/sso/SettingsSsoIdentitiesProvidersListCard.tsx@@ -1,10 +1,10 @@/* @license Enterprise */+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { Link } from 'react-router-dom';import { SettingsPath } from 'twenty-shared/types';-import { useSnackBarOnQueryError } from '@/apollo/hooks/useSnackBarOnQueryError';import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { SettingsCard } from '@/settings/components/SettingsCard';import { SettingsSsoIdentitiesProvidersListCardWrapper } from '@/settings/security/components/sso/SettingsSsoIdentitiesProvidersListCardWrapper';@@ -51,21 +51,28 @@ export const SettingsSsoIdentitiesProvidersListCard = () => {}}, [ssoData, setSsoIdentitiesProviders]);- useSnackBarOnQueryError(ssoError);-- return loading || !ssoIdentitiesProviders.length ? (- <StyledLinkContainer- isDisabled={currentWorkspace?.hasValidEnterpriseValidityToken !== true}- >- <Link to={getSettingsPath(SettingsPath.NewSsoIdentityProvider)}>- <SettingsCard- title={t`Add SSO Identity Provider`}- disabled={currentWorkspace?.hasValidEnterpriseValidityToken !== true}- Icon={<IconKey />}- />- </Link>- </StyledLinkContainer>- ) : (- <SettingsSsoIdentitiesProvidersListCardWrapper />+ return (+ <>+ <ToastOnQueryErrorEffect error={ssoError} />+ {loading || !ssoIdentitiesProviders.length ? (+ <StyledLinkContainer+ isDisabled={+ currentWorkspace?.hasValidEnterpriseValidityToken !== true+ }+ >+ <Link to={getSettingsPath(SettingsPath.NewSsoIdentityProvider)}>+ <SettingsCard+ title={t`Add SSO Identity Provider`}+ disabled={+ currentWorkspace?.hasValidEnterpriseValidityToken !== true+ }+ Icon={<IconKey />}+ />+ </Link>+ </StyledLinkContainer>+ ) : (+ <SettingsSsoIdentitiesProvidersListCardWrapper />+ )}+ </>);};diff --git a/packages/twenty-front/src/modules/settings/security/components/sso/SettingsSsoSamlForm.tsx b/packages/twenty-front/src/modules/settings/security/components/sso/SettingsSsoSamlForm.tsxindex 51e369e5dac..6578147a289 100644--- a/packages/twenty-front/src/modules/settings/security/components/sso/SettingsSsoSamlForm.tsx+++ b/packages/twenty-front/src/modules/settings/security/components/sso/SettingsSsoSamlForm.tsx@@ -1,20 +1,20 @@-/* @license Enterprise */-import { parseSamlMetadataFromXmlFile } from '@/settings/security/utils/parseSamlMetadataFromXmlFile';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';-import { type ChangeEvent, useContext, useRef } from 'react';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';+import { type ChangeEvent, useContext, useRef } from 'react';import { useFormContext } from 'react-hook-form';import { isDefined } from 'twenty-shared/utils';import { IconCheck, IconCopy, IconDownload, IconUpload } from 'twenty-ui/icon';+import { Button } from 'twenty-ui/primitives/input';import { HorizontalSeparator, Section } from 'twenty-ui/primitives/layout';import { H2Title } from 'twenty-ui/primitives/typography';-import { Button } from 'twenty-ui/primitives/input';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import { REACT_APP_SERVER_BASE_URL } from '~/config';import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';+/* @license Enterprise */++import { useToast } from 'twenty-ui/primitives/feedback';const StyledUploadFileContainer = styled.div`align-items: center;@@ -51,7 +51,7 @@ const StyledButtonCopy = styled.div`export const SettingsSsoSamlForm = () => {const { theme } = useContext(ThemeContext);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { setValue, getValues, watch, trigger } = useFormContext();const { t } = useLingui();const { copyToClipboard } = useCopyToClipboard();@@ -62,11 +62,10 @@ export const SettingsSsoSamlForm = () => {const samlMetadataParsed = parseSamlMetadataFromXmlFile(text);e.target.value = '';if (!samlMetadataParsed.success) {- return enqueueErrorSnackBar({- message: t`Invalid file: ${samlMetadataParsed.reason}`,- options: {- duration: 5000,- },+ return enqueueToast({+ variant: 'error',+ children: t`Invalid file: ${samlMetadataParsed.reason}`,+ duration: 5000,});}setValue('ssoURL', samlMetadataParsed.data.ssoUrl);@@ -100,11 +99,10 @@ export const SettingsSsoSamlForm = () => {`${REACT_APP_SERVER_BASE_URL}/auth/saml/metadata/${getValues('id')}`,);if (!response.ok) {- return enqueueErrorSnackBar({- message: t`Metadata file generation failed`,- options: {- duration: 2000,- },+ return enqueueToast({+ variant: 'error',+ children: t`Metadata file generation failed`,+ duration: 2000,});}const text = await response.text();diff --git a/packages/twenty-front/src/modules/settings/translations/components/__stories__/SidePanelSettingsMetadataTranslationsPage.stories.tsx b/packages/twenty-front/src/modules/settings/translations/components/__stories__/SidePanelSettingsMetadataTranslationsPage.stories.tsxindex 0e25692a279..2d08326e5de 100644--- a/packages/twenty-front/src/modules/settings/translations/components/__stories__/SidePanelSettingsMetadataTranslationsPage.stories.tsx+++ b/packages/twenty-front/src/modules/settings/translations/components/__stories__/SidePanelSettingsMetadataTranslationsPage.stories.tsx@@ -11,7 +11,7 @@ import { settingsTranslationsSidePanelTargetState } from '@/settings/translationimport { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { ComponentDecorator } from 'twenty-ui/testing';import { RootDecorator } from '~/testing/decorators/RootDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const TargetDecorator: Decorator = (Story) => {jotaiStore.set(settingsTranslationsSidePanelTargetState.atom, {@@ -50,7 +50,7 @@ const meta: Meta<typeof SidePanelSettingsMetadataTranslationsPage> = {TargetDecorator,RootDecorator,ComponentDecorator,- SnackBarDecorator,+ ToastDecorator,],parameters: {msw: {diff --git a/packages/twenty-front/src/modules/settings/two-factor-authentication/components/DeleteTwoFactorAuthenticationMethod.tsx b/packages/twenty-front/src/modules/settings/two-factor-authentication/components/DeleteTwoFactorAuthenticationMethod.tsxindex adec0ebd932..00ffa9fe27b 100644--- a/packages/twenty-front/src/modules/settings/two-factor-authentication/components/DeleteTwoFactorAuthenticationMethod.tsx+++ b/packages/twenty-front/src/modules/settings/two-factor-authentication/components/DeleteTwoFactorAuthenticationMethod.tsx@@ -1,21 +1,21 @@import { useAuth } from '@/auth/hooks/useAuth';import { currentUserState } from '@/auth/states/currentUserState';-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useCurrentUserWorkspaceTwoFactorAuthentication } from '@/settings/two-factor-authentication/hooks/useCurrentUserWorkspaceTwoFactorAuthentication';+import { useCurrentWorkspaceTwoFactorAuthenticationPolicy } from '@/settings/two-factor-authentication/hooks/useWorkspaceTwoFactorAuthenticationPolicy';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useLoadCurrentUser } from '@/users/hooks/useLoadCurrentUser';+import { useMutation } from '@apollo/client/react';import { Trans, useLingui } from '@lingui/react/macro';import { useParams } from 'react-router-dom';import { SettingsPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';-import { H2Title } from 'twenty-ui/primitives/typography';+import { useToast } from 'twenty-ui/primitives/feedback';import { Button } from 'twenty-ui/primitives/input';-import { useMutation } from '@apollo/client/react';+import { H2Title } from 'twenty-ui/primitives/typography';import { DeleteTwoFactorAuthenticationMethodDocument } from '~/generated-metadata/graphql';import { useNavigateSettings } from '~/hooks/useNavigateSettings';-import { useCurrentUserWorkspaceTwoFactorAuthentication } from '@/settings/two-factor-authentication/hooks/useCurrentUserWorkspaceTwoFactorAuthentication';-import { useCurrentWorkspaceTwoFactorAuthenticationPolicy } from '@/settings/two-factor-authentication/hooks/useWorkspaceTwoFactorAuthenticationPolicy';const DELETE_TWO_FACTOR_AUTHENTICATION_MODAL_ID ='delete-two-factor-authentication-modal';@@ -23,7 +23,7 @@ export const DeleteTwoFactorAuthentication = () => {const { t } = useLingui();const { openModal } = useModal();- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { signOut } = useAuth();const { loadCurrentUser } = useLoadCurrentUser();const [deleteTwoFactorAuthenticationMethod] = useMutation(@@ -50,11 +50,10 @@ export const DeleteTwoFactorAuthentication = () => {]?.twoFactorAuthenticationMethodId,)) {- enqueueErrorSnackBar({- message: t`Invalid 2FA information.`,- options: {- dedupeKey: '2fa-dedupe-key',- },+ enqueueToast({+ variant: 'error',+ children: t`Invalid 2FA information.`,+ dedupeKey: '2fa-dedupe-key',});return navigate(SettingsPath.ProfilePage);}@@ -68,11 +67,10 @@ export const DeleteTwoFactorAuthentication = () => {},});- enqueueSuccessSnackBar({- message: t`2FA Method has been deleted successfully.`,- options: {- dedupeKey: '2fa-dedupe-key',- },+ enqueueToast({+ variant: 'success',+ children: t`2FA Method has been deleted successfully.`,+ dedupeKey: '2fa-dedupe-key',});if (isTwoFactorAuthenticationEnforced === true) {diff --git a/packages/twenty-front/src/modules/settings/two-factor-authentication/components/TwoFactorAuthenticationSetupForSettingsEffect.tsx b/packages/twenty-front/src/modules/settings/two-factor-authentication/components/TwoFactorAuthenticationSetupForSettingsEffect.tsxindex 7a89289439a..8ee9ecf2874 100644--- a/packages/twenty-front/src/modules/settings/two-factor-authentication/components/TwoFactorAuthenticationSetupForSettingsEffect.tsx+++ b/packages/twenty-front/src/modules/settings/two-factor-authentication/components/TwoFactorAuthenticationSetupForSettingsEffect.tsx@@ -1,16 +1,16 @@import { currentUserState } from '@/auth/states/currentUserState';import { qrCodeState } from '@/auth/states/qrCode';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useMutation } from '@apollo/client/react';import { useLingui } from '@lingui/react/macro';import { useEffect } from 'react';import { isDefined } from 'twenty-shared/utils';-import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { useToast } from 'twenty-ui/primitives/feedback';import { InitiateOtpProvisioningForAuthenticatedUserDocument } from '~/generated-metadata/graphql';export const TwoFactorAuthenticationSetupForSettingsEffect = () => {- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [qrCode, setQrCode] = useAtomState(qrCodeState);const currentUser = useAtomStateValue(currentUserState);@@ -42,19 +42,17 @@ export const TwoFactorAuthenticationSetupForSettingsEffect = () => {.initiateOTPProvisioningForAuthenticatedUser.uri,);} catch {- enqueueErrorSnackBar({- message: t`Two factor authentication provisioning failed.`,- options: {- dedupeKey:- 'two-factor-authentication-provisioning-initiation-failed',- },+ enqueueToast({+ variant: 'error',+ children: t`Two factor authentication provisioning failed.`,+ dedupeKey: 'two-factor-authentication-provisioning-initiation-failed',});}};handleTwoFactorAuthenticationProvisioningInitiation();}, [- enqueueErrorSnackBar,+ enqueueToast,initiateOTPProvisioningForAuthenticatedUser,t,setQrCode,diff --git a/packages/twenty-front/src/modules/settings/two-factor-authentication/hooks/useTwoFactorVerificationForSettings.ts b/packages/twenty-front/src/modules/settings/two-factor-authentication/hooks/useTwoFactorVerificationForSettings.tsindex c38f7097714..95bb4819402 100644--- a/packages/twenty-front/src/modules/settings/two-factor-authentication/hooks/useTwoFactorVerificationForSettings.ts+++ b/packages/twenty-front/src/modules/settings/two-factor-authentication/hooks/useTwoFactorVerificationForSettings.ts@@ -1,16 +1,16 @@import { type OTPFormValues } from '@/auth/sign-in-up/hooks/useTwoFactorAuthenticationForm';import { VERIFY_TWO_FACTOR_AUTHENTICATION_METHOD_FOR_AUTHENTICATED_USER } from '@/settings/two-factor-authentication/graphql/mutations/verifyTwoFactorAuthenticationMethod';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useLoadCurrentUser } from '@/users/hooks/useLoadCurrentUser';import { useMutation } from '@apollo/client/react';import { useLingui } from '@lingui/react/macro';import { useState } from 'react';import { useForm } from 'react-hook-form';import { SettingsPath } from 'twenty-shared/types';+import { useToast } from 'twenty-ui/primitives/feedback';import { useNavigateSettings } from '~/hooks/useNavigateSettings';export const useTwoFactorVerificationForSettings = () => {- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const navigate = useNavigateSettings();const { t } = useLingui();const [isLoading, setIsLoading] = useState(false);@@ -32,8 +32,9 @@ export const useTwoFactorVerificationForSettings = () => {const canSave = !isSubmitting && otpValue?.length === 6;const handleVerificationSuccess = async () => {- enqueueSuccessSnackBar({- message: t`Two-factor authentication setup completed successfully!`,+ enqueueToast({+ variant: 'success',+ children: t`Two-factor authentication setup completed successfully!`,});await loadCurrentUser();@@ -53,8 +54,9 @@ export const useTwoFactorVerificationForSettings = () => {await handleVerificationSuccess();} catch {- enqueueErrorSnackBar({- message: t`Invalid verification code. Please try again.`,+ enqueueToast({+ variant: 'error',+ children: t`Invalid verification code. Please try again.`,});} finally {setIsLoading(false);diff --git a/packages/twenty-front/src/modules/settings/workspace-member/components/WorkspaceMemberPictureUploader.tsx b/packages/twenty-front/src/modules/settings/workspace-member/components/WorkspaceMemberPictureUploader.tsxindex 869a34037d2..b9c8d88faa8 100644--- a/packages/twenty-front/src/modules/settings/workspace-member/components/WorkspaceMemberPictureUploader.tsx+++ b/packages/twenty-front/src/modules/settings/workspace-member/components/WorkspaceMemberPictureUploader.tsx@@ -4,13 +4,13 @@ import { useState } from 'react';import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';import { useCanEditProfileField } from '@/settings/profile/hooks/useCanEditProfileField';import { useUpdateWorkspaceMemberSettings } from '@/settings/profile/hooks/useUpdateWorkspaceMemberSettings';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { ImageInput } from '@/ui/input/components/ImageInput';-import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { useMutation } from '@apollo/client/react';import { FileFolder } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { REACT_APP_SERVER_BASE_URL } from '~/config';import { UploadWorkspaceMemberProfilePictureDocument } from '~/generated-metadata/graphql';import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';@@ -28,7 +28,7 @@ export const WorkspaceMemberPictureUploader = ({onAvatarUpdated,disabled = false,}: WorkspaceMemberPictureUploaderProps) => {- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [isUploading, setIsUploading] = useState(false);const [errorMessage, setErrorMessage] = useState<string | null>(null);const [uploadController, setUploadController] =@@ -101,7 +101,7 @@ export const WorkspaceMemberPictureUploader = ({const message =error instanceof Error ? error.message : t`Failed to upload picture`;setErrorMessage(t`An error occurred while uploading the picture.`);- enqueueErrorSnackBar({ message });+ enqueueToast({ variant: 'error', children: message });} finally {setIsUploading(false);}@@ -130,7 +130,7 @@ export const WorkspaceMemberPictureUploader = ({const message =error instanceof Error ? error.message : t`Failed to remove picture`;setErrorMessage(t`An error occurred while removing the picture.`);- enqueueErrorSnackBar({ message });+ enqueueToast({ variant: 'error', children: message });} finally {setIsUploading(false);}diff --git a/packages/twenty-front/src/modules/settings/workspace/components/ImpersonationSwitch.tsx b/packages/twenty-front/src/modules/settings/workspace/components/ImpersonationSwitch.tsxindex 79f16eb6da2..ac6c03deef8 100644--- a/packages/twenty-front/src/modules/settings/workspace/components/ImpersonationSwitch.tsx+++ b/packages/twenty-front/src/modules/settings/workspace/components/ImpersonationSwitch.tsx@@ -1,16 +1,18 @@import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';-import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';++import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { IconLifebuoy } from 'twenty-ui/icon';import { Card } from 'twenty-ui/primitives/surfaces';-import { useMutation } from '@apollo/client/react';import { UpdateWorkspaceDocument } from '~/generated-metadata/graphql';+import { useToast } from 'twenty-ui/primitives/feedback';+export const ImpersonationSwitch = () => {- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [currentWorkspace, setCurrentWorkspace] = useAtomState(currentWorkspaceState,@@ -35,9 +37,7 @@ export const ImpersonationSwitch = () => {allowImpersonation: value,});} catch (err: any) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(err) ? err : undefined,- });+ enqueueToast(getToastOptionsFromError({ error: err }));}};diff --git a/packages/twenty-front/src/modules/settings/workspace/components/SettingsWorkspaceEmailSyncSection.tsx b/packages/twenty-front/src/modules/settings/workspace/components/SettingsWorkspaceEmailSyncSection.tsxindex b639cfbe6ad..d27cf825b3b 100644--- a/packages/twenty-front/src/modules/settings/workspace/components/SettingsWorkspaceEmailSyncSection.tsx+++ b/packages/twenty-front/src/modules/settings/workspace/components/SettingsWorkspaceEmailSyncSection.tsx@@ -1,11 +1,11 @@import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { useLingui } from '@lingui/react/macro';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { IconMail } from 'twenty-ui/icon';import { Section } from 'twenty-ui/primitives/layout';import { Card } from 'twenty-ui/primitives/surfaces';@@ -18,7 +18,7 @@ export const SettingsWorkspaceEmailSyncSection = () => {const [currentWorkspace, setCurrentWorkspace] = useAtomState(currentWorkspaceState,);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [updateWorkspace] = useMutation(UpdateWorkspaceDocument);const handleSyncInternalEmailsChange = (value: boolean) => {@@ -41,10 +41,8 @@ export const SettingsWorkspaceEmailSyncSection = () => {isInternalMessagesImportEnabled: value,},},- }).catch((err) => {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(err) ? err : undefined,- });+ }).catch((error) => {+ enqueueToast(getToastOptionsFromError({ error }));});};diff --git a/packages/twenty-front/src/modules/side-panel/components/__stories__/SidePanelTopBar.stories.tsx b/packages/twenty-front/src/modules/side-panel/components/__stories__/SidePanelTopBar.stories.tsxindex 597f2c8ddb2..d4b581671c9 100644--- a/packages/twenty-front/src/modules/side-panel/components/__stories__/SidePanelTopBar.stories.tsx+++ b/packages/twenty-front/src/modules/side-panel/components/__stories__/SidePanelTopBar.stories.tsx@@ -16,7 +16,7 @@ import { SidePanelPages } from 'twenty-shared/types';import { IconDotsVertical } from 'twenty-ui/icon';import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const ROOT_PAGE: SidePanelNavigationStackItem = {page: SidePanelPages.CommandMenuDisplay,@@ -48,7 +48,7 @@ const meta: Meta<typeof SidePanelTopBar> = {component: SidePanelTopBar,decorators: [ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,ComponentWithRouterDecorator,],};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 eacc7a1b19e..6513fc8f73c 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@@ -1,7 +1,7 @@-import { useEffect, useState } from 'react';import { type Meta, type StoryObj } from '@storybook/react-vite';import { useStore } from 'jotai';-import { graphql, HttpResponse } from 'msw';+import { HttpResponse, graphql } from 'msw';+import { useEffect, useState } from 'react';import { expect, userEvent, within } from 'storybook/test';import { CoreObjectNameSingular } from 'twenty-shared/types';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';@@ -15,7 +15,7 @@ import { composeEmailDefaultSubjectComponentState } from '@/side-panel/pages/comimport { composeEmailDefaultToComponentState } from '@/side-panel/pages/compose-email/states/composeEmailDefaultToComponentState';import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';@@ -209,7 +209,7 @@ const meta = {decorators: [ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,RouterDecorator,WorkspaceDecorator,],diff --git a/packages/twenty-front/src/modules/side-panel/pages/compose-calendar-event/components/SidePanelComposeCalendarEventPage.tsx b/packages/twenty-front/src/modules/side-panel/pages/compose-calendar-event/components/SidePanelComposeCalendarEventPage.tsxindex ea2833a8203..4c5099f4f38 100644--- a/packages/twenty-front/src/modules/side-panel/pages/compose-calendar-event/components/SidePanelComposeCalendarEventPage.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/compose-calendar-event/components/SidePanelComposeCalendarEventPage.tsx@@ -5,7 +5,6 @@ import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId';import { useSidePanelHistory } from '@/side-panel/hooks/useSidePanelHistory';import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu';import { composeCalendarEventInitialValuesComponentState } from '@/side-panel/pages/compose-calendar-event/states/composeCalendarEventInitialValuesComponentState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { SidePanelFooter } from '@/ui/layout/side-panel/components/SidePanelFooter';import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';@@ -13,6 +12,7 @@ import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { ConnectedAccountProvider, SettingsPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { IconCalendarEvent, IconTrash } from 'twenty-ui/icon';import { Button, IconButton } from 'twenty-ui/primitives/input';import { getOsControlSymbol } from 'twenty-ui/utilities';@@ -32,7 +32,7 @@ export const SidePanelComposeCalendarEventPage = () => {const { closeSidePanelMenu } = useSidePanelMenu();const navigateSettings = useNavigateSettings();const { triggerApisOAuth } = useTriggerApisOAuth();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const composerState = useCalendarEventComposer({initialValues: composeCalendarEventInitialValues,@@ -69,8 +69,9 @@ export const SidePanelComposeCalendarEventPage = () => {loginHint: selectedAccount.handle,});} catch {- enqueueErrorSnackBar({- message: t`Failed to reconnect calendar account`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to reconnect calendar account`,});}};diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/__stories__/SidePanelPageLayoutTabSettingsContent.stories.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/__stories__/SidePanelPageLayoutTabSettingsContent.stories.tsxindex 0c8dac1ea29..e69be1b832f 100644--- a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/__stories__/SidePanelPageLayoutTabSettingsContent.stories.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/__stories__/SidePanelPageLayoutTabSettingsContent.stories.tsx@@ -10,8 +10,8 @@ import {makeTab,makeWidget,} from '@/page-layout/testing/pageLayoutDraftFixtures';-import { getTabListInstanceIdFromPageLayoutAndRecord } from '@/page-layout/utils/getTabListInstanceIdFromPageLayoutAndRecord';import { getIsFirstTabPinned } from '@/page-layout/utils/getIsFirstTabPinned';+import { getTabListInstanceIdFromPageLayoutAndRecord } from '@/page-layout/utils/getTabListInstanceIdFromPageLayoutAndRecord';import { getTabsByDisplayMode } from '@/page-layout/utils/getTabsByDisplayMode';import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId';import { SidePanelPageLayoutTabSettingsContent } from '@/side-panel/pages/page-layout/components/SidePanelPageLayoutTabSettingsContent';@@ -21,14 +21,14 @@ import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabimport { TabListComponentInstanceContext } from '@/ui/layout/tab-list/states/contexts/TabListComponentInstanceContext';import { focusStackState } from '@/ui/utilities/focus/states/focusStackState';import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';-import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';-import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';+import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';+import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { type Meta, type StoryObj } from '@storybook/react-vite';import { MemoryRouter, useLocation } from 'react-router-dom';import { expect, userEvent, waitFor, within } from 'storybook/test';import { PageLayoutType } from '~/generated-metadata/graphql';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const PAGE_LAYOUT_ID = 'tab-settings-story';const RECORD_ID = 'record-id';@@ -141,7 +141,7 @@ const meta: Meta<typeof SidePanelPageLayoutTabSettingsContent> = {]);},decorators: [- SnackBarDecorator,+ ToastDecorator,(Story, { parameters }) => (<MemoryRouterinitialEntries={[diff --git a/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordsPage.tsx b/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordsPage.tsxindex 0796b5733f7..1041d61582e 100644--- a/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordsPage.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordsPage.tsx@@ -1,3 +1,4 @@+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { useCloseCommandMenu } from '@/command-menu-item/hooks/useCloseCommandMenu';import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem';import { SidePanelGroup } from '@/side-panel/components/SidePanelGroup';@@ -33,7 +34,8 @@ const previewTooltipClass = css`export const SidePanelSearchRecordsPage = () => {const { t } = useLingui();- const { searchResultItems, loading, noResults } = useSidePanelSearchRecords();+ const { searchResultItems, loading, noResults, error } =+ useSidePanelSearchRecords();const { openRecordInSidePanel } = useOpenRecordInSidePanel();const { closeCommandMenu } = useCloseCommandMenu();const navigate = useNavigate();@@ -50,6 +52,8 @@ export const SidePanelSearchRecordsPage = () => {return (<>+ <ToastOnQueryErrorEffect error={error} />+<SidePanelListselectableItemIds={selectableItemIds}loading={loading}diff --git a/packages/twenty-front/src/modules/side-panel/pages/search/hooks/useSidePanelSearchRecordPreviewItem.ts b/packages/twenty-front/src/modules/side-panel/pages/search/hooks/useSidePanelSearchRecordPreviewItem.tsindex 0cac675de42..4e6e2511d98 100644--- a/packages/twenty-front/src/modules/side-panel/pages/search/hooks/useSidePanelSearchRecordPreviewItem.ts+++ b/packages/twenty-front/src/modules/side-panel/pages/search/hooks/useSidePanelSearchRecordPreviewItem.ts@@ -1,5 +1,5 @@import { SIDE_PANEL_SELECTABLE_LIST_ID } from '@/side-panel/constants/SidePanelSelectableListId';-import { type SearchResultItem } from '@/side-panel/pages/search/hooks/useSidePanelSearchRecords';+import { type SearchResultItem } from '@/side-panel/pages/search/types/SearchResultItem';import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';diff --git a/packages/twenty-front/src/modules/side-panel/pages/search/hooks/useSidePanelSearchRecords.tsx b/packages/twenty-front/src/modules/side-panel/pages/search/hooks/useSidePanelSearchRecords.tsxindex 5a31977315d..91520d01091 100644--- a/packages/twenty-front/src/modules/side-panel/pages/search/hooks/useSidePanelSearchRecords.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/search/hooks/useSidePanelSearchRecords.tsx@@ -1,3 +1,4 @@+import { type SearchResultItem } from '@/side-panel/pages/search/types/SearchResultItem';import { useObjectRecordSearchRecords } from '@/object-record/hooks/useObjectRecordSearchRecords';import { useReadableObjectMetadataItems } from '@/object-metadata/hooks/useReadableObjectMetadataItems';import { useSearchableObjectNameSingulars } from '@/side-panel/hooks/useSearchableObjectNameSingulars';@@ -8,16 +9,6 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateimport { useMemo } from 'react';import { useDebounce } from 'use-debounce';-export type SearchResultItem = {- id: string;- label: string;- objectNameSingular: string;- recordId: string;- imageUrl?: string | null;- objectLabel: string;- avatarShape: 'square' | 'circle';-};-export const useSidePanelSearchRecords = () => {const sidePanelSearch = useAtomStateValue(sidePanelSearchState);const sidePanelSearchObjectFilter = useAtomStateValue(@@ -31,7 +22,7 @@ export const useSidePanelSearchRecords = () => {selectedObjectNameSingular: sidePanelSearchObjectFilter,});- const { loading, searchRecords } = useObjectRecordSearchRecords({+ const { loading, searchRecords, error } = useObjectRecordSearchRecords({objectNameSingulars: includedObjectNameSingulars,searchInput: deferredSidePanelSearch,});@@ -55,6 +46,7 @@ export const useSidePanelSearchRecords = () => {}, [searchRecords, readableObjectMetadataItems]);return {+ error,loading,noResults: !searchResultItems.length,searchResultItems,diff --git a/packages/twenty-front/src/modules/side-panel/pages/search/types/SearchResultItem.ts b/packages/twenty-front/src/modules/side-panel/pages/search/types/SearchResultItem.tsnew file mode 100644index 00000000000..74a87053c9c--- /dev/null+++ b/packages/twenty-front/src/modules/side-panel/pages/search/types/SearchResultItem.ts@@ -0,0 +1,9 @@+export type SearchResultItem = {+ id: string;+ label: string;+ objectNameSingular: string;+ recordId: string;+ imageUrl?: string | null;+ objectLabel: string;+ avatarShape: 'square' | 'circle';+};diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepper.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepper.tsxindex 3854b4d0544..0c20880fe80 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepper.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepper.tsx@@ -1,18 +1,16 @@-import { useCallback, useContext, useState } from 'react';import { useSpreadsheetImportInternal } from '@/spreadsheet-import/hooks/useSpreadsheetImportInternal';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { ModalContent } from 'twenty-ui/primitives/surfaces';-import { ImportDataStep } from '@/spreadsheet-import/steps/components/ImportDataStep';import { type SpreadsheetImportStep } from '@/spreadsheet-import/steps/types/SpreadsheetImportStep';import { SpreadsheetImportStepType } from '@/spreadsheet-import/steps/types/SpreadsheetImportStepType';-import { CircularProgressBar } from 'twenty-ui/primitives/feedback';+import { useCallback, useContext, useState } from 'react';+import { CircularProgressBar, useToast } from 'twenty-ui/primitives/feedback';+import { ModalContent } from 'twenty-ui/primitives/surfaces';+import { ThemeContext } from 'twenty-ui/theme-constants';import { MatchColumnsStep } from './MatchColumnsStep/MatchColumnsStep';import { SelectHeaderStep } from './SelectHeaderStep/SelectHeaderStep';import { SelectSheetStep } from './SelectSheetStep/SelectSheetStep';import { UploadStep } from './UploadStep/UploadStep';import { ValidationStep } from './ValidationStep/ValidationStep';-import { ThemeContext } from 'twenty-ui/theme-constants';type SpreadsheetImportStepperProps = {nextStep: () => void;@@ -37,15 +35,13 @@ export const SpreadsheetImportStepper = ({const [uploadedFile, setUploadedFile] = useState<File | null>(null);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const handleError = useCallback((description: string) => {- enqueueErrorSnackBar({- message: description,- });+ enqueueToast({ variant: 'error', children: description });},- [enqueueErrorSnackBar],+ [enqueueToast],);const handleBack = useCallback(() => {diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/UploadStep/components/DropZone.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/UploadStep/components/DropZone.tsxindex 7f544070f48..79557adbed6 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/UploadStep/components/DropZone.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/UploadStep/components/DropZone.tsx@@ -1,17 +1,17 @@-import { styled } from '@linaria/react';-import { themeCssVariables } from 'twenty-ui/theme-constants';-import { useState } from 'react';-import { useDropzone } from 'react-dropzone';-import { read, type WorkBook } from 'xlsx-ugnis';-import { useNumberFormat } from '@/localization/hooks/useNumberFormat';import { SPREADSHEET_MAX_RECORD_IMPORT_CAPACITY } from '@/spreadsheet-import/constants/SpreadsheetMaxRecordImportCapacity';import { useSpreadsheetImportInternal } from '@/spreadsheet-import/hooks/useSpreadsheetImportInternal';import { useDownloadFakeRecords } from '@/spreadsheet-import/steps/components/UploadStep/hooks/useDownloadFakeRecords';import { readFileAsync } from '@/spreadsheet-import/utils/readFilesAsync';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { styled } from '@linaria/react';import { Trans, useLingui } from '@lingui/react/macro';+import { useState } from 'react';+import { useDropzone } from 'react-dropzone';import { MainButton } from 'twenty-ui/primitives/input';+import { themeCssVariables } from 'twenty-ui/theme-constants';+import { read, type WorkBook } from 'xlsx-ugnis';++import { useToast } from 'twenty-ui/primitives/feedback';const StyledContainer = styled.div`align-items: center;@@ -117,7 +117,7 @@ export const DropZone = ({ onContinue, isLoading }: DropZoneProps) => {const [loading, setLoading] = useState(false);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { downloadSample } = useDownloadFakeRecords();@@ -137,11 +137,10 @@ export const DropZone = ({ onContinue, isLoading }: DropZoneProps) => {setLoading(false);fileRejections.forEach((fileRejection) => {const fileName = fileRejection.file.name;- enqueueErrorSnackBar({- message: t`${fileName} upload rejected`,- options: {- detailedMessage: fileRejection.errors[0].message,- },+ enqueueToast({+ variant: 'error',+ children: t`${fileName} upload rejected`,+ description: fileRejection.errors[0].message,});});},diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/MatchColumns.stories.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/MatchColumns.stories.tsxindex 8ae587e3551..d5f59338695 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/MatchColumns.stories.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/MatchColumns.stories.tsx@@ -6,7 +6,7 @@ import { SpreadSheetImportModalWrapper } from '@/spreadsheet-import/components/Simport { MatchColumnsStep } from '@/spreadsheet-import/steps/components/MatchColumnsStep/MatchColumnsStep';import { type SpreadsheetImportStep } from '@/spreadsheet-import/steps/types/SpreadsheetImportStep';import { DialogComponentInstanceContext } from '@/ui/feedback/dialog-manager/contexts/DialogComponentInstanceContext';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const meta: Meta<typeof MatchColumnsStep> = {title: 'Modules/SpreadsheetImport/MatchColumnsStep',@@ -14,7 +14,7 @@ const meta: Meta<typeof MatchColumnsStep> = {parameters: {layout: 'fullscreen',},- decorators: [SnackBarDecorator],+ decorators: [ToastDecorator],};export default meta;diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/Steps.stories.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/Steps.stories.tsxindex cb5de9ec61c..c78c55e222a 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/Steps.stories.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/Steps.stories.tsx@@ -1,6 +1,6 @@import { type Meta, type StoryObj } from '@storybook/react-vite';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { SpreadsheetImportStepperContainer } from '@/spreadsheet-import/steps/components/SpreadsheetImportStepperContainer';import { stepBarInternalState } from '@/ui/navigation/step-bar/states/stepBarInternalState';@@ -11,7 +11,7 @@ const meta: Meta<typeof SpreadsheetImportStepperContainer> = {title: 'Modules/SpreadsheetImport/Steps',component: SpreadsheetImportStepperContainer,decorators: [- SnackBarDecorator,+ ToastDecorator,ObjectMetadataItemsDecorator,ContextStoreDecorator,],diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/Upload.stories.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/Upload.stories.tsxindex 363c4344050..528b44a905f 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/Upload.stories.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/Upload.stories.tsx@@ -11,7 +11,7 @@ import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { Provider as JotaiProvider } from 'jotai';import { ContextStoreDecorator } from '~/testing/decorators/ContextStoreDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const meta: Meta<typeof UploadStep> = {title: 'Modules/SpreadsheetImport/UploadStep',@@ -35,7 +35,7 @@ const meta: Meta<typeof UploadStep> = {</JotaiProvider>);},- SnackBarDecorator,+ ToastDecorator,],};diff --git a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/SnackBar.tsx b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/SnackBar.tsxdeleted file mode 100644index 0a71c201558..00000000000--- a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/SnackBar.tsx+++ /dev/null@@ -1,100 +0,0 @@-import { sanitizeMessageToRenderInSnackbar } from '@/ui/feedback/snack-bar-manager/utils/sanitizeMessageToRenderInSnackbar';-import { msg } from '@lingui/core/macro';-import { useLingui } from '@lingui/react/macro';-import { type ComponentPropsWithoutRef, type ReactNode } from 'react';-import { isDefined } from 'twenty-shared/utils';-import { Toast } from 'twenty-ui/primitives/feedback';-import { LightButton } from 'twenty-ui/primitives/input';-import { UndecoratedLink } from 'twenty-ui/primitives/navigation';--export enum SnackBarVariant {- Default = 'default',- Error = 'error',- Success = 'success',- Info = 'info',- Warning = 'warning',-}--export type SnackBarProps = Pick<ComponentPropsWithoutRef<'div'>, 'id'> & {- className?: string;- progress?: number;- duration?: number;- icon?: ReactNode;- message: string;- buttonLabel?: string;- buttonOnClick?: () => void;- buttonTo?: string;- detailedMessage?: string;- onCancel?: () => void;- onClose?: () => void;- role?: 'alert' | 'status';- variant?: SnackBarVariant;- dedupeKey?: string;-};--const DEFAULT_ARIA_LABEL_BY_VARIANT: Record<- SnackBarVariant,- ReturnType<typeof msg>-> = {- [SnackBarVariant.Default]: msg`Alert`,- [SnackBarVariant.Error]: msg`Error`,- [SnackBarVariant.Info]: msg`Info`,- [SnackBarVariant.Success]: msg`Success`,- [SnackBarVariant.Warning]: msg`Warning`,-};--export const SnackBar = ({- className,- progress,- duration,- icon,- id,- message,- detailedMessage,- buttonLabel,- buttonOnClick,- buttonTo,- onCancel,- onClose,- role,- variant = SnackBarVariant.Default,-}: SnackBarProps) => {- const { i18n, t } = useLingui();- const iconLabel = i18n._(DEFAULT_ARIA_LABEL_BY_VARIANT[variant]);- const sanitizedMessage = sanitizeMessageToRenderInSnackbar(message);- const sanitizedDetailedMessage =- sanitizeMessageToRenderInSnackbar(detailedMessage);-- const hasAction =- isDefined(buttonLabel) && (isDefined(buttonOnClick) || isDefined(buttonTo));- const action = isDefined(buttonTo) ? (- <UndecoratedLink to={buttonTo}>- <LightButton title={buttonLabel} />- </UndecoratedLink>- ) : (- <LightButton title={buttonLabel} onClick={buttonOnClick} />- );-- return (- <Toast- className={className}- progress={progress}- duration={duration}- icon={icon}- iconLabel={iconLabel}- id={id}- onCancel={onCancel}- onClose={onClose}- role={role}- variant={variant}- title={sanitizedMessage ?? iconLabel}- description={sanitizedDetailedMessage}- cancelLabel={t`Cancel`}- closeLabel={t`Close`}- action={hasAction ? action : undefined}- data-globally-prevent-click-outside- >- {sanitizedMessage ?? ''}- </Toast>- );-};diff --git a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/SnackBarProvider.tsx b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/SnackBarProvider.tsxdeleted file mode 100644index d3211d7da00..00000000000--- a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/SnackBarProvider.tsx+++ /dev/null@@ -1,94 +0,0 @@-import { styled } from '@linaria/react';-import { AnimatePresence, motion } from 'framer-motion';--import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';--import { snackBarInternalComponentState } from '@/ui/feedback/snack-bar-manager/states/snackBarInternalComponentState';-import { RootStackingContextZIndices } from '@/ui/layout/constants/RootStackingContextZIndices';-import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';-import { MOBILE_VIEWPORT, themeCssVariables } from 'twenty-ui/theme-constants';-import { SnackBar } from './SnackBar';--const StyledSnackBarContainer = styled.div`- bottom: ${themeCssVariables.spacing[3]};- display: flex;- flex-direction: column;- position: fixed;- right: ${themeCssVariables.spacing[3]};- z-index: ${RootStackingContextZIndices.SnackBar};-- @media (max-width: ${MOBILE_VIEWPORT}px) {- bottom: auto;- left: 0;- right: 0;- top: 0;- }-`;--export const SnackBarProvider = ({ children }: React.PropsWithChildren) => {- const snackBarInternal = useAtomComponentStateValue(- snackBarInternalComponentState,- );-- const { handleSnackBarClose } = useSnackBar();- const isMobile = useIsMobile();-- const variants = {- out: {- opacity: 0,- y: isMobile ? -40 : 40,- },- in: {- opacity: 1,- y: 0,- },- };-- return (- <>- {children}- <StyledSnackBarContainer>- <AnimatePresence>- {snackBarInternal.queue.map(- ({- duration,- icon,- id,- message,- detailedMessage,- variant,- buttonLabel,- buttonOnClick,- buttonTo,- }) => (- <motion.div- key={id}- variants={variants}- initial="out"- animate="in"- exit="out"- transition={{ duration: 0.5 }}- layout- >- <SnackBar- {...{- duration,- icon,- message,- detailedMessage,- variant,- buttonLabel,- buttonOnClick,- buttonTo,- }}- onClose={() => handleSnackBarClose(id)}- />- </motion.div>- ),- )}- </AnimatePresence>- </StyledSnackBarContainer>- </>- );-};diff --git a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/__stories__/SnackBar.stories.tsx b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/__stories__/SnackBar.stories.tsxdeleted file mode 100644index faefb612491..00000000000--- a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/__stories__/SnackBar.stories.tsx+++ /dev/null@@ -1,111 +0,0 @@-import { type Meta, type StoryObj } from '@storybook/react-vite';-import { fn } from 'storybook/test';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';--import {- SnackBar,- SnackBarVariant,-} from '@/ui/feedback/snack-bar-manager/components/SnackBar';-import {- CatalogDecorator,- type CatalogStory,- ComponentDecorator,-} from 'twenty-ui/testing';--const meta: Meta<typeof SnackBar> = {- title: 'UI/Feedback/SnackBarManager/SnackBar',- component: SnackBar,- decorators: [SnackBarDecorator],- argTypes: {- className: { control: false },- icon: { control: false },- },- args: {- message: 'Lorem ipsum',- detailedMessage:- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec purus nec eros tincidunt lacinia.',- onCancel: undefined,- onClose: fn(),- role: 'status',- variant: SnackBarVariant.Default,- },-};--export default meta;-type Story = StoryObj<typeof SnackBar>;--export const Default: Story = {- decorators: [ComponentDecorator],- parameters: {- chromatic: { disableSnapshot: true },- },-};--export const WithBottomButton: Story = {- args: {- variant: SnackBarVariant.Error,- message: 'An error has occurred',- detailedMessage: 'Error during useFindManyRecord...',- buttonLabel: 'Open Record',- buttonOnClick: fn(),- },- decorators: [ComponentDecorator],- parameters: {- chromatic: { disableSnapshot: true },- },-};--export const SuccessWithButton: Story = {- args: {- variant: SnackBarVariant.Success,- message: 'Record created successfully',- buttonLabel: 'View Record',- buttonOnClick: fn(),- },- decorators: [ComponentDecorator],- parameters: {- chromatic: { disableSnapshot: true },- },-};--export const Catalog: CatalogStory<Story, typeof SnackBar> = {- args: {- onCancel: fn(),- },- decorators: [CatalogDecorator],- parameters: {- catalog: {- dimensions: [- {- name: 'progress',- values: [0, 75, 100],- props: (progress) => ({ progress }),- },- {- name: 'variants',- values: Object.values(SnackBarVariant),- props: (variant: SnackBarVariant) => ({ variant }),- },- ],- },- },-};--export const CatalogWithButton: CatalogStory<Story, typeof SnackBar> = {- args: {- buttonLabel: 'Open Record',- buttonOnClick: fn(),- },- decorators: [CatalogDecorator],- parameters: {- catalog: {- dimensions: [- {- name: 'variants',- values: Object.values(SnackBarVariant),- props: (variant: SnackBarVariant) => ({ variant }),- },- ],- },- },-};diff --git a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/contexts/SnackBarComponentInstanceContext.ts b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/contexts/SnackBarComponentInstanceContext.tsdeleted file mode 100644index 9105eea8e75..00000000000--- a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/contexts/SnackBarComponentInstanceContext.ts+++ /dev/null@@ -1,4 +0,0 @@-import { createComponentInstanceContext } from '@/ui/utilities/state/component-state/utils/createComponentInstanceContext';--export const SnackBarComponentInstanceContext =- createComponentInstanceContext();diff --git a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/hooks/useSnackBar.ts b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/hooks/useSnackBar.tsdeleted file mode 100644index 035d895800d..00000000000--- a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/hooks/useSnackBar.ts+++ /dev/null@@ -1,167 +0,0 @@-import { useCallback } from 'react';-import { v4 as uuidv4 } from 'uuid';--import { SnackBarVariant } from '@/ui/feedback/snack-bar-manager/components/SnackBar';-import { SnackBarComponentInstanceContext } from '@/ui/feedback/snack-bar-manager/contexts/SnackBarComponentInstanceContext';-import {- snackBarInternalComponentState,- type SnackBarOptions,-} from '@/ui/feedback/snack-bar-manager/states/snackBarInternalComponentState';-import { buildErrorAction } from '@/ui/feedback/snack-bar-manager/utils/buildErrorAction';-import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';-import { type ErrorLike } from '@apollo/client';-import { t } from '@lingui/core/macro';-import { useStore } from 'jotai';-import { isDefined } from 'twenty-shared/utils';-import { getErrorMessageFromApolloError } from '~/utils/get-error-message-from-apollo-error.util';--export const useSnackBar = () => {- const componentInstanceId = useAvailableComponentInstanceIdOrThrow(- SnackBarComponentInstanceContext,- );-- const store = useStore();-- const handleSnackBarClose = useCallback(- (id: string) => {- store.set(- snackBarInternalComponentState.atomFamily({- instanceId: componentInstanceId,- }),- (prevState) => ({- ...prevState,- queue: prevState.queue.filter((snackBar) => snackBar.id !== id),- }),- );- },- [componentInstanceId, store],- );-- const setSnackBarQueue = useCallback(- (newValue: SnackBarOptions) =>- store.set(- snackBarInternalComponentState.atomFamily({- instanceId: componentInstanceId,- }),- (prev) => {- if (- isDefined(newValue.dedupeKey) &&- prev.queue.some(- (snackBar) => snackBar.dedupeKey === newValue.dedupeKey,- )- ) {- return prev;- }-- if (prev.queue.length >= prev.maxQueue) {- return {- ...prev,- queue: [...prev.queue.slice(1), newValue] as SnackBarOptions[],- };- }-- return {- ...prev,- queue: [...prev.queue, newValue] as SnackBarOptions[],- };- },- ),- [componentInstanceId, store],- );-- const enqueueSuccessSnackBar = useCallback(- ({- message,- options,- }: {- message: string;- options?: Omit<SnackBarOptions, 'message' | 'id'>;- }) => {- setSnackBarQueue({- id: uuidv4(),- message,- ...options,- variant: SnackBarVariant.Success,- });- },- [setSnackBarQueue],- );-- const enqueueInfoSnackBar = useCallback(- ({- message,- options,- }: {- message: string;- options?: Omit<SnackBarOptions, 'message' | 'id'>;- }) => {- setSnackBarQueue({- id: uuidv4(),- message,- ...options,- variant: SnackBarVariant.Info,- });- },- [setSnackBarQueue],- );-- const enqueueWarningSnackBar = useCallback(- ({- message,- options,- }: {- message: string;- options?: Omit<SnackBarOptions, 'message' | 'id'>;- }) => {- setSnackBarQueue({- id: uuidv4(),- message,- ...options,- variant: SnackBarVariant.Warning,- });- },- [setSnackBarQueue],- );-- const enqueueErrorSnackBar = useCallback(- ({- apolloError,- message,- options,- }: (- | { apolloError: ErrorLike; message?: never }- | { apolloError?: never; message?: string }- ) & {- options?: Omit<SnackBarOptions, 'message' | 'id'>;- }) => {- if (apolloError?.name === 'AbortError') {- return;- }-- const errorMessage = message- ? message- : apolloError- ? getErrorMessageFromApolloError(apolloError)- : t`An error occurred.`;-- const errorAction = buildErrorAction(apolloError);-- setSnackBarQueue({- id: uuidv4(),- message: errorMessage,- ...errorAction,- ...options,- variant: SnackBarVariant.Error,- });- },- [setSnackBarQueue],- );-- return {- handleSnackBarClose,- enqueueSuccessSnackBar,- enqueueErrorSnackBar,- enqueueInfoSnackBar,- enqueueWarningSnackBar,- };-};diff --git a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/states/snackBarInternalComponentState.ts b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/states/snackBarInternalComponentState.tsdeleted file mode 100644index 6c18541da1b..00000000000--- a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/states/snackBarInternalComponentState.ts+++ /dev/null@@ -1,22 +0,0 @@-import { SnackBarComponentInstanceContext } from '@/ui/feedback/snack-bar-manager/contexts/SnackBarComponentInstanceContext';-import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState';-import { type SnackBarProps } from '@/ui/feedback/snack-bar-manager/components/SnackBar';--export type SnackBarOptions = SnackBarProps & {- id: string;-};--export type SnackBarState = {- maxQueue: number;- queue: SnackBarOptions[];-};--export const snackBarInternalComponentState =- createAtomComponentState<SnackBarState>({- key: 'snackBarState',- defaultValue: {- maxQueue: 3,- queue: [],- },- componentInstanceContext: SnackBarComponentInstanceContext,- });diff --git a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/utils/buildErrorAction.ts b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/utils/buildErrorAction.tsdeleted file mode 100644index df3fb2c3e98..00000000000--- a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/utils/buildErrorAction.ts+++ /dev/null@@ -1,28 +0,0 @@-import { type ErrorLike } from '@apollo/client';-import { t } from '@lingui/core/macro';-import { AppPath } from 'twenty-shared/types';-import { getAppPath, isDefined } from 'twenty-shared/utils';-import { getConflictingRecordFromApolloError } from '~/utils/get-conflicting-record-from-apollo-error.util';-import { type SnackBarOptions } from '@/ui/feedback/snack-bar-manager/states/snackBarInternalComponentState';--export const buildErrorAction = (- apolloError?: ErrorLike,-): Pick<SnackBarOptions, 'buttonLabel' | 'buttonTo'> | null => {- if (!apolloError) {- return null;- }-- const conflictingRecord = getConflictingRecordFromApolloError(apolloError);-- if (isDefined(conflictingRecord)) {- return {- buttonLabel: t`View existing record`,- buttonTo: getAppPath(AppPath.RecordShowPage, {- objectNameSingular: conflictingRecord.conflictingObjectNameSingular,- objectRecordId: conflictingRecord.conflictingRecordId,- }),- };- }-- return null;-};diff --git a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/utils/sanitizeMessageToRenderInSnackbar.ts b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/utils/sanitizeMessageToRenderInSnackbar.tsdeleted file mode 100644index c361c8b50d2..00000000000--- a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/utils/sanitizeMessageToRenderInSnackbar.ts+++ /dev/null@@ -1,24 +0,0 @@-import { t } from '@lingui/core/macro';-import { isDefined } from 'twenty-shared/utils';--export const sanitizeMessageToRenderInSnackbar = (- messageToRenderInSnackbar: any,-) => {- if (!isDefined(messageToRenderInSnackbar)) {- return null;- } else if (- typeof messageToRenderInSnackbar === 'string' ||- typeof messageToRenderInSnackbar === 'string' ||- typeof messageToRenderInSnackbar === 'boolean'- ) {- return `${messageToRenderInSnackbar}`;- } else if (typeof messageToRenderInSnackbar === 'object') {- try {- return JSON.stringify(messageToRenderInSnackbar);- } catch {- return t`Cannot display message`;- }- } else {- return t`Cannot display message`;- }-};diff --git a/packages/twenty-front/src/modules/ui/feedback/toast/components/AppToaster.tsx b/packages/twenty-front/src/modules/ui/feedback/toast/components/AppToaster.tsxnew file mode 100644index 00000000000..d54a078f6eb--- /dev/null+++ b/packages/twenty-front/src/modules/ui/feedback/toast/components/AppToaster.tsx@@ -0,0 +1,20 @@+import { getLocalizedToastProps } from '@/ui/feedback/toast/utils/getLocalizedToastProps';+import { RootStackingContextZIndices } from '@/ui/layout/constants/RootStackingContextZIndices';+import { useLingui } from '@lingui/react/macro';+import { Toaster, type ToasterProps } from 'twenty-ui/primitives/feedback';++type AppToasterProps = Pick<ToasterProps, 'container'>;++export const AppToaster = ({ container }: AppToasterProps) => {+ const { t, i18n } = useLingui();++ return (+ <Toaster+ container={container}+ aria-label={t`Notifications`}+ getToastProps={(toast) => getLocalizedToastProps({ toast, i18n })}+ style={{ zIndex: RootStackingContextZIndices.Toaster }}+ data-globally-prevent-click-outside+ />+ );+};diff --git a/packages/twenty-front/src/modules/ui/feedback/toast/components/__tests__/AppToaster.test.tsx b/packages/twenty-front/src/modules/ui/feedback/toast/components/__tests__/AppToaster.test.tsxnew file mode 100644index 00000000000..91d62a106d6--- /dev/null+++ b/packages/twenty-front/src/modules/ui/feedback/toast/components/__tests__/AppToaster.test.tsx@@ -0,0 +1,208 @@+import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { type I18n, i18n, setupI18n } from '@lingui/core';+import { msg } from '@lingui/core/macro';+import { I18nProvider } from '@lingui/react';+import { act, renderHook, screen, waitFor } from '@testing-library/react';+import userEvent from '@testing-library/user-event';+import { type ReactNode } from 'react';+import { MemoryRouter } from 'react-router-dom';+import { ToastProvider, useToast } from 'twenty-ui/primitives/feedback';+import { Button } from 'twenty-ui/primitives/input';+import { ThemeProvider } from 'twenty-ui/theme-constants';++import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';+import { AppToaster } from '@/ui/feedback/toast/components/AppToaster';++type WrapperProps = { children: ReactNode; i18nInstance?: I18n };++const Wrapper = ({ children, i18nInstance = i18n }: WrapperProps) => (+ <I18nProvider i18n={i18nInstance}>+ <ThemeProvider colorScheme="light">+ <MemoryRouter>+ <ToastProvider>+ {children}+ <AppToaster />+ </ToastProvider>+ </MemoryRouter>+ </ThemeProvider>+ </I18nProvider>+);++describe('AppToaster', () => {+ it('should preserve actions and dismiss a notification through the shared toaster', async () => {+ const onAction = jest.fn();+ const onClose = jest.fn();+ const { result } = renderHook(() => useToast(), { wrapper: Wrapper });++ act(() => {+ result.current.enqueueToast({+ variant: 'success',+ children: 'Record saved',+ description: 'Your changes are available',+ action: (+ <Button+ title="Undo"+ ariaLabel="Undo"+ onClick={onAction}+ variant="tertiary"+ size="small"+ />+ ),+ onClose,+ progress: 100,+ });+ });++ expect(screen.getByRole('status')).toHaveTextContent('Record saved');+ expect(screen.getByText('Your changes are available')).toBeInTheDocument();+ await userEvent.click(screen.getByRole('button', { name: 'Undo' }));+ expect(onAction).toHaveBeenCalledTimes(1);+ await userEvent.click(screen.getByRole('button', { name: 'Close' }));+ await waitFor(() =>+ expect(screen.queryByRole('status')).not.toBeInTheDocument(),+ );+ expect(onClose).toHaveBeenCalledTimes(1);+ });++ it('should render rich notification content without converting it to text', () => {+ const { result } = renderHook(() => useToast(), { wrapper: Wrapper });++ act(() => {+ result.current.enqueueToast({+ children: <strong>Record saved</strong>,+ description: <a href="/records">View records</a>,+ progress: 100,+ });+ });++ expect(screen.getByRole('status')).toHaveTextContent('Record saved');+ expect(screen.getByRole('link', { name: 'View records' })).toHaveAttribute(+ 'href',+ '/records',+ );+ });++ it('should keep record-conflict links inside the frontend router', () => {+ const { result } = renderHook(() => useToast(), { wrapper: Wrapper });+ const apolloError = new CombinedGraphQLErrors({+ errors: [+ {+ message: 'Record already exists',+ extensions: {+ conflictingRecordId: 'existing-record',+ conflictingObjectNameSingular: 'person',+ },+ },+ ],+ });++ act(() => {+ result.current.enqueueToast(+ getToastOptionsFromError({ error: apolloError, progress: 100 }),+ );+ });++ expect(screen.getByRole('status')).toHaveTextContent('An error occurred.');+ const action = screen.getByRole('link', { name: 'View existing record' });+ expect(action).toHaveAttribute('href', '/object/person/existing-record');+ expect(action.querySelector('button')).toBeNull();+ });++ it('should update visible labels when the active locale changes', async () => {+ const testI18n = setupI18n({+ locale: 'en',+ messages: {+ en: { ...i18n.messages },+ fr: {+ [msg`Success`.id]: 'Succès',+ [msg`Cancel`.id]: 'Annuler',+ [msg`Close`.id]: 'Fermer',+ [msg`Notifications`.id]: 'Notifications',+ },+ },+ });+ const onClose = jest.fn();+ const onCancel = jest.fn();+ const { result } = renderHook(() => useToast(), {+ wrapper: ({ children }) => (+ <Wrapper i18nInstance={testI18n}>{children}</Wrapper>+ ),+ });++ act(() => {+ result.current.enqueueToast({+ variant: 'success',+ children: 'Record saved',+ onClose,+ onCancel,+ progress: 100,+ });+ });+ const toast = screen.getByRole('status');+ expect(screen.getByLabelText('Success')).toBeInTheDocument();+ expect(screen.getByRole('button', { name: 'Cancel' })).toBeInTheDocument();+ expect(screen.getByRole('button', { name: 'Close' })).toBeInTheDocument();++ act(() => testI18n.activate('fr'));++ expect(screen.getByRole('status')).toBe(toast);+ expect(screen.getByLabelText('Succès')).toBeInTheDocument();+ await userEvent.click(screen.getByRole('button', { name: 'Annuler' }));+ expect(onCancel).toHaveBeenCalledTimes(1);+ expect(onClose).not.toHaveBeenCalled();+ await userEvent.click(screen.getByRole('button', { name: 'Fermer' }));+ await waitFor(() => expect(toast).not.toBeInTheDocument());+ expect(onClose).toHaveBeenCalledTimes(1);+ });++ it.each([+ { error: new Error('Connection lost'), message: 'Connection lost' },+ {+ error: new CombinedGraphQLErrors({+ errors: [+ {+ message: 'Internal error',+ extensions: { userFriendlyMessage: 'Permission denied' },+ },+ ],+ }),+ message: 'Permission denied',+ },+ {+ error: new CombinedGraphQLErrors({+ errors: [+ {+ message: 'Internal error',+ extensions: { userFriendlyMessage: msg`An error occurred.` },+ },+ ],+ }),+ message: 'An error occurred.',+ },+ { error: undefined, message: 'An error occurred.' },+ ])('should display $message for a caught error', ({ error, message }) => {+ const { result } = renderHook(() => useToast(), { wrapper: Wrapper });++ act(() => {+ result.current.enqueueToast(+ getToastOptionsFromError({ error, progress: 100 }),+ );+ });++ expect(screen.getByRole('status')).toHaveTextContent(message);+ });++ it('should ignore aborted requests', () => {+ const { result } = renderHook(() => useToast(), { wrapper: Wrapper });++ act(() => {+ result.current.enqueueToast(+ getToastOptionsFromError({+ error: new DOMException('Request aborted', 'AbortError'),+ }),+ );+ });++ expect(screen.queryByRole('status')).not.toBeInTheDocument();+ });+});diff --git a/packages/twenty-front/src/modules/ui/feedback/toast/utils/getLocalizedToastProps.ts b/packages/twenty-front/src/modules/ui/feedback/toast/utils/getLocalizedToastProps.tsnew file mode 100644index 00000000000..a21d87e3d94--- /dev/null+++ b/packages/twenty-front/src/modules/ui/feedback/toast/utils/getLocalizedToastProps.ts@@ -0,0 +1,38 @@+import { type I18n } from '@lingui/core';+import { msg } from '@lingui/core/macro';+import { isString } from '@sniptt/guards';+import {+ type ToastProps,+ type ToastVariant,+} from 'twenty-ui/primitives/feedback';++const DEFAULT_ARIA_LABEL_BY_VARIANT: Record<+ ToastVariant,+ ReturnType<typeof msg>+> = {+ default: msg`Alert`,+ error: msg`Error`,+ info: msg`Info`,+ success: msg`Success`,+ warning: msg`Warning`,+};++export const getLocalizedToastProps = ({+ toast,+ i18n,+}: {+ toast: ToastProps;+ i18n: I18n;+}) => {+ const iconLabel =+ toast.iconLabel ??+ i18n._(DEFAULT_ARIA_LABEL_BY_VARIANT[toast.variant ?? 'default']);++ return {+ iconLabel,+ title:+ toast.title ?? (isString(toast.children) ? toast.children : iconLabel),+ cancelLabel: toast.cancelLabel ?? i18n._(msg`Cancel`),+ closeLabel: toast.closeLabel ?? i18n._(msg`Close`),+ };+};diff --git a/packages/twenty-front/src/modules/ui/layout/constants/RootStackingContextZIndices.ts b/packages/twenty-front/src/modules/ui/layout/constants/RootStackingContextZIndices.tsindex dc42481a4f2..1e2a161f574 100644--- a/packages/twenty-front/src/modules/ui/layout/constants/RootStackingContextZIndices.ts+++ b/packages/twenty-front/src/modules/ui/layout/constants/RootStackingContextZIndices.ts@@ -22,6 +22,6 @@ export enum RootStackingContextZIndices {DropdownPortalAboveModal = 50,Dialog = 9999,WelcomeOverlay = 10000,- SnackBar = 10002,+ Toaster = 10002,NotFound = 10001,}diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawer.stories.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawer.stories.tsxindex 4006bf5b3e7..c6a827eea30 100644--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawer.stories.tsx+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawer.stories.tsx@@ -7,11 +7,12 @@ import { AdvancedSettingsSwitch } from '@/ui/input/components/AdvancedSettingsSwimport { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { setTestObjectMetadataItemsInMetadataStore } from '~/testing/utils/setTestObjectMetadataItemsInMetadataStore';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';+import { SettingsPath } from 'twenty-shared/types';import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator';-import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';import { LoadedDecorator } from '~/testing/decorators/LoadedDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';import { mockedWorkspaceMemberData } from '~/testing/mock-data/users';import { getTestEnrichedObjectMetadataItemsMock } from '~/testing/utils/getTestEnrichedObjectMetadataItemsMock';@@ -48,7 +49,7 @@ const meta: Meta<typeof NavigationDrawer> = {component: NavigationDrawer,decorators: [ComponentWithRouterDecorator,- SnackBarDecorator,+ ToastDecorator,ObjectMetadataItemsDecorator,LoadedDecorator,(Story) => {diff --git a/packages/twenty-front/src/modules/ui/theme/hooks/__tests__/useColorScheme.test.tsx b/packages/twenty-front/src/modules/ui/theme/hooks/__tests__/useColorScheme.test.tsxindex 07c3d0db42d..8cb7dd7726c 100644--- a/packages/twenty-front/src/modules/ui/theme/hooks/__tests__/useColorScheme.test.tsx+++ b/packages/twenty-front/src/modules/ui/theme/hooks/__tests__/useColorScheme.test.tsx@@ -1,6 +1,3 @@-import { CombinedGraphQLErrors } from '@apollo/client/errors';-import { act, renderHook } from '@testing-library/react';-import { Provider as JotaiProvider } from 'jotai';import {currentWorkspaceMemberState,type CurrentWorkspaceMember,@@ -8,18 +5,21 @@ import {import { useColorScheme } from '@/ui/theme/hooks/useColorScheme';import { persistedColorSchemeState } from '@/ui/theme/states/persistedColorSchemeState';import { resetJotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';+import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { act, renderHook } from '@testing-library/react';+import { Provider as JotaiProvider } from 'jotai';const mockUpdateWorkspaceMemberSettings = jest.fn();-const mockEnqueueErrorSnackBar = jest.fn();jest.mock('@apollo/client/react', () => ({useMutation: () => [mockUpdateWorkspaceMemberSettings],}));-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({- enqueueErrorSnackBar: mockEnqueueErrorSnackBar,- }),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));const workspaceMember: CurrentWorkspaceMember = {@@ -77,7 +77,7 @@ describe('useColorScheme', () => {},},});- expect(mockEnqueueErrorSnackBar).not.toHaveBeenCalled();+ expect(mockEnqueueToast).not.toHaveBeenCalled();});it.each([false, true])(@@ -118,8 +118,9 @@ describe('useColorScheme', () => {'System',);expect(store.get(persistedColorSchemeState.atom)).toBe('Light');- expect(mockEnqueueErrorSnackBar).toHaveBeenCalledWith({- apolloError: error,+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'You do not have permission to update this workspace member.',});},);@@ -179,7 +180,7 @@ describe('useColorScheme', () => {},);- it('should use the default error message for a non-error rejection', async () => {+ it('should forward a non-error rejection to the error toast', async () => {mockUpdateWorkspaceMemberSettings.mockRejectedValueOnce(undefined);const { result } = renderColorSchemeHook();@@ -188,7 +189,10 @@ describe('useColorScheme', () => {});expect(result.current.colorScheme).toBe('System');- expect(mockEnqueueErrorSnackBar).toHaveBeenCalledWith({});+ expect(mockEnqueueToast).toHaveBeenCalledWith({+ variant: 'error',+ children: 'An error occurred.',+ });});it('should not save a theme without a workspace member', async () => {diff --git a/packages/twenty-front/src/modules/ui/theme/hooks/useColorScheme.ts b/packages/twenty-front/src/modules/ui/theme/hooks/useColorScheme.tsindex ceccc629bb1..8c05a56d570 100644--- a/packages/twenty-front/src/modules/ui/theme/hooks/useColorScheme.ts+++ b/packages/twenty-front/src/modules/ui/theme/hooks/useColorScheme.ts@@ -1,13 +1,15 @@import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useUpdateWorkspaceMemberSettings } from '@/settings/profile/hooks/useUpdateWorkspaceMemberSettings';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { persistedColorSchemeState } from '@/ui/theme/states/persistedColorSchemeState';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { type ColorScheme } from '@/workspace-member/types/WorkspaceMember';-import { isErrorLike } from '@apollo/client/errors';+import { useStore } from 'jotai';import { useCallback } from 'react';import { isDefined } from 'twenty-shared/utils';++import { useToast } from 'twenty-ui/primitives/feedback';import {type IconComponent,IconMoon,@@ -20,7 +22,7 @@ export const useColorScheme = () => {const store = useStore();const { updateWorkspaceMemberSettings } = useUpdateWorkspaceMemberSettings();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const colorScheme = currentWorkspaceMember?.colorScheme ?? 'System';@@ -68,10 +70,10 @@ export const useColorScheme = () => {);}- enqueueErrorSnackBar(isErrorLike(error) ? { apolloError: error } : {});+ enqueueToast(getToastOptionsFromError({ error }));}},- [store, updateWorkspaceMemberSettings, enqueueErrorSnackBar],+ [store, updateWorkspaceMemberSettings, enqueueToast],);const colorSchemeList: Array<{diff --git a/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx b/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsxindex c0a954efb58..79c61f80295 100644--- a/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx+++ b/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx@@ -29,7 +29,7 @@ import { ComponentDecorator } from 'twenty-ui/testing';import { ContextStoreDecorator } from '~/testing/decorators/ContextStoreDecorator';import { IconsProviderDecorator } from '~/testing/decorators/IconsProviderDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { mockedViews } from '~/testing/mock-data/generated/metadata/views/mock-views-data';import { getTestEnrichedObjectMetadataItemsMock } from '~/testing/utils/getTestEnrichedObjectMetadataItemsMock';import { setTestViewsInMetadataStore } from '~/testing/utils/setTestViewsInMetadataStore';@@ -139,7 +139,7 @@ const meta: Meta<typeof ViewBarFilterDropdown> = {},ContextStoreDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,ComponentDecorator,IconsProviderDecorator,],diff --git a/packages/twenty-front/src/modules/views/hooks/internal/usePerformViewApiUpdate.ts b/packages/twenty-front/src/modules/views/hooks/internal/usePerformViewApiUpdate.tsindex 037b49bba89..c55969bfed1 100644--- a/packages/twenty-front/src/modules/views/hooks/internal/usePerformViewApiUpdate.ts+++ b/packages/twenty-front/src/modules/views/hooks/internal/usePerformViewApiUpdate.ts@@ -6,14 +6,14 @@ import { metadataStoreState } from '@/metadata-store/states/metadataStoreState';import { type FlatView } from '@/metadata-store/types/FlatView';import { type FlatViewGroup } from '@/metadata-store/types/FlatViewGroup';import { type MetadataRequestResult } from '@/object-metadata/types/MetadataRequestResult.type';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { computeViewGroupsReplacementForView } from '@/views/utils/computeViewGroupsReplacementForView';import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { useStore } from 'jotai';import { CrudOperationType } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';-import { useMutation } from '@apollo/client/react';+import { useToast } from 'twenty-ui/primitives/feedback';import {type UpdateViewMutation,type UpdateViewMutationVariables,@@ -27,7 +27,7 @@ export const usePerformViewApiUpdate = () => {useUpdateMetadataStoreDraft();const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const store = useStore();@@ -114,7 +114,7 @@ export const usePerformViewApiUpdate = () => {operationType: CrudOperationType.UPDATE,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}return {@@ -126,7 +126,7 @@ export const usePerformViewApiUpdate = () => {[updateViewMutation,handleMetadataError,- enqueueErrorSnackBar,+ enqueueToast,updateInDraft,applyChanges,syncViewGroupsFromMutationResult,diff --git a/packages/twenty-front/src/modules/views/hooks/internal/usePerformViewEntityApiPersistOperation.ts b/packages/twenty-front/src/modules/views/hooks/internal/usePerformViewEntityApiPersistOperation.tsindex 06ffb1fec6e..95aaa038bab 100644--- a/packages/twenty-front/src/modules/views/hooks/internal/usePerformViewEntityApiPersistOperation.ts+++ b/packages/twenty-front/src/modules/views/hooks/internal/usePerformViewEntityApiPersistOperation.ts@@ -3,12 +3,12 @@ import { useCallback } from 'react';import { useMetadataErrorHandler } from '@/metadata-error-handler/hooks/useMetadataErrorHandler';import { useUpdateMetadataStoreDraft } from '@/metadata-store/hooks/useUpdateMetadataStoreDraft';import { type MetadataRequestResult } from '@/object-metadata/types/MetadataRequestResult.type';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { t } from '@lingui/core/macro';import { type AllMetadataName } from 'twenty-shared/metadata';import { type CrudOperationType } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';type MetadataStoreDraftUtils = Pick<ReturnType<typeof useUpdateMetadataStoreDraft>,@@ -41,7 +41,7 @@ export const usePerformViewEntityApiPersistOperation = (useUpdateMetadataStoreDraft();const { handleMetadataError } = useMetadataErrorHandler();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const handlePersistError = useCallback((error: unknown, operationType: CrudOperationType) => {@@ -51,10 +51,10 @@ export const usePerformViewEntityApiPersistOperation = (operationType,});} else {- enqueueErrorSnackBar({ message: t`An error occurred.` });+ enqueueToast({ variant: 'error', children: t`An error occurred.` });}},- [handleMetadataError, enqueueErrorSnackBar, metadataName],+ [handleMetadataError, enqueueToast, metadataName],);const performViewEntityApiPersistOperation = useCallback(diff --git a/packages/twenty-front/src/modules/workflow/components/__stories__/WorkflowStepExecutionResult.stories.tsx b/packages/twenty-front/src/modules/workflow/components/__stories__/WorkflowStepExecutionResult.stories.tsxindex bf7a3ed45f3..21333f4384b 100644--- a/packages/twenty-front/src/modules/workflow/components/__stories__/WorkflowStepExecutionResult.stories.tsx+++ b/packages/twenty-front/src/modules/workflow/components/__stories__/WorkflowStepExecutionResult.stories.tsx@@ -2,14 +2,14 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';import { ComponentDecorator } from 'twenty-ui/testing';import { ARGOS_CAPTURE_DISABLED } from '~/testing/constants/ArgosCaptureDisabled';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { WorkflowStepExecutionResult } from '@/workflow/components/WorkflowStepExecutionResult';const meta: Meta<typeof WorkflowStepExecutionResult> = {title: 'Modules/Workflow/Components/StepExecutionResult',component: WorkflowStepExecutionResult,- decorators: [ComponentDecorator, SnackBarDecorator],+ decorators: [ComponentDecorator, ToastDecorator],parameters: {argos: ARGOS_CAPTURE_DISABLED,},diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/__tests__/useUpdateWorkflowVersionStep.test.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/__tests__/useUpdateWorkflowVersionStep.test.tsindex 0747e5d19f1..1da3f92c3b6 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/__tests__/useUpdateWorkflowVersionStep.test.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/__tests__/useUpdateWorkflowVersionStep.test.ts@@ -1,12 +1,11 @@import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext';-import { createElement, type ReactNode } from 'react';import { useUpdateWorkflowVersionStep } from '@/workflow/workflow-steps/hooks/useUpdateWorkflowVersionStep';import { act, renderHook } from '@testing-library/react';+import { createElement, type ReactNode } from 'react';const mockMutate = jest.fn();const mockGetRecordFromCache = jest.fn();const mockMarkStepForRecomputation = jest.fn();-const mockEnqueueErrorSnackBar = jest.fn();jest.mock('@/object-metadata/hooks/useApolloCoreClient', () => ({useApolloCoreClient: () => ({ cache: {} }),@@ -24,8 +23,11 @@ jest.mock('@/object-record/hooks/useObjectPermissions', () => ({useObjectPermissions: () => ({ objectPermissionsByObjectMetadataId: {} }),}));-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({ enqueueErrorSnackBar: mockEnqueueErrorSnackBar }),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));jest.mock('@/object-record/cache/hooks/useGetRecordFromCache', () => ({diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useCreateWorkflowVersionEdge.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useCreateWorkflowVersionEdge.tsindex 0ff125cca68..340892c1c04 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useCreateWorkflowVersionEdge.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useCreateWorkflowVersionEdge.ts@@ -1,20 +1,21 @@+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { CREATE_WORKFLOW_VERSION_EDGE } from '@/workflow/graphql/mutations/createWorkflowVersionEdge';+import { useApplyWorkflowVersionStepChanges } from '@/workflow/workflow-steps/hooks/useApplyWorkflowVersionStepChanges';import { useMutation } from '@apollo/client/react';+import { useToast } from 'twenty-ui/primitives/feedback';import {+ type CreateWorkflowVersionEdgeInput,type CreateWorkflowVersionEdgeMutation,type CreateWorkflowVersionEdgeMutationVariables,- type CreateWorkflowVersionEdgeInput,} from '~/generated/graphql';-import { CREATE_WORKFLOW_VERSION_EDGE } from '@/workflow/graphql/mutations/createWorkflowVersionEdge';-import { useApplyWorkflowVersionStepChanges } from '@/workflow/workflow-steps/hooks/useApplyWorkflowVersionStepChanges';export const useCreateWorkflowVersionEdge = () => {const apolloCoreClient = useApolloCoreClient();const { applyWorkflowVersionStepChanges } =useApplyWorkflowVersionStepChanges();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [mutate] = useMutation<CreateWorkflowVersionEdgeMutation,@@ -27,7 +28,7 @@ export const useCreateWorkflowVersionEdge = () => {const result = await mutate({variables: { input },onError: (error) => {- enqueueErrorSnackBar({ apolloError: error });+ enqueueToast(getToastOptionsFromError({ error }));},});diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useCreateWorkflowVersionStep.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useCreateWorkflowVersionStep.tsindex a21d2359c15..86947f1fdad 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useCreateWorkflowVersionStep.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useCreateWorkflowVersionStep.ts@@ -1,13 +1,14 @@+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';import { CREATE_WORKFLOW_VERSION_STEP } from '@/workflow/graphql/mutations/createWorkflowVersionStep';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useApplyWorkflowVersionStepChanges } from '@/workflow/workflow-steps/hooks/useApplyWorkflowVersionStepChanges';import { useMutation } from '@apollo/client/react';+import { useToast } from 'twenty-ui/primitives/feedback';import {type CreateWorkflowVersionStepInput,type CreateWorkflowVersionStepMutation,type CreateWorkflowVersionStepMutationVariables,} from '~/generated/graphql';-import { useApplyWorkflowVersionStepChanges } from '@/workflow/workflow-steps/hooks/useApplyWorkflowVersionStepChanges';export const useCreateWorkflowVersionStep = () => {const apolloCoreClient = useApolloCoreClient();@@ -15,7 +16,7 @@ export const useCreateWorkflowVersionStep = () => {const { applyWorkflowVersionStepChanges } =useApplyWorkflowVersionStepChanges();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [mutate] = useMutation<CreateWorkflowVersionStepMutation,@@ -30,7 +31,7 @@ export const useCreateWorkflowVersionStep = () => {const result = await mutate({variables: { input },onError: (error) => {- enqueueErrorSnackBar({ apolloError: error });+ enqueueToast(getToastOptionsFromError({ error }));},});diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDeleteWorkflowVersionStep.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDeleteWorkflowVersionStep.tsindex 73b2bcf3172..70e764a1f45 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDeleteWorkflowVersionStep.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDeleteWorkflowVersionStep.ts@@ -1,10 +1,11 @@+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';-import { CoreObjectNameSingular } from 'twenty-shared/types';import { useFindOneRecordQuery } from '@/object-record/hooks/useFindOneRecordQuery';import { DELETE_WORKFLOW_VERSION_STEP } from '@/workflow/graphql/mutations/deleteWorkflowVersionStep';import { useApplyWorkflowVersionStepChanges } from '@/workflow/workflow-steps/hooks/useApplyWorkflowVersionStepChanges';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useMutation } from '@apollo/client/react';+import { CoreObjectNameSingular } from 'twenty-shared/types';+import { useToast } from 'twenty-ui/primitives/feedback';import {type DeleteWorkflowVersionStepInput,type DeleteWorkflowVersionStepMutation,@@ -16,7 +17,7 @@ export const useDeleteWorkflowVersionStep = () => {const { applyWorkflowVersionStepChanges } =useApplyWorkflowVersionStepChanges();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { findOneRecordQuery: findOneWorkflowVersionQuery } =useFindOneRecordQuery({@@ -43,7 +44,7 @@ export const useDeleteWorkflowVersionStep = () => {},],onError: (error) => {- enqueueErrorSnackBar({ apolloError: error });+ enqueueToast(getToastOptionsFromError({ error }));},});diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDuplicateWorkflowVersionStep.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDuplicateWorkflowVersionStep.tsindex 73a0539421f..4c65b550fd6 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDuplicateWorkflowVersionStep.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDuplicateWorkflowVersionStep.ts@@ -1,8 +1,9 @@+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';import { DUPLICATE_WORKFLOW_VERSION_STEP } from '@/workflow/graphql/mutations/duplicateWorkflowVersionStep';import { useApplyWorkflowVersionStepChanges } from '@/workflow/workflow-steps/hooks/useApplyWorkflowVersionStepChanges';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useMutation } from '@apollo/client/react';+import { useToast } from 'twenty-ui/primitives/feedback';import {type DuplicateWorkflowVersionStepInput,type DuplicateWorkflowVersionStepMutation,@@ -15,7 +16,7 @@ export const useDuplicateWorkflowVersionStep = () => {const { applyWorkflowVersionStepChanges } =useApplyWorkflowVersionStepChanges();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [mutate] = useMutation<DuplicateWorkflowVersionStepMutation,@@ -30,7 +31,7 @@ export const useDuplicateWorkflowVersionStep = () => {const result = await mutate({variables: { input },onError: (error) => {- enqueueErrorSnackBar({ apolloError: error });+ enqueueToast(getToastOptionsFromError({ error }));},});diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useUpdateWorkflowRunStep.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useUpdateWorkflowRunStep.tsindex ea276c3fda3..5ec7f894ec3 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useUpdateWorkflowRunStep.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useUpdateWorkflowRunStep.ts@@ -1,15 +1,16 @@+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems';-import { CoreObjectNameSingular } from 'twenty-shared/types';import { useGetRecordFromCache } from '@/object-record/cache/hooks/useGetRecordFromCache';import { updateRecordFromCache } from '@/object-record/cache/utils/updateRecordFromCache';import { useObjectPermissions } from '@/object-record/hooks/useObjectPermissions';import { UPDATE_WORKFLOW_RUN_STEP } from '@/workflow/graphql/mutations/updateWorkflowRunStep';-import { type WorkflowStep, type WorkflowRun } from '@/workflow/types/Workflow';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { type WorkflowRun, type WorkflowStep } from '@/workflow/types/Workflow';import { useMutation } from '@apollo/client/react';+import { CoreObjectNameSingular } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import {type UpdateWorkflowRunStepInput,type UpdateWorkflowRunStepMutation,@@ -33,7 +34,7 @@ export const useUpdateWorkflowRunStep = () => {const getRecordFromCache = useGetRecordFromCache({objectNameSingular: CoreObjectNameSingular.WorkflowRun,});- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const updateWorkflowRunStep = async (input: UpdateWorkflowRunStepInput) => {const result = await mutate({@@ -41,7 +42,7 @@ export const useUpdateWorkflowRunStep = () => {input: { workflowRunId: input.workflowRunId, step: input.step },},onError: (error) => {- enqueueErrorSnackBar({ apolloError: error });+ enqueueToast(getToastOptionsFromError({ error }));},});const updatedStep = result?.data?.updateWorkflowRunStep;diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useUpdateWorkflowVersionStep.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useUpdateWorkflowVersionStep.tsindex 0b338cb6a46..a99b67946ea 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useUpdateWorkflowVersionStep.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useUpdateWorkflowVersionStep.ts@@ -1,21 +1,22 @@+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems';-import { CoreObjectNameSingular } from 'twenty-shared/types';import { useGetRecordFromCache } from '@/object-record/cache/hooks/useGetRecordFromCache';import { updateRecordFromCache } from '@/object-record/cache/utils/updateRecordFromCache';import { useObjectPermissions } from '@/object-record/hooks/useObjectPermissions';import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';-import { flowComponentState } from '@/workflow/states/flowComponentState';import { UPDATE_WORKFLOW_VERSION_STEP } from '@/workflow/graphql/mutations/updateWorkflowVersionStep';+import { flowComponentState } from '@/workflow/states/flowComponentState';import {- type WorkflowVersion,type WorkflowStep,+ type WorkflowVersion,} from '@/workflow/types/Workflow';import { useStepsOutputSchema } from '@/workflow/workflow-variables/hooks/useStepsOutputSchema';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useMutation } from '@apollo/client/react';+import { CoreObjectNameSingular } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import {type UpdateWorkflowVersionStepInput,type UpdateWorkflowVersionStepMutation,@@ -26,7 +27,7 @@ export const useUpdateWorkflowVersionStep = (instanceId?: string) => {const apolloCoreClient = useApolloCoreClient();const { objectMetadataItems } = useObjectMetadataItems();const { objectPermissionsByObjectMetadataId } = useObjectPermissions();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { markStepForRecomputation } = useStepsOutputSchema();const setFlow = useSetAtomComponentState(flowComponentState, instanceId);@@ -49,7 +50,7 @@ export const useUpdateWorkflowVersionStep = (instanceId?: string) => {const result = await mutate({variables: { input },onError: (error) => {- enqueueErrorSnackBar({ apolloError: error });+ enqueueToast(getToastOptionsFromError({ error }));},});const updatedStep = result?.data?.updateWorkflowVersionStep;diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useWorkflowAiAgentPermissionActions.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useWorkflowAiAgentPermissionActions.tsindex 500bd199265..5d0e1f70744 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useWorkflowAiAgentPermissionActions.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useWorkflowAiAgentPermissionActions.ts@@ -2,18 +2,18 @@ import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteimport { type SettingsRoleObjectPermissionKey } from '@/settings/roles/role-permissions/objects-permissions/constants/SettingsRoleObjectPermissionIconConfig';import { useActionRolePermissionFlagConfig } from '@/settings/roles/role-permissions/permission-flags/hooks/useActionRolePermissionFlagConfig';import { useSettingsRolePermissionFlagConfig } from '@/settings/roles/role-permissions/permission-flags/hooks/useSettingsRolePermissionFlagConfig';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { CRUD_PERMISSIONS } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/constants/WorkflowAiAgentCrudPermissions';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';+import { CRUD_PERMISSIONS } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/constants/WorkflowAiAgentCrudPermissions';import { workflowAiAgentActionAgentState } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentActionAgentState';import { workflowAiAgentPermissionsIsAddingPermissionState } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsIsAddingPermissionState';import { workflowAiAgentPermissionsIsSystemObjectsListOpenState } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsIsSystemObjectsListOpenState';import { workflowAiAgentPermissionsSelectedObjectIdState } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsSelectedObjectIdState';+import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { useMemo } from 'react';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { v4 } from 'uuid';-import { useMutation } from '@apollo/client/react';import {type Agent,type ObjectPermission,@@ -36,7 +36,7 @@ export const useWorkflowAiAgentPermissionActions = ({permissionFlagKeys,refetchAgentAndRoles,}: UseWorkflowAiAgentPermissionActionsParams) => {- const { enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [workflowAiAgentActionAgent, setWorkflowAiAgentActionAgent] =useAtomState(workflowAiAgentActionAgentState);const { activeObjectMetadataItems: objectMetadataItems } =@@ -294,8 +294,9 @@ export const useWorkflowAiAgentPermissionActions = ({)?.label(objectMetadata.labelPlural);if (isDefined(permissionLabel)) {- enqueueSuccessSnackBar({- message: t`${permissionLabel} Permission removed`,+ enqueueToast({+ variant: 'success',+ children: t`${permissionLabel} Permission removed`,});}};@@ -353,8 +354,9 @@ export const useWorkflowAiAgentPermissionActions = ({const permissionLabel = permissionFlagLabelMap[permissionFlagKey];if (isDefined(permissionLabel)) {- enqueueSuccessSnackBar({- message: t`${permissionLabel} permission removed`,+ enqueueToast({+ variant: 'success',+ children: t`${permissionLabel} permission removed`,});}};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/__stories__/WorkflowEditActionCode.stories.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/__stories__/WorkflowEditActionCode.stories.tsxindex b9a9adc5eae..a1f4718ec2a 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/__stories__/WorkflowEditActionCode.stories.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/__stories__/WorkflowEditActionCode.stories.tsx@@ -1,12 +1,12 @@import { type WorkflowCodeAction } from '@/workflow/types/Workflow';import { WorkflowEditActionCode } from '@/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCode';import { type Meta, type StoryObj } from '@storybook/react-vite';-import { graphql, HttpResponse } from 'msw';+import { HttpResponse, graphql } from 'msw';import { fn } from 'storybook/test';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';import { ARGOS_CAPTURE_DISABLED } from '~/testing/constants/ArgosCaptureDisabled';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/WorkflowStepActionDrawerDecorator';import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';@@ -130,7 +130,7 @@ const meta: Meta<typeof WorkflowEditActionCode> = {WorkflowStepDecorator,ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,RouterDecorator,WorkspaceDecorator,],diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionCreateRecord.stories.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionCreateRecord.stories.tsxindex 3aaa827c218..5f9dee4afc4 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionCreateRecord.stories.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionCreateRecord.stories.tsx@@ -3,7 +3,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';import { expect, fn, userEvent, within } from 'storybook/test';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/WorkflowStepActionDrawerDecorator';import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';@@ -45,7 +45,7 @@ const meta: Meta<typeof WorkflowEditActionCreateRecord> = {ComponentDecorator,RouterDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,WorkspaceDecorator,],};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionDeleteRecord.stories.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionDeleteRecord.stories.tsxindex e28db705628..feda45f00a9 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionDeleteRecord.stories.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionDeleteRecord.stories.tsx@@ -1,14 +1,14 @@+import { getRecordFromRecordNode } from '@/object-record/cache/utils/getRecordFromRecordNode';import { type WorkflowDeleteRecordAction } from '@/workflow/types/Workflow';import { WorkflowEditActionDeleteRecord } from '@/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionDeleteRecord';import { type Meta, type StoryObj } from '@storybook/react-vite';import { expect, fn, userEvent, within } from 'storybook/test';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/WorkflowStepActionDrawerDecorator';import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';-import { getRecordFromRecordNode } from '@/object-record/cache/utils/getRecordFromRecordNode';import { graphqlMocks } from '~/testing/graphqlMocks';import { mockedPersonRecords } from '~/testing/mock-data/generated/data/people/mock-people-data';import { getWorkflowNodeIdMock } from '~/testing/mock-data/workflow';@@ -49,7 +49,7 @@ const meta: Meta<typeof WorkflowEditActionDeleteRecord> = {WorkflowStepDecorator,ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,RouterDecorator,WorkspaceDecorator,],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 d70c4e5318d..f3280e6f1f5 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@@ -4,11 +4,11 @@ import {} from '@/workflow/types/Workflow';import { WorkflowEditActionEmailBase } from '@/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmailBase';import { type Meta, type StoryObj } from '@storybook/react-vite';-import { graphql, HttpResponse } from 'msw';+import { HttpResponse, graphql } from 'msw';import { expect, fn, within } from 'storybook/test';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/WorkflowStepActionDrawerDecorator';import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';@@ -228,7 +228,7 @@ const meta: Meta<typeof WorkflowEditActionEmailBase> = {WorkflowStepDecorator,ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,RouterDecorator,WorkspaceDecorator,],diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionFindRecords.stories.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionFindRecords.stories.tsxindex 15149da11af..848aa05368c 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionFindRecords.stories.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionFindRecords.stories.tsx@@ -4,7 +4,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';import { expect, fn, screen, userEvent, waitFor, within } from 'storybook/test';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/WorkflowStepActionDrawerDecorator';import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';@@ -47,7 +47,7 @@ const meta: Meta<typeof WorkflowEditActionFindRecords> = {WorkflowStepDecorator,ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,RouterDecorator,WorkspaceDecorator,],diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionUpdateRecord.stories.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionUpdateRecord.stories.tsxindex 1dc8eee5331..39e15f78411 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionUpdateRecord.stories.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/__stories__/WorkflowEditActionUpdateRecord.stories.tsx@@ -1,14 +1,14 @@+import { getRecordFromRecordNode } from '@/object-record/cache/utils/getRecordFromRecordNode';import { type WorkflowUpdateRecordAction } from '@/workflow/types/Workflow';import { WorkflowEditActionUpdateRecord } from '@/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionUpdateRecord';import { type Meta, type StoryObj } from '@storybook/react-vite';import { expect, fn, userEvent, within } from 'storybook/test';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/WorkflowStepActionDrawerDecorator';import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';-import { getRecordFromRecordNode } from '@/object-record/cache/utils/getRecordFromRecordNode';import { graphqlMocks } from '~/testing/graphqlMocks';import { mockedPersonRecords } from '~/testing/mock-data/generated/data/people/mock-people-data';import { getWorkflowNodeIdMock } from '~/testing/mock-data/workflow';@@ -51,7 +51,7 @@ const meta: Meta<typeof WorkflowEditActionUpdateRecord> = {WorkflowStepDecorator,ComponentDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,RouterDecorator,WorkspaceDecorator,],diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/filter-action/components/__stories__/WorkflowEditActionFilter.stories.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/filter-action/components/__stories__/WorkflowEditActionFilter.stories.tsxindex aadaf188361..54fbe02feaf 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/filter-action/components/__stories__/WorkflowEditActionFilter.stories.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/filter-action/components/__stories__/WorkflowEditActionFilter.stories.tsx@@ -4,7 +4,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';import { fn } from 'storybook/test';import { StepLogicalOperator, ViewFilterOperand } from 'twenty-shared/types';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/WorkflowStepActionDrawerDecorator';import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';@@ -88,7 +88,7 @@ const meta: Meta<typeof WorkflowEditActionFilter> = {ComponentDecorator,RouterDecorator,WorkspaceDecorator,- SnackBarDecorator,+ ToastDecorator,],};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/__stories__/WorkflowEditActionFormBuilder.stories.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/__stories__/WorkflowEditActionFormBuilder.stories.tsxindex 0fcea1e73ec..48415ad45fa 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/__stories__/WorkflowEditActionFormBuilder.stories.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/__stories__/WorkflowEditActionFormBuilder.stories.tsx@@ -5,7 +5,7 @@ import { expect, fn, userEvent, waitFor, within } from 'storybook/test';import { FieldMetadataType } from 'twenty-shared/types';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/WorkflowStepActionDrawerDecorator';import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';@@ -62,7 +62,7 @@ const meta: Meta<typeof WorkflowEditActionFormBuilder> = {ComponentDecorator,RouterDecorator,ObjectMetadataItemsDecorator,- SnackBarDecorator,+ ToastDecorator,],};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/__stories__/WorkflowEditActionFormFiller.stories.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/__stories__/WorkflowEditActionFormFiller.stories.tsxindex ada789bb853..5d1ad3434a0 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/__stories__/WorkflowEditActionFormFiller.stories.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/__stories__/WorkflowEditActionFormFiller.stories.tsx@@ -5,7 +5,7 @@ import { expect, within } from 'storybook/test';import { FieldMetadataType } from 'twenty-shared/types';import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/WorkflowStepActionDrawerDecorator';import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';@@ -24,7 +24,7 @@ const meta: Meta<typeof WorkflowEditActionFormFiller> = {RouterDecorator,ObjectMetadataItemsDecorator,WorkspaceDecorator,- SnackBarDecorator,+ ToastDecorator,],};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/hooks/useUploadWorkflowFile.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/hooks/useUploadWorkflowFile.tsindex cbb00da0c5a..3e41c2d1002 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/hooks/useUploadWorkflowFile.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/hooks/useUploadWorkflowFile.ts@@ -1,16 +1,16 @@import { MAX_ATTACHMENT_SIZE } from '@/advanced-text-editor/utils/maxAttachmentSize';import { useDirectFileUpload } from '@/file/hooks/useDirectFileUpload';import { formatFileSize } from '@/file/utils/formatFileSize';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { t } from '@lingui/core/macro';import { extractFolderPathFilenameAndTypeOrThrow } from 'twenty-shared/utils';import { type WorkflowAttachment } from 'twenty-shared/workflow';+import { useToast } from 'twenty-ui/primitives/feedback';import { FileFolder } from '~/generated-metadata/graphql';import { logError } from '~/utils/logError';export const useUploadWorkflowFile = () => {const { uploadFile: directUploadFile } = useDirectFileUpload();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const uploadWorkflowFile = async (file: File,@@ -19,8 +19,9 @@ export const useUploadWorkflowFile = () => {if (file.size > MAX_ATTACHMENT_SIZE) {const fileName = file.name;const maxUploadSize = formatFileSize(MAX_ATTACHMENT_SIZE);- enqueueErrorSnackBar({- message: t`File "${fileName}" exceeds ${maxUploadSize}`,+ enqueueToast({+ variant: 'error',+ children: t`File "${fileName}" exceeds ${maxUploadSize}`,});return null;}@@ -37,8 +38,9 @@ export const useUploadWorkflowFile = () => {};const fileName = file.name;- enqueueSuccessSnackBar({- message: t`File "${fileName}" uploaded successfully`,+ enqueueToast({+ variant: 'success',+ children: t`File "${fileName}" uploaded successfully`,});return workflowFile;@@ -46,8 +48,9 @@ export const useUploadWorkflowFile = () => {logError(`Failed to upload workflow file "${file.name}": ${error}`);const fileNameForError = file.name;- enqueueErrorSnackBar({- message: t`Failed to upload "${fileNameForError}"`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to upload "${fileNameForError}"`,});return null;diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/__stories__/HttpRequestExecutionResult.stories.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/__stories__/HttpRequestExecutionResult.stories.tsxindex b2e96f0764d..b275a1adfd5 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/__stories__/HttpRequestExecutionResult.stories.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/__stories__/HttpRequestExecutionResult.stories.tsx@@ -3,7 +3,7 @@ import { expect, within } from 'storybook/test';import { ComponentDecorator } from 'twenty-ui/testing';import { ARGOS_CAPTURE_DISABLED } from '~/testing/constants/ArgosCaptureDisabled';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { HttpRequestExecutionResult } from '@/workflow/workflow-steps/workflow-actions/http-request-action/components/HttpRequestExecutionResult';import type { HttpRequestTestData } from '@/workflow/workflow-steps/workflow-actions/http-request-action/types/HttpRequestTestData';@@ -11,7 +11,7 @@ import type { HttpRequestTestData } from '@/workflow/workflow-steps/workflow-actconst meta: Meta<typeof HttpRequestExecutionResult> = {title: 'Modules/Workflow/Actions/HttpRequest/ExecutionResult',component: HttpRequestExecutionResult,- decorators: [ComponentDecorator, SnackBarDecorator],+ decorators: [ComponentDecorator, ToastDecorator],parameters: {argos: ARGOS_CAPTURE_DISABLED,layout: 'fullscreen',diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/__stories__/WorkflowEditActionHttpRequest.stories.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/__stories__/WorkflowEditActionHttpRequest.stories.tsxindex d989a47bed7..b91eac5f705 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/__stories__/WorkflowEditActionHttpRequest.stories.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/__stories__/WorkflowEditActionHttpRequest.stories.tsx@@ -4,14 +4,14 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';import { expect, fn, waitFor, within } from 'storybook/test';import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/WorkflowStepActionDrawerDecorator';import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';import {- getWorkflowNodeIdMock,MOCKED_STEP_ID,+ getWorkflowNodeIdMock,} from '~/testing/mock-data/workflow';const DEFAULT_ACTION: WorkflowHttpRequestAction = {@@ -81,7 +81,7 @@ const meta: Meta<typeof WorkflowEditActionHttpRequest> = {WorkflowStepActionDrawerDecorator,WorkflowStepDecorator,ComponentWithRouterDecorator,- SnackBarDecorator,+ ToastDecorator,WorkspaceDecorator,ObjectMetadataItemsDecorator,],diff --git a/packages/twenty-front/src/modules/workflow/workflow-trigger/hooks/__tests__/useUpdateWorkflowVersionTrigger.test.ts b/packages/twenty-front/src/modules/workflow/workflow-trigger/hooks/__tests__/useUpdateWorkflowVersionTrigger.test.tsindex 85d367b2bf2..e6bdb13554a 100644--- a/packages/twenty-front/src/modules/workflow/workflow-trigger/hooks/__tests__/useUpdateWorkflowVersionTrigger.test.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-trigger/hooks/__tests__/useUpdateWorkflowVersionTrigger.test.ts@@ -1,15 +1,14 @@-import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext';-import { createElement, type ReactNode } from 'react';import { type WorkflowTrigger } from '@/workflow/types/Workflow';+import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext';import { useUpdateWorkflowVersionTrigger } from '@/workflow/workflow-trigger/hooks/useUpdateWorkflowVersionTrigger';import { act, renderHook } from '@testing-library/react';+import { createElement, type ReactNode } from 'react';import { TRIGGER_STEP_ID } from 'twenty-shared/workflow';const mockMutate = jest.fn();const mockGetUpdatableWorkflowVersion = jest.fn();const mockGetRecordFromCache = jest.fn();const mockMarkStepForRecomputation = jest.fn();-const mockEnqueueErrorSnackBar = jest.fn();jest.mock('@/object-metadata/hooks/useApolloCoreClient', () => ({useApolloCoreClient: () => ({ cache: {} }),@@ -27,8 +26,11 @@ jest.mock('@/object-record/hooks/useObjectPermissions', () => ({useObjectPermissions: () => ({ objectPermissionsByObjectMetadataId: {} }),}));-jest.mock('@/ui/feedback/snack-bar-manager/hooks/useSnackBar', () => ({- useSnackBar: () => ({ enqueueErrorSnackBar: mockEnqueueErrorSnackBar }),+const mockEnqueueToast = jest.fn();++jest.mock('twenty-ui/primitives/feedback', () => ({+ ...jest.requireActual('twenty-ui/primitives/feedback'),+ useToast: () => ({ enqueueToast: mockEnqueueToast }),}));jest.mock('@/object-record/cache/hooks/useGetRecordFromCache', () => ({diff --git a/packages/twenty-front/src/modules/workflow/workflow-trigger/hooks/useUpdateWorkflowVersionTrigger.ts b/packages/twenty-front/src/modules/workflow/workflow-trigger/hooks/useUpdateWorkflowVersionTrigger.tsindex fb35a88dc63..692f1d1cd82 100644--- a/packages/twenty-front/src/modules/workflow/workflow-trigger/hooks/useUpdateWorkflowVersionTrigger.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-trigger/hooks/useUpdateWorkflowVersionTrigger.ts@@ -1,3 +1,4 @@+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems';@@ -5,10 +6,9 @@ import { useGetRecordFromCache } from '@/object-record/cache/hooks/useGetRecordFimport { updateRecordFromCache } from '@/object-record/cache/utils/updateRecordFromCache';import { useObjectPermissions } from '@/object-record/hooks/useObjectPermissions';import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';-import { flowComponentState } from '@/workflow/states/flowComponentState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { UPDATE_WORKFLOW_VERSION_TRIGGER } from '@/workflow/graphql/mutations/updateWorkflowVersionTrigger';import { useGetUpdatableWorkflowVersionOrThrow } from '@/workflow/hooks/useGetUpdatableWorkflowVersionOrThrow';+import { flowComponentState } from '@/workflow/states/flowComponentState';import {type WorkflowTrigger,type WorkflowVersion,@@ -18,6 +18,7 @@ import { useMutation } from '@apollo/client/react';import { CoreObjectNameSingular } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';import { TRIGGER_STEP_ID } from 'twenty-shared/workflow';+import { useToast } from 'twenty-ui/primitives/feedback';import {type UpdateWorkflowVersionTriggerMutation,type UpdateWorkflowVersionTriggerMutationVariables,@@ -27,7 +28,7 @@ export const useUpdateWorkflowVersionTrigger = (instanceId?: string) => {const apolloCoreClient = useApolloCoreClient();const { objectMetadataItems } = useObjectMetadataItems();const { objectPermissionsByObjectMetadataId } = useObjectPermissions();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { getUpdatableWorkflowVersion } =useGetUpdatableWorkflowVersionOrThrow(instanceId);@@ -61,7 +62,7 @@ export const useUpdateWorkflowVersionTrigger = (instanceId?: string) => {},},onError: (error) => {- enqueueErrorSnackBar({ apolloError: error });+ enqueueToast(getToastOptionsFromError({ error }));},});diff --git a/packages/twenty-front/src/modules/workspace-invitation/hooks/useCreateWorkspaceInvitation.ts b/packages/twenty-front/src/modules/workspace-invitation/hooks/useCreateWorkspaceInvitation.tsindex 6f668e48ad3..c41535416ca 100644--- a/packages/twenty-front/src/modules/workspace-invitation/hooks/useCreateWorkspaceInvitation.ts+++ b/packages/twenty-front/src/modules/workspace-invitation/hooks/useCreateWorkspaceInvitation.ts@@ -1,15 +1,16 @@+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useMutation } from '@apollo/client/react';+import { useToast } from 'twenty-ui/primitives/feedback';import {type SendInvitationsMutationVariables,- SendInvitationsDocument,GetWorkspaceInvitationsDocument,+ SendInvitationsDocument,} from '~/generated-metadata/graphql';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';export const useCreateWorkspaceInvitation = () => {const [sendInvitationsMutation] = useMutation(SendInvitationsDocument);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const sendInvitation = async (variables: SendInvitationsMutationVariables,@@ -18,7 +19,7 @@ export const useCreateWorkspaceInvitation = () => {variables,refetchQueries: [GetWorkspaceInvitationsDocument],onError: (error) => {- enqueueErrorSnackBar({ apolloError: error });+ enqueueToast(getToastOptionsFromError({ error }));},});};diff --git a/packages/twenty-front/src/modules/workspace-invitation/hooks/useDeleteWorkspaceInvitation.ts b/packages/twenty-front/src/modules/workspace-invitation/hooks/useDeleteWorkspaceInvitation.tsindex 9f1bd27d588..dcc13750925 100644--- a/packages/twenty-front/src/modules/workspace-invitation/hooks/useDeleteWorkspaceInvitation.ts+++ b/packages/twenty-front/src/modules/workspace-invitation/hooks/useDeleteWorkspaceInvitation.ts@@ -1,17 +1,18 @@+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useMutation } from '@apollo/client/react';+import { useToast } from 'twenty-ui/primitives/feedback';import {type DeleteWorkspaceInvitationMutationVariables,DeleteWorkspaceInvitationDocument,GetWorkspaceInvitationsDocument,} from '~/generated-metadata/graphql';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';export const useDeleteWorkspaceInvitation = () => {const [deleteWorkspaceInvitationMutation] = useMutation(DeleteWorkspaceInvitationDocument,);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const deleteWorkspaceInvitation = async ({appTokenId,@@ -22,7 +23,7 @@ export const useDeleteWorkspaceInvitation = () => {},refetchQueries: [GetWorkspaceInvitationsDocument],onError: (error) => {- enqueueErrorSnackBar({ apolloError: error });+ enqueueToast(getToastOptionsFromError({ error }));},});};diff --git a/packages/twenty-front/src/modules/workspace-invitation/hooks/useResendWorkspaceInvitation.ts b/packages/twenty-front/src/modules/workspace-invitation/hooks/useResendWorkspaceInvitation.tsindex 0fad83aae5f..12e8c3246cd 100644--- a/packages/twenty-front/src/modules/workspace-invitation/hooks/useResendWorkspaceInvitation.ts+++ b/packages/twenty-front/src/modules/workspace-invitation/hooks/useResendWorkspaceInvitation.ts@@ -1,17 +1,18 @@+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useMutation } from '@apollo/client/react';+import { useToast } from 'twenty-ui/primitives/feedback';import {type ResendWorkspaceInvitationMutationVariables,- ResendWorkspaceInvitationDocument,GetWorkspaceInvitationsDocument,+ ResendWorkspaceInvitationDocument,} from '~/generated-metadata/graphql';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';export const useResendWorkspaceInvitation = () => {const [resendWorkspaceInvitationMutation] = useMutation(ResendWorkspaceInvitationDocument,);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const resendInvitation = async ({appTokenId,@@ -22,7 +23,7 @@ export const useResendWorkspaceInvitation = () => {},refetchQueries: [GetWorkspaceInvitationsDocument],onError: (error) => {- enqueueErrorSnackBar({ apolloError: error });+ enqueueToast(getToastOptionsFromError({ error }));},});};diff --git a/packages/twenty-front/src/modules/workspace/components/WorkspaceInviteTeam.tsx b/packages/twenty-front/src/modules/workspace/components/WorkspaceInviteTeam.tsxindex 584f555864c..93406fed28c 100644--- a/packages/twenty-front/src/modules/workspace/components/WorkspaceInviteTeam.tsx+++ b/packages/twenty-front/src/modules/workspace/components/WorkspaceInviteTeam.tsx@@ -1,11 +1,10 @@-import { styled } from '@linaria/react';import { zodResolver } from '@hookform/resolvers/zod';+import { styled } from '@linaria/react';import { useEffect } from 'react';import { Controller, useForm } from 'react-hook-form';import { z } from 'zod';import { type RoleWithPartialMembers } from '@/settings/roles/types/RoleWithPartialMembers';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { Select } from '@/ui/input/components/Select';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { useCreateWorkspaceInvitation } from '@/workspace-invitation/hooks/useCreateWorkspaceInvitation';@@ -14,6 +13,7 @@ import { i18n } from '@lingui/core';import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react/macro';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import {IconLock,IconSend,@@ -102,7 +102,7 @@ export const WorkspaceInviteTeam = ({ roles }: WorkspaceInviteTeamProps) => {const { t } = useLingui();const { getIcon } = useIcons();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { sendInvitation } = useCreateWorkspaceInvitation();const roleOptions: Array<{@@ -147,22 +147,20 @@ export const WorkspaceInviteTeam = ({ roles }: WorkspaceInviteTeamProps) => {if (data.sendInvitations.result.length > 0) {const invitationCount = data.sendInvitations.result.length;- enqueueSuccessSnackBar({- message: t`${invitationCount} invitations sent`,- options: {- duration: 2000,- },+ enqueueToast({+ variant: 'success',+ children: t`${invitationCount} invitations sent`,+ duration: 2000,});return;}if (!data.sendInvitations.success) {- enqueueErrorSnackBar({- message: data.sendInvitations.errors.join(', '),- options: {- duration: 5000,- },+ enqueueToast({+ variant: 'error',+ children: data.sendInvitations.errors.join(', '),+ duration: 5000,});}});diff --git a/packages/twenty-front/src/pages/auth/PasswordReset.tsx b/packages/twenty-front/src/pages/auth/PasswordReset.tsxindex 8182ca9d742..6e112601ce6 100644--- a/packages/twenty-front/src/pages/auth/PasswordReset.tsx+++ b/packages/twenty-front/src/pages/auth/PasswordReset.tsx@@ -1,9 +1,9 @@import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader';import { Logo } from '@/auth/components/Logo';+import { StyledOnboardingContentContainer } from '@/auth/components/StyledOnboardingContentContainer';import { Title } from '@/auth/components/Title';import { useAuth } from '@/auth/hooks/useAuth';import { useIsLogged } from '@/auth/hooks/useIsLogged';-import { StyledOnboardingContentContainer } from '@/auth/components/StyledOnboardingContentContainer';import { currentUserState } from '@/auth/states/currentUserState';import { workspacePublicDataState } from '@/auth/states/workspacePublicDataState';import { PASSWORD_REGEX } from '@/auth/utils/passwordRegex';@@ -11,14 +11,15 @@ import { useReadCaptchaToken } from '@/captcha/hooks/useReadCaptchaToken';import { useCaptcha } from '@/client-config/hooks/useCaptcha';import { useIsCurrentLocationOnAWorkspace } from '@/domain-manager/hooks/useIsCurrentLocationOnAWorkspace';import { useRedirect } from '@/domain-manager/hooks/useRedirect';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { TextInput } from '@/ui/input/components/TextInput';-import { ModalContent } from 'twenty-ui/primitives/surfaces';-import { CombinedGraphQLErrors } from '@apollo/client/errors';-import { styled } from '@linaria/react';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';+import { useMutation, useQuery } from '@apollo/client/react';import { zodResolver } from '@hookform/resolvers/zod';-import { msg } from '@lingui/core/macro';+import { styled } from '@linaria/react';import { i18n } from '@lingui/core';+import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react/macro';import { isNonEmptyString } from '@sniptt/guards';import { motion } from 'framer-motion';@@ -26,14 +27,13 @@ import { useContext, useEffect, useState } from 'react';import { Controller, useForm } from 'react-hook-form';import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';import { useParams } from 'react-router-dom';-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { AppPath } from 'twenty-shared/types';+import { useToast } from 'twenty-ui/primitives/feedback';import { MainButton } from 'twenty-ui/primitives/input';-import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import { AnimatedEaseIn } from 'twenty-ui/primitives/layout';+import { ModalContent } from 'twenty-ui/primitives/surfaces';+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import { z } from 'zod';-import { useMutation, useQuery } from '@apollo/client/react';import {UpdatePasswordViaResetTokenDocument,ValidatePasswordResetTokenDocument,@@ -84,7 +84,7 @@ const StyledMainButtonContainer = styled.div`export const PasswordReset = () => {const { theme } = useContext(ThemeContext);const { t } = useLingui();- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const workspacePublicData = useAtomStateValue(workspacePublicDataState);const setCurrentUser = useSetAtomState(currentUserState);@@ -120,12 +120,10 @@ export const PasswordReset = () => {useEffect(() => {if (tokenValidationError) {- enqueueErrorSnackBar({- apolloError: tokenValidationError,- });+ enqueueToast(getToastOptionsFromError({ error: tokenValidationError }));navigate(AppPath.Index);}- }, [tokenValidationError, enqueueErrorSnackBar, navigate]);+ }, [tokenValidationError, enqueueToast, navigate]);useEffect(() => {if (tokenValidationData) {@@ -159,8 +157,9 @@ export const PasswordReset = () => {});if (!data?.updatePasswordViaResetToken.success) {- enqueueErrorSnackBar({- message: t`There was an error while updating password.`,+ enqueueToast({+ variant: 'error',+ children: t`There was an error while updating password.`,});return;}@@ -175,16 +174,15 @@ export const PasswordReset = () => {);if (isLogged) {- enqueueSuccessSnackBar({- message: successMessage,- });+ enqueueToast({ variant: 'success', children: successMessage });navigate(AppPath.Index);return;}if (!isCaptchaReady) {- enqueueErrorSnackBar({- message: t`Captcha (anti-bot check) is still loading, try again`,+ enqueueToast({+ variant: 'error',+ children: t`Captcha (anti-bot check) is still loading, try again`,});return;}@@ -204,9 +202,7 @@ export const PasswordReset = () => {redirect(AppPath.Index);} catch (err) {logError(err);- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(err) ? err : undefined,- });+ enqueueToast(getToastOptionsFromError({ error: err }));}};diff --git a/packages/twenty-front/src/pages/onboarding/CreateProfile.tsx b/packages/twenty-front/src/pages/onboarding/CreateProfile.tsxindex 6b60e273917..2f05b047923 100644--- a/packages/twenty-front/src/pages/onboarding/CreateProfile.tsx+++ b/packages/twenty-front/src/pages/onboarding/CreateProfile.tsx@@ -1,6 +1,7 @@import { currentUserState } from '@/auth/states/currentUserState';import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';import { currentWorkspaceMembersState } from '@/auth/states/currentWorkspaceMembersState';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { OnboardingProfilePictureUploader } from '@/onboarding/components/OnboardingProfilePictureUploader';import { OnboardingStepAnimatedItem } from '@/onboarding/components/OnboardingStepAnimatedItem';import { StyledOnboardingStepHeading } from '@/onboarding/components/StyledOnboardingStepHeading';@@ -12,12 +13,10 @@ import { usePrefetchInviteSuggestions } from '@/onboarding/hooks/usePrefetchInviimport { useSetNextOnboardingStatus } from '@/onboarding/hooks/useSetNextOnboardingStatus';import { useUpdateWorkspaceMemberSettings } from '@/settings/profile/hooks/useUpdateWorkspaceMemberSettings';import { PageFocusId } from '@/types/PageFocusId';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { TextInput } from '@/ui/input/components/TextInput';import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { zodResolver } from '@hookform/resolvers/zod';import { styled } from '@linaria/react';import { i18n } from '@lingui/core';@@ -27,6 +26,7 @@ import { useCallback, useState } from 'react';import { Controller, type SubmitHandler, useForm } from 'react-hook-form';import { Key } from 'ts-key-enum';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { MainButton } from 'twenty-ui/primitives/input';import { MOBILE_VIEWPORT, themeCssVariables } from 'twenty-ui/theme-constants';import { z } from 'zod';@@ -84,7 +84,7 @@ export const CreateProfile = () => {usePrefetchInviteSuggestions();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState);const setCurrentUser = useSetAtomState(currentUserState);const setCurrentWorkspaceMembers = useSetAtomState(@@ -161,15 +161,13 @@ export const CreateProfile = () => {setIsNavigating(true);} catch (error: any) {setIsNavigating(false);- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));}},[currentWorkspaceMember?.id,setNextOnboardingStatus,- enqueueErrorSnackBar,+ enqueueToast,setCurrentWorkspaceMembers,setCurrentUser,updateWorkspaceMemberSettings,diff --git a/packages/twenty-front/src/pages/onboarding/PaymentSuccess.tsx b/packages/twenty-front/src/pages/onboarding/PaymentSuccess.tsxindex e7a7c12d259..baae1dc7b88 100644--- a/packages/twenty-front/src/pages/onboarding/PaymentSuccess.tsx+++ b/packages/twenty-front/src/pages/onboarding/PaymentSuccess.tsx@@ -3,13 +3,13 @@ import { OnboardingAnimatedReveal } from '@/onboarding/components/OnboardingAnimimport { OnboardingVerifyLayout } from '@/onboarding/components/OnboardingVerifyLayout';import { useOnboardingMotionTransition } from '@/onboarding/hooks/useOnboardingMotionTransition';import { useShowWelcomeAnimationAfterOnboardingCheckout } from '@/onboarding/hooks/useShowWelcomeAnimationAfterOnboardingCheckout';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useLoadCurrentUser } from '@/users/hooks/useLoadCurrentUser';-import { t } from '@lingui/core/macro';import { styled } from '@linaria/react';+import { t } from '@lingui/core/macro';import { AnimatePresence, motion } from 'framer-motion';import { useEffect, useState } from 'react';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { MainButton } from 'twenty-ui/primitives/input';import { themeCssVariables } from 'twenty-ui/theme-constants';@@ -25,7 +25,7 @@ export const PaymentSuccess = () => {const { loadCurrentUser } = useLoadCurrentUser();const showWelcomeAnimationAfterOnboardingCheckout =useShowWelcomeAnimationAfterOnboardingCheckout();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [hasTimedOut, setHasTimedOut] = useState(false);const [confirmationRunIndex, setConfirmationRunIndex] = useState(0);@@ -59,8 +59,9 @@ export const PaymentSuccess = () => {if (attempts >= SUBSCRIPTION_CONFIRMATION_MAX_ATTEMPTS) {setHasTimedOut(true);- enqueueErrorSnackBar({- message: t`We're still waiting for a confirmation from our payment provider (Stripe). Please refresh in a few seconds.`,+ enqueueToast({+ variant: 'error',+ children: t`We're still waiting for a confirmation from our payment provider (Stripe). Please refresh in a few seconds.`,});return;}diff --git a/packages/twenty-front/src/pages/onboarding/WorkspaceActivation.tsx b/packages/twenty-front/src/pages/onboarding/WorkspaceActivation.tsxindex eea7b7f6ff9..d328ecf9722 100644--- a/packages/twenty-front/src/pages/onboarding/WorkspaceActivation.tsx+++ b/packages/twenty-front/src/pages/onboarding/WorkspaceActivation.tsx@@ -1,6 +1,3 @@-import { styled } from '@linaria/react';-import { useCallback, useEffect, useRef } from 'react';-import { isAppEffectRedirectEnabledState } from '@/app/states/isAppEffectRedirectEnabledState';import { Logo } from '@/auth/components/Logo';import { SubTitle } from '@/auth/components/SubTitle';@@ -11,19 +8,22 @@ import { OnboardingStepAnimatedItem } from '@/onboarding/components/OnboardingStimport { useSetNextOnboardingStatus } from '@/onboarding/hooks/useSetNextOnboardingStatus';import { onboardingActivationFailedState } from '@/onboarding/states/onboardingActivationFailedState';import { onboardingFreeCreditsState } from '@/onboarding/states/onboardingFreeCreditsState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';import { useLoadCurrentUser } from '@/users/hooks/useLoadCurrentUser';-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';+import { styled } from '@linaria/react';import { Trans, useLingui } from '@lingui/react/macro';import { isNonEmptyString } from '@sniptt/guards';+import { useCallback, useEffect, useRef } from 'react';import { isDefined } from 'twenty-shared/utils';import { MainButton } from 'twenty-ui/primitives/input';import { themeCssVariables } from 'twenty-ui/theme-constants';import { ActivateWorkspaceDocument } from '~/generated-metadata/graphql';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';+import { useToast } from 'twenty-ui/primitives/feedback';+const StyledContainer = styled.div`align-items: center;background: ${themeCssVariables.background.secondary};@@ -41,7 +41,7 @@ const StyledButtonContainer = styled.div`export const WorkspaceActivation = () => {const { t } = useLingui();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const setNextOnboardingStatus = useSetNextOnboardingStatus();const { loadCurrentUser } = useLoadCurrentUser();const [activateWorkspace, { loading: isActivating }] = useMutation(@@ -84,13 +84,11 @@ export const WorkspaceActivation = () => {setIsCreatingWorkspace(false);setOnboardingActivationFailed(true);- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));}}, [activateWorkspace,- enqueueErrorSnackBar,+ enqueueToast,loadCurrentUser,setOnboardingActivationFailed,setIsAppEffectRedirectEnabled,diff --git a/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsConfiguration.tsx b/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsConfiguration.tsxindex 7b5c6a3c4e7..bf147597d48 100644--- a/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsConfiguration.tsx+++ b/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsConfiguration.tsx@@ -4,12 +4,13 @@ import { useNavigate, useParams } from 'react-router-dom';import { type CalendarChannel } from '@/accounts/types/CalendarChannel';import { type MessageChannel } from '@/accounts/types/MessageChannel';-import { SettingsPath } from 'twenty-shared/types';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { GET_MY_CALENDAR_CHANNELS } from '@/settings/accounts/graphql/queries/getMyCalendarChannels';import { GET_MY_MESSAGE_CHANNELS } from '@/settings/accounts/graphql/queries/getMyMessageChannels';import { useMutation, useQuery } from '@apollo/client/react';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { StartChannelSyncDocument } from '~/generated-metadata/graphql';import { SettingsAccountsConfigurationSelectedMessageChannelEffect } from '~/pages/settings/accounts/SettingsAccountsConfigurationSelectedMessageChannelEffect';import { SettingsAccountsConfigurationStepCalendar } from '~/pages/settings/accounts/SettingsAccountsConfigurationStepCalendar';@@ -26,7 +27,7 @@ export const SettingsAccountsConfiguration = () => {connectedAccountId: string;}>();const navigate = useNavigate();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [startChannelSyncMutation, { loading: isSubmitting }] = useMutation(StartChannelSyncDocument,);@@ -70,15 +71,14 @@ export const SettingsAccountsConfiguration = () => {connectedAccountId,},onCompleted: () => {- enqueueSuccessSnackBar({- message: t`Account added successfully. Sync started.`,+ enqueueToast({+ variant: 'success',+ children: t`Account added successfully. Sync started.`,});navigate(getSettingsPath(SettingsPath.Accounts));},onError: (error) => {- enqueueErrorSnackBar({- apolloError: error,- });+ enqueueToast(getToastOptionsFromError({ error }));},});};diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminAiProviderDetail.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminAiProviderDetail.tsxindex e48b6190333..6ad4198dcb8 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminAiProviderDetail.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminAiProviderDetail.tsx@@ -1,13 +1,27 @@-import { useMemo, useState } from 'react';-import { useNavigate, useParams } from 'react-router-dom';-+import { useClientConfig } from '@/client-config/hooks/useClientConfig';+import { AI_ADMIN_PATH } from '@/settings/admin-panel/ai/constants/AiAdminPath';+import { AI_PROVIDER_SOURCE } from '@/settings/admin-panel/ai/constants/AiProviderSource';+import { REMOVE_AI_PROVIDER } from '@/settings/admin-panel/ai/graphql/mutations/removeAiProvider';+import { REMOVE_MODEL_FROM_PROVIDER } from '@/settings/admin-panel/ai/graphql/mutations/removeModelFromProvider';+import { SET_ADMIN_AI_MODELS_ENABLED } from '@/settings/admin-panel/ai/graphql/mutations/setAdminAiModelsEnabled';+import { GET_ADMIN_AI_MODELS } from '@/settings/admin-panel/ai/graphql/queries/getAdminAiModels';+import { GET_AI_PROVIDERS } from '@/settings/admin-panel/ai/graphql/queries/getAiProviders';+import { type GetAiProvidersResult } from '@/settings/admin-panel/ai/types/GetAiProvidersResult';+import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';+import { SettingsAiModelsTable } from '@/settings/ai/components/SettingsAiModelsTable';+import { getDataResidencyDisplay } from '@/settings/ai/utils/getDataResidencyDisplay';+import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';+import { SettingsSkeletonLoader } from '@/settings/components/SettingsSkeletonLoader';+import { SettingsTableCard } from '@/settings/components/SettingsTableCard';+import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';+import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';+import { useModal } from '@/ui/layout/modal/hooks/useModal';import { useMutation, useQuery } from '@apollo/client/react';import { t } from '@lingui/core/macro';+import { useMemo, useState } from 'react';+import { useNavigate, useParams } from 'react-router-dom';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';--import { AI_ADMIN_PATH } from '@/settings/admin-panel/ai/constants/AiAdminPath';-import { AI_PROVIDER_SOURCE } from '@/settings/admin-panel/ai/constants/AiProviderSource';import {type IconComponent,IconFlag,@@ -19,33 +33,17 @@ import {IconTrash,IconWorld,} from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';import { Button, SearchInput } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';import { RoundedLink, UndecoratedLink } from 'twenty-ui/primitives/navigation';--import { useClientConfig } from '@/client-config/hooks/useClientConfig';-import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';-import { SettingsSkeletonLoader } from '@/settings/components/SettingsSkeletonLoader';-import { SettingsAiModelsTable } from '@/settings/ai/components/SettingsAiModelsTable';-import { REMOVE_AI_PROVIDER } from '@/settings/admin-panel/ai/graphql/mutations/removeAiProvider';-import { SET_ADMIN_AI_MODELS_ENABLED } from '@/settings/admin-panel/ai/graphql/mutations/setAdminAiModelsEnabled';-import { REMOVE_MODEL_FROM_PROVIDER } from '@/settings/admin-panel/ai/graphql/mutations/removeModelFromProvider';-import { GET_ADMIN_AI_MODELS } from '@/settings/admin-panel/ai/graphql/queries/getAdminAiModels';-import { GET_AI_PROVIDERS } from '@/settings/admin-panel/ai/graphql/queries/getAiProviders';-import { type GetAiProvidersResult } from '@/settings/admin-panel/ai/types/GetAiProvidersResult';-import { getDataResidencyDisplay } from '@/settings/ai/utils/getDataResidencyDisplay';-import { SettingsTableCard } from '@/settings/components/SettingsTableCard';-import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';-import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';+import { H2Title } from 'twenty-ui/primitives/typography';import {type AdminAiModelConfig,SetAdminAiModelEnabledDocument,} from '~/generated-admin/graphql';+import { useToast } from 'twenty-ui/primitives/feedback';+const REMOVE_PROVIDER_MODAL_ID = 'settings-ai-provider-remove';const REMOVE_MODEL_MODAL_ID = 'settings-ai-model-remove';@@ -53,7 +51,7 @@ export const SettingsAdminAiProviderDetail = () => {const { providerName } = useParams<{ providerName: string }>();const apolloAdminClient = useApolloAdminClient();const navigate = useNavigate();- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { refetch: refetchClientConfig } = useClientConfig();const { openModal } = useModal();const [searchQuery, setSearchQuery] = useState('');@@ -104,13 +102,15 @@ export const SettingsAdminAiProviderDetail = () => {{ query: GET_ADMIN_AI_MODELS },],});- enqueueSuccessSnackBar({- message: t`Provider "${provider?.label ?? providerName}" removed`,+ enqueueToast({+ variant: 'success',+ children: t`Provider "${provider?.label ?? providerName}" removed`,});navigate(AI_ADMIN_PATH);} catch {- enqueueErrorSnackBar({- message: t`Failed to remove provider`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to remove provider`,});}};@@ -132,14 +132,13 @@ export const SettingsAdminAiProviderDetail = () => {],});await refetchClientConfig();- enqueueSuccessSnackBar({- message: t`Model "${modelToRemove.label}" removed`,+ enqueueToast({+ variant: 'success',+ children: t`Model "${modelToRemove.label}" removed`,});setModelToRemove(null);} catch {- enqueueErrorSnackBar({- message: t`Failed to remove model`,- });+ enqueueToast({ variant: 'error', children: t`Failed to remove model` });}};@@ -187,8 +186,9 @@ export const SettingsAdminAiProviderDetail = () => {});await refetchClientConfig();} catch {- enqueueErrorSnackBar({- message: t`Failed to update model availability`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to update model availability`,});}};@@ -381,8 +381,9 @@ export const SettingsAdminAiProviderDetail = () => {},});} catch {- enqueueErrorSnackBar({- message: t`Failed to update model availability`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to update model availability`,});} finally {await refetchModels();diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDangerZone.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDangerZone.tsxindex 9df3e119e41..827ca26a236 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDangerZone.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDangerZone.tsx@@ -1,4 +1,3 @@-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';@@ -8,19 +7,22 @@ import { Trans, useLingui } from '@lingui/react/macro';import { isNonEmptyString } from '@sniptt/guards';import { useState } from 'react';import { SettingsPath } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';import { IconShare, IconTrash, IconUserPlus } from 'twenty-ui/icon';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';-import {- H1Title,- H1TitleFontColor,- H2Title,-} from 'twenty-ui/primitives/typography';+import { useToast } from 'twenty-ui/primitives/feedback';import { Button } from 'twenty-ui/primitives/input';import {Section,SectionAlignment,SectionFontColor,} from 'twenty-ui/primitives/layout';+import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import {+ H1Title,+ H1TitleFontColor,+ H2Title,+} from 'twenty-ui/primitives/typography';+import { themeCssVariables } from 'twenty-ui/theme-constants';import {type ApplicationRegistration,ClaimApplicationRegistrationOwnershipDocument,@@ -30,14 +32,12 @@ import {TransferApplicationRegistrationOwnershipDocument,} from '~/generated-metadata/graphql';import { useNavigateSettings } from '~/hooks/useNavigateSettings';-import { themeCssVariables } from 'twenty-ui/theme-constants';import {StyledAppModal,StyledAppModalButton,StyledAppModalSection,StyledAppModalTitle,} from '~/pages/settings/applications/components/SettingsAppModalLayout';-import { isDefined } from 'twenty-shared/utils';const DELETE_REGISTRATION_MODAL_ID = 'delete-application-registration-modal';@@ -63,7 +63,7 @@ export const SettingsAdminApplicationRegistrationDangerZone = ({}) => {const { t } = useLingui();const navigate = useNavigateSettings();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { openModal, closeModal } = useModal();const [isLoading, setIsLoading] = useState(false);@@ -134,13 +134,12 @@ export const SettingsAdminApplicationRegistrationDangerZone = ({);}- enqueueSuccessSnackBar({- message: t`App deleted successfully`,+ enqueueToast({+ variant: 'success',+ children: t`App deleted successfully`,});} catch {- enqueueErrorSnackBar({- message: t`Error deleting app`,- });+ enqueueToast({ variant: 'error', children: t`Error deleting app` });} finally {setIsLoading(false);}@@ -161,14 +160,16 @@ export const SettingsAdminApplicationRegistrationDangerZone = ({targetWorkspaceSubdomain: trimmed,},});- enqueueSuccessSnackBar({- message: t`Ownership transferred successfully`,+ enqueueToast({+ variant: 'success',+ children: t`Ownership transferred successfully`,});setTransferSubdomain('');navigate(SettingsPath.Applications);} catch {- enqueueErrorSnackBar({- message: t`Failed to transfer ownership. Check that the subdomain is correct.`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to transfer ownership. Check that the subdomain is correct.`,});} finally {setIsTransferring(false);@@ -181,13 +182,15 @@ export const SettingsAdminApplicationRegistrationDangerZone = ({await claimOwnership({variables: { applicationRegistrationId },});- enqueueSuccessSnackBar({- message: t`Ownership claimed successfully`,+ enqueueToast({+ variant: 'success',+ children: t`Ownership claimed successfully`,});closeModal(CLAIM_OWNERSHIP_MODAL_ID);} catch {- enqueueErrorSnackBar({- message: t`Failed to claim ownership.`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to claim ownership.`,});} finally {setIsClaiming(false);diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminInferredVersion.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminInferredVersion.tsxindex ac4dbe6c7c9..c5b397fc642 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminInferredVersion.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminInferredVersion.tsx@@ -1,7 +1,6 @@import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';import { SettingsTableCard } from '@/settings/components/SettingsTableCard';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { useMutation, useQuery } from '@apollo/client/react';import { styled } from '@linaria/react';@@ -9,9 +8,10 @@ import { t } from '@lingui/core/macro';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath } from 'twenty-shared/utils';import { IconId } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';+import { useToast } from 'twenty-ui/primitives/feedback';import { Button } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';+import { H2Title } from 'twenty-ui/primitives/typography';import { themeCssVariables } from 'twenty-ui/theme-constants';import {GetInstanceAndAllWorkspacesUpgradeStatusDocument,@@ -27,7 +27,7 @@ const StyledRefreshButtonContainer = styled.div`export const SettingsAdminInferredVersion = () => {const apolloAdminClient = useApolloAdminClient();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const {data,@@ -50,12 +50,14 @@ export const SettingsAdminInferredVersion = () => {try {await refreshUpgradeStatus();await refetch();- enqueueSuccessSnackBar({- message: t`Upgrade status refreshed`,+ enqueueToast({+ variant: 'success',+ children: t`Upgrade status refreshed`,});} catch (error) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:error instanceof Error? error.message: t`Failed to refresh upgrade status`,diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminInstanceStatus.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminInstanceStatus.tsxindex f1ae68a4afc..c18103e3d9f 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminInstanceStatus.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminInstanceStatus.tsx@@ -2,7 +2,6 @@ import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApoimport { getUpgradeHealthStatusBadge } from '@/settings/admin-panel/utils/getUpgradeHealthStatusBadge';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';import { SettingsTableCard } from '@/settings/components/SettingsTableCard';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { UserContext } from '@/users/contexts/UserContext';@@ -13,16 +12,17 @@ import { isNonEmptyString } from '@sniptt/guards';import { useContext } from 'react';import { SettingsPath } from 'twenty-shared/types';import { formatUpgradeCommandName, getSettingsPath } from 'twenty-shared/utils';-import { Status } from 'twenty-ui/primitives/data-display';import {IconAlertTriangle,IconCalendar,IconProgressCheck,IconStatusChange,} from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';+import { Status } from 'twenty-ui/primitives/data-display';+import { useToast } from 'twenty-ui/primitives/feedback';import { Button } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';+import { H2Title } from 'twenty-ui/primitives/typography';import { themeCssVariables } from 'twenty-ui/theme-constants';import {GetInstanceAndAllWorkspacesUpgradeStatusDocument,@@ -44,7 +44,7 @@ const StyledCommandValue = styled.span`export const SettingsAdminInstanceStatus = () => {const apolloAdminClient = useApolloAdminClient();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { dateFormat, timeFormat, timeZone } = useContext(UserContext);const { localeCatalog } = useAtomStateValue(dateLocaleState);@@ -80,12 +80,14 @@ export const SettingsAdminInstanceStatus = () => {try {await refreshUpgradeStatus();await refetch();- enqueueSuccessSnackBar({- message: t`Upgrade status refreshed`,+ enqueueToast({+ variant: 'success',+ children: t`Upgrade status refreshed`,});} catch (error) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:error instanceof Error? error.message: t`Failed to refresh upgrade status`,diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminNewAiModel.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminNewAiModel.tsxindex 5a59c668fa1..f6ea9c73ce0 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminNewAiModel.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminNewAiModel.tsx@@ -1,34 +1,31 @@-import { useMemo, useState } from 'react';--import { styled } from '@linaria/react';+import { ADD_MODEL_TO_PROVIDER } from '@/settings/admin-panel/ai/graphql/mutations/addModelToProvider';+import { GET_ADMIN_AI_MODELS } from '@/settings/admin-panel/ai/graphql/queries/getAdminAiModels';+import { GET_AI_PROVIDERS } from '@/settings/admin-panel/ai/graphql/queries/getAiProviders';+import { GET_MODELS_DEV_SUGGESTIONS } from '@/settings/admin-panel/ai/graphql/queries/getModelsDevSuggestions';+import { useCustomAiProviderAccess } from '@/settings/admin-panel/ai/hooks/useCustomAiProviderAccess';+import { type GetAiProvidersResult } from '@/settings/admin-panel/ai/types/GetAiProvidersResult';+import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';+import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';+import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';+import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';+import { Select } from '@/ui/input/components/Select';+import { TextInput } from '@/ui/input/components/TextInput';import { useMutation, useQuery } from '@apollo/client/react';+import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { Trans, useLingui } from '@lingui/react/macro';+import { useMemo, useState } from 'react';import { Controller, useForm } from 'react-hook-form';import { useNavigate, useParams } from 'react-router-dom';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';import { IconPlus } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';-import { Info } from 'twenty-ui/primitives/feedback';+import { Info, useToast } from 'twenty-ui/primitives/feedback';+import { Checkbox, Switch } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';+import { H2Title } from 'twenty-ui/primitives/typography';import { themeCssVariables } from 'twenty-ui/theme-constants';--import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';-import { ADD_MODEL_TO_PROVIDER } from '@/settings/admin-panel/ai/graphql/mutations/addModelToProvider';-import { GET_ADMIN_AI_MODELS } from '@/settings/admin-panel/ai/graphql/queries/getAdminAiModels';-import { GET_AI_PROVIDERS } from '@/settings/admin-panel/ai/graphql/queries/getAiProviders';-import { GET_MODELS_DEV_SUGGESTIONS } from '@/settings/admin-panel/ai/graphql/queries/getModelsDevSuggestions';-import { type GetAiProvidersResult } from '@/settings/admin-panel/ai/types/GetAiProvidersResult';-import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';-import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { Select } from '@/ui/input/components/Select';-import { TextInput } from '@/ui/input/components/TextInput';-import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';-import { useCustomAiProviderAccess } from '@/settings/admin-panel/ai/hooks/useCustomAiProviderAccess';import { OrganizationAdornment } from '~/pages/settings/enterprise/components/OrganizationAdornment';-import { Checkbox, Switch } from 'twenty-ui/primitives/input';const StyledComboInputContainer = styled.div`display: flex;@@ -97,7 +94,7 @@ export const SettingsAdminNewAiModel = () => {const apolloAdminClient = useApolloAdminClient();const navigate = useNavigate();const { t } = useLingui();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [isSubmitting, setIsSubmitting] = useState(false);const [isCustomModelId, setIsCustomModelId] = useState(false);const {@@ -307,14 +304,13 @@ export const SettingsAdminNewAiModel = () => {],});- enqueueSuccessSnackBar({- message: t`Model "${values.label.trim()}" added`,+ enqueueToast({+ variant: 'success',+ children: t`Model "${values.label.trim()}" added`,});navigate(providerDetailPath);} catch {- enqueueErrorSnackBar({- message: t`Failed to add model`,- });+ enqueueToast({ variant: 'error', children: t`Failed to add model` });} finally {setIsSubmitting(false);}diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminNewAiProvider.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminNewAiProvider.tsxindex 8ff8a925086..e6ea2e9ff03 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminNewAiProvider.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminNewAiProvider.tsx@@ -1,36 +1,32 @@-import { isNonEmptyString } from '@sniptt/guards';--import { useMemo, useState } from 'react';--import { useMutation, useQuery } from '@apollo/client/react';-import { Trans, useLingui } from '@lingui/react/macro';-import { Controller, useForm } from 'react-hook-form';-import { useNavigate } from 'react-router-dom';-import { type AiSdkPackage, isDataResidency } from 'twenty-shared/ai';-import { SettingsPath } from 'twenty-shared/types';-import { getSettingsPath } from 'twenty-shared/utils';-import { Info } from 'twenty-ui/primitives/feedback';-import { IconPlus } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';-import { Section } from 'twenty-ui/primitives/layout';-import { AI_ADMIN_PATH } from '@/settings/admin-panel/ai/constants/AiAdminPath';import { DATA_RESIDENCY_OPTIONS } from '@/settings/admin-panel/ai/constants/DataResidencyOptions';-import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';import { ADD_AI_PROVIDER } from '@/settings/admin-panel/ai/graphql/mutations/addAiProvider';import { GET_ADMIN_AI_MODELS } from '@/settings/admin-panel/ai/graphql/queries/getAdminAiModels';import { GET_AI_PROVIDERS } from '@/settings/admin-panel/ai/graphql/queries/getAiProviders';import { GET_MODELS_DEV_PROVIDERS } from '@/settings/admin-panel/ai/graphql/queries/getModelsDevProviders';+import { useCustomAiProviderAccess } from '@/settings/admin-panel/ai/hooks/useCustomAiProviderAccess';import { type RawAiProviderConfig } from '@/settings/admin-panel/ai/types/RawAiProviderConfig';-import { slugify } from 'transliteration';import { getProviderIcon } from '@/settings/admin-panel/ai/utils/getProviderIcon';+import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { Select } from '@/ui/input/components/Select';import { TextInput } from '@/ui/input/components/TextInput';-import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';-import { useCustomAiProviderAccess } from '@/settings/admin-panel/ai/hooks/useCustomAiProviderAccess';+import { useMutation, useQuery } from '@apollo/client/react';+import { Trans, useLingui } from '@lingui/react/macro';+import { isNonEmptyString } from '@sniptt/guards';+import { useMemo, useState } from 'react';+import { Controller, useForm } from 'react-hook-form';+import { useNavigate } from 'react-router-dom';+import { slugify } from 'transliteration';+import { type AiSdkPackage, isDataResidency } from 'twenty-shared/ai';+import { SettingsPath } from 'twenty-shared/types';+import { getSettingsPath } from 'twenty-shared/utils';+import { IconPlus } from 'twenty-ui/icon';+import { Info, useToast } from 'twenty-ui/primitives/feedback';+import { Section } from 'twenty-ui/primitives/layout';+import { H2Title } from 'twenty-ui/primitives/typography';import { OrganizationAdornment } from '~/pages/settings/enterprise/components/OrganizationAdornment';type ModelsDevProvider = { id: string; modelCount: number; npm: AiSdkPackage };@@ -50,7 +46,7 @@ export const SettingsAdminNewAiProvider = () => {const apolloAdminClient = useApolloAdminClient();const navigate = useNavigate();const { t } = useLingui();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [isSubmitting, setIsSubmitting] = useState(false);const [selectedModelsDevId, setSelectedModelsDevId] = useState<string | null>(null,@@ -242,14 +238,13 @@ export const SettingsAdminNewAiProvider = () => {],});- enqueueSuccessSnackBar({- message: t`Provider "${values.label.trim()}" added`,+ enqueueToast({+ variant: 'success',+ children: t`Provider "${values.label.trim()}" added`,});navigate(AI_ADMIN_PATH);} catch {- enqueueErrorSnackBar({- message: t`Failed to add provider`,- });+ enqueueToast({ variant: 'error', children: t`Failed to add provider` });} finally {setIsSubmitting(false);}diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsxindex 38ac40006dd..0b6bc678463 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx@@ -1,34 +1,24 @@-import { useParams } from 'react-router-dom';--import { useMutation, useQuery } from '@apollo/client/react';-import { t } from '@lingui/core/macro';-import { styled } from '@linaria/react';-import { isNonEmptyString } from '@sniptt/guards';-import { SettingsPath } from 'twenty-shared/types';-import { getSettingsPath, isDefined } from 'twenty-shared/utils';-import { currentUserState } from '@/auth/states/currentUserState';import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';-import { labPublicFeatureFlagsState } from '@/client-config/states/labPublicFeatureFlagsState';import { billingState } from '@/client-config/states/billingState';import { canManageFeatureFlagsState } from '@/client-config/states/canManageFeatureFlagsState';+import { labPublicFeatureFlagsState } from '@/client-config/states/labPublicFeatureFlagsState';import { AI_ADMIN_PATH } from '@/settings/admin-panel/ai/constants/AiAdminPath';import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';import { SettingsAdminWorkspaceBillingContent } from '@/settings/admin-panel/components/SettingsAdminWorkspaceBillingContent';-import { SETTINGS_ADMIN_FEATURE_FLAG_METADATA } from '@/settings/admin-panel/constants/SettingsAdminFeatureFlagMetadata';import { SettingsAdminWorkspaceContent } from '@/settings/admin-panel/components/SettingsAdminWorkspaceContent';-import {- SettingsTableListSection,- type SettingsTableListSectionColumn,-} from '@/settings/components/SettingsTableListSection';-import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';+import { SETTINGS_ADMIN_FEATURE_FLAG_METADATA } from '@/settings/admin-panel/constants/SettingsAdminFeatureFlagMetadata';import { GET_ADMIN_WORKSPACE_CHAT_THREADS } from '@/settings/admin-panel/graphql/queries/getAdminWorkspaceChatThreads';import { WORKSPACE_LOOKUP_ADMIN_PANEL } from '@/settings/admin-panel/graphql/queries/workspaceLookupAdminPanel';import { useAdminUpdateFeatureFlag } from '@/settings/admin-panel/hooks/useAdminUpdateFeatureFlag';import { useHandleImpersonate } from '@/settings/admin-panel/hooks/useHandleImpersonate';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';+import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';import { SettingsSkeletonLoader } from '@/settings/components/SettingsSkeletonLoader';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import {+ SettingsTableListSection,+ type SettingsTableListSectionColumn,+} from '@/settings/components/SettingsTableListSection';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { SettingsTabBar } from '@/settings/components/layout/SettingsTabBar';import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';@@ -40,9 +30,13 @@ import { TableRow } from '@/ui/layout/table/components/TableRow';import { DEFAULT_WORKSPACE_LOGO } from '@/ui/navigation/navigation-drawer/constants/DefaultWorkspaceLogo';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { Avatar } from 'twenty-ui/primitives/data-display';-import { Switch, Button } from 'twenty-ui/primitives/input';-import { Text, H2Title } from 'twenty-ui/primitives/typography';+import { useMutation, useQuery } from '@apollo/client/react';+import { styled } from '@linaria/react';+import { t } from '@lingui/core/macro';+import { isNonEmptyString } from '@sniptt/guards';+import { useParams } from 'react-router-dom';+import { SettingsPath } from 'twenty-shared/types';+import { getSettingsPath, isDefined } from 'twenty-shared/utils';import {IconCreditCard,IconEyeShare,@@ -51,21 +45,26 @@ import {IconSettings2,IconUsers,} from 'twenty-ui/icon';+import { Avatar } from 'twenty-ui/primitives/data-display';+import { Button, Switch } from 'twenty-ui/primitives/input';+import { Section } from 'twenty-ui/primitives/layout';import {Card,OverflowingTextWithTooltip,TooltipPosition,} from 'twenty-ui/primitives/surfaces';-import { Section } from 'twenty-ui/primitives/layout';+import { H2Title, Text } from 'twenty-ui/primitives/typography';import { themeCssVariables } from 'twenty-ui/theme-constants';-import { getAbsoluteImageUrl } from '~/utils/image/getAbsoluteImageUrl';import {+ GetUpgradeStatusDocument,+ UpdateWorkspaceFeatureFlagDocument,type FeatureFlagKey,type GetAdminWorkspaceChatThreadsQuery,type WorkspaceLookupAdminPanelQuery,- GetUpgradeStatusDocument,- UpdateWorkspaceFeatureFlagDocument,} from '~/generated-admin/graphql';+import { getAbsoluteImageUrl } from '~/utils/image/getAbsoluteImageUrl';++import { useToast } from 'twenty-ui/primitives/feedback';const StyledFeatureFlagName = styled(Text)`color: ${themeCssVariables.font.color.primary};@@ -99,7 +98,7 @@ export const SettingsAdminWorkspaceDetail = () => {const labPublicFeatureFlags = useAtomStateValue(labPublicFeatureFlagsState);const isBillingEnabled = billing?.isBillingEnabled ?? false;const canManageFeatureFlags = useAtomStateValue(canManageFeatureFlagsState);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { updateFeatureFlagState } = useAdminUpdateFeatureFlag();const { handleImpersonate, impersonatingUserId } = useHandleImpersonate();const [updateFeatureFlag] = useMutation(UpdateWorkspaceFeatureFlagDocument, {@@ -165,8 +164,9 @@ export const SettingsAdminWorkspaceDetail = () => {if (isDefined(previousValue)) {updateFeatureFlagState(workspaceId, featureFlag, previousValue);}- enqueueErrorSnackBar({- message: `Failed to update feature flag. ${error.message}`,+ enqueueToast({+ variant: 'error',+ children: `Failed to update feature flag. ${error.message}`,});},});diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspacesStatus.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspacesStatus.tsxindex 95785426087..59ccf8d3682 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspacesStatus.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspacesStatus.tsx@@ -2,16 +2,16 @@ import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApoimport { SettingsAdminWorkspacesByHealthAccordion } from '@/settings/admin-panel/health-status/components/SettingsAdminWorkspacesByHealthAccordion';import { SettingsAdminWorkspacesStatusSummaryCard } from '@/settings/admin-panel/health-status/components/SettingsAdminWorkspacesStatusSummaryCard';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { useMutation, useQuery } from '@apollo/client/react';import { styled } from '@linaria/react';import { plural, t } from '@lingui/core/macro';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath } from 'twenty-shared/utils';-import { H2Title } from 'twenty-ui/primitives/typography';+import { useToast } from 'twenty-ui/primitives/feedback';import { Button } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';+import { H2Title } from 'twenty-ui/primitives/typography';import { themeCssVariables } from 'twenty-ui/theme-constants';import {GetInstanceAndAllWorkspacesUpgradeStatusDocument,@@ -33,7 +33,7 @@ const StyledAccordionCardsContainer = styled.div`export const SettingsAdminWorkspacesStatus = () => {const apolloAdminClient = useApolloAdminClient();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const {data,@@ -56,12 +56,14 @@ export const SettingsAdminWorkspacesStatus = () => {try {await refreshUpgradeStatus();await refetch();- enqueueSuccessSnackBar({- message: t`Upgrade status refreshed`,+ enqueueToast({+ variant: 'success',+ children: t`Upgrade status refreshed`,});} catch (error) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:error instanceof Error? error.message: t`Failed to refresh upgrade status`,diff --git a/packages/twenty-front/src/pages/settings/ai/SettingsToolDetail.tsx b/packages/twenty-front/src/pages/settings/ai/SettingsToolDetail.tsxindex 497662d46e8..9ef90414519 100644--- a/packages/twenty-front/src/pages/settings/ai/SettingsToolDetail.tsx+++ b/packages/twenty-front/src/pages/settings/ai/SettingsToolDetail.tsx@@ -1,28 +1,24 @@-import { useQuery } from '@apollo/client/react';-import { t } from '@lingui/core/macro';-import { useContext, useState } from 'react';-import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';-import { useNavigate, useParams } from 'react-router-dom';-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { useGetOneLogicFunction } from '@/logic-functions/hooks/useGetOneLogicFunction';import { usePersistLogicFunction } from '@/logic-functions/hooks/usePersistLogicFunction';-import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';+import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { SettingsLogicFunctionLabelContainer } from '@/settings/logic-functions/components/SettingsLogicFunctionLabelContainer';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { TextArea } from '@/ui/input/components/TextArea';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';-import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { useQuery } from '@apollo/client/react';+import { t } from '@lingui/core/macro';+import { useContext, useState } from 'react';+import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';+import { useNavigate, useParams } from 'react-router-dom';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined, isValidUuid } from 'twenty-shared/utils';import { IconTrash } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';import { Button } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';-+import { H2Title } from 'twenty-ui/primitives/typography';import { ThemeContext } from 'twenty-ui/theme-constants';import { useDebouncedCallback } from 'use-debounce';import {@@ -32,13 +28,15 @@ import {import { SettingsToolIcon } from '~/pages/settings/ai/components/SettingsToolIcon';import { SettingsToolParameterTable } from '~/pages/settings/ai/components/SettingsToolParameterTable';+import { useToast } from 'twenty-ui/primitives/feedback';+const DELETE_TOOL_MODAL_ID = 'delete-tool-modal';export const SettingsToolDetail = () => {const { toolIdentifier } = useParams();const { theme } = useContext(ThemeContext);const navigate = useNavigate();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { updateLogicFunction, deleteLogicFunction } =usePersistLogicFunction();const { openModal } = useModal();@@ -163,10 +161,10 @@ export const SettingsToolDetail = () => {});if (result.status === 'successful') {- enqueueSuccessSnackBar({ message: t`Tool deleted` });+ enqueueToast({ variant: 'success', children: t`Tool deleted` });navigate(getSettingsPath(SettingsPath.AI, undefined, undefined, 'tools'));} else {- enqueueErrorSnackBar({ message: t`Failed to delete tool` });+ enqueueToast({ variant: 'error', children: t`Failed to delete tool` });}setIsDeleting(false);diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDeleteConfirmationModal.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDeleteConfirmationModal.tsxindex 47db9b582d6..228ba9965dc 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDeleteConfirmationModal.tsx+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDeleteConfirmationModal.tsx@@ -1,12 +1,12 @@-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { Trans, useLingui } from '@lingui/react/macro';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';-import { SettingsPath } from 'twenty-shared/types';import { useMutation } from '@apollo/client/react';+import { SettingsPath } from 'twenty-shared/types';+import { useToast } from 'twenty-ui/primitives/feedback';import { DeleteOneAgentDocument } from '~/generated-metadata/graphql';import { useNavigateSettings } from '~/hooks/useNavigateSettings';@@ -24,7 +24,7 @@ export const SettingsAgentDeleteConfirmationModal = ({const { t } = useLingui();const { closeModal } = useModal();const navigate = useNavigateSettings();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [deleteAgent] = useMutation(DeleteOneAgentDocument);const handleDelete = async () => {@@ -37,9 +37,7 @@ export const SettingsAgentDeleteConfirmationModal = ({closeModal(DELETE_AGENT_MODAL_ID);navigate(SettingsPath.AI);} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));}};diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentEvalsTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentEvalsTab.tsxindex 0b9f478099e..7745b0b394d 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentEvalsTab.tsx+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentEvalsTab.tsx@@ -1,7 +1,6 @@import { RUN_EVALUATION_INPUT } from '@/ai/graphql/mutations/runEvaluationInput';import { GET_AGENT_TURNS } from '@/ai/graphql/queries/getAgentTurns';import { SettingsListCard } from '@/settings/components/SettingsListCard';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { TextInput } from '@/ui/input/components/TextInput';import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';@@ -12,11 +11,11 @@ import { useModal } from '@/ui/layout/modal/hooks/useModal';import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';import { useMutation } from '@apollo/client/react';-import { getOperationName } from '~/utils/getOperationName';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { useState } from 'react';import { useNavigate } from 'react-router-dom';+import { useToast } from 'twenty-ui/primitives/feedback';import {IconDotsVertical,IconMessage,@@ -30,6 +29,7 @@ import { MenuItem } from 'twenty-ui/primitives/navigation';import { themeCssVariables } from 'twenty-ui/theme-constants';import { v4 as uuidv4 } from 'uuid';import { SETTINGS_AGENT_DETAIL_TABS } from '~/pages/settings/ai/constants/SettingsAgentDetailTabs';+import { getOperationName } from '~/utils/getOperationName';const DELETE_EVAL_INPUT_MODAL_ID = 'delete-eval-input-modal';@@ -67,7 +67,7 @@ export const SettingsAgentEvalsTab = ({const [inputToDelete, setInputToDelete] = useState<string | null>(null);const { openModal } = useModal();const { closeDropdown } = useCloseDropdown();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const navigate = useNavigate();const tabListComponentId = `${SETTINGS_AGENT_DETAIL_TABS.COMPONENT_INSTANCE_ID}-${agentId}`;@@ -83,8 +83,9 @@ export const SettingsAgentEvalsTab = ({navigate(`#${logsTabId}`);},onError: () => {- enqueueErrorSnackBar({- message: t`Failed to execute evaluation input`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to execute evaluation input`,});},refetchQueries: [getOperationName(GET_AGENT_TURNS) ?? ''],diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentLogsTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentLogsTab.tsxindex c2572238da5..8393f0f54ab 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentLogsTab.tsx+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentLogsTab.tsx@@ -1,27 +1,27 @@-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { Table } from '@/ui/layout/table/components/Table';import { TableCell } from '@/ui/layout/table/components/TableCell';import { TableHeader } from '@/ui/layout/table/components/TableHeader';import { TableRow } from '@/ui/layout/table/components/TableRow';+import { useMutation, useQuery } from '@apollo/client/react';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { useEffect, useState } from 'react';import Skeleton from 'react-loading-skeleton';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';-import { Status } from 'twenty-ui/primitives/data-display';import { IconChevronRight } from 'twenty-ui/icon';-import { Button, LightIconButton } from 'twenty-ui/primitives/input';+import { Status } from 'twenty-ui/primitives/data-display';import {AnimatedPlaceholder,AnimatedPlaceholderEmptyContainer,AnimatedPlaceholderEmptySubTitle,AnimatedPlaceholderEmptyTextContainer,AnimatedPlaceholderEmptyTitle,+ useToast,} from 'twenty-ui/primitives/feedback';+import { Button, LightIconButton } from 'twenty-ui/primitives/input';import { UndecoratedLink } from 'twenty-ui/primitives/navigation';import { themeCssVariables } from 'twenty-ui/theme-constants';-import { useMutation, useQuery } from '@apollo/client/react';import {EvaluateAgentTurnDocument,GetAgentTurnsDocument,@@ -42,7 +42,7 @@ type SettingsAgentLogsTabProps = {export const SettingsAgentLogsTab = ({agentId,}: SettingsAgentLogsTabProps) => {- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [evaluatingTurnIds, setEvaluatingTurnIds] = useState<Set<string>>(new Set(),);@@ -108,8 +108,9 @@ export const SettingsAgentLogsTab = ({return next;});}- enqueueSuccessSnackBar({- message: t`Turn evaluated successfully`,+ enqueueToast({+ variant: 'success',+ children: t`Turn evaluated successfully`,});refetch();},@@ -124,9 +125,7 @@ export const SettingsAgentLogsTab = ({next.delete(turnId);return next;});- enqueueErrorSnackBar({- message: t`Failed to evaluate turn`,- });+ enqueueToast({ variant: 'error', children: t`Failed to evaluate turn` });});};diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSkillsTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSkillsTab.tsxindex 1dd72e41f5a..8781b8cdd23 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSkillsTab.tsx+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSkillsTab.tsx@@ -1,6 +1,6 @@+import { useToast } from 'twenty-ui/primitives/feedback';import { getApplicationDisplayName } from '@/applications/utils/getApplicationDisplayName';import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';@@ -35,7 +35,7 @@ const StyledSearchContainer = styled.div`export const SettingsAgentSkillsTab = () => {const { t } = useLingui();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { data, loading, refetch } = useQuery(FindManySkillsDocument);const [activateSkill] = useMutation(ActivateSkillDocument);@@ -102,20 +102,20 @@ export const SettingsAgentSkillsTab = () => {const handleActivate = async (skillId: string) => {try {await activateSkill({ variables: { id: skillId } });- enqueueSuccessSnackBar({ message: t`Skill activated` });+ enqueueToast({ variant: 'success', children: t`Skill activated` });refetch();} catch {- enqueueErrorSnackBar({ message: t`Failed to activate skill` });+ enqueueToast({ variant: 'error', children: t`Failed to activate skill` });}};const handleDelete = async (skillId: string) => {try {await deleteSkill({ variables: { id: skillId } });- enqueueSuccessSnackBar({ message: t`Skill deleted` });+ enqueueToast({ variant: 'success', children: t`Skill deleted` });refetch();} catch {- enqueueErrorSnackBar({ message: t`Failed to delete skill` });+ enqueueToast({ variant: 'error', children: t`Failed to delete skill` });}};diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAiOverviewTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAiOverviewTab.tsxindex 6c3bd1d69c5..d3df2b0a6e8 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAiOverviewTab.tsx+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAiOverviewTab.tsx@@ -1,21 +1,22 @@-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { FormAdvancedTextFieldInput } from '@/advanced-text-editor/components/FormAdvancedTextFieldInput';import { AI_INSTRUCTIONS_EDITOR_PROFILE } from '@/ai/constants/AiInstructionsEditorProfile';+import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { SettingsCard } from '@/settings/components/SettingsCard';import { SettingsStatsGrid } from '@/settings/components/SettingsStatsGrid';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';import { CombinedGraphQLErrors } from '@apollo/client';import { useMutation, useQuery } from '@apollo/client/react';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { Fragment, useContext, useState } from 'react';+import { SettingsPath } from 'twenty-shared/types';+import { getSettingsPath } from 'twenty-shared/utils';import { IconBook, IconMessage, IconSparkles, IconTool } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';+import { useToast } from 'twenty-ui/primitives/feedback';import { Section } from 'twenty-ui/primitives/layout';import { UndecoratedLink } from 'twenty-ui/primitives/navigation';-import { SettingsPath } from 'twenty-shared/types';-import { getSettingsPath } from 'twenty-shared/utils';+import { H2Title } from 'twenty-ui/primitives/typography';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import { useDebouncedCallback } from 'use-debounce';import {@@ -33,7 +34,7 @@ const MCP_DEEP_LINK = `${getSettingsPath(SettingsPath.ApiWebhooks)}#mcp`;export const SettingsAiOverviewTab = () => {const { theme } = useContext(ThemeContext);- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [currentWorkspace, setCurrentWorkspace] = useAtomState(currentWorkspaceState,);@@ -67,10 +68,11 @@ export const SettingsAiOverviewTab = () => {aiAdditionalInstructions: originalInstructions || null,});if (CombinedGraphQLErrors.is(error)) {- enqueueErrorSnackBar({ apolloError: error });+ enqueueToast(getToastOptionsFromError({ error }));} else {- enqueueErrorSnackBar({- message: t`Failed to save workspace instructions`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to save workspace instructions`,});}}diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillDangerZone.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillDangerZone.tsxindex 622cb56f2f6..321d4c60454 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillDangerZone.tsx+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillDangerZone.tsx@@ -1,16 +1,16 @@-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { useState } from 'react';import { SettingsPath } from 'twenty-shared/types';+import { useToast } from 'twenty-ui/primitives/feedback';import { IconArchive, IconArchiveOff, IconTrash } from 'twenty-ui/icon';import { Button } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';import { themeCssVariables } from 'twenty-ui/theme-constants';import { H2Title } from 'twenty-ui/primitives/typography';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';import {@@ -39,7 +39,7 @@ export const SettingsSkillDangerZone = ({skill,}: SettingsSkillDangerZoneProps) => {const navigate = useNavigateSettings();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { openModal, closeModal } = useModal();const [isSubmitting, setIsSubmitting] = useState(false);@@ -53,9 +53,7 @@ export const SettingsSkillDangerZone = ({await mutation();navigate(SettingsPath.AI);} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));} finally {setIsSubmitting(false);}diff --git a/packages/twenty-front/src/pages/settings/ai/hooks/useCreateTool.ts b/packages/twenty-front/src/pages/settings/ai/hooks/useCreateTool.tsindex 74d294322da..fcf26b33bb9 100644--- a/packages/twenty-front/src/pages/settings/ai/hooks/useCreateTool.ts+++ b/packages/twenty-front/src/pages/settings/ai/hooks/useCreateTool.ts@@ -6,11 +6,11 @@ import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';import { usePersistLogicFunction } from '@/logic-functions/hooks/usePersistLogicFunction';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useToast } from 'twenty-ui/primitives/feedback';export const useCreateTool = () => {const navigate = useNavigate();- const { enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { createLogicFunction } = usePersistLogicFunction();const [isCreatingTool, setIsCreatingTool] = useState(false);@@ -26,13 +26,13 @@ export const useCreateTool = () => {},});- // Failure path already surfaces its own snackbar from usePersistLogicFunction.+ // Failure path already surfaces its own toast from usePersistLogicFunction.if (result.status !== 'successful' || !isDefined(result.response?.data)) {return;}const newLogicFunction = result.response.data.createOneLogicFunction;- enqueueSuccessSnackBar({ message: t`Tool created` });+ enqueueToast({ variant: 'success', children: t`Tool created` });const applicationId = newLogicFunction.applicationId;if (isDefined(applicationId)) {diff --git a/packages/twenty-front/src/pages/settings/ai/hooks/useNavigateToNotFoundOnLoadFailure.ts b/packages/twenty-front/src/pages/settings/ai/hooks/useNavigateToNotFoundOnLoadFailure.tsindex b530c7e1b48..b349fcd7f76 100644--- a/packages/twenty-front/src/pages/settings/ai/hooks/useNavigateToNotFoundOnLoadFailure.ts+++ b/packages/twenty-front/src/pages/settings/ai/hooks/useNavigateToNotFoundOnLoadFailure.ts@@ -2,8 +2,9 @@ import { type ErrorLike } from '@apollo/client';import { useEffect } from 'react';import { AppPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useNavigateApp } from '~/hooks/useNavigateApp';export const useNavigateToNotFoundOnLoadFailure = ({@@ -16,22 +17,18 @@ export const useNavigateToNotFoundOnLoadFailure = ({notFoundMessage: string;}) => {const navigateApp = useNavigateApp();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();useEffect(() => {if (!hasFailedToLoad) {return;}- enqueueErrorSnackBar(- isDefined(error) ? { apolloError: error } : { message: notFoundMessage },+ enqueueToast(+ isDefined(error)+ ? getToastOptionsFromError({ error })+ : { variant: 'error', children: notFoundMessage },);navigateApp(AppPath.NotFound);- }, [- hasFailedToLoad,- error,- notFoundMessage,- enqueueErrorSnackBar,- navigateApp,- ]);+ }, [hasFailedToLoad, error, notFoundMessage, enqueueToast, navigateApp]);};diff --git a/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAgentSave.ts b/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAgentSave.tsindex e5ca21e6825..98e18288c5a 100644--- a/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAgentSave.ts+++ b/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAgentSave.ts@@ -5,9 +5,10 @@ import { useEffect, useState } from 'react';import { useDebouncedCallback } from 'use-debounce';import { SettingsPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useSaveDraftRoleToDB } from '@/settings/roles/role/hooks/useSaveDraftRoleToDB';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import {type CreateAgentInput,CreateOneAgentDocument,@@ -34,7 +35,7 @@ export const useSettingsAgentSave = ({validateForm: () => boolean;}) => {const navigate = useNavigateSettings();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [isSubmitting, setIsSubmitting] = useState(false);const [originalFormValues, setOriginalFormValues] =useState(initialFormValues);@@ -54,14 +55,13 @@ export const useSettingsAgentSave = ({return true;} catch (error) {if (CombinedGraphQLErrors.is(error)) {- enqueueErrorSnackBar({- apolloError: error,- });+ enqueueToast(getToastOptionsFromError({ error }));} else {const errorMessage =error instanceof Error ? error.message : String(error);- enqueueErrorSnackBar({- message: t`Failed to save role permissions: ${errorMessage}`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to save role permissions: ${errorMessage}`,});}@@ -117,9 +117,7 @@ export const useSettingsAgentSave = ({setOriginalFormValues({ ...formValues });} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));} finally {setIsSubmitting(false);}@@ -183,9 +181,7 @@ export const useSettingsAgentSave = ({navigate(SettingsPath.AI);} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));} finally {setIsSubmitting(false);}diff --git a/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAiModelsActions.ts b/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAiModelsActions.tsindex 29db1e6d808..7fc4bb5255e 100644--- a/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAiModelsActions.ts+++ b/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsAiModelsActions.ts@@ -1,3 +1,4 @@+import { useToast } from 'twenty-ui/primitives/feedback';import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { type AiModelTier } from 'twenty-shared/ai';@@ -7,7 +8,6 @@ import {currentWorkspaceState,type CurrentWorkspace,} from '@/auth/states/currentWorkspaceState';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';import {AiModelTier as GraphqlAiModelTier,@@ -28,7 +28,7 @@ type WorkspaceAiModelSettingsChanges = Partial<>;export const useSettingsAiModelsActions = () => {- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [currentWorkspace, setCurrentWorkspace] = useAtomState(currentWorkspaceState,);@@ -46,7 +46,10 @@ export const useSettingsAiModelsActions = () => {await updateWorkspace({ variables: { input: changes } });} catch {setCurrentWorkspace(previousWorkspace);- enqueueErrorSnackBar({ message: t`Failed to update model settings` });+ enqueueToast({+ variant: 'error',+ children: t`Failed to update model settings`,+ });}};diff --git a/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsSkillSave.ts b/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsSkillSave.tsindex 3e8d55ed9b3..21196e764ef 100644--- a/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsSkillSave.ts+++ b/packages/twenty-front/src/pages/settings/ai/hooks/useSettingsSkillSave.ts@@ -1,11 +1,11 @@-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { useEffect, useState } from 'react';import { useDebouncedCallback } from 'use-debounce';import { SettingsPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import {CreateSkillDocument,type FindOneSkillQuery,@@ -29,7 +29,7 @@ export const useSettingsSkillSave = ({validateForm: () => boolean;}) => {const navigate = useNavigateSettings();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [isSubmitting, setIsSubmitting] = useState(false);const [originalFormValues, setOriginalFormValues] =useState(initialFormValues);@@ -70,9 +70,7 @@ export const useSettingsSkillSave = ({setOriginalFormValues({ ...formValues });} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));} finally {setIsSubmitting(false);}@@ -110,9 +108,7 @@ export const useSettingsSkillSave = ({navigate(SettingsPath.AI);} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));} finally {setIsSubmitting(false);}diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsClaimApplicationSection.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsClaimApplicationSection.tsxindex 2fe5b4e7f33..baf99adbd4c 100644--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsClaimApplicationSection.tsx+++ b/packages/twenty-front/src/pages/settings/applications/components/SettingsClaimApplicationSection.tsx@@ -1,7 +1,7 @@import { ApplicationDisplay } from '@/applications/components/ApplicationDisplay';import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';+import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlag';import { getDocumentationUrl } from '@/support/utils/getDocumentationUrl';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useLazyQuery, useMutation } from '@apollo/client/react';@@ -17,19 +17,18 @@ import {} from 'react-router-dom';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';-import { Callout } from 'twenty-ui/primitives/feedback';import { IconBrandGithub, IconRefresh, IconSearch } from 'twenty-ui/icon';+import { Callout, useToast } from 'twenty-ui/primitives/feedback';import { Button } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';-import { themeCssVariables } from 'twenty-ui/theme-constants';import { H2Title } from 'twenty-ui/primitives/typography';+import { themeCssVariables } from 'twenty-ui/theme-constants';import {FindClaimableApplicationRegistrationDocument,GithubClaimAuthorizationUrlDocument,PermissionFlagType,SyncMarketplaceCatalogDocument,} from '~/generated-metadata/graphql';-import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlag';import { getClaimErrorContent } from '~/pages/settings/applications/utils/getClaimErrorContent';export const CLAIM_ERROR_CODE_SEARCH_PARAM = 'claimErrorCode';@@ -83,7 +82,7 @@ const StyledCalloutContainer = styled.div`export const SettingsClaimApplicationSection = () => {const { t } = useLingui();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState);const [searchParams] = useSearchParams();@@ -150,8 +149,9 @@ export const SettingsClaimApplicationSection = () => {setNotFound(true);}} catch (error) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:error instanceof Error ? error.message : t`Could not run the lookup`,});}@@ -175,8 +175,9 @@ export const SettingsClaimApplicationSection = () => {window.location.href = authorizationUrl;} catch (error) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:error instanceof Error? error.message: t`Could not start the GitHub claim`,@@ -187,12 +188,14 @@ export const SettingsClaimApplicationSection = () => {const handleSync = async () => {try {await syncCatalog();- enqueueSuccessSnackBar({- message: t`Catalog sync started. Try your lookup again in a moment.`,+ enqueueToast({+ variant: 'success',+ children: t`Catalog sync started. Try your lookup again in a moment.`,});} catch (error) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:error instanceof Error? error.message: t`Could not sync the catalog`,diff --git a/packages/twenty-front/src/pages/settings/applications/hooks/useApplicationTimelineActivityTypes.ts b/packages/twenty-front/src/pages/settings/applications/hooks/useApplicationTimelineActivityTypes.tsindex 74a75bbc9f2..823a04b9017 100644--- a/packages/twenty-front/src/pages/settings/applications/hooks/useApplicationTimelineActivityTypes.ts+++ b/packages/twenty-front/src/pages/settings/applications/hooks/useApplicationTimelineActivityTypes.ts@@ -1,7 +1,7 @@-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { useState } from 'react';+import { useToast } from 'twenty-ui/primitives/feedback';import {ResetTimelineActivityTypeDocument,UpdateTimelineActivityTypeIsActiveDocument,@@ -13,7 +13,7 @@ export const useApplicationTimelineActivityTypes = ({}: {isInstalledApplication: boolean;}) => {- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [mutatingTimelineActivityTypeIds, setMutatingTimelineActivityTypeIds] =useState<ReadonlySet<string>>(new Set());const { installedTimelineActivityTypes, loading } =@@ -42,9 +42,7 @@ export const useApplicationTimelineActivityTypes = ({try {await mutation();} catch {- enqueueErrorSnackBar({- message: errorMessage,- });+ enqueueToast({ variant: 'error', children: errorMessage });} finally {setMutatingTimelineActivityTypeIds((currentIds) => {const nextIds = new Set(currentIds);diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationGeneralSection.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationGeneralSection.tsxindex c355b256be1..7b0a99cad14 100644--- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationGeneralSection.tsx+++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationGeneralSection.tsx@@ -1,7 +1,8 @@import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';+import { useToast } from 'twenty-ui/primitives/feedback';import { IconRefresh } from 'twenty-ui/icon';import { Section } from 'twenty-ui/primitives/layout';import { Card } from 'twenty-ui/primitives/surfaces';@@ -15,7 +16,7 @@ export const SettingsApplicationGeneralSection = ({applicationId: string;autoUpgrade: boolean;}) => {- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [updateApplication] = useMutation(UpdateApplicationDocument);@@ -28,8 +29,9 @@ export const SettingsApplicationGeneralSection = ({},});} catch {- enqueueErrorSnackBar({- message: t`Failed to update auto-upgrade setting.`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to update auto-upgrade setting.`,});}};diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationRegistrationOAuthTab.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationRegistrationOAuthTab.tsxindex ddade688689..01fedb6d793 100644--- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationRegistrationOAuthTab.tsx+++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationRegistrationOAuthTab.tsx@@ -1,6 +1,5 @@import { SettingsTableCard } from '@/settings/components/SettingsTableCard';import { ApiKeyInput } from '@/settings/developers/components/ApiKeyInput';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';@@ -10,18 +9,19 @@ import { Trans, useLingui } from '@lingui/react/macro';import { isNonEmptyString } from '@sniptt/guards';import { useState } from 'react';import { IconKey, IconRefresh, IconShield } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';+import { useToast } from 'twenty-ui/primitives/feedback';import { Button } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';+import { H2Title } from 'twenty-ui/primitives/typography';import { themeCssVariables } from 'twenty-ui/theme-constants';import {RotateApplicationRegistrationClientSecretDocument,UpdateApplicationRegistrationDocument,} from '~/generated-metadata/graphql';-import { applicationRegistrationClientSecretFamilyState } from '~/pages/settings/applications/states/applicationRegistrationClientSecretFamilyState';-import { type ApplicationRegistrationData } from '~/pages/settings/applications/tabs/types/ApplicationRegistrationData';import { SettingsApplicationRegistrationRedirectURIsInput } from '~/pages/settings/applications/components/SettingsApplicationRegistrationRedirectURIsInput';import { SettingsApplicationRegistrationRedirectURIsTable } from '~/pages/settings/applications/components/SettingsApplicationRegistrationRedirectURIsTable';+import { applicationRegistrationClientSecretFamilyState } from '~/pages/settings/applications/states/applicationRegistrationClientSecretFamilyState';+import { type ApplicationRegistrationData } from '~/pages/settings/applications/tabs/types/ApplicationRegistrationData';const ROTATE_SECRET_MODAL_ID = 'rotate-application-registration-secret-modal';@@ -35,7 +35,7 @@ export const SettingsApplicationRegistrationOAuthTab = ({registration: ApplicationRegistrationData;}) => {const { t } = useLingui();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { openModal } = useModal();const applicationRegistrationId = registration.id;@@ -73,10 +73,13 @@ export const SettingsApplicationRegistrationOAuthTab = ({},},});- enqueueSuccessSnackBar({ message: t`Redirect URIs updated` });+ enqueueToast({ variant: 'success', children: t`Redirect URIs updated` });setFormRedirectUris(newFormRedirectUris);} catch {- enqueueErrorSnackBar({ message: t`Error updating redirect URIs` });+ enqueueToast({+ variant: 'error',+ children: t`Error updating redirect URIs`,+ });} finally {setIsLoading(false);}@@ -93,13 +96,15 @@ export const SettingsApplicationRegistrationOAuthTab = ({if (isNonEmptyString(secret)) {setRotatedSecret(secret);- enqueueSuccessSnackBar({- message: t`Client secret rotated. Copy it now — it won't be shown again.`,+ enqueueToast({+ variant: 'success',+ children: t`Client secret rotated. Copy it now — it won't be shown again.`,});}} catch {- enqueueErrorSnackBar({- message: t`Error rotating client secret`,+ enqueueToast({+ variant: 'error',+ children: t`Error rotating client secret`,});} finally {setIsLoading(false);diff --git a/packages/twenty-front/src/pages/settings/billing/SettingsBillingNewLimit.tsx b/packages/twenty-front/src/pages/settings/billing/SettingsBillingNewLimit.tsxindex 6049a37e17b..a0ac0af1ea6 100644--- a/packages/twenty-front/src/pages/settings/billing/SettingsBillingNewLimit.tsx+++ b/packages/twenty-front/src/pages/settings/billing/SettingsBillingNewLimit.tsx@@ -3,6 +3,7 @@ import { Trans, useLingui } from '@lingui/react/macro';import { useState } from 'react';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { SettingsBillingLimitForm } from '@/settings/billing/components/SettingsBillingLimitForm';import { EMPTY_USAGE_LIMIT_FORM_VALUES } from '@/settings/billing/constants/EmptyUsageLimitFormValues';@@ -14,13 +15,12 @@ import { buildCreateUsageLimitInput } from '@/settings/billing/utils/buildCreateimport { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { useNavigateSettings } from '~/hooks/useNavigateSettings';export const SettingsBillingNewLimit = () => {const { t } = useLingui();const navigate = useNavigateSettings();- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { usageQuotaDefinitions, loading: definitionsLoading } =useUsageQuotaDefinitions();const { createUsageLimit, loading: isSaving } = useCreateUsageLimit();@@ -39,7 +39,7 @@ export const SettingsBillingNewLimit = () => {try {await createUsageLimit({ variables: { input } });- enqueueSuccessSnackBar({ message: t`Limit created.` });+ enqueueToast({ variant: 'success', children: t`Limit created.` });navigate(SettingsPath.BillingLimits);} catch (error) {const serverMessage =@@ -47,8 +47,9 @@ export const SettingsBillingNewLimit = () => {? error.errors[0]?.message: undefined;- enqueueErrorSnackBar({- message: serverMessage ?? t`Failed to create the limit.`,+ enqueueToast({+ variant: 'error',+ children: serverMessage ?? t`Failed to create the limit.`,});}};diff --git a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceCommunicationGroupChannelDetail.tsx b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceCommunicationGroupChannelDetail.tsxindex 201f459cce7..267c0e891a2 100644--- a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceCommunicationGroupChannelDetail.tsx+++ b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceCommunicationGroupChannelDetail.tsx@@ -1,38 +1,35 @@-import { useQuery } from '@apollo/client/react';-import { styled } from '@linaria/react';-import { useLingui } from '@lingui/react/macro';-import { useState } from 'react';-import { useParams } from 'react-router-dom';-import { SettingsAccountsMessageChannelDetails } from '@/settings/accounts/components/SettingsAccountsMessageChannelDetails';import { useDeleteEmailGroupChannel } from '@/settings/accounts/hooks/useDeleteEmailGroupChannel';import { useMyMessageChannels } from '@/settings/accounts/hooks/useMyMessageChannels';import { useUpdateEmailGroupChannel } from '@/settings/accounts/hooks/useUpdateEmailGroupChannel';-import { SettingsEditableTitle } from '@/settings/components/SettingsEditableTitle';-import { getEmailChannelDomain } from '@/settings/accounts/utils/getEmailChannelDomain';--import { SettingsEmailingDomainDnsRecords } from '@/settings/emailing-domains/components/SettingsEmailingDomainDnsRecords';-import { SettingsEmailingDomainVerifyButton } from '@/settings/emailing-domains/components/SettingsEmailingDomainVerifyButton';+import { SettingsEditableTitle } from '@/settings/components/SettingsEditableTitle';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';import { SettingsSkeletonLoader } from '@/settings/components/SettingsSkeletonLoader';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';+import { SettingsEmailingDomainDnsRecords } from '@/settings/emailing-domains/components/SettingsEmailingDomainDnsRecords';+import { SettingsEmailingDomainVerifyButton } from '@/settings/emailing-domains/components/SettingsEmailingDomainVerifyButton';+import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useQuery } from '@apollo/client/react';+import { styled } from '@linaria/react';+import { useLingui } from '@lingui/react/macro';import { isNonEmptyString } from '@sniptt/guards';+import { useState } from 'react';+import { useParams } from 'react-router-dom';import { MessageChannelType, SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';-import { GetEmailingDomainsDocument } from '~/generated-metadata/graphql';import { IconCopy, IconTrash } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';+import { useToast } from 'twenty-ui/primitives/feedback';import { Button } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';+import { H2Title } from 'twenty-ui/primitives/typography';import { themeCssVariables } from 'twenty-ui/theme-constants';-import { NotFound } from '~/pages/not-found/NotFound';+import { GetEmailingDomainsDocument } from '~/generated-metadata/graphql';import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';import { useNavigateSettings } from '~/hooks/useNavigateSettings';+import { NotFound } from '~/pages/not-found/NotFound';const DELETE_EMAIL_GROUP_MODAL_ID = 'delete-email-group-channel-modal';@@ -59,7 +56,7 @@ export const SettingsWorkspaceCommunicationGroupChannelDetail = () => {const { channels, loading } = useMyMessageChannels();const { copyToClipboard } = useCopyToClipboard();const { openModal } = useModal();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { deleteEmailGroupChannel, loading: deleting } =useDeleteEmailGroupChannel();const { updateEmailGroupChannel, loading: updatingDisplayName } =@@ -107,8 +104,9 @@ export const SettingsWorkspaceCommunicationGroupChannelDetail = () => {isNonEmptyString(nextDisplayName) ? nextDisplayName : null,);} catch {- enqueueErrorSnackBar({- message: t`Failed to update sender name.`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to update sender name.`,});} finally {setDisplayNameDraft(null);@@ -120,8 +118,9 @@ export const SettingsWorkspaceCommunicationGroupChannelDetail = () => {await deleteEmailGroupChannel(channel.id);navigateSettings(SettingsPath.WorkspaceCommunications);} catch {- enqueueErrorSnackBar({- message: t`Failed to delete email channel.`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to delete email channel.`,});}};diff --git a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceNewUnsubscribeTopic.tsx b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceNewUnsubscribeTopic.tsxindex c5e8a9c17d7..487bd244c5e 100644--- a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceNewUnsubscribeTopic.tsx+++ b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceNewUnsubscribeTopic.tsx@@ -1,29 +1,29 @@-import { useLingui } from '@lingui/react/macro';-import { useCallback, useState } from 'react';--import { useCreateUnsubscribeTopic } from '@/settings/unsubscribe-topics/hooks/useCreateUnsubscribeTopic';-import { SETTINGS_UNSUBSCRIBE_TAB_IDS } from '@/settings/unsubscribers/constants/SettingsUnsubscribeTabIds';-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { useCreateUnsubscribeTopic } from '@/settings/unsubscribe-topics/hooks/useCreateUnsubscribeTopic';+import { SETTINGS_UNSUBSCRIBE_TAB_IDS } from '@/settings/unsubscribers/constants/SettingsUnsubscribeTabIds';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';+import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';+import { useLingui } from '@lingui/react/macro';+import { useCallback, useState } from 'react';import { FeatureFlagKey, SettingsPath } from 'twenty-shared/types';import { getSettingsPath } from 'twenty-shared/utils';-import { UnsubscribeTopicVisibility } from '~/generated-metadata/graphql';import { IconEye } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';import { Section } from 'twenty-ui/primitives/layout';import { Card } from 'twenty-ui/primitives/surfaces';-import { NotFound } from '~/pages/not-found/NotFound';+import { H2Title } from 'twenty-ui/primitives/typography';+import { UnsubscribeTopicVisibility } from '~/generated-metadata/graphql';import { useNavigateSettings } from '~/hooks/useNavigateSettings';+import { NotFound } from '~/pages/not-found/NotFound';++import { useToast } from 'twenty-ui/primitives/feedback';export const SettingsWorkspaceNewUnsubscribeTopic = () => {const { t } = useLingui();const navigate = useNavigateSettings();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { createUnsubscribeTopic, loading } = useCreateUnsubscribeTopic();const isMessageCampaignEnabled = useIsFeatureEnabled(FeatureFlagKey.IS_MESSAGE_CAMPAIGN_ENABLED,@@ -66,8 +66,9 @@ export const SettingsWorkspaceNewUnsubscribeTopic = () => {navigateToTopics();}} catch {- enqueueErrorSnackBar({- message: t`Failed to create unsubscribe topic.`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to create unsubscribe topic.`,});}}, [@@ -77,7 +78,7 @@ export const SettingsWorkspaceNewUnsubscribeTopic = () => {isPublic,navigate,navigateToTopics,- enqueueErrorSnackBar,+ enqueueToast,t,]);diff --git a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceUnsubscribeTopicDetail.tsx b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceUnsubscribeTopicDetail.tsxindex 192bfbb3085..8680ea96391 100644--- a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceUnsubscribeTopicDetail.tsx+++ b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceUnsubscribeTopicDetail.tsx@@ -1,30 +1,30 @@-import { useLingui } from '@lingui/react/macro';-import { useEffect, useState } from 'react';-import { useParams } from 'react-router-dom';-import { useUnsubscribeTopics } from '@/activities/emails/hooks/useUnsubscribeTopics';-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';import { SettingsSkeletonLoader } from '@/settings/components/SettingsSkeletonLoader';-import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { useDeleteUnsubscribeTopic } from '@/settings/unsubscribe-topics/hooks/useDeleteUnsubscribeTopic';import { useUpdateUnsubscribeTopic } from '@/settings/unsubscribe-topics/hooks/useUpdateUnsubscribeTopic';import { SETTINGS_UNSUBSCRIBE_TAB_IDS } from '@/settings/unsubscribers/constants/SettingsUnsubscribeTabIds';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';+import { useLingui } from '@lingui/react/macro';+import { useEffect, useState } from 'react';+import { useParams } from 'react-router-dom';import { FeatureFlagKey, SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';-import { UnsubscribeTopicVisibility } from '~/generated-metadata/graphql';import { IconEye, IconTrash } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';import { Button } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';import { Card } from 'twenty-ui/primitives/surfaces';-import { NotFound } from '~/pages/not-found/NotFound';+import { H2Title } from 'twenty-ui/primitives/typography';+import { UnsubscribeTopicVisibility } from '~/generated-metadata/graphql';import { useNavigateSettings } from '~/hooks/useNavigateSettings';+import { NotFound } from '~/pages/not-found/NotFound';++import { useToast } from 'twenty-ui/primitives/feedback';const DELETE_UNSUBSCRIBE_TOPIC_MODAL_ID = 'delete-unsubscribe-topic-modal';@@ -34,7 +34,7 @@ export const SettingsWorkspaceUnsubscribeTopicDetail = () => {const { unsubscribeTopicId } = useParams<{ unsubscribeTopicId: string }>();const { unsubscribeTopics, loading } = useUnsubscribeTopics();const { openModal } = useModal();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { updateUnsubscribeTopic } = useUpdateUnsubscribeTopic();const { deleteUnsubscribeTopic, loading: deleting } =useDeleteUnsubscribeTopic();@@ -75,8 +75,9 @@ export const SettingsWorkspaceUnsubscribeTopicDetail = () => {try {await updateUnsubscribeTopic(input);} catch {- enqueueErrorSnackBar({- message: t`Failed to update unsubscribe topic.`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to update unsubscribe topic.`,});}};@@ -113,8 +114,9 @@ export const SettingsWorkspaceUnsubscribeTopicDetail = () => {SETTINGS_UNSUBSCRIBE_TAB_IDS.TOPICS,);} catch {- enqueueErrorSnackBar({- message: t`Failed to delete unsubscribe topic.`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to delete unsubscribe topic.`,});}};diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldEdit.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldEdit.tsxindex 3f81816e391..7c782e88994 100644--- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldEdit.tsx+++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldEdit.tsx@@ -1,10 +1,6 @@-import { zodResolver } from '@hookform/resolvers/zod';-import omit from 'lodash.omit';-import { useEffect, useState } from 'react';-import { FormProvider, useForm } from 'react-hook-form';-import { useLocation, useNavigate, useParams } from 'react-router-dom';-import { WorkspaceRouteUnavailable } from '@/app/routing/components/WorkspaceRouteUnavailable';+import { isValidReturnToPath } from '@/auth/utils/isValidReturnToPath';+import { isDDLLockedState } from '@/client-config/states/isDDLLockedState';import { useFieldMetadataItem } from '@/object-metadata/hooks/useFieldMetadataItem';import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems';import { useGetIsMetadataItemCustom } from '@/object-metadata/hooks/useGetIsMetadataItemCustom';@@ -12,40 +8,44 @@ import { useGetRelationMetadata } from '@/object-metadata/hooks/useGetRelationMeimport { useUpdateOneFieldMetadataItem } from '@/object-metadata/hooks/useUpdateOneFieldMetadataItem';import { formatFieldMetadataItemInput } from '@/object-metadata/utils/formatFieldMetadataItemInput';import { isLabelIdentifierField } from '@/object-metadata/utils/isLabelIdentifierField';-import { isDDLLockedState } from '@/client-config/states/isDDLLockedState';import { isObjectMetadataReadOnly } from '@/object-record/read-only/utils/isObjectMetadataReadOnly';import { resolveJunctionConfig } from '@/object-record/record-field/ui/utils/junction/resolveJunctionConfig';import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';+import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { FIELD_NAME_MAXIMUM_LENGTH } from '@/settings/data-model/constants/FieldNameMaximumLength';import { SettingsDataModelFieldDescriptionForm } from '@/settings/data-model/fields/forms/components/SettingsDataModelFieldDescriptionForm';-import { SettingsTranslationsButton } from '@/settings/translations/components/SettingsTranslationsButton';import { SettingsDataModelFieldIconLabelForm } from '@/settings/data-model/fields/forms/components/SettingsDataModelFieldIconLabelForm';import { SettingsDataModelFieldSettingsFormCard } from '@/settings/data-model/fields/forms/components/SettingsDataModelFieldSettingsFormCard';import { settingsFieldFormSchema } from '@/settings/data-model/fields/forms/validation-schemas/settingsFieldFormSchema';import { type SettingsDataModelFieldEditFormValues } from '@/settings/data-model/types/SettingsDataModelFieldEditFormValues';import { type SettingsFieldType } from '@/settings/data-model/types/SettingsFieldType';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';+import { SettingsTranslationsButton } from '@/settings/translations/components/SettingsTranslationsButton';+import { useWorkspaceSurface } from '@/ui/layout/hooks/useWorkspaceSurface';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';-import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';-import { useWorkspaceSurface } from '@/ui/layout/hooks/useWorkspaceSurface';+import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { zodResolver } from '@hookform/resolvers/zod';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';+import omit from 'lodash.omit';+import { useEffect, useState } from 'react';+import { FormProvider, useForm } from 'react-hook-form';+import { useLocation, useNavigate, useParams } from 'react-router-dom';import { AppPath, SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';import { IconArchive, IconArchiveOff, IconTrash } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';import { Button } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';+import { H2Title } from 'twenty-ui/primitives/typography';import { themeCssVariables } from 'twenty-ui/theme-constants';import { FieldMetadataType } from '~/generated-metadata/graphql';import { useNavigateApp } from '~/hooks/useNavigateApp';import { useNavigateSettings } from '~/hooks/useNavigateSettings';import { getFieldMetadataItemInitialValues } from '~/pages/settings/data-model/utils/getFieldMetadataItemInitialValues';-import { isValidReturnToPath } from '@/auth/utils/isValidReturnToPath';-import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState';++import { useToast } from 'twenty-ui/primitives/feedback';const DELETE_FIELD_MODAL_ID = 'delete-field-confirmation-modal';const StyledDangerButtons = styled.div`@@ -60,7 +60,7 @@ export const SettingsObjectFieldEdit = () => {const { t } = useLingui();const { openModal, closeModal } = useModal();- const { enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const navigate = useNavigate();const location = useLocation();@@ -313,9 +313,7 @@ export const SettingsObjectFieldEdit = () => {});if (deleteResult.status === 'successful') {- enqueueSuccessSnackBar({- message: t`Field deleted`,- });+ enqueueToast({ variant: 'success', children: t`Field deleted` });closeModal(DELETE_FIELD_MODAL_ID);navigateSettings(SettingsPath.ObjectDetail, {objectNamePlural,diff --git a/packages/twenty-front/src/pages/settings/data-model/new-field/SettingsObjectNewFieldConfigure.tsx b/packages/twenty-front/src/pages/settings/data-model/new-field/SettingsObjectNewFieldConfigure.tsxindex beebe5f6de9..599dbbd93a1 100644--- a/packages/twenty-front/src/pages/settings/data-model/new-field/SettingsObjectNewFieldConfigure.tsx+++ b/packages/twenty-front/src/pages/settings/data-model/new-field/SettingsObjectNewFieldConfigure.tsx@@ -3,14 +3,13 @@ import { isDDLLockedState } from '@/client-config/states/isDDLLockedState';import { useFieldMetadataItem } from '@/object-metadata/hooks/useFieldMetadataItem';import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';+import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { SettingsWizardStepBar } from '@/settings/components/layout/SettingsWizardStepBar';import { FIELD_NAME_MAXIMUM_LENGTH } from '@/settings/data-model/constants/FieldNameMaximumLength';import { SettingsObjectNewFieldHeaderIcon } from '@/settings/data-model/fields/components/SettingsObjectNewFieldHeaderIcon';import { SettingsDataModelFieldIconLabelForm } from '@/settings/data-model/fields/forms/components/SettingsDataModelFieldIconLabelForm';import { SettingsDataModelFieldSettingsFormCard } from '@/settings/data-model/fields/forms/components/SettingsDataModelFieldSettingsFormCard';import { settingsFieldFormSchema } from '@/settings/data-model/fields/forms/validation-schemas/settingsFieldFormSchema';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { useWorkspaceSurface } from '@/ui/layout/hooks/useWorkspaceSurface';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { zodResolver } from '@hookform/resolvers/zod';@@ -24,9 +23,10 @@ import {SettingsPath,} from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';-import { H2Title } from 'twenty-ui/primitives/typography';+import { useToast } from 'twenty-ui/primitives/feedback';import { Button } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';+import { H2Title } from 'twenty-ui/primitives/typography';import { themeCssVariables } from 'twenty-ui/theme-constants';import { type z } from 'zod';import { FieldMetadataType } from '~/generated-metadata/graphql';@@ -53,7 +53,7 @@ export const SettingsObjectNewFieldConfigure = () => {const fieldType =(searchParams.get('fieldType') as FieldMetadataType) ||FieldMetadataType.TEXT;- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { findObjectMetadataItemByNamePlural } =useFilteredObjectMetadataItems();@@ -178,8 +178,9 @@ export const SettingsObjectNewFieldConfigure = () => {return createCleanUp(creationResult);}default: {- enqueueErrorSnackBar({- message: t`Please select at least one destination object for this relation.`,+ enqueueToast({+ variant: 'error',+ children: t`Please select at least one destination object for this relation.`,});return setIsSaving(false);}diff --git a/packages/twenty-front/src/pages/settings/data-model/new-index/SettingsObjectNewIndex.tsx b/packages/twenty-front/src/pages/settings/data-model/new-index/SettingsObjectNewIndex.tsxindex 04ca71b48e9..fc37765e45c 100644--- a/packages/twenty-front/src/pages/settings/data-model/new-index/SettingsObjectNewIndex.tsx+++ b/packages/twenty-front/src/pages/settings/data-model/new-index/SettingsObjectNewIndex.tsx@@ -6,10 +6,9 @@ import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataIteimport { SEARCH_VECTOR_FIELD_NAME } from '@/object-record/constants/SearchVectorFieldName';import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';+import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { SettingsObjectIndexFieldsForm } from '@/settings/data-model/indexes/forms/components/SettingsObjectIndexFieldsForm';import { SettingsObjectIndexOptionsForm } from '@/settings/data-model/indexes/forms/components/SettingsObjectIndexOptionsForm';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { useWorkspaceSurface } from '@/ui/layout/hooks/useWorkspaceSurface';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { zodResolver } from '@hookform/resolvers/zod';@@ -17,16 +16,16 @@ import { useLingui } from '@lingui/react/macro';import { useEffect, useMemo } from 'react';import { FormProvider, useForm } from 'react-hook-form';import { useParams } from 'react-router-dom';+import { MAX_CUSTOM_INDEXES_PER_OBJECT } from 'twenty-shared/constants';import { AppPath, RelationType, SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';-import { Callout } from 'twenty-ui/primitives/feedback';import { IconAlertTriangle } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';+import { Callout, useToast } from 'twenty-ui/primitives/feedback';import { Section } from 'twenty-ui/primitives/layout';+import { H2Title } from 'twenty-ui/primitives/typography';import { IndexType } from '~/generated-metadata/graphql';import { useNavigateApp } from '~/hooks/useNavigateApp';import { useNavigateSettings } from '~/hooks/useNavigateSettings';-import { MAX_CUSTOM_INDEXES_PER_OBJECT } from 'twenty-shared/constants';import {settingsObjectNewIndexFormSchema,type SettingsObjectNewIndexFormValues,@@ -55,7 +54,7 @@ export const SettingsObjectNewIndex = () => {const navigate = useNavigateSettings();const workspaceSurface = useWorkspaceSurface();const { objectNamePlural = '' } = useParams();- const { enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { findObjectMetadataItemByNamePlural } =useFilteredObjectMetadataItems();@@ -117,7 +116,7 @@ export const SettingsObjectNewIndex = () => {});if (result.status === 'successful') {- enqueueSuccessSnackBar({ message: t`Index created` });+ enqueueToast({ variant: 'success', children: t`Index created` });navigate(SettingsPath.ObjectDetail, { objectNamePlural });}};diff --git a/packages/twenty-front/src/pages/settings/developers/api-keys/SettingsDevelopersApiKeyDetail.tsx b/packages/twenty-front/src/pages/settings/developers/api-keys/SettingsDevelopersApiKeyDetail.tsxindex 7315025f6c9..c35965ec533 100644--- a/packages/twenty-front/src/pages/settings/developers/api-keys/SettingsDevelopersApiKeyDetail.tsx+++ b/packages/twenty-front/src/pages/settings/developers/api-keys/SettingsDevelopersApiKeyDetail.tsx@@ -1,32 +1,30 @@-import { styled } from '@linaria/react';-import { isNonEmptyString } from '@sniptt/guards';-import { useStore } from 'jotai';-import { useCallback, useEffect, useState } from 'react';-import { useParams } from 'react-router-dom';-import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';import { SettingsSkeletonLoader } from '@/settings/components/SettingsSkeletonLoader';+import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { ApiKeyInput } from '@/settings/developers/components/ApiKeyInput';import { ApiKeyNameInput } from '@/settings/developers/components/ApiKeyNameInput';import { SettingsDevelopersRoleSelector } from '@/settings/developers/components/SettingsDevelopersRoleSelector';import { apiKeyTokenFamilyState } from '@/settings/developers/states/apiKeyTokenFamilyState';-import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';import { computeNewExpirationDate } from '@/settings/developers/utils/computeNewExpirationDate';import { formatExpiration } from '@/settings/developers/utils/formatExpiration';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';-import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';+import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';+import { useMutation, useQuery } from '@apollo/client/react';+import { styled } from '@linaria/react';import { Trans, useLingui } from '@lingui/react/macro';+import { isNonEmptyString } from '@sniptt/guards';+import { useStore } from 'jotai';+import { useCallback, useEffect, useState } from 'react';+import { useParams } from 'react-router-dom';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';import { IconRepeat, IconTrash } from 'twenty-ui/icon';-import { H2Title } from 'twenty-ui/primitives/typography';import { Button } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';+import { H2Title } from 'twenty-ui/primitives/typography';import { themeCssVariables } from 'twenty-ui/theme-constants';-import { useMutation, useQuery } from '@apollo/client/react';import {AssignRoleToApiKeyDocument,CreateApiKeyDocument,@@ -38,6 +36,8 @@ import {import { useNavigateSettings } from '~/hooks/useNavigateSettings';import { SETTINGS_API_WEBHOOKS_TABS } from '~/pages/settings/api-webhooks/constants/SettingsApiWebhooksTabs';+import { useToast } from 'twenty-ui/primitives/feedback';+const StyledInfo = styled.span`color: ${themeCssVariables.font.color.light};font-size: ${themeCssVariables.font.size.sm};@@ -57,7 +57,7 @@ const REGENERATE_API_KEY_MODAL_ID = 'regenerate-api-key-modal';export const SettingsDevelopersApiKeyDetail = () => {const { t } = useLingui();- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { openModal } = useModal();const [isLoading, setIsLoading] = useState(false);@@ -123,14 +123,13 @@ export const SettingsDevelopersApiKeyDetail = () => {roleId,},});- enqueueSuccessSnackBar({- message: t`Role updated successfully`,+ enqueueToast({+ variant: 'success',+ children: t`Role updated successfully`,});setSelectedRoleId(roleId);} catch {- enqueueErrorSnackBar({- message: t`Error updating role`,- });+ enqueueToast({ variant: 'error', children: t`Error updating role` });} finally {setIsLoading(false);}@@ -157,7 +156,7 @@ export const SettingsDevelopersApiKeyDetail = () => {);}} catch {- enqueueErrorSnackBar({ message: t`Error deleting api key.` });+ enqueueToast({ variant: 'error', children: t`Error deleting api key.` });} finally {setIsLoading(false);}@@ -170,8 +169,9 @@ export const SettingsDevelopersApiKeyDetail = () => {const roleIdToUse = selectedRoleId;if (!roleIdToUse) {- enqueueErrorSnackBar({- message: t`A role must be selected for the API key`,+ enqueueToast({+ variant: 'error',+ children: t`A role must be selected for the API key`,});return;}@@ -213,8 +213,9 @@ export const SettingsDevelopersApiKeyDetail = () => {try {if (isDefined(apiKey)) {if (!isNonEmptyString(apiKeyName)) {- enqueueErrorSnackBar({- message: t`API key name cannot be empty`,+ enqueueToast({+ variant: 'error',+ children: t`API key name cannot be empty`,});return;}@@ -233,8 +234,9 @@ export const SettingsDevelopersApiKeyDetail = () => {}}} catch {- enqueueErrorSnackBar({- message: t`Error regenerating api key.`,+ enqueueToast({+ variant: 'error',+ children: t`Error regenerating api key.`,});} finally {setIsLoading(false);diff --git a/packages/twenty-front/src/pages/settings/enterprise/SettingsEnterprise.tsx b/packages/twenty-front/src/pages/settings/enterprise/SettingsEnterprise.tsxindex e239df049a5..8f650305e51 100644--- a/packages/twenty-front/src/pages/settings/enterprise/SettingsEnterprise.tsx+++ b/packages/twenty-front/src/pages/settings/enterprise/SettingsEnterprise.tsx@@ -2,6 +2,7 @@ import { Trans, useLingui } from '@lingui/react/macro';import { useCallback, useEffect, useState } from 'react';import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';import { GET_DATABASE_CONFIG_VARIABLE } from '@/settings/admin-panel/config-variables/graphql/queries/getDatabaseConfigVariable';import { useConfigVariableActions } from '@/settings/admin-panel/config-variables/hooks/useConfigVariableActions';@@ -18,7 +19,6 @@ import { RELEASE_ENTERPRISE_SERVER_BINDING } from '@/settings/enterprise/graphqlimport { SET_ENTERPRISE_KEY } from '@/settings/enterprise/graphql/mutations/setOrganizationKey';import { ENTERPRISE_PORTAL_SESSION } from '@/settings/enterprise/graphql/queries/enterprisePortalSession';import { ENTERPRISE_SUBSCRIPTION_STATUS } from '@/settings/enterprise/graphql/queries/enterpriseSubscriptionStatus';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';@@ -32,6 +32,7 @@ import {} from 'twenty-shared/constants';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import {IconCalendarRepeat,IconCheck,@@ -142,7 +143,7 @@ export const SettingsEnterprise = ({const [isReleasing, setIsReleasing] = useState(false);const [isBoundToAnotherServer, setIsBoundToAnotherServer] = useState(false);const { openModal } = useModal();- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { loadCurrentUser } = useLoadCurrentUser();const apolloAdminClient = useApolloAdminClient();@@ -275,8 +276,9 @@ export const SettingsEnterprise = ({});if (result.data?.setEnterpriseKey.isValid === true) {- enqueueSuccessSnackBar({- message: t`Organization license activated successfully`,+ enqueueToast({+ variant: 'success',+ children: t`Organization license activated successfully`,});setEnterpriseKey('');const { data: statusData } = await fetchSubscriptionStatus();@@ -284,8 +286,9 @@ export const SettingsEnterprise = ({setSubscriptionStatus(statusData?.enterpriseSubscriptionStatus ?? null);await loadCurrentUser();} else {- enqueueErrorSnackBar({- message: t`Failed to activate Organization license. Please check your key or contact support.`,+ enqueueToast({+ variant: 'error',+ children: t`Failed to activate Organization license. Please check your key or contact support.`,});}} catch (error) {@@ -303,20 +306,15 @@ export const SettingsEnterprise = ({isGraphqlErrorOfType(error, 'ENTERPRISE_KEY_BOUND_TO_ANOTHER_SERVER'),);await loadCurrentUser();- enqueueErrorSnackBar({- apolloError: error,- options: { duration: 10000 },- });+ enqueueToast(getToastOptionsFromError({ error, duration: 10000 }));} else if (isGraphqlErrorOfType(error, 'CONFIG_VARIABLES_IN_DB_DISABLED')) {- enqueueErrorSnackBar({- apolloError: error,- options: { duration: 10000 },- });+ enqueueToast(getToastOptionsFromError({ error, duration: 10000 }));} else {- enqueueErrorSnackBar({- message: t`Error activating Organization license`,+ enqueueToast({+ variant: 'error',+ children: t`Error activating Organization license`,});}} finally {@@ -325,8 +323,7 @@ export const SettingsEnterprise = ({}, [enterpriseKey,setEnterpriseKeyMutation,- enqueueErrorSnackBar,- enqueueSuccessSnackBar,+ enqueueToast,fetchSubscriptionStatus,loadCurrentUser,t,@@ -347,16 +344,18 @@ export const SettingsEnterprise = ({if (portalUrl !== null && portalUrl !== undefined) {window.open(portalUrl, '_blank', 'noopener');} else {- enqueueErrorSnackBar({- message: t`Could not open billing portal. Please check your Organization key is present, or contact support.`,+ enqueueToast({+ variant: 'error',+ children: t`Could not open billing portal. Please check your Organization key is present, or contact support.`,});}} catch {- enqueueErrorSnackBar({- message: t`Error opening billing portal`,+ enqueueToast({+ variant: 'error',+ children: t`Error opening billing portal`,});}- }, [fetchPortalSession, enqueueErrorSnackBar, t, returnUrlPath]);+ }, [fetchPortalSession, enqueueToast, t, returnUrlPath]);const openCheckoutModal = useCallback(() => {openModal(ENTERPRISE_PLAN_MODAL_ID);@@ -370,13 +369,15 @@ export const SettingsEnterprise = ({if (data?.refreshEnterpriseValidityToken === true) {setIsBoundToAnotherServer(false);- enqueueSuccessSnackBar({- message: t`Validity token refreshed successfully`,+ enqueueToast({+ variant: 'success',+ children: t`Validity token refreshed successfully`,});await loadCurrentUser();} else {- enqueueErrorSnackBar({- message: t`Could not refresh validity token. Please contact support.`,+ enqueueToast({+ variant: 'error',+ children: t`Could not refresh validity token. Please contact support.`,});}} catch (error) {@@ -385,10 +386,7 @@ export const SettingsEnterprise = ({) {setIsBoundToAnotherServer(true);await loadCurrentUser();- enqueueErrorSnackBar({- apolloError: error,- options: { duration: 10000 },- });+ enqueueToast(getToastOptionsFromError({ error, duration: 10000 }));} else if (isGraphqlErrorOfType(error, 'ENTERPRISE_MISSING_SERVER_ID') ||isGraphqlErrorOfType(@@ -398,25 +396,17 @@ export const SettingsEnterprise = ({isGraphqlErrorOfType(error, 'ENTERPRISE_DEV_SLOT_IN_USE') ||isGraphqlErrorOfType(error, 'ENTERPRISE_VALIDITY_TOKEN_RATE_LIMITED')) {- enqueueErrorSnackBar({- apolloError: error,- options: { duration: 10000 },- });+ enqueueToast(getToastOptionsFromError({ error, duration: 10000 }));} else {- enqueueErrorSnackBar({- message: t`Error refreshing validity token. Please contact support.`,+ enqueueToast({+ variant: 'error',+ children: t`Error refreshing validity token. Please contact support.`,});}} finally {setIsRefreshingToken(false);}- }, [- refreshValidityTokenMutation,- enqueueSuccessSnackBar,- enqueueErrorSnackBar,- loadCurrentUser,- t,- ]);+ }, [refreshValidityTokenMutation, enqueueToast, loadCurrentUser, t]);const handleReleaseBinding = useCallback(async () => {setIsReleasing(true);@@ -426,26 +416,30 @@ export const SettingsEnterprise = ({if (result.data?.releaseEnterpriseServerBinding.isValid === true) {setIsBoundToAnotherServer(false);- enqueueSuccessSnackBar({- message: t`Organization key transferred to this server`,+ enqueueToast({+ variant: 'success',+ children: t`Organization key transferred to this server`,});const { data: statusData } = await fetchSubscriptionStatus();setSubscriptionStatus(statusData?.enterpriseSubscriptionStatus ?? null);await loadCurrentUser();} else {- enqueueErrorSnackBar({- message: t`Could not transfer the Organization key. Please contact support.`,+ enqueueToast({+ variant: 'error',+ children: t`Could not transfer the Organization key. Please contact support.`,});}} catch (error) {if (isGraphqlErrorOfType(error, 'ENTERPRISE_RELEASE_RATE_LIMITED')) {- enqueueErrorSnackBar({- message: t`You have reached the maximum number of server transfers allowed in the last 30 days for this Organization key. Please try again later or contact support.`,+ enqueueToast({+ variant: 'error',+ children: t`You have reached the maximum number of server transfers allowed in the last 30 days for this Organization key. Please try again later or contact support.`,});} else {- enqueueErrorSnackBar({- message: t`Error transferring the Organization key`,+ enqueueToast({+ variant: 'error',+ children: t`Error transferring the Organization key`,});}} finally {@@ -453,8 +447,7 @@ export const SettingsEnterprise = ({}}, [releaseServerBindingMutation,- enqueueSuccessSnackBar,- enqueueErrorSnackBar,+ enqueueToast,fetchSubscriptionStatus,loadCurrentUser,t,@@ -478,8 +471,9 @@ export const SettingsEnterprise = ({setIsInstanceTypeFromDb(true);await loadCurrentUser();- enqueueSuccessSnackBar({- message:+ enqueueToast({+ variant: 'success',+ children:nextInstanceType === ENTERPRISE_INSTANCE_TYPE.DEVELOPMENT? t`Registered as a development instance. This instance will not be billed.`: t`Switched to a production instance.`,@@ -489,8 +483,9 @@ export const SettingsEnterprise = ({tokenRefreshSuccess = true;} catch {if (!instanceUpdateSuccess) {- enqueueErrorSnackBar({- message: t`Could not update the instance type`,+ enqueueToast({+ variant: 'error',+ children: t`Could not update the instance type`,});}} finally {@@ -504,12 +499,14 @@ export const SettingsEnterprise = ({setInstanceType(previousInstanceType);setIsInstanceTypeFromDb(previousIsInstanceTypeFromDb);await loadCurrentUser();- enqueueErrorSnackBar({- message: t`Could not refresh validity token - reverted the instance type change.`,+ enqueueToast({+ variant: 'error',+ children: t`Could not refresh validity token - reverted the instance type change.`,});} catch {- enqueueErrorSnackBar({- message: t`Could not refresh validity token and could not revert the instance type change.`,+ enqueueToast({+ variant: 'error',+ children: t`Could not refresh validity token and could not revert the instance type change.`,});}}@@ -523,8 +520,7 @@ export const SettingsEnterprise = ({isInstanceTypeFromDb,refreshValidityTokenMutation,loadCurrentUser,- enqueueSuccessSnackBar,- enqueueErrorSnackBar,+ enqueueToast,t,],);diff --git a/packages/twenty-front/src/pages/settings/legal/SettingsLegalDpaNew.tsx b/packages/twenty-front/src/pages/settings/legal/SettingsLegalDpaNew.tsxindex f4d0ff2cf58..b16de242a70 100644--- a/packages/twenty-front/src/pages/settings/legal/SettingsLegalDpaNew.tsx+++ b/packages/twenty-front/src/pages/settings/legal/SettingsLegalDpaNew.tsx@@ -6,7 +6,12 @@ import { getSettingsPath } from 'twenty-shared/utils';import { Section } from 'twenty-ui/primitives/layout';import { H2Title } from 'twenty-ui/primitives/typography';+import { downloadFile } from '@/activities/files/utils/downloadFile';import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';+import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';+import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';+import { SettingsSkeletonLoader } from '@/settings/components/SettingsSkeletonLoader';+import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { DpaDocumentPreview } from '@/settings/legal/components/DpaDocumentPreview';import { DpaNotice } from '@/settings/legal/components/DpaNotice';import { GENERATE_SIGNED_DPA } from '@/settings/legal/graphql/mutations/generateSignedDpa';@@ -16,19 +21,14 @@ import {type DpaDocument,type GenerateSignedDpaResult,} from '@/settings/legal/types/Dpa';-import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';-import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';-import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';-import { SettingsSkeletonLoader } from '@/settings/components/SettingsSkeletonLoader';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { downloadFile } from '@/activities/files/utils/downloadFile';+import { useToast } from 'twenty-ui/primitives/feedback';import { useNavigateSettings } from '~/hooks/useNavigateSettings';export const SettingsLegalDpaNew = () => {const { t } = useLingui();const navigateSettings = useNavigateSettings();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();// DPA operations live on the core (/graphql) schema, not the default /metadata client.const apolloCoreClient = useApolloCoreClient();@@ -96,13 +96,15 @@ export const SettingsLegalDpaNew = () => {`Twenty-DPA-${result.agreement.templateVersion}-${safeLegalEntityName}.pdf`,);- enqueueSuccessSnackBar({- message: t`Signed DPA generated and downloaded`,+ enqueueToast({+ variant: 'success',+ children: t`Signed DPA generated and downloaded`,});navigateSettings(SettingsPath.LegalDpa);} catch {- enqueueErrorSnackBar({- message: t`Could not generate the signed DPA. Please try again.`,+ enqueueToast({+ variant: 'error',+ children: t`Could not generate the signed DPA. Please try again.`,});} finally {setIsGenerating(false);diff --git a/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMember.tsx b/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMember.tsxindex 98e68806377..d351d9eede0 100644--- a/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMember.tsx+++ b/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMember.tsx@@ -4,19 +4,19 @@ import { useDebouncedCallback } from 'use-debounce';import { useImpersonationSession } from '@/auth/hooks/useImpersonationSession';import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';+import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';+import { SettingsTabBar } from '@/settings/components/layout/SettingsTabBar';import { SettingsRolesQueryEffect } from '@/settings/roles/components/SettingsRolesQueryEffect';import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlag';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';-import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';-import { SettingsTabBar } from '@/settings/components/layout/SettingsTabBar';import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { t } from '@lingui/core/macro';import { CoreObjectNameSingular, SettingsPath } from 'twenty-shared/types';import { getSettingsPath, isDefined } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { IconInfoCircle, IconLock } from 'twenty-ui/icon';import { useNavigateSettings } from '~/hooks/useNavigateSettings';@@ -48,7 +48,7 @@ const DELETE_MEMBER_MODAL_ID = 'workspace-member-delete-modal';export const SettingsWorkspaceMember = () => {const { workspaceMemberId = '' } = useParams();const navigateSettings = useNavigateSettings();- const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { openModal, closeModal } = useModal();const currentUser = useAtomStateValue(currentUserState);const currentWorkspace = useAtomStateValue(currentWorkspaceState);@@ -106,8 +106,9 @@ export const SettingsWorkspaceMember = () => {},});} catch (error) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:error instanceof Error? error.message: t`Error while saving the name`,@@ -123,12 +124,16 @@ export const SettingsWorkspaceMember = () => {await deleteUserFromWorkspace({variables: { workspaceMemberIdToDelete: member.id },});- enqueueSuccessSnackBar({ message: t`Member removed from workspace` });+ enqueueToast({+ variant: 'success',+ children: t`Member removed from workspace`,+ });closeModal(DELETE_MEMBER_MODAL_ID);navigateSettings(SettingsPath.WorkspaceMembersPage);} catch (error) {- enqueueErrorSnackBar({- message:+ enqueueToast({+ variant: 'error',+ children:error instanceof Error? error.message: t`Unable to delete member right now`,@@ -138,17 +143,19 @@ export const SettingsWorkspaceMember = () => {const handleImpersonate = async () => {if (!member?.userId || !currentWorkspace?.id) {- enqueueErrorSnackBar({- message: t`Cannot impersonate selected user`,- options: { duration: 2000 },+ enqueueToast({+ variant: 'error',+ children: t`Cannot impersonate selected user`,+ duration: 2000,});return;}if (!isDefined(currentUser?.id) || member.userId === currentUser.id) {- enqueueErrorSnackBar({- message: t`You cannot impersonate your own account`,- options: { duration: 2000 },+ enqueueToast({+ variant: 'error',+ children: t`You cannot impersonate your own account`,+ duration: 2000,});return;@@ -165,9 +172,10 @@ export const SettingsWorkspaceMember = () => {await startImpersonating(loginToken.token);},onError: () => {- enqueueErrorSnackBar({- message: t`Cannot impersonate selected user`,- options: { duration: 2000 },+ enqueueToast({+ variant: 'error',+ children: t`Cannot impersonate selected user`,+ duration: 2000,});},});diff --git a/packages/twenty-front/src/pages/settings/members/tabs/SettingsWorkspaceMembersInviteTab.tsx b/packages/twenty-front/src/pages/settings/members/tabs/SettingsWorkspaceMembersInviteTab.tsxindex 3cc17bb25f8..f77bbb68a46 100644--- a/packages/twenty-front/src/pages/settings/members/tabs/SettingsWorkspaceMembersInviteTab.tsx+++ b/packages/twenty-front/src/pages/settings/members/tabs/SettingsWorkspaceMembersInviteTab.tsx@@ -1,37 +1,36 @@-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { styled } from '@linaria/react';-import { Trans, useLingui } from '@lingui/react/macro';-import { useQuery } from '@apollo/client/react';-import { isNonEmptyArray } from '@sniptt/guards';-import { formatDistanceToNow } from 'date-fns';-import { useContext, useMemo } from 'react';--import { SettingsRolesQueryEffect } from '@/settings/roles/components/SettingsRolesQueryEffect';--import { useSnackBarOnQueryError } from '@/apollo/hooks/useSnackBarOnQueryError';+import { ToastOnQueryErrorEffect } from '@/apollo/components/ToastOnQueryErrorEffect';import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';+import { SettingsRolesQueryEffect } from '@/settings/roles/components/SettingsRolesQueryEffect';import { useSettingsAllRoles } from '@/settings/roles/hooks/useSettingsAllRoles';import { SettingsApprovedAccessDomainsListCard } from '@/settings/security/components/approvedAccessDomains/SettingsApprovedAccessDomainsListCard';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';import { Table } from '@/ui/layout/table/components/Table';import { TableCell } from '@/ui/layout/table/components/TableCell';import { TableHeader } from '@/ui/layout/table/components/TableHeader';import { TableRow } from '@/ui/layout/table/components/TableRow';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useDeleteWorkspaceInvitation } from '@/workspace-invitation/hooks/useDeleteWorkspaceInvitation';import { useResendWorkspaceInvitation } from '@/workspace-invitation/hooks/useResendWorkspaceInvitation';import { WorkspaceInviteLink } from '@/workspace/components/WorkspaceInviteLink';import { WorkspaceInviteTeam } from '@/workspace/components/WorkspaceInviteTeam';+import { useQuery } from '@apollo/client/react';+import { styled } from '@linaria/react';+import { Trans, useLingui } from '@lingui/react/macro';+import { isNonEmptyArray } from '@sniptt/guards';+import { formatDistanceToNow } from 'date-fns';+import { useContext, useMemo } from 'react';import { isDefined } from 'twenty-shared/utils';-import { Status } from 'twenty-ui/primitives/data-display';import { IconMail, IconReload, IconTrash } from 'twenty-ui/icon';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';-import { H2Title } from 'twenty-ui/primitives/typography';+import { Status } from 'twenty-ui/primitives/data-display';import { IconButton } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';+import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { H2Title } from 'twenty-ui/primitives/typography';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import { GetWorkspaceInvitationsDocument } from '~/generated-metadata/graphql';import { dateLocaleState } from '~/localization/states/dateLocaleState';+import { useToast } from 'twenty-ui/primitives/feedback';+const StyledButtonContainer = styled.div`align-items: center;display: flex;@@ -71,7 +70,7 @@ const StyledTableRows = styled.div`export const SettingsWorkspaceMembersInviteTab = () => {const { theme } = useContext(ThemeContext);const { t } = useLingui();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const roles = useSettingsAllRoles();const { localeCatalog } = useAtomStateValue(dateLocaleState);@@ -89,18 +88,15 @@ export const SettingsWorkspaceMembersInviteTab = () => {GetWorkspaceInvitationsDocument,);- useSnackBarOnQueryError(invitationsError);-const workspaceInvitations = invitationsData?.findWorkspaceInvitations ?? [];const handleRemoveWorkspaceInvitation = async (appTokenId: string) => {const result = await deleteWorkspaceInvitation({ appTokenId });if (isDefined(result.error)) {- enqueueErrorSnackBar({- message: t`Error deleting invitation`,- options: {- duration: 2000,- },+ enqueueToast({+ variant: 'error',+ children: t`Error deleting invitation`,+ duration: 2000,});}};@@ -108,11 +104,10 @@ export const SettingsWorkspaceMembersInviteTab = () => {const handleResendWorkspaceInvitation = async (appTokenId: string) => {const result = await resendInvitation({ appTokenId });if (isDefined(result.error)) {- enqueueErrorSnackBar({- message: t`Error resending invitation`,- options: {- duration: 2000,- },+ enqueueToast({+ variant: 'error',+ children: t`Error resending invitation`,+ duration: 2000,});}};@@ -125,6 +120,8 @@ export const SettingsWorkspaceMembersInviteTab = () => {return (<>+ <ToastOnQueryErrorEffect error={invitationsError} />+<SettingsRolesQueryEffect />{currentWorkspace?.inviteHash &¤tWorkspace?.isPublicInviteLinkEnabled && (diff --git a/packages/twenty-front/src/pages/settings/security/SettingsSecurityApprovedAccessDomain.tsx b/packages/twenty-front/src/pages/settings/security/SettingsSecurityApprovedAccessDomain.tsxindex 9ef0d408a19..97ee4867ee5 100644--- a/packages/twenty-front/src/pages/settings/security/SettingsSecurityApprovedAccessDomain.tsx+++ b/packages/twenty-front/src/pages/settings/security/SettingsSecurityApprovedAccessDomain.tsx@@ -1,18 +1,18 @@+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';-import { CombinedGraphQLErrors } from '@apollo/client/errors';+import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';+import { useMutation } from '@apollo/client/react';import { zodResolver } from '@hookform/resolvers/zod';import { Trans, useLingui } from '@lingui/react/macro';import { Controller, useForm } from 'react-hook-form';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath } from 'twenty-shared/utils';-import { H2Title } from 'twenty-ui/primitives/typography';+import { useToast } from 'twenty-ui/primitives/feedback';import { Section } from 'twenty-ui/primitives/layout';+import { H2Title } from 'twenty-ui/primitives/typography';import { z } from 'zod';-import { useMutation } from '@apollo/client/react';import { CreateApprovedAccessDomainDocument } from '~/generated-metadata/graphql';import { useNavigateSettings } from '~/hooks/useNavigateSettings';@@ -21,7 +21,7 @@ export const SettingsSecurityApprovedAccessDomain = () => {const { t } = useLingui();- const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const [createApprovedAccessDomain] = useMutation(CreateApprovedAccessDomainDocument,@@ -63,21 +63,18 @@ export const SettingsSecurityApprovedAccessDomain = () => {},},onCompleted: () => {- enqueueSuccessSnackBar({- message: t`Please check your email for a verification link.`,+ enqueueToast({+ variant: 'success',+ children: t`Please check your email for a verification link.`,});navigate(SettingsPath.WorkspaceMembersPage);},onError: (error) => {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));},});} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));}};diff --git a/packages/twenty-front/src/pages/settings/security/SettingsSecuritySsoIdentifyProvider.tsx b/packages/twenty-front/src/pages/settings/security/SettingsSecuritySsoIdentifyProvider.tsxindex e0aa2c20ea9..fd0969d61e7 100644--- a/packages/twenty-front/src/pages/settings/security/SettingsSecuritySsoIdentifyProvider.tsx+++ b/packages/twenty-front/src/pages/settings/security/SettingsSecuritySsoIdentifyProvider.tsx@@ -1,26 +1,26 @@/* @license Enterprise */+import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';+import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import SettingsSsoIdentitiesProvidersForm from '@/settings/security/components/sso/SettingsSsoIdentitiesProvidersForm';import { useCreateSsoIdentityProvider } from '@/settings/security/hooks/useCreateSsoIdentityProvider';import { type SettingSecurityNewSsoIdentityFormValues } from '@/settings/security/types/SsoIdentityProvider';import { ssoIdentityProviderDefaultValues } from '@/settings/security/utils/ssoIdentityProviderDefaultValues';import { ssoIdentitiesProvidersParamsSchema } from '@/settings/security/validation-schemas/ssoIdentityProviderSchema';-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';-import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';-import { CombinedGraphQLErrors } from '@apollo/client/errors';import { zodResolver } from '@hookform/resolvers/zod';import { t } from '@lingui/core/macro';import { Trans } from '@lingui/react/macro';import { FormProvider, useForm } from 'react-hook-form';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath } from 'twenty-shared/utils';+import { useToast } from 'twenty-ui/primitives/feedback';import { useNavigateSettings } from '~/hooks/useNavigateSettings';export const SettingsSecuritySsoIdentifyProvider = () => {const navigate = useNavigateSettings();- const { enqueueErrorSnackBar } = useSnackBar();+ const { enqueueToast } = useToast();const { createSsoIdentityProvider } = useCreateSsoIdentityProvider();const form = useForm<SettingSecurityNewSsoIdentityFormValues>({@@ -51,9 +51,7 @@ export const SettingsSecuritySsoIdentifyProvider = () => {navigate(SettingsPath.Security);} catch (error) {- enqueueErrorSnackBar({- apolloError: CombinedGraphQLErrors.is(error) ? error : undefined,- });+ enqueueToast(getToastOptionsFromError({ error }));}};diff --git a/packages/twenty-front/src/testing/decorators/PageDecorator.tsx b/packages/twenty-front/src/testing/decorators/PageDecorator.tsxindex c7e17a6ef88..8f8a9914283 100644--- a/packages/twenty-front/src/testing/decorators/PageDecorator.tsx+++ b/packages/twenty-front/src/testing/decorators/PageDecorator.tsx@@ -24,7 +24,7 @@ import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainCoimport { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext';import { PreComputedChipGeneratorsProvider } from '@/object-metadata/components/PreComputedChipGeneratorsProvider';import { RecordComponentInstanceContextsWrapper } from '@/object-record/components/RecordComponentInstanceContextsWrapper';-import { SnackBarComponentInstanceContext } from '@/ui/feedback/snack-bar-manager/contexts/SnackBarComponentInstanceContext';+import { ToastProvider } from 'twenty-ui/primitives/feedback';import { WorkspaceProviderEffect } from '@/workspace/components/WorkspaceProviderEffect';import { i18n } from '@lingui/core';import { I18nProvider } from '@lingui/react';@@ -83,9 +83,7 @@ const Providers = () => {return (<JotaiProvider store={store}>- <SnackBarComponentInstanceContext.Provider- value={{ instanceId: 'snack-bar-manager' }}- >+ <ToastProvider><ApolloProvider client={mockedApolloClient}><I18nProvider i18n={i18n}><ApolloStorybookDevLogEffect />@@ -117,7 +115,7 @@ const Providers = () => {</ClientConfigProvider></I18nProvider></ApolloProvider>- </SnackBarComponentInstanceContext.Provider>+ </ToastProvider></JotaiProvider>);};diff --git a/packages/twenty-front/src/testing/decorators/SnackBarDecorator.tsx b/packages/twenty-front/src/testing/decorators/SnackBarDecorator.tsxdeleted file mode 100644index 2a9cbc3198b..00000000000--- a/packages/twenty-front/src/testing/decorators/SnackBarDecorator.tsx+++ /dev/null@@ -1,10 +0,0 @@-import { SnackBarComponentInstanceContext } from '@/ui/feedback/snack-bar-manager/contexts/SnackBarComponentInstanceContext';-import { type Decorator } from '@storybook/react-vite';--export const SnackBarDecorator: Decorator = (Story) => (- <SnackBarComponentInstanceContext.Provider- value={{ instanceId: 'snack-bar-manager' }}- >- <Story />- </SnackBarComponentInstanceContext.Provider>-);diff --git a/packages/twenty-front/src/testing/decorators/ToastDecorator.tsx b/packages/twenty-front/src/testing/decorators/ToastDecorator.tsxnew file mode 100644index 00000000000..456e6644798--- /dev/null+++ b/packages/twenty-front/src/testing/decorators/ToastDecorator.tsx@@ -0,0 +1,8 @@+import { type Decorator } from '@storybook/react-vite';+import { ToastProvider } from 'twenty-ui/primitives/feedback';++export const ToastDecorator: Decorator = (Story) => (+ <ToastProvider>+ <Story />+ </ToastProvider>+);diff --git a/packages/twenty-front/src/testing/jest/getJestMetadataAndApolloMocksWrapper.tsx b/packages/twenty-front/src/testing/jest/getJestMetadataAndApolloMocksWrapper.tsxindex 547f2c8ccdf..7dac98f795a 100644--- a/packages/twenty-front/src/testing/jest/getJestMetadataAndApolloMocksWrapper.tsx+++ b/packages/twenty-front/src/testing/jest/getJestMetadataAndApolloMocksWrapper.tsx@@ -7,7 +7,7 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/conimport { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';import { RecordComponentInstanceContextsWrapper } from '@/object-record/components/RecordComponentInstanceContextsWrapper';-import { SnackBarComponentInstanceContext } from '@/ui/feedback/snack-bar-manager/contexts/SnackBarComponentInstanceContext';+import { ToastProvider } from 'twenty-ui/primitives/feedback';import {jotaiStore,resetJotaiStore,@@ -42,9 +42,7 @@ export const getJestMetadataAndApolloMocksWrapper = ({return (<JotaiProvider store={store}>- <SnackBarComponentInstanceContext.Provider- value={{ instanceId: 'snack-bar-manager' }}- >+ <ToastProvider><MockedProvider mocks={apolloMocks} cache={cache}><RecordComponentInstanceContextsWrapper componentInstanceId="instanceId"><ViewComponentInstanceContext.Provider@@ -62,7 +60,7 @@ export const getJestMetadataAndApolloMocksWrapper = ({</ViewComponentInstanceContext.Provider></RecordComponentInstanceContextsWrapper></MockedProvider>- </SnackBarComponentInstanceContext.Provider>+ </ToastProvider></JotaiProvider>);};diff --git a/packages/twenty-ui/.storybook/vitest.setup.ts b/packages/twenty-ui/.storybook/vitest.setup.tsindex 26d684b986e..91a5f5bed19 100644--- a/packages/twenty-ui/.storybook/vitest.setup.ts+++ b/packages/twenty-ui/.storybook/vitest.setup.ts@@ -1,14 +1,7 @@import * as a11yAddonAnnotations from '@storybook/addon-a11y/preview';import { setProjectAnnotations } from '@storybook/react-vite';-import { MotionGlobalConfig } from 'framer-motion';import * as projectAnnotations from './preview';-// Freeze framer-motion so Argos screenshots are deterministic. Playwright's-// `animations: "disabled"` only halts CSS animations/transitions, not-// framer-motion's main-thread (rAF) animations, so loaders/spinners were-// captured mid-frame and flagged as visual changes on every run.-MotionGlobalConfig.skipAnimations = true;-// Apply Storybook's preview configuration to Vitest runs.// The a11y addon annotations register the axe afterEach hook so that// parameters.a11y.test = 'error' (set in preview.tsx) actually gates tests.diff --git a/packages/twenty-ui/README.md b/packages/twenty-ui/README.mdindex a37f9826b13..12eccb7019a 100644--- a/packages/twenty-ui/README.md+++ b/packages/twenty-ui/README.md@@ -81,6 +81,14 @@ Component guides belong in `packages/twenty-docs/ui/primitives`. For each statefExplain state ownership before advanced behavior such as indeterminate selection or manual tab activation. Document independent states, such as selection and popup visibility, separately. For components that delegate state to a parent or group, explain that ownership and link to the relevant examples.+## Internal state++twenty-ui uses Base UI's store for notification state. Each `ToastProvider` creates its own store, and the toaster subscribes to the toast list. Queue rules and rendering remain owned by twenty-ui. Consumers use `useToast()` without configuring a state library.++The store factory and subscription hook are internal to the toast module. `@base-ui/utils` is a direct dependency pinned to the version used by `@base-ui/react`, and the library build keeps it external. Review its store API changes when upgrading the dependency.++## Testing+Component interaction and behavior tests belong in Storybook stories (`*.stories.tsx`) using `play` functions. Component unit tests are reserved for conformance (native props, refs, class names, rendering, and prop types). Keep non-interactive utility, hook, and token tests in the Vitest unit project; avoid duplicating story coverage there.```bashdiff --git a/packages/twenty-ui/package.json b/packages/twenty-ui/package.jsonindex b80c70076c4..4afcc5020ea 100644--- a/packages/twenty-ui/package.json+++ b/packages/twenty-ui/package.json@@ -70,6 +70,7 @@},"dependencies": {"@base-ui/react": "^1.8.0",+ "@base-ui/utils": "0.4.0","@monaco-editor/react": "^4.7.0","@sniptt/guards": "^0.2.0","@tabler/icons-react": "^3.31.0",diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/ToastProvider.tsx b/packages/twenty-ui/src/primitives/feedback/Toast/ToastProvider.tsxnew file mode 100644index 00000000000..c836f773606--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/ToastProvider.tsx@@ -0,0 +1,17 @@+import { useState } from 'react';++import { DEFAULT_TOAST_LIMIT } from './constants/DefaultToastLimit';+import { ToastContext } from './contexts/ToastContext';+import { createToastStore } from './stores/createToastStore';+import { type ToastProviderProps } from './types/ToastProviderProps';++export const ToastProvider = ({+ children,+ limit = DEFAULT_TOAST_LIMIT,+}: ToastProviderProps) => {+ const [store] = useState(() => createToastStore(limit));++ return (+ <ToastContext.Provider value={store}>{children}</ToastContext.Provider>+ );+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/__tests__/ToastProvider.test.tsx b/packages/twenty-ui/src/primitives/feedback/Toast/__tests__/ToastProvider.test.tsxnew file mode 100644index 00000000000..c4271cbae5d--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/__tests__/ToastProvider.test.tsx@@ -0,0 +1,73 @@+import { act, render, renderHook } from '@testing-library/react';+import { expect, it, vi } from 'vitest';++import { ToastContext } from '../contexts/ToastContext';+import { useToast } from '../hooks/useToast';+import { useToastEntries } from '../hooks/useToastEntries';+import { createToastStore } from '../stores/createToastStore';+import { ToastProvider } from '../ToastProvider';++it.each([0, -1, 1.5])('rejects an invalid toast limit of %s', (limit) => {+ expect(() => render(<ToastProvider limit={limit} />)).toThrow(+ 'Toast limit must be a positive integer.',+ );+});++it('isolates nested provider queues and deduplication', () => {+ const parentStore = createToastStore();+ parentStore.set('toasts', [+ {+ notification: { id: 'parent', children: 'Parent notification' },+ dedupeKey: 'saved',+ status: 'visible',+ },+ ]);+ const parentToasts = parentStore.state.toasts;+ const { result } = renderHook(+ () => ({ ...useToast(), toasts: useToastEntries() }),+ {+ wrapper: ({ children }) => (+ <ToastContext.Provider value={parentStore}>+ <ToastProvider>{children}</ToastProvider>+ </ToastContext.Provider>+ ),+ },+ );++ act(() => {+ result.current.enqueueToast({+ dedupeKey: 'saved',+ children: 'Child notification',+ });+ });++ expect(result.current.toasts).toHaveLength(1);+ expect(result.current.toasts[0].notification.children).toBe(+ 'Child notification',+ );++ act(() => result.current.closeToast());++ expect(result.current.toasts).toEqual([]);+ expect(parentStore.state.toasts).toBe(parentToasts);+});++it('deduplicates consecutive enqueues and applies the provider limit synchronously', () => {+ const { result } = renderHook(() => useToast(), {+ wrapper: ({ children }) => (+ <ToastProvider limit={1}>{children}</ToastProvider>+ ),+ });+ const onClose = vi.fn();+ const { enqueueToast, closeToast } = result.current;++ const firstId: string = enqueueToast({ dedupeKey: 'saved', onClose });+ expect(enqueueToast({ dedupeKey: 'saved' })).toBe(firstId);+ expect(enqueueToast(undefined)).toBeUndefined();+ expect(onClose).not.toHaveBeenCalled();++ enqueueToast({ children: 'Next notification' });+ expect(onClose).toHaveBeenCalledOnce();+ closeToast(firstId);+ expect(onClose).toHaveBeenCalledOnce();+});diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/constants/DefaultToastLimit.ts b/packages/twenty-ui/src/primitives/feedback/Toast/constants/DefaultToastLimit.tsnew file mode 100644index 00000000000..c762d49d954--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/constants/DefaultToastLimit.ts@@ -0,0 +1 @@+export const DEFAULT_TOAST_LIMIT = 3;diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/contexts/ToastContext.ts b/packages/twenty-ui/src/primitives/feedback/Toast/contexts/ToastContext.tsnew file mode 100644index 00000000000..416609535b2--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/contexts/ToastContext.ts@@ -0,0 +1,7 @@+import { createContext } from 'react';++import { type createToastStore } from '../stores/createToastStore';++export const ToastContext = createContext<+ ReturnType<typeof createToastStore> | undefined+>(undefined);diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/hooks/__tests__/useToast.test.tsx b/packages/twenty-ui/src/primitives/feedback/Toast/hooks/__tests__/useToast.test.tsxnew file mode 100644index 00000000000..bf646df1b74--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/hooks/__tests__/useToast.test.tsx@@ -0,0 +1,303 @@+import { render, renderHook } from '@testing-library/react';+import { StrictMode, useEffect } from 'react';+import { expect, it, vi } from 'vitest';++import { ToastContext } from '../../contexts/ToastContext';+import { ToasterLifecycleEffect } from '../../../Toaster/internal/ToasterLifecycleEffect';+import { createToastStore } from '../../stores/createToastStore';+import { completeToastExit } from '../../utils/completeToastExit';+import { useToast } from '../useToast';++const renderToastHooks = ({ hasToaster = true } = {}) => {+ const store = createToastStore();+ const hook = renderHook(() => useToast(), {+ wrapper: ({ children }) => (+ <ToastContext.Provider value={store}>+ {hasToaster && <ToasterLifecycleEffect />}+ {children}+ </ToastContext.Provider>+ ),+ });++ return { store, ...hook };+};++it('does not repeat an enqueue effect when its consumer rerenders', () => {+ const store = createToastStore();+ const { rerender } = renderHook(+ () => {+ const { enqueueToast } = useToast();++ useEffect(() => {+ enqueueToast({ children: 'Saved' });+ }, [enqueueToast]);+ },+ {+ wrapper: ({ children }) => (+ <ToastContext.Provider value={store}>{children}</ToastContext.Provider>+ ),+ },+ );++ rerender();++ expect(+ store.state.toasts.map(({ notification }) => notification.children),+ ).toEqual(['Saved']);+});++it('generates distinct ids for each new notification', () => {+ const { store, result } = renderToastHooks();++ const firstId = result.current.enqueueToast({+ children: 'First notification',+ });+ const secondId = result.current.enqueueToast({+ children: 'Second notification',+ });++ expect(firstId).toBeTruthy();+ expect(secondId).not.toBe(firstId);+ expect(store.state.toasts).toEqual([+ {+ notification: { id: firstId, children: 'First notification' },+ status: 'visible',+ },+ {+ notification: { id: secondId, children: 'Second notification' },+ status: 'visible',+ },+ ]);+});++it('ignores undefined options without publishing or evicting a toast', () => {+ const { store, result } = renderToastHooks();+ store.set('limit', 1);+ const listener = vi.fn();+ const onClose = vi.fn();+ store.subscribe(listener);+ result.current.enqueueToast({ children: 'Saved', onClose });+ const snapshot = store.state.toasts;+ listener.mockClear();++ expect(result.current.enqueueToast(undefined)).toBeUndefined();++ expect(store.state.toasts).toBe(snapshot);+ expect(listener).not.toHaveBeenCalled();+ expect(onClose).not.toHaveBeenCalled();+});++it('retains a dismissed toast until its exit finishes and calls onClose once', () => {+ const { store, result } = renderToastHooks();+ const listener = vi.fn();+ const onClose = vi.fn();+ store.subscribe(listener);+ const id = result.current.enqueueToast({ children: 'Saved', onClose });++ result.current.closeToast(id);+ const [closingToast] = store.state.toasts;+ expect(closingToast.status).toBe('closing');+ expect(onClose).toHaveBeenCalledOnce();++ result.current.closeToast(id);+ result.current.closeToast();+ expect(onClose).toHaveBeenCalledOnce();+ expect(listener).toHaveBeenCalledTimes(2);++ completeToastExit({ store, toast: closingToast });+ expect(store.state.toasts).toEqual([]);+ expect(onClose).toHaveBeenCalledOnce();+ expect(listener).toHaveBeenCalledTimes(3);+});++it('deduplicates visible notifications without updating their content', () => {+ const { store, result } = renderToastHooks();+ const listener = vi.fn();+ store.subscribe(listener);+ const id = result.current.enqueueToast({+ dedupeKey: 'record',+ children: 'Saved',+ });+ const snapshot = store.state.toasts;++ expect(+ result.current.enqueueToast({ dedupeKey: 'record', children: 'Changed' }),+ ).toBe(id);+ expect(store.state.toasts).toBe(snapshot);+ expect(listener).toHaveBeenCalledOnce();+});++it('counts only visible toasts toward the limit and evicts the oldest', () => {+ const { store, result } = renderToastHooks();+ store.set('limit', 2);+ const onFirstClose = vi.fn();+ const onSecondClose = vi.fn();+ const firstId = result.current.enqueueToast({+ children: 'First',+ onClose: onFirstClose,+ });+ result.current.enqueueToast({ children: 'Second', onClose: onSecondClose });+ result.current.closeToast(firstId);+ result.current.enqueueToast({ children: 'Third' });+ expect(onSecondClose).not.toHaveBeenCalled();++ result.current.enqueueToast({ children: 'Fourth' });+ expect(+ store.state.toasts.map(({ notification, status }) => [+ notification.children,+ status,+ ]),+ ).toEqual([+ ['First', 'closing'],+ ['Second', 'closing'],+ ['Third', 'visible'],+ ['Fourth', 'visible'],+ ]);+ expect(onFirstClose).toHaveBeenCalledOnce();+ expect(onSecondClose).toHaveBeenCalledOnce();+});++it('reopens a dismissed toast with a new id and completes each exit independently', () => {+ const { store, result } = renderToastHooks();+ const onClose = vi.fn();+ const firstId = result.current.enqueueToast({ dedupeKey: 'saved', onClose });+ const secondId = result.current.enqueueToast({ children: 'Second' });+ result.current.closeToast(firstId);+ const [firstExit] = store.state.toasts;++ const restoredId = result.current.enqueueToast({+ dedupeKey: 'saved',+ children: 'Restored',+ onClose,+ });+ const restoredToasts = store.state.toasts;+ expect(restoredToasts.map(({ notification }) => notification.id)).toEqual([+ firstId,+ secondId,+ restoredId,+ ]);+ expect(restoredId).not.toBe(firstId);+ result.current.closeToast(firstId);+ expect(store.state.toasts).toBe(restoredToasts);+ completeToastExit({ store, toast: firstExit });+ expect(store.state.toasts[1].notification.children).toBe('Restored');++ result.current.closeToast(restoredId);+ const snapshot = store.state.toasts;+ completeToastExit({ store, toast: firstExit });+ expect(store.state.toasts).toBe(snapshot);+ completeToastExit({ store, toast: snapshot[1] });+ expect(store.state.toasts.map(({ notification }) => notification.id)).toEqual(+ [secondId],+ );+ expect(onClose).toHaveBeenCalledTimes(2);+});++it('can restore a notification from its close callback', () => {+ const { store, result } = renderToastHooks();+ const onClose = vi.fn(() => {+ result.current.enqueueToast({ dedupeKey: 'saved', children: 'Restored' });+ });+ const firstId = result.current.enqueueToast({ dedupeKey: 'saved', onClose });++ result.current.closeToast();++ expect(store.state.toasts).toEqual([+ {+ notification: { id: firstId, onClose },+ dedupeKey: 'saved',+ status: 'closing',+ },+ {+ notification: { id: expect.any(String), children: 'Restored' },+ dedupeKey: 'saved',+ status: 'visible',+ },+ ]);+ expect(onClose).toHaveBeenCalledOnce();+});++it('preserves queue limits when an eviction callback enqueues a toast', () => {+ const { store, result } = renderToastHooks();+ store.set('limit', 1);+ const onFirstClose = vi.fn(() => {+ result.current.enqueueToast({ children: 'Third' });+ });+ const onSecondClose = vi.fn();+ result.current.enqueueToast({ children: 'First', onClose: onFirstClose });++ result.current.enqueueToast({ children: 'Second', onClose: onSecondClose });++ const toasts = store.state.toasts;++ expect(+ toasts.map(({ notification, status }) => ({+ children: notification.children,+ status,+ })),+ ).toEqual([+ { children: 'First', status: 'closing' },+ { children: 'Second', status: 'closing' },+ { children: 'Third', status: 'visible' },+ ]);+ expect(onFirstClose).toHaveBeenCalledOnce();+ expect(onSecondClose).toHaveBeenCalledOnce();+});++it('removes dismissed notifications immediately without a viewport even with queue subscribers', () => {+ const { store, result } = renderToastHooks({ hasToaster: false });+ store.subscribe(vi.fn());+ store.set('limit', 1);+ const onClose = vi.fn();+ result.current.enqueueToast({ children: 'First', onClose });+ const secondId = result.current.enqueueToast({ children: 'Second', onClose });+ expect(store.state.toasts.map(({ notification }) => notification.id)).toEqual(+ [secondId],+ );+ expect(onClose).toHaveBeenCalledOnce();++ result.current.closeToast();+ expect(store.state.toasts).toEqual([]);+ expect(onClose).toHaveBeenCalledTimes(2);+});++it('discards unfinished exits when the last viewport unmounts and keeps visible toasts', () => {+ const { store, result } = renderToastHooks({ hasToaster: false });+ const mountToaster = () =>+ render(+ <StrictMode>+ <ToastContext.Provider value={store}>+ <ToasterLifecycleEffect />+ </ToastContext.Provider>+ </StrictMode>,+ );+ const firstToaster = mountToaster();+ const secondToaster = mountToaster();+ const onClose = vi.fn();+ const firstId = result.current.enqueueToast({ children: 'First', onClose });+ result.current.enqueueToast({ children: 'Second' });+ result.current.closeToast(firstId);+ const closingSnapshot = store.state.toasts;++ firstToaster.unmount();+ expect(store.state.toasts).toBe(closingSnapshot);+ secondToaster.unmount();+ expect(store.state.toasts).toEqual([closingSnapshot[1]]);+ mountToaster();+ expect(store.state.toasts).toHaveLength(1);+ expect(onClose).toHaveBeenCalledOnce();+});++it('ignores unknown dismissals and completion for visible notifications', () => {+ const { store, result } = renderToastHooks();+ const listener = vi.fn();+ store.subscribe(listener);+ result.current.enqueueToast({ children: 'Saved' });+ const snapshot = store.state.toasts;++ result.current.closeToast('unknown');+ completeToastExit({ store, toast: snapshot[0] });++ expect(store.state.toasts).toBe(snapshot);+ expect(listener).toHaveBeenCalledOnce();+});diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/hooks/__tests__/useToastEntries.test.tsx b/packages/twenty-ui/src/primitives/feedback/Toast/hooks/__tests__/useToastEntries.test.tsxnew file mode 100644index 00000000000..4b8a97a403b--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/hooks/__tests__/useToastEntries.test.tsx@@ -0,0 +1,47 @@+import { act, renderHook } from '@testing-library/react';+import { type ReactNode } from 'react';+import { expect, it, vi } from 'vitest';++import { ToastContext } from '../../contexts/ToastContext';+import { createToastStore } from '../../stores/createToastStore';+import { useToast } from '../useToast';+import { useToastEntries } from '../useToastEntries';++it('rerenders only toast subscribers when the toast list changes', () => {+ const store = createToastStore();+ const wrapper = ({ children }: { children: ReactNode }) => (+ <ToastContext.Provider value={store}>{children}</ToastContext.Provider>+ );+ const renderActions = vi.fn();+ const renderEntries = vi.fn();+ const actions = renderHook(+ () => {+ renderActions();+ return useToast();+ },+ { wrapper },+ );+ const entries = renderHook(+ () => {+ renderEntries();+ return useToastEntries();+ },+ { wrapper },+ );+ const initialActionRenderCount = renderActions.mock.calls.length;+ const initialEntriesRenderCount = renderEntries.mock.calls.length;++ act(() => store.set('mountedToasterCount', 1));++ expect(renderEntries).toHaveBeenCalledTimes(initialEntriesRenderCount);++ act(() => {+ actions.result.current.enqueueToast({ children: 'Saved' });+ });++ expect(entries.result.current[0].notification.children).toBe('Saved');+ expect(renderEntries.mock.calls.length).toBeGreaterThan(+ initialEntriesRenderCount,+ );+ expect(renderActions).toHaveBeenCalledTimes(initialActionRenderCount);+});diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/hooks/useCloseToast.ts b/packages/twenty-ui/src/primitives/feedback/Toast/hooks/useCloseToast.tsnew file mode 100644index 00000000000..ef51ad8976d--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/hooks/useCloseToast.ts@@ -0,0 +1,27 @@+import { isNonEmptyArray } from '@sniptt/guards';++import { isDefined } from '@ui/utilities/utils/isDefined';++import { dismissToasts } from '../utils/dismissToasts';+import { isToastVisible } from '../utils/isToastVisible';+import { useToastContext } from './useToastContext';++export const useCloseToast = () => {+ const store = useToastContext();++ const closeToast = (id?: string) => {+ const toastsToClose = store.state.toasts.filter(+ (toast) =>+ isToastVisible(toast) &&+ (!isDefined(id) || toast.notification.id === id),+ );++ if (!isNonEmptyArray(toastsToClose)) {+ return;+ }++ dismissToasts({ store, toastsToClose });+ };++ return { closeToast };+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/hooks/useEnqueueToast.ts b/packages/twenty-ui/src/primitives/feedback/Toast/hooks/useEnqueueToast.tsnew file mode 100644index 00000000000..e4616eb011f--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/hooks/useEnqueueToast.ts@@ -0,0 +1,60 @@+import { useMemo } from 'react';++import { isDefined } from '@ui/utilities/utils/isDefined';++import { type ToastOptions } from '../types/ToastOptions';+import { dismissToasts } from '../utils/dismissToasts';+import { isToastVisible } from '../utils/isToastVisible';+import { useToastContext } from './useToastContext';++let lastToastId = 0;++export const useEnqueueToast = () => {+ const store = useToastContext();++ const enqueueToast = useMemo(() => {+ function enqueueToast(options: ToastOptions): string;+ function enqueueToast(+ options: ToastOptions | undefined,+ ): string | undefined;+ function enqueueToast(options: ToastOptions | undefined) {+ if (!isDefined(options)) {+ return;+ }++ const { dedupeKey, ...toastProps } = options;+ const { toasts, limit } = store.state;+ const visibleToasts = toasts.filter(isToastVisible);+ const existingToast = isDefined(dedupeKey)+ ? visibleToasts.find((toast) => toast.dedupeKey === dedupeKey)+ : undefined;++ if (isDefined(existingToast)) {+ return existingToast.notification.id;+ }++ lastToastId += 1;+ const id = `toast-${lastToastId}`;+ const removedCount = Math.max(0, visibleToasts.length - limit + 1);++ dismissToasts({+ store,+ toastsToClose: visibleToasts.slice(0, removedCount),+ nextToasts: [+ ...toasts,+ {+ notification: { ...toastProps, id },+ dedupeKey,+ status: 'visible',+ },+ ],+ });++ return id;+ }++ return enqueueToast;+ }, [store]);++ return { enqueueToast };+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/hooks/useToast.ts b/packages/twenty-ui/src/primitives/feedback/Toast/hooks/useToast.tsnew file mode 100644index 00000000000..c51f5c42237--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/hooks/useToast.ts@@ -0,0 +1,9 @@+import { useCloseToast } from './useCloseToast';+import { useEnqueueToast } from './useEnqueueToast';++export const useToast = () => {+ const { closeToast } = useCloseToast();+ const { enqueueToast } = useEnqueueToast();++ return { enqueueToast, closeToast };+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/hooks/useToastContext.ts b/packages/twenty-ui/src/primitives/feedback/Toast/hooks/useToastContext.tsnew file mode 100644index 00000000000..291db36f694--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/hooks/useToastContext.ts@@ -0,0 +1,15 @@+import { useContext } from 'react';++import { isDefined } from '@ui/utilities/utils/isDefined';++import { ToastContext } from '../contexts/ToastContext';++export const useToastContext = () => {+ const context = useContext(ToastContext);++ if (!isDefined(context)) {+ throw new Error('Toast components must be used within a ToastProvider.');+ }++ return context;+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/hooks/useToastEntries.ts b/packages/twenty-ui/src/primitives/feedback/Toast/hooks/useToastEntries.tsnew file mode 100644index 00000000000..5fb6e7ee250--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/hooks/useToastEntries.ts@@ -0,0 +1,9 @@+import { useStore } from '@base-ui/utils/store';++import { useToastContext } from './useToastContext';++export const useToastEntries = () => {+ const store = useToastContext();++ return useStore(store, (state) => state.toasts);+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/stores/createToastStore.ts b/packages/twenty-ui/src/primitives/feedback/Toast/stores/createToastStore.tsnew file mode 100644index 00000000000..cceeb08a8b6--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/stores/createToastStore.ts@@ -0,0 +1,17 @@+import { Store } from '@base-ui/utils/store';+import { isPositiveInteger } from '@sniptt/guards';++import { DEFAULT_TOAST_LIMIT } from '../constants/DefaultToastLimit';+import { type ToastStoreState } from '../types/ToastStoreState';++export const createToastStore = (limit = DEFAULT_TOAST_LIMIT) => {+ if (!isPositiveInteger(limit)) {+ throw new Error('Toast limit must be a positive integer.');+ }++ return new Store<ToastStoreState>({+ toasts: [],+ limit,+ mountedToasterCount: 0,+ });+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/types/ToastEntry.ts b/packages/twenty-ui/src/primitives/feedback/Toast/types/ToastEntry.tsnew file mode 100644index 00000000000..6a9cb5c1c0a--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/types/ToastEntry.ts@@ -0,0 +1,7 @@+import { type ToastNotification } from './ToastNotification';++export type ToastEntry = {+ notification: ToastNotification;+ dedupeKey?: string;+ status: 'visible' | 'closing';+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/types/ToastNotification.ts b/packages/twenty-ui/src/primitives/feedback/Toast/types/ToastNotification.tsnew file mode 100644index 00000000000..51f4d97070c--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/types/ToastNotification.ts@@ -0,0 +1,5 @@+import { type ToastOptions } from './ToastOptions';++export type ToastNotification = Omit<ToastOptions, 'dedupeKey'> & {+ id: string;+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/types/ToastOptions.ts b/packages/twenty-ui/src/primitives/feedback/Toast/types/ToastOptions.tsnew file mode 100644index 00000000000..702b506ebd2--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/types/ToastOptions.ts@@ -0,0 +1,5 @@+import { type ToastProps } from './ToastProps';++export type ToastOptions = Omit<ToastProps, 'ref' | 'id'> & {+ dedupeKey?: string;+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/types/ToastProviderProps.ts b/packages/twenty-ui/src/primitives/feedback/Toast/types/ToastProviderProps.tsnew file mode 100644index 00000000000..788a70da668--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/types/ToastProviderProps.ts@@ -0,0 +1,6 @@+import { type ReactNode } from 'react';++export type ToastProviderProps = {+ children?: ReactNode;+ limit?: number;+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/types/ToastStoreState.ts b/packages/twenty-ui/src/primitives/feedback/Toast/types/ToastStoreState.tsnew file mode 100644index 00000000000..20b3978859e--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/types/ToastStoreState.ts@@ -0,0 +1,7 @@+import { type ToastEntry } from './ToastEntry';++export type ToastStoreState = {+ toasts: ToastEntry[];+ limit: number;+ mountedToasterCount: number;+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/utils/completeToastExit.ts b/packages/twenty-ui/src/primitives/feedback/Toast/utils/completeToastExit.tsnew file mode 100644index 00000000000..3e6adeed0f6--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/utils/completeToastExit.ts@@ -0,0 +1,23 @@+import { type createToastStore } from '../stores/createToastStore';+import { type ToastEntry } from '../types/ToastEntry';++export const completeToastExit = ({+ store,+ toast,+}: {+ store: ReturnType<typeof createToastStore>;+ toast: ToastEntry;+}) => {+ const { toasts } = store.state;+ const isCurrentClosingToast =+ toast.status === 'closing' && toasts.includes(toast);++ if (!isCurrentClosingToast) {+ return;+ }++ store.set(+ 'toasts',+ toasts.filter((currentToast) => currentToast !== toast),+ );+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/utils/dismissToasts.ts b/packages/twenty-ui/src/primitives/feedback/Toast/utils/dismissToasts.tsnew file mode 100644index 00000000000..53cc23ec879--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/utils/dismissToasts.ts@@ -0,0 +1,29 @@+import { type createToastStore } from '../stores/createToastStore';+import { type ToastEntry } from '../types/ToastEntry';+import { isToastVisible } from './isToastVisible';++export const dismissToasts = ({+ store,+ toastsToClose,+ nextToasts = store.state.toasts,+}: {+ store: ReturnType<typeof createToastStore>;+ toastsToClose: ToastEntry[];+ nextToasts?: ToastEntry[];+}) => {+ const toasts = nextToasts.map(+ (toast): ToastEntry =>+ toastsToClose.includes(toast) ? { ...toast, status: 'closing' } : toast,+ );++ const isToasterMounted = store.state.mountedToasterCount > 0;++ store.set(+ 'toasts',+ isToasterMounted ? toasts : toasts.filter(isToastVisible),+ );++ for (const toast of toastsToClose) {+ toast.notification.onClose?.();+ }+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/utils/isToastVisible.ts b/packages/twenty-ui/src/primitives/feedback/Toast/utils/isToastVisible.tsnew file mode 100644index 00000000000..881c7282bd1--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toast/utils/isToastVisible.ts@@ -0,0 +1,3 @@+import { type ToastEntry } from '../types/ToastEntry';++export const isToastVisible = (toast: ToastEntry) => toast.status === 'visible';diff --git a/packages/twenty-ui/src/primitives/feedback/Toaster/Toaster.module.scss b/packages/twenty-ui/src/primitives/feedback/Toaster/Toaster.module.scssnew file mode 100644index 00000000000..85714ba40d8--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toaster/Toaster.module.scss@@ -0,0 +1,53 @@+.root {+ --toaster-offset: 40px;+ display: flex;+ flex-direction: column;+ inset-block-end: var(--t-spacing-3);+ inset-inline-end: var(--t-spacing-3);+ pointer-events: none;+ position: fixed;+ z-index: var(--t-last-layer-z-index);++ @include respond-to(mobile) {+ --toaster-offset: -40px;++ inset-block-end: auto;+ inset-block-start: 0;+ inset-inline: 0;+ }+}++.item {+ display: grid;+ grid-template-rows: 1fr;+ opacity: 1;+ pointer-events: auto;+ transform: translateY(0);+ transition:+ grid-template-rows 500ms ease-in-out,+ opacity 500ms ease-in-out,+ transform 500ms ease-in-out;++ @starting-style {+ grid-template-rows: 0fr;+ opacity: 0;+ transform: translateY(var(--toaster-offset));+ }++ &[data-exiting] {+ grid-template-rows: 0fr;+ opacity: 0;+ pointer-events: none;+ transform: translateY(var(--toaster-offset));+ }++ @media (prefers-reduced-motion: reduce) {+ transition: none;+ }+}++.itemContent {+ display: flex;+ flex-direction: column;+ min-block-size: 0;+}diff --git a/packages/twenty-ui/src/primitives/feedback/Toaster/Toaster.module.scss.d.ts b/packages/twenty-ui/src/primitives/feedback/Toaster/Toaster.module.scss.d.tsnew file mode 100644index 00000000000..e474bedf61c--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toaster/Toaster.module.scss.d.ts@@ -0,0 +1,6 @@+declare const classNames: {+ readonly root: 'root';+ readonly item: 'item';+ readonly itemContent: 'itemContent';+};+export default classNames;diff --git a/packages/twenty-ui/src/primitives/feedback/Toaster/Toaster.tsx b/packages/twenty-ui/src/primitives/feedback/Toaster/Toaster.tsxnew file mode 100644index 00000000000..b2e1c8cac44--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toaster/Toaster.tsx@@ -0,0 +1,49 @@+import { useRender } from '@base-ui/react/use-render';+import { useDirection } from '@base-ui/react/direction-provider';+import { clsx } from 'clsx';+import { createPortal } from 'react-dom';++import { useThemeContainer } from '@ui/theme-constants';+import { isDefined } from '@ui/utilities/utils/isDefined';++import { ToasterItems } from './internal/ToasterItems';+import { ToasterLifecycleEffect } from './internal/ToasterLifecycleEffect';+import styles from './Toaster.module.scss';+import { type ToasterProps } from './types/ToasterProps';++export const Toaster = ({+ container,+ getToastProps,+ className,+ render,+ ref,+ ...props+}: ToasterProps) => {+ const themeContainer = useThemeContainer();+ const direction = useDirection();+ const target =+ container === undefined+ ? (themeContainer ??+ (typeof document === 'undefined' ? null : document.body))+ : container;++ const element = useRender({+ render,+ ref,+ props: {+ role: 'region',+ dir: direction,+ 'aria-label': 'Notifications',+ ...props,+ className: clsx(styles.root, className),+ children: (+ <>+ <ToasterLifecycleEffect />+ <ToasterItems getToastProps={getToastProps} />+ </>+ ),+ },+ });++ return isDefined(target) ? createPortal(element, target) : null;+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toaster/__stories__/ToastControls.tsx b/packages/twenty-ui/src/primitives/feedback/Toaster/__stories__/ToastControls.tsxnew file mode 100644index 00000000000..fa2abd627a1--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toaster/__stories__/ToastControls.tsx@@ -0,0 +1,64 @@+import { useState } from 'react';++import { useToast } from '@ui/primitives/feedback/Toast/hooks/useToast';+import { type ToastOptions } from '@ui/primitives/feedback/Toast/types/ToastOptions';++type ToastControlsProps = {+ onClose?: () => void;+};++export const ToastControls = ({ onClose }: ToastControlsProps) => {+ const { enqueueToast, closeToast } = useToast();+ const [count, setCount] = useState(1);+ const [toastId, setToastId] = useState('');++ const enqueueExampleToast = (options: ToastOptions) => {+ const id = enqueueToast({+ progress: 100,+ ...options,+ onClose: options.onClose ?? onClose,+ });+ setToastId(id);+ };++ return (+ <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>+ <button+ type="button"+ onClick={() => {+ enqueueExampleToast({ children: `Notification ${count}` });+ setCount(count + 1);+ }}+ >+ Add notification+ </button>+ <button+ type="button"+ onClick={() =>+ enqueueExampleToast({ children: 'Already saved', dedupeKey: 'saved' })+ }+ >+ Add duplicate+ </button>+ <button+ type="button"+ onClick={() =>+ enqueueExampleToast({+ children: 'Timed notification',+ progress: undefined,+ duration: 800,+ })+ }+ >+ Add timed notification+ </button>+ <button type="button" onClick={() => closeToast(toastId)}>+ Close last notification+ </button>+ <button type="button" onClick={() => closeToast()}>+ Close all notifications+ </button>+ <span aria-label="Last notification ID">{toastId}</span>+ </div>+ );+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toaster/__stories__/Toaster.stories.tsx b/packages/twenty-ui/src/primitives/feedback/Toaster/__stories__/Toaster.stories.tsxnew file mode 100644index 00000000000..6f6380c98be--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toaster/__stories__/Toaster.stories.tsx@@ -0,0 +1,447 @@+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { StrictMode, useState } from 'react';+import { expect, fn, userEvent, waitFor, within } from 'storybook/test';++import { ToastProvider } from '@ui/primitives/feedback/Toast/ToastProvider';+import { ComponentDecorator } from '@ui/testing';+import { ThemeProvider } from '@ui/theme-constants/ThemeProvider';++import { Toaster } from '../Toaster';+import { ToastControls } from './ToastControls';+import { ToasterExample } from './ToasterExample';+import { type ToasterExampleProps } from './ToasterExampleProps';++const meta: Meta<typeof ToasterExample> = {+ title: 'UI/Feedback/Toaster',+ component: ToasterExample,+ args: { onClose: fn() },+};++export default meta;+type Story = StoryObj<typeof ToasterExample>;++const isMotionEnabled = () =>+ !window.matchMedia('(prefers-reduced-motion: reduce)').matches;++export const Default: Story = {+ decorators: [ComponentDecorator],+ parameters: { container: { width: 400, height: 200 } },+ play: async ({ canvasElement }) => {+ await userEvent.click(+ within(canvasElement).getByRole('button', {+ name: 'Add notification',+ }),+ );+ const body = within(canvasElement.ownerDocument.body);+ await waitFor(() => expect(body.getByRole('status')).toBeVisible());+ expect(body.getByRole('status')).toHaveTextContent('Notification 1');+ },+};++export const QueueOverflow: Story = {+ ...Default,+ play: async ({ canvasElement, args }) => {+ const add = within(canvasElement).getByRole('button', {+ name: 'Add notification',+ });+ const limit = args.limit ?? 3;+ for (let count = 0; count <= limit; count++) {+ await userEvent.click(add);+ }+ const body = within(canvasElement.ownerDocument.body);+ await waitFor(() =>+ expect(body.queryByText('Notification 1')).not.toBeInTheDocument(),+ );+ const region = body.getByRole('region', { name: 'Notifications' });+ await waitFor(() =>+ expect(region.getAnimations({ subtree: true })).toHaveLength(0),+ );+ expect(body.getAllByRole('status')).toHaveLength(limit);+ expect(body.getByText(`Notification ${limit + 1}`)).toBeVisible();+ expect(args.onClose).toHaveBeenCalledOnce();+ },+};++export const CustomLimit: Story = {+ ...QueueOverflow,+ args: { limit: 1 },+};++export const Deduplication: Story = {+ ...Default,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const add = canvas.getByRole('button', { name: 'Add duplicate' });+ await userEvent.click(add);+ const id = canvas.getByLabelText('Last notification ID').textContent;+ await userEvent.click(add);+ expect(canvas.getByLabelText('Last notification ID')).toHaveTextContent(+ id!,+ );+ const body = within(canvasElement.ownerDocument.body);+ expect(body.getAllByRole('status')).toHaveLength(1);+ await waitFor(() => expect(body.getByText('Already saved')).toBeVisible());+ },+};++export const Dismissal: Story = {+ ...Default,+ play: async ({ canvasElement, args }) => {+ const canvas = within(canvasElement);+ const body = within(canvasElement.ownerDocument.body);+ await userEvent.click(+ canvas.getByRole('button', { name: 'Add notification' }),+ );+ const toast = body.getByRole('status');+ const region = body.getByRole('region', { name: 'Notifications' });+ await waitFor(() =>+ expect(region.getAnimations({ subtree: true })).toHaveLength(0),+ );+ await userEvent.click(body.getByRole('button', { name: 'Close' }));+ if (isMotionEnabled()) {+ expect(toast).toBeInTheDocument();+ }+ expect(args.onClose).toHaveBeenCalledOnce();+ await waitFor(() => expect(toast).not.toBeInTheDocument());+ expect(args.onClose).toHaveBeenCalledOnce();+ await userEvent.click(+ canvas.getByRole('button', { name: 'Close last notification' }),+ );+ expect(args.onClose).toHaveBeenCalledOnce();+ },+};++export const CloseAll: Story = {+ ...Default,+ play: async ({ canvasElement, args }) => {+ const canvas = within(canvasElement);+ const add = canvas.getByRole('button', {+ name: 'Add notification',+ });+ await userEvent.click(add);+ await userEvent.click(add);+ await userEvent.click(+ canvas.getByRole('button', { name: 'Close all notifications' }),+ );+ await waitFor(() =>+ expect(+ within(canvasElement.ownerDocument.body).queryAllByRole('status'),+ ).toHaveLength(0),+ );+ expect(args.onClose).toHaveBeenCalledTimes(2);+ },+};++export const Countdown: Story = {+ ...Default,+ play: async ({ canvasElement, args }) => {+ await userEvent.click(+ within(canvasElement).getByRole('button', {+ name: 'Add timed notification',+ }),+ );+ await waitFor(() => expect(args.onClose).toHaveBeenCalledOnce(), {+ timeout: 3000,+ });+ await waitFor(() =>+ expect(+ within(canvasElement.ownerDocument.body).queryByRole('status'),+ ).not.toBeInTheDocument(),+ );+ },+};++export const StrictModeAddition: Story = {+ ...Default,+ render: (args) => (+ <StrictMode>+ <ToasterExample {...args} />+ </StrictMode>+ ),+};++const RemountingToaster = ({ onClose }: ToasterExampleProps) => {+ const [screen, setScreen] = useState('authentication');+ return (+ <ToastProvider>+ <ToastControls onClose={onClose} />+ <button type="button" onClick={() => setScreen('workspace')}>+ Enter workspace+ </button>+ <Toaster key={screen} aria-label={`${screen} notifications`} />+ </ToastProvider>+ );+};++export const RendererRemount: Story = {+ ...Default,+ render: (args) => <RemountingToaster {...args} />,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await userEvent.click(+ canvas.getByRole('button', { name: 'Add notification' }),+ );+ await userEvent.click(+ canvas.getByRole('button', { name: 'Enter workspace' }),+ );+ const body = within(canvasElement.ownerDocument.body);+ const region = body.getByRole('region', {+ name: 'workspace notifications',+ });+ await waitFor(() =>+ expect(within(region).getByText('Notification 1')).toBeVisible(),+ );+ expect(+ body.queryByRole('region', { name: 'authentication notifications' }),+ ).not.toBeInTheDocument();+ },+};++export const RendererRemountDuringExit: Story = {+ ...RendererRemount,+ play: async ({ canvasElement, args }) => {+ const canvas = within(canvasElement);+ const body = within(canvasElement.ownerDocument.body);+ const add = canvas.getByRole('button', { name: 'Add notification' });+ await userEvent.click(add);+ await userEvent.click(add);+ const region = body.getByRole('region', {+ name: 'authentication notifications',+ });+ await waitFor(() =>+ expect(region.getAnimations({ subtree: true })).toHaveLength(0),+ );+ await userEvent.click(+ within(region).getAllByRole('button', { name: 'Close' })[0],+ );+ await userEvent.click(+ canvas.getByRole('button', { name: 'Enter workspace' }),+ );++ const workspaceRegion = body.getByRole('region', {+ name: 'workspace notifications',+ });+ await waitFor(() => {+ expect(body.queryByText('Notification 1')).not.toBeInTheDocument();+ expect(within(workspaceRegion).getByText('Notification 2')).toBeVisible();+ });+ expect(args.onClose).toHaveBeenCalledOnce();+ },+};++const DeferredToaster = () => {+ const [container, setContainer] = useState<HTMLDivElement | null>(null);+ const [isAttached, setIsAttached] = useState(false);+ return (+ <ToastProvider>+ <ToastControls />+ <button type="button" onClick={() => setIsAttached(true)}>+ Attach viewport+ </button>+ {isAttached && <div ref={setContainer} data-testid="toast-container" />}+ <Toaster container={container} />+ </ToastProvider>+ );+};++export const DeferredContainer: Story = {+ ...Default,+ render: () => <DeferredToaster />,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await userEvent.click(+ canvas.getByRole('button', { name: 'Add notification' }),+ );+ expect(+ within(canvasElement.ownerDocument.body).queryByRole('region'),+ ).not.toBeInTheDocument();+ await userEvent.click(+ canvas.getByRole('button', { name: 'Attach viewport' }),+ );+ await waitFor(() =>+ expect(+ within(canvas.getByTestId('toast-container')).getByText(+ 'Notification 1',+ ),+ ).toBeVisible(),+ );+ },+};++export const DismissBeforeContainer: Story = {+ ...DeferredContainer,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const add = canvas.getByRole('button', { name: 'Add notification' });+ await userEvent.click(add);+ await userEvent.click(add);+ await userEvent.click(+ canvas.getByRole('button', { name: 'Close last notification' }),+ );+ await userEvent.click(+ canvas.getByRole('button', { name: 'Attach viewport' }),+ );++ const container = within(canvas.getByTestId('toast-container'));+ await waitFor(() => expect(container.getByRole('status')).toBeVisible());+ expect(container.getByRole('status')).toHaveTextContent('Notification 1');+ expect(container.queryByText('Notification 2')).not.toBeInTheDocument();+ },+};++export const ScopedTheme: Story = {+ ...Default,+ render: (args) => (+ <ThemeProvider colorScheme="dark" applyToRoot={false}>+ <ToasterExample {...args} />+ </ThemeProvider>+ ),+ play: async ({ canvasElement }) => {+ await userEvent.click(+ within(canvasElement).getByRole('button', {+ name: 'Add notification',+ }),+ );+ const toast = within(canvasElement.ownerDocument.body).getByRole('status');+ expect(toast.closest('.dark')).not.toBeNull();+ },+};++export const Dark: Story = {+ ...Default,+ globals: { colorScheme: 'dark' },+};++export const ProviderIsolation: Story = {+ ...Default,+ render: () => (+ <>+ <section aria-label="First source">+ <ToastProvider>+ <ToastControls />+ <Toaster aria-label="First notifications" style={{ bottom: 200 }} />+ </ToastProvider>+ </section>+ <section aria-label="Second source">+ <ToastProvider>+ <ToastControls />+ <Toaster aria-label="Second notifications" />+ </ToastProvider>+ </section>+ </>+ ),+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const first = within(canvas.getByRole('region', { name: 'First source' }));+ const second = within(+ canvas.getByRole('region', { name: 'Second source' }),+ );+ await userEvent.click(+ first.getByRole('button', { name: 'Add notification' }),+ );+ await userEvent.click(+ second.getByRole('button', { name: 'Add notification' }),+ );+ const body = within(canvasElement.ownerDocument.body);+ const firstToaster = within(+ body.getByRole('region', { name: 'First notifications' }),+ );+ const secondToaster = within(+ body.getByRole('region', { name: 'Second notifications' }),+ );+ await waitFor(() => {+ expect(firstToaster.getByRole('status')).toBeVisible();+ expect(secondToaster.getByRole('status')).toBeVisible();+ });+ await userEvent.click(+ first.getByRole('button', { name: 'Close all notifications' }),+ );+ await waitFor(() =>+ expect(firstToaster.queryByRole('status')).not.toBeInTheDocument(),+ );+ expect(secondToaster.getByRole('status')).toBeVisible();+ },+};++export const StackReflow: Story = {+ ...Default,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const body = within(canvasElement.ownerDocument.body);+ const add = canvas.getByRole('button', { name: 'Add notification' });+ await userEvent.click(add);+ await userEvent.click(add);+ await userEvent.click(add);+ const region = body.getByRole('region', { name: 'Notifications' });+ await waitFor(() =>+ expect(region.getAnimations({ subtree: true })).toHaveLength(0),+ );+ const [first, middle, last] = body.getAllByRole('status');+ const firstTop = first.getBoundingClientRect().top;+ const gap = middle.getBoundingClientRect().top - firstTop;+ const isTopAnchored = getComputedStyle(region).top === '0px';+ const movingToast = isTopAnchored ? last : first;+ const anchoredToast = isTopAnchored ? first : last;+ const movingTop = movingToast.getBoundingClientRect().top;+ const anchoredTop = anchoredToast.getBoundingClientRect().top;+ const direction = isTopAnchored ? -1 : 1;++ await userEvent.click(+ within(middle).getByRole('button', { name: 'Close' }),+ );+ if (isMotionEnabled()) {+ expect(middle).toBeInTheDocument();+ await waitFor(() => {+ const distance =+ (movingToast.getBoundingClientRect().top - movingTop) * direction;+ expect(distance).toBeGreaterThan(1);+ expect(distance).toBeLessThan(gap - 1);+ });+ }+ await waitFor(() => expect(middle).not.toBeInTheDocument());+ expect(movingToast.getBoundingClientRect().top).toBeCloseTo(+ movingTop + gap * direction,+ 0,+ );+ expect(anchoredToast.getBoundingClientRect().top).toBeCloseTo(+ anchoredTop,+ 0,+ );+ },+};++export const ReopenDuringExit: Story = {+ ...Default,+ play: async ({ canvasElement, args }) => {+ const canvas = within(canvasElement);+ const body = within(canvasElement.ownerDocument.body);+ const add = canvas.getByRole('button', { name: 'Add notification' });+ const addDuplicate = canvas.getByRole('button', { name: 'Add duplicate' });+ await userEvent.click(addDuplicate);+ await userEvent.click(add);+ await userEvent.click(add);+ const region = body.getByRole('region', { name: 'Notifications' });+ await waitFor(() =>+ expect(region.getAnimations({ subtree: true })).toHaveLength(0),+ );+ const [toast, secondToast, thirdToast] = body.getAllByRole('status');+ const id = toast.id;+ await userEvent.click(within(toast).getByRole('button', { name: 'Close' }));+ if (isMotionEnabled()) {+ expect(toast).toBeInTheDocument();+ }+ await userEvent.click(addDuplicate);+ await waitFor(() =>+ expect(region.getAnimations({ subtree: true })).toHaveLength(0),+ );+ const restoredToasts = body.getAllByRole('status');+ expect(+ restoredToasts.slice(0, 2).map((notification) => notification.id),+ ).toEqual([secondToast.id, thirdToast.id]);+ expect(toast).not.toBeInTheDocument();+ expect(restoredToasts[2].id).not.toBe(id);+ expect(restoredToasts[2]).toHaveTextContent('Already saved');+ expect(restoredToasts[2]).toBeVisible();+ expect(args.onClose).toHaveBeenCalledOnce();+ },+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toaster/__stories__/ToasterExample.tsx b/packages/twenty-ui/src/primitives/feedback/Toaster/__stories__/ToasterExample.tsxnew file mode 100644index 00000000000..d8763020cfa--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toaster/__stories__/ToasterExample.tsx@@ -0,0 +1,12 @@+import { ToastProvider } from '@ui/primitives/feedback/Toast/ToastProvider';++import { Toaster } from '../Toaster';+import { ToastControls } from './ToastControls';+import { type ToasterExampleProps } from './ToasterExampleProps';++export const ToasterExample = ({ limit, onClose }: ToasterExampleProps) => (+ <ToastProvider limit={limit}>+ <ToastControls onClose={onClose} />+ <Toaster />+ </ToastProvider>+);diff --git a/packages/twenty-ui/src/primitives/feedback/Toaster/__stories__/ToasterExampleProps.ts b/packages/twenty-ui/src/primitives/feedback/Toaster/__stories__/ToasterExampleProps.tsnew file mode 100644index 00000000000..5a41851754b--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toaster/__stories__/ToasterExampleProps.ts@@ -0,0 +1,4 @@+export type ToasterExampleProps = {+ limit?: number;+ onClose?: () => void;+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toaster/__tests__/Toaster.test.tsx b/packages/twenty-ui/src/primitives/feedback/Toaster/__tests__/Toaster.test.tsxnew file mode 100644index 00000000000..9b4e7ae38d4--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toaster/__tests__/Toaster.test.tsx@@ -0,0 +1,19 @@+import { type ReactNode } from 'react';++import { runComponentConformance } from '@test-utilities/conformance/runComponentConformance';+import { ToastProvider } from '@ui/primitives/feedback/Toast/ToastProvider';++import { Toaster } from '../Toaster';+import styles from '../Toaster.module.scss';++const ToastWrapper = ({ children }: { children: ReactNode }) => (+ <ToastProvider>{children}</ToastProvider>+);++runComponentConformance({+ name: 'Toaster',+ element: <Toaster />,+ wrapper: ToastWrapper,+ refInstanceOf: HTMLDivElement,+ ownClassName: styles.root,+});diff --git a/packages/twenty-ui/src/primitives/feedback/Toaster/internal/ToasterItem.tsx b/packages/twenty-ui/src/primitives/feedback/Toaster/internal/ToasterItem.tsxnew file mode 100644index 00000000000..06438f9e2cb--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toaster/internal/ToasterItem.tsx@@ -0,0 +1,45 @@+import { useRef } from 'react';++import { Toast } from '@ui/primitives/feedback/Toast/Toast';+import { type ToastEntry } from '@ui/primitives/feedback/Toast/types/ToastEntry';++import styles from '../Toaster.module.scss';+import { type ToasterProps } from '../types/ToasterProps';+import { ToasterItemExitEffect } from './ToasterItemExitEffect';++type ToasterItemProps = {+ toastEntry: ToastEntry;+ getToastProps?: ToasterProps['getToastProps'];+ onClose: (id: string) => void;+};++export const ToasterItem = ({+ toastEntry,+ getToastProps,+ onClose,+}: ToasterItemProps) => {+ const { notification, status } = toastEntry;+ const { id, ...toastProps } = notification;+ const elementRef = useRef<HTMLDivElement>(null);++ return (+ <>+ <div+ ref={elementRef}+ className={styles.item}+ data-exiting={status === 'closing' || undefined}+ inert={status === 'closing'}+ >+ <div className={styles.itemContent}>+ <Toast+ {...toastProps}+ {...getToastProps?.(notification)}+ id={id}+ onClose={() => onClose(id)}+ />+ </div>+ </div>+ <ToasterItemExitEffect elementRef={elementRef} toastEntry={toastEntry} />+ </>+ );+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toaster/internal/ToasterItemExitEffect.tsx b/packages/twenty-ui/src/primitives/feedback/Toaster/internal/ToasterItemExitEffect.tsxnew file mode 100644index 00000000000..420c5e26a9e--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toaster/internal/ToasterItemExitEffect.tsx@@ -0,0 +1,45 @@+import { type RefObject, useLayoutEffect } from 'react';++import { useToastContext } from '@ui/primitives/feedback/Toast/hooks/useToastContext';+import { type ToastEntry } from '@ui/primitives/feedback/Toast/types/ToastEntry';+import { completeToastExit } from '@ui/primitives/feedback/Toast/utils/completeToastExit';++type ToasterItemExitEffectProps = {+ elementRef: RefObject<HTMLDivElement | null>;+ toastEntry: ToastEntry;+};++export const ToasterItemExitEffect = ({+ elementRef,+ toastEntry,+}: ToasterItemExitEffectProps) => {+ const store = useToastContext();++ useLayoutEffect(() => {+ if (toastEntry.status === 'visible') {+ return;+ }++ const exitAnimations = elementRef.current?.getAnimations?.() ?? [];++ if (exitAnimations.length === 0) {+ completeToastExit({ store, toast: toastEntry });+ return;+ }++ let isCancelled = false;+ Promise.allSettled(+ exitAnimations.map((animation) => animation.finished),+ ).then(() => {+ if (!isCancelled) {+ completeToastExit({ store, toast: toastEntry });+ }+ });++ return () => {+ isCancelled = true;+ };+ }, [elementRef, toastEntry, store]);++ return <></>;+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toaster/internal/ToasterItems.tsx b/packages/twenty-ui/src/primitives/feedback/Toaster/internal/ToasterItems.tsxnew file mode 100644index 00000000000..dad23e6d9ad--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toaster/internal/ToasterItems.tsx@@ -0,0 +1,23 @@+import { useCloseToast } from '@ui/primitives/feedback/Toast/hooks/useCloseToast';+import { useToastEntries } from '@ui/primitives/feedback/Toast/hooks/useToastEntries';++import { type ToasterProps } from '../types/ToasterProps';+import { ToasterItem } from './ToasterItem';++type ToasterItemsProps = {+ getToastProps?: ToasterProps['getToastProps'];+};++export const ToasterItems = ({ getToastProps }: ToasterItemsProps) => {+ const toasts = useToastEntries();+ const { closeToast } = useCloseToast();++ return toasts.map((toast) => (+ <ToasterItem+ key={toast.notification.id}+ toastEntry={toast}+ getToastProps={getToastProps}+ onClose={closeToast}+ />+ ));+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toaster/internal/ToasterLifecycleEffect.tsx b/packages/twenty-ui/src/primitives/feedback/Toaster/internal/ToasterLifecycleEffect.tsxnew file mode 100644index 00000000000..2bceea449ee--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toaster/internal/ToasterLifecycleEffect.tsx@@ -0,0 +1,24 @@+import { useLayoutEffect } from 'react';++import { useToastContext } from '@ui/primitives/feedback/Toast/hooks/useToastContext';+import { isToastVisible } from '@ui/primitives/feedback/Toast/utils/isToastVisible';++export const ToasterLifecycleEffect = () => {+ const store = useToastContext();++ useLayoutEffect(() => {+ store.set('mountedToasterCount', store.state.mountedToasterCount + 1);++ return () => {+ store.set('mountedToasterCount', store.state.mountedToasterCount - 1);++ if (store.state.mountedToasterCount > 0) {+ return;+ }++ store.set('toasts', store.state.toasts.filter(isToastVisible));+ };+ }, [store]);++ return null;+};diff --git a/packages/twenty-ui/src/primitives/feedback/Toaster/types/ToasterProps.ts b/packages/twenty-ui/src/primitives/feedback/Toaster/types/ToasterProps.tsnew file mode 100644index 00000000000..4747af64e7b--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/Toaster/types/ToasterProps.ts@@ -0,0 +1,13 @@+import { type useRender } from '@base-ui/react/use-render';+import { type ComponentPropsWithRef } from 'react';++import { type ToastNotification } from '@ui/primitives/feedback/Toast/types/ToastNotification';+import { type ToastProps } from '@ui/primitives/feedback/Toast/types/ToastProps';++export type ToasterProps = Omit<ComponentPropsWithRef<'div'>, 'children'> & {+ container?: HTMLElement | null;+ getToastProps?: (+ toast: ToastNotification,+ ) => Partial<Omit<ToastProps, 'id' | 'onClose' | 'ref'>>;+ render?: useRender.RenderProp;+};diff --git a/packages/twenty-ui/src/primitives/feedback/index.ts b/packages/twenty-ui/src/primitives/feedback/index.tsindex 36999478943..1777de9aaad 100644--- a/packages/twenty-ui/src/primitives/feedback/index.ts+++ b/packages/twenty-ui/src/primitives/feedback/index.ts@@ -38,6 +38,13 @@ export type { ProgressBarProps } from './ProgressBar/ProgressBar';export { ProgressBar } from './ProgressBar/ProgressBar';export type { SidePanelInformationBannerProps } from './SidePanelInformationBanner/SidePanelInformationBanner';export { SidePanelInformationBanner } from './SidePanelInformationBanner/SidePanelInformationBanner';+export { useToast } from './Toast/hooks/useToast';export { Toast } from './Toast/Toast';+export { ToastProvider } from './Toast/ToastProvider';+export type { ToastNotification } from './Toast/types/ToastNotification';+export type { ToastOptions } from './Toast/types/ToastOptions';export type { ToastProps } from './Toast/types/ToastProps';+export type { ToastProviderProps } from './Toast/types/ToastProviderProps';export type { ToastVariant } from './Toast/types/ToastVariant';+export { Toaster } from './Toaster/Toaster';+export type { ToasterProps } from './Toaster/types/ToasterProps';diff --git a/packages/twenty-ui/vite.config.ts b/packages/twenty-ui/vite.config.tsindex c273b73b08c..5e1dec62818 100644--- a/packages/twenty-ui/vite.config.ts+++ b/packages/twenty-ui/vite.config.ts@@ -76,7 +76,7 @@ export default defineConfig(({ command }) => {},},optimizeDeps: {- // Pre-bundle React up front so Vite's dep optimizer doesn't re-bundle it+ // Pre-bundle React and Jotai so Vite's dep optimizer doesn't re-bundle them// mid-run during browser-mode Storybook tests — re-bundling rotates the// optimized chunk hash and 404s in-flight dynamic imports (vite 8 / rolldown).include: [diff --git a/yarn.lock b/yarn.lockindex 4ada919303f..7dd092c406e 100644--- a/yarn.lock+++ b/yarn.lock@@ -50506,6 +50506,7 @@ __metadata:dependencies:"@argos-ci/storybook": "npm:6.2.3""@base-ui/react": "npm:^1.8.0"+ "@base-ui/utils": "npm:0.4.0""@fontsource/inter": "npm:^5.2.8""@monaco-editor/react": "npm:^4.7.0""@prettier/sync": "npm:^0.5.2"