import { useCallback, useContext } from 'react';
import { WorkflowTasksContext } from '../../../contexts/WorkflowTasksContext';
import { useMdmAction, useMdmEntityUri } from '../../../contexts/MdmModuleContext';
export var useWorkflowDefaultActionSuccessHandler = function () {
    var loadTasks = (useContext(WorkflowTasksContext) || {}).loadTasks;
    var loadEntity = useMdmAction('loadEntity');
    var entityDeletionFinished = useMdmAction('entityDeletionFinished');
    var entityUri = useMdmEntityUri();
    return useCallback(function (action) {
        if (action === 'Delete') {
            entityDeletionFinished();
        }
        else {
            // entity refreshing
            loadEntity(entityUri);
            loadTasks === null || loadTasks === void 0 ? void 0 : loadTasks();
        }
    }, [entityUri, loadTasks, loadEntity, entityDeletionFinished]);
};
