@kya-os/consent 0.3.0 → 0.4.0
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.
- package/README.md +6 -1
- package/dist/bundle/inline.d.ts.map +1 -1
- package/dist/bundle/inline.js +4 -4
- package/dist/bundle/inline.js.map +1 -1
- package/dist/cjs/bundle/inline.js +4 -4
- package/dist/cjs/bundle/inline.js.map +1 -1
- package/dist/cjs/components/consent-capabilities-screen.js +39 -3
- package/dist/cjs/components/consent-capabilities-screen.js.map +1 -1
- package/dist/cjs/components/consent-capability-card.js +75 -24
- package/dist/cjs/components/consent-capability-card.js.map +1 -1
- package/dist/cjs/components/consent-headline.js +50 -1
- package/dist/cjs/components/consent-headline.js.map +1 -1
- package/dist/cjs/components/index.js +2 -1
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/constants/capabilities.js +11 -2
- package/dist/cjs/constants/capabilities.js.map +1 -1
- package/dist/cjs/mcp-app/inline.js +2 -2
- package/dist/cjs/mcp-app/inline.js.map +1 -1
- package/dist/components/consent-capabilities-screen.d.ts +14 -3
- package/dist/components/consent-capabilities-screen.d.ts.map +1 -1
- package/dist/components/consent-capabilities-screen.js +37 -2
- package/dist/components/consent-capabilities-screen.js.map +1 -1
- package/dist/components/consent-capability-card.d.ts +19 -2
- package/dist/components/consent-capability-card.d.ts.map +1 -1
- package/dist/components/consent-capability-card.js +74 -23
- package/dist/components/consent-capability-card.js.map +1 -1
- package/dist/components/consent-headline.d.ts +25 -0
- package/dist/components/consent-headline.d.ts.map +1 -1
- package/dist/components/consent-headline.js +52 -3
- package/dist/components/consent-headline.js.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/consent.js +121 -25
- package/dist/consent.min.js +114 -94
- package/dist/constants/capabilities.d.ts +5 -2
- package/dist/constants/capabilities.d.ts.map +1 -1
- package/dist/constants/capabilities.js +11 -2
- package/dist/constants/capabilities.js.map +1 -1
- package/dist/mcp-app/inline.d.ts.map +1 -1
- package/dist/mcp-app/inline.js +2 -2
- package/dist/mcp-app/inline.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline.js","sourceRoot":"","sources":["../../../src/mcp-app/inline.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,sEAAsE;AACzD,QAAA,oBAAoB,GAAW,
|
|
1
|
+
{"version":3,"file":"inline.js","sourceRoot":"","sources":["../../../src/mcp-app/inline.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,sEAAsE;AACzD,QAAA,oBAAoB,GAAW,u+h1BAAu+h1B,CAAC;AAEphi1B,4CAA4C;AAC/B,QAAA,yBAAyB,GAAW,MAAM,CAAC"}
|
|
@@ -13,6 +13,13 @@
|
|
|
13
13
|
* window. Selection state for the checkboxes is owned here to keep the
|
|
14
14
|
* parent simple.
|
|
15
15
|
*
|
|
16
|
+
* Each row's parts are forwarded with a `capability-` prefix
|
|
17
|
+
* (`capability-row`, `capability-label` and so on, see
|
|
18
|
+
* CAPABILITY_ROW_EXPORT_PARTS), and the header above the rows is the
|
|
19
|
+
* `section-header` part. A host puts content in a row by giving it
|
|
20
|
+
* `slot="capability-<capability id>"`, and words the headline itself through
|
|
21
|
+
* the `headline` slot.
|
|
22
|
+
*
|
|
16
23
|
* @module components/consent-capabilities-screen
|
|
17
24
|
*/
|
|
18
25
|
import { LitElement } from "lit";
|
|
@@ -20,12 +27,15 @@ import { type ConsentScopeCapability, type AgentMetadata, type ConsentTheme, typ
|
|
|
20
27
|
import { type AgentIdentity } from "../identity/agent-identity.js";
|
|
21
28
|
import "./consent-agent-header.js";
|
|
22
29
|
import "./consent-headline.js";
|
|
23
|
-
import "./consent-capability-card.js";
|
|
24
30
|
import "./consent-action-bar.js";
|
|
25
31
|
import "./consent-footer.js";
|
|
26
32
|
import "./consent-revocation-notice.js";
|
|
27
33
|
import "./consent-connector-header.js";
|
|
28
34
|
import { type GrantTerms } from "../grant/terms.js";
|
|
35
|
+
/** Each row part the screen forwards, as `<row part>: capability-<row part>`. */
|
|
36
|
+
export declare const CAPABILITY_ROW_EXPORT_PARTS: string;
|
|
37
|
+
/** The screen slot whose content shows inside the row for `capabilityId`. */
|
|
38
|
+
export declare function capabilitySlotName(capabilityId: string): string;
|
|
29
39
|
/**
|
|
30
40
|
* Detail emitted on `capabilities-allow`: the set of capability ids the user
|
|
31
41
|
* approved. The parent uses this to compose the granted list.
|
|
@@ -42,9 +52,10 @@ export interface CapabilitiesApproveDetail {
|
|
|
42
52
|
}
|
|
43
53
|
export declare class ConsentCapabilitiesScreen extends LitElement {
|
|
44
54
|
static readonly features: Readonly<{
|
|
45
|
-
version:
|
|
55
|
+
version: 2;
|
|
46
56
|
scopesOnly: true;
|
|
47
|
-
slots: readonly ["identity", "details", "notice", "footer"];
|
|
57
|
+
slots: readonly ["identity", "details", "notice", "footer", "headline"];
|
|
58
|
+
capabilitySlotPrefix: "capability-";
|
|
48
59
|
}>;
|
|
49
60
|
capabilities: ConsentScopeCapability[];
|
|
50
61
|
agentMetadata: AgentMetadata | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent-capabilities-screen.d.ts","sourceRoot":"","sources":["../../src/components/consent-capabilities-screen.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"consent-capabilities-screen.d.ts","sourceRoot":"","sources":["../../src/components/consent-capabilities-screen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAKrD,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM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;OAIG;IACsD,YAAY,SAAM;IAE3E;;;;OAIG;IACuD,aAAa,SAAM;IAE7E,0EAA0E;IACnB,UAAU,UAAS;IAEjE,OAAO,CAAC,QAAQ,CAAqB;IAE9C;;;;OAIG;IACH,OAAO,CAAC,OAAO,CAAM;;IAUZ,iBAAiB,IAAI,IAAI;IAKzB,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAMxD;;;;;;;OAOG;IACH,OAAO,CAAC,YAAY;IASpB,OAAgB,MAAM,0BAoDpB;IAEF,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,kBAAkB,CAmBxB;IAEF,2EAA2E;IAC3E,OAAO,KAAK,YAAY,GAIvB;IAED,OAAO,KAAK,gBAAgB,GAW3B;IAED,OAAO,CAAC,OAAO,CAyBb;IAEF,OAAO,CAAC,MAAM,CAKZ;IAEF,OAAO,CAAC,sBAAsB;IAgB9B,iFAAiF;IACjF,OAAO,CAAC,YAAY;IAaX,MAAM;CA0GhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,6BAA6B,EAAE,yBAAyB,CAAC;KAC1D;CACF"}
|
|
@@ -13,6 +13,13 @@
|
|
|
13
13
|
* window. Selection state for the checkboxes is owned here to keep the
|
|
14
14
|
* parent simple.
|
|
15
15
|
*
|
|
16
|
+
* Each row's parts are forwarded with a `capability-` prefix
|
|
17
|
+
* (`capability-row`, `capability-label` and so on, see
|
|
18
|
+
* CAPABILITY_ROW_EXPORT_PARTS), and the header above the rows is the
|
|
19
|
+
* `section-header` part. A host puts content in a row by giving it
|
|
20
|
+
* `slot="capability-<capability id>"`, and words the headline itself through
|
|
21
|
+
* the `headline` slot.
|
|
22
|
+
*
|
|
16
23
|
* @module components/consent-capabilities-screen
|
|
17
24
|
*/
|
|
18
25
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -32,13 +39,33 @@ import { capabilityIdsFor, capabilitySeedKey, } from "../resolution/credential-c
|
|
|
32
39
|
import { CONSENT_CAPABILITIES_FEATURES } from "../constants/capabilities.js";
|
|
33
40
|
import "./consent-agent-header.js";
|
|
34
41
|
import "./consent-headline.js";
|
|
35
|
-
import "./consent-capability-card.js";
|
|
42
|
+
import { CAPABILITY_ROW_PARTS } from "./consent-capability-card.js";
|
|
36
43
|
import "./consent-action-bar.js";
|
|
37
44
|
import "./consent-footer.js";
|
|
38
45
|
import "./consent-revocation-notice.js";
|
|
39
46
|
import "./consent-connector-header.js";
|
|
40
47
|
import { GRANT_FIELD_EVENTS } from "./consent-grant-terms.js";
|
|
41
48
|
import { mergeGrantTerms } from "../grant/terms.js";
|
|
49
|
+
/** Each row part the screen forwards, as `<row part>: capability-<row part>`. */
|
|
50
|
+
export const CAPABILITY_ROW_EXPORT_PARTS = CAPABILITY_ROW_PARTS.map((part) => `${part}: capability-${part}`).join(", ");
|
|
51
|
+
/** The screen slot whose content shows inside the row for `capabilityId`. */
|
|
52
|
+
export function capabilitySlotName(capabilityId) {
|
|
53
|
+
return `${CONSENT_CAPABILITIES_FEATURES.capabilitySlotPrefix}${capabilityId}`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Whether a `capability-toggle` reached the rows through a row's slot, so came
|
|
57
|
+
* from the host's content there and not from a row: that content cannot tick or
|
|
58
|
+
* untick any row. Only the path below the listener counts, so a screen that is
|
|
59
|
+
* itself slotted somewhere is not mistaken for slotted content.
|
|
60
|
+
*/
|
|
61
|
+
function cameThroughARowSlot(event) {
|
|
62
|
+
const path = event.composedPath();
|
|
63
|
+
const listener = event.currentTarget ? path.indexOf(event.currentTarget) : -1;
|
|
64
|
+
return path
|
|
65
|
+
.slice(0, listener === -1 ? path.length : listener)
|
|
66
|
+
.some((node) => node instanceof HTMLSlotElement &&
|
|
67
|
+
node.name.startsWith(CONSENT_CAPABILITIES_FEATURES.capabilitySlotPrefix));
|
|
68
|
+
}
|
|
42
69
|
let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends LitElement {
|
|
43
70
|
constructor() {
|
|
44
71
|
super();
|
|
@@ -98,6 +125,8 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends LitEleme
|
|
|
98
125
|
this.onCapabilityToggle = (event) => {
|
|
99
126
|
if (this.loading || this.disabled || !(event instanceof CustomEvent))
|
|
100
127
|
return;
|
|
128
|
+
if (cameThroughARowSlot(event))
|
|
129
|
+
return;
|
|
101
130
|
const detail = event.detail;
|
|
102
131
|
if (!detail ||
|
|
103
132
|
typeof detail !== "object" ||
|
|
@@ -242,6 +271,7 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends LitEleme
|
|
|
242
271
|
org-name="${this.orgName}"
|
|
243
272
|
verb="${this.headlineVerb}"
|
|
244
273
|
description="${this.description}"
|
|
274
|
+
><slot name="headline" slot="headline"></slot
|
|
245
275
|
></consent-headline>
|
|
246
276
|
<slot name="recovery"></slot>
|
|
247
277
|
<slot name="identity"></slot>
|
|
@@ -259,7 +289,7 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends LitEleme
|
|
|
259
289
|
: nothing}
|
|
260
290
|
<slot name="agent-key"></slot>
|
|
261
291
|
<div part="permissions">
|
|
262
|
-
<div class="section-header">
|
|
292
|
+
<div class="section-header" part="section-header">
|
|
263
293
|
<span>${sectionHeader}</span>
|
|
264
294
|
<span class="hint">${tokens.section.tapToToggle}</span>
|
|
265
295
|
</div>
|
|
@@ -275,6 +305,11 @@ let ConsentCapabilitiesScreen = class ConsentCapabilitiesScreen extends LitEleme
|
|
|
275
305
|
?disabled=${this.loading || this.disabled}
|
|
276
306
|
.scopes=${capability.scopes}
|
|
277
307
|
compiled-cedar="${this.compileCapabilityCedar(capability)}"
|
|
308
|
+
exportparts=${CAPABILITY_ROW_EXPORT_PARTS}
|
|
309
|
+
><slot
|
|
310
|
+
name=${capabilitySlotName(capability.id)}
|
|
311
|
+
slot="extra"
|
|
312
|
+
></slot
|
|
278
313
|
></consent-capability-card>
|
|
279
314
|
`)}
|
|
280
315
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent-capabilities-screen.js","sourceRoot":"","sources":["../../src/components/consent-capabilities-screen.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"consent-capabilities-screen.js","sourceRoot":"","sources":["../../src/components/consent-capabilities-screen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EACL,iBAAiB,GAKlB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,yBAAyB,GAE1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,2BAA2B,CAAC;AACnC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,yBAAyB,CAAC;AACjC,OAAO,qBAAqB,CAAC;AAC7B,OAAO,gCAAgC,CAAC;AACxC,OAAO,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAmB,MAAM,mBAAmB,CAAC;AAErE,iFAAiF;AACjF,MAAM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AM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;8DAAkB;AACjB;IAAtD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;8DAAkB;AAQxE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;8DAClD;AAOsC;IAAzD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;gEACjD;AAOgD;IAAvD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;+DAAmB;AAOjB;IAAxD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;+DAAmB;AAOjB;IAAzD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;gEAAoB;AAGtB;IAAtD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;6DAAoB;AAEzD;IAAhB,KAAK,EAAE;2DAAsC;AAtEnC,yBAAyB;IADrC,aAAa,CAAC,6BAA6B,CAAC;GAChC,yBAAyB,CAgYrC"}
|
|
@@ -8,10 +8,26 @@
|
|
|
8
8
|
* Emits a `capability-toggle` CustomEvent with `{ id, checked }` whenever the
|
|
9
9
|
* checkbox state changes; the parent (`<mcp-consent>`) tracks selection.
|
|
10
10
|
*
|
|
11
|
+
* Parts: `row`, `checkbox`, `check` (the mark in a ticked box), `icon`, `body`,
|
|
12
|
+
* `label-row` (the label, description and risk chip), `label-text` (the label
|
|
13
|
+
* and description), `label`, `description`, `risk`, `scopes`, `scope` and
|
|
14
|
+
* `policy`.
|
|
15
|
+
*
|
|
16
|
+
* Slot: `extra`, under the row's scopes, for something the host shows with the
|
|
17
|
+
* row (such as a check the row needs). A click anywhere in it does not toggle
|
|
18
|
+
* the row, and it is not part of the row's accessible name: the row is named
|
|
19
|
+
* by its label and, when it is higher risk, its risk chip, so a reader with
|
|
20
|
+
* descriptions off still hears the risk; its description describes it.
|
|
21
|
+
*
|
|
11
22
|
* @module components/consent-capability-card
|
|
12
23
|
*/
|
|
13
24
|
import { LitElement } from "lit";
|
|
14
25
|
import type { CapabilityIcon, RiskLevel } from "../types/capabilities.types.js";
|
|
26
|
+
/**
|
|
27
|
+
* Every part a row exposes. The capabilities screen forwards each one as
|
|
28
|
+
* `capability-<part>`, so a part added to the row must be added here too.
|
|
29
|
+
*/
|
|
30
|
+
export declare const CAPABILITY_ROW_PARTS: readonly ["row", "checkbox", "check", "icon", "body", "label-row", "label-text", "label", "description", "risk", "scopes", "scope", "policy"];
|
|
15
31
|
/**
|
|
16
32
|
* Detail emitted on the `capability-toggle` event.
|
|
17
33
|
*/
|
|
@@ -36,8 +52,9 @@ export declare class ConsentCapabilityCard extends LitElement {
|
|
|
36
52
|
* Row-level click handler. Makes the entire row a click target for
|
|
37
53
|
* toggling the checkbox — a UX nicety that matches Plaid/Apple-style
|
|
38
54
|
* consent rows. Skips when the user clicks the per-row "View policy"
|
|
39
|
-
* button, the policy disclosure,
|
|
40
|
-
* those
|
|
55
|
+
* button, the policy disclosure, any link inside the description, or
|
|
56
|
+
* anything the host put in the `extra` slot, so those children retain their
|
|
57
|
+
* own behavior.
|
|
41
58
|
*/
|
|
42
59
|
private onRowClick;
|
|
43
60
|
private togglePolicy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent-capability-card.d.ts","sourceRoot":"","sources":["../../src/components/consent-capability-card.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"consent-capability-card.d.ts","sourceRoot":"","sources":["../../src/components/consent-capability-card.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAKrD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAEhF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,+IAcvB,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,qBACa,qBAAsB,SAAQ,UAAU;IACvB,YAAY,SAAM;IAClB,KAAK,SAAM;IACX,WAAW,SAAM;IACjB,IAAI,EAAE,cAAc,CAAa;IACjC,SAAS,EAAE,SAAS,CAAS;IACb,OAAO,UAAS;IAChB,QAAQ,UAAS;IAClC,MAAM,EAAE,MAAM,EAAE,CAAM;IACQ,aAAa,SAAM;IAEnE,OAAO,CAAC,UAAU,CAAS;IAEpC,OAAgB,MAAM,0BAqLpB;IAEF,OAAO,CAAC,aAAa;IAgBrB;;;;;;;OAOG;IACH,OAAO,CAAC,UAAU;IA0BlB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,YAAY;IA0BX,MAAM;CAgFhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,yBAAyB,EAAE,qBAAqB,CAAC;KAClD;CACF"}
|
|
@@ -8,6 +8,17 @@
|
|
|
8
8
|
* Emits a `capability-toggle` CustomEvent with `{ id, checked }` whenever the
|
|
9
9
|
* checkbox state changes; the parent (`<mcp-consent>`) tracks selection.
|
|
10
10
|
*
|
|
11
|
+
* Parts: `row`, `checkbox`, `check` (the mark in a ticked box), `icon`, `body`,
|
|
12
|
+
* `label-row` (the label, description and risk chip), `label-text` (the label
|
|
13
|
+
* and description), `label`, `description`, `risk`, `scopes`, `scope` and
|
|
14
|
+
* `policy`.
|
|
15
|
+
*
|
|
16
|
+
* Slot: `extra`, under the row's scopes, for something the host shows with the
|
|
17
|
+
* row (such as a check the row needs). A click anywhere in it does not toggle
|
|
18
|
+
* the row, and it is not part of the row's accessible name: the row is named
|
|
19
|
+
* by its label and, when it is higher risk, its risk chip, so a reader with
|
|
20
|
+
* descriptions off still hears the risk; its description describes it.
|
|
21
|
+
*
|
|
11
22
|
* @module components/consent-capability-card
|
|
12
23
|
*/
|
|
13
24
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -20,6 +31,25 @@ import { LitElement, html, css, nothing } from "lit";
|
|
|
20
31
|
import { customElement, property, state } from "lit/decorators.js";
|
|
21
32
|
import { CONSENT_COPY_TOKENS } from "../copy/tokens.js";
|
|
22
33
|
import { explainCedarFragment } from "../cedar/explain.js";
|
|
34
|
+
/**
|
|
35
|
+
* Every part a row exposes. The capabilities screen forwards each one as
|
|
36
|
+
* `capability-<part>`, so a part added to the row must be added here too.
|
|
37
|
+
*/
|
|
38
|
+
export const CAPABILITY_ROW_PARTS = [
|
|
39
|
+
"row",
|
|
40
|
+
"checkbox",
|
|
41
|
+
"check",
|
|
42
|
+
"icon",
|
|
43
|
+
"body",
|
|
44
|
+
"label-row",
|
|
45
|
+
"label-text",
|
|
46
|
+
"label",
|
|
47
|
+
"description",
|
|
48
|
+
"risk",
|
|
49
|
+
"scopes",
|
|
50
|
+
"scope",
|
|
51
|
+
"policy",
|
|
52
|
+
];
|
|
23
53
|
let ConsentCapabilityCard = class ConsentCapabilityCard extends LitElement {
|
|
24
54
|
constructor() {
|
|
25
55
|
super(...arguments);
|
|
@@ -52,22 +82,26 @@ let ConsentCapabilityCard = class ConsentCapabilityCard extends LitElement {
|
|
|
52
82
|
* Row-level click handler. Makes the entire row a click target for
|
|
53
83
|
* toggling the checkbox — a UX nicety that matches Plaid/Apple-style
|
|
54
84
|
* consent rows. Skips when the user clicks the per-row "View policy"
|
|
55
|
-
* button, the policy disclosure,
|
|
56
|
-
* those
|
|
85
|
+
* button, the policy disclosure, any link inside the description, or
|
|
86
|
+
* anything the host put in the `extra` slot, so those children retain their
|
|
87
|
+
* own behavior.
|
|
57
88
|
*/
|
|
58
89
|
onRowClick(event) {
|
|
59
90
|
const target = event.target;
|
|
60
91
|
if (!target)
|
|
61
92
|
return;
|
|
62
93
|
// Walk the composed path to detect interactive children we shouldn't
|
|
63
|
-
// hijack — the policy toggle/disclosure or
|
|
94
|
+
// hijack — the policy toggle/disclosure, any anchor, or the host's slot
|
|
95
|
+
// (an input, select, label or summary there is the host's, not the row's).
|
|
96
|
+
const extra = this.renderRoot.querySelector('slot[name="extra"]');
|
|
64
97
|
const path = event.composedPath?.() || [];
|
|
65
98
|
for (const node of path) {
|
|
66
99
|
if (!(node instanceof HTMLElement))
|
|
67
100
|
continue;
|
|
68
101
|
if (node === this)
|
|
69
102
|
break;
|
|
70
|
-
if (node
|
|
103
|
+
if (node === extra ||
|
|
104
|
+
node.classList?.contains("policy-toggle") ||
|
|
71
105
|
node.classList?.contains("policy-disclosure") ||
|
|
72
106
|
node.tagName === "A" ||
|
|
73
107
|
node.tagName === "BUTTON") {
|
|
@@ -120,11 +154,14 @@ let ConsentCapabilityCard = class ConsentCapabilityCard extends LitElement {
|
|
|
120
154
|
class="row"
|
|
121
155
|
part="row"
|
|
122
156
|
role="button"
|
|
157
|
+
aria-labelledby=${this.isHigherRisk() ? "label risk" : "label"}
|
|
158
|
+
aria-describedby="description"
|
|
123
159
|
tabindex=${this.disabled ? "-1" : "0"}
|
|
124
160
|
aria-disabled=${String(this.disabled)}
|
|
125
161
|
@click=${this.onRowClick}
|
|
126
162
|
@keydown=${(e) => {
|
|
127
|
-
if (e.target === e.currentTarget &&
|
|
163
|
+
if (e.target === e.currentTarget &&
|
|
164
|
+
(e.key === " " || e.key === "Enter")) {
|
|
128
165
|
e.preventDefault();
|
|
129
166
|
this.toggleChecked();
|
|
130
167
|
}
|
|
@@ -144,31 +181,44 @@ let ConsentCapabilityCard = class ConsentCapabilityCard extends LitElement {
|
|
|
144
181
|
type="button"
|
|
145
182
|
tabindex="-1"
|
|
146
183
|
>
|
|
147
|
-
${this.checked
|
|
184
|
+
${this.checked
|
|
185
|
+
? html `<span class="check-mark" part="check">✓</span>`
|
|
186
|
+
: nothing}
|
|
148
187
|
</button>
|
|
149
|
-
<div class="icon-tile" aria-hidden="true"
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
188
|
+
<div class="icon-tile" part="icon" aria-hidden="true">
|
|
189
|
+
${this.renderIcon()}
|
|
190
|
+
</div>
|
|
191
|
+
<div class="body" part="body">
|
|
192
|
+
<div class="row-label" part="label-row">
|
|
193
|
+
<span part="label-text"
|
|
194
|
+
><strong id="label" part="label">${this.label}</strong>
|
|
195
|
+
<span id="description" class="description" part="description"
|
|
196
|
+
>${this.description}</span
|
|
197
|
+
></span
|
|
155
198
|
>
|
|
156
199
|
${this.isHigherRisk()
|
|
157
|
-
? html `<span class="risk-chip"
|
|
200
|
+
? html `<span id="risk" class="risk-chip" part="risk"
|
|
201
|
+
>${tokens.higherRiskChip}</span
|
|
202
|
+
>`
|
|
158
203
|
: nothing}
|
|
159
204
|
</div>
|
|
160
205
|
${this.scopes.length > 0
|
|
161
|
-
? html `<ul class="scopes" aria-label="Scopes"
|
|
206
|
+
? html `<ul class="scopes" part="scopes" aria-label="Scopes">
|
|
207
|
+
${this.scopes.map((scope) => html `<li><code part="scope">${scope}</code></li>`)}
|
|
208
|
+
</ul>`
|
|
209
|
+
: nothing}
|
|
210
|
+
${this.compiledCedar.trim()
|
|
211
|
+
? html `<button
|
|
212
|
+
class="policy-toggle"
|
|
213
|
+
type="button"
|
|
214
|
+
@click=${this.togglePolicy}
|
|
215
|
+
aria-expanded="${String(this.policyOpen)}"
|
|
216
|
+
>
|
|
217
|
+
${tokens.viewPolicyLink}
|
|
218
|
+
</button>`
|
|
162
219
|
: nothing}
|
|
163
|
-
${this.compiledCedar.trim() ? html `<button
|
|
164
|
-
class="policy-toggle"
|
|
165
|
-
type="button"
|
|
166
|
-
@click=${this.togglePolicy}
|
|
167
|
-
aria-expanded="${String(this.policyOpen)}"
|
|
168
|
-
>
|
|
169
|
-
${tokens.viewPolicyLink}
|
|
170
|
-
</button>` : nothing}
|
|
171
220
|
${this.renderPolicy()}
|
|
221
|
+
<slot name="extra"></slot>
|
|
172
222
|
</div>
|
|
173
223
|
</div>
|
|
174
224
|
`;
|
|
@@ -202,7 +252,8 @@ ConsentCapabilityCard.styles = css `
|
|
|
202
252
|
background: var(--cs-row-hover-bg, rgba(15, 23, 42, 0.025));
|
|
203
253
|
}
|
|
204
254
|
|
|
205
|
-
.row[aria-disabled="true"],
|
|
255
|
+
.row[aria-disabled="true"],
|
|
256
|
+
.checkbox:disabled {
|
|
206
257
|
cursor: not-allowed;
|
|
207
258
|
}
|
|
208
259
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent-capability-card.js","sourceRoot":"","sources":["../../src/components/consent-capability-card.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"consent-capability-card.js","sourceRoot":"","sources":["../../src/components/consent-capability-card.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3D;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,KAAK;IACL,UAAU;IACV,OAAO;IACP,MAAM;IACN,MAAM;IACN,WAAW;IACX,YAAY;IACZ,OAAO;IACP,aAAa;IACb,MAAM;IACN,QAAQ;IACR,OAAO;IACP,QAAQ;CACA,CAAC;AAWJ,IAAM,qBAAqB,GAA3B,MAAM,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;;;;;;;;aAUJ,CAAC;QACV,KAAK,MAAM;YACT,OAAO,IAAI,CAAA;;;;;;;;;aASJ,CAAC;QACV,KAAK,SAAS;YACZ,OAAO,IAAI,CAAA;;;;;;;;;;;aAWJ,CAAC;QACV;YACE,OAAO,IAAI,CAAA;;;;;;;;;aASJ,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
* Parts: `eyebrow`, `headline` (the h1; each name is an `em` inside it) and
|
|
13
13
|
* `subhead`.
|
|
14
14
|
*
|
|
15
|
+
* Slot: `headline`, the h1's words in place of the standard line, for a host
|
|
16
|
+
* that words it its own way (such as the agent's name as a button that opens
|
|
17
|
+
* its details). The host's content is its own markup, so the host keeps an
|
|
18
|
+
* agent-chosen name as text. consent-capabilities-screen forwards its own
|
|
19
|
+
* `headline` slot here.
|
|
20
|
+
*
|
|
15
21
|
* @module components/consent-headline
|
|
16
22
|
*/
|
|
17
23
|
import { LitElement } from "lit";
|
|
@@ -29,8 +35,27 @@ export declare class ConsentHeadline extends LitElement {
|
|
|
29
35
|
description: string;
|
|
30
36
|
/** The line above the headline. Empty gives "PERMISSION REQUEST". */
|
|
31
37
|
eyebrow: string;
|
|
38
|
+
/** Whether the host filled the `headline` slot, so the standard line steps aside. */
|
|
39
|
+
private hostHeadline;
|
|
32
40
|
static styles: import("lit").CSSResult;
|
|
33
41
|
render(): import("lit").TemplateResult<1>;
|
|
42
|
+
/**
|
|
43
|
+
* Before the first render, reads what the slot will hold from the light DOM,
|
|
44
|
+
* so the first render is already the right one. A change made here does not
|
|
45
|
+
* schedule another update, where one made after the first update would.
|
|
46
|
+
*/
|
|
47
|
+
willUpdate(): void;
|
|
48
|
+
/**
|
|
49
|
+
* The children the `headline` slot will be given, flattened: a screen's
|
|
50
|
+
* forwarded slot counts only when something is assigned to it.
|
|
51
|
+
*/
|
|
52
|
+
private lightHeadlineFilled;
|
|
53
|
+
/**
|
|
54
|
+
* Reads the slot itself, not the event's target: when a screen forwards its
|
|
55
|
+
* own slot here, the event comes from that slot, and a host that fills the
|
|
56
|
+
* screen's slot later is seen only through the flattened list.
|
|
57
|
+
*/
|
|
58
|
+
private readHeadlineSlot;
|
|
34
59
|
/** The headline, with each name as text in its own `em`. */
|
|
35
60
|
private headlinePieces;
|
|
36
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent-headline.d.ts","sourceRoot":"","sources":["../../src/components/consent-headline.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"consent-headline.d.ts","sourceRoot":"","sources":["../../src/components/consent-headline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAQrD,qBACa,eAAgB,SAAQ,UAAU;IAC7C,yEAAyE;IACpB,SAAS,SAAM;IAEpE,0EAA0E;IACvB,OAAO,SAAM;IAEhE;;;OAGG;IACyB,IAAI,SAAM;IAEtC,gEAAgE;IACpC,WAAW,SAAM;IAE7C,qEAAqE;IACzC,OAAO,SAAM;IAEzC,qFAAqF;IAC5E,OAAO,CAAC,YAAY,CAAS;IAEtC,OAAgB,MAAM,0BAoCpB;IAEO,MAAM;IAsBf;;;;OAIG;IACM,UAAU,IAAI,IAAI;IAI3B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAU3B;;;;OAIG;IACH,OAAO,CAAC,gBAAgB,CAMtB;IAEF,4DAA4D;IAC5D,OAAO,CAAC,cAAc;CAiBvB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,kBAAkB,EAAE,eAAe,CAAC;KACrC;CACF"}
|
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
* Parts: `eyebrow`, `headline` (the h1; each name is an `em` inside it) and
|
|
13
13
|
* `subhead`.
|
|
14
14
|
*
|
|
15
|
+
* Slot: `headline`, the h1's words in place of the standard line, for a host
|
|
16
|
+
* that words it its own way (such as the agent's name as a button that opens
|
|
17
|
+
* its details). The host's content is its own markup, so the host keeps an
|
|
18
|
+
* agent-chosen name as text. consent-capabilities-screen forwards its own
|
|
19
|
+
* `headline` slot here.
|
|
20
|
+
*
|
|
15
21
|
* @module components/consent-headline
|
|
16
22
|
*/
|
|
17
23
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -20,8 +26,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
20
26
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
27
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
28
|
};
|
|
23
|
-
import { LitElement, html, css } from "lit";
|
|
24
|
-
import { customElement, property } from "lit/decorators.js";
|
|
29
|
+
import { LitElement, html, css, nothing } from "lit";
|
|
30
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
25
31
|
import { CONSENT_COPY_TOKENS, formatToken } from "../copy/tokens.js";
|
|
26
32
|
/** The headline's placeholders, kept as their own pieces when it is split. */
|
|
27
33
|
const PLACEHOLDER = /(\{Agent\}|\{Verb\}|\{Org\})/;
|
|
@@ -41,6 +47,18 @@ let ConsentHeadline = class ConsentHeadline extends LitElement {
|
|
|
41
47
|
this.description = "";
|
|
42
48
|
/** The line above the headline. Empty gives "PERMISSION REQUEST". */
|
|
43
49
|
this.eyebrow = "";
|
|
50
|
+
/** Whether the host filled the `headline` slot, so the standard line steps aside. */
|
|
51
|
+
this.hostHeadline = false;
|
|
52
|
+
/**
|
|
53
|
+
* Reads the slot itself, not the event's target: when a screen forwards its
|
|
54
|
+
* own slot here, the event comes from that slot, and a host that fills the
|
|
55
|
+
* screen's slot later is seen only through the flattened list.
|
|
56
|
+
*/
|
|
57
|
+
this.readHeadlineSlot = () => {
|
|
58
|
+
const slot = this.renderRoot.querySelector('slot[name="headline"]');
|
|
59
|
+
this.hostHeadline =
|
|
60
|
+
(slot?.assignedElements({ flatten: true }).length ?? 0) > 0;
|
|
61
|
+
};
|
|
44
62
|
}
|
|
45
63
|
render() {
|
|
46
64
|
const tokens = CONSENT_COPY_TOKENS;
|
|
@@ -52,10 +70,38 @@ let ConsentHeadline = class ConsentHeadline extends LitElement {
|
|
|
52
70
|
<span class="eyebrow" part="eyebrow"
|
|
53
71
|
>${this.eyebrow.trim() || tokens.eyebrow.permissionRequest}</span
|
|
54
72
|
>
|
|
55
|
-
<h1 class="headline" part="headline"
|
|
73
|
+
<h1 class="headline" part="headline">
|
|
74
|
+
<slot name="headline" @slotchange=${this.readHeadlineSlot}></slot>${this
|
|
75
|
+
.hostHeadline
|
|
76
|
+
? nothing
|
|
77
|
+
: this.headlinePieces()}
|
|
78
|
+
</h1>
|
|
56
79
|
<p class="subhead" part="subhead">${subhead}</p>
|
|
57
80
|
`;
|
|
58
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Before the first render, reads what the slot will hold from the light DOM,
|
|
84
|
+
* so the first render is already the right one. A change made here does not
|
|
85
|
+
* schedule another update, where one made after the first update would.
|
|
86
|
+
*/
|
|
87
|
+
willUpdate() {
|
|
88
|
+
if (!this.hasUpdated)
|
|
89
|
+
this.hostHeadline = this.lightHeadlineFilled();
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The children the `headline` slot will be given, flattened: a screen's
|
|
93
|
+
* forwarded slot counts only when something is assigned to it.
|
|
94
|
+
*/
|
|
95
|
+
lightHeadlineFilled() {
|
|
96
|
+
return [...this.children].some((child) => {
|
|
97
|
+
if (child.getAttribute("slot") !== "headline")
|
|
98
|
+
return false;
|
|
99
|
+
if (child instanceof HTMLSlotElement) {
|
|
100
|
+
return child.assignedElements({ flatten: true }).length > 0;
|
|
101
|
+
}
|
|
102
|
+
return true;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
59
105
|
/** The headline, with each name as text in its own `em`. */
|
|
60
106
|
headlinePieces() {
|
|
61
107
|
const tokens = CONSENT_COPY_TOKENS;
|
|
@@ -128,6 +174,9 @@ __decorate([
|
|
|
128
174
|
__decorate([
|
|
129
175
|
property({ type: String })
|
|
130
176
|
], ConsentHeadline.prototype, "eyebrow", void 0);
|
|
177
|
+
__decorate([
|
|
178
|
+
state()
|
|
179
|
+
], ConsentHeadline.prototype, "hostHeadline", void 0);
|
|
131
180
|
ConsentHeadline = __decorate([
|
|
132
181
|
customElement("consent-headline")
|
|
133
182
|
], ConsentHeadline);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent-headline.js","sourceRoot":"","sources":["../../src/components/consent-headline.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"consent-headline.js","sourceRoot":"","sources":["../../src/components/consent-headline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErE,8EAA8E;AAC9E,MAAM,WAAW,GAAG,8BAA8B,CAAC;AAG5C,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QACL,yEAAyE;QACpB,cAAS,GAAG,EAAE,CAAC;QAEpE,0EAA0E;QACvB,YAAO,GAAG,EAAE,CAAC;QAEhE;;;WAGG;QACyB,SAAI,GAAG,EAAE,CAAC;QAEtC,gEAAgE;QACpC,gBAAW,GAAG,EAAE,CAAC;QAE7C,qEAAqE;QACzC,YAAO,GAAG,EAAE,CAAC;QAEzC,qFAAqF;QACpE,iBAAY,GAAG,KAAK,CAAC;QAqFtC;;;;WAIG;QACK,qBAAgB,GAAG,GAAS,EAAE;YACpC,MAAM,IAAI,GAAG,IAAI,CAAC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AE,CAAC;6CAAW;AAGV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAAkB;AAGjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAc;AAGxB;IAAhB,KAAK,EAAE;qDAA8B;AApB3B,eAAe;IAD3B,aAAa,CAAC,kBAAkB,CAAC;GACrB,eAAe,CAwI3B"}
|
|
@@ -22,7 +22,7 @@ export { ConsentActionBar } from "./consent-action-bar.js";
|
|
|
22
22
|
export { ConsentFooter } from "./consent-footer.js";
|
|
23
23
|
export { ConsentRevocationNotice } from "./consent-revocation-notice.js";
|
|
24
24
|
export { ConsentConnectorHeader } from "./consent-connector-header.js";
|
|
25
|
-
export { ConsentCapabilitiesScreen, type CapabilitiesApproveDetail, } from "./consent-capabilities-screen.js";
|
|
25
|
+
export { ConsentCapabilitiesScreen, capabilitySlotName, type CapabilitiesApproveDetail, } from "./consent-capabilities-screen.js";
|
|
26
26
|
export { ConsentDuration, type DurationChangeDetail, } from "./consent-duration.js";
|
|
27
27
|
export { ConsentFolderScope, type FolderScopeChangeDetail, } from "./consent-folder-scope.js";
|
|
28
28
|
export { ConsentGrantTerms, GRANT_FIELD_EVENTS, type GrantField, type GrantTermsChangeDetail, } from "./consent-grant-terms.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,GACpB,MAAM,0BAA0B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26
26
|
export { ConsentFooter } from "./consent-footer.js";
|
|
27
27
|
export { ConsentRevocationNotice } from "./consent-revocation-notice.js";
|
|
28
28
|
export { ConsentConnectorHeader } from "./consent-connector-header.js";
|
|
29
|
-
export { ConsentCapabilitiesScreen, } from "./consent-capabilities-screen.js";
|
|
29
|
+
export { ConsentCapabilitiesScreen, capabilitySlotName, } from "./consent-capabilities-screen.js";
|
|
30
30
|
// Grant terms and taking a grant back
|
|
31
31
|
export { ConsentDuration, } from "./consent-duration.js";
|
|
32
32
|
export { ConsentFolderScope, } from "./consent-folder-scope.js";
|