@@ -16,17 +16,18 @@ import useBeforeRemove from '@hooks/useBeforeRemove';
16
16
import useLocalize from '@hooks/useLocalize' ;
17
17
import useNetwork from '@hooks/useNetwork' ;
18
18
import useThemeStyles from '@hooks/useThemeStyles' ;
19
- import * as FormActions from '@libs/actions/FormActions' ;
19
+ import { setDraftValues } from '@libs/actions/FormActions' ;
20
20
import { requestValidateCodeAction } from '@libs/actions/User' ;
21
- import * as CardUtils from '@libs/CardUtils' ;
22
- import * as CurrencyUtils from '@libs/CurrencyUtils' ;
23
- import * as GetPhysicalCardUtils from '@libs/GetPhysicalCardUtils' ;
21
+ import { formatCardExpiration , getDomainCards , maskCard } from '@libs/CardUtils' ;
22
+ import { convertToDisplayString } from '@libs/CurrencyUtils' ;
23
+ import { getUpdatedDraftValues , getUpdatedPrivatePersonalDetails , goToNextPhysicalCardRoute } from '@libs/GetPhysicalCardUtils' ;
24
24
import Navigation from '@libs/Navigation/Navigation' ;
25
25
import type { PlatformStackScreenProps } from '@libs/Navigation/PlatformStackNavigation/types' ;
26
26
import type { SettingsNavigatorParamList } from '@libs/Navigation/types' ;
27
+ import { buildCannedSearchQuery } from '@libs/SearchQueryUtils' ;
27
28
import NotFoundPage from '@pages/ErrorPage/NotFoundPage' ;
28
- import * as Card from '@userActions/Card' ;
29
- import * as Link from '@userActions/Link' ;
29
+ import { revealVirtualCardDetails } from '@userActions/Card' ;
30
+ import { openOldDotLink } from '@userActions/Link' ;
30
31
import CONST from '@src/CONST' ;
31
32
import type { TranslationPaths } from '@src/languages/types' ;
32
33
import ONYXKEYS from '@src/ONYXKEYS' ;
@@ -81,7 +82,7 @@ function ExpensifyCardPage({
81
82
const [ isNotFound , setIsNotFound ] = useState ( false ) ;
82
83
const cardsToShow = useMemo ( ( ) => {
83
84
if ( shouldDisplayCardDomain ) {
84
- return CardUtils . getDomainCards ( cardList ) [ domain ] ?. filter ( ( card ) => ! card ?. nameValuePairs ?. issuedBy || ! card ?. nameValuePairs ?. isVirtual ) ?? [ ] ;
85
+ return getDomainCards ( cardList ) [ domain ] ?. filter ( ( card ) => ! card ?. nameValuePairs ?. issuedBy || ! card ?. nameValuePairs ?. isVirtual ) ?? [ ] ;
85
86
}
86
87
return [ cardList ?. [ cardID ] ] ;
87
88
} , [ shouldDisplayCardDomain , cardList , cardID , domain ] ) ;
@@ -112,7 +113,7 @@ function ExpensifyCardPage({
112
113
// That is why this action is handled manually and the response is stored in a local state
113
114
// Hence eslint disable here.
114
115
// eslint-disable-next-line rulesdir/no-thenable-actions-in-views
115
- Card . revealVirtualCardDetails ( currentCardID , validateCode )
116
+ revealVirtualCardDetails ( currentCardID , validateCode )
116
117
. then ( ( value ) => {
117
118
setCardsDetails ( ( prevState : Record < number , ExpensifyCardDetails | null > ) => ( { ...prevState , [ currentCardID ] : value } ) ) ;
118
119
setCardsDetailsErrors ( ( prevState ) => ( {
@@ -135,7 +136,7 @@ function ExpensifyCardPage({
135
136
const hasDetectedDomainFraud = cardsToShow ?. some ( ( card ) => card ?. fraud === CONST . EXPENSIFY_CARD . FRAUD_TYPES . DOMAIN ) ;
136
137
const hasDetectedIndividualFraud = cardsToShow ?. some ( ( card ) => card ?. fraud === CONST . EXPENSIFY_CARD . FRAUD_TYPES . INDIVIDUAL ) ;
137
138
138
- const formattedAvailableSpendAmount = CurrencyUtils . convertToDisplayString ( cardsToShow ?. at ( 0 ) ?. availableSpend ) ;
139
+ const formattedAvailableSpendAmount = convertToDisplayString ( cardsToShow ?. at ( 0 ) ?. availableSpend ) ;
139
140
const { limitNameKey, limitTitleKey} = getLimitTypeTranslationKeys ( cardsToShow ?. at ( 0 ) ?. nameValuePairs ?. limitType ) ;
140
141
141
142
const primaryLogin = account ?. primaryLogin ?? '' ;
@@ -144,13 +145,13 @@ function ExpensifyCardPage({
144
145
const goToGetPhysicalCardFlow = ( ) => {
145
146
let updatedDraftValues = draftValues ;
146
147
if ( ! draftValues ) {
147
- updatedDraftValues = GetPhysicalCardUtils . getUpdatedDraftValues ( undefined , privatePersonalDetails , loginList ) ;
148
+ updatedDraftValues = getUpdatedDraftValues ( undefined , privatePersonalDetails , loginList ) ;
148
149
// Form draft data needs to be initialized with the private personal details
149
150
// If no draft data exists
150
- FormActions . setDraftValues ( ONYXKEYS . FORMS . GET_PHYSICAL_CARD_FORM , updatedDraftValues ) ;
151
+ setDraftValues ( ONYXKEYS . FORMS . GET_PHYSICAL_CARD_FORM , updatedDraftValues ) ;
151
152
}
152
153
153
- GetPhysicalCardUtils . goToNextPhysicalCardRoute ( domain , GetPhysicalCardUtils . getUpdatedPrivatePersonalDetails ( updatedDraftValues , privatePersonalDetails ) ) ;
154
+ goToNextPhysicalCardRoute ( domain , getUpdatedPrivatePersonalDetails ( updatedDraftValues , privatePersonalDetails ) ) ;
154
155
} ;
155
156
156
157
if ( isNotFound ) {
@@ -187,7 +188,7 @@ function ExpensifyCardPage({
187
188
< Button
188
189
style = { [ styles . mh5 , styles . mb5 ] }
189
190
text = { translate ( 'cardPage.reviewTransaction' ) }
190
- onPress = { ( ) => Link . openOldDotLink ( CONST . OLDDOT_URLS . INBOX ) }
191
+ onPress = { ( ) => openOldDotLink ( CONST . OLDDOT_URLS . INBOX ) }
191
192
/>
192
193
</ >
193
194
) }
@@ -214,15 +215,15 @@ function ExpensifyCardPage({
214
215
{ ! ! cardsDetails [ card . cardID ] && cardsDetails [ card . cardID ] ?. pan ? (
215
216
< CardDetails
216
217
pan = { cardsDetails [ card . cardID ] ?. pan }
217
- expiration = { CardUtils . formatCardExpiration ( cardsDetails [ card . cardID ] ?. expiration ?? '' ) }
218
+ expiration = { formatCardExpiration ( cardsDetails [ card . cardID ] ?. expiration ?? '' ) }
218
219
cvv = { cardsDetails [ card . cardID ] ?. cvv }
219
220
domain = { domain }
220
221
/>
221
222
) : (
222
223
< >
223
224
< MenuItemWithTopDescription
224
225
description = { translate ( 'cardPage.virtualCardNumber' ) }
225
- title = { CardUtils . maskCard ( '' ) }
226
+ title = { maskCard ( '' ) }
226
227
interactive = { false }
227
228
titleStyle = { styles . walletCardNumber }
228
229
shouldShowRightComponent
@@ -259,7 +260,7 @@ function ExpensifyCardPage({
259
260
< >
260
261
< MenuItemWithTopDescription
261
262
description = { translate ( 'cardPage.physicalCardNumber' ) }
262
- title = { CardUtils . maskCard ( card ?. lastFourPAN ) }
263
+ title = { maskCard ( card ?. lastFourPAN ) }
263
264
interactive = { false }
264
265
titleStyle = { styles . walletCardNumber }
265
266
/>
@@ -272,6 +273,18 @@ function ExpensifyCardPage({
272
273
</ >
273
274
) ;
274
275
} ) }
276
+ < MenuItem
277
+ icon = { Expensicons . MoneySearch }
278
+ title = { translate ( 'workspace.common.viewTransactions' ) }
279
+ style = { styles . mt3 }
280
+ onPress = { ( ) => {
281
+ Navigation . navigate (
282
+ ROUTES . SEARCH_CENTRAL_PANE . getRoute ( {
283
+ query : buildCannedSearchQuery ( { type : CONST . SEARCH . DATA_TYPES . EXPENSE , status : CONST . SEARCH . STATUS . EXPENSE . ALL , cardID} ) ,
284
+ } ) ,
285
+ ) ;
286
+ } }
287
+ />
275
288
</ >
276
289
) }
277
290
</ ScrollView >
0 commit comments