<commit_before>import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {getDisplayName} from '@ciscospark/react-component-utils';

import SparkComponent from './component';

const propTypes = {
  accessToken: PropTypes.string.isRequired
};

export default function injectSpark(WrappedComponent, options = {}) {
  const {
    withRef = false
  } = options;

  class InjectSpark extends Component {
    shouldComponentUpdate(nextProps) {
      return nextProps !== this.props;
    }

    render() {
      const {accessToken} = this.props;
      return (
        <div>
          {
            accessToken
            && <SparkComponent accessToken={accessToken} {...this.props} />
          }
          <WrappedComponent
            {...this.props}
            withRef={withRef}
          />
        </div>
      );
    }
  }

  InjectSpark.propTypes = propTypes;

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

  return InjectSpark;
}<commit_msg>refactor(react-redux-spark): Move injector to enhancer pattern<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import {getDisplayName} from '@ciscospark/react-component-utils';

import SparkComponent from './component';

const propTypes = {
  accessToken: PropTypes.string.isRequired
};

export default function injectSpark() {
  return (BaseComponent) => {
    function InjectSpark(props) {
      return (
        <div>
          <SparkComponent {...props} />
          <BaseComponent {...props} />
        </div>
      );
    }
    InjectSpark.propTypes = propTypes;
    InjectSpark.displayName = `InjectSpark(${getDisplayName(BaseComponent)})`;

    return InjectSpark;
  };
}
{'fraction_non_alphanumeric': 0.12081678956324447, 'fraction_numerical': 0.0, 'mean_word_length': 2.946308724832215, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4556849', 'n_tokens_mistral': 523, 'n_tokens_neox': 516, 'n_words': 106}