2021-05-06 00:09:29 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { mapDispatchToProps } from '../actions';
|
|
|
|
import { CaptchaDialog } from '../../components/CaptchaDialog';
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { StateType } from '../reducer';
|
2021-05-06 00:09:29 +00:00
|
|
|
import { getIntl } from '../selectors/user';
|
|
|
|
import { isChallengePending } from '../selectors/network';
|
|
|
|
import { getChallengeURL } from '../../challenge';
|
2023-04-06 21:49:24 +00:00
|
|
|
import * as log from '../../logging/log';
|
2021-05-06 00:09:29 +00:00
|
|
|
|
|
|
|
const mapStateToProps = (state: StateType) => {
|
|
|
|
return {
|
|
|
|
...state.updates,
|
|
|
|
isPending: isChallengePending(state),
|
|
|
|
i18n: getIntl(state),
|
|
|
|
|
|
|
|
onContinue() {
|
2023-04-06 21:49:24 +00:00
|
|
|
const url = getChallengeURL('chat');
|
|
|
|
log.info(`CaptchaDialog: navigating to ${url}`);
|
|
|
|
document.location.href = url;
|
2021-05-06 00:09:29 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const smart = connect(mapStateToProps, mapDispatchToProps);
|
|
|
|
|
|
|
|
export const SmartCaptchaDialog = smart(CaptchaDialog);
|