Skip to content

Settings

Discount editor

The full-screen discount builder that switches its section cards, form fields, and a live summary sidebar based on discount kind: amount off products, buy X get Y, or amount off order.
Available
Ports as-is

Examples

Rendered live from the maintained Storybook story. Lantern stores only the story id and embeds Storybook rather than duplicating the component or its demo.

Discount editor

Rendered live from Storybook

Storybook must be running for this to load — bun run start:storybook from the monorepo root, or set NEXT_PUBLIC_STORYBOOK_URL to a deployed instance.

Props

The component's public API, read from its TypeScript source. Descriptions come from TSDoc on the prop, so this table cannot drift from the component.

PropTypeDefaultDescription
kind*DiscountKind—Undocumented — add TSDoc to the prop in the library.
headerTitle*string—Undocumented — add TSDoc to the prop in the library.
autoApply*boolean—Undocumented — add TSDoc to the prop in the library.
code*string—Undocumented — add TSDoc to the prop in the library.
valueMode*DiscountValueMode—Undocumented — add TSDoc to the prop in the library.
value*string—Undocumented — add TSDoc to the prop in the library.
applyItems*ApplyItem[]—Undocumented — add TSDoc to the prop in the library.
buyItems*ApplyItem[]—Undocumented — add TSDoc to the prop in the library.
getItems*ApplyItem[]—Undocumented — add TSDoc to the prop in the library.
getValueMode*DiscountValueMode—Undocumented — add TSDoc to the prop in the library.
getValue*string—Undocumented — add TSDoc to the prop in the library.
minRequirement*DiscountMinRequirement—Undocumented — add TSDoc to the prop in the library.
minOrderValue*string—Undocumented — add TSDoc to the prop in the library.
minItemQuantity*string—Undocumented — add TSDoc to the prop in the library.
limitEnabled*boolean—Undocumented — add TSDoc to the prop in the library.
limitCount*string—Undocumented — add TSDoc to the prop in the library.
limitUsesPerOrder*boolean—Undocumented — add TSDoc to the prop in the library.
limitUsesPerOrderCount*string—Undocumented — add TSDoc to the prop in the library.
expiryEnabled*boolean—Undocumented — add TSDoc to the prop in the library.
endDateDate—Undocumented — add TSDoc to the prop in the library.
endTime*string—Undocumented — add TSDoc to the prop in the library.
restrictedLinksCount*number—Undocumented — add TSDoc to the prop in the library.
combineCodes*number—Undocumented — add TSDoc to the prop in the library.
combineAutomatic*number—Undocumented — add TSDoc to the prop in the library.
dateLocalestring"en-US"Locale for the expiry date line. The app passed `undefined` (machine locale); pinned here so the same draft renders the same string everywhere.

Reference

Transcribed from the component audit. If this disagrees with the source, the source is right.

Source
src/components/settings/DiscountEditor.tsx
Portability
Copies across unchanged — only the utils import path moves.
Notes
Use it for building or editing a discount in depth, since each kind reveals a different middle section (apply-to, buy/get pickers, or minimum requirements) while sharing details and settings. Only one section card can be expanded at a time, and the Save action is gated by kind-specific completeness rules rather than a single shared check.