From 5457d195f832336a365eab684d084237152b683d Mon Sep 17 00:00:00 2001 From: rawls238 Date: Tue, 18 Aug 2015 21:41:27 -0400 Subject: [PATCH] import entire Utils file --- dist/react-experiments.js | 10 +++++----- dist/react-experiments.min.js | 2 +- src/experiment.js | 4 ++-- src/namespace.js | 4 ++-- src/utils.js | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dist/react-experiments.js b/dist/react-experiments.js index f40ab5d..85019ae 100644 --- a/dist/react-experiments.js +++ b/dist/react-experiments.js @@ -92,7 +92,7 @@ return /******/ (function(modules) { // webpackBootstrap var ExperimentEnrollment = _interopRequire(__webpack_require__(3)); - var suppressAutoExposureLogging = __webpack_require__(5).suppressAutoExposureLogging; + var Utils = _interopRequire(__webpack_require__(5)); var Experiment = React.createClass({ displayName: "Experiment", @@ -135,7 +135,7 @@ return /******/ (function(modules) { // webpackBootstrap return; } - experiment = suppressAutoExposureLogging(this.props.experimentClass); + experiment = Utils.suppressAutoExposureLogging(this.props.experimentClass); this.setState({ exposedVariation: experiment.get(param) }); @@ -220,7 +220,7 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; module.exports = { - suppressExposureLogging: function suppressExposureLogging(experimentClass) { + suppressAutoExposureLogging: function suppressAutoExposureLogging(experimentClass) { if (experimentClass.setAutoExposureLogging && typeof experimentClass.setAutoExposureLogging == "function") { experimentClass.setAutoExposureLogging(false); } @@ -246,7 +246,7 @@ return /******/ (function(modules) { // webpackBootstrap var ExperimentEnrollment = _interopRequire(__webpack_require__(3)); - var suppressAutoExposureLogging = __webpack_require__(5).suppressAutoExposureLogging; + var Utils = _interopRequire(__webpack_require__(5)); var Namespace = React.createClass({ displayName: "Namespace", @@ -268,7 +268,7 @@ return /******/ (function(modules) { // webpackBootstrap }, enrollInNamespace: function enrollInNamespace(component, child) { - var experiment = suppressAutoExposureLogging(this.props.experimentClass); + var experiment = Utils.suppressAutoExposureLogging(this.props.experimentClass); if (child.props.displayName === DEFAULT_EXPERIMENT_COMPONENT) { component.defaultComponent = child; } else if (child.props.isEnrolled) { diff --git a/dist/react-experiments.min.js b/dist/react-experiments.min.js index 6708c4e..292c307 100644 --- a/dist/react-experiments.min.js +++ b/dist/react-experiments.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactExperiments=t(require("react")):e.ReactExperiments=t(e.React)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";var n=function(e){return e&&e.__esModule?e["default"]:e},o=function(e){return e&&e.__esModule?e:{"default":e}},i=o(r(1)),s=o(r(6)),a=o(r(7)),p=n(r(8));e.exports={Experiment:i.Experiment,Namespace:s.Namespace,Variation:a.Variation,Default:a.Default,ExperimentClass:p}},function(e,t,r){"use strict";var n=function(e){return e&&e.__esModule?e["default"]:e};Object.defineProperty(t,"__esModule",{value:!0});var o=n(r(2)),i=n(r(3)),s=r(5).suppressAutoExposureLogging,a=o.createClass({displayName:"Experiment",getDefaultProps:function(){return{isEnrolled:!0}},getInitialState:function(){return{exposedVariation:null}},componentDidMount:function(){this.selectVariation()},selectVariation:function(){var e=void 0,t=this.props,r=t.param,n=t.isEnrolled;if(!this.props.experimentClass||!this.props.experimentClass.inputs)return void console.error("You must pass in an experimentClass instance as a prop");if(0===o.Children.count(this.props.children))throw"You must have at least one variation in an experiment";return n?(e=s(this.props.experimentClass),void this.setState({exposedVariation:e.get(r)})):void this.setState({exposedVariation:null})},renderExposedVariation:function(){var e=i.getExposedExperimentVariation(this.props.children,this.state.exposedVariation);return e.exposedVariation?(this.props.experimentClass.logExposure(),e.exposedVariation):e.defaultComponent?e.defaultComponent:null},render:function(){return this.renderExposedVariation()}});t.Experiment=a},function(t,r){t.exports=e},function(e,t,r){"use strict";var n=r(4).DEFAULT_EXPERIMENT_COMPONENT;e.exports={enrollInExperiment:function(e,t,r){return r&&t.props.name===r?e.exposedVariation=t:t.props.displayName===n&&(e.defaultComponent=t),e},getExposedExperimentVariation:function(e,t){var r=this;return e.reduce?e.reduce(function(e,n){return e.exposedVariation?e:r.enrollInExperiment(e,n,t)},{}):this.enrollInExperiment({},e,t)}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="DEFAULT";t.DEFAULT_EXPERIMENT_COMPONENT=r},function(e,t){"use strict";e.exports={suppressExposureLogging:function(e){return e.setAutoExposureLogging&&"function"==typeof e.setAutoExposureLogging&&e.setAutoExposureLogging(!1),e}}},function(e,t,r){"use strict";var n=function(e){return e&&e.__esModule?e["default"]:e};Object.defineProperty(t,"__esModule",{value:!0});var o=n(r(2)),i=r(4).DEFAULT_EXPERIMENT_COMPONENT,s=n(r(3)),a=r(5).suppressAutoExposureLogging,p=o.createClass({displayName:"Namespace",getEnrolledExperiment:function(){var e=this;return this.props.children.reduce?this.props.children.reduce(function(t,r){return t.exposedExperiment?t:e.enrollInNamespace(t,r)},{}):this.enrollInNamespace({},this.props.children)},enrollInNamespace:function(e,t){var r=a(this.props.experimentClass);if(t.props.displayName===i)e.defaultComponent=t;else if(t.props.isEnrolled){var n=r.get(t.props.param);n&&s.getExposedExperimentVariation(t.props.children,n).exposedVariation&&(e.exposedExperiment=t)}return e},renderEnrolledExperiment:function(){var e=this.getEnrolledExperiment();return e.exposedExperiment?o.createElement(Experiment,{experimentClass:this.props.experimentClass,param:e.exposedExperiment.props.param},e.exposedExperiment.props.children):e.defaultComponent},render:function(){return o.createElement("span",null,this.renderEnrolledExperiment())}});t.Namespace=p},function(e,t,r){"use strict";var n=function(e){return e&&e.__esModule?e["default"]:e};Object.defineProperty(t,"__esModule",{value:!0});var o=n(r(2)),i=r(4).DEFAULT_EXPERIMENT_COMPONENT,s=o.createClass({displayName:"Variation",render:function(){return o.createElement("span",null,this.props.children)}});t.Variation=s;var a=o.createClass({displayName:"Default",getDefaultProps:function(){return{displayName:i}},render:function(){return o.createElement("span",null,this.props.children)}});t.Default=a},function(e,t){"use strict";var r=function(){function e(e,t){for(var r in t){var n=t[r];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(e,t)}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),n=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},o=function(){function e(){n(this,e)}return r(e,{get:{value:function(e){throw"IMPLEMENT get"}},logExposure:{value:function(e){throw"IMPLEMENT logExposure"}},getName:{value:function(){throw"IMPLEMENT getName"}}}),e}();e.exports=o}])}); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactExperiments=t(require("react")):e.ReactExperiments=t(e.React)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";var n=function(e){return e&&e.__esModule?e["default"]:e},o=function(e){return e&&e.__esModule?e:{"default":e}},i=o(r(1)),s=o(r(6)),a=o(r(7)),p=n(r(8));e.exports={Experiment:i.Experiment,Namespace:s.Namespace,Variation:a.Variation,Default:a.Default,ExperimentClass:p}},function(e,t,r){"use strict";var n=function(e){return e&&e.__esModule?e["default"]:e};Object.defineProperty(t,"__esModule",{value:!0});var o=n(r(2)),i=n(r(3)),s=n(r(5)),a=o.createClass({displayName:"Experiment",getDefaultProps:function(){return{isEnrolled:!0}},getInitialState:function(){return{exposedVariation:null}},componentDidMount:function(){this.selectVariation()},selectVariation:function(){var e=void 0,t=this.props,r=t.param,n=t.isEnrolled;if(!this.props.experimentClass||!this.props.experimentClass.inputs)return void console.error("You must pass in an experimentClass instance as a prop");if(0===o.Children.count(this.props.children))throw"You must have at least one variation in an experiment";return n?(e=s.suppressAutoExposureLogging(this.props.experimentClass),void this.setState({exposedVariation:e.get(r)})):void this.setState({exposedVariation:null})},renderExposedVariation:function(){var e=i.getExposedExperimentVariation(this.props.children,this.state.exposedVariation);return e.exposedVariation?(this.props.experimentClass.logExposure(),e.exposedVariation):e.defaultComponent?e.defaultComponent:null},render:function(){return this.renderExposedVariation()}});t.Experiment=a},function(t,r){t.exports=e},function(e,t,r){"use strict";var n=r(4).DEFAULT_EXPERIMENT_COMPONENT;e.exports={enrollInExperiment:function(e,t,r){return r&&t.props.name===r?e.exposedVariation=t:t.props.displayName===n&&(e.defaultComponent=t),e},getExposedExperimentVariation:function(e,t){var r=this;return e.reduce?e.reduce(function(e,n){return e.exposedVariation?e:r.enrollInExperiment(e,n,t)},{}):this.enrollInExperiment({},e,t)}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="DEFAULT";t.DEFAULT_EXPERIMENT_COMPONENT=r},function(e,t){"use strict";e.exports={suppressAutoExposureLogging:function(e){return e.setAutoExposureLogging&&"function"==typeof e.setAutoExposureLogging&&e.setAutoExposureLogging(!1),e}}},function(e,t,r){"use strict";var n=function(e){return e&&e.__esModule?e["default"]:e};Object.defineProperty(t,"__esModule",{value:!0});var o=n(r(2)),i=r(4).DEFAULT_EXPERIMENT_COMPONENT,s=n(r(3)),a=n(r(5)),p=o.createClass({displayName:"Namespace",getEnrolledExperiment:function(){var e=this;return this.props.children.reduce?this.props.children.reduce(function(t,r){return t.exposedExperiment?t:e.enrollInNamespace(t,r)},{}):this.enrollInNamespace({},this.props.children)},enrollInNamespace:function(e,t){var r=a.suppressAutoExposureLogging(this.props.experimentClass);if(t.props.displayName===i)e.defaultComponent=t;else if(t.props.isEnrolled){var n=r.get(t.props.param);n&&s.getExposedExperimentVariation(t.props.children,n).exposedVariation&&(e.exposedExperiment=t)}return e},renderEnrolledExperiment:function(){var e=this.getEnrolledExperiment();return e.exposedExperiment?o.createElement(Experiment,{experimentClass:this.props.experimentClass,param:e.exposedExperiment.props.param},e.exposedExperiment.props.children):e.defaultComponent},render:function(){return o.createElement("span",null,this.renderEnrolledExperiment())}});t.Namespace=p},function(e,t,r){"use strict";var n=function(e){return e&&e.__esModule?e["default"]:e};Object.defineProperty(t,"__esModule",{value:!0});var o=n(r(2)),i=r(4).DEFAULT_EXPERIMENT_COMPONENT,s=o.createClass({displayName:"Variation",render:function(){return o.createElement("span",null,this.props.children)}});t.Variation=s;var a=o.createClass({displayName:"Default",getDefaultProps:function(){return{displayName:i}},render:function(){return o.createElement("span",null,this.props.children)}});t.Default=a},function(e,t){"use strict";var r=function(){function e(e,t){for(var r in t){var n=t[r];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(e,t)}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),n=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},o=function(){function e(){n(this,e)}return r(e,{get:{value:function(e){throw"IMPLEMENT get"}},logExposure:{value:function(e){throw"IMPLEMENT logExposure"}},getName:{value:function(){throw"IMPLEMENT getName"}}}),e}();e.exports=o}])}); \ No newline at end of file diff --git a/src/experiment.js b/src/experiment.js index a1ebe94..bf2a101 100644 --- a/src/experiment.js +++ b/src/experiment.js @@ -1,6 +1,6 @@ import React from 'react'; import ExperimentEnrollment from './experimentEnrollment'; -import {suppressAutoExposureLogging} from './utils'; +import Utils from './utils'; export const Experiment = React.createClass({ getDefaultProps() { @@ -39,7 +39,7 @@ export const Experiment = React.createClass({ return; } - experiment = suppressAutoExposureLogging(this.props.experimentClass); + experiment = Utils.suppressAutoExposureLogging(this.props.experimentClass); this.setState({ exposedVariation: experiment.get(param) }); diff --git a/src/namespace.js b/src/namespace.js index c794ded..fc6b8cb 100644 --- a/src/namespace.js +++ b/src/namespace.js @@ -1,7 +1,7 @@ import React from 'react'; import {DEFAULT_EXPERIMENT_COMPONENT} from './constants'; import ExperimentEnrollment from './experimentEnrollment'; -import {suppressAutoExposureLogging} from './utils'; +import Utils from './utils'; export const Namespace = React.createClass({ getEnrolledExperiment() { @@ -19,7 +19,7 @@ export const Namespace = React.createClass({ }, enrollInNamespace(component, child) { - const experiment = suppressAutoExposureLogging(this.props.experimentClass); + const experiment = Utils.suppressAutoExposureLogging(this.props.experimentClass); if (child.props.displayName === DEFAULT_EXPERIMENT_COMPONENT) { component.defaultComponent = child; } else if (child.props.isEnrolled) { diff --git a/src/utils.js b/src/utils.js index 8a24409..538f21f 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,5 +1,5 @@ export default { - suppressExposureLogging(experimentClass) { + suppressAutoExposureLogging(experimentClass) { if (experimentClass.setAutoExposureLogging && typeof(experimentClass.setAutoExposureLogging) == "function") { experimentClass.setAutoExposureLogging(false); }