115 lines
3.7 KiB
JavaScript
115 lines
3.7 KiB
JavaScript
import * as Sentry from "@sentry/react";
|
|
import Dinero from "dinero.js";
|
|
import React from "react";
|
|
import ReactDOM from "react-dom/client";
|
|
import { Provider } from "react-redux";
|
|
import {createBrowserRouter, createRoutesFromElements, Route, RouterProvider} from "react-router-dom";
|
|
import { PersistGate } from "redux-persist/integration/react";
|
|
import AppContainer from "./App/App.container";
|
|
import LoadingSpinner from "./components/loading-spinner/loading-spinner.component";
|
|
import "./index.css";
|
|
import { persistor, store } from "./redux/store";
|
|
import reportWebVitals from "./reportWebVitals";
|
|
import "./translations/i18n";
|
|
import "./utils/CleanAxios";
|
|
import { ConfigProvider } from "antd";
|
|
//import { BrowserTracing } from "@sentry/tracing";
|
|
//import "antd/dist/antd.css";
|
|
// import "antd/dist/antd.less";
|
|
|
|
// Dinero.defaultCurrency = "CAD";
|
|
// Dinero.globalLocale = "en-CA";
|
|
Dinero.globalRoundingMode = "HALF_EVEN";
|
|
|
|
if (process.env.NODE_ENV !== "development") {
|
|
Sentry.init({
|
|
dsn: "https://fd7e89369b6b4bdc9c6c4c9f22fa4ee4@o492140.ingest.sentry.io/5651027",
|
|
ignoreErrors: [
|
|
|
|
],
|
|
integrations: [
|
|
// new BrowserTracing(),
|
|
// new Sentry.Integrations.Breadcrumbs({ console: true }),
|
|
// new Sentry.Replay(),
|
|
],
|
|
// This sets the sample rate to be 10%. You may want this to be 100% while
|
|
// in development and sample at a lower rate in production
|
|
// replaysSessionSampleRate: 0.1,
|
|
// // If the entire session is not sampled, use the below sample rate to sample
|
|
// // sessions when an error occurs.
|
|
// replaysOnErrorSampleRate: 1.0,
|
|
environment: process.env.NODE_ENV,
|
|
// tracesSampleRate: 0.2,
|
|
// We recommend adjusting this value in production, or using tracesSampler
|
|
// for finer control
|
|
// tracesSampleRate: 0.5,
|
|
});
|
|
}
|
|
|
|
const router = createBrowserRouter(
|
|
createRoutesFromElements(
|
|
<Route path="*" element={<AppContainer />} />
|
|
)
|
|
);
|
|
|
|
function App() {
|
|
return (
|
|
<PersistGate loading={<LoadingSpinner message="Restoring your settings..." />} persistor={persistor}>
|
|
<Provider store={store}>
|
|
<RouterProvider router={router} />
|
|
</Provider>
|
|
</PersistGate>
|
|
);
|
|
}
|
|
|
|
// Used for ANTD Component Tokens
|
|
// https://ant.design/docs/react/migrate-less-variables
|
|
ReactDOM.createRoot(document.getElementById('root')).render(
|
|
<ConfigProvider>
|
|
<App />
|
|
</ConfigProvider>
|
|
);
|
|
|
|
|
|
// const onServiceWorkerUpdate = (registration) => {
|
|
// console.log("onServiceWorkerUpdate", registration);
|
|
|
|
// const btn = (
|
|
// <Space flex>
|
|
// <Button
|
|
// onClick={async () => {
|
|
// window.open("https://imex-online.noticeable.news/", "_blank");
|
|
// }}
|
|
// >
|
|
// {i18n.t("general.actions.viewreleasenotes")}
|
|
// </Button>
|
|
// <Button
|
|
// type="primary"
|
|
// onClick={async () => {
|
|
// if (registration && registration.waiting) {
|
|
// await registration.unregister();
|
|
// // Makes Workbox call skipWaiting()
|
|
// registration.waiting.postMessage({ type: "SKIP_WAITING" });
|
|
// // Once the service worker is unregistered, we can reload the page to let
|
|
// // the browser download a fresh copy of our app (invalidating the cache)
|
|
// window.location.reload();
|
|
// }
|
|
// }}
|
|
// >
|
|
// {i18n.t("general.actions.refresh")}
|
|
// </Button>
|
|
// </Space>
|
|
// );
|
|
// notification.open({
|
|
// icon: <AlertOutlined />,
|
|
// message: i18n.t("general.messages.newversiontitle"),
|
|
// description: i18n.t("general.messages.newversionmessage"),
|
|
// duration: 0,
|
|
// btn,
|
|
// key: "updateavailable",
|
|
// });
|
|
// };
|
|
|
|
// serviceWorkerRegistration.register({ onUpdate: onServiceWorkerUpdate });
|
|
reportWebVitals();
|