@kya-os/consent 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/README.md +30 -9
  2. package/dist/bundle/inline.d.ts.map +1 -1
  3. package/dist/bundle/inline.js +4 -4
  4. package/dist/bundle/inline.js.map +1 -1
  5. package/dist/cjs/bundle/inline.js +4 -4
  6. package/dist/cjs/bundle/inline.js.map +1 -1
  7. package/dist/cjs/components/approver-lockup.js +365 -0
  8. package/dist/cjs/components/approver-lockup.js.map +1 -0
  9. package/dist/cjs/components/consent-action-bar.js +4 -0
  10. package/dist/cjs/components/consent-action-bar.js.map +1 -1
  11. package/dist/cjs/components/consent-capabilities-screen.js +358 -98
  12. package/dist/cjs/components/consent-capabilities-screen.js.map +1 -1
  13. package/dist/cjs/components/consent-connector-header.js +1 -0
  14. package/dist/cjs/components/consent-connector-header.js.map +1 -1
  15. package/dist/cjs/components/consent-flow.js +392 -10
  16. package/dist/cjs/components/consent-flow.js.map +1 -1
  17. package/dist/cjs/components/consent-headline.js +35 -7
  18. package/dist/cjs/components/consent-headline.js.map +1 -1
  19. package/dist/cjs/components/consent-wallet-orb.js +6 -1
  20. package/dist/cjs/components/consent-wallet-orb.js.map +1 -1
  21. package/dist/cjs/components/decision-icons.js +2 -0
  22. package/dist/cjs/components/decision-icons.js.map +1 -1
  23. package/dist/cjs/components/flow-blocks.js +139 -298
  24. package/dist/cjs/components/flow-blocks.js.map +1 -1
  25. package/dist/cjs/components/index.js.map +1 -1
  26. package/dist/cjs/copy/tokens.js +14 -1
  27. package/dist/cjs/copy/tokens.js.map +1 -1
  28. package/dist/cjs/flow/copy.js +15 -0
  29. package/dist/cjs/flow/copy.js.map +1 -1
  30. package/dist/cjs/flow/index.js +5 -2
  31. package/dist/cjs/flow/index.js.map +1 -1
  32. package/dist/cjs/flow/model.js +46 -1
  33. package/dist/cjs/flow/model.js.map +1 -1
  34. package/dist/cjs/flow/page.js +282 -0
  35. package/dist/cjs/flow/page.js.map +1 -0
  36. package/dist/cjs/flow/presets.js +4 -0
  37. package/dist/cjs/flow/presets.js.map +1 -1
  38. package/dist/cjs/flow/schema.js +1 -0
  39. package/dist/cjs/flow/schema.js.map +1 -1
  40. package/dist/cjs/mcp-app/inline.js +2 -2
  41. package/dist/cjs/mcp-app/inline.js.map +1 -1
  42. package/dist/cjs/react/index.js +2 -0
  43. package/dist/cjs/react/index.js.map +1 -1
  44. package/dist/cjs/schemas/capabilities.schemas.js +1 -0
  45. package/dist/cjs/schemas/capabilities.schemas.js.map +1 -1
  46. package/dist/cjs/styles/brand.js +135 -38
  47. package/dist/cjs/styles/brand.js.map +1 -1
  48. package/dist/cjs/styles/theme.js +32 -3
  49. package/dist/cjs/styles/theme.js.map +1 -1
  50. package/dist/components/approver-lockup.d.ts +73 -0
  51. package/dist/components/approver-lockup.d.ts.map +1 -0
  52. package/dist/components/approver-lockup.js +358 -0
  53. package/dist/components/approver-lockup.js.map +1 -0
  54. package/dist/components/consent-action-bar.d.ts.map +1 -1
  55. package/dist/components/consent-action-bar.js +4 -0
  56. package/dist/components/consent-action-bar.js.map +1 -1
  57. package/dist/components/consent-capabilities-screen.d.ts +88 -8
  58. package/dist/components/consent-capabilities-screen.d.ts.map +1 -1
  59. package/dist/components/consent-capabilities-screen.js +358 -98
  60. package/dist/components/consent-capabilities-screen.js.map +1 -1
  61. package/dist/components/consent-connector-header.d.ts.map +1 -1
  62. package/dist/components/consent-connector-header.js +1 -0
  63. package/dist/components/consent-connector-header.js.map +1 -1
  64. package/dist/components/consent-flow.d.ts +56 -2
  65. package/dist/components/consent-flow.d.ts.map +1 -1
  66. package/dist/components/consent-flow.js +394 -12
  67. package/dist/components/consent-flow.js.map +1 -1
  68. package/dist/components/consent-headline.d.ts +15 -3
  69. package/dist/components/consent-headline.d.ts.map +1 -1
  70. package/dist/components/consent-headline.js +35 -7
  71. package/dist/components/consent-headline.js.map +1 -1
  72. package/dist/components/consent-wallet-orb.d.ts +4 -0
  73. package/dist/components/consent-wallet-orb.d.ts.map +1 -1
  74. package/dist/components/consent-wallet-orb.js +6 -1
  75. package/dist/components/consent-wallet-orb.js.map +1 -1
  76. package/dist/components/decision-icons.d.ts +2 -0
  77. package/dist/components/decision-icons.d.ts.map +1 -1
  78. package/dist/components/decision-icons.js +2 -0
  79. package/dist/components/decision-icons.js.map +1 -1
  80. package/dist/components/flow-blocks.d.ts +5 -5
  81. package/dist/components/flow-blocks.d.ts.map +1 -1
  82. package/dist/components/flow-blocks.js +139 -296
  83. package/dist/components/flow-blocks.js.map +1 -1
  84. package/dist/components/index.d.ts +1 -1
  85. package/dist/components/index.d.ts.map +1 -1
  86. package/dist/components/index.js.map +1 -1
  87. package/dist/consent.js +1787 -910
  88. package/dist/consent.min.js +1026 -676
  89. package/dist/copy/tokens.d.ts +14 -1
  90. package/dist/copy/tokens.d.ts.map +1 -1
  91. package/dist/copy/tokens.js +14 -1
  92. package/dist/copy/tokens.js.map +1 -1
  93. package/dist/flow/copy.d.ts +2 -0
  94. package/dist/flow/copy.d.ts.map +1 -1
  95. package/dist/flow/copy.js +14 -0
  96. package/dist/flow/copy.js.map +1 -1
  97. package/dist/flow/index.d.ts +5 -2
  98. package/dist/flow/index.d.ts.map +1 -1
  99. package/dist/flow/index.js +5 -2
  100. package/dist/flow/index.js.map +1 -1
  101. package/dist/flow/model.d.ts +53 -2
  102. package/dist/flow/model.d.ts.map +1 -1
  103. package/dist/flow/model.js +45 -0
  104. package/dist/flow/model.js.map +1 -1
  105. package/dist/flow/page.d.ts +110 -0
  106. package/dist/flow/page.d.ts.map +1 -0
  107. package/dist/flow/page.js +276 -0
  108. package/dist/flow/page.js.map +1 -0
  109. package/dist/flow/presets.d.ts.map +1 -1
  110. package/dist/flow/presets.js +4 -0
  111. package/dist/flow/presets.js.map +1 -1
  112. package/dist/flow/schema.d.ts +19 -14
  113. package/dist/flow/schema.d.ts.map +1 -1
  114. package/dist/flow/schema.js +1 -0
  115. package/dist/flow/schema.js.map +1 -1
  116. package/dist/mcp-app/inline.d.ts.map +1 -1
  117. package/dist/mcp-app/inline.js +2 -2
  118. package/dist/mcp-app/inline.js.map +1 -1
  119. package/dist/react/index.d.ts +5 -3
  120. package/dist/react/index.d.ts.map +1 -1
  121. package/dist/react/index.js +2 -0
  122. package/dist/react/index.js.map +1 -1
  123. package/dist/schemas/api.schemas.d.ts +9 -0
  124. package/dist/schemas/api.schemas.d.ts.map +1 -1
  125. package/dist/schemas/capabilities.schemas.d.ts +5 -0
  126. package/dist/schemas/capabilities.schemas.d.ts.map +1 -1
  127. package/dist/schemas/capabilities.schemas.js +1 -0
  128. package/dist/schemas/capabilities.schemas.js.map +1 -1
  129. package/dist/schemas/config.schemas.d.ts +14 -0
  130. package/dist/schemas/config.schemas.d.ts.map +1 -1
  131. package/dist/styles/brand.d.ts +53 -18
  132. package/dist/styles/brand.d.ts.map +1 -1
  133. package/dist/styles/brand.js +136 -39
  134. package/dist/styles/brand.js.map +1 -1
  135. package/dist/styles/theme.d.ts +15 -1
  136. package/dist/styles/theme.d.ts.map +1 -1
  137. package/dist/styles/theme.js +31 -2
  138. package/dist/styles/theme.js.map +1 -1
  139. package/dist/types/capabilities.types.d.ts +20 -0
  140. package/dist/types/capabilities.types.d.ts.map +1 -1
  141. package/dist/types/decision.types.d.ts +10 -2
  142. package/dist/types/decision.types.d.ts.map +1 -1
  143. package/package.json +1 -1
package/dist/consent.js CHANGED
@@ -3052,8 +3052,17 @@ var CONSENT_COPY_TOKENS = {
3052
3052
  heading: "Unverified agent",
3053
3053
  advice: "Allow only if you asked it to."
3054
3054
  },
3055
- /** The box naming who is signing in. */
3055
+ /** The box naming who is signing in, over the agent they authorize. */
3056
3056
  approver: {
3057
+ /** Over the person's name. */
3058
+ label: "You are authorizing",
3059
+ /** Over the agent's name. */
3060
+ party: "To act for you",
3061
+ /** The sign-in mark's accessible name, with the host's `method`. */
3062
+ signedInWith: "Signed in with {Method}",
3063
+ /** The sign-in mark's accessible name, with no `method`. */
3064
+ signedInMark: "Signed in",
3065
+ /** @deprecated The box no longer draws it; kept for hosts that read it. */
3057
3066
  signedIn: "Signed in as"
3058
3067
  },
3059
3068
  /** The box that says what the grant connects to and how it is bounded. */
@@ -3103,7 +3112,11 @@ var CONSENT_COPY_TOKENS = {
3103
3112
  /** Disclosure title above the plain-language gloss. */
3104
3113
  glossTitle: "What this allows",
3105
3114
  /** Used in the gloss when no resource is extractable. */
3106
- glossUnknownResource: "this deployment"
3115
+ glossUnknownResource: "this deployment",
3116
+ /** In a row that needs a check before it can be granted, beside the button that starts it. */
3117
+ checkRequired: "Requires verification",
3118
+ /** Under an unticked row, for a scope an earlier approval holds. `{Scope}` is drawn in code. */
3119
+ heldNotice: "{Scope} stays granted because of your earlier approval."
3107
3120
  },
3108
3121
  footer: {
3109
3122
  /**
@@ -3723,7 +3736,7 @@ var editRegionStyles = i`
3723
3736
  `;
3724
3737
 
3725
3738
  // src/components/consent-headline.ts
3726
- var PLACEHOLDER = /(\{Agent\}|\{Verb\})/;
3739
+ var PLACEHOLDER = /(\{Agent\}|\{Verb\}|\{Merchant\})/;
3727
3740
  var DETAILS_WIDTH_PX = 304;
3728
3741
  var DETAILS_GAP_PX = 8;
3729
3742
  var DETAILS_GUTTER_PX = 16;
@@ -3739,6 +3752,8 @@ var ConsentHeadline = class extends i4 {
3739
3752
  super(...arguments);
3740
3753
  this.agentName = "";
3741
3754
  this.verb = "";
3755
+ this.template = "";
3756
+ this.merchant = "";
3742
3757
  this.description = "";
3743
3758
  this.eyebrow = "";
3744
3759
  this.preview = false;
@@ -3843,10 +3858,15 @@ var ConsentHeadline = class extends i4 {
3843
3858
  headlinePieces() {
3844
3859
  const tokens = CONSENT_COPY_TOKENS;
3845
3860
  const verb = this.verb.trim();
3846
- const template = verb && verb !== "use" ? tokens.headline.template : tokens.headline.fallbackTemplate;
3861
+ const hasVerb = verb !== "" && verb !== "use";
3862
+ const merchant = this.merchant.trim();
3863
+ const own = this.template.trim();
3864
+ const template = own && (hasVerb || !own.includes("{Verb}")) && (merchant || !own.includes("{Merchant}")) ? own : hasVerb ? tokens.headline.template : tokens.headline.fallbackTemplate;
3847
3865
  return template.split(PLACEHOLDER).map((piece) => {
3848
3866
  if (piece === "{Agent}") return this.renderName();
3849
3867
  if (piece === "{Verb}") return verb;
3868
+ if (piece === "{Merchant}")
3869
+ return b2`<em part="merchant-name">${merchant}</em>`;
3850
3870
  return piece;
3851
3871
  });
3852
3872
  }
@@ -4118,6 +4138,12 @@ __decorateClass([
4118
4138
  __decorateClass([
4119
4139
  n4({ type: String })
4120
4140
  ], ConsentHeadline.prototype, "verb", 2);
4141
+ __decorateClass([
4142
+ n4({ type: String })
4143
+ ], ConsentHeadline.prototype, "template", 2);
4144
+ __decorateClass([
4145
+ n4({ type: String })
4146
+ ], ConsentHeadline.prototype, "merchant", 2);
4121
4147
  __decorateClass([
4122
4148
  n4({ type: String })
4123
4149
  ], ConsentHeadline.prototype, "description", 2);
@@ -4920,6 +4946,7 @@ var ConsentActionBar = class extends i4 {
4920
4946
  <button
4921
4947
  class="action primary"
4922
4948
  part="submit"
4949
+ data-field="approve"
4923
4950
  type="button"
4924
4951
  ?disabled=${this.disabled || this.loading}
4925
4952
  @click=${this.emitAllow}
@@ -4929,6 +4956,7 @@ var ConsentActionBar = class extends i4 {
4929
4956
  <button
4930
4957
  class="action secondary"
4931
4958
  part="cancel"
4959
+ data-field="deny"
4932
4960
  type="button"
4933
4961
  ?disabled=${this.loading}
4934
4962
  @click=${this.emitDeny}
@@ -4947,6 +4975,7 @@ var ConsentActionBar = class extends i4 {
4947
4975
  <div
4948
4976
  class="action primary${this.disabled || this.loading ? " disabled" : ""}"
4949
4977
  part="submit"
4978
+ data-field="approve"
4950
4979
  >
4951
4980
  ${this.renderSubmitIcon()}${editRegion(
4952
4981
  CONSENT_EDIT_KEYS.submitLabel,
@@ -4958,6 +4987,7 @@ var ConsentActionBar = class extends i4 {
4958
4987
  <div
4959
4988
  class="action secondary${this.loading ? " disabled" : ""}"
4960
4989
  part="cancel"
4990
+ data-field="deny"
4961
4991
  >
4962
4992
  ${editRegion(
4963
4993
  CONSENT_EDIT_KEYS.cancelLabel,
@@ -5528,6 +5558,7 @@ var ConsentConnectorHeader = class extends i4 {
5528
5558
  ${this.renderBridge()}
5529
5559
  <div
5530
5560
  class="tile server ${serverLogo ? "has-logo" : ""}"
5561
+ data-field="merchant"
5531
5562
  aria-hidden="true"
5532
5563
  >
5533
5564
  ${serverLogo ? b2`<img
@@ -5788,6 +5819,11 @@ var FIXED_AGENT_TILE_BORDER = "rgba(15, 23, 42, 0.08)";
5788
5819
  var FIXED_AGENT_TILE_TEXT = "#0F172A";
5789
5820
  var TINT_PERCENT = 4;
5790
5821
  var TINT_LINE_PERCENT = 11;
5822
+ var WALLET_SUCCESS = "#10b981";
5823
+ var PAGE_TOKENS = [
5824
+ ["textTertiary", "--cs-page-text"],
5825
+ ["surfaceAccent", "--cs-page-accent"]
5826
+ ];
5791
5827
  var lightTheme = {
5792
5828
  surfaceBg: "#F4F1EA",
5793
5829
  surfaceCard: "#FFFFFF",
@@ -5805,7 +5841,8 @@ var lightTheme = {
5805
5841
  agentTileBg: FIXED_AGENT_TILE_BG,
5806
5842
  agentTileBorder: FIXED_AGENT_TILE_BORDER,
5807
5843
  agentTileText: FIXED_AGENT_TILE_TEXT,
5808
- lockup: "#0810FE"
5844
+ lockup: "#0810FE",
5845
+ errorText: "#B42318"
5809
5846
  };
5810
5847
  var darkTheme = {
5811
5848
  surfaceBg: "#0B0808",
@@ -5823,7 +5860,8 @@ var darkTheme = {
5823
5860
  cardShadow: "0 40px 90px -40px rgba(0, 0, 0, 0.85)",
5824
5861
  agentTileBg: FIXED_AGENT_TILE_BG,
5825
5862
  agentTileBorder: FIXED_AGENT_TILE_BORDER,
5826
- agentTileText: FIXED_AGENT_TILE_TEXT
5863
+ agentTileText: FIXED_AGENT_TILE_TEXT,
5864
+ errorText: "#FCA5A5"
5827
5865
  };
5828
5866
  function getConsentTheme(theme) {
5829
5867
  return theme === "dark" ? darkTheme : lightTheme;
@@ -5838,7 +5876,7 @@ function resolveThemeTokens(tokens) {
5838
5876
  }
5839
5877
  return resolved;
5840
5878
  }
5841
- function themeScopeStyle(tokens, scope) {
5879
+ function themeScopeStyle(tokens, scope, page) {
5842
5880
  const resolved = resolveThemeTokens(tokens);
5843
5881
  const keys = Object.keys(resolved);
5844
5882
  const resolvedName = (key) => `--_${themeTokenProperty(key).slice(2)}`;
@@ -5850,11 +5888,28 @@ function themeScopeStyle(tokens, scope) {
5850
5888
  const publish = keys.map(
5851
5889
  (key) => ` ${themeTokenProperty(key)}: var(${resolvedName(key)});`
5852
5890
  );
5853
- return `:host {
5891
+ if (!page)
5892
+ return `:host {
5854
5893
  ${resolve.join("\n")}
5855
5894
  }
5856
5895
  ${scope} {
5857
5896
  ${publish.join("\n")}
5897
+ }`;
5898
+ const success = ` --_cs-wallet-success: var(--cs-wallet-success, var(--cs-page-success, ${WALLET_SUCCESS}));`;
5899
+ const onPage = [
5900
+ ...PAGE_TOKENS.map(
5901
+ ([key, pageToken]) => ` ${themeTokenProperty(key)}: var(${pageToken}, var(${resolvedName(key)}));`
5902
+ ),
5903
+ " --cs-wallet-success: var(--_cs-wallet-success);"
5904
+ ];
5905
+ return `:host {
5906
+ ${[...resolve, success].join("\n")}
5907
+ }
5908
+ ${scope}, ${page} {
5909
+ ${publish.join("\n")}
5910
+ }
5911
+ ${page} {
5912
+ ${onPage.join("\n")}
5858
5913
  }`;
5859
5914
  }
5860
5915
  var FIXED_TOKENS = {
@@ -5869,7 +5924,8 @@ var DERIVED_TOKENS = {
5869
5924
  mark: (token2) => token2("textPrimary"),
5870
5925
  action: (token2) => token2("textPrimary"),
5871
5926
  lockup: (token2) => token2("textPrimary"),
5872
- warningText: (token2) => token2("textPrimary")
5927
+ warningText: (token2) => token2("textPrimary"),
5928
+ errorText: (token2) => token2("textPrimary")
5873
5929
  };
5874
5930
  var DERIVED_KEYS = Object.keys(DERIVED_TOKENS);
5875
5931
  function themeTokenProperty(key) {
@@ -6260,6 +6316,140 @@ var CONSENT_CAPABILITIES_FEATURES = Object.freeze({
6260
6316
  capabilitySlotPrefix: "capability-"
6261
6317
  });
6262
6318
 
6319
+ // src/flow/copy.ts
6320
+ var FLOW_COPY = {
6321
+ eyebrow: {
6322
+ default: "Permission request",
6323
+ granted: "Permission granted",
6324
+ denied: "Permission declined"
6325
+ },
6326
+ headline: {
6327
+ "sign-in": "Sign in to let {Agent} {Verb} at {Merchant}.",
6328
+ default: "{Agent} would like to {Verb} at {Merchant} on your behalf",
6329
+ granted: "Access granted",
6330
+ denied: "No access given",
6331
+ error: "Something went wrong"
6332
+ },
6333
+ sub: {
6334
+ granted: "{Agent} can now {Verb} at {Merchant} for you.",
6335
+ denied: "{Agent} can't {Verb} for you. Nothing was approved.",
6336
+ error: "Nothing was approved. Try again, or ask {Agent} to start over."
6337
+ },
6338
+ signIn: {
6339
+ continueAs: "Continue as {First}",
6340
+ other: "Not you? Use another {Provider} account.",
6341
+ finePrint: "{Provider} confirms you control this account. {Merchant} does not get your mail, contacts or files."
6342
+ },
6343
+ approver: {
6344
+ label: "You are authorizing",
6345
+ labelGranted: "You authorized",
6346
+ labelDenied: "You declined",
6347
+ party: "To act for you",
6348
+ partyGranted: "Can now act for you",
6349
+ partyDenied: "Asked to act for you",
6350
+ confirmed: "Confirmed with passkey",
6351
+ signedInWith: "Signed in with {Provider}",
6352
+ declined: "Declined",
6353
+ unverified: "Unverified",
6354
+ unverifiedInfo: "It registered itself, so the name it gives is not checked. Allow only if you asked it to.",
6355
+ identifiedBy: "Identified by {Domain}"
6356
+ },
6357
+ capabilitiesHeader: "What {Agent} can do for you",
6358
+ tapToToggle: "Tap to toggle",
6359
+ seal: {
6360
+ "sign-in": "Sign in to continue",
6361
+ consent: "Waiting for your passkey",
6362
+ passkey: "Confirming with your passkey",
6363
+ cancelled: "Passkey not confirmed",
6364
+ granted: "Signed with your passkey",
6365
+ denied: "Nothing was signed",
6366
+ expired: "Request expired",
6367
+ error: "Something went wrong"
6368
+ },
6369
+ details: {
6370
+ title: "Permission details",
6371
+ connectsTo: "Connects to",
6372
+ duration: "Duration",
6373
+ budget: "Budget",
6374
+ amountLimits: "Amount limits",
6375
+ folders: "Folders",
6376
+ alreadyGranted: "Already granted"
6377
+ },
6378
+ actions: {
6379
+ approve: "Approve with passkey",
6380
+ deny: "Deny",
6381
+ confirming: "Confirming\u2026"
6382
+ },
6383
+ status: "Waiting for your passkey\u2026",
6384
+ notice: "Passkey not confirmed. Nothing was approved.",
6385
+ expired: "This request expired. Ask {Agent} to try again.",
6386
+ receipt: { until: "Until {When}" },
6387
+ goBack: "Go back to {Agent} and tell it to continue. Revoke anytime under Connected agents at {Merchant}.",
6388
+ retry: "Try again",
6389
+ terms: { agree: "I agree to the {Terms}" },
6390
+ legal: { label: "Legal" },
6391
+ announce: {
6392
+ "sign-in": "Sign in to continue.",
6393
+ consent: "Review what {Agent} is asking for.",
6394
+ passkey: "Waiting for your passkey.",
6395
+ granted: "Access granted.",
6396
+ denied: "No access given.",
6397
+ cancelled: "Passkey not confirmed. Nothing was approved.",
6398
+ expired: "This request expired.",
6399
+ error: "Something went wrong. Nothing was approved."
6400
+ }
6401
+ };
6402
+ var isGroup = (value) => !!value && typeof value === "object" && !Array.isArray(value);
6403
+ function flowCopy(...layers) {
6404
+ const out = { ...FLOW_COPY };
6405
+ for (const layer of layers) {
6406
+ for (const [key, value] of Object.entries(layer ?? {})) {
6407
+ const base = out[key];
6408
+ out[key] = isGroup(value) && isGroup(base) ? { ...base, ...value } : value;
6409
+ }
6410
+ }
6411
+ return out;
6412
+ }
6413
+ function token(copy, key, step) {
6414
+ const value = copy[key];
6415
+ if (typeof value === "string") return value;
6416
+ if (!isGroup(value)) return "";
6417
+ const entry = (step && value[step]) ?? value.default;
6418
+ return typeof entry === "string" ? entry : "";
6419
+ }
6420
+ function group(copy, key) {
6421
+ const value = copy[key];
6422
+ if (!isGroup(value)) return {};
6423
+ return Object.fromEntries(
6424
+ Object.entries(value).filter(
6425
+ (entry) => typeof entry[1] === "string"
6426
+ )
6427
+ );
6428
+ }
6429
+ function splitTemplate(template) {
6430
+ return template.split(/\{(\w+)\}/).map((part, i8) => i8 % 2 ? { name: part } : { text: part }).filter((part) => part.name || part.text);
6431
+ }
6432
+ function fillTemplate(template, values) {
6433
+ return splitTemplate(template).map((part) => part.name ? values[part.name] ?? "" : part.text).join("");
6434
+ }
6435
+ function initialsOf(name = "", identifier = "") {
6436
+ const first = (word) => Array.from(word.replace(/^[^\p{L}\p{N}]+/u, ""))[0] ?? "";
6437
+ const words = name.trim().split(/\s+/).filter((word) => /[\p{L}\p{N}]/u.test(word));
6438
+ if (words.length >= 2)
6439
+ return (first(words[0]) + first(words[words.length - 1])).toUpperCase();
6440
+ if (words.length === 1) return first(words[0]).toUpperCase();
6441
+ return (first(identifier) || "?").toUpperCase();
6442
+ }
6443
+ function httpsUrl(value) {
6444
+ const raw = typeof value === "string" ? value.trim() : "";
6445
+ if (!raw) return void 0;
6446
+ try {
6447
+ return new URL(raw).protocol === "https:" ? raw : void 0;
6448
+ } catch {
6449
+ return void 0;
6450
+ }
6451
+ }
6452
+
6263
6453
  // src/components/decision-icons.ts
6264
6454
  var PATHS = {
6265
6455
  warning: w`<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" /><path d="M12 9v4" /><path d="M12 17h.01" />`,
@@ -6271,7 +6461,9 @@ var PATHS = {
6271
6461
  alreadyGranted: w`<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" /><path d="M3 3v5h5" /><path d="M12 7v5l4 2" />`,
6272
6462
  info: w`<circle cx="12" cy="12" r="10" /><path d="M12 16v-4" /><path d="M12 8h.01" />`,
6273
6463
  minus: w`<path d="M5 12h14" />`,
6274
- tick: w`<path d="M20 6 9 17l-5-5" />`
6464
+ tick: w`<path d="M20 6 9 17l-5-5" />`,
6465
+ shield: w`<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" /><path d="m9 12 2 2 4-4" />`,
6466
+ arrowRight: w`<path d="M5 12h14" /><path d="m12 5 7 7-7 7" />`
6275
6467
  };
6276
6468
  function decisionIcon(name) {
6277
6469
  return w`<svg
@@ -6285,90 +6477,410 @@ function decisionIcon(name) {
6285
6477
  >${PATHS[name]}</svg>`;
6286
6478
  }
6287
6479
 
6288
- // src/components/grant-details.ts
6289
- function grantDetailRows(details, name) {
6290
- const copy = CONSENT_COPY_TOKENS.grantDetails;
6291
- const resource = details.resource?.trim() ?? "";
6292
- const rows = [];
6293
- if (name || resource) {
6294
- rows.push({
6295
- icon: "resource",
6296
- label: copy.connectsTo,
6297
- values: name ? [name] : [resource],
6298
- ...resource && name ? { note: resource } : {}
6299
- });
6300
- }
6301
- const fact = (icon, label, given) => {
6302
- const values = (given?.values ?? []).filter((value) => value.trim());
6303
- const note = given?.note?.trim();
6304
- if (values.length > 0 || note) {
6305
- rows.push({ icon, label, values, ...note ? { note } : {} });
6306
- }
6307
- };
6308
- fact("duration", copy.duration, details.duration);
6309
- if (details.budget?.trim()) {
6310
- rows.push({
6311
- icon: "budget",
6312
- label: copy.budget,
6313
- values: [details.budget.trim()]
6314
- });
6315
- }
6316
- fact("amountLimits", copy.amountLimits, details.amountLimits);
6317
- fact("alreadyGranted", copy.alreadyGranted, details.alreadyGranted);
6318
- return rows;
6480
+ // src/components/approver-lockup.ts
6481
+ function breakable(value) {
6482
+ return value.split(/(?=[@.])/).map((piece, i8) => i8 ? b2`<wbr />${piece}` : piece);
6319
6483
  }
6320
- function grantDetailsSection(rows, heading = CONSENT_COPY_TOKENS.grantDetails.heading) {
6321
- if (rows.length === 0) return A;
6322
- return b2`<section
6323
- class="grant-details tinted"
6324
- part="grant-details"
6325
- aria-labelledby="grant-details-heading"
6326
- >
6327
- <h2 id="grant-details-heading">${heading}</h2>
6328
- <dl>
6329
- ${rows.map(
6330
- (row) => b2`<div class="fact">
6331
- <span class="fact-icon">${decisionIcon(row.icon)}</span>
6332
- <div class="fact-text">
6333
- <dt class="small">${row.label}</dt>
6334
- ${row.values.map(
6335
- (value) => b2`<dd class="value">${value}</dd>`
6336
- )}
6337
- ${row.note ? b2`<dd class="note small">${row.note}</dd>` : A}
6338
- </div>
6339
- </div>`
6340
- )}
6341
- </dl>
6342
- </section>`;
6484
+ var hide = (event) => {
6485
+ event.target.hidden = true;
6486
+ };
6487
+ var show = (event) => {
6488
+ event.target.hidden = false;
6489
+ };
6490
+ function face(name, identifier = "", avatarUrl = "", size = "md") {
6491
+ const initials = initialsOf(name, identifier);
6492
+ return b2`<span
6493
+ class="face ${size} ${initials.length > 1 ? "two" : ""}"
6494
+ aria-hidden="true"
6495
+ >${initials}${avatarUrl ? b2`<img src=${avatarUrl} alt="" @error=${hide} @load=${show} />` : A}</span
6496
+ >`;
6343
6497
  }
6344
- var grantDetailStyles = i`
6345
- .grant-details {
6346
- margin-top: 16px;
6347
- padding: 16px;
6348
- font-size: 14px;
6349
- line-height: 1.45;
6350
- }
6351
-
6352
- .grant-details h2 {
6353
- margin: 0 0 12px;
6354
- font-size: 14px;
6355
- font-weight: 600;
6356
- }
6357
-
6358
- .grant-details dl {
6498
+ function agentTile(agent) {
6499
+ const initial = initialsOf(agent.name).slice(0, 1);
6500
+ return b2`<span class="tile" aria-hidden="true"
6501
+ >${initial}${agent.logoUrl ? b2`<img src=${agent.logoUrl} alt="" @error=${hide} @load=${show} />` : A}</span
6502
+ >`;
6503
+ }
6504
+ function personRow(person) {
6505
+ return b2`<div class="lockup-row">
6506
+ ${face(person.name, person.identifier, person.avatarUrl)}
6507
+ <div class="lockup-text">
6508
+ <span class="lockup-label">${person.label}</span>
6509
+ <span class="lockup-name">${breakable(person.name)}</span>
6510
+ ${person.detail ? b2`<span class="small">${breakable(person.detail)}</span>` : A}
6511
+ </div>
6512
+ <span
6513
+ class="lockup-mark ${person.declined ? "declined" : ""}"
6514
+ role="img"
6515
+ aria-label=${person.mark}
6516
+ title=${person.mark}
6517
+ >${decisionIcon(person.declined ? "minus" : "check")}</span
6518
+ >
6519
+ </div>`;
6520
+ }
6521
+ function checkRow(check) {
6522
+ return b2`<div class="lockup-row lockup-check" part="approver-check">
6523
+ <span class="lockup-check-icon" aria-hidden="true"
6524
+ >${decisionIcon("check")}</span
6525
+ >
6526
+ <div class="lockup-text">
6527
+ <span class="value">${check.label}</span>
6528
+ ${check.summary ? b2`<span>${check.summary}</span>` : A}
6529
+ ${check.source ? b2`<span class="small">${check.source}</span>` : A}
6530
+ </div>
6531
+ </div>`;
6532
+ }
6533
+ function agentRow(agent) {
6534
+ return b2`<div class="lockup-row party" part="approver-agent">
6535
+ ${agentTile(agent)}
6536
+ <div class="lockup-text">
6537
+ <span class="small">${agent.label}</span>
6538
+ <span class="value">${breakable(agent.name)}</span>
6539
+ </div>
6540
+ ${agent.status ? b2`<span
6541
+ class="party-status ${agent.unverified ? "unverified" : ""}"
6542
+ part="agent-status"
6543
+ >${breakable(agent.status)}${agent.info ? b2`<button
6544
+ type="button"
6545
+ class="info"
6546
+ aria-label=${agent.status}
6547
+ aria-describedby="agent-status-info"
6548
+ >
6549
+ ${decisionIcon("info")}</button
6550
+ ><span class="tip" id="agent-status-info" role="tooltip"
6551
+ >${agent.info}</span
6552
+ >` : A}</span
6553
+ >` : A}
6554
+ </div>`;
6555
+ }
6556
+ function approverLockup(view) {
6557
+ return b2`<div class="tinted lockup" part="approver">
6558
+ ${view.person ? personRow(view.person) : A}
6559
+ ${(view.checks ?? []).map(checkRow)}
6560
+ ${view.agent ? agentRow(view.agent) : A}
6561
+ </div>`;
6562
+ }
6563
+ var approverLockupStyles = i`
6564
+ /* Names break only where a word can't fit, and an address at its "@" and
6565
+ dots first (breakable). */
6566
+ .lockup {
6359
6567
  display: flex;
6360
6568
  flex-direction: column;
6361
6569
  gap: 12px;
6362
- margin: 0;
6570
+ padding: 16px 18px;
6571
+ container-type: inline-size;
6363
6572
  }
6364
6573
 
6365
- .fact {
6574
+ .lockup-row {
6366
6575
  display: flex;
6367
- align-items: flex-start;
6576
+ align-items: center;
6368
6577
  gap: 12px;
6578
+ min-width: 0;
6369
6579
  }
6370
6580
 
6371
- .fact-icon {
6581
+ .lockup-row.party,
6582
+ .lockup-check:not(:first-child) {
6583
+ padding-top: 12px;
6584
+ border-top: 1px solid var(--cs-tint-line);
6585
+ }
6586
+
6587
+ .lockup-check {
6588
+ align-items: flex-start;
6589
+ font-size: 14px;
6590
+ line-height: 1.45;
6591
+ }
6592
+
6593
+ .lockup-text {
6594
+ display: flex;
6595
+ flex: 1;
6596
+ flex-direction: column;
6597
+ gap: 2px;
6598
+ min-width: 0;
6599
+ }
6600
+
6601
+ .lockup-label {
6602
+ font-size: 10px;
6603
+ letter-spacing: 0.16em;
6604
+ font-weight: 600;
6605
+ text-transform: uppercase;
6606
+ color: var(--cs-text-tertiary);
6607
+ }
6608
+
6609
+ .lockup-name {
6610
+ font-size: 20px;
6611
+ font-weight: 600;
6612
+ line-height: 1.2;
6613
+ overflow-wrap: break-word;
6614
+ }
6615
+
6616
+ .lockup-text .value {
6617
+ font-weight: 500;
6618
+ overflow-wrap: break-word;
6619
+ }
6620
+
6621
+ .lockup-mark {
6622
+ display: grid;
6623
+ flex-shrink: 0;
6624
+ color: var(--cs-wallet-success, var(--cs-mark));
6625
+ }
6626
+
6627
+ .lockup-mark.declined {
6628
+ color: var(--cs-text-tertiary);
6629
+ }
6630
+
6631
+ .lockup-mark svg {
6632
+ width: 22px;
6633
+ height: 22px;
6634
+ }
6635
+
6636
+ /* A check's mark sits in the face's column, so its words line up with the name. */
6637
+ .lockup-check-icon {
6638
+ display: grid;
6639
+ place-items: center;
6640
+ flex-shrink: 0;
6641
+ width: 42px;
6642
+ color: var(--cs-mark);
6643
+ }
6644
+
6645
+ .lockup-check-icon svg {
6646
+ width: 20px;
6647
+ height: 20px;
6648
+ }
6649
+
6650
+ .face,
6651
+ .tile {
6652
+ position: relative;
6653
+ display: grid;
6654
+ place-items: center;
6655
+ flex-shrink: 0;
6656
+ width: 42px;
6657
+ height: 42px;
6658
+ overflow: hidden;
6659
+ font-weight: 600;
6660
+ }
6661
+
6662
+ .face {
6663
+ border-radius: 50%;
6664
+ background: var(--cs-surface-accent);
6665
+ color: var(--cs-surface-accent-text);
6666
+ font-size: 17px;
6667
+ }
6668
+
6669
+ .face.two {
6670
+ font-size: 15px;
6671
+ letter-spacing: 0.02em;
6672
+ }
6673
+
6674
+ .face.sm {
6675
+ width: 32px;
6676
+ height: 32px;
6677
+ font-size: 13px;
6678
+ }
6679
+
6680
+ .face img {
6681
+ position: absolute;
6682
+ inset: 0;
6683
+ width: 100%;
6684
+ height: 100%;
6685
+ object-fit: cover;
6686
+ }
6687
+
6688
+ .tile {
6689
+ border-radius: var(--cs-tile-radius, 10px);
6690
+ border: 1px solid var(--cs-agent-tile-border, rgba(15, 23, 42, 0.16));
6691
+ background: var(--cs-surface-accent);
6692
+ color: var(--cs-surface-accent-text);
6693
+ font-size: 18px;
6694
+ }
6695
+
6696
+ .tile img {
6697
+ position: absolute;
6698
+ inset: 0;
6699
+ width: 100%;
6700
+ height: 100%;
6701
+ padding: 4px;
6702
+ box-sizing: border-box;
6703
+ object-fit: contain;
6704
+ background: var(--cs-agent-tile-bg, #ffffff);
6705
+ }
6706
+
6707
+ .party-status {
6708
+ position: relative;
6709
+ display: inline-flex;
6710
+ align-items: center;
6711
+ gap: 4px;
6712
+ flex-shrink: 0;
6713
+ font-size: 13px;
6714
+ font-weight: 500;
6715
+ color: var(--cs-text-secondary);
6716
+ }
6717
+
6718
+ .party-status.unverified {
6719
+ color: var(--cs-warning-text, var(--cs-text-primary));
6720
+ }
6721
+
6722
+ /* A phone-width card: smaller faces and padding, and the agent's status
6723
+ under its name, so the names keep their width. */
6724
+ @container (max-width: 300px) {
6725
+ .lockup-row {
6726
+ gap: 10px;
6727
+ }
6728
+
6729
+ .lockup-row.party {
6730
+ flex-wrap: wrap;
6731
+ }
6732
+
6733
+ .face,
6734
+ .tile {
6735
+ width: 36px;
6736
+ height: 36px;
6737
+ }
6738
+
6739
+ .lockup-check-icon {
6740
+ width: 36px;
6741
+ }
6742
+
6743
+ .party-status {
6744
+ flex-basis: 100%;
6745
+ flex-shrink: 1;
6746
+ min-width: 0;
6747
+ padding-left: 46px;
6748
+ overflow-wrap: break-word;
6749
+ }
6750
+ }
6751
+
6752
+ .info {
6753
+ display: inline-grid;
6754
+ place-items: center;
6755
+ width: 22px;
6756
+ height: 22px;
6757
+ padding: 0;
6758
+ border: 0;
6759
+ border-radius: 50%;
6760
+ background: none;
6761
+ color: var(--cs-text-tertiary);
6762
+ cursor: help;
6763
+ }
6764
+
6765
+ .info svg {
6766
+ width: 16px;
6767
+ height: 16px;
6768
+ }
6769
+
6770
+ .info:focus-visible {
6771
+ outline: 2px solid var(--cs-focus-ring, currentColor);
6772
+ outline-offset: 1px;
6773
+ }
6774
+
6775
+ .tip {
6776
+ position: absolute;
6777
+ top: calc(100% + 8px);
6778
+ right: -6px;
6779
+ z-index: 5;
6780
+ width: 240px;
6781
+ padding: 8px 10px;
6782
+ border-radius: 8px;
6783
+ background: var(--cs-text-primary);
6784
+ color: var(--cs-surface-card);
6785
+ font-size: 12px;
6786
+ font-weight: 400;
6787
+ line-height: 1.45;
6788
+ text-align: left;
6789
+ opacity: 0;
6790
+ visibility: hidden;
6791
+ }
6792
+
6793
+ .party-status:hover .tip,
6794
+ .info:focus-visible + .tip {
6795
+ opacity: 1;
6796
+ visibility: visible;
6797
+ }
6798
+ `;
6799
+
6800
+ // src/components/grant-details.ts
6801
+ function grantDetailRows(details, name) {
6802
+ const copy = CONSENT_COPY_TOKENS.grantDetails;
6803
+ const resource = details.resource?.trim() ?? "";
6804
+ const rows = [];
6805
+ if (name || resource) {
6806
+ rows.push({
6807
+ icon: "resource",
6808
+ label: copy.connectsTo,
6809
+ values: name ? [name] : [resource],
6810
+ ...resource && name ? { note: resource } : {}
6811
+ });
6812
+ }
6813
+ const fact = (icon, label, given) => {
6814
+ const values = (given?.values ?? []).filter((value) => value.trim());
6815
+ const note = given?.note?.trim();
6816
+ if (values.length > 0 || note) {
6817
+ rows.push({ icon, label, values, ...note ? { note } : {} });
6818
+ }
6819
+ };
6820
+ fact("duration", copy.duration, details.duration);
6821
+ if (details.budget?.trim()) {
6822
+ rows.push({
6823
+ icon: "budget",
6824
+ label: copy.budget,
6825
+ values: [details.budget.trim()]
6826
+ });
6827
+ }
6828
+ fact("amountLimits", copy.amountLimits, details.amountLimits);
6829
+ fact("alreadyGranted", copy.alreadyGranted, details.alreadyGranted);
6830
+ return rows;
6831
+ }
6832
+ function grantDetailsSection(rows, heading = CONSENT_COPY_TOKENS.grantDetails.heading) {
6833
+ if (rows.length === 0) return A;
6834
+ return b2`<section
6835
+ class="grant-details tinted"
6836
+ part="grant-details"
6837
+ aria-labelledby="grant-details-heading"
6838
+ >
6839
+ <h2 id="grant-details-heading">${heading}</h2>
6840
+ <dl>
6841
+ ${rows.map(
6842
+ (row) => b2`<div class="fact">
6843
+ <span class="fact-icon">${decisionIcon(row.icon)}</span>
6844
+ <div class="fact-text">
6845
+ <dt class="small">${row.label}</dt>
6846
+ ${row.values.map(
6847
+ (value) => b2`<dd class="value">${value}</dd>`
6848
+ )}
6849
+ ${row.note ? b2`<dd class="note small">${row.note}</dd>` : A}
6850
+ </div>
6851
+ </div>`
6852
+ )}
6853
+ </dl>
6854
+ </section>`;
6855
+ }
6856
+ var grantDetailStyles = i`
6857
+ .grant-details {
6858
+ margin-top: 16px;
6859
+ padding: 16px;
6860
+ font-size: 14px;
6861
+ line-height: 1.45;
6862
+ }
6863
+
6864
+ .grant-details h2 {
6865
+ margin: 0 0 12px;
6866
+ font-size: 14px;
6867
+ font-weight: 600;
6868
+ }
6869
+
6870
+ .grant-details dl {
6871
+ display: flex;
6872
+ flex-direction: column;
6873
+ gap: 12px;
6874
+ margin: 0;
6875
+ }
6876
+
6877
+ .fact {
6878
+ display: flex;
6879
+ align-items: flex-start;
6880
+ gap: 12px;
6881
+ }
6882
+
6883
+ .fact-icon {
6372
6884
  display: grid;
6373
6885
  place-items: center;
6374
6886
  width: 32px;
@@ -6429,8 +6941,8 @@ function durationOptionsWithin(options, maxSeconds) {
6429
6941
  if (maxSeconds === void 0 || !Number.isFinite(maxSeconds)) {
6430
6942
  return valid;
6431
6943
  }
6432
- const within = valid.filter((o9) => o9.seconds <= maxSeconds);
6433
- if (within.length > 0) return within;
6944
+ const within2 = valid.filter((o9) => o9.seconds <= maxSeconds);
6945
+ if (within2.length > 0) return within2;
6434
6946
  const shortest = valid.reduce((a4, b4) => b4.seconds < a4.seconds ? b4 : a4);
6435
6947
  return [shortest];
6436
6948
  }
@@ -7107,10 +7619,15 @@ var ConsentCapabilitiesScreen = class extends i4 {
7107
7619
  this.fixedExpiry = false;
7108
7620
  this.theme = "light";
7109
7621
  this.howItWorksUrl = "";
7622
+ this.error = "";
7110
7623
  this.loading = false;
7111
7624
  this.disabled = false;
7625
+ this.eyebrow = "";
7626
+ this.headline = "";
7627
+ this.infoNote = "";
7112
7628
  this.description = "";
7113
7629
  this.submitLabel = "";
7630
+ this.heldScopes = [];
7114
7631
  this.showIcons = false;
7115
7632
  this.hideRisk = false;
7116
7633
  this.hideScopes = false;
@@ -7147,20 +7664,8 @@ var ConsentCapabilitiesScreen = class extends i4 {
7147
7664
  };
7148
7665
  this.onAllow = () => {
7149
7666
  if (this.preview || this.loading || this.approvalDisabled) return;
7150
- const selectedCapabilities = this.capabilities.filter(
7151
- (c6) => this.selected.has(c6.id)
7152
- );
7153
- if (selectedCapabilities.length === 0) return;
7154
- const selectedIds = selectedCapabilities.map((c6) => c6.id);
7155
- const selectedScopes = Array.from(
7156
- new Set(selectedCapabilities.flatMap((c6) => c6.scopes))
7157
- );
7158
- const terms = this.slottedTerms;
7159
- const detail = {
7160
- selectedCapabilityIds: selectedIds,
7161
- selectedScopes,
7162
- ...terms.length > 0 ? { grantTerms: mergeGrantTerms(...terms.map((t8) => t8.grantTerms)) } : {}
7163
- };
7667
+ const detail = this.approvalDetail(this.selected);
7668
+ if (!detail) return;
7164
7669
  this.dispatchEvent(
7165
7670
  new CustomEvent("capabilities-allow", {
7166
7671
  detail,
@@ -7187,6 +7692,11 @@ var ConsentCapabilitiesScreen = class extends i4 {
7187
7692
  super.connectedCallback();
7188
7693
  this.seedDefaults();
7189
7694
  }
7695
+ updated(changed) {
7696
+ if (changed.has("error") && this.error) {
7697
+ this.renderRoot.querySelector(".error")?.scrollIntoView?.({ block: "nearest" });
7698
+ }
7699
+ }
7190
7700
  willUpdate(changed) {
7191
7701
  if (changed.has("capabilities") || changed.has("allSelected")) {
7192
7702
  this.seedDefaults();
@@ -7216,7 +7726,8 @@ var ConsentCapabilitiesScreen = class extends i4 {
7216
7726
  hostStyle() {
7217
7727
  return themeScopeStyle(
7218
7728
  getConsentTheme(this.theme),
7219
- ".card, consent-connector-header, .below"
7729
+ ".card",
7730
+ "consent-connector-header, .below"
7220
7731
  );
7221
7732
  }
7222
7733
  /** Grant terms in the `details` slot. None when rendered without a DOM. */
@@ -7230,6 +7741,39 @@ var ConsentCapabilitiesScreen = class extends i4 {
7230
7741
  (capability2) => !this.selected.has(capability2.id)
7231
7742
  );
7232
7743
  }
7744
+ /** What approving `selected` sends: its rows, their scopes and any grant terms. */
7745
+ approvalDetail(selected) {
7746
+ const selectedCapabilities = this.capabilities.filter(
7747
+ (c6) => selected.has(c6.id)
7748
+ );
7749
+ if (selectedCapabilities.length === 0) return null;
7750
+ const terms = this.slottedTerms;
7751
+ return {
7752
+ selectedCapabilityIds: selectedCapabilities.map((c6) => c6.id),
7753
+ selectedScopes: Array.from(
7754
+ new Set(selectedCapabilities.flatMap((c6) => c6.scopes))
7755
+ ),
7756
+ ...terms.length > 0 ? { grantTerms: mergeGrantTerms(...terms.map((t8) => t8.grantTerms)) } : {}
7757
+ };
7758
+ }
7759
+ /** A row's check can't start while the screen is busy or its terms can't be used. */
7760
+ get checkDisabled() {
7761
+ return this.loading || this.disabled || this.slottedTerms.some((terms) => terms.valid === false);
7762
+ }
7763
+ onCheck(capability2) {
7764
+ if (this.preview || this.checkDisabled) return;
7765
+ const approval = this.approvalDetail(
7766
+ /* @__PURE__ */ new Set([...this.selected, capability2.id])
7767
+ );
7768
+ if (!approval) return;
7769
+ this.dispatchEvent(
7770
+ new CustomEvent("capability-check", {
7771
+ detail: { ...approval, capabilityId: capability2.id },
7772
+ bubbles: true,
7773
+ composed: true
7774
+ })
7775
+ );
7776
+ }
7233
7777
  compileCapabilityCedar(capability2) {
7234
7778
  const cedar = capability2.cedar?.trim() || "";
7235
7779
  if (!cedar) return "";
@@ -7260,6 +7804,8 @@ var ConsentCapabilitiesScreen = class extends i4 {
7260
7804
  const agent = this.resolveAgent();
7261
7805
  const editing = isEditing(this);
7262
7806
  const agentName = agent?.name || "this agent";
7807
+ const approver2 = this.renderApprover(agent);
7808
+ const warning = approver2 !== A && agent?.name ? A : this.renderUnverified(agent);
7263
7809
  return b2`
7264
7810
  <style>
7265
7811
  ${this.hostStyle()}
@@ -7280,20 +7826,26 @@ var ConsentCapabilitiesScreen = class extends i4 {
7280
7826
  ></consent-connector-header>
7281
7827
  <div class="card" part="card">
7282
7828
  <consent-headline
7283
- exportparts="eyebrow, headline, agent-name, subhead, agent-details"
7829
+ exportparts="eyebrow, headline, agent-name, merchant-name, subhead, agent-details"
7284
7830
  agent-name="${agent?.name ?? ""}"
7285
7831
  .agent=${agent}
7286
7832
  verb="${this.headlineVerb}"
7833
+ eyebrow="${this.eyebrow}"
7834
+ template="${this.headline}"
7835
+ merchant="${this.orgName}"
7287
7836
  description="${this.description}"
7288
7837
  ?preview=${this.preview}
7289
7838
  ?editable=${editing}
7290
7839
  .editSource=${this.editSource}
7291
7840
  ><slot name="headline" slot="headline"></slot
7292
7841
  ></consent-headline>
7842
+ ${this.error ? b2`<p class="error" part="error" role="alert">
7843
+ ${decisionIcon("warning")}<span>${this.error}</span>
7844
+ </p>` : A}
7293
7845
  <slot name="recovery"></slot>
7294
- ${this.renderUnverified(agent)}
7846
+ ${warning}
7295
7847
  <slot name="identity"></slot>
7296
- ${this.renderApprover()}
7848
+ ${approver2}
7297
7849
  <slot name="agent-key"></slot>
7298
7850
  <div part="permissions">
7299
7851
  ${this.renderSectionHeader(agentName, editing)}
@@ -7317,7 +7869,7 @@ var ConsentCapabilitiesScreen = class extends i4 {
7317
7869
  ?editable=${editing}
7318
7870
  .editSource=${this.editSource}
7319
7871
  exportparts=${CAPABILITY_ROW_EXPORT_PARTS}
7320
- ><slot
7872
+ >${capability2.check ? this.renderCheck(capability2, capability2.check.action) : A}${this.renderHeld(capability2)}<slot
7321
7873
  name=${capabilitySlotName(capability2.id)}
7322
7874
  slot="extra"
7323
7875
  ></slot
@@ -7328,7 +7880,7 @@ var ConsentCapabilitiesScreen = class extends i4 {
7328
7880
  </div>
7329
7881
  <slot name="auth"></slot>
7330
7882
  <slot name="details"></slot>
7331
- ${this.renderGrantDetails(editing)}
7883
+ ${this.renderGrantDetails(editing)} ${this.renderInfoNote(agentName)}
7332
7884
  <slot name="notice"
7333
7885
  >${this.grantDetails ? A : b2`<consent-revocation-notice
7334
7886
  revocationPath="${this.revocationPath}"
@@ -7379,11 +7931,65 @@ var ConsentCapabilitiesScreen = class extends i4 {
7379
7931
  >` : A}
7380
7932
  </div>`;
7381
7933
  }
7934
+ /**
7935
+ * "Requires verification" and the button that starts a row's check. It is
7936
+ * in the row's `extra` slot, whose clicks the row leaves alone.
7937
+ */
7938
+ renderCheck(capability2, action) {
7939
+ return b2`<div
7940
+ slot="extra"
7941
+ class="row-check tinted"
7942
+ part="capability-verify"
7943
+ data-capability-check=${capability2.id}
7944
+ >
7945
+ <span class="row-check-label" part="capability-verify-label"
7946
+ >${decisionIcon("shield")}${CONSENT_COPY_TOKENS.capabilityRow.checkRequired}</span
7947
+ >
7948
+ <button
7949
+ type="button"
7950
+ class="row-check-action"
7951
+ part="capability-verify-action"
7952
+ ?disabled=${this.checkDisabled}
7953
+ @click=${() => this.onCheck(capability2)}
7954
+ >
7955
+ <span>${action}</span>${decisionIcon("arrowRight")}
7956
+ </button>
7957
+ </div>`;
7958
+ }
7959
+ /**
7960
+ * "<scope> stays granted because of your earlier approval." under an
7961
+ * unticked row, for each scope of it that an earlier approval holds. The
7962
+ * live region stays while the row is ticked, so the words are announced as
7963
+ * they appear.
7964
+ */
7965
+ renderHeld(capability2) {
7966
+ const held = new Set(this.heldScopes);
7967
+ const scopes = [...new Set(capability2.scopes ?? [])].filter(
7968
+ (scope) => held.has(scope)
7969
+ );
7970
+ if (scopes.length === 0) return A;
7971
+ const unticked = !this.selected.has(capability2.id);
7972
+ const words = splitTemplate(CONSENT_COPY_TOKENS.capabilityRow.heldNotice);
7973
+ return b2`<div
7974
+ slot="extra"
7975
+ class="held"
7976
+ part="capability-held"
7977
+ role="status"
7978
+ >
7979
+ ${unticked ? scopes.map(
7980
+ (scope) => b2`<p class="held-notice" data-held-scope=${scope}>
7981
+ ${words.map(
7982
+ (part) => part.name === "Scope" ? b2`<code class="held-scope">${scope}</code>` : part.text ?? ""
7983
+ )}
7984
+ </p>`
7985
+ ) : A}
7986
+ </div>`;
7987
+ }
7382
7988
  /** The warning for an agent that registered itself: its name is not checked. */
7383
7989
  renderUnverified(agent) {
7384
7990
  if (!agent || agentVerification(agent) !== "unverified") return A;
7385
7991
  const copy = CONSENT_COPY_TOKENS;
7386
- return b2`<div class="unverified" part="unverified">
7992
+ return b2`<div class="unverified-note" part="unverified">
7387
7993
  <p class="unverified-heading">${copy.unverifiedAgent.heading}</p>
7388
7994
  <p class="unverified-body">
7389
7995
  ${copy.agentDetails.unverifiedExplanation}
@@ -7391,36 +7997,51 @@ var ConsentCapabilitiesScreen = class extends i4 {
7391
7997
  </p>
7392
7998
  </div>`;
7393
7999
  }
7394
- /** Who is signing in, and the checks they passed; nothing when there is neither. */
7395
- renderApprover() {
8000
+ /**
8001
+ * Who is signing in and the checks they passed, over the agent they
8002
+ * authorize; nothing when there is no identifier, name or check.
8003
+ */
8004
+ renderApprover(agent) {
8005
+ const copy = CONSENT_COPY_TOKENS;
7396
8006
  const identifier = this.approver?.identifier?.trim() ?? "";
8007
+ const name = this.approver?.name?.trim() ?? "";
8008
+ const method = this.approver?.method?.trim() ?? "";
7397
8009
  const checks = (this.approver?.checks ?? []).filter(
7398
8010
  (check) => check.label.trim()
7399
8011
  );
7400
- if (!identifier && checks.length === 0) return A;
7401
- return b2`<div class="approver tinted" part="approver">
7402
- ${identifier ? b2`<div class="signed-in">
7403
- <span class="avatar" aria-hidden="true"
7404
- >${initialOf(identifier)}</span
7405
- >
7406
- <span class="who">
7407
- <span class="small"
7408
- >${CONSENT_COPY_TOKENS.approver.signedIn}</span
7409
- >
7410
- <span class="identifier">${identifier}</span>
7411
- </span>
7412
- </div>` : A}
7413
- ${checks.map(
7414
- (check, index) => b2`<div class="check${identifier || index > 0 ? " ruled" : ""}">
7415
- <span class="check-icon">${decisionIcon("check")}</span>
7416
- <span class="who">
7417
- <span class="strong">${check.label}</span>
7418
- ${check.summary ? b2`<span>${check.summary}</span>` : A}
7419
- ${check.source ? b2`<span class="small">${check.source}</span>` : A}
7420
- </span>
7421
- </div>`
7422
- )}
7423
- </div>`;
8012
+ const shown = name || identifier;
8013
+ if (!shown && checks.length === 0) return A;
8014
+ const under = name && identifier && identifier !== name ? identifier : "";
8015
+ return approverLockup({
8016
+ person: shown ? {
8017
+ label: copy.approver.label,
8018
+ name: shown,
8019
+ identifier,
8020
+ detail: under || method,
8021
+ mark: method ? formatToken(copy.approver.signedInWith, { Method: method }) : copy.approver.signedInMark
8022
+ } : void 0,
8023
+ checks,
8024
+ agent: agent?.name ? this.lockupAgent(agent) : void 0
8025
+ });
8026
+ }
8027
+ /**
8028
+ * The agent's row: its name and tile, with "Unverified" or the domain it is
8029
+ * identified by. Each status has an info button: the unverified one says
8030
+ * what that means, and the domain one carries the host's `identityNote`
8031
+ * when it gives one.
8032
+ */
8033
+ lockupAgent(agent) {
8034
+ const copy = CONSENT_COPY_TOKENS;
8035
+ const unverified = agentVerification(agent) === "unverified";
8036
+ const domain = agent.domain?.trim() ?? "";
8037
+ return {
8038
+ name: agent.name,
8039
+ logoUrl: agent.logoUrl,
8040
+ label: copy.approver.party,
8041
+ status: unverified ? copy.agentDetails.unverified : domain ? formatToken(copy.agentDetails.identifiedBy, { Host: domain }) : "",
8042
+ unverified,
8043
+ info: unverified ? `${copy.agentDetails.unverifiedExplanation} ${copy.unverifiedAgent.advice}` : domain && agent.identityNote?.trim() || void 0
8044
+ };
7424
8045
  }
7425
8046
  /** The "Permission details" box, when the host gives `grantDetails`. */
7426
8047
  renderGrantDetails(editing) {
@@ -7437,6 +8058,20 @@ var ConsentCapabilitiesScreen = class extends i4 {
7437
8058
  grantDetailRows(details, org || editing ? orgValue : "")
7438
8059
  );
7439
8060
  }
8061
+ /** The host's note under "Permission details"; nothing without one. */
8062
+ renderInfoNote(agentName) {
8063
+ const words = this.infoNote.trim();
8064
+ if (!words) return A;
8065
+ return b2`<p class="info-note tinted" part="info-note">
8066
+ ${decisionIcon("info")}<span
8067
+ >${formatToken(words, {
8068
+ Agent: agentName,
8069
+ Verb: this.headlineVerb.trim(),
8070
+ Merchant: this.orgName.trim()
8071
+ })}</span
8072
+ >
8073
+ </p>`;
8074
+ }
7440
8075
  /**
7441
8076
  * The host's legal links, or a "How does this work?" link when the host
7442
8077
  * gives its address; nothing when there is neither.
@@ -7456,6 +8091,7 @@ ConsentCapabilitiesScreen.features = CONSENT_CAPABILITIES_FEATURES;
7456
8091
  ConsentCapabilitiesScreen.styles = i`
7457
8092
  ${editRegionStyles}
7458
8093
  ${grantDetailStyles}
8094
+ ${approverLockupStyles}
7459
8095
 
7460
8096
  /* The box is on an inner element: a page's reset (such as
7461
8097
  Tailwind's "* { padding: 0; margin: 0; border: 0 }") reaches the host,
@@ -7517,7 +8153,7 @@ ConsentCapabilitiesScreen.styles = i`
7517
8153
  flex-shrink: 0;
7518
8154
  }
7519
8155
 
7520
- .unverified {
8156
+ .unverified-note {
7521
8157
  display: flex;
7522
8158
  flex-direction: column;
7523
8159
  gap: 2px;
@@ -7526,7 +8162,7 @@ ConsentCapabilitiesScreen.styles = i`
7526
8162
  line-height: 1.45;
7527
8163
  }
7528
8164
 
7529
- .unverified p {
8165
+ .unverified-note p {
7530
8166
  margin: 0;
7531
8167
  }
7532
8168
 
@@ -7545,67 +8181,134 @@ ConsentCapabilitiesScreen.styles = i`
7545
8181
  background: var(--cs-tint);
7546
8182
  }
7547
8183
 
7548
- .approver {
7549
- margin-top: 16px;
7550
- padding: 12px 16px;
8184
+ .error {
8185
+ display: flex;
8186
+ align-items: flex-start;
8187
+ gap: 8px;
8188
+ margin: 16px 0 0;
7551
8189
  font-size: 14px;
7552
8190
  line-height: 1.45;
8191
+ color: var(--cs-error-text, var(--cs-text-primary));
7553
8192
  }
7554
8193
 
7555
- .signed-in,
7556
- .check {
7557
- display: flex;
7558
- align-items: center;
7559
- gap: 12px;
8194
+ .error svg {
8195
+ flex: none;
8196
+ width: 16px;
8197
+ height: 16px;
8198
+ margin-top: 2px;
7560
8199
  }
7561
8200
 
7562
- .check {
8201
+ /* Under "Permission details": the card's gap alone spaces it, as in consent-flow. */
8202
+ .info-note {
8203
+ display: flex;
7563
8204
  align-items: flex-start;
8205
+ gap: 8px;
8206
+ margin: 0;
8207
+ padding: 12px 14px;
8208
+ font-size: 13px;
8209
+ line-height: 1.45;
8210
+ color: var(--cs-text-secondary);
7564
8211
  }
7565
8212
 
7566
- .ruled {
7567
- margin-top: 12px;
7568
- padding-top: 12px;
7569
- border-top: 1px solid var(--cs-tint-line);
8213
+ .info-note svg {
8214
+ width: 16px;
8215
+ height: 16px;
8216
+ margin-top: 2px;
8217
+ color: var(--cs-text-tertiary);
7570
8218
  }
7571
8219
 
7572
- .avatar,
7573
- .check-icon {
7574
- display: grid;
7575
- place-items: center;
7576
- width: 40px;
7577
- height: 40px;
7578
- flex-shrink: 0;
8220
+ .held-notice {
8221
+ margin: 6px 0 0;
8222
+ font-size: 13px;
8223
+ line-height: 1.45;
8224
+ color: var(--cs-text-secondary);
7579
8225
  }
7580
8226
 
7581
- .avatar {
7582
- border-radius: 50%;
7583
- background: var(--cs-surface-accent);
7584
- color: var(--cs-surface-accent-text);
8227
+ .held-scope {
8228
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
8229
+ font-size: 12px;
8230
+ color: var(--cs-text-primary);
8231
+ word-break: break-all;
8232
+ }
8233
+
8234
+ .row-check {
8235
+ display: flex;
8236
+ flex-wrap: wrap;
8237
+ align-items: center;
8238
+ justify-content: space-between;
8239
+ gap: 6px 12px;
8240
+ margin-top: 4px;
8241
+ padding: 8px 12px;
8242
+ border-radius: 8px;
8243
+ }
8244
+
8245
+ .row-check-label {
8246
+ display: inline-flex;
8247
+ align-items: center;
8248
+ gap: 6px;
8249
+ font-size: 14px;
8250
+ font-weight: 500;
8251
+ color: var(--cs-text-primary);
8252
+ }
8253
+
8254
+ .row-check-label svg {
8255
+ flex: none;
8256
+ width: 16px;
8257
+ height: 16px;
8258
+ color: var(--cs-mark, var(--cs-text-primary));
8259
+ }
8260
+
8261
+ .row-check-action {
8262
+ display: inline-flex;
8263
+ align-items: center;
8264
+ gap: 4px;
8265
+ margin-left: auto;
8266
+ padding: 0;
8267
+ border: 0;
8268
+ border-radius: 4px;
8269
+ background: transparent;
8270
+ font: inherit;
8271
+ font-size: 14px;
7585
8272
  font-weight: 600;
8273
+ color: var(--cs-action, var(--cs-text-primary));
8274
+ cursor: pointer;
7586
8275
  }
7587
8276
 
7588
- .check-icon {
7589
- color: var(--cs-mark);
8277
+ .row-check-action span {
8278
+ text-decoration: underline;
8279
+ text-decoration-thickness: 0.1em;
8280
+ text-underline-offset: 0.25em;
7590
8281
  }
7591
8282
 
7592
- .check-icon svg {
7593
- width: 20px;
7594
- height: 20px;
8283
+ .row-check-action svg {
8284
+ flex: none;
8285
+ width: 14px;
8286
+ height: 14px;
8287
+ transition: transform 150ms ease-out;
7595
8288
  }
7596
8289
 
7597
- .who {
7598
- display: flex;
7599
- flex-direction: column;
7600
- gap: 2px;
7601
- min-width: 0;
8290
+ .row-check-action:hover:not(:disabled) svg {
8291
+ transform: translateX(2px);
7602
8292
  }
7603
8293
 
7604
- .identifier {
7605
- font-weight: 500;
7606
- overflow: hidden;
7607
- text-overflow: ellipsis;
7608
- white-space: nowrap;
8294
+ .row-check-action:focus-visible {
8295
+ outline: 2px solid var(--cs-focus-ring);
8296
+ outline-offset: 2px;
8297
+ }
8298
+
8299
+ .row-check-action:disabled {
8300
+ cursor: not-allowed;
8301
+ opacity: 0.6;
8302
+ }
8303
+
8304
+ @media (prefers-reduced-motion: reduce) {
8305
+ .row-check-action svg {
8306
+ transition: none;
8307
+ }
8308
+ }
8309
+
8310
+ .lockup {
8311
+ margin-top: 16px;
7609
8312
  }
7610
8313
 
7611
8314
  .small {
@@ -7613,10 +8316,6 @@ ConsentCapabilitiesScreen.styles = i`
7613
8316
  color: var(--cs-text-tertiary);
7614
8317
  }
7615
8318
 
7616
- .strong {
7617
- font-weight: 500;
7618
- }
7619
-
7620
8319
  .below {
7621
8320
  display: flex;
7622
8321
  flex-direction: column;
@@ -7691,12 +8390,24 @@ __decorateClass([
7691
8390
  __decorateClass([
7692
8391
  n4({ type: String, attribute: "how-it-works-url" })
7693
8392
  ], ConsentCapabilitiesScreen.prototype, "howItWorksUrl", 2);
8393
+ __decorateClass([
8394
+ n4({ type: String })
8395
+ ], ConsentCapabilitiesScreen.prototype, "error", 2);
7694
8396
  __decorateClass([
7695
8397
  n4({ type: Boolean })
7696
8398
  ], ConsentCapabilitiesScreen.prototype, "loading", 2);
7697
8399
  __decorateClass([
7698
8400
  n4({ type: Boolean })
7699
8401
  ], ConsentCapabilitiesScreen.prototype, "disabled", 2);
8402
+ __decorateClass([
8403
+ n4({ type: String })
8404
+ ], ConsentCapabilitiesScreen.prototype, "eyebrow", 2);
8405
+ __decorateClass([
8406
+ n4({ type: String })
8407
+ ], ConsentCapabilitiesScreen.prototype, "headline", 2);
8408
+ __decorateClass([
8409
+ n4({ type: String, attribute: "info-note" })
8410
+ ], ConsentCapabilitiesScreen.prototype, "infoNote", 2);
7700
8411
  __decorateClass([
7701
8412
  n4({ type: String })
7702
8413
  ], ConsentCapabilitiesScreen.prototype, "description", 2);
@@ -7706,6 +8417,9 @@ __decorateClass([
7706
8417
  __decorateClass([
7707
8418
  n4({ attribute: false })
7708
8419
  ], ConsentCapabilitiesScreen.prototype, "approver", 2);
8420
+ __decorateClass([
8421
+ n4({ attribute: false })
8422
+ ], ConsentCapabilitiesScreen.prototype, "heldScopes", 2);
7709
8423
  __decorateClass([
7710
8424
  n4({ attribute: false })
7711
8425
  ], ConsentCapabilitiesScreen.prototype, "grantDetails", 2);
@@ -8270,7 +8984,7 @@ ConsentWalletOrb.styles = i`
8270
8984
 
8271
8985
  .frame {
8272
8986
  --_ink: var(--cs-wallet-accent, var(--cs-surface-accent, #0f172a));
8273
- --_success: var(--cs-wallet-success, #10b981);
8987
+ --_success: var(--cs-wallet-success, ${r(WALLET_SUCCESS)});
8274
8988
  --_muted: var(--cs-wallet-muted, var(--cs-text-tertiary, #5d6c82));
8275
8989
  position: relative;
8276
8990
  width: 100%;
@@ -8887,154 +9601,31 @@ var c4 = e7(class extends i5 {
8887
9601
  const h5 = this.ut ?? (this.ut = []), v4 = [];
8888
9602
  let m4, y4, x3 = 0, j2 = d4.length - 1, k2 = 0, w3 = p5.length - 1;
8889
9603
  for (; x3 <= j2 && k2 <= w3; ) if (null === d4[x3]) x3++;
8890
- else if (null === d4[j2]) j2--;
8891
- else if (h5[x3] === a4[k2]) v4[k2] = u3(d4[x3], p5[k2]), x3++, k2++;
8892
- else if (h5[j2] === a4[w3]) v4[w3] = u3(d4[j2], p5[w3]), j2--, w3--;
8893
- else if (h5[x3] === a4[w3]) v4[w3] = u3(d4[x3], p5[w3]), v2(s6, v4[w3 + 1], d4[x3]), x3++, w3--;
8894
- else if (h5[j2] === a4[k2]) v4[k2] = u3(d4[j2], p5[k2]), v2(s6, d4[x3], d4[j2]), j2--, k2++;
8895
- else if (void 0 === m4 && (m4 = u4(a4, k2, w3), y4 = u4(h5, x3, j2)), m4.has(h5[x3])) if (m4.has(h5[j2])) {
8896
- const e10 = y4.get(a4[k2]), t9 = void 0 !== e10 ? d4[e10] : null;
8897
- if (null === t9) {
8898
- const e11 = v2(s6, d4[x3]);
8899
- u3(e11, p5[k2]), v4[k2] = e11;
8900
- } else v4[k2] = u3(t9, p5[k2]), v2(s6, d4[x3], t9), d4[e10] = null;
8901
- k2++;
8902
- } else h3(d4[j2]), j2--;
8903
- else h3(d4[x3]), x3++;
8904
- for (; k2 <= w3; ) {
8905
- const e10 = v2(s6, v4[w3 + 1]);
8906
- u3(e10, p5[k2]), v4[k2++] = e10;
8907
- }
8908
- for (; x3 <= j2; ) {
8909
- const e10 = d4[x3++];
8910
- null !== e10 && h3(e10);
8911
- }
8912
- return this.ut = a4, p3(s6, v4), E;
8913
- }
8914
- });
8915
-
8916
- // src/flow/copy.ts
8917
- var FLOW_COPY = {
8918
- eyebrow: {
8919
- default: "Permission request",
8920
- granted: "Permission granted",
8921
- denied: "Permission declined"
8922
- },
8923
- headline: {
8924
- "sign-in": "Sign in to let {Agent} {Verb} at {Merchant}.",
8925
- default: "{Agent} would like to {Verb} at {Merchant} on your behalf",
8926
- granted: "Access granted",
8927
- denied: "No access given",
8928
- error: "Something went wrong"
8929
- },
8930
- sub: {
8931
- granted: "{Agent} can now {Verb} at {Merchant} for you.",
8932
- denied: "{Agent} can't {Verb} for you. Nothing was approved.",
8933
- error: "Nothing was approved. Try again, or ask {Agent} to start over."
8934
- },
8935
- signIn: {
8936
- continueAs: "Continue as {First}",
8937
- other: "Not you? Use another {Provider} account.",
8938
- finePrint: "{Provider} confirms you control this account. {Merchant} does not get your mail, contacts or files."
8939
- },
8940
- approver: {
8941
- label: "You are authorizing",
8942
- labelGranted: "You authorized",
8943
- labelDenied: "You declined",
8944
- party: "To act for you",
8945
- partyGranted: "Can now act for you",
8946
- partyDenied: "Asked to act for you",
8947
- confirmed: "Confirmed with passkey",
8948
- signedInWith: "Signed in with {Provider}",
8949
- declined: "Declined",
8950
- unverified: "Unverified",
8951
- unverifiedInfo: "It registered itself, so the name it gives is not checked. Allow only if you asked it to.",
8952
- identifiedBy: "Identified by {Domain}"
8953
- },
8954
- capabilitiesHeader: "What {Agent} can do for you",
8955
- tapToToggle: "Tap to toggle",
8956
- seal: {
8957
- "sign-in": "Sign in to continue",
8958
- consent: "Waiting for your passkey",
8959
- passkey: "Confirming with your passkey",
8960
- cancelled: "Passkey not confirmed",
8961
- granted: "Signed with your passkey",
8962
- denied: "Nothing was signed",
8963
- expired: "Request expired",
8964
- error: "Something went wrong"
8965
- },
8966
- details: {
8967
- title: "Permission details",
8968
- connectsTo: "Connects to",
8969
- duration: "Duration",
8970
- budget: "Budget",
8971
- amountLimits: "Amount limits",
8972
- folders: "Folders",
8973
- alreadyGranted: "Already granted"
8974
- },
8975
- actions: {
8976
- approve: "Approve with passkey",
8977
- deny: "Deny",
8978
- confirming: "Confirming\u2026"
8979
- },
8980
- status: "Waiting for your passkey\u2026",
8981
- notice: "Passkey not confirmed. Nothing was approved.",
8982
- expired: "This request expired. Ask {Agent} to try again.",
8983
- receipt: { until: "Until {When}" },
8984
- goBack: "Go back to {Agent} and tell it to continue. Revoke anytime under Connected agents at {Merchant}.",
8985
- retry: "Try again",
8986
- announce: {
8987
- "sign-in": "Sign in to continue.",
8988
- consent: "Review what {Agent} is asking for.",
8989
- passkey: "Waiting for your passkey.",
8990
- granted: "Access granted.",
8991
- denied: "No access given.",
8992
- cancelled: "Passkey not confirmed. Nothing was approved.",
8993
- expired: "This request expired.",
8994
- error: "Something went wrong. Nothing was approved."
8995
- }
8996
- };
8997
- var isGroup = (value) => !!value && typeof value === "object" && !Array.isArray(value);
8998
- function flowCopy(...layers) {
8999
- const out = { ...FLOW_COPY };
9000
- for (const layer of layers) {
9001
- for (const [key, value] of Object.entries(layer ?? {})) {
9002
- const base = out[key];
9003
- out[key] = isGroup(value) && isGroup(base) ? { ...base, ...value } : value;
9604
+ else if (null === d4[j2]) j2--;
9605
+ else if (h5[x3] === a4[k2]) v4[k2] = u3(d4[x3], p5[k2]), x3++, k2++;
9606
+ else if (h5[j2] === a4[w3]) v4[w3] = u3(d4[j2], p5[w3]), j2--, w3--;
9607
+ else if (h5[x3] === a4[w3]) v4[w3] = u3(d4[x3], p5[w3]), v2(s6, v4[w3 + 1], d4[x3]), x3++, w3--;
9608
+ else if (h5[j2] === a4[k2]) v4[k2] = u3(d4[j2], p5[k2]), v2(s6, d4[x3], d4[j2]), j2--, k2++;
9609
+ else if (void 0 === m4 && (m4 = u4(a4, k2, w3), y4 = u4(h5, x3, j2)), m4.has(h5[x3])) if (m4.has(h5[j2])) {
9610
+ const e10 = y4.get(a4[k2]), t9 = void 0 !== e10 ? d4[e10] : null;
9611
+ if (null === t9) {
9612
+ const e11 = v2(s6, d4[x3]);
9613
+ u3(e11, p5[k2]), v4[k2] = e11;
9614
+ } else v4[k2] = u3(t9, p5[k2]), v2(s6, d4[x3], t9), d4[e10] = null;
9615
+ k2++;
9616
+ } else h3(d4[j2]), j2--;
9617
+ else h3(d4[x3]), x3++;
9618
+ for (; k2 <= w3; ) {
9619
+ const e10 = v2(s6, v4[w3 + 1]);
9620
+ u3(e10, p5[k2]), v4[k2++] = e10;
9621
+ }
9622
+ for (; x3 <= j2; ) {
9623
+ const e10 = d4[x3++];
9624
+ null !== e10 && h3(e10);
9004
9625
  }
9626
+ return this.ut = a4, p3(s6, v4), E;
9005
9627
  }
9006
- return out;
9007
- }
9008
- function token(copy, key, step) {
9009
- const value = copy[key];
9010
- if (typeof value === "string") return value;
9011
- if (!isGroup(value)) return "";
9012
- const entry = (step && value[step]) ?? value.default;
9013
- return typeof entry === "string" ? entry : "";
9014
- }
9015
- function group(copy, key) {
9016
- const value = copy[key];
9017
- if (!isGroup(value)) return {};
9018
- return Object.fromEntries(
9019
- Object.entries(value).filter(
9020
- (entry) => typeof entry[1] === "string"
9021
- )
9022
- );
9023
- }
9024
- function splitTemplate(template) {
9025
- return template.split(/\{(\w+)\}/).map((part, i8) => i8 % 2 ? { name: part } : { text: part }).filter((part) => part.name || part.text);
9026
- }
9027
- function fillTemplate(template, values) {
9028
- return splitTemplate(template).map((part) => part.name ? values[part.name] ?? "" : part.text).join("");
9029
- }
9030
- function initialsOf(name = "", identifier = "") {
9031
- const first = (word) => Array.from(word.replace(/^[^\p{L}\p{N}]+/u, ""))[0] ?? "";
9032
- const words = name.trim().split(/\s+/).filter((word) => /[\p{L}\p{N}]/u.test(word));
9033
- if (words.length >= 2)
9034
- return (first(words[0]) + first(words[words.length - 1])).toUpperCase();
9035
- if (words.length === 1) return first(words[0]).toUpperCase();
9036
- return (first(identifier) || "?").toUpperCase();
9037
- }
9628
+ });
9038
9629
 
9039
9630
  // src/flow/model.ts
9040
9631
  var FLOW_SCHEMA_VERSION = 1;
@@ -9047,6 +9638,7 @@ var FLOW_BLOCKS = [
9047
9638
  "approver",
9048
9639
  "capability",
9049
9640
  "details",
9641
+ "infoNote",
9050
9642
  "countdown",
9051
9643
  "actions",
9052
9644
  "status",
@@ -9093,8 +9685,42 @@ var FLOW_EVENTS = [
9093
9685
  "retry",
9094
9686
  "expire",
9095
9687
  "motion",
9096
- "step"
9688
+ "step",
9689
+ "field"
9690
+ ];
9691
+ var FLOW_FIELDS = [
9692
+ ...FLOW_BLOCKS.filter((block) => block !== "actions"),
9693
+ "capabilitiesHeader",
9694
+ "approve",
9695
+ "deny",
9696
+ "terms",
9697
+ "legal",
9698
+ "merchant",
9699
+ "connector"
9097
9700
  ];
9701
+ var CONFIG_FIELD_REGIONS = Object.freeze({
9702
+ "branding.companyName": { field: "merchant", step: "consent" },
9703
+ "branding.logoUrl": { field: "merchant", step: "consent" },
9704
+ "branding.primaryColor": { field: "approve", step: "consent" },
9705
+ "ui.title": { field: "eyebrow", step: "consent" },
9706
+ "ui.headline": { field: "headline", step: "consent" },
9707
+ "ui.description": { field: "sub", step: "consent" },
9708
+ "ui.expirationText": { field: "infoNote", step: "consent" },
9709
+ "ui.permissionsHeader": { field: "capabilitiesHeader", step: "consent" },
9710
+ "ui.submitButtonText": { field: "approve", step: "consent" },
9711
+ "ui.cancelButtonText": { field: "deny", step: "consent" },
9712
+ headlineVerb: { field: "headline", step: "consent" },
9713
+ "terms.text": { field: "legal", step: "consent" },
9714
+ "terms.url": { field: "legal", step: "consent" },
9715
+ "terms.privacyUrl": { field: "legal", step: "consent" },
9716
+ "terms.required": { field: "terms", step: "consent" },
9717
+ "success.title": { field: "headline", step: "granted" },
9718
+ "success.description": { field: "sub", step: "granted" },
9719
+ // Both methods have a consent step, where Allow and "Approve with
9720
+ // passkey" differ; a consent flow has no passkey step to show.
9721
+ "flow.approvalMethod": { field: "approve", step: "consent" },
9722
+ "flow.connectorMark": { field: "connector", step: "consent" }
9723
+ });
9098
9724
  var FLOW_HOST_ATTRIBUTES = {
9099
9725
  version: "data-consent-version",
9100
9726
  approvalMethod: "data-approval-method"
@@ -9107,9 +9733,11 @@ function consentFlowRenders() {
9107
9733
  var CONSENT_BLOCKS = [
9108
9734
  "eyebrow",
9109
9735
  "headline",
9736
+ "sub",
9110
9737
  "approver",
9111
9738
  "capability",
9112
9739
  "details",
9740
+ "infoNote",
9113
9741
  "countdown",
9114
9742
  "actions"
9115
9743
  ];
@@ -9160,9 +9788,11 @@ var PASSKEY_STEPS = {
9160
9788
  blocks: [
9161
9789
  "eyebrow",
9162
9790
  "headline",
9791
+ "sub",
9163
9792
  "approver",
9164
9793
  "capability:locked",
9165
9794
  "details",
9795
+ "infoNote",
9166
9796
  "countdown",
9167
9797
  "actions:loading",
9168
9798
  "status"
@@ -9223,16 +9853,275 @@ function flow(name, approvalMethod, signIn2) {
9223
9853
  copyWhenCreatingPasskey: passkey ? CREATE_PASSKEY_COPY : {}
9224
9854
  });
9225
9855
  }
9226
- var SIGN_IN_FLOW = flow("Sign in, consent, passkey", "passkey", true);
9227
- var DECISION_FLOW = flow("Consent, passkey", "passkey", false);
9228
- var SIGN_IN_CONSENT_FLOW = flow("Sign in, consent", "consent", true);
9229
- var DECISION_CONSENT_FLOW = flow("Consent", "consent", false);
9230
- var FLOW_PRESETS = {
9231
- passkey: { signIn: SIGN_IN_FLOW, decision: DECISION_FLOW },
9232
- consent: { signIn: SIGN_IN_CONSENT_FLOW, decision: DECISION_CONSENT_FLOW }
9233
- };
9234
- function flowPreset(approvalMethod, { signIn: signIn2 = false } = {}) {
9235
- return FLOW_PRESETS[approvalMethod][signIn2 ? "signIn" : "decision"];
9856
+ var SIGN_IN_FLOW = flow("Sign in, consent, passkey", "passkey", true);
9857
+ var DECISION_FLOW = flow("Consent, passkey", "passkey", false);
9858
+ var SIGN_IN_CONSENT_FLOW = flow("Sign in, consent", "consent", true);
9859
+ var DECISION_CONSENT_FLOW = flow("Consent", "consent", false);
9860
+ var FLOW_PRESETS = {
9861
+ passkey: { signIn: SIGN_IN_FLOW, decision: DECISION_FLOW },
9862
+ consent: { signIn: SIGN_IN_CONSENT_FLOW, decision: DECISION_CONSENT_FLOW }
9863
+ };
9864
+ function flowPreset(approvalMethod, { signIn: signIn2 = false } = {}) {
9865
+ return FLOW_PRESETS[approvalMethod][signIn2 ? "signIn" : "decision"];
9866
+ }
9867
+
9868
+ // src/styles/brand.ts
9869
+ var AA_GRAPHIC_CONTRAST = 3;
9870
+ var TEXT_CONTRAST = 4.5;
9871
+ var ICON_TILE_PERCENT = 8;
9872
+ var HOVERED_ROW_PERCENT = 4;
9873
+ var MUTED_TEXT_PERCENT = 64;
9874
+ var PANEL_TINT_PERCENT = 4;
9875
+ var LIGHTNESS_STEP = 5e-3;
9876
+ var LIGHT_DRAWN_COLORS = Object.freeze({
9877
+ surface: lightTheme.surfaceCard,
9878
+ panel: lightTheme.surfaceInset,
9879
+ text: lightTheme.textPrimary,
9880
+ mutedText: lightTheme.textTertiary
9881
+ });
9882
+ var PALETTE_FIELDS = [
9883
+ "surfaceColor",
9884
+ "panelColor",
9885
+ "borderColor",
9886
+ "textColor",
9887
+ "mutedTextColor",
9888
+ "focusColor",
9889
+ "backgroundColor"
9890
+ ];
9891
+ function rgbOf(hex) {
9892
+ return [1, 3, 5].map((at) => Number.parseInt(hex.slice(at, at + 2), 16));
9893
+ }
9894
+ function hexOf(channels2) {
9895
+ return `#${channels2.map((value) => Math.round(value).toString(16).padStart(2, "0")).join("")}`;
9896
+ }
9897
+ function mixOver(top, percent, under) {
9898
+ const share = percent / 100;
9899
+ const below = rgbOf(under);
9900
+ return hexOf(
9901
+ rgbOf(top).map((above, i8) => above * share + below[i8] * (1 - share))
9902
+ );
9903
+ }
9904
+ function hslOf(hex) {
9905
+ const [red, green, blue] = rgbOf(hex).map((value) => value / 255);
9906
+ const high = Math.max(red, green, blue);
9907
+ const low = Math.min(red, green, blue);
9908
+ const spread = high - low;
9909
+ const lightness = (high + low) / 2;
9910
+ if (spread === 0) return { hue: 0, saturation: 0, lightness };
9911
+ const saturation = spread / (1 - Math.abs(2 * lightness - 1));
9912
+ const sector = high === red ? (green - blue) / spread : high === green ? (blue - red) / spread + 2 : (red - green) / spread + 4;
9913
+ return { hue: (sector * 60 + 360) % 360, saturation, lightness };
9914
+ }
9915
+ function hexFromHsl({ hue, saturation, lightness }) {
9916
+ const reach = saturation * Math.min(lightness, 1 - lightness);
9917
+ const channel = (offset) => {
9918
+ const turn = (offset + hue / 30) % 12;
9919
+ return (lightness - reach * Math.max(-1, Math.min(turn - 3, 9 - turn, 1))) * 255;
9920
+ };
9921
+ return hexOf([channel(0), channel(8), channel(4)]);
9922
+ }
9923
+ function iconColorFor(hex, primary, drawn = LIGHT_DRAWN_COLORS) {
9924
+ const hoveredRow = mixOver(primary, HOVERED_ROW_PERCENT, drawn.surface);
9925
+ return showingOn(hex, [
9926
+ drawn.surface,
9927
+ drawn.panel,
9928
+ mixOver(primary, ICON_TILE_PERCENT, drawn.surface),
9929
+ mixOver(primary, ICON_TILE_PERCENT, hoveredRow)
9930
+ ]);
9931
+ }
9932
+ function showingOn(hex, surfaces) {
9933
+ const worstRatio = (candidate) => Math.min(...surfaces.map((surface) => contrastRatio(candidate, surface)));
9934
+ if (worstRatio(hex) >= AA_GRAPHIC_CONTRAST) return hex;
9935
+ const start = hslOf(hex);
9936
+ for (let steps = 1; steps * LIGHTNESS_STEP <= 1; steps++) {
9937
+ for (const lightness of [
9938
+ start.lightness - steps * LIGHTNESS_STEP,
9939
+ start.lightness + steps * LIGHTNESS_STEP
9940
+ ]) {
9941
+ if (lightness < 0 || lightness > 1) continue;
9942
+ const candidate = hexFromHsl({ ...start, lightness });
9943
+ if (worstRatio(candidate) >= AA_GRAPHIC_CONTRAST) return candidate;
9944
+ }
9945
+ }
9946
+ return worstRatio("#000000") >= worstRatio("#ffffff") ? "#000000" : "#ffffff";
9947
+ }
9948
+ function focusRingFor(hex, surface = LIGHT_DRAWN_COLORS.surface) {
9949
+ return contrastRatio(hex, surface) >= AA_GRAPHIC_CONTRAST ? "brand" : "ink";
9950
+ }
9951
+ function readsOnCardAndTint(hex, ratio, surface) {
9952
+ const tint = mixOver(hex, TINT_PERCENT, surface);
9953
+ return contrastRatio(hex, surface) >= ratio && contrastRatio(hex, tint) >= ratio;
9954
+ }
9955
+ function actionColorFor(hex, surface = LIGHT_DRAWN_COLORS.surface) {
9956
+ return readsOnCardAndTint(hex, TEXT_CONTRAST, surface) ? "brand" : "ink";
9957
+ }
9958
+ function markColorFor(hex, surface = LIGHT_DRAWN_COLORS.surface) {
9959
+ return readsOnCardAndTint(hex, AA_GRAPHIC_CONTRAST, surface) ? "brand" : "ink";
9960
+ }
9961
+ function onPrimaryFor(hex) {
9962
+ const luminance = relativeLuminance(hex);
9963
+ const againstWhite = 1.05 / (luminance + 0.05);
9964
+ const againstBlack = (luminance + 0.05) / 0.05;
9965
+ return againstBlack >= againstWhite ? "black" : "white";
9966
+ }
9967
+ function panelOf(palette, text, drawn) {
9968
+ if (palette.panelColor) return palette.panelColor;
9969
+ if (palette.surfaceColor)
9970
+ return mixOver(text, PANEL_TINT_PERCENT, palette.surfaceColor);
9971
+ return drawn.panel;
9972
+ }
9973
+ function mutedOn(palette, background, drawn) {
9974
+ if (palette.mutedTextColor) return palette.mutedTextColor;
9975
+ if (palette.textColor)
9976
+ return mixOver(palette.textColor, MUTED_TEXT_PERCENT, background);
9977
+ return drawn.mutedText;
9978
+ }
9979
+ function pageTextOn(palette, page, drawn) {
9980
+ const muted = mutedOn(palette, page, drawn);
9981
+ if (contrastRatio(muted, page) >= TEXT_CONTRAST) return muted;
9982
+ const ink = onPrimaryFor(page) === "black" ? "#000000" : "#ffffff";
9983
+ for (let percent = MUTED_TEXT_PERCENT; percent < 100; percent++) {
9984
+ const quieter = mixOver(ink, percent, page);
9985
+ if (contrastRatio(quieter, page) >= TEXT_CONTRAST) return quieter;
9986
+ }
9987
+ return ink;
9988
+ }
9989
+ function floorToHundredths(ratio) {
9990
+ return Math.floor(ratio * 100) / 100;
9991
+ }
9992
+ function paletteFailures(palette, drawn = {}) {
9993
+ const colors = { ...LIGHT_DRAWN_COLORS, ...drawn };
9994
+ const text = palette.textColor ?? colors.text;
9995
+ const backgrounds = [
9996
+ {
9997
+ background: "surfaceColor",
9998
+ color: palette.surfaceColor ?? colors.surface
9999
+ },
10000
+ { background: "panelColor", color: panelOf(palette, text, colors) }
10001
+ ];
10002
+ return backgrounds.flatMap(({ background, color }) => {
10003
+ const pairs = [
10004
+ { foreground: "textColor", color: text, needs: TEXT_CONTRAST },
10005
+ {
10006
+ foreground: "mutedTextColor",
10007
+ color: mutedOn(palette, color, colors),
10008
+ needs: TEXT_CONTRAST
10009
+ },
10010
+ ...palette.focusColor ? [
10011
+ {
10012
+ foreground: "focusColor",
10013
+ color: palette.focusColor,
10014
+ needs: AA_GRAPHIC_CONTRAST
10015
+ }
10016
+ ] : []
10017
+ ];
10018
+ return pairs.flatMap(({ foreground, color: ink, needs }) => {
10019
+ const ratio = contrastRatio(ink, color);
10020
+ return ratio >= needs ? [] : [{ foreground, background, ratio: floorToHundredths(ratio), needs }];
10021
+ });
10022
+ });
10023
+ }
10024
+ function drawablePalette(chosen, drawn = {}) {
10025
+ const { focusColor, borderColor, backgroundColor, ...surfacesAndText } = chosen;
10026
+ const text = paletteFailures(surfacesAndText, drawn).length === 0 ? surfacesAndText : {};
10027
+ const focusShows = focusColor !== void 0 && paletteFailures({ ...text, focusColor }, drawn).length === 0;
10028
+ return {
10029
+ ...text,
10030
+ ...backgroundColor ? { backgroundColor } : {},
10031
+ ...borderColor ? { borderColor } : {},
10032
+ ...focusShows ? { focusColor } : {}
10033
+ };
10034
+ }
10035
+ function brandTokens(brand, theme = "light") {
10036
+ for (const [field, value] of Object.entries(brand)) {
10037
+ if (value !== void 0 && !isHexColor(value)) {
10038
+ throw new RangeError(
10039
+ `${field} must be a #rrggbb color, got ${JSON.stringify(value)}`
10040
+ );
10041
+ }
10042
+ }
10043
+ const { primaryColor: primary, secondaryColor, ...chosen } = brand;
10044
+ const palette = drawablePalette(chosen);
10045
+ const surface = palette.surfaceColor ?? LIGHT_DRAWN_COLORS.surface;
10046
+ const panel = panelOf(
10047
+ palette,
10048
+ palette.textColor ?? LIGHT_DRAWN_COLORS.text,
10049
+ LIGHT_DRAWN_COLORS
10050
+ );
10051
+ const tokens = primary ? primaryTokens(primary, palette, surface, panel, secondaryColor) : {};
10052
+ if (!primary) {
10053
+ if (palette.textColor) {
10054
+ tokens["--cs-surface-accent"] = palette.textColor;
10055
+ tokens["--cs-surface-accent-text"] = onPrimaryFor(palette.textColor);
10056
+ }
10057
+ const ring = palette.focusColor ?? palette.textColor;
10058
+ if (ring) tokens["--cs-focus-ring"] = ring;
10059
+ }
10060
+ if (palette.surfaceColor) tokens["--cs-surface-card"] = palette.surfaceColor;
10061
+ if (palette.surfaceColor || palette.panelColor)
10062
+ tokens["--cs-surface-inset"] = panel;
10063
+ if (palette.borderColor) tokens["--cs-surface-border"] = palette.borderColor;
10064
+ if (palette.textColor) {
10065
+ tokens["--cs-text-primary"] = palette.textColor;
10066
+ tokens["--cs-text-secondary"] = palette.textColor;
10067
+ }
10068
+ if (palette.mutedTextColor) {
10069
+ tokens["--cs-text-tertiary"] = palette.mutedTextColor;
10070
+ } else if (palette.textColor) {
10071
+ tokens["--cs-text-tertiary"] = `color-mix(in srgb, ${palette.textColor} ${MUTED_TEXT_PERCENT}%, transparent)`;
10072
+ }
10073
+ const page = palette.backgroundColor;
10074
+ if (page) {
10075
+ const text = pageTextOn(palette, page, LIGHT_DRAWN_COLORS);
10076
+ const shows = (hex) => contrastRatio(hex, page) >= AA_GRAPHIC_CONTRAST;
10077
+ const accent = primary ?? palette.textColor ?? lightTheme.surfaceAccent;
10078
+ const lockup = lightTheme.lockup;
10079
+ tokens["--cs-surface-bg"] = page;
10080
+ tokens["--cs-page-text"] = text;
10081
+ tokens["--cs-page-accent"] = shows(accent) ? accent : text;
10082
+ tokens["--cs-page-success"] = showingOn(WALLET_SUCCESS, [page]);
10083
+ tokens["--cs-lockup"] = lockup && shows(lockup) ? lockup : text;
10084
+ } else {
10085
+ const stage = getConsentTheme(theme);
10086
+ const accent = primary ?? palette.textColor;
10087
+ if (accent && contrastRatio(accent, stage.surfaceBg) < AA_GRAPHIC_CONTRAST)
10088
+ tokens["--cs-page-accent"] = stage.surfaceAccent;
10089
+ }
10090
+ return tokens;
10091
+ }
10092
+ function primaryTokens(primary, palette, surface, panel, secondaryColor) {
10093
+ const ink = palette.textColor ?? LIGHT_DRAWN_COLORS.text;
10094
+ const onPrimary = onPrimaryFor(primary);
10095
+ const inBrand = (pick) => pick === "brand" ? primary : ink;
10096
+ const tokens = {
10097
+ "--consent-primary": primary,
10098
+ "--consent-on-primary": onPrimary,
10099
+ "--consent-link": inBrand(actionColorFor(primary, surface)),
10100
+ "--cs-surface-accent": primary,
10101
+ "--cs-surface-accent-text": onPrimary,
10102
+ "--cs-tint": mixOver(primary, TINT_PERCENT, surface),
10103
+ "--cs-tint-line": mixOver(primary, TINT_LINE_PERCENT, surface),
10104
+ "--cs-mark": inBrand(markColorFor(primary, surface)),
10105
+ "--cs-action": inBrand(actionColorFor(primary, surface)),
10106
+ "--cs-focus-ring": palette.focusColor ?? inBrand(focusRingFor(primary, surface))
10107
+ };
10108
+ if (secondaryColor) {
10109
+ tokens["--cs-icon"] = iconColorFor(secondaryColor, primary, {
10110
+ surface,
10111
+ panel
10112
+ });
10113
+ }
10114
+ return tokens;
10115
+ }
10116
+ function brandStyle(brand, theme = "light") {
10117
+ const tokens = brandTokens(brand, theme);
10118
+ const page = tokens["--cs-surface-bg"];
10119
+ return [
10120
+ ...Object.entries(tokens).map(
10121
+ ([property, value]) => `${property}: ${value};`
10122
+ ),
10123
+ ...page ? [`background-color: ${page};`] : []
10124
+ ].join(" ");
9236
10125
  }
9237
10126
 
9238
10127
  // src/components/flow-blocks.ts
@@ -9251,6 +10140,14 @@ function flowValues(data) {
9251
10140
  Domain: data.agent.domain
9252
10141
  };
9253
10142
  }
10143
+ function filled(words, values) {
10144
+ return Object.fromEntries(
10145
+ Object.entries(words).map(([key, value]) => [
10146
+ key,
10147
+ fillTemplate(value, values)
10148
+ ])
10149
+ );
10150
+ }
9254
10151
  function whenLabel(at) {
9255
10152
  const date = new Date(at);
9256
10153
  if (Number.isNaN(date.getTime())) return "";
@@ -9271,79 +10168,33 @@ function richText(template, values) {
9271
10168
  return value;
9272
10169
  });
9273
10170
  }
9274
- var hide = (event) => {
9275
- event.target.hidden = true;
9276
- };
9277
- var show = (event) => {
9278
- event.target.hidden = false;
9279
- };
9280
- function face(name, identifier = "", avatarUrl = "", size = "md") {
9281
- const initials = initialsOf(name, identifier);
9282
- return b2`<span
9283
- class="face ${size} ${initials.length > 1 ? "two" : ""}"
9284
- aria-hidden="true"
9285
- >${initials}${avatarUrl ? b2`<img src=${avatarUrl} alt="" @error=${hide} @load=${show} />` : A}</span
9286
- >`;
9287
- }
9288
- function agentTile(agent) {
9289
- const initial = initialsOf(agent.name).slice(0, 1);
9290
- return b2`<span class="tile" aria-hidden="true"
9291
- >${initial}${agent.logoUrl ? b2`<img src=${agent.logoUrl} alt="" @error=${hide} @load=${show} />` : A}</span
9292
- >`;
9293
- }
9294
10171
  var approver = ({ data, copy, step, variant, values }) => {
9295
- const c6 = group(copy, "approver");
10172
+ const c6 = filled(group(copy, "approver"), values);
9296
10173
  const state = variant ?? step;
9297
10174
  const granted = state === "granted";
9298
10175
  const declined = state === "denied";
9299
10176
  const person = data.approver;
9300
10177
  const agent = data.agent;
9301
10178
  const unverified = agent.verification === "unverified";
9302
- const status = unverified ? c6.unverified : agent.domain ? fillTemplate(c6.identifiedBy ?? "", { Domain: agent.domain }) : "";
9303
- const detail = granted ? c6.confirmed : person.identifier;
9304
- const markLabel = declined ? c6.declined : fillTemplate(c6.signedInWith ?? "", values);
9305
- return b2`<div class="tinted lockup" part="approver">
9306
- <div class="lockup-row">
9307
- ${face(person.name, person.identifier, person.avatarUrl)}
9308
- <div class="lockup-text">
9309
- <span class="lockup-label"
9310
- >${granted ? c6.labelGranted : declined ? c6.labelDenied : c6.label}</span
9311
- >
9312
- <span class="lockup-name">${person.name}</span>
9313
- ${detail ? b2`<span class="small">${detail}</span>` : A}
9314
- </div>
9315
- <span
9316
- class="lockup-mark ${declined ? "declined" : ""}"
9317
- role="img"
9318
- aria-label=${markLabel}
9319
- title=${markLabel}
9320
- >${decisionIcon(declined ? "minus" : "check")}</span
9321
- >
9322
- </div>
9323
- <div class="lockup-row party" part="approver-agent">
9324
- ${agentTile(agent)}
9325
- <div class="lockup-text">
9326
- <span class="small"
9327
- >${granted ? c6.partyGranted : declined ? c6.partyDenied : c6.party}</span
9328
- >
9329
- <span class="value">${agent.name}</span>
9330
- </div>
9331
- ${status ? b2`<span
9332
- class="party-status ${unverified ? "unverified" : ""}"
9333
- part="agent-status"
9334
- >${status}${unverified && c6.unverifiedInfo ? b2`<button
9335
- type="button"
9336
- class="info"
9337
- aria-label=${c6.unverified}
9338
- aria-describedby="unverified-info"
9339
- >
9340
- ${decisionIcon("info")}</button
9341
- ><span class="tip" id="unverified-info" role="tooltip"
9342
- >${c6.unverifiedInfo}</span
9343
- >` : A}</span
9344
- >` : A}
9345
- </div>
9346
- </div>`;
10179
+ return approverLockup({
10180
+ person: {
10181
+ label: (granted ? c6.labelGranted : declined ? c6.labelDenied : c6.label) ?? "",
10182
+ name: person.name,
10183
+ identifier: person.identifier,
10184
+ avatarUrl: person.avatarUrl,
10185
+ detail: granted ? c6.confirmed : person.identifier,
10186
+ mark: (declined ? c6.declined : c6.signedInWith) ?? "",
10187
+ declined
10188
+ },
10189
+ agent: {
10190
+ name: agent.name,
10191
+ logoUrl: agent.logoUrl,
10192
+ label: (granted ? c6.partyGranted : declined ? c6.partyDenied : c6.party) ?? "",
10193
+ status: unverified ? c6.unverified : agent.domain ? c6.identifiedBy ?? "" : "",
10194
+ unverified,
10195
+ info: unverified ? c6.unverifiedInfo : void 0
10196
+ }
10197
+ });
9347
10198
  };
9348
10199
  var capability = ({
9349
10200
  data,
@@ -9354,10 +10205,14 @@ var capability = ({
9354
10205
  preview
9355
10206
  }) => {
9356
10207
  const locked = Boolean(variant);
9357
- return b2`<div class="section-header" part="section-header">
10208
+ return b2`<div
10209
+ class="section-header"
10210
+ part="section-header"
10211
+ data-field="capabilitiesHeader"
10212
+ >
9358
10213
  <span>${fillTemplate(token(copy, "capabilitiesHeader"), values)}</span>
9359
10214
  <span class="hint" part="section-hint" ?data-hidden=${locked}
9360
- >${token(copy, "tapToToggle")}</span
10215
+ >${fillTemplate(token(copy, "tapToToggle"), values)}</span
9361
10216
  >
9362
10217
  </div>
9363
10218
  <div class="rows ${variant === "dim" ? "dim" : ""}">
@@ -9428,6 +10283,23 @@ var receipt = ({ data, copy, selected }) => {
9428
10283
  )}
9429
10284
  </ul>`;
9430
10285
  };
10286
+ function termsBox({ copy, termsAccepted }, terms, loading) {
10287
+ const href = httpsUrl(terms.href);
10288
+ const words = splitTemplate(group(copy, "terms").agree ?? "{Terms}").map(
10289
+ (part) => part.name !== "Terms" ? part.text ?? "" : href ? b2`<a href=${href} target="_blank" rel="noopener noreferrer"
10290
+ >${terms.label}</a
10291
+ >` : terms.label
10292
+ );
10293
+ return b2`<label class="terms" part="terms" data-field="terms">
10294
+ <input
10295
+ type="checkbox"
10296
+ data-action="terms"
10297
+ .checked=${termsAccepted}
10298
+ ?disabled=${loading}
10299
+ />
10300
+ <span>${words}</span>
10301
+ </label>`;
10302
+ }
9431
10303
  var FINGERPRINT = b2`<svg
9432
10304
  viewBox="0 0 24 24"
9433
10305
  fill="none"
@@ -9440,8 +10312,8 @@ var FINGERPRINT = b2`<svg
9440
10312
  ${fingerprintIcon}
9441
10313
  </svg>`;
9442
10314
  var FLOW_BLOCK_RENDERERS = {
9443
- eyebrow: ({ copy, step }) => b2`<span class="eyebrow" part="eyebrow"
9444
- >${token(copy, "eyebrow", step)}</span
10315
+ eyebrow: ({ copy, step, values }) => b2`<span class="eyebrow" part="eyebrow"
10316
+ >${fillTemplate(token(copy, "eyebrow", step), values)}</span
9445
10317
  >`,
9446
10318
  headline: ({ copy, step, values }) => {
9447
10319
  const words = token(copy, "headline", step);
@@ -9451,7 +10323,7 @@ var FLOW_BLOCK_RENDERERS = {
9451
10323
  },
9452
10324
  sub: ({ copy, step, values }) => {
9453
10325
  const words = token(copy, "sub", step);
9454
- return words ? b2`<p class="sub">${fillTemplate(words, values)}</p>` : A;
10326
+ return words ? b2`<p class="sub" part="sub">${fillTemplate(words, values)}</p>` : A;
9455
10327
  },
9456
10328
  signIn,
9457
10329
  finePrint: ({ copy, values }) => {
@@ -9464,314 +10336,147 @@ var FLOW_BLOCK_RENDERERS = {
9464
10336
  details: ({ data }) => data.grantDetails ? grantDetailsSection(
9465
10337
  grantDetailRows(data.grantDetails, data.merchant.name)
9466
10338
  ) : A,
10339
+ /** The project's own note (Checkpoint's "Info note"); nothing without one. */
10340
+ infoNote: ({ copy, values }) => {
10341
+ const words = token(copy, "infoNote");
10342
+ return words ? b2`<p class="line tinted info-note" part="info-note">
10343
+ ${decisionIcon("info")}<span>${fillTemplate(words, values)}</span>
10344
+ </p>` : A;
10345
+ },
9467
10346
  /** The package's countdown; its expiry is the flow's `expire` event. */
9468
10347
  countdown: ({ data }) => data.requestExpiresAt !== void 0 ? b2`<consent-request-expiry
9469
10348
  .expiresAt=${data.requestExpiresAt}
9470
10349
  ></consent-request-expiry>` : A,
9471
- actions: ({ data, copy, variant, method, preview }) => {
9472
- const a4 = group(copy, "actions");
9473
- return b2`<consent-action-bar
9474
- .agentName=${data.agent.name}
9475
- .submitLabel=${a4.approve ?? ""}
9476
- .cancelLabel=${a4.deny ?? ""}
9477
- .submitIcon=${method === "passkey" ? "passkey" : ""}
9478
- .loadingLabel=${a4.confirming ?? ""}
9479
- .loading=${variant === "loading"}
9480
- .preview=${preview}
9481
- ></consent-action-bar>`;
10350
+ /** Allow and Deny; with terms, the box to tick over them, and Allow waits for it. */
10351
+ actions: (ctx) => {
10352
+ const { data, copy, variant, method, preview, terms, termsAccepted } = ctx;
10353
+ const a4 = filled(group(copy, "actions"), ctx.values);
10354
+ const loading = variant === "loading";
10355
+ return b2`${terms ? termsBox(ctx, terms, loading) : A}
10356
+ <consent-action-bar
10357
+ .agentName=${data.agent.name}
10358
+ .submitLabel=${a4.approve ?? ""}
10359
+ .cancelLabel=${a4.deny ?? ""}
10360
+ .submitIcon=${method === "passkey" ? "passkey" : ""}
10361
+ .loadingLabel=${a4.confirming ?? ""}
10362
+ .loading=${loading}
10363
+ .disabled=${Boolean(terms) && !termsAccepted}
10364
+ .preview=${preview}
10365
+ ></consent-action-bar>`;
9482
10366
  },
9483
- status: ({ copy }) => b2`<p class="line status" part="status" tabindex="-1">
9484
- ${FINGERPRINT}<span>${token(copy, "status")}</span>
10367
+ status: ({ copy, values }) => b2`<p class="line status" part="status" tabindex="-1">
10368
+ ${FINGERPRINT}<span>${fillTemplate(token(copy, "status"), values)}</span>
9485
10369
  </p>`,
9486
- notice: ({ copy }) => b2`<p class="line notice" part="notice" tabindex="-1">
9487
- ${decisionIcon("warning")}<span>${token(copy, "notice")}</span>
10370
+ notice: ({ copy, values }) => b2`<p class="line notice" part="notice" tabindex="-1">
10371
+ ${decisionIcon("warning")}<span
10372
+ >${fillTemplate(token(copy, "notice"), values)}</span
10373
+ >
9488
10374
  </p>`,
9489
10375
  expiredNote: ({ copy, values }) => b2`<p class="line tinted expired-note" part="expired-note">
9490
10376
  ${decisionIcon("duration")}<span
9491
10377
  >${fillTemplate(token(copy, "expired"), values)}</span
9492
10378
  >
9493
- </p>`,
9494
- receipt,
9495
- goBack: ({ copy, values }) => {
9496
- const words = token(copy, "goBack");
9497
- return words ? b2`<p class="sub">${fillTemplate(words, values)}</p>` : A;
9498
- },
9499
- retry: ({ copy }) => b2`<button type="button" class="primary" part="retry" data-action="retry">
9500
- ${token(copy, "retry")}
9501
- </button>`
9502
- };
9503
- var flowBlockStyles = i`
9504
- ${grantDetailStyles}
9505
-
9506
- .small {
9507
- font-size: 12px;
9508
- color: var(--cs-text-tertiary);
9509
- }
9510
-
9511
- .tinted {
9512
- border-radius: 12px;
9513
- border: 1px solid var(--cs-tint-line);
9514
- background: var(--cs-tint);
9515
- }
9516
-
9517
- /* The card's gap spaces the blocks; the screen's box keeps its own margin. */
9518
- .grant-details {
9519
- margin-top: 0;
9520
- }
9521
-
9522
- .eyebrow,
9523
- .section-header {
9524
- font-size: 11px;
9525
- letter-spacing: 0.16em;
9526
- font-weight: 600;
9527
- line-height: 18px;
9528
- color: var(--cs-text-tertiary);
9529
- text-transform: uppercase;
9530
- }
9531
-
9532
- .headline {
9533
- margin: 0;
9534
- font-family: var(--cs-headline-font, "Instrument Serif", Georgia, serif);
9535
- font-size: var(--cs-headline-font-size, 32px);
9536
- font-weight: var(--cs-headline-weight, 600);
9537
- line-height: var(--cs-headline-line-height, 1.2);
9538
- letter-spacing: -0.01em;
9539
- color: var(--cs-text-primary);
9540
- text-wrap: pretty;
9541
- overflow-wrap: anywhere;
9542
- font-synthesis-weight: none;
9543
- }
9544
-
9545
- .headline:focus {
9546
- outline: none;
9547
- }
9548
-
9549
- .headline em {
9550
- font-style: italic;
9551
- }
9552
-
9553
- [part="agent-name"] {
9554
- font-weight: var(--cs-agent-name-weight, inherit);
9555
- -webkit-text-stroke: var(--cs-agent-name-stroke, 0.04em) currentColor;
9556
- }
9557
-
9558
- .sub {
9559
- margin: 0;
9560
- font-size: 15px;
9561
- line-height: 1.5;
9562
- color: var(--cs-text-secondary);
9563
- }
9564
-
9565
- .section-header {
9566
- display: flex;
9567
- align-items: center;
9568
- justify-content: space-between;
9569
- flex-wrap: wrap;
9570
- gap: 4px 12px;
9571
- margin-bottom: 10px;
9572
- }
9573
-
9574
- .section-header .hint {
9575
- font-size: 12px;
9576
- font-weight: 400;
9577
- letter-spacing: 0;
9578
- text-transform: none;
9579
- }
9580
-
9581
- .section-header .hint[data-hidden] {
9582
- visibility: hidden;
9583
- }
9584
-
9585
- .rows {
9586
- display: flex;
9587
- flex-direction: column;
9588
- gap: 8px;
9589
- }
9590
-
9591
- .rows.dim {
9592
- opacity: 0.55;
9593
- }
9594
-
9595
- /* The approver lockup. */
9596
- .lockup {
9597
- display: flex;
9598
- flex-direction: column;
9599
- gap: 12px;
9600
- padding: 16px 18px;
9601
- }
9602
-
9603
- .lockup-row {
9604
- display: flex;
9605
- align-items: center;
9606
- gap: 12px;
9607
- min-width: 0;
9608
- }
9609
-
9610
- .lockup-row.party {
9611
- padding-top: 12px;
9612
- border-top: 1px solid var(--cs-tint-line);
9613
- }
9614
-
9615
- .lockup-text {
9616
- display: flex;
9617
- flex: 1;
9618
- flex-direction: column;
9619
- gap: 2px;
9620
- min-width: 0;
9621
- }
9622
-
9623
- .lockup-label {
9624
- font-size: 10px;
9625
- letter-spacing: 0.16em;
9626
- font-weight: 600;
9627
- text-transform: uppercase;
9628
- color: var(--cs-text-tertiary);
9629
- }
9630
-
9631
- .lockup-name {
9632
- font-size: 20px;
9633
- font-weight: 600;
9634
- line-height: 1.2;
9635
- overflow-wrap: anywhere;
9636
- }
9637
-
9638
- .lockup-text .value {
9639
- font-weight: 500;
9640
- overflow-wrap: anywhere;
9641
- }
9642
-
9643
- .lockup-mark {
9644
- display: grid;
9645
- flex-shrink: 0;
9646
- color: var(--cs-wallet-success, var(--cs-mark));
9647
- }
9648
-
9649
- .lockup-mark.declined {
9650
- color: var(--cs-text-tertiary);
9651
- }
9652
-
9653
- .lockup-mark svg {
9654
- width: 22px;
9655
- height: 22px;
9656
- }
9657
-
9658
- .face,
9659
- .tile {
9660
- position: relative;
9661
- display: grid;
9662
- place-items: center;
9663
- flex-shrink: 0;
9664
- width: 42px;
9665
- height: 42px;
9666
- overflow: hidden;
9667
- font-weight: 600;
9668
- }
9669
-
9670
- .face {
9671
- border-radius: 50%;
9672
- background: var(--cs-surface-accent);
9673
- color: var(--cs-surface-accent-text);
9674
- font-size: 17px;
9675
- }
10379
+ </p>`,
10380
+ receipt,
10381
+ goBack: ({ copy, values }) => {
10382
+ const words = token(copy, "goBack");
10383
+ return words ? b2`<p class="sub">${fillTemplate(words, values)}</p>` : A;
10384
+ },
10385
+ retry: ({ copy, values }) => b2`<button type="button" class="primary" part="retry" data-action="retry">
10386
+ ${fillTemplate(token(copy, "retry"), values)}
10387
+ </button>`
10388
+ };
10389
+ var flowBlockStyles = i`
10390
+ ${grantDetailStyles}
10391
+ ${approverLockupStyles}
9676
10392
 
9677
- .face.two {
9678
- font-size: 15px;
9679
- letter-spacing: 0.02em;
10393
+ .small {
10394
+ font-size: 12px;
10395
+ color: var(--cs-text-tertiary);
9680
10396
  }
9681
10397
 
9682
- .face.sm {
9683
- width: 32px;
9684
- height: 32px;
9685
- font-size: 13px;
10398
+ .tinted {
10399
+ border-radius: 12px;
10400
+ border: 1px solid var(--cs-tint-line);
10401
+ background: var(--cs-tint);
9686
10402
  }
9687
10403
 
9688
- .face img {
9689
- position: absolute;
9690
- inset: 0;
9691
- width: 100%;
9692
- height: 100%;
9693
- object-fit: cover;
10404
+ /* The card's gap spaces the blocks; the screen's box keeps its own margin. */
10405
+ .grant-details {
10406
+ margin-top: 0;
9694
10407
  }
9695
10408
 
9696
- .tile {
9697
- border-radius: var(--cs-tile-radius, 10px);
9698
- border: 1px solid var(--cs-agent-tile-border, rgba(15, 23, 42, 0.16));
9699
- background: var(--cs-surface-accent);
9700
- color: var(--cs-surface-accent-text);
9701
- font-size: 18px;
10409
+ .eyebrow,
10410
+ .section-header {
10411
+ font-size: 11px;
10412
+ letter-spacing: 0.16em;
10413
+ font-weight: 600;
10414
+ line-height: 18px;
10415
+ color: var(--cs-text-tertiary);
10416
+ text-transform: uppercase;
9702
10417
  }
9703
10418
 
9704
- .tile img {
9705
- position: absolute;
9706
- inset: 0;
9707
- width: 100%;
9708
- height: 100%;
9709
- padding: 4px;
9710
- box-sizing: border-box;
9711
- object-fit: contain;
9712
- background: var(--cs-agent-tile-bg, #ffffff);
10419
+ .headline {
10420
+ margin: 0;
10421
+ font-family: var(--cs-headline-font, "Instrument Serif", Georgia, serif);
10422
+ font-size: var(--cs-headline-font-size, 32px);
10423
+ font-weight: var(--cs-headline-weight, 600);
10424
+ line-height: var(--cs-headline-line-height, 1.2);
10425
+ letter-spacing: -0.01em;
10426
+ color: var(--cs-text-primary);
10427
+ text-wrap: pretty;
10428
+ overflow-wrap: anywhere;
10429
+ font-synthesis-weight: none;
9713
10430
  }
9714
10431
 
9715
- .party-status {
9716
- position: relative;
9717
- display: inline-flex;
9718
- align-items: center;
9719
- gap: 4px;
9720
- flex-shrink: 0;
9721
- font-size: 13px;
9722
- font-weight: 500;
9723
- color: var(--cs-text-secondary);
10432
+ .headline:focus {
10433
+ outline: none;
9724
10434
  }
9725
10435
 
9726
- .party-status.unverified {
9727
- color: var(--cs-warning-text, var(--cs-text-primary));
10436
+ .headline em {
10437
+ font-style: italic;
9728
10438
  }
9729
10439
 
9730
- .info {
9731
- display: inline-grid;
9732
- place-items: center;
9733
- width: 22px;
9734
- height: 22px;
9735
- padding: 0;
9736
- border: 0;
9737
- border-radius: 50%;
9738
- background: none;
9739
- color: var(--cs-text-tertiary);
9740
- cursor: help;
10440
+ [part="agent-name"] {
10441
+ font-weight: var(--cs-agent-name-weight, inherit);
10442
+ -webkit-text-stroke: var(--cs-agent-name-stroke, 0.04em) currentColor;
9741
10443
  }
9742
10444
 
9743
- .info svg {
9744
- width: 16px;
9745
- height: 16px;
10445
+ .sub {
10446
+ margin: 0;
10447
+ font-size: 15px;
10448
+ line-height: 1.5;
10449
+ color: var(--cs-text-secondary);
9746
10450
  }
9747
10451
 
9748
- .info:focus-visible {
9749
- outline: 2px solid var(--cs-focus-ring, currentColor);
9750
- outline-offset: 1px;
10452
+ .section-header {
10453
+ display: flex;
10454
+ align-items: center;
10455
+ justify-content: space-between;
10456
+ flex-wrap: wrap;
10457
+ gap: 4px 12px;
10458
+ margin-bottom: 10px;
9751
10459
  }
9752
10460
 
9753
- .tip {
9754
- position: absolute;
9755
- top: calc(100% + 8px);
9756
- right: -6px;
9757
- z-index: 5;
9758
- width: 240px;
9759
- padding: 8px 10px;
9760
- border-radius: 8px;
9761
- background: var(--cs-text-primary);
9762
- color: var(--cs-surface-card);
10461
+ .section-header .hint {
9763
10462
  font-size: 12px;
9764
10463
  font-weight: 400;
9765
- line-height: 1.45;
9766
- text-align: left;
9767
- opacity: 0;
10464
+ letter-spacing: 0;
10465
+ text-transform: none;
10466
+ }
10467
+
10468
+ .section-header .hint[data-hidden] {
9768
10469
  visibility: hidden;
9769
10470
  }
9770
10471
 
9771
- .party-status:hover .tip,
9772
- .info:focus-visible + .tip {
9773
- opacity: 1;
9774
- visibility: visible;
10472
+ .rows {
10473
+ display: flex;
10474
+ flex-direction: column;
10475
+ gap: 8px;
10476
+ }
10477
+
10478
+ .rows.dim {
10479
+ opacity: 0.55;
9775
10480
  }
9776
10481
 
9777
10482
  /* Sign-in. */
@@ -9867,10 +10572,52 @@ var flowBlockStyles = i`
9867
10572
  color: var(--cs-text-secondary);
9868
10573
  }
9869
10574
 
9870
- .expired-note {
10575
+ .expired-note,
10576
+ .info-note {
9871
10577
  padding: 12px 14px;
9872
10578
  }
9873
10579
 
10580
+ .info-note {
10581
+ align-items: flex-start;
10582
+ font-size: 13px;
10583
+ color: var(--cs-text-secondary);
10584
+ }
10585
+
10586
+ .info-note svg {
10587
+ margin-top: 2px;
10588
+ }
10589
+
10590
+ /* The terms to accept, over Allow. */
10591
+ .terms {
10592
+ display: flex;
10593
+ align-items: flex-start;
10594
+ gap: 10px;
10595
+ margin-bottom: 14px;
10596
+ font-size: 13px;
10597
+ line-height: 1.45;
10598
+ color: var(--cs-text-secondary);
10599
+ cursor: pointer;
10600
+ }
10601
+
10602
+ .terms input {
10603
+ flex-shrink: 0;
10604
+ width: 16px;
10605
+ height: 16px;
10606
+ margin: 1px 0 0;
10607
+ accent-color: var(--cs-action, var(--cs-surface-accent));
10608
+ cursor: inherit;
10609
+ }
10610
+
10611
+ .terms input:disabled {
10612
+ cursor: default;
10613
+ }
10614
+
10615
+ .terms a {
10616
+ color: var(--consent-link, var(--cs-action, currentColor));
10617
+ text-decoration: underline;
10618
+ text-underline-offset: 2px;
10619
+ }
10620
+
9874
10621
  /* The receipt. */
9875
10622
  .receipt {
9876
10623
  display: flex;
@@ -10077,7 +10824,48 @@ function signatureOf(value) {
10077
10824
  return String(value);
10078
10825
  }
10079
10826
  var blockName = (key) => key.split("#")[0];
10080
- var DRAWN = ["flow", "data", "copy", "step", "preview"];
10827
+ var MOVES = ["flow", "step"];
10828
+ var SPOT_X = 8;
10829
+ var SPOT_Y = 6;
10830
+ var LABEL_ROOM = 10;
10831
+ function within(container, node) {
10832
+ while (node) {
10833
+ if (node === container) return true;
10834
+ node = node.parentNode ?? node.host ?? null;
10835
+ }
10836
+ return false;
10837
+ }
10838
+ function inset(rect, by) {
10839
+ return new DOMRect(
10840
+ rect.left + by,
10841
+ rect.top + by,
10842
+ rect.width - 2 * by,
10843
+ rect.height - 2 * by
10844
+ );
10845
+ }
10846
+ function ringRadius(region) {
10847
+ const box = region.getBoundingClientRect();
10848
+ for (const el of [region, region.firstElementChild]) {
10849
+ if (!el) continue;
10850
+ const r8 = el.getBoundingClientRect();
10851
+ if (Math.abs(r8.width - box.width) > 1 || Math.abs(r8.height - box.height) > 1)
10852
+ continue;
10853
+ const radius = parseFloat(getComputedStyle(el).borderTopLeftRadius) || 0;
10854
+ if (radius > 0) return radius + SPOT_Y;
10855
+ }
10856
+ return 8;
10857
+ }
10858
+ var isField = (name) => FLOW_FIELDS.includes(name ?? "");
10859
+ var termsKey = (terms) => terms ? JSON.stringify([terms.label, terms.href, terms.version]) : "";
10860
+ function brandRule(brand, theme) {
10861
+ if (!brand) return "";
10862
+ try {
10863
+ const declarations = Object.entries(brandTokens(brand, theme)).map(([property, value]) => `${property}: ${value};`).join(" ");
10864
+ return `:host { ${declarations} }`;
10865
+ } catch {
10866
+ return "";
10867
+ }
10868
+ }
10081
10869
  var ConsentFlow = class extends i4 {
10082
10870
  constructor() {
10083
10871
  super();
@@ -10085,6 +10873,10 @@ var ConsentFlow = class extends i4 {
10085
10873
  this.copy = {};
10086
10874
  this.step = "";
10087
10875
  this.theme = "light";
10876
+ this.legal = [];
10877
+ this.highlight = "";
10878
+ this.highlightMode = "select";
10879
+ this.highlightLabel = "";
10088
10880
  this.preview = false;
10089
10881
  this.selected = /* @__PURE__ */ new Set();
10090
10882
  this.resolved = null;
@@ -10093,12 +10885,18 @@ var ConsentFlow = class extends i4 {
10093
10885
  this.atRest = null;
10094
10886
  this.pointerInside = false;
10095
10887
  this.generation = 0;
10888
+ this.motionDone = Promise.resolve();
10889
+ this.termsAccepted = false;
10890
+ this.acceptedTerms = "";
10891
+ this.resizes = null;
10096
10892
  this.onDocumentPointer = (event) => {
10097
10893
  this.pointerInside = event.composedPath().includes(this);
10098
10894
  };
10099
10895
  this.onAllow = (event) => {
10100
10896
  event.stopPropagation();
10101
10897
  if (this.fromLeaving(event)) return;
10898
+ const terms = this.terms;
10899
+ if (terms && !this.termsAccepted) return;
10102
10900
  const ticked = (this.data?.capabilities ?? []).filter(
10103
10901
  (cap) => this.selected.has(cap.id)
10104
10902
  );
@@ -10108,11 +10906,76 @@ var ConsentFlow = class extends i4 {
10108
10906
  this.init({
10109
10907
  capabilities: ticked.map((cap) => cap.id),
10110
10908
  scopes: [...new Set(ticked.flatMap((cap) => cap.scopes))],
10111
- approvalMethod: this.flow.approvalMethod
10909
+ approvalMethod: this.flow.approvalMethod,
10910
+ // Without terms the fields stay out: a server reads an explicit
10911
+ // false as refused.
10912
+ ...terms ? { termsAccepted: true } : {},
10913
+ ...terms?.version !== void 0 ? { termsVersion: terms.version } : {}
10112
10914
  })
10113
10915
  )
10114
10916
  );
10115
10917
  };
10918
+ /** The terms box: its tick is the person's, in a preview too. */
10919
+ this.onChange = (event) => {
10920
+ const target = event.target;
10921
+ if (target?.dataset?.action !== "terms" || this.fromLeaving(event)) return;
10922
+ this.termsAccepted = target.checked;
10923
+ this.requestUpdate();
10924
+ };
10925
+ /** In a preview, a click names the region it landed in, for the editor's rail. */
10926
+ this.onFieldClick = (event) => {
10927
+ if (!this.preview || this.fromLeaving(event)) return;
10928
+ const field = this.fieldAt(event);
10929
+ if (!field) return;
10930
+ this.dispatchEvent(
10931
+ new CustomEvent(
10932
+ "consent-flow-field",
10933
+ this.init({ field })
10934
+ )
10935
+ );
10936
+ };
10937
+ /** Outlines the highlighted region, in a preview; fades the outline out otherwise. */
10938
+ this.placeSpotlight = () => {
10939
+ const spot = this.renderRoot.querySelector(".spotlight");
10940
+ const flow2 = this.renderRoot.querySelector(".flow");
10941
+ const card = this.card;
10942
+ if (!spot || !flow2 || !card) return;
10943
+ const region = this.preview && this.highlight ? this.regionOf(this.highlight) : null;
10944
+ if (!region) {
10945
+ delete spot.dataset.shown;
10946
+ return;
10947
+ }
10948
+ const outer = flow2.getBoundingClientRect();
10949
+ const scale = flow2.offsetWidth > 0 ? outer.width / flow2.offsetWidth : 1;
10950
+ const box = region.getBoundingClientRect();
10951
+ const clip = within(card, region) ? inset(card.getBoundingClientRect(), card.clientLeft * scale) : outer;
10952
+ const left = Math.max(box.left - SPOT_X * scale, clip.left);
10953
+ const top = Math.max(box.top - SPOT_Y * scale, clip.top);
10954
+ const right = Math.min(box.right + SPOT_X * scale, clip.right);
10955
+ const bottom = Math.min(box.bottom + SPOT_Y * scale, clip.bottom);
10956
+ const x3 = (left - outer.left) / scale;
10957
+ const y4 = (top - outer.top) / scale;
10958
+ const first = spot.dataset.shown === void 0;
10959
+ if (first) spot.classList.add("placing");
10960
+ spot.style.transform = `translate(${x3}px, ${y4}px)`;
10961
+ spot.style.width = `${(right - left) / scale}px`;
10962
+ spot.style.height = `${(bottom - top) / scale}px`;
10963
+ spot.style.borderRadius = `${ringRadius(region)}px`;
10964
+ spot.dataset.mode = this.highlightMode === "hover" ? "hover" : "select";
10965
+ const ghost = Boolean(region.querySelector(":scope > .ghost"));
10966
+ const label = [this.highlightLabel.trim(), ghost ? "Empty" : ""].filter(Boolean).join(" \xB7 ");
10967
+ const tag = spot.querySelector(".spot-label");
10968
+ if (tag) {
10969
+ tag.textContent = label;
10970
+ tag.hidden = !label;
10971
+ tag.dataset.below = String(y4 < LABEL_ROOM);
10972
+ }
10973
+ if (first) {
10974
+ void spot.offsetWidth;
10975
+ spot.classList.remove("placing");
10976
+ }
10977
+ spot.dataset.shown = "";
10978
+ };
10116
10979
  this.onDeny = (event) => {
10117
10980
  event.stopPropagation();
10118
10981
  if (!this.fromLeaving(event))
@@ -10169,6 +11032,26 @@ var ConsentFlow = class extends i4 {
10169
11032
  get currentStep() {
10170
11033
  return this.resolved;
10171
11034
  }
11035
+ /**
11036
+ * Where a region is drawn now, in viewport coordinates: the box `highlight`
11037
+ * outlines (Approve and Deny each their own button). Null when this step
11038
+ * draws no such region. A box that is moving between steps reads where it
11039
+ * is drawn this frame, so after a step change read it once `whenSettled()`
11040
+ * resolves.
11041
+ *
11042
+ * @example
11043
+ * flowEl.step = "granted";
11044
+ * await flowEl.whenSettled();
11045
+ * flowEl.fieldRect("headline"); // DOMRect
11046
+ */
11047
+ fieldRect(field) {
11048
+ return isField(field) ? this.regionOf(field)?.getBoundingClientRect() ?? null : null;
11049
+ }
11050
+ /** Resolves once the last change is drawn and its motion has finished (at once when nothing moves). */
11051
+ async whenSettled() {
11052
+ await this.updateComplete;
11053
+ await this.motionDone;
11054
+ }
10172
11055
  connectedCallback() {
10173
11056
  super.connectedCallback();
10174
11057
  document.addEventListener("pointerdown", this.onDocumentPointer, true);
@@ -10176,6 +11059,8 @@ var ConsentFlow = class extends i4 {
10176
11059
  disconnectedCallback() {
10177
11060
  super.disconnectedCallback();
10178
11061
  document.removeEventListener("pointerdown", this.onDocumentPointer, true);
11062
+ this.resizes?.disconnect();
11063
+ this.resizes = null;
10179
11064
  }
10180
11065
  get card() {
10181
11066
  return this.renderRoot.querySelector(".card");
@@ -10186,6 +11071,10 @@ var ConsentFlow = class extends i4 {
10186
11071
  willUpdate(changed) {
10187
11072
  if (changed.has("data"))
10188
11073
  this.reselect(changed.get("data"));
11074
+ if (changed.has("terms") && termsKey(this.terms) !== this.acceptedTerms) {
11075
+ this.termsAccepted = false;
11076
+ this.acceptedTerms = termsKey(this.terms);
11077
+ }
10189
11078
  const steps = this.flow.steps;
10190
11079
  const wanted = this.step;
10191
11080
  const swapped = this.hasUpdated && changed.has("flow");
@@ -10195,7 +11084,7 @@ var ConsentFlow = class extends i4 {
10195
11084
  this.atRest = null;
10196
11085
  const card = this.card;
10197
11086
  const fx = this.fx;
10198
- if (!this.hasUpdated || !card || !fx || !DRAWN.some((key) => changed.has(key)))
11087
+ if (!this.hasUpdated || !card || !fx || !MOVES.some((key) => changed.has(key)))
10199
11088
  return;
10200
11089
  settle(card);
10201
11090
  fx.replaceChildren();
@@ -10246,6 +11135,30 @@ var ConsentFlow = class extends i4 {
10246
11135
  const fx = this.fx;
10247
11136
  return Boolean(fx && event.composedPath().includes(fx));
10248
11137
  }
11138
+ /** The innermost region on an event's path, through the package's own shadow roots. */
11139
+ fieldAt(event) {
11140
+ for (const node of event.composedPath()) {
11141
+ if (node === this) return null;
11142
+ if (!(node instanceof HTMLElement)) continue;
11143
+ const name = node.dataset.field ?? node.dataset.block;
11144
+ if (isField(name)) return name;
11145
+ }
11146
+ return null;
11147
+ }
11148
+ /** The element a region is drawn by: the innermost one, inside the package's own parts too. */
11149
+ regionOf(field) {
11150
+ const selector = `[data-field="${field}"]`;
11151
+ const root = this.renderRoot;
11152
+ const own = root.querySelector(selector) ?? root.querySelector(`.card > [data-block="${field}"]`);
11153
+ if (own) return own;
11154
+ for (const host of root.querySelectorAll(
11155
+ "consent-action-bar, consent-connector-header"
11156
+ )) {
11157
+ const inner = host.shadowRoot?.querySelector(selector);
11158
+ if (inner) return inner;
11159
+ }
11160
+ return null;
11161
+ }
10249
11162
  specs(data, step, copy) {
10250
11163
  const ctx = {
10251
11164
  data,
@@ -10254,7 +11167,9 @@ var ConsentFlow = class extends i4 {
10254
11167
  selected: this.selected,
10255
11168
  method: this.flow.approvalMethod,
10256
11169
  preview: this.preview,
10257
- values: flowValues(data)
11170
+ values: flowValues(data),
11171
+ ...this.terms ? { terms: this.terms } : {},
11172
+ termsAccepted: this.termsAccepted
10258
11173
  };
10259
11174
  const seen = /* @__PURE__ */ new Map();
10260
11175
  const specs = [];
@@ -10262,7 +11177,9 @@ var ConsentFlow = class extends i4 {
10262
11177
  const [name, variant] = ref.split(":");
10263
11178
  const draw = FLOW_BLOCK_RENDERERS[name];
10264
11179
  if (!draw) continue;
10265
- const result = draw(variant ? { ...ctx, variant } : ctx);
11180
+ let result = draw(variant ? { ...ctx, variant } : ctx);
11181
+ if (result === A && this.preview && this.highlight === name)
11182
+ result = b2`<div class="ghost" part="ghost"></div>`;
10266
11183
  if (result === A) continue;
10267
11184
  const n6 = (seen.get(name) ?? 0) + 1;
10268
11185
  seen.set(name, n6);
@@ -10283,15 +11200,24 @@ var ConsentFlow = class extends i4 {
10283
11200
  );
10284
11201
  const seal = fillTemplate(group(copy, "seal")[def.connector] ?? "", values);
10285
11202
  const announce = fillTemplate(group(copy, "announce")[step] ?? "", values);
11203
+ const legal = this.legal.filter((link) => httpsUrl(link.href));
10286
11204
  return b2`<style>
10287
11205
  ${themeScopeStyle(
10288
11206
  getConsentTheme(this.theme),
10289
- ".card, consent-connector-header, .below"
11207
+ ".card",
11208
+ "consent-connector-header, .below"
10290
11209
  )}
11210
+ ${brandRule(this.brand, this.theme)}
10291
11211
  </style>
10292
- <div class="flow" data-step=${step}>
11212
+ <div
11213
+ class="flow"
11214
+ data-step=${step}
11215
+ data-motion=${this.flow.motion}
11216
+ @click=${this.onFieldClick}
11217
+ >
10293
11218
  <consent-connector-header
10294
11219
  part="connector"
11220
+ data-field="connector"
10295
11221
  variant="bridge"
10296
11222
  .clientName=${data.agent.name}
10297
11223
  .clientLogoUrl=${data.agent.logoUrl ?? ""}
@@ -10309,6 +11235,7 @@ var ConsentFlow = class extends i4 {
10309
11235
  class="card"
10310
11236
  part="card"
10311
11237
  @click=${this.onClick}
11238
+ @change=${this.onChange}
10312
11239
  @consent-allow=${this.onAllow}
10313
11240
  @consent-deny=${this.onDeny}
10314
11241
  @consent-request-expired=${this.onExpired}
@@ -10329,11 +11256,31 @@ var ConsentFlow = class extends i4 {
10329
11256
  </div>
10330
11257
  <div class="below" part="below">
10331
11258
  <consent-secured-by></consent-secured-by>
11259
+ ${legal.length > 0 ? b2`<nav
11260
+ class="legal"
11261
+ part="legal"
11262
+ data-field="legal"
11263
+ aria-label=${group(copy, "legal").label ?? "Legal"}
11264
+ >
11265
+ ${legal.map(
11266
+ (link) => b2`<a
11267
+ href=${link.href}
11268
+ target="_blank"
11269
+ rel="noopener noreferrer"
11270
+ >${link.label}</a
11271
+ >`
11272
+ )}
11273
+ </nav>` : A}
10332
11274
  </div>
10333
11275
  <p class="sr" role="status">${announce}</p>
11276
+ <div class="spotlight" aria-hidden="true">
11277
+ <span class="spot-label" hidden></span>
11278
+ </div>
10334
11279
  </div>`;
10335
11280
  }
10336
11281
  updated(changed) {
11282
+ this.watchLayout();
11283
+ this.placeSpotlight();
10337
11284
  this.setAttribute(FLOW_HOST_ATTRIBUTES.version, String(this.flow.version));
10338
11285
  this.setAttribute(
10339
11286
  FLOW_HOST_ATTRIBUTES.approvalMethod,
@@ -10356,6 +11303,15 @@ var ConsentFlow = class extends i4 {
10356
11303
  }
10357
11304
  if (before) this.animateStep(before);
10358
11305
  }
11306
+ /** Moves the outline with the card: a resize, a font loading, a step settling. */
11307
+ watchLayout() {
11308
+ if (this.resizes || typeof ResizeObserver === "undefined") return;
11309
+ const card = this.card;
11310
+ if (!card) return;
11311
+ this.resizes = new ResizeObserver(this.placeSpotlight);
11312
+ this.resizes.observe(card);
11313
+ this.resizes.observe(this);
11314
+ }
10359
11315
  /** The step's `focus` block takes focus: its own target (`tabindex="-1"`), else its first control. */
10360
11316
  focusStep(step) {
10361
11317
  const key = this.flow.steps[step]?.focus;
@@ -10415,25 +11371,119 @@ var ConsentFlow = class extends i4 {
10415
11371
  );
10416
11372
  else play2("arrive", name, arrive(el, arrivals++, t8));
10417
11373
  }
10418
- const generation = ++this.generation;
10419
- void Promise.allSettled(
10420
- started.map((animation) => animation.finished)
10421
- ).then(() => {
10422
- if (generation === this.generation) card.classList.remove("moving");
10423
- });
10424
- }
10425
- };
10426
- ConsentFlow.styles = i`
10427
- :host {
10428
- display: block;
10429
- width: 100%;
10430
- text-wrap: pretty;
11374
+ const generation = ++this.generation;
11375
+ this.motionDone = Promise.allSettled(
11376
+ started.map((animation) => animation.finished)
11377
+ ).then(() => {
11378
+ if (generation !== this.generation) return;
11379
+ card.classList.remove("moving");
11380
+ this.placeSpotlight();
11381
+ });
11382
+ }
11383
+ };
11384
+ ConsentFlow.styles = i`
11385
+ :host {
11386
+ display: block;
11387
+ width: 100%;
11388
+ text-wrap: pretty;
11389
+ }
11390
+
11391
+ /* A preview shows the brand's page behind the card, which a live page
11392
+ paints on its body; with none, the editor's own shows through. */
11393
+ :host([preview]) {
11394
+ background-color: var(--cs-surface-bg);
11395
+ }
11396
+
11397
+ .flow {
11398
+ position: relative;
11399
+ box-sizing: border-box;
11400
+ max-width: var(--cs-screen-max-width, 576px);
11401
+ margin: 0 auto;
11402
+ }
11403
+
11404
+ /* The editor's focused field, outlined over the flow in a preview. */
11405
+ /* The editor's highlight: a selection over the flow, in an editor
11406
+ accent (not the brand, not ink). It never takes layout. */
11407
+ .spotlight {
11408
+ --_accent: var(--cs-edit-focus-ring, #6d5ae6);
11409
+ position: absolute;
11410
+ top: 0;
11411
+ left: 0;
11412
+ box-sizing: border-box;
11413
+ border: 1.5px solid var(--_accent);
11414
+ border-radius: 8px;
11415
+ background: var(
11416
+ --cs-edit-wash,
11417
+ color-mix(in srgb, var(--_accent) 6%, transparent)
11418
+ );
11419
+ opacity: 0;
11420
+ pointer-events: none;
11421
+ z-index: 6;
11422
+ transition:
11423
+ opacity 120ms ease-out,
11424
+ transform 180ms ease-out,
11425
+ width 180ms ease-out,
11426
+ height 180ms ease-out;
11427
+ }
11428
+
11429
+ .spotlight[data-shown] {
11430
+ opacity: 1;
11431
+ }
11432
+
11433
+ .spotlight[data-mode="hover"] {
11434
+ border: 1px dashed var(--cs-edit-hover-ring, var(--_accent));
11435
+ background: none;
11436
+ }
11437
+
11438
+ /* A first show lands in place; reduced motion and the none preset fade only. */
11439
+ .spotlight.placing,
11440
+ .flow[data-motion="none"] .spotlight {
11441
+ transition: opacity 120ms ease-out;
11442
+ }
11443
+
11444
+ @media (prefers-reduced-motion: reduce) {
11445
+ .spotlight {
11446
+ transition: opacity 120ms ease-out;
11447
+ }
11448
+ }
11449
+
11450
+ /* The field's name, on the ring's top edge like a legend, so it reaches
11451
+ into the gap above rather than over the block before. */
11452
+ .spot-label {
11453
+ position: absolute;
11454
+ top: 0;
11455
+ left: 10px;
11456
+ transform: translateY(-50%);
11457
+ padding: 2px 6px;
11458
+ border-radius: 4px;
11459
+ background: var(--_accent);
11460
+ /* Themable with the accent: text on it stays readable. */
11461
+ color: var(--cs-edit-on-accent, #ffffff);
11462
+ font:
11463
+ 600 10px/14px system-ui,
11464
+ -apple-system,
11465
+ "Segoe UI",
11466
+ sans-serif;
11467
+ letter-spacing: 0.06em;
11468
+ text-transform: uppercase;
11469
+ white-space: nowrap;
10431
11470
  }
10432
11471
 
10433
- .flow {
11472
+ .spot-label[data-below="true"] {
11473
+ top: 100%;
11474
+ }
11475
+
11476
+ .spot-label[hidden] {
11477
+ display: none;
11478
+ }
11479
+
11480
+ /* Where a highlighted field's words will go, before it has any. */
11481
+ .ghost {
10434
11482
  box-sizing: border-box;
10435
- max-width: var(--cs-screen-max-width, 576px);
10436
- margin: 0 auto;
11483
+ height: 28px;
11484
+ border: 1px dashed
11485
+ color-mix(in srgb, var(--cs-edit-focus-ring, #6d5ae6) 55%, transparent);
11486
+ border-radius: 6px;
10437
11487
  }
10438
11488
 
10439
11489
  .card {
@@ -10476,10 +11526,25 @@ ConsentFlow.styles = i`
10476
11526
  display: flex;
10477
11527
  flex-direction: column;
10478
11528
  align-items: center;
11529
+ gap: 10px;
10479
11530
  margin-top: 16px;
10480
11531
  color: var(--cs-text-tertiary);
10481
11532
  }
10482
11533
 
11534
+ .legal {
11535
+ display: flex;
11536
+ flex-wrap: wrap;
11537
+ justify-content: center;
11538
+ gap: 4px 20px;
11539
+ font-size: 12px;
11540
+ }
11541
+
11542
+ .legal a {
11543
+ color: inherit;
11544
+ text-decoration: underline;
11545
+ text-underline-offset: 2px;
11546
+ }
11547
+
10483
11548
  .sr {
10484
11549
  position: absolute;
10485
11550
  width: 1px;
@@ -10507,6 +11572,24 @@ __decorateClass([
10507
11572
  __decorateClass([
10508
11573
  n4({ type: String })
10509
11574
  ], ConsentFlow.prototype, "theme", 2);
11575
+ __decorateClass([
11576
+ n4({ attribute: false })
11577
+ ], ConsentFlow.prototype, "brand", 2);
11578
+ __decorateClass([
11579
+ n4({ attribute: false })
11580
+ ], ConsentFlow.prototype, "legal", 2);
11581
+ __decorateClass([
11582
+ n4({ attribute: false })
11583
+ ], ConsentFlow.prototype, "terms", 2);
11584
+ __decorateClass([
11585
+ n4({ type: String })
11586
+ ], ConsentFlow.prototype, "highlight", 2);
11587
+ __decorateClass([
11588
+ n4({ type: String, attribute: "highlight-mode" })
11589
+ ], ConsentFlow.prototype, "highlightMode", 2);
11590
+ __decorateClass([
11591
+ n4({ type: String, attribute: "highlight-label" })
11592
+ ], ConsentFlow.prototype, "highlightLabel", 2);
10510
11593
  __decorateClass([
10511
11594
  n4({ type: Boolean, reflect: true })
10512
11595
  ], ConsentFlow.prototype, "preview", 2);
@@ -12974,215 +14057,6 @@ McpConsent = __decorateClass([
12974
14057
  t3("mcp-consent")
12975
14058
  ], McpConsent);
12976
14059
 
12977
- // src/styles/brand.ts
12978
- var AA_GRAPHIC_CONTRAST = 3;
12979
- var TEXT_CONTRAST = 4.5;
12980
- var ICON_TILE_PERCENT = 8;
12981
- var HOVERED_ROW_PERCENT = 4;
12982
- var MUTED_TEXT_PERCENT = 64;
12983
- var PANEL_TINT_PERCENT = 4;
12984
- var LIGHTNESS_STEP = 5e-3;
12985
- var LIGHT_DRAWN_COLORS = Object.freeze({
12986
- surface: lightTheme.surfaceCard,
12987
- panel: lightTheme.surfaceInset,
12988
- text: lightTheme.textPrimary,
12989
- mutedText: lightTheme.textTertiary
12990
- });
12991
- var PALETTE_FIELDS = [
12992
- "surfaceColor",
12993
- "panelColor",
12994
- "borderColor",
12995
- "textColor",
12996
- "mutedTextColor",
12997
- "focusColor"
12998
- ];
12999
- function rgbOf(hex) {
13000
- return [1, 3, 5].map((at) => Number.parseInt(hex.slice(at, at + 2), 16));
13001
- }
13002
- function hexOf(channels2) {
13003
- return `#${channels2.map((value) => Math.round(value).toString(16).padStart(2, "0")).join("")}`;
13004
- }
13005
- function mixOver(top, percent, under) {
13006
- const share = percent / 100;
13007
- const below = rgbOf(under);
13008
- return hexOf(
13009
- rgbOf(top).map((above, i8) => above * share + below[i8] * (1 - share))
13010
- );
13011
- }
13012
- function hslOf(hex) {
13013
- const [red, green, blue] = rgbOf(hex).map((value) => value / 255);
13014
- const high = Math.max(red, green, blue);
13015
- const low = Math.min(red, green, blue);
13016
- const spread = high - low;
13017
- const lightness = (high + low) / 2;
13018
- if (spread === 0) return { hue: 0, saturation: 0, lightness };
13019
- const saturation = spread / (1 - Math.abs(2 * lightness - 1));
13020
- const sector = high === red ? (green - blue) / spread : high === green ? (blue - red) / spread + 2 : (red - green) / spread + 4;
13021
- return { hue: (sector * 60 + 360) % 360, saturation, lightness };
13022
- }
13023
- function hexFromHsl({ hue, saturation, lightness }) {
13024
- const reach = saturation * Math.min(lightness, 1 - lightness);
13025
- const channel = (offset) => {
13026
- const turn = (offset + hue / 30) % 12;
13027
- return (lightness - reach * Math.max(-1, Math.min(turn - 3, 9 - turn, 1))) * 255;
13028
- };
13029
- return hexOf([channel(0), channel(8), channel(4)]);
13030
- }
13031
- function iconColorFor(hex, primary, drawn = LIGHT_DRAWN_COLORS) {
13032
- const hoveredRow = mixOver(primary, HOVERED_ROW_PERCENT, drawn.surface);
13033
- const surfaces = [
13034
- drawn.surface,
13035
- drawn.panel,
13036
- mixOver(primary, ICON_TILE_PERCENT, drawn.surface),
13037
- mixOver(primary, ICON_TILE_PERCENT, hoveredRow)
13038
- ];
13039
- const worstRatio = (candidate) => Math.min(...surfaces.map((surface) => contrastRatio(candidate, surface)));
13040
- if (worstRatio(hex) >= AA_GRAPHIC_CONTRAST) return hex;
13041
- const start = hslOf(hex);
13042
- for (let steps = 1; steps * LIGHTNESS_STEP <= 1; steps++) {
13043
- for (const lightness of [
13044
- start.lightness - steps * LIGHTNESS_STEP,
13045
- start.lightness + steps * LIGHTNESS_STEP
13046
- ]) {
13047
- if (lightness < 0 || lightness > 1) continue;
13048
- const candidate = hexFromHsl({ ...start, lightness });
13049
- if (worstRatio(candidate) >= AA_GRAPHIC_CONTRAST) return candidate;
13050
- }
13051
- }
13052
- return worstRatio("#000000") >= worstRatio("#ffffff") ? "#000000" : "#ffffff";
13053
- }
13054
- function focusRingFor(hex, surface = LIGHT_DRAWN_COLORS.surface) {
13055
- return contrastRatio(hex, surface) >= AA_GRAPHIC_CONTRAST ? "brand" : "ink";
13056
- }
13057
- function readsOnCardAndTint(hex, ratio, surface) {
13058
- const tint = mixOver(hex, TINT_PERCENT, surface);
13059
- return contrastRatio(hex, surface) >= ratio && contrastRatio(hex, tint) >= ratio;
13060
- }
13061
- function actionColorFor(hex, surface = LIGHT_DRAWN_COLORS.surface) {
13062
- return readsOnCardAndTint(hex, TEXT_CONTRAST, surface) ? "brand" : "ink";
13063
- }
13064
- function markColorFor(hex, surface = LIGHT_DRAWN_COLORS.surface) {
13065
- return readsOnCardAndTint(hex, AA_GRAPHIC_CONTRAST, surface) ? "brand" : "ink";
13066
- }
13067
- function onPrimaryFor(hex) {
13068
- const luminance = relativeLuminance(hex);
13069
- const againstWhite = 1.05 / (luminance + 0.05);
13070
- const againstBlack = (luminance + 0.05) / 0.05;
13071
- return againstBlack >= againstWhite ? "black" : "white";
13072
- }
13073
- function panelOf(palette, text, drawn) {
13074
- if (palette.panelColor) return palette.panelColor;
13075
- if (palette.surfaceColor)
13076
- return mixOver(text, PANEL_TINT_PERCENT, palette.surfaceColor);
13077
- return drawn.panel;
13078
- }
13079
- function mutedOn(palette, background, drawn) {
13080
- if (palette.mutedTextColor) return palette.mutedTextColor;
13081
- if (palette.textColor)
13082
- return mixOver(palette.textColor, MUTED_TEXT_PERCENT, background);
13083
- return drawn.mutedText;
13084
- }
13085
- function floorToHundredths(ratio) {
13086
- return Math.floor(ratio * 100) / 100;
13087
- }
13088
- function paletteFailures(palette, drawn = {}) {
13089
- const colors = { ...LIGHT_DRAWN_COLORS, ...drawn };
13090
- const text = palette.textColor ?? colors.text;
13091
- const backgrounds = [
13092
- {
13093
- background: "surfaceColor",
13094
- color: palette.surfaceColor ?? colors.surface
13095
- },
13096
- { background: "panelColor", color: panelOf(palette, text, colors) }
13097
- ];
13098
- return backgrounds.flatMap(({ background, color }) => {
13099
- const pairs = [
13100
- { foreground: "textColor", color: text, needs: TEXT_CONTRAST },
13101
- {
13102
- foreground: "mutedTextColor",
13103
- color: mutedOn(palette, color, colors),
13104
- needs: TEXT_CONTRAST
13105
- },
13106
- ...palette.focusColor ? [
13107
- {
13108
- foreground: "focusColor",
13109
- color: palette.focusColor,
13110
- needs: AA_GRAPHIC_CONTRAST
13111
- }
13112
- ] : []
13113
- ];
13114
- return pairs.flatMap(({ foreground, color: ink, needs }) => {
13115
- const ratio = contrastRatio(ink, color);
13116
- return ratio >= needs ? [] : [{ foreground, background, ratio: floorToHundredths(ratio), needs }];
13117
- });
13118
- });
13119
- }
13120
- function drawablePalette(chosen, drawn = {}) {
13121
- const { focusColor, borderColor, ...surfacesAndText } = chosen;
13122
- const kept = paletteFailures(surfacesAndText, drawn).length === 0 ? surfacesAndText : {};
13123
- const focusShows = focusColor !== void 0 && paletteFailures({ ...kept, focusColor }, drawn).length === 0;
13124
- return {
13125
- ...kept,
13126
- ...borderColor ? { borderColor } : {},
13127
- ...focusShows ? { focusColor } : {}
13128
- };
13129
- }
13130
- function brandTokens(brand) {
13131
- for (const [field, value] of Object.entries(brand)) {
13132
- if (value !== void 0 && !isHexColor(value)) {
13133
- throw new RangeError(
13134
- `${field} must be a #rrggbb color, got ${JSON.stringify(value)}`
13135
- );
13136
- }
13137
- }
13138
- const { primaryColor: primary, secondaryColor, ...chosen } = brand;
13139
- const palette = drawablePalette(chosen);
13140
- const surface = palette.surfaceColor ?? LIGHT_DRAWN_COLORS.surface;
13141
- const panel = panelOf(
13142
- palette,
13143
- palette.textColor ?? LIGHT_DRAWN_COLORS.text,
13144
- LIGHT_DRAWN_COLORS
13145
- );
13146
- const ink = palette.textColor ?? LIGHT_DRAWN_COLORS.text;
13147
- const onPrimary = onPrimaryFor(primary);
13148
- const inBrand = (pick) => pick === "brand" ? primary : ink;
13149
- const tokens = {
13150
- "--consent-primary": primary,
13151
- "--consent-on-primary": onPrimary,
13152
- "--consent-link": inBrand(actionColorFor(primary, surface)),
13153
- "--cs-surface-accent": primary,
13154
- "--cs-surface-accent-text": onPrimary,
13155
- "--cs-tint": mixOver(primary, TINT_PERCENT, surface),
13156
- "--cs-tint-line": mixOver(primary, TINT_LINE_PERCENT, surface),
13157
- "--cs-mark": inBrand(markColorFor(primary, surface)),
13158
- "--cs-action": inBrand(actionColorFor(primary, surface)),
13159
- "--cs-focus-ring": palette.focusColor ?? inBrand(focusRingFor(primary, surface))
13160
- };
13161
- if (secondaryColor) {
13162
- tokens["--cs-icon"] = iconColorFor(secondaryColor, primary, {
13163
- surface,
13164
- panel
13165
- });
13166
- }
13167
- if (palette.surfaceColor) tokens["--cs-surface-card"] = palette.surfaceColor;
13168
- if (palette.surfaceColor || palette.panelColor)
13169
- tokens["--cs-surface-inset"] = panel;
13170
- if (palette.borderColor) tokens["--cs-surface-border"] = palette.borderColor;
13171
- if (palette.textColor) {
13172
- tokens["--cs-text-primary"] = palette.textColor;
13173
- tokens["--cs-text-secondary"] = palette.textColor;
13174
- }
13175
- if (palette.mutedTextColor) {
13176
- tokens["--cs-text-tertiary"] = palette.mutedTextColor;
13177
- } else if (palette.textColor) {
13178
- tokens["--cs-text-tertiary"] = `color-mix(in srgb, ${palette.textColor} ${MUTED_TEXT_PERCENT}%, transparent)`;
13179
- }
13180
- return tokens;
13181
- }
13182
- function brandStyle(brand) {
13183
- return Object.entries(brandTokens(brand)).map(([property, value]) => `${property}: ${value};`).join(" ");
13184
- }
13185
-
13186
14060
  // ../../node_modules/.pnpm/@kya-os+id@0.11.0_@cfworker+json-schema@4.1.1_better-auth@1.7.7_@opentelemetry+api@1.9._1fd211efd4c126c93f6c4adb9fbb1c99/node_modules/@kya-os/id/dist/base64url.js
13187
14061
  function bytesToBase64Url(bytes) {
13188
14062
  let b642;
@@ -13800,6 +14674,7 @@ function renderIcon() {
13800
14674
  }
13801
14675
  export {
13802
14676
  APPROVAL_METHODS,
14677
+ CONFIG_FIELD_REGIONS,
13803
14678
  CONNECTOR_MARKS,
13804
14679
  CONSENT_CAPABILITIES_FEATURES,
13805
14680
  CONSENT_EDIT_EVENTS,
@@ -13827,6 +14702,7 @@ export {
13827
14702
  FLOW_CONNECTOR_STATES,
13828
14703
  FLOW_COPY,
13829
14704
  FLOW_EVENTS,
14705
+ FLOW_FIELDS,
13830
14706
  FLOW_HOST_ATTRIBUTES,
13831
14707
  FLOW_PRESETS,
13832
14708
  FLOW_SCHEMA_VERSION,
@@ -13845,6 +14721,7 @@ export {
13845
14721
  flowCopy,
13846
14722
  flowPreset,
13847
14723
  group,
14724
+ httpsUrl,
13848
14725
  initialsOf,
13849
14726
  paletteFailures,
13850
14727
  parseConsentEditKey,