|
|
@ -2,6 +2,8 @@ import PropTypes from 'prop-types' |
|
|
|
import React, {PureComponent} from 'react' |
|
|
|
import React, {PureComponent} from 'react' |
|
|
|
import { ProviderPageContainerContent, ProviderPageContainerHeader } from '.' |
|
|
|
import { ProviderPageContainerContent, ProviderPageContainerHeader } from '.' |
|
|
|
import { PageContainerFooter } from '../../ui/page-container' |
|
|
|
import { PageContainerFooter } from '../../ui/page-container' |
|
|
|
|
|
|
|
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../../app/scripts/lib/enums' |
|
|
|
|
|
|
|
import { getEnvironmentType } from '../../../../../app/scripts/lib/util' |
|
|
|
|
|
|
|
|
|
|
|
export default class ProviderPageContainer extends PureComponent { |
|
|
|
export default class ProviderPageContainer extends PureComponent { |
|
|
|
static propTypes = { |
|
|
|
static propTypes = { |
|
|
@ -20,6 +22,9 @@ export default class ProviderPageContainer extends PureComponent { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
componentDidMount () { |
|
|
|
componentDidMount () { |
|
|
|
|
|
|
|
if (getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_NOTIFICATION) { |
|
|
|
|
|
|
|
window.addEventListener('beforeunload', this._beforeUnload) |
|
|
|
|
|
|
|
} |
|
|
|
this.context.metricsEvent({ |
|
|
|
this.context.metricsEvent({ |
|
|
|
eventOpts: { |
|
|
|
eventOpts: { |
|
|
|
category: 'Auth', |
|
|
|
category: 'Auth', |
|
|
@ -29,6 +34,27 @@ export default class ProviderPageContainer extends PureComponent { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_beforeUnload () { |
|
|
|
|
|
|
|
const { origin, rejectProviderRequestByOrigin } = this.props |
|
|
|
|
|
|
|
this.context.metricsEvent({ |
|
|
|
|
|
|
|
eventOpts: { |
|
|
|
|
|
|
|
category: 'Auth', |
|
|
|
|
|
|
|
action: 'Connect', |
|
|
|
|
|
|
|
name: 'Cancel Connect Request Via Notification Close', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this._removeBeforeUnload() |
|
|
|
|
|
|
|
rejectProviderRequestByOrigin(origin) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_removeBeforeUnload () { |
|
|
|
|
|
|
|
window.removeEventListener('beforeunload', this._beforeUnload) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
componentWillUnmount () { |
|
|
|
|
|
|
|
this._removeBeforeUnload() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onCancel = () => { |
|
|
|
onCancel = () => { |
|
|
|
const { origin, rejectProviderRequestByOrigin } = this.props |
|
|
|
const { origin, rejectProviderRequestByOrigin } = this.props |
|
|
|
this.context.metricsEvent({ |
|
|
|
this.context.metricsEvent({ |
|
|
@ -38,6 +64,7 @@ export default class ProviderPageContainer extends PureComponent { |
|
|
|
name: 'Canceled', |
|
|
|
name: 'Canceled', |
|
|
|
}, |
|
|
|
}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
this._removeBeforeUnload() |
|
|
|
rejectProviderRequestByOrigin(origin) |
|
|
|
rejectProviderRequestByOrigin(origin) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -50,6 +77,7 @@ export default class ProviderPageContainer extends PureComponent { |
|
|
|
name: 'Confirmed', |
|
|
|
name: 'Confirmed', |
|
|
|
}, |
|
|
|
}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
this._removeBeforeUnload() |
|
|
|
approveProviderRequestByOrigin(origin) |
|
|
|
approveProviderRequestByOrigin(origin) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|