Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: request trial checkbox terms conditions #628

Merged
merged 1 commit into from
Jan 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {
Button,
Field,
Box,
CheckBox,
FieldGroup,
TextInput,
EmailInput,
Expand All @@ -10,7 +12,7 @@ import {
} from '@rocket.chat/fuselage';
import type { ReactElement } from 'react';
import { useForm, SubmitHandler, Validate, Controller } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
import { useTranslation, Trans } from 'react-i18next';

import Form from '../../common/Form';

Expand All @@ -19,6 +21,8 @@ type RequestTrialPayload = {
organizationName: string;
organizationSize: string;
country: string;
updates: boolean;
agreement: boolean;
};

type RequestTrialFormProps = {
Expand All @@ -28,6 +32,8 @@ type RequestTrialFormProps = {
onSubmit: SubmitHandler<RequestTrialPayload>;
onManageWorkspaceClick: () => void;
validateEmail: Validate<string>;
termsHref?: string;
policyHref?: string;
};

const RequestTrialForm = ({
Expand All @@ -36,6 +42,8 @@ const RequestTrialForm = ({
countryOptions,
onSubmit,
validateEmail,
termsHref = 'https://rocket.chat/terms',
policyHref = 'https://rocket.chat/privacy',
}: RequestTrialFormProps): ReactElement => {
const { t } = useTranslation();

Expand Down Expand Up @@ -131,6 +139,53 @@ const RequestTrialForm = ({
/>
</Field.Row>
</Field>
<Field>
<Box mbs='x24'>
<Box
mbe='x8'
display='flex'
flexDirection='row'
alignItems='flex-start'
fontScale='c1'
lineHeight={20}
>
<CheckBox mie='x8' {...register('updates')} />{' '}
<Box is='label' htmlFor='updates'>
{t('form.registeredServerForm.keepInformed')}
</Box>
</Box>
<Box
display='flex'
flexDirection='row'
alignItems='flex-start'
color='default'
fontScale='c1'
lineHeight={20}
>
<CheckBox
mie='x8'
{...register('agreement', { required: true })}
/>{' '}
<Box is='label' htmlFor='agreement' withRichContent>
<Trans i18nKey='component.form.termsAndConditions'>
I agree with
<a href={termsHref} target='_blank' rel='noopener noreferrer'>
Terms and Conditions
</a>
and
<a
href={policyHref}
target='_blank'
rel='noopener noreferrer'
>
Privacy Policy
</a>
</Trans>
</Box>
</Box>
</Box>
</Field>

<Field>
<Field.Label>
{t('form.requestTrialForm.hasWorkspace.label')}
Expand Down