@certrev/cert-block 1.0.3 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +101 -0
- package/README.md +25 -6
- package/dist/builder/cert-chrome-data.d.ts +26 -1
- package/dist/builder/cert-chrome-data.d.ts.map +1 -1
- package/dist/builder/cert-chrome-data.js +1 -0
- package/dist/builder/cert-chrome-data.js.map +1 -1
- package/dist/builder/cert-review-card.d.ts +35 -2
- package/dist/builder/cert-review-card.d.ts.map +1 -1
- package/dist/builder/cert-review-card.js +112 -2
- package/dist/builder/cert-review-card.js.map +1 -1
- package/dist/builder/delivery-runtime.d.ts +23 -0
- package/dist/builder/delivery-runtime.d.ts.map +1 -0
- package/dist/builder/delivery-runtime.js +38 -0
- package/dist/builder/delivery-runtime.js.map +1 -0
- package/dist/builder/envelope-face.d.ts +63 -0
- package/dist/builder/envelope-face.d.ts.map +1 -0
- package/dist/builder/envelope-face.js +151 -0
- package/dist/builder/envelope-face.js.map +1 -0
- package/dist/builder/index.d.ts +15 -3
- package/dist/builder/index.d.ts.map +1 -1
- package/dist/builder/index.js +14 -2
- package/dist/builder/index.js.map +1 -1
- package/dist/builder/issuer-key.d.ts +12 -0
- package/dist/builder/issuer-key.d.ts.map +1 -0
- package/dist/builder/issuer-key.js +14 -0
- package/dist/builder/issuer-key.js.map +1 -0
- package/dist/components/memo-toggle.d.ts +42 -0
- package/dist/components/memo-toggle.d.ts.map +1 -0
- package/dist/components/memo-toggle.js +60 -0
- package/dist/components/memo-toggle.js.map +1 -0
- package/dist/components/render-cert-block.d.ts +9 -0
- package/dist/components/render-cert-block.d.ts.map +1 -1
- package/dist/components/render-cert-block.js +83 -25
- package/dist/components/render-cert-block.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/modal/certrev-cert-modal.d.ts +34 -1
- package/dist/modal/certrev-cert-modal.d.ts.map +1 -1
- package/dist/modal/certrev-cert-modal.js +40 -2
- package/dist/modal/certrev-cert-modal.js.map +1 -1
- package/dist/modal/certrev-cert.entry.d.ts.map +1 -1
- package/dist/modal/certrev-cert.entry.js +2 -4
- package/dist/modal/certrev-cert.entry.js.map +1 -1
- package/dist/modal/certrev-cert.js +4 -4
- package/dist/modal/deprecated.d.ts +15 -0
- package/dist/modal/deprecated.d.ts.map +1 -0
- package/dist/modal/deprecated.js +22 -0
- package/dist/modal/deprecated.js.map +1 -0
- package/dist/modal/ftc-disclosure.d.ts +7 -3
- package/dist/modal/ftc-disclosure.d.ts.map +1 -1
- package/dist/modal/ftc-disclosure.js +7 -3
- package/dist/modal/ftc-disclosure.js.map +1 -1
- package/dist/modal/index.d.ts +4 -3
- package/dist/modal/index.d.ts.map +1 -1
- package/dist/modal/index.js +4 -3
- package/dist/modal/index.js.map +1 -1
- package/dist/modal/interactions.d.ts +20 -4
- package/dist/modal/interactions.d.ts.map +1 -1
- package/dist/modal/interactions.js +34 -7
- package/dist/modal/interactions.js.map +1 -1
- package/dist/verify/get-verified-delivery.d.ts +91 -0
- package/dist/verify/get-verified-delivery.d.ts.map +1 -0
- package/dist/verify/get-verified-delivery.js +157 -0
- package/dist/verify/get-verified-delivery.js.map +1 -0
- package/package.json +5 -1
- package/src/builder/cert-chrome-data.ts +27 -0
- package/src/builder/cert-review-card.tsx +143 -3
- package/src/builder/delivery-runtime.ts +54 -0
- package/src/builder/envelope-face.ts +173 -0
- package/src/builder/index.tsx +23 -1
- package/src/builder/issuer-key.ts +13 -0
- package/src/components/memo-toggle.ts +63 -0
- package/src/components/render-cert-block.ts +124 -28
- package/src/index.ts +28 -0
- package/src/modal/certrev-cert-modal.ts +45 -2
- package/src/modal/certrev-cert.entry.ts +2 -4
- package/src/modal/deprecated.ts +25 -0
- package/src/modal/ftc-disclosure.ts +7 -3
- package/src/modal/index.ts +4 -3
- package/src/modal/interactions.ts +37 -7
- package/src/verify/get-verified-delivery.ts +211 -0
- package/dist/modal/ftc-guard.d.ts +0 -85
- package/dist/modal/ftc-guard.d.ts.map +0 -1
- package/dist/modal/ftc-guard.js +0 -150
- package/dist/modal/ftc-guard.js.map +0 -1
- package/src/modal/ftc-guard.ts +0 -174
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,107 @@ change the rendered cert output and never break a compiling integration** (regis
|
|
|
5
5
|
exports, types). Anything that would alter what a visitor sees, or require integration changes,
|
|
6
6
|
is announced loudly here first.
|
|
7
7
|
|
|
8
|
+
## 1.1.1 · 2026-09-26
|
|
9
|
+
|
|
10
|
+
Patch: the browser bundle no longer hides or replaces a face, and each certificate control opens
|
|
11
|
+
its own face's modal. Nothing about the rendered card changes; no integration needs a code change.
|
|
12
|
+
|
|
13
|
+
- **No runtime FTC disclosure guard.** 1.1.0's `dist/modal/certrev-cert.js` checked every memo on
|
|
14
|
+
DOMContentLoaded and on every DOM mutation, and replaced any memo whose disclosure line was
|
|
15
|
+
missing, altered or had a zero-size box with "This CertREV verification cannot be displayed". A
|
|
16
|
+
face that loads inside a closed `<details>`, an inactive tab or a collapsed accordion has a zero
|
|
17
|
+
box, so it was replaced for good and never showed when the visitor opened it. The guard is gone
|
|
18
|
+
(`src/modal/ftc-guard.ts` deleted; the bundle installs no `MutationObserver`, never writes
|
|
19
|
+
`data-certrev-ftc-neutralized` and contains no notice text). Whether a face shows its disclosure
|
|
20
|
+
is settled where the face is configured. The disclosure line itself is unchanged: every face still
|
|
21
|
+
renders it. A WordPress page can drop CSS that hid a card whose memo the guard had neutralized.
|
|
22
|
+
- **`installFtcGuard` stays exported, as a no-op.** It is public on `@certrev/cert-block/modal`,
|
|
23
|
+
and the contract above says a patch never breaks a compiling integration, so the name remains,
|
|
24
|
+
marked `@deprecated`. It installs nothing; its first call per document dispatches a
|
|
25
|
+
`certrev:deprecated-api` event on the document (`detail: { api: 'installFtcGuard',
|
|
26
|
+
removedIn: '1.1.1' }`) so a caller that still counts on it can find out. It goes in 2.0.
|
|
27
|
+
- **Each control opens its own face's modal.** A `[data-certrev-modal-open]` control used to open
|
|
28
|
+
`document.querySelector('certrev-cert-modal')`, so on a page with two faces (a WordPress Query
|
|
29
|
+
Loop, a related-posts block) every control opened the FIRST face's certificate. A control now
|
|
30
|
+
opens the modal in the smallest subtree around it that holds exactly one, and inside a face root
|
|
31
|
+
(`[data-certrev-cert]`, the WordPress plugin's per-face wrapper) only that face's modal counts, so
|
|
32
|
+
the search never reaches a neighbour. A single Shopify embed (card and controls placed apart) and
|
|
33
|
+
a Builder page-level modal resolve exactly as before. A control that cannot tell which modal is
|
|
34
|
+
its own opens nothing and follows its own `href`, and says so: it gets
|
|
35
|
+
`data-certrev-modal-unresolved="ambiguous"` and a bubbling `certrev:modal-unresolved` event
|
|
36
|
+
(`detail: { reason, modals }`). A WordPress page no longer needs to print one modal per page.
|
|
37
|
+
- **Revocation hides only its own face's controls.** When the modal's live Delivery-API fetch
|
|
38
|
+
returns a revocation or expiry, `markSuppressed()` used to hide every
|
|
39
|
+
`[data-certrev-modal-open]` control in the document. It now hides the controls whose own modal is
|
|
40
|
+
that element; another face's certificate links stay.
|
|
41
|
+
- **Unchanged:** the rendered output of every renderer and component, the exports (`openModal` and
|
|
42
|
+
`openCertModal` keep their document-level behaviour; controls no longer go through them),
|
|
43
|
+
placement, interactions other than the modal lookup, badge revalidation, the verify client, and
|
|
44
|
+
`FTC_DISCLOSURE_LINE`.
|
|
45
|
+
- **For this repo's own suite:** `src/modal/ftc-guard.test.ts` goes with the module, and so does
|
|
46
|
+
any assertion that the entry installs the guard. New: `src/modal/closed-container-face.test.ts`
|
|
47
|
+
and `src/modal/own-face-modal.test.ts`.
|
|
48
|
+
|
|
49
|
+
## 1.1.0 · 2026-09-26
|
|
50
|
+
|
|
51
|
+
Minor: the Builder card can paint from the signed envelope and the brand's render def. **Read
|
|
52
|
+
this before upgrading a Builder integration: a block that carries the new `delivery` marker
|
|
53
|
+
renders a different face from the same block's options.** This is the one deliberate exception
|
|
54
|
+
to the contract above, and it is opt-in per block: the marker is written by the CertREV exporter,
|
|
55
|
+
never by the upgrade itself.
|
|
56
|
+
|
|
57
|
+
- **No marker, no change.** A block without `delivery` (every entry exported before 1.1.0, and
|
|
58
|
+
every block an editor built by hand) renders through the options path exactly as 1.0.3 did,
|
|
59
|
+
byte for byte, including the banner bridge for entries with no `mode`. Upgrading changes no
|
|
60
|
+
pixel on an existing page. `delivery-card.test.tsx` pins this against the 1.0.3 mapping.
|
|
61
|
+
- **With the marker, the options are ignored.** `delivery: { v: 1, baseUrl }` makes
|
|
62
|
+
`CertReviewCard` read `GET {baseUrl}/api/cert/v1/delivery/builder/{entry id}`, verify the signed
|
|
63
|
+
artifact against the baked `cert-issuer-1` key (the key the storefront badge ships), and paint
|
|
64
|
+
the verified content with the render def the Delivery API serves beside it (`renderDef`): the
|
|
65
|
+
brand's accent and surface, hidden fields (e.g. no reviewer photo), rung and layout. The entry id
|
|
66
|
+
is `builderContext.content.id`, so the registration now sets
|
|
67
|
+
`shouldReceiveBuilderProps: { builderContext: true }`; a block copied onto another entry asks for
|
|
68
|
+
that entry's cert.
|
|
69
|
+
- **Fail-closed.** A revoked cert (tombstone), an expired one, a signature that does not verify,
|
|
70
|
+
an envelope for another entry, a 404/5xx/timeout, a marker that is not exactly `{ v: 1, baseUrl }`
|
|
71
|
+
with `baseUrl` an `https:` origin on `certrev.com` or a subdomain, or a missing entry id: the card
|
|
72
|
+
renders nothing. Revocation and expiry are re-judged at every render against the cached,
|
|
73
|
+
verified payload, so an expiry lands at `expiresAt`, and a revocation or def change lands within
|
|
74
|
+
the cache TTL (60s positive, 5s negative) with no republish.
|
|
75
|
+
- **Suspense.** The marker path suspends once per placement (`React.use` on React 19; the thrown
|
|
76
|
+
promise on React 18) inside its own `<Suspense fallback={null}>`, so streaming SSR resolves it
|
|
77
|
+
and hydration finds the read cached.
|
|
78
|
+
- **New API, all additive.** Root: `getVerifiedDelivery`, `peekVerifiedDelivery`,
|
|
79
|
+
`settleDelivery`, `invalidateDelivery`, `parseRenderDef`, `deliveryUrl`, `deliveryCacheKey`,
|
|
80
|
+
`sharedDeliveryCache` and their types. `./builder`: `acceptedDeliveryMarker`, the
|
|
81
|
+
`CertDeliveryMarker` type and the envelope-face helpers. New subpath `./builder/face`
|
|
82
|
+
(react-free): `envelopeCardInput`, the one mapping from verified content + def to the
|
|
83
|
+
`renderCertBlock` input, so a server-side preview renders through the same function as the card.
|
|
84
|
+
- **Wire type.** `BuilderCertChromeData` gains `delivery: CertDeliveryMarker | null` (key 20,
|
|
85
|
+
appended to `BUILDER_CERT_CHROME_KEYS`, registered as an `advanced` input with helper text
|
|
86
|
+
telling editors not to edit it). A TypeScript exporter that builds the full wire object must
|
|
87
|
+
now set it (`null` keeps the options face).
|
|
88
|
+
- **Phone face (opt-in, envelope card only).** `renderCertBlock` gains `responsive?: boolean`.
|
|
89
|
+
Only `responsive: true` changes anything; absent or `false`, every face is byte-identical to
|
|
90
|
+
1.0.3 (`render-cert-block-responsive.test.ts` pins 14 shapes against the 1.0.3 tarball's own
|
|
91
|
+
output). The envelope face (`envelopeCardInput`) always sets it, so a marker card on a viewport
|
|
92
|
+
640px wide or narrower stacks the banner header's two columns into one and clamps a long memo
|
|
93
|
+
(over 160 characters, or four or more line breaks) to 4 lines behind a native
|
|
94
|
+
`<button type="button">` ("Read the full memo" / "Show less") that flips `aria-expanded`. The
|
|
95
|
+
full memo stays in the markup, so a screen reader reads all of it in both states. Wider
|
|
96
|
+
viewports see the same card as before and no button. The rules ship as one `<style>` element,
|
|
97
|
+
first inside the card root, every rule inside `@media (max-width: 640px)` and scoped to
|
|
98
|
+
`.certrev-cert[data-certrev-responsive]`; a host that strips `<style>` or blocks it by CSP
|
|
99
|
+
(it needs `style-src 'unsafe-inline'`, as the card's inline styles already do) gets the
|
|
100
|
+
1.0.3 card, memo unclamped and button hidden. The toggle is `toggleMemo` / `memoToggleFor`,
|
|
101
|
+
new root exports with the `MEMO_*` constants, which `CertReviewCard` binds on its wrapper and
|
|
102
|
+
any other host of the phone face can call.
|
|
103
|
+
- **Unchanged:** the registered name `CertREV Cert`, the `@certrev/cert-block/builder` import,
|
|
104
|
+
`certRevCertComponent` / `BUILDER_REGISTRATION`, every existing input, the anchor path, the web
|
|
105
|
+
component and the modal bundle. `renderCertBlock` and `renderPreviewBlock` paint exactly what
|
|
106
|
+
1.0.3 painted for every input without `responsive: true`, which is every caller in the package
|
|
107
|
+
but the envelope face (the options card among them); the floating pill is unchanged in every case.
|
|
108
|
+
|
|
8
109
|
## 1.0.3 · 2026-08-18
|
|
9
110
|
|
|
10
111
|
Patch: restores the placement a pre-existing Builder entry renders. **If you integrated via
|
package/README.md
CHANGED
|
@@ -60,9 +60,14 @@ import { defineCertRevBadge, setCertRevKidResolver } from '@certrev/cert-block/w
|
|
|
60
60
|
// Builder.io registration (separate subpath; no Builder dependency)
|
|
61
61
|
import { certRevCertComponent, BUILDER_REGISTRATION, CERT_COMPONENT_NAME } from '@certrev/cert-block/builder'
|
|
62
62
|
|
|
63
|
+
// The envelope face mapping on its own (separate subpath, react-free): verified envelope content
|
|
64
|
+
// plus the brand's render def, to the renderCertBlock input a `delivery`-marker card paints.
|
|
65
|
+
// A server-side preview renders through the same function as the card.
|
|
66
|
+
import { envelopeCardInput, faceFromDef, themeFromDef, layoutFor, CERT_FACE_FIELDS } from '@certrev/cert-block/builder/face'
|
|
67
|
+
|
|
63
68
|
// Certificate modal: the ONE SIDE-EFFECTING entry in the package. Importing it registers
|
|
64
|
-
// <certrev-cert-modal> and, in a browser, starts
|
|
65
|
-
//
|
|
69
|
+
// <certrev-cert-modal> and, in a browser, starts three DOM passes (placement, interactions,
|
|
70
|
+
// badge revalidation). Browser only. Never import it from server code. Most
|
|
66
71
|
// integrations should load the prebuilt IIFE as an external <script> instead (see below).
|
|
67
72
|
import '@certrev/cert-block/modal'
|
|
68
73
|
import { CERT_ISSUER_KID, CERT_ISSUER_PUBLIC_KEY_PEM, CERT_MODAL_TAG } from '@certrev/cert-block/modal'
|
|
@@ -299,8 +304,9 @@ page that loaded the modal script and carries `data-delivery-api` + `data-platfo
|
|
|
299
304
|
`data-external-id`, the modal fetches the Delivery API live. If that returns a revocation
|
|
300
305
|
tombstone, or an envelope with `revokedAt` set or `expiresAt` passed, the modal refuses to open
|
|
301
306
|
and calls `markSuppressed()`: it stamps `data-certrev-suppressed` on itself and sets `hidden` +
|
|
302
|
-
`aria-hidden` on
|
|
303
|
-
|
|
307
|
+
`aria-hidden` on the `[data-certrev-modal-open]` controls **of its own face** (the controls that
|
|
308
|
+
open that element; see "Several faces on one page" below). So that face's certificate links disappear on that page view, and
|
|
309
|
+
another face on the same page keeps its own. The card body (the reviewer's name, the credential, the memo,
|
|
304
310
|
the "Expert reviewed" chrome) is not touched, and nothing happens at all for a visitor who never
|
|
305
311
|
clicks, for a page without the modal script, or for a crawler. One more way to lose even that: the
|
|
306
312
|
modal prefers a synchronous envelope source, so if the page inlines one (a light-DOM
|
|
@@ -364,6 +370,19 @@ and is fine; it just means the origin has to be in `font-src`.
|
|
|
364
370
|
`data-delivery-api` is the **origin only**: the element appends
|
|
365
371
|
`/api/cert/v1/delivery/{platform}/{externalId}`.
|
|
366
372
|
|
|
373
|
+
**Several faces on one page.** Each `[data-certrev-modal-open]` control opens its **own** face's
|
|
374
|
+
`<certrev-cert-modal>`, never simply the first one in the document (1.1.0 and earlier did that, so
|
|
375
|
+
every control on a two-face page opened the first face's certificate). A control's own modal is the
|
|
376
|
+
one in the smallest subtree around the control that holds exactly one; when the control sits inside
|
|
377
|
+
a face root `[data-certrev-cert]` (the WordPress plugin's per-face wrapper), only modals of that
|
|
378
|
+
same face count and the search never leaves it. So give each face its own modal, and wrap each face
|
|
379
|
+
in `data-certrev-cert` when faces share a container. A single face whose card and controls sit apart
|
|
380
|
+
(the Shopify embed), or one page-level modal (a Builder page), resolves as before. A control that
|
|
381
|
+
cannot tell which modal is its own (its face has none and it sits between two other faces' modals)
|
|
382
|
+
opens nothing: it gets `data-certrev-modal-unresolved="ambiguous"`, a bubbling
|
|
383
|
+
`certrev:modal-unresolved` event (`detail: { reason, modals }`) fires on it, and a link control
|
|
384
|
+
follows its own `href`.
|
|
385
|
+
|
|
367
386
|
### PULL: the editor-placed anchor (alternative)
|
|
368
387
|
|
|
369
388
|
`CertRevProvider` + the zero-input `CertRevAnchor` (`@certrev/cert-block/builder`) let an editor
|
|
@@ -598,7 +617,7 @@ alongside each modal module. The load-bearing ones:
|
|
|
598
617
|
- **`__tests__/escape-family.test.ts`** puts both escape families (`components/` and `modal/`) against wrong-typed input, not just null: a half-filled CMS object must degrade, never throw.
|
|
599
618
|
- **`__tests__/webcomponent.test.tsx`**: the shared `renderBadgeHtml` string renderer (hand-escaping, unsafe-URL/color dropping, compact style) and the `<certrev-badge>` custom element (idempotent registration, SSR light-DOM preservation, client-mode fail-closed without a resolver).
|
|
600
619
|
- **`builder/__tests__/builder.test.tsx`** covers the PUSH card and its registration: the wire-type ⇄ inputs parity lock, the fused-credential gate, and the mistyped-option degradation.
|
|
601
|
-
- **`modal/*.test.ts`**, per module: the modal element (tombstone → `markSuppressed`), the dialog view, interactions, placement, badge revalidation,
|
|
620
|
+
- **`modal/*.test.ts`**, per module: the modal element (tombstone → `markSuppressed`), the dialog view, interactions, placement, badge revalidation, and the Delivery-API verify client. `modal/own-face-modal.test.ts` puts two faces on one page and proves each control opens its own face's modal; `modal/closed-container-face.test.ts` proves a face that loads inside a closed `<details>`, tab or accordion is left alone and renders when opened (there is no runtime disclosure guard).
|
|
602
621
|
- **`__tests__/readme-version.test.ts`** + **`__tests__/readme-contract.test.ts`** pin the claims in this file that rot silently: the version stamp against `package.json`, the key id, the route-example heading, and every `exports` subpath appearing under Public API.
|
|
603
622
|
|
|
604
623
|
Facts are mocked via `makeMockPayload` / `makeSignedEnvelope` (`src/contract/fixtures.ts`, also
|
|
@@ -606,7 +625,7 @@ published at `@certrev/cert-block/fixtures`).
|
|
|
606
625
|
|
|
607
626
|
## Version
|
|
608
627
|
|
|
609
|
-
`1.
|
|
628
|
+
`1.1.1`: see [CHANGELOG.md](./CHANGELOG.md) for the release history and the semver contract
|
|
610
629
|
(patch/minor never change the rendered cert output or break a compiling integration). Publishes
|
|
611
630
|
**publicly** to npm as `@certrev/cert-block` (`publishConfig.access: public`) via GitHub Actions
|
|
612
631
|
trusted publishing (OIDC); the internal `@certrev` GitHub-Packages channel mirrors it.
|
|
@@ -60,6 +60,24 @@ export interface CertChromeRenderDef {
|
|
|
60
60
|
readonly placedFields: readonly string[];
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* The DELIVERY MARKER (1.1.0): the exporter's statement that this block's cert is served,
|
|
65
|
+
* signed, by the CertREV Delivery API at `baseUrl`. When it is present the card no longer
|
|
66
|
+
* paints the other option keys: it takes its `externalId` from its own Builder entry id,
|
|
67
|
+
* fetches `GET {baseUrl}/api/cert/v1/delivery/builder/{externalId}`, verifies the envelope
|
|
68
|
+
* against the baked issuer key, and paints from the verified facts plus the brand's render
|
|
69
|
+
* def served beside them. A revoked, expired or unverifiable cert renders nothing.
|
|
70
|
+
*
|
|
71
|
+
* `baseUrl` is honoured ONLY when it is `https:` on `certrev.com` or a subdomain of it. The
|
|
72
|
+
* marker is an option like any other, so an editor can type into it; a foreign origin would
|
|
73
|
+
* let a page answer its own revocation check, and so renders nothing (never the options).
|
|
74
|
+
*/
|
|
75
|
+
export interface CertDeliveryMarker {
|
|
76
|
+
/** Marker shape version. Only `1` is understood; anything else renders nothing. */
|
|
77
|
+
readonly v: 1;
|
|
78
|
+
/** The CertREV app origin that serves the Delivery API (e.g. `https://portal.certrev.com`). */
|
|
79
|
+
readonly baseUrl: string;
|
|
80
|
+
}
|
|
63
81
|
/**
|
|
64
82
|
* The OPTIONS a brand's native cert component receives. Delivered per certified
|
|
65
83
|
* article; until the brand registers the component the block renders nothing.
|
|
@@ -134,6 +152,13 @@ export interface BuilderCertChromeData {
|
|
|
134
152
|
renderDef: CertChromeRenderDef | null;
|
|
135
153
|
/** Version of the delivered string set (`data-certrev-strings-version` for the crawl monitor). */
|
|
136
154
|
stringsVersion: string;
|
|
155
|
+
/**
|
|
156
|
+
* 1.1.0: where the signed envelope for this block is served, or null for an options-only
|
|
157
|
+
* block. Present ⇒ the card paints from the verified envelope + def and ignores the keys
|
|
158
|
+
* above; they stay on the wire so installs older than 1.1.0 keep painting during the
|
|
159
|
+
* transition. See `CertDeliveryMarker`.
|
|
160
|
+
*/
|
|
161
|
+
delivery: CertDeliveryMarker | null;
|
|
137
162
|
}
|
|
138
163
|
/**
|
|
139
164
|
* The ordered keys of `BuilderCertChromeData` — the SINGLE SOURCE the Builder
|
|
@@ -142,6 +167,6 @@ export interface BuilderCertChromeData {
|
|
|
142
167
|
* interface without adding it here (or vice-versa) fails the `keyof` exhaustiveness
|
|
143
168
|
* check in `assertChromeKeysExhaustive` below.
|
|
144
169
|
*/
|
|
145
|
-
export declare const BUILDER_CERT_CHROME_KEYS: readonly ["bylineCredentialed", "credentialVerification", "bylinePlain", "reviewerName", "bio", "background", "memo", "compensationCue", "scopeLine", "reviewerPhoto", "reviewerProfileUrl", "verifyUrl", "certifiedAt", "contentModifiedAt", "authorName", "authorTitle", "display", "renderDef", "stringsVersion"];
|
|
170
|
+
export declare const BUILDER_CERT_CHROME_KEYS: readonly ["bylineCredentialed", "credentialVerification", "bylinePlain", "reviewerName", "bio", "background", "memo", "compensationCue", "scopeLine", "reviewerPhoto", "reviewerProfileUrl", "verifyUrl", "certifiedAt", "contentModifiedAt", "authorName", "authorTitle", "display", "renderDef", "stringsVersion", "delivery"];
|
|
146
171
|
export type BuilderCertChromeKey = (typeof BUILDER_CERT_CHROME_KEYS)[number];
|
|
147
172
|
//# sourceMappingURL=cert-chrome-data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cert-chrome-data.d.ts","sourceRoot":"","sources":["../../src/builder/cert-chrome-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;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FAA4F;IAC5F,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB;;;;;;;OAOG;IACH,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB,kEAAkE;IAClE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,mFAAmF;IACnF,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAA;IACjB,wFAAwF;IACxF,WAAW,EAAE,MAAM,CAAA;IACnB,4EAA4E;IAC5E,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,kGAAkG;IAClG,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,0DAA0D;IAC1D,OAAO,EAAE;QACR,eAAe,EAAE,OAAO,CAAA;QACxB,kGAAkG;QAClG,eAAe,EAAE,OAAO,CAAA;KACxB,CAAA;IACD,qFAAqF;IACrF,SAAS,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACrC,kGAAkG;IAClG,cAAc,EAAE,MAAM,CAAA;IACtB;;;;;OAKG;IACH,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAA;CACnC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,kUAqB3B,CAAA;AAEV,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cert-chrome-data.js","sourceRoot":"","sources":["../../src/builder/cert-chrome-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;
|
|
1
|
+
{"version":3,"file":"cert-chrome-data.js","sourceRoot":"","sources":["../../src/builder/cert-chrome-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA6IH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACvC,oBAAoB;IACpB,wBAAwB;IACxB,aAAa;IACb,cAAc;IACd,KAAK;IACL,YAAY;IACZ,MAAM;IACN,iBAAiB;IACjB,WAAW;IACX,eAAe;IACf,oBAAoB;IACpB,WAAW;IACX,aAAa;IACb,mBAAmB;IACnB,YAAY;IACZ,aAAa;IACb,SAAS;IACT,WAAW;IACX,gBAAgB;IAChB,UAAU;CACD,CAAA;AAIV;;;;;GAKG;AACH,MAAM,cAAc,GAA8C,MAAM,CAAC,WAAW,CACnF,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CACR,CAAA;AACvC,MAAM,eAAe,GAAuC,cAAc,CAAA;AAC1E,KAAK,eAAe,CAAA"}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* - maps v2 `barInk`/`inkColor` into the theme (the demo predated brand-ink theming);
|
|
18
18
|
* - honors `display.showCredentials`.
|
|
19
19
|
*/
|
|
20
|
+
import * as React from 'react';
|
|
20
21
|
import { type CertBlockMode } from '../components/render-cert-block.js';
|
|
21
22
|
import type { BuilderCertChromeData } from './cert-chrome-data.js';
|
|
22
23
|
/**
|
|
@@ -44,8 +45,28 @@ export interface CertReviewCardProps extends Partial<BuilderCertChromeData> {
|
|
|
44
45
|
* string-splitting shim is gone — `renderCertBlock` composes each part directly.
|
|
45
46
|
*/
|
|
46
47
|
part?: 'full' | 'header' | 'memo' | null;
|
|
48
|
+
/**
|
|
49
|
+
* 1.1.0: what `@builder.io/sdk-react` passes because the registration sets
|
|
50
|
+
* `shouldReceiveBuilderProps: { builderContext: true }`. Only `content.id` is read: it is the
|
|
51
|
+
* Builder entry this block renders inside, which IS the Delivery placement's `externalId`, so a
|
|
52
|
+
* block copied onto another entry asks for that entry's cert and never shows this one's.
|
|
53
|
+
*/
|
|
54
|
+
builderContext?: {
|
|
55
|
+
readonly content?: {
|
|
56
|
+
readonly id?: unknown;
|
|
57
|
+
} | null;
|
|
58
|
+
} | null;
|
|
47
59
|
}
|
|
48
|
-
|
|
60
|
+
/**
|
|
61
|
+
* The delivery marker, accepted only as `{ v: 1, baseUrl }` with `baseUrl` an `https:` ORIGIN on
|
|
62
|
+
* `certrev.com` or one of its subdomains (no path, query, credentials or port). Anything else is
|
|
63
|
+
* null, and a block carrying a marker that is not accepted renders NOTHING: falling back to the
|
|
64
|
+
* options would let an edit to the marker switch revocation off.
|
|
65
|
+
*/
|
|
66
|
+
export declare function acceptedDeliveryMarker(value: unknown): {
|
|
67
|
+
readonly baseUrl: string;
|
|
68
|
+
} | null;
|
|
69
|
+
export declare function CertReviewCard(props: CertReviewCardProps): React.JSX.Element | null;
|
|
49
70
|
/**
|
|
50
71
|
* The subset of the Builder.io input schema this kit emits. Every field below is verified
|
|
51
72
|
* against `@builder.io/sdk-react`'s own `Input` declaration (`types/types/input.d.ts`, 5.2.7) —
|
|
@@ -75,7 +96,7 @@ export interface BuilderInput {
|
|
|
75
96
|
readonly advanced?: boolean;
|
|
76
97
|
}
|
|
77
98
|
/**
|
|
78
|
-
* The wire-type inputs — DERIVED from `BUILDER_CERT_CHROME_KEYS`, so the
|
|
99
|
+
* The wire-type inputs — DERIVED from `BUILDER_CERT_CHROME_KEYS`, so the 20-field
|
|
79
100
|
* option set can never drift from the type (the W3 lock asserts name-parity). This
|
|
80
101
|
* kills the demo's hand-maintained 17-entry array.
|
|
81
102
|
*/
|
|
@@ -94,6 +115,10 @@ export interface CertBlockBuilderRegistration {
|
|
|
94
115
|
readonly name: string;
|
|
95
116
|
readonly component: typeof CertReviewCard;
|
|
96
117
|
readonly inputs: readonly BuilderInput[];
|
|
118
|
+
/** 1.1.0: asks the SDK for `builderContext`, whose `content.id` the delivery path reads. */
|
|
119
|
+
readonly shouldReceiveBuilderProps: {
|
|
120
|
+
readonly builderContext: true;
|
|
121
|
+
};
|
|
97
122
|
}
|
|
98
123
|
/**
|
|
99
124
|
* The canonical registration data (readonly view). Most consumers want
|
|
@@ -115,6 +140,14 @@ export interface CertReviewCardRegisteredComponent {
|
|
|
115
140
|
name: string;
|
|
116
141
|
description?: string;
|
|
117
142
|
inputs: BuilderInput[];
|
|
143
|
+
/**
|
|
144
|
+
* 1.1.0: `@builder.io/sdk-react`'s `RegisteredComponent.shouldReceiveBuilderProps`. The SDK then
|
|
145
|
+
* passes the `builderContext` prop, and the delivery path takes its placement from
|
|
146
|
+
* `builderContext.content.id`.
|
|
147
|
+
*/
|
|
148
|
+
shouldReceiveBuilderProps: {
|
|
149
|
+
builderContext: boolean;
|
|
150
|
+
};
|
|
118
151
|
}
|
|
119
152
|
/**
|
|
120
153
|
* Ready-to-register: `customComponents={[...yourComponents, certRevCertComponent]}` —
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cert-review-card.d.ts","sourceRoot":"","sources":["../../src/builder/cert-review-card.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,oCAAoC,CAAA;
|
|
1
|
+
{"version":3,"file":"cert-review-card.d.ts","sourceRoot":"","sources":["../../src/builder/cert-review-card.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,oCAAoC,CAAA;AAGxF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAKlE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,iBAAiB,CAAA;AAEjD,MAAM,WAAW,mBAAoB,SAAQ,OAAO,CAAC,qBAAqB,CAAC;IAC1E;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IAC3B;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ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CAAC,SAAS,EAAE,OAAO,cAAc,CAAA;IACzC,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;IACxC,4FAA4F;IAC5F,QAAQ,CAAC,yBAAyB,EAAE;QAAE,QAAQ,CAAC,cAAc,EAAE,IAAI,CAAA;KAAE,CAAA;CACrE;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,EAAE,4BAKlC,CAAA;AAED;;;;;GAKG;AACH,MAAM,WAAW,iCAAiC;IACjD,SAAS,EAAE,OAAO,cAAc,CAAA;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,YAAY,EAAE,CAAA;IACtB;;;;OAIG;IACH,yBAAyB,EAAE;QAAE,cAAc,EAAE,OAAO,CAAA;KAAE,CAAA;CACtD;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,iCAOlC,CAAA"}
|
|
@@ -18,8 +18,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
18
18
|
* - maps v2 `barInk`/`inkColor` into the theme (the demo predated brand-ink theming);
|
|
19
19
|
* - honors `display.showCredentials`.
|
|
20
20
|
*/
|
|
21
|
+
import * as React from 'react';
|
|
22
|
+
import { Suspense } from 'react';
|
|
23
|
+
import { memoToggleFor, toggleMemo } from '../components/memo-toggle.js';
|
|
21
24
|
import { renderCertBlock } from '../components/render-cert-block.js';
|
|
25
|
+
import { CERT_STRINGS_VERSION } from '../components/render-def.js';
|
|
26
|
+
import { getVerifiedDelivery, peekVerifiedDelivery } from '../verify/get-verified-delivery.js';
|
|
22
27
|
import { BUILDER_CERT_CHROME_KEYS } from './cert-chrome-data.js';
|
|
28
|
+
import { cardDeliveryRuntime } from './delivery-runtime.js';
|
|
29
|
+
import { envelopeCardInput } from './envelope-face.js';
|
|
23
30
|
/**
|
|
24
31
|
* The canonical Builder block name. A brand's registration + the portal
|
|
25
32
|
* `certComponent` connection field default to THIS; config exists only for
|
|
@@ -60,7 +67,106 @@ function fusedCredential(pair) {
|
|
|
60
67
|
const verifiedAt = text(pair.verifiedAt);
|
|
61
68
|
return credential && verifiedAt ? { credential, verifiedAt } : null;
|
|
62
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* The delivery marker, accepted only as `{ v: 1, baseUrl }` with `baseUrl` an `https:` ORIGIN on
|
|
72
|
+
* `certrev.com` or one of its subdomains (no path, query, credentials or port). Anything else is
|
|
73
|
+
* null, and a block carrying a marker that is not accepted renders NOTHING: falling back to the
|
|
74
|
+
* options would let an edit to the marker switch revocation off.
|
|
75
|
+
*/
|
|
76
|
+
export function acceptedDeliveryMarker(value) {
|
|
77
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
78
|
+
return null;
|
|
79
|
+
const { v, baseUrl } = value;
|
|
80
|
+
if (v !== 1 || typeof baseUrl !== 'string')
|
|
81
|
+
return null;
|
|
82
|
+
let url;
|
|
83
|
+
try {
|
|
84
|
+
url = new URL(baseUrl);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
if (url.protocol !== 'https:' || url.username || url.password || url.port)
|
|
90
|
+
return null;
|
|
91
|
+
if (url.pathname !== '/' || url.search || url.hash)
|
|
92
|
+
return null;
|
|
93
|
+
const host = url.hostname.toLowerCase();
|
|
94
|
+
if (host !== 'certrev.com' && !host.endsWith('.certrev.com'))
|
|
95
|
+
return null;
|
|
96
|
+
return { baseUrl: url.origin };
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Suspend on a Delivery read. React 19 gets `use` with ONE promise per placement while it is in
|
|
100
|
+
* flight; React 18 (no `use`) gets the promise thrown, the Suspense protocol it supports. Either
|
|
101
|
+
* way the retry finds the settled read in the cache through `peekVerifiedDelivery`, so it never
|
|
102
|
+
* suspends on a second promise.
|
|
103
|
+
*/
|
|
104
|
+
const inflightReads = new Map();
|
|
105
|
+
function suspendOn(key, start) {
|
|
106
|
+
let pending = inflightReads.get(key);
|
|
107
|
+
if (!pending) {
|
|
108
|
+
pending = start().finally(() => inflightReads.delete(key));
|
|
109
|
+
inflightReads.set(key, pending);
|
|
110
|
+
}
|
|
111
|
+
const use = React.use;
|
|
112
|
+
if (typeof use === 'function')
|
|
113
|
+
return use(pending);
|
|
114
|
+
throw pending;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The painted envelope face, with the phone memo toggle bound. One native click listener on the
|
|
118
|
+
* wrapper (delegated, so it survives a re-render of the HTML) flips the memo box the button sits
|
|
119
|
+
* in; the button is native, so Enter and Space reach it as clicks. Bound after hydration only: the
|
|
120
|
+
* server HTML is the collapsed face, which is also what a reader without JS keeps (the whole memo
|
|
121
|
+
* is still in the text for a screen reader, and the desktop never clamps it).
|
|
122
|
+
*/
|
|
123
|
+
function EnvelopeFace(props) {
|
|
124
|
+
const ref = React.useRef(null);
|
|
125
|
+
React.useEffect(() => {
|
|
126
|
+
const el = ref.current;
|
|
127
|
+
if (!el)
|
|
128
|
+
return;
|
|
129
|
+
const onClick = (e) => {
|
|
130
|
+
const button = memoToggleFor(e.target);
|
|
131
|
+
if (button && el.contains(button))
|
|
132
|
+
toggleMemo(button);
|
|
133
|
+
};
|
|
134
|
+
el.addEventListener('click', onClick);
|
|
135
|
+
return () => el.removeEventListener('click', onClick);
|
|
136
|
+
}, []);
|
|
137
|
+
return (_jsx("div", { ref: ref, "data-certrev-cert-chrome": "", "data-certrev-delivery": "", "data-certrev-strings-version": CERT_STRINGS_VERSION, "data-certrev-def-version": props.defVersion,
|
|
138
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: renderCertBlock is the escaping-safe SSR string renderer
|
|
139
|
+
dangerouslySetInnerHTML: { __html: props.html } }));
|
|
140
|
+
}
|
|
141
|
+
function EnvelopeCertReviewCard(props) {
|
|
142
|
+
const rt = cardDeliveryRuntime();
|
|
143
|
+
// The clock is read per render, so the lifecycle is judged NOW, not when the envelope was fetched.
|
|
144
|
+
const context = { platform: 'builder', externalId: props.externalId, now: new Date(rt.now()) };
|
|
145
|
+
const read = { baseUrl: props.baseUrl, platform: 'builder', externalId: props.externalId, context, cache: rt.cache };
|
|
146
|
+
const settled = peekVerifiedDelivery(read) ??
|
|
147
|
+
suspendOn(`${props.baseUrl}|${props.externalId}`, () => getVerifiedDelivery({ ...read, resolveKid: rt.resolveKid, fetchImpl: rt.fetchImpl(), timeoutMs: rt.timeoutMs }));
|
|
148
|
+
// Revoked, expired, unverifiable, for another entry, or unreachable: nothing at all.
|
|
149
|
+
if (settled.verdict.decision !== 'render')
|
|
150
|
+
return null;
|
|
151
|
+
const input = envelopeCardInput(settled.verdict.payload.content, settled.renderDef, {
|
|
152
|
+
mode: props.mode,
|
|
153
|
+
part: props.part,
|
|
154
|
+
});
|
|
155
|
+
if (!input)
|
|
156
|
+
return null;
|
|
157
|
+
return _jsx(EnvelopeFace, { html: renderCertBlock(input), defVersion: settled.renderDef ? settled.renderDef.v : undefined });
|
|
158
|
+
}
|
|
63
159
|
export function CertReviewCard(props) {
|
|
160
|
+
// 1.1.0: a block that carries the delivery marker paints from the signed envelope and the
|
|
161
|
+
// brand's def, never from the options beside it. No marker (every entry exported before 1.1.0)
|
|
162
|
+
// takes the options path below, unchanged from 1.0.3.
|
|
163
|
+
if (props.delivery != null) {
|
|
164
|
+
const marker = acceptedDeliveryMarker(props.delivery);
|
|
165
|
+
const entryId = text(props.builderContext?.content?.id);
|
|
166
|
+
if (!marker || !entryId)
|
|
167
|
+
return null;
|
|
168
|
+
return (_jsx(Suspense, { fallback: null, children: _jsx(EnvelopeCertReviewCard, { baseUrl: marker.baseUrl, externalId: entryId, mode: props.mode, part: props.part }) }));
|
|
169
|
+
}
|
|
64
170
|
const reviewerName = text(props.reviewerName);
|
|
65
171
|
const verifyUrl = text(props.verifyUrl);
|
|
66
172
|
if (!reviewerName || !verifyUrl)
|
|
@@ -90,7 +196,7 @@ export function CertReviewCard(props) {
|
|
|
90
196
|
// explicit `mode` and never reaches this line.
|
|
91
197
|
//
|
|
92
198
|
// The problem is the entries that already exist. `mode` is a PLACEMENT input, not one of
|
|
93
|
-
// the
|
|
199
|
+
// the 20 wire keys (`BUILDER_CERT_CHROME_KEYS`), and the exporter emits only the wire
|
|
94
200
|
// projection (`options: { ...certData }`), so every entry exported to date has NO `mode`
|
|
95
201
|
// key at all. Through 0.5.5 this line read `?? 'banner'` and those entries rendered the
|
|
96
202
|
// banner face. Removing it in 1.0.0 did not give them the renderer's default in the
|
|
@@ -154,6 +260,7 @@ const WIRE_INPUT_TYPE = {
|
|
|
154
260
|
display: 'object',
|
|
155
261
|
renderDef: 'object',
|
|
156
262
|
stringsVersion: 'string',
|
|
263
|
+
delivery: 'object',
|
|
157
264
|
};
|
|
158
265
|
/**
|
|
159
266
|
* The COMPLIANCE-COPY inputs, called what they are.
|
|
@@ -168,9 +275,10 @@ const WIRE_INPUT_TYPE = {
|
|
|
168
275
|
const WIRE_INPUT_HELPER_TEXT = {
|
|
169
276
|
compensationCue: 'System-populated by CertREV. Only its PRESENCE is read (absent = a pro-bono reviewer, so no cue renders); the cue itself is a locked constant, so editing this text changes nothing on the page, and clearing it does not remove the disclosure.',
|
|
170
277
|
scopeLine: 'System-populated by CertREV. The FTC scope line renders byte-verbatim from a locked constant: editing this text changes nothing on the page.',
|
|
278
|
+
delivery: 'System-populated by CertREV. When set, the card shows the certificate CertREV serves for this entry, verified, and ignores the other fields; if CertREV revokes it or it expires, the card shows nothing. Do not edit.',
|
|
171
279
|
};
|
|
172
280
|
/**
|
|
173
|
-
* The wire-type inputs — DERIVED from `BUILDER_CERT_CHROME_KEYS`, so the
|
|
281
|
+
* The wire-type inputs — DERIVED from `BUILDER_CERT_CHROME_KEYS`, so the 20-field
|
|
174
282
|
* option set can never drift from the type (the W3 lock asserts name-parity). This
|
|
175
283
|
* kills the demo's hand-maintained 17-entry array.
|
|
176
284
|
*/
|
|
@@ -230,6 +338,7 @@ export const BUILDER_REGISTRATION = {
|
|
|
230
338
|
name: CERT_COMPONENT_NAME,
|
|
231
339
|
component: CertReviewCard,
|
|
232
340
|
inputs: [...PLACEMENT_INPUTS, ...WIRE_INPUTS],
|
|
341
|
+
shouldReceiveBuilderProps: { builderContext: true },
|
|
233
342
|
};
|
|
234
343
|
/**
|
|
235
344
|
* Ready-to-register: `customComponents={[...yourComponents, certRevCertComponent]}` —
|
|
@@ -242,5 +351,6 @@ export const certRevCertComponent = {
|
|
|
242
351
|
component: CertReviewCard,
|
|
243
352
|
description: 'CertREV expert-review cert card. Options are populated by the CertREV exporter; editors choose placement (mode/part) only.',
|
|
244
353
|
inputs: [...PLACEMENT_INPUTS, ...WIRE_INPUTS],
|
|
354
|
+
shouldReceiveBuilderProps: { builderContext: true },
|
|
245
355
|
};
|
|
246
356
|
//# sourceMappingURL=cert-review-card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cert-review-card.js","sourceRoot":"","sources":["../../src/builder/cert-review-card.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAsB,eAAe,EAAE,MAAM,oCAAoC,CAAA;
|
|
1
|
+
{"version":3,"file":"cert-review-card.js","sourceRoot":"","sources":["../../src/builder/cert-review-card.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACxE,OAAO,EAAsB,eAAe,EAAE,MAAM,oCAAoC,CAAA;AACxF,OAAO,EAAE,oBAAoB,EAA2B,MAAM,6BAA6B,CAAA;AAC3F,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAyB,MAAM,oCAAoC,CAAA;AAErH,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,EAAE,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H;IAC7H,MAAM,EAAE,CAAC,GAAG,gBAAgB,EAAE,GAAG,WAAW,CAAC;IAC7C,yBAAyB,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;CACnD,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Builder card's Delivery runtime (1.1.0): the trust root, fetch, cache and clock the
|
|
3
|
+
* envelope-backed `CertReviewCard` reads with.
|
|
4
|
+
*
|
|
5
|
+
* INTERNAL. This module is deliberately NOT on the package `exports` map, so a consumer cannot
|
|
6
|
+
* swap the trust root through the published API: the card verifies against the baked
|
|
7
|
+
* `cert-issuer-1` key, the same key the storefront badge bundle ships. The package's own tests
|
|
8
|
+
* reach the setter by relative import to run the real kernel against fixture-signed envelopes.
|
|
9
|
+
*/
|
|
10
|
+
import type { ResolvePublicKeyByKid } from '../contract/kernel.js';
|
|
11
|
+
import { TtlCache } from '../verify/cache.js';
|
|
12
|
+
import type { CachedDelivery } from '../verify/get-verified-delivery.js';
|
|
13
|
+
export interface CardDeliveryRuntime {
|
|
14
|
+
readonly resolveKid: ResolvePublicKeyByKid;
|
|
15
|
+
readonly fetchImpl: () => typeof fetch;
|
|
16
|
+
readonly cache: TtlCache<CachedDelivery>;
|
|
17
|
+
readonly now: () => number;
|
|
18
|
+
readonly timeoutMs?: number;
|
|
19
|
+
}
|
|
20
|
+
export declare function cardDeliveryRuntime(): CardDeliveryRuntime;
|
|
21
|
+
/** Test seam: replace parts of the runtime (a fresh cache unless one is given). Returns a restore. */
|
|
22
|
+
export declare function setCardDeliveryRuntimeForTests(overrides: Partial<CardDeliveryRuntime>): () => void;
|
|
23
|
+
//# sourceMappingURL=delivery-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery-runtime.d.ts","sourceRoot":"","sources":["../../src/builder/delivery-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAGxE,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAA;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM,OAAO,KAAK,CAAA;IACtC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAA;IACxC,QAAQ,CAAC,GAAG,EAAE,MAAM,MAAM,CAAA;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC3B;AAgBD,wBAAgB,mBAAmB,IAAI,mBAAmB,CAEzD;AAED,sGAAsG;AACtG,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,MAAM,IAAI,CAWlG"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Builder card's Delivery runtime (1.1.0): the trust root, fetch, cache and clock the
|
|
3
|
+
* envelope-backed `CertReviewCard` reads with.
|
|
4
|
+
*
|
|
5
|
+
* INTERNAL. This module is deliberately NOT on the package `exports` map, so a consumer cannot
|
|
6
|
+
* swap the trust root through the published API: the card verifies against the baked
|
|
7
|
+
* `cert-issuer-1` key, the same key the storefront badge bundle ships. The package's own tests
|
|
8
|
+
* reach the setter by relative import to run the real kernel against fixture-signed envelopes.
|
|
9
|
+
*/
|
|
10
|
+
import { TtlCache } from '../verify/cache.js';
|
|
11
|
+
import { CERT_ISSUER_KID, CERT_ISSUER_PUBLIC_KEY_PEM } from './issuer-key.js';
|
|
12
|
+
const bakedResolveKid = (kid) => kid === CERT_ISSUER_KID ? { format: 'pem', pem: CERT_ISSUER_PUBLIC_KEY_PEM } : null;
|
|
13
|
+
function defaultRuntime() {
|
|
14
|
+
return {
|
|
15
|
+
resolveKid: bakedResolveKid,
|
|
16
|
+
fetchImpl: () => globalThis.fetch,
|
|
17
|
+
cache: new TtlCache({ ttlMs: 60_000, negativeTtlMs: 5_000 }),
|
|
18
|
+
now: Date.now,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
let runtime = defaultRuntime();
|
|
22
|
+
export function cardDeliveryRuntime() {
|
|
23
|
+
return runtime;
|
|
24
|
+
}
|
|
25
|
+
/** Test seam: replace parts of the runtime (a fresh cache unless one is given). Returns a restore. */
|
|
26
|
+
export function setCardDeliveryRuntimeForTests(overrides) {
|
|
27
|
+
const previous = runtime;
|
|
28
|
+
const now = overrides.now ?? previous.now;
|
|
29
|
+
runtime = {
|
|
30
|
+
...previous,
|
|
31
|
+
cache: new TtlCache({ ttlMs: 60_000, negativeTtlMs: 5_000, now }),
|
|
32
|
+
...overrides,
|
|
33
|
+
};
|
|
34
|
+
return () => {
|
|
35
|
+
runtime = previous;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=delivery-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery-runtime.js","sourceRoot":"","sources":["../../src/builder/delivery-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAA;AAU7E,MAAM,eAAe,GAA0B,CAAC,GAAG,EAAE,EAAE,CACtD,GAAG,KAAK,eAAe,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,0BAA0B,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AAEpF,SAAS,cAAc;IACtB,OAAO;QACN,UAAU,EAAE,eAAe;QAC3B,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK;QACjC,KAAK,EAAE,IAAI,QAAQ,CAAiB,EAAE,KAAK,EAAE,MAAM,EAA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