"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.getImportModalStepProps = getImportModalStepProps;
var _designSystem = require("@wix/design-system");
var _react = _interopRequireDefault(require("react"));
var _ImportStepUpload = require("./ImportStepUpload");
var _ImportStepConfiguration = require("./ImportStepConfiguration");
var _ImportStepProgress = require("./ImportStepProgress");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/ImportButton/getImportModalStepProps.tsx";
function getImportModalStepProps({
  state,
  isMobile
}) {
  const {
    currentStep,
    translate: t
  } = state;
  if (currentStep === 'upload') {
    return {
      title: t('cairo.import.title'),
      subtitle: t('cairo.import.subtitle'),
      children: /*#__PURE__*/_react.default.createElement(_ImportStepUpload.ImportStepUpload, {
        state: state,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 32,
          columnNumber: 17
        }
      }),
      footnote: /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
        gap: "SP1",
        verticalAlign: "middle",
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 34,
          columnNumber: 9
        }
      }, /*#__PURE__*/_react.default.createElement(_designSystem.Text, {
        size: "small",
        secondary: true,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 35,
          columnNumber: 11
        }
      }, t('cairo.import.footerText')), /*#__PURE__*/_react.default.createElement(_designSystem.TextButton, {
        size: "small",
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 38,
          columnNumber: 11
        }
      }, t('cairo.import.footerLink'))),
      showFooterDivider: false,
      secondaryButtonText: t('cairo.import.cancel'),
      secondaryButtonOnClick: state.close,
      closeButtonProps: {
        onClick: state.close,
        autoFocus: true
      },
      onRequestClose: state.close
    };
  }
  if (currentStep === 'configuration') {
    const handleClose = () => state.discardAndClose();
    return {
      removeContentPadding: true,
      title: isMobile ? /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
        gap: "SP1",
        verticalAlign: "middle",
        direction: "horizontal",
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 55,
          columnNumber: 9
        }
      }, t('cairo.import.configureMappingsTitle'), /*#__PURE__*/_react.default.createElement(_designSystem.CounterBadge, {
        size: "medium",
        skin: "neutralLight",
        dataHook: "import-columns-found-counter",
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 57,
          columnNumber: 11
        }
      }, state.csvHeaders.length)) : /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
        gap: "SP1",
        verticalAlign: "middle",
        direction: "horizontal",
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 66,
          columnNumber: 9
        }
      }, /*#__PURE__*/_react.default.createElement(_designSystem.Heading, {
        size: "medium",
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 67,
          columnNumber: 11
        }
      }, t('cairo.import.configureMappingsTitle')), /*#__PURE__*/_react.default.createElement(_designSystem.CounterBadge, {
        size: "medium",
        skin: "neutralLight",
        dataHook: "import-columns-found-counter",
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 70,
          columnNumber: 11
        }
      }, state.csvHeaders.length)),
      subtitle: t('cairo.import.subtitle'),
      children: /*#__PURE__*/_react.default.createElement(_ImportStepConfiguration.ImportStepConfiguration, {
        state: state,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 80,
          columnNumber: 17
        }
      }),
      showFooterDivider: true,
      primaryButtonText: t('cairo.import.startImport'),
      primaryButtonOnClick: state.hasMappings ? state.startImport : undefined,
      ...(isMobile ? {
        primaryButtonProps: {
          disabled: !state.hasMappings
        }
      } : {
        primaryButtonTooltipProps: !state.hasMappings ? {
          content: t('cairo.import.noMappingsTooltip')
        } : undefined
      }),
      secondaryButtonText: t('cairo.import.cancel'),
      secondaryButtonOnClick: handleClose,
      closeButtonProps: {
        onClick: handleClose,
        autoFocus: true
      },
      onRequestClose: handleClose
    };
  }
  return {
    title: t('cairo.import.progressTitle'),
    children: /*#__PURE__*/_react.default.createElement(_ImportStepProgress.ImportStepProgress, {
      state: state,
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 103,
        columnNumber: 15
      }
    }),
    showFooterDivider: false,
    primaryButtonText: t('cairo.import.importing'),
    primaryButtonProps: {
      disabled: true
    },
    secondaryButtonText: state.isRestoring ? t('cairo.import.restoring') : t('cairo.import.cancel'),
    secondaryButtonOnClick: state.close,
    secondaryButtonProps: {
      disabled: state.isRestoring
    },
    closeButtonProps: {
      onClick: state.close
    },
    onRequestClose: state.isRestoring ? undefined : state.close
  };
}
//# sourceMappingURL=getImportModalStepProps.js.map