
const openView = (name: string, outlet?: string, options?: object): void => {
  if (isViewExistsInState(viewsState, name)) {
    dispatch({ type: OPEN_VIEW, payload: { name, outlet, options } });
  }
};

const closeView = (name: string, dispatchBeforeCloseAction = true): void => {
  if (isViewExistsInState(viewsState, name)) {
    if (dispatchBeforeCloseAction) {
      dispatch({ type: BEFORE_CLOSE_VIEW, payload: { name } });
    } else {
      dispatch({ type: CLOSE_VIEW, payload: { name } });
    }
  }