@get-asset/sdk

Aged Report

Headless aging report for outstanding receivables or payables. It fetches the matching report, normalizes customer and vendor rows into the same shape, and calculates column totals. The aging date is the last day of the range selected on AssetProvider by the shared date picker. Compose the bucket iterators for the four aging columns and use the same compound for either report by changing kind.

Anatomy

Import the primitive and compose the parts you need.

<AgedReport.Root kind="receivable">
<AgedReport.Success>
<AgedReport.BucketColumns>
<AgedReport.BucketLabel />
</AgedReport.BucketColumns>
<AgedReport.Rows>
<AgedReport.Name />
<AgedReport.Buckets>
<AgedReport.BucketLabel />
<AgedReport.BucketAmount />
</AgedReport.Buckets>
<AgedReport.Total />
</AgedReport.Rows>
<AgedReport.TotalsBuckets>
<AgedReport.BucketAmount />
</AgedReport.TotalsBuckets>
<AgedReport.GrandTotal />
</AgedReport.Success>
<AgedReport.Loading></AgedReport.Loading>
<AgedReport.Empty>Nothing outstanding.</AgedReport.Empty>
<AgedReport.Error>
<AgedReport.ErrorMessage />
<AgedReport.Retry>Try again</AgedReport.Retry>
</AgedReport.Error>
</AgedReport.Root>

Required scopes

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

  • report:read

API reference

Root props

PropTypeDefaultDescription
kindrequired"receivable" | "payable"Selects the API endpoint and customer/vendor labels used by the compound.
dateFromCalendarDateStringInclusive start (YYYY-MM-DD) of a fixed reporting range. Detaches the report from the provider's shared range entirely and must be paired with dateTo — passing one without the other throws. Use periodDateRange to derive the pair from a month, quarter, or year.
dateToCalendarDateStringInclusive end (YYYY-MM-DD) of the fixed reporting range, and the day the report ages from. Must be paired with dateFrom. Omit both to follow the provider's date picker.
linesAgedReportLineOverride[]Overrides fetched rows and skips API requests. Missing bucket values default to zero; missing totals are calculated from the buckets.
state"loading" | "error" | "empty"Forces a state and skips API requests.
childrenrequiredReactNodeCompound parts.

Parts

Container

Always rendered. Provides the report data and state to its children.

PartDescription
AgedReport.RootFetches aged receivables or payables for the current business and provides context.
AgedReport.Title
asChild?
Renders "Aged Receivables" or "Aged Payables" for the active kind.
AgedReport.PartyLabel
asChild?
Renders "Customer" for receivables or "Vendor" for payables.
AgedReport.AsOf
asChild?, format?
Renders the aging date — the last day of the resolved range. The format callback receives the Date value.

Bucket columns

Iterates the four columns in order: 0–30, 31–60, 61–90, and 90+ days.

PartDescription
AgedReport.BucketColumnsIterates the four bucket definitions for column headers and provides bucket context.
AgedReport.BucketLabel
asChild?
Renders the current bucket label and adds its key as the data-bucket attribute.

Success

Renders when the report contains one or more rows.

PartDescription
AgedReport.SuccessState wrapper. Compose the report table inside.
AgedReport.RowsIterates each customer or vendor row and provides row context.
AgedReport.Name
asChild?
Renders the current customer or vendor name.
AgedReport.BucketsIterates the current row's four bucket amounts and provides bucket context.
AgedReport.BucketAmount
asChild?, format?
Renders the current bucket amount. Adds data-bucket and data-empty when the amount is zero.
AgedReport.Total
asChild?, format?
Renders the current row's total outstanding amount.
AgedReport.TotalsBucketsIterates the four calculated column totals and provides bucket context.
AgedReport.GrandTotal
asChild?, format?
Renders the total outstanding amount across all rows.

Loading

Renders while the request is in flight.

PartDescription
AgedReport.LoadingState wrapper. Render a skeleton or placeholder inside.

Empty

Renders when the report has no rows.

PartDescription
AgedReport.EmptyState wrapper. Render an empty-state message inside.

Error

Renders when the report request fails.

PartDescription
AgedReport.ErrorState wrapper. Compose the error UI inside.
AgedReport.ErrorMessage
asChild?, format?
Renders the report error message.
AgedReport.Retry
asChild?
Button that re-runs the active report request.

Hooks and constants

PartDescription
useAgedReport()Returns kind, title, party, asOf, lines, totals, hasData, loading, error, and retry.
useAgedRow()Returns the current normalized row inside Rows.
useAgedBucket()Returns the current bucket key, label, and amount inside an iterator.
AGED_BUCKETSThe ordered bucket definitions exported for custom compositions.