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

Fix account type name constants #41155

Merged
merged 44 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d6739e0
fix: const strings
Apr 27, 2024
46c3531
Revert "fix: const strings"
Apr 27, 2024
7f47efe
fix: string values for the out of pocket expense account options
Apr 27, 2024
98e6461
refactor: const object name
Apr 27, 2024
9427bdb
fix: string values for the company card export account options
Apr 27, 2024
495ecad
refactor: rename const object
Apr 27, 2024
35ebb51
refactor: rename const object
Apr 27, 2024
b8cdac6
fix: map the account type string value to translation key
Apr 27, 2024
0ab5b8b
Merge branch 'main' into hayata-fix-account-type-name-constants
Apr 29, 2024
897e4d8
fix: translation key
Apr 29, 2024
a6cd09d
fix: translation key
Apr 29, 2024
3060112
refactor: rename the translation keys for the type of accounts used t…
Apr 29, 2024
f936dab
fix: remove the translation key mapping
Apr 29, 2024
4d5b99b
fix: use underscore formatted account type name
Apr 29, 2024
2338c9a
fix: change translation key to match the backend account type name & …
Apr 29, 2024
3909feb
fix: the const name
Apr 29, 2024
87693a9
fix: spelling
Apr 29, 2024
05e1019
fix: const name
Apr 29, 2024
47f72aa
fix: translation key that starts with underscore
Apr 29, 2024
68ae452
fix: translation keys
Apr 29, 2024
838a613
fix: remove translation key mapping
Apr 29, 2024
785b8e0
fix: use values from const declarations
Apr 30, 2024
bf9c8ee
fix: use const values for bill
Apr 30, 2024
93b78d2
refactor: organize translation
Apr 30, 2024
99f1fd4
refactor: organize translation keys
Apr 30, 2024
84eb6ee
fix: translation path
Apr 30, 2024
8766e92
fix: translation path
Apr 30, 2024
0ba26a8
fix: translation key path
Apr 30, 2024
c7382bd
fix: translation path
Apr 30, 2024
088ac3d
fix: translation path error
Apr 30, 2024
1955c29
fix: translation key
Apr 30, 2024
e497980
chore: put the translation to the original place
Apr 30, 2024
86b60f7
Merge branch 'main' into hayata-fix-account-type-name-constants
Apr 30, 2024
e328e0f
fix: wrong translation key
Apr 30, 2024
91b078e
Merge branch 'main' into hayata-fix-account-type-name-constants
May 1, 2024
6abfbd2
fix: translation
May 1, 2024
d0029f6
chore: translation key
May 1, 2024
244be92
bring account related translation key under the same property
May 1, 2024
e1d7df2
fix: remove old translation key
May 1, 2024
b90834a
fix: remove old translation key
May 1, 2024
ca5420d
refactor: rename the translation key
May 1, 2024
fc6d2a0
fix: rename outdated translation key
May 1, 2024
4a13595
Merge branch 'main' into hayata-fix-account-type-name-constants
May 1, 2024
8dba03d
Merge branch 'main' into hayata-fix-account-type-name-constants
May 1, 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
14 changes: 7 additions & 7 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1261,10 +1261,10 @@ const CONST = {
COLLECTION_ACCOUNT_ID: 'collectionAccountID',
},

QUICKBOOKS_EXPORT_ENTITY: {
VENDOR_BILL: 'vendorBill',
QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE: {
VENDOR_BILL: 'vendor_bill',
hayata-suenaga marked this conversation as resolved.
Show resolved Hide resolved
CHECK: 'check',
JOURNAL_ENTRY: 'journalEntry',
JOURNAL_ENTRY: 'jouranl_entry',
},

ACCOUNT_ID: {
Expand Down Expand Up @@ -4675,10 +4675,10 @@ const CONST = {
SUBMITTED_DATA: 'submittedData',
},

QUICKBOOKS_EXPORT_COMPANY_CARD: {
CREDIT_CARD: 'creditCard',
DEBIT_CARD: 'debitCard',
VENDOR_BILL: 'vendorBill',
QUICKBOOKS_EXPORT_COMPANY_CARD_ACCOUNT_TYPE: {
CREDIT_CARD: 'credit_card',
DEBIT_CARD: 'debit_card',
VENDOR_BILL: 'vendor_bill',
},

SESSION_STORAGE_KEYS: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@ import ToggleSettingOptionRow from '@pages/workspace/workflows/ToggleSettingsOpt
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';

const AccountTypeTranslationKeyMapping = {
[CONST.QUICKBOOKS_EXPORT_COMPANY_CARD_ACCOUNT_TYPE.VENDOR_BILL]: 'vendorBill',
[CONST.QUICKBOOKS_EXPORT_COMPANY_CARD_ACCOUNT_TYPE.CREDIT_CARD]: 'creditCard',
[CONST.QUICKBOOKS_EXPORT_COMPANY_CARD_ACCOUNT_TYPE.DEBIT_CARD]: 'debitCard',
} as const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this to avoid adding keys with underscore in en/es.ts? so we use debitCard instead of debit_card?
If that is the reason, are we sure we prefer this extra layer? it looks like it is messing up the types too. Shouldn't we just add debit_card in en/es.ts instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ES Lint is going to complain about it. The type issue you were seeing is from another page for which I forgot to create the mapping. I just pushed a commit to fix it.

But let me know if you still prefer introducing a key with underscores in the es/en files 😄

Copy link
Contributor

@aldo-expensify aldo-expensify Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe if you use constants like this:

App/src/languages/en.ts

Lines 2907 to 2911 in 0ab5b8b

reasons: {
[CONST.EXIT_SURVEY.REASONS.FEATURE_NOT_AVAILABLE]: "I need a feature that's only available in Expensify Classic.",
[CONST.EXIT_SURVEY.REASONS.DONT_UNDERSTAND]: "I don't understand how to use New Expensify.",
[CONST.EXIT_SURVEY.REASONS.PREFER_CLASSIC]: 'I understand how to use New Expensify, but I prefer Expensify Classic.',
},

eslint won't complain? I think it is better to now have this extra layer that we have to keep up to date. Something like this:

image


function QuickbooksCompanyCardExpenseAccountPage({policy}: WithPolicyConnectionsProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
const policyID = policy?.id ?? '';
const {exportCompanyCardAccount, exportAccountPayable, autoCreateVendor, errorFields, pendingFields, exportCompanyCard} = policy?.connections?.quickbooksOnline?.config ?? {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB: I don't think exportCompanyCardAccount, exportAccountPayable or exportCompanyCard really exists in the backend

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these were also added by Nikolay in another PR 😨

const isVendorSelected = exportCompanyCard === CONST.QUICKBOOKS_EXPORT_COMPANY_CARD.VENDOR_BILL;
const isVendorSelected = exportCompanyCard === CONST.QUICKBOOKS_EXPORT_COMPANY_CARD_ACCOUNT_TYPE.VENDOR_BILL;
return (
<AdminPolicyAccessOrNotFoundWrapper policyID={policyID}>
<FeatureEnabledAccessOrNotFoundWrapper
Expand All @@ -38,7 +44,7 @@ function QuickbooksCompanyCardExpenseAccountPage({policy}: WithPolicyConnections
<Text style={[styles.ph5, styles.pb5]}>{translate('workspace.qbo.exportCompanyCardsDescription')}</Text>
<OfflineWithFeedback pendingAction={pendingFields?.exportCompanyCard}>
<MenuItemWithTopDescription
title={exportCompanyCard ? translate(`workspace.qbo.${exportCompanyCard}`) : undefined}
title={exportCompanyCard ? translate(`workspace.qbo.${AccountTypeTranslationKeyMapping[exportCompanyCard]}`) : undefined}
description={translate('workspace.qbo.exportCompany')}
error={errorFields?.exportCompanyCard ? translate('common.genericErrorMessage') : undefined}
onPress={() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_SELECT.getRoute(policyID))}
Expand All @@ -47,7 +53,9 @@ function QuickbooksCompanyCardExpenseAccountPage({policy}: WithPolicyConnections
/>
</OfflineWithFeedback>
{!!exportCompanyCard && (
<Text style={[styles.ph5, styles.mutedNormalTextLabel, styles.pt1, styles.pb2]}>{translate(`workspace.qbo.${exportCompanyCard}Description`)}</Text>
<Text style={[styles.ph5, styles.mutedNormalTextLabel, styles.pt1, styles.pb2]}>
{translate(`workspace.qbo.${AccountTypeTranslationKeyMapping[exportCompanyCard]}Description`)}
</Text>
)}
{isVendorSelected && (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';

type CardListItem = ListItem & {
value: ValueOf<typeof CONST.QUICKBOOKS_EXPORT_COMPANY_CARD>;
value: ValueOf<typeof CONST.QUICKBOOKS_EXPORT_COMPANY_CARD_ACCOUNT_TYPE>;
};
type CardsSection = SectionListData<CardListItem, Section<CardListItem>>;
type Card = {name: string; id: ValueOf<typeof CONST.QUICKBOOKS_EXPORT_COMPANY_CARD>};
type Card = {name: string; id: ValueOf<typeof CONST.QUICKBOOKS_EXPORT_COMPANY_CARD_ACCOUNT_TYPE>};

function QuickbooksCompanyCardExpenseAccountSelectCardPage({policy}: WithPolicyConnectionsProps) {
const {translate} = useLocalize();
Expand All @@ -36,15 +36,15 @@ function QuickbooksCompanyCardExpenseAccountSelectCardPage({policy}: WithPolicyC
() => [
{
name: translate(`workspace.qbo.creditCard`),
id: CONST.QUICKBOOKS_EXPORT_COMPANY_CARD.CREDIT_CARD,
id: CONST.QUICKBOOKS_EXPORT_COMPANY_CARD_ACCOUNT_TYPE.CREDIT_CARD,
},
{
name: translate(`workspace.qbo.debitCard`),
id: CONST.QUICKBOOKS_EXPORT_COMPANY_CARD.DEBIT_CARD,
id: CONST.QUICKBOOKS_EXPORT_COMPANY_CARD_ACCOUNT_TYPE.DEBIT_CARD,
},
{
name: translate(`workspace.qbo.vendorBill`),
id: CONST.QUICKBOOKS_EXPORT_COMPANY_CARD.VENDOR_BILL,
id: CONST.QUICKBOOKS_EXPORT_COMPANY_CARD_ACCOUNT_TYPE.VENDOR_BILL,
},
],
[translate],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
const data: CardListItem[] = useMemo(() => {
let accounts: Account[];
switch (exportCompanyCard) {
case CONST.QUICKBOOKS_EXPORT_COMPANY_CARD.CREDIT_CARD:
case CONST.QUICKBOOKS_EXPORT_COMPANY_CARD_ACCOUNT_TYPE.CREDIT_CARD:
accounts = creditCards ?? [];
break;
case CONST.QUICKBOOKS_EXPORT_COMPANY_CARD.DEBIT_CARD:
case CONST.QUICKBOOKS_EXPORT_COMPANY_CARD_ACCOUNT_TYPE.DEBIT_CARD:
accounts = bankAccounts ?? [];
break;
case CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL:
case CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.VENDOR_BILL:
accounts = vendors ?? [];
break;
default:
Expand Down Expand Up @@ -71,10 +71,10 @@
>
<ScreenWrapper testID={QuickbooksCompanyCardExpenseAccountSelectPage.displayName}>
<HeaderWithBackButton
title={exportCompanyCard === CONST.QUICKBOOKS_EXPORT_COMPANY_CARD.VENDOR_BILL ? translate('workspace.qbo.vendor') : translate('workspace.qbo.account')}
title={exportCompanyCard === CONST.QUICKBOOKS_EXPORT_COMPANY_CARD_ACCOUNT_TYPE.VENDOR_BILL ? translate('workspace.qbo.vendor') : translate('workspace.qbo.account')}
/>
<SelectionList
headerContent={exportCompanyCard ? <Text style={[styles.ph5, styles.pb5]}>{translate(`workspace.qbo.${exportCompanyCard}AccountDescription`)}</Text> : null}

Check failure on line 77 in src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Argument of type '"workspace.qbo.vendor_billAccountDescription" | "workspace.qbo.credit_cardAccountDescription" | "workspace.qbo.debit_cardAccountDescription"' is not assignable to parameter of type 'TranslationPaths'.
sections={[{data}]}
ListItem={RadioListItem}
onSelectRow={selectExportAccount}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ function QuickbooksOutOfPocketExpenseAccountSelectPage({policy}: WithPolicyConne
const data: CardListItem[] = useMemo(() => {
let accounts: Account[];
switch (exportEntity) {
case CONST.QUICKBOOKS_EXPORT_ENTITY.CHECK:
case CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.CHECK:
accounts = bankAccounts ?? [];
break;
case CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL:
case CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.VENDOR_BILL:
accounts = accountsPayable ?? [];
break;
case CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY:
case CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.JOURNAL_ENTRY:
accounts = journalEntryAccounts ?? [];
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
const {syncLocations, exportAccount, exportEntity, errorFields, syncTaxes, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {};
const isLocationEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE);
const isTaxesEnabled = Boolean(syncTaxes && syncTaxes !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE);
const shouldShowTaxError = isTaxesEnabled && exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY;
const shouldShowLocationError = isLocationEnabled && exportEntity !== CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY;
const shouldShowTaxError = isTaxesEnabled && exportEntity === CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.JOURNAL_ENTRY;
const shouldShowLocationError = isLocationEnabled && exportEntity !== CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.JOURNAL_ENTRY;
const hasErrors = Boolean(errorFields?.exportEntity) || shouldShowTaxError || shouldShowLocationError;

return (
Expand All @@ -41,15 +41,15 @@
{!isLocationEnabled && <Text style={[styles.ph5, styles.pb5]}>{translate('workspace.qbo.exportOutOfPocketExpensesDescription')}</Text>}
<OfflineWithFeedback pendingAction={pendingFields?.exportEntity}>
<MenuItemWithTopDescription
title={exportEntity ? translate(`workspace.qbo.${exportEntity}`) : undefined}

Check failure on line 44 in src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Argument of type '"workspace.qbo.check" | "workspace.qbo.vendor_bill" | "workspace.qbo.jouranl_entry"' is not assignable to parameter of type 'TranslationPaths'.
description={translate('workspace.qbo.exportAs')}
error={hasErrors && exportEntity ? translate(`workspace.qbo.${exportEntity}Error`) : undefined}

Check failure on line 46 in src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Argument of type '"workspace.qbo.checkError" | "workspace.qbo.vendor_billError" | "workspace.qbo.jouranl_entryError"' is not assignable to parameter of type 'TranslationPaths'.
onPress={() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT.getRoute(policyID))}
brickRoadIndicator={hasErrors ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
shouldShowRightIcon
/>
</OfflineWithFeedback>
{exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL && !isLocationEnabled && (
{exportEntity === CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.VENDOR_BILL && !isLocationEnabled && (
<Text style={[styles.ph5, styles.mutedNormalTextLabel, styles.pt1, styles.pb2]}>{translate('workspace.qbo.exportVendorBillDescription')}</Text>
)}
{isLocationEnabled && <Text style={[styles.ph5, styles.mutedNormalTextLabel, styles.pt1]}>{translate('workspace.qbo.outOfPocketLocationEnabledDescription')}</Text>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';

type CardListItem = ListItem & {
value: ValueOf<typeof CONST.QUICKBOOKS_EXPORT_ENTITY>;
value: ValueOf<typeof CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE>;
isShown: boolean;
};
type CardsSection = SectionListData<CardListItem, Section<CardListItem>>;
Expand All @@ -31,8 +31,8 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec
const {exportEntity, syncTaxes, syncLocations} = policy?.connections?.quickbooksOnline?.config ?? {};
const isLocationsEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE);
const isTaxesEnabled = Boolean(syncTaxes && syncTaxes !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE);
const isTaxError = isTaxesEnabled && exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY;
const isLocationError = isLocationsEnabled && exportEntity !== CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY;
const isTaxError = isTaxesEnabled && exportEntity === CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.JOURNAL_ENTRY;
const isLocationError = isLocationsEnabled && exportEntity !== CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.JOURNAL_ENTRY;
const policyID = policy?.id ?? '';

useEffect(() => {
Expand All @@ -45,24 +45,24 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec
const data: CardListItem[] = useMemo(
() => [
{
value: CONST.QUICKBOOKS_EXPORT_ENTITY.CHECK,
value: CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.CHECK,
text: translate(`workspace.qbo.check`),
keyForList: CONST.QUICKBOOKS_EXPORT_ENTITY.CHECK,
isSelected: exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.CHECK,
keyForList: CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.CHECK,
isSelected: exportEntity === CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.CHECK,
isShown: !isLocationsEnabled,
},
{
value: CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY,
value: CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.JOURNAL_ENTRY,
text: translate(`workspace.qbo.journalEntry`),
keyForList: CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY,
isSelected: exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY,
keyForList: CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.JOURNAL_ENTRY,
isSelected: exportEntity === CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.JOURNAL_ENTRY,
isShown: !isTaxesEnabled || isLocationsEnabled,
},
{
value: CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL,
value: CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.VENDOR_BILL,
text: translate(`workspace.qbo.vendorBill`),
keyForList: CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL,
isSelected: exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL,
keyForList: CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.VENDOR_BILL,
isSelected: exportEntity === CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE.VENDOR_BILL,
isShown: !isLocationsEnabled,
},
],
Expand Down
4 changes: 2 additions & 2 deletions src/types/onyx/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ type QBOConnectionConfig = OnyxCommon.OnyxValueWithOfflineFeedback<{
exportAccount: string;
exportAccountPayable: string;
accountPayable: string;
exportEntity?: ValueOf<typeof CONST.QUICKBOOKS_EXPORT_ENTITY>;
exportCompanyCard: ValueOf<typeof CONST.QUICKBOOKS_EXPORT_COMPANY_CARD>;
exportEntity?: ValueOf<typeof CONST.QUICKBOOKS_OUT_OF_POCKET_EXPENSE_ACCOUNT_TYPE>;
exportCompanyCard: ValueOf<typeof CONST.QUICKBOOKS_EXPORT_COMPANY_CARD_ACCOUNT_TYPE>;
Comment on lines +193 to +194
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB: I don't think these keys exportEntity or exportCompanyCard really exist, shouldn't they be reimbursableExpensesExportDestination and nonReimbursableExpensesExportDestination?

image

This is causing the inputs to start empty because we read the data from non-existing properties

image

I put this as NAB because this was already wrong and we can fix it in another PR if you prefer.

Copy link
Contributor

@aldo-expensify aldo-expensify May 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, these bad setting names made it to the backend in Auth already because I didn't check if they were correct: https://github.com/Expensify/Auth/blob/3bebe7873f058bdc4f1df5c926f4a3d64f94171a/auth/lib/Policy.h#L111-L140

cc @trjExpensify

Copy link
Contributor Author

@hayata-suenaga hayata-suenaga May 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These non-existing field values were added in this PR. I completely missed that during the code review.

I don't know why they have added additional fields to the TypeScript definition though. I already question that in this PR, but I should have realized that that also made it to the backend code

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahhh, so that explains why they are empty

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Starting to work here: #41463

errorFields?: OnyxCommon.ErrorFields;
}>;
type Connection<ConnectionData, ConnectionConfig> = {
Expand Down
Loading