Exclusivobeta
Delivery Trail <mv-delivery-trail>
Torna observável, salto a salto, a entrega de mensagens críticas e transforma falhas silenciosas em travamentos visíveis e acionáveis: e-mails de redefinição de senha e de verificação, códigos por SMS, faturas, notificações push, webhooks, pedidos de assinatura eletrônica. Cada mensagem é um rastro ordenado (created → queued → sent → delivered → opened, ou os saltos que você declarar) com carimbos de data e hora, o tempo que cada salto levou e o texto de status do próprio provedor. Cada salto tem um orçamento de tempo; enquanto o próximo salto é aguardado, a linha até ele se preenche ao longo do orçamento e, quando ele se esgota sem progresso, o rastro marca um travamento silencioso bem naquele salto, diz em palavras simples o que provavelmente aconteceu (“Delivered to the mail server 12 min ago, not opened. It may be in spam or a promotions folder.”) e oferece as alternativas que o seu app declarou (Reenviar, Enviar por SMS, Copiar link, Ligar) por um evento cancelável mv-fallback com waitUntil(). Os bounces mostram o motivo literal, as novas tentativas do provedor são marcadas, eventos de webhook fora de ordem são reconciliados e as chegadas tardias são marcadas como “over budget”. Alimente-o com update(hop, status, { at, detail }) ou com um array de eventos; várias mensagens formam uma lista compacta com o pior estado primeiro (as linhas deslizam para o lugar), minitrilhas por linha e totais. Os tempos derivam de carimbos absolutos e de timers de prazo, então abas em segundo plano nunca se desregulam nem deixam passar um travamento.
| Categoria | Exibição de dados |
|---|---|
| Tipo | Web Component (<mv-delivery-trail>) |
| Status | beta |
| Kit | Estados do sistema honestos |
| Também instala | button |
| Keywords | exclusive, culture, delivery, message-status, email, sms, webhook, push-notification, transactional-email, otp, verification, bounce, sla, timeout, stall, fallback, support-tool, observability, tracking, status |
When to use
- A support agent must see why a customer never got a reset email, invoice or code, and act on it without opening the provider's logs
- A sign-in or checkout flow sends a verification code and should offer SMS or a call when the email silently stalls
- An admin console lists outbound webhooks, SMS and emails and must surface failed or overdue deliveries first
- An e-signature or invoicing tool tracks sent, viewed and signed steps and must prompt a reminder when one takes too long
Avoid when
- The user moves through the steps themselves, such as a checkout or onboarding wizard → use Stepper instead
- The concern is a stream of events that stopped arriving altogether, not one message's hops → use Quiet Alarm instead
- The events are a finished history with no expected timing or pending step, where a plain list reads better
Instalação
node scripts/add.mjs delivery-trail --out ./src/marvelousAgente de IA com o servidor MCP do Marvelous UI: install_components({ slugs: ["delivery-trail"], target_dir: "<absolute path>/src/marvelous", framework: "react" }).
Arquivos copiados (dependências incluídas): tokens/tokens.css, core/base.css, core/dom.js, core/element.js, core/motion.js, core/observe.js, components/delivery-trail/delivery-trail.js, components/delivery-trail/delivery-trail.css, components/button/button.css.
Uso
Início rápido, a menor marcação que funciona:
<mv-delivery-trail label="Password reset email" recipient="[email protected]" channel="email"
fallbacks="resend: Resend email, sms: Send code via SMS"></mv-delivery-trail>
<!-- from your provider webhooks: trail.update("delivered") -->Marcação de referência, para usar como ponto de partida e personalizar com atributos, data-* e variáveis CSS:
<div id="dt-demo" style="width:min(100%,62rem);margin-inline:auto">
<style>
#dt-demo { display:grid; gap:1.5rem; align-content:start }
#dt-demo .dt-grid { display:grid; grid-template-columns:17rem minmax(0,1fr); gap:1rem; align-items:start }
#dt-demo .dt-card { min-width:0; border:1px solid var(--mv-border); border-radius:var(--mv-radius-xl); background:var(--mv-surface); box-shadow:var(--mv-shadow-sm) }
#dt-demo .dt-ticket { display:grid; gap:.875rem; padding:1rem 1.125rem }
#dt-demo .dt-k { margin:0; color:var(--mv-fg-muted); font-size:.6875rem; font-weight:600; letter-spacing:.05em; text-transform:uppercase }
#dt-demo .dt-person { display:flex; align-items:center; gap:.75rem }
#dt-demo .dt-avatar { display:grid; place-items:center; width:2.5rem; height:2.5rem; flex:none; border-radius:50%; background:var(--mv-bg-emphasis); font-size:.8125rem; font-weight:600 }
#dt-demo .dt-person b { display:block; font-size:.9375rem; letter-spacing:-.01em }
#dt-demo .dt-person span { color:var(--mv-fg-muted); font-size:.8125rem }
#dt-demo .dt-quote { margin:0; padding:.625rem .75rem; border-radius:var(--mv-radius-lg); background:var(--mv-bg-subtle); color:var(--mv-fg); font-size:.8125rem; line-height:1.5 }
#dt-demo .dt-facts { display:grid; grid-template-columns:auto 1fr; gap:.375rem .75rem; margin:0; font-size:.8125rem }
#dt-demo .dt-facts dt { color:var(--mv-fg-muted) }
#dt-demo .dt-facts dd { margin:0; text-align:end; font-variant-numeric:tabular-nums }
#dt-demo .dt-badges { display:flex; gap:.375rem; flex-wrap:wrap }
#dt-demo .dt-side { display:grid; gap:.75rem; min-width:0 }
#dt-demo .dt-controls { display:flex; align-items:center; justify-content:space-between; gap:.75rem 1rem; flex-wrap:wrap; padding:.75rem 1rem; border:1px dashed var(--mv-border-strong); border-radius:var(--mv-radius-lg) }
#dt-demo .dt-controls p { margin:0; color:var(--mv-fg-muted); font-size:.75rem; flex:1 1 14rem }
#dt-demo .dt-actions { display:flex; align-items:center; gap:.75rem; flex-wrap:wrap }
#dt-demo .mv-choice { font-size:.8125rem }
#dt-demo .dt-log { min-height:1.1rem; margin:0; color:var(--mv-fg-subtle); font:.75rem/1.4 var(--mv-font-mono); overflow-wrap:anywhere }
#dt-demo .dt-head { display:flex; align-items:end; justify-content:space-between; gap:.5rem 1rem; flex-wrap:wrap; margin:0 0 .75rem }
#dt-demo .dt-head h3 { margin:0; font-size:1rem; letter-spacing:-.01em }
#dt-demo .dt-head p { margin:.125rem 0 0; color:var(--mv-fg-muted); font-size:.8125rem }
@media (max-width:46rem) { #dt-demo .dt-grid { grid-template-columns:minmax(0,1fr) } }
</style>
<!-- 1. Support console: a password reset email that silently never got opened -->
<div class="dt-grid">
<aside class="dt-card dt-ticket" aria-label="Support ticket">
<p class="dt-k">Ticket #48213 · Sign-in</p>
<div class="dt-person">
<span class="dt-avatar" aria-hidden="true">AO</span>
<span><b>Amara Okafor</b><span>Lumen Health · Admin</span></span>
</div>
<p class="dt-quote">“I asked for a password reset twice this morning and nothing ever came. I have a board meeting at noon.”</p>
<dl class="dt-facts">
<dt>Plan</dt><dd>Business</dd>
<dt>Last sign-in</dt><dd>Sep 20, 2026</dd>
<dt>Phone</dt><dd>+1 (415) 555-0192</dd>
</dl>
<div class="dt-badges">
<span class="mv-badge" data-variant="warning">High priority</span>
<span class="mv-badge" data-variant="secondary">Email</span>
</div>
</aside>
<div class="dt-side">
<mv-delivery-trail id="dt-main"
label="Password reset email"
recipient="[email protected]"
channel="email"
budgets="queued: 10s, sent: 30s, delivered: 2m, opened: 10m"
fallbacks="resend: Resend email, sms: Send code via SMS, copy: Copy reset link"
announce="all"></mv-delivery-trail>
<div class="dt-controls">
<p>Resend runs a live, accelerated delivery (budgets of a few seconds). Keep “Lands in spam” on to watch it stall again.</p>
<span class="dt-actions">
<label class="mv-choice"><input type="checkbox" role="switch" class="mv-switch" id="dt-spam" checked> Lands in spam</label>
<button type="button" class="mv-button" data-variant="outline" data-size="sm" id="dt-send">Send a new link</button>
</span>
</div>
<p class="dt-log" id="dt-log" aria-live="off">mv-stall · opened</p>
</div>
</div>
<!-- 2. Outbound messages: several deliveries, worst state first -->
<section aria-labelledby="dt-out-title">
<div class="dt-head">
<div>
<h3 id="dt-out-title">Outbound messages · last hour</h3>
<p>The push notification is on a 10-second budget: watch it stall and move up.</p>
</div>
<button type="button" class="mv-button" data-variant="ghost" data-size="sm" id="dt-replay">Replay</button>
</div>
<mv-delivery-trail id="dt-list"></mv-delivery-trail>
</section>
<script type="module">
const main = document.getElementById("dt-main");
const list = document.getElementById("dt-list");
const log = document.getElementById("dt-log");
const spam = document.getElementById("dt-spam");
const s = 1000, min = 60 * s;
const ago = (ms) => Date.now() - ms;
const say = (text) => { log.textContent = text; };
// ── 1. Password reset email: delivered 12 minutes ago, never opened (10 min budget) ──
main.events = [
{ hop: "created", at: ago(12 * min + 5.4 * s), detail: "Requested from the sign-in page" },
{ hop: "queued", at: ago(12 * min + 5.1 * s), detail: "job_7Hq2 · transactional" },
{ hop: "sent", at: ago(12 * min + 3.8 * s), detail: "Accepted by provider · msg_01J8ZK4F" },
{ hop: "delivered", at: ago(12 * min), detail: "250 2.0.0 OK · mx1.lumenhealth.test" },
];
let run = [];
const clearRun = () => { run.forEach(clearTimeout); run = []; };
const later = (ms, fn) => run.push(setTimeout(fn, ms));
// A live, accelerated send: each hop lands after a short delay; spam = never opened.
function liveSend() {
clearRun();
main.budgets = "queued: 2s, sent: 3s, delivered: 4s, opened: 6s";
main.reset(undefined, { start: true, detail: "Resent by support · Daniel Park" });
later(350, () => main.update("queued", "done", { detail: "job_9Kc4 · transactional" }));
later(1100, () => main.update("sent", "done", { detail: "Accepted by provider · msg_01J8ZQ2M" }));
later(2600, () => main.update("delivered", "done", { detail: "250 2.0.0 OK · mx1.lumenhealth.test" }));
if (!spam.checked) later(4800, () => main.update("opened", "done", { detail: "Opened on mobile · Mail app" }));
}
main.addEventListener("mv-fallback", (e) => {
const { action } = e.detail;
say(`mv-fallback · ${action}`);
if (action === "resend") e.detail.waitUntil(new Promise((r) => setTimeout(r, 500)).then(liveSend));
if (action === "sms") e.detail.waitUntil(new Promise((r) => setTimeout(r, 700)).then(() => say("mv-fallback · sms → code sent to +1 (415) •••-0192")));
});
main.addEventListener("mv-stall", (e) => say(`mv-stall · ${e.detail.hop}`));
main.addEventListener("mv-recover", (e) => say(`mv-recover · ${e.detail.hop}`));
main.addEventListener("mv-complete", () => say("mv-complete"));
document.getElementById("dt-send").addEventListener("click", liveSend);
// ── 2. Outbound messages ──
const at = (list) => list.map(([hop, t, detail, status]) => ({ hop, at: ago(t), detail, status }));
const messages = () => [
{
id: "push-rider", label: "“Your driver is 2 minutes away”", recipient: "Push · Rider app · Sofia Reyes", channel: "push",
hops: ["created", "sent", "delivered", "opened"], budgets: { sent: "5s", delivered: "10s", opened: "5m" },
fallbacks: [{ action: "sms", label: "Send as SMS" }],
events: at([["created", 2.4 * s, "trip_5521 · driver_eta"], ["sent", 2 * s, "Push gateway · msg_0:1727"]]),
},
{
id: "invoice", label: "Invoice INV-2048 · $17,400.00", recipient: "[email protected]", channel: "invoice",
hops: ["created", "queued", "sent", "delivered", "opened"],
fallbacks: [{ action: "edit", label: "Fix the address" }, { action: "copy", label: "Copy payment link", copy: "https://pay.ledgerly.test/i/INV-2048" }],
events: at([
["created", 22 * min, "Issued by Priya Nair"], ["queued", 22 * min - 0.4 * s], ["sent", 22 * min - 1.6 * s, "msg_01J8XR3T"],
["delivered", 21 * min, "550 5.1.1 <[email protected]>: Recipient address rejected: User unknown", "failed"],
]),
},
{
id: "otp", label: "Sign-in code", recipient: "+44 7700 900123 · Oliver Hughes", channel: "sms",
hops: ["created", "sent", "delivered", "confirmed"], budgets: { delivered: "1m", confirmed: "5m" },
fallbacks: [{ action: "resend", label: "Resend code" }, { action: "call", label: "Call with code", href: "tel:+447700900123" }],
events: at([["created", 3 * min + 2 * s], ["sent", 3 * min, "Carrier: Northline · SM1f3a9c"]]),
},
{
id: "hook", label: "Webhook · order.paid", recipient: "https://api.kestrel.test/hooks/orders", channel: "webhook",
hops: ["created", "sent", "delivered"], budgets: { delivered: "5m" },
fallbacks: [{ action: "retry", label: "Retry now" }],
events: at([["created", 48 * s, "evt_3PqK81"], ["sent", 47 * s], ["delivered", 17 * s, "HTTP 503 Service Unavailable · retry 2 of 5 in 30 s", "retrying"]]),
},
{
id: "esign", label: "Master services agreement", recipient: "Li Wei · Kestrel Logistics", channel: "esign",
hops: ["created", "sent", "delivered", "viewed", "signed"],
events: at([["created", 41 * min], ["sent", 41 * min - 1 * s], ["delivered", 41 * min - 4 * s], ["viewed", 18 * min, "Web browser · Singapore"], ["signed", 6 * min, "Signature ID sig_92KD"]]),
},
{
id: "magic", label: "Magic sign-in link", recipient: "[email protected]", channel: "email",
events: at([["created", 95 * s], ["queued", 94.8 * s], ["sent", 93 * s], ["delivered", 90 * s, "250 OK · mx1.fjordcloud.test"], ["opened", 60 * s, "Webmail · desktop"]]),
},
];
list.messages = messages();
document.getElementById("dt-replay").addEventListener("click", () => { list.messages = messages(); });
list.addEventListener("mv-fallback", (e) => {
if (e.detail.action === "retry") {
e.detail.waitUntil(new Promise((r) => setTimeout(r, 600)).then(() => list.update("delivered", "done", { message: "hook", detail: "HTTP 200 OK · 184 ms" })));
}
if (e.detail.action === "resend") {
e.detail.waitUntil(new Promise((r) => setTimeout(r, 600)).then(() => {
list.reset("otp", { start: true });
setTimeout(() => list.update("sent", "done", { message: "otp", detail: "Carrier: Northline · SM1f40d2" }), 500);
setTimeout(() => list.update("delivered", "done", { message: "otp", detail: "DELIVRD · handset" }), 1600);
}));
}
if (e.detail.action === "sms") {
e.detail.waitUntil(new Promise((r) => setTimeout(r, 600)));
}
});
</script>
</div>Referência cultural
Romeu e Julieta, William Shakespeare (1597, peça). A carta de frei Lourenço explicando o plano nunca chega a Romeu porque o mensageiro fica retido em quarentena e, como ninguém fica sabendo que a entrega falhou, a tragédia nasce de uma não chegada silenciosa. Na interface, cada salto de uma mensagem crítica é observável e cronometrado, e um salto que estoura seu orçamento vira um travamento visível e explicado, com alternativas, em vez de um silêncio que ninguém percebe.
API
Attributes
| Name | Tipo | Default | Description |
|---|---|---|---|
hops | comma list | created, queued, sent, delivered, opened | Hops of every message that doesn't declare its own (message.hops). Known ids get English labels and stall wording (created, queued, accepted, sent, delivered, opened, clicked, read, viewed, confirmed, signed, paid, processed); any other id is shown capitalized. |
budgets | "hop: time, …" ("queued: 10s, delivered: 2m, opened: 10m") | queued 30s · accepted 1m · sent 2m · delivered 5m · opened 30m | Time allowed between the previous hop and this one before it is a silent stall. Times accept ms, s, m/min, h, d or a bare number of ms. Per-message budgets and per-hop budget override it; hops without any budget never stall. |
fallbacks | "action: Label, …" | Fallback buttons offered during a stall or failure for messages that don't declare their own (message.fallbacks). Known actions get an icon: resend/retry, sms/text, copy/link, call/phone, email, push. | |
label / recipient / channel | string | Shorthand for a single message (id "default") when you don't set messages. channel (email, sms, push, webhook, esign, invoice, call or any string) picks the icon and channel-specific wording ("Delivered to the mail server", "The phone may be off"). | |
layout | auto | trail | list | auto | trail: every message fully expanded; list: compact rows (disclosure buttons) with mini tracks and totals; auto: trail for one message, list for several. |
announce | problems | all | none | problems | What the polite live region says: stalls, failures and late recoveries (problems), plus every hop reached and completion (all), or nothing. |
locale | BCP 47 | en-US | Locale of absolute timestamps (10:42:07 AM; month and day are added when not today). |
data-state / data-layout | failed | stalled | waiting | idle | complete | Set by the component on the host (worst state) and on each .mv-delivery-trail-item (that message's state). |
Properties
| Name | Tipo | Description |
|---|---|---|
messages | Array<{ id, label, recipient, channel, hops?: (string | { id, label?, budget? })[], budgets?: Record<hop, time> | string, fallbacks?: Fallback[] | string, hints?: Record<hop, string>, events?: Event[] }> | Replace every message (read: snapshots). Messages with the same id keep their open state and don't re-emit stalls already reported. A Fallback is { action, label, when?: "problem" | "stall" | "failed", href? (rendered as a link: tel:, mailto:, https:), copy? (text copied to the clipboard), icon?, variant?, done? (label shown after success) }. |
events | Array<{ message?, hop, status?, at?, detail? }> | Apply a batch of events in order (same rules as update()). Replaying events already applied is harmless. Read: the last 500 events applied. |
state | "failed" | "stalled" | "waiting" | "idle" | "complete" | Worst state across messages (read-only). |
strings | Partial<Record<string, string>> & { hops?, past?, missing?, hints? } | Overrides for every visible text and announcement. hops = hop labels, past = how a reached hop is phrased in a stall ("email:delivered": "Delivered to the mail server"), missing = how the awaited hop is phrased ("not opened"), hints = the probable cause ("email:opened": "It may be in spam…"); keys can be "hop" or "channel:hop". Other keys: stallText ({past} {ago}, {missing}. {hint}), stallTitle, failTitle, failText, state*, step*, note*, waiting, expected, late, totals*, fallback*, announce*. English defaults. |
hops / budgets / fallbacks / label / recipient / channel / layout / announce / locale | reflected | Mirror the attributes. |
Methods
| Name | Description |
|---|---|
update(hop, status = "done", { at?, detail?, message? }) | Record provider progress. status: done | failed (bounce, error: detail is shown as the reason) | retrying (deferred, soft bounce: marked on the awaited hop, the budget keeps running) | pending (undo). at: Date, epoch ms or ISO string (default now). A later hop marks earlier ones as reached (out-of-order webhooks). message defaults to the only message. Also accepts one object { message, hop, status, at, detail }. Returns true if applied. |
addMessage(message) / removeMessage(id) | Add (or replace by id) one message; remove one. addMessage returns the id. |
reset(id?, { start?, at?, detail? }) | Clear a message's progress (before a resend); start: true marks its first hop done now (or at). |
get(id?) | Snapshot { id, label, recipient, channel, state, hop, elapsed, budget, overdue, hops[] } of one message. |
Events
| Name | Description |
|---|---|
mv-stall | A hop exceeded its budget without progress (once per hop and attempt). detail: { message, hop, elapsed, budget, since, initial } (initial: already stalled when the data was loaded, not announced). |
mv-fallback | Cancelable. A fallback button was pressed. detail: { message, action, hop, state, fallback, waitUntil(promise) }. waitUntil shows a busy button, then a brief check (or an error, announced). preventDefault() cancels the default behavior (link navigation, clipboard copy). |
mv-fail | A hop failed. detail: { message, hop, detail, at, initial }. |
mv-recover | A stalled hop finally arrived. detail: { message, hop, late (ms past the budget) }. |
mv-progress | A hop changed status through update() or events. detail: { message, hop, status, at, detail }. |
mv-complete | Every hop of a message is reached. detail: { message }. |
Content structure
| Name | Description |
|---|---|
(JSON) | An optional child <script type="application/json"> holding an array of messages or { messages, events } is read on first connection (server-rendered pages). |
CSS classes
| Name | Description |
|---|---|
mv-delivery-trail-item | One message (<li>, data-state). Contains -head (a disclosure <button class="mv-delivery-trail-summary"> in list layout): -icon, -label, -recipient, -track/-tick (mini track, aria-hidden), -pill, -note, -chevron; then -body. |
mv-delivery-trail-steps / -step | The ordered list of hops; each step has data-status (done | waiting | stalled | failed | pending | skipped), data-rail (line to the next hop: done | flow | stall | fail | idle | end), data-late, aria-current on the awaited hop. Parts: -marker, -rail/-rail-fill, -name, -word, -time, -delta, -meta, -detail. |
mv-delivery-trail-callout | Stall or failure box inside the problem hop (data-tone): -callout-title, -callout-text, -callout-reason (bounce text), -actions with .mv-delivery-trail-fallback buttons (data-action, data-state pending | done | error). |
mv-delivery-trail-totals | Counts line above the list layout (-total, -count[data-tone]). |
CSS variables
| Name | Default | Description |
|---|---|---|
--mv-delivery-trail-ok | var(--mv-success) | Reached hops and complete messages. |
--mv-delivery-trail-active | var(--mv-accent) | The awaited hop and the line filling toward it. |
--mv-delivery-trail-stall | var(--mv-warning) | Silent stalls, retries and late arrivals. |
--mv-delivery-trail-fail | var(--mv-danger) | Failures and bounces. |
--mv-delivery-trail-stall-fg | the stall color mixed 78% toward near-black | Text and icons on the solid stall fill (Stalled word, stalled marker). |
--mv-delivery-trail-fail-fg | white in light theme, a near-black red in dark theme | Text and icons on the solid fail fill (Failed word, failed marker). Set it when you change --mv-delivery-trail-fail, to keep 4.5:1. |
Accessibility
Each message's hops are a real ordered list (<ol>) and every step carries its status in words, not only color: a visually hidden “Step 3 of 5”, the hop name, a status word (visible for Waiting, Retrying, Stalled, Failed, Not reached; spoken only for Done and Pending, whose check or empty ring shows it), the timestamp in a <time datetime> element and the provider detail. The awaited, stalled or failed hop has aria-current="step". Stalls, failures and late recoveries are announced once in a polite live region (“Password reset email: stalled at Opened. Delivered to the mail server 12 min ago, not opened. It may be in spam or a promotions folder.”); announce="all" adds every hop reached, announce="none" silences it; data loaded already stalled is shown but not announced. The stall box is a labelled group; fallbacks are real <button>s (or <a> for tel:/mailto: links) whose visible label says the action and whose aria-describedby points at the stall explanation; while waitUntil() runs they are aria-busy and aria-disabled, and success or failure is announced. In the list layout each row is a disclosure <button> (aria-expanded, aria-controls) named from the label, recipient, state and note; the list keeps worst-first order, and focus is restored when rows move or a stall box disappears (to the row, or to the trail). Icons are decorative (aria-hidden); every tone comes with an icon and a word, and forced-colors mode draws markers, rails and callouts with system colors. Reduced motion (OS or data-motion="reduce"): no breathing dots, beacon or row sliding; the line toward the awaited hop steps once per second instead of flowing.