Added sentry logging.
This commit is contained in:
@@ -4,7 +4,7 @@ import "firebase/auth";
|
||||
import "firebase/database";
|
||||
import "firebase/firestore";
|
||||
import "firebase/messaging";
|
||||
//import { store } from "../redux/store";
|
||||
import { store } from "../redux/store";
|
||||
|
||||
const config = JSON.parse(process.env.REACT_APP_FIREBASE_CONFIG);
|
||||
firebase.initializeApp(config);
|
||||
@@ -48,16 +48,17 @@ try {
|
||||
export { messaging };
|
||||
|
||||
export const logImEXEvent = (eventName, additionalParams, stateProp = null) => {
|
||||
// const state = stateProp || store.getState();
|
||||
const state = stateProp || store.getState();
|
||||
const eventParams = {
|
||||
// shop:
|
||||
// (state.user && state.user.bodyshop && state.user.bodyshop.shopname) ||
|
||||
// null,
|
||||
// user:
|
||||
// (state.user && state.user.currentUser && state.user.currentUser.email) ||
|
||||
// null,
|
||||
shop:
|
||||
(state.user && state.user.bodyshop && state.user.bodyshop.shopname) ||
|
||||
null,
|
||||
user:
|
||||
(state.user && state.user.currentUser && state.user.currentUser.email) ||
|
||||
null,
|
||||
...additionalParams,
|
||||
};
|
||||
console.log("%c[Analytics]", "background: tomato", eventName, eventParams);
|
||||
analytics.logEvent(eventName, eventParams);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { AlertOutlined } from "@ant-design/icons";
|
||||
import * as Sentry from "@sentry/react";
|
||||
import { Integrations } from "@sentry/tracing";
|
||||
import { Button, notification } from "antd";
|
||||
import Dinero from "dinero.js";
|
||||
import i18n from "i18next";
|
||||
@@ -21,6 +23,17 @@ Dinero.defaultCurrency = "CAD";
|
||||
Dinero.globalLocale = "en-CA";
|
||||
Dinero.globalRoundingMode = "HALF_UP";
|
||||
|
||||
Sentry.init({
|
||||
dsn:
|
||||
"https://fd7e89369b6b4bdc9c6c4c9f22fa4ee4@o492140.ingest.sentry.io/5651027",
|
||||
integrations: [new Integrations.BrowserTracing()],
|
||||
environment: process.env || "development",
|
||||
|
||||
// We recommend adjusting this value in production, or using tracesSampler
|
||||
// for finer control
|
||||
tracesSampleRate: 0.5,
|
||||
});
|
||||
|
||||
ReactDOM.render(
|
||||
<Provider store={store}>
|
||||
<BrowserRouter>
|
||||
|
||||
@@ -2,6 +2,7 @@ import Fingerprint2 from "@fingerprintjs/fingerprintjs";
|
||||
import LogRocket from "logrocket";
|
||||
import { all, call, delay, put, select, takeLatest } from "redux-saga/effects";
|
||||
import {
|
||||
analytics,
|
||||
auth,
|
||||
firestore,
|
||||
getCurrentUser,
|
||||
@@ -160,6 +161,8 @@ export function* signInSuccessSaga({ payload }) {
|
||||
LogRocket.identify(payload.email);
|
||||
|
||||
if (!payload.email.includes("@imex.")) yield put(setInstanceId(payload.uid));
|
||||
analytics.setUserId(payload.email);
|
||||
analytics.setUserProperties(payload);
|
||||
yield logImEXEvent("redux_sign_in_success");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user