import React from 'react';
import ReactDOM from 'react-dom';
import FastClick from 'fastclick';

import setup from './entrance/setup';

var bizConfig = {};
var exclusivePath = {};
var globalConfig = {};
var bizLayoutConfig = {};
const mx = {
  initComponent: props => {
    const { homePage, biz_config, exclusive_path, config, biz_layout_config } = props;
    bizConfig = biz_config;
    exclusivePath = exclusive_path;
    globalConfig = config;
    bizLayoutConfig = biz_layout_config;
    const AppContainer = setup(props);
    ReactDOM.render(
      <AppContainer />, // eslint-disable-line
      document.getElementById('root')
    );
    // Eliminates the 300ms delay between a physical tap
    // and the firing of a click event on mobile browsers
    // https://github.com/ftlabs/fastclick
    FastClick.attach(document.body);

    if (module.hot) {
      module.hot.accept();
    }
  },
};
export default mx;

export function getBizConfig() {
  return bizConfig;
}

export function getExclusivePath() {
  return exclusivePath;
}

export function getGlobalConfig() {
  return globalConfig;
}

export function getBizLayoutConfig() {
  return bizLayoutConfig;
}

import './utils/smoothscroll'; // eslint-disable-line import/imports-first
import './utils/iconfont';

