Skip to Content
@get-asset/reactComponents

Document Details

Statement details with reconciliation, buffered transaction edits, and PDF or image preview. Other document types render the not-available state.

Preview

Loading preview…

Required scopes

The access token used by AssetProvider must include these scopes for this primitive to fetch data successfully:

  • document:read
  • document:update
  • external_account:read
  • ledger:read
  • journal_entry:read
  • journal_entry:create
  • journal_entry:update
  • journal_entry:delete
  • transaction:read
  • transaction:update
  • transaction:delete

API reference

Root props

PropTypeDefaultDescription
documentIdrequiredstring—The document to load. Changing it discards the previous document's edit session.
onBack() => void—Called by Back to documents. The host owns navigation.
formatAmount(amount: number) => string—Money formatter for balances, transactions, and banner amounts. Defaults to USD with two decimals.
formatDate(date: string) => string—Formats displayed dates, including the styled edit-mode date field. Input values retain YYYY-MM-DD calendar dates.
documentDocumentPublic—Offline document override. Disables all network reads and server writes. Balances come from metadata_.statement_starting_balance and metadata_.statement_closing_balance.
rowsJournalEntryEacPublic[]—Overrides journal entries, including their line_entries. Otherwise every page is fetched using document_id. Supply accounts and ledgers with offline rows to derive signed amounts.
transactionsTransactionPublic[]—Overrides backing transaction reads. Their amounts establish the sign convention for transaction-backed row edits. Otherwise fetched by transaction_id; document overrides keep these reads offline too.
accountsExternalAccountPublic[]—Overrides external accounts for the immediate-save picker and the statement account's ledger_id.
ledgersLedgerPublic[]—Overrides ledger lookup. Its debit_credit determines the signed statement amount. New rows prefer fallbackLedgerId, then look up Uncategorized Inflow or Uncategorized Outflow by name.
fallbackLedgerIdstring—Host-provided offset ledger ID for new rows, for either amount direction. Takes precedence over the legacy Uncategorized Inflow/Outflow name lookup. LedgerPublic has no unique uncategorized-ledger marker. If neither resolves, Save is disabled with the standard save error until the offset is available or the new row is removed.
previewUrlstring | null—Overrides the signed URL request; null explicitly supplies no URL. The file extension is always read from document.name.
state"loading" | "error"—Forces a display state and disables network reads.
onSave(draft: DocumentDetailsDraft) => void | Promise<void>—Replaces statement server writes. Useful for offline demos. Reject to show the save error; the raw cause remains attached to the error.
onSelectAccount(id: string) => void | Promise<void>—Replaces the immediate account-association write. Account selection is separate from the edit buffer.
classNamestring—Additional class on the outer surface. Give its parent a height to fill.

Layout and mobile

Desktop shows document details and the file side by side. Below 960px, View document opens a dedicated preview screen; Back to details returns to the detail body. Zoom and the open-original link are the only file tools. Previewing a file preserves unsaved edits.

File preview

PDF files load React-PDF dynamically and show every page, with range requests disabled. The renderer configures the installed PDF.js worker using a bundler-resolved URL in the same ESM module. Both package entry formats defer that import. Annotation and text layer styles are included in styles.css. JPG, JPEG, and PNG files render as images. Other extensions show Preview not available for this file type.

Saving and permissions

Statement changes stay local until Save. Every row allows date, description, and amount edits. Save writes balances, one batch of transaction updates, manual journal entry patches, one batch of transaction deletes, manual journal entry deletes, then new balanced journal entries associated with the document. A failed batch retains its completed writes and locks the remaining buffer until retry or Cancel. Account selection saves immediately outside that buffer. Transaction amount changes rebuild journal entries asynchronously; the post-save refetch may briefly show the old amount or omit an entry while it is rebuilt. When rows are missing after an amount save, they refresh every 1.5 seconds until every updated transaction has a row, for up to 30 seconds. Recovery stops silently at the cap or when this document closes. Processing documents refresh every 2 seconds until their status changes.

DocumentDetails.scopes lists all required permissions, including external_account:read, ledger:read, and transaction:read for account choices, ledger lookup, and backing transaction amounts. The SDK and styled component require the same scopes.

On this page