From 75fd91215a173eedef4e123a05e2c41d07e63ffe Mon Sep 17 00:00:00 2001 From: Jakub Szymczak Date: Wed, 12 Jun 2024 15:28:58 +0200 Subject: [PATCH 01/33] add connect to sage intacct button --- src/CONST.ts | 12 +--- .../ConnectToSageIntacctButton/index.tsx | 66 +++++++++++++++++++ src/languages/en.ts | 52 +++++++-------- src/types/onyx/Policy.ts | 3 + 4 files changed, 94 insertions(+), 39 deletions(-) create mode 100644 src/components/ConnectToSageIntacctButton/index.tsx diff --git a/src/CONST.ts b/src/CONST.ts index 26d9af6bb8b8..45763d4a3f8b 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -590,6 +590,8 @@ const CONST = { ONFIDO_TERMS_OF_SERVICE_URL: 'https://onfido.com/terms-of-service/', LIST_OF_RESTRICTED_BUSINESSES: 'https://community.expensify.com/discussion/6191/list-of-restricted-businesses', TRAVEL_TERMS_URL: `${USE_EXPENSIFY_URL}/travelterms`, + EXPENSIFY_PACKAGE_FOR_SAGE_INTACCT: `${USE_EXPENSIFY_URL}/tools/integrations/downloadPackage`, + HOW_TO_CONNECT_TO_SAGE_INTACCT: 'https://help.expensify.com/articles/expensify-classic/integrations/accounting-integrations/Sage-Intacct#how-to-connect-to-sage-intacct', // Use Environment.getEnvironmentURL to get the complete URL with port number DEV_NEW_EXPENSIFY_URL: 'https://dev.new.expensify.com:', @@ -1783,6 +1785,7 @@ const CONST = { // Here we will add other connections names when we add support for them QBO: 'quickbooksOnline', XERO: 'xero', + SAGE_INTACCT: 'intacct', }, SYNC_STAGE_NAME: { STARTING_IMPORT_QBO: 'startingImportQBO', @@ -4820,15 +4823,6 @@ const CONST = { }, SUBSCRIPTION_SIZE_LIMIT: 20000, - - PAYMENT_CARD_CURRENCY: { - USD: 'USD', - AUD: 'AUD', - GBP: 'GBP', - NZD: 'NZD', - }, - - SUBSCRIPTION_PRICE_FACTOR: 2, SUBSCRIPTION_POSSIBLE_COST_SAVINGS: { COLLECT_PLAN: 10, CONTROL_PLAN: 18, diff --git a/src/components/ConnectToSageIntacctButton/index.tsx b/src/components/ConnectToSageIntacctButton/index.tsx new file mode 100644 index 000000000000..1d781d9a62e4 --- /dev/null +++ b/src/components/ConnectToSageIntacctButton/index.tsx @@ -0,0 +1,66 @@ +import React, {useState} from 'react'; +import Button from '@components/Button'; +import ConfirmModal from '@components/ConfirmModal'; +import useEnvironment from '@hooks/useEnvironment'; +import useLocalize from '@hooks/useLocalize'; +import useNetwork from '@hooks/useNetwork'; +import useThemeStyles from '@hooks/useThemeStyles'; +import {removePolicyConnection} from '@libs/actions/connections'; +import {getXeroSetupLink} from '@libs/actions/connections/ConnectToXero'; +import Navigation from '@libs/Navigation/Navigation'; +import * as Link from '@userActions/Link'; +import CONST from '@src/CONST'; +import ROUTES from '@src/ROUTES'; +import type {PolicyConnectionName} from '@src/types/onyx/Policy'; + +type ConnectToSageIntacctButtonProps = { + policyID: string; + shouldDisconnectIntegrationBeforeConnecting?: boolean; + integrationToDisconnect?: PolicyConnectionName; +}; + +function ConnectToXeroButton({policyID, shouldDisconnectIntegrationBeforeConnecting, integrationToDisconnect}: ConnectToSageIntacctButtonProps) { + const styles = useThemeStyles(); + const {translate} = useLocalize(); + const {isOffline} = useNetwork(); + const currentIntegration = translate('workspace.accounting.integrationName', integrationToDisconnect); + const integrationToConnect = translate('workspace.accounting.integrationName', CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT); + + const [isDisconnectModalOpen, setIsDisconnectModalOpen] = useState(false); + + return ( + <> +