@certrev/cert-block 2.0.0 → 2.0.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +45 -8
  3. package/dist/builder/card-beacon.d.ts +73 -0
  4. package/dist/builder/card-beacon.d.ts.map +1 -0
  5. package/dist/builder/card-beacon.js +178 -0
  6. package/dist/builder/card-beacon.js.map +1 -0
  7. package/dist/builder/card-contract.d.ts +10 -2
  8. package/dist/builder/card-contract.d.ts.map +1 -1
  9. package/dist/builder/card-contract.js +27 -3
  10. package/dist/builder/card-contract.js.map +1 -1
  11. package/dist/builder/card-placement.d.ts +45 -0
  12. package/dist/builder/card-placement.d.ts.map +1 -0
  13. package/dist/builder/card-placement.js +193 -0
  14. package/dist/builder/card-placement.js.map +1 -0
  15. package/dist/builder/card-report.d.ts +26 -14
  16. package/dist/builder/card-report.d.ts.map +1 -1
  17. package/dist/builder/card-report.js +68 -14
  18. package/dist/builder/card-report.js.map +1 -1
  19. package/dist/builder/cert-review-card.d.ts +4 -4
  20. package/dist/builder/cert-review-card.d.ts.map +1 -1
  21. package/dist/builder/cert-review-card.js +77 -189
  22. package/dist/builder/cert-review-card.js.map +1 -1
  23. package/dist/builder/contract-card.d.ts +18 -1
  24. package/dist/builder/contract-card.d.ts.map +1 -1
  25. package/dist/builder/contract-card.js +60 -10
  26. package/dist/builder/contract-card.js.map +1 -1
  27. package/dist/builder/delivery-runtime.d.ts +13 -3
  28. package/dist/builder/delivery-runtime.d.ts.map +1 -1
  29. package/dist/builder/delivery-runtime.js +17 -4
  30. package/dist/builder/delivery-runtime.js.map +1 -1
  31. package/dist/builder/index.d.ts +4 -4
  32. package/dist/builder/index.js +4 -4
  33. package/dist/builder/ssr-seed.d.ts +5 -4
  34. package/dist/builder/ssr-seed.d.ts.map +1 -1
  35. package/dist/builder/ssr-seed.js +4 -3
  36. package/dist/builder/ssr-seed.js.map +1 -1
  37. package/dist/builder/version.d.ts +3 -0
  38. package/dist/builder/version.d.ts.map +1 -0
  39. package/dist/builder/version.js +3 -0
  40. package/dist/builder/version.js.map +1 -0
  41. package/dist/verify/get-verified-delivery.d.ts +4 -0
  42. package/dist/verify/get-verified-delivery.d.ts.map +1 -1
  43. package/dist/verify/get-verified-delivery.js +9 -3
  44. package/dist/verify/get-verified-delivery.js.map +1 -1
  45. package/package.json +1 -1
  46. package/src/builder/card-beacon.ts +201 -0
  47. package/src/builder/card-contract.ts +25 -3
  48. package/src/builder/card-placement.ts +208 -0
  49. package/src/builder/card-report.ts +79 -14
  50. package/src/builder/cert-review-card.tsx +100 -230
  51. package/src/builder/contract-card.tsx +65 -8
  52. package/src/builder/delivery-runtime.ts +17 -4
  53. package/src/builder/index.tsx +4 -4
  54. package/src/builder/ssr-seed.ts +5 -4
  55. package/src/builder/version.ts +2 -0
  56. package/src/verify/get-verified-delivery.ts +13 -3
package/CHANGELOG.md CHANGED
@@ -5,6 +5,74 @@ 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
+ ## 2.0.1 · 2026-10-25
9
+
10
+ **e.l.f.'s one install.** A drop-in on 2.0.0: same package, same `certRevCertComponent` and registration (`CertREV
11
+ Cert`, the same 22 inputs), no new prop, no new peer dependency, and the same four Content-Security-Policy sources (the
12
+ beacon below goes to the delivery origin `connect-src` already allows). Everything that can change later comes from
13
+ CertREV's server.
14
+
15
+ - **Nothing, never unsigned facts.** Every path that painted the block's export-time options (a reviewer name, a
16
+ credential, a memo, a verify link nobody signed) now prints **nothing** and reports why: a block with no delivery
17
+ marker (`no_marker`), a marker this client does not accept or a block with no Builder entry (`marker_invalid`),
18
+ CertREV not reached with no verified answer inside the stale window (`delivery_unreachable`, also for a page whose
19
+ 2.0.0 server wrote an `'options'` record), and a client mount with `clientRead={false}` and no server answer
20
+ (`client_read_off`). The signed paths are unchanged: a contract-1 card prints CertREV's document; an envelope with
21
+ no `contract` key paints the 1.3.x face from its SIGNED facts, as 2.0.0 did. The options-face renderer is gone; the
22
+ inputs stay registered (an entry that carries them still loads) and are not read.
23
+ - **A stale window inside the revocation SLA.** A verified answer is fresh for 30 s and may still paint for 30 s more
24
+ while it is refreshed or CertREV is down (2.0.0: 60 s and 300 s), so the card adds at most a minute to the Delivery
25
+ API's own cache and a revoked card is gone within ADR 0001 §7's five to six minutes (2.0.0 stacked to about twelve).
26
+ Past the window a read that cannot reach CertREV prints nothing; stale is never served indefinitely.
27
+ - **A beacon to CertREV** (`card-beacon.ts`). Each fallback, and one health event on one page view in a hundred, is a
28
+ `POST <delivery origin>/api/cert/v1/beacon` with a `text/plain` JSON body: `{v:1, client:'cert-block',
29
+ clientVersion, contract, platform:'builder', externalId, family, events:[{kind, reason, outcome}]}`. No cookies
30
+ (`credentials: 'omit'`), no page address or text, no user agent beyond a family (chromium, webkit, gecko, other,
31
+ server). At most three per page in the browser (`fetch`, `no-cors`, `keepalive`); on a server, each placement and
32
+ reason at most once an hour per process, with a 1.5 s deadline, never awaited. A beacon that fails is dropped; it
33
+ never changes what prints. The same shape serves the WordPress plugin 2.0.1 and the hosted runtime.
34
+ - **Forward compatible.** Unknown parts, unknown fields and new keys in known objects (how CertREV ships a minor change
35
+ under contract 1) are ignored and the card prints as before; a newer major (`contract` 2 or later in the signed
36
+ binding) prints nothing and reports `card_unsupported_contract` (beacon outcome `unsupported`); the page around it
37
+ always renders.
38
+ - **Placement hints** (`card-placement.ts`). After the page has loaded, the block moves each banner part to the place
39
+ `card.placement` names among the Builder entry's top-level blocks: `content-start` (after a leading image when
40
+ `after: 'leading-media'`), `after-byline` (an element marked `data-certrev-anchor="byline"`, else the first
41
+ `[rel~="author"]`, `[itemprop="author"]`, `.byline`, `[class*="byline"]` or `address`), `before-references` (else
42
+ `content-end`), `content-end`. An unknown anchor, `pinned`, or an anchor the page does not have leaves the part where
43
+ the editor put it; with JavaScript off every part is where the editor put it, and in Builder's visual editor and
44
+ preview nothing moves. A sidebar's rail and a floating pill never move. So CertREV can put the reviewer right after the byline and the memo at the end of the article with no
45
+ install.
46
+ - **The page's CertREV graph.** When the document carries `jsonld.graph` (a complete JSON-LD object CertREV's server
47
+ resolved for the placement: the Certification, its reviewer and CertREV, and the page's WebPage and Article; an
48
+ additive key under contract 1), the block that carries the page's assets prints it verbatim, once per page, as
49
+ `<script type="application/ld+json" data-certrev-graph data-certrev-external-id="<entry>">` (every `<` written as
50
+ `\u003c`). A document without it prints no graph. The block never builds or edits the graph; schema changes are the
51
+ server's. (1.x's rule that a page-builder block owns no structured data held while the block had to build the graph
52
+ itself; now it only prints the server's.)
53
+ - Dialogs are the document's own (`card.dialogs`): nothing in the package draws, styles or names them, so a redesign
54
+ of CertREV's profile and certificate dialogs needs no client change.
55
+ - **Nothing in the console.** Through 2.0.0, React's development build reported a hydration mismatch on every page with
56
+ a contract-1 card (the browser had already attached the card's shadow roots, which React expected as templates), and
57
+ in production every card React wrote itself (an in-app navigation, a re-render after the page's own hydration error)
58
+ drew Chrome's "Found declarative shadowrootmode attribute on a template, but declarative Shadow DOM is not being
59
+ parsed" warning once per template. The wrapper now skips React's hydration comparison (`suppressHydrationWarning`,
60
+ never printed), and in a browser that parses declarative roots the HTML React writes holds each template's mode
61
+ under `data-certrev-shadowrootmode` until the block re-parses the card's exact bytes, as before. The server's bytes
62
+ are unchanged.
63
+ - **A failed envelope is reported too.** An envelope that does not verify (a bad signature, an algorithm the client
64
+ does not accept, another platform, content that drifted from what was signed, a payload version it cannot read)
65
+ prints nothing, as before, and is now reported as `envelope_verify_failed` (beacon outcome `verify_failed`). Revoked,
66
+ expired, not found and another entry's envelope stay silent. When CertREV answers with an HTTP error, the
67
+ `delivery_unreachable` report carries `status` and the beacon says `http_5xx` or `http_4xx`. A beacon never sends the
68
+ page address (`referrerPolicy: 'no-referrer'`). Its three-per-page budget belongs to a document address, so an in-app
69
+ navigation starts a new one.
70
+ - **React 19 no longer rewrites the card.** React 19 rewrites an element's `innerHTML` whenever its
71
+ `dangerouslySetInnerHTML` is a new object (React 18 compared the strings), so on React 19 every re-render of a
72
+ contract-1 block, including the one right after hydration, replaced the card the browser had built (and left it to
73
+ the hosted runtime to attach the roots again). The block now keeps one object per printed string, so the server's
74
+ card nodes are the ones on the page after hydration, and it re-attaches any root after every commit before paint.
75
+
8
76
  ## 2.0.0 · 2026-10-21
9
77
 
10
78
  Major: **the contract-v1 Builder client. Install it once; from then on every visual, copy, layout, schema, fold and
package/README.md CHANGED
@@ -296,13 +296,14 @@ brand's render-def (accent / surface / corners / font + v2 bar-ink / body-ink).
296
296
  the card's design, copy, layout, schema, memo fold or dialogs ships from CertREV with no package release and no install
297
297
  on your side. The upgrade is two edits, made once:
298
298
 
299
- 1. `@certrev/cert-block` `^2.0.0`. Keep the registration line as it is: same import, same `certRevCertComponent`,
300
- same block name (`CertREV Cert`), same inputs, no new prop, no config.
299
+ 1. `@certrev/cert-block` `^2.0.1` (2.0.1 is a drop-in on 2.0.0: see "2.0.1" below). Keep the registration line as it
300
+ is: same import, same `certRevCertComponent`, same block name (`CertREV Cert`), same inputs, no new prop, no config.
301
301
  2. Four sources in the storefront's Content-Security-Policy, and nothing else from CertREV:
302
302
 
303
303
  ```
304
304
  script-src https://portal.certrev.com (the hosted card runtime: dialogs, revalidation)
305
- connect-src https://portal.certrev.com (the card's read after an in-app navigation; the runtime's revalidation)
305
+ connect-src https://portal.certrev.com (the card's read after an in-app navigation; the runtime's revalidation;
306
+ 2.0.1: the card's beacon)
306
307
  font-src https://assets.certrev.com (the card's fonts)
307
308
  img-src https://assets.certrev.com (reviewer photos)
308
309
  ```
@@ -342,7 +343,8 @@ page keeps one card when a brand changes its design. A sidebar card's float is l
342
343
  card print it again from the seed after re-checking it. A card the client mounts with no record on the page (an in-app
343
344
  navigation, Builder's editor) reads the Delivery API once (`clientRead`, on by default from 2.0.0; `clientRead={false}`
344
345
  restores 1.3.1's no-read behaviour), prints the card and attaches its roots (`setHTMLUnsafe`, else from each template),
345
- and loads the runtime once. A read your policy blocks paints the block's options face, as 1.3.1 did.
346
+ and loads the runtime once. A read your policy blocks prints nothing and reports `delivery_unreachable` (2.0.1; 2.0.0
347
+ painted the block's options face, as 1.3.1 did).
346
348
 
347
349
  **React 19 hosts and readers with JavaScript off.** React 19 streams a Suspense boundary larger than its
348
350
  `progressiveChunkSize` (12,800 bytes by default) after the page's shell, even when it is ready at once, and only a script
@@ -357,18 +359,53 @@ import { CARD_FALLBACK_EVENT, type CardFallbackDetail } from '@certrev/cert-bloc
357
359
 
358
360
  document.addEventListener(CARD_FALLBACK_EVENT, (e) => {
359
361
  const { reason, externalId, certId } = (e as CustomEvent<CardFallbackDetail>).detail
360
- // reason: card_missing | card_verify_failed | card_unsupported_contract | card_pin_mismatch | unknown_key | delivery_unreachable
362
+ // reason: card_missing | card_verify_failed | card_unsupported_contract | card_pin_mismatch | unknown_key
363
+ // | delivery_unreachable | no_marker | marker_invalid | client_read_off (the last three: 2.0.1)
361
364
  })
362
365
  ```
363
366
 
364
- once per placement and reason per page; on a server, one `console.warn` line `[certrev] card_fallback {json}`. The card
365
- itself sends nothing anywhere (no beacon, no storage, no cookie: its reads use `credentials: 'omit'`).
367
+ once per placement and reason per page; on a server, one `console.warn` line `[certrev] card_fallback {json}`. 2.0.1:
368
+ each report is also a beacon to CertREV (below); the card stores nothing and sends no cookie (`credentials: 'omit'`).
366
369
 
367
370
  **Key rotation needs no reinstall.** The baked kid (`cert-issuer-1`) verifies as before. An envelope signed by any
368
371
  other kid makes one read of `https://portal.certrev.com/api/cert/v1/keys`, a key set the card accepts only when the baked
369
372
  kid signs it (and it is not older than one already accepted, and still lists its signer). Otherwise the kid is unknown
370
373
  and the card renders nothing, as in 1.3.x.
371
374
 
375
+ ### 2.0.1: e.l.f.'s one install
376
+
377
+ A drop-in on 2.0.0 (same package, export, registration, inputs and CSP). What changes on a page:
378
+
379
+ - **Nothing, never unsigned facts.** A block with no delivery marker (`no_marker`), a marker this client does not
380
+ accept (`marker_invalid`), CertREV not reached with no verified answer inside the stale window
381
+ (`delivery_unreachable`), and a client mount with `clientRead={false}` (`client_read_off`) print **nothing** and
382
+ report it. Through 2.0.0 those painted the block's export-time options (a reviewer name, a credential, a memo, a
383
+ verify link that nobody signed); that face is gone. Every section below that still describes "the options face"
384
+ describes 1.x to 2.0.0; 2.0.1 prints nothing there. The signed paths are unchanged.
385
+ - **Stale window: 30 s fresh, 30 s stale** (2.0.0: 60 s and 300 s): with the Delivery API's own cache a revoked card is
386
+ gone within five to six minutes (ADR 0001 §7); past the window a read that cannot reach CertREV prints nothing.
387
+ - **A beacon to CertREV**: each fallback, and one health event on one page view in a hundred, as a `POST <delivery
388
+ origin>/api/cert/v1/beacon` `text/plain` JSON body `{v:1, client:'cert-block', clientVersion, contract,
389
+ platform:'builder', externalId, family, events:[{kind, reason, outcome}]}`. No cookies, no page address or text, no
390
+ user agent beyond a family. At most three per page; on a server, each placement and reason once an hour per process.
391
+ It goes to the delivery origin, already in `connect-src`: no new CSP source.
392
+ - **Forward compatible**: unknown parts, unknown fields and new keys under contract 1 are ignored; a newer major prints
393
+ nothing (`card_unsupported_contract`) and the page renders around it.
394
+ - **Placement hints**: once the page has loaded, each banner part moves to the place the document's `placement` names
395
+ among the Builder entry's top-level blocks: `content-start` (after a leading image with `after: 'leading-media'`),
396
+ `after-byline`, `before-references` (else `content-end`), `content-end`. Mark your byline with
397
+ `data-certrev-anchor="byline"` to make `after-byline` exact; otherwise the first `[rel~="author"]`,
398
+ `[itemprop="author"]`, `.byline`, `[class*="byline"]` or `address` in the entry is taken. An anchor the page lacks,
399
+ or one this client does not know, leaves the part where the editor put it, as JavaScript off and Builder's visual
400
+ editor and preview do. Rails and pills never move.
401
+ - **Nothing in the console**: no hydration mismatch in React's development build, and no "declarative Shadow DOM is
402
+ not being parsed" warning when React writes the card itself (an in-app navigation). The server's bytes are
403
+ unchanged.
404
+ - **The page's CertREV graph**: when the document carries `jsonld.graph` (resolved by CertREV's server for the
405
+ placement), the block that carries the page's assets prints it once as `<script type="application/ld+json"
406
+ data-certrev-graph>`; without it, no graph. The block never builds the graph (the "card emits no structured data" rule
407
+ below describes 1.x's own face).
408
+
372
409
  ### The reader face (1.2.0, opt-in)
373
410
 
374
411
  certrev.com's "reader" design (a banner card plus the expert memo, a sidebar card, a floating pill) is a
@@ -986,7 +1023,7 @@ published at `@certrev/cert-block/fixtures`).
986
1023
 
987
1024
  ## Version
988
1025
 
989
- `2.0.0`: see [CHANGELOG.md](./CHANGELOG.md) for the release history and the semver contract
1026
+ `2.0.1`: see [CHANGELOG.md](./CHANGELOG.md) for the release history and the semver contract
990
1027
  (patch/minor never change the rendered cert output or break a compiling integration). Publishes
991
1028
  **publicly** to npm as `@certrev/cert-block` (`publishConfig.access: public`) via GitHub Actions
992
1029
  trusted publishing (OIDC); the internal `@certrev` GitHub-Packages channel mirrors it.
@@ -0,0 +1,73 @@
1
+ /**
2
+ * The Builder card's beacon (2.0.1): what the card tells CertREV about itself, so a card that does not print on a brand's
3
+ * page is seen by CertREV and not only by the brand's console.
4
+ *
5
+ * One `POST <delivery origin>/api/cert/v1/beacon` per event, a `text/plain` JSON body (a CORS simple request, so no
6
+ * preflight; the origin is the delivery origin the page's `connect-src` already allows, so no new CSP source):
7
+ *
8
+ * { v: 1, client: 'cert-block', clientVersion, contract, platform: 'builder', externalId, family,
9
+ * events: [{ kind: 'fallback' | 'health', reason, outcome, status? }] }
10
+ *
11
+ * What it never carries: cookies (`credentials: 'omit'`), the page's address (`referrerPolicy: 'no-referrer'`) or text, the reader's user agent (only a
12
+ * coarse family: chromium, webkit, gecko, other, or server), or anything the reader typed. `externalId` is the Builder
13
+ * entry the block renders in, which the brand's page already sends to CertREV when it reads the card.
14
+ *
15
+ * How much: in a browser, every fallback (each placement and reason once per page, `card-report.ts`) and one health
16
+ * event per page in a hundred, at most three beacons per page (a page is a document address: an in-app navigation to
17
+ * another article starts a new budget); on a server, each placement, reason and origin at most
18
+ * once an hour per process, with a short deadline, never awaited. A beacon that fails is dropped: it never retries,
19
+ * never stores anything and never changes what the card prints.
20
+ */
21
+ export declare const BEACON_PATH = "/api/cert/v1/beacon";
22
+ /** Where a block with no accepted delivery marker reports: CertREV's production delivery origin. */
23
+ export declare const DEFAULT_BEACON_ORIGIN = "https://portal.certrev.com";
24
+ /** The most beacons one page sends. */
25
+ export declare const BEACON_MAX_PER_PAGE = 3;
26
+ /** The share of page views that send one health event. */
27
+ export declare const BEACON_HEALTH_SAMPLE = 0.01;
28
+ /** A server sends one beacon per placement, reason and origin at most this often. */
29
+ export declare const BEACON_SERVER_INTERVAL_MS = 3600000;
30
+ export type BeaconOutcome = 'ok' | 'unreachable' | 'http_4xx' | 'http_5xx' | 'verify_failed' | 'unsupported' | 'other';
31
+ export type BeaconFamily = 'chromium' | 'webkit' | 'gecko' | 'server' | 'other';
32
+ export interface BeaconEvent {
33
+ readonly kind: 'fallback' | 'health';
34
+ readonly reason: string;
35
+ readonly outcome: BeaconOutcome;
36
+ /** The HTTP status CertREV answered with, when a read failed on one (outcome `http_4xx` or `http_5xx`). */
37
+ readonly status?: number;
38
+ }
39
+ export interface CardBeacon {
40
+ readonly v: 1;
41
+ readonly client: 'cert-block';
42
+ readonly clientVersion: string;
43
+ readonly contract: number;
44
+ readonly platform: 'builder';
45
+ readonly externalId?: string;
46
+ readonly family: BeaconFamily;
47
+ readonly events: readonly BeaconEvent[];
48
+ }
49
+ /** How a beacon leaves: `url`, the JSON body, and where it is sent from. */
50
+ export type BeaconTransport = (url: string, body: string, where: 'browser' | 'server') => void;
51
+ /** The transport the card ships with: `fetch`, never awaited, never throwing (exported for CertREV's replica harness). */
52
+ export declare const fetchBeaconTransport: BeaconTransport;
53
+ /** The coarse browser family, from the user agent; nothing else of it is kept. */
54
+ export declare function browserFamily(userAgent: string): BeaconFamily;
55
+ export declare function beaconBody(externalId: string, events: readonly BeaconEvent[], family: BeaconFamily): CardBeacon;
56
+ /** Send one event from the browser, within the page's budget. */
57
+ export declare function sendBrowserBeacon(baseUrl: string | undefined, externalId: string, event: BeaconEvent): void;
58
+ /** Send one health event from the browser on one page view in a hundred (drawn once per page). */
59
+ export declare function maybeSendBrowserHealth(baseUrl: string | undefined, externalId: string): void;
60
+ /** Send one event from a server: each placement, reason and origin at most once an hour per process. */
61
+ export declare function sendServerBeacon(baseUrl: string | undefined, externalId: string, event: BeaconEvent): void;
62
+ /**
63
+ * Test seam: replace the transport (and the sampling draw and clock) and forget the page's and the process's budget.
64
+ * Returns a restore.
65
+ */
66
+ export declare function setCardBeaconForTests(overrides?: {
67
+ transport?: BeaconTransport;
68
+ random?: () => number;
69
+ now?: () => number;
70
+ }): () => void;
71
+ /** Test seam: a new page and a new process. */
72
+ export declare function forgetCardBeaconsForTests(): void;
73
+ //# sourceMappingURL=card-beacon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card-beacon.d.ts","sourceRoot":"","sources":["../../src/builder/card-beacon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,eAAO,MAAM,WAAW,wBAAwB,CAAA;AAChD,oGAAoG;AACpG,eAAO,MAAM,qBAAqB,+BAA+B,CAAA;AACjE,uCAAuC;AACvC,eAAO,MAAM,mBAAmB,IAAI,CAAA;AACpC,0DAA0D;AAC1D,eAAO,MAAM,oBAAoB,OAAO,CAAA;AACxC,qFAAqF;AACrF,eAAO,MAAM,yBAAyB,UAAY,CAAA;AAIlD,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,eAAe,GAAG,aAAa,GAAG,OAAO,CAAA;AACtH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE/E,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAA;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;I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AO,EAAE,MAAM,GAAG,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAa1G;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACpC,SAAS,GAAE;IAAE,SAAS,CAAC,EAAE,eAAe,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CAAO,GACxF,MAAM,IAAI,CAWZ;AAED,+CAA+C;AAC/C,wBAAgB,yBAAyB,IAAI,IAAI,CAKhD"}
@@ -0,0 +1,178 @@
1
+ /**
2
+ * The Builder card's beacon (2.0.1): what the card tells CertREV about itself, so a card that does not print on a brand's
3
+ * page is seen by CertREV and not only by the brand's console.
4
+ *
5
+ * One `POST <delivery origin>/api/cert/v1/beacon` per event, a `text/plain` JSON body (a CORS simple request, so no
6
+ * preflight; the origin is the delivery origin the page's `connect-src` already allows, so no new CSP source):
7
+ *
8
+ * { v: 1, client: 'cert-block', clientVersion, contract, platform: 'builder', externalId, family,
9
+ * events: [{ kind: 'fallback' | 'health', reason, outcome, status? }] }
10
+ *
11
+ * What it never carries: cookies (`credentials: 'omit'`), the page's address (`referrerPolicy: 'no-referrer'`) or text, the reader's user agent (only a
12
+ * coarse family: chromium, webkit, gecko, other, or server), or anything the reader typed. `externalId` is the Builder
13
+ * entry the block renders in, which the brand's page already sends to CertREV when it reads the card.
14
+ *
15
+ * How much: in a browser, every fallback (each placement and reason once per page, `card-report.ts`) and one health
16
+ * event per page in a hundred, at most three beacons per page (a page is a document address: an in-app navigation to
17
+ * another article starts a new budget); on a server, each placement, reason and origin at most
18
+ * once an hour per process, with a short deadline, never awaited. A beacon that fails is dropped: it never retries,
19
+ * never stores anything and never changes what the card prints.
20
+ */
21
+ import { CARD_CONTRACT_VERSION } from './card-contract.js';
22
+ import { CERT_BLOCK_VERSION } from './version.js';
23
+ export const BEACON_PATH = '/api/cert/v1/beacon';
24
+ /** Where a block with no accepted delivery marker reports: CertREV's production delivery origin. */
25
+ export const DEFAULT_BEACON_ORIGIN = 'https://portal.certrev.com';
26
+ /** The most beacons one page sends. */
27
+ export const BEACON_MAX_PER_PAGE = 3;
28
+ /** The share of page views that send one health event. */
29
+ export const BEACON_HEALTH_SAMPLE = 0.01;
30
+ /** A server sends one beacon per placement, reason and origin at most this often. */
31
+ export const BEACON_SERVER_INTERVAL_MS = 3_600_000;
32
+ const SERVER_MAX_KEYS = 500;
33
+ const SERVER_TIMEOUT_MS = 1_500;
34
+ /** The transport the card ships with: `fetch`, never awaited, never throwing (exported for CertREV's replica harness). */
35
+ export const fetchBeaconTransport = (url, body, where) => {
36
+ try {
37
+ const send = globalThis.fetch;
38
+ if (typeof send !== 'function')
39
+ return;
40
+ const init = {
41
+ method: 'POST',
42
+ body,
43
+ headers: { 'content-type': 'text/plain;charset=UTF-8' },
44
+ credentials: 'omit',
45
+ // Never the reader's page address, whatever the storefront's Referrer-Policy.
46
+ referrerPolicy: 'no-referrer',
47
+ ...(where === 'browser'
48
+ ? // Opaque and kept alive: no CORS read of the answer, and it outlives a navigation away.
49
+ { mode: 'no-cors', keepalive: true }
50
+ : typeof AbortSignal !== 'undefined' && typeof AbortSignal.timeout === 'function'
51
+ ? { signal: AbortSignal.timeout(SERVER_TIMEOUT_MS) }
52
+ : {}),
53
+ };
54
+ void send(url, init).catch(() => { });
55
+ }
56
+ catch {
57
+ // A beacon never throws into a render.
58
+ }
59
+ };
60
+ let transport = fetchBeaconTransport;
61
+ let sentOnPage = 0;
62
+ let healthDrawn = null;
63
+ /** The document address the page budget belongs to. */
64
+ let budgetPage = null;
65
+ /** Start a new page budget when the document's address changed (an in-app navigation). */
66
+ function samePageBudget() {
67
+ const page = typeof location !== 'undefined' ? `${location.pathname}${location.search}` : '';
68
+ if (page === budgetPage)
69
+ return;
70
+ budgetPage = page;
71
+ sentOnPage = 0;
72
+ healthDrawn = null;
73
+ }
74
+ const sentOnServer = new Map();
75
+ let random = Math.random;
76
+ let clock = Date.now;
77
+ /** The coarse browser family, from the user agent; nothing else of it is kept. */
78
+ export function browserFamily(userAgent) {
79
+ if (/Firefox\//.test(userAgent))
80
+ return 'gecko';
81
+ if (/(Chrome|Chromium|CriOS|Edg)\//.test(userAgent))
82
+ return 'chromium';
83
+ if (/AppleWebKit\//.test(userAgent))
84
+ return 'webkit';
85
+ return 'other';
86
+ }
87
+ /** The delivery origin a beacon goes to: an `https:` origin on certrev.com, else CertREV's production origin. */
88
+ function beaconOrigin(baseUrl) {
89
+ if (!baseUrl)
90
+ return DEFAULT_BEACON_ORIGIN;
91
+ try {
92
+ const url = new URL(baseUrl);
93
+ const host = url.hostname;
94
+ if (url.protocol === 'https:' && (host === 'certrev.com' || host.endsWith('.certrev.com')))
95
+ return url.origin;
96
+ }
97
+ catch {
98
+ // Fall through.
99
+ }
100
+ return DEFAULT_BEACON_ORIGIN;
101
+ }
102
+ export function beaconBody(externalId, events, family) {
103
+ return {
104
+ v: 1,
105
+ client: 'cert-block',
106
+ clientVersion: CERT_BLOCK_VERSION,
107
+ contract: CARD_CONTRACT_VERSION,
108
+ platform: 'builder',
109
+ ...(externalId ? { externalId } : {}),
110
+ family,
111
+ events,
112
+ };
113
+ }
114
+ /** Send one event from the browser, within the page's budget. */
115
+ export function sendBrowserBeacon(baseUrl, externalId, event) {
116
+ if (typeof document === 'undefined')
117
+ return;
118
+ samePageBudget();
119
+ if (sentOnPage >= BEACON_MAX_PER_PAGE)
120
+ return;
121
+ sentOnPage++;
122
+ const userAgent = typeof navigator !== 'undefined' ? String(navigator.userAgent ?? '') : '';
123
+ const body = beaconBody(externalId, [event], browserFamily(userAgent));
124
+ transport(`${beaconOrigin(baseUrl)}${BEACON_PATH}`, JSON.stringify(body), 'browser');
125
+ }
126
+ /** Send one health event from the browser on one page view in a hundred (drawn once per page). */
127
+ export function maybeSendBrowserHealth(baseUrl, externalId) {
128
+ if (typeof document === 'undefined')
129
+ return;
130
+ samePageBudget();
131
+ if (healthDrawn === null)
132
+ healthDrawn = random() < BEACON_HEALTH_SAMPLE;
133
+ if (!healthDrawn)
134
+ return;
135
+ healthDrawn = false;
136
+ sendBrowserBeacon(baseUrl, externalId, { kind: 'health', reason: 'card_printed', outcome: 'ok' });
137
+ }
138
+ /** Send one event from a server: each placement, reason and origin at most once an hour per process. */
139
+ export function sendServerBeacon(baseUrl, externalId, event) {
140
+ const origin = beaconOrigin(baseUrl);
141
+ const key = `${origin}|${externalId}|${event.kind}|${event.reason}`;
142
+ const now = clock();
143
+ const last = sentOnServer.get(key);
144
+ if (last !== undefined && now - last < BEACON_SERVER_INTERVAL_MS)
145
+ return;
146
+ sentOnServer.delete(key);
147
+ if (sentOnServer.size >= SERVER_MAX_KEYS) {
148
+ const oldest = sentOnServer.keys().next().value;
149
+ if (oldest !== undefined)
150
+ sentOnServer.delete(oldest);
151
+ }
152
+ sentOnServer.set(key, now);
153
+ transport(`${origin}${BEACON_PATH}`, JSON.stringify(beaconBody(externalId, [event], 'server')), 'server');
154
+ }
155
+ /**
156
+ * Test seam: replace the transport (and the sampling draw and clock) and forget the page's and the process's budget.
157
+ * Returns a restore.
158
+ */
159
+ export function setCardBeaconForTests(overrides = {}) {
160
+ const previous = { transport, random, clock };
161
+ transport = overrides.transport ?? (() => { });
162
+ random = overrides.random ?? (() => 1);
163
+ clock = overrides.now ?? Date.now;
164
+ forgetCardBeaconsForTests();
165
+ return () => {
166
+ transport = previous.transport;
167
+ random = previous.random;
168
+ clock = previous.clock;
169
+ };
170
+ }
171
+ /** Test seam: a new page and a new process. */
172
+ export function forgetCardBeaconsForTests() {
173
+ sentOnPage = 0;
174
+ healthDrawn = null;
175
+ budgetPage = null;
176
+ sentOnServer.clear();
177
+ }
178
+ //# sourceMappingURL=card-beacon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card-beacon.js","sourceRoot":"","sources":["../../src/builder/card-beacon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAA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IACD,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC1B,SAAS,CAAC,GAAG,MAAM,GAAG,WAAW,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA;AAC1G,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACpC,YAAwF,EAAE;IAE1F,MAAM,QAAQ,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA;IAC7C,SAAS,GAAG,SAAS,CAAC,SAAS,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IAC7C,MAAM,GAAG,SAAS,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;IACtC,KAAK,GAAG,SAAS,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAA;IACjC,yBAAyB,EAAE,CAAA;IAC3B,OAAO,GAAG,EAAE;QACX,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAA;QAC9B,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAA;QACxB,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAA;IACvB,CAAC,CAAA;AACF,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,yBAAyB;IACxC,UAAU,GAAG,CAAC,CAAA;IACd,WAAW,GAAG,IAAI,CAAA;IAClB,UAAU,GAAG,IAAI,CAAA;IACjB,YAAY,CAAC,KAAK,EAAE,CAAA;AACrB,CAAC"}
@@ -132,10 +132,18 @@ export declare function cardRuntimeTag(card: CardDocumentV1): string;
132
132
  export declare function cardFirstPart(card: CardDocumentV1): CardPartName | null;
133
133
  /** Whether the block printing `names` prints the page's head fragment, dialogs and runtime: it holds the first part. */
134
134
  export declare function cardCarriesAssets(card: CardDocumentV1, names: readonly CardPartName[]): boolean;
135
+ /**
136
+ * 2.0.1: the page's CertREV graph, when the document carries one CertREV's server resolved for this placement
137
+ * (`card.jsonld.graph`: a complete JSON-LD object, every link and page fact filled in, an additive key under contract
138
+ * 1). Printed verbatim as `<script type="application/ld+json" data-certrev-graph ...>`, with every `<` written as
139
+ * `\u003c` so no value can close the element; '' when the document has no graph. The block never builds or edits the
140
+ * graph: what it says, and when it changes, is the server's.
141
+ */
142
+ export declare function cardGraphTag(card: CardDocumentV1): string;
135
143
  /**
136
144
  * Exactly what a block prints inside its wrapper: its parts in page order and, only in the block holding the document's
137
- * first part (`cardCarriesAssets`), the head fragment before them and both dialogs (expert, then certificate) and the
138
- * runtime's tag after. So a split banner (a header block and a memo block) prints the head, the dialogs and the runtime
145
+ * first part (`cardCarriesAssets`), the head fragment before them and both dialogs (expert, then certificate), the
146
+ * runtime's tag and (2.0.1) the page's graph after. So a split banner (a header block and a memo block) prints the head, the dialogs and the runtime
139
147
  * once, in the header block, with no coordination between the blocks and with JavaScript off; the runtime finds a
140
148
  * control's dialog anywhere on the page by its placement. Every byte but the runtime tag is the document's own.
141
149
  */
@@ -1 +1 @@
1
- {"version":3,"file":"card-contract.d.ts","sourceRoot":"","sources":["../../src/builder/card-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAoB,MAAM,uBAAuB,CAAA;AAG5F,uCAAuC;AACvC,eAAO,MAAM,qBAAqB,IAAI,CAAA;AAEtC,uHAAuH;AACvH,eAAO,MAAM,eAAe,4CAA6C,CAAA;AACzE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3D,qCAAqC;AACrC,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAA;AAG1D;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA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AI,EAAE,cAAc,EACpB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,GAChB,OAAO,CAQT;AAED,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAEtF;AAED,mHAAmH;AACnH,wBAAsB,SAAS,CAC9B,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,GAAG,YAAY,EAAE,CAUhF;AAMD,6DAA6D;AAC7D,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAI3D;AAKD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,YAAY,GAAG,IAAI,CAEvE;AAED,wHAAwH;AACxH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,OAAO,CAG/F;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAazD;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,CAMrF"}
@@ -243,10 +243,34 @@ export function cardCarriesAssets(card, names) {
243
243
  const first = cardFirstPart(card);
244
244
  return first !== null && names.includes(first);
245
245
  }
246
+ /**
247
+ * 2.0.1: the page's CertREV graph, when the document carries one CertREV's server resolved for this placement
248
+ * (`card.jsonld.graph`: a complete JSON-LD object, every link and page fact filled in, an additive key under contract
249
+ * 1). Printed verbatim as `<script type="application/ld+json" data-certrev-graph ...>`, with every `<` written as
250
+ * `\u003c` so no value can close the element; '' when the document has no graph. The block never builds or edits the
251
+ * graph: what it says, and when it changes, is the server's.
252
+ */
253
+ export function cardGraphTag(card) {
254
+ const jsonld = card.jsonld;
255
+ if (typeof jsonld !== 'object' || jsonld === null)
256
+ return '';
257
+ const graph = jsonld.graph;
258
+ if (typeof graph !== 'object' || graph === null || Array.isArray(graph))
259
+ return '';
260
+ let json;
261
+ try {
262
+ json = JSON.stringify(graph);
263
+ }
264
+ catch {
265
+ return '';
266
+ }
267
+ const id = escapeAttribute(card.subject.externalId);
268
+ return `<script type="application/ld+json" data-certrev-graph="" data-certrev-platform="builder" data-certrev-external-id="${id}">${json.replace(/</g, '\\u003c')}</script>`;
269
+ }
246
270
  /**
247
271
  * Exactly what a block prints inside its wrapper: its parts in page order and, only in the block holding the document's
248
- * first part (`cardCarriesAssets`), the head fragment before them and both dialogs (expert, then certificate) and the
249
- * runtime's tag after. So a split banner (a header block and a memo block) prints the head, the dialogs and the runtime
272
+ * first part (`cardCarriesAssets`), the head fragment before them and both dialogs (expert, then certificate), the
273
+ * runtime's tag and (2.0.1) the page's graph after. So a split banner (a header block and a memo block) prints the head, the dialogs and the runtime
250
274
  * once, in the header block, with no coordination between the blocks and with JavaScript off; the runtime finds a
251
275
  * control's dialog anywhere on the page by its placement. Every byte but the runtime tag is the document's own.
252
276
  */
@@ -257,6 +281,6 @@ export function cardHtml(card, names) {
257
281
  if (!cardCarriesAssets(card, names))
258
282
  return parts;
259
283
  const dialogs = (card.dialogs.expert ?? '') + (card.dialogs.certificate ?? '');
260
- return card.assets.head + parts + dialogs + cardRuntimeTag(card);
284
+ return card.assets.head + parts + dialogs + cardRuntimeTag(card) + cardGraphTag(card);
261
285
  }
262
286
  //# sourceMappingURL=card-contract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"card-contract.js","sourceRoot":"","sources":["../../src/builder/card-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;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AAC;IAAC,MAAM,CAAC;QACR,OAAO,EAAE,CAAA;IACV,CAAC;IACD,MAAM,EAAE,GAAG,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IACnD,OAAO,sHAAsH,EAAE,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,WAAW,CAAA;AAC7K,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAoB,EAAE,KAA8B;IAC5E,IAAI,KAAK,GAAG,EAAE,CAAA;IACd,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAA;IACzD,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IACjD,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC,CAAA;IAC9E,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,KAAK,GAAG,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;AACtF,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * 2.0.1: the card document's placement hints (`card.placement`, ADR 0001 §2), applied by the block in the browser, so
3
+ * CertREV can move a banner's card and memo on a Builder page with no new install (Owen: the reviewer up top, the memo
4
+ * at the end).
5
+ *
6
+ * A Builder page renders an entry as `[builder-content-id] > .builder-blocks > .builder-block`, one top-level block per
7
+ * block the editor placed; the CertREV block is one of them. A hint names where a part belongs among those blocks:
8
+ *
9
+ * - `content-start`: before the first block; with `after: 'leading-media'`, after a first block that is only media
10
+ * (an image, a picture, a video or an iframe, and no text);
11
+ * - `after-byline`: after the block that holds the article's byline: an element marked `data-certrev-anchor="byline"`
12
+ * first, else the first `[rel~="author"]`, `[itemprop="author"]`, `.byline`, `[class*="byline"]` or `address`;
13
+ * - `before-references`: before the block that opens the references (a heading or label reading References, Sources,
14
+ * Citations or Works cited, or an element whose id names references);
15
+ * - `content-end`: after the last block;
16
+ * - `pinned`, or any anchor this client does not know: where the editor put it.
17
+ * An anchor that the page does not have falls back to the hint's `else`, and then to where the editor put it.
18
+ *
19
+ * Only a banner's parts move (`top`, `bottom`): a sidebar's rail floats beside the copy from the block the editor
20
+ * placed, and a floating pill is pinned to the viewport. A part moves into a holder (`data-certrev-placed`) inserted
21
+ * among the top-level blocks; the block itself stays where it was, with the card's head, dialogs and runtime.
22
+ *
23
+ * WHEN: in the browser only, after the page has loaded and React has hydrated (two frames after `load`), never during
24
+ * a render or a hydration, and never in Builder's visual editor or preview (`builder.frameEditing`,
25
+ * `builder.preview`, `__builder_editing__` in the address): an editor sees each block where it placed it. With JavaScript off, and until then, every part is where the editor put it. A card React
26
+ * prints again (a new document) or unmounts takes its moved parts with it first, so a part is never printed twice.
27
+ */
28
+ import type { CardDocumentV1, CardPartName } from './card-contract.js';
29
+ /**
30
+ * Apply the document's hints to the parts this block printed; returns the undo. A no-op, and a no-op undo, outside a
31
+ * Builder page.
32
+ *
33
+ * The undo puts each moved part back in the block's wrapper, unless the wrapper already holds that part again (React
34
+ * printed a new document into it, which it does before any effect cleanup runs) or has left the page (the card
35
+ * unmounted): then the moved part is dropped with its holder. Either way no part is ever printed twice.
36
+ */
37
+ export declare function applyCardPlacement(wrapper: Element, card: CardDocumentV1, names: readonly CardPartName[]): () => void;
38
+ /** True in Builder's visual editor or preview, where blocks stay where the editor placed them. */
39
+ export declare function inBuilderEditor(search?: string): boolean;
40
+ /**
41
+ * Run `apply` once the page has loaded and hydrated (two frames after `load`); returns a cancel that also undoes what
42
+ * `apply` did. Never runs in Builder's editor or preview.
43
+ */
44
+ export declare function afterPageSettles(apply: () => () => void): () => void;
45
+ //# sourceMappingURL=card-placement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card-placement.d.ts","sourceRoot":"","sources":["../../src/builder/card-placement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AA+FtE;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,IAAI,CA0CrH;AAKD,kGAAkG;AAClG,wBAAgB,eAAe,CAAC,MAAM,GAAE,MAA+D,GAAG,OAAO,CAGhH;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,MAAM,IAAI,GAAG,MAAM,IAAI,CAmBpE"}