<commit_before>import {takeEvery, all, call, put} from 'redux-saga/effects'

import notification from '../../notification'
import remoteEvents from '../../remoteEvents'
import actionHandlers from './actionHandlers'
import * as actions from './actions'
import prepare from './prepare'

export default function* sagas(config) {
  yield all([takeEvery(actions.ACTION_INVOKE, invokeAction, config)])
}

export function* invokeAction(config, {payload}) {
  const {definition, selection, parent} = payload

  const {abort, abortMessage, params} = yield call(prepare, definition, selection, parent, config)

  if (!abort) {
    const actionHandler = actionHandlers[definition.actionType]
    const response = yield call(actionHandler, definition, selection, parent, params, config)

    if (response && response.remoteEvents) {
      yield all(response.remoteEvents.map(remoteEvent => put(remoteEvents.remoteEvent(remoteEvent))))
    }

    if (response && response.success) {
      yield put(actions.actionInvoked(definition, selection, response))
    }
  } else if (abortMessage) {
    yield put(notification.toaster({type: 'info', title: abortMessage}))
  }
}<commit_msg>fix(app-extensions): change toaster type of aborted action handler<commit_after>import {takeEvery, all, call, put} from 'redux-saga/effects'

import notification from '../../notification'
import remoteEvents from '../../remoteEvents'
import actionHandlers from './actionHandlers'
import * as actions from './actions'
import prepare from './prepare'

export default function* sagas(config) {
  yield all([takeEvery(actions.ACTION_INVOKE, invokeAction, config)])
}

export function* invokeAction(config, {payload}) {
  const {definition, selection, parent} = payload

  const {abort, abortMessage, params} = yield call(prepare, definition, selection, parent, config)

  if (!abort) {
    const actionHandler = actionHandlers[definition.actionType]
    const response = yield call(actionHandler, definition, selection, parent, params, config)

    if (response && response.remoteEvents) {
      yield all(response.remoteEvents.map(remoteEvent => put(remoteEvents.remoteEvent(remoteEvent))))
    }

    if (response && response.success) {
      yield put(actions.actionInvoked(definition, selection, response))
    }
  } else if (abortMessage) {
    yield put(notification.toaster({type: 'error', title: abortMessage}))
  }
}
{'fraction_non_alphanumeric': 0.12395309882747069, 'fraction_numerical': 0.0, 'mean_word_length': 4.92803970223325, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3866305', 'n_tokens_mistral': 645, 'n_tokens_neox': 643, 'n_words': 187}