@kya-os/consent 0.4.0 → 0.4.2

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 (296) hide show
  1. package/README.md +186 -22
  2. package/dist/bundle/index.d.ts +9 -0
  3. package/dist/bundle/index.d.ts.map +1 -1
  4. package/dist/bundle/index.js +13 -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 +36 -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 +456 -117
  20. package/dist/cjs/components/consent-capabilities-screen.js.map +1 -1
  21. package/dist/cjs/components/consent-capability-card.js +159 -32
  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 +262 -45
  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-flow-timeline.js +177 -0
  29. package/dist/cjs/components/consent-flow-timeline.js.map +1 -0
  30. package/dist/cjs/components/consent-flow.js +540 -0
  31. package/dist/cjs/components/consent-flow.js.map +1 -0
  32. package/dist/cjs/components/consent-footer.js +22 -14
  33. package/dist/cjs/components/consent-footer.js.map +1 -1
  34. package/dist/cjs/components/consent-headline.js +353 -33
  35. package/dist/cjs/components/consent-headline.js.map +1 -1
  36. package/dist/cjs/components/consent-oauth-button.js +68 -138
  37. package/dist/cjs/components/consent-oauth-button.js.map +1 -1
  38. package/dist/cjs/components/consent-otp-input.js +5 -0
  39. package/dist/cjs/components/consent-otp-input.js.map +1 -1
  40. package/dist/cjs/components/consent-phone-handoff.js +3 -3
  41. package/dist/cjs/components/consent-request-expiry.js +1 -1
  42. package/dist/cjs/components/consent-revocation-notice.js +29 -18
  43. package/dist/cjs/components/consent-revocation-notice.js.map +1 -1
  44. package/dist/cjs/components/consent-revoke.js +9 -4
  45. package/dist/cjs/components/consent-revoke.js.map +1 -1
  46. package/dist/cjs/components/consent-secured-by.js +106 -0
  47. package/dist/cjs/components/consent-secured-by.js.map +1 -0
  48. package/dist/cjs/components/consent-shell.js +1 -1
  49. package/dist/cjs/components/consent-terms.js +7 -0
  50. package/dist/cjs/components/consent-terms.js.map +1 -1
  51. package/dist/cjs/components/consent-wallet-check.js +26 -2
  52. package/dist/cjs/components/consent-wallet-check.js.map +1 -1
  53. package/dist/cjs/components/consent-wallet-notice.js +1 -1
  54. package/dist/cjs/components/consent-wallet-orb.js +1 -1
  55. package/dist/cjs/components/consent-wallet-signature.js +1 -1
  56. package/dist/cjs/components/decision-icons.js +37 -0
  57. package/dist/cjs/components/decision-icons.js.map +1 -0
  58. package/dist/cjs/components/edit-region.js +309 -0
  59. package/dist/cjs/components/edit-region.js.map +1 -0
  60. package/dist/cjs/components/flow-blocks.js +762 -0
  61. package/dist/cjs/components/flow-blocks.js.map +1 -0
  62. package/dist/cjs/components/flow-motion.js +177 -0
  63. package/dist/cjs/components/flow-motion.js.map +1 -0
  64. package/dist/cjs/components/grant-details.js +143 -0
  65. package/dist/cjs/components/grant-details.js.map +1 -0
  66. package/dist/cjs/components/grant-field-styles.js +2 -2
  67. package/dist/cjs/components/index.js +13 -1
  68. package/dist/cjs/components/index.js.map +1 -1
  69. package/dist/cjs/components/mcp-consent.js +93 -36
  70. package/dist/cjs/components/mcp-consent.js.map +1 -1
  71. package/dist/cjs/components/preview.js +67 -0
  72. package/dist/cjs/components/preview.js.map +1 -0
  73. package/dist/cjs/components/provider-icons.js +92 -0
  74. package/dist/cjs/components/provider-icons.js.map +1 -0
  75. package/dist/cjs/constants/capabilities.js +17 -2
  76. package/dist/cjs/constants/capabilities.js.map +1 -1
  77. package/dist/cjs/copy/tokens.js +67 -24
  78. package/dist/cjs/copy/tokens.js.map +1 -1
  79. package/dist/cjs/flow/copy.js +146 -0
  80. package/dist/cjs/flow/copy.js.map +1 -0
  81. package/dist/cjs/flow/index.js +31 -0
  82. package/dist/cjs/flow/index.js.map +1 -0
  83. package/dist/cjs/flow/model.js +107 -0
  84. package/dist/cjs/flow/model.js.map +1 -0
  85. package/dist/cjs/flow/presets.js +157 -0
  86. package/dist/cjs/flow/presets.js.map +1 -0
  87. package/dist/cjs/flow/schema.js +76 -0
  88. package/dist/cjs/flow/schema.js.map +1 -0
  89. package/dist/cjs/identity/agent-identity.js +3 -2
  90. package/dist/cjs/identity/agent-identity.js.map +1 -1
  91. package/dist/cjs/mcp-app/inline.js +2 -2
  92. package/dist/cjs/mcp-app/inline.js.map +1 -1
  93. package/dist/cjs/react/index.js +40 -2
  94. package/dist/cjs/react/index.js.map +1 -1
  95. package/dist/cjs/styles/brand.js +385 -0
  96. package/dist/cjs/styles/brand.js.map +1 -0
  97. package/dist/cjs/styles/index.js +1 -0
  98. package/dist/cjs/styles/index.js.map +1 -1
  99. package/dist/cjs/styles/theme.js +102 -30
  100. package/dist/cjs/styles/theme.js.map +1 -1
  101. package/dist/cjs/types/capabilities.types.js +1 -2
  102. package/dist/cjs/types/capabilities.types.js.map +1 -1
  103. package/dist/cjs/types/decision.types.js +13 -0
  104. package/dist/cjs/types/decision.types.js.map +1 -0
  105. package/dist/cjs/types/edit.types.js +80 -0
  106. package/dist/cjs/types/edit.types.js.map +1 -0
  107. package/dist/cjs/types/index.js +2 -0
  108. package/dist/cjs/types/index.js.map +1 -1
  109. package/dist/components/consent-action-bar.d.ts +20 -1
  110. package/dist/components/consent-action-bar.d.ts.map +1 -1
  111. package/dist/components/consent-action-bar.js +97 -25
  112. package/dist/components/consent-action-bar.js.map +1 -1
  113. package/dist/components/consent-agent-header.d.ts +4 -17
  114. package/dist/components/consent-agent-header.d.ts.map +1 -1
  115. package/dist/components/consent-agent-header.js +7 -105
  116. package/dist/components/consent-agent-header.js.map +1 -1
  117. package/dist/components/consent-button.d.ts +2 -0
  118. package/dist/components/consent-button.d.ts.map +1 -1
  119. package/dist/components/consent-button.js +6 -1
  120. package/dist/components/consent-button.js.map +1 -1
  121. package/dist/components/consent-capabilities-screen.d.ts +101 -17
  122. package/dist/components/consent-capabilities-screen.d.ts.map +1 -1
  123. package/dist/components/consent-capabilities-screen.js +457 -118
  124. package/dist/components/consent-capabilities-screen.js.map +1 -1
  125. package/dist/components/consent-capability-card.d.ts +32 -3
  126. package/dist/components/consent-capability-card.d.ts.map +1 -1
  127. package/dist/components/consent-capability-card.js +159 -32
  128. package/dist/components/consent-capability-card.js.map +1 -1
  129. package/dist/components/consent-checkbox.d.ts +2 -0
  130. package/dist/components/consent-checkbox.d.ts.map +1 -1
  131. package/dist/components/consent-checkbox.js +7 -0
  132. package/dist/components/consent-checkbox.js.map +1 -1
  133. package/dist/components/consent-connector-header.d.ts +52 -7
  134. package/dist/components/consent-connector-header.d.ts.map +1 -1
  135. package/dist/components/consent-connector-header.js +262 -45
  136. package/dist/components/consent-connector-header.js.map +1 -1
  137. package/dist/components/consent-duration.js +1 -1
  138. package/dist/components/consent-flow-timeline.d.ts +49 -0
  139. package/dist/components/consent-flow-timeline.d.ts.map +1 -0
  140. package/dist/components/consent-flow-timeline.js +174 -0
  141. package/dist/components/consent-flow-timeline.js.map +1 -0
  142. package/dist/components/consent-flow.d.ts +101 -0
  143. package/dist/components/consent-flow.d.ts.map +1 -0
  144. package/dist/components/consent-flow.js +504 -0
  145. package/dist/components/consent-flow.js.map +1 -0
  146. package/dist/components/consent-footer.d.ts +6 -4
  147. package/dist/components/consent-footer.d.ts.map +1 -1
  148. package/dist/components/consent-footer.js +22 -14
  149. package/dist/components/consent-footer.js.map +1 -1
  150. package/dist/components/consent-headline.d.ts +62 -16
  151. package/dist/components/consent-headline.d.ts.map +1 -1
  152. package/dist/components/consent-headline.js +352 -34
  153. package/dist/components/consent-headline.js.map +1 -1
  154. package/dist/components/consent-oauth-button.d.ts +9 -6
  155. package/dist/components/consent-oauth-button.d.ts.map +1 -1
  156. package/dist/components/consent-oauth-button.js +71 -141
  157. package/dist/components/consent-oauth-button.js.map +1 -1
  158. package/dist/components/consent-otp-input.d.ts.map +1 -1
  159. package/dist/components/consent-otp-input.js +5 -0
  160. package/dist/components/consent-otp-input.js.map +1 -1
  161. package/dist/components/consent-passkey.d.ts +6 -0
  162. package/dist/components/consent-passkey.d.ts.map +1 -1
  163. package/dist/components/consent-passkey.js +67 -9
  164. package/dist/components/consent-passkey.js.map +1 -1
  165. package/dist/components/consent-phone-handoff.js +3 -3
  166. package/dist/components/consent-request-expiry.js +1 -1
  167. package/dist/components/consent-revocation-notice.d.ts.map +1 -1
  168. package/dist/components/consent-revocation-notice.js +29 -18
  169. package/dist/components/consent-revocation-notice.js.map +1 -1
  170. package/dist/components/consent-revoke.d.ts +2 -0
  171. package/dist/components/consent-revoke.d.ts.map +1 -1
  172. package/dist/components/consent-revoke.js +9 -4
  173. package/dist/components/consent-revoke.js.map +1 -1
  174. package/dist/components/consent-secured-by.d.ts +25 -0
  175. package/dist/components/consent-secured-by.d.ts.map +1 -0
  176. package/dist/components/consent-secured-by.js +103 -0
  177. package/dist/components/consent-secured-by.js.map +1 -0
  178. package/dist/components/consent-shell.js +1 -1
  179. package/dist/components/consent-terms.d.ts +2 -0
  180. package/dist/components/consent-terms.d.ts.map +1 -1
  181. package/dist/components/consent-terms.js +7 -0
  182. package/dist/components/consent-terms.js.map +1 -1
  183. package/dist/components/consent-wallet-check.d.ts +8 -0
  184. package/dist/components/consent-wallet-check.d.ts.map +1 -1
  185. package/dist/components/consent-wallet-check.js +27 -3
  186. package/dist/components/consent-wallet-check.js.map +1 -1
  187. package/dist/components/consent-wallet-notice.js +1 -1
  188. package/dist/components/consent-wallet-orb.js +1 -1
  189. package/dist/components/consent-wallet-signature.js +1 -1
  190. package/dist/components/decision-icons.d.ts +26 -0
  191. package/dist/components/decision-icons.d.ts.map +1 -0
  192. package/dist/components/decision-icons.js +34 -0
  193. package/dist/components/decision-icons.js.map +1 -0
  194. package/dist/components/edit-region.d.ts +50 -0
  195. package/dist/components/edit-region.d.ts.map +1 -0
  196. package/dist/components/edit-region.js +305 -0
  197. package/dist/components/edit-region.js.map +1 -0
  198. package/dist/components/flow-blocks.d.ts +45 -0
  199. package/dist/components/flow-blocks.d.ts.map +1 -0
  200. package/dist/components/flow-blocks.js +755 -0
  201. package/dist/components/flow-blocks.js.map +1 -0
  202. package/dist/components/flow-motion.d.ts +41 -0
  203. package/dist/components/flow-motion.d.ts.map +1 -0
  204. package/dist/components/flow-motion.js +164 -0
  205. package/dist/components/flow-motion.js.map +1 -0
  206. package/dist/components/grant-details.d.ts +28 -0
  207. package/dist/components/grant-details.d.ts.map +1 -0
  208. package/dist/components/grant-details.js +138 -0
  209. package/dist/components/grant-details.js.map +1 -0
  210. package/dist/components/grant-field-styles.js +2 -2
  211. package/dist/components/index.d.ts +5 -1
  212. package/dist/components/index.d.ts.map +1 -1
  213. package/dist/components/index.js +5 -1
  214. package/dist/components/index.js.map +1 -1
  215. package/dist/components/mcp-consent.d.ts +19 -0
  216. package/dist/components/mcp-consent.d.ts.map +1 -1
  217. package/dist/components/mcp-consent.js +93 -36
  218. package/dist/components/mcp-consent.js.map +1 -1
  219. package/dist/components/preview.d.ts +38 -0
  220. package/dist/components/preview.d.ts.map +1 -0
  221. package/dist/components/preview.js +61 -0
  222. package/dist/components/preview.js.map +1 -0
  223. package/dist/components/provider-icons.d.ts +16 -0
  224. package/dist/components/provider-icons.d.ts.map +1 -0
  225. package/dist/components/provider-icons.js +88 -0
  226. package/dist/components/provider-icons.js.map +1 -0
  227. package/dist/consent.js +4875 -1178
  228. package/dist/consent.min.js +2367 -814
  229. package/dist/constants/capabilities.d.ts +16 -3
  230. package/dist/constants/capabilities.d.ts.map +1 -1
  231. package/dist/constants/capabilities.js +17 -2
  232. package/dist/constants/capabilities.js.map +1 -1
  233. package/dist/copy/tokens.d.ts +67 -24
  234. package/dist/copy/tokens.d.ts.map +1 -1
  235. package/dist/copy/tokens.js +67 -24
  236. package/dist/copy/tokens.js.map +1 -1
  237. package/dist/flow/copy.d.ts +31 -0
  238. package/dist/flow/copy.d.ts.map +1 -0
  239. package/dist/flow/copy.js +137 -0
  240. package/dist/flow/copy.js.map +1 -0
  241. package/dist/flow/index.d.ts +15 -0
  242. package/dist/flow/index.d.ts.map +1 -0
  243. package/dist/flow/index.js +15 -0
  244. package/dist/flow/index.js.map +1 -0
  245. package/dist/flow/model.d.ts +209 -0
  246. package/dist/flow/model.d.ts.map +1 -0
  247. package/dist/flow/model.js +103 -0
  248. package/dist/flow/model.js.map +1 -0
  249. package/dist/flow/presets.d.ts +29 -0
  250. package/dist/flow/presets.d.ts.map +1 -0
  251. package/dist/flow/presets.js +153 -0
  252. package/dist/flow/presets.js.map +1 -0
  253. package/dist/flow/schema.d.ts +127 -0
  254. package/dist/flow/schema.d.ts.map +1 -0
  255. package/dist/flow/schema.js +72 -0
  256. package/dist/flow/schema.js.map +1 -0
  257. package/dist/identity/agent-identity.d.ts +3 -2
  258. package/dist/identity/agent-identity.d.ts.map +1 -1
  259. package/dist/identity/agent-identity.js +3 -2
  260. package/dist/identity/agent-identity.js.map +1 -1
  261. package/dist/mcp-app/inline.d.ts.map +1 -1
  262. package/dist/mcp-app/inline.js +2 -2
  263. package/dist/mcp-app/inline.js.map +1 -1
  264. package/dist/react/index.d.ts +27 -1
  265. package/dist/react/index.d.ts.map +1 -1
  266. package/dist/react/index.js +39 -1
  267. package/dist/react/index.js.map +1 -1
  268. package/dist/styles/brand.d.ts +184 -0
  269. package/dist/styles/brand.d.ts.map +1 -0
  270. package/dist/styles/brand.js +372 -0
  271. package/dist/styles/brand.js.map +1 -0
  272. package/dist/styles/index.d.ts +1 -0
  273. package/dist/styles/index.d.ts.map +1 -1
  274. package/dist/styles/index.js +1 -0
  275. package/dist/styles/index.js.map +1 -1
  276. package/dist/styles/theme.d.ts +76 -13
  277. package/dist/styles/theme.d.ts.map +1 -1
  278. package/dist/styles/theme.js +98 -29
  279. package/dist/styles/theme.js.map +1 -1
  280. package/dist/types/capabilities.types.d.ts +12 -14
  281. package/dist/types/capabilities.types.d.ts.map +1 -1
  282. package/dist/types/capabilities.types.js +1 -2
  283. package/dist/types/capabilities.types.js.map +1 -1
  284. package/dist/types/decision.types.d.ts +57 -0
  285. package/dist/types/decision.types.d.ts.map +1 -0
  286. package/dist/types/decision.types.js +12 -0
  287. package/dist/types/decision.types.js.map +1 -0
  288. package/dist/types/edit.types.d.ts +73 -0
  289. package/dist/types/edit.types.d.ts.map +1 -0
  290. package/dist/types/edit.types.js +76 -0
  291. package/dist/types/edit.types.js.map +1 -0
  292. package/dist/types/index.d.ts +2 -0
  293. package/dist/types/index.d.ts.map +1 -1
  294. package/dist/types/index.js +2 -0
  295. package/dist/types/index.js.map +1 -1
  296. package/package.json +10 -5
@@ -0,0 +1,755 @@
1
+ /**
2
+ * Flow blocks
3
+ *
4
+ * The building blocks of a consent flow. Each draws one piece of the card
5
+ * from the request's data and the flow's copy, and nothing else: no network,
6
+ * no motion, no state. A step is a list of block names (`flow.steps[step]
7
+ * .blocks`, as `name` or `name:variant`); `<consent-flow>` puts them together
8
+ * and moves between steps.
9
+ *
10
+ * The package's own elements draw wherever there is one: the capability
11
+ * cards, the countdown, the action bar, the grant details.
12
+ *
13
+ * @module components/flow-blocks
14
+ */
15
+ import { css, html, nothing } from "lit";
16
+ import { fillTemplate, group, initialsOf, splitTemplate, token, } from "../flow/copy.js";
17
+ import { decisionIcon } from "./decision-icons.js";
18
+ import { grantDetailRows, grantDetailsSection, grantDetailStyles, } from "./grant-details.js";
19
+ import { PROVIDER_NAMES, providerIcon, } from "./provider-icons.js";
20
+ import { fingerprintIcon } from "./wallet-icons.js";
21
+ /** The block that grows out of another as it leaves: the account chip becomes the approver box; the capabilities their receipt. */
22
+ export const BLOCK_MORPH_FROM = {
23
+ approver: "signIn",
24
+ receipt: "capability",
25
+ };
26
+ /** The placeholders' values for a request. */
27
+ export function flowValues(data) {
28
+ const provider = data.approver.provider ?? "";
29
+ return {
30
+ Agent: data.agent.name,
31
+ Merchant: data.merchant.name,
32
+ Verb: data.verb,
33
+ Provider: data.approver.providerName ??
34
+ (Object.prototype.hasOwnProperty.call(PROVIDER_NAMES, provider) &&
35
+ provider !== "custom"
36
+ ? PROVIDER_NAMES[provider]
37
+ : "sign-in"),
38
+ First: data.approver.name.trim().split(/\s+/)[0] ?? "",
39
+ Domain: data.agent.domain,
40
+ };
41
+ }
42
+ /** "Thu 07:00 CST": the viewer's own time, with its zone. */
43
+ export function whenLabel(at) {
44
+ const date = new Date(at);
45
+ if (Number.isNaN(date.getTime()))
46
+ return "";
47
+ return new Intl.DateTimeFormat(undefined, {
48
+ weekday: "short",
49
+ hour: "2-digit",
50
+ minute: "2-digit",
51
+ timeZoneName: "short",
52
+ }).format(date);
53
+ }
54
+ /** A headline: its words, with the agent's name bold (as the screen draws it) and the merchant's in italics. */
55
+ function richText(template, values) {
56
+ return splitTemplate(template).map((part) => {
57
+ if (!part.name)
58
+ return part.text;
59
+ const value = values[part.name] ?? "";
60
+ if (part.name === "Agent")
61
+ return html `<em part="agent-name">${value}</em>`;
62
+ if (part.name === "Merchant")
63
+ return html `<em part="merchant-name">${value}</em>`;
64
+ return value;
65
+ });
66
+ }
67
+ const hide = (event) => {
68
+ event.target.hidden = true;
69
+ };
70
+ const show = (event) => {
71
+ event.target.hidden = false;
72
+ };
73
+ /** A person's face: their initials, with the provider's picture over them when it loads. */
74
+ export function face(name, identifier = "", avatarUrl = "", size = "md") {
75
+ const initials = initialsOf(name, identifier);
76
+ return html `<span
77
+ class="face ${size} ${initials.length > 1 ? "two" : ""}"
78
+ aria-hidden="true"
79
+ >${initials}${avatarUrl
80
+ ? html `<img src=${avatarUrl} alt="" @error=${hide} @load=${show} />`
81
+ : nothing}</span
82
+ >`;
83
+ }
84
+ /** The agent's tile: its mark on white in every theme, or its initial. A name alone never earns a mark. */
85
+ export function agentTile(agent) {
86
+ const initial = initialsOf(agent.name).slice(0, 1);
87
+ return html `<span class="tile" aria-hidden="true"
88
+ >${initial}${agent.logoUrl
89
+ ? html `<img src=${agent.logoUrl} alt="" @error=${hide} @load=${show} />`
90
+ : nothing}</span
91
+ >`;
92
+ }
93
+ /** Who approves, and the agent they approve: the lockup, in every step that has it. */
94
+ const approver = ({ data, copy, step, variant, values }) => {
95
+ const c = group(copy, "approver");
96
+ const state = variant ?? step;
97
+ const granted = state === "granted";
98
+ const declined = state === "denied";
99
+ const person = data.approver;
100
+ const agent = data.agent;
101
+ const unverified = agent.verification === "unverified";
102
+ const status = unverified
103
+ ? c.unverified
104
+ : agent.domain
105
+ ? fillTemplate(c.identifiedBy ?? "", { Domain: agent.domain })
106
+ : "";
107
+ const detail = granted ? c.confirmed : person.identifier;
108
+ const markLabel = declined
109
+ ? c.declined
110
+ : fillTemplate(c.signedInWith ?? "", values);
111
+ return html `<div class="tinted lockup" part="approver">
112
+ <div class="lockup-row">
113
+ ${face(person.name, person.identifier, person.avatarUrl)}
114
+ <div class="lockup-text">
115
+ <span class="lockup-label"
116
+ >${granted
117
+ ? c.labelGranted
118
+ : declined
119
+ ? c.labelDenied
120
+ : c.label}</span
121
+ >
122
+ <span class="lockup-name">${person.name}</span>
123
+ ${detail ? html `<span class="small">${detail}</span>` : nothing}
124
+ </div>
125
+ <span
126
+ class="lockup-mark ${declined ? "declined" : ""}"
127
+ role="img"
128
+ aria-label=${markLabel}
129
+ title=${markLabel}
130
+ >${decisionIcon(declined ? "minus" : "check")}</span
131
+ >
132
+ </div>
133
+ <div class="lockup-row party" part="approver-agent">
134
+ ${agentTile(agent)}
135
+ <div class="lockup-text">
136
+ <span class="small"
137
+ >${granted
138
+ ? c.partyGranted
139
+ : declined
140
+ ? c.partyDenied
141
+ : c.party}</span
142
+ >
143
+ <span class="value">${agent.name}</span>
144
+ </div>
145
+ ${status
146
+ ? html `<span
147
+ class="party-status ${unverified ? "unverified" : ""}"
148
+ part="agent-status"
149
+ >${status}${unverified && c.unverifiedInfo
150
+ ? html `<button
151
+ type="button"
152
+ class="info"
153
+ aria-label=${c.unverified}
154
+ aria-describedby="unverified-info"
155
+ >
156
+ ${decisionIcon("info")}</button
157
+ ><span class="tip" id="unverified-info" role="tooltip"
158
+ >${c.unverifiedInfo}</span
159
+ >`
160
+ : nothing}</span
161
+ >`
162
+ : nothing}
163
+ </div>
164
+ </div>`;
165
+ };
166
+ /**
167
+ * What the agent asks to do, as the screen draws it: its eyebrow, then one
168
+ * card per capability. A card names the action and its product; the limits
169
+ * are the grant's (details). Locked (passkey open) and dimmed (expired) cards
170
+ * can't be ticked, and the hint hides without moving the rows.
171
+ */
172
+ const capability = ({ data, copy, variant, selected, values, preview, }) => {
173
+ const locked = Boolean(variant);
174
+ return html `<div class="section-header" part="section-header">
175
+ <span>${fillTemplate(token(copy, "capabilitiesHeader"), values)}</span>
176
+ <span class="hint" part="section-hint" ?data-hidden=${locked}
177
+ >${token(copy, "tapToToggle")}</span
178
+ >
179
+ </div>
180
+ <div class="rows ${variant === "dim" ? "dim" : ""}">
181
+ ${data.capabilities.map((cap) => html `<consent-capability-card
182
+ .capabilityId=${cap.id}
183
+ .label=${cap.label}
184
+ .description=${cap.description}
185
+ .icon=${cap.icon}
186
+ .riskLevel=${cap.riskLevel}
187
+ .scopes=${cap.scopes}
188
+ .checked=${selected.has(cap.id)}
189
+ .disabled=${locked}
190
+ .hideRisk=${Boolean(data.hideRisk)}
191
+ .hideScopes=${Boolean(data.hideScopes)}
192
+ .preview=${preview}
193
+ ></consent-capability-card>`)}
194
+ </div>`;
195
+ };
196
+ const signIn = ({ data, copy, values }) => {
197
+ const c = group(copy, "signIn");
198
+ const person = data.approver;
199
+ const provider = person.provider ?? "custom";
200
+ return html `<div class="sign-in">
201
+ <button
202
+ type="button"
203
+ class="account"
204
+ data-action="sign-in"
205
+ data-provider=${provider}
206
+ >
207
+ ${face(person.name, person.identifier, person.avatarUrl, "sm")}
208
+ <span class="account-text">
209
+ <span class="account-name"
210
+ >${fillTemplate(c.continueAs ?? "", values)}</span
211
+ >
212
+ ${person.identifier
213
+ ? html `<span class="small">${person.identifier}</span>`
214
+ : nothing}
215
+ </span>
216
+ <span class="provider" aria-hidden="true">${providerIcon(provider)}</span>
217
+ </button>
218
+ <button
219
+ type="button"
220
+ class="link"
221
+ data-action="sign-in"
222
+ data-provider=${provider}
223
+ data-account="other"
224
+ >
225
+ ${fillTemplate(c.other ?? "", values)}
226
+ </button>
227
+ </div>`;
228
+ };
229
+ /** What the capabilities become once granted: each with its line and when it ends. */
230
+ const receipt = ({ data, copy, selected }) => {
231
+ const granted = new Set(data.grant?.capabilities ?? selected);
232
+ const items = data.capabilities.filter((cap) => granted.has(cap.id));
233
+ if (items.length === 0)
234
+ return nothing;
235
+ const when = data.grant?.endsAt ? whenLabel(data.grant.endsAt) : "";
236
+ const until = when
237
+ ? fillTemplate(group(copy, "receipt").until ?? "", { When: when })
238
+ : "";
239
+ return html `<ul class="tinted receipt" part="receipt">
240
+ ${items.map((cap) => html `<li>
241
+ ${decisionIcon("tick")}
242
+ <div>
243
+ <p class="receipt-title">${cap.label}</p>
244
+ ${cap.receipt ? html `<p class="small">${cap.receipt}</p>` : nothing}
245
+ ${until ? html `<p class="small">${until}</p>` : nothing}
246
+ </div>
247
+ </li>`)}
248
+ </ul>`;
249
+ };
250
+ const FINGERPRINT = html `<svg
251
+ viewBox="0 0 24 24"
252
+ fill="none"
253
+ stroke="currentColor"
254
+ stroke-width="2"
255
+ stroke-linecap="round"
256
+ stroke-linejoin="round"
257
+ aria-hidden="true"
258
+ >
259
+ ${fingerprintIcon}
260
+ </svg>`;
261
+ /** Every block, by name. */
262
+ export const FLOW_BLOCK_RENDERERS = {
263
+ eyebrow: ({ copy, step }) => html `<span class="eyebrow" part="eyebrow"
264
+ >${token(copy, "eyebrow", step)}</span
265
+ >`,
266
+ headline: ({ copy, step, values }) => {
267
+ const words = token(copy, "headline", step);
268
+ return words
269
+ ? html `<h1 class="headline" part="headline" tabindex="-1">
270
+ ${richText(words, values)}
271
+ </h1>`
272
+ : nothing;
273
+ },
274
+ sub: ({ copy, step, values }) => {
275
+ const words = token(copy, "sub", step);
276
+ return words
277
+ ? html `<p class="sub">${fillTemplate(words, values)}</p>`
278
+ : nothing;
279
+ },
280
+ signIn,
281
+ finePrint: ({ copy, values }) => {
282
+ const words = group(copy, "signIn").finePrint;
283
+ return words
284
+ ? html `<p class="small fine-print">${fillTemplate(words, values)}</p>`
285
+ : nothing;
286
+ },
287
+ approver,
288
+ capability,
289
+ /** "Connects to" is always the merchant, over the grant's address: never a slot host. */
290
+ details: ({ data }) => data.grantDetails
291
+ ? grantDetailsSection(grantDetailRows(data.grantDetails, data.merchant.name))
292
+ : nothing,
293
+ /** The package's countdown; its expiry is the flow's `expire` event. */
294
+ countdown: ({ data }) => data.requestExpiresAt !== undefined
295
+ ? html `<consent-request-expiry
296
+ .expiresAt=${data.requestExpiresAt}
297
+ ></consent-request-expiry>`
298
+ : nothing,
299
+ actions: ({ data, copy, variant, method, preview }) => {
300
+ const a = group(copy, "actions");
301
+ return html `<consent-action-bar
302
+ .agentName=${data.agent.name}
303
+ .submitLabel=${a.approve ?? ""}
304
+ .cancelLabel=${a.deny ?? ""}
305
+ .submitIcon=${method === "passkey" ? "passkey" : ""}
306
+ .loadingLabel=${a.confirming ?? ""}
307
+ .loading=${variant === "loading"}
308
+ .preview=${preview}
309
+ ></consent-action-bar>`;
310
+ },
311
+ status: ({ copy }) => html `<p class="line status" part="status" tabindex="-1">
312
+ ${FINGERPRINT}<span>${token(copy, "status")}</span>
313
+ </p>`,
314
+ notice: ({ copy }) => html `<p class="line notice" part="notice" tabindex="-1">
315
+ ${decisionIcon("warning")}<span>${token(copy, "notice")}</span>
316
+ </p>`,
317
+ expiredNote: ({ copy, values }) => html `<p class="line tinted expired-note" part="expired-note">
318
+ ${decisionIcon("duration")}<span
319
+ >${fillTemplate(token(copy, "expired"), values)}</span
320
+ >
321
+ </p>`,
322
+ receipt,
323
+ goBack: ({ copy, values }) => {
324
+ const words = token(copy, "goBack");
325
+ return words
326
+ ? html `<p class="sub">${fillTemplate(words, values)}</p>`
327
+ : nothing;
328
+ },
329
+ retry: ({ copy }) => html `<button type="button" class="primary" part="retry" data-action="retry">
330
+ ${token(copy, "retry")}
331
+ </button>`,
332
+ };
333
+ /** The blocks' own look. The card and its spacing are the flow's. */
334
+ export const flowBlockStyles = css `
335
+ ${grantDetailStyles}
336
+
337
+ .small {
338
+ font-size: 12px;
339
+ color: var(--cs-text-tertiary);
340
+ }
341
+
342
+ .tinted {
343
+ border-radius: 12px;
344
+ border: 1px solid var(--cs-tint-line);
345
+ background: var(--cs-tint);
346
+ }
347
+
348
+ /* The card's gap spaces the blocks; the screen's box keeps its own margin. */
349
+ .grant-details {
350
+ margin-top: 0;
351
+ }
352
+
353
+ .eyebrow,
354
+ .section-header {
355
+ font-size: 11px;
356
+ letter-spacing: 0.16em;
357
+ font-weight: 600;
358
+ line-height: 18px;
359
+ color: var(--cs-text-tertiary);
360
+ text-transform: uppercase;
361
+ }
362
+
363
+ .headline {
364
+ margin: 0;
365
+ font-family: var(--cs-headline-font, "Instrument Serif", Georgia, serif);
366
+ font-size: var(--cs-headline-font-size, 32px);
367
+ font-weight: var(--cs-headline-weight, 600);
368
+ line-height: var(--cs-headline-line-height, 1.2);
369
+ letter-spacing: -0.01em;
370
+ color: var(--cs-text-primary);
371
+ text-wrap: pretty;
372
+ overflow-wrap: anywhere;
373
+ font-synthesis-weight: none;
374
+ }
375
+
376
+ .headline:focus {
377
+ outline: none;
378
+ }
379
+
380
+ .headline em {
381
+ font-style: italic;
382
+ }
383
+
384
+ [part="agent-name"] {
385
+ font-weight: var(--cs-agent-name-weight, inherit);
386
+ -webkit-text-stroke: var(--cs-agent-name-stroke, 0.04em) currentColor;
387
+ }
388
+
389
+ .sub {
390
+ margin: 0;
391
+ font-size: 15px;
392
+ line-height: 1.5;
393
+ color: var(--cs-text-secondary);
394
+ }
395
+
396
+ .section-header {
397
+ display: flex;
398
+ align-items: center;
399
+ justify-content: space-between;
400
+ flex-wrap: wrap;
401
+ gap: 4px 12px;
402
+ margin-bottom: 10px;
403
+ }
404
+
405
+ .section-header .hint {
406
+ font-size: 12px;
407
+ font-weight: 400;
408
+ letter-spacing: 0;
409
+ text-transform: none;
410
+ }
411
+
412
+ .section-header .hint[data-hidden] {
413
+ visibility: hidden;
414
+ }
415
+
416
+ .rows {
417
+ display: flex;
418
+ flex-direction: column;
419
+ gap: 8px;
420
+ }
421
+
422
+ .rows.dim {
423
+ opacity: 0.55;
424
+ }
425
+
426
+ /* The approver lockup. */
427
+ .lockup {
428
+ display: flex;
429
+ flex-direction: column;
430
+ gap: 12px;
431
+ padding: 16px 18px;
432
+ }
433
+
434
+ .lockup-row {
435
+ display: flex;
436
+ align-items: center;
437
+ gap: 12px;
438
+ min-width: 0;
439
+ }
440
+
441
+ .lockup-row.party {
442
+ padding-top: 12px;
443
+ border-top: 1px solid var(--cs-tint-line);
444
+ }
445
+
446
+ .lockup-text {
447
+ display: flex;
448
+ flex: 1;
449
+ flex-direction: column;
450
+ gap: 2px;
451
+ min-width: 0;
452
+ }
453
+
454
+ .lockup-label {
455
+ font-size: 10px;
456
+ letter-spacing: 0.16em;
457
+ font-weight: 600;
458
+ text-transform: uppercase;
459
+ color: var(--cs-text-tertiary);
460
+ }
461
+
462
+ .lockup-name {
463
+ font-size: 20px;
464
+ font-weight: 600;
465
+ line-height: 1.2;
466
+ overflow-wrap: anywhere;
467
+ }
468
+
469
+ .lockup-text .value {
470
+ font-weight: 500;
471
+ overflow-wrap: anywhere;
472
+ }
473
+
474
+ .lockup-mark {
475
+ display: grid;
476
+ flex-shrink: 0;
477
+ color: var(--cs-wallet-success, var(--cs-mark));
478
+ }
479
+
480
+ .lockup-mark.declined {
481
+ color: var(--cs-text-tertiary);
482
+ }
483
+
484
+ .lockup-mark svg {
485
+ width: 22px;
486
+ height: 22px;
487
+ }
488
+
489
+ .face,
490
+ .tile {
491
+ position: relative;
492
+ display: grid;
493
+ place-items: center;
494
+ flex-shrink: 0;
495
+ width: 42px;
496
+ height: 42px;
497
+ overflow: hidden;
498
+ font-weight: 600;
499
+ }
500
+
501
+ .face {
502
+ border-radius: 50%;
503
+ background: var(--cs-surface-accent);
504
+ color: var(--cs-surface-accent-text);
505
+ font-size: 17px;
506
+ }
507
+
508
+ .face.two {
509
+ font-size: 15px;
510
+ letter-spacing: 0.02em;
511
+ }
512
+
513
+ .face.sm {
514
+ width: 32px;
515
+ height: 32px;
516
+ font-size: 13px;
517
+ }
518
+
519
+ .face img {
520
+ position: absolute;
521
+ inset: 0;
522
+ width: 100%;
523
+ height: 100%;
524
+ object-fit: cover;
525
+ }
526
+
527
+ .tile {
528
+ border-radius: var(--cs-tile-radius, 10px);
529
+ border: 1px solid var(--cs-agent-tile-border, rgba(15, 23, 42, 0.16));
530
+ background: var(--cs-surface-accent);
531
+ color: var(--cs-surface-accent-text);
532
+ font-size: 18px;
533
+ }
534
+
535
+ .tile img {
536
+ position: absolute;
537
+ inset: 0;
538
+ width: 100%;
539
+ height: 100%;
540
+ padding: 4px;
541
+ box-sizing: border-box;
542
+ object-fit: contain;
543
+ background: var(--cs-agent-tile-bg, #ffffff);
544
+ }
545
+
546
+ .party-status {
547
+ position: relative;
548
+ display: inline-flex;
549
+ align-items: center;
550
+ gap: 4px;
551
+ flex-shrink: 0;
552
+ font-size: 13px;
553
+ font-weight: 500;
554
+ color: var(--cs-text-secondary);
555
+ }
556
+
557
+ .party-status.unverified {
558
+ color: var(--cs-warning-text, var(--cs-text-primary));
559
+ }
560
+
561
+ .info {
562
+ display: inline-grid;
563
+ place-items: center;
564
+ width: 22px;
565
+ height: 22px;
566
+ padding: 0;
567
+ border: 0;
568
+ border-radius: 50%;
569
+ background: none;
570
+ color: var(--cs-text-tertiary);
571
+ cursor: help;
572
+ }
573
+
574
+ .info svg {
575
+ width: 16px;
576
+ height: 16px;
577
+ }
578
+
579
+ .info:focus-visible {
580
+ outline: 2px solid var(--cs-focus-ring, currentColor);
581
+ outline-offset: 1px;
582
+ }
583
+
584
+ .tip {
585
+ position: absolute;
586
+ top: calc(100% + 8px);
587
+ right: -6px;
588
+ z-index: 5;
589
+ width: 240px;
590
+ padding: 8px 10px;
591
+ border-radius: 8px;
592
+ background: var(--cs-text-primary);
593
+ color: var(--cs-surface-card);
594
+ font-size: 12px;
595
+ font-weight: 400;
596
+ line-height: 1.45;
597
+ text-align: left;
598
+ opacity: 0;
599
+ visibility: hidden;
600
+ }
601
+
602
+ .party-status:hover .tip,
603
+ .info:focus-visible + .tip {
604
+ opacity: 1;
605
+ visibility: visible;
606
+ }
607
+
608
+ /* Sign-in. */
609
+ .sign-in {
610
+ display: flex;
611
+ flex-direction: column;
612
+ gap: 10px;
613
+ }
614
+
615
+ .account {
616
+ display: flex;
617
+ align-items: center;
618
+ gap: 12px;
619
+ width: 100%;
620
+ padding: 10px 14px;
621
+ border: 1px solid var(--cs-surface-border);
622
+ border-radius: var(--cs-field-radius, 8px);
623
+ background: var(--cs-surface-card);
624
+ color: var(--cs-text-primary);
625
+ font: inherit;
626
+ text-align: left;
627
+ cursor: pointer;
628
+ }
629
+
630
+ .account:hover {
631
+ background: var(--cs-row-hover-bg, var(--cs-tint));
632
+ }
633
+
634
+ .account-text {
635
+ display: flex;
636
+ flex-direction: column;
637
+ min-width: 0;
638
+ line-height: 1.3;
639
+ }
640
+
641
+ .account-name {
642
+ font-size: 14px;
643
+ font-weight: 600;
644
+ }
645
+
646
+ .provider {
647
+ display: inline-flex;
648
+ margin-left: auto;
649
+ }
650
+
651
+ .provider svg {
652
+ width: 20px;
653
+ height: 20px;
654
+ }
655
+
656
+ .link {
657
+ align-self: center;
658
+ padding: 2px 4px;
659
+ border: 0;
660
+ border-radius: 4px;
661
+ background: none;
662
+ color: var(--cs-text-secondary);
663
+ font: inherit;
664
+ font-size: 13px;
665
+ cursor: pointer;
666
+ text-decoration: underline;
667
+ text-underline-offset: 2px;
668
+ }
669
+
670
+ .fine-print {
671
+ margin: 0;
672
+ padding-top: 14px;
673
+ border-top: 1px solid var(--cs-surface-border);
674
+ }
675
+
676
+ /* Lines: the passkey's status, the dismissed notice, the expiry. */
677
+ .line {
678
+ display: flex;
679
+ align-items: center;
680
+ gap: 8px;
681
+ margin: 0;
682
+ font-size: 14px;
683
+ color: var(--cs-text-primary);
684
+ }
685
+
686
+ .line:focus {
687
+ outline: none;
688
+ }
689
+
690
+ .line svg {
691
+ width: 16px;
692
+ height: 16px;
693
+ flex-shrink: 0;
694
+ color: var(--cs-text-tertiary);
695
+ }
696
+
697
+ .line.status {
698
+ color: var(--cs-text-secondary);
699
+ }
700
+
701
+ .expired-note {
702
+ padding: 12px 14px;
703
+ }
704
+
705
+ /* The receipt. */
706
+ .receipt {
707
+ display: flex;
708
+ flex-direction: column;
709
+ gap: 12px;
710
+ margin: 0;
711
+ padding: 14px 16px;
712
+ list-style: none;
713
+ }
714
+
715
+ .receipt li {
716
+ display: flex;
717
+ align-items: flex-start;
718
+ gap: 10px;
719
+ }
720
+
721
+ .receipt li > svg {
722
+ width: 16px;
723
+ height: 16px;
724
+ flex-shrink: 0;
725
+ margin-top: 3px;
726
+ color: var(--cs-wallet-success, var(--cs-mark));
727
+ }
728
+
729
+ .receipt p {
730
+ margin: 0;
731
+ }
732
+
733
+ .receipt-title {
734
+ font-weight: 600;
735
+ }
736
+
737
+ .primary {
738
+ min-height: var(--cs-action-min-height, 44px);
739
+ padding: 0 20px;
740
+ border: 0;
741
+ border-radius: var(--cs-action-radius, 8px);
742
+ background: var(--cs-surface-accent);
743
+ color: var(--cs-surface-accent-text);
744
+ font: inherit;
745
+ font-size: var(--cs-action-font-size, 15px);
746
+ font-weight: 600;
747
+ cursor: pointer;
748
+ }
749
+
750
+ button:focus-visible {
751
+ outline: 2px solid var(--cs-focus-ring, currentColor);
752
+ outline-offset: 2px;
753
+ }
754
+ `;
755
+ //# sourceMappingURL=flow-blocks.js.map