@kya-os/consent 0.5.2 → 0.5.4

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 (82) hide show
  1. package/README.md +25 -8
  2. package/dist/bundle/inline.d.ts.map +1 -1
  3. package/dist/bundle/inline.js +4 -4
  4. package/dist/bundle/inline.js.map +1 -1
  5. package/dist/cjs/bundle/inline.js +4 -4
  6. package/dist/cjs/bundle/inline.js.map +1 -1
  7. package/dist/cjs/components/approver-lockup.js +372 -0
  8. package/dist/cjs/components/approver-lockup.js.map +1 -0
  9. package/dist/cjs/components/consent-capabilities-screen.js +357 -97
  10. package/dist/cjs/components/consent-capabilities-screen.js.map +1 -1
  11. package/dist/cjs/components/consent-headline.js +35 -7
  12. package/dist/cjs/components/consent-headline.js.map +1 -1
  13. package/dist/cjs/components/decision-icons.js +2 -0
  14. package/dist/cjs/components/decision-icons.js.map +1 -1
  15. package/dist/cjs/components/flow-blocks.js +26 -312
  16. package/dist/cjs/components/flow-blocks.js.map +1 -1
  17. package/dist/cjs/components/index.js.map +1 -1
  18. package/dist/cjs/copy/tokens.js +14 -1
  19. package/dist/cjs/copy/tokens.js.map +1 -1
  20. package/dist/cjs/mcp-app/inline.js +2 -2
  21. package/dist/cjs/mcp-app/inline.js.map +1 -1
  22. package/dist/cjs/react/index.js +1 -0
  23. package/dist/cjs/react/index.js.map +1 -1
  24. package/dist/cjs/schemas/capabilities.schemas.js +1 -0
  25. package/dist/cjs/schemas/capabilities.schemas.js.map +1 -1
  26. package/dist/cjs/styles/theme.js +3 -0
  27. package/dist/cjs/styles/theme.js.map +1 -1
  28. package/dist/components/approver-lockup.d.ts +73 -0
  29. package/dist/components/approver-lockup.d.ts.map +1 -0
  30. package/dist/components/approver-lockup.js +365 -0
  31. package/dist/components/approver-lockup.js.map +1 -0
  32. package/dist/components/consent-capabilities-screen.d.ts +88 -8
  33. package/dist/components/consent-capabilities-screen.d.ts.map +1 -1
  34. package/dist/components/consent-capabilities-screen.js +357 -97
  35. package/dist/components/consent-capabilities-screen.js.map +1 -1
  36. package/dist/components/consent-headline.d.ts +15 -3
  37. package/dist/components/consent-headline.d.ts.map +1 -1
  38. package/dist/components/consent-headline.js +35 -7
  39. package/dist/components/consent-headline.js.map +1 -1
  40. package/dist/components/decision-icons.d.ts +2 -0
  41. package/dist/components/decision-icons.d.ts.map +1 -1
  42. package/dist/components/decision-icons.js +2 -0
  43. package/dist/components/decision-icons.js.map +1 -1
  44. package/dist/components/flow-blocks.d.ts +0 -9
  45. package/dist/components/flow-blocks.d.ts.map +1 -1
  46. package/dist/components/flow-blocks.js +26 -309
  47. package/dist/components/flow-blocks.js.map +1 -1
  48. package/dist/components/index.d.ts +1 -1
  49. package/dist/components/index.d.ts.map +1 -1
  50. package/dist/components/index.js.map +1 -1
  51. package/dist/consent.js +907 -606
  52. package/dist/consent.min.js +629 -509
  53. package/dist/copy/tokens.d.ts +14 -1
  54. package/dist/copy/tokens.d.ts.map +1 -1
  55. package/dist/copy/tokens.js +14 -1
  56. package/dist/copy/tokens.js.map +1 -1
  57. package/dist/flow/model.d.ts +1 -1
  58. package/dist/flow/schema.d.ts +12 -12
  59. package/dist/mcp-app/inline.d.ts.map +1 -1
  60. package/dist/mcp-app/inline.js +2 -2
  61. package/dist/mcp-app/inline.js.map +1 -1
  62. package/dist/react/index.d.ts +3 -2
  63. package/dist/react/index.d.ts.map +1 -1
  64. package/dist/react/index.js +1 -0
  65. package/dist/react/index.js.map +1 -1
  66. package/dist/schemas/api.schemas.d.ts +9 -0
  67. package/dist/schemas/api.schemas.d.ts.map +1 -1
  68. package/dist/schemas/capabilities.schemas.d.ts +5 -0
  69. package/dist/schemas/capabilities.schemas.d.ts.map +1 -1
  70. package/dist/schemas/capabilities.schemas.js +1 -0
  71. package/dist/schemas/capabilities.schemas.js.map +1 -1
  72. package/dist/schemas/config.schemas.d.ts +14 -0
  73. package/dist/schemas/config.schemas.d.ts.map +1 -1
  74. package/dist/styles/theme.d.ts +5 -0
  75. package/dist/styles/theme.d.ts.map +1 -1
  76. package/dist/styles/theme.js +3 -0
  77. package/dist/styles/theme.js.map +1 -1
  78. package/dist/types/capabilities.types.d.ts +20 -0
  79. package/dist/types/capabilities.types.d.ts.map +1 -1
  80. package/dist/types/decision.types.d.ts +10 -2
  81. package/dist/types/decision.types.d.ts.map +1 -1
  82. package/package.json +1 -1
@@ -4,8 +4,9 @@
4
4
  *
5
5
  * The consent decision page, as Checkpoint draws it: the connector above a
6
6
  * card holding the eyebrow, the serif headline that names the agent (its name
7
- * opens what is known about it), a warning when the agent registered itself,
8
- * who is signing in (`approver`), the permission rows, the "Permission
7
+ * opens what is known about it), who is authorizing which agent
8
+ * (`approver`, else a warning when the agent registered itself), the
9
+ * permission rows, the "Permission
9
10
  * details" box (`grantDetails`, else the revocation notice) and Allow and
10
11
  * Deny; under the card, "Secured by" and the Vouched lockup, and the host's
11
12
  * legal links. Used when the resolved consent config includes `capabilities`.
@@ -19,11 +20,16 @@
19
20
  * Each row's parts are forwarded with a `capability-` prefix
20
21
  * (`capability-row`, `capability-label` and so on, see
21
22
  * CAPABILITY_ROW_EXPORT_PARTS). The other parts are `connector`, `card`,
22
- * `eyebrow`, `headline`, `agent-name`, `subhead`, `agent-details`,
23
- * `unverified`, `approver`, `permissions`, `section-header` (the eyebrow over
23
+ * `eyebrow`, `headline`, `agent-name`, `merchant-name` (with `headline`),
24
+ * `subhead`, `agent-details`, `info-note`,
25
+ * `unverified`, `approver` (with `approver-check`, `approver-agent` and
26
+ * `agent-status` inside), `permissions`, `section-header` (the eyebrow over
24
27
  * the rows, "What {Agent} can do for you"), `section-hint` ("Tap to toggle"),
25
28
  * `grant-details`, `actions`,
26
- * `submit`, `cancel` and `below`. A host puts content in a row by giving it
29
+ * `submit`, `cancel` and `below`, and, when drawn, `error`, a row's
30
+ * verification (`capability-verify`, `capability-verify-label` and
31
+ * `capability-verify-action`) and its held-scope notice (`capability-held`).
32
+ * A host puts content in a row by giving it
27
33
  * `slot="capability-<capability id>"`, words the headline itself through the
28
34
  * `headline` slot, replaces the lockup through `footer`, adds its legal
29
35
  * links through `legal`, and puts a `consent-wallet-check`
@@ -32,6 +38,14 @@
32
38
  * Text wraps with `text-wrap: pretty`, inherited by every part, so no line
33
39
  * ends on one word where the browser supports it.
34
40
  *
41
+ * A row whose capability has a `check` (an identity check it needs first)
42
+ * shows "Requires verification" and a button with the check's words. The
43
+ * button never ticks the row: it sends `capability-check`, with the rows
44
+ * ticked now plus that one and any grant terms, for the host to run the
45
+ * check. `error` draws a notice at the top of the card that an action
46
+ * failed, and scrolls it into view each time it is set; clear it when the
47
+ * next action starts.
48
+ *
35
49
  * With `preview` the screen draws as it would live and acts on nothing: it
36
50
  * sends no `capabilities-allow` or `capabilities-deny`, and no link inside it
37
51
  * goes anywhere; rows still tick. With `editable` as well, the subhead, the
@@ -61,13 +75,15 @@ const credential_capabilities_js_1 = require("../resolution/credential-capabilit
61
75
  const capabilities_js_1 = require("../constants/capabilities.js");
62
76
  const edit_types_js_1 = require("../types/edit.types.js");
63
77
  const resolve_branding_js_1 = require("../resolution/resolve-branding.js");
78
+ const copy_js_1 = require("../flow/copy.js");
64
79
  const edit_region_js_1 = require("./edit-region.js");
80
+ const approver_lockup_js_1 = require("./approver-lockup.js");
65
81
  const decision_icons_js_1 = require("./decision-icons.js");
66
82
  const preview_js_1 = require("./preview.js");
67
- const consent_headline_js_1 = require("./consent-headline.js");
68
83
  const consent_capability_card_js_1 = require("./consent-capability-card.js");
69
84
  const grant_details_js_1 = require("./grant-details.js");
70
85
  require("./consent-action-bar.js");
86
+ require("./consent-headline.js");
71
87
  require("./consent-secured-by.js");
72
88
  require("./consent-revocation-notice.js");
73
89
  require("./consent-connector-header.js");
@@ -104,12 +120,39 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
104
120
  this.fixedExpiry = false;
105
121
  this.theme = "light";
106
122
  this.howItWorksUrl = "";
123
+ /**
124
+ * That the last action failed, in words for the person, such as the
125
+ * server's refusal. Drawn at the top of the card as an alert. Empty: none.
126
+ */
127
+ this.error = "";
107
128
  this.loading = false;
108
129
  /** Blocks approval while allowing the human to decline. */
109
130
  this.disabled = false;
131
+ /** The line over the headline. Empty gives "PERMISSION REQUEST". */
132
+ this.eyebrow = "";
133
+ /**
134
+ * The headline, with `{Agent}`, `{Verb}` (`headlineVerb`) and `{Merchant}`
135
+ * (`orgName`) in it. The agent's name stays the button that opens its
136
+ * details, and the merchant's is in italics. Empty, or naming a verb or
137
+ * merchant that isn't given, gives the standard line. The `headline` slot
138
+ * wins over it.
139
+ */
140
+ this.headline = "";
141
+ /**
142
+ * A note under "Permission details", such as how long access lasts, with
143
+ * `{Agent}`, `{Verb}` and `{Merchant}` filled in as plain text. Empty draws
144
+ * none.
145
+ */
146
+ this.infoNote = "";
110
147
  /** The subhead. Empty draws none. */
111
148
  this.description = "";
112
149
  this.submitLabel = "";
150
+ /**
151
+ * Scopes an earlier approval already holds. A row that grants one says, once
152
+ * unticked, that the scope stays granted, since unticking it here doesn't
153
+ * withdraw the earlier grant.
154
+ */
155
+ this.heldScopes = [];
113
156
  /** Draw each row's icon tile. */
114
157
  this.showIcons = false;
115
158
  /** Leave out every row's HIGHER RISK chip (each row's riskLevel is unchanged). */
@@ -200,19 +243,9 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
200
243
  this.onAllow = () => {
201
244
  if (this.preview || this.loading || this.approvalDisabled)
202
245
  return;
203
- const selectedCapabilities = this.capabilities.filter((c) => this.selected.has(c.id));
204
- if (selectedCapabilities.length === 0)
246
+ const detail = this.approvalDetail(this.selected);
247
+ if (!detail)
205
248
  return;
206
- const selectedIds = selectedCapabilities.map((c) => c.id);
207
- const selectedScopes = Array.from(new Set(selectedCapabilities.flatMap((c) => c.scopes)));
208
- const terms = this.slottedTerms;
209
- const detail = {
210
- selectedCapabilityIds: selectedIds,
211
- selectedScopes,
212
- ...(terms.length > 0
213
- ? { grantTerms: (0, terms_js_1.mergeGrantTerms)(...terms.map((t) => t.grantTerms)) }
214
- : {}),
215
- };
216
249
  this.dispatchEvent(new CustomEvent("capabilities-allow", {
217
250
  detail,
218
251
  bubbles: true,
@@ -240,6 +273,15 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
240
273
  super.connectedCallback();
241
274
  this.seedDefaults();
242
275
  }
276
+ updated(changed) {
277
+ // The notice sits at the top of the card and Allow at its bottom, so a
278
+ // new error starts off screen.
279
+ if (changed.has("error") && this.error) {
280
+ this.renderRoot
281
+ .querySelector(".error")
282
+ ?.scrollIntoView?.({ block: "nearest" });
283
+ }
284
+ }
243
285
  willUpdate(changed) {
244
286
  if (changed.has("capabilities") || changed.has("allSelected")) {
245
287
  this.seedDefaults();
@@ -280,6 +322,38 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
280
322
  (this.requireAll &&
281
323
  this.capabilities.some((capability) => !this.selected.has(capability.id))));
282
324
  }
325
+ /** What approving `selected` sends: its rows, their scopes and any grant terms. */
326
+ approvalDetail(selected) {
327
+ const selectedCapabilities = this.capabilities.filter((c) => selected.has(c.id));
328
+ if (selectedCapabilities.length === 0)
329
+ return null;
330
+ const terms = this.slottedTerms;
331
+ return {
332
+ selectedCapabilityIds: selectedCapabilities.map((c) => c.id),
333
+ selectedScopes: Array.from(new Set(selectedCapabilities.flatMap((c) => c.scopes))),
334
+ ...(terms.length > 0
335
+ ? { grantTerms: (0, terms_js_1.mergeGrantTerms)(...terms.map((t) => t.grantTerms)) }
336
+ : {}),
337
+ };
338
+ }
339
+ /** A row's check can't start while the screen is busy or its terms can't be used. */
340
+ get checkDisabled() {
341
+ return (this.loading ||
342
+ this.disabled ||
343
+ this.slottedTerms.some((terms) => terms.valid === false));
344
+ }
345
+ onCheck(capability) {
346
+ if (this.preview || this.checkDisabled)
347
+ return;
348
+ const approval = this.approvalDetail(new Set([...this.selected, capability.id]));
349
+ if (!approval)
350
+ return;
351
+ this.dispatchEvent(new CustomEvent("capability-check", {
352
+ detail: { ...approval, capabilityId: capability.id },
353
+ bubbles: true,
354
+ composed: true,
355
+ }));
356
+ }
283
357
  compileCapabilityCedar(capability) {
284
358
  const cedar = capability.cedar?.trim() || "";
285
359
  if (!cedar)
@@ -313,6 +387,11 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
313
387
  // Only an editable preview passes editable on, so no part warns on its own.
314
388
  const editing = (0, preview_js_1.isEditing)(this);
315
389
  const agentName = agent?.name || "this agent";
390
+ const approver = this.renderApprover(agent);
391
+ // A box that names the agent shows its status, so it stands in for the warning.
392
+ const warning = approver !== lit_1.nothing && agent?.name
393
+ ? lit_1.nothing
394
+ : this.renderUnverified(agent);
316
395
  return (0, lit_1.html) `
317
396
  <style>
318
397
  ${this.hostStyle()}
@@ -333,20 +412,28 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
333
412
  ></consent-connector-header>
334
413
  <div class="card" part="card">
335
414
  <consent-headline
336
- exportparts="eyebrow, headline, agent-name, subhead, agent-details"
415
+ exportparts="eyebrow, headline, agent-name, merchant-name, subhead, agent-details"
337
416
  agent-name="${agent?.name ?? ""}"
338
417
  .agent=${agent}
339
418
  verb="${this.headlineVerb}"
419
+ eyebrow="${this.eyebrow}"
420
+ template="${this.headline}"
421
+ merchant="${this.orgName}"
340
422
  description="${this.description}"
341
423
  ?preview=${this.preview}
342
424
  ?editable=${editing}
343
425
  .editSource=${this.editSource}
344
426
  ><slot name="headline" slot="headline"></slot
345
427
  ></consent-headline>
428
+ ${this.error
429
+ ? (0, lit_1.html) `<p class="error" part="error" role="alert">
430
+ ${(0, decision_icons_js_1.decisionIcon)("warning")}<span>${this.error}</span>
431
+ </p>`
432
+ : lit_1.nothing}
346
433
  <slot name="recovery"></slot>
347
- ${this.renderUnverified(agent)}
434
+ ${warning}
348
435
  <slot name="identity"></slot>
349
- ${this.renderApprover()}
436
+ ${approver}
350
437
  <slot name="agent-key"></slot>
351
438
  <div part="permissions">
352
439
  ${this.renderSectionHeader(agentName, editing)}
@@ -369,7 +456,9 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
369
456
  ?editable=${editing}
370
457
  .editSource=${this.editSource}
371
458
  exportparts=${exports.CAPABILITY_ROW_EXPORT_PARTS}
372
- ><slot
459
+ >${capability.check
460
+ ? this.renderCheck(capability, capability.check.action)
461
+ : lit_1.nothing}${this.renderHeld(capability)}<slot
373
462
  name=${capabilitySlotName(capability.id)}
374
463
  slot="extra"
375
464
  ></slot
@@ -379,7 +468,7 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
379
468
  </div>
380
469
  <slot name="auth"></slot>
381
470
  <slot name="details"></slot>
382
- ${this.renderGrantDetails(editing)}
471
+ ${this.renderGrantDetails(editing)} ${this.renderInfoNote(agentName)}
383
472
  <slot name="notice"
384
473
  >${this.grantDetails
385
474
  ? lit_1.nothing
@@ -435,12 +524,66 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
435
524
  : lit_1.nothing}
436
525
  </div>`;
437
526
  }
527
+ /**
528
+ * "Requires verification" and the button that starts a row's check. It is
529
+ * in the row's `extra` slot, whose clicks the row leaves alone.
530
+ */
531
+ renderCheck(capability, action) {
532
+ return (0, lit_1.html) `<div
533
+ slot="extra"
534
+ class="row-check tinted"
535
+ part="capability-verify"
536
+ data-capability-check=${capability.id}
537
+ >
538
+ <span class="row-check-label" part="capability-verify-label"
539
+ >${(0, decision_icons_js_1.decisionIcon)("shield")}${tokens_js_1.CONSENT_COPY_TOKENS.capabilityRow
540
+ .checkRequired}</span
541
+ >
542
+ <button
543
+ type="button"
544
+ class="row-check-action"
545
+ part="capability-verify-action"
546
+ ?disabled=${this.checkDisabled}
547
+ @click=${() => this.onCheck(capability)}
548
+ >
549
+ <span>${action}</span>${(0, decision_icons_js_1.decisionIcon)("arrowRight")}
550
+ </button>
551
+ </div>`;
552
+ }
553
+ /**
554
+ * "<scope> stays granted because of your earlier approval." under an
555
+ * unticked row, for each scope of it that an earlier approval holds. The
556
+ * live region stays while the row is ticked, so the words are announced as
557
+ * they appear.
558
+ */
559
+ renderHeld(capability) {
560
+ const held = new Set(this.heldScopes);
561
+ const scopes = [...new Set(capability.scopes ?? [])].filter((scope) => held.has(scope));
562
+ if (scopes.length === 0)
563
+ return lit_1.nothing;
564
+ const unticked = !this.selected.has(capability.id);
565
+ const words = (0, copy_js_1.splitTemplate)(tokens_js_1.CONSENT_COPY_TOKENS.capabilityRow.heldNotice);
566
+ return (0, lit_1.html) `<div
567
+ slot="extra"
568
+ class="held"
569
+ part="capability-held"
570
+ role="status"
571
+ >
572
+ ${unticked
573
+ ? scopes.map((scope) => (0, lit_1.html) `<p class="held-notice" data-held-scope=${scope}>
574
+ ${words.map((part) => part.name === "Scope"
575
+ ? (0, lit_1.html) `<code class="held-scope">${scope}</code>`
576
+ : (part.text ?? ""))}
577
+ </p>`)
578
+ : lit_1.nothing}
579
+ </div>`;
580
+ }
438
581
  /** The warning for an agent that registered itself: its name is not checked. */
439
582
  renderUnverified(agent) {
440
583
  if (!agent || (0, capabilities_types_js_1.agentVerification)(agent) !== "unverified")
441
584
  return lit_1.nothing;
442
585
  const copy = tokens_js_1.CONSENT_COPY_TOKENS;
443
- return (0, lit_1.html) `<div class="unverified" part="unverified">
586
+ return (0, lit_1.html) `<div class="unverified-note" part="unverified">
444
587
  <p class="unverified-heading">${copy.unverifiedAgent.heading}</p>
445
588
  <p class="unverified-body">
446
589
  ${copy.agentDetails.unverifiedExplanation}
@@ -448,37 +591,60 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
448
591
  </p>
449
592
  </div>`;
450
593
  }
451
- /** Who is signing in, and the checks they passed; nothing when there is neither. */
452
- renderApprover() {
594
+ /**
595
+ * Who is signing in and the checks they passed, over the agent they
596
+ * authorize; nothing when there is no identifier, name or check.
597
+ */
598
+ renderApprover(agent) {
599
+ const copy = tokens_js_1.CONSENT_COPY_TOKENS;
453
600
  const identifier = this.approver?.identifier?.trim() ?? "";
601
+ const name = this.approver?.name?.trim() ?? "";
602
+ const method = this.approver?.method?.trim() ?? "";
454
603
  const checks = (this.approver?.checks ?? []).filter((check) => check.label.trim());
455
- if (!identifier && checks.length === 0)
604
+ const shown = name || identifier;
605
+ if (!shown && checks.length === 0)
456
606
  return lit_1.nothing;
457
- return (0, lit_1.html) `<div class="approver tinted" part="approver">
458
- ${identifier
459
- ? (0, lit_1.html) `<div class="signed-in">
460
- <span class="avatar" aria-hidden="true"
461
- >${(0, consent_headline_js_1.initialOf)(identifier)}</span
462
- >
463
- <span class="who">
464
- <span class="small"
465
- >${tokens_js_1.CONSENT_COPY_TOKENS.approver.signedIn}</span
466
- >
467
- <span class="identifier">${identifier}</span>
468
- </span>
469
- </div>`
470
- : lit_1.nothing}
471
- ${checks.map((check, index) => (0, lit_1.html) `<div class="check${identifier || index > 0 ? " ruled" : ""}">
472
- <span class="check-icon">${(0, decision_icons_js_1.decisionIcon)("check")}</span>
473
- <span class="who">
474
- <span class="strong">${check.label}</span>
475
- ${check.summary ? (0, lit_1.html) `<span>${check.summary}</span>` : lit_1.nothing}
476
- ${check.source
477
- ? (0, lit_1.html) `<span class="small">${check.source}</span>`
478
- : lit_1.nothing}
479
- </span>
480
- </div>`)}
481
- </div>`;
607
+ const under = name && identifier && identifier !== name ? identifier : "";
608
+ return (0, approver_lockup_js_1.approverLockup)({
609
+ person: shown
610
+ ? {
611
+ label: copy.approver.label,
612
+ name: shown,
613
+ identifier,
614
+ detail: under || method,
615
+ mark: method
616
+ ? (0, tokens_js_1.formatToken)(copy.approver.signedInWith, { Method: method })
617
+ : copy.approver.signedInMark,
618
+ }
619
+ : undefined,
620
+ checks,
621
+ agent: agent?.name ? this.lockupAgent(agent) : undefined,
622
+ });
623
+ }
624
+ /**
625
+ * The agent's row: its name and tile, with "Unverified" or the domain it is
626
+ * identified by. Each status has an info button: the unverified one says
627
+ * what that means, and the domain one carries the host's `identityNote`
628
+ * when it gives one.
629
+ */
630
+ lockupAgent(agent) {
631
+ const copy = tokens_js_1.CONSENT_COPY_TOKENS;
632
+ const unverified = (0, capabilities_types_js_1.agentVerification)(agent) === "unverified";
633
+ const domain = agent.domain?.trim() ?? "";
634
+ return {
635
+ name: agent.name,
636
+ logoUrl: agent.logoUrl,
637
+ label: copy.approver.party,
638
+ status: unverified
639
+ ? copy.agentDetails.unverified
640
+ : domain
641
+ ? (0, tokens_js_1.formatToken)(copy.agentDetails.identifiedBy, { Host: domain })
642
+ : "",
643
+ unverified,
644
+ info: unverified
645
+ ? `${copy.agentDetails.unverifiedExplanation} ${copy.unverifiedAgent.advice}`
646
+ : (domain && agent.identityNote?.trim()) || undefined,
647
+ };
482
648
  }
483
649
  /** The "Permission details" box, when the host gives `grantDetails`. */
484
650
  renderGrantDetails(editing) {
@@ -491,6 +657,21 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
491
657
  : org;
492
658
  return (0, grant_details_js_1.grantDetailsSection)((0, grant_details_js_1.grantDetailRows)(details, org || editing ? orgValue : ""));
493
659
  }
660
+ /** The host's note under "Permission details"; nothing without one. */
661
+ renderInfoNote(agentName) {
662
+ const words = this.infoNote.trim();
663
+ if (!words)
664
+ return lit_1.nothing;
665
+ return (0, lit_1.html) `<p class="info-note tinted" part="info-note">
666
+ ${(0, decision_icons_js_1.decisionIcon)("info")}<span
667
+ >${(0, tokens_js_1.formatToken)(words, {
668
+ Agent: agentName,
669
+ Verb: this.headlineVerb.trim(),
670
+ Merchant: this.orgName.trim(),
671
+ })}</span
672
+ >
673
+ </p>`;
674
+ }
494
675
  /**
495
676
  * The host's legal links, or a "How does this work?" link when the host
496
677
  * gives its address; nothing when there is neither.
@@ -513,6 +694,7 @@ ConsentCapabilitiesScreen.features = capabilities_js_1.CONSENT_CAPABILITIES_FEAT
513
694
  ConsentCapabilitiesScreen.styles = (0, lit_1.css) `
514
695
  ${edit_region_js_1.editRegionStyles}
515
696
  ${grant_details_js_1.grantDetailStyles}
697
+ ${approver_lockup_js_1.approverLockupStyles}
516
698
 
517
699
  /* The box is on an inner element: a page's reset (such as
518
700
  Tailwind's "* { padding: 0; margin: 0; border: 0 }") reaches the host,
@@ -574,7 +756,7 @@ ConsentCapabilitiesScreen.styles = (0, lit_1.css) `
574
756
  flex-shrink: 0;
575
757
  }
576
758
 
577
- .unverified {
759
+ .unverified-note {
578
760
  display: flex;
579
761
  flex-direction: column;
580
762
  gap: 2px;
@@ -583,7 +765,7 @@ ConsentCapabilitiesScreen.styles = (0, lit_1.css) `
583
765
  line-height: 1.45;
584
766
  }
585
767
 
586
- .unverified p {
768
+ .unverified-note p {
587
769
  margin: 0;
588
770
  }
589
771
 
@@ -602,67 +784,134 @@ ConsentCapabilitiesScreen.styles = (0, lit_1.css) `
602
784
  background: var(--cs-tint);
603
785
  }
604
786
 
605
- .approver {
606
- margin-top: 16px;
607
- padding: 12px 16px;
787
+ .error {
788
+ display: flex;
789
+ align-items: flex-start;
790
+ gap: 8px;
791
+ margin: 16px 0 0;
608
792
  font-size: 14px;
609
793
  line-height: 1.45;
794
+ color: var(--cs-error-text, var(--cs-text-primary));
610
795
  }
611
796
 
612
- .signed-in,
613
- .check {
614
- display: flex;
615
- align-items: center;
616
- gap: 12px;
797
+ .error svg {
798
+ flex: none;
799
+ width: 16px;
800
+ height: 16px;
801
+ margin-top: 2px;
617
802
  }
618
803
 
619
- .check {
804
+ /* Under "Permission details": the card's gap alone spaces it, as in consent-flow. */
805
+ .info-note {
806
+ display: flex;
620
807
  align-items: flex-start;
808
+ gap: 8px;
809
+ margin: 0;
810
+ padding: 12px 14px;
811
+ font-size: 13px;
812
+ line-height: 1.45;
813
+ color: var(--cs-text-secondary);
621
814
  }
622
815
 
623
- .ruled {
624
- margin-top: 12px;
625
- padding-top: 12px;
626
- border-top: 1px solid var(--cs-tint-line);
816
+ .info-note svg {
817
+ width: 16px;
818
+ height: 16px;
819
+ margin-top: 2px;
820
+ color: var(--cs-text-tertiary);
627
821
  }
628
822
 
629
- .avatar,
630
- .check-icon {
631
- display: grid;
632
- place-items: center;
633
- width: 40px;
634
- height: 40px;
635
- flex-shrink: 0;
823
+ .held-notice {
824
+ margin: 6px 0 0;
825
+ font-size: 13px;
826
+ line-height: 1.45;
827
+ color: var(--cs-text-secondary);
828
+ }
829
+
830
+ .held-scope {
831
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
832
+ font-size: 12px;
833
+ color: var(--cs-text-primary);
834
+ word-break: break-all;
636
835
  }
637
836
 
638
- .avatar {
639
- border-radius: 50%;
640
- background: var(--cs-surface-accent);
641
- color: var(--cs-surface-accent-text);
837
+ .row-check {
838
+ display: flex;
839
+ flex-wrap: wrap;
840
+ align-items: center;
841
+ justify-content: space-between;
842
+ gap: 6px 12px;
843
+ margin-top: 4px;
844
+ padding: 8px 12px;
845
+ border-radius: 8px;
846
+ }
847
+
848
+ .row-check-label {
849
+ display: inline-flex;
850
+ align-items: center;
851
+ gap: 6px;
852
+ font-size: 14px;
853
+ font-weight: 500;
854
+ color: var(--cs-text-primary);
855
+ }
856
+
857
+ .row-check-label svg {
858
+ flex: none;
859
+ width: 16px;
860
+ height: 16px;
861
+ color: var(--cs-mark, var(--cs-text-primary));
862
+ }
863
+
864
+ .row-check-action {
865
+ display: inline-flex;
866
+ align-items: center;
867
+ gap: 4px;
868
+ margin-left: auto;
869
+ padding: 0;
870
+ border: 0;
871
+ border-radius: 4px;
872
+ background: transparent;
873
+ font: inherit;
874
+ font-size: 14px;
642
875
  font-weight: 600;
876
+ color: var(--cs-action, var(--cs-text-primary));
877
+ cursor: pointer;
643
878
  }
644
879
 
645
- .check-icon {
646
- color: var(--cs-mark);
880
+ .row-check-action span {
881
+ text-decoration: underline;
882
+ text-decoration-thickness: 0.1em;
883
+ text-underline-offset: 0.25em;
647
884
  }
648
885
 
649
- .check-icon svg {
650
- width: 20px;
651
- height: 20px;
886
+ .row-check-action svg {
887
+ flex: none;
888
+ width: 14px;
889
+ height: 14px;
890
+ transition: transform 150ms ease-out;
652
891
  }
653
892
 
654
- .who {
655
- display: flex;
656
- flex-direction: column;
657
- gap: 2px;
658
- min-width: 0;
893
+ .row-check-action:hover:not(:disabled) svg {
894
+ transform: translateX(2px);
659
895
  }
660
896
 
661
- .identifier {
662
- font-weight: 500;
663
- overflow: hidden;
664
- text-overflow: ellipsis;
665
- white-space: nowrap;
897
+ .row-check-action:focus-visible {
898
+ outline: 2px solid var(--cs-focus-ring);
899
+ outline-offset: 2px;
900
+ }
901
+
902
+ .row-check-action:disabled {
903
+ cursor: not-allowed;
904
+ opacity: 0.6;
905
+ }
906
+
907
+ @media (prefers-reduced-motion: reduce) {
908
+ .row-check-action svg {
909
+ transition: none;
910
+ }
911
+ }
912
+
913
+ .lockup {
914
+ margin-top: 16px;
666
915
  }
667
916
 
668
917
  .small {
@@ -670,10 +919,6 @@ ConsentCapabilitiesScreen.styles = (0, lit_1.css) `
670
919
  color: var(--cs-text-tertiary);
671
920
  }
672
921
 
673
- .strong {
674
- font-weight: 500;
675
- }
676
-
677
922
  .below {
678
923
  display: flex;
679
924
  flex-direction: column;
@@ -748,12 +993,24 @@ __decorate([
748
993
  __decorate([
749
994
  (0, decorators_js_1.property)({ type: String, attribute: "how-it-works-url" })
750
995
  ], ConsentCapabilitiesScreen.prototype, "howItWorksUrl", void 0);
996
+ __decorate([
997
+ (0, decorators_js_1.property)({ type: String })
998
+ ], ConsentCapabilitiesScreen.prototype, "error", void 0);
751
999
  __decorate([
752
1000
  (0, decorators_js_1.property)({ type: Boolean })
753
1001
  ], ConsentCapabilitiesScreen.prototype, "loading", void 0);
754
1002
  __decorate([
755
1003
  (0, decorators_js_1.property)({ type: Boolean })
756
1004
  ], ConsentCapabilitiesScreen.prototype, "disabled", void 0);
1005
+ __decorate([
1006
+ (0, decorators_js_1.property)({ type: String })
1007
+ ], ConsentCapabilitiesScreen.prototype, "eyebrow", void 0);
1008
+ __decorate([
1009
+ (0, decorators_js_1.property)({ type: String })
1010
+ ], ConsentCapabilitiesScreen.prototype, "headline", void 0);
1011
+ __decorate([
1012
+ (0, decorators_js_1.property)({ type: String, attribute: "info-note" })
1013
+ ], ConsentCapabilitiesScreen.prototype, "infoNote", void 0);
757
1014
  __decorate([
758
1015
  (0, decorators_js_1.property)({ type: String })
759
1016
  ], ConsentCapabilitiesScreen.prototype, "description", void 0);
@@ -763,6 +1020,9 @@ __decorate([
763
1020
  __decorate([
764
1021
  (0, decorators_js_1.property)({ attribute: false })
765
1022
  ], ConsentCapabilitiesScreen.prototype, "approver", void 0);
1023
+ __decorate([
1024
+ (0, decorators_js_1.property)({ attribute: false })
1025
+ ], ConsentCapabilitiesScreen.prototype, "heldScopes", void 0);
766
1026
  __decorate([
767
1027
  (0, decorators_js_1.property)({ attribute: false })
768
1028
  ], ConsentCapabilitiesScreen.prototype, "grantDetails", void 0);