@get-asset/sdk

Tasks

Headless compound for the outstanding-tasks list a business needs to act on. The Root fetches the outstanding tasks and renders one section per API task_type(reconnect, each document request, each question type), ordered and labelled by the SDK. Group those sections by what they do with the kind components — Tasks.Reconnect, Tasks.Upload, Tasks.Classify — each of which renders every section of that kind that has outstanding tasks. Upload (attach files as documents) and Classify (leave a note on the journal entry, which marks the task done) are built in; reconnect runs through the shared PlaidLink in update mode — wire onReconnect to its connect(), as AssetTasks does. The token needs the matching scopes (see below): reconnect uses plaid:create, upload document:create, and a comment journal_entry:read + journal_entry:create. Each section is independently collapsible and caps its rows behind a “show more” toggle.

Anatomy

Import the primitive and compose the parts you need.

<Tasks.Root>
<Tasks.Status />
<Tasks.Success>
{/* Reconnect — button calls onReconnect (wire to PlaidLink) */}
<Tasks.Reconnect>
<Tasks.GroupTrigger>
<Tasks.GroupLabel />
<Tasks.GroupCount />
</Tasks.GroupTrigger>
<Tasks.GroupContent>
<Tasks.GroupDescription />
<Tasks.GroupTasks>
<Tasks.Task>
<Tasks.TaskDescription />
<Tasks.ReconnectTrigger />
</Tasks.Task>
</Tasks.GroupTasks>
</Tasks.GroupContent>
</Tasks.Reconnect>
{/* Upload — button opens a file picker and uploads */}
<Tasks.Upload>
<Tasks.GroupTrigger>
<Tasks.GroupLabel />
<Tasks.GroupCount />
</Tasks.GroupTrigger>
<Tasks.GroupContent>
<Tasks.GroupTasks>
<Tasks.Task>
<Tasks.TaskDescription />
<Tasks.UploadTrigger />
</Tasks.Task>
</Tasks.GroupTasks>
</Tasks.GroupContent>
</Tasks.Upload>
{/* Classify — comment button opens an inline note form */}
<Tasks.Classify>
<Tasks.GroupTrigger>
<Tasks.GroupLabel />
<Tasks.GroupCount />
</Tasks.GroupTrigger>
<Tasks.GroupContent>
<Tasks.GroupTasks>
<Tasks.Task>
<Tasks.TaskDescription />
<Tasks.CommentTrigger />
</Tasks.Task>
<Tasks.CommentForm>
<Tasks.CommentInput />
<Tasks.CommentCancel /> <Tasks.CommentSubmit />
</Tasks.CommentForm>
</Tasks.GroupTasks>
<Tasks.GroupShowMore />
</Tasks.GroupContent>
</Tasks.Classify>
</Tasks.Success>
<Tasks.Empty>You&apos;re all caught up!</Tasks.Empty>
</Tasks.Root>

Required scopes

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

  • request:read
  • transaction:read
  • plaid:create
  • document:create
  • journal_entry:read
  • journal_entry:create

API reference

Root props

PropTypeDefaultDescription
tasksTasksTask[]Override the fetched tasks with a fixed list — mainly for testing/storybook. Pending entries become rows.
accountsExternalAccountPublic[]Override the external accounts resolved for statement / reconnect / categorization rows. Otherwise fetched live only when a row needs one.
transactionsTransactionPublic[]Override the transactions resolved for categorization rows (amount / date / account). Otherwise fetched live by id when a row needs them.
onReconnect(task: TasksTask) => voidCalled when a reconnect row's button is clicked — wire it to your Plaid (update-mode) flow. AssetTasks wires it to the shared PlaidLink.
onUpload(task: TasksTask, files: File[]) => Promise<void>Optional. Override the built-in upload — defaults to attaching the files to the task as documents.
onAddNote(task: TasksTask, message: string) => Promise<void>Optional. Override the built-in comment — defaults to leaving the note on the task's journal entry.
state"loading" | "error" | "empty"Force a specific state for testing.
childrenrequiredReactNodeCompound parts.

Parts

Container

Always rendered. Fetches data and provides context.

PartDescription
Tasks.RootFetches the pending tasks and provides context.
Tasks.Status
asChild?, format?
Renders the header status — defaults to "N tasks" or "Up to date". Pass format({ pending, isComplete }) to override.
Tasks.PendingCount
asChild?, format?
Number of outstanding (pending) tasks across all sections.

Success

Renders when there are pending tasks.

PartDescription
Tasks.SuccessState wrapper. Compose the sections inside.
Tasks.ReconnectRenders each reconnect-kind section (one per task_type) that has outstanding tasks; nothing when there are none.
Tasks.UploadRenders each upload-kind section (statements, receipts, payroll, documents) that has outstanding tasks.
Tasks.ClassifyRenders each classify-kind section (categorize, review, …) that has outstanding tasks.
Tasks.GroupsGeneric alternative: iterates every non-empty section (one per task_type) in order.
Tasks.Group
asChild?
Generic per-group wrapper used with Tasks.Groups.
Tasks.GroupTrigger
asChild?
Toggles the section open/closed. Sets data-state + aria-expanded.
Tasks.GroupLabel
asChild?
The group's label, e.g. "Reconnect accounts".
Tasks.GroupCount
asChild?, format?
Number of remaining tasks in the section (default e.g. "3"). Pass format({ pending }) to override.
Tasks.GroupDescription
asChild?
One-line explanation for the group.
Tasks.GroupContentRenders its children only while the group is open.
Tasks.GroupTasksIterates the group's visible tasks, providing per-task context.
Tasks.Task
asChild?
Per-task wrapper. Sets data-task-type and data-status.
Tasks.TaskDescription
asChild?
The task's description text.
Tasks.TaskMonth
asChild?, format?
The task's YYYY-MM month. Pass format(month) to override.
Tasks.TaskType
asChild?
The raw API task_type.
Tasks.TaskAccount
asChild?, format?
The resolved external account (name + mask) for statement-request rows. Empty for other tasks.
Tasks.TaskInstitution
asChild?, format?
The resolved institution name (from the linked item) for reconnect-account rows. Empty for other tasks.
Tasks.ReconnectTrigger
asChild?
Calls Root's onReconnect with the task (wired to PlaidLink update mode by AssetTasks). Reconnect rows.
Tasks.UploadTrigger
asChild?, accept?, multiple?
Opens a file picker and uploads the chosen files for the task. Owns a hidden file input. Upload rows.
Tasks.UploadErrorMessage
asChild?, format?
Renders the upload error copy for the row whose last upload failed (empty otherwise).
Tasks.GroupShowMore
asChild?, format?
Toggles the per-section row limit. Hidden when nothing is collapsed.

Classify comment form

Per-task inline form for classifying a transaction — leaves a note on the journal entry, which marks the task done.

PartDescription
Tasks.CommentTrigger
asChild?
Toggles the current task's comment form open/closed.
Tasks.CommentFormRenders its children only while the current task's form is open.
Tasks.CommentInput
asChild?
Controlled textarea bound to the draft comment.
Tasks.CommentSubmit
asChild?
Submits the comment. Disabled while empty or saving; sets data-pending.
Tasks.CommentCancel
asChild?
Closes the form without saving.
Tasks.CommentErrorMessage
asChild?
Renders the save-error copy (empty when there's no error).

Loading

Renders while the fetch is in flight.

PartDescription
Tasks.LoadingState wrapper. Render skeletons inside.

Empty

Renders when there are no pending tasks ("up to date").

PartDescription
Tasks.EmptyState wrapper. Render the caught-up message inside.

Error

Renders on fetch error.

PartDescription
Tasks.ErrorState wrapper. Compose the error UI inside.
Tasks.ErrorMessage
asChild?
Renders the error message string.
Tasks.Retry
asChild?
Button that refetches the task list.

Hooks

PartDescription
useTasks()Hook returning the full context.
useTasksGroup()Per-group context (inside Tasks.Groups).
useTask()Per-task context (inside Tasks.GroupTasks).