{"size": 1383, "ext": "js", "max_stars_repo_path": "src/bebo-react.js", "max_stars_repo_name": "bebo/bebo-react", "max_stars_repo_stars_event_min_datetime": "2018-06-10T06:02:52.000Z", "max_stars_repo_stars_event_max_datetime": "2018-06-10T06:02:52.000Z", "max_issues_repo_path": "src/bebo-react.js", "max_issues_repo_name": "bebo/bebo-react", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/bebo-react.js", "max_forks_repo_name": "bebo/bebo-react", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.0943396226, "max_line_length": 77, "alphanum_fraction": 0.6717281273}
/**
 * Created by jonas on 9/13/16.
 */
import React from 'react';
import ReactDOM from 'react-dom';
import hoistStatics from 'hoist-non-react-statics'

function getDisplayName(WrappedComponent) {
  return WrappedComponent.displayName || WrappedComponent.name || 'Component'
}

export function withBebo(WrappedComponent) {
  const WithBebo = React.createClass({
    render() {
      // eslint-disable-next-line
      if(Bebo) {
        // eslint-disable-next-line
        return <WrappedComponent {...this.props} bebo={Bebo} Bebo={Bebo} />
      }
      return console.error('Bebo is not defined yet...');


    }
  });

  WithBebo.displayName = `withBebo(${getDisplayName(WrappedComponent)})`;
  WithBebo.WrappedComponent = WrappedComponent;

  return hoistStatics(WithBebo, WrappedComponent)
}

export default new class BeboDOM {
  constructor (){
    // eslint-disable-next-line
    this.bebo = Bebo;
  }

  render(component, element, beboOptions) {
    this.bebo.onReady(() => {
      const { disableKeyboardDoneStrip, disableAudio  } = beboOptions;
    if(disableKeyboardDoneStrip) {
      // eslint-disable-next-line
      Bebo.UI.disableKeyboardDoneStrip();
    }
      // eslint-disable-next-line
    if(disableAudio && Bebo.Audio && Bebo.Audio.disable) {
      // eslint-disable-next-line
      Bebo.Audio.disable();
    }
    ReactDOM.render(component, element);
  })
  }
}