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 { openGlobalShareModal } from '@app/features/sharing/global-share-modal/GlobalShareModal';
import {
isShareableEntityType,
type ShareableEntityData,
} from '@app/features/sharing/global-share-modal/shareable-entity';
import type { EntityData } from '@entity';
import type { EntityActionListState } from './entity-action-context';
export const makeShareAction = () => {
/**
* Check if the share action can be executed
* Only requires shareable type - the modal handles permissions
*/
const canExecute = (entity: EntityData): boolean => {
return isShareableEntityType(entity.type);
};
const execute = async (entity: EntityData) => {
if (!isShareableEntityType(entity.type)) {
return;
}
await openGlobalShareModal({
// TODO: use type guard on entity data, not the type
entity: entity as ShareableEntityData,
});
};
const executeWithSoup = async (
entities: EntityData[],
_soup: EntityActionListState
) => {
const entity = entities[0];
if (!entity) return;
await execute(entity);
// Don't clear selection or change focus for share
};
return { canExecute, execute, executeWithSoup };
};