diff --git a/src/CONFIG.ts b/src/CONFIG.ts index 76ea18d37d5f..9ed4242d7604 100644 --- a/src/CONFIG.ts +++ b/src/CONFIG.ts @@ -48,6 +48,7 @@ export default { EXPENSIFY: { // Note: This will be EXACTLY what is set for EXPENSIFY_URL whether the proxy is enabled or not. EXPENSIFY_URL: expensifyURL, + SECURE_EXPENSIFY_URL: secureExpensifyUrl, NEW_EXPENSIFY_URL: newExpensifyURL, // The DEFAULT API is the API used by most environments, except staging, where we use STAGING (defined below) @@ -72,7 +73,7 @@ export default { IS_USING_LOCAL_WEB: useNgrok || expensifyURLRoot.includes('dev'), PUSHER: { APP_KEY: get(Config, 'PUSHER_APP_KEY', '268df511a204fbb60884'), - SUFFIX: get(Config, 'PUSHER_DEV_SUFFIX', ''), + SUFFIX: ENVIRONMENT === CONST.ENVIRONMENT.DEV ? get(Config, 'PUSHER_DEV_SUFFIX', '') : '', CLUSTER: 'mt1', }, SITE_TITLE: 'New Expensify', diff --git a/src/CONST.ts b/src/CONST.ts index 78659ad79fa5..a6df33987c8d 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1215,9 +1215,9 @@ const CONST = { NOT_IMPORTED: 'NOT_IMPORTED', IMPORTED: 'IMPORTED', }, - QUICK_BOOKS_ONLINE: 'quickbooksOnline', + QUICKBOOKS_ONLINE: 'quickbooksOnline', - QUICK_BOOKS_IMPORTS: { + QUICKBOOKS_IMPORTS: { SYNC_CLASSES: 'syncClasses', ENABLE_NEW_CATEGORIES: 'enableNewCategories', SYNC_CUSTOMERS: 'syncCustomers', @@ -1614,25 +1614,23 @@ const CONST = { GENERAL_SETTINGS: 'generalSettings', }, CONNECTIONS: { - SYNC_STATUS: { - STARTING: 'starting', - FINISHED: 'finished', - PROGRESS: 'progress', - }, NAME: { // Here we will add other connections names when we add support for them QBO: 'quickbooksOnline', }, SYNC_STAGE_NAME: { STARTING_IMPORT: 'startingImport', - QBO_CUSTOMERS: 'quickbooksOnlineImportCustomers', - QBO_EMPLOYEES: 'quickbooksOnlineImportEmployees', - QBO_ACCOUNTS: 'quickbooksOnlineImportAccounts', - QBO_CLASSES: 'quickbooksOnlineImportClasses', - QBO_LOCATIONS: 'quickbooksOnlineImportLocations', - QBO_PROCESSING: 'quickbooksOnlineImportProcessing', - QBO_PAYMENTS: 'quickbooksOnlineSyncBillPayments', - QBO_TAX_CODES: 'quickbooksOnlineSyncTaxCodes', + QBO_IMPORT_MAIN: 'quickbooksOnlineImportMain', + QBO_IMPORT_CUSTOMERS: 'quickbooksOnlineImportCustomers', + QBO_IMPORT_EMPLOYEES: 'quickbooksOnlineImportEmployees', + QBO_IMPORT_ACCOUNTS: 'quickbooksOnlineImportAccounts', + QBO_IMPORT_CLASSES: 'quickbooksOnlineImportClasses', + QBO_IMPORT_LOCATIONS: 'quickbooksOnlineImportLocations', + QBO_IMPORT_PROCESSING: 'quickbooksOnlineImportProcessing', + QBO_SYNC_PAYMENTS: 'quickbooksOnlineSyncBillPayments', + QBO_IMPORT_TAX_CODES: 'quickbooksOnlineSyncTaxCodes', + QBO_CHECK_CONNECTION: 'quickbooksOnlineCheckConnection', + JOB_DONE: 'jobDone', }, }, }, diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index e321c4dcb3df..7c9247bcdbd7 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -324,6 +324,7 @@ const ONYXKEYS = { // object should mirror the data as it's stored in the database. POLICY_HAS_CONNECTIONS_DATA_BEEN_FETCHED: 'policyHasConnectionsDataBeenFetched_', OLD_POLICY_RECENTLY_USED_TAGS: 'policyRecentlyUsedTags_', + POLICY_CONNECTION_SYNC_PROGRESS: 'policyConnectionSyncProgress_', WORKSPACE_INVITE_MEMBERS_DRAFT: 'workspaceInviteMembersDraft_', WORKSPACE_INVITE_MESSAGE_DRAFT: 'workspaceInviteMessageDraft_', REPORT: 'report_', @@ -355,8 +356,6 @@ const ONYXKEYS = { /** This is deprecated, but needed for a migration, so we still need to include it here so that it will be initialized in Onyx.init */ DEPRECATED_POLICY_MEMBER_LIST: 'policyMemberList_', - - POLICY_CONNECTION_SYNC_PROGRESS: 'policyConnectionSyncProgress_', }, /** List of Form ids */ diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 59d2cd797f73..7d73d8e55503 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -563,7 +563,7 @@ const ROUTES = { route: 'settings/workspaces/:policyID/members', getRoute: (policyID: string) => `settings/workspaces/${policyID}/members` as const, }, - WORKSPACE_ACCOUNTING: { + POLICY_ACCOUNTING: { route: 'settings/workspaces/:policyID/accounting', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting` as const, }, @@ -707,27 +707,27 @@ const ROUTES = { route: 'r/:reportID/transaction/:transactionID/receipt', getRoute: (reportID: string, transactionID: string) => `r/${reportID}/transaction/${transactionID}/receipt` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_IMPORT: { + POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_IMPORT: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/import', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/import` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_CHART_OF_ACCOUNTS: { + POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_CHART_OF_ACCOUNTS: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/import/accounts', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/import/accounts` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_CLASSES: { + POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_CLASSES: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/import/classes', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/import/classes` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_CUSTOMERS: { + POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_CUSTOMERS: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/import/customers', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/import/customers` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_LOCATIONS: { + POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_LOCATIONS: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/import/locations', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/import/locations` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_TAXES: { + POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_TAXES: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/import/taxes', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/import/taxes` as const, }, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 5ff8b272e56f..d474945d332e 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -203,6 +203,15 @@ const SCREENS = { }, WORKSPACE: { + ACCOUNTING: { + ROOT: 'Policy_Accounting', + QUICKBOOKS_ONLINE_IMPORT: 'Policy_Accounting_Quickbooks_Online_Import', + QUICKBOOKS_ONLINE_CHART_OF_ACCOUNTS: 'Policy_Accounting_Quickbooks_Online_Import_Chart_Of_Accounts', + QUICKBOOKS_ONLINE_CLASSES: 'Policy_Accounting_Quickbooks_Online_Import_Classes', + QUICKBOOKS_ONLINE_CUSTOMERS: 'Policy_Accounting_Quickbooks_Online_Import_Customers', + QUICKBOOKS_ONLINE_LOCATIONS: 'Policy_Accounting_Quickbooks_Online_Import_Locations', + QUICKBOOKS_ONLINE_TAXES: 'Policy_Accounting_Quickbooks_Online_Import_Taxes', + }, INITIAL: 'Workspace_Initial', PROFILE: 'Workspace_Profile', CARD: 'Workspace_Card', @@ -214,7 +223,6 @@ const SCREENS = { INVOICES: 'Workspace_Invoices', TRAVEL: 'Workspace_Travel', MEMBERS: 'Workspace_Members', - ACCOUNTING: 'Workspace_Accounting', INVITE: 'Workspace_Invite', INVITE_MESSAGE: 'Workspace_Invite_Message', CATEGORIES: 'Workspace_Categories', @@ -254,12 +262,6 @@ const SCREENS = { DISTANCE_RATES: 'Distance_Rates', CREATE_DISTANCE_RATE: 'Create_Distance_Rate', DISTANCE_RATES_SETTINGS: 'Distance_Rates_Settings', - QUICKBOOKS_ONLINE_IMPORT: 'Workspace_Accounting_Quickbooks_Online_Import', - QUICKBOOKS_ONLINE_CHART_OF_ACCOUNTS: 'Workspace_Accounting_Quickbooks_Online_Import_Chart_Of_Accounts', - QUICKBOOKS_ONLINE_CLASSES: 'Workspace_Accounting_Quickbooks_Online_Import_Classes', - QUICKBOOKS_ONLINE_CUSTOMERS: 'Workspace_Accounting_Quickbooks_Online_Import_Customers', - QUICKBOOKS_ONLINE_LOCATIONS: 'Workspace_Accounting_Quickbooks_Online_Import_Locations', - QUICKBOOKS_ONLINE_TAXES: 'Workspace_Accounting_Quickbooks_Online_Import_Taxes', DISTANCE_RATE_DETAILS: 'Distance_Rate_Details', DISTANCE_RATE_EDIT: 'Distance_Rate_Edit', }, diff --git a/src/components/ConnectToQuickbooksOnlineButton/index.native.tsx b/src/components/ConnectToQuickbooksOnlineButton/index.native.tsx new file mode 100644 index 000000000000..4d482cb92ead --- /dev/null +++ b/src/components/ConnectToQuickbooksOnlineButton/index.native.tsx @@ -0,0 +1,68 @@ +import React, {useState} from 'react'; +import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; +import {WebView} from 'react-native-webview'; +import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView'; +import Button from '@components/Button'; +import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import Modal from '@components/Modal'; +import useLocalize from '@hooks/useLocalize'; +import {getQuickBooksOnlineSetupLink} from '@libs/actions/connections/QuickBooksOnline'; +import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; +import type {Session} from '@src/types/onyx'; +import type {ConnectToQuickbooksOnlineButtonProps} from './types'; + +type ConnectToQuickbooksOnlineButtonOnyxProps = { + /** Session info for the currently logged in user. */ + session: OnyxEntry; +}; + +const renderLoading = () => ; + +function ConnectToQuickbooksOnlineButton({policyID, session}: ConnectToQuickbooksOnlineButtonProps & ConnectToQuickbooksOnlineButtonOnyxProps) { + const [isModalOpen, setIsModalOpen] = useState(false); + const {translate} = useLocalize(); + + return ( + <> +