From 62ff804d445f9821bdd6b61f296257c569486664 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Fri, 6 Sep 2024 20:40:30 +0700 Subject: [PATCH 01/13] remove free workspace --- src/ROUTES.ts | 12 --- src/SCREENS.ts | 3 - .../FocusTrap/WIDE_LAYOUT_INACTIVE_SCREENS.ts | 3 - .../Navigators/FullScreenNavigator.tsx | 3 - src/libs/Navigation/linkingConfig/config.ts | 9 -- src/libs/Navigation/types.ts | 9 -- src/libs/PolicyUtils.ts | 8 +- src/libs/ReportUtils.ts | 11 +-- src/libs/actions/IOU.ts | 9 +- src/pages/workspace/WorkspaceInitialPage.tsx | 48 ----------- src/pages/workspace/WorkspacesListRow.tsx | 4 - .../bills/WorkspaceBillsFirstSection.tsx | 85 ------------------- .../bills/WorkspaceBillsNoVBAView.tsx | 43 ---------- .../workspace/bills/WorkspaceBillsPage.tsx | 42 --------- .../workspace/bills/WorkspaceBillsVBAView.tsx | 53 ------------ .../workspace/card/WorkspaceCardNoVBAView.tsx | 42 --------- .../workspace/card/WorkspaceCardPage.tsx | 46 ---------- .../card/WorkspaceCardVBANoECardView.tsx | 63 -------------- .../card/WorkspaceCardVBAWithECardView.tsx | 75 ---------------- .../travel/WorkspaceTravelNoVBAView.tsx | 38 --------- .../workspace/travel/WorkspaceTravelPage.tsx | 42 --------- .../travel/WorkspaceTravelVBAView.tsx | 61 ------------- src/pages/workspace/withPolicy.tsx | 3 - 23 files changed, 5 insertions(+), 707 deletions(-) delete mode 100644 src/pages/workspace/bills/WorkspaceBillsFirstSection.tsx delete mode 100644 src/pages/workspace/bills/WorkspaceBillsNoVBAView.tsx delete mode 100644 src/pages/workspace/bills/WorkspaceBillsPage.tsx delete mode 100644 src/pages/workspace/bills/WorkspaceBillsVBAView.tsx delete mode 100644 src/pages/workspace/card/WorkspaceCardNoVBAView.tsx delete mode 100644 src/pages/workspace/card/WorkspaceCardPage.tsx delete mode 100644 src/pages/workspace/card/WorkspaceCardVBANoECardView.tsx delete mode 100644 src/pages/workspace/card/WorkspaceCardVBAWithECardView.tsx delete mode 100644 src/pages/workspace/travel/WorkspaceTravelNoVBAView.tsx delete mode 100644 src/pages/workspace/travel/WorkspaceTravelPage.tsx delete mode 100644 src/pages/workspace/travel/WorkspaceTravelVBAView.tsx diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 89023063ad8f..399648d1b0f0 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -658,10 +658,6 @@ const ROUTES = { route: 'settings/workspaces/:policyID/workflows/auto-reporting-frequency/monthly-offset', getRoute: (policyID: string) => `settings/workspaces/${policyID}/workflows/auto-reporting-frequency/monthly-offset` as const, }, - WORKSPACE_CARD: { - route: 'settings/workspaces/:policyID/card', - getRoute: (policyID: string) => `settings/workspaces/${policyID}/card` as const, - }, WORKSPACE_REIMBURSE: { route: 'settings/workspaces/:policyID/reimburse', getRoute: (policyID: string) => `settings/workspaces/${policyID}/reimburse` as const, @@ -678,10 +674,6 @@ const ROUTES = { route: 'settings/workspaces/:policyID/rateandunit/unit', getRoute: (policyID: string) => `settings/workspaces/${policyID}/rateandunit/unit` as const, }, - WORKSPACE_BILLS: { - route: 'settings/workspaces/:policyID/bills', - getRoute: (policyID: string) => `settings/workspaces/${policyID}/bills` as const, - }, WORKSPACE_INVOICES: { route: 'settings/workspaces/:policyID/invoices', getRoute: (policyID: string) => `settings/workspaces/${policyID}/invoices` as const, @@ -694,10 +686,6 @@ const ROUTES = { route: 'settings/workspaces/:policyID/invoices/company-website', getRoute: (policyID: string) => `settings/workspaces/${policyID}/invoices/company-website` as const, }, - WORKSPACE_TRAVEL: { - route: 'settings/workspaces/:policyID/travel', - getRoute: (policyID: string) => `settings/workspaces/${policyID}/travel` as const, - }, WORKSPACE_MEMBERS: { route: 'settings/workspaces/:policyID/members', getRoute: (policyID: string) => `settings/workspaces/${policyID}/members` as const, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index db790dd389c3..73d6e1a74638 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -362,7 +362,6 @@ const SCREENS = { }, INITIAL: 'Workspace_Initial', PROFILE: 'Workspace_Profile', - CARD: 'Workspace_Card', REIMBURSE: 'Workspace_Reimburse', RATE_AND_UNIT: 'Workspace_RateAndUnit', RATE_AND_UNIT_RATE: 'Workspace_RateAndUnit_Rate', @@ -382,11 +381,9 @@ const SCREENS = { EXPENSIFY_CARD_SETTINGS: 'Workspace_ExpensifyCard_Settings', EXPENSIFY_CARD_SETTINGS_ACCOUNT: 'Workspace_ExpensifyCard_Settings_Account', EXPENSIFY_CARD_SETTINGS_FREQUENCY: 'Workspace_ExpensifyCard_Settings_Frequency', - BILLS: 'Workspace_Bills', INVOICES: 'Workspace_Invoices', INVOICES_COMPANY_NAME: 'Workspace_Invoices_Company_Name', INVOICES_COMPANY_WEBSITE: 'Workspace_Invoices_Company_Website', - TRAVEL: 'Workspace_Travel', MEMBERS: 'Workspace_Members', INVITE: 'Workspace_Invite', INVITE_MESSAGE: 'Workspace_Invite_Message', diff --git a/src/components/FocusTrap/WIDE_LAYOUT_INACTIVE_SCREENS.ts b/src/components/FocusTrap/WIDE_LAYOUT_INACTIVE_SCREENS.ts index 686c318a99dc..ee3ea9b9e0c6 100644 --- a/src/components/FocusTrap/WIDE_LAYOUT_INACTIVE_SCREENS.ts +++ b/src/components/FocusTrap/WIDE_LAYOUT_INACTIVE_SCREENS.ts @@ -20,12 +20,9 @@ const WIDE_LAYOUT_INACTIVE_SCREENS: string[] = [ SCREENS.WORKSPACE.ACCOUNTING.ROOT, SCREENS.WORKSPACE.INITIAL, SCREENS.WORKSPACE.PROFILE, - SCREENS.WORKSPACE.CARD, SCREENS.WORKSPACE.WORKFLOWS, SCREENS.WORKSPACE.REIMBURSE, - SCREENS.WORKSPACE.BILLS, SCREENS.WORKSPACE.INVOICES, - SCREENS.WORKSPACE.TRAVEL, SCREENS.WORKSPACE.MEMBERS, SCREENS.WORKSPACE.CATEGORIES, SCREENS.WORKSPACE.MORE_FEATURES, diff --git a/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx index 8c06d5b458d1..5a9da5ed0677 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx @@ -18,12 +18,9 @@ type Screens = Partial React.Co const CENTRAL_PANE_WORKSPACE_SCREENS = { [SCREENS.WORKSPACE.PROFILE]: () => require('../../../../pages/workspace/WorkspaceProfilePage').default, - [SCREENS.WORKSPACE.CARD]: () => require('../../../../pages/workspace/card/WorkspaceCardPage').default, [SCREENS.WORKSPACE.WORKFLOWS]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsPage').default, [SCREENS.WORKSPACE.REIMBURSE]: () => require('../../../../pages/workspace/reimburse/WorkspaceReimbursePage').default, - [SCREENS.WORKSPACE.BILLS]: () => require('../../../../pages/workspace/bills/WorkspaceBillsPage').default, [SCREENS.WORKSPACE.INVOICES]: () => require('../../../../pages/workspace/invoices/WorkspaceInvoicesPage').default, - [SCREENS.WORKSPACE.TRAVEL]: () => require('../../../../pages/workspace/travel/WorkspaceTravelPage').default, [SCREENS.WORKSPACE.MEMBERS]: () => require('../../../../pages/workspace/WorkspaceMembersPage').default, [SCREENS.WORKSPACE.ACCOUNTING.ROOT]: () => require('../../../../pages/workspace/accounting/PolicyAccountingPage').default, [SCREENS.WORKSPACE.CATEGORIES]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesPage').default, diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index cf45126bfc04..5d9d65a5bb67 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -1086,9 +1086,6 @@ const config: LinkingOptions['config'] = { path: ROUTES.WORKSPACE_INITIAL.route, }, [SCREENS.WORKSPACE.PROFILE]: ROUTES.WORKSPACE_PROFILE.route, - [SCREENS.WORKSPACE.CARD]: { - path: ROUTES.WORKSPACE_CARD.route, - }, [SCREENS.WORKSPACE.EXPENSIFY_CARD]: { path: ROUTES.WORKSPACE_EXPENSIFY_CARD.route, }, @@ -1101,15 +1098,9 @@ const config: LinkingOptions['config'] = { [SCREENS.WORKSPACE.REIMBURSE]: { path: ROUTES.WORKSPACE_REIMBURSE.route, }, - [SCREENS.WORKSPACE.BILLS]: { - path: ROUTES.WORKSPACE_BILLS.route, - }, [SCREENS.WORKSPACE.INVOICES]: { path: ROUTES.WORKSPACE_INVOICES.route, }, - [SCREENS.WORKSPACE.TRAVEL]: { - path: ROUTES.WORKSPACE_TRAVEL.route, - }, [SCREENS.WORKSPACE.MEMBERS]: { path: ROUTES.WORKSPACE_MEMBERS.route, }, diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index c8c2c0f0e41d..4d9b0539b9d8 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -1134,9 +1134,6 @@ type FullScreenNavigatorParamList = { [SCREENS.WORKSPACE.PROFILE]: { policyID: string; }; - [SCREENS.WORKSPACE.CARD]: { - policyID: string; - }; [SCREENS.WORKSPACE.EXPENSIFY_CARD]: { policyID: string; }; @@ -1176,15 +1173,9 @@ type FullScreenNavigatorParamList = { [SCREENS.WORKSPACE.REIMBURSE]: { policyID: string; }; - [SCREENS.WORKSPACE.BILLS]: { - policyID: string; - }; [SCREENS.WORKSPACE.INVOICES]: { policyID: string; }; - [SCREENS.WORKSPACE.TRAVEL]: { - policyID: string; - }; [SCREENS.WORKSPACE.MEMBERS]: { policyID: string; }; diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index f9acb67a1efb..d13c3d08283f 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -201,11 +201,6 @@ const isPolicyAdmin = (policy: OnyxInputOrEntry, currentUserLogin?: stri */ const isPolicyUser = (policy: OnyxInputOrEntry, currentUserLogin?: string): boolean => getPolicyRole(policy, currentUserLogin) === CONST.POLICY.ROLE.USER; -/** - * Checks if the policy is a free group policy. - */ -const isFreeGroupPolicy = (policy: OnyxEntry): boolean => policy?.type === CONST.POLICY.TYPE.FREE; - const isPolicyEmployee = (policyID: string, policies: OnyxCollection): boolean => Object.values(policies ?? {}).some((policy) => policy?.id === policyID); /** @@ -370,7 +365,7 @@ function isTaxTrackingEnabled(isPolicyExpenseChat: boolean, policy: OnyxEntry): boolean { - return policy?.type === CONST.POLICY.TYPE.FREE || (policy?.autoReporting === true && policy?.autoReportingFrequency === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.INSTANT); + return policy?.autoReporting === true && policy?.autoReportingFrequency === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.INSTANT; } /** @@ -1024,7 +1019,6 @@ export { isControlOnAdvancedApprovalMode, isExpensifyTeam, isDeletedPolicyEmployee, - isFreeGroupPolicy, isInstantSubmitEnabled, getCorrectedAutoReportingFrequency, isPaidGroupPolicy, diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 7b226b2e5c8e..1d8d974b19a9 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1021,7 +1021,7 @@ function isControlPolicyExpenseChat(report: OnyxEntry): boolean { * Whether the provided policyType is a Free, Collect or Control policy type */ function isGroupPolicy(policyType: string): boolean { - return policyType === CONST.POLICY.TYPE.CORPORATE || policyType === CONST.POLICY.TYPE.TEAM || policyType === CONST.POLICY.TYPE.FREE; + return policyType === CONST.POLICY.TYPE.CORPORATE || policyType === CONST.POLICY.TYPE.TEAM; } /** @@ -1303,7 +1303,6 @@ function findLastAccessedReport(ignoreDomainRooms: boolean, openOnAdminRoom = fa if ( ignoreDomainRooms && isDomainRoom(report) && - getPolicyType(report, allPolicies) !== CONST.POLICY.TYPE.FREE && !hasExpensifyGuidesEmails(Object.keys(report?.participants ?? {}).map(Number)) ) { return false; @@ -5793,11 +5792,6 @@ function canSeeDefaultRoom(report: OnyxEntry, policies: OnyxCollection

): Outsta const policy = getPolicy(iouReport.policyID); const shouldBeManuallySubmitted = PolicyUtils.isPaidGroupPolicy(policy) && !policy?.harvesting?.enabled; - const isOwnFreePolicy = PolicyUtils.isFreeGroupPolicy(policy) && PolicyUtils.isPolicyAdmin(policy); - if (shouldBeManuallySubmitted || isOwnFreePolicy) { + if (shouldBeManuallySubmitted) { return { hasOutstandingChildRequest: true, }; diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 29d481737790..1203f8df7c12 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -7287,14 +7287,9 @@ function cancelPayment(expenseReport: OnyxEntry, chatReport: O const optimisticReportAction = ReportUtils.buildOptimisticCancelPaymentReportAction(expenseReport.reportID, -(expenseReport.total ?? 0), expenseReport.currency ?? ''); const policy = PolicyUtils.getPolicy(chatReport.policyID); - const isFree = policy && policy.type === CONST.POLICY.TYPE.FREE; const approvalMode = policy?.approvalMode ?? CONST.POLICY.APPROVAL_MODE.BASIC; - let stateNum: ValueOf = CONST.REPORT.STATE_NUM.SUBMITTED; - let statusNum: ValueOf = CONST.REPORT.STATUS_NUM.SUBMITTED; - if (!isFree) { - stateNum = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATE_NUM.SUBMITTED : CONST.REPORT.STATE_NUM.APPROVED; - statusNum = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATUS_NUM.CLOSED : CONST.REPORT.STATUS_NUM.APPROVED; - } + const stateNum: ValueOf = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATE_NUM.SUBMITTED : CONST.REPORT.STATE_NUM.APPROVED; + const statusNum: ValueOf = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATUS_NUM.CLOSED : CONST.REPORT.STATUS_NUM.APPROVED; const optimisticNextStep = NextStepUtils.buildNextStep(expenseReport, statusNum); const optimisticData: OnyxUpdate[] = [ { diff --git a/src/pages/workspace/WorkspaceInitialPage.tsx b/src/pages/workspace/WorkspaceInitialPage.tsx index f88e387f0039..a3a2eaefe289 100644 --- a/src/pages/workspace/WorkspaceInitialPage.tsx +++ b/src/pages/workspace/WorkspaceInitialPage.tsx @@ -51,11 +51,8 @@ type WorkspaceMenuItem = { routeName?: | typeof SCREENS.WORKSPACE.ACCOUNTING.ROOT | typeof SCREENS.WORKSPACE.INITIAL - | typeof SCREENS.WORKSPACE.CARD | typeof SCREENS.WORKSPACE.REIMBURSE - | typeof SCREENS.WORKSPACE.BILLS | typeof SCREENS.WORKSPACE.INVOICES - | typeof SCREENS.WORKSPACE.TRAVEL | typeof SCREENS.WORKSPACE.DISTANCE_RATES | typeof SCREENS.WORKSPACE.WORKFLOWS | typeof SCREENS.WORKSPACE.CATEGORIES @@ -165,51 +162,7 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, reimbursementAcc const {login} = useCurrentUserPersonalDetails(); const shouldShowProtectedItems = PolicyUtils.isPolicyAdmin(policy, login); const isPaidGroupPolicy = PolicyUtils.isPaidGroupPolicy(policy); - const isFreeGroupPolicy = PolicyUtils.isFreeGroupPolicy(policy); const [featureStates, setFeatureStates] = useState(policyFeatureStates); - - const protectedFreePolicyMenuItems: WorkspaceMenuItem[] = [ - { - translationKey: 'workspace.common.card', - icon: Expensicons.ExpensifyCard, - action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_CARD.getRoute(policyID)))), - routeName: SCREENS.WORKSPACE.CARD, - }, - { - translationKey: 'workspace.common.reimburse', - icon: Expensicons.Receipt, - action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_REIMBURSE.getRoute(policyID)))), - routeName: SCREENS.WORKSPACE.REIMBURSE, - }, - { - translationKey: 'workspace.common.bills', - icon: Expensicons.Bill, - action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_BILLS.getRoute(policyID)))), - routeName: SCREENS.WORKSPACE.BILLS, - }, - { - translationKey: 'workspace.common.invoices', - icon: Expensicons.Invoice, - action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_INVOICES.getRoute(policyID)))), - routeName: SCREENS.WORKSPACE.INVOICES, - }, - { - translationKey: 'workspace.common.travel', - icon: Expensicons.Luggage, - action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_TRAVEL.getRoute(policyID)))), - routeName: SCREENS.WORKSPACE.TRAVEL, - }, - { - translationKey: 'workspace.common.bankAccount', - icon: Expensicons.Bank, - action: () => - policy?.outputCurrency === CONST.CURRENCY.USD - ? singleExecution(waitForNavigate(() => ReimbursementAccount.navigateToBankAccountRoute(policyID, Navigation.getActiveRouteWithoutParams())))() - : setIsCurrencyModalOpen(true), - brickRoadIndicator: !isEmptyObject(reimbursementAccount?.errors) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, - }, - ]; - const protectedCollectPolicyMenuItems: WorkspaceMenuItem[] = []; // We only update feature states if they aren't pending. @@ -346,7 +299,6 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, reimbursementAcc routeName: SCREENS.WORKSPACE.MEMBERS, }, ...(isPaidGroupPolicy && shouldShowProtectedItems ? protectedCollectPolicyMenuItems : []), - ...(isFreeGroupPolicy && shouldShowProtectedItems ? protectedFreePolicyMenuItems : []), ]; const prevPolicy = usePrevious(policy); diff --git a/src/pages/workspace/WorkspacesListRow.tsx b/src/pages/workspace/WorkspacesListRow.tsx index ac53252829fa..5d95b98ea3ac 100644 --- a/src/pages/workspace/WorkspacesListRow.tsx +++ b/src/pages/workspace/WorkspacesListRow.tsx @@ -71,8 +71,6 @@ type BrickRoadIndicatorIconProps = { const workspaceTypeIcon = (workspaceType: WorkspacesListRowProps['workspaceType']): IconAsset => { switch (workspaceType) { - case CONST.POLICY.TYPE.FREE: - return Illustrations.HandCard; case CONST.POLICY.TYPE.CORPORATE: return Illustrations.ShieldYellow; case CONST.POLICY.TYPE.TEAM: @@ -119,8 +117,6 @@ function WorkspacesListRow({ const userFriendlyWorkspaceType = useMemo(() => { switch (workspaceType) { - case CONST.POLICY.TYPE.FREE: - return translate('workspace.type.free'); case CONST.POLICY.TYPE.CORPORATE: return translate('workspace.type.control'); case CONST.POLICY.TYPE.TEAM: diff --git a/src/pages/workspace/bills/WorkspaceBillsFirstSection.tsx b/src/pages/workspace/bills/WorkspaceBillsFirstSection.tsx deleted file mode 100644 index f30d90f5a063..000000000000 --- a/src/pages/workspace/bills/WorkspaceBillsFirstSection.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import {Str} from 'expensify-common'; -import React from 'react'; -import {View} from 'react-native'; -import {withOnyx} from 'react-native-onyx'; -import type {OnyxEntry} from 'react-native-onyx'; -import CopyTextToClipboard from '@components/CopyTextToClipboard'; -import * as Expensicons from '@components/Icon/Expensicons'; -import * as Illustrations from '@components/Icon/Illustrations'; -import Section from '@components/Section'; -import Text from '@components/Text'; -import TextLink from '@components/TextLink'; -import useLocalize from '@hooks/useLocalize'; -import useThemeStyles from '@hooks/useThemeStyles'; -import * as Link from '@userActions/Link'; -import ONYXKEYS from '@src/ONYXKEYS'; -import type {Session, User} from '@src/types/onyx'; - -type WorkspaceBillsFirstSectionOnyxProps = { - /** Session of currently logged in user */ - session: OnyxEntry; - - /** Information about the logged in user's account */ - user: OnyxEntry; -}; - -type WorkspaceBillsFirstSectionProps = WorkspaceBillsFirstSectionOnyxProps & { - /** The policy ID currently being configured */ - policyID: string; -}; - -function WorkspaceBillsFirstSection({session, policyID, user}: WorkspaceBillsFirstSectionProps) { - const styles = useThemeStyles(); - const {translate} = useLocalize(); - - const emailDomain = Str.extractEmailDomain(session?.email ?? ''); - const manageYourBillsUrl = `reports?policyID=${policyID}&from=all&type=bill&showStates=Open,Processing,Approved,Reimbursed,Archived&isAdvancedFilterMode=true`; - - return ( -

Link.openOldDotLink(manageYourBillsUrl), - icon: Expensicons.Bill, - shouldShowRightIcon: true, - iconRight: Expensicons.NewWindow, - wrapperStyle: [styles.cardMenuItem], - link: () => Link.buildOldDotURL(manageYourBillsUrl), - }, - ]} - containerStyles={styles.cardSectionContainer} - > - - - {translate('workspace.bills.askYourVendorsBeforeEmail')} - {user?.isFromPublicDomain ? ( - Link.openExternalLink('https://community.expensify.com/discussion/7500/how-to-pay-your-company-bills-in-expensify/')}> - example.com@expensify.cash - - ) : ( - - )} - {translate('workspace.bills.askYourVendorsAfterEmail')} - - -
- ); -} - -WorkspaceBillsFirstSection.displayName = 'WorkspaceBillsFirstSection'; - -export default withOnyx({ - session: { - key: ONYXKEYS.SESSION, - }, - user: { - key: ONYXKEYS.USER, - }, -})(WorkspaceBillsFirstSection); diff --git a/src/pages/workspace/bills/WorkspaceBillsNoVBAView.tsx b/src/pages/workspace/bills/WorkspaceBillsNoVBAView.tsx deleted file mode 100644 index 3503d8565a39..000000000000 --- a/src/pages/workspace/bills/WorkspaceBillsNoVBAView.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import React from 'react'; -import {View} from 'react-native'; -import ConnectBankAccountButton from '@components/ConnectBankAccountButton'; -import * as Illustrations from '@components/Icon/Illustrations'; -import Section from '@components/Section'; -import Text from '@components/Text'; -import useLocalize from '@hooks/useLocalize'; -import useThemeStyles from '@hooks/useThemeStyles'; -import WorkspaceBillsFirstSection from './WorkspaceBillsFirstSection'; - -type WorkspaceBillsNoVBAViewProps = { - /** The policy ID currently being configured */ - policyID: string; -}; - -function WorkspaceBillsNoVBAView({policyID}: WorkspaceBillsNoVBAViewProps) { - const styles = useThemeStyles(); - const {translate} = useLocalize(); - - return ( - <> - - -
- - {translate('workspace.bills.unlockNoVBACopy')} - - -
- - ); -} - -WorkspaceBillsNoVBAView.displayName = 'WorkspaceBillsNoVBAView'; - -export default WorkspaceBillsNoVBAView; diff --git a/src/pages/workspace/bills/WorkspaceBillsPage.tsx b/src/pages/workspace/bills/WorkspaceBillsPage.tsx deleted file mode 100644 index 195cf51a710b..000000000000 --- a/src/pages/workspace/bills/WorkspaceBillsPage.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import type {StackScreenProps} from '@react-navigation/stack'; -import React from 'react'; -import {View} from 'react-native'; -import useLocalize from '@hooks/useLocalize'; -import useResponsiveLayout from '@hooks/useResponsiveLayout'; -import useThemeStyles from '@hooks/useThemeStyles'; -import type {FullScreenNavigatorParamList} from '@navigation/types'; -import WorkspacePageWithSections from '@pages/workspace/WorkspacePageWithSections'; -import CONST from '@src/CONST'; -import type SCREENS from '@src/SCREENS'; -import WorkspaceBillsNoVBAView from './WorkspaceBillsNoVBAView'; -import WorkspaceBillsVBAView from './WorkspaceBillsVBAView'; - -type WorkspaceBillsPageProps = StackScreenProps; - -function WorkspaceBillsPage({route}: WorkspaceBillsPageProps) { - const {translate} = useLocalize(); - const styles = useThemeStyles(); - const {shouldUseNarrowLayout} = useResponsiveLayout(); - - return ( - - {(hasVBA: boolean, policyID: string) => ( - - {!hasVBA && } - {hasVBA && } - - )} - - ); -} - -WorkspaceBillsPage.displayName = 'WorkspaceBillsPage'; - -export default WorkspaceBillsPage; diff --git a/src/pages/workspace/bills/WorkspaceBillsVBAView.tsx b/src/pages/workspace/bills/WorkspaceBillsVBAView.tsx deleted file mode 100644 index 4709061b8567..000000000000 --- a/src/pages/workspace/bills/WorkspaceBillsVBAView.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import React from 'react'; -import {View} from 'react-native'; -import * as Expensicons from '@components/Icon/Expensicons'; -import * as Illustrations from '@components/Icon/Illustrations'; -import Section from '@components/Section'; -import Text from '@components/Text'; -import useLocalize from '@hooks/useLocalize'; -import useThemeStyles from '@hooks/useThemeStyles'; -import * as Link from '@userActions/Link'; -import WorkspaceBillsFirstSection from './WorkspaceBillsFirstSection'; - -type WorkspaceBillsVBAViewProps = { - /** The policy ID currently being configured */ - policyID: string; -}; - -function WorkspaceBillsVBAView({policyID}: WorkspaceBillsVBAViewProps) { - const styles = useThemeStyles(); - const {translate} = useLocalize(); - - const reportsUrl = `reports?policyID=${policyID}&from=all&type=bill&showStates=Processing,Approved&isAdvancedFilterMode=true`; - - return ( - <> - - -
Link.openOldDotLink(reportsUrl), - icon: Expensicons.Bill, - shouldShowRightIcon: true, - iconRight: Expensicons.NewWindow, - wrapperStyle: [styles.cardMenuItem], - link: () => Link.buildOldDotURL(reportsUrl), - }, - ]} - > - - {translate('workspace.bills.VBACopy')} - -
- - ); -} - -WorkspaceBillsVBAView.displayName = 'WorkspaceBillsVBAView'; - -export default WorkspaceBillsVBAView; diff --git a/src/pages/workspace/card/WorkspaceCardNoVBAView.tsx b/src/pages/workspace/card/WorkspaceCardNoVBAView.tsx deleted file mode 100644 index cd6293298830..000000000000 --- a/src/pages/workspace/card/WorkspaceCardNoVBAView.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import React from 'react'; -import {View} from 'react-native'; -import ConnectBankAccountButton from '@components/ConnectBankAccountButton'; -import * as Illustrations from '@components/Icon/Illustrations'; -import Section from '@components/Section'; -import Text from '@components/Text'; -import UnorderedList from '@components/UnorderedList'; -import useLocalize from '@hooks/useLocalize'; -import useThemeStyles from '@hooks/useThemeStyles'; - -type WorkspaceCardNoVBAViewProps = { - /** The policy ID currently being configured */ - policyID: string; -}; - -function WorkspaceCardNoVBAView({policyID}: WorkspaceCardNoVBAViewProps) { - const styles = useThemeStyles(); - const {translate} = useLocalize(); - const unorderedListItems = [translate('workspace.card.benefit1'), translate('workspace.card.benefit2'), translate('workspace.card.benefit3'), translate('workspace.card.benefit4')]; - - return ( -
- - {translate('workspace.card.noVBACopy')} - - - - -
- ); -} - -WorkspaceCardNoVBAView.displayName = 'WorkspaceCardNoVBAView'; - -export default WorkspaceCardNoVBAView; diff --git a/src/pages/workspace/card/WorkspaceCardPage.tsx b/src/pages/workspace/card/WorkspaceCardPage.tsx deleted file mode 100644 index af00d3ad437a..000000000000 --- a/src/pages/workspace/card/WorkspaceCardPage.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import type {StackScreenProps} from '@react-navigation/stack'; -import React from 'react'; -import {View} from 'react-native'; -import useLocalize from '@hooks/useLocalize'; -import useResponsiveLayout from '@hooks/useResponsiveLayout'; -import useThemeStyles from '@hooks/useThemeStyles'; -import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; -import WorkspacePageWithSections from '@pages/workspace/WorkspacePageWithSections'; -import CONST from '@src/CONST'; -import type SCREENS from '@src/SCREENS'; -import WorkspaceCardNoVBAView from './WorkspaceCardNoVBAView'; -import WorkspaceCardVBANoECardView from './WorkspaceCardVBANoECardView'; -import WorkspaceCardVBAWithECardView from './WorkspaceCardVBAWithECardView'; - -type WorkspaceCardPageProps = StackScreenProps; - -function WorkspaceCardPage({route}: WorkspaceCardPageProps) { - const {translate} = useLocalize(); - const styles = useThemeStyles(); - const {shouldUseNarrowLayout} = useResponsiveLayout(); - - return ( - - {(hasVBA?: boolean, policyID?: string, isUsingECard?: boolean) => ( - - {!hasVBA && } - - {hasVBA && !isUsingECard && } - - {hasVBA && isUsingECard && } - - )} - - ); -} - -WorkspaceCardPage.displayName = 'WorkspaceCardPage'; - -export default WorkspaceCardPage; diff --git a/src/pages/workspace/card/WorkspaceCardVBANoECardView.tsx b/src/pages/workspace/card/WorkspaceCardVBANoECardView.tsx deleted file mode 100644 index db7a3f4b6368..000000000000 --- a/src/pages/workspace/card/WorkspaceCardVBANoECardView.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import React from 'react'; -import {View} from 'react-native'; -import type {OnyxEntry} from 'react-native-onyx'; -import {withOnyx} from 'react-native-onyx'; -import Button from '@components/Button'; -import * as Expensicons from '@components/Icon/Expensicons'; -import * as Illustrations from '@components/Icon/Illustrations'; -import Section from '@components/Section'; -import Text from '@components/Text'; -import UnorderedList from '@components/UnorderedList'; -import useLocalize from '@hooks/useLocalize'; -import useThemeStyles from '@hooks/useThemeStyles'; -import * as Link from '@userActions/Link'; -import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; -import type {User} from '@src/types/onyx'; - -type WorkspaceCardVBANoECardViewOnyxProps = { - /** Information about the logged in user's account */ - user: OnyxEntry; -}; - -type WorkspaceCardVBANoECardViewProps = WorkspaceCardVBANoECardViewOnyxProps; - -function WorkspaceCardVBANoECardView({user}: WorkspaceCardVBANoECardViewProps) { - const styles = useThemeStyles(); - const {translate} = useLocalize(); - const unorderedListItems = [translate('workspace.card.benefit1'), translate('workspace.card.benefit2'), translate('workspace.card.benefit3'), translate('workspace.card.benefit4')]; - - return ( - <> -
- - - -
- {!!user?.isCheckingDomain && {translate('workspace.card.checkingDomain')}} - - ); -} - -WorkspaceCardVBANoECardView.displayName = 'WorkspaceCardVBANoECardView'; - -export default withOnyx({ - user: { - key: ONYXKEYS.USER, - }, -})(WorkspaceCardVBANoECardView); diff --git a/src/pages/workspace/card/WorkspaceCardVBAWithECardView.tsx b/src/pages/workspace/card/WorkspaceCardVBAWithECardView.tsx deleted file mode 100644 index 61c2e43f23bf..000000000000 --- a/src/pages/workspace/card/WorkspaceCardVBAWithECardView.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import React from 'react'; -import {View} from 'react-native'; -import * as Expensicons from '@components/Icon/Expensicons'; -import * as Illustrations from '@components/Icon/Illustrations'; -import type {MenuItemWithLink} from '@components/MenuItemList'; -import Section from '@components/Section'; -import Text from '@components/Text'; -import UnorderedList from '@components/UnorderedList'; -import useLocalize from '@hooks/useLocalize'; -import useThemeStyles from '@hooks/useThemeStyles'; -import * as Link from '@userActions/Link'; - -const MENU_LINKS = { - ISSUE_AND_MANAGE_CARDS: 'domain_companycards', - RECONCILE_CARDS: encodeURI('domain_companycards?param={"section":"cardReconciliation"}'), - SETTLEMENT_FREQUENCY: encodeURI('domain_companycards?param={"section":"configureSettings"}'), -} as const; - -function WorkspaceCardVBAWithECardView() { - const styles = useThemeStyles(); - const {translate} = useLocalize(); - - const unorderedListItems = [translate('workspace.card.benefit1'), translate('workspace.card.benefit2'), translate('workspace.card.benefit3'), translate('workspace.card.benefit4')]; - - const menuItems: MenuItemWithLink[] = [ - { - title: translate('workspace.common.issueAndManageCards'), - onPress: () => Link.openOldDotLink(MENU_LINKS.ISSUE_AND_MANAGE_CARDS), - icon: Expensicons.ExpensifyCard, - shouldShowRightIcon: true, - iconRight: Expensicons.NewWindow, - wrapperStyle: [styles.cardMenuItem], - link: () => Link.buildOldDotURL(MENU_LINKS.ISSUE_AND_MANAGE_CARDS), - }, - { - title: translate('workspace.common.reconcileCards'), - onPress: () => Link.openOldDotLink(MENU_LINKS.RECONCILE_CARDS), - icon: Expensicons.ReceiptSearch, - shouldShowRightIcon: true, - iconRight: Expensicons.NewWindow, - wrapperStyle: [styles.cardMenuItem], - link: () => Link.buildOldDotURL(MENU_LINKS.RECONCILE_CARDS), - }, - { - title: translate('workspace.common.settlementFrequency'), - onPress: () => Link.openOldDotLink(MENU_LINKS.SETTLEMENT_FREQUENCY), - icon: Expensicons.Gear, - shouldShowRightIcon: true, - iconRight: Expensicons.NewWindow, - wrapperStyle: [styles.cardMenuItem], - link: () => Link.buildOldDotURL(MENU_LINKS.SETTLEMENT_FREQUENCY), - }, - ]; - - return ( -
- - {translate('workspace.card.VBAWithECardCopy')} - - - - - -
- ); -} - -WorkspaceCardVBAWithECardView.displayName = 'WorkspaceCardVBAWithECardView'; - -export default WorkspaceCardVBAWithECardView; diff --git a/src/pages/workspace/travel/WorkspaceTravelNoVBAView.tsx b/src/pages/workspace/travel/WorkspaceTravelNoVBAView.tsx deleted file mode 100644 index e49c328ce4b5..000000000000 --- a/src/pages/workspace/travel/WorkspaceTravelNoVBAView.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import React from 'react'; -import {View} from 'react-native'; -import ConnectBankAccountButton from '@components/ConnectBankAccountButton'; -import * as Illustrations from '@components/Icon/Illustrations'; -import Section from '@components/Section'; -import Text from '@components/Text'; -import useLocalize from '@hooks/useLocalize'; -import useThemeStyles from '@hooks/useThemeStyles'; - -type WorkspaceTravelNoVBAViewProps = { - /** The policy ID currently being configured */ - policyID: string; -}; - -function WorkspaceTravelNoVBAView({policyID}: WorkspaceTravelNoVBAViewProps) { - const styles = useThemeStyles(); - const {translate} = useLocalize(); - - return ( -
- - {translate('workspace.travel.noVBACopy')} - - -
- ); -} - -WorkspaceTravelNoVBAView.displayName = 'WorkspaceTravelNoVBAView'; - -export default WorkspaceTravelNoVBAView; diff --git a/src/pages/workspace/travel/WorkspaceTravelPage.tsx b/src/pages/workspace/travel/WorkspaceTravelPage.tsx deleted file mode 100644 index 36f7deaea0a1..000000000000 --- a/src/pages/workspace/travel/WorkspaceTravelPage.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import type {StackScreenProps} from '@react-navigation/stack'; -import React from 'react'; -import {View} from 'react-native'; -import useLocalize from '@hooks/useLocalize'; -import useResponsiveLayout from '@hooks/useResponsiveLayout'; -import useThemeStyles from '@hooks/useThemeStyles'; -import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; -import WorkspacePageWithSections from '@pages/workspace/WorkspacePageWithSections'; -import CONST from '@src/CONST'; -import type SCREENS from '@src/SCREENS'; -import WorkspaceTravelNoVBAView from './WorkspaceTravelNoVBAView'; -import WorkspaceTravelVBAView from './WorkspaceTravelVBAView'; - -type WorkspaceTravelPageProps = StackScreenProps; - -function WorkspaceTravelPage({route}: WorkspaceTravelPageProps) { - const {translate} = useLocalize(); - const styles = useThemeStyles(); - const {shouldUseNarrowLayout} = useResponsiveLayout(); - - return ( - - {(hasVBA, policyID) => ( - - {!hasVBA && } - {hasVBA && } - - )} - - ); -} - -WorkspaceTravelPage.displayName = 'WorkspaceTravelPage'; - -export default WorkspaceTravelPage; diff --git a/src/pages/workspace/travel/WorkspaceTravelVBAView.tsx b/src/pages/workspace/travel/WorkspaceTravelVBAView.tsx deleted file mode 100644 index ae4002e14d4b..000000000000 --- a/src/pages/workspace/travel/WorkspaceTravelVBAView.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import React from 'react'; -import {View} from 'react-native'; -import * as Expensicons from '@components/Icon/Expensicons'; -import * as Illustrations from '@components/Icon/Illustrations'; -import Section from '@components/Section'; -import Text from '@components/Text'; -import useLocalize from '@hooks/useLocalize'; -import useThemeStyles from '@hooks/useThemeStyles'; -import * as Link from '@userActions/Link'; -import * as Report from '@userActions/Report'; -import CONST from '@src/CONST'; - -function WorkspaceTravelVBAView() { - const styles = useThemeStyles(); - const {translate} = useLocalize(); - - return ( -
Link.openOldDotLink('domain_companycards'), - icon: Expensicons.ExpensifyCard, - shouldShowRightIcon: true, - iconRight: Expensicons.NewWindow, - wrapperStyle: styles.cardMenuItem, - link: () => Link.buildOldDotURL('domain_companycards'), - }, - { - title: translate('workspace.travel.bookTravelWithConcierge'), - onPress: () => { - Report.navigateToConciergeChat(); - }, - icon: Expensicons.Concierge, - shouldShowRightIcon: true, - wrapperStyle: styles.cardMenuItem, - }, - { - title: translate('requestorStep.learnMore'), - onPress: () => Link.openExternalLink(CONST.CONCIERGE_TRAVEL_URL), - icon: Expensicons.Info, - shouldShowRightIcon: true, - iconRight: Expensicons.NewWindow, - wrapperStyle: styles.cardMenuItem, - link: CONST.CONCIERGE_TRAVEL_URL, - }, - ]} - > - - {translate('workspace.travel.VBACopy')} - -
- ); -} - -WorkspaceTravelVBAView.displayName = 'WorkspaceTravelVBAView'; - -export default WorkspaceTravelVBAView; diff --git a/src/pages/workspace/withPolicy.tsx b/src/pages/workspace/withPolicy.tsx index db55db2514ef..125b954d0a4f 100644 --- a/src/pages/workspace/withPolicy.tsx +++ b/src/pages/workspace/withPolicy.tsx @@ -17,7 +17,6 @@ type PolicyRoute = RouteProp< | typeof SCREENS.REIMBURSEMENT_ACCOUNT_ROOT | typeof SCREENS.WORKSPACE.INITIAL | typeof SCREENS.WORKSPACE.PROFILE - | typeof SCREENS.WORKSPACE.BILLS | typeof SCREENS.WORKSPACE.MORE_FEATURES | typeof SCREENS.WORKSPACE.MEMBERS | typeof SCREENS.WORKSPACE.EXPENSIFY_CARD @@ -31,11 +30,9 @@ type PolicyRoute = RouteProp< | typeof SCREENS.WORKSPACE.WORKFLOWS_APPROVALS_EXPENSES_FROM | typeof SCREENS.WORKSPACE.WORKFLOWS_APPROVALS_APPROVER | typeof SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET - | typeof SCREENS.WORKSPACE.TRAVEL | typeof SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_FREQUENCY | typeof SCREENS.WORKSPACE.MEMBER_DETAILS | typeof SCREENS.WORKSPACE.INVOICES - | typeof SCREENS.WORKSPACE.CARD | typeof SCREENS.WORKSPACE.OWNER_CHANGE_CHECK | typeof SCREENS.WORKSPACE.TAX_EDIT | typeof SCREENS.WORKSPACE.ADDRESS From de3ded41b68632842a85657baaa3e1612df28198 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Fri, 6 Sep 2024 20:50:30 +0700 Subject: [PATCH 02/13] remove free workspace --- src/ROUTES.ts | 16 -- .../FocusTrap/WIDE_LAYOUT_INACTIVE_SCREENS.ts | 1 - .../ModalStackNavigators/index.tsx | 3 - .../Navigators/FullScreenNavigator.tsx | 1 - .../FULL_SCREEN_TO_RHP_MAPPING.ts | 1 - src/libs/Navigation/linkingConfig/config.ts | 12 -- src/libs/Navigation/types.ts | 12 -- .../WorkspaceCardCreateAWorkspace.tsx | 0 src/pages/WorkspaceSwitcherPage/index.tsx | 2 +- .../WorkspaceRateAndUnitPage/InitialPage.tsx | 158 ------------------ .../WorkspaceRateAndUnitPage/RatePage.tsx | 106 ------------ .../WorkspaceRateAndUnitPage/UnitPage.tsx | 78 --------- .../reimburse/WorkspaceReimbursePage.tsx | 33 ---- .../reimburse/WorkspaceReimburseSection.tsx | 111 ------------ .../reimburse/WorkspaceReimburseView.tsx | 150 ----------------- 15 files changed, 1 insertion(+), 683 deletions(-) rename src/pages/{workspace/card => WorkspaceSwitcherPage}/WorkspaceCardCreateAWorkspace.tsx (100%) delete mode 100644 src/pages/workspace/reimburse/WorkspaceRateAndUnitPage/InitialPage.tsx delete mode 100644 src/pages/workspace/reimburse/WorkspaceRateAndUnitPage/RatePage.tsx delete mode 100644 src/pages/workspace/reimburse/WorkspaceRateAndUnitPage/UnitPage.tsx delete mode 100644 src/pages/workspace/reimburse/WorkspaceReimbursePage.tsx delete mode 100644 src/pages/workspace/reimburse/WorkspaceReimburseSection.tsx delete mode 100644 src/pages/workspace/reimburse/WorkspaceReimburseView.tsx diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 399648d1b0f0..a68ac320d956 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -658,22 +658,6 @@ const ROUTES = { route: 'settings/workspaces/:policyID/workflows/auto-reporting-frequency/monthly-offset', getRoute: (policyID: string) => `settings/workspaces/${policyID}/workflows/auto-reporting-frequency/monthly-offset` as const, }, - WORKSPACE_REIMBURSE: { - route: 'settings/workspaces/:policyID/reimburse', - getRoute: (policyID: string) => `settings/workspaces/${policyID}/reimburse` as const, - }, - WORKSPACE_RATE_AND_UNIT: { - route: 'settings/workspaces/:policyID/rateandunit', - getRoute: (policyID: string) => `settings/workspaces/${policyID}/rateandunit` as const, - }, - WORKSPACE_RATE_AND_UNIT_RATE: { - route: 'settings/workspaces/:policyID/rateandunit/rate', - getRoute: (policyID: string) => `settings/workspaces/${policyID}/rateandunit/rate` as const, - }, - WORKSPACE_RATE_AND_UNIT_UNIT: { - route: 'settings/workspaces/:policyID/rateandunit/unit', - getRoute: (policyID: string) => `settings/workspaces/${policyID}/rateandunit/unit` as const, - }, WORKSPACE_INVOICES: { route: 'settings/workspaces/:policyID/invoices', getRoute: (policyID: string) => `settings/workspaces/${policyID}/invoices` as const, diff --git a/src/components/FocusTrap/WIDE_LAYOUT_INACTIVE_SCREENS.ts b/src/components/FocusTrap/WIDE_LAYOUT_INACTIVE_SCREENS.ts index ee3ea9b9e0c6..26094b8299a7 100644 --- a/src/components/FocusTrap/WIDE_LAYOUT_INACTIVE_SCREENS.ts +++ b/src/components/FocusTrap/WIDE_LAYOUT_INACTIVE_SCREENS.ts @@ -21,7 +21,6 @@ const WIDE_LAYOUT_INACTIVE_SCREENS: string[] = [ SCREENS.WORKSPACE.INITIAL, SCREENS.WORKSPACE.PROFILE, SCREENS.WORKSPACE.WORKFLOWS, - SCREENS.WORKSPACE.REIMBURSE, SCREENS.WORKSPACE.INVOICES, SCREENS.WORKSPACE.MEMBERS, SCREENS.WORKSPACE.CATEGORIES, diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index c2a30f20ed56..cff94bcb6392 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -221,9 +221,6 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/settings/Subscription/SubscriptionSize').default, [SCREENS.SETTINGS.SUBSCRIPTION.DISABLE_AUTO_RENEW_SURVEY]: () => require('../../../../pages/settings/Subscription/DisableAutoRenewSurveyPage').default, [SCREENS.SETTINGS.SUBSCRIPTION.REQUEST_EARLY_CANCELLATION]: () => require('../../../../pages/settings/Subscription/RequestEarlyCancellationPage').default, - [SCREENS.WORKSPACE.RATE_AND_UNIT]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/InitialPage').default, - [SCREENS.WORKSPACE.RATE_AND_UNIT_RATE]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/RatePage').default, - [SCREENS.WORKSPACE.RATE_AND_UNIT_UNIT]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/UnitPage').default, [SCREENS.WORKSPACE.INVITE]: () => require('../../../../pages/workspace/WorkspaceInvitePage').default, [SCREENS.WORKSPACE.WORKFLOWS_APPROVALS_NEW]: () => require('../../../../pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsCreatePage').default, [SCREENS.WORKSPACE.WORKFLOWS_APPROVALS_EDIT]: () => require('../../../../pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsEditPage').default, diff --git a/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx index 5a9da5ed0677..2f513fe804bb 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx @@ -19,7 +19,6 @@ type Screens = Partial React.Co const CENTRAL_PANE_WORKSPACE_SCREENS = { [SCREENS.WORKSPACE.PROFILE]: () => require('../../../../pages/workspace/WorkspaceProfilePage').default, [SCREENS.WORKSPACE.WORKFLOWS]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsPage').default, - [SCREENS.WORKSPACE.REIMBURSE]: () => require('../../../../pages/workspace/reimburse/WorkspaceReimbursePage').default, [SCREENS.WORKSPACE.INVOICES]: () => require('../../../../pages/workspace/invoices/WorkspaceInvoicesPage').default, [SCREENS.WORKSPACE.MEMBERS]: () => require('../../../../pages/workspace/WorkspaceMembersPage').default, [SCREENS.WORKSPACE.ACCOUNTING.ROOT]: () => require('../../../../pages/workspace/accounting/PolicyAccountingPage').default, diff --git a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts index 22db5deaebfb..f7df87890469 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -3,7 +3,6 @@ import SCREENS from '@src/SCREENS'; const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { [SCREENS.WORKSPACE.PROFILE]: [SCREENS.WORKSPACE.NAME, SCREENS.WORKSPACE.ADDRESS, SCREENS.WORKSPACE.CURRENCY, SCREENS.WORKSPACE.DESCRIPTION, SCREENS.WORKSPACE.SHARE], - [SCREENS.WORKSPACE.REIMBURSE]: [SCREENS.WORKSPACE.RATE_AND_UNIT, SCREENS.WORKSPACE.RATE_AND_UNIT_RATE, SCREENS.WORKSPACE.RATE_AND_UNIT_UNIT], [SCREENS.WORKSPACE.MEMBERS]: [ SCREENS.WORKSPACE.INVITE, SCREENS.WORKSPACE.INVITE_MESSAGE, diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index 5d9d65a5bb67..92dc38e03f04 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -520,15 +520,6 @@ const config: LinkingOptions['config'] = { [SCREENS.WORKSPACE.COMPANY_CARDS_ASSIGN_CARD]: { path: ROUTES.WORKSPACE_COMPANY_CARDS_ASSIGN_CARD.route, }, - [SCREENS.WORKSPACE.RATE_AND_UNIT]: { - path: ROUTES.WORKSPACE_RATE_AND_UNIT.route, - }, - [SCREENS.WORKSPACE.RATE_AND_UNIT_RATE]: { - path: ROUTES.WORKSPACE_RATE_AND_UNIT_RATE.route, - }, - [SCREENS.WORKSPACE.RATE_AND_UNIT_UNIT]: { - path: ROUTES.WORKSPACE_RATE_AND_UNIT_UNIT.route, - }, [SCREENS.WORKSPACE.INVITE]: { path: ROUTES.WORKSPACE_INVITE.route, }, @@ -1095,9 +1086,6 @@ const config: LinkingOptions['config'] = { [SCREENS.WORKSPACE.WORKFLOWS]: { path: ROUTES.WORKSPACE_WORKFLOWS.route, }, - [SCREENS.WORKSPACE.REIMBURSE]: { - path: ROUTES.WORKSPACE_REIMBURSE.route, - }, [SCREENS.WORKSPACE.INVOICES]: { path: ROUTES.WORKSPACE_INVOICES.route, }, diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 4d9b0539b9d8..14b97e390bf1 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -181,15 +181,6 @@ type SettingsNavigatorParamList = { [SCREENS.WORKSPACE.NAME]: undefined; [SCREENS.WORKSPACE.DESCRIPTION]: undefined; [SCREENS.WORKSPACE.SHARE]: undefined; - [SCREENS.WORKSPACE.RATE_AND_UNIT]: { - policyID: string; - }; - [SCREENS.WORKSPACE.RATE_AND_UNIT_RATE]: { - policyID: string; - }; - [SCREENS.WORKSPACE.RATE_AND_UNIT_UNIT]: { - policyID: string; - }; [SCREENS.WORKSPACE.INVITE]: { policyID: string; }; @@ -1170,9 +1161,6 @@ type FullScreenNavigatorParamList = { [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET]: { policyID: string; }; - [SCREENS.WORKSPACE.REIMBURSE]: { - policyID: string; - }; [SCREENS.WORKSPACE.INVOICES]: { policyID: string; }; diff --git a/src/pages/workspace/card/WorkspaceCardCreateAWorkspace.tsx b/src/pages/WorkspaceSwitcherPage/WorkspaceCardCreateAWorkspace.tsx similarity index 100% rename from src/pages/workspace/card/WorkspaceCardCreateAWorkspace.tsx rename to src/pages/WorkspaceSwitcherPage/WorkspaceCardCreateAWorkspace.tsx diff --git a/src/pages/WorkspaceSwitcherPage/index.tsx b/src/pages/WorkspaceSwitcherPage/index.tsx index 6dc5ecce075b..53d40340fa3d 100644 --- a/src/pages/WorkspaceSwitcherPage/index.tsx +++ b/src/pages/WorkspaceSwitcherPage/index.tsx @@ -20,7 +20,7 @@ import {sortWorkspacesBySelected} from '@libs/PolicyUtils'; import * as ReportUtils from '@libs/ReportUtils'; import {getWorkspacesBrickRoads, getWorkspacesUnreadStatuses} from '@libs/WorkspacesSettingsUtils'; import type {BrickRoad} from '@libs/WorkspacesSettingsUtils'; -import WorkspaceCardCreateAWorkspace from '@pages/workspace/card/WorkspaceCardCreateAWorkspace'; +import WorkspaceCardCreateAWorkspace from './WorkspaceCardCreateAWorkspace'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; diff --git a/src/pages/workspace/reimburse/WorkspaceRateAndUnitPage/InitialPage.tsx b/src/pages/workspace/reimburse/WorkspaceRateAndUnitPage/InitialPage.tsx deleted file mode 100644 index 7381d02cb01d..000000000000 --- a/src/pages/workspace/reimburse/WorkspaceRateAndUnitPage/InitialPage.tsx +++ /dev/null @@ -1,158 +0,0 @@ -import {Str} from 'expensify-common'; -import React, {useEffect} from 'react'; -import {View} from 'react-native'; -import type {OnyxEntry} from 'react-native-onyx'; -import {withOnyx} from 'react-native-onyx'; -import FormAlertWithSubmitButton from '@components/FormAlertWithSubmitButton'; -import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; -import OfflineWithFeedback from '@components/OfflineWithFeedback'; -import ScrollView from '@components/ScrollView'; -import useLocalize from '@hooks/useLocalize'; -import useThemeStyles from '@hooks/useThemeStyles'; -import * as CurrencyUtils from '@libs/CurrencyUtils'; -import Navigation from '@libs/Navigation/Navigation'; -import * as PolicyUtils from '@libs/PolicyUtils'; -import {getUnitTranslationKey} from '@libs/WorkspacesSettingsUtils'; -import type {WithPolicyProps} from '@pages/workspace/withPolicy'; -import withPolicy from '@pages/workspace/withPolicy'; -import WorkspacePageWithSections from '@pages/workspace/WorkspacePageWithSections'; -import * as BankAccounts from '@userActions/BankAccounts'; -import * as Policy from '@userActions/Policy/Policy'; -import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES from '@src/ROUTES'; -import type {ReimbursementAccount, WorkspaceRateAndUnit} from '@src/types/onyx'; -import type {Unit} from '@src/types/onyx/Policy'; -import {isEmptyObject} from '@src/types/utils/EmptyObject'; - -type WorkspaceRateAndUnitPageBaseProps = WithPolicyProps; - -type WorkspaceRateAndUnitOnyxProps = { - workspaceRateAndUnit: OnyxEntry; - // eslint-disable-next-line react/no-unused-prop-types - reimbursementAccount: OnyxEntry; -}; - -type WorkspaceRateAndUnitPageProps = WorkspaceRateAndUnitPageBaseProps & WorkspaceRateAndUnitOnyxProps; - -function WorkspaceRateAndUnitPage(props: WorkspaceRateAndUnitPageProps) { - const styles = useThemeStyles(); - const {translate} = useLocalize(); - - useEffect(() => { - if (props.workspaceRateAndUnit?.policyID === props.policy?.id) { - return; - } - Policy.setPolicyIDForReimburseView(props.policy?.id ?? '-1'); - // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps - }, []); - - useEffect(() => { - const customUnits = props.policy?.customUnits ?? {}; - if (!isEmptyObject(customUnits)) { - return; - } - - BankAccounts.setReimbursementAccountLoading(true); - Policy.openWorkspaceReimburseView(props.policy?.id ?? '-1'); - }, [props]); - - const saveUnitAndRate = (newUnit: Unit, newRate: string) => { - const distanceCustomUnit = PolicyUtils.getCustomUnit(props.policy); - if (!distanceCustomUnit) { - return; - } - const currentCustomUnitRate = Object.values(distanceCustomUnit?.rates ?? {}).find((rate) => rate.name === CONST.CUSTOM_UNITS.DEFAULT_RATE); - const unitID = distanceCustomUnit.customUnitID ?? ''; - const unitName = distanceCustomUnit.name ?? ''; - - const newCustomUnit = { - customUnitID: unitID, - name: unitName, - attributes: {unit: newUnit}, - rates: { - ...currentCustomUnitRate, - rate: parseFloat(newRate), - }, - }; - Policy.updateWorkspaceCustomUnitAndRate(props.policy?.id ?? '-1', distanceCustomUnit, newCustomUnit, props.policy?.lastModified); - }; - - const distanceCustomUnit = PolicyUtils.getCustomUnit(props.policy); - const distanceCustomRate = Object.values(distanceCustomUnit?.rates ?? {}).find((rate) => rate.name === CONST.CUSTOM_UNITS.DEFAULT_RATE); - - const unitValue = props.workspaceRateAndUnit?.unit ?? distanceCustomUnit?.attributes.unit ?? CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES; - const rateValue = props.workspaceRateAndUnit?.rate ?? distanceCustomRate?.rate?.toString() ?? ''; - const unitTitle = Str.recapitalize(translate(getUnitTranslationKey(unitValue))); - - const submit = () => { - saveUnitAndRate(unitValue, rateValue); - Policy.clearOnyxDataForReimburseView(); - Navigation.goBack(); - }; - - return ( - - {() => ( - - - - Policy.clearCustomUnitErrors(props.policy?.id ?? '-1', distanceCustomUnit?.customUnitID ?? '-1', distanceCustomRate?.customUnitRateID ?? '-1')} - > - Navigation.navigate(ROUTES.WORKSPACE_RATE_AND_UNIT_RATE.getRoute(props.policy?.id ?? '-1'))} - shouldShowRightIcon - /> - Navigation.navigate(ROUTES.WORKSPACE_RATE_AND_UNIT_UNIT.getRoute(props.policy?.id ?? '-1'))} - shouldShowRightIcon - /> - - - - - submit()} - enabledWhenOffline - buttonText={translate('common.save')} - containerStyles={[styles.mh0, styles.mt5, styles.flex1, styles.ph5]} - isAlertVisible={false} - /> - - - )} - - ); -} - -WorkspaceRateAndUnitPage.displayName = 'WorkspaceRateAndUnitPage'; - -export default withPolicy( - withOnyx({ - // @ts-expect-error: ONYXKEYS.REIMBURSEMENT_ACCOUNT is conflicting with ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM - reimbursementAccount: { - key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, - }, - workspaceRateAndUnit: { - key: ONYXKEYS.WORKSPACE_RATE_AND_UNIT, - }, - })(WorkspaceRateAndUnitPage), -); diff --git a/src/pages/workspace/reimburse/WorkspaceRateAndUnitPage/RatePage.tsx b/src/pages/workspace/reimburse/WorkspaceRateAndUnitPage/RatePage.tsx deleted file mode 100644 index c8a2b3373230..000000000000 --- a/src/pages/workspace/reimburse/WorkspaceRateAndUnitPage/RatePage.tsx +++ /dev/null @@ -1,106 +0,0 @@ -import React, {useCallback, useEffect, useMemo} from 'react'; -import type {OnyxEntry} from 'react-native-onyx'; -import {withOnyx} from 'react-native-onyx'; -import AmountForm from '@components/AmountForm'; -import FormProvider from '@components/Form/FormProvider'; -import InputWrapperWithRef from '@components/Form/InputWrapper'; -import type {FormOnyxValues} from '@components/Form/types'; -import useLocalize from '@hooks/useLocalize'; -import useThemeStyles from '@hooks/useThemeStyles'; -import Navigation from '@libs/Navigation/Navigation'; -import {validateRateValue} from '@libs/PolicyDistanceRatesUtils'; -import * as PolicyUtils from '@libs/PolicyUtils'; -import type {WithPolicyProps} from '@pages/workspace/withPolicy'; -import withPolicy from '@pages/workspace/withPolicy'; -import WorkspacePageWithSections from '@pages/workspace/WorkspacePageWithSections'; -import * as Policy from '@userActions/Policy/Policy'; -import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES from '@src/ROUTES'; -import INPUT_IDS from '@src/types/form/WorkspaceRateAndUnitForm'; -import type {WorkspaceRateAndUnit} from '@src/types/onyx'; - -type WorkspaceRatePageBaseProps = WithPolicyProps; - -type WorkspaceRateAndUnitOnyxProps = { - workspaceRateAndUnit: OnyxEntry; -}; - -type WorkspaceRatePageProps = WorkspaceRatePageBaseProps & WorkspaceRateAndUnitOnyxProps; - -function WorkspaceRatePage(props: WorkspaceRatePageProps) { - const styles = useThemeStyles(); - const {translate, toLocaleDigit} = useLocalize(); - const outputCurrency = props.policy?.outputCurrency ?? CONST.CURRENCY.USD; - - useEffect(() => { - if (props.workspaceRateAndUnit?.policyID === props.policy?.id) { - return; - } - Policy.setPolicyIDForReimburseView(props.policy?.id ?? '-1'); - // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps - }, []); - - const submit = (values: FormOnyxValues) => { - const rate = values.rate; - Policy.setRateForReimburseView((parseFloat(rate) * CONST.POLICY.CUSTOM_UNIT_RATE_BASE_OFFSET).toFixed(1)); - Navigation.goBack(ROUTES.WORKSPACE_RATE_AND_UNIT.getRoute(props.policy?.id ?? '-1')); - }; - - const validate = useCallback( - (values: FormOnyxValues) => validateRateValue(values, outputCurrency, toLocaleDigit), - [outputCurrency, toLocaleDigit], - ); - - const defaultValue = useMemo(() => { - const defaultDistanceCustomUnit = PolicyUtils.getCustomUnit(props.policy); - const distanceCustomRate = Object.values(defaultDistanceCustomUnit?.rates ?? {}).find((rate) => rate.name === CONST.CUSTOM_UNITS.DEFAULT_RATE); - return distanceCustomRate?.rate ?? 0; - }, [props.policy]); - - return ( - - {() => ( - - - - )} - - ); -} - -WorkspaceRatePage.displayName = 'WorkspaceRatePage'; - -export default withPolicy( - withOnyx({ - workspaceRateAndUnit: { - key: ONYXKEYS.WORKSPACE_RATE_AND_UNIT, - }, - })(WorkspaceRatePage), -); diff --git a/src/pages/workspace/reimburse/WorkspaceRateAndUnitPage/UnitPage.tsx b/src/pages/workspace/reimburse/WorkspaceRateAndUnitPage/UnitPage.tsx deleted file mode 100644 index 981ad2c81f9b..000000000000 --- a/src/pages/workspace/reimburse/WorkspaceRateAndUnitPage/UnitPage.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import React, {useEffect, useMemo} from 'react'; -import type {OnyxEntry} from 'react-native-onyx'; -import {withOnyx} from 'react-native-onyx'; -import Text from '@components/Text'; -import type {UnitItemType} from '@components/UnitPicker'; -import UnitPicker from '@components/UnitPicker'; -import useLocalize from '@hooks/useLocalize'; -import useThemeStyles from '@hooks/useThemeStyles'; -import Navigation from '@libs/Navigation/Navigation'; -import * as PolicyUtils from '@libs/PolicyUtils'; -import type {WithPolicyProps} from '@pages/workspace/withPolicy'; -import withPolicy from '@pages/workspace/withPolicy'; -import WorkspacePageWithSections from '@pages/workspace/WorkspacePageWithSections'; -import * as Policy from '@userActions/Policy/Policy'; -import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES from '@src/ROUTES'; -import type {WorkspaceRateAndUnit} from '@src/types/onyx'; - -type WorkspaceUnitPageBaseProps = WithPolicyProps; - -type WorkspaceRateAndUnitOnyxProps = { - workspaceRateAndUnit: OnyxEntry; -}; - -type WorkspaceUnitPageProps = WorkspaceUnitPageBaseProps & WorkspaceRateAndUnitOnyxProps; -function WorkspaceUnitPage(props: WorkspaceUnitPageProps) { - const styles = useThemeStyles(); - const {translate} = useLocalize(); - - useEffect(() => { - if (props.workspaceRateAndUnit?.policyID === props.policy?.id) { - return; - } - Policy.setPolicyIDForReimburseView(props.policy?.id ?? '-1'); - // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps - }, []); - - const updateUnit = (unit: UnitItemType) => { - Policy.setUnitForReimburseView(unit.value); - Navigation.goBack(ROUTES.WORKSPACE_RATE_AND_UNIT.getRoute(props.policy?.id ?? '-1')); - }; - - const defaultValue = useMemo(() => { - const defaultDistanceCustomUnit = PolicyUtils.getCustomUnit(props.policy); - return defaultDistanceCustomUnit?.attributes.unit ?? CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES; - }, [props.policy]); - - return ( - - {() => ( - <> - {translate('workspace.reimburse.trackDistanceChooseUnit')} - - - )} - - ); -} - -WorkspaceUnitPage.displayName = 'WorkspaceUnitPage'; -export default withPolicy( - withOnyx({ - workspaceRateAndUnit: { - key: ONYXKEYS.WORKSPACE_RATE_AND_UNIT, - }, - })(WorkspaceUnitPage), -); diff --git a/src/pages/workspace/reimburse/WorkspaceReimbursePage.tsx b/src/pages/workspace/reimburse/WorkspaceReimbursePage.tsx deleted file mode 100644 index d929ec10748a..000000000000 --- a/src/pages/workspace/reimburse/WorkspaceReimbursePage.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import type {StackScreenProps} from '@react-navigation/stack'; -import React from 'react'; -import useLocalize from '@hooks/useLocalize'; -import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; -import type {WithPolicyProps} from '@pages/workspace/withPolicy'; -import withPolicy from '@pages/workspace/withPolicy'; -import WorkspacePageWithSections from '@pages/workspace/WorkspacePageWithSections'; -import CONST from '@src/CONST'; -import type SCREENS from '@src/SCREENS'; -import WorkspaceReimburseView from './WorkspaceReimburseView'; - -type WorkspaceReimbursePageProps = WithPolicyProps & StackScreenProps; - -function WorkspaceReimbursePage({route, policy}: WorkspaceReimbursePageProps) { - const {translate} = useLocalize(); - - return ( - - {() => } - - ); -} - -WorkspaceReimbursePage.displayName = 'WorkspaceReimbursePage'; - -export default withPolicy(WorkspaceReimbursePage); diff --git a/src/pages/workspace/reimburse/WorkspaceReimburseSection.tsx b/src/pages/workspace/reimburse/WorkspaceReimburseSection.tsx deleted file mode 100644 index 6c07956e74a7..000000000000 --- a/src/pages/workspace/reimburse/WorkspaceReimburseSection.tsx +++ /dev/null @@ -1,111 +0,0 @@ -import React, {useEffect, useState} from 'react'; -import {ActivityIndicator, View} from 'react-native'; -import type {OnyxEntry} from 'react-native-onyx'; -import ConnectBankAccountButton from '@components/ConnectBankAccountButton'; -import * as Expensicons from '@components/Icon/Expensicons'; -import * as Illustrations from '@components/Icon/Illustrations'; -import Section from '@components/Section'; -import Text from '@components/Text'; -import useLocalize from '@hooks/useLocalize'; -import useNetwork from '@hooks/useNetwork'; -import usePrevious from '@hooks/usePrevious'; -import useTheme from '@hooks/useTheme'; -import useThemeStyles from '@hooks/useThemeStyles'; -import BankAccount from '@libs/models/BankAccount'; -import * as Link from '@userActions/Link'; -import type * as OnyxTypes from '@src/types/onyx'; - -type WorkspaceReimburseSectionProps = { - /** Policy values needed in the component */ - policy: OnyxEntry; - - /** Bank account attached to free plan */ - reimbursementAccount: OnyxEntry; -}; - -function WorkspaceReimburseSection({policy, reimbursementAccount}: WorkspaceReimburseSectionProps) { - const theme = useTheme(); - const styles = useThemeStyles(); - const {translate} = useLocalize(); - const [shouldShowLoadingSpinner, setShouldShowLoadingSpinner] = useState(true); - const achState = reimbursementAccount?.achData?.state ?? ''; - const hasVBA = achState === BankAccount.STATE.OPEN; - const policyId = policy?.id ?? '-1'; - const reimburseReceiptsUrl = `reports?policyID=${policyId}&from=all&type=expense&showStates=Archived&isAdvancedFilterMode=true`; - const isLoading = reimbursementAccount?.isLoading ?? false; - const prevIsLoading = usePrevious(isLoading); - const {isOffline} = useNetwork(); - - useEffect(() => { - if (prevIsLoading === isLoading) { - return; - } - setShouldShowLoadingSpinner(isLoading); - }, [prevIsLoading, isLoading]); - - if (isOffline) { - return ( -
- - {`${translate('common.youAppearToBeOffline')} ${translate('common.thisFeatureRequiresInternet')}`} - -
- ); - } - - if (shouldShowLoadingSpinner) { - return ( - - - - ); - } - - return hasVBA ? ( -
Link.openOldDotLink(reimburseReceiptsUrl), - icon: Expensicons.Bank, - shouldShowRightIcon: true, - iconRight: Expensicons.NewWindow, - wrapperStyle: [styles.cardMenuItem], - link: () => Link.buildOldDotURL(reimburseReceiptsUrl), - }, - ]} - > - - {translate('workspace.reimburse.fastReimbursementsVBACopy')} - -
- ) : ( -
- - {translate('workspace.reimburse.unlockNoVBACopy')} - - -
- ); -} - -WorkspaceReimburseSection.displayName = 'WorkspaceReimburseSection'; - -export default WorkspaceReimburseSection; diff --git a/src/pages/workspace/reimburse/WorkspaceReimburseView.tsx b/src/pages/workspace/reimburse/WorkspaceReimburseView.tsx deleted file mode 100644 index 8cfd6ee07207..000000000000 --- a/src/pages/workspace/reimburse/WorkspaceReimburseView.tsx +++ /dev/null @@ -1,150 +0,0 @@ -import React, {useCallback, useEffect, useState} from 'react'; -import {View} from 'react-native'; -import {withOnyx} from 'react-native-onyx'; -import type {OnyxEntry} from 'react-native-onyx'; -import CopyTextToClipboard from '@components/CopyTextToClipboard'; -import * as Expensicons from '@components/Icon/Expensicons'; -import * as Illustrations from '@components/Icon/Illustrations'; -import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; -import OfflineWithFeedback from '@components/OfflineWithFeedback'; -import Section from '@components/Section'; -import Text from '@components/Text'; -import useLocalize from '@hooks/useLocalize'; -import useNetwork from '@hooks/useNetwork'; -import useResponsiveLayout from '@hooks/useResponsiveLayout'; -import useThemeStyles from '@hooks/useThemeStyles'; -import Navigation from '@libs/Navigation/Navigation'; -import * as PolicyUtils from '@libs/PolicyUtils'; -import * as BankAccounts from '@userActions/BankAccounts'; -import * as Link from '@userActions/Link'; -import * as Policy from '@userActions/Policy/Policy'; -import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES from '@src/ROUTES'; -import type * as OnyxTypes from '@src/types/onyx'; -import type {Unit} from '@src/types/onyx/Policy'; -import WorkspaceReimburseSection from './WorkspaceReimburseSection'; - -type WorkspaceReimburseViewOnyxProps = { - /** Bank account attached to free plan */ - reimbursementAccount: OnyxEntry; -}; - -type WorkspaceReimburseViewProps = WorkspaceReimburseViewOnyxProps & { - /** Policy values needed in the component */ - policy: OnyxEntry; -}; - -function WorkspaceReimburseView({policy, reimbursementAccount}: WorkspaceReimburseViewProps) { - const styles = useThemeStyles(); - const [currentRatePerUnit, setCurrentRatePerUnit] = useState(''); - const {shouldUseNarrowLayout} = useResponsiveLayout(); - const viewAllReceiptsUrl = `expenses?policyIDList=${policy?.id ?? '-1'}&billableReimbursable=reimbursable&submitterEmail=%2B%2B`; - const distanceCustomUnit = PolicyUtils.getCustomUnit(policy); - const distanceCustomRate = Object.values(distanceCustomUnit?.rates ?? {}).find((rate) => rate.name === CONST.CUSTOM_UNITS.DEFAULT_RATE); - const {translate, toLocaleDigit} = useLocalize(); - const {isOffline} = useNetwork(); - - const getUnitLabel = useCallback((value: Unit): string => translate(`common.${value}`), [translate]); - - const getCurrentRatePerUnitLabel = useCallback(() => { - const customUnitRate = Object.values(distanceCustomUnit?.rates ?? {}).find((rate) => rate && rate.name === CONST.CUSTOM_UNITS.DEFAULT_RATE); - const currentUnit = getUnitLabel(distanceCustomUnit?.attributes.unit ?? CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES); - const currentRate = PolicyUtils.getUnitRateValue(toLocaleDigit, customUnitRate); - const perWord = translate('common.per'); - - return `${currentRate} ${perWord} ${currentUnit}`; - }, [translate, distanceCustomUnit, toLocaleDigit, getUnitLabel]); - - const fetchData = useCallback(() => { - // Instead of setting the reimbursement account loading within the optimistic data of the API command, use a separate action so that the Onyx value is updated right away. - // openWorkspaceReimburseView uses API.read which will not make the request until all WRITE requests in the sequential queue have finished responding, so there would be a delay in - // updating Onyx with the optimistic data. - BankAccounts.setReimbursementAccountLoading(true); - Policy.openWorkspaceReimburseView(policy?.id ?? '-1'); - }, [policy?.id]); - - useEffect(() => { - if (isOffline) { - return; - } - fetchData(); - }, [isOffline, fetchData]); - - useEffect(() => { - setCurrentRatePerUnit(getCurrentRatePerUnitLabel()); - }, [policy?.customUnits, getCurrentRatePerUnitLabel]); - - return ( - -
Link.openOldDotLink(viewAllReceiptsUrl), - icon: Expensicons.Receipt, - shouldShowRightIcon: true, - iconRight: Expensicons.NewWindow, - wrapperStyle: styles.cardMenuItem, - link: () => Link.buildOldDotURL(viewAllReceiptsUrl), - }, - ]} - > - - - {translate('workspace.reimburse.captureNoVBACopyBeforeEmail')} - - {translate('workspace.reimburse.captureNoVBACopyAfterEmail')} - - -
- -
- - {translate('workspace.reimburse.trackDistanceCopy')} - - { - Policy.setPolicyIDForReimburseView(policy?.id ?? '-1'); - Navigation.navigate(ROUTES.WORKSPACE_RATE_AND_UNIT.getRoute(policy?.id ?? '-1')); - }} - wrapperStyle={[styles.sectionMenuItemTopDescription, styles.mt3]} - brickRoadIndicator={(distanceCustomUnit?.errors ?? distanceCustomRate?.errors) && CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR} - /> - - -
- - -
- ); -} - -WorkspaceReimburseView.displayName = 'WorkspaceReimburseView'; - -export default withOnyx({ - // @ts-expect-error: ONYXKEYS.REIMBURSEMENT_ACCOUNT is conflicting with ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM - reimbursementAccount: { - key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, - }, -})(WorkspaceReimburseView); From c74eb3a07bacb58ab7ab3603a76ac6fa1237df60 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Fri, 6 Sep 2024 21:33:21 +0700 Subject: [PATCH 03/13] remove free workspace --- src/CONST.ts | 5 - src/ONYXKEYS.ts | 12 -- src/SCREENS.ts | 4 - src/components/UnorderedList.tsx | 26 ---- src/languages/en.ts | 50 +------ src/languages/es.ts | 52 +------ .../OpenWorkspaceReimburseViewParams.ts | 5 - .../UpdateWorkspaceCustomUnitAndRateParams.ts | 8 -- src/libs/API/parameters/index.ts | 1 - src/libs/API/types.ts | 4 - src/libs/PolicyDistanceRatesUtils.ts | 6 +- src/libs/actions/Policy/Policy.ts | 136 ------------------ src/pages/workspace/WorkspaceInitialPage.tsx | 1 - src/types/form/WorkspaceRateAndUnitForm.ts | 20 --- src/types/form/index.ts | 1 - src/types/onyx/WorkspaceRateAndUnit.ts | 16 --- src/types/onyx/index.ts | 2 - 17 files changed, 8 insertions(+), 341 deletions(-) delete mode 100644 src/components/UnorderedList.tsx delete mode 100644 src/libs/API/parameters/OpenWorkspaceReimburseViewParams.ts delete mode 100644 src/libs/API/parameters/UpdateWorkspaceCustomUnitAndRateParams.ts delete mode 100644 src/types/form/WorkspaceRateAndUnitForm.ts delete mode 100644 src/types/onyx/WorkspaceRateAndUnit.ts diff --git a/src/CONST.ts b/src/CONST.ts index 0f0105fdc358..baba4bfcf5ba 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -2469,11 +2469,7 @@ const CONST = { CONCIERGE_DM: 'NewExpensifyConciergeDM', WORKSPACE_INITIAL: 'WorkspaceHome', WORKSPACE_PROFILE: 'WorkspaceProfile', - WORKSPACE_CARD: 'WorkspaceCorporateCards', - WORKSPACE_REIMBURSE: 'WorkspaceReimburseReceipts', - WORKSPACE_BILLS: 'WorkspacePayBills', WORKSPACE_INVOICES: 'WorkspaceSendInvoices', - WORKSPACE_TRAVEL: 'WorkspaceBookTravel', WORKSPACE_MEMBERS: 'WorkspaceManageMembers', WORKSPACE_EXPENSIFY_CARD: 'WorkspaceExpensifyCard', WORKSPACE_WORKFLOWS: 'WorkspaceWorkflows', @@ -3785,7 +3781,6 @@ const CONST = { SEARCH_ISSUES: 'https://github.com/Expensify/App/issues', }, - CONCIERGE_TRAVEL_URL: 'https://community.expensify.com/discussion/7066/introducing-concierge-travel', BOOK_TRAVEL_DEMO_URL: 'https://calendly.com/d/ck2z-xsh-q97/expensify-travel-demo-travel-page', TRAVEL_DOT_URL: 'https://travel.expensify.com', STAGING_TRAVEL_DOT_URL: 'https://staging.travel.expensify.com', diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index d2a0372fd9c7..f6fe230fd39f 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -67,14 +67,6 @@ const ONYXKEYS = { /** Contains all the info for Tasks */ TASK: 'task', - /** - * Contains all the info for Workspace Rate and Unit while editing. - * - * Note: This is not under the COLLECTION key as we can edit rate and unit - * for one workspace only at a time. And we don't need to store - * rates and units for different workspaces at the same time. */ - WORKSPACE_RATE_AND_UNIT: 'workspaceRateAndUnit', - /** Contains a list of all currencies available to the user - user can * select a currency based on the list */ CURRENCY_LIST: 'currencyList', @@ -502,8 +494,6 @@ const ONYXKEYS = { WORKSPACE_SETTINGS_FORM_DRAFT: 'workspaceSettingsFormDraft', WORKSPACE_DESCRIPTION_FORM: 'workspaceDescriptionForm', WORKSPACE_DESCRIPTION_FORM_DRAFT: 'workspaceDescriptionFormDraft', - WORKSPACE_RATE_AND_UNIT_FORM: 'workspaceRateAndUnitForm', - WORKSPACE_RATE_AND_UNIT_FORM_DRAFT: 'workspaceRateAndUnitFormDraft', WORKSPACE_TAX_CUSTOM_NAME: 'workspaceTaxCustomName', WORKSPACE_TAX_CUSTOM_NAME_DRAFT: 'workspaceTaxCustomNameDraft', WORKSPACE_COMPANY_CARD_FEED_NAME: 'workspaceCompanyCardFeedName', @@ -658,7 +648,6 @@ type OnyxFormValuesMapping = { [ONYXKEYS.FORMS.WORKSPACE_SETTINGS_FORM]: FormTypes.WorkspaceSettingsForm; [ONYXKEYS.FORMS.WORKSPACE_CATEGORY_FORM]: FormTypes.WorkspaceCategoryForm; [ONYXKEYS.FORMS.WORKSPACE_TAG_FORM]: FormTypes.WorkspaceTagForm; - [ONYXKEYS.FORMS.WORKSPACE_RATE_AND_UNIT_FORM]: FormTypes.WorkspaceRateAndUnitForm; [ONYXKEYS.FORMS.WORKSPACE_TAX_CUSTOM_NAME]: FormTypes.WorkspaceTaxCustomName; [ONYXKEYS.FORMS.WORKSPACE_COMPANY_CARD_FEED_NAME]: FormTypes.WorkspaceCompanyCardFeedName; [ONYXKEYS.FORMS.WORKSPACE_REPORT_FIELDS_FORM]: FormTypes.WorkspaceReportFieldForm; @@ -814,7 +803,6 @@ type OnyxValuesMapping = { [ONYXKEYS.PRIVATE_PERSONAL_DETAILS]: OnyxTypes.PrivatePersonalDetails; [ONYXKEYS.PERSONAL_DETAILS_METADATA]: Record; [ONYXKEYS.TASK]: OnyxTypes.Task; - [ONYXKEYS.WORKSPACE_RATE_AND_UNIT]: OnyxTypes.WorkspaceRateAndUnit; [ONYXKEYS.CURRENCY_LIST]: OnyxTypes.CurrencyList; [ONYXKEYS.UPDATE_AVAILABLE]: boolean; [ONYXKEYS.SCREEN_SHARE_REQUEST]: OnyxTypes.ScreenShareRequest; diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 73d6e1a74638..48258543254b 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -362,10 +362,6 @@ const SCREENS = { }, INITIAL: 'Workspace_Initial', PROFILE: 'Workspace_Profile', - REIMBURSE: 'Workspace_Reimburse', - RATE_AND_UNIT: 'Workspace_RateAndUnit', - RATE_AND_UNIT_RATE: 'Workspace_RateAndUnit_Rate', - RATE_AND_UNIT_UNIT: 'Workspace_RateAndUnit_Unit', COMPANY_CARDS: 'Workspace_CompanyCards', COMPANY_CARDS_ASSIGN_CARD: 'Workspace_CompanyCards_AssignCard', COMPANY_CARDS_SELECT_FEED: 'Workspace_CompanyCards_Select_Feed', diff --git a/src/components/UnorderedList.tsx b/src/components/UnorderedList.tsx deleted file mode 100644 index a2b836bd4d80..000000000000 --- a/src/components/UnorderedList.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react'; -import {View} from 'react-native'; -import useThemeStyles from '@hooks/useThemeStyles'; -import Text from './Text'; - -type UnorderedListProps = { - /** An array of strings to display as an unordered list */ - items?: string[]; -}; - -function UnorderedList({items = []}: UnorderedListProps) { - const styles = useThemeStyles(); - - return items.map((itemText) => ( - - {'\u2022'} - {itemText} - - )); -} - -UnorderedList.displayName = 'UnorderedList'; -export default UnorderedList; diff --git a/src/languages/en.ts b/src/languages/en.ts index 7a745bbd00c0..d08a585b9299 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -271,6 +271,8 @@ export default { invalidTimeRange: 'Please enter a time using the 12-hour clock format (e.g., 2:30 PM).', pleaseCompleteForm: 'Please complete the form above to continue.', pleaseSelectOne: 'Please select an option above.', + invalidRateError: 'Please enter a valid rate.', + lowRateError: 'Rate must be greater than 0.', }, comma: 'comma', semicolon: 'semicolon', @@ -3183,18 +3185,6 @@ export default { membersListTitle: 'Directory of all workspace members.', }, card: { - header: 'Unlock free Expensify Cards', - headerWithEcard: 'Cards are ready!', - noVBACopy: 'Connect a bank account to issue Expensify Cards to your workspace members and access exclusive benefits like:', - VBANoECardCopy: 'Add a work email to issue unlimited Expensify Cards to your workspace members and enjoy exclusive benefits like:', - VBAWithECardCopy: 'Access these incredible benefits and more:', - benefit1: 'Cash back on every US purchase', - benefit2: 'Unlimited virtual and physical cards', - benefit3: 'No personal liability', - benefit4: 'Customizable limits and spend controls', - addWorkEmail: 'Add work email address', - checkingDomain: "Hang tight! We're still working on enabling your Expensify Cards. Check back here in a few minutes.", - issueAndManageCards: 'Issue and manage your Expensify Cards', getStartedIssuing: 'Get started by issuing your first virtual or physical card.', issueCard: 'Issue card', issueNewCard: { @@ -3230,25 +3220,6 @@ export default { deactivateConfirmation: 'Deactivating this card will decline all future transactions and can’t be undone.', }, }, - reimburse: { - captureReceipts: 'Capture receipts', - fastReimbursementsHappyMembers: 'Fast reimbursements = happy members!', - viewAllReceipts: 'View all receipts', - reimburseReceipts: 'Reimburse receipts', - trackDistance: 'Track distance', - trackDistanceCopy: 'Set the per mile/km rate and choose a default unit to track.', - trackDistanceRate: 'Rate', - trackDistanceUnit: 'Unit', - trackDistanceChooseUnit: 'Choose a default unit to track.', - unlockNextDayReimbursements: 'Unlock next-day reimbursements', - captureNoVBACopyBeforeEmail: 'Ask your workspace members to forward receipts to ', - captureNoVBACopyAfterEmail: ' and download the Expensify app to track expenses on the go.', - unlockNoVBACopy: 'Connect a bank account to reimburse your workspace members quickly and easily.', - fastReimbursementsVBACopy: "You're all set to reimburse receipts from your bank account!", - updateCustomUnitError: "Your changes couldn't be saved because the workspace was modified while you were offline. Please try again.", - invalidRateError: 'Please enter a valid rate.', - lowRateError: 'Rate must be greater than 0.', - }, accounting: { settings: 'settings', title: 'Connections', @@ -3466,16 +3437,6 @@ export default { notReadyHeading: 'Not ready to export', notReadyDescription: 'Draft or pending expense reports cannot be exported to the accounting system. Please approve or pay these expenses before exporting them.', }, - bills: { - manageYourBills: 'Manage your bills', - askYourVendorsBeforeEmail: 'Ask your vendors to forward their invoices to ', - askYourVendorsAfterEmail: " and we'll scan them for you to pay.", - viewAllBills: 'View all bills', - unlockOnlineBillPayment: 'Unlock online bill payment', - unlockNoVBACopy: 'Connect your bank account to pay bills online for free!', - hassleFreeBills: 'Hassle-free bills!', - VBACopy: "You're all set to make payments from your bank account!", - }, invoices: { invoiceClientsAndCustomers: 'Invoice clients and customers', invoiceFirstSectionCopy: 'Send beautiful, professional invoices directly to your clients and customers right from the Expensify app.', @@ -3500,13 +3461,6 @@ export default { payingAsBusiness: 'Paying as a business', }, }, - travel: { - unlockConciergeBookingTravel: 'Unlock Concierge travel booking', - noVBACopy: 'Connect your bank account to let workspace members book their flights, hotels, and cars by starting a chat with Concierge.', - packYourBags: 'Pack your bags!', - VBACopy: 'Members with the Expensify card can chat with Concierge to book travel!', - bookTravelWithConcierge: 'Book travel with Concierge', - }, invite: { member: 'Invite member', members: 'Invite members', diff --git a/src/languages/es.ts b/src/languages/es.ts index ecdd1f5f4c04..925873cfe7ae 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -261,6 +261,8 @@ export default { invalidTimeRange: 'Por favor, introduce una hora entre 1 y 12 (por ejemplo, 2:30 PM).', pleaseCompleteForm: 'Por favor complete el formulario de arriba para continuar.', pleaseSelectOne: 'Seleccione una de las opciones.', + invalidRateError: 'Por favor, introduce una tarifa válida.', + lowRateError: 'La tarifa debe ser mayor que 0.', }, comma: 'la coma', semicolon: 'el punto y coma', @@ -3444,20 +3446,7 @@ export default { }, }, card: { - header: 'Desbloquea Tarjetas Expensify gratis', - headerWithEcard: '¡Tus tarjetas están listas!', - noVBACopy: 'Conecta una cuenta bancaria para emitir Tarjetas Expensify a los miembros de tu espacio de trabajo y acceder a estos increíbles beneficios y más:', - VBANoECardCopy: - 'Añade tu correo electrónico de trabajo para emitir Tarjetas Expensify ilimitadas a los miembros de tu espacio de trabajo y acceder a todas estas increíbles ventajas:', - VBAWithECardCopy: 'Acceda a estos increíbles beneficios y más:', - benefit1: 'Devolución de dinero en cada compra en Estados Unidos', - benefit2: 'Tarjetas virtuales y físicas ilimitadas', - benefit3: 'Sin responsabilidad personal', - benefit4: 'Límites personalizables', - addWorkEmail: 'Añadir correo electrónico de trabajo', - checkingDomain: '¡Un momento! Estamos todavía trabajando para habilitar tu Tarjeta Expensify. Vuelve aquí en unos minutos.', issueCard: 'Emitir tarjeta', - issueAndManageCards: 'Emitir y gestionar Tarjetas Expensify', getStartedIssuing: 'Empieza emitiendo tu primera tarjeta virtual o física.', issueNewCard: { whoNeedsCard: '¿Quién necesita una tarjeta?', @@ -3492,40 +3481,12 @@ export default { deactivateConfirmation: 'Al desactivar esta tarjeta, se rechazarán todas las transacciones futuras y no se podrá deshacer.', }, }, - reimburse: { - captureReceipts: 'Captura recibos', - fastReimbursementsHappyMembers: '¡Reembolsos rápidos = miembros felices!', - viewAllReceipts: 'Ver todos los recibos', - reimburseReceipts: 'Reembolsar recibos', - trackDistance: 'Medir distancia', - trackDistanceCopy: 'Configura la tarifa y unidad usadas para medir distancias.', - trackDistanceRate: 'Tarifa', - trackDistanceUnit: 'Unidad', - trackDistanceChooseUnit: 'Elige una unidad predeterminada de medida.', - unlockNextDayReimbursements: 'Desbloquea reembolsos diarios', - captureNoVBACopyBeforeEmail: 'Pide a los miembros de tu espacio de trabajo que envíen recibos a ', - captureNoVBACopyAfterEmail: ' y descarga la app de Expensify para controlar tus gastos en efectivo sobre la marcha.', - unlockNoVBACopy: 'Conecta una cuenta bancaria para reembolsar online a los miembros de tu espacio de trabajo.', - fastReimbursementsVBACopy: '¡Todo listo para reembolsar recibos desde tu cuenta bancaria!', - updateCustomUnitError: 'Los cambios no han podido ser guardados. El espacio de trabajo ha sido modificado mientras estabas desconectado. Por favor, inténtalo de nuevo.', - invalidRateError: 'Por favor, introduce una tarifa válida.', - lowRateError: 'La tarifa debe ser mayor que 0.', - }, + export: { notReadyHeading: 'No está listo para exportar', notReadyDescription: 'Los borradores o informes de gastos pendientes no se pueden exportar al sistema contabilidad. Por favor, apruebe o pague estos gastos antes de exportarlos.', }, - bills: { - manageYourBills: 'Gestiona tus facturas', - askYourVendorsBeforeEmail: 'Pide a tus proveedores que envíen sus facturas a ', - askYourVendorsAfterEmail: ' y las escanearemos para que las pagues.', - viewAllBills: 'Ver facturas recibidas', - unlockOnlineBillPayment: 'Desbloquea el pago de facturas online', - unlockNoVBACopy: '¡Conecta tu cuenta bancaria para pagar tus facturas online de manera gratuita!', - hassleFreeBills: '¡Facturas sin complicaciones!', - VBACopy: '¡Todo listo para realizar pagos desde tu cuenta bancaria!', - }, invoices: { invoiceClientsAndCustomers: 'Emite facturas a tus clientes', invoiceFirstSectionCopy: 'Envía facturas detalladas y profesionales directamente a tus clientes desde la app de Expensify.', @@ -3550,13 +3511,6 @@ export default { payingAsBusiness: 'Pagar como una empresa', }, }, - travel: { - unlockConciergeBookingTravel: 'Desbloquea la reserva de viajes con Concierge', - noVBACopy: 'Conecta tu cuenta bancaria para permitir a los miembros de tu espacio de trabajo reservar sus vuelos, hoteles y coches empezando una conversación con Concierge.', - packYourBags: '¡Haz las maletas!', - VBACopy: '¡Miembros con la tarjeta Expensify pueden hablar con Concierge para reservar viajes!', - bookTravelWithConcierge: 'Reserva viajes con Concierge', - }, invite: { member: 'Invitar miembros', members: 'Invitar miembros', diff --git a/src/libs/API/parameters/OpenWorkspaceReimburseViewParams.ts b/src/libs/API/parameters/OpenWorkspaceReimburseViewParams.ts deleted file mode 100644 index 317241c8842f..000000000000 --- a/src/libs/API/parameters/OpenWorkspaceReimburseViewParams.ts +++ /dev/null @@ -1,5 +0,0 @@ -type OpenWorkspaceReimburseViewParams = { - policyID: string; -}; - -export default OpenWorkspaceReimburseViewParams; diff --git a/src/libs/API/parameters/UpdateWorkspaceCustomUnitAndRateParams.ts b/src/libs/API/parameters/UpdateWorkspaceCustomUnitAndRateParams.ts deleted file mode 100644 index 010bcaa1e60a..000000000000 --- a/src/libs/API/parameters/UpdateWorkspaceCustomUnitAndRateParams.ts +++ /dev/null @@ -1,8 +0,0 @@ -type UpdateWorkspaceCustomUnitAndRateParams = { - policyID: string; - lastModified?: string; - customUnit: string; - customUnitRate: string; -}; - -export default UpdateWorkspaceCustomUnitAndRateParams; diff --git a/src/libs/API/parameters/index.ts b/src/libs/API/parameters/index.ts index b58b35e752a1..e025de63b4da 100644 --- a/src/libs/API/parameters/index.ts +++ b/src/libs/API/parameters/index.ts @@ -133,7 +133,6 @@ export type {default as OpenWorkspaceMembersPageParams} from './OpenWorkspaceMem export type {default as OpenPolicyCategoriesPageParams} from './OpenPolicyCategoriesPageParams'; export type {default as OpenPolicyTagsPageParams} from './OpenPolicyTagsPageParams'; export type {default as OpenDraftWorkspaceRequestParams} from './OpenDraftWorkspaceRequestParams'; -export type {default as UpdateWorkspaceCustomUnitAndRateParams} from './UpdateWorkspaceCustomUnitAndRateParams'; export type {default as CreateWorkspaceFromIOUPaymentParams} from './CreateWorkspaceFromIOUPaymentParams'; export type {default as CreateTaskParams} from './CreateTaskParams'; export type {default as CancelTaskParams} from './CancelTaskParams'; diff --git a/src/libs/API/types.ts b/src/libs/API/types.ts index bc2bc5f342af..b3c07d39afb6 100644 --- a/src/libs/API/types.ts +++ b/src/libs/API/types.ts @@ -125,7 +125,6 @@ const WRITE_COMMANDS = { UPDATE_WORKSPACE_AVATAR: 'UpdateWorkspaceAvatar', DELETE_WORKSPACE_AVATAR: 'DeleteWorkspaceAvatar', UPDATE_WORKSPACE_GENERAL_SETTINGS: 'UpdateWorkspaceGeneralSettings', - UPDATE_WORKSPACE_CUSTOM_UNIT_AND_RATE: 'UpdateWorkspaceCustomUnitAndRate', UPDATE_WORKSPACE_DESCRIPTION: 'UpdateWorkspaceDescription', UPDATE_WORKSPACE_MEMBERS_ROLE: 'UpdateWorkspaceMembersRole', CREATE_WORKSPACE: 'CreateWorkspace', @@ -480,7 +479,6 @@ type WriteCommandParameters = { [WRITE_COMMANDS.UPDATE_WORKSPACE_GENERAL_SETTINGS]: Parameters.UpdateWorkspaceGeneralSettingsParams; [WRITE_COMMANDS.UPDATE_WORKSPACE_DESCRIPTION]: Parameters.UpdateWorkspaceDescriptionParams; [WRITE_COMMANDS.UPDATE_WORKSPACE_MEMBERS_ROLE]: Parameters.UpdateWorkspaceMembersRoleParams; - [WRITE_COMMANDS.UPDATE_WORKSPACE_CUSTOM_UNIT_AND_RATE]: Parameters.UpdateWorkspaceCustomUnitAndRateParams; [WRITE_COMMANDS.CREATE_WORKSPACE]: Parameters.CreateWorkspaceParams; [WRITE_COMMANDS.CREATE_WORKSPACE_FROM_IOU_PAYMENT]: Parameters.CreateWorkspaceFromIOUPaymentParams; [WRITE_COMMANDS.SET_WORKSPACE_CATEGORIES_ENABLED]: Parameters.SetWorkspaceCategoriesEnabledParams; @@ -762,7 +760,6 @@ const READ_COMMANDS = { BEGIN_SIGNIN: 'BeginSignIn', SIGN_IN_WITH_SHORT_LIVED_AUTH_TOKEN: 'SignInWithShortLivedAuthToken', SIGN_IN_WITH_SUPPORT_AUTH_TOKEN: 'SignInWithSupportAuthToken', - OPEN_WORKSPACE_REIMBURSE_VIEW: 'OpenWorkspaceReimburseView', OPEN_WORKSPACE: 'OpenWorkspace', OPEN_WORKSPACE_MEMBERS_PAGE: 'OpenWorkspaceMembersPage', OPEN_POLICY_CATEGORIES_PAGE: 'OpenPolicyCategoriesPage', @@ -820,7 +817,6 @@ type ReadCommandParameters = { [READ_COMMANDS.BEGIN_SIGNIN]: Parameters.BeginSignInParams; [READ_COMMANDS.SIGN_IN_WITH_SHORT_LIVED_AUTH_TOKEN]: Parameters.SignInWithShortLivedAuthTokenParams; [READ_COMMANDS.SIGN_IN_WITH_SUPPORT_AUTH_TOKEN]: Parameters.SignInWithSupportAuthTokenParams; - [READ_COMMANDS.OPEN_WORKSPACE_REIMBURSE_VIEW]: Parameters.OpenWorkspaceReimburseViewParams; [READ_COMMANDS.OPEN_WORKSPACE]: Parameters.OpenWorkspaceParams; [READ_COMMANDS.OPEN_WORKSPACE_MEMBERS_PAGE]: Parameters.OpenWorkspaceMembersPageParams; [READ_COMMANDS.OPEN_POLICY_CATEGORIES_PAGE]: Parameters.OpenPolicyCategoriesPageParams; diff --git a/src/libs/PolicyDistanceRatesUtils.ts b/src/libs/PolicyDistanceRatesUtils.ts index 7e2c0bb83320..0c5493f2f97b 100644 --- a/src/libs/PolicyDistanceRatesUtils.ts +++ b/src/libs/PolicyDistanceRatesUtils.ts @@ -8,7 +8,7 @@ import * as Localize from './Localize'; import * as MoneyRequestUtils from './MoneyRequestUtils'; import * as NumberUtils from './NumberUtils'; -type RateValueForm = typeof ONYXKEYS.FORMS.WORKSPACE_RATE_AND_UNIT_FORM | typeof ONYXKEYS.FORMS.POLICY_CREATE_DISTANCE_RATE_FORM | typeof ONYXKEYS.FORMS.POLICY_DISTANCE_RATE_EDIT_FORM; +type RateValueForm = typeof ONYXKEYS.FORMS.POLICY_CREATE_DISTANCE_RATE_FORM | typeof ONYXKEYS.FORMS.POLICY_DISTANCE_RATE_EDIT_FORM; type TaxReclaimableForm = typeof ONYXKEYS.FORMS.POLICY_DISTANCE_RATE_TAX_RECLAIMABLE_ON_EDIT_FORM; @@ -20,9 +20,9 @@ function validateRateValue(values: FormOnyxValues, currency: stri // Allow one more decimal place for accuracy const rateValueRegex = RegExp(String.raw`^-?\d{0,8}([${getPermittedDecimalSeparator(decimalSeparator)}]\d{0,${CurrencyUtils.getCurrencyDecimals(currency) + 1}})?$`, 'i'); if (!rateValueRegex.test(parsedRate) || parsedRate === '') { - errors.rate = Localize.translateLocal('workspace.reimburse.invalidRateError'); + errors.rate = Localize.translateLocal('common.error.invalidRateError'); } else if (NumberUtils.parseFloatAnyLocale(parsedRate) <= 0) { - errors.rate = Localize.translateLocal('workspace.reimburse.lowRateError'); + errors.rate = Localize.translateLocal('common.error.lowRateError'); } return errors; } diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index 018089ed62f0..59ce72288978 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -31,7 +31,6 @@ import type { OpenPolicyWorkflowsPageParams, OpenWorkspaceInvitePageParams, OpenWorkspaceParams, - OpenWorkspaceReimburseViewParams, RequestExpensifyCardLimitIncreaseParams, SetPolicyBillableModeParams, SetWorkspaceApprovalModeParams, @@ -40,7 +39,6 @@ import type { SetWorkspacePayerParams, SetWorkspaceReimbursementParams, UpdateWorkspaceAvatarParams, - UpdateWorkspaceCustomUnitAndRateParams, UpdateWorkspaceDescriptionParams, UpdateWorkspaceGeneralSettingsParams, UpgradeToCorporateParams, @@ -1342,87 +1340,6 @@ function updateAddress(policyID: string, newAddress: CompanyAddress) { }); } -function updateWorkspaceCustomUnitAndRate(policyID: string, currentCustomUnit: CustomUnit, newCustomUnit: NewCustomUnit, lastModified?: string) { - if (!currentCustomUnit.customUnitID || !newCustomUnit?.customUnitID || !newCustomUnit.rates?.customUnitRateID) { - return; - } - - const optimisticData: OnyxUpdate[] = [ - { - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, - value: { - customUnits: { - [newCustomUnit.customUnitID]: { - ...newCustomUnit, - rates: { - [newCustomUnit.rates.customUnitRateID]: { - ...newCustomUnit.rates, - errors: null, - pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE, - }, - }, - pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE, - }, - }, - }, - }, - ]; - - const successData: OnyxUpdate[] = [ - { - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, - value: { - customUnits: { - [newCustomUnit.customUnitID]: { - pendingAction: null, - errors: null, - rates: { - [newCustomUnit.rates.customUnitRateID]: { - pendingAction: null, - }, - }, - }, - }, - }, - }, - ]; - - const failureData: OnyxUpdate[] = [ - { - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, - value: { - customUnits: { - [currentCustomUnit.customUnitID]: { - customUnitID: currentCustomUnit.customUnitID, - rates: { - [newCustomUnit.rates.customUnitRateID]: { - ...currentCustomUnit.rates, - errors: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('workspace.reimburse.updateCustomUnitError'), - }, - }, - }, - }, - }, - }, - ]; - - const newCustomUnitParam = lodashClone(newCustomUnit); - const {pendingAction, errors, ...newRates} = newCustomUnitParam.rates ?? {}; - newCustomUnitParam.rates = newRates; - - const params: UpdateWorkspaceCustomUnitAndRateParams = { - policyID, - lastModified, - customUnit: JSON.stringify(newCustomUnitParam), - customUnitRate: JSON.stringify(newCustomUnitParam.rates), - }; - - API.write(WRITE_COMMANDS.UPDATE_WORKSPACE_CUSTOM_UNIT_AND_RATE, params, {optimisticData, successData, failureData}); -} - /** * Removes an error after trying to delete a workspace */ @@ -1980,37 +1897,6 @@ function createDraftWorkspace(policyOwnerEmail = '', makeMeAdmin = false, policy return params; } -function openWorkspaceReimburseView(policyID: string) { - if (!policyID) { - Log.warn('openWorkspaceReimburseView invalid params', {policyID}); - return; - } - - const successData: OnyxUpdate[] = [ - { - onyxMethod: Onyx.METHOD.MERGE, - key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, - value: { - isLoading: false, - }, - }, - ]; - - const failureData: OnyxUpdate[] = [ - { - onyxMethod: Onyx.METHOD.MERGE, - key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, - value: { - isLoading: false, - }, - }, - ]; - - const params: OpenWorkspaceReimburseViewParams = {policyID}; - - API.read(READ_COMMANDS.OPEN_WORKSPACE_REIMBURSE_VIEW, params, {successData, failureData}); -} - function openPolicyWorkflowsPage(policyID: string) { if (!policyID) { Log.warn('openPolicyWorkflowsPage invalid params', {policyID}); @@ -2052,22 +1938,6 @@ function openPolicyWorkflowsPage(policyID: string) { API.read(READ_COMMANDS.OPEN_POLICY_WORKFLOWS_PAGE, params, onyxData); } -function setPolicyIDForReimburseView(policyID: string) { - Onyx.merge(ONYXKEYS.WORKSPACE_RATE_AND_UNIT, {policyID, rate: null, unit: null}); -} - -function clearOnyxDataForReimburseView() { - Onyx.merge(ONYXKEYS.WORKSPACE_RATE_AND_UNIT, null); -} - -function setRateForReimburseView(rate: string) { - Onyx.merge(ONYXKEYS.WORKSPACE_RATE_AND_UNIT, {rate}); -} - -function setUnitForReimburseView(unit: Unit) { - Onyx.merge(ONYXKEYS.WORKSPACE_RATE_AND_UNIT, {unit}); -} - /** * Returns the accountIDs of the members of the policy whose data is passed in the parameters */ @@ -3959,15 +3829,9 @@ export { hideWorkspaceAlertMessage, deleteWorkspace, updateAddress, - updateWorkspaceCustomUnitAndRate, updateLastAccessedWorkspace, clearDeleteWorkspaceError, - openWorkspaceReimburseView, - setPolicyIDForReimburseView, - clearOnyxDataForReimburseView, setWorkspaceDefaultSpendCategory, - setRateForReimburseView, - setUnitForReimburseView, generateDefaultWorkspaceName, updateGeneralSettings, deleteWorkspaceAvatar, diff --git a/src/pages/workspace/WorkspaceInitialPage.tsx b/src/pages/workspace/WorkspaceInitialPage.tsx index a3a2eaefe289..479da22716fc 100644 --- a/src/pages/workspace/WorkspaceInitialPage.tsx +++ b/src/pages/workspace/WorkspaceInitialPage.tsx @@ -51,7 +51,6 @@ type WorkspaceMenuItem = { routeName?: | typeof SCREENS.WORKSPACE.ACCOUNTING.ROOT | typeof SCREENS.WORKSPACE.INITIAL - | typeof SCREENS.WORKSPACE.REIMBURSE | typeof SCREENS.WORKSPACE.INVOICES | typeof SCREENS.WORKSPACE.DISTANCE_RATES | typeof SCREENS.WORKSPACE.WORKFLOWS diff --git a/src/types/form/WorkspaceRateAndUnitForm.ts b/src/types/form/WorkspaceRateAndUnitForm.ts deleted file mode 100644 index 566f10df9d9d..000000000000 --- a/src/types/form/WorkspaceRateAndUnitForm.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type {ValueOf} from 'type-fest'; -import type Form from './Form'; - -const INPUT_IDS = { - RATE: 'rate', - UNIT: 'unit', -} as const; - -type InputID = ValueOf; - -type WorkspaceRateAndUnitForm = Form< - InputID, - { - [INPUT_IDS.RATE]: string; - [INPUT_IDS.UNIT]: string; - } ->; - -export type {WorkspaceRateAndUnitForm}; -export default INPUT_IDS; diff --git a/src/types/form/index.ts b/src/types/form/index.ts index 94b6a4ec08a4..724e877e8cfd 100644 --- a/src/types/form/index.ts +++ b/src/types/form/index.ts @@ -39,7 +39,6 @@ export type {SettingsStatusSetClearAfterForm} from './SettingsStatusSetClearAfte export type {SettingsStatusSetForm} from './SettingsStatusSetForm'; export type {WaypointForm} from './WaypointForm'; export type {WorkspaceInviteMessageForm} from './WorkspaceInviteMessageForm'; -export type {WorkspaceRateAndUnitForm} from './WorkspaceRateAndUnitForm'; export type {WorkspaceCategoryForm} from './WorkspaceCategoryForm'; export type {WorkspaceSettingsForm} from './WorkspaceSettingsForm'; export type {ReportPhysicalCardForm} from './ReportPhysicalCardForm'; diff --git a/src/types/onyx/WorkspaceRateAndUnit.ts b/src/types/onyx/WorkspaceRateAndUnit.ts deleted file mode 100644 index ebef0902d972..000000000000 --- a/src/types/onyx/WorkspaceRateAndUnit.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** Units of distance */ -type Unit = 'mi' | 'km'; - -/** Model of workspace distance rate */ -type WorkspaceRateAndUnit = { - /** policyID of the Workspace */ - policyID: string; - - /** Unit of the Workspace */ - unit?: Unit; - - /** Distance rate of the Workspace */ - rate?: string; -}; - -export default WorkspaceRateAndUnit; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 0073e47bb65c..87f6e7c8448e 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -102,7 +102,6 @@ import type WalletOnfido from './WalletOnfido'; import type WalletStatement from './WalletStatement'; import type WalletTerms from './WalletTerms'; import type WalletTransfer from './WalletTransfer'; -import type WorkspaceRateAndUnit from './WorkspaceRateAndUnit'; import type WorkspaceTooltip from './WorkspaceTooltip'; export type { @@ -203,7 +202,6 @@ export type { WalletStatement, WalletTerms, WalletTransfer, - WorkspaceRateAndUnit, ReportUserIsTyping, PolicyReportField, RecentlyUsedReportFields, From 041db7634645a1731391e8cedcd359b6195165c1 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Fri, 6 Sep 2024 21:33:44 +0700 Subject: [PATCH 04/13] remove free workspace --- src/libs/API/parameters/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/API/parameters/index.ts b/src/libs/API/parameters/index.ts index e025de63b4da..1485d7e72cab 100644 --- a/src/libs/API/parameters/index.ts +++ b/src/libs/API/parameters/index.ts @@ -127,7 +127,6 @@ export type {default as DeleteMembersFromWorkspaceParams} from './DeleteMembersF export type {default as OpenWorkspaceParams} from './OpenWorkspaceParams'; export type {default as OpenWorkspaceViewParams} from './OpenWorkspaceViewParams'; export type {default as ConnectPolicyToSageIntacctParams} from './ConnectPolicyToSageIntacctParams'; -export type {default as OpenWorkspaceReimburseViewParams} from './OpenWorkspaceReimburseViewParams'; export type {default as OpenWorkspaceInvitePageParams} from './OpenWorkspaceInvitePageParams'; export type {default as OpenWorkspaceMembersPageParams} from './OpenWorkspaceMembersPageParams'; export type {default as OpenPolicyCategoriesPageParams} from './OpenPolicyCategoriesPageParams'; From bdd84b94fc9e8d523f4ecc00918f63b3f9bc977e Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Fri, 6 Sep 2024 21:42:53 +0700 Subject: [PATCH 05/13] remove free ws --- src/libs/ReportUtils.ts | 6 +----- src/libs/actions/IOU.ts | 24 ++++++++++------------- src/pages/WorkspaceSwitcherPage/index.tsx | 2 +- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 1d8d974b19a9..ad89dedff0b1 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1300,11 +1300,7 @@ function findLastAccessedReport(ignoreDomainRooms: boolean, openOnAdminRoom = fa // We allow public announce rooms, admins, and announce rooms through since we bypass the default rooms beta for them. // Check where ReportUtils.findLastAccessedReport is called in MainDrawerNavigator.js for more context. // Domain rooms are now the only type of default room that are on the defaultRooms beta. - if ( - ignoreDomainRooms && - isDomainRoom(report) && - !hasExpensifyGuidesEmails(Object.keys(report?.participants ?? {}).map(Number)) - ) { + if (ignoreDomainRooms && isDomainRoom(report) && !hasExpensifyGuidesEmails(Object.keys(report?.participants ?? {}).map(Number))) { return false; } diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 1203f8df7c12..222b8c030c7e 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -7315,13 +7315,11 @@ function cancelPayment(expenseReport: OnyxEntry, chatReport: O }, ]; - if (!isFree) { - optimisticData.push({ - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`, - value: optimisticNextStep, - }); - } + optimisticData.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`, + value: optimisticNextStep, + }); const successData: OnyxUpdate[] = [ { @@ -7364,13 +7362,11 @@ function cancelPayment(expenseReport: OnyxEntry, chatReport: O }, }); } - if (!isFree) { - failureData.push({ - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`, - value: NextStepUtils.buildNextStep(expenseReport, CONST.REPORT.STATUS_NUM.REIMBURSED), - }); - } + failureData.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`, + value: NextStepUtils.buildNextStep(expenseReport, CONST.REPORT.STATUS_NUM.REIMBURSED), + }); API.write( WRITE_COMMANDS.CANCEL_PAYMENT, diff --git a/src/pages/WorkspaceSwitcherPage/index.tsx b/src/pages/WorkspaceSwitcherPage/index.tsx index 53d40340fa3d..221889b80b49 100644 --- a/src/pages/WorkspaceSwitcherPage/index.tsx +++ b/src/pages/WorkspaceSwitcherPage/index.tsx @@ -20,10 +20,10 @@ import {sortWorkspacesBySelected} from '@libs/PolicyUtils'; import * as ReportUtils from '@libs/ReportUtils'; import {getWorkspacesBrickRoads, getWorkspacesUnreadStatuses} from '@libs/WorkspacesSettingsUtils'; import type {BrickRoad} from '@libs/WorkspacesSettingsUtils'; -import WorkspaceCardCreateAWorkspace from './WorkspaceCardCreateAWorkspace'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; +import WorkspaceCardCreateAWorkspace from './WorkspaceCardCreateAWorkspace'; import WorkspacesSectionHeader from './WorkspacesSectionHeader'; type WorkspaceListItem = { From 9a42c9b9397531a27e0d93fb16bda7cf10667145 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Fri, 6 Sep 2024 21:58:18 +0700 Subject: [PATCH 06/13] lint error --- src/libs/actions/Policy/Policy.ts | 3 +-- src/pages/workspace/WorkspaceInitialPage.tsx | 9 +-------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index 59ce72288978..cf03b1b106e5 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -1,6 +1,5 @@ import {PUBLIC_DOMAINS, Str} from 'expensify-common'; import {escapeRegExp} from 'lodash'; -import lodashClone from 'lodash/clone'; import type {NullishDeep, OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; @@ -78,7 +77,7 @@ import type { Transaction, } from '@src/types/onyx'; import type {Errors} from '@src/types/onyx/OnyxCommon'; -import type {Attributes, CompanyAddress, CustomUnit, NetSuiteCustomList, NetSuiteCustomSegment, Rate, TaxRate, Unit} from '@src/types/onyx/Policy'; +import type {Attributes, CompanyAddress, CustomUnit, NetSuiteCustomList, NetSuiteCustomSegment, Rate, TaxRate} from '@src/types/onyx/Policy'; import type {OnyxData} from '@src/types/onyx/Request'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import {buildOptimisticPolicyCategories} from './Category'; diff --git a/src/pages/workspace/WorkspaceInitialPage.tsx b/src/pages/workspace/WorkspaceInitialPage.tsx index 479da22716fc..794a51e32712 100644 --- a/src/pages/workspace/WorkspaceInitialPage.tsx +++ b/src/pages/workspace/WorkspaceInitialPage.tsx @@ -67,9 +67,6 @@ type WorkspaceMenuItem = { }; type WorkspaceInitialPageOnyxProps = { - /** Bank account attached to free plan */ - reimbursementAccount: OnyxEntry; - /** Collection of categories attached to a policy */ policyCategories: OnyxEntry; }; @@ -87,7 +84,7 @@ function dismissError(policyID: string, pendingAction: PendingAction | undefined } } -function WorkspaceInitialPage({policyDraft, policy: policyProp, reimbursementAccount, policyCategories, route}: WorkspaceInitialPageProps) { +function WorkspaceInitialPage({policyDraft, policy: policyProp, policyCategories, route}: WorkspaceInitialPageProps) { const styles = useThemeStyles(); const policy = policyDraft?.id ? policyDraft : policyProp; const [isCurrencyModalOpen, setIsCurrencyModalOpen] = useState(false); @@ -426,10 +423,6 @@ WorkspaceInitialPage.displayName = 'WorkspaceInitialPage'; export default withPolicyAndFullscreenLoading( withOnyx({ - // @ts-expect-error: ONYXKEYS.REIMBURSEMENT_ACCOUNT is conflicting with ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM - reimbursementAccount: { - key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, - }, policyCategories: { key: ({route}) => `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${route.params?.policyID ?? '-1'}`, }, From 23d55550f947f179e09ce895a89ee9719e3a3541 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Fri, 13 Sep 2024 21:38:47 +0700 Subject: [PATCH 07/13] remove by mistake --- src/libs/actions/Policy/Policy.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index 6db9122a5f08..2554404d849d 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -1,5 +1,6 @@ import {PUBLIC_DOMAINS, Str} from 'expensify-common'; import {escapeRegExp} from 'lodash'; +import lodashUnion from 'lodash/union'; import type {NullishDeep, OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; From afdffbb5a692ef5dd65def996b82c1f58850a9f0 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Wed, 18 Sep 2024 21:13:10 +0700 Subject: [PATCH 08/13] Fix eslint --- src/libs/actions/Policy/Policy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index 9430253a2dfb..45529b0676b0 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -88,7 +88,7 @@ import type { Transaction, } from '@src/types/onyx'; import type {Errors} from '@src/types/onyx/OnyxCommon'; -import type {Attributes, CompanyAddress, CustomUnit, NetSuiteCustomList, NetSuiteCustomSegment, Rate, TaxRate, Unit} from '@src/types/onyx/Policy'; +import type {Attributes, CompanyAddress, CustomUnit, NetSuiteCustomList, NetSuiteCustomSegment, Rate, TaxRate} from '@src/types/onyx/Policy'; import type {ReportActions} from '@src/types/onyx/ReportAction'; import type {OnyxData} from '@src/types/onyx/Request'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; From 38293b7c86a609ee45ba199ea67f3ee7d30b2edb Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Thu, 19 Sep 2024 08:10:49 +0700 Subject: [PATCH 09/13] fix test file --- src/CONST.ts | 1 - tests/unit/SidebarFilterTest.ts | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index dee71c4720b7..f8703ab29aec 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -2153,7 +2153,6 @@ const CONST = { POLICY: { TYPE: { - FREE: 'free', PERSONAL: 'personal', // Often referred to as "control" workspaces diff --git a/tests/unit/SidebarFilterTest.ts b/tests/unit/SidebarFilterTest.ts index 5505ffdd0971..e9f8f296cfea 100644 --- a/tests/unit/SidebarFilterTest.ts +++ b/tests/unit/SidebarFilterTest.ts @@ -322,7 +322,7 @@ xdescribe('Sidebar', () => { const policy = { name: 'Policy One', policyID: '1', - type: CONST.POLICY.TYPE.FREE, + type: CONST.POLICY.TYPE.PERSONAL, }; // Given the user is in all betas @@ -668,7 +668,7 @@ xdescribe('Sidebar', () => { const policy = { name: 'Policy One', policyID: '1', - type: CONST.POLICY.TYPE.FREE, + type: CONST.POLICY.TYPE.PERSONAL, }; // Given the user is in all betas From cf06284fe5ea4b8f57849a2fae58919d8cd5baf5 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Thu, 19 Sep 2024 08:17:28 +0700 Subject: [PATCH 10/13] fix test files --- tests/actions/IOUTest.ts | 6 +++--- tests/unit/OptionsListUtilsTest.ts | 2 +- tests/unit/ReportUtilsTest.ts | 2 +- tests/unit/SidebarFilterTest.ts | 4 ++-- tests/utils/LHNTestUtils.tsx | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/actions/IOUTest.ts b/tests/actions/IOUTest.ts index 662eae8d7b21..bc8604b194ad 100644 --- a/tests/actions/IOUTest.ts +++ b/tests/actions/IOUTest.ts @@ -1689,7 +1689,7 @@ describe('actions/IOU', () => { { id: '123', role: 'user', - type: 'free', + type: CONST.POLICY.TYPE.TEAM, name: '', owner: '', outputCurrency: '', @@ -1844,7 +1844,7 @@ describe('actions/IOU', () => { { id: '123', role: 'user', - type: 'free', + type: CONST.POLICY.TYPE.TEAM, name: '', owner: '', outputCurrency: '', @@ -2577,7 +2577,7 @@ describe('actions/IOU', () => { { id: '123', role: 'user', - type: 'free', + type: CONST.POLICY.TYPE.TEAM, name: '', owner: '', outputCurrency: '', diff --git a/tests/unit/OptionsListUtilsTest.ts b/tests/unit/OptionsListUtilsTest.ts index d27a53da69ce..f356d8ba294f 100644 --- a/tests/unit/OptionsListUtilsTest.ts +++ b/tests/unit/OptionsListUtilsTest.ts @@ -364,7 +364,7 @@ describe('OptionsListUtils', () => { id: policyID, name: 'Hero Policy', role: 'user', - type: 'free', + type: CONST.POLICY.TYPE.TEAM, owner: '', outputCurrency: '', isPolicyExpenseChatEnabled: false, diff --git a/tests/unit/ReportUtilsTest.ts b/tests/unit/ReportUtilsTest.ts index 2008cf45b746..f8d23e89ca5a 100644 --- a/tests/unit/ReportUtilsTest.ts +++ b/tests/unit/ReportUtilsTest.ts @@ -54,7 +54,7 @@ const policy: Policy = { id: '1', name: 'Vikings Policy', role: 'user', - type: 'free', + type: CONST.POLICY.TYPE.TEAM, owner: '', outputCurrency: '', isPolicyExpenseChatEnabled: false, diff --git a/tests/unit/SidebarFilterTest.ts b/tests/unit/SidebarFilterTest.ts index e9f8f296cfea..409c34f1903e 100644 --- a/tests/unit/SidebarFilterTest.ts +++ b/tests/unit/SidebarFilterTest.ts @@ -322,7 +322,7 @@ xdescribe('Sidebar', () => { const policy = { name: 'Policy One', policyID: '1', - type: CONST.POLICY.TYPE.PERSONAL, + type: CONST.POLICY.TYPE.TEAM, }; // Given the user is in all betas @@ -668,7 +668,7 @@ xdescribe('Sidebar', () => { const policy = { name: 'Policy One', policyID: '1', - type: CONST.POLICY.TYPE.PERSONAL, + type: CONST.POLICY.TYPE.TEAM, }; // Given the user is in all betas diff --git a/tests/utils/LHNTestUtils.tsx b/tests/utils/LHNTestUtils.tsx index 7197529cd43c..2065565c71e8 100644 --- a/tests/utils/LHNTestUtils.tsx +++ b/tests/utils/LHNTestUtils.tsx @@ -207,7 +207,7 @@ function getFakePolicy(id = '1', name = 'Workspace-Test-001'): Policy { name, isFromFullPolicy: false, role: 'admin', - type: 'free', + type: CONST.POLICY.TYPE.TEAM, owner: 'myuser@gmail.com', outputCurrency: 'BRL', avatarURL: '', From 657967cdd84f8e4e4bd21043735541a2c3ed3fb6 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Sat, 21 Sep 2024 00:25:03 +0700 Subject: [PATCH 11/13] lint problem --- src/libs/actions/Policy/Policy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index c3305beb1b89..2123f2a47764 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -1,5 +1,5 @@ import {PUBLIC_DOMAINS, Str} from 'expensify-common'; -import {escapeRegExp} from 'lodash'; +import escapeRegExp from 'lodash/escapeRegExp'; import lodashUnion from 'lodash/union'; import type {NullishDeep, OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; From 72df82471dda35ebf08ee2cd6377f66a80f05472 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Sat, 21 Sep 2024 00:33:26 +0700 Subject: [PATCH 12/13] update to use UseOnyx --- src/pages/workspace/WorkspaceInitialPage.tsx | 22 +++++--------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/pages/workspace/WorkspaceInitialPage.tsx b/src/pages/workspace/WorkspaceInitialPage.tsx index 37256d079e34..9dcf24587bcc 100644 --- a/src/pages/workspace/WorkspaceInitialPage.tsx +++ b/src/pages/workspace/WorkspaceInitialPage.tsx @@ -2,8 +2,7 @@ import {useFocusEffect, useNavigationState} from '@react-navigation/native'; import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import {View} from 'react-native'; -import type {OnyxEntry} from 'react-native-onyx'; -import {useOnyx, withOnyx} from 'react-native-onyx'; +import {useOnyx} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import ConfirmModal from '@components/ConfirmModal'; @@ -35,7 +34,6 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type {Route} from '@src/ROUTES'; import ROUTES from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; -import type * as OnyxTypes from '@src/types/onyx'; import type {PendingAction} from '@src/types/onyx/OnyxCommon'; import type {PolicyFeatureName} from '@src/types/onyx/Policy'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; @@ -66,12 +64,7 @@ type WorkspaceMenuItem = { | typeof SCREENS.WORKSPACE.RULES; }; -type WorkspaceInitialPageOnyxProps = { - /** Collection of categories attached to a policy */ - policyCategories: OnyxEntry; -}; - -type WorkspaceInitialPageProps = WithPolicyAndFullscreenLoadingProps & WorkspaceInitialPageOnyxProps & StackScreenProps; +type WorkspaceInitialPageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; type PolicyFeatureStates = Record; @@ -84,12 +77,13 @@ function dismissError(policyID: string, pendingAction: PendingAction | undefined } } -function WorkspaceInitialPage({policyDraft, policy: policyProp, policyCategories, route}: WorkspaceInitialPageProps) { +function WorkspaceInitialPage({policyDraft, policy: policyProp, route}: WorkspaceInitialPageProps) { const styles = useThemeStyles(); const policy = policyDraft?.id ? policyDraft : policyProp; const [isCurrencyModalOpen, setIsCurrencyModalOpen] = useState(false); const hasPolicyCreationError = !!(policy?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD && !isEmptyObject(policy.errors)); const [connectionSyncProgress] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CONNECTION_SYNC_PROGRESS}${policy?.id}`); + const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${route.params?.policyID ?? '-1'}`); const hasSyncError = PolicyUtils.hasSyncError(policy, isConnectionInProgress(connectionSyncProgress, policy)); const waitForNavigate = useWaitForNavigation(); const {singleExecution, isExecuting} = useSingleExecution(); @@ -421,10 +415,4 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, policyCategories WorkspaceInitialPage.displayName = 'WorkspaceInitialPage'; -export default withPolicyAndFullscreenLoading( - withOnyx({ - policyCategories: { - key: ({route}) => `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${route.params?.policyID ?? '-1'}`, - }, - })(WorkspaceInitialPage), -); +export default withPolicyAndFullscreenLoading(WorkspaceInitialPage); \ No newline at end of file From bbf8ed22f7c60363c198566b3e22e16eab74d909 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Sat, 21 Sep 2024 00:36:45 +0700 Subject: [PATCH 13/13] add new line --- src/pages/workspace/WorkspaceInitialPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/WorkspaceInitialPage.tsx b/src/pages/workspace/WorkspaceInitialPage.tsx index 9dcf24587bcc..841addd5f11b 100644 --- a/src/pages/workspace/WorkspaceInitialPage.tsx +++ b/src/pages/workspace/WorkspaceInitialPage.tsx @@ -415,4 +415,4 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, route}: Workspac WorkspaceInitialPage.displayName = 'WorkspaceInitialPage'; -export default withPolicyAndFullscreenLoading(WorkspaceInitialPage); \ No newline at end of file +export default withPolicyAndFullscreenLoading(WorkspaceInitialPage);