1
0
mirror of https://github.com/uetchy/namae.git synced 2025-10-15 07:32:19 +09:00

feat: add crisp (#7)

* feat: add crisp

* test: add codacy

* fix: coverage
This commit is contained in:
2019-10-24 12:55:09 +09:00
committed by GitHub
parent 664801205c
commit 2fc4d94779
11 changed files with 706 additions and 7 deletions

View File

@@ -7,7 +7,7 @@
"now-build": "yarn build",
"now-dev": "NODE_ENV=development BROWSER=none react-scripts start",
"start": "NODE_ENV=development react-scripts start",
"test": "react-scripts test"
"test": "react-scripts test --coverage"
},
"dependencies": {
"@sentry/browser": "^5.6.3",

View File

@@ -1,13 +1,16 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import * as serviceWorker from './serviceWorker';
import {FullScreenSuspense} from './util/suspense';
import {initGA, initSentry} from './util/analytics';
import {initCrisp} from './util/crip';
import './util/i18n';
initGA();
initSentry();
initCrisp();
ReactDOM.render(
<FullScreenSuspense>

14
web/src/util/crip.ts Normal file
View File

@@ -0,0 +1,14 @@
interface CrispWindow extends Window {
$crisp: any[];
CRISP_WEBSITE_ID: string;
}
declare var window: CrispWindow;
export function initCrisp() {
window.$crisp = [];
window.CRISP_WEBSITE_ID = '92b2e096-6892-47dc-bf4a-057bad52d82e';
const s = document.createElement('script');
s.src = 'https://client.crisp.chat/l.js';
s.async = true;
document.getElementsByTagName('head')[0].appendChild(s);
}

View File

@@ -2,7 +2,6 @@
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
@@ -13,7 +12,8 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
"jsx": "react",
"allowJs": true
},
"include": ["src"]
}