logrocket-react
Advanced tools
Comparing version 4.0.1 to 5.0.0
@@ -10,41 +10,31 @@ 'use strict'; | ||
var injectEventPluginsByName = void 0; | ||
// from https://github.com/facebook/react/blob/v16.5.1/packages/react-dom/src/client/ReactDOM.js#L750 | ||
var getInstanceFromNode = void 0; | ||
var secret = _reactDom.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
if (secret && secret.Events && secret.Events[3]) { | ||
injectEventPluginsByName = secret.Events[3]; | ||
if (secret && secret.Events && secret.Events[0]) { | ||
getInstanceFromNode = secret.Events[0]; | ||
} else { | ||
injectEventPluginsByName = function injectEventPluginsByName() { | ||
console.warn('logrocket-react does not work with this version of React'); | ||
}; | ||
console.warn('logrocket-react does not work with this version of React'); | ||
} | ||
function setupReact() { | ||
injectEventPluginsByName({ | ||
ResponderEventPlugin: { | ||
extractEvents: function logRocketReactEventHook(topLevelType, targetInst, fiberNode, nativeEvent) { | ||
try { | ||
if (topLevelType !== 'click' || !fiberNode || !nativeEvent) { | ||
return; | ||
} | ||
var currentElement = fiberNode; | ||
var names = []; | ||
while (currentElement) { | ||
var name = typeof currentElement.elementType === 'function' && currentElement.elementType.displayName; | ||
if (name) { | ||
names.push(name); | ||
} | ||
currentElement = currentElement.return; | ||
} | ||
// eslint-disable-next-line no-param-reassign | ||
nativeEvent.__lrName = names; | ||
} catch (error) { | ||
console.error('logrocket-react caught an error while hooking into React. Please make sure you are using the correct version of logrocket-react for your version of react-dom.'); | ||
var listener = function listener(event) { | ||
try { | ||
var fiberNode = getInstanceFromNode(event.target); | ||
var names = []; | ||
var currentElement = fiberNode; | ||
while (currentElement) { | ||
var name = typeof currentElement.elementType === 'function' && currentElement.elementType.displayName; | ||
if (name) { | ||
names.push(name); | ||
} | ||
currentElement = currentElement.return; | ||
} | ||
event.__lrName = names; | ||
} catch (err) { | ||
console.error('logrocket-react caught an error while hooking into React. Please make sure you are using the correct version of logrocket-react for your version of react-dom.'); | ||
} | ||
}); | ||
}; | ||
document.body.addEventListener('click', listener, { capture: true, passive: true }); | ||
} | ||
module.exports = exports['default']; |
{ | ||
"name": "logrocket-react", | ||
"version": "4.0.1", | ||
"version": "5.0.0", | ||
"description": "React library for [LogRocket](https://logrocket.com/).", | ||
@@ -20,4 +20,4 @@ "main": "dist/index.js", | ||
"test": "node_modules/.bin/karma start", | ||
"test:16.10": "npm run react:clean && npm i react@16.10 react-dom@16.10 --no-save && npm test", | ||
"test:all": "DEV=true npm run test:16.10", | ||
"test:17": "npm run react:clean && npm i react@17.0 react-dom@17.0 --no-save && npm test", | ||
"test:all": "DEV=true npm run test:17", | ||
"prepublish": "npm run build" | ||
@@ -63,5 +63,9 @@ }, | ||
"peerDependencies": { | ||
"react": ">=16.10", | ||
"react-dom": ">=16.10" | ||
"logrocket": ">=2.0", | ||
"react": ">=17.0", | ||
"react-dom": ">=17.0" | ||
}, | ||
"dependencies": { | ||
"logrocket": "^2.1.3" | ||
} | ||
} |
@@ -12,2 +12,5 @@ # LogRocket React plugin | ||
### If using React 17 | ||
`npm i --save logrocket-react@5` | ||
### If using React 16.10 | ||
@@ -14,0 +17,0 @@ `npm i --save logrocket-react@4` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32
5608
4
33
+ Addedlogrocket@^2.1.3
+ Addedlogrocket@2.2.1(transitive)