@zeniai/client-epic-state 5.0.31-betaAR1 → 5.0.31-betaAR10

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';
4
3
  import { AdditionalBalancesOptions } from '../../commonStateTypes/coaBalance/additionalBalances/getAdditionalBalances';
5
4
  import { COABalancesFilter } from '../../commonStateTypes/coaBalance/coaBalancesFilter';
6
5
  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,10 +132,16 @@ 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
  }
136
137
  /**
137
138
  * Partitions accounts for transaction filter dropdowns: bank/credit_card → paymentAccountNames,
138
139
  * all other account types → categoryOptions. Use for payment_account_name and category filter options.
140
+ *
141
+ * Note: payment_account_type dropdown options come from transaction-level
142
+ * `paymentType`/`paymentTypeName` fields, not account-level — account records
143
+ * rarely carry those values. See ExpenseAutomationPage.filterOptions for
144
+ * the source of those options.
139
145
  */
140
146
  export declare const getTransactionFilterAccountOptions: (accountState: AccountState) => {
141
147
  categoryOptions: AccountFilterOption[];
@@ -202,15 +202,24 @@ exports.getAllAccounts = getAllAccounts;
202
202
  /**
203
203
  * Partitions accounts for transaction filter dropdowns: bank/credit_card → paymentAccountNames,
204
204
  * all other account types → categoryOptions. Use for payment_account_name and category filter options.
205
+ *
206
+ * Note: payment_account_type dropdown options come from transaction-level
207
+ * `paymentType`/`paymentTypeName` fields, not account-level — account records
208
+ * rarely carry those values. See ExpenseAutomationPage.filterOptions for
209
+ * the source of those options.
205
210
  */
206
211
  const getTransactionFilterAccountOptions = (accountState) => {
207
212
  const accounts = (0, exports.getAllAccounts)(accountState);
208
213
  const paymentAccountNames = [];
209
214
  const categoryOptions = [];
210
215
  for (const account of accounts) {
216
+ if (account.accountType == null) {
217
+ continue;
218
+ }
211
219
  const option = {
212
220
  accountId: account.accountId,
213
221
  accountName: account.accountName,
222
+ accountType: account.accountType,
214
223
  };
215
224
  if ((0, accountState_1.isPaymentAccountType)(account.accountType)) {
216
225
  paymentAccountNames.push(option);
@@ -188,15 +188,24 @@ export const getAllAccounts = (accountState) => Object.values(accountState.accou
188
188
  /**
189
189
  * Partitions accounts for transaction filter dropdowns: bank/credit_card → paymentAccountNames,
190
190
  * all other account types → categoryOptions. Use for payment_account_name and category filter options.
191
+ *
192
+ * Note: payment_account_type dropdown options come from transaction-level
193
+ * `paymentType`/`paymentTypeName` fields, not account-level — account records
194
+ * rarely carry those values. See ExpenseAutomationPage.filterOptions for
195
+ * the source of those options.
191
196
  */
192
197
  export const getTransactionFilterAccountOptions = (accountState) => {
193
198
  const accounts = getAllAccounts(accountState);
194
199
  const paymentAccountNames = [];
195
200
  const categoryOptions = [];
196
201
  for (const account of accounts) {
202
+ if (account.accountType == null) {
203
+ continue;
204
+ }
197
205
  const option = {
198
206
  accountId: account.accountId,
199
207
  accountName: account.accountName,
208
+ accountType: account.accountType,
200
209
  };
201
210
  if (isPaymentAccountType(account.accountType)) {
202
211
  paymentAccountNames.push(option);
@@ -24,6 +24,11 @@ export const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) =>
24
24
  page_size: 25,
25
25
  search_text: uiState.searchString,
26
26
  };
27
+ // .getJSON<TransactionCategorizationResponse>(
28
+ // `https://qa.api.zeni.ai/version/accounting/amitesh/1.0/expense-automation/transactions?query=${encodeURIComponent(
29
+ // JSON.stringify(queryParam)
30
+ // )}`
31
+ // )
27
32
  return zeniAPI
28
33
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expense-automation/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
29
34
  .pipe(mergeMap((response) => {
@@ -332,33 +332,20 @@ const getCategoryValueForTransaction = (key, transaction) => {
332
332
  return undefined;
333
333
  }
334
334
  case 'payment_account_name': {
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;
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;
348
340
  }
349
341
  case 'payment_account_type': {
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;
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;
362
349
  }
363
350
  case 'category': {
364
351
  // 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 { AccountReport, AccountWithBalanceReport, getAllAccounts, getTransactionFilterAccountOptions } from './entity/account/accountSelector';
41
+ import { AccountFilterOption, 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, getAllAccounts, getTransactionFilterAccountOptions, NestedAccountReport, AccountWithBalanceReport, AccountGroup, AccountGroupReportV2, AccountGroupType, toAccountGroupType, AccountGroupReport, getAccountGroupKey, AccountGroupKey, RecommendedAccountBase, };
650
+ export { Account, ALL_ACCOUNT_TYPES, AccountType, AccountBase, StatementCloseDay, toAccountType, AccountReport, AccountFilterOption, 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';