@zeniai/client-epic-state 5.0.31-betaAR11 → 5.0.31-betaAR2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  import { AccountsViewParentID } from '../../commonStateTypes/accountView/nestedAccountID';
2
2
  import { ClassesViewParentID } from '../../commonStateTypes/classesView/nestedClassID';
3
+ import { ProjectsViewParentID } from '../../commonStateTypes/projectView/projectViewParentID';
3
4
  import { AdditionalBalancesOptions } from '../../commonStateTypes/coaBalance/additionalBalances/getAdditionalBalances';
4
5
  import { COABalancesFilter } from '../../commonStateTypes/coaBalance/coaBalancesFilter';
5
6
  import { ID } from '../../commonStateTypes/common';
6
- import { ProjectsViewParentID } from '../../commonStateTypes/projectView/projectViewParentID';
7
7
  import { EntityOrder } from '../../commonStateTypes/selectorTypes/selectorTypes';
8
8
  import { ReportIDPlusForecastID } from '../../commonStateTypes/viewAndReport/viewAndReport';
9
9
  import { Account, AccountBase, AccountState, AccountType } from './accountState';
@@ -132,7 +132,12 @@ export declare const getAllAccounts: (accountState: AccountState) => Account[];
132
132
  export interface AccountFilterOption {
133
133
  accountId: ID;
134
134
  accountName: string;
135
- accountType: AccountType;
135
+ /**
136
+ * Account type for the underlying account (e.g. 'bank', 'credit_card', 'expenses').
137
+ * Required by the Payment Account Type filter dropdown so it can show only the
138
+ * types actually present on the tenant rather than the full ALL_ACCOUNT_TYPES list.
139
+ */
140
+ accountType: AccountType | undefined;
136
141
  }
137
142
  /**
138
143
  * Partitions accounts for transaction filter dropdowns: bank/credit_card → paymentAccountNames,
@@ -208,9 +208,6 @@ const getTransactionFilterAccountOptions = (accountState) => {
208
208
  const paymentAccountNames = [];
209
209
  const categoryOptions = [];
210
210
  for (const account of accounts) {
211
- if (account.accountType == null) {
212
- continue;
213
- }
214
211
  const option = {
215
212
  accountId: account.accountId,
216
213
  accountName: account.accountName,
@@ -194,9 +194,6 @@ export const getTransactionFilterAccountOptions = (accountState) => {
194
194
  const paymentAccountNames = [];
195
195
  const categoryOptions = [];
196
196
  for (const account of accounts) {
197
- if (account.accountType == null) {
198
- continue;
199
- }
200
197
  const option = {
201
198
  accountId: account.accountId,
202
199
  accountName: account.accountName,
@@ -332,20 +332,33 @@ const getCategoryValueForTransaction = (key, transaction) => {
332
332
  return undefined;
333
333
  }
334
334
  case 'payment_account_name': {
335
- // Match the value the row renders: TransactionCategorizationListRow reads
336
- // `currentTransaction?.account?.accountName` for the Payment Account Name
337
- // column. Returning the same field here keeps filter-match parity with the
338
- // visible cell, so any row a user can see is also a row the filter can match.
339
- return transaction.transaction.account?.accountName;
335
+ // Get from transaction.account or from lines
336
+ if (transaction.transaction.account?.accountName) {
337
+ return transaction.transaction.account.accountName;
338
+ }
339
+ // Get from first line's account
340
+ const firstLine = transaction.transaction.lines?.[0];
341
+ if (firstLine?.type === 'transaction_with_account_and_class_line' ||
342
+ firstLine?.type === 'transaction_with_product_or_service_line' ||
343
+ firstLine?.type === 'journal_entry_transaction_line') {
344
+ const accountLine = firstLine;
345
+ return accountLine.account?.accountName;
346
+ }
347
+ return undefined;
340
348
  }
341
349
  case 'payment_account_type': {
342
- // Compare against the raw `paymentType` enum (e.g. "credit_card", "check",
343
- // "cash"). The same enum is what TransactionCategorizationListRow uses for
344
- // its icon switch on line ~1675, and it's what the dropdown options emit
345
- // as `value`. Display labels come from each account's `paymentTypeName`
346
- // field (populated by mapAccountBasePayloadToAccountBase from the backend
347
- // payload) no client-side label map required.
348
- return transaction.transaction.paymentType;
350
+ // Similar to payment_account_name but for type
351
+ if (transaction.transaction.account?.accountType) {
352
+ return transaction.transaction.account.accountType;
353
+ }
354
+ const firstLineForType = transaction.transaction.lines?.[0];
355
+ if (firstLineForType?.type === 'transaction_with_account_and_class_line' ||
356
+ firstLineForType?.type === 'transaction_with_product_or_service_line' ||
357
+ firstLineForType?.type === 'journal_entry_transaction_line') {
358
+ const accountLineForType = firstLineForType;
359
+ return accountLineForType.account?.accountType;
360
+ }
361
+ return undefined;
349
362
  }
350
363
  case 'category': {
351
364
  // Get from transactionLocalData (preferred) or from transaction lines
package/lib/index.d.ts CHANGED
@@ -38,7 +38,7 @@ import { AgingDateSelectionType, AgingDetailReportInvoice, AgingDetailReportUISt
38
38
  import { isAgingReport, isCashFlowOrBalanceSheetReport, isDashboardClassesViewReport, isDashboardReport, isFluxAnalysisOpExReport, isOpExByVendorReport, isPAndLClassesViewReport, isPAndLProjectViewReport, isPAndLReport } from './commonStateTypes/viewAndReport/reportIDHelper';
39
39
  import { PageToken, Report, ReportFormat, ReportID, ReportIDPlusForecastID, SelectorReport, SelectorView, View, toReportFormatStrict, toReportID } from './commonStateTypes/viewAndReport/viewAndReport';
40
40
  import { PAYMENT_BUSINESS_DAYS, filterDays, getNextNthWorkingDay, getPreviousNthWorkingDay, getYearsList, holidaysFormatted, isHoliday, isHolidayToday } from './commonStateTypes/workingDayHelper';
41
- import { AccountFilterOption, AccountReport, AccountWithBalanceReport, getAllAccounts, getTransactionFilterAccountOptions } from './entity/account/accountSelector';
41
+ import { AccountReport, AccountWithBalanceReport, getAllAccounts, getTransactionFilterAccountOptions } from './entity/account/accountSelector';
42
42
  import { ALL_ACCOUNT_TYPES, Account, AccountBase, AccountType, RecommendedAccountBase, ReconciliationAccountSourceType, StatementCloseDay, toAccountType, toReconciliationAccountSource } from './entity/account/accountState';
43
43
  import { NestedAccountReport } from './entity/account/subAccountSelector';
44
44
  import { AccountGroupReport } from './entity/accountGroup/accountGroupSelector';
@@ -647,7 +647,7 @@ export { VendorSpendTrendFilterTabType, toVendorSpendTrendFilterTabsTypeStrict,
647
647
  export { getNumberOfPeriods };
648
648
  export { SCHEDULE_DAYS_OF_MONTH, ScheduleDaysOfMonth, toScheduleDaysOfMonth, Day, Month, toMonth, toMonthStrict, Quarter, toQuarter, toQuarterStrict, AbsoluteDay, TimePeriod, };
649
649
  export { Tenant, TenantView, LoggedInUser, TenantBaseView, CurrentTenant, TenantProductSettings, getTenantBaseById, getCurrentTenant, getIsAccountingClassesEnabled, getIsAccountingProjectsEnabled, getTenantsByCheckInDateSelector, getTenantsBaseByCheckInDateSelector, getTenantsCoreDetailsByCheckInDateSelector, toTenantCoreDetailsView, getTenantBaseViewForTenantView, getTenantBaseViewForTenantId, isZeniDomainTenant, isTenantUsingZeniCOA, TenantsBaseOrdered, TenantsOrdered, TenantCoreDetailsView, fetchActiveTenant, fetchAllTenants, updateCurrentTenant, clearAll, doMagicLinkSignIn, verifyDeviceWithTwoFA, resendVerifyDeviceOTP, sendEmailMagicLinkToUser, doSignIn, updateSignInState, DoSignInPayload, doSignOut, sendSessionHeartbeat, resetSignInState, RoleResource, Connection, fetchExcludedResourcesForTenant, fetchExternalConnectionsForTenant, saveExternalConnectionForTenant, fetchSubscriptionSummaryForTenant, isTenantBankingOnly, isTenantCardsOnly, isTenantBookkeepingEnabled, isOtherProductsEnabledForTenant, };
650
- export { Account, ALL_ACCOUNT_TYPES, AccountType, AccountBase, StatementCloseDay, toAccountType, AccountReport, AccountFilterOption, getAllAccounts, getTransactionFilterAccountOptions, NestedAccountReport, AccountWithBalanceReport, AccountGroup, AccountGroupReportV2, AccountGroupType, toAccountGroupType, AccountGroupReport, getAccountGroupKey, AccountGroupKey, RecommendedAccountBase, };
650
+ export { Account, ALL_ACCOUNT_TYPES, AccountType, AccountBase, StatementCloseDay, toAccountType, AccountReport, getAllAccounts, getTransactionFilterAccountOptions, NestedAccountReport, AccountWithBalanceReport, AccountGroup, AccountGroupReportV2, AccountGroupType, toAccountGroupType, AccountGroupReport, getAccountGroupKey, AccountGroupKey, RecommendedAccountBase, };
651
651
  export { Class, ClassBase, RecommendedClassBase, } from './entity/class/classState';
652
652
  export { getAllClasses, getClassById } from './entity/class/classSelector';
653
653
  export { ClassReport } from './entity/class/classSelectorTypes';