lbry-desktop/ui/component/userVerify/view.jsx

151 lines
5.1 KiB
React
Raw Normal View History

// @flow
2019-09-26 18:07:11 +02:00
import * as ICONS from 'constants/icons';
import React, { Fragment } from 'react';
2018-03-26 23:32:43 +02:00
import Button from 'component/button';
import CardVerify from 'component/cardVerify';
2018-10-04 21:27:49 +02:00
import { Lbryio } from 'lbryinc';
2019-09-26 18:07:11 +02:00
import Card from 'component/common/card';
2020-02-13 18:51:20 +01:00
import I18nMessage from 'component/i18nMessage';
2017-07-16 18:29:46 +02:00
type Props = {
errorMessage: ?string,
isPending: boolean,
verifyUserIdentity: string => void,
verifyPhone: () => void,
fetchUser: () => void,
skipLink?: string,
2020-03-16 16:56:24 +01:00
onSkip: () => void,
};
2017-07-16 18:29:46 +02:00
class UserVerify extends React.PureComponent<Props> {
constructor() {
super();
2017-07-16 18:29:46 +02:00
(this: any).onToken = this.onToken.bind(this);
2017-07-16 18:29:46 +02:00
}
onToken(data: { id: string }) {
2017-07-19 01:00:13 +02:00
this.props.verifyUserIdentity(data.id);
2017-07-16 18:29:46 +02:00
}
render() {
const { errorMessage, isPending, verifyPhone, fetchUser, onSkip } = this.props;
2020-03-16 16:56:24 +01:00
const skipButtonProps = {
onClick: onSkip,
};
2017-07-16 18:29:46 +02:00
return (
2018-03-26 23:32:43 +02:00
<React.Fragment>
2019-09-27 22:03:05 +02:00
<section className="section__header">
2020-02-13 18:51:20 +01:00
<h1 className="section__title--large">{__('Rewards Validation')}</h1>
2019-09-26 18:07:11 +02:00
<p>
2020-02-13 18:51:20 +01:00
<I18nMessage
tokens={{
rewards_program: (
<Button button="link" label={__('Rewards Program')} href="https://lbry.com/faq/rewards" />
),
Refresh: <Button onClick={() => fetchUser()} button="link" label={__('Refresh')} />,
Skip: <Button {...skipButtonProps} button="link" label={__('Skip')} />,
2020-02-13 18:51:20 +01:00
}}
>
If you'd like to participate our %rewards_program% to earn credits, please complete one of the steps below
to be validated. %Refresh% or %Skip%.
</I18nMessage>
2019-07-21 23:31:22 +02:00
</p>
2020-02-13 18:51:20 +01:00
<p>{__('This step is not required to use LBRY, and not all users or regions may qualify.')}</p>
2017-08-26 05:21:26 +02:00
</section>
2019-09-26 18:07:11 +02:00
<div className="section">
<Card
icon={ICONS.PHONE}
title={__('Proof via Text')}
subtitle={__(
2019-07-21 23:31:22 +02:00
'You will receive an SMS text message confirming that your phone number is correct. Does not work for Canada and possibly other regions'
2019-09-26 18:07:11 +02:00
)}
actions={
<Fragment>
<Button
onClick={() => {
verifyPhone();
}}
button="primary"
label={__('Verify Phone Number')}
/>
<p className="help">
{__('Standard messaging rates apply. LBRY will not text or call you otherwise. Having trouble?')}{' '}
<Button button="link" href="https://lbry.com/faq/phone" label={__('Read more.')} />
</p>
</Fragment>
}
/>
2019-07-21 23:31:22 +02:00
2019-09-26 18:07:11 +02:00
<div className="section__divider">
<hr />
<p>{__('OR')}</p>
2019-07-21 23:31:22 +02:00
</div>
2019-09-26 18:07:11 +02:00
<Card
icon={ICONS.WALLET}
title={__('Proof via Credit')}
subtitle={__(
'If you have a valid credit or debit card, you can use it to instantly prove your humanity. LBRY does not store your credit card information. There is no charge at all for this, now or in the future.'
2019-07-21 23:31:22 +02:00
)}
2019-09-26 18:07:11 +02:00
actions={
<Fragment>
{errorMessage && <p className="error__text">{errorMessage}</p>}
2019-09-26 18:07:11 +02:00
<CardVerify
label={__('Verify Card')}
disabled={isPending}
token={this.onToken}
stripeKey={Lbryio.getStripeToken()}
/>
<p className="help">
{__('A $1 authorization may temporarily appear with your provider.')}{' '}
<Button button="link" href="https://lbry.com/faq/identity-requirements" label={__('Read more')} />.
</p>
</Fragment>
}
/>
2019-07-21 23:31:22 +02:00
2019-09-26 18:07:11 +02:00
<div className="section__divider">
<hr />
<p>{__('OR')}</p>
2017-08-26 05:21:26 +02:00
</div>
2019-09-26 18:07:11 +02:00
<Card
icon={ICONS.CHAT}
title={__('Proof via Chat')}
subtitle={__(
2020-02-13 18:51:20 +01:00
'A moderator capable of approving you is typically available in the discord server. See the #rewards-approval instructions carefully and do not message any moderators directly. This process will likely involve providing proof of a stable and established online or real-life identity.'
2019-09-26 18:07:11 +02:00
)}
actions={
<Fragment>
<Button href="https://chat.lbry.com" button="primary" label={__('Join LBRY Chat')} />
<p className="help">{__("We're friendly. We promise.")}</p>
</Fragment>
}
/>
2020-02-26 22:01:49 +01:00
<div className="section__divider">
<hr />
<p>{__('OR')}</p>
</div>
<Card
icon={ICONS.REMOVE}
title={__('Skip')}
subtitle={__('Rewards validation is optional.')}
actions={
<Fragment>
2020-03-16 16:56:24 +01:00
<Button {...skipButtonProps} button="primary" label={__('Continue Without Rewards')} />
2020-02-26 22:01:49 +01:00
</Fragment>
}
/>
2019-09-26 18:07:11 +02:00
</div>
2018-03-26 23:32:43 +02:00
</React.Fragment>
2017-07-16 18:29:46 +02:00
);
}
}
export default UserVerify;