Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Xero freeze branch #2 #42340

Merged
merged 194 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
194 commits
Select commit Hold shift + click to select a range
a73a507
add routes
rushatgabhane May 3, 2024
e266c3e
add screen map
rushatgabhane May 3, 2024
102d949
add navigation map
rushatgabhane May 3, 2024
37df48a
link to bill status page and add default page
rushatgabhane May 3, 2024
7562b7f
add selection screen
rushatgabhane May 3, 2024
189c4f4
Add sync functionality in Xero connection
ShridharGoel May 3, 2024
fe9b69b
add selection screen
rushatgabhane May 3, 2024
a362c38
Update
ShridharGoel May 3, 2024
d7fc0c3
Update PolicyAccountingPage.tsx
ShridharGoel May 3, 2024
ff31b53
Update PolicyAccountingPage.tsx
ShridharGoel May 3, 2024
1ddad04
Add new command and JSdoc
ShridharGoel May 8, 2024
e04f688
Merge branch '41320' of https://github.com/ShridharGoel/ExpensifyApp …
ShridharGoel May 8, 2024
a73430f
Merge branch 'xero-merge-freeze' of https://github.com/Expensify/App …
ShridharGoel May 9, 2024
b6fa193
Update
ShridharGoel May 9, 2024
b0032de
fix merge
rushatgabhane May 10, 2024
6614242
unlink from advanced
rushatgabhane May 10, 2024
fcd7545
link export page
rushatgabhane May 10, 2024
dfe0452
fix merge
rushatgabhane May 10, 2024
6ad88e3
update route to export
rushatgabhane May 10, 2024
db7f63e
add lang
rushatgabhane May 10, 2024
c4fcf6d
fix nav
rushatgabhane May 10, 2024
d75c756
use updated routes and lang
rushatgabhane May 10, 2024
6de73ea
update status name
rushatgabhane May 10, 2024
19b1c8c
change order
rushatgabhane May 10, 2024
c7eb413
change order
rushatgabhane May 10, 2024
2380eb7
handle undefined
rushatgabhane May 10, 2024
87bae9f
Merge branch 'Expensify:main' into bill-status
rushatgabhane May 10, 2024
4d1a0e0
Update src/pages/workspace/accounting/xero/export/XeroPurchaseBillSta…
rushatgabhane May 10, 2024
bf670dc
Update src/SCREENS.ts
rushatgabhane May 10, 2024
1fce4d0
add offline support for XeroOrganizationConfiguration
SzymczakJ May 10, 2024
6df24b4
Merge branch 'main' into @szymczak/handle-offline-state-xero-organiza…
SzymczakJ May 13, 2024
1cf8b94
fix PR comments
SzymczakJ May 13, 2024
0cea6dd
fix XeroOrganization bug
SzymczakJ May 13, 2024
e0b49d7
use ConnectionLayout in XeroOrganizationConfigurationPage
SzymczakJ May 13, 2024
5f9585d
Merge branch 'main' into @szymczak/handle-offline-state-xero-organiza…
SzymczakJ May 14, 2024
7d8a0d1
Merge branch 'main' of github.com:rushatgabhane/exfy into bill-status
rushatgabhane May 14, 2024
8e391e0
fix padding on XeroOrganizationList
SzymczakJ May 14, 2024
77f0cff
fix safe area insets
SzymczakJ May 14, 2024
f19f3ed
Update
ShridharGoel May 14, 2024
1a4bb31
Updates
ShridharGoel May 14, 2024
2dbef02
Merge branch 'main' into @szymczak/handle-offline-state-xero-organiza…
SzymczakJ May 15, 2024
b5e0200
fix typescript errors
SzymczakJ May 15, 2024
ef91552
make taxes read only
SzymczakJ May 15, 2024
191b805
Update src/languages/es.ts
rushatgabhane May 15, 2024
95b787f
Update src/languages/es.ts
rushatgabhane May 15, 2024
2c7c80f
Update src/languages/es.ts
rushatgabhane May 15, 2024
68b7551
add error message in case of sync failure
SzymczakJ May 16, 2024
33aeffc
Merge branch 'main' into 41320
ShridharGoel May 16, 2024
e2f0a62
Fix lint
ShridharGoel May 16, 2024
c010b12
fix: remove slash from url
mananjadhav May 16, 2024
1cc1056
fix: route path
mananjadhav May 17, 2024
c88c564
Merge pull request #41562 from ShridharGoel/41320
lakchote May 17, 2024
55b0597
Merge pull request #41983 from software-mansion-labs/@szymczak/handle…
lakchote May 17, 2024
fb31f37
Merge pull request #42324 from mananjadhav/fix-xero-customers-console…
lakchote May 17, 2024
36ac388
Merge pull request #41559 from rushatgabhane/bill-status
lakchote May 17, 2024
6d71b0e
fix: change selected text
mananjadhav May 17, 2024
4115f7e
fix: added padding
mananjadhav May 17, 2024
73524a9
fix: default selection
mananjadhav May 17, 2024
636cbf1
hide policy guides as exporters
rushatgabhane May 17, 2024
f74e05f
Merge branch 'xero-merge-freeze' of https://github.com/Expensify/App …
mananjadhav May 17, 2024
acbeb1b
fix: select first item in list
mananjadhav May 17, 2024
89a68ba
fix: default select first item
mananjadhav May 17, 2024
77cedd2
fix: default select first item
mananjadhav May 17, 2024
70e1945
Console error shows up when opening Preferred exporter
tienifr May 20, 2024
f521fa5
Merge pull request #42347 from mananjadhav/xero-tracking-categories-f…
lakchote May 20, 2024
08b321a
Merge branch 'main' into @szymczak/error-message-sync-failure
SzymczakJ May 20, 2024
ecdeaf4
add translations
SzymczakJ May 20, 2024
e87d711
delete unrelated changes
SzymczakJ May 20, 2024
3dfd53b
Merge branch 'main' into @szymczak/make-taxes-read-only-when-connected
SzymczakJ May 20, 2024
27972bf
fix PR comments
SzymczakJ May 20, 2024
de93763
Merge remote-tracking branch 'expensify-real/xero-merge-freeze' into …
SzymczakJ May 20, 2024
811e35f
Merge remote-tracking branch 'expensify-real/xero-merge-freeze' into …
SzymczakJ May 20, 2024
9665c0f
Fix: QBO briefly shows when syncing Xero
hungvu193 May 20, 2024
1dde849
fix prettier
hungvu193 May 20, 2024
c444695
update Spanish translation
hungvu193 May 20, 2024
ed18ae8
Merge pull request #42346 from rushatgabhane/xero-exporter
lakchote May 20, 2024
ade85e0
Merge pull request #42372 from tienifr/fix/42195
lakchote May 20, 2024
ef5d777
fix connections lastSync unsafe access
SzymczakJ May 20, 2024
1f71c18
Merge branch 'xero-merge-freeze' of https://github.com/Expensify/App …
mananjadhav May 20, 2024
4059db3
Merge pull request #42192 from software-mansion-labs/@szymczak/make-t…
lakchote May 21, 2024
9d57ceb
Merge pull request #42383 from hungvu193/fix-42376
lakchote May 21, 2024
a8ee9fe
Merge branch 'xero-merge-freeze' of https://github.com/Expensify/App …
mananjadhav May 21, 2024
f3cbb21
refactor: move bank selection to utils
mananjadhav May 21, 2024
e143cfb
refactor: replace with utils
mananjadhav May 21, 2024
92cd9c6
refactor: replace with utils
mananjadhav May 21, 2024
a66f8cb
refactor: lint fixes
mananjadhav May 21, 2024
1342b73
Merge pull request #42360 from mananjadhav/xero-default-select-options
lakchote May 21, 2024
c960fa3
fix taxes not blocking on more features page
SzymczakJ May 22, 2024
bff08c2
Update category integration name
hungvu193 May 22, 2024
b40eaae
disable taxes if previously enabled on disconnect
lakchote May 22, 2024
a5322ab
rm header overflow menu
rushatgabhane May 22, 2024
0b3ecb1
rm header overflow menu
rushatgabhane May 22, 2024
f47f063
hide 3dot
rushatgabhane May 22, 2024
96b58cb
hide 3dot
rushatgabhane May 22, 2024
a3e4f70
undo all beta
rushatgabhane May 22, 2024
082b792
Merge pull request #42462 from hungvu193/fix-42458
lakchote May 22, 2024
aff888d
change logic
lakchote May 22, 2024
83c3a6c
remove taxes in lhn when connecting to QBO
lakchote May 22, 2024
539c063
fix: replace connection name
mananjadhav May 22, 2024
0dea1e1
feat: added content for taxes page
mananjadhav May 22, 2024
d46d6f6
fix: update translate path
mananjadhav May 22, 2024
3cb3179
feat: footer text for more features
mananjadhav May 22, 2024
3bf7309
feat: added content for more features
mananjadhav May 22, 2024
9cb30ef
fix: add margin
mananjadhav May 22, 2024
83f4c84
refactor: prettier fix
mananjadhav May 22, 2024
6204f36
fix: update styling
mananjadhav May 22, 2024
78da569
fix PR comments
SzymczakJ May 23, 2024
4543955
Merge pull request #42461 from software-mansion-labs/@szymczak/fix-ta…
lakchote May 23, 2024
351ccdc
Merge pull request #42468 from rushatgabhane/xero-rm-3-dot
lakchote May 23, 2024
b222597
Merge pull request #42467 from Expensify/lucien/xero-fix-disconnect-t…
techievivek May 23, 2024
5979a35
change translations
SzymczakJ May 23, 2024
95f1ed9
Merge pull request #42315 from Expensify/hayata-call-api-for-multi-le…
arosiclair May 23, 2024
1ebaeed
Merge pull request #42149 from s77rt/multi-level-tags-fix-not-found
May 20, 2024
86bbf4b
make translations dynamic for xero tracking categories
lakchote May 24, 2024
ff704d1
use only one route for tracking category mapping
lakchote May 24, 2024
9e860f3
use one screen for the tracking category mapping
lakchote May 24, 2024
1b8901a
handle navigation for the new page for tracking category
lakchote May 24, 2024
c837440
add new types for tracking category mapping
lakchote May 24, 2024
2256423
map the tracking category page to rhp
lakchote May 24, 2024
bb8c24e
create function to get tracking categories
lakchote May 24, 2024
5b797b6
modify component for dynamic translations
lakchote May 24, 2024
ed4c53f
make the handling of tracking categories dynamic
lakchote May 24, 2024
0371ac1
fix style
lakchote May 24, 2024
c48295c
delete specific tracking categories pages
lakchote May 24, 2024
be80134
make the handling of tracking categories dynamic
lakchote May 24, 2024
7b816a8
Merge branch 'main' into xero-merge-freeze
lakchote May 24, 2024
14d6550
Merge branch 'xero-merge-freeze' of https://github.com/Expensify/App …
mananjadhav May 24, 2024
5d82268
fix: revert in-line text
mananjadhav May 24, 2024
42bfc1b
fix: revert in-line text
mananjadhav May 24, 2024
72dbd0a
fix: added period in all content
mananjadhav May 25, 2024
3f7b21b
chore: resolve merge issues
mananjadhav May 25, 2024
bbb7ea2
chore: resolve merge issues
mananjadhav May 25, 2024
d211850
fix: use var
mananjadhav May 25, 2024
11d853a
chore: resolve merge issues
mananjadhav May 25, 2024
57727ac
style: lint fixes
mananjadhav May 25, 2024
26680ab
feat: added shouldBeBlocked to ConnectionLayout
mananjadhav May 25, 2024
1782985
fix: added checks for connection import pages
mananjadhav May 25, 2024
cd23f1c
fix: added block check for xero pages
mananjadhav May 26, 2024
bfcba51
style: lint fixes
mananjadhav May 26, 2024
e3e42b7
fix lint
lakchote May 27, 2024
bc3c185
refactor: added connection name
mananjadhav May 27, 2024
a786d30
refactor: use connection name
mananjadhav May 27, 2024
c77d660
refactor: use connection name
mananjadhav May 27, 2024
3430cea
refactor: use connection layout for import page
mananjadhav May 27, 2024
11923a4
style: lint fixes
mananjadhav May 27, 2024
7ba4125
fix: added connection name to pending pages
mananjadhav May 27, 2024
063d8d1
Merge pull request #42619 from mananjadhav/xero-access-block
lakchote May 27, 2024
5a8efbf
Merge branch 'xero-merge-freeze' into lucien/fix-xero-tracking-catego…
lakchote May 27, 2024
72ce91a
fix lint
lakchote May 27, 2024
e0bb804
fix typo
lakchote May 27, 2024
52216fb
Merge branch 'xero-merge-freeze' into @szymczak/error-message-sync-fa…
SzymczakJ May 27, 2024
4df274a
encode category name
lakchote May 27, 2024
0b94f59
decode category name
lakchote May 27, 2024
25db9b7
fix style
SzymczakJ May 27, 2024
b779dff
fix styles
SzymczakJ May 27, 2024
3d30445
fix isSelected
lakchote May 27, 2024
7a559df
use already decoded category name
lakchote May 27, 2024
a8e48c9
fix lint
lakchote May 27, 2024
86f509f
fix lint errors
SzymczakJ May 27, 2024
adddbcd
fix type error
SzymczakJ May 27, 2024
a082fc4
feat: add lock icon for switch
mananjadhav May 27, 2024
e68aba9
feat: state modal
mananjadhav May 27, 2024
1e6dc10
feat: added features modal
mananjadhav May 27, 2024
4ed381b
refactor: modal state
mananjadhav May 27, 2024
8033a8c
refactor: language format
mananjadhav May 27, 2024
9dab55a
refactor: language and connection name
mananjadhav May 27, 2024
b4f8164
style: prettier fixes
mananjadhav May 27, 2024
1427992
Merge pull request #42593 from Expensify/lucien/fix-xero-tracking-cat…
lakchote May 28, 2024
4ce01d2
fix PR comments
SzymczakJ May 28, 2024
c857d39
Merge branch 'xero-merge-freeze' of https://github.com/Expensify/App …
mananjadhav May 28, 2024
9ebe047
feat: added es translations
mananjadhav May 28, 2024
835e953
refactor: remove title
mananjadhav May 28, 2024
369f92e
fix: added dependency
mananjadhav May 28, 2024
90f0c0f
style: lint fixes
mananjadhav May 28, 2024
a38c2ee
fix: update copy
mananjadhav May 28, 2024
c2c741b
refactor: remove unused var
mananjadhav May 28, 2024
0c0b5d1
fix: spanish copy
mananjadhav May 28, 2024
59770a4
style: lint fixes
mananjadhav May 28, 2024
a2ffb3b
fix: spanish copy
mananjadhav May 28, 2024
e610704
fix: captilize
mananjadhav May 28, 2024
17e6948
Merge pull request #42662 from mananjadhav/xero-more-features-text
lakchote May 28, 2024
6604b8f
Merge pull request #42307 from software-mansion-labs/@szymczak/error-…
lakchote May 28, 2024
1330fe2
Merge branch 'main' into xero-merge-freeze
lakchote May 29, 2024
a938513
fix lint
lakchote May 29, 2024
4e353e3
fix: remove unused translations
mananjadhav May 29, 2024
36f728a
fix: header for smallscreen width
mananjadhav May 29, 2024
7151030
fix: show text in empty state
mananjadhav May 29, 2024
ab8563b
fix: boolean check
mananjadhav May 29, 2024
ed9b9a9
refactor: simplify condition
mananjadhav May 29, 2024
27b69f0
Merge pull request #42487 from mananjadhav/xero-educational-messages
lakchote May 30, 2024
6f5d219
Merge branch 'main' into xero-merge-freeze
lakchote May 30, 2024
a96752c
fix lint
lakchote May 30, 2024
990ab4f
fix backtick
lakchote May 30, 2024
ef55d3a
Merge branch 'main' into xero-merge-freeze
lakchote May 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1305,12 +1305,13 @@ const CONST = {
SYNC: 'sync',
ENABLE_NEW_CATEGORIES: 'enableNewCategories',
EXPORT: 'export',
TENANT_ID: 'tenantID',
IMPORT_CUSTOMERS: 'importCustomers',
IMPORT_TAX_RATES: 'importTaxRates',
INVOICE_STATUS: {
AWAITING_PAYMENT: 'AWT_PAYMENT',
DRAFT: 'DRAFT',
AWAITING_APPROVAL: 'AWT_APPROVAL',
AWAITING_PAYMENT: 'AWT_PAYMENT',
},
IMPORT_TRACKING_CATEGORIES: 'importTrackingCategories',
MAPPINGS: 'mappings',
Expand Down Expand Up @@ -1778,7 +1779,8 @@ const CONST = {
XERO: 'xero',
},
SYNC_STAGE_NAME: {
STARTING_IMPORT: 'startingImport',
STARTING_IMPORT_QBO: 'startingImportQBO',
STARTING_IMPORT_XERO: 'startingImportXero',
QBO_IMPORT_MAIN: 'quickbooksOnlineImportMain',
QBO_IMPORT_CUSTOMERS: 'quickbooksOnlineImportCustomers',
QBO_IMPORT_EMPLOYEES: 'quickbooksOnlineImportEmployees',
Expand Down
31 changes: 16 additions & 15 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -689,12 +689,12 @@ const ROUTES = {
getRoute: (policyID: string, orderWeight: number) => `settings/workspaces/${policyID}/tags/${orderWeight}/edit` as const,
},
WORKSPACE_TAG_EDIT: {
route: 'settings/workspace/:policyID/tag/:tagName/edit',
getRoute: (policyID: string, tagName: string) => `settings/workspace/${policyID}/tag/${encodeURIComponent(tagName)}/edit` as const,
route: 'settings/workspaces/:policyID/tag/:orderWeight/:tagName/edit',
getRoute: (policyID: string, orderWeight: number, tagName: string) => `settings/workspaces/${policyID}/tag/${orderWeight}/${encodeURIComponent(tagName)}/edit` as const,
},
WORKSPACE_TAG_SETTINGS: {
route: 'settings/workspaces/:policyID/tag/:tagName',
getRoute: (policyID: string, tagName: string) => `settings/workspaces/${policyID}/tag/${encodeURIComponent(tagName)}` as const,
route: 'settings/workspaces/:policyID/tag/:orderWeight/:tagName',
getRoute: (policyID: string, orderWeight: number, tagName: string) => `settings/workspaces/${policyID}/tag/${orderWeight}/${encodeURIComponent(tagName)}` as const,
},
WORKSPACE_TAG_LIST_VIEW: {
route: 'settings/workspaces/:policyID/tag-list/:orderWeight',
Expand Down Expand Up @@ -812,17 +812,14 @@ const ROUTES = {
route: 'settings/workspaces/:policyID/accounting/xero/import/tracking-categories',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/import/tracking-categories` as const,
},
POLICY_ACCOUNTING_XERO_TRACKING_CATEGORIES_MAP_COST_CENTERS: {
route: 'settings/workspaces/:policyID/accounting/xero/import/tracking-categories/cost-centers',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/import/tracking-categories/cost-centers` as const,
},
POLICY_ACCOUNTING_XERO_TRACKING_CATEGORIES_MAP_REGION: {
route: 'settings/workspaces/:policyID/accounting/xero/import/tracking-categories/region',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/import/tracking-categories/region` as const,
POLICY_ACCOUNTING_XERO_TRACKING_CATEGORIES_MAP: {
route: 'settings/workspaces/:policyID/accounting/xero/import/tracking-categories/mapping/:categoryId/:categoryName',
getRoute: (policyID: string, categoryId: string, categoryName: string) =>
`settings/workspaces/${policyID}/accounting/xero/import/tracking-categories/mapping/${categoryId}/${encodeURIComponent(categoryName)}` as const,
},
POLICY_ACCOUNTING_XERO_CUSTOMER: {
route: '/settings/workspaces/:policyID/accounting/xero/import/customers',
getRoute: (policyID: string) => `/settings/workspaces/${policyID}/accounting/xero/import/customers` as const,
route: 'settings/workspaces/:policyID/accounting/xero/import/customers',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/import/customers` as const,
},
POLICY_ACCOUNTING_XERO_TAXES: {
route: 'settings/workspaces/:policyID/accounting/xero/import/taxes',
Expand All @@ -833,8 +830,8 @@ const ROUTES = {
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,
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',
Expand All @@ -848,6 +845,10 @@ const ROUTES = {
route: 'settings/workspaces/:policyID/accounting/xero/advanced',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/advanced` as const,
},
POLICY_ACCOUNTING_XERO_BILL_STATUS_SELECTOR: {
route: 'settings/workspaces/:policyID/accounting/xero/export/purchase-bill-status-selector',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/export/purchase-bill-status-selector` as const,
},
POLICY_ACCOUNTING_XERO_INVOICE_SELECTOR: {
route: 'settings/workspaces/:policyID/accounting/xero/advanced/invoice-account-selector',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/advanced/invoice-account-selector` as const,
Expand Down
4 changes: 2 additions & 2 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ const SCREENS = {
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_MAP_TRACKING_CATEGORY: 'Policy_Accounting_Xero_Map_Tracking_Category',
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_BILL_STATUS_SELECTOR: 'Policy_Accounting_Xero_Export_Bill_Status_Selector',
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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import useThemeStyles from '@hooks/useThemeStyles';
import {removePolicyConnection} from '@libs/actions/connections';
import {getQuickBooksOnlineSetupLink} from '@libs/actions/connections/QuickBooksOnline';
import getQuickBooksOnlineSetupLink from '@libs/actions/connections/QuickBooksOnline';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Session} from '@src/types/onyx';
Expand Down
5 changes: 4 additions & 1 deletion src/components/ConnectToQuickbooksOnlineButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import useThemeStyles from '@hooks/useThemeStyles';
import {removePolicyConnection} from '@libs/actions/connections';
import {getQuickBooksOnlineSetupLink} from '@libs/actions/connections/QuickBooksOnline';
import getQuickBooksOnlineSetupLink from '@libs/actions/connections/QuickBooksOnline';
import * as Link from '@userActions/Link';
import * as PolicyAction from '@userActions/Policy/Policy';
import CONST from '@src/CONST';
import type {ConnectToQuickbooksOnlineButtonProps} from './types';

Expand All @@ -27,6 +28,8 @@ function ConnectToQuickbooksOnlineButton({policyID, shouldDisconnectIntegrationB
setIsDisconnectModalOpen(true);
return;
}
// Since QBO doesn't support Taxes, we should disable them from the LHN when connecting to QBO
PolicyAction.enablePolicyTaxes(policyID, false);
Link.openLink(getQuickBooksOnlineSetupLink(policyID), environmentURL);
}}
isDisabled={isOffline}
Expand Down
43 changes: 33 additions & 10 deletions src/components/ConnectionLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import {isEmpty} from 'lodash';
import React, {useMemo} from 'react';
import type {StyleProp, TextStyle, ViewStyle} from 'react-native';
import {View} from 'react-native';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@libs/Navigation/Navigation';
import * as PolicyUtils from '@libs/PolicyUtils';
import type {AccessVariant} from '@pages/workspace/AccessOrNotFoundWrapper';
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper';
import type {TranslationPaths} from '@src/languages/types';
import type {PolicyFeatureName} from '@src/types/onyx/Policy';
import type {ConnectionName, PolicyFeatureName} from '@src/types/onyx/Policy';
import HeaderWithBackButton from './HeaderWithBackButton';
import ScreenWrapper from './ScreenWrapper';
import ScrollView from './ScrollView';
Expand All @@ -17,16 +19,16 @@ type ConnectionLayoutProps = {
/** Used to set the testID for tests */
displayName: string;

/** Header title for the connection */
headerTitle: TranslationPaths;
/** Header title to be translated for the connection component */
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 to be translated for the connection component */
title?: TranslationPaths;

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

/** Whether to include safe area padding bottom or not */
shouldIncludeSafeAreaPaddingBottom?: boolean;

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

/** Used for dynamic header title translation with parameters */
headerTitleAlreadyTranslated?: string;

/** Used for dynamic title translation with parameters */
titleAlreadyTranslated?: string;

/** Name of the current connection */
connectionName: ConnectionName;
};

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

function ConnectionLayoutContent({title, titleStyle, children}: ConnectionLayoutContentProps) {
function ConnectionLayoutContent({title, titleStyle, children, titleAlreadyTranslated}: ConnectionLayoutContentProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
return (
<>
{title && <Text style={[styles.pb5, titleStyle]}>{translate(title)}</Text>}
{title && <Text style={[styles.pb5, titleStyle]}>{titleAlreadyTranslated ?? translate(title)}</Text>}
{children}
</>
);
Expand All @@ -72,35 +86,44 @@ function ConnectionLayout({
featureName,
contentContainerStyle,
titleStyle,
shouldIncludeSafeAreaPaddingBottom,
connectionName,
shouldUseScrollView = true,
headerTitleAlreadyTranslated,
titleAlreadyTranslated,
}: ConnectionLayoutProps) {
const {translate} = useLocalize();

const policy = PolicyUtils.getPolicy(policyID ?? '');
const isConnectionEmpty = isEmpty(policy.connections?.[connectionName]);

const renderSelectionContent = useMemo(
() => (
<ConnectionLayoutContent
title={title}
titleStyle={titleStyle}
titleAlreadyTranslated={titleAlreadyTranslated}
>
{children}
</ConnectionLayoutContent>
),
[title, titleStyle, children],
[title, titleStyle, children, titleAlreadyTranslated],
);

return (
<AccessOrNotFoundWrapper
policyID={policyID}
accessVariants={accessVariants}
featureName={featureName}
shouldBeBlocked={isConnectionEmpty}
>
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
includeSafeAreaPaddingBottom={!!shouldIncludeSafeAreaPaddingBottom}
shouldEnableMaxHeight
testID={displayName}
>
<HeaderWithBackButton
title={translate(headerTitle)}
title={headerTitleAlreadyTranslated ?? (headerTitle ? translate(headerTitle as TranslationPaths) : '')}
subtitle={headerSubtitle}
onBackButtonPress={() => Navigation.goBack()}
/>
Expand Down
12 changes: 10 additions & 2 deletions src/components/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,15 @@ type MenuItemBaseProps = {
/** Error to display at the bottom of the component */
errorText?: MaybePhraseKey;

/** Any additional styles to pass to error text. */
errorTextStyle?: StyleProp<ViewStyle>;

/** Hint to display at the bottom of the component */
hintText?: MaybePhraseKey;

/** Should the error text red dot indicator be shown */
shouldShowRedDotIndicator?: boolean;

/** A boolean flag that gives the icon a green fill if true */
success?: boolean;

Expand Down Expand Up @@ -308,6 +314,8 @@ function MenuItem(
helperText,
helperTextStyle,
errorText,
errorTextStyle,
shouldShowRedDotIndicator,
hintText,
success = false,
focused = false,
Expand Down Expand Up @@ -684,9 +692,9 @@ function MenuItem(
{!!errorText && (
<FormHelpMessage
isError
shouldShowRedDotIndicator={false}
shouldShowRedDotIndicator={!!shouldShowRedDotIndicator}
message={errorText}
style={styles.menuItemError}
style={[styles.menuItemError, errorTextStyle]}
/>
)}
{!!hintText && (
Expand Down
14 changes: 12 additions & 2 deletions src/components/SelectionScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {isEmpty} from 'lodash';
import React from 'react';
import useLocalize from '@hooks/useLocalize';
import * as PolicyUtils from '@libs/PolicyUtils';
import type {AccessVariant} from '@pages/workspace/AccessOrNotFoundWrapper';
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper';
import type {TranslationPaths} from '@src/languages/types';
import type {PolicyFeatureName} from '@src/types/onyx/Policy';
import type {ConnectionName, PolicyFeatureName} from '@src/types/onyx/Policy';
import HeaderWithBackButton from './HeaderWithBackButton';
import ScreenWrapper from './ScreenWrapper';
import SelectionList from './SelectionList';
Expand Down Expand Up @@ -52,6 +54,9 @@ type SelectionScreenProps = {

/** Whether or not to block user from accessing the page */
shouldBeBlocked?: boolean;

/** Name of the current connection */
connectionName: ConnectionName;
};

function SelectionScreen({
Expand All @@ -67,14 +72,19 @@ function SelectionScreen({
accessVariants,
featureName,
shouldBeBlocked,
connectionName,
}: SelectionScreenProps) {
const {translate} = useLocalize();

const policy = PolicyUtils.getPolicy(policyID ?? '');
const isConnectionEmpty = isEmpty(policy.connections?.[connectionName]);

return (
<AccessOrNotFoundWrapper
policyID={policyID}
accessVariants={accessVariants}
featureName={featureName}
shouldBeBlocked={shouldBeBlocked}
shouldBeBlocked={isConnectionEmpty || shouldBeBlocked}
>
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
Expand Down
7 changes: 5 additions & 2 deletions src/components/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@ type SwitchProps = {

/** Whether the switch is disabled */
disabled?: boolean;

/** Whether to show the lock icon even if the switch is enabled */
showLockIcon?: boolean;
};

const OFFSET_X = {
OFF: 0,
ON: 20,
};

function Switch({isOn, onToggle, accessibilityLabel, disabled}: SwitchProps) {
function Switch({isOn, onToggle, accessibilityLabel, disabled, showLockIcon}: SwitchProps) {
const styles = useThemeStyles();
const offsetX = useRef(new Animated.Value(isOn ? OFFSET_X.ON : OFFSET_X.OFF));
const theme = useTheme();
Expand Down Expand Up @@ -60,7 +63,7 @@ function Switch({isOn, onToggle, accessibilityLabel, disabled}: SwitchProps) {
pressDimmingValue={0.8}
>
<Animated.View style={[styles.switchThumb, styles.switchThumbTransformation(offsetX.current)]}>
{disabled && (
{(Boolean(disabled) || Boolean(showLockIcon)) && (
<Icon
src={Expensicons.Lock}
fill={isOn ? theme.text : theme.icon}
Expand Down
Loading
Loading