Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
import { t } from '@app/lib/i18n';
import { toast } from '@core/component/Toast/Toast';
import type { EntityData } from '@entity';
import type { EntityActionListState } from './entity-action-context';
export const makeCopyEntityIdAction = () => {
// A channel message or thread row's id joins its channel's and its own, so
// it names nothing a user can look up.
const canExecute = (entity: EntityData): boolean =>
entity.type !== 'channel_message' && entity.type !== 'channel_thread';
/** Copying an id needs nothing but the id, so callers that only have one
* (e.g. a block, which is keyed by its entity id) can skip resolving the
* entity. */
const executeById = async (id: string) => {
await navigator.clipboard.writeText(id);
toast.success(t('entityActions.toastIdCopied'));
};
const execute = async (entities: EntityData[]) => {
const entity = entities[0];
if (!entity) return;
await executeById(entity.id);
};
const executeWithSoup = async (
entities: EntityData[],
_soup: EntityActionListState
) => {
await execute(entities);
};
return { canExecute, execute, executeById, executeWithSoup };
};