Two Step Order 14
Takes the order in two steps under one segmented step header whose active segment settles into place: contact first, then payment with the optional add-on, the investment in plain words and a live total.
Use it in a prompt
Use checkout/two-step-order-14 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/checkout/two-step-order-14.tsx. - Import it and pass your copy and images (Props tab):
import { TwoStepOrder14 } from "@/components/funneldna/checkout/two-step-order-14"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/checkout/two-step-order-14/component.tsx 768 lines
// layout: segmented-stepper
// Takes the order in two steps under one segmented step header whose active segment settles into place: contact first, then payment with the optional add-on, the investment in plain words and a live total.
// Theme notes: official payment-network SVG marks (Visa, Mastercard, American Express, Discover) keep their brand colours (theme-contract mark exception). The completed-step tick and the ticked add-on box are solid --success badges with a white glyph (status badge rule), overridable through --status-glyph.
'use client'
import * as React from 'react'
import { AlertCircle, CalendarDays, Check, CreditCard, Loader2, Lock, Mail, MapPin, ShieldCheck, User, type LucideIcon } from 'lucide-react'
import { AmericanExpress, Discover, Mastercard, Visa } from 'react-svg-credit-card-payment-icons/icons/flat-rounded'
export type Order14Field = {
/** Key in the submitted values; also picks the field icon and the default placeholder. */
name: string
label: string
type?: string
autoComplete?: string
/** Realistic example answer; known field names fall back to a built-in example. */
placeholder?: string
inputMode?: 'text' | 'email' | 'numeric' | 'tel'
/** Shares a row with the neighbouring half field. */
half?: boolean
}
export type Order14Item = { name: string; image?: string; imageAlt?: string }
/** One segment of the step header: a short label and a line under it (hidden on phones). */
export type Order14Step = { label: string; sub?: string }
export type Order14Bump = {
/** Strip line beside the checkbox; {price} is replaced with the add-on price. */
title: string
/** {price} is replaced with the add-on price. */
body?: string
/** Supplied add-on price, shown as given and added to the total. */
price: string
/** Line shown in the order summary when the add-on is ticked. */
summaryLabel?: string
}
export type CardMark = 'visa' | 'mastercard' | 'amex' | 'discover'
export type TwoStepOrder14State = 'default' | 'active' | 'error' | 'disabled'
const COPY = {
stepsLabel: 'Checkout steps',
completed: 'completed',
thumbsLabel: 'What’s in your kit',
step1Heading: 'Where should we send your kit?',
step1Lead: 'Your download link goes straight to this email.',
step2Heading: 'Your kit is one step away',
investmentLabel: 'Your investment:',
investmentNote: 'One payment, lifetime access.',
/** {price} is replaced with today’s price. Match the number word to the reasons you pass. */
reasonsHeading: 'Three reasons this is {price} today:',
nextLabel: 'Continue to Payment',
nextNote: 'You’ll see your full total before you pay.',
/** {product} is replaced with the product name (a leading The becomes the). */
orderLabel: 'Yes! I want {product}',
loadingLabel: 'Processing your order…',
orderNote: 'Secure checkout · Instant download',
backLabel: 'Back',
weAccept: 'We accept',
totalLabel: 'Total today',
/** {count} and {fields} are replaced as text. */
alert: 'Please fix {count} {fields} to continue.',
fieldWord: 'field',
fieldsWord: 'fields',
submitError: 'We couldn’t complete your order. Please try again.',
/** {label} is replaced with the field label in lower case. */
required: 'Enter your {label}.',
email: 'Enter a valid email address.',
card: 'Enter a valid card number.',
expiry: 'Enter the expiry as MM / YY.',
cvc: 'Enter the 3 or 4 digit code.',
}
export type TwoStepOrder14Copy = typeof COPY
export type TwoStepOrder14Props = {
productName?: string
/** Short line under the product name. */
productNote?: string
/** Today’s price: shown in the investment line and used for the total. */
price?: string
/** Kit contents shown as up to three thumbnails (slots item-1 … item-3). */
items?: Order14Item[]
/** Numbered inline reasons after copy.reasonsHeading. Pass [] to hide them. */
reasons?: string[]
/** The two segments of the step header. */
steps?: [Order14Step, Order14Step]
/** Step 1 contact fields. */
fields?: Order14Field[]
/** Appends shippingFields to step 1 (physical products). */
collectShipping?: boolean
shippingFields?: Order14Field[]
/** Step 2 card fields. */
paymentFields?: Order14Field[]
/** Optional add-on, always unchecked at first. Supply it only with a real price. */
bump?: Order14Bump | null
/** Guarantee line under the order button. Pass null to hide it. */
guarantee?: string | null
acceptedCards?: CardMark[]
/** ISO currency code used to format the total. */
currency?: string
/** Interface copy; templates replace {price}, {product}, {count}, {fields} and {label} as text. */
copy?: Partial<TwoStepOrder14Copy>
/** active opens step 2 (payment); error shows step 1 with its inline errors; disabled locks every control. */
state?: TwoStepOrder14State
/** Step shown first when no state is set. */
initialStep?: 1 | 2
/** Prefilled field values keyed by field name. */
defaultValues?: Record<string, string>
/** Locks every control, same as state disabled. */
disabled?: boolean
/** Called with the validated step 1 values when the buyer moves to payment. */
onContinue?: (values: Readonly<Record<string, string>>) => void
/** Receives validated values and the add-on choice; never sends data or charges money itself. A returned promise shows the processing label, a rejection shows copy.submitError. */
onSubmit?: (values: Readonly<Record<string, string>>, bumpSelected: boolean) => void | Promise<void>
className?: string
}
const DEFAULT_STEPS: [Order14Step, Order14Step] = [
{ label: 'Details', sub: 'Where we send it' },
{ label: 'Payment', sub: 'Card and total' },
]
const DEFAULT_REASONS = [
'The guide, workbook and checklist arrive in one download.',
'You plan, write and check every page before you launch.',
'You’re covered by the 30-day money-back guarantee.',
]
const CONTACT_FIELDS: Order14Field[] = [
{ name: 'name', label: 'Full name', autoComplete: 'name', placeholder: 'Jane Smith' },
{ name: 'email', label: 'Email address', type: 'email', inputMode: 'email', autoComplete: 'email', placeholder: 'you@example.com' },
]
const SHIPPING_FIELDS: Order14Field[] = [
{ name: 'address', label: 'Street address', autoComplete: 'shipping street-address', placeholder: '123 Main Street' },
{ name: 'city', label: 'City', autoComplete: 'shipping address-level2', placeholder: 'Austin', half: true },
{ name: 'zip', label: 'ZIP / Postal code', autoComplete: 'shipping postal-code', placeholder: '78701', half: true },
]
const PAYMENT_FIELDS: Order14Field[] = [
{ name: 'cardNumber', label: 'Card number', inputMode: 'numeric', autoComplete: 'cc-number', placeholder: '1234 5678 9012 3456' },
{ name: 'cardExpiry', label: 'Expiry', inputMode: 'numeric', autoComplete: 'cc-exp', placeholder: 'MM / YY', half: true },
{ name: 'cardCvc', label: 'Security code', inputMode: 'numeric', autoComplete: 'cc-csc', placeholder: '123', half: true },
]
const ALL_CARDS: CardMark[] = ['visa', 'mastercard', 'amex', 'discover']
export function TwoStepOrder14({
productName = 'The Funnel Starter Kit',
productNote = 'One payment · Lifetime access',
price = '$47',
items = [],
reasons = DEFAULT_REASONS,
steps = DEFAULT_STEPS,
fields = CONTACT_FIELDS,
collectShipping = false,
shippingFields = SHIPPING_FIELDS,
paymentFields = PAYMENT_FIELDS,
bump = null,
guarantee = '30-day money-back guarantee',
acceptedCards = ALL_CARDS,
currency = 'USD',
copy: copyOverrides,
state,
initialStep = 1,
defaultValues,
disabled: disabledProp = false,
onContinue,
onSubmit,
className = '',
}: TwoStepOrder14Props) {
const copy: TwoStepOrder14Copy = { ...COPY, ...defined<TwoStepOrder14Copy>(copyOverrides) }
const uid = 'tso14' + React.useId().replace(/[^a-zA-Z0-9]/g, '')
const step1Fields = React.useMemo(() => [...fields, ...(collectShipping ? shippingFields : [])], [fields, collectShipping, shippingFields])
const startStep: 1 | 2 = state === 'active' ? 2 : state === 'error' ? 1 : initialStep
const [step, setStep] = React.useState<1 | 2>(startStep)
const [values, setValues] = React.useState<Record<string, string>>(() => ({ ...(defaultValues ?? {}) }))
const [errors, setErrors] = React.useState<Record<string, string>>(() => (state === 'error' ? validate(step1Fields, defaultValues ?? {}, copy) : {}))
const [showAlert, setShowAlert] = React.useState(state === 'error')
const [bumpOn, setBumpOn] = React.useState(false)
const [status, setStatus] = React.useState<'idle' | 'loading'>('idle')
const [submitFailed, setSubmitFailed] = React.useState(false)
const run = React.useRef(0)
const frame = React.useRef<number | undefined>(undefined)
const moved = React.useRef(false)
const lastState = React.useRef(state)
const formRef = React.useRef<HTMLFormElement>(null)
const headRef = React.useRef<HTMLHeadingElement>(null)
const disabled = state === 'disabled' || disabledProp
const loading = status === 'loading'
const locked = disabled || loading
React.useEffect(
() => () => {
run.current++
if (frame.current !== undefined) cancelAnimationFrame(frame.current)
},
[]
)
React.useEffect(() => {
if (lastState.current === state) return
lastState.current = state
run.current++
moved.current = false
setStep(state === 'active' ? 2 : state === 'error' ? 1 : initialStep)
setStatus('idle')
setSubmitFailed(false)
setBumpOn(false)
setErrors(state === 'error' ? validate(step1Fields, values, copy) : {})
setShowAlert(state === 'error')
}, [state])
React.useEffect(() => {
if (!moved.current) return
headRef.current?.focus()
}, [step])
const base = toNum(price)
const bumpPrice = bump ? toNum(bump.price) : 0
const total = base + (bump && bumpOn ? bumpPrice : 0)
const thumbs = items.filter((item) => item.image).slice(0, 3)
const orderLabel = fill(copy.orderLabel, { product: productName.replace(/^The /, 'the ') })
const errorCount = Object.keys(errors).length
const alertText = submitFailed
? copy.submitError
: showAlert && errorCount > 0
? fill(copy.alert, { count: String(errorCount), fields: errorCount === 1 ? copy.fieldWord : copy.fieldsWord })
: ''
const focusFirst = (errs: Record<string, string>) => {
const first = Object.keys(errs)[0]
if (!first) return
frame.current = requestAnimationFrame(() => {
const inputs = formRef.current?.querySelectorAll<HTMLInputElement>('input')
Array.from(inputs ?? []).find((input) => input.name === first)?.focus()
})
}
const update = (name: string, raw: string) => {
setValues((prev) => ({ ...prev, [name]: shape(name, raw) }))
if (errors[name])
setErrors((prev) => {
const next = { ...prev }
delete next[name]
return next
})
setSubmitFailed(false)
}
const goNext = () => {
if (locked) return
const errs = validate(step1Fields, values, copy)
setErrors(errs)
if (Object.keys(errs).length) {
setShowAlert(true)
focusFirst(errs)
return
}
setShowAlert(false)
onContinue?.(pick(step1Fields, values))
moved.current = true
setStep(2)
}
const goBack = () => {
if (locked) return
moved.current = true
setErrors({})
setShowAlert(false)
setSubmitFailed(false)
setStep(1)
}
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault()
if (locked) return
if (step === 1) return goNext()
const errs = validate(paymentFields, values, copy)
setErrors(errs)
setSubmitFailed(false)
if (Object.keys(errs).length) {
setShowAlert(true)
focusFirst(errs)
return
}
setShowAlert(false)
const result = onSubmit?.(pick([...step1Fields, ...paymentFields], values), bump ? bumpOn : false)
if (!result || typeof (result as Promise<void>).then !== 'function') return
const id = ++run.current
setStatus('loading')
try {
await result
if (id === run.current) setStatus('idle')
} catch {
if (id === run.current) {
setStatus('idle')
setSubmitFailed(true)
}
}
}
const renderField = (f: Order14Field) => {
const id = uid + '-' + f.name
const err = errors[f.name]
const Icon = ICONS[f.name] ?? (f.type === 'email' ? Mail : undefined)
return (
<div key={f.name} className={'tso-field' + (f.half ? ' is-half' : '')}>
<label className='tso-label' htmlFor={id}>
{f.label}
</label>
<div className='tso-control'>
{Icon && <Icon aria-hidden='true' strokeWidth={2.5} />}
<input
id={id}
name={f.name}
className={'tso-input' + (Icon ? '' : ' no-icon')}
type={f.type ?? 'text'}
inputMode={f.inputMode}
autoComplete={f.autoComplete}
placeholder={f.placeholder ?? PLACEHOLDERS[f.name] ?? (f.type === 'email' ? 'you@example.com' : 'Type your ' + f.label.toLowerCase())}
value={values[f.name] ?? ''}
onChange={(e) => update(f.name, e.target.value)}
disabled={locked}
aria-invalid={err ? true : undefined}
aria-describedby={err ? id + '-err' : undefined}
/>
</div>
{err && (
<p className='tso-err' id={id + '-err'}>
<AlertCircle aria-hidden='true' strokeWidth={2.5} />
{err}
</p>
)}
</div>
)
}
return (
<div className={('cf-tso14 ' + className).trim()}>
<style>{CSS}</style>
<form ref={formRef} className='tso-card' noValidate onSubmit={handleSubmit} aria-labelledby={uid + '-h'} aria-busy={loading || undefined}>
<div className='tso-offer'>
{thumbs.length > 0 && (
<ul className='tso-thumbs' aria-label={copy.thumbsLabel}>
{thumbs.map((item) => (
<li key={item.name}>
<img src={item.image} alt={item.imageAlt ?? item.name} width={52} height={52} decoding='async' />
</li>
))}
</ul>
)}
<div className='tso-offer-text'>
<p className='tso-name'>{productName}</p>
{productNote && <p className='tso-note'>{productNote}</p>}
</div>
</div>
<ol className='tso-seg' data-step={step} aria-label={copy.stepsLabel}>
{steps.map((s, i) => {
const n = (i + 1) as 1 | 2
const current = n === step
const done = n === 1 && step === 2
const sub = done && values.email ? values.email : s.sub
return (
<li key={i}>
<button
type='button'
className='tso-seg-btn'
aria-current={current ? 'step' : undefined}
disabled={locked}
onClick={() => {
if (current) return
if (n === 1) goBack()
else goNext()
}}
>
<span className='tso-seg-num' aria-hidden='true'>
{done ? (
<span className='tso-tick'>
<Check strokeWidth={3} />
</span>
) : (
n
)}
</span>
<span className='tso-seg-text'>
<span className='tso-seg-label'>
{s.label}
{done && <span className='tso-sr'> ({copy.completed})</span>}
</span>
{sub && <span className='tso-seg-sub'>{sub}</span>}
</span>
</button>
</li>
)
})}
</ol>
<div className='tso-panel' key={step}>
<div className='tso-head'>
<h2 ref={headRef} id={uid + '-h'} tabIndex={-1} className='tso-h'>
{step === 1 ? copy.step1Heading : copy.step2Heading}
</h2>
{step === 1 ? (
copy.step1Lead ? <p className='tso-lead'>{copy.step1Lead}</p> : null
) : (
<p className='tso-letter'>
<span className='tso-invest'>
{copy.investmentLabel} <b>{price}</b>
</span>
{'. '}
{copy.investmentNote}
{reasons.length > 0 && (
<>
{' '}
<strong>{fill(copy.reasonsHeading, { price })}</strong>
{reasons.map((reason, i) => (
<React.Fragment key={i}>
{' '}
<span className='tso-rn'>{i + 1}.</span> {reason}
</React.Fragment>
))}
</>
)}
</p>
)}
</div>
{alertText && (
<p className='tso-alert' role='alert'>
<AlertCircle aria-hidden='true' strokeWidth={2.5} />
{alertText}
</p>
)}
{step === 2 && acceptedCards.length > 0 && (
<div className='tso-marks'>
<span className='tso-marks-label'>{copy.weAccept}</span>
{acceptedCards.map((mark) => (
<span key={mark} className='tso-mark'>
{CARD_MARKS[mark]()}
</span>
))}
</div>
)}
<div className='tso-fields'>{(step === 1 ? step1Fields : paymentFields).map(renderField)}</div>
{step === 1 ? (
<div className='tso-act'>
<button type='submit' className='tso-btn' disabled={locked}>
{copy.nextLabel}
</button>
{copy.nextNote && <p className='tso-small'>{copy.nextNote}</p>}
</div>
) : (
<>
{bump && (
<div className={'tso-bump' + (bumpOn ? ' is-on' : '') + (locked ? ' is-locked' : '')}>
<label className='tso-bump-strip' htmlFor={uid + '-bump'}>
<input
id={uid + '-bump'}
type='checkbox'
className='tso-bump-input'
checked={bumpOn}
onChange={(e) => setBumpOn(e.target.checked)}
disabled={locked}
/>
<span className='tso-check' aria-hidden='true'>
<Check strokeWidth={3} />
</span>
<span className='tso-bump-title'>{fill(bump.title, { price: bump.price })}</span>
</label>
{bump.body && <p className='tso-bump-body'>{fill(bump.body, { price: bump.price })}</p>}
</div>
)}
<div className='tso-sum' aria-live='polite'>
<div className='tso-row'>
<span>{productName}</span>
<span>{price}</span>
</div>
{bump && bumpOn && (
<div className='tso-row is-new'>
<span>{bump.summaryLabel ?? fill(bump.title, { price: bump.price })}</span>
<span>{bump.price}</span>
</div>
)}
<div className='tso-row tso-total'>
<span>{copy.totalLabel}</span>
<span className='tso-total-n'>{money(total, currency)}</span>
</div>
</div>
<div className='tso-act'>
<div className='tso-act2'>
<button type='button' className='tso-btn2' onClick={goBack} disabled={locked}>
{copy.backLabel}
</button>
<button type='submit' className={'tso-btn is-order' + (loading ? ' is-loading' : '')} disabled={locked}>
{loading ? (
<>
<Loader2 className='tso-spin' aria-hidden='true' strokeWidth={2.5} />
{copy.loadingLabel}
</>
) : (
orderLabel
)}
</button>
</div>
<div className='tso-reassure'>
{copy.orderNote && (
<p className='tso-small'>
<Lock aria-hidden='true' strokeWidth={2.5} />
{copy.orderNote}
</p>
)}
{guarantee && (
<p className='tso-small is-guarantee'>
<ShieldCheck aria-hidden='true' strokeWidth={2.5} />
{guarantee}
</p>
)}
</div>
</div>
</>
)}
</div>
</form>
</div>
)
}
export default TwoStepOrder14
const ICONS: Partial<Record<string, LucideIcon>> = {
name: User,
email: Mail,
address: MapPin,
city: MapPin,
zip: MapPin,
cardNumber: CreditCard,
cardExpiry: CalendarDays,
cardCvc: Lock,
}
const PLACEHOLDERS: Partial<Record<string, string>> = {
name: 'Jane Smith',
email: 'you@example.com',
phone: '(555) 123-4567',
address: '123 Main Street',
city: 'Austin',
zip: '78701',
cardNumber: '1234 5678 9012 3456',
cardExpiry: 'MM / YY',
cardCvc: '123',
}
// Official payment-network SVG marks keep their brand colours (theme-contract mark exception).
const CARD_MARKS: Record<CardMark, () => React.ReactNode> = {
visa: () => <Visa aria-label='Visa' />,
mastercard: () => <Mastercard aria-label='Mastercard' />,
amex: () => <AmericanExpress aria-label='American Express' />,
discover: () => <Discover aria-label='Discover' />,
}
function defined<T>(o?: Partial<T>): Partial<T> {
const out: Partial<T> = {}
if (!o) return out
for (const key of Object.keys(o) as (keyof T)[]) if (o[key] !== undefined) out[key] = o[key]
return out
}
function fill(template: string, vars: Record<string, string>) {
return template.replace(/[{]([a-zA-Z]+)[}]/g, (match, key: string) => (key in vars ? vars[key] : match))
}
const digits = (s: string) => s.replace(/[^0-9]/g, '')
function toNum(s?: string) {
if (!s) return 0
const n = parseFloat(s.replace(/[^0-9.]/g, ''))
return Number.isFinite(n) ? n : 0
}
function money(n: number, currency: string) {
const whole = Math.abs(n - Math.round(n)) < 0.005
try {
return new Intl.NumberFormat('en-US', { style: 'currency', currency, minimumFractionDigits: whole ? 0 : 2, maximumFractionDigits: whole ? 0 : 2 }).format(n)
} catch {
return '$' + n.toFixed(whole ? 0 : 2)
}
}
function shape(name: string, raw: string) {
if (name === 'cardNumber') return digits(raw).slice(0, 19).replace(/(.{4})/g, '$1 ').trim()
if (name === 'cardExpiry') {
const d = digits(raw).slice(0, 4)
return d.length > 2 ? d.slice(0, 2) + ' / ' + d.slice(2) : d
}
if (name === 'cardCvc') return digits(raw).slice(0, 4)
return raw
}
function validate(list: Order14Field[], values: Record<string, string>, copy: TwoStepOrder14Copy) {
const out: Record<string, string> = {}
for (const f of list) {
const v = (values[f.name] ?? '').trim()
if (!v) {
out[f.name] = fill(copy.required, { label: f.label.toLowerCase() })
continue
}
if (f.type === 'email' || f.name === 'email') {
if (!/^[^ @]+@[^ @]+[.][^ @]+$/.test(v)) out[f.name] = copy.email
} else if (f.name === 'cardNumber') {
const d = digits(v)
if (d.length < 13 || d.length > 19) out[f.name] = copy.card
} else if (f.name === 'cardExpiry') {
const m = /^([0-9]{2}) [/] ([0-9]{2})$/.exec(v)
if (!m || Number(m[1]) < 1 || Number(m[1]) > 12) out[f.name] = copy.expiry
} else if (f.name === 'cardCvc') {
if (!/^[0-9]{3,4}$/.test(v)) out[f.name] = copy.cvc
}
}
return out
}
function pick(list: Order14Field[], values: Record<string, string>) {
const out: Record<string, string> = {}
for (const f of list) out[f.name] = (values[f.name] ?? '').trim()
return out
}
const CSS = `
.cf-tso14{--tso-cta:var(--button-bg,var(--cta,#d43c2b));--tso-cta-2:var(--button-bg-2,var(--cta-2,#b02a1c));--tso-sh:var(--shadow,oklch(.22 .03 256));--tso-well:color-mix(in oklch,var(--ink,#1a2233) 4%,var(--card,#fff));width:100%;max-width:44rem;margin-inline:auto;color:var(--ink,#1a2233);font-family:var(--font-body,system-ui,sans-serif)}
.cf-tso14 *,.cf-tso14 *::before,.cf-tso14 *::after{box-sizing:border-box}
.cf-tso14 :where(h2,p,ol,ul){margin:0;padding:0}
.cf-tso14 :where(ol,ul){list-style:none}
.cf-tso14 .tso-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.cf-tso14 .tso-card{display:grid;gap:24px;padding:clamp(20px,3vw,32px);background:var(--card,#fff);color:var(--ink,#1a2233);border:1px solid var(--card-border,oklch(from var(--ink,#1a2233) l c h / .12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(.22 .03 256 / .22),0 12px 24px -8px oklch(.22 .03 256 / .32)))}
.cf-tso14 .tso-offer{display:flex;align-items:center;gap:16px;min-width:0}
.cf-tso14 .tso-thumbs{display:flex;gap:8px;flex:0 0 auto}
.cf-tso14 .tso-thumbs img{display:block;width:52px;height:52px;object-fit:cover;object-position:center;border-radius:8px}
.cf-tso14 .tso-offer-text{display:grid;gap:4px;min-width:0}
.cf-tso14 .tso-name{font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.2;letter-spacing:-.01em;text-wrap:balance}
.cf-tso14 .tso-note{font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--muted,#4a5565);text-wrap:pretty}
.cf-tso14 .tso-seg{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:4px;padding:6px;border-radius:calc(var(--radius,12px) + 4px);background:var(--tso-well)}
.cf-tso14 .tso-seg li{display:flex;min-width:0}
.cf-tso14 .tso-seg-btn{flex:1;display:flex;align-items:center;gap:12px;min-width:0;min-height:68px;padding:10px 16px;border:0;border-radius:var(--radius,12px);background-color:transparent;color:var(--ink,#1a2233);font:inherit;text-align:left;cursor:pointer;transition:background-color .2s ease,color .2s ease,box-shadow .2s ease}
.cf-tso14 .tso-seg-btn:hover:not(:disabled):not([aria-current]){background-color:oklch(from var(--ink,#1a2233) l c h / .06)}
.cf-tso14 .tso-seg-btn[aria-current]{color:var(--band-ink,#fff);background-color:var(--band,#1c2a4a);box-shadow:inset 0 1px 0 oklch(from var(--band,#1c2a4a) calc(l + .1) c h / .7),0 1px 2px oklch(from var(--tso-sh) l c h / .3),0 6px 12px -4px oklch(from var(--tso-sh) l c h / .35);cursor:default;animation:tso-seg-in .32s cubic-bezier(.2,.7,.2,1) both}
@keyframes tso-seg-in{from{transform:scale(.97);opacity:.85}}
.cf-tso14 .tso-seg-btn:disabled{cursor:not-allowed}
.cf-tso14 .tso-seg-btn:focus-visible{outline:3px solid var(--field-focus,var(--accent,#2563eb));outline-offset:2px}
.cf-tso14 .tso-seg-num{flex:0 0 auto;display:inline-grid;place-items:center;min-width:28px;font-family:var(--font-display,inherit);font-weight:800;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1;font-variant-numeric:tabular-nums;color:var(--accent,#2563eb)}
.cf-tso14 .tso-seg-btn[aria-current] .tso-seg-num{color:var(--band-ink,#fff)}
.cf-tso14 .tso-tick{display:grid;place-items:center;width:28px;height:28px;border-radius:999px;background:var(--success,#1f7a3d);color:var(--status-glyph,#fff)}
.cf-tso14 .tso-tick svg{width:16px;height:16px}
.cf-tso14 .tso-seg-text{display:grid;gap:2px;min-width:0}
.cf-tso14 .tso-seg-label{font-weight:800;font-size:1.0625rem;line-height:1.2}
.cf-tso14 .tso-seg-sub{font-size:.9375rem;font-weight:500;line-height:1.3;color:var(--muted,#4a5565);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cf-tso14 .tso-seg-btn[aria-current] .tso-seg-sub{color:color-mix(in oklab,var(--band-ink,#fff) 88%,var(--band,#1c2a4a))}
.cf-tso14 .tso-panel{display:grid;gap:20px;animation:tso-rise .45s cubic-bezier(.2,.7,.2,1) both}
@keyframes tso-rise{from{opacity:.82;transform:translateY(8px)}}
.cf-tso14 .tso-head{display:grid;gap:12px}
.cf-tso14 .tso-h{font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.01em);text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;text-wrap:balance;outline:none}
.cf-tso14 .tso-lead{font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;color:var(--muted,#4a5565);text-wrap:pretty}
.cf-tso14 .tso-letter{font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.6;color:var(--ink,#1a2233);text-wrap:pretty}
.cf-tso14 .tso-letter strong{font-weight:800}
.cf-tso14 .tso-invest{font-variant-caps:all-small-caps;letter-spacing:.05em;font-weight:800}
.cf-tso14 .tso-invest b{font-variant-caps:normal;letter-spacing:0;font-family:var(--font-display,inherit);font-weight:800;font-variant-numeric:tabular-nums}
.cf-tso14 .tso-rn{font-family:var(--font-display,inherit);font-weight:800;font-variant-numeric:tabular-nums;color:var(--accent,#2563eb)}
.cf-tso14 .tso-alert{padding:12px 16px;border-radius:10px;background:var(--danger-soft,color-mix(in oklch,var(--danger,#c0352b) 14%,var(--card,#fff)));color:var(--danger,#c0352b);font-size:.9375rem;font-weight:700;line-height:1.4;text-wrap:pretty}
.cf-tso14 .tso-alert svg{display:inline-block;vertical-align:-.2em;width:18px;height:18px;margin-inline-end:.4em}
.cf-tso14 .tso-marks{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.cf-tso14 .tso-marks-label{margin-inline-end:4px;font-size:.875rem;font-weight:800;line-height:1.2;color:var(--muted,#4a5565)}
.cf-tso14 .tso-mark{display:inline-flex}
.cf-tso14 .tso-mark svg{display:block;width:40px;height:26px}
.cf-tso14 .tso-fields{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px}
.cf-tso14 .tso-field{grid-column:1 / -1;display:grid;gap:8px;min-width:0}
.cf-tso14 .tso-field.is-half{grid-column:auto}
.cf-tso14 .tso-label{font-size:1rem;font-weight:700;line-height:1.3;color:var(--label-ink,var(--ink,#1a2233))}
.cf-tso14 .tso-control{position:relative}
.cf-tso14 .tso-control svg{position:absolute;left:16px;top:50%;width:18px;height:18px;transform:translateY(-50%);color:color-mix(in oklch,var(--field-ink,#1a2233) 55%,var(--field,#fff));pointer-events:none}
.cf-tso14 .tso-input{display:block;width:100%;min-width:0;height:56px;padding:0 16px 0 46px;border:1px solid var(--field-border,color-mix(in oklch,var(--ink,#1a2233) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));background:var(--field,#fff);color:var(--field-ink,#1a2233);font-family:var(--font-body,inherit);font-size:1.0625rem;box-shadow:inset 0 1px 2px oklch(from var(--tso-sh) l c h / .07);transition:border-color .16s ease,box-shadow .16s ease}
.cf-tso14 .tso-input.no-icon{padding-left:16px}
.cf-tso14 .tso-input::placeholder{color:color-mix(in oklch,var(--field-ink,#1a2233) 65%,var(--field,#fff));opacity:1}
.cf-tso14 .tso-input:hover:not(:disabled){border-color:color-mix(in oklch,var(--ink,#1a2233) 40%,transparent)}
.cf-tso14 .tso-input:focus{outline:none;border-color:var(--field-focus,var(--accent,#2563eb));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--accent,#2563eb)) l c h / .35)}
.cf-tso14 .tso-input[aria-invalid='true']{border-color:var(--danger,#c0352b)}
.cf-tso14 .tso-input[aria-invalid='true']:focus{box-shadow:0 0 0 3px oklch(from var(--danger,#c0352b) l c h / .3)}
.cf-tso14 .tso-input:disabled{cursor:not-allowed;background:color-mix(in oklch,var(--ink,#1a2233) 4%,var(--field,#fff))}
.cf-tso14 .tso-err{font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--danger,#c0352b);text-wrap:pretty}
.cf-tso14 .tso-err svg{display:inline-block;vertical-align:-.2em;width:16px;height:16px;margin-inline-end:.35em}
.cf-tso14 .tso-bump{overflow:hidden;border-radius:var(--radius,12px);background:var(--bump,oklch(.975 .04 95));color:var(--bump-ink,var(--ink,#1a2233));border:1px solid oklch(from var(--bump-ink,#1a2233) l c h / .16);transition:border-color .16s ease,box-shadow .16s ease}
.cf-tso14 .tso-bump.is-on{border-color:var(--success,#1f7a3d);box-shadow:inset 0 0 0 1px var(--success,#1f7a3d)}
.cf-tso14 .tso-bump-strip{position:relative;display:flex;align-items:center;gap:12px;padding:14px 16px;background:var(--bump-strip,oklch(.93 .11 95));cursor:pointer}
.cf-tso14 .tso-bump.is-locked .tso-bump-strip{cursor:not-allowed}
.cf-tso14 .tso-bump-input{position:absolute;left:16px;top:50%;width:26px;height:26px;margin:0;opacity:0;transform:translateY(-50%);cursor:inherit}
.cf-tso14 .tso-check{flex:0 0 auto;display:grid;place-items:center;width:26px;height:26px;border-radius:6px;border:2px solid var(--bump-ink,#1a2233);background:var(--field,#fff);color:transparent;transition:background-color .16s ease,border-color .16s ease}
.cf-tso14 .tso-check svg{width:16px;height:16px}
.cf-tso14 .tso-bump-strip:hover .tso-bump-input:not(:disabled):not(:checked) + .tso-check{background:color-mix(in oklch,var(--success,#1f7a3d) 12%,var(--field,#fff))}
.cf-tso14 .tso-bump-input:checked + .tso-check{background:var(--success,#1f7a3d);border-color:var(--success,#1f7a3d);color:var(--status-glyph,#fff)}
.cf-tso14 .tso-bump-input:focus-visible + .tso-check{outline:3px solid var(--field-focus,var(--accent,#2563eb));outline-offset:2px}
.cf-tso14 .tso-bump-title{font-weight:800;font-size:1.0625rem;line-height:1.3;text-wrap:pretty}
.cf-tso14 .tso-bump-body{padding:12px 16px 14px;font-size:.9375rem;font-weight:500;line-height:1.5;text-wrap:pretty}
.cf-tso14 .tso-sum{display:grid;gap:8px;padding:16px 20px;border-radius:10px;background:var(--tso-well)}
.cf-tso14 .tso-row{display:flex;justify-content:space-between;align-items:baseline;gap:16px;font-size:1rem;line-height:1.4}
.cf-tso14 .tso-row > span:first-child{min-width:0;text-wrap:pretty}
.cf-tso14 .tso-row > span:last-child{flex:0 0 auto;font-weight:700;font-variant-numeric:tabular-nums;white-space:nowrap}
.cf-tso14 .tso-row.is-new{animation:tso-pop .3s ease both}
@keyframes tso-pop{from{opacity:.5;transform:scale(.97)}}
.cf-tso14 .tso-total{margin-top:8px;font-size:1.0625rem;font-weight:800}
.cf-tso14 .tso-total .tso-total-n{font-family:var(--font-display,inherit);font-size:clamp(1.3125rem,1.8vw,1.625rem);font-weight:800;line-height:1;letter-spacing:-.02em}
.cf-tso14 .tso-act{display:grid;gap:12px}
.cf-tso14 .tso-act2{display:flex;align-items:stretch;gap:12px}
.cf-tso14 .tso-act2 .tso-btn{flex:1 1 auto;width:auto}
.cf-tso14 .tso-btn{--b:var(--tso-cta);--b2:var(--tso-cta-2);display:inline-flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:56px;padding:10px 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));font-family:var(--button-font,var(--font-display,inherit));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;color:var(--button-ink,var(--cta-ink,#fff));text-shadow:var(--button-text-shadow,none);background:linear-gradient(oklch(from var(--b) calc(l + .04) c h),oklch(from var(--b2) calc(l - .02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--b) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--b) calc(l - .16) c h),0 1px 2px oklch(from var(--tso-sh) l c h / .3),0 8px 16px -6px oklch(from var(--tso-sh) l c h / .45));cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-tso14 .tso-btn.is-order{min-height:64px}
.cf-tso14 .tso-btn:hover:not(:disabled){background:linear-gradient(oklch(from var(--b) calc(l - .01) c h),oklch(from var(--b2) calc(l - .07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--b) calc(l + .12) c h / .7),inset 0 -3px 0 oklch(from var(--b) calc(l - .18) c h),0 1px 2px oklch(from var(--tso-sh) l c h / .32),0 10px 18px -6px oklch(from var(--tso-sh) l c h / .55))}
.cf-tso14 .tso-btn:active:not(:disabled){transform:translateY(1px);box-shadow:inset 0 2px 4px oklch(from var(--b) calc(l - .22) c h / .55),inset 0 -2px 0 oklch(from var(--b) calc(l - .16) c h),0 1px 2px oklch(from var(--tso-sh) l c h / .25)}
.cf-tso14 .tso-btn:focus-visible{outline:3px solid var(--field-focus,var(--accent,#2563eb));outline-offset:3px}
.cf-tso14 .tso-btn:disabled{cursor:not-allowed;background:var(--secondary,#e8ebf0);color:var(--secondary-ink,#1a2233);text-shadow:none;box-shadow:none}
.cf-tso14 .tso-btn.is-loading:disabled{cursor:progress;color:var(--button-ink,var(--cta-ink,#fff));text-shadow:var(--button-text-shadow,none);background:linear-gradient(oklch(from var(--b) calc(l + .04) c h),oklch(from var(--b2) calc(l - .02) c h));box-shadow:inset 0 -3px 0 oklch(from var(--b) calc(l - .16) c h)}
.cf-tso14 .tso-btn2{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;min-height:64px;padding:10px 24px;border:1px solid var(--button-2-border,transparent);border-radius:var(--button-radius,var(--radius,12px));background:var(--button-2-bg,var(--secondary,#e8ebf0));color:var(--button-2-ink,var(--secondary-ink,#1a2233));font-family:var(--button-font,var(--font-display,inherit));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.15;box-shadow:var(--button-2-shadow,var(--shadow-sm,0 1px 2px oklch(.22 .03 256 / .2)));cursor:pointer;transition:background-color .16s ease,transform .16s ease}
.cf-tso14 .tso-btn2:hover:not(:disabled){background:oklch(from var(--button-2-bg,var(--secondary,#e8ebf0)) calc(l - .03) c h)}
.cf-tso14 .tso-btn2:active:not(:disabled){transform:translateY(1px);background:oklch(from var(--button-2-bg,var(--secondary,#e8ebf0)) calc(l - .06) c h)}
.cf-tso14 .tso-btn2:focus-visible{outline:3px solid var(--field-focus,var(--accent,#2563eb));outline-offset:3px}
.cf-tso14 .tso-btn2:disabled{cursor:not-allowed}
.cf-tso14 .tso-spin{width:20px;height:20px;flex:0 0 auto;animation:tso-spin .8s linear infinite}
@keyframes tso-spin{to{transform:rotate(360deg)}}
.cf-tso14 .tso-reassure{display:grid;gap:6px}
.cf-tso14 .tso-small{font-size:.9375rem;font-weight:500;line-height:1.4;color:var(--muted,#4a5565);text-align:center;text-wrap:pretty}
.cf-tso14 .tso-small svg{display:inline-block;vertical-align:-.15em;width:16px;height:16px;margin-inline-end:.4em}
.cf-tso14 .tso-small.is-guarantee{font-weight:600;color:var(--ink,#1a2233)}
.cf-tso14 .tso-small.is-guarantee svg{color:var(--success,#1f7a3d)}
@media (max-width:560px){
.cf-tso14 .tso-offer{flex-direction:column;align-items:flex-start;gap:12px}
.cf-tso14 .tso-thumbs img{width:48px;height:48px}
.cf-tso14 .tso-seg-sub{display:none}
.cf-tso14 .tso-seg-btn{min-height:56px;padding:8px 12px;gap:10px}
.cf-tso14 .tso-btn{padding:10px 20px}
.cf-tso14 .tso-act2{flex-direction:column-reverse}
.cf-tso14 .tso-btn2{width:100%;min-height:56px}
.cf-tso14 .tso-sum{padding:14px 16px}
}
@media (prefers-reduced-motion:reduce){
.cf-tso14 *,.cf-tso14 *::before,.cf-tso14 *::after{animation:none!important;transition:none!important}
}
`
pieces/checkout/two-step-order-14/specimen.tsx 32 lines
import * as React from 'react'
import { TwoStepOrder14, type TwoStepOrder14State } from '../two-step-order-14'
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
export const states = ['default', 'active', 'error', 'disabled']
export default function TwoStepOrder14Specimen({ state = 'default' }: { state?: TwoStepOrder14State }) {
const s = defaults.sample
return (
<TwoStepOrder14
state={state}
productName={s.name}
productNote={s.note}
price={s.price}
items={s.items.map((item, i) => ({ name: item.name, image: slot('item-' + (i + 1), item.image), imageAlt: item.imageAlt }))}
reasons={[
'The guide, workbook and checklist arrive in one download.',
'You plan, write and check every page before you launch.',
'You’re covered by the 30-day money-back guarantee.',
]}
guarantee={s.guarantee}
bump={{
title: 'Yes! Add the Funnel Copy Swipe File for {price}',
body: 'Fill-in headline and email templates that follow the workbook, ready to copy into your pages.',
price: '$17',
summaryLabel: 'Funnel Copy Swipe File',
}}
copy={{ orderNote: s.sublabel }}
/>
)
}
| Name | Type | Details |
|---|---|---|
productName OptionalTwoStepOrder14 |
string |
Default 'The Funnel Starter Kit'
|
productNote OptionalTwoStepOrder14 |
string |
Default 'One payment · Lifetime access'
|
price OptionalTwoStepOrder14 |
string |
Default '$47'
|
items OptionalTwoStepOrder14 |
Order14Item[] |
Default []
|
reasons OptionalTwoStepOrder14 |
string[] |
Default DEFAULT_REASONS
|
steps OptionalTwoStepOrder14 |
[Order14Step, Order14Step] |
Default DEFAULT_STEPS
|
fields OptionalTwoStepOrder14 |
Order14Field[] |
Default CONTACT_FIELDS
|
collectShipping OptionalTwoStepOrder14 |
boolean |
Default false
|
shippingFields OptionalTwoStepOrder14 |
Order14Field[] |
Default SHIPPING_FIELDS
|
paymentFields OptionalTwoStepOrder14 |
Order14Field[] |
Default PAYMENT_FIELDS
|
bump OptionalTwoStepOrder14 |
Order14Bump | null |
Default null
|
guarantee OptionalTwoStepOrder14 |
string | null |
Default '30-day money-back guarantee'
|
acceptedCards OptionalTwoStepOrder14 |
CardMark[] |
Default ALL_CARDS
|
currency OptionalTwoStepOrder14 |
string |
Default 'USD'
|
copy OptionalTwoStepOrder14 |
Partial<TwoStepOrder14Copy> |
|
state OptionalTwoStepOrder14 |
TwoStepOrder14State |
|
initialStep OptionalTwoStepOrder14 |
1 | 2 |
Default 1
|
defaultValues OptionalTwoStepOrder14 |
Record<string, string> |
|
disabled OptionalTwoStepOrder14 |
boolean |
Default false
|
onContinue OptionalTwoStepOrder14 |
(values: Readonly<Record<string, string>>) => void |
|
onSubmit OptionalTwoStepOrder14 |
(values: Readonly<Record<string, string>>, bumpSelected: boolean) => void | Promise<void> |
|
className OptionalTwoStepOrder14 |
string |
Default ''
|
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-border--button-2-ink--button-2-shadow- 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.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
This piece reads no image slots.
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB