text: var __rest = (this && this.__rest) || function (s, e) {
      var t = {};
      for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
          t[p] = s[p];
      if (s != null && typeof Object.getOwnPropertySymbols === "function")
          for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
              if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                  t[p[i]] = s[p[i]];
          }
      return t;
  };
  import { useCallback } from 'react';
  import { useDispatch } from 'react-redux';
  import { showNotification, } from '../actions/notificationActions';
  import warning from '../util/warning';
  /**
   * Hook for Notification Side Effect
   *
   * @example
   *
   * const notify = useNotify();
   * // simple message (info level)
   * notify('Level complete');
   * // specify level
   * notify('A problem occurred', 'warning')
   * // pass arguments to the translation function
   * notify('Deleted %{count} elements', 'info', { smart_count: 23 })
   * // show the action as undoable in the notification
   * notify('Post renamed', 'info', {}, true)
   */
  var useNotify = function () {
      var dispatch = useDispatch();
      return useCallback(function (message, type, messageArgs, undoable, autoHideDuration, multiLine) {
          if (messageArgs === void 0) { messageArgs = {}; }
          if (undoable === void 0) { undoable = false; }
          if (typeof type === 'string') {
              warning(true, 'This way of calling useNotify callback is deprecated. Please use the new syntax passing notify("[Your message]", { ...restOfArguments })');
              dispatch(showNotification(message, (type || 'info'), {
                  messageArgs: messageArgs,
                  undoable: undoable,
                  autoHideDuration: autoHideDuration,
                  multiLine: multiLine,
              }));
          }
          else {
              var _a = type || {}, messageType = _a.type, options = __rest(_a, ["type"]);
              dispatch(showNotification(message, messageType, options));
          }
      }, [dispatch]);
  };
  export default useNotify;
  