dolfindevelopers

Edit customer dialog

DialogReceivablesSDK + UI

Edit a customer's name, contact details, tax number and address in a dialog. Settings the form does not show (e-invoicing address, WhatsApp) are kept as they are; a fields prop and a request hook let the host edit them.

Dialog: a modal you open from your own screen. You control when it opens with its props. Pages vs components

Choose your integration

Ready to connect to Dolfin. Loads data through SDK hooks, with appearance and behaviour you can customise. Requires DolfinProvider.

Loading preview…

Installation

Needs the Dolfin registry token. The CLI copies the source into your app.

Terminal
bunx --bun shadcn@4.23.0 add @dolfin/ar-edit-customer-dialog

Also installs: button, dialog, base-theme, ar-customer-form, ui-ar-edit-customer-dialog.

Usage

screen.tsx
import { ArEditCustomerDialog } from "@/components/dolfin/ar/edit-customer-dialog";

// Place it anywhere inside your <DolfinProvider>.
<ArEditCustomerDialog customer={customer} open={open} onOpenChange={handleOpenChange} />

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

PropTypeDescription
customer required{ id?: string; organisationId?: string; name: string; email?: null | string; phone?: null | string; taxNumber?: null | string; addressLine1?…The customer to edit; the form is filled from it each time the dialog opens.
open requiredboolean
onOpenChange required(open: boolean) => void
onUpdated(customer: Customer) => voidAfter the save; the dialog has closed.
transformRequest(body: UpdateCustomerRequest) => UpdateCustomerRequestAdjust the request before it is sent, e.g. to add the values of your `fields`.
onSubmit(body: UpdateCustomerRequest) => Promise<Customer | void> | voidSaves the changes yourself instead of the SDK. The dialog closes once it resolves and shows the error in place if it rejects.
submittingbooleanYour own save is running.
countriesreadonly CodeOption[]The countries to offer (ISO code and name), instead of loading them.
fieldsstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Extra fields after the address (e.g. e-invoicing or WhatsApp settings); pair with `transformRequest`.
titlestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…
descriptionstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…
hideAddressboolean
classNamestring

Customisation

Without editing the source, you can change:

Class names
className
Messages
ar.customers

Or edit the installed file directly: it is your code. See theming for colours and fonts.

Hooks

The SDK hooks this dialog uses. Use them directly from @dolfinai/react to build your own version.

useCustomerMutationsuseMessages

Files

Written to your app by the install command:

  • components/dolfin/ar/edit-customer-dialog.tsx 130 lines