Customers
Manages an organization's customers: a searchable list with money columns, a details sheet, and create, edit and delete flows.
Part ofFinOps
Manages an organization's customers: a searchable list with money columns, a details sheet, and create, edit and delete flows.
Quick Start
import { CustomersWidget } from '@tesouro/embedded-components-react';
export function CustomersPage() {
return (
<CustomersWidget
baseUrl="https://api.tesouro.com"
widgetToken="wt_..."
organizationId="org_..."
/>
);
}It is the customers-only view of CounterpartsWidget and shares its label types.
Behaviour
- Create, edit and delete actions are gated by the user's widget-init scopes.
- Queries wait until
widgetTokenandorganizationIdresolve. - Addresses are US-only: country is fixed to the United States with a US state picker.
Props
Widget props
Every copy prop is merged over built-in English defaults.
| Prop | Type | Default | Description |
|---|---|---|---|
pageSizeOptions | number[] | [10, 25, 50, 100] | Page-size choices shown by the table. The list opens at the first one. |
onViewAllDocumentsEvent |
| undefined | Shows a "View all" action on the details sheet's recent invoices and passes the customer's id and name; omit to hide it. |
onCreateDocumentEvent |
| undefined | Handles "Issue an invoice" with the customer's id and name; omit to hide the button. You check invoice scopes. |
Label overrides
| Prop | Type | Default | Description |
|---|---|---|---|
screenLabelsLabels | Partial<CounterpartsScreenLabels> | English labels | Table, search, filter, empty and error copy. |
formLabelsLabels |
| English labels | Create/edit customer form copy. |
detailsLabelsLabels |
| English labels | Details sheet copy. |
addressLabelsLabels |
| English labels | Address form copy. |
deleteLabelsLabels |
| English labels | Delete-dialog copy. |
messageLabelsLabels | Partial<CounterpartMessageLabels> | English labels | Validation, API failure and delete-prompt copy. |
Examples
Linking to your invoice pages
<CustomersWidget
onViewAllDocuments={({ id }) => navigate(`/invoices?customer=${id}`)}
onCreateDocument={({ id }) => navigate(`/invoices/new?customer=${id}`)}
/>TypeScript
import type {
CounterpartActionTarget,
CustomersWidgetProps,
} from '@tesouro/embedded-components-react';CounterpartActionTarget is { id: string; name: string }. The label types are the same shapes CounterpartsWidget uses; see CounterpartsWidget.md for their fields.