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 widgetToken and organizationId resolve.
  • 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.

PropTypeDefaultDescription
pageSizeOptionsnumber[][10, 25, 50, 100]Page-size choices shown by the table. The list opens at the first one.
onViewAllDocumentsEvent
(customer: CounterpartActionTarget) => void
(customer: CounterpartActionTarget) => void
undefinedShows a "View all" action on the details sheet's recent invoices and passes the customer's id and name; omit to hide it.
onCreateDocumentEvent
(customer: CounterpartActionTarget) => void
(customer: CounterpartActionTarget) => void
undefinedHandles "Issue an invoice" with the customer's id and name; omit to hide the button. You check invoice scopes.
Label overrides
PropTypeDefaultDescription
screenLabelsLabelsPartial<CounterpartsScreenLabels>English labelsTable, search, filter, empty and error copy.
formLabelsLabels
Partial<CounterpartFormSheetLabels>
Partial<CounterpartFormSheetLabels>
English labelsCreate/edit customer form copy.
detailsLabelsLabels
Partial<CounterpartDetailsSheetLabels>
Partial<CounterpartDetailsSheetLabels>
English labelsDetails sheet copy.
addressLabelsLabels
PartialDeep<AddressFormSheetLabels>
PartialDeep<AddressFormSheetLabels>
English labelsAddress form copy.
deleteLabelsLabels
Partial<ConfirmDeleteDialogLabels>
Partial<ConfirmDeleteDialogLabels>
English labelsDelete-dialog copy.
messageLabelsLabelsPartial<CounterpartMessageLabels>English labelsValidation, 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.

On this page