diff --git a/package.json b/package.json index 31b27d89..77227aaa 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,8 @@ "i18next-browser-languagedetector": "^2.2.4", "identicon.js": "^2.3.3", "lodash": "^4.17.11", + "logrocket": "^1.0.1", + "logrocket-react": "^3.0.0", "merge": "^1.2.1", "moment": "^2.23.0", "number-to-bn": "^1.7.0", diff --git a/src/index.js b/src/index.js index b9b83eed..100c1d21 100644 --- a/src/index.js +++ b/src/index.js @@ -6,6 +6,9 @@ import { I18nextProvider } from 'react-i18next'; import i18n from './js/i18n'; import { PersistGate } from 'redux-persist/integration/react'; +import LogRocket from 'logrocket'; +import setupLogRocketReact from 'logrocket-react'; + import './css/fonts/Inter/inter.css'; import './css/bootstrap-overrides.scss'; import './index.scss'; @@ -15,6 +18,11 @@ import App from './js/layout/App'; import history from './js/history'; import {store, persistor} from './js/store'; +if (!process || !process.env || process.env.NODE_ENV !== 'development') { + LogRocket.init('lqnuu9/teller-network'); + setupLogRocketReact(LogRocket); +} + ReactDOM.render( diff --git a/src/js/store.js b/src/js/store.js index e90b28a1..a8be974d 100644 --- a/src/js/store.js +++ b/src/js/store.js @@ -1,3 +1,4 @@ +import LogRocket from 'logrocket'; import { applyMiddleware, compose, createStore } from 'redux'; import { connectRouter, routerMiddleware } from 'connected-react-router'; import createSagaMiddleware from 'redux-saga'; @@ -18,6 +19,17 @@ import arbitration from './features/arbitration'; import metadata from './features/metadata'; import approval from './features/approval'; +const emptyMiddleWare = store => next => action => { + next(action); +} + +function getLogrocket() { + if (!process || !process.env || process.env.NODE_ENV !== 'development') { + return LogRocket.reduxMiddleware(); + } + return emptyMiddleWare; +} + const persistConfig = { key: 'teller-network-store', storage, @@ -47,7 +59,8 @@ const store = createStore( composeEnhancers( applyMiddleware( routerMiddleware(history), - sagaMiddleware + sagaMiddleware, + getLogrocket() ), ), ); diff --git a/yarn.lock b/yarn.lock index 1807f8a5..87235c61 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11886,6 +11886,16 @@ loglevel@^1.4.1: resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.1.tgz#e0fc95133b6ef276cdc8887cdaf24aa6f156f8fa" integrity sha1-4PyVEztu8nbNyIh82vJKpvFW+Po= +logrocket-react@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/logrocket-react/-/logrocket-react-3.0.0.tgz#b0e1bfa4de25ae89c5da890fbb1c18276a1ac82f" + integrity sha512-vjx2MkFfvKDVilGuHBUuBPyr2en3tvd7bd9rozwEeYELk/DNL5z7Aqoqaz7DLlIhJndOG7/wIv873OdupySiRQ== + +logrocket@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/logrocket/-/logrocket-1.0.1.tgz#0555ec619d2db54a7b345c4e8df09baea835b176" + integrity sha512-oPA0c5GzMKsWp/6p19OaujZQMzttluqVOI+989uHeciPAljPZvGEpZRbNO3Rr+jC/8jVLJdlMP9IHuyhKsASGA== + looper@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/looper/-/looper-2.0.0.tgz#66cd0c774af3d4fedac53794f742db56da8f09ec"