-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update UI to show fraud states #29680
Conversation
2c69338
to
d13e96c
Compare
@@ -1237,7 +1237,7 @@ const CONST = { | |||
BANK: 'Expensify Card', | |||
FRAUD_TYPES: { | |||
DOMAIN: 'domain', | |||
INDIVIDUAL: 'individal', | |||
INDIVIDUAL: 'individual', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
8d6022c
to
5fec082
Compare
@eVoloshchak Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
||
// Additional styles to apply to the text | ||
// eslint-disable-next-line react/forbid-prop-types | ||
textStyle: PropTypes.arrayOf(PropTypes.object), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we rename this textStyles
as it's an array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
@@ -62,6 +66,9 @@ function ExpensifyCardPage({ | |||
setShouldShowCardDetails(true); | |||
}; | |||
|
|||
const isDetectedDomainFraud = _.some(domainCards, (card) => card.fraud === CONST.EXPENSIFY_CARD.FRAUD_TYPES.DOMAIN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these read better:
hasDetectedDomainFraud
hasDetectedIndividualFraud
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
applied
titleStyle={styles.newKansasLarge} | ||
/> | ||
{!_.isEmpty(virtualCard) && ( | ||
{isDetectedDomainFraud && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use the Boolean ? () : null
pattern instead of &&
for these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
applied
titleStyle={styles.walletCardMenuItem} | ||
/> | ||
|
||
{!isDetectedDomainFraud && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way we could default to this without depending on the fraud variables? Since this the core of this page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to the requirements, we need to hide this block in case of detected domain fraud
|
||
// Additional styles to apply to the text | ||
// eslint-disable-next-line react/forbid-prop-types | ||
textStyle: PropTypes.arrayOf(PropTypes.object), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use stylePropTypes
for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
}; | ||
|
||
const defaultProps = { | ||
messages: {}, | ||
style: [], | ||
textStyle: [], | ||
}; | ||
|
||
function DotIndicatorMessage(props) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not directly related to this PR, but since we're adding changes to this component, let's use prop destructuring, it's documented as a best practice now
// Bad
function UserInfo(props) {
return (
<View>
<Text>Name: {props.name}</Text>
<Text>Email: {props.email}</Text>
</View>
}
UserInfo.defaultProps = {
name: 'anonymous';
}
// Good
function UserInfo({ name = 'anonymous', email }) {
return (
<View>
<Text>Name: {name}</Text>
<Text>Email: {email}</Text>
</View>
);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that we need to update this in the scope of the current task
I believe that the best way is to apply it with typescript migration
shouldShowRightIcon | ||
onPress={() => Navigation.navigate(ROUTES.SETTINGS_REPORT_FRAUD.getRoute(domain))} | ||
brickRoadIndicator="error" | ||
onPress={() => Link.openOldDotLink('inbox')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should leave a note that this won't work in DEV and staging too, only in production (I wonder if buildOldDotURL is supposed to add environment to URL, since there is no dev/staging version of oldDot)
Screen.Recording.2023-10-19.at.17.06.52.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should leave a note that this won't work in DEV and staging too, only in production (I wonder if buildOldDotURL is supposed to add environment to URL, since there is no dev/staging version of oldDot)
@0xmiroslav Internal employees do have a DEV/staging Old Dot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah you were tagging @eVoloshchak
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I'll have to change the profile pic, this isn't the first time this happens 😅
@@ -25,11 +26,16 @@ const propTypes = { | |||
// Additional styles to apply to the container */ | |||
// eslint-disable-next-line react/forbid-prop-types | |||
style: PropTypes.arrayOf(PropTypes.object), | |||
|
|||
// Additional styles to apply to the text | |||
// eslint-disable-next-line react/forbid-prop-types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// eslint-disable-next-line react/forbid-prop-types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-10-20.at.18.26.32.movMobile Web - Chromescreen-20231020-182140.mp4Mobile Web - SafariScreen.Recording.2023-10-20.at.18.18.15.movDesktopScreen.Recording.2023-10-20.at.18.25.10.moviOSScreen.Recording.2023-10-20.at.18.17.14.movAndroidscreen-20231020-182033.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks and tests good, but there are a couple of propType warnings
- Invalid prop
cardList.234523452345.fraud
of valueindividual
supplied toExpensifyCardPage
, expected one of ["domain",null,"none"].
fraud: PropTypes.oneOf([CONST.EXPENSIFY_CARD.FRAUD_TYPES.DOMAIN, CONST.EXPENSIFY_CARD.FRAUD_TYPES.USER, CONST.EXPENSIFY_CARD.FRAUD_TYPES.NONE]),
This line is at fault it seems - Update test data with fraud: "domain" for one of the cards, press on the card, observe the following propType warning:
Invalid prop `messages` of type `array` supplied to `DotIndicatorMessage`, expected an object
We should replacemessages={[translate('cardPage.cardLocked')]}
withmessages={{0: translate('cardPage.cardLocked')}}
- Not sure if this one is related to the PR, but when you enter wallet page on native platforms (iOS/Android), the ‘VirtualizedLists should never be nested inside plain ScrollViews’ warning pops up
@eVoloshchak The VirtualizedLists is not directly related to this PR since there are no structure changes on the wallet page, only the adding of new prop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@eVoloshchak before I merge, can you confirm that you tested that the latest branch has no errors on all platforms |
@grgia, merged the latest main and re-tested, no errors on all platforms |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/grgia in version: 1.3.90-0 🚀
|
🚀 Deployed to production by https://github.com/marcaaron in version: 1.3.90-2 🚀
|
🚀 Deployed to staging by https://github.com/grgia in version: 1.3.91-0 🚀
|
🚀 Deployed to production by https://github.com/marcaaron in version: 1.3.91-8 🚀
|
Details
Fixed Issues
$ #22881
PROPOSAL:
Tests
1.Update the getComponent for SCREENS.SETTINGS.WALLET, in SettingsModalStackNavigator to import the component from ../../../pages/settings/Wallet/WalletPage/WalletPage
2. Initialise cardList with mock data:
review the transaction
button (by pressing it user’s old dot inbox should be opened)fraud: "domain"
for one of the cards"Your card is temporarily locked while our team reviews your company's account."
the message showed with a red dot and all other elements are hiddenOffline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
native-androidp1.webm
native-androidp2.webm
Android: mWeb Chrome
web-android.mp4
iOS: Native
native-ios.mp4
iOS: mWeb Safari
web-ios.mp4
MacOS: Chrome / Safari
web-desktop.mp4
MacOS: Desktop
desktop.mp4