@kya-os/consent 0.4.0 → 0.4.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 (226) hide show
  1. package/README.md +182 -22
  2. package/dist/bundle/index.d.ts +4 -0
  3. package/dist/bundle/index.d.ts.map +1 -1
  4. package/dist/bundle/index.js +6 -0
  5. package/dist/bundle/index.js.map +1 -1
  6. package/dist/bundle/inline.d.ts.map +1 -1
  7. package/dist/bundle/inline.js +4 -4
  8. package/dist/bundle/inline.js.map +1 -1
  9. package/dist/cjs/bundle/index.js +15 -1
  10. package/dist/cjs/bundle/index.js.map +1 -1
  11. package/dist/cjs/bundle/inline.js +4 -4
  12. package/dist/cjs/bundle/inline.js.map +1 -1
  13. package/dist/cjs/components/consent-action-bar.js +97 -25
  14. package/dist/cjs/components/consent-action-bar.js.map +1 -1
  15. package/dist/cjs/components/consent-agent-header.js +7 -105
  16. package/dist/cjs/components/consent-agent-header.js.map +1 -1
  17. package/dist/cjs/components/consent-button.js +6 -1
  18. package/dist/cjs/components/consent-button.js.map +1 -1
  19. package/dist/cjs/components/consent-capabilities-screen.js +454 -68
  20. package/dist/cjs/components/consent-capabilities-screen.js.map +1 -1
  21. package/dist/cjs/components/consent-capability-card.js +131 -27
  22. package/dist/cjs/components/consent-capability-card.js.map +1 -1
  23. package/dist/cjs/components/consent-checkbox.js +7 -0
  24. package/dist/cjs/components/consent-checkbox.js.map +1 -1
  25. package/dist/cjs/components/consent-connector-header.js +206 -43
  26. package/dist/cjs/components/consent-connector-header.js.map +1 -1
  27. package/dist/cjs/components/consent-duration.js +1 -1
  28. package/dist/cjs/components/consent-footer.js +13 -12
  29. package/dist/cjs/components/consent-footer.js.map +1 -1
  30. package/dist/cjs/components/consent-headline.js +399 -33
  31. package/dist/cjs/components/consent-headline.js.map +1 -1
  32. package/dist/cjs/components/consent-oauth-button.js +71 -62
  33. package/dist/cjs/components/consent-oauth-button.js.map +1 -1
  34. package/dist/cjs/components/consent-otp-input.js +5 -0
  35. package/dist/cjs/components/consent-otp-input.js.map +1 -1
  36. package/dist/cjs/components/consent-phone-handoff.js +3 -3
  37. package/dist/cjs/components/consent-request-expiry.js +1 -1
  38. package/dist/cjs/components/consent-revocation-notice.js +4 -2
  39. package/dist/cjs/components/consent-revocation-notice.js.map +1 -1
  40. package/dist/cjs/components/consent-revoke.js +9 -4
  41. package/dist/cjs/components/consent-revoke.js.map +1 -1
  42. package/dist/cjs/components/consent-secured-by.js +106 -0
  43. package/dist/cjs/components/consent-secured-by.js.map +1 -0
  44. package/dist/cjs/components/consent-shell.js +1 -1
  45. package/dist/cjs/components/consent-terms.js +7 -0
  46. package/dist/cjs/components/consent-terms.js.map +1 -1
  47. package/dist/cjs/components/consent-wallet-check.js +1 -1
  48. package/dist/cjs/components/consent-wallet-notice.js +1 -1
  49. package/dist/cjs/components/consent-wallet-orb.js +1 -1
  50. package/dist/cjs/components/consent-wallet-signature.js +1 -1
  51. package/dist/cjs/components/decision-icons.js +33 -0
  52. package/dist/cjs/components/decision-icons.js.map +1 -0
  53. package/dist/cjs/components/edit-region.js +309 -0
  54. package/dist/cjs/components/edit-region.js.map +1 -0
  55. package/dist/cjs/components/grant-field-styles.js +2 -2
  56. package/dist/cjs/components/index.js +4 -1
  57. package/dist/cjs/components/index.js.map +1 -1
  58. package/dist/cjs/components/mcp-consent.js +81 -36
  59. package/dist/cjs/components/mcp-consent.js.map +1 -1
  60. package/dist/cjs/components/preview.js +67 -0
  61. package/dist/cjs/components/preview.js.map +1 -0
  62. package/dist/cjs/constants/capabilities.js +12 -2
  63. package/dist/cjs/constants/capabilities.js.map +1 -1
  64. package/dist/cjs/copy/tokens.js +60 -21
  65. package/dist/cjs/copy/tokens.js.map +1 -1
  66. package/dist/cjs/identity/agent-identity.js +3 -2
  67. package/dist/cjs/identity/agent-identity.js.map +1 -1
  68. package/dist/cjs/mcp-app/inline.js +2 -2
  69. package/dist/cjs/mcp-app/inline.js.map +1 -1
  70. package/dist/cjs/react/index.js +11 -2
  71. package/dist/cjs/react/index.js.map +1 -1
  72. package/dist/cjs/styles/brand.js +385 -0
  73. package/dist/cjs/styles/brand.js.map +1 -0
  74. package/dist/cjs/styles/index.js +1 -0
  75. package/dist/cjs/styles/index.js.map +1 -1
  76. package/dist/cjs/styles/theme.js +100 -30
  77. package/dist/cjs/styles/theme.js.map +1 -1
  78. package/dist/cjs/types/capabilities.types.js +1 -2
  79. package/dist/cjs/types/capabilities.types.js.map +1 -1
  80. package/dist/cjs/types/decision.types.js +13 -0
  81. package/dist/cjs/types/decision.types.js.map +1 -0
  82. package/dist/cjs/types/edit.types.js +80 -0
  83. package/dist/cjs/types/edit.types.js.map +1 -0
  84. package/dist/cjs/types/index.js +2 -0
  85. package/dist/cjs/types/index.js.map +1 -1
  86. package/dist/components/consent-action-bar.d.ts +20 -1
  87. package/dist/components/consent-action-bar.d.ts.map +1 -1
  88. package/dist/components/consent-action-bar.js +97 -25
  89. package/dist/components/consent-action-bar.js.map +1 -1
  90. package/dist/components/consent-agent-header.d.ts +4 -17
  91. package/dist/components/consent-agent-header.d.ts.map +1 -1
  92. package/dist/components/consent-agent-header.js +7 -105
  93. package/dist/components/consent-agent-header.js.map +1 -1
  94. package/dist/components/consent-button.d.ts +2 -0
  95. package/dist/components/consent-button.d.ts.map +1 -1
  96. package/dist/components/consent-button.js +6 -1
  97. package/dist/components/consent-button.js.map +1 -1
  98. package/dist/components/consent-capabilities-screen.d.ts +85 -17
  99. package/dist/components/consent-capabilities-screen.d.ts.map +1 -1
  100. package/dist/components/consent-capabilities-screen.js +456 -70
  101. package/dist/components/consent-capabilities-screen.js.map +1 -1
  102. package/dist/components/consent-capability-card.d.ts +23 -3
  103. package/dist/components/consent-capability-card.d.ts.map +1 -1
  104. package/dist/components/consent-capability-card.js +131 -27
  105. package/dist/components/consent-capability-card.js.map +1 -1
  106. package/dist/components/consent-checkbox.d.ts +2 -0
  107. package/dist/components/consent-checkbox.d.ts.map +1 -1
  108. package/dist/components/consent-checkbox.js +7 -0
  109. package/dist/components/consent-checkbox.js.map +1 -1
  110. package/dist/components/consent-connector-header.d.ts +39 -7
  111. package/dist/components/consent-connector-header.d.ts.map +1 -1
  112. package/dist/components/consent-connector-header.js +206 -43
  113. package/dist/components/consent-connector-header.js.map +1 -1
  114. package/dist/components/consent-duration.js +1 -1
  115. package/dist/components/consent-footer.d.ts +6 -4
  116. package/dist/components/consent-footer.d.ts.map +1 -1
  117. package/dist/components/consent-footer.js +13 -12
  118. package/dist/components/consent-footer.js.map +1 -1
  119. package/dist/components/consent-headline.d.ts +55 -16
  120. package/dist/components/consent-headline.d.ts.map +1 -1
  121. package/dist/components/consent-headline.js +398 -34
  122. package/dist/components/consent-headline.js.map +1 -1
  123. package/dist/components/consent-oauth-button.d.ts +7 -3
  124. package/dist/components/consent-oauth-button.d.ts.map +1 -1
  125. package/dist/components/consent-oauth-button.js +74 -65
  126. package/dist/components/consent-oauth-button.js.map +1 -1
  127. package/dist/components/consent-otp-input.d.ts.map +1 -1
  128. package/dist/components/consent-otp-input.js +5 -0
  129. package/dist/components/consent-otp-input.js.map +1 -1
  130. package/dist/components/consent-passkey.d.ts +6 -0
  131. package/dist/components/consent-passkey.d.ts.map +1 -1
  132. package/dist/components/consent-passkey.js +67 -9
  133. package/dist/components/consent-passkey.js.map +1 -1
  134. package/dist/components/consent-phone-handoff.js +3 -3
  135. package/dist/components/consent-request-expiry.js +1 -1
  136. package/dist/components/consent-revocation-notice.d.ts.map +1 -1
  137. package/dist/components/consent-revocation-notice.js +4 -2
  138. package/dist/components/consent-revocation-notice.js.map +1 -1
  139. package/dist/components/consent-revoke.d.ts +2 -0
  140. package/dist/components/consent-revoke.d.ts.map +1 -1
  141. package/dist/components/consent-revoke.js +9 -4
  142. package/dist/components/consent-revoke.js.map +1 -1
  143. package/dist/components/consent-secured-by.d.ts +25 -0
  144. package/dist/components/consent-secured-by.d.ts.map +1 -0
  145. package/dist/components/consent-secured-by.js +103 -0
  146. package/dist/components/consent-secured-by.js.map +1 -0
  147. package/dist/components/consent-shell.js +1 -1
  148. package/dist/components/consent-terms.d.ts +2 -0
  149. package/dist/components/consent-terms.d.ts.map +1 -1
  150. package/dist/components/consent-terms.js +7 -0
  151. package/dist/components/consent-terms.js.map +1 -1
  152. package/dist/components/consent-wallet-check.js +1 -1
  153. package/dist/components/consent-wallet-notice.js +1 -1
  154. package/dist/components/consent-wallet-orb.js +1 -1
  155. package/dist/components/consent-wallet-signature.js +1 -1
  156. package/dist/components/decision-icons.d.ts +22 -0
  157. package/dist/components/decision-icons.d.ts.map +1 -0
  158. package/dist/components/decision-icons.js +30 -0
  159. package/dist/components/decision-icons.js.map +1 -0
  160. package/dist/components/edit-region.d.ts +50 -0
  161. package/dist/components/edit-region.d.ts.map +1 -0
  162. package/dist/components/edit-region.js +305 -0
  163. package/dist/components/edit-region.js.map +1 -0
  164. package/dist/components/grant-field-styles.js +2 -2
  165. package/dist/components/index.d.ts +2 -1
  166. package/dist/components/index.d.ts.map +1 -1
  167. package/dist/components/index.js +2 -1
  168. package/dist/components/index.js.map +1 -1
  169. package/dist/components/mcp-consent.d.ts +15 -0
  170. package/dist/components/mcp-consent.d.ts.map +1 -1
  171. package/dist/components/mcp-consent.js +81 -36
  172. package/dist/components/mcp-consent.js.map +1 -1
  173. package/dist/components/preview.d.ts +38 -0
  174. package/dist/components/preview.d.ts.map +1 -0
  175. package/dist/components/preview.js +61 -0
  176. package/dist/components/preview.js.map +1 -0
  177. package/dist/consent.js +2104 -389
  178. package/dist/consent.min.js +1289 -497
  179. package/dist/constants/capabilities.d.ts +12 -3
  180. package/dist/constants/capabilities.d.ts.map +1 -1
  181. package/dist/constants/capabilities.js +12 -2
  182. package/dist/constants/capabilities.js.map +1 -1
  183. package/dist/copy/tokens.d.ts +60 -21
  184. package/dist/copy/tokens.d.ts.map +1 -1
  185. package/dist/copy/tokens.js +60 -21
  186. package/dist/copy/tokens.js.map +1 -1
  187. package/dist/identity/agent-identity.d.ts +3 -2
  188. package/dist/identity/agent-identity.d.ts.map +1 -1
  189. package/dist/identity/agent-identity.js +3 -2
  190. package/dist/identity/agent-identity.js.map +1 -1
  191. package/dist/mcp-app/inline.d.ts.map +1 -1
  192. package/dist/mcp-app/inline.js +2 -2
  193. package/dist/mcp-app/inline.js.map +1 -1
  194. package/dist/react/index.d.ts +6 -1
  195. package/dist/react/index.d.ts.map +1 -1
  196. package/dist/react/index.js +10 -1
  197. package/dist/react/index.js.map +1 -1
  198. package/dist/styles/brand.d.ts +184 -0
  199. package/dist/styles/brand.d.ts.map +1 -0
  200. package/dist/styles/brand.js +372 -0
  201. package/dist/styles/brand.js.map +1 -0
  202. package/dist/styles/index.d.ts +1 -0
  203. package/dist/styles/index.d.ts.map +1 -1
  204. package/dist/styles/index.js +1 -0
  205. package/dist/styles/index.js.map +1 -1
  206. package/dist/styles/theme.d.ts +73 -13
  207. package/dist/styles/theme.d.ts.map +1 -1
  208. package/dist/styles/theme.js +96 -29
  209. package/dist/styles/theme.js.map +1 -1
  210. package/dist/types/capabilities.types.d.ts +12 -14
  211. package/dist/types/capabilities.types.d.ts.map +1 -1
  212. package/dist/types/capabilities.types.js +1 -2
  213. package/dist/types/capabilities.types.js.map +1 -1
  214. package/dist/types/decision.types.d.ts +57 -0
  215. package/dist/types/decision.types.d.ts.map +1 -0
  216. package/dist/types/decision.types.js +12 -0
  217. package/dist/types/decision.types.js.map +1 -0
  218. package/dist/types/edit.types.d.ts +73 -0
  219. package/dist/types/edit.types.d.ts.map +1 -0
  220. package/dist/types/edit.types.js +76 -0
  221. package/dist/types/edit.types.js.map +1 -0
  222. package/dist/types/index.d.ts +2 -0
  223. package/dist/types/index.d.ts.map +1 -1
  224. package/dist/types/index.js +2 -0
  225. package/dist/types/index.js.map +1 -1
  226. package/package.json +2 -2
@@ -2,11 +2,13 @@
2
2
  /**
3
3
  * Consent Capabilities Screen
4
4
  *
5
- * The composite layout from Peter's mockup: eyebrow + serif headline +
6
- * subhead (consent-headline, its parts exported) + agent identity tile +
7
- * capability rows + revocation notice + action bar + footer. Used when the resolved consent config includes
8
- * `capabilities` (the new humanized layout). Falls back to the legacy
9
- * permissions list otherwise.
5
+ * The consent decision page, as Checkpoint draws it: the connector above a
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
9
+ * details" box (`grantDetails`, else the revocation notice) and Allow and
10
+ * Deny; under the card, "Secured by" and the Vouched lockup, and the host's
11
+ * legal links. Used when the resolved consent config includes `capabilities`.
10
12
  *
11
13
  * This component is purely presentational. It accepts the resolved data
12
14
  * (capabilities, agent metadata, copy values) and emits `capabilities-allow` /
@@ -16,10 +18,20 @@
16
18
  *
17
19
  * Each row's parts are forwarded with a `capability-` prefix
18
20
  * (`capability-row`, `capability-label` and so on, see
19
- * CAPABILITY_ROW_EXPORT_PARTS), and the header above the rows is the
20
- * `section-header` part. A host puts content in a row by giving it
21
- * `slot="capability-<capability id>"`, and words the headline itself through
22
- * the `headline` slot.
21
+ * CAPABILITY_ROW_EXPORT_PARTS). The other parts are `connector`, `card`,
22
+ * `eyebrow`, `headline`, `agent-name`, `host`, `subhead`, `agent-details`,
23
+ * `unverified`, `approver`, `permissions`, `grant-details`, `actions`,
24
+ * `submit`, `cancel` and `below`. A host puts content in a row by giving it
25
+ * `slot="capability-<capability id>"`, words the headline itself through the
26
+ * `headline` slot, replaces the lockup through `footer` and adds its legal
27
+ * links through `legal`.
28
+ *
29
+ * With `preview` the screen draws as it would live and acts on nothing: it
30
+ * sends no `capabilities-allow` or `capabilities-deny`, and no link inside it
31
+ * goes anywhere; rows still tick. With `editable` as well, the subhead, the
32
+ * organization's name (in "Connects to"), each row's label and description
33
+ * and both button labels are regions a person types into (see
34
+ * `CONSENT_EDIT_KEYS`), and the rows stop toggling.
23
35
  *
24
36
  * @module components/consent-capabilities-screen
25
37
  */
@@ -41,11 +53,15 @@ const agent_identity_js_1 = require("../identity/agent-identity.js");
41
53
  const compile_js_1 = require("../cedar/compile.js");
42
54
  const credential_capabilities_js_1 = require("../resolution/credential-capabilities.js");
43
55
  const capabilities_js_1 = require("../constants/capabilities.js");
44
- require("./consent-agent-header.js");
45
- require("./consent-headline.js");
56
+ const edit_types_js_1 = require("../types/edit.types.js");
57
+ const resolve_branding_js_1 = require("../resolution/resolve-branding.js");
58
+ const edit_region_js_1 = require("./edit-region.js");
59
+ const decision_icons_js_1 = require("./decision-icons.js");
60
+ const preview_js_1 = require("./preview.js");
61
+ const consent_headline_js_1 = require("./consent-headline.js");
46
62
  const consent_capability_card_js_1 = require("./consent-capability-card.js");
47
63
  require("./consent-action-bar.js");
48
- require("./consent-footer.js");
64
+ require("./consent-secured-by.js");
49
65
  require("./consent-revocation-notice.js");
50
66
  require("./consent-connector-header.js");
51
67
  const consent_grant_terms_js_1 = require("./consent-grant-terms.js");
@@ -84,8 +100,11 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
84
100
  this.loading = false;
85
101
  /** Blocks approval while allowing the human to decline. */
86
102
  this.disabled = false;
103
+ /** The subhead. Empty draws none. */
87
104
  this.description = "";
88
105
  this.submitLabel = "";
106
+ /** Draw each row's icon tile. */
107
+ this.showIcons = false;
89
108
  this.cancelLabel = "";
90
109
  /**
91
110
  * Seed every capability as selected. The credential path grants a fixed,
@@ -117,9 +136,29 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
117
136
  * reach this screen the same way it reaches the other consent screens.
118
137
  */
119
138
  this.serverLogoUrl = "";
139
+ /**
140
+ * The connector's bridge: `bridge` (default), dashed lines and a shield in
141
+ * the page's tint, or `dots`. Forwarded to the connector header.
142
+ */
143
+ this.connectorVariant = "bridge";
144
+ /**
145
+ * Who carries the connection, such as the host's product name: read out as
146
+ * "{agent} is connecting to {org} via {via}" and shown on the connector's
147
+ * shield. Empty: the connector names only the agent and the org.
148
+ */
149
+ this.via = "";
120
150
  /** Fixed grants require every disclosed capability to remain selected. */
121
151
  this.requireAll = false;
152
+ /**
153
+ * Draws as it would live and acts on nothing: no decision event, no link
154
+ * followed. Every part inside gets it.
155
+ */
156
+ this.preview = false;
157
+ /** With `preview`: the screen's words can be edited in place. */
158
+ this.editable = false;
122
159
  this.selected = new Set();
160
+ /** Whether the host filled the `legal` slot. */
161
+ this.hasLegal = false;
123
162
  /**
124
163
  * Last capability set this component seeded `selected` from, per
125
164
  * `capabilitySeedKey`. Re-seeding is keyed on this value rather than on
@@ -148,7 +187,7 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
148
187
  this.selected = next;
149
188
  };
150
189
  this.onAllow = () => {
151
- if (this.loading || this.approvalDisabled)
190
+ if (this.preview || this.loading || this.approvalDisabled)
152
191
  return;
153
192
  const selectedCapabilities = this.capabilities.filter((c) => this.selected.has(c.id));
154
193
  if (selectedCapabilities.length === 0)
@@ -170,15 +209,21 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
170
209
  }));
171
210
  };
172
211
  this.onDeny = () => {
173
- if (this.loading)
212
+ if (this.preview || this.loading)
174
213
  return;
175
214
  this.dispatchEvent(new CustomEvent("capabilities-deny", { bubbles: true, composed: true }));
176
215
  };
216
+ this.readLegalSlot = (event) => {
217
+ this.hasLegal =
218
+ event.target.assignedNodes({ flatten: true })
219
+ .length > 0;
220
+ };
177
221
  // Grant terms in the `details` slot can turn Allow off and on.
178
222
  const refresh = () => this.requestUpdate();
179
223
  this.addEventListener("consent-grant-terms-change", refresh);
180
224
  for (const type of consent_grant_terms_js_1.GRANT_FIELD_EVENTS)
181
225
  this.addEventListener(type, refresh);
226
+ (0, preview_js_1.guardPreviewNavigation)(this);
182
227
  }
183
228
  connectedCallback() {
184
229
  super.connectedCallback();
@@ -188,6 +233,7 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
188
233
  if (changed.has("capabilities") || changed.has("allSelected")) {
189
234
  this.seedDefaults();
190
235
  }
236
+ (0, preview_js_1.warnIfEditableWithoutPreview)(this);
191
237
  }
192
238
  /**
193
239
  * Seed `selected` from the capability defaults, but only when the
@@ -204,8 +250,12 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
204
250
  this.seedKey = key;
205
251
  this.selected = new Set((0, credential_capabilities_js_1.capabilityIdsFor)(this.capabilities, this.allSelected));
206
252
  }
253
+ /**
254
+ * The theme, as values the page can override: a `--cs-*` property set on
255
+ * this element or on any ancestor wins over the theme's own.
256
+ */
207
257
  hostStyle() {
208
- return `:host { ${(0, theme_js_1.themeToCssVariables)((0, theme_js_1.getConsentTheme)(this.theme))} }`;
258
+ return (0, theme_js_1.themeScopeStyle)((0, theme_js_1.getConsentTheme)(this.theme), ".card, consent-connector-header, .below");
209
259
  }
210
260
  /** Grant terms in the `details` slot. None when rendered without a DOM. */
211
261
  get slottedTerms() {
@@ -248,12 +298,10 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
248
298
  }
249
299
  }
250
300
  render() {
251
- const tokens = tokens_js_1.CONSENT_COPY_TOKENS;
252
301
  const agent = this.resolveAgent();
302
+ // Only an editable preview passes editable on, so no part warns on its own.
303
+ const editing = (0, preview_js_1.isEditing)(this);
253
304
  const agentName = agent?.name || "this agent";
254
- const sectionHeader = (0, tokens_js_1.formatToken)(tokens.section.capabilitiesHeader, {
255
- Agent: agentName.toUpperCase(),
256
- });
257
305
  return (0, lit_1.html) `
258
306
  <style>
259
307
  ${this.hostStyle()}
@@ -267,36 +315,27 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
267
315
  server-logo-url="${this.serverLogoUrl}"
268
316
  server-domain="${this.serverDomain}"
269
317
  logo-dev-token="${this.logoDevToken}"
318
+ variant=${this.connectorVariant}
319
+ via=${this.via}
270
320
  ></consent-connector-header>
271
321
  <div class="card" part="card">
272
322
  <consent-headline
273
- exportparts="eyebrow, headline, subhead"
323
+ exportparts="eyebrow, headline, agent-name, host, subhead, agent-details"
274
324
  agent-name="${agent?.name ?? ""}"
275
- org-name="${this.orgName}"
325
+ .agent=${agent}
276
326
  verb="${this.headlineVerb}"
277
327
  description="${this.description}"
328
+ ?preview=${this.preview}
329
+ ?editable=${editing}
330
+ .editSource=${this.editSource}
278
331
  ><slot name="headline" slot="headline"></slot
279
332
  ></consent-headline>
280
333
  <slot name="recovery"></slot>
334
+ ${this.renderUnverified(agent)}
281
335
  <slot name="identity"></slot>
282
- ${agent
283
- ? (0, lit_1.html) `<consent-agent-header
284
- part="agent"
285
- agentName="${agent.name}"
286
- vendor="${agent.vendor || ""}"
287
- surfaceLabel="${agent.surfaceLabel || ""}"
288
- verification="${(0, capabilities_types_js_1.agentVerification)(agent)}"
289
- domain="${agent.domain || ""}"
290
- logoUrl="${agent.logoUrl || ""}"
291
- connectedAt="${agent.connectedAt || ""}"
292
- ></consent-agent-header>`
293
- : lit_1.nothing}
336
+ ${this.renderApprover()}
294
337
  <slot name="agent-key"></slot>
295
338
  <div part="permissions">
296
- <div class="section-header" part="section-header">
297
- <span>${sectionHeader}</span>
298
- <span class="hint">${tokens.section.tapToToggle}</span>
299
- </div>
300
339
  <div class="rows" @capability-toggle=${this.onCapabilityToggle}>
301
340
  ${this.capabilities.map((capability) => (0, lit_1.html) `
302
341
  <consent-capability-card
@@ -307,8 +346,12 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
307
346
  riskLevel="${capability.riskLevel}"
308
347
  ?checked=${this.selected.has(capability.id)}
309
348
  ?disabled=${this.loading || this.disabled}
349
+ ?show-icon=${this.showIcons}
310
350
  .scopes=${capability.scopes}
311
351
  compiled-cedar="${this.compileCapabilityCedar(capability)}"
352
+ ?preview=${this.preview}
353
+ ?editable=${editing}
354
+ .editSource=${this.editSource}
312
355
  exportparts=${exports.CAPABILITY_ROW_EXPORT_PARTS}
313
356
  ><slot
314
357
  name=${capabilitySlotName(capability.id)}
@@ -320,15 +363,18 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
320
363
  </div>
321
364
  <slot name="auth"></slot>
322
365
  <slot name="details"></slot>
366
+ ${this.renderGrantDetails(editing)}
323
367
  <slot name="notice"
324
- ><consent-revocation-notice
325
- revocationPath="${this.revocationPath}"
326
- orgName="${this.orgName || "this site"}"
327
- inactivityDays=${this.inactivityDays}
328
- ?fixed-expiry=${this.fixedExpiry}
329
- fixed-expiry-days=${this.fixedExpiryDays ?? lit_1.nothing}
330
- ></consent-revocation-notice
331
- ></slot>
368
+ >${this.grantDetails
369
+ ? lit_1.nothing
370
+ : (0, lit_1.html) `<consent-revocation-notice
371
+ revocationPath="${this.revocationPath}"
372
+ orgName="${this.orgName || "this site"}"
373
+ inactivityDays=${this.inactivityDays}
374
+ ?fixed-expiry=${this.fixedExpiry}
375
+ fixed-expiry-days=${this.fixedExpiryDays ?? lit_1.nothing}
376
+ ></consent-revocation-notice>`}</slot
377
+ >
332
378
  <consent-action-bar
333
379
  part="actions"
334
380
  agentName="${agentName}"
@@ -337,28 +383,153 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends lit_1.Li
337
383
  ?disabled=${this.approvalDisabled}
338
384
  submit-label=${this.submitLabel}
339
385
  cancel-label=${this.cancelLabel}
386
+ ?preview=${this.preview}
387
+ ?editable=${editing}
388
+ .editSource=${this.editSource}
340
389
  exportparts="submit, cancel"
341
390
  @consent-allow=${this.onAllow}
342
391
  @consent-deny=${this.onDeny}
343
392
  ></consent-action-bar>
344
- <slot name="footer"
345
- ><consent-footer
346
- theme="${this.theme}"
347
- howItWorksUrl="${this.howItWorksUrl}"
348
- ></consent-footer
349
- ></slot>
393
+ </div>
394
+ <div class="below" part="below">
395
+ <slot name="footer"><consent-secured-by></consent-secured-by></slot>
396
+ ${this.renderLegal()}
350
397
  </div>
351
398
  `;
352
399
  }
400
+ /** The warning for an agent that registered itself: its name is not checked. */
401
+ renderUnverified(agent) {
402
+ if (!agent || (0, capabilities_types_js_1.agentVerification)(agent) !== "unverified")
403
+ return lit_1.nothing;
404
+ const copy = tokens_js_1.CONSENT_COPY_TOKENS;
405
+ return (0, lit_1.html) `<div class="unverified" part="unverified">
406
+ <p class="unverified-heading">
407
+ ${(0, decision_icons_js_1.decisionIcon)("warning")}${copy.unverifiedAgent.heading}
408
+ </p>
409
+ <p class="unverified-body">
410
+ ${copy.agentDetails.unverifiedExplanation}
411
+ ${copy.unverifiedAgent.advice}
412
+ </p>
413
+ </div>`;
414
+ }
415
+ /** Who is signing in, and the checks they passed; nothing when there is neither. */
416
+ renderApprover() {
417
+ const identifier = this.approver?.identifier?.trim() ?? "";
418
+ const checks = (this.approver?.checks ?? []).filter((check) => check.label.trim());
419
+ if (!identifier && checks.length === 0)
420
+ return lit_1.nothing;
421
+ return (0, lit_1.html) `<div class="approver tinted" part="approver">
422
+ ${identifier
423
+ ? (0, lit_1.html) `<div class="signed-in">
424
+ <span class="avatar" aria-hidden="true"
425
+ >${(0, consent_headline_js_1.initialOf)(identifier)}</span
426
+ >
427
+ <span class="who">
428
+ <span class="small"
429
+ >${tokens_js_1.CONSENT_COPY_TOKENS.approver.signedIn}</span
430
+ >
431
+ <span class="identifier">${identifier}</span>
432
+ </span>
433
+ </div>`
434
+ : lit_1.nothing}
435
+ ${checks.map((check, index) => (0, lit_1.html) `<div class="check${identifier || index > 0 ? " ruled" : ""}">
436
+ <span class="check-icon">${(0, decision_icons_js_1.decisionIcon)("check")}</span>
437
+ <span class="who">
438
+ <span class="strong">${check.label}</span>
439
+ ${check.summary ? (0, lit_1.html) `<span>${check.summary}</span>` : lit_1.nothing}
440
+ ${check.source
441
+ ? (0, lit_1.html) `<span class="small">${check.source}</span>`
442
+ : lit_1.nothing}
443
+ </span>
444
+ </div>`)}
445
+ </div>`;
446
+ }
447
+ /** The "Permission details" box, when the host gives `grantDetails`. */
448
+ renderGrantDetails(editing) {
449
+ const details = this.grantDetails;
450
+ if (!details)
451
+ return lit_1.nothing;
452
+ const copy = tokens_js_1.CONSENT_COPY_TOKENS.grantDetails;
453
+ const org = this.orgName.trim();
454
+ const resource = details.resource?.trim() ?? "";
455
+ const orgValue = editing
456
+ ? (0, edit_region_js_1.editRegion)(edit_types_js_1.CONSENT_EDIT_KEYS.orgName, tokens_js_1.CONSENT_COPY_TOKENS.editRegions.orgName, org, this.editSource)
457
+ : org;
458
+ const rows = [];
459
+ if (org || resource || editing) {
460
+ rows.push({
461
+ icon: "resource",
462
+ label: copy.connectsTo,
463
+ values: org || editing ? [orgValue] : [resource],
464
+ ...(resource && (org || editing) ? { note: resource } : {}),
465
+ });
466
+ }
467
+ const fact = (icon, label, given) => {
468
+ const values = (given?.values ?? []).filter((value) => value.trim());
469
+ const note = given?.note?.trim();
470
+ if (values.length > 0 || note) {
471
+ rows.push({ icon, label, values, ...(note ? { note } : {}) });
472
+ }
473
+ };
474
+ fact("duration", copy.duration, details.duration);
475
+ if (details.budget?.trim()) {
476
+ rows.push({
477
+ icon: "budget",
478
+ label: copy.budget,
479
+ values: [details.budget.trim()],
480
+ });
481
+ }
482
+ fact("amountLimits", copy.amountLimits, details.amountLimits);
483
+ fact("alreadyGranted", copy.alreadyGranted, details.alreadyGranted);
484
+ if (rows.length === 0)
485
+ return lit_1.nothing;
486
+ return (0, lit_1.html) `<section
487
+ class="grant-details tinted"
488
+ part="grant-details"
489
+ aria-labelledby="grant-details-heading"
490
+ >
491
+ <h2 id="grant-details-heading">${copy.heading}</h2>
492
+ <dl>
493
+ ${rows.map((row) => (0, lit_1.html) `<div class="fact">
494
+ <span class="fact-icon">${(0, decision_icons_js_1.decisionIcon)(row.icon)}</span>
495
+ <div class="fact-text">
496
+ <dt class="small">${row.label}</dt>
497
+ ${row.values.map((value) => (0, lit_1.html) `<dd class="value">${value}</dd>`)}
498
+ ${row.note
499
+ ? (0, lit_1.html) `<dd class="note small">${row.note}</dd>`
500
+ : lit_1.nothing}
501
+ </div>
502
+ </div>`)}
503
+ </dl>
504
+ </section>`;
505
+ }
506
+ /**
507
+ * The host's legal links, or a "How does this work?" link when the host
508
+ * gives its address; nothing when there is neither.
509
+ */
510
+ renderLegal() {
511
+ const howItWorks = (0, resolve_branding_js_1.sanitizeLinkUrl)(this.howItWorksUrl);
512
+ return (0, lit_1.html) `<div class="legal" ?hidden=${!this.hasLegal && !howItWorks}>
513
+ <slot name="legal" @slotchange=${this.readLegalSlot}
514
+ >${howItWorks
515
+ ? (0, lit_1.html) `<a href=${howItWorks} target="_blank" rel="noopener noreferrer"
516
+ >${tokens_js_1.CONSENT_COPY_TOKENS.attribution.howThisWorks}</a
517
+ >`
518
+ : lit_1.nothing}</slot
519
+ >
520
+ </div>`;
521
+ }
353
522
  };
354
523
  exports.ConsentCapabilitiesScreen = ConsentCapabilitiesScreen;
355
524
  ConsentCapabilitiesScreen.features = capabilities_js_1.CONSENT_CAPABILITIES_FEATURES;
356
525
  ConsentCapabilitiesScreen.styles = (0, lit_1.css) `
526
+ ${edit_region_js_1.editRegionStyles}
527
+
357
528
  :host {
358
529
  display: block;
359
530
  box-sizing: border-box;
360
531
  width: 100%;
361
- max-width: var(--cs-screen-max-width, 560px);
532
+ max-width: var(--cs-screen-max-width, 576px);
362
533
  margin: 0 auto;
363
534
  }
364
535
 
@@ -366,43 +537,231 @@ ConsentCapabilitiesScreen.styles = (0, lit_1.css) `
366
537
  min-width: 0;
367
538
  background: var(--cs-surface-card);
368
539
  border: 1px solid var(--cs-surface-border);
369
- border-radius: 22px;
540
+ border-radius: var(--cs-card-radius, 12px);
370
541
  box-shadow: var(--cs-card-shadow);
371
- padding: var(--cs-card-padding, 28px 28px 22px);
542
+ padding: var(--cs-card-padding, 28px 28px 24px);
372
543
  display: flex;
373
544
  flex-direction: column;
374
545
  gap: var(--cs-card-gap, 22px);
375
546
  color: var(--cs-text-primary);
376
547
  }
377
548
 
378
- .section-header {
549
+ .rows {
550
+ display: flex;
551
+ flex-direction: column;
552
+ }
553
+
554
+ svg {
555
+ flex-shrink: 0;
556
+ }
557
+
558
+ .unverified {
559
+ display: flex;
560
+ flex-direction: column;
561
+ gap: 2px;
562
+ margin-top: 12px;
563
+ font-size: 14px;
564
+ line-height: 1.45;
565
+ }
566
+
567
+ .unverified p {
568
+ margin: 0;
569
+ }
570
+
571
+ .unverified-heading {
572
+ display: flex;
573
+ align-items: center;
574
+ gap: 6px;
575
+ font-weight: 500;
576
+ color: var(--cs-warning-text, #8c4a00);
577
+ }
578
+
579
+ .unverified-heading svg {
580
+ width: 16px;
581
+ height: 16px;
582
+ }
583
+
584
+ .unverified-body {
585
+ color: var(--cs-text-secondary);
586
+ }
587
+
588
+ .tinted {
589
+ border-radius: 12px;
590
+ border: 1px solid var(--cs-tint-line);
591
+ background: var(--cs-tint);
592
+ }
593
+
594
+ .approver {
595
+ margin-top: 16px;
596
+ padding: 12px 16px;
597
+ font-size: 14px;
598
+ line-height: 1.45;
599
+ }
600
+
601
+ .signed-in,
602
+ .check {
379
603
  display: flex;
380
604
  align-items: center;
381
- justify-content: space-between;
382
- font-size: 11px;
383
- letter-spacing: 0.14em;
605
+ gap: 12px;
606
+ }
607
+
608
+ .check {
609
+ align-items: flex-start;
610
+ }
611
+
612
+ .ruled {
613
+ margin-top: 12px;
614
+ padding-top: 12px;
615
+ border-top: 1px solid var(--cs-tint-line);
616
+ }
617
+
618
+ .avatar,
619
+ .check-icon {
620
+ display: grid;
621
+ place-items: center;
622
+ width: 40px;
623
+ height: 40px;
624
+ flex-shrink: 0;
625
+ }
626
+
627
+ .avatar {
628
+ border-radius: 50%;
629
+ background: var(--cs-surface-accent);
630
+ color: var(--cs-surface-accent-text);
384
631
  font-weight: 600;
632
+ }
633
+
634
+ .check-icon {
635
+ color: var(--cs-mark);
636
+ }
637
+
638
+ .check-icon svg {
639
+ width: 20px;
640
+ height: 20px;
641
+ }
642
+
643
+ .who {
644
+ display: flex;
645
+ flex-direction: column;
646
+ gap: 2px;
647
+ min-width: 0;
648
+ }
649
+
650
+ .identifier {
651
+ font-weight: 500;
652
+ overflow: hidden;
653
+ text-overflow: ellipsis;
654
+ white-space: nowrap;
655
+ }
656
+
657
+ .small {
658
+ font-size: 12px;
385
659
  color: var(--cs-text-tertiary);
386
- text-transform: uppercase;
660
+ }
661
+
662
+ .strong {
663
+ font-weight: 500;
664
+ }
665
+
666
+ .grant-details {
667
+ margin-top: 16px;
668
+ padding: 16px;
669
+ font-size: 14px;
670
+ line-height: 1.45;
671
+ }
672
+
673
+ .grant-details h2 {
674
+ margin: 0 0 12px;
675
+ font-size: 14px;
676
+ font-weight: 600;
677
+ }
678
+
679
+ .grant-details dl {
680
+ display: flex;
681
+ flex-direction: column;
387
682
  gap: 12px;
388
- flex-wrap: wrap;
683
+ margin: 0;
389
684
  }
390
685
 
391
- .section-header .hint {
392
- letter-spacing: 0;
393
- font-weight: 400;
394
- text-transform: none;
395
- font-size: 12px;
686
+ .fact {
687
+ display: flex;
688
+ align-items: flex-start;
689
+ gap: 12px;
396
690
  }
397
691
 
398
- .rows {
692
+ .fact-icon {
693
+ display: grid;
694
+ place-items: center;
695
+ width: 32px;
696
+ height: 32px;
697
+ flex-shrink: 0;
698
+ border-radius: 6px;
699
+ border: 1px solid var(--cs-surface-border);
700
+ background: var(--cs-surface-card);
701
+ color: var(--cs-mark);
702
+ }
703
+
704
+ .fact-icon svg {
705
+ width: 16px;
706
+ height: 16px;
707
+ }
708
+
709
+ .fact-text {
399
710
  display: flex;
711
+ flex: 1;
400
712
  flex-direction: column;
713
+ gap: 2px;
714
+ min-width: 0;
715
+ }
716
+
717
+ .fact dd {
718
+ margin: 0;
401
719
  }
402
720
 
403
- @media (max-width: 480px) {
721
+ .fact .value {
722
+ font-weight: 500;
723
+ overflow-wrap: anywhere;
724
+ }
725
+
726
+ .fact .note {
727
+ overflow-wrap: break-word;
728
+ }
729
+
730
+ .below {
731
+ display: flex;
732
+ flex-direction: column;
733
+ align-items: center;
734
+ margin-top: 16px;
735
+ color: var(--cs-text-tertiary);
736
+ }
737
+
738
+ .legal {
739
+ display: flex;
740
+ justify-content: center;
741
+ gap: 20px;
742
+ padding-top: 48px;
743
+ font-size: 12px;
744
+ }
745
+
746
+ .legal a {
747
+ color: inherit;
748
+ text-decoration: underline;
749
+ text-underline-offset: 2px;
750
+ border-radius: 2px;
751
+ }
752
+
753
+ .legal a:hover {
754
+ color: var(--cs-text-primary);
755
+ }
756
+
757
+ .legal a:focus-visible {
758
+ outline: 2px solid var(--cs-focus-ring);
759
+ outline-offset: 2px;
760
+ }
761
+
762
+ @media (max-width: 640px) {
404
763
  .card {
405
- padding: var(--cs-card-padding-mobile, 20px 18px);
764
+ padding: var(--cs-card-padding-mobile, 20px 20px 24px);
406
765
  }
407
766
  }
408
767
  `;
@@ -454,6 +813,15 @@ __decorate([
454
813
  __decorate([
455
814
  (0, decorators_js_1.property)({ type: String, attribute: "submit-label" })
456
815
  ], ConsentCapabilitiesScreen.prototype, "submitLabel", void 0);
816
+ __decorate([
817
+ (0, decorators_js_1.property)({ attribute: false })
818
+ ], ConsentCapabilitiesScreen.prototype, "approver", void 0);
819
+ __decorate([
820
+ (0, decorators_js_1.property)({ attribute: false })
821
+ ], ConsentCapabilitiesScreen.prototype, "grantDetails", void 0);
822
+ __decorate([
823
+ (0, decorators_js_1.property)({ type: Boolean, attribute: "show-icons" })
824
+ ], ConsentCapabilitiesScreen.prototype, "showIcons", void 0);
457
825
  __decorate([
458
826
  (0, decorators_js_1.property)({ type: String, attribute: "cancel-label" })
459
827
  ], ConsentCapabilitiesScreen.prototype, "cancelLabel", void 0);
@@ -472,12 +840,30 @@ __decorate([
472
840
  __decorate([
473
841
  (0, decorators_js_1.property)({ type: String, attribute: "server-logo-url" })
474
842
  ], ConsentCapabilitiesScreen.prototype, "serverLogoUrl", void 0);
843
+ __decorate([
844
+ (0, decorators_js_1.property)({ type: String, attribute: "connector-variant" })
845
+ ], ConsentCapabilitiesScreen.prototype, "connectorVariant", void 0);
846
+ __decorate([
847
+ (0, decorators_js_1.property)({ type: String })
848
+ ], ConsentCapabilitiesScreen.prototype, "via", void 0);
475
849
  __decorate([
476
850
  (0, decorators_js_1.property)({ type: Boolean, attribute: "require-all" })
477
851
  ], ConsentCapabilitiesScreen.prototype, "requireAll", void 0);
852
+ __decorate([
853
+ (0, decorators_js_1.property)({ type: Boolean, reflect: true })
854
+ ], ConsentCapabilitiesScreen.prototype, "preview", void 0);
855
+ __decorate([
856
+ (0, decorators_js_1.property)({ type: Boolean, reflect: true })
857
+ ], ConsentCapabilitiesScreen.prototype, "editable", void 0);
858
+ __decorate([
859
+ (0, decorators_js_1.property)({ attribute: false })
860
+ ], ConsentCapabilitiesScreen.prototype, "editSource", void 0);
478
861
  __decorate([
479
862
  (0, decorators_js_1.state)()
480
863
  ], ConsentCapabilitiesScreen.prototype, "selected", void 0);
864
+ __decorate([
865
+ (0, decorators_js_1.state)()
866
+ ], ConsentCapabilitiesScreen.prototype, "hasLegal", void 0);
481
867
  exports.ConsentCapabilitiesScreen = ConsentCapabilitiesScreen = __decorate([
482
868
  (0, decorators_js_1.customElement)("consent-capabilities-screen")
483
869
  ], ConsentCapabilitiesScreen);