Merchant category mapping page
Map each merchant category to an account so card spend codes itself: Expenses header, a notice when there are no accounts to map to yet, Needs mapping (with a count) and All categories views, a search over all categories, and the mapping tables with account pickers that can create an account in place. ReactNode props for header actions, the empty state, an aside and the no-accounts notice; takes both tables' columns and row actions, and the initial view and search.
Page: A complete screen for one route, such as a bill or the invoices list. Mount it on a route in your app; connected SDK pages provide data and actions; standalone UI pages receive them as props. 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-merchant-category-mapping-pageAlso installs: input, tabs, expenses-mcc-mappings-table, base-page, base-theme, ui-expenses-merchant-category-mapping-page.
Usage
import { MerchantCategoryMappingPage } from "@/components/dolfin/expenses/merchant-category-mapping-page";
// A whole screen: mount it on a route, inside your <DolfinProvider>.
export default function Route() {
return <MerchantCategoryMappingPage />;
}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 |
|---|---|---|
filters | MccMappingsFilters | Initial filters. A changed value re-applies, e.g. from the URL. |
onViewChange | (view: MccMappingsView) => void | |
unmappedColumns | MccUnmappedColumnsProp | |
mappingColumns | MccMappingColumnsProp | |
unmappedRowActions | MccUnmappedRowActionsProp | Row actions on Needs mapping; none by default. |
mappingRowActions | MccMappingRowActionsProp | Row actions on All categories; none by default. |
headerActions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | |
emptyState | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the empty state of the current view. |
aside | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | |
noAccounts | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the "Connect your accounting platform first" notice (pass `null` to hide it). |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
expenses.merchants
Or edit the installed file directly: it is your code. See theming for colours and fonts.
Hooks
The SDK hooks this page uses. Use them directly from @dolfinai/react to build your own version.
useMccAccountsuseMccMappingMutationsuseMccMappingsuseMessagesFiles
Written to your app by the install command:
components/dolfin/expenses/merchant-category-mapping-page.tsx158 lines