@certrev/cert-block 1.0.3 → 1.1.0
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 +60 -0
- package/README.md +6 -1
- 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 +80 -19
- 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/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 +121 -22
- package/src/index.ts +28 -0
- package/src/verify/get-verified-delivery.ts +211 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,66 @@ 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.0 · 2026-09-26
|
|
9
|
+
|
|
10
|
+
Minor: the Builder card can paint from the signed envelope and the brand's render def. **Read
|
|
11
|
+
this before upgrading a Builder integration: a block that carries the new `delivery` marker
|
|
12
|
+
renders a different face from the same block's options.** This is the one deliberate exception
|
|
13
|
+
to the contract above, and it is opt-in per block: the marker is written by the CertREV exporter,
|
|
14
|
+
never by the upgrade itself.
|
|
15
|
+
|
|
16
|
+
- **No marker, no change.** A block without `delivery` (every entry exported before 1.1.0, and
|
|
17
|
+
every block an editor built by hand) renders through the options path exactly as 1.0.3 did,
|
|
18
|
+
byte for byte, including the banner bridge for entries with no `mode`. Upgrading changes no
|
|
19
|
+
pixel on an existing page. `delivery-card.test.tsx` pins this against the 1.0.3 mapping.
|
|
20
|
+
- **With the marker, the options are ignored.** `delivery: { v: 1, baseUrl }` makes
|
|
21
|
+
`CertReviewCard` read `GET {baseUrl}/api/cert/v1/delivery/builder/{entry id}`, verify the signed
|
|
22
|
+
artifact against the baked `cert-issuer-1` key (the key the storefront badge ships), and paint
|
|
23
|
+
the verified content with the render def the Delivery API serves beside it (`renderDef`): the
|
|
24
|
+
brand's accent and surface, hidden fields (e.g. no reviewer photo), rung and layout. The entry id
|
|
25
|
+
is `builderContext.content.id`, so the registration now sets
|
|
26
|
+
`shouldReceiveBuilderProps: { builderContext: true }`; a block copied onto another entry asks for
|
|
27
|
+
that entry's cert.
|
|
28
|
+
- **Fail-closed.** A revoked cert (tombstone), an expired one, a signature that does not verify,
|
|
29
|
+
an envelope for another entry, a 404/5xx/timeout, a marker that is not exactly `{ v: 1, baseUrl }`
|
|
30
|
+
with `baseUrl` an `https:` origin on `certrev.com` or a subdomain, or a missing entry id: the card
|
|
31
|
+
renders nothing. Revocation and expiry are re-judged at every render against the cached,
|
|
32
|
+
verified payload, so an expiry lands at `expiresAt`, and a revocation or def change lands within
|
|
33
|
+
the cache TTL (60s positive, 5s negative) with no republish.
|
|
34
|
+
- **Suspense.** The marker path suspends once per placement (`React.use` on React 19; the thrown
|
|
35
|
+
promise on React 18) inside its own `<Suspense fallback={null}>`, so streaming SSR resolves it
|
|
36
|
+
and hydration finds the read cached.
|
|
37
|
+
- **New API, all additive.** Root: `getVerifiedDelivery`, `peekVerifiedDelivery`,
|
|
38
|
+
`settleDelivery`, `invalidateDelivery`, `parseRenderDef`, `deliveryUrl`, `deliveryCacheKey`,
|
|
39
|
+
`sharedDeliveryCache` and their types. `./builder`: `acceptedDeliveryMarker`, the
|
|
40
|
+
`CertDeliveryMarker` type and the envelope-face helpers. New subpath `./builder/face`
|
|
41
|
+
(react-free): `envelopeCardInput`, the one mapping from verified content + def to the
|
|
42
|
+
`renderCertBlock` input, so a server-side preview renders through the same function as the card.
|
|
43
|
+
- **Wire type.** `BuilderCertChromeData` gains `delivery: CertDeliveryMarker | null` (key 20,
|
|
44
|
+
appended to `BUILDER_CERT_CHROME_KEYS`, registered as an `advanced` input with helper text
|
|
45
|
+
telling editors not to edit it). A TypeScript exporter that builds the full wire object must
|
|
46
|
+
now set it (`null` keeps the options face).
|
|
47
|
+
- **Phone face (opt-in, envelope card only).** `renderCertBlock` gains `responsive?: boolean`.
|
|
48
|
+
Only `responsive: true` changes anything; absent or `false`, every face is byte-identical to
|
|
49
|
+
1.0.3 (`render-cert-block-responsive.test.ts` pins 14 shapes against the 1.0.3 tarball's own
|
|
50
|
+
output). The envelope face (`envelopeCardInput`) always sets it, so a marker card on a viewport
|
|
51
|
+
640px wide or narrower stacks the banner header's two columns into one and clamps a long memo
|
|
52
|
+
(over 160 characters, or four or more line breaks) to 4 lines behind a native
|
|
53
|
+
`<button type="button">` ("Read the full memo" / "Show less") that flips `aria-expanded`. The
|
|
54
|
+
full memo stays in the markup, so a screen reader reads all of it in both states. Wider
|
|
55
|
+
viewports see the same card as before and no button. The rules ship as one `<style>` element,
|
|
56
|
+
first inside the card root, every rule inside `@media (max-width: 640px)` and scoped to
|
|
57
|
+
`.certrev-cert[data-certrev-responsive]`; a host that strips `<style>` or blocks it by CSP
|
|
58
|
+
(it needs `style-src 'unsafe-inline'`, as the card's inline styles already do) gets the
|
|
59
|
+
1.0.3 card, memo unclamped and button hidden. The toggle is `toggleMemo` / `memoToggleFor`,
|
|
60
|
+
new root exports with the `MEMO_*` constants, which `CertReviewCard` binds on its wrapper and
|
|
61
|
+
any other host of the phone face can call.
|
|
62
|
+
- **Unchanged:** the registered name `CertREV Cert`, the `@certrev/cert-block/builder` import,
|
|
63
|
+
`certRevCertComponent` / `BUILDER_REGISTRATION`, every existing input, the anchor path, the web
|
|
64
|
+
component and the modal bundle. `renderCertBlock` and `renderPreviewBlock` paint exactly what
|
|
65
|
+
1.0.3 painted for every input without `responsive: true`, which is every caller in the package
|
|
66
|
+
but the envelope face (the options card among them); the floating pill is unchanged in every case.
|
|
67
|
+
|
|
8
68
|
## 1.0.3 · 2026-08-18
|
|
9
69
|
|
|
10
70
|
Patch: restores the placement a pre-existing Builder entry renders. **If you integrated via
|
package/README.md
CHANGED
|
@@ -60,6 +60,11 @@ 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
69
|
// <certrev-cert-modal> and, in a browser, starts four DOM passes (placement, interactions,
|
|
65
70
|
// FTC guard, badge revalidation). Browser only. Never import it from server code. Most
|
|
@@ -606,7 +611,7 @@ published at `@certrev/cert-block/fixtures`).
|
|
|
606
611
|
|
|
607
612
|
## Version
|
|
608
613
|
|
|
609
|
-
`1.0
|
|
614
|
+
`1.1.0`: see [CHANGELOG.md](./CHANGELOG.md) for the release history and the semver contract
|
|
610
615
|
(patch/minor never change the rendered cert output or break a compiling integration). Publishes
|
|
611
616
|
**publicly** to npm as `@certrev/cert-block` (`publishConfig.access: public`) via GitHub Actions
|
|
612
617
|
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;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IACnC,8EAA8E;IAC9E,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE;QAChB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;QAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;QACzB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;QAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;QACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAC1B,CAAA;IACD,oFAAoF;IACpF,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IACzC,i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ACD,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;AAE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|
|
|
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;;;;;;;;;;;;;;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QACpB,IAAI,EAAE;YACL,EAAE,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM,EAAE;YAChD,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE;YACzC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE;SACrC;KACD;CACD,CAAA;AAWD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAiC;IACjE,IAAI,EAAE,mBAAmB;IACzB,SAAS,EAAE,cAAc;IACzB,MAAM,EAAE,CAAC,GAAG,gBAAgB,EAAE,GAAG,WAAW,CAAC;IAC7C,yBAAyB,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;CACnD,CAAA;AAqBD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAsC;IACtE,IAAI,EAAE,mBAAmB;IACzB,SAAS,EAAE,cAAc;IACzB,WAAW,EACV,4HAA4H;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 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
|
|
1
|
+
/**
|
|
2
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
3
|
+
* `envelopeCardInput` — the Builder card's face, from VERIFIED facts + the brand's def (1.1.0)
|
|
4
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* The one mapping from a verified payload's `content` and the Delivery API's `renderDef` sibling
|
|
7
|
+
* to the `renderCertBlock` input the registered `CertReviewCard` paints. It is its own module,
|
|
8
|
+
* react-free, and exported on the `./builder/face` subpath so the portal's server bundle (which
|
|
9
|
+
* cannot load `./builder`: that entry creates a React context at import) renders its preview
|
|
10
|
+
* through THIS function instead of a copy of it. A preview and the live card that share the
|
|
11
|
+
* mapping cannot disagree about it.
|
|
12
|
+
*
|
|
13
|
+
* The facts are read exactly as the Shopify app embed reads the same envelope:
|
|
14
|
+
* - the credential is each verified credential's `cardLabel` (else `abbreviation`), joined, and
|
|
15
|
+
* only with the dated verification beside it; no date, no credential (the name-only face);
|
|
16
|
+
* - the compensation cue's PRESENCE is the only thing read; the words are the locked constant,
|
|
17
|
+
* and an absent or null cue is the pro-bono face with no cue;
|
|
18
|
+
* - the def's `hidden` set removes only what is hideable (`HIDEABLE_FIELDS`); a def cannot hide
|
|
19
|
+
* the scope line, the credential verification or the certificate link.
|
|
20
|
+
*
|
|
21
|
+
* The face is the PHONE-aware one (`responsive`): on a narrow viewport the banner header stacks and
|
|
22
|
+
* a long memo collapses behind a toggle the card binds (`memo-toggle.ts`); a wider viewport paints
|
|
23
|
+
* exactly what it would without it.
|
|
24
|
+
*
|
|
25
|
+
* The caller has already run the kernel. This function never decides WHETHER to render a cert;
|
|
26
|
+
* it only returns null when the verified content cannot make a face (no reviewer, no verify URL).
|
|
27
|
+
*/
|
|
28
|
+
import type { CertBlockFace, CertBlockLayout, RenderCertBlockInput } from '../components/render-cert-block.js';
|
|
29
|
+
import { type ResolvedBlockTheme } from '../components/render-def.js';
|
|
30
|
+
import type { CertContent } from '../contract/kernel.js';
|
|
31
|
+
import type { CertChromeRenderDef } from './cert-chrome-data.js';
|
|
32
|
+
/**
|
|
33
|
+
* Every field id `renderCertBlock` places, in its canonical order. A def-driven face places all of
|
|
34
|
+
* them except what the def hides; `renderCertBlock` still gates each on its fact being present.
|
|
35
|
+
*/
|
|
36
|
+
export declare const CERT_FACE_FIELDS: readonly ["label", "authorName", "authorTitle", "reviewerPhoto", "bylineCredentialed", "bylinePlain", "bio", "memo", "profileLink", "certificateLink", "scopeLine", "compensationCue"];
|
|
37
|
+
export interface EnvelopeCardOptions {
|
|
38
|
+
/** The placement the entry/editor chose. A recognised mode wins over the def's layout. */
|
|
39
|
+
readonly mode?: unknown;
|
|
40
|
+
/** Banner memo placement, passed through as on the options path. */
|
|
41
|
+
readonly part?: unknown;
|
|
42
|
+
}
|
|
43
|
+
/** The def's theme tokens as `renderCertBlock` theme input, with the accent ink derived. */
|
|
44
|
+
export declare function themeFromDef(def: CertChromeRenderDef | null): Partial<ResolvedBlockTheme> | undefined;
|
|
45
|
+
/** The face a def asks for: its custom composition, or every field minus the hideable ones it hides. */
|
|
46
|
+
export declare function faceFromDef(def: CertChromeRenderDef | null, layout: CertBlockLayout): CertBlockFace | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* The layout: an editor-chosen mode, else the def's own layout (a custom face only when the def
|
|
49
|
+
* carries one), else banner, which is what the Shopify embed paints for a def with no layout and
|
|
50
|
+
* what every exported Builder entry has painted since 0.5.
|
|
51
|
+
*/
|
|
52
|
+
export declare function layoutFor(def: CertChromeRenderDef | null, mode: unknown): CertBlockLayout;
|
|
53
|
+
/** The fused credential label the envelope's verified credentials stand for, or '' (name-only). */
|
|
54
|
+
export declare function credentialLabel(expert: Record<string, unknown>): {
|
|
55
|
+
credential: string;
|
|
56
|
+
verifiedAt: string;
|
|
57
|
+
} | null;
|
|
58
|
+
/**
|
|
59
|
+
* The exact `renderCertBlock` input for a verified envelope's content and the brand's def, or
|
|
60
|
+
* null when the content cannot make a face.
|
|
61
|
+
*/
|
|
62
|
+
export declare function envelopeCardInput(content: CertContent, renderDef: CertChromeRenderDef | null, options?: EnvelopeCardOptions): RenderCertBlockInput | null;
|
|
63
|
+
//# sourceMappingURL=envelope-face.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envelope-face.d.ts","sourceRoot":"","sources":["../../src/builder/envelope-face.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EACX,aAAa,EACb,eAAe,EAEf,oBAAoB,EACpB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAA+C,KAAK,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAClH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAEhE;;;GAGG;AACH,eAAO,MAAM,gBAAgB,wLAanB,CAAA;AAgBV,MAAM,WAAW,mBAAmB;IACnC,0FAA0F;IAC1F,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IACvB,oEAAoE;IACpE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,4FAA4F;AAC5F,wBAAgB,YAAY,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,GAAG,OAAO,CAAC,kBAAkB,CAAC,GAAG,SAAS,CAerG;AAED,wGAAwG;AACxG,wBAAgB,WAAW,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,EAAE,MAAM,EAAE,eAAe,GAAG,aAAa,GAAG,SAAS,CAK/G;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,EAAE,IAAI,EAAE,OAAO,GAAG,eAAe,CAKzF;AAED,mGAAmG;AACnG,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,UA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