Skip to content

Commit b587bf7

Browse files
authored
Merge pull request #42043 from Expensify/xero-merge-freeze
Merge Xero freeze branch
2 parents d646a30 + 1a2b82c commit b587bf7

28 files changed

+654
-61
lines changed

src/CONST.ts

+15
Original file line numberDiff line numberDiff line change
@@ -1301,8 +1301,15 @@ const CONST = {
13011301
XERO_CONFIG: {
13021302
AUTO_SYNC: 'autoSync',
13031303
SYNC: 'sync',
1304+
ENABLE_NEW_CATEGORIES: 'enableNewCategories',
1305+
EXPORT: 'export',
13041306
IMPORT_CUSTOMERS: 'importCustomers',
13051307
IMPORT_TAX_RATES: 'importTaxRates',
1308+
INVOICE_STATUS: {
1309+
AWAITING_PAYMENT: 'AWT_PAYMENT',
1310+
DRAFT: 'DRAFT',
1311+
AWAITING_APPROVAL: 'AWT_APPROVAL',
1312+
},
13061313
IMPORT_TRACKING_CATEGORIES: 'importTrackingCategories',
13071314
MAPPINGS: 'mappings',
13081315
TRACKING_CATEGORY_PREFIX: 'trackingCategory_',
@@ -1322,6 +1329,12 @@ const CONST = {
13221329
JOURNAL_ENTRY: 'journal_entry',
13231330
},
13241331

1332+
XERO_EXPORT_DATE: {
1333+
LAST_EXPENSE: 'LAST_EXPENSE',
1334+
REPORT_EXPORTED: 'REPORT_EXPORTED',
1335+
REPORT_SUBMITTED: 'REPORT_SUBMITTED',
1336+
},
1337+
13251338
QUICKBOOKS_EXPORT_DATE: {
13261339
LAST_EXPENSE: 'LAST_EXPENSE',
13271340
REPORT_EXPORTED: 'REPORT_EXPORTED',
@@ -1787,6 +1800,8 @@ const CONST = {
17871800
XERO_SYNC_IMPORT_CUSTOMERS: 'xeroSyncImportCustomers',
17881801
XERO_SYNC_IMPORT_BANK_ACCOUNTS: 'xeroSyncImportBankAccounts',
17891802
XERO_SYNC_IMPORT_TAX_RATES: 'xeroSyncImportTaxRates',
1803+
XERO_CHECK_CONNECTION: 'xeroCheckConnection',
1804+
XERO_SYNC_TITLE: 'xeroSyncTitle',
17901805
},
17911806
},
17921807
ACCESS_VARIANTS: {

src/ROUTES.ts

+20
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,10 @@ const ROUTES = {
787787
route: 'settings/workspaces/:policyID/accounting/xero/import',
788788
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/import` as const,
789789
},
790+
POLICY_ACCOUNTING_XERO_CHART_OF_ACCOUNTS: {
791+
route: 'settings/workspaces/:policyID/accounting/xero/import/accounts',
792+
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/import/accounts` as const,
793+
},
790794
POLICY_ACCOUNTING_XERO_ORGANIZATION: {
791795
route: 'settings/workspaces/:policyID/accounting/xero/organization/:currentOrganizationID',
792796
getRoute: (policyID: string, currentOrganizationID: string) => `settings/workspaces/${policyID}/accounting/xero/organization/${currentOrganizationID}` as const,
@@ -815,6 +819,18 @@ const ROUTES = {
815819
route: 'settings/workspaces/:policyID/accounting/xero/export',
816820
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/export` as const,
817821
},
822+
POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_SELECT: {
823+
route: '/settings/workspaces/:policyID/connections/xero/export/preferred-exporter/select',
824+
getRoute: (policyID: string) => `/settings/workspaces/${policyID}/connections/xero/export/preferred-exporter/select` as const,
825+
},
826+
POLICY_ACCOUNTING_XERO_EXPORT_PURCHASE_BILL_DATE_SELECT: {
827+
route: 'settings/workspaces/:policyID/accounting/xero/export/purchase-bill-date-select',
828+
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/export/purchase-bill-date-select` as const,
829+
},
830+
POLICY_ACCOUNTING_XERO_EXPORT_BANK_ACCOUNT_SELECT: {
831+
route: 'settings/workspaces/:policyID/accounting/xero/export/bank-account-select',
832+
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/export/bank-account-select` as const,
833+
},
818834
POLICY_ACCOUNTING_XERO_ADVANCED: {
819835
route: 'settings/workspaces/:policyID/accounting/xero/advanced',
820836
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/advanced` as const,
@@ -823,6 +839,10 @@ const ROUTES = {
823839
route: 'settings/workspaces/:policyID/accounting/xero/advanced/invoice-account-selector',
824840
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/advanced/invoice-account-selector` as const,
825841
},
842+
POLICY_ACCOUNTING_XERO_BILL_PAYMENT_ACCOUNT_SELECTOR: {
843+
route: 'settings/workspaces/:policyID/accounting/xero/advanced/bill-payment-account-selector',
844+
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/advanced/bill-payment-account-selector` as const,
845+
},
826846
POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_IMPORT: {
827847
route: 'settings/workspaces/:policyID/accounting/quickbooks-online/import',
828848
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/import` as const,

src/SCREENS.ts

+5
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,19 @@ const SCREENS = {
245245
QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR: 'Policy_Accounting_Quickbooks_Online_Invoice_Account_Selector',
246246
XERO_IMPORT: 'Policy_Accounting_Xero_Import',
247247
XERO_ORGANIZATION: 'Policy_Accounting_Xero_Customers',
248+
XERO_CHART_OF_ACCOUNTS: 'Policy_Accounting_Xero_Import_Chart_Of_Accounts',
248249
XERO_CUSTOMER: 'Policy_Acounting_Xero_Import_Customer',
249250
XERO_TAXES: 'Policy_Accounting_Xero_Taxes',
250251
XERO_TRACKING_CATEGORIES: 'Policy_Accounting_Xero_Tracking_Categories',
251252
XERO_MAP_COST_CENTERS: 'Policy_Accounting_Xero_Map_Cost_Centers',
252253
XERO_MAP_REGION: 'Policy_Accounting_Xero_Map_Region',
253254
XERO_EXPORT: 'Policy_Accounting_Xero_Export',
255+
XERO_EXPORT_PURCHASE_BILL_DATE_SELECT: 'Policy_Accounting_Xero_Export_Purchase_Bill_Date_Select',
254256
XERO_ADVANCED: 'Policy_Accounting_Xero_Advanced',
255257
XERO_INVOICE_ACCOUNT_SELECTOR: 'Policy_Accounting_Xero_Invoice_Account_Selector',
258+
XERO_EXPORT_PREFERRED_EXPORTER_SELECT: 'Workspace_Accounting_Xero_Export_Preferred_Exporter_Select',
259+
XERO_BILL_PAYMENT_ACCOUNT_SELECTOR: 'Policy_Accounting_Xero_Bill_Payment_Account_Selector',
260+
XERO_EXPORT_BANK_ACCOUNT_SELECT: 'Policy_Accounting_Xero_Export_Bank_Account_Select',
256261
},
257262
INITIAL: 'Workspace_Initial',
258263
PROFILE: 'Workspace_Profile',

src/components/CollapsibleSection/index.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@ type CollapsibleSectionProps = ChildrenProps & {
1818
/** Style of title of the collapsible section */
1919
titleStyle?: StyleProp<TextStyle>;
2020

21+
/** Style for the text */
22+
textStyle?: StyleProp<TextStyle>;
23+
2124
/** Style for the wrapper view */
2225
wrapperStyle?: StyleProp<ViewStyle>;
2326

2427
/** Whether or not to show border between section title and expandable items */
2528
shouldShowSectionBorder?: boolean;
2629
};
2730

28-
function CollapsibleSection({title, children, titleStyle, wrapperStyle, shouldShowSectionBorder}: CollapsibleSectionProps) {
31+
function CollapsibleSection({title, children, titleStyle, textStyle, wrapperStyle, shouldShowSectionBorder}: CollapsibleSectionProps) {
2932
const theme = useTheme();
3033
const styles = useThemeStyles();
3134
const [isExpanded, setIsExpanded] = useState(false);
@@ -50,7 +53,7 @@ function CollapsibleSection({title, children, titleStyle, wrapperStyle, shouldSh
5053
pressDimmingValue={0.2}
5154
>
5255
<Text
53-
style={[styles.flex1, styles.textStrong, styles.userSelectNone, titleStyle]}
56+
style={textStyle ?? [styles.flex1, styles.textStrong, styles.userSelectNone, titleStyle]}
5457
dataSet={{[CONST.SELECTION_SCRAPER_HIDDEN_ELEMENT]: true}}
5558
>
5659
{title}

src/components/ConnectionLayout.tsx

+8-14
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ type ConnectionLayoutProps = {
2020
/** Header title for the connection */
2121
headerTitle: TranslationPaths;
2222

23+
/** The subtitle to show in the header */
24+
headerSubtitle?: string;
25+
2326
/** React nodes that will be shown */
2427
children?: React.ReactNode;
2528

2629
/** Title of the connection component */
2730
title?: TranslationPaths;
2831

29-
/** Subtitle of the connection */
30-
subtitle?: TranslationPaths;
31-
3232
/** The current policyID */
3333
policyID: string;
3434

@@ -44,22 +44,18 @@ type ConnectionLayoutProps = {
4444
/** Style of the title text */
4545
titleStyle?: StyleProp<TextStyle> | undefined;
4646

47-
/** Style of the subtitle text */
48-
subTitleStyle?: StyleProp<TextStyle> | undefined;
49-
5047
/** Whether to use ScrollView or not */
5148
shouldUseScrollView?: boolean;
5249
};
5350

54-
type ConnectionLayoutContentProps = Pick<ConnectionLayoutProps, 'title' | 'titleStyle' | 'subtitle' | 'subTitleStyle' | 'children'>;
51+
type ConnectionLayoutContentProps = Pick<ConnectionLayoutProps, 'title' | 'titleStyle' | 'children'>;
5552

56-
function ConnectionLayoutContent({title, titleStyle, subtitle, subTitleStyle, children}: ConnectionLayoutContentProps) {
53+
function ConnectionLayoutContent({title, titleStyle, children}: ConnectionLayoutContentProps) {
5754
const {translate} = useLocalize();
5855
const styles = useThemeStyles();
5956
return (
6057
<>
6158
{title && <Text style={[styles.pb5, titleStyle]}>{translate(title)}</Text>}
62-
{subtitle && <Text style={[styles.textLabelSupporting, subTitleStyle]}>{translate(subtitle)}</Text>}
6359
{children}
6460
</>
6561
);
@@ -70,13 +66,12 @@ function ConnectionLayout({
7066
headerTitle,
7167
children,
7268
title,
73-
subtitle,
69+
headerSubtitle,
7470
policyID,
7571
accessVariants,
7672
featureName,
7773
contentContainerStyle,
7874
titleStyle,
79-
subTitleStyle,
8075
shouldUseScrollView = true,
8176
}: ConnectionLayoutProps) {
8277
const {translate} = useLocalize();
@@ -85,14 +80,12 @@ function ConnectionLayout({
8580
() => (
8681
<ConnectionLayoutContent
8782
title={title}
88-
subtitle={subtitle}
89-
subTitleStyle={subTitleStyle}
9083
titleStyle={titleStyle}
9184
>
9285
{children}
9386
</ConnectionLayoutContent>
9487
),
95-
[title, subtitle, titleStyle, subTitleStyle, children],
88+
[title, titleStyle, children],
9689
);
9790

9891
return (
@@ -108,6 +101,7 @@ function ConnectionLayout({
108101
>
109102
<HeaderWithBackButton
110103
title={translate(headerTitle)}
104+
subtitle={headerSubtitle}
111105
onBackButtonPress={() => Navigation.goBack()}
112106
/>
113107
{shouldUseScrollView ? (

src/languages/en.ts

+56-1
Original file line numberDiff line numberDiff line change
@@ -1891,6 +1891,7 @@ export default {
18911891
travel: 'Travel',
18921892
members: 'Members',
18931893
accounting: 'Accounting',
1894+
displayedAs: 'Displayed as',
18941895
plan: 'Plan',
18951896
profile: 'Profile',
18961897
bankAccount: 'Bank account',
@@ -1921,7 +1922,6 @@ export default {
19211922
classes: 'Classes',
19221923
locations: 'Locations',
19231924
customers: 'Customers/Projects',
1924-
displayedAs: 'Displayed as',
19251925
accountsDescription: 'When connected to Quickbooks Online, chart of accounts are always imported to Expensify as categories.',
19261926
accountsSwitchTitle: 'Below you can choose to have any new account imported as an enabled or disabled category by default.',
19271927
accountsSwitchDescription: 'Enabled categories are available for members to select when creating their expenses.',
@@ -2029,6 +2029,9 @@ export default {
20292029
organization: 'Xero organization',
20302030
organizationDescription: 'Select the organization in Xero you are importing data from.',
20312031
importDescription: 'Choose which coding configurations are imported from Xero to Expensify.',
2032+
accountsDescription: 'When connected to Xero, chart of accounts are always imported to Expensify as categories.',
2033+
accountsSwitchTitle: 'Below you can choose to have any new account imported as an enabled or disabled category by default.',
2034+
accountsSwitchDescription: 'Enabled categories are available for members to select when creating their expenses.',
20322035
trackingCategories: 'Tracking categories',
20332036
trackingCategoriesDescription: 'Choose whether to import tracking categories and see where they are displayed.',
20342037
mapXeroCostCentersTo: 'Map Xero cost centers to',
@@ -2051,6 +2054,7 @@ export default {
20512054
'Each exported expense posts as a bank transaction to the Xero bank account you select below, and transaction dates will match the dates on your bank statement.',
20522055
bankTransactions: 'Bank transactions',
20532056
xeroBankAccount: 'Xero bank account',
2057+
xeroBankAccountDescription: 'Select the bank account expenses will be posted to as bank transactions.',
20542058
preferredExporter: 'Preferred exporter',
20552059
exportExpenses: 'Export out-of-pocket expenses as',
20562060
exportExpensesDescription: 'Reports will export as a purchase bill, using the date and status you select below.',
@@ -2068,7 +2072,36 @@ export default {
20682072
xeroBillPaymentAccount: 'Xero Bill Payment Account',
20692073
xeroInvoiceCollectionAccount: 'Xero Invoice Collections Account',
20702074
invoiceAccountSelectorDescription: "As you've enabled exporting invoices from Expensify to Xero, this is the account the invoice will appear against once marked as paid.",
2075+
xeroBillPaymentAccountDescription:
2076+
"As you've enabled sync reimbursed reports, you will need to select the bank account your reimbursements are coming out of, and we'll create the payment in Xero.",
20712077
},
2078+
exportDate: {
2079+
label: 'Export date',
2080+
description: 'Use this date when exporting reports to Xero.',
2081+
values: {
2082+
[CONST.QUICKBOOKS_EXPORT_DATE.LAST_EXPENSE]: {
2083+
label: 'Date of last expense',
2084+
description: 'The date of the most recent expense on the report',
2085+
},
2086+
[CONST.QUICKBOOKS_EXPORT_DATE.REPORT_EXPORTED]: {
2087+
label: 'Export date',
2088+
description: 'The date the report was exported to Xero',
2089+
},
2090+
[CONST.QUICKBOOKS_EXPORT_DATE.REPORT_SUBMITTED]: {
2091+
label: 'Submitted date',
2092+
description: 'The date the report was submitted for approval',
2093+
},
2094+
},
2095+
},
2096+
invoiceStatus: {
2097+
values: {
2098+
[CONST.XERO_CONFIG.INVOICE_STATUS.AWAITING_PAYMENT]: 'Authorised',
2099+
[CONST.XERO_CONFIG.INVOICE_STATUS.DRAFT]: 'Draft',
2100+
[CONST.XERO_CONFIG.INVOICE_STATUS.AWAITING_APPROVAL]: 'Submitted',
2101+
},
2102+
},
2103+
exportPreferredExporterNote: 'This can be any workspace admin, but must be a domain admin if you set different export accounts for individual company cards in domain settings.',
2104+
exportPreferredExporterSubNote: 'Once set, the preferred exporter will see reports for export in their account.',
20722105
},
20732106
type: {
20742107
free: 'Free',
@@ -2368,6 +2401,28 @@ export default {
23682401
return 'Updating people list';
23692402
case 'quickbooksOnlineSyncApplyClassesLocations':
23702403
return 'Updating report fields';
2404+
case 'xeroSyncImportChartOfAccounts':
2405+
return 'Syncing chart of accounts';
2406+
case 'xeroSyncImportCategories':
2407+
return 'Syncing categories';
2408+
case 'xeroSyncImportCustomers':
2409+
return 'Syncing customers';
2410+
case 'xeroSyncXeroReimbursedReports':
2411+
return 'Marking Expensify reports as reimbursed';
2412+
case 'xeroSyncExpensifyReimbursedReports':
2413+
return 'Marking Xero bills and invoices as paid';
2414+
case 'xeroSyncImportTrackingCategories':
2415+
return 'Syncing tracking categories';
2416+
case 'xeroSyncImportBankAccounts':
2417+
return 'Syncing bank accounts';
2418+
case 'xeroSyncImportTaxRates':
2419+
return 'Syncing tax rates';
2420+
case 'xeroCheckConnection':
2421+
return 'Checking Xero connection';
2422+
case 'xeroSyncTitle':
2423+
return 'Synchronizing Xero data';
2424+
case 'xeroSyncStep':
2425+
return 'Loading data';
23712426
default: {
23722427
return `Translation missing for stage: ${stage}`;
23732428
}

0 commit comments

Comments
 (0)