diff --git a/src/languages/en.ts b/src/languages/en.ts index ff43644bbbca..1c414638407d 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2659,6 +2659,7 @@ const translations = { planType: 'Plan type', submitExpense: 'Submit expenses using your workspace chat below:', defaultCategory: 'Default category', + viewTransactions: 'View transactions', }, perDiem: { subtitle: 'Set per diem rates to control daily employee spend. ', diff --git a/src/languages/es.ts b/src/languages/es.ts index bf4d14f445cd..60996c9c0ce4 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2683,6 +2683,7 @@ const translations = { planType: 'Tipo de plan', submitExpense: 'Envíe los gastos utilizando el chat de su espacio de trabajo:', defaultCategory: 'Categoría predeterminada', + viewTransactions: 'Ver transacciones', }, perDiem: { subtitle: 'Establece las tasas per diem para controlar los gastos diarios de los empleados. ', diff --git a/src/libs/SearchQueryUtils.ts b/src/libs/SearchQueryUtils.ts index e754107fd0b9..3bbc08a5a532 100644 --- a/src/libs/SearchQueryUtils.ts +++ b/src/libs/SearchQueryUtils.ts @@ -624,14 +624,22 @@ function buildCannedSearchQuery({ type = CONST.SEARCH.DATA_TYPES.EXPENSE, status = CONST.SEARCH.STATUS.EXPENSE.ALL, policyID, + cardID, }: { type?: SearchDataTypes; status?: SearchStatus; policyID?: string; + cardID?: string; } = {}): SearchQueryString { - const queryString = policyID - ? `type:${type} status:${Array.isArray(status) ? status.join(',') : status} policyID:${policyID}` - : `type:${type} status:${Array.isArray(status) ? status.join(',') : status}`; + let queryString = `type:${type} status:${Array.isArray(status) ? status.join(',') : status}`; + + if (policyID) { + queryString = `type:${type} status:${Array.isArray(status) ? status.join(',') : status} policyID:${policyID}`; + } + + if (cardID) { + queryString = `type:${type} status:${Array.isArray(status) ? status.join(',') : status} expense-type:card card:${cardID}`; + } // Parse the query to fill all default query fields with values const normalizedQueryJSON = buildSearchQueryJSON(queryString); diff --git a/src/pages/settings/Wallet/ExpensifyCardPage.tsx b/src/pages/settings/Wallet/ExpensifyCardPage.tsx index 394d254aa926..32ec1d0f2439 100644 --- a/src/pages/settings/Wallet/ExpensifyCardPage.tsx +++ b/src/pages/settings/Wallet/ExpensifyCardPage.tsx @@ -16,17 +16,18 @@ import useBeforeRemove from '@hooks/useBeforeRemove'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as FormActions from '@libs/actions/FormActions'; +import {setDraftValues} from '@libs/actions/FormActions'; import {requestValidateCodeAction} from '@libs/actions/User'; -import * as CardUtils from '@libs/CardUtils'; -import * as CurrencyUtils from '@libs/CurrencyUtils'; -import * as GetPhysicalCardUtils from '@libs/GetPhysicalCardUtils'; +import {formatCardExpiration, getDomainCards, maskCard} from '@libs/CardUtils'; +import {convertToDisplayString} from '@libs/CurrencyUtils'; +import {getUpdatedDraftValues, getUpdatedPrivatePersonalDetails, goToNextPhysicalCardRoute} from '@libs/GetPhysicalCardUtils'; import Navigation from '@libs/Navigation/Navigation'; import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; +import {buildCannedSearchQuery} from '@libs/SearchQueryUtils'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; -import * as Card from '@userActions/Card'; -import * as Link from '@userActions/Link'; +import {revealVirtualCardDetails} from '@userActions/Card'; +import {openOldDotLink} from '@userActions/Link'; import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -81,7 +82,7 @@ function ExpensifyCardPage({ const [isNotFound, setIsNotFound] = useState(false); const cardsToShow = useMemo(() => { if (shouldDisplayCardDomain) { - return CardUtils.getDomainCards(cardList)[domain]?.filter((card) => !card?.nameValuePairs?.issuedBy || !card?.nameValuePairs?.isVirtual) ?? []; + return getDomainCards(cardList)[domain]?.filter((card) => !card?.nameValuePairs?.issuedBy || !card?.nameValuePairs?.isVirtual) ?? []; } return [cardList?.[cardID]]; }, [shouldDisplayCardDomain, cardList, cardID, domain]); @@ -112,7 +113,7 @@ function ExpensifyCardPage({ // That is why this action is handled manually and the response is stored in a local state // Hence eslint disable here. // eslint-disable-next-line rulesdir/no-thenable-actions-in-views - Card.revealVirtualCardDetails(currentCardID, validateCode) + revealVirtualCardDetails(currentCardID, validateCode) .then((value) => { setCardsDetails((prevState: Record) => ({...prevState, [currentCardID]: value})); setCardsDetailsErrors((prevState) => ({ @@ -135,7 +136,7 @@ function ExpensifyCardPage({ const hasDetectedDomainFraud = cardsToShow?.some((card) => card?.fraud === CONST.EXPENSIFY_CARD.FRAUD_TYPES.DOMAIN); const hasDetectedIndividualFraud = cardsToShow?.some((card) => card?.fraud === CONST.EXPENSIFY_CARD.FRAUD_TYPES.INDIVIDUAL); - const formattedAvailableSpendAmount = CurrencyUtils.convertToDisplayString(cardsToShow?.at(0)?.availableSpend); + const formattedAvailableSpendAmount = convertToDisplayString(cardsToShow?.at(0)?.availableSpend); const {limitNameKey, limitTitleKey} = getLimitTypeTranslationKeys(cardsToShow?.at(0)?.nameValuePairs?.limitType); const primaryLogin = account?.primaryLogin ?? ''; @@ -144,13 +145,13 @@ function ExpensifyCardPage({ const goToGetPhysicalCardFlow = () => { let updatedDraftValues = draftValues; if (!draftValues) { - updatedDraftValues = GetPhysicalCardUtils.getUpdatedDraftValues(undefined, privatePersonalDetails, loginList); + updatedDraftValues = getUpdatedDraftValues(undefined, privatePersonalDetails, loginList); // Form draft data needs to be initialized with the private personal details // If no draft data exists - FormActions.setDraftValues(ONYXKEYS.FORMS.GET_PHYSICAL_CARD_FORM, updatedDraftValues); + setDraftValues(ONYXKEYS.FORMS.GET_PHYSICAL_CARD_FORM, updatedDraftValues); } - GetPhysicalCardUtils.goToNextPhysicalCardRoute(domain, GetPhysicalCardUtils.getUpdatedPrivatePersonalDetails(updatedDraftValues, privatePersonalDetails)); + goToNextPhysicalCardRoute(domain, getUpdatedPrivatePersonalDetails(updatedDraftValues, privatePersonalDetails)); }; if (isNotFound) { @@ -187,7 +188,7 @@ function ExpensifyCardPage({