Skip to content

Commit

Permalink
Flow
Browse files Browse the repository at this point in the history
  • Loading branch information
neuodev committed May 23, 2022
1 parent 5945b61 commit 420009b
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions packages/yoroi-extension/app/components/widgets/Support.js
Expand Up @@ -4,29 +4,37 @@ import type { Node } from 'react';
import { ReactComponent as SupportIcon } from '../../assets/images/support.inline.svg';
import { IconButton } from '@mui/material';

export default class Support extends Component <{||}> {
type Props = {||}
type State = {|
isOpened: boolean,
|}

state = {
export default class Support extends Component <Props, State> {

state: State = {
isOpened: false
}

loadScript(src: string, id: string): void {
const script = document.createElement('script')
script.src = src
script.id = id
document.body.appendChild(script)
document.body?.appendChild(script)
}

componentDidMount() {
this.loadScript('https://static.zdassets.com/ekr/snippet.js?key=68b95d72-6354-4343-8a64-427979a6f5d6', 'ze-snippet');
this.interval = setInterval(()=>{

const interval = setInterval(()=>{
if (typeof window.zE !== 'undefined' && typeof window.zE.hide === 'function') {
window.zE.hide()
clearInterval(this.interval)

window.zE('webWidget:on', 'close', () => {
this.setState({ isOpened: false })
})

if (interval) {
clearInterval(interval)
}
}
}, 500);
}
Expand Down

0 comments on commit 420009b

Please sign in to comment.