"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports._ArchiveFieldModal = exports.ArchiveFieldModal = void 0;
var _designSystem = require("@wix/design-system");
var _react = _interopRequireDefault(require("react"));
var _react2 = require("@wix/bex-core/react");
var _ActionModal = require("../ActionModal");
var _mobxReactLite = require("mobx-react-lite");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/CustomFieldsPanel/ArchiveFieldModal.tsx";
const _ArchiveFieldModal = ({
  state
}) => {
  const container = (0, _react2.useWixPatternsContainer)();
  const {
    translate: t
  } = container;
  const {
    dataExtension,
    modal
  } = state;
  const getModalTitle = () => {
    var _modal$value;
    const fieldId = (_modal$value = modal.value) == null ? void 0 : _modal$value.id;
    if (dataExtension.enableArchive && fieldId) {
      const fieldValues = dataExtension.extractFieldValuesFromSchema(fieldId);
      if (fieldValues != null && fieldValues.name) {
        return t('cairo.customFields.archive.modal.title.enabled', {
          selectedField: fieldValues.name
        });
      }
    }
    return t('cairo.customFields.archive.modal.title');
  };
  const getModalDescription = () => {
    if (dataExtension.enableArchive) {
      return t('cairo.customFields.archive.modal.description.enabled');
    }
    return t('cairo.customFields.archive.modal.description');
  };
  return /*#__PURE__*/_react.default.createElement(_ActionModal.CustomActionModal, {
    dataHook: "archive-custom-field-modal",
    state: state.modal,
    title: getModalTitle(),
    primaryButtonText: t('cairo.customFields.archive.modal.CTA'),
    secondaryButtonText: t('cairo.customFields.archive.modal.cancel.CTA'),
    content: /*#__PURE__*/_react.default.createElement(_designSystem.Text, {
      dataHook: "archive-custom-field-body",
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 45,
        columnNumber: 9
      }
    }, getModalDescription()),
    theme: "destructive",
    width: "510px",
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 38,
      columnNumber: 5
    }
  });
};
exports._ArchiveFieldModal = _ArchiveFieldModal;
const ArchiveFieldModal = exports.ArchiveFieldModal = (0, _mobxReactLite.observer)(_ArchiveFieldModal);
//# sourceMappingURL=ArchiveFieldModal.js.map