Policy document review
Reviews an expense policy document once it is read: every proposed approval policy against the clause it came from (edit, leave out or include), the clauses that can't be enforced and why, the current policies confirming would delete, and a sticky Confirm policies bar with a confirmation listing what applies. Read-only without the manageExpensePolicies permission. Driven by useExpensePolicyDocumentReview.
Component: A piece you place inside your own screens: a table, a form, a card or a dialog. You decide the layout around it. Pages vs components
Ready to connect to Dolfin. Loads data through SDK hooks, with appearance and behaviour you can customise. Requires DolfinProvider.
Installation
Needs the Dolfin registry token. The CLI copies the source into your app.
bunx --bun shadcn@4.23.0 add @dolfin/expenses-policy-document-reviewAlso installs: alert-dialog, badge, button, card, base-theme, base-page, expenses-policy-document-proposals, ui-expenses-policy-document-review.
Usage
import { ExpensePolicyDocumentReview } from "@/components/dolfin/expenses/policy-document-review";
// Place it anywhere inside your <DolfinProvider>.
<ExpensePolicyDocumentReview document={document} />Renders inside DolfinProvider (set it up once). By default it loads its own data through the SDK. Supplied-data examples show how to override that behavior.
API reference
| Prop | Type | Description |
|---|---|---|
document required | { id: string; version: number | string; fileName: string; contentType: string; sizeBytes?: number | string; pageCount?: null | number | stri… | A document that has been read (ready for review, confirmed or superseded). |
referenceData | ExpensePolicyReferenceData | Names for the proposals' categories, merchants and approvers; read here when not passed. |
onConfirmed | () => void | After the document is confirmed. |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
expenses.approvalPolicies.document
Or edit the installed file directly: it is your code. See theming for colours and fonts.
Hooks
The SDK hooks this component uses. Use them directly from @dolfinai/react to build your own version.
useExpensePolicyDocumentReviewuseExpensePolicyFormatuseExpensePolicyReferenceDatauseMessagesFiles
Written to your app by the install command:
components/dolfin/expenses/policy-document-review.tsx216 lines