import { defineFrontComponent } from 'twenty-sdk/define'; import { Command, useSelectedRecordIds } from 'twenty-sdk/front-component'; import { FRONT_COMPONENT_UNIVERSAL_IDENTIFIERS, LOGIC_FUNCTION_CONSTANTS, } from 'src/constants/universal-identifiers'; import { callContractLogicFunction } from 'src/front-components/utils/call-contract-logic-function.utils'; const SubmitForReview = () => { const recordIds = useSelectedRecordIds(); return ( { // Submit only marks the contract pending_ai_review. The AI review runs // automatically via the contract.updated database-event trigger (which // also covers a manual status change), so nothing is fired here. await callContractLogicFunction({ path: LOGIC_FUNCTION_CONSTANTS.submitForReview.path, body: { contractId: recordIds[0] }, pendingMessage: 'Enviando para revisão…', successMessage: 'Enviado. A análise de IA está rodando em segundo plano — atualize o contrato em cerca de um minuto.', errorMessage: 'Falha ao enviar o contrato para revisão.', }); }} /> ); }; export default defineFrontComponent({ universalIdentifier: FRONT_COMPONENT_UNIVERSAL_IDENTIFIERS.submitForReview, name: 'submit-for-review-effect', description: 'Submit contract for AI review effect', component: SubmitForReview, isHeadless: true, });