import type { FlowStep } from '../../data/types'; import { Icon } from '../shared/Icon'; interface HandlerLogicSnippetProps { step: FlowStep; } export function HandlerLogicSnippet({ step }: HandlerLogicSnippetProps) { const handlerParts = step.handler.split('.'); const fileName = handlerParts.length > 1 ? handlerParts[0] + '.ts' : 'handler.ts'; const functionName = handlerParts.length > 1 ? handlerParts[1] : step.handler; const code = `async ${functionName}(req) { // trigger: ${step.trigger} // status: ${step.status} → ${step.bookingStatus} ${step.messages.map((m) => `await this.emit('${m.type}', '${m.label}');`).join('\n ')} }`; return (
{code}