Merge pull request #1148 from slumbering/fix/amplitude-dynamic-import
Use common import instead of dynamic for Amplitude-js
This commit is contained in:
commit
86821325b5
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@ -183,6 +183,7 @@ jobs:
|
|||||||
REACT_APP_AMPLITUDE_ID: 123
|
REACT_APP_AMPLITUDE_ID: 123
|
||||||
with:
|
with:
|
||||||
config: chromeWebSecurity=false
|
config: chromeWebSecurity=false
|
||||||
|
install-command: yarn install --silent
|
||||||
start: |
|
start: |
|
||||||
yarn start
|
yarn start
|
||||||
yarn start:withAuth
|
yarn start:withAuth
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"concurrently": "^6.4.0",
|
"concurrently": "^6.4.0",
|
||||||
"cypress": "^9.0.0",
|
"cypress": "8.5.0",
|
||||||
"cypress-localstorage-commands": "^1.6.1",
|
"cypress-localstorage-commands": "^1.6.1",
|
||||||
"start-server-and-test": "^1.13.1"
|
"start-server-and-test": "^1.13.1"
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import clsx from 'clsx';
|
|||||||
import styles from './styles.module.css';
|
import styles from './styles.module.css';
|
||||||
import {ThemeClassNames, docVersionSearchTag} from '@docusaurus/theme-common';
|
import {ThemeClassNames, docVersionSearchTag} from '@docusaurus/theme-common';
|
||||||
import DocPageCustom from "../../components/DocPageCustom"
|
import DocPageCustom from "../../components/DocPageCustom"
|
||||||
|
import amplitude from 'amplitude-js';
|
||||||
|
|
||||||
function DocPageContent({currentDocRoute, versionMetadata, children}) {
|
function DocPageContent({currentDocRoute, versionMetadata, children}) {
|
||||||
const {pluginId, version} = versionMetadata;
|
const {pluginId, version} = versionMetadata;
|
||||||
@ -138,7 +139,6 @@ function DocPage(props) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
import('amplitude-js').then(amplitude => {
|
|
||||||
if (userAccessStatus?.login) {
|
if (userAccessStatus?.login) {
|
||||||
var amplitudeInstance = amplitude.getInstance().init(process.env.REACT_APP_AMPLITUDE_ID, userAccessStatus?.login.toLowerCase(), {
|
var amplitudeInstance = amplitude.getInstance().init(process.env.REACT_APP_AMPLITUDE_ID, userAccessStatus?.login.toLowerCase(), {
|
||||||
apiEndpoint: `${window.location.hostname}/t`
|
apiEndpoint: `${window.location.hostname}/t`
|
||||||
@ -149,7 +149,6 @@ function DocPage(props) {
|
|||||||
window.hj("identify", userAccessStatus?.login.toLowerCase(), {});
|
window.hj("identify", userAccessStatus?.login.toLowerCase(), {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}, [location.pathname, userAccessStatus])
|
}, [location.pathname, userAccessStatus])
|
||||||
|
|
||||||
if (process.env.OAUTH_ENABLE == 'true' && userAccessStatus?.permission !== true) {
|
if (process.env.OAUTH_ENABLE == 'true' && userAccessStatus?.permission !== true) {
|
||||||
|
Reference in New Issue
Block a user