@certrev/cert-block 1.3.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 (88) hide show
  1. package/CHANGELOG.md +235 -0
  2. package/README.md +162 -9
  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 +151 -0
  8. package/dist/builder/card-contract.d.ts.map +1 -0
  9. package/dist/builder/card-contract.js +286 -0
  10. package/dist/builder/card-contract.js.map +1 -0
  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 +49 -0
  16. package/dist/builder/card-report.d.ts.map +1 -0
  17. package/dist/builder/card-report.js +97 -0
  18. package/dist/builder/card-report.js.map +1 -0
  19. package/dist/builder/cert-review-card.d.ts +7 -5
  20. package/dist/builder/cert-review-card.d.ts.map +1 -1
  21. package/dist/builder/cert-review-card.js +202 -170
  22. package/dist/builder/cert-review-card.js.map +1 -1
  23. package/dist/builder/contract-card.d.ts +70 -0
  24. package/dist/builder/contract-card.d.ts.map +1 -0
  25. package/dist/builder/contract-card.js +191 -0
  26. package/dist/builder/contract-card.js.map +1 -0
  27. package/dist/builder/delivered-face.d.ts +9 -0
  28. package/dist/builder/delivered-face.d.ts.map +1 -1
  29. package/dist/builder/delivered-face.js +18 -5
  30. package/dist/builder/delivered-face.js.map +1 -1
  31. package/dist/builder/delivery-runtime.d.ts +27 -3
  32. package/dist/builder/delivery-runtime.d.ts.map +1 -1
  33. package/dist/builder/delivery-runtime.js +40 -4
  34. package/dist/builder/delivery-runtime.js.map +1 -1
  35. package/dist/builder/index.d.ts +7 -4
  36. package/dist/builder/index.d.ts.map +1 -1
  37. package/dist/builder/index.js +8 -4
  38. package/dist/builder/index.js.map +1 -1
  39. package/dist/builder/ssr-seed.d.ts +23 -4
  40. package/dist/builder/ssr-seed.d.ts.map +1 -1
  41. package/dist/builder/ssr-seed.js +29 -6
  42. package/dist/builder/ssr-seed.js.map +1 -1
  43. package/dist/builder/version.d.ts +3 -0
  44. package/dist/builder/version.d.ts.map +1 -0
  45. package/dist/builder/version.js +3 -0
  46. package/dist/builder/version.js.map +1 -0
  47. package/dist/index.d.ts +1 -0
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +2 -0
  50. package/dist/index.js.map +1 -1
  51. package/dist/reader/reader-css.generated.d.ts +1 -1
  52. package/dist/reader/reader-css.generated.d.ts.map +1 -1
  53. package/dist/reader/reader-css.generated.js +1 -1
  54. package/dist/reader/reader-css.generated.js.map +1 -1
  55. package/dist/reader/render.d.ts.map +1 -1
  56. package/dist/reader/render.js +71 -34
  57. package/dist/reader/render.js.map +1 -1
  58. package/dist/reader/tokens.d.ts +2 -0
  59. package/dist/reader/tokens.d.ts.map +1 -1
  60. package/dist/reader/tokens.js +28 -6
  61. package/dist/reader/tokens.js.map +1 -1
  62. package/dist/verify/get-verified-delivery.d.ts +32 -0
  63. package/dist/verify/get-verified-delivery.d.ts.map +1 -1
  64. package/dist/verify/get-verified-delivery.js +30 -5
  65. package/dist/verify/get-verified-delivery.js.map +1 -1
  66. package/dist/verify/key-set.d.ts +67 -0
  67. package/dist/verify/key-set.d.ts.map +1 -0
  68. package/dist/verify/key-set.js +190 -0
  69. package/dist/verify/key-set.js.map +1 -0
  70. package/package.json +115 -112
  71. package/src/builder/card-beacon.ts +201 -0
  72. package/src/builder/card-contract.ts +336 -0
  73. package/src/builder/card-placement.ts +208 -0
  74. package/src/builder/card-report.ts +126 -0
  75. package/src/builder/cert-review-card.tsx +285 -201
  76. package/src/builder/contract-card.tsx +216 -0
  77. package/src/builder/delivered-face.ts +18 -4
  78. package/src/builder/delivery-runtime.ts +46 -4
  79. package/src/builder/index.tsx +16 -4
  80. package/src/builder/ssr-seed.ts +37 -7
  81. package/src/builder/version.ts +2 -0
  82. package/src/index.ts +9 -0
  83. package/src/reader/reader-css.generated.ts +1 -1
  84. package/src/reader/reader.css +297 -2
  85. package/src/reader/render.ts +87 -38
  86. package/src/reader/tokens.ts +29 -6
  87. package/src/verify/get-verified-delivery.ts +54 -5
  88. package/src/verify/key-set.ts +225 -0
@@ -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"}
@@ -0,0 +1,193 @@
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
+ const MOVABLE = ['top', 'bottom'];
29
+ const PLACED_ATTRIBUTE = 'data-certrev-placed';
30
+ const MEDIA = 'img, picture, video, iframe, svg';
31
+ const BYLINE_MARKED = '[data-certrev-anchor="byline"]';
32
+ const BYLINE = '[rel~="author"], [itemprop="author"], .byline, [class*="byline"], address';
33
+ const REFERENCES_TEXT = /^\s*(references|sources|citations|works cited)\s*:?\s*$/i;
34
+ const REFERENCES_LABEL = 'h1, h2, h3, h4, h5, h6, strong, b, p, summary, dt, figcaption';
35
+ function hintFor(card, part) {
36
+ const placement = card.placement;
37
+ if (typeof placement !== 'object' || placement === null)
38
+ return null;
39
+ const hint = placement[part];
40
+ return typeof hint === 'object' && hint !== null ? hint : null;
41
+ }
42
+ /** A block that is only media: an image (or picture, video, iframe, svg) and no text of its own. */
43
+ function mediaOnly(block) {
44
+ return block.querySelector(MEDIA) !== null && (block.textContent ?? '').trim() === '';
45
+ }
46
+ function blockOf(node, blocks) {
47
+ return blocks.find((block) => block === node || block.contains(node)) ?? null;
48
+ }
49
+ function referencesBlock(blocks) {
50
+ for (const block of blocks) {
51
+ if (/references|sources|citations/i.test(block.id))
52
+ return block;
53
+ if (block.querySelector('[id*="references" i], [id*="sources" i], [id*="citations" i]'))
54
+ return block;
55
+ for (const label of Array.from(block.querySelectorAll(REFERENCES_LABEL))) {
56
+ if (REFERENCES_TEXT.test(label.textContent ?? ''))
57
+ return block;
58
+ }
59
+ }
60
+ return null;
61
+ }
62
+ function bylineBlock(root, blocks, own) {
63
+ for (const selector of [BYLINE_MARKED, BYLINE]) {
64
+ for (const node of Array.from(root.querySelectorAll(selector))) {
65
+ const block = blockOf(node, blocks);
66
+ if (block && block !== own)
67
+ return block;
68
+ }
69
+ }
70
+ return null;
71
+ }
72
+ /** One anchor, resolved among the top-level blocks other than the card's own; null when the page has no such place. */
73
+ function resolveAnchor(anchor, hint, root, column, blocks, own) {
74
+ const others = blocks.filter((block) => block !== own);
75
+ switch (anchor) {
76
+ case 'content-start': {
77
+ const first = others[0];
78
+ if (!first)
79
+ return null;
80
+ return hint.after === 'leading-media' && mediaOnly(first) ? { after: first } : { before: first };
81
+ }
82
+ case 'after-byline': {
83
+ const byline = bylineBlock(root, blocks, own);
84
+ return byline ? { after: byline } : null;
85
+ }
86
+ case 'before-references': {
87
+ const references = referencesBlock(others);
88
+ return references ? { before: references } : null;
89
+ }
90
+ case 'content-end':
91
+ return others.length > 0 ? { end: column } : null;
92
+ default:
93
+ return null;
94
+ }
95
+ }
96
+ /** True when the card's own block already sits where `target` would put the part. */
97
+ function alreadyThere(target, own, blocks) {
98
+ const index = blocks.indexOf(own);
99
+ if ('before' in target)
100
+ return blocks[index + 1] === target.before || (index === 0 && blocks[0] === target.before);
101
+ if ('after' in target)
102
+ return blocks[index - 1] === target.after;
103
+ return index === blocks.length - 1;
104
+ }
105
+ /**
106
+ * Apply the document's hints to the parts this block printed; returns the undo. A no-op, and a no-op undo, outside a
107
+ * Builder page.
108
+ *
109
+ * The undo puts each moved part back in the block's wrapper, unless the wrapper already holds that part again (React
110
+ * printed a new document into it, which it does before any effect cleanup runs) or has left the page (the card
111
+ * unmounted): then the moved part is dropped with its holder. Either way no part is ever printed twice.
112
+ */
113
+ export function applyCardPlacement(wrapper, card, names) {
114
+ const root = wrapper.closest('[builder-content-id]');
115
+ const column = root?.querySelector(':scope > .builder-blocks') ?? null;
116
+ if (!root || !column)
117
+ return () => { };
118
+ const blocks = Array.from(column.children).filter((child) => child.classList.contains('builder-block'));
119
+ const own = blockOf(wrapper, blocks);
120
+ if (!own)
121
+ return () => { };
122
+ const placed = [];
123
+ for (const part of names) {
124
+ if (!MOVABLE.includes(part))
125
+ continue;
126
+ const hint = hintFor(card, part);
127
+ if (!hint)
128
+ continue;
129
+ const host = wrapper.querySelector(`:scope > certrev-card[data-certrev-part="${part}"]`);
130
+ if (!host)
131
+ continue;
132
+ const target = resolveAnchor(hint.anchor, hint, root, column, blocks, own) ??
133
+ (hint.else !== undefined ? resolveAnchor(hint.else, hint, root, column, blocks, own) : null);
134
+ if (!target || alreadyThere(target, own, blocks))
135
+ continue;
136
+ const next = host.nextSibling;
137
+ const holder = (wrapper.ownerDocument ?? document).createElement('div');
138
+ holder.setAttribute(PLACED_ATTRIBUTE, part);
139
+ holder.setAttribute('data-certrev-face', 'card');
140
+ if ('before' in target)
141
+ column.insertBefore(holder, target.before);
142
+ else if ('after' in target)
143
+ column.insertBefore(holder, target.after.nextSibling);
144
+ else
145
+ column.appendChild(holder);
146
+ holder.appendChild(host);
147
+ placed.push({ holder, host, part, next });
148
+ }
149
+ return () => {
150
+ for (const { holder, host, part, next } of placed) {
151
+ const printedAgain = wrapper.querySelector(`:scope > certrev-card[data-certrev-part="${part}"]`) !== null;
152
+ if (wrapper.isConnected && !printedAgain) {
153
+ wrapper.insertBefore(host, next && next.parentNode === wrapper ? next : null);
154
+ }
155
+ holder.remove();
156
+ }
157
+ };
158
+ }
159
+ /** Builder's visual editor and preview load the page with one of these in its address. */
160
+ const EDITOR_PARAMS = ['builder.frameEditing', 'builder.preview', '__builder_editing__'];
161
+ /** True in Builder's visual editor or preview, where blocks stay where the editor placed them. */
162
+ export function inBuilderEditor(search = typeof location === 'undefined' ? '' : location.search) {
163
+ const params = new URLSearchParams(search);
164
+ return EDITOR_PARAMS.some((name) => params.has(name));
165
+ }
166
+ /**
167
+ * Run `apply` once the page has loaded and hydrated (two frames after `load`); returns a cancel that also undoes what
168
+ * `apply` did. Never runs in Builder's editor or preview.
169
+ */
170
+ export function afterPageSettles(apply) {
171
+ if (inBuilderEditor())
172
+ return () => { };
173
+ let undo = null;
174
+ let cancelled = false;
175
+ const run = () => {
176
+ if (cancelled)
177
+ return;
178
+ requestAnimationFrame(() => requestAnimationFrame(() => {
179
+ if (!cancelled)
180
+ undo = apply();
181
+ }));
182
+ };
183
+ if (document.readyState === 'complete')
184
+ run();
185
+ else
186
+ window.addEventListener('load', run, { once: true });
187
+ return () => {
188
+ cancelled = true;
189
+ window.removeEventListener('load', run);
190
+ undo?.();
191
+ };
192
+ }
193
+ //# sourceMappingURL=card-placement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card-placement.js","sourceRoot":"","sources":["../../src/builder/card-placement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,MAAM,O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A;QAChB,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QACvC,IAAI,EAAE,EAAE,CAAA;IACT,CAAC,CAAA;AACF,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * The Builder card's fallback report (2.0.0; 2.0.1 adds the beacon): one structured event every time a placement does
3
+ * not print a card, so no fallback is silent.
4
+ *
5
+ * - In the browser: `CustomEvent('certrev:card-fallback', { detail })` on `document`, once per placement and reason per
6
+ * page, which a brand (or CertREV's own replica) can listen for; and (2.0.1) the same fallback to CertREV as a beacon
7
+ * (`card-beacon.ts`: no reader data, at most three per page).
8
+ * - On a server: one `console.warn` line, `[certrev] card_fallback {json}`, per render that takes the fallback; and
9
+ * (2.0.1) a beacon, each placement and reason at most once an hour per process.
10
+ *
11
+ * The same reason rides the placement's `'none'` record on the page (`ssr-seed.ts`), so a capture can read it too.
12
+ *
13
+ * Reasons (2.0.1: every one of them prints NOTHING; no fallback ever prints the block's own export-time options):
14
+ * - `card_missing`: a contract-1 placement (the signed binding says `contract: 1`) with no card in the response;
15
+ * - `card_verify_failed`: a card that is malformed, or does not hash to the signed digest, or names another design
16
+ * version, certificate or placement;
17
+ * - `card_unsupported_contract`: a signed binding with a `contract` this client does not print (a newer major);
18
+ * - `card_pin_mismatch`: CertREV's replica pinned a design version the signed card was not painted for;
19
+ * - `unknown_key`: the envelope's kid is neither baked nor in the origin's signed published key set;
20
+ * - `envelope_verify_failed` (2.0.1): the envelope itself did not verify (a bad signature, an algorithm this client does
21
+ * not accept, another platform, content that drifted from what was signed, a payload version it cannot read);
22
+ * - `delivery_unreachable`: CertREV could not be reached and no verified answer was cached inside the stale window
23
+ * (2.0.1: when CertREV answered with an HTTP error, the beacon says `http_5xx` or `http_4xx` and carries `status`);
24
+ * - `no_marker`: a block with no delivery marker (an entry exported before 1.1.0, or a block dropped in by hand);
25
+ * - `marker_invalid`: a delivery marker this client does not accept, or a block with no Builder entry to read for;
26
+ * - `client_read_off`: a block mounted in the browser with no server answer while the brand turned `clientRead` off.
27
+ */
28
+ export declare const CARD_FALLBACK_EVENT = "certrev:card-fallback";
29
+ export type CardFallbackReason = 'card_missing' | 'card_verify_failed' | 'card_unsupported_contract' | 'card_pin_mismatch' | 'unknown_key' | 'envelope_verify_failed' | 'delivery_unreachable' | 'no_marker' | 'marker_invalid' | 'client_read_off';
30
+ export declare const CARD_FALLBACK_REASONS: readonly CardFallbackReason[];
31
+ export interface CardFallbackDetail {
32
+ readonly reason: CardFallbackReason;
33
+ readonly platform: 'builder';
34
+ readonly externalId: string;
35
+ /** The certificate, when the envelope verified far enough to name it. */
36
+ readonly certId?: string;
37
+ /** 2.0.1: with `delivery_unreachable`, the HTTP status CertREV answered with, when it answered. */
38
+ readonly status?: number;
39
+ }
40
+ /**
41
+ * Report one fallback in the browser: the event and the beacon, once per placement and reason per page. `origin` is the
42
+ * delivery origin the block reads (absent for a block with no accepted marker: CertREV's production origin).
43
+ */
44
+ export declare function reportCardFallbackInBrowser(detail: CardFallbackDetail, origin?: string): void;
45
+ /** Report one fallback on a server: one structured console line, and the beacon (at most once an hour per process). */
46
+ export declare function reportCardFallbackOnServer(detail: CardFallbackDetail, origin?: string): void;
47
+ /** Test seam: forget what this page reported (a new page). */
48
+ export declare function forgetCardReportsForTests(): void;
49
+ //# sourceMappingURL=card-report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card-report.d.ts","sourceRoot":"","sources":["../../src/builder/card-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,eAAO,MAAM,mBAAmB,0BAA0B,CAAA;AAE1D,MAAM,MAAM,kBAAkB,GAC3B,cAAc,GACd,oBAAoB,GACpB,2BAA2B,GAC3B,mBAAmB,GACnB,aAAa,GACb,wBAAwB,GACxB,sBAAsB,GACtB,WAAW,GACX,gBAAgB,GAChB,iBAAiB,CAAA;AAEpB,eAAO,MAAM,qBAAqB,EAAE,SAAS,kBAAkB,EAW9D,CAAA;AAED,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;IACnC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,yEAAyE;IACzE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,mGAAmG;IACnG,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACxB;AAgCD;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAY7F;AAED,uHAAuH;AACvH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAG5F;AAED,8DAA8D;AAC9D,wBAAgB,yBAAyB,IAAI,IAAI,CAGhD"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * The Builder card's fallback report (2.0.0; 2.0.1 adds the beacon): one structured event every time a placement does
3
+ * not print a card, so no fallback is silent.
4
+ *
5
+ * - In the browser: `CustomEvent('certrev:card-fallback', { detail })` on `document`, once per placement and reason per
6
+ * page, which a brand (or CertREV's own replica) can listen for; and (2.0.1) the same fallback to CertREV as a beacon
7
+ * (`card-beacon.ts`: no reader data, at most three per page).
8
+ * - On a server: one `console.warn` line, `[certrev] card_fallback {json}`, per render that takes the fallback; and
9
+ * (2.0.1) a beacon, each placement and reason at most once an hour per process.
10
+ *
11
+ * The same reason rides the placement's `'none'` record on the page (`ssr-seed.ts`), so a capture can read it too.
12
+ *
13
+ * Reasons (2.0.1: every one of them prints NOTHING; no fallback ever prints the block's own export-time options):
14
+ * - `card_missing`: a contract-1 placement (the signed binding says `contract: 1`) with no card in the response;
15
+ * - `card_verify_failed`: a card that is malformed, or does not hash to the signed digest, or names another design
16
+ * version, certificate or placement;
17
+ * - `card_unsupported_contract`: a signed binding with a `contract` this client does not print (a newer major);
18
+ * - `card_pin_mismatch`: CertREV's replica pinned a design version the signed card was not painted for;
19
+ * - `unknown_key`: the envelope's kid is neither baked nor in the origin's signed published key set;
20
+ * - `envelope_verify_failed` (2.0.1): the envelope itself did not verify (a bad signature, an algorithm this client does
21
+ * not accept, another platform, content that drifted from what was signed, a payload version it cannot read);
22
+ * - `delivery_unreachable`: CertREV could not be reached and no verified answer was cached inside the stale window
23
+ * (2.0.1: when CertREV answered with an HTTP error, the beacon says `http_5xx` or `http_4xx` and carries `status`);
24
+ * - `no_marker`: a block with no delivery marker (an entry exported before 1.1.0, or a block dropped in by hand);
25
+ * - `marker_invalid`: a delivery marker this client does not accept, or a block with no Builder entry to read for;
26
+ * - `client_read_off`: a block mounted in the browser with no server answer while the brand turned `clientRead` off.
27
+ */
28
+ import { sendBrowserBeacon, sendServerBeacon } from './card-beacon.js';
29
+ export const CARD_FALLBACK_EVENT = 'certrev:card-fallback';
30
+ export const CARD_FALLBACK_REASONS = [
31
+ 'card_missing',
32
+ 'card_verify_failed',
33
+ 'card_unsupported_contract',
34
+ 'card_pin_mismatch',
35
+ 'unknown_key',
36
+ 'envelope_verify_failed',
37
+ 'delivery_unreachable',
38
+ 'no_marker',
39
+ 'marker_invalid',
40
+ 'client_read_off',
41
+ ];
42
+ /** The beacon's outcome for each reason. */
43
+ const OUTCOMES = {
44
+ card_missing: 'other',
45
+ card_verify_failed: 'verify_failed',
46
+ card_unsupported_contract: 'unsupported',
47
+ card_pin_mismatch: 'other',
48
+ unknown_key: 'verify_failed',
49
+ envelope_verify_failed: 'verify_failed',
50
+ delivery_unreachable: 'unreachable',
51
+ no_marker: 'other',
52
+ marker_invalid: 'other',
53
+ client_read_off: 'other',
54
+ };
55
+ /** Placement and reason pairs already reported on this page (browser only), and the document address they belong to. */
56
+ const reportedOnPage = new Set();
57
+ let reportedPage = null;
58
+ /** The beacon event for one fallback: an HTTP error says which, with its status. */
59
+ function fallbackEvent(detail) {
60
+ const status = detail.status;
61
+ const outcome = status !== undefined && status >= 500
62
+ ? 'http_5xx'
63
+ : status !== undefined && status >= 400
64
+ ? 'http_4xx'
65
+ : OUTCOMES[detail.reason];
66
+ return { kind: 'fallback', reason: detail.reason, outcome, ...(status === undefined ? {} : { status }) };
67
+ }
68
+ /**
69
+ * Report one fallback in the browser: the event and the beacon, once per placement and reason per page. `origin` is the
70
+ * delivery origin the block reads (absent for a block with no accepted marker: CertREV's production origin).
71
+ */
72
+ export function reportCardFallbackInBrowser(detail, origin) {
73
+ if (typeof document === 'undefined' || typeof CustomEvent !== 'function')
74
+ return;
75
+ const page = typeof location !== 'undefined' ? `${location.pathname}${location.search}` : '';
76
+ if (page !== reportedPage) {
77
+ reportedPage = page;
78
+ reportedOnPage.clear();
79
+ }
80
+ const key = `${detail.externalId}|${detail.reason}`;
81
+ if (reportedOnPage.has(key))
82
+ return;
83
+ reportedOnPage.add(key);
84
+ document.dispatchEvent(new CustomEvent(CARD_FALLBACK_EVENT, { detail }));
85
+ sendBrowserBeacon(origin, detail.externalId, fallbackEvent(detail));
86
+ }
87
+ /** Report one fallback on a server: one structured console line, and the beacon (at most once an hour per process). */
88
+ export function reportCardFallbackOnServer(detail, origin) {
89
+ console.warn(`[certrev] card_fallback ${JSON.stringify(detail)}`);
90
+ sendServerBeacon(origin, detail.externalId, fallbackEvent(detail));
91
+ }
92
+ /** Test seam: forget what this page reported (a new page). */
93
+ export function forgetCardReportsForTests() {
94
+ reportedOnPage.clear();
95
+ reportedPage = null;
96
+ }
97
+ //# sourceMappingURL=card-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card-report.js","sourceRoot":"","sources":["../../src/builder/card-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAsB,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAE1F,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAA;AAc1D,MAAM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AI,OAAO,WAAW,KAAK,UAAU;QAAE,OAAM;IAChF,MAAM,IAAI,GAAG,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAC5F,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;QAC3B,YAAY,GAAG,IAAI,CAAA;QACnB,cAAc,CAAC,KAAK,EAAE,CAAA;IACvB,CAAC;IACD,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,CAAA;IACnD,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAM;IACnC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACvB,QAAQ,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,mBAAmB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;IACxE,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAA;AACpE,CAAC;AAED,uHAAuH;AACvH,MAAM,UAAU,0BAA0B,CAAC,MAA0B,EAAE,MAAe;IACrF,OAAO,CAAC,IAAI,CAAC,2BAA2B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IACjE,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAA;AACnE,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,yBAAyB;IACxC,cAAc,CAAC,KAAK,EAAE,CAAA;IACtB,YAAY,GAAG,IAAI,CAAA;AACpB,CAAC"}
@@ -63,11 +63,13 @@ export interface CertReviewCardProps extends Partial<BuilderCertChromeData> {
63
63
  } | null;
64
64
  } | null;
65
65
  /**
66
- * 1.2.0: opt in to a Delivery read FROM THE BROWSER for a card the server did not render (a client-side navigation,
67
- * Builder's editor). Off by default: the card then never makes a request from the browser, so a brand's
68
- * Content-Security-Policy needs no CertREV origin, and such a card paints the block's own options face. Turning it
69
- * on needs the Delivery API's origin in the page's `connect-src`. Not a Builder input: a brand sets it in code, on
70
- * a wrapper of this component.
66
+ * A Delivery read FROM THE BROWSER for a card the server did not render (a client-side navigation, Builder's editor).
67
+ * 2.0.0: ON by default (absent or `true`): it is the only way CertREV's server-rendered card exists after an in-app
68
+ * navigation, and it needs the Delivery API's origin (`https://portal.certrev.com`) in the page's `connect-src`, one
69
+ * of the four CSP sources 2.0 asks for. A read the policy blocks is a read that did not reach CertREV: nothing, and a
70
+ * reported `delivery_unreachable` (2.0.1; 2.0.0 painted the block's options face). `false`: no request from the
71
+ * browser, and such a card prints nothing and reports `client_read_off`. Not a Builder input: a brand sets it in code,
72
+ * on a wrapper of this component.
71
73
  */
72
74
  clientRead?: boolean;
73
75
  }
@@ -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,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,oCAAoC,CAAA;AAYxF,OAAO,KAAK,EAAE,qBAAqB,EAAuB,MAAM,uBAAuB,CAAA;AA2BvF;;;;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,GAAG,MAAM,GAAG,IAAI,CAAA;IACxC;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE;QAChB,QAAQ,CAAC,OAAO,CAAC,EAAE;Y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