-
Notifications
You must be signed in to change notification settings - Fork 3.7k
SettlementButton - migrate redirect to ROUTES.SETTINGS_CONTACT_METHOD_VERIFY_ACCOUNT (removal of backTo) #71330
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
Changes from all commits
543ed1d
0c68d1c
09586e9
56bbf84
96cfe3f
b2894ba
5155579
42a6ab9
2ed0b49
7787465
27bba3d
03ead68
4dd0cf3
dadcb86
057d057
9165bb8
0d2be77
e0334b9
c2a4d81
93fae1b
a907e4f
6a519b7
45ee8ab
f1d9727
083a2c9
1530f78
44a2fca
c3d209c
b9da3c9
fb88931
32e1280
74fab07
0bd0139
5284799
1bfa238
396ea83
a0b340d
280830d
2af58e1
11beaa4
cf5a7d9
0d38c7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,6 +60,7 @@ const ROUTES = { | |
| return `search?q=${encodeURIComponent(query)}${name ? `&name=${name}` : ''}` as const; | ||
| }, | ||
| }, | ||
| SEARCH_ROOT_VERIFY_ACCOUNT: `search/${VERIFY_ACCOUNT}`, | ||
| SEARCH_SAVED_SEARCH_RENAME: { | ||
| route: 'search/saved-search/rename', | ||
| getRoute: ({name, jsonQuery}: {name: string; jsonQuery: SearchQueryString}) => `search/saved-search/rename?name=${name}&q=${jsonQuery}` as const, | ||
|
|
@@ -83,6 +84,10 @@ const ROUTES = { | |
| return getUrlWithBackToParam(baseRoute, backTo); | ||
| }, | ||
| }, | ||
| SEARCH_REPORT_VERIFY_ACCOUNT: { | ||
| route: `search/view/:reportID/${VERIFY_ACCOUNT}`, | ||
| getRoute: (reportID: string) => `search/view/${reportID}/${VERIFY_ACCOUNT}` as const, | ||
| }, | ||
| SEARCH_MONEY_REQUEST_REPORT: { | ||
| route: 'search/r/:reportID', | ||
| getRoute: ({reportID, backTo}: {reportID: string; backTo?: string}) => { | ||
|
|
@@ -92,6 +97,10 @@ const ROUTES = { | |
| return getUrlWithBackToParam(baseRoute, backTo); | ||
| }, | ||
| }, | ||
| SEARCH_MONEY_REQUEST_REPORT_VERIFY_ACCOUNT: { | ||
| route: `search/r/:reportID/${VERIFY_ACCOUNT}`, | ||
| getRoute: (reportID: string) => `search/r/${reportID}/${VERIFY_ACCOUNT}` as const, | ||
| }, | ||
| SEARCH_MONEY_REQUEST_REPORT_HOLD_TRANSACTIONS: { | ||
| route: 'search/r/:reportID/hold', | ||
| getRoute: ({reportID, backTo}: {reportID: string; backTo?: string}) => { | ||
|
|
@@ -537,6 +546,10 @@ const ROUTES = { | |
| return getUrlWithBackToParam(`r/${reportID}/details/shareCode` as const, backTo); | ||
| }, | ||
| }, | ||
| REPORT_VERIFY_ACCOUNT: { | ||
| route: `r/:reportID/${VERIFY_ACCOUNT}`, | ||
| getRoute: (reportID: string) => `r/${reportID}/${VERIFY_ACCOUNT}` as const, | ||
| }, | ||
| REPORT_PARTICIPANTS: { | ||
| route: 'r/:reportID/participants', | ||
|
|
||
|
|
@@ -735,8 +748,12 @@ const ROUTES = { | |
| }, | ||
| MONEY_REQUEST_CREATE: { | ||
| route: ':action/:iouType/start/:transactionID/:reportID/:backToReport?', | ||
| getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string, backToReport?: string) => | ||
| `${action as string}/${iouType as string}/start/${transactionID}/${reportID}/${backToReport ?? ''}` as const, | ||
| getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string, backToReport?: string) => { | ||
| if (backToReport) { | ||
| return `${action as string}/${iouType as string}/start/${transactionID}/${reportID}/${backToReport}` as const; | ||
| } | ||
| return `${action as string}/${iouType as string}/start/${transactionID}/${reportID}` as const; | ||
| }, | ||
| }, | ||
| MONEY_REQUEST_STEP_SEND_FROM: { | ||
| route: 'create/:iouType/from/:transactionID/:reportID', | ||
|
|
@@ -752,12 +769,22 @@ const ROUTES = { | |
| }, | ||
| MONEY_REQUEST_STEP_CONFIRMATION: { | ||
| route: ':action/:iouType/confirmation/:transactionID/:reportID/:backToReport?', | ||
| getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string | undefined, backToReport?: string, participantsAutoAssigned?: boolean, backTo?: string) => | ||
| getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string | undefined, backToReport?: string, participantsAutoAssigned?: boolean, backTo?: string) => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to też tak jak było wcześniej bylo ok
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's the same case as the one above |
||
| let optionalRoutePart = ''; | ||
| if (backToReport !== undefined) { | ||
| optionalRoutePart += `/${backToReport}`; | ||
| } | ||
| if (participantsAutoAssigned !== undefined) { | ||
| optionalRoutePart += '?participantsAutoAssigned=true'; | ||
| } | ||
| // eslint-disable-next-line no-restricted-syntax -- Legacy route generation | ||
| getUrlWithBackToParam( | ||
| `${action as string}/${iouType as string}/confirmation/${transactionID}/${reportID}/${backToReport ?? ''}${participantsAutoAssigned ? '?participantsAutoAssigned=true' : ''}`, | ||
| backTo, | ||
| ), | ||
| return getUrlWithBackToParam(`${action as string}/${iouType as string}/confirmation/${transactionID}/${reportID}${optionalRoutePart}` as const, backTo); | ||
| }, | ||
| }, | ||
| MONEY_REQUEST_STEP_CONFIRMATION_VERIFY_ACCOUNT: { | ||
| route: `:action/:iouType/confirmation/:transactionID/:reportID/${VERIFY_ACCOUNT}`, | ||
| getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string) => | ||
| `${action as string}/${iouType as string}/confirmation/${transactionID}/${reportID}/${VERIFY_ACCOUNT}` as const, | ||
| }, | ||
| MONEY_REQUEST_STEP_AMOUNT: { | ||
| route: ':action/:iouType/amount/:transactionID/:reportID/:reportActionID?/:pageIndex?/:backToReport?', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,7 @@ import { | |
| isInvoiceReport as isInvoiceReportUtil, | ||
| isIOUReport, | ||
| } from '@libs/ReportUtils'; | ||
| import {getSettlementButtonPaymentMethods, handleUnvalidatedUserNavigation} from '@libs/SettlementButtonUtils'; | ||
| import {shouldRestrictUserBillableActions} from '@libs/SubscriptionUtils'; | ||
| import {setPersonalBankAccountContinueKYCOnSuccess} from '@userActions/BankAccounts'; | ||
| import {approveMoneyRequest} from '@userActions/IOU'; | ||
|
|
@@ -179,7 +180,7 @@ function SettlementButton({ | |
| } | ||
|
|
||
| if (!isUserValidated) { | ||
| Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHOD_VERIFY_ACCOUNT.getRoute(Navigation.getActiveRoute())); | ||
| handleUnvalidatedUserNavigation(chatReportID, reportID); | ||
| return true; | ||
| } | ||
|
|
||
|
|
@@ -189,7 +190,7 @@ function SettlementButton({ | |
| } | ||
|
|
||
| return false; | ||
| }, [isAccountLocked, isUserValidated, policy, showLockedAccountModal]); | ||
| }, [policy, isAccountLocked, isUserValidated, chatReportID, reportID, showLockedAccountModal]); | ||
|
|
||
| const getPaymentSubitems = useCallback( | ||
| (payAsBusiness: boolean) => { | ||
|
|
@@ -225,24 +226,7 @@ function SettlementButton({ | |
|
|
||
| const paymentButtonOptions = useMemo(() => { | ||
| const buttonOptions = []; | ||
| const paymentMethods = { | ||
| [CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT]: { | ||
| text: hasActivatedWallet ? translate('iou.settleWallet', {formattedAmount: ''}) : translate('iou.settlePersonal', {formattedAmount: ''}), | ||
| icon: Expensicons.User, | ||
| value: CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT, | ||
| }, | ||
| [CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT]: { | ||
| text: translate('iou.settleBusiness', {formattedAmount: ''}), | ||
| icon: Expensicons.Building, | ||
| value: CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT, | ||
| }, | ||
| [CONST.IOU.PAYMENT_TYPE.ELSEWHERE]: { | ||
| text: translate('iou.payElsewhere', {formattedAmount: ''}), | ||
| icon: Expensicons.CheckCircle, | ||
| value: CONST.IOU.PAYMENT_TYPE.ELSEWHERE, | ||
| shouldUpdateSelectedIndex: false, | ||
| }, | ||
| }; | ||
| const paymentMethods = getSettlementButtonPaymentMethods(hasActivatedWallet, translate); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice one. I think we also have a few other places (
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will do 😃
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. I'm also working on a similar issue related to |
||
|
|
||
| const shortFormPayElsewhereButton = { | ||
| text: translate('iou.pay'), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.