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
15 changes: 8 additions & 7 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -901,12 +901,6 @@ const CONST = {
DEEP_DIVE_ERECEIPTS: 'https://community.expensify.com/discussion/5542/deep-dive-what-are-ereceipts/',
DEEP_DIVE_PER_DIEM: 'https://community.expensify.com/discussion/4772/how-to-add-a-single-rate-per-diem',
GITHUB_URL: 'https://github.com/Expensify/App',
TERMS_URL: `${EXPENSIFY_URL}/terms`,
PRIVACY_URL: `${EXPENSIFY_URL}/privacy`,
LICENSES_URL: `${USE_EXPENSIFY_URL}/licenses`,
ACH_TERMS_URL: `${EXPENSIFY_URL}/achterms`,
WALLET_AGREEMENT_URL: `${EXPENSIFY_URL}/expensify-payments-wallet-terms-of-service`,
BANCORP_WALLET_AGREEMENT_URL: `${EXPENSIFY_URL}/bancorp-bank-wallet-terms-of-service`,
HELP_LINK_URL: `${USE_EXPENSIFY_URL}/usa-patriot-act`,
ELECTRONIC_DISCLOSURES_URL: `${USE_EXPENSIFY_URL}/esignagreement`,
GITHUB_RELEASE_URL: 'https://api.github.com/repos/expensify/app/releases/latest',
Expand Down Expand Up @@ -951,7 +945,14 @@ const CONST = {
EMPLOYEE_TOUR_PRODUCTION: 'https://expensify.navattic.com/35609gb',
EMPLOYEE_TOUR_STAGING: 'https://expensify.navattic.com/cf15002s',
},

OLD_DOT_PUBLIC_URLS: {
TERMS_URL: `${EXPENSIFY_URL}/terms`,
PRIVACY_URL: `${EXPENSIFY_URL}/privacy`,
LICENSES_URL: `${USE_EXPENSIFY_URL}/licenses`,
ACH_TERMS_URL: `${EXPENSIFY_URL}/achterms`,
WALLET_AGREEMENT_URL: `${EXPENSIFY_URL}/expensify-payments-wallet-terms-of-service`,
BANCORP_WALLET_AGREEMENT_URL: `${EXPENSIFY_URL}/bancorp-bank-wallet-terms-of-service`,
},
OLDDOT_URLS: {
ADMIN_POLICIES_URL: 'admin_policies',
ADMIN_DOMAINS_URL: 'admin_domains',
Expand Down
4 changes: 2 additions & 2 deletions src/components/AddPaymentCard/PaymentCardForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ function IAcceptTheLabel() {
return (
<Text>
{`${translate('common.iAcceptThe')}`}
<TextLink href={CONST.TERMS_URL}>{`${translate('common.addCardTermsOfService')}`}</TextLink> {`${translate('common.and')}`}
<TextLink href={CONST.PRIVACY_URL}> {` ${translate('common.privacyPolicy')} `}</TextLink>
<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>
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/libs/actions/Link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ function openLink(href: string, environmentURL: string, isAttachment = false) {
Navigation.navigate(internalNewExpensifyPath as Route);
return;
}

// If we are handling an old dot Expensify link we need to open it with openOldDotLink() so we can navigate to it with the user already logged in.
// As attachments also use expensify.com we don't want it working the same as links.
if (internalExpensifyPath && !isAttachment) {
const isPublicOldDotURL = (Object.values(CONST.OLD_DOT_PUBLIC_URLS) as string[]).includes(href);
if (internalExpensifyPath && !isAttachment && !isPublicOldDotURL) {
openOldDotLink(internalExpensifyPath);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ function AgreeToTheLabel() {
const [userWallet] = useOnyx(ONYXKEYS.USER_WALLET);

const walletAgreementUrl =
userWallet?.walletProgramID && userWallet?.walletProgramID === CONST.WALLET.BANCORP_WALLET_PROGRAM_ID ? CONST.BANCORP_WALLET_AGREEMENT_URL : CONST.WALLET_AGREEMENT_URL;
userWallet?.walletProgramID && userWallet?.walletProgramID === CONST.WALLET.BANCORP_WALLET_PROGRAM_ID
? CONST.OLD_DOT_PUBLIC_URLS.BANCORP_WALLET_AGREEMENT_URL
: CONST.OLD_DOT_PUBLIC_URLS.WALLET_AGREEMENT_URL;

return (
<Text>
{`${translate('termsStep.agreeToThe')} `}
<TextLink href={CONST.PRIVACY_URL}>{`${translate('common.privacy')} `}</TextLink>
<TextLink href={CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}>{`${translate('common.privacy')} `}</TextLink>
{`${translate('common.and')} `}
<TextLink href={walletAgreementUrl}>{`${translate('termsStep.walletAgreement')}.`}</TextLink>
</Text>
Expand Down
29 changes: 10 additions & 19 deletions src/pages/EnablePayments/TermsStep.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {useEffect, useState} from 'react';
import {withOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import {useOnyx} from 'react-native-onyx';
import CheckboxWithLabel from '@components/CheckboxWithLabel';
import FormAlertWithSubmitButton from '@components/FormAlertWithSubmitButton';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
Expand All @@ -13,16 +13,11 @@ import * as ErrorUtils from '@libs/ErrorUtils';
import * as BankAccounts from '@userActions/BankAccounts';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {UserWallet, WalletTerms} from '@src/types/onyx';
import type {UserWallet} from '@src/types/onyx';
import LongTermsForm from './TermsPage/LongTermsForm';
import ShortTermsForm from './TermsPage/ShortTermsForm';

type TermsStepOnyxProps = {
/** Comes from Onyx. Information about the terms for the wallet */
walletTerms: OnyxEntry<WalletTerms>;
};

type TermsStepProps = TermsStepOnyxProps & {
type TermsStepProps = {
/** The user's wallet */
userWallet: OnyxEntry<UserWallet>;
};
Expand All @@ -44,9 +39,9 @@ function AgreeToTheLabel() {
return (
<Text>
{`${translate('termsStep.agreeToThe')} `}
<TextLink href={CONST.PRIVACY_URL}>{`${translate('common.privacy')} `}</TextLink>
<TextLink href={CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}>{`${translate('common.privacy')} `}</TextLink>
{`${translate('common.and')} `}
<TextLink href={CONST.WALLET_AGREEMENT_URL}>{`${translate('termsStep.walletAgreement')}.`}</TextLink>
<TextLink href={CONST.OLD_DOT_PUBLIC_URLS.WALLET_AGREEMENT_URL}>{`${translate('termsStep.walletAgreement')}.`}</TextLink>
</Text>
);
}
Expand All @@ -57,8 +52,8 @@ function TermsStep(props: TermsStepProps) {
const [hasAcceptedPrivacyPolicyAndWalletAgreement, setHasAcceptedPrivacyPolicyAndWalletAgreement] = useState(false);
const [error, setError] = useState(false);
const {translate} = useLocalize();

const errorMessage = error ? translate('common.error.acceptTerms') : ErrorUtils.getLatestErrorMessage(props.walletTerms ?? {}) ?? '';
const [walletTerms] = useOnyx(ONYXKEYS.WALLET_TERMS);
const errorMessage = error ? translate('common.error.acceptTerms') : ErrorUtils.getLatestErrorMessage(walletTerms ?? {}) ?? '';

const toggleDisclosure = () => {
setHasAcceptedDisclosure(!hasAcceptedDisclosure);
Expand Down Expand Up @@ -109,12 +104,12 @@ function TermsStep(props: TermsStepProps) {
setError(false);
BankAccounts.acceptWalletTerms({
hasAcceptedTerms: hasAcceptedDisclosure && hasAcceptedPrivacyPolicyAndWalletAgreement,
reportID: props.walletTerms?.chatReportID ?? '-1',
reportID: walletTerms?.chatReportID ?? '-1',
});
}}
message={errorMessage}
isAlertVisible={error || !!errorMessage}
isLoading={!!props.walletTerms?.isLoading}
isLoading={!!walletTerms?.isLoading}
containerStyles={[styles.mh0, styles.mv4]}
/>
</ScrollView>
Expand All @@ -124,8 +119,4 @@ function TermsStep(props: TermsStepProps) {

TermsStep.displayName = 'TermsPage';

export default withOnyx<TermsStepProps, TermsStepOnyxProps>({
walletTerms: {
key: ONYXKEYS.WALLET_TERMS,
},
})(TermsStep);
export default TermsStep;
2 changes: 1 addition & 1 deletion src/pages/ReimbursementAccount/BankAccountStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ function BankAccountStep({
</View>
</Section>
<View style={[styles.mv0, styles.mh5, styles.flexRow, styles.justifyContentBetween]}>
<TextLink href={CONST.PRIVACY_URL}>{translate('common.privacy')}</TextLink>
<TextLink href={CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}>{translate('common.privacy')}</TextLink>
<PressableWithoutFeedback
onPress={() => Link.openExternalLink('https://help.expensify.com/articles/new-expensify/settings/Encryption-and-Data-Security/')}
style={[styles.flexRow, styles.alignItemsCenter]}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, {useCallback} from 'react';
import {withOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import {useOnyx} from 'react-native-onyx';
import CheckboxWithLabel from '@components/CheckboxWithLabel';
import FormProvider from '@components/Form/FormProvider';
import InputWrapper from '@components/Form/InputWrapper';
Expand All @@ -14,14 +13,8 @@ import * as ValidationUtils from '@libs/ValidationUtils';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import INPUT_IDS from '@src/types/form/ReimbursementAccountForm';
import type {ReimbursementAccount} from '@src/types/onyx';

type ConfirmAgreementsOnyxProps = {
/** Reimbursement account from ONYX */
reimbursementAccount: OnyxEntry<ReimbursementAccount>;
};

type ConfirmAgreementsProps = SubStepProps & ConfirmAgreementsOnyxProps;
type ConfirmAgreementsProps = SubStepProps;

const COMPLETE_VERIFICATION_KEYS = INPUT_IDS.COMPLETE_VERIFICATION;
const STEP_FIELDS = [
Expand All @@ -45,12 +38,13 @@ function TermsAndConditionsLabel() {
return (
<Text>
{translate('common.iAcceptThe')}
<TextLink href={CONST.ACH_TERMS_URL}>{`${translate('completeVerificationStep.termsAndConditions')}`}</TextLink>
<TextLink href={CONST.OLD_DOT_PUBLIC_URLS.ACH_TERMS_URL}>{`${translate('completeVerificationStep.termsAndConditions')}`}</TextLink>
</Text>
);
}

function ConfirmAgreements({onNext, reimbursementAccount}: ConfirmAgreementsProps) {
function ConfirmAgreements({onNext}: ConfirmAgreementsProps) {
const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT);
const {translate} = useLocalize();
const styles = useThemeStyles();
const defaultValues = {
Expand Down Expand Up @@ -122,9 +116,4 @@ function ConfirmAgreements({onNext, reimbursementAccount}: ConfirmAgreementsProp

ConfirmAgreements.displayName = 'ConfirmAgreements';

export default withOnyx<ConfirmAgreementsProps, ConfirmAgreementsOnyxProps>({
// @ts-expect-error: ONYXKEYS.REIMBURSEMENT_ACCOUNT is conflicting with ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM
reimbursementAccount: {
key: ONYXKEYS.REIMBURSEMENT_ACCOUNT,
},
})(ConfirmAgreements);
export default ConfirmAgreements;
4 changes: 2 additions & 2 deletions src/pages/settings/AboutPage/AboutPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ function AboutPage() {
{translate('initialSettingsPage.readTheTermsAndPrivacy.phrase1')}{' '}
<TextLink
style={[styles.textMicroSupporting, styles.link]}
href={CONST.TERMS_URL}
href={CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}
>
{translate('initialSettingsPage.readTheTermsAndPrivacy.phrase2')}
</TextLink>{' '}
{translate('initialSettingsPage.readTheTermsAndPrivacy.phrase3')}{' '}
<TextLink
style={[styles.textMicroSupporting, styles.link]}
href={CONST.PRIVACY_URL}
href={CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}
>
{translate('initialSettingsPage.readTheTermsAndPrivacy.phrase4')}
</TextLink>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Subscription/PaymentCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function AddPaymentCard() {
{translate('subscription.paymentCard.security')}{' '}
<TextLink
style={[styles.mutedTextLabel, styles.link]}
href={CONST.TERMS_URL}
href={CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}
>
{translate('subscription.paymentCard.learnMoreAboutSecurity')}
</TextLink>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function RequestEarlyCancellationPage() {
() => (
<Text>
{translate('subscription.requestEarlyCancellation.acknowledgement.part1')}
<TextLink href={CONST.TERMS_URL}>{translate('subscription.requestEarlyCancellation.acknowledgement.link')}</TextLink>
<TextLink href={CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}>{translate('subscription.requestEarlyCancellation.acknowledgement.link')}</TextLink>
{translate('subscription.requestEarlyCancellation.acknowledgement.part2')}
</Text>
),
Expand Down
2 changes: 1 addition & 1 deletion src/pages/signin/Licenses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Licenses() {
{translate('termsOfUse.phrase5')}
<TextLink
style={[styles.textExtraSmallSupporting, styles.link]}
href={CONST.LICENSES_URL}
href={CONST.OLD_DOT_PUBLIC_URLS.LICENSES_URL}
>
{' '}
{translate('termsOfUse.phrase6')}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/signin/Terms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ function Terms() {
{translate('termsOfUse.phrase1')}
<TextLink
style={linkStyles}
href={CONST.TERMS_URL}
href={CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}
>
{' '}
{translate('termsOfUse.phrase2')}{' '}
</TextLink>
{translate('termsOfUse.phrase3')}
<TextLink
style={linkStyles}
href={CONST.PRIVACY_URL}
href={CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}
>
{' '}
{translate('termsOfUse.phrase4')}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/workspace/WorkspaceInviteMessagePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function WorkspaceInviteMessagePage({policy, route, currentUserPersonalDetails}:
/** Opens privacy url as an external link */
const openPrivacyURL = (event: GestureResponderEvent | KeyboardEvent | undefined) => {
event?.preventDefault();
Link.openExternalLink(CONST.PRIVACY_URL);
Link.openExternalLink(CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL);
};

const validate = (): FormInputErrors<typeof ONYXKEYS.FORMS.WORKSPACE_INVITE_MESSAGE_FORM> => {
Expand Down Expand Up @@ -155,7 +155,7 @@ function WorkspaceInviteMessagePage({policy, route, currentUserPersonalDetails}:
onPress={openPrivacyURL}
role={CONST.ROLE.LINK}
accessibilityLabel={translate('common.privacy')}
href={CONST.PRIVACY_URL}
href={CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}
style={[styles.mv2, styles.alignSelfStart]}
>
<View style={[styles.flexRow]}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ function WorkspaceOwnerPaymentCardForm({policy}: WorkspaceOwnerPaymentCardFormPr
{translate('workspace.changeOwner.addPaymentCardReadAndAcceptTextPart1')}{' '}
<TextLink
style={[styles.textMicroSupporting, styles.link]}
href={CONST.TERMS_URL}
href={CONST.OLD_DOT_PUBLIC_URLS.TERMS_URL}
>
{translate('workspace.changeOwner.addPaymentCardTerms')}
</TextLink>{' '}
{translate('workspace.changeOwner.addPaymentCardAnd')}{' '}
<TextLink
style={[styles.textMicroSupporting, styles.link]}
href={CONST.PRIVACY_URL}
href={CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}
>
{translate('workspace.changeOwner.addPaymentCardPrivacy')}
</TextLink>{' '}
Expand Down