The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import { HeadlessFrontComponentRendererEngineCommand } from '@/command-menu-item/engine-command/components/HeadlessFrontComponentRendererEngineCommand';
import { HeadlessNavigateEngineCommand } from '@/command-menu-item/engine-command/components/HeadlessNavigateEngineCommand';
import { NewAiChatCommand } from '@/command-menu-item/engine-command/global/components/NewAiChatCommand';
import { HeadlessOpenSidePanelPageEngineCommand } from '@/command-menu-item/engine-command/components/HeadlessOpenSidePanelPageEngineCommand';
import { NavigationEngineCommand } from '@/command-menu-item/engine-command/components/NavigationEngineCommand';
import { ComposeCampaignCommand } from '@/command-menu-item/engine-command/global/components/ComposeCampaignCommand';
import { SendMessageCampaignSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/message-campaign/components/SendMessageCampaignSingleRecordCommand';
import { CancelMessageCampaignSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/message-campaign/components/CancelMessageCampaignSingleRecordCommand';
import { DuplicateMessageCampaignSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/message-campaign/components/DuplicateMessageCampaignSingleRecordCommand';
import { SendMessageCampaignTestSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/message-campaign/components/SendMessageCampaignTestSingleRecordCommand';
import { OpenEmailBlockSettingsSingleRecordCommand } from '@/command-menu-item/engine-command/record/components/OpenEmailBlockSettingsSingleRecordCommand';
import { OpenEmailPageStyleSingleRecordCommand } from '@/command-menu-item/engine-command/record/components/OpenEmailPageStyleSingleRecordCommand';
import { ComposeEmailCommand } from '@/command-menu-item/engine-command/global/components/ComposeEmailCommand';
import { EditLayoutCommand } from '@/command-menu-item/engine-command/global/components/EditLayoutCommand';
import { DeleteRecordsCommand } from '@/command-menu-item/engine-command/record/components/DeleteRecordsCommand';
import { DestroyRecordsCommand } from '@/command-menu-item/engine-command/record/components/DestroyRecordsCommand';
import { ExportRecordsCommand } from '@/command-menu-item/engine-command/record/components/ExportRecordsCommand';
import { AddRecordsToMessageListCommand } from '@/command-menu-item/engine-command/record/components/AddRecordsToMessageListCommand';
import { AddViewToMessageListNoSelectionRecordCommand } from '@/command-menu-item/engine-command/record/no-selection/components/AddViewToMessageListNoSelectionRecordCommand';
import { RestoreRecordsCommand } from '@/command-menu-item/engine-command/record/components/RestoreRecordsCommand';
import { TriggerWorkflowVersionEngineCommand } from '@/command-menu-item/engine-command/record/components/TriggerWorkflowVersionEngineCommand';
import { MergeMultipleRecordsCommand } from '@/command-menu-item/engine-command/record/multiple-records/components/MergeMultipleRecordsCommand';
import { UpdateMultipleRecordsCommand } from '@/command-menu-item/engine-command/record/multiple-records/components/UpdateMultipleRecordsCommand';
import { CreateNewRecordCommand } from '@/command-menu-item/engine-command/record/no-selection/components/CreateNewRecordCommand';
import { CreateNewViewNoSelectionRecordCommand } from '@/command-menu-item/engine-command/record/no-selection/components/CreateNewViewNoSelectionRecordCommand';
import { HideDeletedRecordsNoSelectionRecordCommand } from '@/command-menu-item/engine-command/record/no-selection/components/HideDeletedRecordsNoSelectionRecordCommand';
import { ImportRecordsNoSelectionRecordCommand } from '@/command-menu-item/engine-command/record/no-selection/components/ImportRecordsNoSelectionRecordCommand';
import { SeeDeletedRecordsNoSelectionRecordCommand } from '@/command-menu-item/engine-command/record/no-selection/components/SeeDeletedRecordsNoSelectionRecordCommand';
import { AddToFavoritesCommand } from '@/command-menu-item/engine-command/record/components/AddToFavoritesCommand';
import { MergeWithRecordSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/components/MergeWithRecordSingleRecordCommand';
import { NavigateToNextRecordSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/components/NavigateToNextRecordSingleRecordCommand';
import { NavigateToPreviousRecordSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/components/NavigateToPreviousRecordSingleRecordCommand';
import { RemoveFromFavoritesCommand } from '@/command-menu-item/engine-command/record/components/RemoveFromFavoritesCommand';
import { CancelDashboardSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/dashboard/components/CancelDashboardSingleRecordCommand';
import { DuplicateDashboardSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/dashboard/components/DuplicateDashboardSingleRecordCommand';
import { DuplicateMessageListSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/message-list/components/DuplicateMessageListSingleRecordCommand';
import { EditDashboardSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/dashboard/components/EditDashboardSingleRecordCommand';
import { SaveDashboardSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/dashboard/components/SaveDashboardSingleRecordCommand';
import { ReplyToEmailThreadCommand } from '@/command-menu-item/engine-command/record/single-record/message-thread/components/ReplyToEmailThreadCommand';
import { AgentChatThreadInboxCommand } from '@/command-menu-item/engine-command/record/components/AgentChatThreadInboxCommand';
import { ShareRecordCommand } from '@/command-menu-item/engine-command/record/components/ShareRecordCommand';
import { SeeVersionWorkflowRunSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow-runs/components/SeeVersionWorkflowRunSingleRecordCommand';
import { SeeWorkflowWorkflowRunSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow-runs/components/SeeWorkflowWorkflowRunSingleRecordCommand';
import { RetryWorkflowRunSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow-runs/components/RetryWorkflowRunSingleRecordCommand';
import { StopWorkflowRunSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow-runs/components/StopWorkflowRunSingleRecordCommand';
import { SeeRunsWorkflowVersionSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow-versions/components/SeeRunsWorkflowVersionSingleRecordCommand';
import { SeeVersionsWorkflowVersionSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow-versions/components/SeeVersionsWorkflowVersionSingleRecordCommand';
import { SeeWorkflowWorkflowVersionSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow-versions/components/SeeWorkflowWorkflowVersionSingleRecordCommand';
import { UseAsDraftWorkflowVersionSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow-versions/components/UseAsDraftWorkflowVersionSingleRecordCommand';
import { ActivateWorkflowSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow/components/ActivateWorkflowSingleRecordCommand';
import { AddNodeWorkflowSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow/components/AddNodeWorkflowSingleRecordCommand';
import { DeactivateWorkflowSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow/components/DeactivateWorkflowSingleRecordCommand';
import { DiscardDraftWorkflowSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow/components/DiscardDraftWorkflowSingleRecordCommand';
import { DuplicateWorkflowSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow/components/DuplicateWorkflowSingleRecordCommand';
import { ToggleWorkflowVisibilitySingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow/components/ToggleWorkflowVisibilitySingleRecordCommand';
import { SeeActiveVersionWorkflowSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow/components/SeeActiveVersionWorkflowSingleRecordCommand';
import { SeeRunsWorkflowSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow/components/SeeRunsWorkflowSingleRecordCommand';
import { SeeVersionsWorkflowSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow/components/SeeVersionsWorkflowSingleRecordCommand';
import { TestWorkflowSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow/components/TestWorkflowSingleRecordCommand';
import { TidyUpWorkflowSingleRecordCommand } from '@/command-menu-item/engine-command/record/single-record/workflow/components/TidyUpWorkflowSingleRecordCommand';
import { CoreObjectNamePlural } from '@/object-metadata/types/CoreObjectNamePlural';
import { msg } from '@lingui/core/macro';
import { AppPath, SettingsPath, SidePanelPages } from 'twenty-shared/types';
import { IconMessage, IconSearch, IconSparkles } from 'twenty-ui/icon';
import {
AgentChatInboxAction,
EngineComponentKey,
} from '~/generated-metadata/graphql';
export const ENGINE_COMPONENT_KEY_COMPONENT_MAP: Record<
EngineComponentKey,
React.ReactNode
> = {
[EngineComponentKey.CREATE_NEW_RECORD]: <CreateNewRecordCommand />,
[EngineComponentKey.DELETE_RECORDS]: <DeleteRecordsCommand />,
[EngineComponentKey.RESTORE_RECORDS]: <RestoreRecordsCommand />,
[EngineComponentKey.DESTROY_RECORDS]: <DestroyRecordsCommand />,
[EngineComponentKey.ADD_TO_FAVORITES]: <AddToFavoritesCommand />,
[EngineComponentKey.REMOVE_FROM_FAVORITES]: <RemoveFromFavoritesCommand />,
[EngineComponentKey.MERGE_MULTIPLE_RECORDS]: <MergeMultipleRecordsCommand />,
[EngineComponentKey.MERGE_WITH_RECORD]: (
<MergeWithRecordSingleRecordCommand />
),
[EngineComponentKey.DUPLICATE_DASHBOARD]: (
<DuplicateDashboardSingleRecordCommand />
),
[EngineComponentKey.DUPLICATE_MESSAGE_LIST]: (
<DuplicateMessageListSingleRecordCommand />
),
[EngineComponentKey.ADD_TO_MESSAGE_LIST]: <AddRecordsToMessageListCommand />,
[EngineComponentKey.ADD_VIEW_TO_MESSAGE_LIST]: (
<AddViewToMessageListNoSelectionRecordCommand />
),
[EngineComponentKey.DUPLICATE_WORKFLOW]: (
<DuplicateWorkflowSingleRecordCommand />
),
[EngineComponentKey.TOGGLE_WORKFLOW_VISIBILITY]: (
<ToggleWorkflowVisibilitySingleRecordCommand />
),
[EngineComponentKey.ACTIVATE_WORKFLOW]: (
<ActivateWorkflowSingleRecordCommand />
),
[EngineComponentKey.DEACTIVATE_WORKFLOW]: (
<DeactivateWorkflowSingleRecordCommand />
),
[EngineComponentKey.DISCARD_DRAFT_WORKFLOW]: (
<DiscardDraftWorkflowSingleRecordCommand />
),
[EngineComponentKey.TEST_WORKFLOW]: <TestWorkflowSingleRecordCommand />,
[EngineComponentKey.STOP_WORKFLOW_RUN]: (
<StopWorkflowRunSingleRecordCommand />
),
[EngineComponentKey.RETRY_WORKFLOW_RUN]: (
<RetryWorkflowRunSingleRecordCommand />
),
[EngineComponentKey.USE_AS_DRAFT_WORKFLOW_VERSION]: (
<UseAsDraftWorkflowVersionSingleRecordCommand />
),
[EngineComponentKey.SAVE_DASHBOARD_LAYOUT]: (
<SaveDashboardSingleRecordCommand />
),
[EngineComponentKey.TIDY_UP_WORKFLOW]: <TidyUpWorkflowSingleRecordCommand />,
[EngineComponentKey.NAVIGATE_TO_NEXT_RECORD]: (
<NavigateToNextRecordSingleRecordCommand />
),
[EngineComponentKey.NAVIGATE_TO_PREVIOUS_RECORD]: (
<NavigateToPreviousRecordSingleRecordCommand />
),
[EngineComponentKey.EXPORT_RECORDS]: <ExportRecordsCommand />,
[EngineComponentKey.UPDATE_MULTIPLE_RECORDS]: (
<UpdateMultipleRecordsCommand />
),
[EngineComponentKey.IMPORT_RECORDS]: (
<ImportRecordsNoSelectionRecordCommand />
),
[EngineComponentKey.EXPORT_VIEW]: <ExportRecordsCommand />,
[EngineComponentKey.SEE_DELETED_RECORDS]: (
<SeeDeletedRecordsNoSelectionRecordCommand />
),
[EngineComponentKey.CREATE_NEW_VIEW]: (
<CreateNewViewNoSelectionRecordCommand />
),
[EngineComponentKey.HIDE_DELETED_RECORDS]: (
<HideDeletedRecordsNoSelectionRecordCommand />
),
[EngineComponentKey.EDIT_RECORD_PAGE_LAYOUT]: <EditLayoutCommand />,
[EngineComponentKey.EDIT_DASHBOARD_LAYOUT]: (
<EditDashboardSingleRecordCommand />
),
[EngineComponentKey.CANCEL_DASHBOARD_LAYOUT]: (
<CancelDashboardSingleRecordCommand />
),
[EngineComponentKey.NAVIGATION]: <NavigationEngineCommand />,
// TODO: remove these keys once `upgrade:1-21:refactor-navigation-commands` has run
[EngineComponentKey.GO_TO_PEOPLE]: (
<HeadlessNavigateEngineCommand
to={AppPath.RecordIndexPage}
params={{ objectNamePlural: CoreObjectNamePlural.Person }}
/>
),
[EngineComponentKey.GO_TO_COMPANIES]: (
<HeadlessNavigateEngineCommand
to={AppPath.RecordIndexPage}
params={{ objectNamePlural: CoreObjectNamePlural.Company }}
/>
),
[EngineComponentKey.GO_TO_DASHBOARDS]: (
<HeadlessNavigateEngineCommand
to={AppPath.RecordIndexPage}
params={{ objectNamePlural: CoreObjectNamePlural.Dashboard }}
/>
),
[EngineComponentKey.GO_TO_OPPORTUNITIES]: (
<HeadlessNavigateEngineCommand
to={AppPath.RecordIndexPage}
params={{
objectNamePlural: CoreObjectNamePlural.Opportunity,
}}
/>
),
[EngineComponentKey.GO_TO_SETTINGS]: (
<HeadlessNavigateEngineCommand
to={AppPath.SettingsCatchAll}
params={{
'*': SettingsPath.ProfilePage,
}}
/>
),
[EngineComponentKey.GO_TO_TASKS]: (
<HeadlessNavigateEngineCommand
to={AppPath.RecordIndexPage}
params={{ objectNamePlural: CoreObjectNamePlural.Task }}
/>
),
[EngineComponentKey.GO_TO_NOTES]: (
<HeadlessNavigateEngineCommand
to={AppPath.RecordIndexPage}
params={{ objectNamePlural: CoreObjectNamePlural.Note }}
/>
),
[EngineComponentKey.GO_TO_WORKFLOWS]: (
<HeadlessNavigateEngineCommand
to={AppPath.RecordIndexPage}
params={{ objectNamePlural: CoreObjectNamePlural.Workflow }}
/>
),
[EngineComponentKey.GO_TO_RUNS]: (
<HeadlessNavigateEngineCommand
to={AppPath.RecordIndexPage}
params={{ objectNamePlural: CoreObjectNamePlural.WorkflowRun }}
/>
),
[EngineComponentKey.SEARCH_RECORDS]: (
<HeadlessOpenSidePanelPageEngineCommand
page={SidePanelPages.SearchRecords}
pageTitle={msg`Search`}
pageIcon={IconSearch}
shouldResetSearchState={true}
/>
),
[EngineComponentKey.SEARCH_RECORDS_FALLBACK]: (
<HeadlessOpenSidePanelPageEngineCommand
page={SidePanelPages.SearchRecords}
pageTitle={msg`Search`}
pageIcon={IconSearch}
/>
),
[EngineComponentKey.ASK_AI]: (
<HeadlessOpenSidePanelPageEngineCommand
page={SidePanelPages.AskAI}
pageTitle={msg`Ask AI`}
pageIcon={IconSparkles}
/>
),
[EngineComponentKey.VIEW_PREVIOUS_AI_CHATS]: (
<HeadlessOpenSidePanelPageEngineCommand
page={SidePanelPages.SearchAiChats}
pageTitle={msg`Open chat`}
pageIcon={IconMessage}
shouldResetSearchState
/>
),
[EngineComponentKey.SEE_ACTIVE_VERSION_WORKFLOW]: (
<SeeActiveVersionWorkflowSingleRecordCommand />
),
[EngineComponentKey.SEE_RUNS_WORKFLOW]: (
<SeeRunsWorkflowSingleRecordCommand />
),
[EngineComponentKey.SEE_VERSIONS_WORKFLOW]: (
<SeeVersionsWorkflowSingleRecordCommand />
),
[EngineComponentKey.ADD_NODE_WORKFLOW]: (
<AddNodeWorkflowSingleRecordCommand />
),
[EngineComponentKey.SEE_VERSION_WORKFLOW_RUN]: (
<SeeVersionWorkflowRunSingleRecordCommand />
),
[EngineComponentKey.SEE_WORKFLOW_WORKFLOW_RUN]: (
<SeeWorkflowWorkflowRunSingleRecordCommand />
),
[EngineComponentKey.SEE_RUNS_WORKFLOW_VERSION]: (
<SeeRunsWorkflowVersionSingleRecordCommand />
),
[EngineComponentKey.SEE_WORKFLOW_WORKFLOW_VERSION]: (
<SeeWorkflowWorkflowVersionSingleRecordCommand />
),
[EngineComponentKey.SEE_VERSIONS_WORKFLOW_VERSION]: (
<SeeVersionsWorkflowVersionSingleRecordCommand />
),
[EngineComponentKey.TRIGGER_WORKFLOW_VERSION]: (
<TriggerWorkflowVersionEngineCommand />
),
[EngineComponentKey.FRONT_COMPONENT_RENDERER]: (
<HeadlessFrontComponentRendererEngineCommand />
),
[EngineComponentKey.REPLY_TO_EMAIL_THREAD]: <ReplyToEmailThreadCommand />,
[EngineComponentKey.NEW_AI_CHAT]: <NewAiChatCommand />,
[EngineComponentKey.SHARE_RECORD]: <ShareRecordCommand />,
[EngineComponentKey.MARK_AI_CHAT_AS_READ]: (
<AgentChatThreadInboxCommand action={AgentChatInboxAction.READ} />
),
[EngineComponentKey.MARK_AI_CHAT_AS_UNREAD]: (
<AgentChatThreadInboxCommand action={AgentChatInboxAction.UNREAD} />
),
[EngineComponentKey.MARK_AI_CHAT_AS_DONE]: (
<AgentChatThreadInboxCommand action={AgentChatInboxAction.ARCHIVE} />
),
[EngineComponentKey.REOPEN_AI_CHAT]: (
<AgentChatThreadInboxCommand action={AgentChatInboxAction.MOVE_TO_INBOX} />
),
[EngineComponentKey.SNOOZE_AI_CHAT]: (
<AgentChatThreadInboxCommand action={AgentChatInboxAction.SNOOZE} />
),
[EngineComponentKey.SUBSCRIBE_TO_AI_CHAT]: (
<AgentChatThreadInboxCommand action={AgentChatInboxAction.SUBSCRIBE} />
),
[EngineComponentKey.UNSUBSCRIBE_FROM_AI_CHAT]: (
<AgentChatThreadInboxCommand action={AgentChatInboxAction.UNSUBSCRIBE} />
),
[EngineComponentKey.ASSIGN_AI_CHAT]: (
<AgentChatThreadInboxCommand action="assign" />
),
[EngineComponentKey.COMPOSE_EMAIL]: <ComposeEmailCommand />,
[EngineComponentKey.COMPOSE_CAMPAIGN]: <ComposeCampaignCommand />,
[EngineComponentKey.SEND_MESSAGE_CAMPAIGN]: (
<SendMessageCampaignSingleRecordCommand />
),
[EngineComponentKey.SEND_MESSAGE_CAMPAIGN_TEST]: (
<SendMessageCampaignTestSingleRecordCommand />
),
[EngineComponentKey.CANCEL_MESSAGE_CAMPAIGN]: (
<CancelMessageCampaignSingleRecordCommand />
),
[EngineComponentKey.DUPLICATE_MESSAGE_CAMPAIGN]: (
<DuplicateMessageCampaignSingleRecordCommand />
),
[EngineComponentKey.EMAIL_BLOCK_SETTINGS]: (
<OpenEmailBlockSettingsSingleRecordCommand />
),
[EngineComponentKey.EMAIL_PAGE_STYLE]: (
<OpenEmailPageStyleSingleRecordCommand />
),
// Deprecated keys kept for backward compatibility until migration runs
[EngineComponentKey.DELETE_SINGLE_RECORD]: <DeleteRecordsCommand />,
[EngineComponentKey.DELETE_MULTIPLE_RECORDS]: <DeleteRecordsCommand />,
[EngineComponentKey.RESTORE_SINGLE_RECORD]: <RestoreRecordsCommand />,
[EngineComponentKey.RESTORE_MULTIPLE_RECORDS]: <RestoreRecordsCommand />,
[EngineComponentKey.DESTROY_SINGLE_RECORD]: <DestroyRecordsCommand />,
[EngineComponentKey.DESTROY_MULTIPLE_RECORDS]: <DestroyRecordsCommand />,
[EngineComponentKey.EXPORT_FROM_RECORD_INDEX]: <ExportRecordsCommand />,
[EngineComponentKey.EXPORT_FROM_RECORD_SHOW]: <ExportRecordsCommand />,
[EngineComponentKey.EXPORT_MULTIPLE_RECORDS]: <ExportRecordsCommand />,
};