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