Skip to content

Commit

Permalink
Merge pull request #42043 from Expensify/xero-merge-freeze
Browse files Browse the repository at this point in the history
Merge Xero freeze branch
  • Loading branch information
lakchote authored May 14, 2024
2 parents d646a30 + 1a2b82c commit b587bf7
Show file tree
Hide file tree
Showing 28 changed files with 654 additions and 61 deletions.
15 changes: 15 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1301,8 +1301,15 @@ const CONST = {
XERO_CONFIG: {
AUTO_SYNC: 'autoSync',
SYNC: 'sync',
ENABLE_NEW_CATEGORIES: 'enableNewCategories',
EXPORT: 'export',
IMPORT_CUSTOMERS: 'importCustomers',
IMPORT_TAX_RATES: 'importTaxRates',
INVOICE_STATUS: {
AWAITING_PAYMENT: 'AWT_PAYMENT',
DRAFT: 'DRAFT',
AWAITING_APPROVAL: 'AWT_APPROVAL',
},
IMPORT_TRACKING_CATEGORIES: 'importTrackingCategories',
MAPPINGS: 'mappings',
TRACKING_CATEGORY_PREFIX: 'trackingCategory_',
Expand All @@ -1322,6 +1329,12 @@ const CONST = {
JOURNAL_ENTRY: 'journal_entry',
},

XERO_EXPORT_DATE: {
LAST_EXPENSE: 'LAST_EXPENSE',
REPORT_EXPORTED: 'REPORT_EXPORTED',
REPORT_SUBMITTED: 'REPORT_SUBMITTED',
},

QUICKBOOKS_EXPORT_DATE: {
LAST_EXPENSE: 'LAST_EXPENSE',
REPORT_EXPORTED: 'REPORT_EXPORTED',
Expand Down Expand Up @@ -1787,6 +1800,8 @@ const CONST = {
XERO_SYNC_IMPORT_CUSTOMERS: 'xeroSyncImportCustomers',
XERO_SYNC_IMPORT_BANK_ACCOUNTS: 'xeroSyncImportBankAccounts',
XERO_SYNC_IMPORT_TAX_RATES: 'xeroSyncImportTaxRates',
XERO_CHECK_CONNECTION: 'xeroCheckConnection',
XERO_SYNC_TITLE: 'xeroSyncTitle',
},
},
ACCESS_VARIANTS: {
Expand Down
20 changes: 20 additions & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,10 @@ const ROUTES = {
route: 'settings/workspaces/:policyID/accounting/xero/import',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/import` as const,
},
POLICY_ACCOUNTING_XERO_CHART_OF_ACCOUNTS: {
route: 'settings/workspaces/:policyID/accounting/xero/import/accounts',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/import/accounts` as const,
},
POLICY_ACCOUNTING_XERO_ORGANIZATION: {
route: 'settings/workspaces/:policyID/accounting/xero/organization/:currentOrganizationID',
getRoute: (policyID: string, currentOrganizationID: string) => `settings/workspaces/${policyID}/accounting/xero/organization/${currentOrganizationID}` as const,
Expand Down Expand Up @@ -815,6 +819,18 @@ const ROUTES = {
route: 'settings/workspaces/:policyID/accounting/xero/export',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/export` as const,
},
POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_SELECT: {
route: '/settings/workspaces/:policyID/connections/xero/export/preferred-exporter/select',
getRoute: (policyID: string) => `/settings/workspaces/${policyID}/connections/xero/export/preferred-exporter/select` as const,
},
POLICY_ACCOUNTING_XERO_EXPORT_PURCHASE_BILL_DATE_SELECT: {
route: 'settings/workspaces/:policyID/accounting/xero/export/purchase-bill-date-select',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/export/purchase-bill-date-select` as const,
},
POLICY_ACCOUNTING_XERO_EXPORT_BANK_ACCOUNT_SELECT: {
route: 'settings/workspaces/:policyID/accounting/xero/export/bank-account-select',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/export/bank-account-select` as const,
},
POLICY_ACCOUNTING_XERO_ADVANCED: {
route: 'settings/workspaces/:policyID/accounting/xero/advanced',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/advanced` as const,
Expand All @@ -823,6 +839,10 @@ const ROUTES = {
route: 'settings/workspaces/:policyID/accounting/xero/advanced/invoice-account-selector',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/advanced/invoice-account-selector` as const,
},
POLICY_ACCOUNTING_XERO_BILL_PAYMENT_ACCOUNT_SELECTOR: {
route: 'settings/workspaces/:policyID/accounting/xero/advanced/bill-payment-account-selector',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/advanced/bill-payment-account-selector` as const,
},
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,
Expand Down
5 changes: 5 additions & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,19 @@ const SCREENS = {
QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR: 'Policy_Accounting_Quickbooks_Online_Invoice_Account_Selector',
XERO_IMPORT: 'Policy_Accounting_Xero_Import',
XERO_ORGANIZATION: 'Policy_Accounting_Xero_Customers',
XERO_CHART_OF_ACCOUNTS: 'Policy_Accounting_Xero_Import_Chart_Of_Accounts',
XERO_CUSTOMER: 'Policy_Acounting_Xero_Import_Customer',
XERO_TAXES: 'Policy_Accounting_Xero_Taxes',
XERO_TRACKING_CATEGORIES: 'Policy_Accounting_Xero_Tracking_Categories',
XERO_MAP_COST_CENTERS: 'Policy_Accounting_Xero_Map_Cost_Centers',
XERO_MAP_REGION: 'Policy_Accounting_Xero_Map_Region',
XERO_EXPORT: 'Policy_Accounting_Xero_Export',
XERO_EXPORT_PURCHASE_BILL_DATE_SELECT: 'Policy_Accounting_Xero_Export_Purchase_Bill_Date_Select',
XERO_ADVANCED: 'Policy_Accounting_Xero_Advanced',
XERO_INVOICE_ACCOUNT_SELECTOR: 'Policy_Accounting_Xero_Invoice_Account_Selector',
XERO_EXPORT_PREFERRED_EXPORTER_SELECT: 'Workspace_Accounting_Xero_Export_Preferred_Exporter_Select',
XERO_BILL_PAYMENT_ACCOUNT_SELECTOR: 'Policy_Accounting_Xero_Bill_Payment_Account_Selector',
XERO_EXPORT_BANK_ACCOUNT_SELECT: 'Policy_Accounting_Xero_Export_Bank_Account_Select',
},
INITIAL: 'Workspace_Initial',
PROFILE: 'Workspace_Profile',
Expand Down
7 changes: 5 additions & 2 deletions src/components/CollapsibleSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ type CollapsibleSectionProps = ChildrenProps & {
/** Style of title of the collapsible section */
titleStyle?: StyleProp<TextStyle>;

/** Style for the text */
textStyle?: StyleProp<TextStyle>;

/** Style for the wrapper view */
wrapperStyle?: StyleProp<ViewStyle>;

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

function CollapsibleSection({title, children, titleStyle, wrapperStyle, shouldShowSectionBorder}: CollapsibleSectionProps) {
function CollapsibleSection({title, children, titleStyle, textStyle, wrapperStyle, shouldShowSectionBorder}: CollapsibleSectionProps) {
const theme = useTheme();
const styles = useThemeStyles();
const [isExpanded, setIsExpanded] = useState(false);
Expand All @@ -50,7 +53,7 @@ function CollapsibleSection({title, children, titleStyle, wrapperStyle, shouldSh
pressDimmingValue={0.2}
>
<Text
style={[styles.flex1, styles.textStrong, styles.userSelectNone, titleStyle]}
style={textStyle ?? [styles.flex1, styles.textStrong, styles.userSelectNone, titleStyle]}
dataSet={{[CONST.SELECTION_SCRAPER_HIDDEN_ELEMENT]: true}}
>
{title}
Expand Down
22 changes: 8 additions & 14 deletions src/components/ConnectionLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ type ConnectionLayoutProps = {
/** Header title for the connection */
headerTitle: TranslationPaths;

/** The subtitle to show in the header */
headerSubtitle?: string;

/** React nodes that will be shown */
children?: React.ReactNode;

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

/** Subtitle of the connection */
subtitle?: TranslationPaths;

/** The current policyID */
policyID: string;

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

/** Style of the subtitle text */
subTitleStyle?: StyleProp<TextStyle> | undefined;

/** Whether to use ScrollView or not */
shouldUseScrollView?: boolean;
};

type ConnectionLayoutContentProps = Pick<ConnectionLayoutProps, 'title' | 'titleStyle' | 'subtitle' | 'subTitleStyle' | 'children'>;
type ConnectionLayoutContentProps = Pick<ConnectionLayoutProps, 'title' | 'titleStyle' | 'children'>;

function ConnectionLayoutContent({title, titleStyle, subtitle, subTitleStyle, children}: ConnectionLayoutContentProps) {
function ConnectionLayoutContent({title, titleStyle, children}: ConnectionLayoutContentProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
return (
<>
{title && <Text style={[styles.pb5, titleStyle]}>{translate(title)}</Text>}
{subtitle && <Text style={[styles.textLabelSupporting, subTitleStyle]}>{translate(subtitle)}</Text>}
{children}
</>
);
Expand All @@ -70,13 +66,12 @@ function ConnectionLayout({
headerTitle,
children,
title,
subtitle,
headerSubtitle,
policyID,
accessVariants,
featureName,
contentContainerStyle,
titleStyle,
subTitleStyle,
shouldUseScrollView = true,
}: ConnectionLayoutProps) {
const {translate} = useLocalize();
Expand All @@ -85,14 +80,12 @@ function ConnectionLayout({
() => (
<ConnectionLayoutContent
title={title}
subtitle={subtitle}
subTitleStyle={subTitleStyle}
titleStyle={titleStyle}
>
{children}
</ConnectionLayoutContent>
),
[title, subtitle, titleStyle, subTitleStyle, children],
[title, titleStyle, children],
);

return (
Expand All @@ -108,6 +101,7 @@ function ConnectionLayout({
>
<HeaderWithBackButton
title={translate(headerTitle)}
subtitle={headerSubtitle}
onBackButtonPress={() => Navigation.goBack()}
/>
{shouldUseScrollView ? (
Expand Down
57 changes: 56 additions & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1891,6 +1891,7 @@ export default {
travel: 'Travel',
members: 'Members',
accounting: 'Accounting',
displayedAs: 'Displayed as',
plan: 'Plan',
profile: 'Profile',
bankAccount: 'Bank account',
Expand Down Expand Up @@ -1921,7 +1922,6 @@ export default {
classes: 'Classes',
locations: 'Locations',
customers: 'Customers/Projects',
displayedAs: 'Displayed as',
accountsDescription: 'When connected to Quickbooks Online, chart of accounts are always imported to Expensify as categories.',
accountsSwitchTitle: 'Below you can choose to have any new account imported as an enabled or disabled category by default.',
accountsSwitchDescription: 'Enabled categories are available for members to select when creating their expenses.',
Expand Down Expand Up @@ -2029,6 +2029,9 @@ export default {
organization: 'Xero organization',
organizationDescription: 'Select the organization in Xero you are importing data from.',
importDescription: 'Choose which coding configurations are imported from Xero to Expensify.',
accountsDescription: 'When connected to Xero, chart of accounts are always imported to Expensify as categories.',
accountsSwitchTitle: 'Below you can choose to have any new account imported as an enabled or disabled category by default.',
accountsSwitchDescription: 'Enabled categories are available for members to select when creating their expenses.',
trackingCategories: 'Tracking categories',
trackingCategoriesDescription: 'Choose whether to import tracking categories and see where they are displayed.',
mapXeroCostCentersTo: 'Map Xero cost centers to',
Expand All @@ -2051,6 +2054,7 @@ export default {
'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.',
bankTransactions: 'Bank transactions',
xeroBankAccount: 'Xero bank account',
xeroBankAccountDescription: 'Select the bank account expenses will be posted to as bank transactions.',
preferredExporter: 'Preferred exporter',
exportExpenses: 'Export out-of-pocket expenses as',
exportExpensesDescription: 'Reports will export as a purchase bill, using the date and status you select below.',
Expand All @@ -2068,7 +2072,36 @@ export default {
xeroBillPaymentAccount: 'Xero Bill Payment Account',
xeroInvoiceCollectionAccount: 'Xero Invoice Collections Account',
invoiceAccountSelectorDescription: "As you've enabled exporting invoices from Expensify to Xero, this is the account the invoice will appear against once marked as paid.",
xeroBillPaymentAccountDescription:
"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.",
},
exportDate: {
label: 'Export date',
description: 'Use this date when exporting reports to Xero.',
values: {
[CONST.QUICKBOOKS_EXPORT_DATE.LAST_EXPENSE]: {
label: 'Date of last expense',
description: 'The date of the most recent expense on the report',
},
[CONST.QUICKBOOKS_EXPORT_DATE.REPORT_EXPORTED]: {
label: 'Export date',
description: 'The date the report was exported to Xero',
},
[CONST.QUICKBOOKS_EXPORT_DATE.REPORT_SUBMITTED]: {
label: 'Submitted date',
description: 'The date the report was submitted for approval',
},
},
},
invoiceStatus: {
values: {
[CONST.XERO_CONFIG.INVOICE_STATUS.AWAITING_PAYMENT]: 'Authorised',
[CONST.XERO_CONFIG.INVOICE_STATUS.DRAFT]: 'Draft',
[CONST.XERO_CONFIG.INVOICE_STATUS.AWAITING_APPROVAL]: 'Submitted',
},
},
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.',
exportPreferredExporterSubNote: 'Once set, the preferred exporter will see reports for export in their account.',
},
type: {
free: 'Free',
Expand Down Expand Up @@ -2368,6 +2401,28 @@ export default {
return 'Updating people list';
case 'quickbooksOnlineSyncApplyClassesLocations':
return 'Updating report fields';
case 'xeroSyncImportChartOfAccounts':
return 'Syncing chart of accounts';
case 'xeroSyncImportCategories':
return 'Syncing categories';
case 'xeroSyncImportCustomers':
return 'Syncing customers';
case 'xeroSyncXeroReimbursedReports':
return 'Marking Expensify reports as reimbursed';
case 'xeroSyncExpensifyReimbursedReports':
return 'Marking Xero bills and invoices as paid';
case 'xeroSyncImportTrackingCategories':
return 'Syncing tracking categories';
case 'xeroSyncImportBankAccounts':
return 'Syncing bank accounts';
case 'xeroSyncImportTaxRates':
return 'Syncing tax rates';
case 'xeroCheckConnection':
return 'Checking Xero connection';
case 'xeroSyncTitle':
return 'Synchronizing Xero data';
case 'xeroSyncStep':
return 'Loading data';
default: {
return `Translation missing for stage: ${stage}`;
}
Expand Down
Loading

0 comments on commit b587bf7

Please sign in to comment.