react-optimize
Advanced tools
Comparing version 2.2.1 to 2.2.2
@@ -107,3 +107,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
"use strict"; | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ \"prop-types\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _OptimizeContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./OptimizeContext */ \"./src/OptimizeContext.js\");\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\nvar Experiment =\n/*#__PURE__*/\nfunction (_React$Component) {\n _inherits(Experiment, _React$Component);\n\n function Experiment() {\n var _getPrototypeOf2;\n\n var _this;\n\n _classCallCheck(this, Experiment);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Experiment)).call.apply(_getPrototypeOf2, [this].concat(args)));\n\n _defineProperty(_assertThisInitialized(_this), \"state\", {\n variant: null\n });\n\n _defineProperty(_assertThisInitialized(_this), \"updateVariantTimeout\", null);\n\n _defineProperty(_assertThisInitialized(_this), \"updateVariant\", function (value) {\n clearTimeout(_this.updateVariantTimeout); // if experiment not active, render original\n\n var newVariant = value === undefined || value === null ? \"0\" : value;\n\n if (newVariant !== _this.state.variant) {\n _this.setState({\n variant: newVariant\n });\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"updateVariantFromGlobalState\", function () {\n var value = typeof window !== \"undefined\" && window.google_optimize ? window.google_optimize.get(_this.props.id) : null;\n\n _this.updateVariant(value);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"setupOptimizeCallback\", function () {\n _this.updateVariantTimeout = setTimeout(_this.updateVariantFromGlobalState, _this.props.timeout);\n var oldHideEnd = window.dataLayer.hide.end;\n\n window.dataLayer.hide.end = function () {\n _this.updateVariantFromGlobalState();\n\n oldHideEnd && oldHideEnd();\n };\n\n window.gtag && window.gtag(\"event\", \"optimize.callback\", {\n name: _this.props.id,\n callback: _this.updateVariant\n });\n });\n\n return _this;\n }\n\n _createClass(Experiment, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n if (!this.props.id) {\n throw new Error(\"Please specify the experiment id\");\n } // Delayed init\n\n\n if (typeof window !== \"undefined\" && !window.google_optimize) {\n if (!window.dataLayer) {\n window.dataLayer = [];\n }\n\n if (!window.dataLayer.hide) {\n window.dataLayer.hide = {\n start: Date.now()\n };\n }\n\n this.setupOptimizeCallback();\n } else {\n // Google Optimize already loaded, or we're doing server-side rendering\n this.updateVariantFromGlobalState();\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n typeof window !== \"undefined\" && window.gtag && window.gtag(\"event\", \"optimize.callback\", {\n name: this.props.id,\n callback: this.updateVariant,\n remove: true\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_OptimizeContext__WEBPACK_IMPORTED_MODULE_2__[\"default\"].Provider, {\n value: this.state.variant\n }, this.state.variant === null ? this.props.loader : this.props.children);\n }\n }]);\n\n return Experiment;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);\n\n_defineProperty(Experiment, \"defaultProps\", {\n loader: null,\n timeout: 3000\n});\n\n_defineProperty(Experiment, \"propTypes\", {\n id: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string.isRequired,\n loader: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.node,\n timeout: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.number,\n children: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.node\n});\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Experiment);\n\n//# sourceURL=webpack://react-optimize/./src/Experiment.js?"); | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ \"prop-types\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _OptimizeContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./OptimizeContext */ \"./src/OptimizeContext.js\");\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\nvar Experiment =\n/*#__PURE__*/\nfunction (_React$Component) {\n _inherits(Experiment, _React$Component);\n\n function Experiment() {\n var _getPrototypeOf2;\n\n var _this;\n\n _classCallCheck(this, Experiment);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Experiment)).call.apply(_getPrototypeOf2, [this].concat(args)));\n\n _defineProperty(_assertThisInitialized(_this), \"state\", {\n variant: null\n });\n\n _defineProperty(_assertThisInitialized(_this), \"updateVariantTimeout\", null);\n\n _defineProperty(_assertThisInitialized(_this), \"updateVariant\", function (value) {\n clearTimeout(_this.updateVariantTimeout); // if experiment not active, render original\n\n var newVariant = value === undefined || value === null ? \"0\" : value;\n\n if (newVariant !== _this.state.variant) {\n _this.setState({\n variant: newVariant\n });\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"updateVariantFromGlobalState\", function () {\n var value = typeof window !== \"undefined\" && window.google_optimize ? window.google_optimize.get(_this.props.id) : null;\n\n _this.updateVariant(value);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"setupOptimizeCallback\", function () {\n _this.updateVariantTimeout = setTimeout(_this.updateVariantFromGlobalState, _this.props.timeout);\n var oldHideEnd = window.dataLayer.hide.end;\n\n window.dataLayer.hide.end = function () {\n _this.updateVariantFromGlobalState();\n\n oldHideEnd && oldHideEnd();\n };\n\n window.gtag && window.gtag(\"event\", \"optimize.callback\", {\n name: _this.props.id,\n callback: _this.updateVariant\n });\n });\n\n return _this;\n }\n\n _createClass(Experiment, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n if (!this.props.id) {\n throw new Error(\"Please specify the experiment id\");\n } // Delayed init\n\n\n if (typeof window !== \"undefined\" && !window.google_optimize) {\n if (!window.dataLayer) {\n window.dataLayer = [];\n }\n\n if (!window.dataLayer.hide) {\n window.dataLayer.hide = {\n start: Date.now()\n };\n }\n\n this.setupOptimizeCallback();\n } else {\n // Google Optimize already loaded, or we're doing server-side rendering\n this.updateVariantFromGlobalState();\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n clearTimeout(this.updateVariantTimeout);\n typeof window !== \"undefined\" && window.gtag && window.gtag(\"event\", \"optimize.callback\", {\n name: this.props.id,\n callback: this.updateVariant,\n remove: true\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_OptimizeContext__WEBPACK_IMPORTED_MODULE_2__[\"default\"].Provider, {\n value: this.state.variant\n }, this.state.variant === null ? this.props.loader : this.props.children);\n }\n }]);\n\n return Experiment;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);\n\n_defineProperty(Experiment, \"defaultProps\", {\n loader: null,\n timeout: 3000\n});\n\n_defineProperty(Experiment, \"propTypes\", {\n id: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string.isRequired,\n loader: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.node,\n timeout: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.number,\n children: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.node\n});\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Experiment);\n\n//# sourceURL=webpack://react-optimize/./src/Experiment.js?"); | ||
@@ -110,0 +110,0 @@ /***/ }), |
{ | ||
"name": "react-optimize", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"main": "lib/react-optimize.js", | ||
@@ -55,7 +55,7 @@ "repository": "hudovisk/react-optimize", | ||
"mocha": "^7.0.1", | ||
"prettier": "^1.19.1", | ||
"prettier": "^2.0.0", | ||
"react": "^16.8.6", | ||
"react-dom": "^16.8.6", | ||
"semantic-release": "^17.0.0", | ||
"sinon": "^8.0.2", | ||
"sinon": "^9.0.0", | ||
"webpack": "^4.25.1", | ||
@@ -62,0 +62,0 @@ "webpack-cli": "^3.1.2" |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
25046
192