diff --git a/src/languages/en.ts b/src/languages/en.ts index 0a9f71e5888d..9aad437c36a4 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -3370,16 +3370,16 @@ const translations = { text: 'Learn more about these ', linkText: 'options.', }, - customFeedDetails: 'Requires setup with your bank. This is typically used by larger companies and is often the best option if you qualify.', + commercialFeedDetails: 'Requires setup with your bank. This is typically used by larger companies and is often the best option if you qualify.', directFeedDetails: 'The simplest approach. Connect right away using your master credentials. This method is most common.', enableFeed: { title: ({provider}: GoBackMessageParams) => `Enable your ${provider} feed`, heading: 'We have a direct integration with your card issuer and can import your transaction data into Expensify quickly and accurately.\n\nTo get started, simply:', visa: 'We have global integrations with Visa, though eligibility varies by bank and card program.\n\nTo get started, simply:', mastercard: 'We have global integrations with Mastercard, though eligibility varies by bank and card program.\n\nTo get started, simply:', - vcf: `1. Visit [this help article](${CONST.COMPANY_CARDS_HELP}) for detailed instructions on how to set up your Visa Commercial Cards.\n\n2. [Contact your bank](${CONST.COMPANY_CARDS_HELP}) to verify they support a custom feed for your program, and ask them to enable it.\n\n3. *Once the feed is enabled and you have its details, continue to the next screen.*`, - gl1025: `1. Visit [this help article](${CONST.COMPANY_CARDS_HELP}) to find out if American Express can enable a custom feed for your program.\n\n2. Once the feed is enabled, Amex will send you a production letter.\n\n3. *Once you have the feed information, continue to the next screen.*`, - cdf: `1. Visit [this help article](${CONST.COMPANY_CARDS_HELP}) for detailed instructions on how to set up your Mastercard Commercial Cards.\n\n 2. [Contact your bank](${CONST.COMPANY_CARDS_HELP}) to verify they support a custom feed for your program, and ask them to enable it.\n\n3. *Once the feed is enabled and you have its details, continue to the next screen.*`, + vcf: `1. Visit [this help article](${CONST.COMPANY_CARDS_HELP}) for detailed instructions on how to set up your Visa Commercial Cards.\n\n2. [Contact your bank](${CONST.COMPANY_CARDS_HELP}) to verify they support a commercial feed for your program, and ask them to enable it.\n\n3. *Once the feed is enabled and you have its details, continue to the next screen.*`, + gl1025: `1. Visit [this help article](${CONST.COMPANY_CARDS_HELP}) to find out if American Express can enable a commercial feed for your program.\n\n2. Once the feed is enabled, Amex will send you a production letter.\n\n3. *Once you have the feed information, continue to the next screen.*`, + cdf: `1. Visit [this help article](${CONST.COMPANY_CARDS_HELP}) for detailed instructions on how to set up your Mastercard Commercial Cards.\n\n 2. [Contact your bank](${CONST.COMPANY_CARDS_HELP}) to verify they support a commercial feed for your program, and ask them to enable it.\n\n3. *Once the feed is enabled and you have its details, continue to the next screen.*`, stripe: `1. Visit Stripe’s Dashboard, and go to [Settings](${CONST.COMPANY_CARDS_STRIPE_HELP}).\n\n2. Under Product Integrations, click Enable next to Expensify.\n\n3. Once the feed is enabled, click Submit below and we’ll work on adding it.`, }, whatBankIssuesCard: 'What bank issues these cards?', @@ -3415,7 +3415,7 @@ const translations = { }, assignCard: 'Assign card', cardNumber: 'Card number', - customFeed: 'Custom feed', + commercialFeed: 'Commercial feed', feedName: ({feedName}: CompanyCardFeedNameParams) => `${feedName} cards`, directFeed: 'Direct feed', whoNeedsCardAssigned: 'Who needs a card assigned?', diff --git a/src/languages/es.ts b/src/languages/es.ts index 225895a5424e..3909406a96ed 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -3409,7 +3409,7 @@ const translations = { text: 'Obtén más información sobre estas ', linkText: 'opciones.', }, - customFeedDetails: 'Requiere configuración con tu banco. Esto suele ser utilizado por empresas más grandes y a menudo es la mejor opción si calificas.', + commercialFeedDetails: 'Requiere configuración con tu banco. Esto suele ser utilizado por empresas más grandes y a menudo es la mejor opción si calificas.', directFeedDetails: 'El enfoque más simple. Conéctate de inmediato usando tus credenciales maestras. Este método es el más común.', enableFeed: { title: ({provider}: GoBackMessageParams) => `Habilita tu feed ${provider}`, @@ -3455,7 +3455,7 @@ const translations = { }, assignCard: 'Asignar tarjeta', cardNumber: 'Número de la tarjeta', - customFeed: 'Fuente personalizada', + commercialFeed: 'Fuente comercial', feedName: ({feedName}: CompanyCardFeedNameParams) => `Tarjetas ${feedName}`, directFeed: 'Fuente directa', whoNeedsCardAssigned: '¿Quién necesita una tarjeta?', diff --git a/src/libs/CardUtils.ts b/src/libs/CardUtils.ts index 02b9ce5be587..1d697af554f5 100644 --- a/src/libs/CardUtils.ts +++ b/src/libs/CardUtils.ts @@ -284,6 +284,9 @@ function getCardFeedIcon(cardFeed: CompanyCardFeed | typeof CONST.EXPENSIFY_CARD return Illustrations.AmexCompanyCards; } +/** + * Verify if the feed is a custom feed. Those are also refered to as commercial feeds. + */ function isCustomFeed(feed: CompanyCardFeed): boolean { return [CONST.COMPANY_CARD.FEED_BANK_NAME.MASTER_CARD, CONST.COMPANY_CARD.FEED_BANK_NAME.VISA, CONST.COMPANY_CARD.FEED_BANK_NAME.AMEX].some((value) => value === feed); } diff --git a/src/pages/workspace/companyCards/WorkspaceCompanyCardsListHeaderButtons.tsx b/src/pages/workspace/companyCards/WorkspaceCompanyCardsListHeaderButtons.tsx index 0f8893c5bce2..7e4b5fe925f5 100644 --- a/src/pages/workspace/companyCards/WorkspaceCompanyCardsListHeaderButtons.tsx +++ b/src/pages/workspace/companyCards/WorkspaceCompanyCardsListHeaderButtons.tsx @@ -12,8 +12,8 @@ import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as CardUtils from '@libs/CardUtils'; -import * as PolicyUtils from '@libs/PolicyUtils'; +import {getCardFeedIcon, getCompanyFeeds, getCustomOrFormattedFeedName, isCustomFeed} from '@libs/CardUtils'; +import {getWorkspaceAccountID, hasPolicyFeedsError} from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import variables from '@styles/variables'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -39,12 +39,12 @@ function WorkspaceCompanyCardsListHeaderButtons({policyID, selectedFeed, shouldS const {translate} = useLocalize(); const theme = useTheme(); const {shouldUseNarrowLayout, isMediumScreenWidth} = useResponsiveLayout(); - const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyID); + const workspaceAccountID = getWorkspaceAccountID(policyID); const [cardFeeds] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${workspaceAccountID}`); const shouldChangeLayout = isMediumScreenWidth || shouldUseNarrowLayout; - const formattedFeedName = CardUtils.getCustomOrFormattedFeedName(selectedFeed, cardFeeds?.settings?.companyCardNicknames); - const isCustomFeed = CardUtils.isCustomFeed(selectedFeed); - const companyFeeds = CardUtils.getCompanyFeeds(cardFeeds); + const formattedFeedName = getCustomOrFormattedFeedName(selectedFeed, cardFeeds?.settings?.companyCardNicknames); + const isCommercialFeed = isCustomFeed(selectedFeed); + const companyFeeds = getCompanyFeeds(cardFeeds); const currentFeedData = companyFeeds?.[selectedFeed]; return ( @@ -60,7 +60,7 @@ function WorkspaceCompanyCardsListHeaderButtons({policyID, selectedFeed, shouldS accessibilityLabel={formattedFeedName ?? ''} > {formattedFeedName} - {PolicyUtils.hasPolicyFeedsError(companyFeeds, selectedFeed) && ( + {hasPolicyFeedsError(companyFeeds, selectedFeed) && ( )} - {translate(isCustomFeed ? 'workspace.companyCards.customFeed' : 'workspace.companyCards.directFeed')} + {translate(isCommercialFeed ? 'workspace.companyCards.commercialFeed' : 'workspace.companyCards.directFeed')} diff --git a/src/pages/workspace/companyCards/addNew/SelectFeedType.tsx b/src/pages/workspace/companyCards/addNew/SelectFeedType.tsx index 53b88b2b7295..7fe8da2f9954 100644 --- a/src/pages/workspace/companyCards/addNew/SelectFeedType.tsx +++ b/src/pages/workspace/companyCards/addNew/SelectFeedType.tsx @@ -11,7 +11,7 @@ import Text from '@components/Text'; import TextLink from '@components/TextLink'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as CompanyCards from '@userActions/CompanyCards'; +import {setAddNewCompanyCardStepAndData} from '@userActions/CompanyCards'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -27,7 +27,7 @@ function SelectFeedType() { setHasError(true); return; } - CompanyCards.setAddNewCompanyCardStepAndData({ + setAddNewCompanyCardStepAndData({ step: typeSelected === CONST.COMPANY_CARDS.FEED_TYPE.DIRECT ? CONST.COMPANY_CARDS.STEP.BANK_CONNECTION : CONST.COMPANY_CARDS.STEP.CARD_TYPE, data: {selectedFeedType: typeSelected}, }); @@ -38,14 +38,14 @@ function SelectFeedType() { }, [addNewCard?.data.selectedFeedType]); const handleBackButtonPress = () => { - CompanyCards.setAddNewCompanyCardStepAndData({step: CONST.COMPANY_CARDS.STEP.SELECT_BANK}); + setAddNewCompanyCardStepAndData({step: CONST.COMPANY_CARDS.STEP.SELECT_BANK}); }; const data = [ { value: CONST.COMPANY_CARDS.FEED_TYPE.CUSTOM, - text: translate('workspace.companyCards.customFeed'), - alternateText: translate('workspace.companyCards.addNewCard.customFeedDetails'), + text: translate('workspace.companyCards.commercialFeed'), + alternateText: translate('workspace.companyCards.addNewCard.commercialFeedDetails'), keyForList: CONST.COMPANY_CARDS.FEED_TYPE.CUSTOM, isSelected: typeSelected === CONST.COMPANY_CARDS.FEED_TYPE.CUSTOM, }, diff --git a/src/pages/workspace/companyCards/assignCard/BankConnection/index.native.tsx b/src/pages/workspace/companyCards/assignCard/BankConnection/index.native.tsx index fca4f2d4f1ce..aec2c9ece0cd 100644 --- a/src/pages/workspace/companyCards/assignCard/BankConnection/index.native.tsx +++ b/src/pages/workspace/companyCards/assignCard/BankConnection/index.native.tsx @@ -33,6 +33,7 @@ function BankConnection({policyID, feed}: BankConnectionStepProps) { const url = getCompanyCardBankConnection(policyID, bankName); const workspaceAccountID = getWorkspaceAccountID(policyID); const [cardFeeds] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${workspaceAccountID}`); + // This does not apply for custom feeds, this is used to check if the feed is expired to push user to reauthenticate const isFeedExpired = isSelectedFeedExpired(cardFeeds?.settings?.oAuthAccountDetails?.[feed]);