2020-01-05 15:10:42 +01:00
|
|
|
import React from "react";
|
|
|
|
import ReactDOM from "react-dom";
|
2020-03-31 09:37:51 +01:00
|
|
|
import * as Sentry from "@sentry/browser";
|
2020-04-07 15:54:49 +02:00
|
|
|
import * as SentryIntegrations from "@sentry/integrations";
|
2020-03-07 10:20:38 -05:00
|
|
|
import { TopErrorBoundary } from "./components/TopErrorBoundary";
|
|
|
|
import { IsMobileProvider } from "./is-mobile";
|
2020-04-12 16:24:52 +05:30
|
|
|
import App from "./components/App";
|
2020-01-09 00:06:25 +05:00
|
|
|
import "./styles.scss";
|
2020-01-05 15:10:42 +01:00
|
|
|
|
2020-04-11 13:37:43 +02:00
|
|
|
const SentryEnvHostnameMap: { [key: string]: string } = {
|
2020-03-31 09:37:51 +01:00
|
|
|
"excalidraw.com": "production",
|
|
|
|
"now.sh": "staging",
|
|
|
|
};
|
|
|
|
|
2020-04-11 13:37:43 +02:00
|
|
|
const onlineEnv = Object.keys(SentryEnvHostnameMap).find(
|
2020-03-31 09:37:51 +01:00
|
|
|
(item) => window.location.hostname.indexOf(item) >= 0,
|
|
|
|
);
|
|
|
|
|
|
|
|
Sentry.init({
|
|
|
|
// Disable Sentry locally to avoid noise
|
|
|
|
dsn: onlineEnv
|
|
|
|
? "https://7bfc596a5bf945eda6b660d3015a5460@sentry.io/5179260"
|
|
|
|
: undefined,
|
2020-04-11 13:37:43 +02:00
|
|
|
environment: onlineEnv ? SentryEnvHostnameMap[onlineEnv] : undefined,
|
2020-03-31 09:37:51 +01:00
|
|
|
release: process.env.REACT_APP_GIT_SHA,
|
2020-04-07 15:54:49 +02:00
|
|
|
integrations: [
|
|
|
|
new SentryIntegrations.CaptureConsole({
|
|
|
|
levels: ["error"],
|
|
|
|
}),
|
|
|
|
],
|
2020-03-31 09:37:51 +01:00
|
|
|
});
|
|
|
|
|
2020-02-20 18:44:38 -05:00
|
|
|
// Block pinch-zooming on iOS outside of the content area
|
|
|
|
document.addEventListener(
|
|
|
|
"touchmove",
|
2020-03-23 13:05:07 +02:00
|
|
|
function (event) {
|
2020-02-20 18:44:38 -05:00
|
|
|
// @ts-ignore
|
|
|
|
if (event.scale !== 1) {
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ passive: false },
|
|
|
|
);
|
|
|
|
|
2020-01-05 15:10:42 +01:00
|
|
|
const rootElement = document.getElementById("root");
|
2020-01-21 15:50:25 +01:00
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
<TopErrorBoundary>
|
2020-02-20 18:44:38 -05:00
|
|
|
<IsMobileProvider>
|
|
|
|
<App />
|
|
|
|
</IsMobileProvider>
|
2020-01-21 15:50:25 +01:00
|
|
|
</TopErrorBoundary>,
|
2020-01-24 12:04:54 +02:00
|
|
|
rootElement,
|
2020-01-21 15:50:25 +01:00
|
|
|
);
|