From c29e243a768ca92f97b0ea4fc469c5331b310ce7 Mon Sep 17 00:00:00 2001 From: Sibtain Ali Date: Wed, 10 Jul 2024 04:13:14 +0500 Subject: [PATCH 1/9] add upgrade screen to more features --- src/CONST.ts | 22 ++++++++++++++++--- src/ROUTES.ts | 3 ++- .../ConnectToNetSuiteButton/index.tsx | 8 +++++++ .../ConnectToSageIntacctButton/index.tsx | 11 ++++++++++ src/languages/en.ts | 20 ++++++++++++----- src/languages/es.ts | 20 ++++++++++++----- .../FULL_SCREEN_TO_RHP_MAPPING.ts | 9 +------- src/libs/Permissions.ts | 2 +- .../workspace/WorkspaceMoreFeaturesPage.tsx | 7 ++++++ src/pages/workspace/upgrade/UpgradeIntro.tsx | 12 +++++----- .../upgrade/WorkspaceUpgradePage.tsx | 4 ++-- 11 files changed, 88 insertions(+), 30 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index a872636eb427..aff5f1cd657c 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -5206,8 +5206,8 @@ const CONST = { }, EXCLUDE_FROM_LAST_VISITED_PATH: [SCREENS.NOT_FOUND, SCREENS.SAML_SIGN_IN, SCREENS.VALIDATE_LOGIN] as string[], - UPGRADE_FEATURE_INTRO_MAPPING: [ - { + UPGRADE_FEATURE_INTRO_MAPPING: { + reportFields: { id: 'reportFields', alias: 'report-fields', name: 'Report Fields', @@ -5215,7 +5215,23 @@ const CONST = { description: 'workspace.upgrade.reportFields.description', icon: 'Pencil', }, - ], + netSuite: { + id: 'netSuite', + alias: 'netsuite', + name: 'NetSuite', + title: 'workspace.upgrade.netSuite.title', + description: 'workspace.upgrade.netSuite.description', + icon: 'NetSuiteSquare', + }, + sageIntacct: { + id: 'sageIntacct', + alias: 'sage-intacct', + name: 'Sage Intacct', + title: 'workspace.upgrade.sageIntacct.title', + description: 'workspace.upgrade.sageIntacct.description', + icon: 'IntacctSquare', + }, + }, REPORT_FIELD_TYPES: { TEXT: 'text', DATE: 'date', diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 3f93109463c9..f4b367648930 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -681,7 +681,8 @@ const ROUTES = { }, WORKSPACE_UPGRADE: { route: 'settings/workspaces/:policyID/upgrade/:featureName', - getRoute: (policyID: string, featureName: string) => `settings/workspaces/${policyID}/upgrade/${encodeURIComponent(featureName)}` as const, + getRoute: (policyID: string, featureName: string, backTo?: string) => + getUrlWithBackToParam(`settings/workspaces/${policyID}/upgrade/${encodeURIComponent(featureName)}` as const, backTo), }, WORKSPACE_CATEGORIES_SETTINGS: { route: 'settings/workspaces/:policyID/categories/settings', diff --git a/src/components/ConnectToNetSuiteButton/index.tsx b/src/components/ConnectToNetSuiteButton/index.tsx index a0cd36671117..72b0b78f45a8 100644 --- a/src/components/ConnectToNetSuiteButton/index.tsx +++ b/src/components/ConnectToNetSuiteButton/index.tsx @@ -1,4 +1,5 @@ import React, {useState} from 'react'; +import {useOnyx} from 'react-native-onyx'; import AccountingConnectionConfirmationModal from '@components/AccountingConnectionConfirmationModal'; import Button from '@components/Button'; import useLocalize from '@hooks/useLocalize'; @@ -7,6 +8,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import {removePolicyConnection} from '@libs/actions/connections'; import Navigation from '@libs/Navigation/Navigation'; import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {ConnectToNetSuiteButtonProps} from './types'; @@ -14,6 +16,7 @@ function ConnectToNetSuiteButton({policyID, shouldDisconnectIntegrationBeforeCon const styles = useThemeStyles(); const {translate} = useLocalize(); const {isOffline} = useNetwork(); + const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`); const [isDisconnectModalOpen, setIsDisconnectModalOpen] = useState(false); @@ -21,6 +24,11 @@ function ConnectToNetSuiteButton({policyID, shouldDisconnectIntegrationBeforeCon <>