import React from 'react';
import PropTypes from 'prop-types';
import {
  Router,
  Switch,
} from 'react-router-dom';

import { Provider } from 'react-redux';
import { CookiesProvider } from 'react-cookie';

import { HotKeys } from '@folio/stripes-components/lib/HotKeys';
import { connectFor } from '@folio/stripes-connect';

import getModuleRoutes from './moduleRoutes';
import events from './events';

import {
  MainContainer,
  MainNav,
  ModuleContainer,
  ModuleTranslator,
  TitledRoute,
  Front,
  SSOLanding,
  SSORedirect,
  Settings,
  HandlerManager,
  TitleManager,
  Login,
  OverlayContainer,
  CreateResetPassword,
  CheckEmailStatusPage,
  ForgotPasswordCtrl,
  ForgotUserNameCtrl,
  AppCtxMenuProvider,
} from './components';
import { stripesShape } from './Stripes';
import { StripesContext } from './StripesContext';

class RootWithIntl extends React.Component {
  static propTypes = {
    stripes: stripesShape.isRequired,
    token: PropTypes.string,
    disableAuth: PropTypes.bool.isRequired,
    history: PropTypes.shape({}),
  };

  static defaultProps = {
    token: '',
    history: {},
  };

  render() {
    const {
      token,
      disableAuth,
      history,
    } = this.props;

    const connect = connectFor('@folio/core', this.props.stripes.epics, this.props.stripes.logger);
    const stripes = this.props.stripes.clone({ connect });

    return (
      <StripesContext.Provider value={stripes}>
        <ModuleTranslator>
          <TitleManager>
            <HotKeys
              keyMap={stripes.bindings}
              noWrapper
            >
              <Provider store={stripes.store}>
                <Router history={history}>
                  { token || disableAuth ?
                    <MainContainer stripes={stripes}>
                      <OverlayContainer />
                      <AppCtxMenuProvider>
                        <MainNav stripes={stripes} />
                        <HandlerManager
                          event={events.LOGIN}
                          stripes={stripes}
                        />
                        { (stripes.okapi !== 'object' || stripes.discovery.isFinished) && (
                          <ModuleContainer id="content">
                            <Switch>
                              <TitledRoute
                                name="home"
                                path="/"
                                key="root"
                                exact
                                component={<Front stripes={stripes} />}
                              />
                              <TitledRoute
                                name="ssoRedirect"
                                path="/sso-landing"
                                key="sso-landing"
                                component={<SSORedirect stripes={stripes} />}
                              />
                              <TitledRoute
                                name="settings"
                                path="/settings"
                                component={<Settings stripes={stripes} />}
                              />
                              {getModuleRoutes(stripes)}
                              <TitledRoute
                                name="notFound"
                                component={(
                                  <div>
                                    <h2>Uh-oh!</h2>
                                    <p>This route does not exist.</p>
                                  </div>
                                )}
                              />
                            </Switch>
                          </ModuleContainer>
                        )}
                      </AppCtxMenuProvider>
                    </MainContainer> :
                    <Switch>
                      <TitledRoute
                        name="CreateResetPassword"
                        path="/reset-password/:token"
                        component={<CreateResetPassword stripes={stripes} />}
                      />
                      <TitledRoute
                        name="ssoLanding"
                        exact
                        path="/sso-landing"
                        component={<CookiesProvider><SSOLanding stripes={stripes} /></CookiesProvider>}
                        key="sso-landing"
                      />
                      <TitledRoute
                        name="forgotPassword"
                        path="/forgot-password"
                        component={<ForgotPasswordCtrl stripes={stripes} />}
                      />
                      <TitledRoute
                        name="forgotUsername"
                        path="/forgot-username"
                        component={<ForgotUserNameCtrl stripes={stripes} />}
                      />
                      <TitledRoute
                        name="checkEmail"
                        path="/check-email"
                        component={<CheckEmailStatusPage />}
                      />
                      <TitledRoute
                        name="login"
                        component={
                          <Login
                            autoLogin={stripes.config.autoLogin}
                            stripes={stripes}
                          />
                        }
                      />
                    </Switch>
                  }
                </Router>
              </Provider>
            </HotKeys>
          </TitleManager>
        </ModuleTranslator>
      </StripesContext.Provider>
    );
  }
}

export default RootWithIntl;

@@ -743,50 +743,8 @@
 s';%0A
-import %7B stripesShape %7D from './Stripes';%0A
 impo
@@ -876,20 +876,146 @@
 es: 
-stripesS
+PropTypes.s
 hape
+(%7B%0A      epics: PropTypes.object,%0A      logger: PropTypes.object.isRequired,%0A      clone: PropTypes.func.isRequired,%0A    %7D)
 .isR

Replace use of stripesShape with explicit propTypes list