"use strict";

exports.__esModule = true;
exports.ManageTagsNotification = void 0;
var _react = _interopRequireWildcard(require("react"));
var _designSystem = require("@wix/design-system");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/Tags/ManageTags/ManageTagsModal/ManageTagsNotification.tsx";
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
const toastTypeToStatus = {
  STANDARD: 'info',
  PREMIUM: 'info',
  SUCCESS: 'success',
  WARNING: 'warning',
  ERROR: 'error'
};
const ManageTagsNotification = ({
  toastConfig,
  onClose,
  dataHook
}) => {
  const actionElement = (0, _react.useMemo)(() => {
    var _toastConfig$action;
    if (!((_toastConfig$action = toastConfig.action) != null && _toastConfig$action.text)) {
      return undefined;
    }
    const handleClick = () => {
      var _toastConfig$action2, _toastConfig$action3;
      (_toastConfig$action2 = toastConfig.action) == null || _toastConfig$action2.onClick == null || _toastConfig$action2.onClick();
      if ((_toastConfig$action3 = toastConfig.action) != null && _toastConfig$action3.removeToastOnClick) {
        onClose(toastConfig);
      }
    };
    return /*#__PURE__*/_react.default.createElement(_designSystem.StatusToast.Action, {
      dataHook: "manage-tags-modal-notification-action",
      onClick: handleClick,
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 40,
        columnNumber: 7
      }
    }, toastConfig.action.text);
  }, [toastConfig, onClose]);
  return /*#__PURE__*/_react.default.createElement(_designSystem.StatusToast, {
    key: toastConfig.biName ?? toastConfig.message,
    dataHook: dataHook,
    status: toastTypeToStatus[toastConfig.type ?? 'STANDARD'],
    dismissible: true,
    onDismiss: () => onClose(toastConfig),
    action: actionElement,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 50,
      columnNumber: 5
    }
  }, /*#__PURE__*/_react.default.createElement("span", {
    "data-hook": "manage-tags-modal-notification-message",
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 58,
      columnNumber: 7
    }
  }, toastConfig.message));
};
exports.ManageTagsNotification = ManageTagsNotification;
//# sourceMappingURL=ManageTagsNotification.js.map