Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
runs-on: ubuntu-latest
env:
CI: true
NODE_OPTIONS: --max_old_space_size=8192
strategy:
fail-fast: false
matrix:
Expand Down
11 changes: 2 additions & 9 deletions src/components/AddPaymentCard/PaymentCardForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import CurrencySelector from '@components/CurrencySelector';
import FormProvider from '@components/Form/FormProvider';
import InputWrapper from '@components/Form/InputWrapper';
import type {FormInputErrors, FormOnyxValues} from '@components/Form/types';
import RenderHTML from '@components/RenderHTML';
import type {AnimatedTextInputRef} from '@components/RNTextInput';
import StateSelector from '@components/StateSelector';
import Text from '@components/Text';
import TextInput from '@components/TextInput';
import TextLink from '@components/TextLink';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import useThemeStyles from '@hooks/useThemeStyles';
Expand Down Expand Up @@ -46,13 +45,7 @@ type PaymentCardFormProps = {
function IAcceptTheLabel() {
const {translate} = useLocalize();

return (
<Text>
{`${translate('common.iAcceptThe')}`}
<TextLink href={CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}>{`${translate('common.addCardTermsOfService')}`}</TextLink> {`${translate('common.and')}`}
<TextLink href={CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}> {` ${translate('common.privacyPolicy')} `}</TextLink>
</Text>
);
return <RenderHTML html={translate('common.acceptTermsAndPrivacy')} />;
}

const REQUIRED_FIELDS = [
Expand Down
3 changes: 3 additions & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ const translations = {
zipPostCode: 'Postleitzahl',
whatThis: 'Was ist das?',
iAcceptThe: 'Ich akzeptiere die',
acceptTermsAndPrivacy: `Ich akzeptiere die <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Expensify-Nutzungsbedingungen</a> und <a href="${CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}">Datenschutzrichtlinie</a>`,
acceptTermsAndConditions: `Ich akzeptiere die <a href="${CONST.OLD_DOT_PUBLIC_URLS.ACH_TERMS_URL}">Allgemeine Geschäftsbedingungen</a>`,
acceptTermsOfService: `Ich akzeptiere die <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Expensify-Nutzungsbedingungen</a>`,
remove: 'Entfernen',
admin: 'Admin',
owner: 'Eigentümer',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,9 @@ const translations = {
zipPostCode: 'Zip / Postcode',
whatThis: "What's this?",
iAcceptThe: 'I accept the ',
acceptTermsAndPrivacy: `I accept the <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Expensify Terms of Service</a> and <a href="${CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}">Privacy Policy</a>`,
acceptTermsAndConditions: `I accept the <a href="${CONST.OLD_DOT_PUBLIC_URLS.ACH_TERMS_URL}">terms and conditions</a>`,
acceptTermsOfService: `I accept the <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Expensify Terms of Service</a>`,
remove: 'Remove',
admin: 'Admin',
owner: 'Owner',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,9 @@ const translations = {
zipPostCode: 'Código postal',
whatThis: '¿Qué es esto?',
iAcceptThe: 'Acepto los ',
acceptTermsAndPrivacy: `Acepto los <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Términos de Servicio</a> y <a href="${CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}">la Política de Privacidad de Expensify</a>`,
acceptTermsAndConditions: `Acepto los <a href="${CONST.OLD_DOT_PUBLIC_URLS.ACH_TERMS_URL}">Términos y Condiciones</a>`,
acceptTermsOfService: `Acepto los <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Términos de Servicio</a>`,
remove: 'Eliminar',
admin: 'Administrador',
owner: 'Dueño',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ const translations = {
zipPostCode: 'Code postal',
whatThis: "Qu'est-ce que c'est ?",
iAcceptThe: "J'accepte le",
acceptTermsAndPrivacy: `J'accepte le <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Conditions d'utilisation d'Expensify</a> et <a href="${CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}">Politique de confidentialité</a>`,
acceptTermsAndConditions: `J'accepte le <a href="${CONST.OLD_DOT_PUBLIC_URLS.ACH_TERMS_URL}">termes et conditions</a>`,
acceptTermsOfService: `J'accepte le <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Conditions d'utilisation d'Expensify</a>`,
remove: 'Supprimer',
admin: 'Admin',
owner: 'Propriétaire',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ const translations = {
zipPostCode: 'CAP / Codice postale',
whatThis: "Cos'è questo?",
iAcceptThe: 'Accetto il',
acceptTermsAndPrivacy: `Accetto il <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Termini di servizio di Expensify</a> e <a href="${CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}">Informativa sulla privacy</a>`,
acceptTermsAndConditions: `Accetto il <a href="${CONST.OLD_DOT_PUBLIC_URLS.ACH_TERMS_URL}">termini e condizioni</a>`,
acceptTermsOfService: `Accetto il <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Termini di servizio di Expensify</a>`,
remove: 'Rimuovi',
admin: 'Admin',
owner: 'Proprietario',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ const translations = {
zipPostCode: '郵便番号',
whatThis: 'これは何ですか?',
iAcceptThe: '承諾します',
acceptTermsAndPrivacy: `承諾します <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Expensify 利用規約</a> および <a href="${CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}">プライバシーポリシー</a>`,
acceptTermsAndConditions: `承諾します <a href="${CONST.OLD_DOT_PUBLIC_URLS.ACH_TERMS_URL}">利用規約</a>`,
acceptTermsOfService: `承諾します <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Expensify 利用規約</a>`,
remove: '削除',
admin: '管理者',
owner: 'オーナー',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ const translations = {
zipPostCode: 'Postcode',
whatThis: 'Wat is dit?',
iAcceptThe: 'Ik accepteer de',
acceptTermsAndPrivacy: `Ik accepteer de <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Expensify Gebruiksvoorwaarden</a> en <a href="${CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}">Privacybeleid</a>`,
acceptTermsAndConditions: `Ik accepteer de <a href="${CONST.OLD_DOT_PUBLIC_URLS.ACH_TERMS_URL}">algemene voorwaarden</a>`,
acceptTermsOfService: `Ik accepteer de <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Expensify Gebruiksvoorwaarden</a>`,
remove: 'Verwijderen',
admin: 'Admin',
owner: 'Eigenaar',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ const translations = {
zipPostCode: 'Kod pocztowy',
whatThis: 'Co to jest?',
iAcceptThe: 'Akceptuję',
acceptTermsAndPrivacy: `Akceptuję <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Warunki korzystania z usługi Expensify</a> i <a href="${CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}">Polityka prywatności</a>`,
acceptTermsAndConditions: `Akceptuję <a href="${CONST.OLD_DOT_PUBLIC_URLS.ACH_TERMS_URL}">warunki i zasady</a>`,
acceptTermsOfService: `Akceptuję <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Warunki korzystania z usługi Expensify</a>`,
remove: 'Usuń',
admin: 'Admin',
owner: 'Właściciel',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ const translations = {
zipPostCode: 'CEP / Código Postal',
whatThis: 'O que é isso?',
iAcceptThe: 'Eu aceito o',
acceptTermsAndPrivacy: `Eu aceito o <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Termos de Serviço da Expensify</a> e <a href="${CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}">Política de Privacidade</a>`,
acceptTermsAndConditions: `Eu aceito o <a href="${CONST.OLD_DOT_PUBLIC_URLS.ACH_TERMS_URL}">termos e condições</a>`,
acceptTermsOfService: `Eu aceito o <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Termos de Serviço da Expensify</a>`,
remove: 'Remover',
admin: 'Administração',
owner: 'Proprietário',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ const translations = {
zipPostCode: '邮政编码',
whatThis: '这是什么?',
iAcceptThe: '我接受',
acceptTermsAndPrivacy: `我接受 <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Expensify 服务条款</a> 和 <a href="${CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}">隐私政策</a>`,
acceptTermsAndConditions: `我接受 <a href="${CONST.OLD_DOT_PUBLIC_URLS.ACH_TERMS_URL}">条款和条件</a>`,
acceptTermsOfService: `我接受 <a href="${CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}">Expensify 服务条款</a>`,
remove: '移除',
admin: '管理员',
owner: '所有者',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import CheckboxWithLabel from '@components/CheckboxWithLabel';
import FormProvider from '@components/Form/FormProvider';
import InputWrapper from '@components/Form/InputWrapper';
import type {FormInputErrors, FormOnyxValues} from '@components/Form/types';
import RenderHTML from '@components/RenderHTML';
import Text from '@components/Text';
import TextLink from '@components/TextLink';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import type {SubStepProps} from '@hooks/useSubStep/types';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ValidationUtils from '@libs/ValidationUtils';
import CONST from '@src/CONST';
import {getFieldRequiredErrors, isRequiredFulfilled} from '@libs/ValidationUtils';
import ONYXKEYS from '@src/ONYXKEYS';
import INPUT_IDS from '@src/types/form/ReimbursementAccountForm';

Expand All @@ -35,16 +34,11 @@ function CertifyTrueAndAccurateLabel() {

function TermsAndConditionsLabel() {
const {translate} = useLocalize();
return (
<Text>
{translate('common.iAcceptThe')}
<TextLink href={CONST.OLD_DOT_PUBLIC_URLS.ACH_TERMS_URL}>{`${translate('completeVerificationStep.termsAndConditions')}`}</TextLink>
</Text>
);
return <RenderHTML html={translate('common.acceptTermsAndConditions')} />;
}

function ConfirmAgreements({onNext}: ConfirmAgreementsProps) {
const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT);
const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {canBeMissing: true});
const {translate} = useLocalize();
const styles = useThemeStyles();
const defaultValues = {
Expand All @@ -54,17 +48,17 @@ function ConfirmAgreements({onNext}: ConfirmAgreementsProps) {
};
const validate = useCallback(
(values: FormOnyxValues<typeof ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM>): FormInputErrors<typeof ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM> => {
const errors = ValidationUtils.getFieldRequiredErrors(values, STEP_FIELDS);
const errors = getFieldRequiredErrors(values, STEP_FIELDS);

if (!ValidationUtils.isRequiredFulfilled(values.acceptTermsAndConditions)) {
if (!isRequiredFulfilled(values.acceptTermsAndConditions)) {
errors.acceptTermsAndConditions = translate('common.error.acceptTerms');
}

if (!ValidationUtils.isRequiredFulfilled(values.certifyTrueInformation)) {
if (!isRequiredFulfilled(values.certifyTrueInformation)) {
errors.certifyTrueInformation = translate('completeVerificationStep.certifyTrueAndAccurateError');
}

if (!ValidationUtils.isRequiredFulfilled(values.isAuthorizedToUseBankAccount)) {
if (!isRequiredFulfilled(values.isAuthorizedToUseBankAccount)) {
errors.isAuthorizedToUseBankAccount = translate('completeVerificationStep.isAuthorizedToUseBankAccountError');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import InputWrapper from '@components/Form/InputWrapper';
import type {FormInputErrors, FormOnyxValues} from '@components/Form/types';
import FormHelpMessage from '@components/FormHelpMessage';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import RenderHTML from '@components/RenderHTML';
import ScrollView from '@components/ScrollView';
import Text from '@components/Text';
import TextLink from '@components/TextLink';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import useOnyx from '@hooks/useOnyx';
Expand All @@ -34,12 +34,7 @@ type MenuItemProps = {

function TermsAndConditionsLabel() {
const {translate} = useLocalize();
return (
<Text>
{translate('common.iAcceptThe')}
<TextLink href={CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}>{`${translate('common.addCardTermsOfService')}`}</TextLink>
</Text>
);
return <RenderHTML html={translate('common.acceptTermsOfService')} />;
}

function Confirmation({onNext, onMove, formValues, fieldsMap}: CustomSubStepProps) {
Expand Down
13 changes: 12 additions & 1 deletion tests/unit/PaymentCardFormTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,24 @@ import {fireEvent, render, screen} from '@testing-library/react-native';
import React from 'react';
import Onyx from 'react-native-onyx';
import ComposeProviders from '@components/ComposeProviders';
import HTMLEngineProvider from '@components/HTMLEngineProvider';
import {LocaleContextProvider} from '@components/LocaleContextProvider';
import OnyxListItemProvider from '@components/OnyxListItemProvider';
import {CurrentReportIDContextProvider} from '@hooks/useCurrentReportID';
import AddPaymentCard from '@pages/settings/Subscription/PaymentCard';
import ONYXKEYS from '@src/ONYXKEYS';
import SCREENS from '@src/SCREENS';

jest.mock('@components/RenderHTML', () => {
const ReactMock = require('react') as typeof React;
const {Text} = require('react-native') as {Text: React.ComponentType<{children?: React.ReactNode}>};

return ({html}: {html: string}) => {
const plainText = html.replace(/<[^>]*>/g, '');
return ReactMock.createElement(Text, null, plainText);
};
});

jest.mock('@react-native-community/geolocation', () => ({
setRNConfiguration: jest.fn(),
}));
Expand Down Expand Up @@ -39,7 +50,7 @@ describe('Subscription/AddPaymentCard', () => {

const renderAddPaymentCardPage = (initialRouteName: typeof SCREENS.SETTINGS.SUBSCRIPTION.ADD_PAYMENT_CARD) => {
return render(
<ComposeProviders components={[OnyxListItemProvider, LocaleContextProvider, CurrentReportIDContextProvider]}>
<ComposeProviders components={[OnyxListItemProvider, LocaleContextProvider, CurrentReportIDContextProvider, HTMLEngineProvider]}>
<PortalProvider>
<NavigationContainer>
<Stack.Navigator initialRouteName={initialRouteName}>
Expand Down
Loading