Skip to Content
@get-asset/reactComponents

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:read
  • business:update

API reference

Root props

PropTypeRequiredDefaultDescription
classNamestringNo
state"loading" | "error" | "empty"NoForce a specific state for testing/storybook.
rulesBusinessReceiptRulePublic[]NoOverride fetched rules for testing/storybook. Skips the API call.
onAddRule() => voidNoThe host opens its own rule editor.
onEditRule(ruleId: string) => voidNoThe host opens its own rule editor, for this rule. The default rule goes by the id "default", which ReceiptRuleEditor takes as its ruleId.
currencystringNoISO-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.

On this page