@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'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:readtransaction:readplaid:createdocument:createjournal_entry:readjournal_entry:create
API reference
Root props
| Prop | Type | Default | Description |
|---|---|---|---|
tasks | TasksTask[] | — | Override the fetched tasks with a fixed list — mainly for testing/storybook. Pending entries become rows. |
accounts | ExternalAccountPublic[] | — | Override the external accounts resolved for statement / reconnect / categorization rows. Otherwise fetched live only when a row needs one. |
transactions | TransactionPublic[] | — | Override the transactions resolved for categorization rows (amount / date / account). Otherwise fetched live by id when a row needs them. |
onReconnect | (task: TasksTask) => void | — | Called 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. |
childrenrequired | ReactNode | — | Compound parts. |
Parts
Container
Always rendered. Fetches data and provides context.
| Part | Description |
|---|---|
Tasks.Root | Fetches the pending tasks and provides context. |
Tasks.StatusasChild?, format? | Renders the header status — defaults to "N tasks" or "Up to date". Pass format({ pending, isComplete }) to override. |
Tasks.PendingCountasChild?, format? | Number of outstanding (pending) tasks across all sections. |
Success
Renders when there are pending tasks.
| Part | Description |
|---|---|
Tasks.Success | State wrapper. Compose the sections inside. |
Tasks.Reconnect | Renders each reconnect-kind section (one per task_type) that has outstanding tasks; nothing when there are none. |
Tasks.Upload | Renders each upload-kind section (statements, receipts, payroll, documents) that has outstanding tasks. |
Tasks.Classify | Renders each classify-kind section (categorize, review, …) that has outstanding tasks. |
Tasks.Groups | Generic alternative: iterates every non-empty section (one per task_type) in order. |
Tasks.GroupasChild? | Generic per-group wrapper used with Tasks.Groups. |
Tasks.GroupTriggerasChild? | Toggles the section open/closed. Sets data-state + aria-expanded. |
Tasks.GroupLabelasChild? | The group's label, e.g. "Reconnect accounts". |
Tasks.GroupCountasChild?, format? | Number of remaining tasks in the section (default e.g. "3"). Pass format({ pending }) to override. |
Tasks.GroupDescriptionasChild? | One-line explanation for the group. |
Tasks.GroupContent | Renders its children only while the group is open. |
Tasks.GroupTasks | Iterates the group's visible tasks, providing per-task context. |
Tasks.TaskasChild? | Per-task wrapper. Sets data-task-type and data-status. |
Tasks.TaskDescriptionasChild? | The task's description text. |
Tasks.TaskMonthasChild?, format? | The task's YYYY-MM month. Pass format(month) to override. |
Tasks.TaskTypeasChild? | The raw API task_type. |
Tasks.TaskAccountasChild?, format? | The resolved external account (name + mask) for statement-request rows. Empty for other tasks. |
Tasks.TaskInstitutionasChild?, format? | The resolved institution name (from the linked item) for reconnect-account rows. Empty for other tasks. |
Tasks.ReconnectTriggerasChild? | Calls Root's onReconnect with the task (wired to PlaidLink update mode by AssetTasks). Reconnect rows. |
Tasks.UploadTriggerasChild?, accept?, multiple? | Opens a file picker and uploads the chosen files for the task. Owns a hidden file input. Upload rows. |
Tasks.UploadErrorMessageasChild?, format? | Renders the upload error copy for the row whose last upload failed (empty otherwise). |
Tasks.GroupShowMoreasChild?, 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.
| Part | Description |
|---|---|
Tasks.CommentTriggerasChild? | Toggles the current task's comment form open/closed. |
Tasks.CommentForm | Renders its children only while the current task's form is open. |
Tasks.CommentInputasChild? | Controlled textarea bound to the draft comment. |
Tasks.CommentSubmitasChild? | Submits the comment. Disabled while empty or saving; sets data-pending. |
Tasks.CommentCancelasChild? | Closes the form without saving. |
Tasks.CommentErrorMessageasChild? | Renders the save-error copy (empty when there's no error). |
Loading
Renders while the fetch is in flight.
| Part | Description |
|---|---|
Tasks.Loading | State wrapper. Render skeletons inside. |
Empty
Renders when there are no pending tasks ("up to date").
| Part | Description |
|---|---|
Tasks.Empty | State wrapper. Render the caught-up message inside. |
Error
Renders on fetch error.
| Part | Description |
|---|---|
Tasks.Error | State wrapper. Compose the error UI inside. |
Tasks.ErrorMessageasChild? | Renders the error message string. |
Tasks.RetryasChild? | Button that refetches the task list. |
Hooks
| Part | Description |
|---|---|
useTasks() | Hook returning the full context. |
useTasksGroup() | Per-group context (inside Tasks.Groups). |
useTask() | Per-task context (inside Tasks.GroupTasks). |