@kya-os/consent 0.5.1 → 0.5.3

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