Epc Calculator 1
Affiliate EPC estimator set as a partner-newspaper front page: affiliates enter their list size and click rate, see live what one send of this offer could pay them (clearly labelled as an estimate), then take the one action: get their link.
Use it in a prompt
Use jv/epc-calculator from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/jv/epc-calculator.tsx. - Import it and pass your copy and images (Props tab):
import { EpcCalculator } from "@/components/funneldna/jv/epc-calculator"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/jv/epc-calculator/component.tsx 698 lines
// layout: advertorial-front
// Affiliate EPC estimator set as a partner-newspaper front page: affiliates enter their list size and click rate, see live what one send of this offer could pay them (clearly labelled as an estimate), then take the one action: get their link.
import * as React from "react"
import { AlertCircle, Calculator, Info } from "lucide-react"
export type EpcEstimate = {
listSize: number
clickRate: number
clicks: number
sales: number
perClick: number
perThousand: number
perSend: number
}
const COPY = {
edition: "Affiliate edition",
/** {product} and {price} are replaced. */
dateline: "{product} · {price} front end",
inputsTitle: "Run your list through the numbers",
listLabel: "Subscribers you'll mail",
listSuffix: "subscribers",
listPlaceholder: "5,000",
listSlider: "Drag to set your list size",
/** {list} is replaced. */
listValueText: "{list} subscribers",
rateLabel: "Your typical click rate",
rateSuffix: "% click",
ratePlaceholder: "4",
rateSlider: "Drag to set your click rate",
/** {rate} is replaced. */
rateValueText: "{rate} percent click rate",
listEmpty: "Enter your list size, like 5,000.",
listInvalid: "Use a whole number of subscribers, like 5,000.",
listTooBig: "Enter a list size under 10,000,000.",
rateEmpty: "Enter your typical click rate, like 4.",
rateInvalid: "Use a click rate between 0.1% and 50%.",
conversionLabel: "Offer conversion rate",
commissionLabel: "Your commission",
/** {rate} and {amount} are replaced. */
commissionValue: "{rate} · {amount} a sale",
factsNote: "Supplied by the offer owner. Your list may convert higher or lower.",
estimateChip: "Estimate",
liveNote: "Updates as you type",
staleNote: "Fix the highlighted field to update this estimate.",
/** {list} is replaced. */
totalLabel: "One send to {list} subscribers",
totalNote: "in estimated commission",
perClickLabel: "Per click (EPC)",
perThousandLabel: "Per 1,000 emails sent",
funnelLabel: "How the estimate is built",
sendsLabel: "Emails sent",
clicksLabel: "Clicks",
salesLabel: "Sales",
/** {sales} is replaced. */
salesValue: "≈ {sales}",
disclaimer: "Estimate only, not a promise of earnings. Real results depend on your list, your email and the day you send.",
offerLabel: "The offer you're promoting",
regularPrice: "Regular price",
tagToday: "today",
/** {amount} and {price} are replaced. */
keepLine: "You keep {amount} of every {price} sale.",
}
export type EpcCalculatorCopy = typeof COPY
export type EpcCalculatorProps = {
/** Product the affiliate promotes, shown in the dateline. */
productName: string
/** Front-end price in currency units, e.g. 47. */
price: number
/** Regular price struck on the hang tag; omit to show today's price alone. */
regularPrice?: number
/** Percent of clicks that buy, as supplied by the offer owner (2.5 = 2.5%). */
conversionRate: number
/** Percent of the price paid to the affiliate (50 = 50%). */
commissionRate: number
/** ISO currency code for every money figure. */
currency?: string
locale?: string
/** Starting list size in the estimator. */
defaultListSize?: number
/** Starting click rate in percent. */
defaultClickRate?: number
masthead?: string
headline?: string
/** Phrase inside the headline that gets the marker stroke. */
highlight?: string
lead?: string
/** product slot: transparent cut-out of the offer. */
productImage?: string
productImageAlt?: string
/** Heading over the reasons; {price} is replaced. */
reasonsTitle?: string
reasons?: React.ReactNode[]
actionLabel?: string
actionNote?: string
href?: string
/** Called with the current estimate when the action is clicked. */
onAction?: (estimate: EpcEstimate) => void
copy?: Partial<EpcCalculatorCopy>
state?: "default" | "hover" | "active" | "disabled" | "error"
className?: string
}
export function EpcCalculator(props: EpcCalculatorProps) {
const {
productName,
price,
regularPrice,
conversionRate,
commissionRate,
currency = "USD",
locale = "en-US",
defaultListSize = 5000,
defaultClickRate = 4,
masthead = "The Partner Ledger",
headline = "What one email to your list could pay you",
highlight = "one email",
lead = "Enter your list size and typical click rate. We run them against this offer's conversion rate and commission, so you see the math before you mail.",
productImage,
productImageAlt = "",
reasonsTitle = "Why {price} is an easy first yes",
reasons = [],
actionLabel = "Get my affiliate link",
actionNote = "Grab your link, then send when you're ready.",
href,
onAction,
copy,
state = "default",
className,
} = props
const c: EpcCalculatorCopy = { ...COPY, ...copy }
const uid = React.useId()
const ids = {
h: `${uid}-h`,
list: `${uid}-list`,
listErr: `${uid}-list-err`,
rate: `${uid}-rate`,
rateErr: `${uid}-rate-err`,
}
const fmtInt = (n: number) => new Intl.NumberFormat(locale, { maximumFractionDigits: 0 }).format(n)
const fmtNum = (n: number, d: number) =>
new Intl.NumberFormat(locale, { minimumFractionDigits: d, maximumFractionDigits: d }).format(n)
const fmtPct = (n: number) => `${new Intl.NumberFormat(locale, { maximumFractionDigits: 2 }).format(n)}%`
const money = (n: number, d?: number) => {
const digits = d ?? (Math.abs(n) >= 1000 ? 0 : 2)
return new Intl.NumberFormat(locale, {
style: "currency",
currency,
minimumFractionDigits: digits,
maximumFractionDigits: digits,
}).format(n)
}
const fmtPrice = (n: number) => money(n, Number.isInteger(n) ? 0 : 2)
const startList = clamp(Math.round(defaultListSize), 1, LIST_LIMIT)
const startRate = clamp(defaultClickRate, RATE_MIN, RATE_MAX)
const forcedError = state === "error"
const [list, setList] = React.useState(startList)
const [rate, setRate] = React.useState(startRate)
const [listText, setListText] = React.useState(forcedError ? "" : fmtInt(startList))
const [rateText, setRateText] = React.useState(trimRate(startRate))
const [listTouched, setListTouched] = React.useState(forcedError)
const [rateTouched, setRateTouched] = React.useState(false)
React.useEffect(() => {
if (state === "error") {
setListText("")
setListTouched(true)
}
}, [state])
const listCheck = checkList(listText, c)
const rateCheck = checkRate(rateText, c)
const listError = listCheck.error && (listTouched || listText.trim() !== "") ? listCheck.error : undefined
const rateError = rateCheck.error && (rateTouched || rateText.trim() !== "") ? rateCheck.error : undefined
const stale = Boolean(listError || rateError)
const onListChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const text = e.target.value
setListText(text)
const r = checkList(text, c)
if (r.value !== undefined) setList(r.value)
}
const onListBlur = () => {
setListTouched(true)
const r = checkList(listText, c)
if (r.value !== undefined) setListText(fmtInt(r.value))
}
const onListSlide = (e: React.ChangeEvent<HTMLInputElement>) => {
const n = posToList(Number(e.target.value))
setList(n)
setListText(fmtInt(n))
}
const onRateChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const text = e.target.value
setRateText(text)
const r = checkRate(text, c)
if (r.value !== undefined) setRate(r.value)
}
const onRateSlide = (e: React.ChangeEvent<HTMLInputElement>) => {
const v = Math.round(Number(e.target.value) * 10) / 10
setRate(v)
setRateText(trimRate(v))
}
const perSale = (price * commissionRate) / 100
const clicks = (list * rate) / 100
const sales = (clicks * conversionRate) / 100
const perSend = sales * perSale
const perClick = (conversionRate / 100) * perSale
const perThousand = 10 * rate * perClick
const totalText = money(perSend)
const scale = (v: number) =>
list <= 1 || v <= 0 ? 0.16 : Math.max(0.16, Math.min(1, Math.log10(v + 1) / Math.log10(list + 1)))
const steps = [
{ label: c.sendsLabel, value: fmtInt(list), width: 1 },
{ label: c.clicksLabel, value: clicks < 10 ? fmtNum(clicks, 1) : fmtInt(clicks), width: scale(clicks) },
{
label: c.salesLabel,
value: fill(c.salesValue, { sales: sales < 10 ? fmtNum(sales, 1) : fmtInt(sales) }),
width: scale(sales),
},
]
const listPos = listToPos(list)
const ratePos = clamp(rate, RATE_SLIDE_MIN, RATE_SLIDE_MAX)
const rateFill = ((ratePos - RATE_SLIDE_MIN) / (RATE_SLIDE_MAX - RATE_SLIDE_MIN)) * 100
const disabled = state === "disabled"
const handleAction = (e: React.MouseEvent) => {
if (disabled) {
e.preventDefault()
return
}
onAction?.({ listSize: list, clickRate: rate, clicks, sales, perClick, perThousand, perSend })
}
const ctaClass = ["cf-epc-cta", state === "hover" && "is-hover", state === "active" && "is-active"]
.filter(Boolean)
.join(" ")
const hiAt = highlight ? headline.indexOf(highlight) : -1
const headlineNode =
hiAt >= 0 ? (
<>
{headline.slice(0, hiAt)}
<span className="cf-epc-mark">{highlight}</span>
{headline.slice(hiAt + highlight.length)}
</>
) : (
headline
)
return (
<section
className={["cf-epc", className].filter(Boolean).join(" ")}
aria-labelledby={ids.h}
data-state={state}
>
<style>{CSS}</style>
<div className="cf-epc-wrap">
<header className="cf-epc-mast">
<span className="cf-epc-edition">{c.edition}</span>
<p className="cf-epc-name">{masthead}</p>
<span className="cf-epc-dateline">
{fill(c.dateline, { product: productName, price: fmtPrice(price) })}
</span>
</header>
<div className="cf-epc-head">
<h2 id={ids.h} className="cf-epc-h2">
{headlineNode}
</h2>
{lead ? <p className="cf-epc-lead">{lead}</p> : null}
</div>
<div className="cf-epc-grid">
<div className="cf-epc-col cf-epc-inputs">
<h3 className="cf-epc-h3">{c.inputsTitle}</h3>
<div className="cf-epc-field">
<label className="cf-epc-label" htmlFor={ids.list}>
{c.listLabel}
</label>
<div className={`cf-epc-control${listError ? " is-invalid" : ""}`}>
<input
id={ids.list}
type="text"
inputMode="numeric"
autoComplete="off"
placeholder={c.listPlaceholder}
value={listText}
onChange={onListChange}
onBlur={onListBlur}
aria-invalid={listError ? true : undefined}
aria-describedby={listError ? ids.listErr : undefined}
/>
<span className="cf-epc-suffix" aria-hidden="true">
{c.listSuffix}
</span>
</div>
<input
type="range"
className="cf-epc-range"
min={0}
max={1000}
step={1}
value={listPos}
onChange={onListSlide}
aria-label={c.listSlider}
aria-valuetext={fill(c.listValueText, { list: fmtInt(list) })}
style={{ ["--fill" as string]: `${listPos / 10}%` } as React.CSSProperties}
/>
{listError ? (
<p className="cf-epc-error" id={ids.listErr} role="alert">
<AlertCircle className="cf-epc-ico" size={16} strokeWidth={2.5} aria-hidden="true" />
{listError}
</p>
) : null}
</div>
<div className="cf-epc-field">
<label className="cf-epc-label" htmlFor={ids.rate}>
{c.rateLabel}
</label>
<div className={`cf-epc-control${rateError ? " is-invalid" : ""}`}>
<input
id={ids.rate}
type="text"
inputMode="decimal"
autoComplete="off"
placeholder={c.ratePlaceholder}
value={rateText}
onChange={onRateChange}
onBlur={() => setRateTouched(true)}
aria-invalid={rateError ? true : undefined}
aria-describedby={rateError ? ids.rateErr : undefined}
/>
<span className="cf-epc-suffix" aria-hidden="true">
{c.rateSuffix}
</span>
</div>
<input
type="range"
className="cf-epc-range"
min={RATE_SLIDE_MIN}
max={RATE_SLIDE_MAX}
step={0.1}
value={ratePos}
onChange={onRateSlide}
aria-label={c.rateSlider}
aria-valuetext={fill(c.rateValueText, { rate: trimRate(rate) })}
style={{ ["--fill" as string]: `${rateFill}%` } as React.CSSProperties}
/>
{rateError ? (
<p className="cf-epc-error" id={ids.rateErr} role="alert">
<AlertCircle className="cf-epc-ico" size={16} strokeWidth={2.5} aria-hidden="true" />
{rateError}
</p>
) : null}
</div>
<div className="cf-epc-facts">
<dl>
<div>
<dt>{c.conversionLabel}</dt>
<dd>{fmtPct(conversionRate)}</dd>
</div>
<div>
<dt>{c.commissionLabel}</dt>
<dd>{fill(c.commissionValue, { rate: fmtPct(commissionRate), amount: money(perSale) })}</dd>
</div>
</dl>
<p className="cf-epc-facts-note">{c.factsNote}</p>
</div>
</div>
<div className="cf-epc-col">
<div className="cf-epc-card">
<div className="cf-epc-card-top">
<span className="cf-epc-chip">
<Calculator size={16} strokeWidth={2.5} aria-hidden="true" />
{c.estimateChip}
</span>
{stale ? (
<span className="cf-epc-stale" role="status">
<AlertCircle className="cf-epc-ico" size={16} strokeWidth={2.5} aria-hidden="true" />
{c.staleNote}
</span>
) : (
<span className="cf-epc-live">{c.liveNote}</span>
)}
</div>
<p className="cf-epc-total-label">{fill(c.totalLabel, { list: fmtInt(list) })}</p>
<p className="cf-epc-total" aria-live="polite" aria-atomic="true">
<span key={totalText} className="cf-epc-tick">
{totalText}
</span>
</p>
<p className="cf-epc-total-note">{c.totalNote}</p>
<div className="cf-epc-tiles">
<div className="cf-epc-tile">
<p className="cf-epc-tile-label">{c.perClickLabel}</p>
<p className="cf-epc-tile-num">{money(perClick, 2)}</p>
</div>
<div className="cf-epc-tile">
<p className="cf-epc-tile-label">{c.perThousandLabel}</p>
<p className="cf-epc-tile-num">{money(perThousand)}</p>
</div>
</div>
<ul className="cf-epc-funnel" aria-label={c.funnelLabel}>
{steps.map((step, i) => (
<li key={step.label} className="cf-epc-step">
<span className="cf-epc-step-label">{step.label}</span>
<span className="cf-epc-track" aria-hidden="true">
<span
className={`cf-epc-bar cf-epc-bar-${i + 1}`}
style={{ width: `${Math.round(step.width * 1000) / 10}%` }}
/>
</span>
<span className="cf-epc-step-num">{step.value}</span>
</li>
))}
</ul>
<div className="cf-epc-action">
{href && !disabled ? (
<a className={ctaClass} href={href} onClick={handleAction}>
{actionLabel}
</a>
) : (
<button type="button" className={ctaClass} onClick={handleAction} disabled={disabled}>
{actionLabel}
</button>
)}
{actionNote ? <p className="cf-epc-note">{actionNote}</p> : null}
</div>
<p className="cf-epc-disclaimer">
<Info className="cf-epc-ico" size={16} strokeWidth={2.5} aria-hidden="true" />
{c.disclaimer}
</p>
</div>
</div>
<aside className="cf-epc-col cf-epc-offer" aria-label={c.offerLabel}>
<div className="cf-epc-shelf">
{productImage ? (
<img
className="cf-epc-product"
src={productImage}
alt={productImageAlt}
width={480}
height={480}
loading="lazy"
decoding="async"
/>
) : null}
<div className={`cf-epc-tag${productImage ? " has-string" : ""}`}>
{productImage ? (
<svg className="cf-epc-string" viewBox="0 0 24 72" aria-hidden="true" focusable="false">
<path d="M12 72 C 2 52, 22 28, 12 0" />
</svg>
) : null}
<span className="cf-epc-hole" aria-hidden="true" />
{regularPrice !== undefined ? (
<s className="cf-epc-was">
<span className="cf-epc-sr">{c.regularPrice} </span>
{fmtPrice(regularPrice)}
</s>
) : null}
<span className="cf-epc-now">{fmtPrice(price)}</span>
<span className="cf-epc-today">{c.tagToday}</span>
</div>
<p className="cf-epc-keep">
{fillNodes(c.keepLine, { amount: <strong>{money(perSale)}</strong>, price: fmtPrice(price) })}
</p>
</div>
{reasons.length > 0 ? (
<div className="cf-epc-reasons">
<h3 className="cf-epc-h3">{fill(reasonsTitle, { price: fmtPrice(price) })}</h3>
<ol>
{reasons.map((reason, i) => (
<li key={i}>
<span className="cf-epc-n" aria-hidden="true">
{i + 1}
</span>
<span>{reason}</span>
</li>
))}
</ol>
</div>
) : null}
</aside>
</div>
</div>
</section>
)
}
export default EpcCalculator
const LIST_LIMIT = 10_000_000
const SLIDER_MIN = 100
const SLIDER_MAX = 1_000_000
const RATE_MIN = 0.1
const RATE_MAX = 50
const RATE_SLIDE_MIN = 0.5
const RATE_SLIDE_MAX = 20
function clamp(n: number, min: number, max: number) {
return Math.min(max, Math.max(min, n))
}
function trimRate(v: number) {
return String(Math.round(v * 10) / 10)
}
function listToPos(n: number) {
return Math.round((Math.log10(clamp(n, SLIDER_MIN, SLIDER_MAX) / SLIDER_MIN) / 4) * 1000)
}
function posToList(p: number) {
const n = SLIDER_MIN * 10 ** (p / 250)
const step = n < 1000 ? 10 : n < 10000 ? 50 : n < 100000 ? 500 : 5000
return clamp(Math.round(n / step) * step, SLIDER_MIN, SLIDER_MAX)
}
function checkList(text: string, c: EpcCalculatorCopy): { value?: number; error?: string } {
const raw = text.replace(/[,\s_]/g, "")
if (!raw) return { error: c.listEmpty }
if (!/^\d+$/.test(raw)) return { error: c.listInvalid }
const n = Number(raw)
if (n < 1) return { error: c.listInvalid }
if (n > LIST_LIMIT) return { error: c.listTooBig }
return { value: n }
}
function checkRate(text: string, c: EpcCalculatorCopy): { value?: number; error?: string } {
const raw = text.replace(/[%\s]/g, "").replace(",", ".")
if (!raw) return { error: c.rateEmpty }
if (!/^\d*\.?\d+$/.test(raw)) return { error: c.rateInvalid }
const n = Number(raw)
if (n < RATE_MIN || n > RATE_MAX) return { error: c.rateInvalid }
return { value: n }
}
function fill(template: string, vars: Record<string, string | number>) {
return template.replace(/\{(\w+)\}/g, (match, key: string) => (key in vars ? String(vars[key]) : match))
}
function fillNodes(template: string, vars: Record<string, React.ReactNode>): React.ReactNode[] {
return template.split(/(\{\w+\})/g).map((part, i) => {
const m = /^\{(\w+)\}$/.exec(part)
return m && m[1] in vars ? <React.Fragment key={i}>{vars[m[1]]}</React.Fragment> : part
})
}
const CSS = `
.cf-epc{position:relative;background:var(--surface);color:var(--ink);font-family:var(--font-body);padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px);overflow-x:clip}
.cf-epc *,.cf-epc *::before,.cf-epc *::after{box-sizing:border-box}
.cf-epc :where(h2,h3,p,ul,ol,dl,dd){margin:0}
.cf-epc :where(ul,ol){padding:0;list-style:none}
.cf-epc-wrap{max-width:1120px;margin-inline:auto}
.cf-epc-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.cf-epc-ico{display:inline-block;vertical-align:-.15em;margin-inline-end:.4em;flex:none}
.cf-epc-mast{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;gap:16px;padding-bottom:16px;border-bottom:3px double oklch(from var(--ink) l c h / .3)}
.cf-epc-edition{font-size:.875rem;font-weight:800;line-height:1.2;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.cf-epc-name{font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;text-align:center}
.cf-epc-dateline{justify-self:end;text-align:right;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-epc-head{max-width:46rem;margin:clamp(32px,4.5vw,56px) auto 0;text-align:center}
.cf-epc-h2{font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;text-wrap:balance}
.cf-epc-mark{background:linear-gradient(transparent 56%,oklch(from var(--marker,#fae37c) l c h / .75) 56%,oklch(from var(--marker,#fae37c) l c h / .75) 92%,transparent 92%);-webkit-box-decoration-break:clone;box-decoration-break:clone;padding-inline:.06em;border-radius:.1em}
.cf-epc-lead{max-width:60ch;margin:16px auto 0;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
.cf-epc-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.3fr) minmax(0,.9fr);gap:clamp(24px,3vw,40px);align-items:start;margin-top:clamp(32px,4.5vw,56px)}
.cf-epc-col{animation:cf-epc-in .45s cubic-bezier(.2,.7,.2,1) both}
.cf-epc-col:nth-child(2){animation-delay:.07s}
.cf-epc-col:nth-child(3){animation-delay:.14s}
@keyframes cf-epc-in{from{opacity:.82;transform:translateY(8px)}}
.cf-epc-h3{font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:-.01em;text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;text-wrap:balance}
.cf-epc-inputs{display:grid;gap:24px}
.cf-epc-field{display:grid}
.cf-epc-label{margin-bottom:8px;font-size:1.0625rem;font-weight:700;line-height:1.3;color:var(--label-ink,var(--ink))}
.cf-epc-control{display:flex;align-items:center;gap:8px;min-height:56px;padding-inline:16px;background:var(--field);color:var(--field-ink);border:1px solid var(--field-border,color-mix(in oklch,var(--ink) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));transition:border-color .16s ease,box-shadow .16s ease}
.cf-epc-control:hover:not(:focus-within):not(.is-invalid){border-color:color-mix(in oklch,var(--field-ink) 45%,var(--field))}
.cf-epc-control:focus-within{border-color:var(--field-focus,var(--accent));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--accent)) l c h / .35)}
.cf-epc-control.is-invalid{border-color:var(--danger)}
.cf-epc-control.is-invalid:focus-within{box-shadow:0 0 0 3px oklch(from var(--danger) l c h / .3)}
.cf-epc-control input{flex:1;min-width:0;height:54px;padding:0;border:0;outline:0;background:var(--field);color:var(--field-ink);font-family:var(--font-body);font-size:1.0625rem;font-weight:700;font-variant-numeric:tabular-nums}
.cf-epc-control input::placeholder{color:color-mix(in oklch,var(--field-ink) 65%,var(--field));opacity:1;font-weight:500}
.cf-epc-suffix{flex:none;font-size:.9375rem;font-weight:600;color:color-mix(in oklch,var(--field-ink) 72%,var(--field))}
.cf-epc-range{--fillc:var(--accent-fill,var(--accent));--track:color-mix(in oklch,var(--ink) 14%,var(--surface));-webkit-appearance:none;appearance:none;display:block;width:100%;height:32px;margin:8px 0 0;background:transparent;cursor:pointer}
.cf-epc-range:focus{outline:none}
.cf-epc-range::-webkit-slider-runnable-track{height:8px;border-radius:999px;background:linear-gradient(to right,var(--fillc) 0 var(--fill,50%),var(--track) var(--fill,50%) 100%)}
.cf-epc-range::-moz-range-track{height:8px;border-radius:999px;background:var(--track)}
.cf-epc-range::-moz-range-progress{height:8px;border-radius:999px;background:var(--fillc)}
.cf-epc-range::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:26px;height:26px;margin-top:-9px;border-radius:50%;background:var(--card);border:3px solid var(--fillc);box-shadow:var(--shadow-sm,0 1px 2px oklch(0.22 0.03 260 / .3));cursor:grab;transition:transform .16s ease,box-shadow .16s ease}
.cf-epc-range::-moz-range-thumb{width:20px;height:20px;border-radius:50%;background:var(--card);border:3px solid var(--fillc);box-shadow:var(--shadow-sm,0 1px 2px oklch(0.22 0.03 260 / .3));cursor:grab;transition:transform .16s ease}
.cf-epc-range:hover::-webkit-slider-thumb{transform:scale(1.08)}
.cf-epc-range:hover::-moz-range-thumb{transform:scale(1.08)}
.cf-epc-range:active::-webkit-slider-thumb{transform:scale(1.14);cursor:grabbing}
.cf-epc-range:active::-moz-range-thumb{transform:scale(1.14);cursor:grabbing}
.cf-epc-range:focus-visible::-webkit-slider-thumb{box-shadow:0 0 0 4px oklch(from var(--field-focus,var(--accent)) l c h / .35),var(--shadow-sm,0 1px 2px oklch(0.22 0.03 260 / .3))}
.cf-epc-range:focus-visible::-moz-range-thumb{box-shadow:0 0 0 4px oklch(from var(--field-focus,var(--accent)) l c h / .35),var(--shadow-sm,0 1px 2px oklch(0.22 0.03 260 / .3))}
.cf-epc-error{margin-top:8px;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--danger);text-wrap:pretty}
.cf-epc-facts{padding:16px 20px;border-radius:10px;background:color-mix(in oklch,var(--ink) 5%,var(--surface))}
.cf-epc-facts dl{display:grid;gap:8px}
.cf-epc-facts dl div{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:baseline;gap:4px 12px}
.cf-epc-facts dt{font-size:.9375rem;font-weight:600;color:var(--muted)}
.cf-epc-facts dd{font-size:1.0625rem;font-weight:800;font-variant-numeric:tabular-nums;color:var(--ink)}
.cf-epc-facts-note{margin-top:12px;padding-top:12px;border-top:1px solid oklch(from var(--ink) l c h / .1);font-size:.9375rem;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-epc-card{display:grid;padding:clamp(20px,3vw,32px);background:var(--card);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--accent) l c h / .35));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(0.22 0.03 260 / .22),0 12px 24px -8px oklch(0.22 0.03 260 / .32)))}
.cf-epc-card-top{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px}
.cf-epc-chip{display:inline-flex;align-items:center;gap:6px;min-height:28px;padding:4px 12px;border-radius:999px;background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card));font-size:.875rem;font-weight:800;line-height:1.2;letter-spacing:.06em;text-transform:uppercase}
.cf-epc-live{font-size:.9375rem;font-weight:600;color:var(--muted)}
.cf-epc-stale{flex:1 1 14rem;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--warning);text-wrap:pretty}
.cf-epc-total-label{margin-top:24px;font-size:1.0625rem;font-weight:700;line-height:1.3;color:var(--muted)}
.cf-epc-total{margin-top:8px;font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:-.03em;font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;font-variant-numeric:tabular-nums;color:var(--ink);overflow-wrap:anywhere}
.cf-epc-tick{display:inline-block;animation:cf-epc-tick .3s cubic-bezier(.2,.7,.2,1) both}
@keyframes cf-epc-tick{from{opacity:.82;transform:translateY(4px)}}
.cf-epc-total-note{margin-top:12px;font-size:.9375rem;font-weight:600;color:var(--muted)}
.cf-epc-tiles{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);margin-top:24px;border-radius:10px;background:color-mix(in oklch,var(--ink) 4%,var(--card))}
.cf-epc-tile{position:relative;display:grid;align-content:start;gap:4px;padding:16px}
.cf-epc-tile+.cf-epc-tile::before{content:"";position:absolute;inset:16px auto 16px 0;width:1px;background:oklch(from var(--ink) l c h / .12)}
.cf-epc-tile-label{font-size:.9375rem;font-weight:600;line-height:1.3;color:var(--muted)}
.cf-epc-tile-num{font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:-.01em;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;font-variant-numeric:tabular-nums;color:var(--ink)}
.cf-epc-funnel{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px 12px;margin-top:24px}
.cf-epc-step{display:grid;grid-template-columns:subgrid;grid-column:1/-1;align-items:center}
.cf-epc-step-label{font-size:.9375rem;font-weight:600;color:var(--muted)}
.cf-epc-step-num{font-size:.9375rem;font-weight:800;font-variant-numeric:tabular-nums;text-align:right;color:var(--ink)}
.cf-epc-step:last-child .cf-epc-step-label,.cf-epc-step:last-child .cf-epc-step-num{color:var(--ink);font-weight:800}
.cf-epc-track{display:flex;justify-content:center;height:20px}
.cf-epc-bar{height:100%;border-radius:6px;background:linear-gradient(oklch(from var(--accent-fill,var(--accent)) calc(l + .04) c h),oklch(from var(--accent-fill,var(--accent)) calc(l - .04) c h));box-shadow:inset 0 -2px 0 oklch(from var(--accent-fill,var(--accent)) calc(l - .14) c h / .5);transition:width .45s cubic-bezier(.2,.7,.2,1)}
.cf-epc-bar-1{background:color-mix(in oklch,var(--ink) 14%,var(--card));box-shadow:inset 0 -2px 0 oklch(from var(--ink) l c h / .08)}
.cf-epc-bar-2{background:color-mix(in oklch,var(--ink) 28%,var(--card));box-shadow:inset 0 -2px 0 oklch(from var(--ink) l c h / .1)}
.cf-epc-action{margin-top:32px}
.cf-epc-cta{display:flex;align-items:center;justify-content:center;width:100%;min-height:64px;padding:12px 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:clamp(1.125rem,1.55vw,1.375rem);line-height:1.15;text-align:center;text-wrap:balance;text-decoration:none;color:var(--button-ink,var(--cta-ink));text-shadow:var(--button-text-shadow,none);background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l + .04) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - .16) c h),0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .3),0 8px 16px -6px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .45));cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-epc-cta:hover:not(:disabled),.cf-epc-cta.is-hover{transform:translateY(-1px);background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l - .01) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - .18) c h),0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .34),0 10px 18px -6px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .55))}
.cf-epc-cta:active:not(:disabled),.cf-epc-cta.is-active{transform:translateY(1px);background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l - .04) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .08) c h));box-shadow:inset 0 2px 4px oklch(from var(--button-bg,var(--cta)) calc(l - .2) c h / .6),inset 0 -2px 0 oklch(from var(--button-bg,var(--cta)) calc(l - .16) c h),0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .3)}
.cf-epc-cta:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:3px}
.cf-epc-cta:disabled{background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));text-shadow:none;box-shadow:none;transform:none;cursor:not-allowed}
.cf-epc-note{margin-top:12px;text-align:center;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-epc-disclaimer{margin-top:24px;padding-top:16px;border-top:1px solid oklch(from var(--ink) l c h / .1);font-size:.9375rem;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-epc-offer{display:grid;gap:32px}
.cf-epc-shelf{display:grid;justify-items:center}
.cf-epc-product{display:block;width:100%;max-width:280px;height:auto;aspect-ratio:1;object-fit:contain;filter:drop-shadow(0 2px 3px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .3)) drop-shadow(0 12px 16px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .22))}
.cf-epc-tag{position:relative;z-index:1;display:grid;justify-items:center;width:min(220px,100%);margin:-48px auto 0;justify-self:center;padding:40px 20px 20px;text-align:center;background:var(--card);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--ink) l c h / .12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-md,0 1px 2px oklch(0.22 0.03 260 / .22),0 4px 10px -2px oklch(0.22 0.03 260 / .2)));transform:rotate(-2deg);transform-origin:50% 0;transition:transform .45s cubic-bezier(.2,.7,.2,1)}
.cf-epc-tag:hover{transform:rotate(0deg)}
.cf-epc-tag:not(.has-string){margin:0 auto}
.cf-epc-hole{position:absolute;top:14px;left:50%;width:12px;height:12px;margin-left:-6px;border-radius:50%;background:var(--surface);border:1px solid oklch(from var(--ink) l c h / .2);box-shadow:inset 0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .35)}
.cf-epc-string{position:absolute;left:50%;bottom:calc(100% - 20px);width:24px;height:72px;margin-left:-12px;overflow:visible;pointer-events:none}
.cf-epc-string path{fill:none;stroke:oklch(from var(--ink) l c h / .45);stroke-width:1.5;stroke-linecap:round}
.cf-epc-was{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;font-variant-numeric:tabular-nums;color:var(--muted);text-decoration-line:line-through;text-decoration-color:var(--danger);text-decoration-thickness:3px}
.cf-epc-now{margin-top:4px;font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:-.03em;font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;font-variant-numeric:tabular-nums;color:var(--ink)}
.cf-epc-today{margin-top:12px;font-size:.875rem;font-weight:800;line-height:1.2;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.cf-epc-keep{margin-top:24px;text-align:center;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;text-wrap:pretty}
.cf-epc-keep strong{font-weight:800}
.cf-epc-reasons ol{display:grid;gap:16px;margin-top:16px}
.cf-epc-reasons li{display:grid;grid-template-columns:2rem minmax(0,1fr);align-items:baseline;gap:12px;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;text-wrap:pretty}
.cf-epc-n{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;font-variant-numeric:tabular-nums;color:var(--accent)}
@media (max-width:1099px){
.cf-epc-grid{grid-template-columns:minmax(0,1fr) minmax(0,1.2fr)}
.cf-epc-offer{grid-column:1/-1;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);align-items:start;gap:clamp(24px,4vw,48px)}
}
@media (max-width:759px){
.cf-epc-grid{grid-template-columns:minmax(0,1fr)}
.cf-epc-offer{grid-template-columns:minmax(0,1fr)}
.cf-epc-mast{grid-template-columns:minmax(0,1fr);justify-items:center;gap:8px}
.cf-epc-edition{display:none}
.cf-epc-dateline{justify-self:center;text-align:center}
}
@media (prefers-reduced-motion:reduce){
.cf-epc-col,.cf-epc-tick{animation:none}
.cf-epc-bar,.cf-epc-tag,.cf-epc-cta,.cf-epc-control{transition:none}
.cf-epc-range::-webkit-slider-thumb{transition:none}
.cf-epc-range::-moz-range-thumb{transition:none}
.cf-epc-tag:hover{transform:rotate(-2deg)}
.cf-epc-cta:hover:not(:disabled),.cf-epc-cta.is-hover,.cf-epc-cta:active:not(:disabled),.cf-epc-cta.is-active{transform:none}
}
`
pieces/jv/epc-calculator/specimen.tsx 35 lines
import __studioImage84a5fe6e from "../assets/6b0271c757098c3a.webp";
// Specimen: the EPC calculator promoting the studio's sample offer, with clearly fictional conversion and commission figures.
import defaults from "../../studio-defaults.json"
import { slot } from "../../slots"
import { EpcCalculator, type EpcCalculatorProps } from "../epc-calculator"
export const states = ["default", "hover", "active", "disabled", "error"]
const amount = (text: string) => Number(text.replace(/[^0-9.]/g, ""))
export default function EpcCalculatorSpecimen({ state }: { state?: EpcCalculatorProps["state"] }) {
const sample = defaults.sample
return (
<EpcCalculator
productName={sample.name}
price={amount(sample.price)}
regularPrice={amount(sample.regularPrice)}
conversionRate={2.5}
commissionRate={50}
productImage={slot(
"product",
__studioImage84a5fe6e
)}
productImageAlt={`${sample.name}: planning guide, page copy workbook and launch checklist`}
reasonsTitle={`Three reasons ${sample.price} is an easy first yes`}
reasons={[
`It's ${sample.price} today, not the regular ${sample.regularPrice}.`,
"One payment, lifetime access. Nothing for your reader to cancel later.",
`The ${sample.guarantee} takes the risk off your reader.`,
]}
href="#partner-signup"
state={state}
/>
)
}
| Name | Type | Details |
|---|---|---|
productName RequiredEpcCalculator |
string |
|
price RequiredEpcCalculator |
number |
|
regularPrice OptionalEpcCalculator |
number |
|
conversionRate RequiredEpcCalculator |
number |
|
commissionRate RequiredEpcCalculator |
number |
|
currency OptionalEpcCalculator |
string |
|
locale OptionalEpcCalculator |
string |
|
defaultListSize OptionalEpcCalculator |
number |
|
defaultClickRate OptionalEpcCalculator |
number |
|
masthead OptionalEpcCalculator |
string |
|
headline OptionalEpcCalculator |
string |
|
highlight OptionalEpcCalculator |
string |
|
lead OptionalEpcCalculator |
string |
|
productImage OptionalEpcCalculator |
string |
|
productImageAlt OptionalEpcCalculator |
string |
|
reasonsTitle OptionalEpcCalculator |
string |
|
reasons OptionalEpcCalculator |
React.ReactNode[] |
|
actionLabel OptionalEpcCalculator |
string |
|
actionNote OptionalEpcCalculator |
string |
|
href OptionalEpcCalculator |
string |
|
onAction OptionalEpcCalculator |
(estimate: EpcEstimate) => void |
|
copy OptionalEpcCalculator |
Partial<EpcCalculatorCopy> |
|
state OptionalEpcCalculator |
"default" | "hover" | "active" | "disabled" | "error" |
|
className OptionalEpcCalculator |
string |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-ink- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field--field-border--field-focus--field-ink--field-radius- Form inputs: background, ink, border, radius and focus colour.
--marker- The highlighter colour behind key phrases.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
product- The main product shot or cover (ebook, kit, bottle).
-
6b0271c757098c3a.webp
image/webp · 149 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB