View as Markdown

Embeds · Guide

Show a capture list

<provenance-capture-list> lists your account's capture requests for your staff, inside your own admin tool, newest first. Each row is one line: the status with a dot, what was asked for, the hardware grade and the time. Your staff filter it, sort it and page through it; a selected row opens in a panel beside the rows.

Before you begin: a publishable key (see embeds) and a secret key with the attest scope. The embed needs Pro or the Free trial in live, and works on any plan in sandbox; the same rows show on the console's Capture requests page on every plan.

export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x

1. Mint a list session on your server

Your server mints a short session for the list with POST /v1/embed/tokens and widget: "capture_list". A list takes no object_id: it's scoped to your account (a key's session, to the carrier its requests land with). Put it behind a route your admin page calls, after your own sign-in check:

In the SDK tabs, prov (Node, Python) and embed (Go) are your server-side clients, set up as in admin results and requests.

curl -s -X POST $PROVENANCE_API/v1/embed/tokens \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "widget": "capture_list", "filters": { "case_id": "LMB-20418" }, "show": ["case_id"], "ttl": 900 }'
FieldWhat it does
filtersOptional. Filters the session always applies, which the browser can't change: status, item_type, source, destination, case_id, created_gte, created_lte. Pin case_id to show one case's requests on its case page.
showOptional. ["case_id"] adds your case reference to each row.
ttlSeconds, up to 900 (15 minutes).

A key without the attest scope gets 403 insufficient_scope. A filter that isn't one of the list's, or a value it doesn't take, is 400 parameter_invalid.

2. Drop the list in your page

npm install @provenance/embed
<script type="module" src="https://unpkg.com/@provenance/embed"></script>

<provenance-capture-list id="requests" base-url="https://sandbox-api.provenanceauth.com" publishable-key="prv_pub_1D10TzJo8F73Z7ZHhWGKPpn0K7suJ0se"
  filters="status,kind,created" page-size="25"></provenance-capture-list>

<script>
  const list = document.querySelector("provenance-capture-list");
  // No context: the list's own session. { objectId, widget }: the session for the row its panel opens.
  list.getToken = async ({ objectId, widget } = {}) => {
    const q = objectId ? `widget=${widget}&id=${objectId}` : "widget=capture_list";
    return (await (await fetch(`/admin/provenance/session?${q}`)).json()).token;
  };
</script>

A selected row opens in the list's own panel: beside the rows on a column 600 px or wider, with the request's reference, Previous, Next and Close; narrower, as the whole element with Back. One "Powered by Provenance" sits under both.

The panel asks the list's getToken({ objectId, widget: "capture_result" }) for the request's ID (capr_…), and your server mints a capture_result session for exactly that request, so the list never widens what it can read. Check the request is one your staff member may see before you mint.

AttributeWhat it does
filtersThe filters shown, from status, kind (an item type), source, destination (where the link opened), case (a case reference) and created (Any time, Today, Last 7 days, Last 30 days). status,created when absent. A pinned filter has no tab, chip or menu entry.
sortThe order on load, one of Newest first (-created) or Oldest first (created). Newest first when absent.
sortsThe orders the sort button offers, a comma list (for example -created,created). All of them when absent.
detailpanel (the default) opens a selected row in the list's own panel. none only emits pv:select.
page-sizeRows per page, 10 to 100. 25 when absent.
select-firstSelect the first row on load (with the panel, it opens on that row).

Above the rows: tabs for status (All, Waiting and Completed), a Filter chip for the other filters you show, a chip for each filter in use (its button removes it) and a sort button that names the current order.

Under the rows, the range ("1–25") and Newer and Older page by cursor, with no page numbers or totals. The filters, the sort and the page stay inside the element; to keep them in your page's address, listen for pv:list_change.

To show the request somewhere else on your page, set detail="none" and either handle pv:select yourself or put a <provenance-capture-result for="requests"> beside it (a list that a result element follows never opens its own panel):

list.addEventListener("pv:select", (e) => {
  const { kind, id } = e.detail; // kind: "capture", id: "capr_…"
  openCase(id);
});

In React:

import { ProvenanceCaptureList } from "@provenance/embed/react";

<ProvenanceCaptureList
  id="requests"
  baseUrl={process.env.NEXT_PUBLIC_PROVENANCE_API!}
  publishableKey="prv_pub_1D10TzJo8F73Z7ZHhWGKPpn0K7suJ0se"
  filters={["status", "kind", "created"]}
  sort="created"
  getToken={async ({ objectId, widget } = {}) => {
    const q = objectId ? `widget=${widget}&id=${objectId}` : "widget=capture_list";
    return (await (await fetch(`/admin/provenance/session?${q}`)).json()).token;
  }}
/>;

What it shows

Each row, and where it comes from in GET /v1/attest/capture_requests:

PartExampleFrom
StatusCompleted, and Review when the checks need a personstatus (Declined when the person's latest release is a decline), result.checks
CaseLMB-20418case_id, only with show: ["case_id"]
WhatID photo and a selfiesession_type, the items' type and max_count
GradeHardware · StrongBoxThe weakest item's tier
Risk score35, or Risk 35 on a phoneThe highest captured item's risk_score, 0 to 100; blank before anything is taken
Time1:23 pm today, Nov 14 beforecreated_at

The list's filters are the API list's own, and the API list takes the same created range: created_gte and created_lte. The element gets types and counts only, never your item labels or instructions, a contact, a link or metadata. To see what it gets, call GET /v1/embed/capture_list with the session.

Events

EventWhenDetail
pv:readyThe session openedwidget, object_id, mode
pv:selectA row was selected (click, Enter or Space)kind: "capture", id
pv:list_changeThe filters, the sort or the page changedfilters, cursor, sort
pv:token_refresh_failedgetToken() couldn't renew the sessionwidget
pv:errorThe element couldn't start or read a pagecode, message

Embed, console or your own

This embedThe consoleYour own UI on the API
WhereYour admin toolAttest › Capture requestsAnywhere you like
PlanPro, or the Free trial; any plan in sandboxEvery planEvery plan
WorkMint two kinds of session, drop one tagNonePage the list, map the words, mint or read each result

Errors you might see

SymptomCauseFix
400 embed_filter_pinnedThe page asked for another value of a pinned filterLeave it out; the session applies it.
400 parameter_invalid on sort or cursorA sort the list doesn't take, or a cursor made in another orderUse an order from the sort row above; start again without the cursor.
403 insufficient_scopeThe key has no attest scopeMint with an Attest key.
401 embed_token_invalidThe session expired or is for another widgetMint a new one, or give the element getToken().
503 embed_result_unavailableThe list couldn't be readRetry shortly.

See also