Receipt Rules
Styled drop-in list of a business's own receipt rules — when a receipt is asked for on a ledger — with delete, and Add and Edit handed to your editor.
List a business's own receipt rules — when a receipt is asked for on a ledger — and delete one. Add and Edit hand off to your own editor, or to the Receipt Rule Editor.
Built on the headless ReceiptRules compound from @get-asset/sdk.
Preview
Loading preview…
Usage
import { AssetReceiptRules } from "@get-asset/react";
import "@get-asset/react/styles.css";
<AssetReceiptRules onAddRule={() => openEditor()}
onEditRule={ruleId => openEditor(ruleId)}
/>Required scopes
The access token used by AssetProvider must include these scopes for this component to fetch data successfully:
business:readbusiness:update
API reference
Root props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
className | string | No | ||
state | "loading" | "error" | "empty" | No | Force a specific state for testing/storybook. | |
rules | BusinessReceiptRulePublic[] | No | Override fetched rules for testing/storybook. Skips the API call. | |
onAddRule | () => void | No | The host opens its own rule editor. | |
onEditRule | (ruleId: string) => void | No | The host opens its own rule editor, for this rule. The default rule goes by the id "default", which ReceiptRuleEditor takes as its ruleId. | |
currency | string | No | ISO-4217 code the amounts are denominated in. Resolved from the business's own country when omitted — a Canadian business's thresholds are in CAD — which costs a Business lookup the other receipt components already make. |
Behaviour
The host owns navigation between the list and the editor. A business's rule replaces the tenant's for the same ledger name. Deleting it returns that ledger to the business's default rule, or, when the business has no default of its own, to the tenant's rule for its name.