"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.CustomFieldsWidgetInline = void 0;
var _react = _interopRequireDefault(require("react"));
var _mobxReactLite = require("mobx-react-lite");
var _wixUiIconsCommon = require("@wix/wix-ui-icons-common");
var _ErrorState = require("../ErrorState");
var _CustomFieldsWidgetContentLazy = require("./CustomFieldsWidgetContentLazy");
var _Skeletons = require("./Skeletons");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/CustomFieldsWidget/CustomFieldsWidgetInline.tsx";
const _CustomFieldsWidgetInline = props => {
  const {
    state,
    emptyStateOverrides,
    onChange,
    dataHook
  } = props;
  const {
    translate: t
  } = state.dataExtension.container;
  const renderContent = () => {
    if (state.isLoading) {
      return /*#__PURE__*/_react.default.createElement(_Skeletons.InlineSkeletonContent, {
        __self: void 0,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 24,
          columnNumber: 14
        }
      });
    }
    if (state.isError) {
      return /*#__PURE__*/_react.default.createElement(_ErrorState.LoadingErrorState, {
        dataHook: "custom-fields-widget-inline-error",
        title: t('cairo.customFields.technical.error.title'),
        action: {
          prefixIcon: /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.Refresh, {
            __self: void 0,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 33,
              columnNumber: 25
            }
          }),
          text: t('cairo.toast.retry'),
          onClick: state.retry
        },
        __self: void 0,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 29,
          columnNumber: 9
        }
      });
    }
    return /*#__PURE__*/_react.default.createElement(_CustomFieldsWidgetContentLazy.CustomFieldsWidgetContentLazy, {
      emptyStateOverrides: emptyStateOverrides,
      onChange: onChange,
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 42,
        columnNumber: 7
      }
    });
  };
  return /*#__PURE__*/_react.default.createElement("div", {
    "data-hook": dataHook,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 49,
      columnNumber: 10
    }
  }, renderContent());
};
const CustomFieldsWidgetInline = exports.CustomFieldsWidgetInline = (0, _mobxReactLite.observer)(_CustomFieldsWidgetInline);
//# sourceMappingURL=CustomFieldsWidgetInline.js.map