diff --git a/package.json b/package.json index 3910c8a..69476f9 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "@types/lodash": "^4.14.149", "@types/node": "^13.11.0", "@types/qs": "^6.9.0", + "@types/raygun4js": "^2.13.2", "@types/react": "16.9.11", "@types/react-beautiful-dnd": "^11.0.3", "@types/react-beforeunload": "^2.1.0", @@ -64,6 +65,7 @@ "postcss-preset-env": "6.7.0", "postcss-safe-parser": "4.0.1", "qs": "^6.9.1", + "raygun4js": "^2.18.3", "react": "^16.13.1", "react-app-polyfill": "^1.0.4", "react-beautiful-dnd": "^12.1.1", diff --git a/src/index.tsx b/src/index.tsx index dfc7c08..9f63295 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -4,16 +4,21 @@ import "./index.css"; import App from "./App"; import * as serviceWorker from "./serviceWorkerLoader"; +import raygun from "raygun4js"; + import store from "./store"; import { Provider } from "react-redux"; +raygun("apiKey", "mtj24r3YzPoYyCG8cVArA"); +raygun("enableCrashReporting", true); + function render() { - ReactDOM.render( - - - , - document.getElementById("root") - ); + ReactDOM.render( + + + , + document.getElementById("root") + ); } render(); diff --git a/src/session/state.ts b/src/session/state.ts index f8285e1..6b40000 100644 --- a/src/session/state.ts +++ b/src/session/state.ts @@ -6,6 +6,8 @@ import { AppThunk } from "../store"; import { User, getCurrentApiUser, Timeslot, getCurrentApiTimeslot, doesCurrentUserHavePermission } from "../api"; import { timestampToDateTime } from "../lib/utils"; +import raygun from "raygun4js"; + const BROADCAST_PERMISSION_ID = 340; interface sessionState { @@ -78,6 +80,11 @@ export const getUser = (): AppThunk => async dispatch => { dispatch(sessionState.actions.getUserStarting()); try { const [user, canBroadcast] = await Promise.all([ getCurrentApiUser(), doesCurrentUserHavePermission(BROADCAST_PERMISSION_ID) ]); + raygun("setUser", { + identifier: user.memberid.toString(10), + firstName: user.fname, + fullName: user.fname + " " + user.sname + }); dispatch(sessionState.actions.setCurrentUser({user, canBroadcast})); } catch (e) { console.log("failed to get user. " + e.toString()) diff --git a/yarn.lock b/yarn.lock index 71fc75b..bbb48d6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1469,6 +1469,11 @@ resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.1.tgz#937fab3194766256ee09fcd40b781740758617e7" integrity sha512-lhbQXx9HKZAPgBkISrBcmAcMpZsmpe/Cd/hY7LGZS5OfkySUBItnPZHgQPssWYUET8elF+yCFBbP1Q0RZPTdaw== +"@types/raygun4js@^2.13.2": + version "2.13.2" + resolved "https://registry.yarnpkg.com/@types/raygun4js/-/raygun4js-2.13.2.tgz#5ca323687c6a2e7e0f744d176e81ff3c3b35f28f" + integrity sha512-lcEfBC5dIoSuRT5A9JaUXD5HetgXYnFJaj3+5e9FfEer1Z2Hr7UzSMCbRbF91x86IW1IhbTpH7CpZx1LvoNOIQ== + "@types/react-beautiful-dnd@^11.0.3": version "11.0.5" resolved "https://registry.yarnpkg.com/@types/react-beautiful-dnd/-/react-beautiful-dnd-11.0.5.tgz#2f5bc733dd46da28312c8ee0c126ab7202b90247" @@ -8722,6 +8727,11 @@ raw-body@2.4.0: iconv-lite "0.4.24" unpipe "1.0.0" +raygun4js@^2.18.3: + version "2.18.3" + resolved "https://registry.yarnpkg.com/raygun4js/-/raygun4js-2.18.3.tgz#204a403dcc95d6e449d58952d0a6ade0bde2ca98" + integrity sha512-JVVAIYOqUcU9zqMhUJ34Wuh2U45ZY8E/S0v6FVieOku0boZYRMh+8jh7g/OQ8JqAXDjjMpF+GJCcdeVAXHIUeg== + react-app-polyfill@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/react-app-polyfill/-/react-app-polyfill-1.0.6.tgz#890f8d7f2842ce6073f030b117de9130a5f385f0"