Skip to content
Merged
5 changes: 3 additions & 2 deletions src/hooks/useDefaultFundID.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useCallback} from 'react';
import type {OnyxCollection} from 'react-native-onyx';
import {getFundIdFromSettingsKey} from '@libs/CardUtils';
import {getCardSettings, getFundIdFromSettingsKey} from '@libs/CardUtils';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {ExpensifyCardSettings} from '@src/types/onyx';
Expand All @@ -15,6 +15,7 @@ function useDefaultFundID(policyID: string | undefined) {
const workspaceAccountID = useWorkspaceAccountID(policyID);
const [lastSelectedExpensifyCardFeed] = useOnyx(`${ONYXKEYS.COLLECTION.LAST_SELECTED_EXPENSIFY_CARD_FEED}${policyID}`);
const [lastSelectedCardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${lastSelectedExpensifyCardFeed}`);
const lastSelectedSettings = getCardSettings(lastSelectedCardSettings);

Choose a reason for hiding this comment

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

P1 Badge Resolve last-selected fund from the nested feed settings

This hook now calls getCardSettings(lastSelectedCardSettings) without a feedCountry, so when the backend returns the nested shape described in this PR (for example US / TRAVEL_US buckets), the helper returns the root object and lastSelectedSettings?.paymentBankAccountID can be missing. In that case the lastSelectedExpensifyCardFeed branch is skipped and we fall back to another fund ID, which can open the wrong feed’s card data after Phase 2 rollout. Pass the selected feed country when reading settings here (and in the related call sites) so default feed selection remains correct for nested payloads.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch on the theory, but this is intentional for Phase 1. Today the backend only sends the flat format, so calling getCardSettings without feedCountry correctly returns the root object with paymentBankAccountID intact.

In Phase 2 when the backend starts sending nested format (US, TRAVEL_US keys), we'll update these call sites to pass the appropriate feedCountry. This PR just sets up the abstraction layer so that transition is a small diff rather than a large refactor.


const getDomainFundID = useCallback(
(cardSettings: OnyxCollection<ExpensifyCardSettings>) => {
Expand All @@ -36,7 +37,7 @@ function useDefaultFundID(policyID: string | undefined) {
[getDomainFundID],
);

if (lastSelectedExpensifyCardFeed && lastSelectedCardSettings?.paymentBankAccountID) {
if (lastSelectedExpensifyCardFeed && lastSelectedSettings?.paymentBankAccountID) {
return lastSelectedExpensifyCardFeed;
}

Expand Down
17 changes: 17 additions & 0 deletions src/libs/CardUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type {
CompanyCardFeed,
CurrencyList,
ExpensifyCardSettings,
ExpensifyCardSettingsBase,
PersonalDetailsList,
Policy,
PrivatePersonalDetails,
Expand Down Expand Up @@ -1071,6 +1072,21 @@ function isExpensifyCardFullySetUp(policy?: OnyxEntry<Policy>, cardSettings?: On
return !!(policy?.areExpensifyCardsEnabled && cardSettings?.paymentBankAccountID);
}

function getCardSettings(cardSettings: OnyxEntry<ExpensifyCardSettings>, feedCountry?: string): ExpensifyCardSettingsBase | undefined {
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be an onyx selector 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.

It could work as a selector today since no call site passes feedCountry yet — all 10 usages would just be useOnyx(..., { selector: getCardSettings }).

But in Phase 2 when some call sites need to pass feedCountry, those would need useCallback wrappers to keep the selector referentially stable:

const selector = useCallback(
    (cs: OnyxEntry<ExpensifyCardSettings>) => getCardSettings(cs, feedCountry),
    [feedCountry]
);
const [settings] = useOnyx(`...`, { selector }, [feedCountry]);

Also right now without feedCountry it's essentially an identity function, so there's no memoization benefit from making it a selector — Onyx would still re-render on any settings change.

Keeping it as a plain utility for now keeps things simple and avoids a second refactor when Phase 2 lands. But happy to convert if you'd prefer the selector pattern regardless.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, I just think the change would be smaller overall because you would not have to rename everything from cardSettings to settings, but all good.

if (!cardSettings) {
return undefined;
}

if (feedCountry) {
const feedCountryCardSettings = cardSettings[feedCountry as keyof typeof cardSettings];
if (feedCountryCardSettings && typeof feedCountryCardSettings === 'object' && !Array.isArray(feedCountryCardSettings)) {
return feedCountryCardSettings as ExpensifyCardSettingsBase;
}
}

return cardSettings;
}

function isCardPendingIssue(card?: Card) {
return card?.state === CONST.EXPENSIFY_CARD.STATE.STATE_NOT_ISSUED;
}
Expand Down Expand Up @@ -1368,6 +1384,7 @@ export {
normalizeCardName,
hasIssuedExpensifyCard,
isExpensifyCardFullySetUp,
getCardSettings,
filterAllInactiveCards,
filterInactiveCards,
isCardPendingIssue,
Expand Down
5 changes: 3 additions & 2 deletions src/pages/workspace/WorkspaceMoreFeaturesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import {enablePolicyTravel} from '@libs/actions/Policy/Travel';
import {filterInactiveCards, getAllCardsForWorkspace, getCompanyFeeds, isSmartLimitEnabled as isSmartLimitEnabledUtil} from '@libs/CardUtils';
import {filterInactiveCards, getAllCardsForWorkspace, getCardSettings, getCompanyFeeds, isSmartLimitEnabled as isSmartLimitEnabledUtil} from '@libs/CardUtils';
import {getLatestErrorField} from '@libs/ErrorUtils';
import Navigation from '@libs/Navigation/Navigation';
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
Expand Down Expand Up @@ -115,7 +115,8 @@ function WorkspaceMoreFeaturesPage({policy, route}: WorkspaceMoreFeaturesPagePro
const policyData = usePolicyData(policyID);
const defaultFundID = useDefaultFundID(policyID);
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${defaultFundID}`);
const paymentBankAccountID = cardSettings?.paymentBankAccountID;
const settings = getCardSettings(cardSettings);
const paymentBankAccountID = settings?.paymentBankAccountID;

const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE);

Expand Down
5 changes: 3 additions & 2 deletions src/pages/workspace/WorkspaceOverviewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
setIsComingFromGlobalReimbursementsFlow,
updateWorkspaceAvatar,
} from '@libs/actions/Policy/Policy';
import {filterInactiveCards} from '@libs/CardUtils';
import {filterInactiveCards, getCardSettings} from '@libs/CardUtils';
import {getLatestErrorField, getLatestErrorMessage} from '@libs/ErrorUtils';
import Navigation from '@libs/Navigation/Navigation';
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
Expand Down Expand Up @@ -97,7 +97,8 @@ function WorkspaceOverviewPage({policyDraft, policy: policyProp, route}: Workspa
const policyID = policy?.id;
const defaultFundID = useDefaultFundID(policyID);
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${defaultFundID}`);
const isBankAccountVerified = !!cardSettings?.paymentBankAccountID;
const settings = getCardSettings(cardSettings);
const isBankAccountVerified = !!settings?.paymentBankAccountID;

const isPolicyAdmin = isPolicyAdminPolicyUtils(policy);
const outputCurrency = policy?.outputCurrency ?? '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import useOnyx from '@hooks/useOnyx';
import useThemeStyles from '@hooks/useThemeStyles';
import {getConnectionNameFromRouteParam} from '@libs/AccountingUtils';
import {getLastFourDigits} from '@libs/BankAccountUtils';
import {getEligibleBankAccountsForCard} from '@libs/CardUtils';
import {getCardSettings, getEligibleBankAccountsForCard} from '@libs/CardUtils';
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
import {getDomainNameForPolicy} from '@libs/PolicyUtils';
import Navigation from '@navigation/Navigation';
Expand Down Expand Up @@ -43,12 +43,13 @@ function ReconciliationAccountSettingsPage({route}: ReconciliationAccountSetting

const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST);
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${defaultFundID}`);
const paymentBankAccountID = cardSettings?.paymentBankAccountID;
const settings = getCardSettings(cardSettings);
const paymentBankAccountID = settings?.paymentBankAccountID;

const selectedBankAccount = useMemo(() => bankAccountList?.[paymentBankAccountID?.toString() ?? ''], [paymentBankAccountID, bankAccountList]);
const bankAccountNumber = useMemo(() => selectedBankAccount?.accountData?.accountNumber ?? '', [selectedBankAccount?.accountData?.accountNumber]);
const settlementAccountEnding = getLastFourDigits(bankAccountNumber);
const domainName = cardSettings?.domainName ?? getDomainNameForPolicy(policyID);
const domainName = settings?.domainName ?? getDomainNameForPolicy(policyID);
const {environmentURL} = useEnvironment();

const options = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {ExpensifyCardSettings} from '@src/types/onyx';
import type {ExpensifyCardSettingsBase} from '@src/types/onyx';
import WorkspaceCardsListLabel from './WorkspaceCardsListLabel';

type WorkspaceCardListLabelsProps = {
/** ID of the current policy */
policyID: string;

/** Card settings */
cardSettings: ExpensifyCardSettings | undefined;
cardSettings: ExpensifyCardSettingsBase | undefined;
};

function WorkspaceCardListLabels({policyID, cardSettings}: WorkspaceCardListLabelsProps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import useThemeStyles from '@hooks/useThemeStyles';
import {getLastFourDigits} from '@libs/BankAccountUtils';
import {getCardSettings} from '@libs/CardUtils';
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
import Navigation from '@navigation/Navigation';
import type {SettingsNavigatorParamList} from '@navigation/types';
Expand All @@ -30,11 +31,12 @@ function WorkspaceCardSettingsPage({route}: WorkspaceCardSettingsPageProps) {

const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST);
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${defaultFundID}`);
const settings = getCardSettings(cardSettings);

const paymentBankAccountID = cardSettings?.paymentBankAccountID;
const paymentBankAccountNumber = cardSettings?.paymentBankAccountNumber;
const isMonthlySettlementAllowed = cardSettings?.isMonthlySettlementAllowed ?? false;
const settlementFrequency = cardSettings?.monthlySettlementDate ? CONST.EXPENSIFY_CARD.FREQUENCY_SETTING.MONTHLY : CONST.EXPENSIFY_CARD.FREQUENCY_SETTING.DAILY;
const paymentBankAccountID = settings?.paymentBankAccountID;
const paymentBankAccountNumber = settings?.paymentBankAccountNumber;
const isMonthlySettlementAllowed = settings?.isMonthlySettlementAllowed ?? false;
const settlementFrequency = settings?.monthlySettlementDate ? CONST.EXPENSIFY_CARD.FREQUENCY_SETTING.MONTHLY : CONST.EXPENSIFY_CARD.FREQUENCY_SETTING.DAILY;
const isSettlementFrequencyBlocked = !isMonthlySettlementAllowed && settlementFrequency === CONST.EXPENSIFY_CARD.FREQUENCY_SETTING.DAILY;
const bankAccountNumber = bankAccountList?.[paymentBankAccountID?.toString() ?? '']?.accountData?.accountNumber ?? paymentBankAccountNumber ?? '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import {getCardSettings} from '@libs/CardUtils';
import {convertToDisplayString} from '@libs/CurrencyUtils';
import getClickedTargetLocation from '@libs/getClickedTargetLocation';
import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types';
Expand Down Expand Up @@ -59,9 +60,10 @@ function WorkspaceCardsListLabel({type, value, style}: WorkspaceCardsListLabelPr

const settlementCurrency = useCurrencyForExpensifyCard({policyID});
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${defaultFundID}`);
const settings = getCardSettings(cardSettings);
const [cardManualBilling] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_MANUAL_BILLING}${defaultFundID}`);
const icons = useMemoizedLazyExpensifyIcons(['Info'] as const);
const paymentBankAccountID = cardSettings?.paymentBankAccountID;
const paymentBankAccountID = settings?.paymentBankAccountID;

const isLessThanMediumScreen = isMediumScreenWidth || shouldUseNarrowLayout;

Expand All @@ -88,13 +90,13 @@ function WorkspaceCardsListLabel({type, value, style}: WorkspaceCardsListLabelPr
}, [isVisible, windowWidth]);

const requestLimitIncrease = () => {
requestExpensifyCardLimitIncrease(cardSettings?.paymentBankAccountID);
requestExpensifyCardLimitIncrease(settings?.paymentBankAccountID);
setVisible(false);
navigateToConciergeChat(conciergeReportID, false);
};

const isCurrentBalanceType = type === CONST.WORKSPACE_CARDS_LIST_LABEL_TYPE.CURRENT_BALANCE;
const isSettleBalanceButtonDisplayed = !!cardSettings?.isMonthlySettlementAllowed && !cardManualBilling && isCurrentBalanceType;
const isSettleBalanceButtonDisplayed = !!settings?.isMonthlySettlementAllowed && !cardManualBilling && isCurrentBalanceType;
const isSettleDateTextDisplayed = !!cardManualBilling && isCurrentBalanceType;

const settlementDate = isSettleDateTextDisplayed ? format(addDays(new Date(), 1), CONST.DATE.FNS_FORMAT_STRING) : '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import {clearIssueNewCardFormData, setIssueNewCardStepAndData} from '@libs/actions/Card';
import {clearDeletePaymentMethodError} from '@libs/actions/PaymentMethods';
import {filterCardsByPersonalDetails, getCardsByCardholderName, sortCardsByCardholderName} from '@libs/CardUtils';
import {filterCardsByPersonalDetails, getCardsByCardholderName, getCardSettings, sortCardsByCardholderName} from '@libs/CardUtils';
import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types';
import {getDescriptionForPolicyDomainCard, getMemberAccountIDsForWorkspace} from '@libs/PolicyUtils';
import Navigation from '@navigation/Navigation';
Expand Down Expand Up @@ -71,6 +71,7 @@ function WorkspaceExpensifyCardListPage({route, cardsList, fundID}: WorkspaceExp
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
const [cardOnWaitlist] = useOnyx(`${ONYXKEYS.COLLECTION.NVP_EXPENSIFY_ON_CARD_WAITLIST}${policyID}`);
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${fundID}`);
const settings = getCardSettings(cardSettings);
const allExpensifyCardFeeds = useExpensifyCardFeeds(policyID);

const shouldShowSelector = Object.keys(allExpensifyCardFeeds ?? {}).length > 1;
Expand Down Expand Up @@ -195,7 +196,7 @@ function WorkspaceExpensifyCardListPage({route, cardsList, fundID}: WorkspaceExp
<View style={[styles.appBG, styles.flexShrink0, styles.flexGrow1]}>
<WorkspaceCardListLabels
policyID={policyID}
cardSettings={cardSettings}
cardSettings={settings}
/>
{allCards.length > CONST.SEARCH_ITEM_LIMIT && (
<SearchBar
Expand Down Expand Up @@ -245,7 +246,7 @@ function WorkspaceExpensifyCardListPage({route, cardsList, fundID}: WorkspaceExp
onFeedSelect={() => Navigation.navigate(ROUTES.WORKSPACE_EXPENSIFY_CARD_SELECT_FEED.getRoute(policyID))}
CardFeedIcon={cardFeedIcon}
feedName={translate('workspace.common.expensifyCard')}
supportingText={getDescriptionForPolicyDomainCard(cardSettings?.domainName ?? '', policyCollection)}
supportingText={getDescriptionForPolicyDomainCard(settings?.domainName ?? '', policyCollection)}
/>
{isBankAccountVerified && getHeaderButtons()}
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import useDefaultFundID from '@hooks/useDefaultFundID';
import useNetwork from '@hooks/useNetwork';
import useOnyx from '@hooks/useOnyx';
import {updateSelectedExpensifyCardFeed} from '@libs/actions/Card';
import {filterInactiveCards} from '@libs/CardUtils';
import {filterInactiveCards, getCardSettings} from '@libs/CardUtils';
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
import type {WorkspaceSplitNavigatorParamList} from '@libs/Navigation/types';
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper';
Expand All @@ -22,6 +22,7 @@ function WorkspaceExpensifyCardPage({route}: WorkspaceExpensifyCardPageProps) {
const defaultFundID = useDefaultFundID(policyID);

const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${defaultFundID}`);
const settings = getCardSettings(cardSettings);
const [cardsList] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${defaultFundID}_${CONST.EXPENSIFY_CARD.BANK}`, {selector: filterInactiveCards});

const fetchExpensifyCards = useCallback(() => {
Expand All @@ -35,8 +36,8 @@ function WorkspaceExpensifyCardPage({route}: WorkspaceExpensifyCardPageProps) {
fetchExpensifyCards();
}, [fetchExpensifyCards]);

const paymentBankAccountID = cardSettings?.paymentBankAccountID ?? CONST.DEFAULT_NUMBER_ID;
const isLoading = !isOffline && (!cardSettings || cardSettings.isLoading) && !cardSettings?.hasOnceLoaded;
const paymentBankAccountID = settings?.paymentBankAccountID ?? CONST.DEFAULT_NUMBER_ID;
const isLoading = !isOffline && (!cardSettings || settings?.isLoading) && !cardSettings?.hasOnceLoaded;

const renderContent = () => {
if (isLoading) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import useThemeStyles from '@hooks/useThemeStyles';
import {getRouteParamForConnection} from '@libs/AccountingUtils';
import {openPolicyAccountingPage} from '@libs/actions/PolicyConnections';
import {getLastFourDigits} from '@libs/BankAccountUtils';
import {getEligibleBankAccountsForCard, getEligibleBankAccountsForUkEuCard} from '@libs/CardUtils';
import {getCardSettings, getEligibleBankAccountsForCard, getEligibleBankAccountsForUkEuCard} from '@libs/CardUtils';
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
import {getDomainNameForPolicy} from '@libs/PolicyUtils';
import Navigation from '@navigation/Navigation';
Expand Down Expand Up @@ -45,13 +45,14 @@ function WorkspaceSettlementAccountPage({route}: WorkspaceSettlementAccountPageP
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`);
const [bankAccountsList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST);
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${defaultFundID}`);
const settings = getCardSettings(cardSettings);
const [continuousReconciliation] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_USE_CONTINUOUS_RECONCILIATION}${defaultFundID}`);
const [reconciliationConnection] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_CONTINUOUS_RECONCILIATION_CONNECTION}${defaultFundID}`);
const isUkEuCurrencySupported = useExpensifyCardUkEuSupported(policyID);

const paymentBankAccountID = cardSettings?.paymentBankAccountID;
const paymentBankAccountNumberFromCardSettings = cardSettings?.paymentBankAccountNumber;
const paymentBankAccountAddressName = cardSettings?.paymentBankAccountAddressName;
const paymentBankAccountID = settings?.paymentBankAccountID;
const paymentBankAccountNumberFromCardSettings = settings?.paymentBankAccountNumber;
const paymentBankAccountAddressName = settings?.paymentBankAccountAddressName;
const paymentBankAccountNumber = bankAccountsList?.[paymentBankAccountID?.toString() ?? '']?.accountData?.accountNumber ?? paymentBankAccountNumberFromCardSettings ?? '';

const getEligibleBankAccounts = () => {
Expand All @@ -62,7 +63,7 @@ function WorkspaceSettlementAccountPage({route}: WorkspaceSettlementAccountPageP
};
const eligibleBankAccounts = getEligibleBankAccounts();

const domainName = cardSettings?.domainName ?? getDomainNameForPolicy(policyID);
const domainName = settings?.domainName ?? getDomainNameForPolicy(policyID);
const hasActiveAccountingConnection = !!(policy?.connections && Object.keys(policy.connections).length > 0);

const fetchPolicyAccountingData = useCallback(() => {
Expand Down
Loading
Loading