diff --git a/src/CONST.ts b/src/CONST.ts index 204ccaccf394b..5e9c56f69681c 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -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', @@ -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', diff --git a/src/components/AddPaymentCard/PaymentCardForm.tsx b/src/components/AddPaymentCard/PaymentCardForm.tsx index 9843996602f10..bcb3e27783e82 100644 --- a/src/components/AddPaymentCard/PaymentCardForm.tsx +++ b/src/components/AddPaymentCard/PaymentCardForm.tsx @@ -48,8 +48,8 @@ function IAcceptTheLabel() { return ( {`${translate('common.iAcceptThe')}`} - {`${translate('common.addCardTermsOfService')}`} {`${translate('common.and')}`} - {` ${translate('common.privacyPolicy')} `} + {`${translate('common.addCardTermsOfService')}`} {`${translate('common.and')}`} + {` ${translate('common.privacyPolicy')} `} ); } diff --git a/src/libs/actions/Link.ts b/src/libs/actions/Link.ts index 0250ea7b84a1a..cee639f4c4a3a 100644 --- a/src/libs/actions/Link.ts +++ b/src/libs/actions/Link.ts @@ -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; } diff --git a/src/pages/EnablePayments/FeesAndTerms/substeps/TermsStep.tsx b/src/pages/EnablePayments/FeesAndTerms/substeps/TermsStep.tsx index 7998d9511b0d7..e71a979165ec8 100644 --- a/src/pages/EnablePayments/FeesAndTerms/substeps/TermsStep.tsx +++ b/src/pages/EnablePayments/FeesAndTerms/substeps/TermsStep.tsx @@ -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 ( {`${translate('termsStep.agreeToThe')} `} - {`${translate('common.privacy')} `} + {`${translate('common.privacy')} `} {`${translate('common.and')} `} {`${translate('termsStep.walletAgreement')}.`} diff --git a/src/pages/EnablePayments/TermsStep.tsx b/src/pages/EnablePayments/TermsStep.tsx index 09bf0da163bc2..fe7574178422b 100644 --- a/src/pages/EnablePayments/TermsStep.tsx +++ b/src/pages/EnablePayments/TermsStep.tsx @@ -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'; @@ -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; -}; - -type TermsStepProps = TermsStepOnyxProps & { +type TermsStepProps = { /** The user's wallet */ userWallet: OnyxEntry; }; @@ -44,9 +39,9 @@ function AgreeToTheLabel() { return ( {`${translate('termsStep.agreeToThe')} `} - {`${translate('common.privacy')} `} + {`${translate('common.privacy')} `} {`${translate('common.and')} `} - {`${translate('termsStep.walletAgreement')}.`} + {`${translate('termsStep.walletAgreement')}.`} ); } @@ -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); @@ -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]} /> @@ -124,8 +119,4 @@ function TermsStep(props: TermsStepProps) { TermsStep.displayName = 'TermsPage'; -export default withOnyx({ - walletTerms: { - key: ONYXKEYS.WALLET_TERMS, - }, -})(TermsStep); +export default TermsStep; diff --git a/src/pages/ReimbursementAccount/BankAccountStep.tsx b/src/pages/ReimbursementAccount/BankAccountStep.tsx index 8a1c751e37ce2..95d8f2c396636 100644 --- a/src/pages/ReimbursementAccount/BankAccountStep.tsx +++ b/src/pages/ReimbursementAccount/BankAccountStep.tsx @@ -211,7 +211,7 @@ function BankAccountStep({ - {translate('common.privacy')} + {translate('common.privacy')} Link.openExternalLink('https://help.expensify.com/articles/new-expensify/settings/Encryption-and-Data-Security/')} style={[styles.flexRow, styles.alignItemsCenter]} diff --git a/src/pages/ReimbursementAccount/CompleteVerification/substeps/ConfirmAgreements.tsx b/src/pages/ReimbursementAccount/CompleteVerification/substeps/ConfirmAgreements.tsx index 71d7a80ab58b4..ff3a5dc28cbdd 100644 --- a/src/pages/ReimbursementAccount/CompleteVerification/substeps/ConfirmAgreements.tsx +++ b/src/pages/ReimbursementAccount/CompleteVerification/substeps/ConfirmAgreements.tsx @@ -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'; @@ -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; -}; - -type ConfirmAgreementsProps = SubStepProps & ConfirmAgreementsOnyxProps; +type ConfirmAgreementsProps = SubStepProps; const COMPLETE_VERIFICATION_KEYS = INPUT_IDS.COMPLETE_VERIFICATION; const STEP_FIELDS = [ @@ -45,12 +38,13 @@ function TermsAndConditionsLabel() { return ( {translate('common.iAcceptThe')} - {`${translate('completeVerificationStep.termsAndConditions')}`} + {`${translate('completeVerificationStep.termsAndConditions')}`} ); } -function ConfirmAgreements({onNext, reimbursementAccount}: ConfirmAgreementsProps) { +function ConfirmAgreements({onNext}: ConfirmAgreementsProps) { + const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT); const {translate} = useLocalize(); const styles = useThemeStyles(); const defaultValues = { @@ -122,9 +116,4 @@ function ConfirmAgreements({onNext, reimbursementAccount}: ConfirmAgreementsProp ConfirmAgreements.displayName = 'ConfirmAgreements'; -export default withOnyx({ - // @ts-expect-error: ONYXKEYS.REIMBURSEMENT_ACCOUNT is conflicting with ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM - reimbursementAccount: { - key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, - }, -})(ConfirmAgreements); +export default ConfirmAgreements; diff --git a/src/pages/settings/AboutPage/AboutPage.tsx b/src/pages/settings/AboutPage/AboutPage.tsx index 4232e08f70f05..85995dae01872 100644 --- a/src/pages/settings/AboutPage/AboutPage.tsx +++ b/src/pages/settings/AboutPage/AboutPage.tsx @@ -166,14 +166,14 @@ function AboutPage() { {translate('initialSettingsPage.readTheTermsAndPrivacy.phrase1')}{' '} {translate('initialSettingsPage.readTheTermsAndPrivacy.phrase2')} {' '} {translate('initialSettingsPage.readTheTermsAndPrivacy.phrase3')}{' '} {translate('initialSettingsPage.readTheTermsAndPrivacy.phrase4')} diff --git a/src/pages/settings/Subscription/PaymentCard/index.tsx b/src/pages/settings/Subscription/PaymentCard/index.tsx index 61178d8f5cadc..c87515a61589b 100644 --- a/src/pages/settings/Subscription/PaymentCard/index.tsx +++ b/src/pages/settings/Subscription/PaymentCard/index.tsx @@ -97,7 +97,7 @@ function AddPaymentCard() { {translate('subscription.paymentCard.security')}{' '} {translate('subscription.paymentCard.learnMoreAboutSecurity')} diff --git a/src/pages/settings/Subscription/RequestEarlyCancellationPage/index.tsx b/src/pages/settings/Subscription/RequestEarlyCancellationPage/index.tsx index 561f05b5167e0..922293dc06512 100644 --- a/src/pages/settings/Subscription/RequestEarlyCancellationPage/index.tsx +++ b/src/pages/settings/Subscription/RequestEarlyCancellationPage/index.tsx @@ -38,7 +38,7 @@ function RequestEarlyCancellationPage() { () => ( {translate('subscription.requestEarlyCancellation.acknowledgement.part1')} - {translate('subscription.requestEarlyCancellation.acknowledgement.link')} + {translate('subscription.requestEarlyCancellation.acknowledgement.link')} {translate('subscription.requestEarlyCancellation.acknowledgement.part2')} ), diff --git a/src/pages/signin/Licenses.tsx b/src/pages/signin/Licenses.tsx index 87271e3df6b27..e3ea73d4a0626 100644 --- a/src/pages/signin/Licenses.tsx +++ b/src/pages/signin/Licenses.tsx @@ -19,7 +19,7 @@ function Licenses() { {translate('termsOfUse.phrase5')} {' '} {translate('termsOfUse.phrase6')} diff --git a/src/pages/signin/Terms.tsx b/src/pages/signin/Terms.tsx index 293cc42ea8d74..c985d45b5272f 100644 --- a/src/pages/signin/Terms.tsx +++ b/src/pages/signin/Terms.tsx @@ -22,7 +22,7 @@ function Terms() { {translate('termsOfUse.phrase1')} {' '} {translate('termsOfUse.phrase2')}{' '} @@ -30,7 +30,7 @@ function Terms() { {translate('termsOfUse.phrase3')} {' '} {translate('termsOfUse.phrase4')} diff --git a/src/pages/workspace/WorkspaceInviteMessagePage.tsx b/src/pages/workspace/WorkspaceInviteMessagePage.tsx index df1fb63b5fd73..5b9d64d52cbc1 100644 --- a/src/pages/workspace/WorkspaceInviteMessagePage.tsx +++ b/src/pages/workspace/WorkspaceInviteMessagePage.tsx @@ -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 => { @@ -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]} > diff --git a/src/pages/workspace/members/WorkspaceOwnerPaymentCardForm.tsx b/src/pages/workspace/members/WorkspaceOwnerPaymentCardForm.tsx index 89b921b9f9ae0..2b317809c9966 100644 --- a/src/pages/workspace/members/WorkspaceOwnerPaymentCardForm.tsx +++ b/src/pages/workspace/members/WorkspaceOwnerPaymentCardForm.tsx @@ -88,14 +88,14 @@ function WorkspaceOwnerPaymentCardForm({policy}: WorkspaceOwnerPaymentCardFormPr {translate('workspace.changeOwner.addPaymentCardReadAndAcceptTextPart1')}{' '} {translate('workspace.changeOwner.addPaymentCardTerms')} {' '} {translate('workspace.changeOwner.addPaymentCardAnd')}{' '} {translate('workspace.changeOwner.addPaymentCardPrivacy')} {' '}