-
Notifications
You must be signed in to change notification settings - Fork 3.7k
BT - Migrate SAGE_INTACCT Export
#87554
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
base: main
Are you sure you want to change the base?
Changes from all commits
8e4d420
373c4d7
f4c3469
123e427
ecf7e12
992d361
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 |
|---|---|---|
|
|
@@ -146,19 +146,39 @@ const DYNAMIC_ROUTES = { | |
| path: 'date-select', | ||
| entryScreens: [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT], | ||
| }, | ||
| POLICY_ACCOUNTING_SAGE_INTACCT_PREFERRED_EXPORTER: { | ||
| path: 'sage-preferred-exporter', | ||
| entryScreens: [SCREENS.WORKSPACE.ACCOUNTING.SAGE_INTACCT_EXPORT], | ||
| }, | ||
| POLICY_ACCOUNTING_SAGE_INTACCT_EXPORT_DATE: { | ||
| path: 'date', | ||
| entryScreens: [SCREENS.WORKSPACE.ACCOUNTING.SAGE_INTACCT_EXPORT], | ||
| }, | ||
| POLICY_ACCOUNTING_SAGE_INTACCT_REIMBURSABLE_EXPENSES: { | ||
| path: 'reimbursable', | ||
| entryScreens: [SCREENS.WORKSPACE.ACCOUNTING.SAGE_INTACCT_EXPORT], | ||
| }, | ||
| POLICY_ACCOUNTING_SAGE_INTACCT_NON_REIMBURSABLE_EXPENSES: { | ||
| path: 'nonreimbursable', | ||
| entryScreens: [SCREENS.WORKSPACE.ACCOUNTING.SAGE_INTACCT_EXPORT], | ||
| }, | ||
| POLICY_ACCOUNTING_SAGE_INTACCT_NON_REIMBURSABLE_DESTINATION: { | ||
| path: 'destination', | ||
| entryScreens: [SCREENS.WORKSPACE.ACCOUNTING.SAGE_INTACCT_NON_REIMBURSABLE_EXPENSES], | ||
| path: 'nonreimbursable-expenses', | ||
| entryScreens: [SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_SAGE_INTACCT_NON_REIMBURSABLE_EXPENSES], | ||
| }, | ||
| POLICY_ACCOUNTING_SAGE_INTACCT_REIMBURSABLE_DESTINATION: { | ||
| path: 'reimbursable-expenses', | ||
|
Comment on lines
+166
to
+170
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.
Renaming destination suffixes to Useful? React with 👍 / 👎. |
||
| entryScreens: [SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_SAGE_INTACCT_REIMBURSABLE_EXPENSES], | ||
| }, | ||
| POLICY_ACCOUNTING_SAGE_INTACCT_DEFAULT_VENDOR: { | ||
| path: 'default-vendor', | ||
| entryScreens: [SCREENS.WORKSPACE.ACCOUNTING.SAGE_INTACCT_REIMBURSABLE_EXPENSES, SCREENS.WORKSPACE.ACCOUNTING.SAGE_INTACCT_NON_REIMBURSABLE_EXPENSES], | ||
| entryScreens: [SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_SAGE_INTACCT_REIMBURSABLE_EXPENSES, SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_SAGE_INTACCT_NON_REIMBURSABLE_EXPENSES], | ||
| getRoute: (reimbursable: string) => getUrlWithParams('default-vendor', {reimbursable}), | ||
| queryParams: ['reimbursable'], | ||
| }, | ||
| POLICY_ACCOUNTING_SAGE_INTACCT_NON_REIMBURSABLE_CREDIT_CARD_ACCOUNT: { | ||
| path: 'credit-card-account', | ||
| entryScreens: [SCREENS.WORKSPACE.ACCOUNTING.SAGE_INTACCT_NON_REIMBURSABLE_EXPENSES], | ||
| entryScreens: [SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_SAGE_INTACCT_NON_REIMBURSABLE_EXPENSES], | ||
| }, | ||
| POLICY_ACCOUNTING_XERO_EXPORT_BANK_ACCOUNT_SELECT: { | ||
| path: 'bank-account-select', | ||
|
|
@@ -3829,36 +3849,6 @@ const ROUTES = { | |
| // eslint-disable-next-line no-restricted-syntax -- Legacy route generation | ||
| getRoute: (policyID: string, backTo?: string) => getUrlWithBackToParam(`workspaces/${policyID}/accounting/sage-intacct/export` as const, backTo, false), | ||
| }, | ||
| POLICY_ACCOUNTING_SAGE_INTACCT_PREFERRED_EXPORTER: { | ||
| route: 'workspaces/:policyID/accounting/sage-intacct/export/preferred-exporter', | ||
|
|
||
| // eslint-disable-next-line no-restricted-syntax -- Legacy route generation | ||
| getRoute: (policyID: string, backTo?: string) => getUrlWithBackToParam(`workspaces/${policyID}/accounting/sage-intacct/export/preferred-exporter` as const, backTo), | ||
| }, | ||
| POLICY_ACCOUNTING_SAGE_INTACCT_EXPORT_DATE: { | ||
| route: 'workspaces/:policyID/accounting/sage-intacct/export/date', | ||
|
|
||
| // eslint-disable-next-line no-restricted-syntax -- Legacy route generation | ||
| getRoute: (policyID: string, backTo?: string) => getUrlWithBackToParam(`workspaces/${policyID}/accounting/sage-intacct/export/date` as const, backTo), | ||
| }, | ||
| POLICY_ACCOUNTING_SAGE_INTACCT_REIMBURSABLE_EXPENSES: { | ||
| route: 'workspaces/:policyID/accounting/sage-intacct/export/reimbursable', | ||
|
|
||
| // eslint-disable-next-line no-restricted-syntax -- Legacy route generation | ||
| getRoute: (policyID: string, backTo?: string) => getUrlWithBackToParam(`workspaces/${policyID}/accounting/sage-intacct/export/reimbursable` as const, backTo), | ||
| }, | ||
| POLICY_ACCOUNTING_SAGE_INTACCT_NON_REIMBURSABLE_EXPENSES: { | ||
| route: 'workspaces/:policyID/accounting/sage-intacct/export/nonreimbursable', | ||
|
|
||
| // eslint-disable-next-line no-restricted-syntax -- Legacy route generation | ||
| getRoute: (policyID: string, backTo?: string) => getUrlWithBackToParam(`workspaces/${policyID}/accounting/sage-intacct/export/nonreimbursable` as const, backTo), | ||
| }, | ||
| POLICY_ACCOUNTING_SAGE_INTACCT_REIMBURSABLE_DESTINATION: { | ||
| route: 'workspaces/:policyID/accounting/sage-intacct/export/reimbursable/destination', | ||
|
|
||
| // eslint-disable-next-line no-restricted-syntax -- Legacy route generation | ||
| getRoute: (policyID: string, backTo?: string) => getUrlWithBackToParam(`workspaces/${policyID}/accounting/sage-intacct/export/reimbursable/destination` as const, backTo), | ||
| }, | ||
| POLICY_ACCOUNTING_SAGE_INTACCT_ADVANCED: { | ||
| route: 'workspaces/:policyID/accounting/sage-intacct/advanced', | ||
| getRoute: (policyID: string | undefined) => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,4 +1,3 @@ | ||||||
| import {useRoute} from '@react-navigation/native'; | ||||||
| import React, {useCallback, useMemo} from 'react'; | ||||||
| import {View} from 'react-native'; | ||||||
| import type {ValueOf} from 'type-fest'; | ||||||
|
|
@@ -7,26 +6,24 @@ import type {ListItem} from '@components/SelectionList/types'; | |||||
| import SelectionScreen from '@components/SelectionScreen'; | ||||||
| import type {SelectorType} from '@components/SelectionScreen'; | ||||||
| import Text from '@components/Text'; | ||||||
| import useDynamicBackPath from '@hooks/useDynamicBackPath'; | ||||||
| import useLocalize from '@hooks/useLocalize'; | ||||||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||||||
| import {clearSageIntacctErrorField} from '@libs/actions/Policy/Policy'; | ||||||
| import {getLatestErrorField} from '@libs/ErrorUtils'; | ||||||
| import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; | ||||||
| import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; | ||||||
| import {settingsPendingAction} from '@libs/PolicyUtils'; | ||||||
| import Navigation from '@navigation/Navigation'; | ||||||
| import type {WithPolicyProps} from '@pages/workspace/withPolicy'; | ||||||
| import withPolicyConnections from '@pages/workspace/withPolicyConnections'; | ||||||
| import {updateSageIntacctExportDate} from '@userActions/connections/SageIntacct'; | ||||||
| import CONST from '@src/CONST'; | ||||||
| import ROUTES from '@src/ROUTES'; | ||||||
| import type SCREENS from '@src/SCREENS'; | ||||||
| import ROUTES, {DYNAMIC_ROUTES} from '@src/ROUTES'; | ||||||
|
|
||||||
| type MenuListItem = ListItem & { | ||||||
| value: ValueOf<typeof CONST.SAGE_INTACCT_EXPORT_DATE>; | ||||||
| }; | ||||||
|
|
||||||
| function SageIntacctDatePage({policy}: WithPolicyProps) { | ||||||
| function DynamicSageIntacctExportDatePage({policy}: WithPolicyProps) { | ||||||
| const {translate} = useLocalize(); | ||||||
| const policyID = policy?.id; | ||||||
| const styles = useThemeStyles(); | ||||||
|
|
@@ -39,12 +36,11 @@ function SageIntacctDatePage({policy}: WithPolicyProps) { | |||||
| keyForList: dateType, | ||||||
| isSelected: exportConfig?.exportDate === dateType, | ||||||
| })); | ||||||
| const route = useRoute<PlatformStackRouteProp<SettingsNavigatorParamList, typeof SCREENS.WORKSPACE.ACCOUNTING.SAGE_INTACCT_EXPORT_DATE>>(); | ||||||
| const backTo = route.params?.backTo; | ||||||
| const backPath = useDynamicBackPath(DYNAMIC_ROUTES.POLICY_ACCOUNTING_SAGE_INTACCT_EXPORT_DATE.path); | ||||||
|
|
||||||
| const goBack = useCallback(() => { | ||||||
| Navigation.goBack(backTo ?? (policyID && ROUTES.POLICY_ACCOUNTING_SAGE_INTACCT_EXPORT.getRoute(policyID))); | ||||||
| }, [policyID, backTo]); | ||||||
| Navigation.goBack(backPath || (policyID && ROUTES.POLICY_ACCOUNTING_SAGE_INTACCT_EXPORT.getRoute(policyID))); | ||||||
|
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.
Suggested change
When we migrate this page to a dynamic route, I think |
||||||
| }, [policyID, backPath]); | ||||||
|
|
||||||
| const headerContent = useMemo( | ||||||
| () => ( | ||||||
|
|
@@ -67,7 +63,7 @@ function SageIntacctDatePage({policy}: WithPolicyProps) { | |||||
|
|
||||||
| return ( | ||||||
| <SelectionScreen | ||||||
| displayName="SageIntacctDatePage" | ||||||
| displayName="DynamicSageIntacctExportDatePage" | ||||||
| title="workspace.sageIntacct.exportDate.label" | ||||||
| headerContent={headerContent} | ||||||
| data={data} | ||||||
|
|
@@ -87,4 +83,4 @@ function SageIntacctDatePage({policy}: WithPolicyProps) { | |||||
| ); | ||||||
| } | ||||||
|
|
||||||
| export default withPolicyConnections(SageIntacctDatePage); | ||||||
| export default withPolicyConnections(DynamicSageIntacctExportDatePage); | ||||||
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.
Changing this suffix from
preferred-exportertosage-preferred-exporterbreaks previously issued Sage Intacct export URLs (for example browser history, shared links, or stalebackTolinks) because the old static Sage route was removed in this commit and there is no compatibility remap inOldRoutes. Users opening the old URL will no longer land on the intended screen, so we should keep an alias/redirect for the legacy path.Useful? React with 👍 / 👎.