-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[TS migration] Migrate 'SettingsWalletPhysicalCard' page to TypeScript #33641
[TS migration] Migrate 'SettingsWalletPhysicalCard' page to TypeScript #33641
Conversation
411e55d
to
c85b80e
Compare
src/libs/GetPhysicalCardUtils.ts
Outdated
@@ -116,13 +86,13 @@ function getUpdatedDraftValues(draftValues: DraftValues, privatePersonalDetails: | |||
* @param draftValues | |||
* @returns | |||
*/ | |||
function getUpdatedPrivatePersonalDetails(draftValues: DraftValues) { | |||
const {addressLine1, addressLine2, city, country, legalFirstName, legalLastName, phoneNumber, state, zipPostCode} = draftValues; | |||
function getUpdatedPrivatePersonalDetails(draftValues: OnyxEntry<GetPhysicalCardForm | undefined>): PrivatePersonalDetails { |
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.
Why do we need undefined
inside OnyxEntry value?
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.
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.
How about removing undefined from the onyx type instead?
function getUpdatedPrivatePersonalDetails(draftValues: OnyxEntry<GetPhysicalCardForm | undefined>): PrivatePersonalDetails { | |
function getUpdatedPrivatePersonalDetails(draftValues: OnyxEntry<GetPhysicalCardForm>): PrivatePersonalDetails { |
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.
Working on that. It is needed to patch a logic also
state: PropTypes.string, | ||
zipPostCode: PropTypes.string, | ||
}), | ||
draftValues: OnyxEntry<GetPhysicalCardForm | undefined>; |
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.
Why do we need undefined
in this typing?
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.
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.
@pasyukevich You should rather remove undefined from the onyx value, right?
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.
@blazejkustra I'm not sure about it
Could you clarify your question?
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.
Sorry I'm a bit sick today 😅
Let's remove undefined from ONYXKEYS.ts:
[ONYXKEYS.FORMS.GET_PHYSICAL_CARD_FORM_DRAFT]: OnyxTypes.GetPhysicalCardForm;
6720e7b
to
68bad7c
Compare
052401c
to
a44bab3
Compare
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
a44bab3
to
3d57b84
Compare
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
src/libs/CardUtils.ts
Outdated
const activeCards = Object.values(cardList ?? {}).filter( | ||
(card) => !!card?.domainName && (CONST.EXPENSIFY_CARD.ACTIVE_STATES as ReadonlyArray<OnyxTypes.Card['state']>).includes(card.state), |
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.
You can use .some
instead of .includes
to get rid of assertion
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
src/libs/CardUtils.ts
Outdated
@@ -72,11 +73,13 @@ function getYearFromExpirationDateString(expirationDateString: string) { | |||
* @param cardList - collection of assigned cards | |||
* @returns collection of assigned cards grouped by domain | |||
*/ | |||
function getDomainCards(cardList: Record<string, OnyxTypes.Card>) { | |||
function getDomainCards(cardList: OnyxCollection<OnyxTypes.Card>) { |
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 this really a OnyxCollection? if not I think we should stick to just Record<string, OnyxTypes.Card>
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.
should it be just OnyxEntry<OnyxTypes.CardList
?
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.
Yes, we receive this data from the Onyx
@@ -77,7 +69,7 @@ function GetPhysicalCardName({ | |||
name="legalFirstName" | |||
label={translate('getPhysicalCard.legalFirstName')} | |||
aria-label={translate('getPhysicalCard.legalFirstName')} | |||
role={CONST.ACCESSIBILITY_ROLE.TEXT} |
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.
Q: why those roles changed?
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.
They were replaced as they were deprecated
3a916a3
to
59c7719
Compare
@@ -209,16 +171,14 @@ function BaseGetPhysicalCard({ | |||
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WALLET_DOMAINCARD.getRoute(domain))} | |||
/> | |||
<Text style={[styles.textHeadline, styles.mh5, styles.mb5]}>{headline}</Text> | |||
{renderContent(onSubmit, submitButtonText, styles, children, onValidate)} | |||
{renderContent({onSubmit, submitButtonText, children, onValidate})} |
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.
Before renderContent function had 5 arguments, now it has one. We need to be careful for any regressions
state: PropTypes.string, | ||
zipPostCode: PropTypes.string, | ||
}), | ||
draftValues: OnyxEntry<GetPhysicalCardForm | undefined>; |
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.
@pasyukevich You should rather remove undefined from the onyx value, right?
@@ -83,7 +56,7 @@ function GetPhysicalCardConfirm({ | |||
submitButtonText={translate('getPhysicalCard.shipCard')} | |||
title={translate('getPhysicalCard.header')} | |||
> | |||
<Text style={[styles.baseFontStyle, styles.mb5, styles.mh5]}>{translate('getPhysicalCard.estimatedDeliveryMessage')}</Text> |
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.
Why these styles were removed?
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.
Only the baseFontStyle
was removed, since it is nonexistent in styles
59c7719
to
502d7f5
Compare
502d7f5
to
c97ce23
Compare
src/ONYXKEYS.ts
Outdated
[ONYXKEYS.FORMS.GET_PHYSICAL_CARD_FORM]: OnyxTypes.Form; | ||
[ONYXKEYS.FORMS.GET_PHYSICAL_CARD_FORM_DRAFT]: OnyxTypes.Form | undefined; | ||
[ONYXKEYS.FORMS.GET_PHYSICAL_CARD_FORM]: OnyxTypes.GetPhysicalCardForm; | ||
[ONYXKEYS.FORMS.GET_PHYSICAL_CARD_FORM_DRAFT]: OnyxTypes.GetPhysicalCardForm | undefined; |
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.
[ONYXKEYS.FORMS.GET_PHYSICAL_CARD_FORM_DRAFT]: OnyxTypes.GetPhysicalCardForm | undefined; | |
[ONYXKEYS.FORMS.GET_PHYSICAL_CARD_FORM_DRAFT]: OnyxTypes.GetPhysicalCardForm; |
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
src/libs/GetPhysicalCardUtils.ts
Outdated
@@ -116,13 +86,13 @@ function getUpdatedDraftValues(draftValues: DraftValues, privatePersonalDetails: | |||
* @param draftValues | |||
* @returns | |||
*/ | |||
function getUpdatedPrivatePersonalDetails(draftValues: DraftValues) { | |||
const {addressLine1, addressLine2, city, country, legalFirstName, legalLastName, phoneNumber, state, zipPostCode} = draftValues; | |||
function getUpdatedPrivatePersonalDetails(draftValues: OnyxEntry<GetPhysicalCardForm | undefined>): PrivatePersonalDetails { |
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.
How about removing undefined from the onyx type instead?
function getUpdatedPrivatePersonalDetails(draftValues: OnyxEntry<GetPhysicalCardForm | undefined>): PrivatePersonalDetails { | |
function getUpdatedPrivatePersonalDetails(draftValues: OnyxEntry<GetPhysicalCardForm>): PrivatePersonalDetails { |
@@ -209,16 +171,14 @@ function BaseGetPhysicalCard({ | |||
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WALLET_DOMAINCARD.getRoute(domain))} | |||
/> | |||
<Text style={[styles.textHeadline, styles.mh5, styles.mb5]}>{headline}</Text> | |||
{renderContent(onSubmit, submitButtonText, styles, children, onValidate)} | |||
{renderContent({onSubmit, submitButtonText, children, onValidate})} |
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.
Bump @pasyukevich
In addition to the questions above, could you update the QA steps please @pasyukevich? Step 2 won't be able to happen |
@amyevans As far as I know, currently there are no other possibilities to test it without the hardcode |
I think Applause has some accounts with the Expensify card (see the test steps in #35483 for instance). |
And please resolve conflict @pasyukevich |
@situchan PR updated |
@amyevans To test this flow we need an account with a physical card in Where I can check the other options for test accounts? |
I'm not sure, I asked in Slack and tagged you in the thread! |
@amyevans I've updated QA steps for internal testing (according to the discussion in slack) |
Alright thanks! Looks like there's still some unresolved questions from @situchan |
@situchan All comments were addressed |
Thanks @amyevans all yours |
@pasyukevich conflicts |
@situchan conflicts solved |
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.
There's a lint error to fix, otherwise looks good though 👍
@amyevans Lint fixed |
✋ 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/amyevans in version: 1.4.40-0 🚀
|
@situchan QA team is unable to see the Expensify card in the 'Not issued' state. in tester@applausecard.expensifail.com account. Can you please verify above PR Internally? |
✅ QA'ed it: qa-33641.mov |
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.40-5 🚀
|
Details
Fixed Issues
$ #31997
PROPOSAL:
Tests
Offline 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)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.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
Android_native-converted.webm
Android: mWeb Chrome
android_web-converted.webm
iOS: Native
Ios_Native-converted.mp4
iOS: mWeb Safari
Ios_web-converted.mp4
MacOS: Chrome / Safari
mac_web-converted.mov
MacOS: Desktop
mac_desktop-converted.mov