@certrev/cert-block 2.0.2 → 2.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 +24 -0
- package/README.md +4 -2
- package/dist/builder/envelope-face.d.ts +2 -0
- package/dist/builder/envelope-face.d.ts.map +1 -1
- package/dist/builder/envelope-face.js +9 -1
- package/dist/builder/envelope-face.js.map +1 -1
- package/dist/builder/version.d.ts +1 -1
- package/dist/builder/version.js +1 -1
- package/dist/components/CertBadge.d.ts.map +1 -1
- package/dist/components/CertBadge.js +4 -2
- package/dist/components/CertBadge.js.map +1 -1
- package/dist/components/render-cert-block.d.ts +9 -1
- package/dist/components/render-cert-block.d.ts.map +1 -1
- package/dist/components/render-cert-block.js +4 -4
- package/dist/components/render-cert-block.js.map +1 -1
- package/dist/components/render-def.d.ts +18 -0
- package/dist/components/render-def.d.ts.map +1 -1
- package/dist/components/render-def.js +15 -0
- package/dist/components/render-def.js.map +1 -1
- package/dist/modal/cert-modal-view.d.ts +3 -0
- package/dist/modal/cert-modal-view.d.ts.map +1 -1
- package/dist/modal/cert-modal-view.js +4 -3
- package/dist/modal/cert-modal-view.js.map +1 -1
- package/dist/modal/certrev-cert.js +4 -4
- package/dist/modal/display-strings.d.ts +9 -0
- package/dist/modal/display-strings.d.ts.map +1 -1
- package/dist/modal/display-strings.js +12 -1
- package/dist/modal/display-strings.js.map +1 -1
- package/dist/modal/ftc-disclosure.d.ts +6 -0
- package/dist/modal/ftc-disclosure.d.ts.map +1 -1
- package/dist/modal/ftc-disclosure.js +6 -0
- package/dist/modal/ftc-disclosure.js.map +1 -1
- package/dist/reader/render.d.ts.map +1 -1
- package/dist/reader/render.js +5 -10
- package/dist/reader/render.js.map +1 -1
- package/dist/webcomponent/render-badge-html.d.ts.map +1 -1
- package/dist/webcomponent/render-badge-html.js +6 -3
- package/dist/webcomponent/render-badge-html.js.map +1 -1
- package/package.json +1 -1
- package/src/builder/envelope-face.ts +16 -1
- package/src/builder/version.ts +1 -1
- package/src/components/CertBadge.tsx +6 -3
- package/src/components/render-cert-block.ts +13 -4
- package/src/components/render-def.ts +24 -0
- package/src/modal/cert-modal-view.ts +7 -3
- package/src/modal/display-strings.ts +14 -1
- package/src/modal/ftc-disclosure.ts +8 -0
- package/src/reader/render.ts +12 -11
- package/src/webcomponent/render-badge-html.ts +6 -3
|
@@ -141,6 +141,30 @@ export const COMPENSATED_EXPERT_CUE = 'Compensated expert'
|
|
|
141
141
|
export const CERT_SCOPE_LINE =
|
|
142
142
|
'Independent editorial review of this article’s text and sources. Not a product endorsement, nor medical advice.'
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* 2.1.0: the scope line for an article whose review covered its TEXT only (no references or sources section). Byte-verbatim
|
|
146
|
+
* copy of the portal's `FTC_DISCLOSURE_LINE_TEXT_ONLY` (`src/lib/embed/ftc-disclosure.ts`; Owen, Console decision
|
|
147
|
+
* af5b0db5, 2026-10-30: the review line says what the expert actually reviewed). Same curly apostrophe, same contract
|
|
148
|
+
* status as `CERT_SCOPE_LINE`: never re-word here.
|
|
149
|
+
*/
|
|
150
|
+
export const CERT_SCOPE_LINE_TEXT_ONLY =
|
|
151
|
+
'Independent editorial review of this article’s text. Not a product endorsement, nor medical advice.'
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* 2.1.0: what the review covered, the portal's signed `content.expert.reviewScope`. ABSENT means `text_and_sources`: every
|
|
155
|
+
* envelope signed before the field existed prints exactly as 2.0.2 printed it.
|
|
156
|
+
*/
|
|
157
|
+
export type CertReviewScope = 'text' | 'text_and_sources'
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The scope line for a review scope, the ONE rule every face of this package prints by: only an exact `'text'` is the
|
|
161
|
+
* text-only line; anything else (absent, null, `'text_and_sources'`, a value this version has never heard of) is the full
|
|
162
|
+
* `CERT_SCOPE_LINE`. The portal's `scopeLineFor` decides the same way.
|
|
163
|
+
*/
|
|
164
|
+
export function certScopeLineFor(reviewScope: unknown): typeof CERT_SCOPE_LINE | typeof CERT_SCOPE_LINE_TEXT_ONLY {
|
|
165
|
+
return reviewScope === 'text' ? CERT_SCOPE_LINE_TEXT_ONLY : CERT_SCOPE_LINE
|
|
166
|
+
}
|
|
167
|
+
|
|
144
168
|
/**
|
|
145
169
|
* The delivered display-string EDITION, stamped as `data-certrev-strings-version`
|
|
146
170
|
* so the crawl monitor can assert which verbatim strings a live face should carry.
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
import { asText, escapeHtml } from './escape.js'
|
|
31
31
|
import { resizeAvatarUrl } from './avatar-resize.js'
|
|
32
|
-
import {
|
|
32
|
+
import { formatCertDisplayDate, scopeLineForReview } from './display-strings.js'
|
|
33
33
|
import { checkIcon, chevronMark, verifiedStamp } from './certrev-cert-modal.styles.js'
|
|
34
34
|
|
|
35
35
|
export interface CertModalCredential {
|
|
@@ -48,6 +48,9 @@ export interface CertModalExpert {
|
|
|
48
48
|
/** The pre-composed material-connection label ('Compensated expert') or null/absent for
|
|
49
49
|
* a pro-bono reviewer. Present → the disclosure footer renders the label; null/absent → label omitted. */
|
|
50
50
|
compensationCue?: string | null
|
|
51
|
+
/** 2.1.0: what the review covered (`'text'` | `'text_and_sources'`, absent = text and sources). Picks the locked
|
|
52
|
+
* scope line the footer prints, never its words. */
|
|
53
|
+
reviewScope?: string | null
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
/** The subset of the signed `payload.content` the modals read (structural). */
|
|
@@ -171,12 +174,13 @@ function certifiedChip(cls: string): string {
|
|
|
171
174
|
* (`expert.compensationCue`, a FINISHED string off the signed envelope) leads ONLY when the reviewer
|
|
172
175
|
* was compensated; a pro-bono reviewer (null/absent cue) drops the label but keeps the scope line —
|
|
173
176
|
* which makes no compensation claim, so it is true for volunteers too and renders unconditionally.
|
|
174
|
-
* The scope line is the verbatim FTC copy (`CERT_SCOPE_LINE`
|
|
177
|
+
* The scope line is the verbatim FTC copy (`CERT_SCOPE_LINE`, or 2.1.0's `CERT_SCOPE_LINE_TEXT_ONLY` when the signed
|
|
178
|
+
* `expert.reviewScope` is `'text'`), never re-assembled here.
|
|
175
179
|
*/
|
|
176
180
|
function disclosureFooter(expert: CertModalExpert | null | undefined): string {
|
|
177
181
|
const cue = asText(expert?.compensationCue).trim()
|
|
178
182
|
const cueHtml = cue ? `<span class="crm-disclosure__cue">${escapeHtml(cue)}</span> ` : ''
|
|
179
|
-
return `<div class="crm-disclosure">${cueHtml}${escapeHtml(
|
|
183
|
+
return `<div class="crm-disclosure">${cueHtml}${escapeHtml(scopeLineForReview(expert?.reviewScope))}</div>`
|
|
180
184
|
}
|
|
181
185
|
|
|
182
186
|
/**
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* never legitimately carry renders nothing (see `formatCertDisplayDate`).
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { FTC_DISCLOSURE_LINE } from "./ftc-disclosure.js";
|
|
17
|
+
import { FTC_DISCLOSURE_LINE, FTC_DISCLOSURE_LINE_TEXT_ONLY } from "./ftc-disclosure.js";
|
|
18
18
|
|
|
19
19
|
/** The compensation cue (guide "line A"), byte-verbatim from portal `COMPENSATED_EXPERT_CUE`. */
|
|
20
20
|
export const COMPENSATED_EXPERT_CUE = "Compensated expert";
|
|
@@ -22,6 +22,19 @@ export const COMPENSATED_EXPERT_CUE = "Compensated expert";
|
|
|
22
22
|
/** The FTC scope disclaimer, re-exported from the FTC SoT (portal `CERT_SCOPE_LINE = FTC_DISCLOSURE_LINE`). */
|
|
23
23
|
export const CERT_SCOPE_LINE = FTC_DISCLOSURE_LINE;
|
|
24
24
|
|
|
25
|
+
/** 2.1.0: the text-only scope line (portal `FTC_DISCLOSURE_LINE_TEXT_ONLY`), for a review that covered the text only. */
|
|
26
|
+
export const CERT_SCOPE_LINE_TEXT_ONLY = FTC_DISCLOSURE_LINE_TEXT_ONLY;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 2.1.0: the scope line for the signed `content.expert.reviewScope`. Only an exact `"text"` is the text-only line; absent,
|
|
30
|
+
* null, `"text_and_sources"` or any other value is `CERT_SCOPE_LINE`, as 2.0.2 printed it. The same rule as
|
|
31
|
+
* `certScopeLineFor` in `../components/render-def.ts`, repeated because `src/modal/` imports nothing from `src/components/`
|
|
32
|
+
* (it is bundled standalone into `certrev-cert.js`).
|
|
33
|
+
*/
|
|
34
|
+
export function scopeLineForReview(reviewScope: unknown): typeof CERT_SCOPE_LINE | typeof CERT_SCOPE_LINE_TEXT_ONLY {
|
|
35
|
+
return reviewScope === "text" ? CERT_SCOPE_LINE_TEXT_ONLY : CERT_SCOPE_LINE;
|
|
36
|
+
}
|
|
37
|
+
|
|
25
38
|
/**
|
|
26
39
|
* Format a timestamp the way every cert byline renders dates ("Jun 14, 2026", en-US short month,
|
|
27
40
|
* UTC-pinned). Null for an unparseable input — callers treat that as "no date, no byline".
|
|
@@ -15,3 +15,11 @@
|
|
|
15
15
|
|
|
16
16
|
export const FTC_DISCLOSURE_LINE =
|
|
17
17
|
"Independent editorial review of this article’s text and sources. Not a product endorsement, nor medical advice." as const;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 2.1.0: the line for an article whose review covered its TEXT only (no references or sources section): a byte-faithful
|
|
21
|
+
* copy of the portal's `FTC_DISCLOSURE_LINE_TEXT_ONLY` (Owen, Console decision af5b0db5). Same contract status and curly
|
|
22
|
+
* apostrophe as `FTC_DISCLOSURE_LINE`.
|
|
23
|
+
*/
|
|
24
|
+
export const FTC_DISCLOSURE_LINE_TEXT_ONLY =
|
|
25
|
+
"Independent editorial review of this article’s text. Not a product endorsement, nor medical advice." as const;
|
package/src/reader/render.ts
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
*/
|
|
50
50
|
import { asText } from '../components/escape.js'
|
|
51
51
|
import { CERTREV_LINK_REL } from '../components/rel.js'
|
|
52
|
-
import {
|
|
52
|
+
import { CERT_STRINGS_VERSION, COMPENSATED_EXPERT_CUE, certScopeLineFor } from '../components/render-def.js'
|
|
53
53
|
import type { CertContent } from '../contract/kernel.js'
|
|
54
54
|
import { readerFace } from './face.js'
|
|
55
55
|
import {
|
|
@@ -115,6 +115,13 @@ interface Facts {
|
|
|
115
115
|
/** The joined credential labels, '' when there are none or the rung shows none (named, minimal). */
|
|
116
116
|
readonly creds: string
|
|
117
117
|
readonly hasCue: boolean
|
|
118
|
+
/**
|
|
119
|
+
* The scope sentence, by the signed `expert.reviewScope` (2.1.0, `certScopeLineFor`: `'text'` is the text-only line,
|
|
120
|
+
* anything else the full one). It is DIRECT text of the scope element (the demo's `<span class="dg-scope">`), which
|
|
121
|
+
* carries the `data-ftc-line` marker itself: no inner span, so the element's `.certrev-r-scope em` cue and the sentence
|
|
122
|
+
* are leaves of one element, as the demo paints them. The marker is on exactly one element per render, as before.
|
|
123
|
+
*/
|
|
124
|
+
readonly scope: string
|
|
118
125
|
readonly illus: boolean
|
|
119
126
|
/** Whether the memo is printed: there is one, and the rung is the memo rung. */
|
|
120
127
|
readonly hasMemo: boolean
|
|
@@ -161,6 +168,7 @@ function readFacts(input: ReaderFaceInput): Facts {
|
|
|
161
168
|
showPhoto,
|
|
162
169
|
creds: rung === 'named' || minimal ? '' : labels.join(', '),
|
|
163
170
|
hasCue,
|
|
171
|
+
scope: certScopeLineFor(expert.reviewScope),
|
|
164
172
|
illus: input.illustrative === true && !hasCue,
|
|
165
173
|
hasMemo: !isBlank(content.memo) && rung === 'memo',
|
|
166
174
|
toned: isTonedStyle(style),
|
|
@@ -209,13 +217,6 @@ function scopeLead(f: Facts): string {
|
|
|
209
217
|
return ''
|
|
210
218
|
}
|
|
211
219
|
|
|
212
|
-
/**
|
|
213
|
-
* The scope sentence is DIRECT text of the scope element (the demo's `<span class="dg-scope">`), which carries the
|
|
214
|
-
* `data-ftc-line` marker itself: no inner span, so the element's `.certrev-r-scope em` cue and the sentence are leaves of
|
|
215
|
-
* one element, as the demo paints them. The marker is on exactly one element per render, as before.
|
|
216
|
-
*/
|
|
217
|
-
const SCOPE = CERT_SCOPE_LINE
|
|
218
|
-
|
|
219
220
|
/**
|
|
220
221
|
* The muted credential line, empty when the reviewer has no displayed credential (so no "verified" claim prints).
|
|
221
222
|
*
|
|
@@ -296,7 +297,7 @@ function bannerCard(f: Facts): string {
|
|
|
296
297
|
}
|
|
297
298
|
|
|
298
299
|
// POR-9317: the memo card carries the scope line when there is a memo; with none this card is the sole claim face.
|
|
299
|
-
const scope = scopeOn ? `<div class="certrev-r-scope" data-ftc-disclosure data-ftc-line>${
|
|
300
|
+
const scope = scopeOn ? `<div class="certrev-r-scope" data-ftc-disclosure data-ftc-line>${f.scope}</div>` : ''
|
|
300
301
|
|
|
301
302
|
return (
|
|
302
303
|
`${sectionOpen(f, true, f.minimal ? 'Expert reviewed' : credentialAria(f))}\n <div class="certrev-r-card">\n` +
|
|
@@ -324,7 +325,7 @@ function bannerMemo(f: Facts): string {
|
|
|
324
325
|
` <blockquote>${esc(f.content.memo)}</blockquote>${links}</div>\n </div>\n` +
|
|
325
326
|
' <div class="certrev-r-rule"></div>\n <div class="certrev-r-vfoot">\n' +
|
|
326
327
|
` <span class="certrev-r-verified">${readerLogo('mono', 17, '')}Verified by <b>CertREV</b></span>\n` +
|
|
327
|
-
` <span class="certrev-r-scope" data-ftc-disclosure data-ftc-line>${scopeLead(f)}${
|
|
328
|
+
` <span class="certrev-r-scope" data-ftc-disclosure data-ftc-line>${scopeLead(f)}${f.scope}</span>\n </div>\n </div>\n</section>`
|
|
328
329
|
)
|
|
329
330
|
}
|
|
330
331
|
|
|
@@ -364,7 +365,7 @@ function sidebar(f: Facts): string {
|
|
|
364
365
|
`${open}<div class="certrev-r-side-body">\n <div class="certrev-r-by">${avatar}<div>\n` +
|
|
365
366
|
` <b>${esc(f.ename)}${f.creds !== '' ? `<!-- -->, <!-- -->${esc(f.creds)}` : ''}</b>${verifiedLine(f, false)}</div>\n </div>` +
|
|
366
367
|
`${fold}${more}` +
|
|
367
|
-
`<div class="certrev-r-scope" data-ftc-disclosure data-ftc-line>${scopeLead(f)}${
|
|
368
|
+
`<div class="certrev-r-scope" data-ftc-disclosure data-ftc-line>${scopeLead(f)}${f.scope}</div>\n </div>` +
|
|
368
369
|
`${links}</div>\n</section>`
|
|
369
370
|
)
|
|
370
371
|
}
|
|
@@ -22,9 +22,9 @@ import {
|
|
|
22
22
|
} from '../components/format.js'
|
|
23
23
|
import { CERTREV_LINK_REL } from '../components/rel.js'
|
|
24
24
|
import {
|
|
25
|
-
CERT_SCOPE_LINE,
|
|
26
25
|
CERT_STRINGS_VERSION,
|
|
27
26
|
type CertRenderDef,
|
|
27
|
+
certScopeLineFor,
|
|
28
28
|
resolveRenderTheme,
|
|
29
29
|
themeCssVarDeclarations,
|
|
30
30
|
} from '../components/render-def.js'
|
|
@@ -88,6 +88,8 @@ function attr(name: string, value: string | null | undefined): string {
|
|
|
88
88
|
export function renderBadgeHtml(payload: CertPayload, opts: RenderBadgeOptions = {}): string {
|
|
89
89
|
const content: LooseContent = payload?.content ?? {}
|
|
90
90
|
const expert = content.expert ?? null
|
|
91
|
+
// 2.1.0: the locked scope line the signed `expert.reviewScope` picks ('text' is the text-only line).
|
|
92
|
+
const scopeLine = certScopeLineFor((expert as { readonly reviewScope?: unknown } | null)?.reviewScope)
|
|
91
93
|
const display = resolveDisplay(content.display ?? undefined, opts.accentColor, opts.renderDef)
|
|
92
94
|
const theme = resolveRenderTheme(opts.renderDef)
|
|
93
95
|
const style = badgeFace(opts.badgeStyle ?? display.badgeStyle)
|
|
@@ -155,14 +157,15 @@ export function renderBadgeHtml(payload: CertPayload, opts: RenderBadgeOptions =
|
|
|
155
157
|
// regardless of a render-def, matching the Shopify/WordPress engine fix. The
|
|
156
158
|
// cue's "expert" links to the reviewer profile; the whole cue tag-strips to the
|
|
157
159
|
// byte-verbatim COMPENSATED_EXPERT_CUE. The scope line is byte-verbatim
|
|
158
|
-
// CERT_SCOPE_LINE (its curly apostrophe U+2019 survives escapeHtml untouched).
|
|
160
|
+
// CERT_SCOPE_LINE (its curly apostrophe U+2019 survives escapeHtml untouched), or 2.1.0's CERT_SCOPE_LINE_TEXT_ONLY
|
|
161
|
+
// when the signed `expert.reviewScope` is 'text' (`certScopeLineFor`).
|
|
159
162
|
const cueInner = profileUrl
|
|
160
163
|
? `Compensated <a class="${C}__cue-link" href="${escapeAttribute(profileUrl)}" rel="${CERTREV_LINK_REL}">expert</a>`
|
|
161
164
|
: 'Compensated expert'
|
|
162
165
|
const disclosure =
|
|
163
166
|
`<div class="${C}__disclosure">` +
|
|
164
167
|
`<span class="${C}__compensated-cue">${cueInner}</span>` +
|
|
165
|
-
`<p class="${C}__ftc" data-ftc-disclosure><span data-ftc-line>${escapeHtml(
|
|
168
|
+
`<p class="${C}__ftc" data-ftc-disclosure><span data-ftc-line>${escapeHtml(scopeLine)}</span></p>` +
|
|
166
169
|
`</div>`
|
|
167
170
|
|
|
168
171
|
const verify = verifyUrl
|