Skip to content

Commerce

Checkout link analytics card

CheckoutLinkAnalyticsCard — exported from the library at `src/components/checkout-links/CheckoutLinkAnalyticsCard.tsx`. Awaiting a written description.
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.

Checkout link analytics card

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
linkId*string—Used to build the default share URL.
statsCheckoutLinkAnalyticsStatsDEFAULT_CHECKOUT_LINK_ANALYTICS_STATSThe figures to display. Defaults to `DEFAULT_CHECKOUT_LINK_ANALYTICS_STATS`.
statsForRange(rangeKey: string) => CheckoutLinkAnalyticsStats | undefined—Optional per-range figures, so changing the date range in a demo re-renders plausible numbers without inventing them. Return `undefined` to fall back to `stats`. Must be a pure function of the range key.
defaultDateRangestring"30d"Uncontrolled initial date range key.
dateRangestring—Controlled date range key — one of the date-range presets, or `"custom"`.
onDateRangeChange(rangeKey: string, start: Date, end: Date) => void—Undocumented — add TSDoc to the prop in the library.
defaultPanelOpenbooleanfalseUncontrolled seed for the date-range panel, so "panel open" is a snapshot.
panelOpenboolean—Controlled date-range panel state.
onPanelOpenChange(open: boolean) => void—Undocumented — add TSDoc to the prop in the library.
defaultShareOpenbooleanfalseUncontrolled seed for the share modal.
shareOpenboolean—Controlled share modal state.
onShareOpenChange(open: boolean) => void—Undocumented — add TSDoc to the prop in the library.
shareUrlstring—URL offered in the share modal. Defaults to `https://bts.space/c/{linkId}`.
titlestring"Analytics"Heading text beside the range button.
currencySymbolstring"$"Prefix on the revenue figure. BTS reports in AUD, hence the bare `$`.
nowDateDATE_RANGE_DEFAULT_NOWReference "today" for the relative presets.
epochDateDATE_RANGE_DEFAULT_EPOCHStart of the "All time" range.
usePortalForPanelbooleantrueRender the date-range panel into `document.body`. False keeps it in flow, which is what a docs page wants.
anchorPanelToHeaderbooleantruePin the date-range panel under the header row (the app's behaviour). Set false and the panel uses `DateRangePickerPanel`'s un-anchored fallback inset instead. Why this is a prop: the panel measures its anchor once, in a layout effect fired when `open` flips. A story that opens the panel *on mount* races the stylesheet — the measurement can land before the CSS applies and produce a zero-width panel. Un-anchoring sidesteps the race.
classNamestring—Undocumented — add TSDoc to the prop in the library.

Reference

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

Source
src/components/checkout-links/CheckoutLinkAnalyticsCard.tsx
Portability
Copies across unchanged — only the utils import path moves.