import { Amount } from '../../../commonStateTypes/amount'; import { FetchStateAndError, ID } from '../../../commonStateTypes/common'; import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes'; import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod'; import { ReconciliationAccountSourceType } from '../../../entity/account/accountState'; import { BankStatusCodeType } from '../../../entity/accountRecon/accountReconState'; import { CustomerBase } from '../../../entity/customer/customerState'; import { VendorBase } from '../../../entity/vendor/vendorState'; import { ZeniAPIStatus } from '../../../responsePayload'; export interface PolygonPoint { x: number; y: number; } export interface Citation { page: number; pageHeight: number; pageWidth: number; polygon: PolygonPoint[]; referenceText: string; } export interface StatementTransaction { amount: number; citations: Citation[]; isUserAdded: boolean; isUserEdited: boolean; statementTransactionId: string; transactionDate: string; transactionDirection: 'debit' | 'credit'; transactionMemo: string; } export declare const toStatementBalanceSource: (v: string) => "ocr" | "prior_recon" | "default_zero"; export type StatementBalanceSource = ReturnType; export declare const toStatementBalanceSourceStrict: (v: string | null | undefined) => StatementBalanceSource | undefined; export interface StatementMeta { closingBalance: number; openingBalance: number; statementDataStatus: { code: string; label: string; }; statementEndDate: string; statementStartDate: string; statementStatus: { code: string; label: string; }; statementUploadId: string; totalDeposits: number; totalPayments: number; balanceSource?: StatementBalanceSource; combinedStatementGroupId?: string; isCombinedStatement?: boolean; isCombinedStatementAnchor?: boolean; } export interface AccountInfo { accountId: string; accountName: string; accountType: string; currencyCode: string; last4Digits: string | null; } export interface FileInfo { fileId: string; fileName: string; signedUrl: string; } export interface AiSummaryField { code: string; label: string; } export interface PreviousReconciliationInfo { endDate: string; reconciledAt: string; reconciledByUserId: string; reconciliationId: string; startDate: string; } export interface AiSummaryChainStatus { code: string; expectedStartDate: string | null; label: string; previousReconciliationInfo: PreviousReconciliationInfo | null; } /** * Surfaced when Confirm & Save is rejected with a 409 because the statement * period overlaps with / leaves a gap after an already-reconciled period. */ export interface StatementDateConflict { errorCode: string; expectedStartDate: string | null; /** Present for overlap conflicts; GAP-only 409s may omit prior recon info. */ previousReconciliationInfo?: PreviousReconciliationInfo; } export interface AiSummary { accountIdentified: string | null; chainStatus: AiSummaryChainStatus; exceptionsDetected: number; fieldsCaptured: AiSummaryField[]; transactionsExtracted: number; } export interface CombinedStatementAccountSuggestion { accountId: ID; accountName: string; matchConfidence: number; matchedBy: string; } export interface CombinedStatementAccount { accountName: string; accountType: string; closingBalance: number; isUploadContext: boolean; ledgerIdentifier: string; maskedAccountNumber: string; openingBalance: number; transactionCount: number; existingStatementStatus?: { code: string; label: string; } | null; suggestion?: CombinedStatementAccountSuggestion | null; } export interface CombinedStatementDetails { accounts: CombinedStatementAccount[]; combinedStatementGroupId: string; isMappingConfirmed: boolean; statementUploads: ConfirmedCombinedStatementUpload[]; } export interface ConfirmedCombinedStatementUpload { accountId: ID; isCombinedStatementAnchor: boolean; ledgerIdentifiers: string[]; statementUploadId: ID; } export interface ConfirmStatementMappingConflict { collidingLedgerIdentifiers: string[]; collidingAccountId?: ID; previousReconciliationInfo?: PreviousReconciliationInfo | null; } export interface StatementUpload { account: AccountInfo; file: FileInfo | null; statementMeta: StatementMeta; statementTransactions: StatementTransaction[]; aiSummary?: AiSummary | null; combinedStatementDetails?: CombinedStatementDetails; } export interface ParsedStatementData { /** * Single-account parse: the only upload. * Combined-account parse: the anchor / PDF-owning upload (also in statementUploads). */ statementUpload: StatementUpload; /** * Present only for combined multi-account parse responses after mapping. * When set, ParseInfo renders one section per upload. */ statementUploads?: StatementUpload[]; } export interface ReconciliationSummaryAccounts { done: number; failed: number; inProgress: number; total: number; } export interface ReconciliationSummaryAutoMatched { matchedTxns: number; totalTxns: number; } export interface ReconciliationSummaryNeedsReview { accountCount: number; txnCount: number; } export interface ReconciliationSummaryProgressBar { aiPercentageShare: number; completePercentage: number; humanPercentageShare: number; remainingPercentage: number; } export interface ReconciliationViewSummary { accounts: ReconciliationSummaryAccounts; accountsToConnectCount: number; autoMatched: ReconciliationSummaryAutoMatched; needsReview: ReconciliationSummaryNeedsReview; timeSavedHours: number; timeSavedPercentage: number; progressBar?: ReconciliationSummaryProgressBar; } export declare const RECONCILE_ACTIONS: readonly ["reconcile", "save_reconcile_for_later", "exclude"]; export declare const toReconcileActions: (v: string) => "reconcile" | "save_reconcile_for_later" | "exclude"; export type ReconcileActionType = ReturnType; export type SaveReconcileDetailActionPayload = { excludeTransactionId: ID; reconcileAction: 'exclude'; } | { reconcileAction: 'reconcile' | 'save_reconcile_for_later'; }; export interface SaveReconciliationDetailFailurePayload { error: ZeniAPIStatus; fetchStateByAction: SaveReconcileDetailActionPayload; } export declare const toReconciliationTabsType: (v: string) => "review" | "reconcile"; export declare type ReconciliationViewTabType = ReturnType; declare const toReconReconcileSortKeysType: (v: string) => "type" | "date" | "amount" | "memo" | "account" | "recommended" | "clearedDate" | "payee" | "transactionDirection"; export declare type ReconReconcileSortKey = ReturnType; export interface ReconciliationReconcileTabLocalData { selectedTransactionIds: ID[]; } export interface ReconciliationReconcileTabViewUiState { sortKey: ReconReconcileSortKey; sortOrder: SortOrder; scrollYOffset?: number; } export interface TransactionSummary { count: number; totalAmount: Amount; } export interface BalancesLocalData { clearedBalance: Amount; deposits: TransactionSummary; payments: TransactionSummary; variance: Amount; variancePercentage?: number; } export interface ReconciliationTabsState { balances: BalancesLocalData; reconcile: { localData: ReconciliationReconcileTabLocalData; uiState: ReconciliationReconcileTabViewUiState; }; review: { localData: Record; uiState: ReconciliationReviewTabViewUiState; }; } declare const toReconReviewSortKey: (v: string) => "date" | "amount" | "memo" | "match" | "payee" | "direction"; export type ReconReviewSortKey = ReturnType; export interface ReconciliationReviewTabViewUiState { scrollPosition: { scrollTop: number; scrollLeft?: number; } | undefined; sortKey: ReconReviewSortKey; sortOrder: SortOrder; } export interface ReconciliationReviewTabLocalData { memo: string; bankAccountId?: ID; categoryId?: ID; classId?: ID; creditCardId?: ID; customer?: CustomerBase; matchedTransactionId?: ID; vendor?: VendorBase; } export interface ExcludeAccountFromReconciliationPayload { accountId: ID; } export interface ExclusionInfo { bankBalance: Amount | undefined; clearedBalance: Amount | undefined; variance: Amount | undefined; } export interface ActionFetchStates { excludeAccountFetch: FetchStateAndError; excludeFetchById: Record; includeAccountFetch: FetchStateAndError; reconcileFetch: FetchStateAndError; saveForLaterFetch: FetchStateAndError; saveReconciliationReviewFetch: Record; } export interface ReconListUIState { nodeCollapseState: Record; scrollPosition: { scrollTop: number; scrollLeft?: number; }; } export interface ReconciliationViewState extends FetchStateAndError { accountConnectionStatusByAccountID: Record; accountReconciliationRecordsBySelectedPeriod: Record; actionFetchState: ActionFetchStates; excludedAccountExclusionInfo: Record; excludedAccountIDs: ID[]; reconListUIState: ReconListUIState; reconTabsState: ReconciliationTabsState; refreshStatus: FetchStateAndError; selectedTab: ReconciliationViewTabType; statementUploadChosen: boolean; selectedAccountId?: ID; selectedDrawerAccountId?: ID; summary?: ReconciliationViewSummary; } export interface BankConnectionStatus { connectionInProgress: boolean; status: BankStatusCodeType; paymentAccountId?: ID; } export interface AccountReconciliationRecords { accountIDs: ID[]; reconciliationByAccountID: Record; } export interface StatementTransactionForUpdate { amount: number; transactionDate: string; transactionDirection: 'debit' | 'credit'; transactionMemo: string; /** * Client-only stable id for unsaved added rows. Preserved across local-data * rebuilds so form rows survive add/delete without index remapping. Not sent * to the API. */ id?: string; statementTransactionId?: string; } export interface StatementTransactionsUpdate { added: StatementTransactionForUpdate[]; deletedIds: string[]; updated: StatementTransactionForUpdate[]; } /** Client-only totals derived from in-period transactions; not sent on PUT. */ export interface StatementBalancesFromTransactions { closingBalance: number; totalDeposits: number; totalPayments: number; } export interface StatementUpdateLocalData { statementMeta: StatementMeta; statementTransactions: StatementTransactionsUpdate; balancesFromTransactions?: StatementBalancesFromTransactions; } export interface StatementUpdateLocalDataPayload { statement_meta: { closing_balance: number; opening_balance: number; statement_end_date: string; statement_start_date: string; total_deposits: number; total_payments: number; }; statement_transactions: { added: Array<{ amount: number; transaction_date: string; transaction_direction: 'debit' | 'credit'; transaction_memo: string; }>; deleted_ids: string[]; updated: Array<{ amount: number; statement_transaction_id: string; transaction_date: string; transaction_direction: 'debit' | 'credit'; transaction_memo: string; }>; }; } export declare const toStatementAccountScope: (v: string) => "single_account" | "multi_account"; export type StatementAccountScope = ReturnType; export declare const toStatementAccountScopeStrict: (v: string | null | undefined) => StatementAccountScope | undefined; export declare const STATEMENT_ACCOUNT_SCOPES: readonly StatementAccountScope[]; export interface CombinedStatementAccountMappingDraft { accountId: ID; ledgerIdentifier: string; } export interface AccountReconciliationLocalData { accountSource?: ReconciliationAccountSourceType; /** Draft ledger mappings saved when continuing combined mapping in background. */ combinedStatementAccountMappings?: CombinedStatementAccountMappingDraft[]; statementAccountScope?: StatementAccountScope; /** Confirm & Save drafts keyed by statementUploadId (single and combined). */ statementUpdateLocalDataByUploadId?: Record; } export interface AccountReconciliationDataWithTransactionFetchState { accountId: ID; confirmStatementMappingConflict: ConfirmStatementMappingConflict | null; confirmStatementMappingStatus: FetchStateAndError; localData: AccountReconciliationLocalData; refreshStatus: FetchStateAndError; reparseStatementStatus: FetchStateAndError; statementDateConflict: StatementDateConflict | null; statementDeleteStatus: FetchStateAndError; /** True while statement upload/parse/reparse is in flight (local + entity signals). */ statementParseInProgress: boolean; /** Client-driven fetch state for the parseStatement epic (In-Progress/Completed/Error). */ statementParseStatus: FetchStateAndError; /** Step progress saved when user continues parsing in background. */ statementProcessingBackgroundCompletedSteps: number; /** User dismissed StatementProcessingPage via Continue in Background. */ statementProcessingDismissedToBackground: boolean; /** True when statement upload/parse failed for this account (drives drawer error popup). */ statementProcessingFailed: boolean; statementUpdateStatus: FetchStateAndError; statementUploadStatus: FetchStateAndError; transactionFetchState: FetchStateAndError; accountDetectionReason?: string; /** Persisted after mapping confirm for batch GET / group pusher resolution. */ combinedStatementGroupId?: string; confirmedCombinedStatementUploads?: ConfirmedCombinedStatementUpload[]; parsedStatementData?: ParsedStatementData; reconciliationId?: ID; /** Wall-clock start used to recompute UI step progress after backgrounding. */ statementProcessingStartedAtMs?: number; /** Locked countdown duration (seconds) paired with startedAtMs. */ statementProcessingTotalDurationSeconds?: number; } export {};