@kya-os/consent 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +182 -22
- package/dist/bundle/index.d.ts +4 -0
- package/dist/bundle/index.d.ts.map +1 -1
- package/dist/bundle/index.js +6 -0
- package/dist/bundle/index.js.map +1 -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/index.js +15 -1
- package/dist/cjs/bundle/index.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-action-bar.js +97 -25
- package/dist/cjs/components/consent-action-bar.js.map +1 -1
- package/dist/cjs/components/consent-agent-header.js +7 -105
- package/dist/cjs/components/consent-agent-header.js.map +1 -1
- package/dist/cjs/components/consent-button.js +6 -1
- package/dist/cjs/components/consent-button.js.map +1 -1
- package/dist/cjs/components/consent-capabilities-screen.js +454 -68
- package/dist/cjs/components/consent-capabilities-screen.js.map +1 -1
- package/dist/cjs/components/consent-capability-card.js +131 -27
- package/dist/cjs/components/consent-capability-card.js.map +1 -1
- package/dist/cjs/components/consent-checkbox.js +7 -0
- package/dist/cjs/components/consent-checkbox.js.map +1 -1
- package/dist/cjs/components/consent-connector-header.js +206 -43
- package/dist/cjs/components/consent-connector-header.js.map +1 -1
- package/dist/cjs/components/consent-duration.js +1 -1
- package/dist/cjs/components/consent-footer.js +13 -12
- package/dist/cjs/components/consent-footer.js.map +1 -1
- package/dist/cjs/components/consent-headline.js +399 -33
- package/dist/cjs/components/consent-headline.js.map +1 -1
- package/dist/cjs/components/consent-oauth-button.js +71 -62
- package/dist/cjs/components/consent-oauth-button.js.map +1 -1
- package/dist/cjs/components/consent-otp-input.js +5 -0
- package/dist/cjs/components/consent-otp-input.js.map +1 -1
- package/dist/cjs/components/consent-phone-handoff.js +3 -3
- package/dist/cjs/components/consent-request-expiry.js +1 -1
- package/dist/cjs/components/consent-revocation-notice.js +4 -2
- package/dist/cjs/components/consent-revocation-notice.js.map +1 -1
- package/dist/cjs/components/consent-revoke.js +9 -4
- package/dist/cjs/components/consent-revoke.js.map +1 -1
- package/dist/cjs/components/consent-secured-by.js +106 -0
- package/dist/cjs/components/consent-secured-by.js.map +1 -0
- package/dist/cjs/components/consent-shell.js +1 -1
- package/dist/cjs/components/consent-terms.js +7 -0
- package/dist/cjs/components/consent-terms.js.map +1 -1
- package/dist/cjs/components/consent-wallet-check.js +1 -1
- package/dist/cjs/components/consent-wallet-notice.js +1 -1
- package/dist/cjs/components/consent-wallet-orb.js +1 -1
- package/dist/cjs/components/consent-wallet-signature.js +1 -1
- package/dist/cjs/components/decision-icons.js +33 -0
- package/dist/cjs/components/decision-icons.js.map +1 -0
- package/dist/cjs/components/edit-region.js +309 -0
- package/dist/cjs/components/edit-region.js.map +1 -0
- package/dist/cjs/components/grant-field-styles.js +2 -2
- package/dist/cjs/components/index.js +4 -1
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/components/mcp-consent.js +81 -36
- package/dist/cjs/components/mcp-consent.js.map +1 -1
- package/dist/cjs/components/preview.js +67 -0
- package/dist/cjs/components/preview.js.map +1 -0
- package/dist/cjs/constants/capabilities.js +12 -2
- package/dist/cjs/constants/capabilities.js.map +1 -1
- package/dist/cjs/copy/tokens.js +60 -21
- package/dist/cjs/copy/tokens.js.map +1 -1
- package/dist/cjs/identity/agent-identity.js +3 -2
- package/dist/cjs/identity/agent-identity.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/cjs/react/index.js +11 -2
- package/dist/cjs/react/index.js.map +1 -1
- package/dist/cjs/styles/brand.js +385 -0
- package/dist/cjs/styles/brand.js.map +1 -0
- package/dist/cjs/styles/index.js +1 -0
- package/dist/cjs/styles/index.js.map +1 -1
- package/dist/cjs/styles/theme.js +100 -30
- package/dist/cjs/styles/theme.js.map +1 -1
- package/dist/cjs/types/capabilities.types.js +1 -2
- package/dist/cjs/types/capabilities.types.js.map +1 -1
- package/dist/cjs/types/decision.types.js +13 -0
- package/dist/cjs/types/decision.types.js.map +1 -0
- package/dist/cjs/types/edit.types.js +80 -0
- package/dist/cjs/types/edit.types.js.map +1 -0
- package/dist/cjs/types/index.js +2 -0
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/components/consent-action-bar.d.ts +20 -1
- package/dist/components/consent-action-bar.d.ts.map +1 -1
- package/dist/components/consent-action-bar.js +97 -25
- package/dist/components/consent-action-bar.js.map +1 -1
- package/dist/components/consent-agent-header.d.ts +4 -17
- package/dist/components/consent-agent-header.d.ts.map +1 -1
- package/dist/components/consent-agent-header.js +7 -105
- package/dist/components/consent-agent-header.js.map +1 -1
- package/dist/components/consent-button.d.ts +2 -0
- package/dist/components/consent-button.d.ts.map +1 -1
- package/dist/components/consent-button.js +6 -1
- package/dist/components/consent-button.js.map +1 -1
- package/dist/components/consent-capabilities-screen.d.ts +85 -17
- package/dist/components/consent-capabilities-screen.d.ts.map +1 -1
- package/dist/components/consent-capabilities-screen.js +456 -70
- package/dist/components/consent-capabilities-screen.js.map +1 -1
- package/dist/components/consent-capability-card.d.ts +23 -3
- package/dist/components/consent-capability-card.d.ts.map +1 -1
- package/dist/components/consent-capability-card.js +131 -27
- package/dist/components/consent-capability-card.js.map +1 -1
- package/dist/components/consent-checkbox.d.ts +2 -0
- package/dist/components/consent-checkbox.d.ts.map +1 -1
- package/dist/components/consent-checkbox.js +7 -0
- package/dist/components/consent-checkbox.js.map +1 -1
- package/dist/components/consent-connector-header.d.ts +39 -7
- package/dist/components/consent-connector-header.d.ts.map +1 -1
- package/dist/components/consent-connector-header.js +206 -43
- package/dist/components/consent-connector-header.js.map +1 -1
- package/dist/components/consent-duration.js +1 -1
- package/dist/components/consent-footer.d.ts +6 -4
- package/dist/components/consent-footer.d.ts.map +1 -1
- package/dist/components/consent-footer.js +13 -12
- package/dist/components/consent-footer.js.map +1 -1
- package/dist/components/consent-headline.d.ts +55 -16
- package/dist/components/consent-headline.d.ts.map +1 -1
- package/dist/components/consent-headline.js +398 -34
- package/dist/components/consent-headline.js.map +1 -1
- package/dist/components/consent-oauth-button.d.ts +7 -3
- package/dist/components/consent-oauth-button.d.ts.map +1 -1
- package/dist/components/consent-oauth-button.js +74 -65
- package/dist/components/consent-oauth-button.js.map +1 -1
- package/dist/components/consent-otp-input.d.ts.map +1 -1
- package/dist/components/consent-otp-input.js +5 -0
- package/dist/components/consent-otp-input.js.map +1 -1
- package/dist/components/consent-passkey.d.ts +6 -0
- package/dist/components/consent-passkey.d.ts.map +1 -1
- package/dist/components/consent-passkey.js +67 -9
- package/dist/components/consent-passkey.js.map +1 -1
- package/dist/components/consent-phone-handoff.js +3 -3
- package/dist/components/consent-request-expiry.js +1 -1
- package/dist/components/consent-revocation-notice.d.ts.map +1 -1
- package/dist/components/consent-revocation-notice.js +4 -2
- package/dist/components/consent-revocation-notice.js.map +1 -1
- package/dist/components/consent-revoke.d.ts +2 -0
- package/dist/components/consent-revoke.d.ts.map +1 -1
- package/dist/components/consent-revoke.js +9 -4
- package/dist/components/consent-revoke.js.map +1 -1
- package/dist/components/consent-secured-by.d.ts +25 -0
- package/dist/components/consent-secured-by.d.ts.map +1 -0
- package/dist/components/consent-secured-by.js +103 -0
- package/dist/components/consent-secured-by.js.map +1 -0
- package/dist/components/consent-shell.js +1 -1
- package/dist/components/consent-terms.d.ts +2 -0
- package/dist/components/consent-terms.d.ts.map +1 -1
- package/dist/components/consent-terms.js +7 -0
- package/dist/components/consent-terms.js.map +1 -1
- package/dist/components/consent-wallet-check.js +1 -1
- package/dist/components/consent-wallet-notice.js +1 -1
- package/dist/components/consent-wallet-orb.js +1 -1
- package/dist/components/consent-wallet-signature.js +1 -1
- package/dist/components/decision-icons.d.ts +22 -0
- package/dist/components/decision-icons.d.ts.map +1 -0
- package/dist/components/decision-icons.js +30 -0
- package/dist/components/decision-icons.js.map +1 -0
- package/dist/components/edit-region.d.ts +50 -0
- package/dist/components/edit-region.d.ts.map +1 -0
- package/dist/components/edit-region.js +305 -0
- package/dist/components/edit-region.js.map +1 -0
- package/dist/components/grant-field-styles.js +2 -2
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/mcp-consent.d.ts +15 -0
- package/dist/components/mcp-consent.d.ts.map +1 -1
- package/dist/components/mcp-consent.js +81 -36
- package/dist/components/mcp-consent.js.map +1 -1
- package/dist/components/preview.d.ts +38 -0
- package/dist/components/preview.d.ts.map +1 -0
- package/dist/components/preview.js +61 -0
- package/dist/components/preview.js.map +1 -0
- package/dist/consent.js +2104 -389
- package/dist/consent.min.js +1289 -497
- package/dist/constants/capabilities.d.ts +12 -3
- package/dist/constants/capabilities.d.ts.map +1 -1
- package/dist/constants/capabilities.js +12 -2
- package/dist/constants/capabilities.js.map +1 -1
- package/dist/copy/tokens.d.ts +60 -21
- package/dist/copy/tokens.d.ts.map +1 -1
- package/dist/copy/tokens.js +60 -21
- package/dist/copy/tokens.js.map +1 -1
- package/dist/identity/agent-identity.d.ts +3 -2
- package/dist/identity/agent-identity.d.ts.map +1 -1
- package/dist/identity/agent-identity.js +3 -2
- package/dist/identity/agent-identity.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/dist/react/index.d.ts +6 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +10 -1
- package/dist/react/index.js.map +1 -1
- package/dist/styles/brand.d.ts +184 -0
- package/dist/styles/brand.d.ts.map +1 -0
- package/dist/styles/brand.js +372 -0
- package/dist/styles/brand.js.map +1 -0
- package/dist/styles/index.d.ts +1 -0
- package/dist/styles/index.d.ts.map +1 -1
- package/dist/styles/index.js +1 -0
- package/dist/styles/index.js.map +1 -1
- package/dist/styles/theme.d.ts +73 -13
- package/dist/styles/theme.d.ts.map +1 -1
- package/dist/styles/theme.js +96 -29
- package/dist/styles/theme.js.map +1 -1
- package/dist/types/capabilities.types.d.ts +12 -14
- package/dist/types/capabilities.types.d.ts.map +1 -1
- package/dist/types/capabilities.types.js +1 -2
- package/dist/types/capabilities.types.js.map +1 -1
- package/dist/types/decision.types.d.ts +57 -0
- package/dist/types/decision.types.d.ts.map +1 -0
- package/dist/types/decision.types.js +12 -0
- package/dist/types/decision.types.js.map +1 -0
- package/dist/types/edit.types.d.ts +73 -0
- package/dist/types/edit.types.d.ts.map +1 -0
- package/dist/types/edit.types.js +76 -0
- package/dist/types/edit.types.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +2 -2
package/dist/consent.js
CHANGED
|
@@ -643,6 +643,7 @@ function r6(r8) {
|
|
|
643
643
|
var ConsentButton = class extends i4 {
|
|
644
644
|
constructor() {
|
|
645
645
|
super();
|
|
646
|
+
this.preview = false;
|
|
646
647
|
this.variant = "primary";
|
|
647
648
|
this.type = "button";
|
|
648
649
|
this.disabled = false;
|
|
@@ -651,7 +652,7 @@ var ConsentButton = class extends i4 {
|
|
|
651
652
|
this.internals = this.attachInternals();
|
|
652
653
|
}
|
|
653
654
|
handleClick() {
|
|
654
|
-
if (this.disabled || this.loading) return;
|
|
655
|
+
if (this.disabled || this.loading || this.preview) return;
|
|
655
656
|
const form = this.internals.form;
|
|
656
657
|
if (!form) return;
|
|
657
658
|
if (this.type === "submit") {
|
|
@@ -750,6 +751,9 @@ ConsentButton.styles = i`
|
|
|
750
751
|
}
|
|
751
752
|
}
|
|
752
753
|
`;
|
|
754
|
+
__decorateClass([
|
|
755
|
+
n4({ type: Boolean, reflect: true })
|
|
756
|
+
], ConsentButton.prototype, "preview", 2);
|
|
753
757
|
__decorateClass([
|
|
754
758
|
n4({ type: String, reflect: true })
|
|
755
759
|
], ConsentButton.prototype, "variant", 2);
|
|
@@ -769,16 +773,49 @@ ConsentButton = __decorateClass([
|
|
|
769
773
|
t3("consent-button")
|
|
770
774
|
], ConsentButton);
|
|
771
775
|
|
|
776
|
+
// src/components/preview.ts
|
|
777
|
+
var warned = /* @__PURE__ */ new WeakSet();
|
|
778
|
+
function isEditing(el) {
|
|
779
|
+
return el.preview && el.editable;
|
|
780
|
+
}
|
|
781
|
+
function warnIfEditableWithoutPreview(el) {
|
|
782
|
+
if (!el.editable || el.preview || warned.has(el)) return;
|
|
783
|
+
warned.add(el);
|
|
784
|
+
console.warn(
|
|
785
|
+
`<${el.localName}> ignores editable without preview, so a live page is never edited.`
|
|
786
|
+
);
|
|
787
|
+
}
|
|
788
|
+
function stopPreviewNavigation(el) {
|
|
789
|
+
return (event) => {
|
|
790
|
+
if (!el.preview) return;
|
|
791
|
+
for (const node of event.composedPath()) {
|
|
792
|
+
if (node === el) return;
|
|
793
|
+
if (node instanceof Element && (node.localName === "a" || node.localName === "area") && node.hasAttribute("href")) {
|
|
794
|
+
event.preventDefault();
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
function guardPreviewNavigation(el) {
|
|
801
|
+
const stop = stopPreviewNavigation(el);
|
|
802
|
+
for (const type of ["click", "auxclick"]) {
|
|
803
|
+
el.addEventListener(type, stop, { capture: true });
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
|
|
772
807
|
// src/components/consent-checkbox.ts
|
|
773
808
|
var ConsentCheckbox = class extends i4 {
|
|
774
809
|
constructor() {
|
|
775
810
|
super();
|
|
811
|
+
this.preview = false;
|
|
776
812
|
this.name = "";
|
|
777
813
|
this.checked = false;
|
|
778
814
|
this.required = false;
|
|
779
815
|
this.disabled = false;
|
|
780
816
|
this.value = "on";
|
|
781
817
|
this.internals = this.attachInternals();
|
|
818
|
+
guardPreviewNavigation(this);
|
|
782
819
|
}
|
|
783
820
|
// Update form value when properties change
|
|
784
821
|
updated(changedProperties) {
|
|
@@ -924,6 +961,9 @@ ConsentCheckbox.styles = i`
|
|
|
924
961
|
text-decoration: none;
|
|
925
962
|
}
|
|
926
963
|
`;
|
|
964
|
+
__decorateClass([
|
|
965
|
+
n4({ type: Boolean, reflect: true })
|
|
966
|
+
], ConsentCheckbox.prototype, "preview", 2);
|
|
927
967
|
__decorateClass([
|
|
928
968
|
n4({ type: String, reflect: true })
|
|
929
969
|
], ConsentCheckbox.prototype, "name", 2);
|
|
@@ -1444,7 +1484,7 @@ ConsentShell.styles = i`
|
|
|
1444
1484
|
.container {
|
|
1445
1485
|
box-sizing: border-box;
|
|
1446
1486
|
background: white;
|
|
1447
|
-
border-radius: 20px;
|
|
1487
|
+
border-radius: var(--cs-card-radius, 20px);
|
|
1448
1488
|
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
1449
1489
|
box-shadow:
|
|
1450
1490
|
0 20px 25px -5px rgba(0, 0, 0, 0.1),
|
|
@@ -2012,6 +2052,7 @@ function resolveConsentBranding(branding) {
|
|
|
2012
2052
|
var ConsentTerms = class extends i4 {
|
|
2013
2053
|
constructor() {
|
|
2014
2054
|
super();
|
|
2055
|
+
this.preview = false;
|
|
2015
2056
|
this.name = "termsAccepted";
|
|
2016
2057
|
this.text = "Terms and Conditions";
|
|
2017
2058
|
this.labelPrefix = "I agree to the";
|
|
@@ -2021,6 +2062,7 @@ var ConsentTerms = class extends i4 {
|
|
|
2021
2062
|
this.disabled = false;
|
|
2022
2063
|
this.value = "accepted";
|
|
2023
2064
|
this.internals = this.attachInternals();
|
|
2065
|
+
guardPreviewNavigation(this);
|
|
2024
2066
|
}
|
|
2025
2067
|
updated(changedProperties) {
|
|
2026
2068
|
if (changedProperties.has("checked") || changedProperties.has("value")) {
|
|
@@ -2198,6 +2240,9 @@ ConsentTerms.styles = i`
|
|
|
2198
2240
|
margin-left: 0.125rem;
|
|
2199
2241
|
}
|
|
2200
2242
|
`;
|
|
2243
|
+
__decorateClass([
|
|
2244
|
+
n4({ type: Boolean, reflect: true })
|
|
2245
|
+
], ConsentTerms.prototype, "preview", 2);
|
|
2201
2246
|
__decorateClass([
|
|
2202
2247
|
n4({ type: String, reflect: true })
|
|
2203
2248
|
], ConsentTerms.prototype, "name", 2);
|
|
@@ -2282,11 +2327,20 @@ var o7 = e7(t5);
|
|
|
2282
2327
|
// src/components/consent-oauth-button.ts
|
|
2283
2328
|
function sanitizeSvg(svg) {
|
|
2284
2329
|
if (!svg || typeof svg !== "string") return "";
|
|
2285
|
-
let sanitized = svg.replace(
|
|
2330
|
+
let sanitized = svg.replace(
|
|
2331
|
+
/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
|
|
2332
|
+
""
|
|
2333
|
+
);
|
|
2286
2334
|
sanitized = sanitized.replace(/\s*on\w+\s*=\s*["'][^"']*["']/gi, "");
|
|
2287
2335
|
sanitized = sanitized.replace(/\s*on\w+\s*=\s*[^\s>]*/gi, "");
|
|
2288
|
-
sanitized = sanitized.replace(
|
|
2289
|
-
|
|
2336
|
+
sanitized = sanitized.replace(
|
|
2337
|
+
/(href|src|xlink:href)\s*=\s*["']?\s*javascript:[^"'>\s]*/gi,
|
|
2338
|
+
'$1=""'
|
|
2339
|
+
);
|
|
2340
|
+
sanitized = sanitized.replace(
|
|
2341
|
+
/(href|src|xlink:href)\s*=\s*["']?\s*data:[^"'>\s]*/gi,
|
|
2342
|
+
'$1=""'
|
|
2343
|
+
);
|
|
2290
2344
|
sanitized = sanitized.replace(/data:text\/html[^"'>\s]*/gi, "");
|
|
2291
2345
|
return sanitized;
|
|
2292
2346
|
}
|
|
@@ -2344,6 +2398,7 @@ var PROVIDER_CONFIGS = {
|
|
|
2344
2398
|
var ConsentOAuthButton = class extends i4 {
|
|
2345
2399
|
constructor() {
|
|
2346
2400
|
super(...arguments);
|
|
2401
|
+
this.preview = false;
|
|
2347
2402
|
this.provider = "custom";
|
|
2348
2403
|
this.url = "";
|
|
2349
2404
|
this.loading = false;
|
|
@@ -2363,7 +2418,8 @@ var ConsentOAuthButton = class extends i4 {
|
|
|
2363
2418
|
return `Continue with ${this.displayName}`;
|
|
2364
2419
|
}
|
|
2365
2420
|
handleClick() {
|
|
2366
|
-
if (this.disabled || this.loading || this.redirecting)
|
|
2421
|
+
if (this.disabled || this.loading || this.redirecting || this.preview)
|
|
2422
|
+
return;
|
|
2367
2423
|
if (this.url) {
|
|
2368
2424
|
this.redirecting = true;
|
|
2369
2425
|
window.location.href = this.url;
|
|
@@ -2513,7 +2569,9 @@ ConsentOAuthButton.styles = i`
|
|
|
2513
2569
|
font-weight: 500;
|
|
2514
2570
|
font-family: inherit;
|
|
2515
2571
|
cursor: pointer;
|
|
2516
|
-
transition:
|
|
2572
|
+
transition:
|
|
2573
|
+
background-color 0.15s ease,
|
|
2574
|
+
opacity 0.15s ease;
|
|
2517
2575
|
display: inline-flex;
|
|
2518
2576
|
align-items: center;
|
|
2519
2577
|
justify-content: center;
|
|
@@ -2562,6 +2620,9 @@ ConsentOAuthButton.styles = i`
|
|
|
2562
2620
|
text-align: center;
|
|
2563
2621
|
}
|
|
2564
2622
|
`;
|
|
2623
|
+
__decorateClass([
|
|
2624
|
+
n4({ type: Boolean, reflect: true })
|
|
2625
|
+
], ConsentOAuthButton.prototype, "preview", 2);
|
|
2565
2626
|
__decorateClass([
|
|
2566
2627
|
n4({ type: String })
|
|
2567
2628
|
], ConsentOAuthButton.prototype, "provider", 2);
|
|
@@ -2847,7 +2908,12 @@ ConsentOTPInput.styles = i`
|
|
|
2847
2908
|
justify-content: center;
|
|
2848
2909
|
}
|
|
2849
2910
|
|
|
2911
|
+
/* Each cell starts at its full width and shrinks evenly when the
|
|
2912
|
+
container is narrower than six of them, so the row never spills out
|
|
2913
|
+
of its own box. */
|
|
2850
2914
|
input {
|
|
2915
|
+
flex: 0 1 auto;
|
|
2916
|
+
min-width: 0;
|
|
2851
2917
|
width: 2.75rem;
|
|
2852
2918
|
height: 3.5rem;
|
|
2853
2919
|
text-align: center;
|
|
@@ -2958,26 +3024,52 @@ var CONSENT_COPY_TOKENS = {
|
|
|
2958
3024
|
},
|
|
2959
3025
|
headline: {
|
|
2960
3026
|
/**
|
|
2961
|
-
* `{Agent}` → agent display name (
|
|
2962
|
-
*
|
|
2963
|
-
* `{
|
|
3027
|
+
* `{Agent}` → agent display name (italic, a button that opens the
|
|
3028
|
+
* agent's details when the agent is given).
|
|
3029
|
+
* `{Verb}` → operator verb; empty or "use" takes `fallbackTemplate`.
|
|
2964
3030
|
*/
|
|
2965
|
-
template: "{Agent} would like to {Verb}
|
|
2966
|
-
fallbackTemplate: "{Agent} is requesting permission
|
|
3031
|
+
template: "{Agent} would like to {Verb} on your behalf",
|
|
3032
|
+
fallbackTemplate: "{Agent} is requesting permission on your behalf"
|
|
2967
3033
|
},
|
|
2968
3034
|
subhead: {
|
|
2969
3035
|
/** `{Agent}` → agent display name. */
|
|
2970
|
-
template: "Pick what {Agent} is allowed to do on your behalf.
|
|
3036
|
+
template: "Pick what {Agent} is allowed to do on your behalf."
|
|
3037
|
+
},
|
|
3038
|
+
/** What the agent's name opens in the headline. */
|
|
3039
|
+
agentDetails: {
|
|
3040
|
+
/** The popover's accessible name. */
|
|
3041
|
+
about: "About {Agent}",
|
|
3042
|
+
kind: "AI agent",
|
|
3043
|
+
identity: "Identity",
|
|
3044
|
+
identifiedBy: "Identified by {Host}",
|
|
3045
|
+
/** Read before the host in the headline's chip. */
|
|
3046
|
+
identifiedByPrefix: "identified by ",
|
|
3047
|
+
identifiedExplanation: "Its details are published at {Host}, and it can only send you back to an address listed there.",
|
|
3048
|
+
verified: "Verified",
|
|
3049
|
+
verifiedExplanation: "Its Entity Card was checked and verified.",
|
|
3050
|
+
unverified: "Unverified",
|
|
3051
|
+
unverifiedExplanation: "It registered itself, so the name it gives is not checked.",
|
|
3052
|
+
agentId: "Agent ID"
|
|
3053
|
+
},
|
|
3054
|
+
/** The warning under the headline for an agent that registered itself. */
|
|
3055
|
+
unverifiedAgent: {
|
|
3056
|
+
heading: "Unverified agent",
|
|
3057
|
+
advice: "Allow only if you asked it to."
|
|
3058
|
+
},
|
|
3059
|
+
/** The box naming who is signing in. */
|
|
3060
|
+
approver: {
|
|
3061
|
+
signedIn: "Signed in as"
|
|
3062
|
+
},
|
|
3063
|
+
/** The box that says what the grant connects to and how it is bounded. */
|
|
3064
|
+
grantDetails: {
|
|
3065
|
+
heading: "Permission details",
|
|
3066
|
+
connectsTo: "Connects to",
|
|
3067
|
+
duration: "Duration",
|
|
3068
|
+
budget: "Budget",
|
|
3069
|
+
amountLimits: "Amount limits",
|
|
3070
|
+
alreadyGranted: "Already granted"
|
|
2971
3071
|
},
|
|
2972
3072
|
agentTile: {
|
|
2973
|
-
verifiedPill: "Verified",
|
|
2974
|
-
unverifiedPill: "UNVERIFIED",
|
|
2975
|
-
/**
|
|
2976
|
-
* Read by screen readers before the domain in a domain-bound agent's
|
|
2977
|
-
* pill, which shows only the domain. Never "Verified": a domain binding
|
|
2978
|
-
* names the client, it does not verify it.
|
|
2979
|
-
*/
|
|
2980
|
-
domainPillPrefix: "Identified by",
|
|
2981
3073
|
/**
|
|
2982
3074
|
* The meta line under the agent's name is built from the parts that are
|
|
2983
3075
|
* known, joined by `metaSeparator`: an unknown vendor or surface is left
|
|
@@ -3000,9 +3092,6 @@ var CONSENT_COPY_TOKENS = {
|
|
|
3000
3092
|
connectedMinutesAgo: "Connected {Minutes} min ago"
|
|
3001
3093
|
},
|
|
3002
3094
|
section: {
|
|
3003
|
-
/** `{Agent}` → agent display name (uppercased at render time). */
|
|
3004
|
-
capabilitiesHeader: "WHAT {Agent} CAN DO FOR YOU",
|
|
3005
|
-
tapToToggle: "Tap to toggle",
|
|
3006
3095
|
/** Used in the dark gateway theme. */
|
|
3007
3096
|
permissionsRequested: "PERMISSIONS REQUESTED"
|
|
3008
3097
|
},
|
|
@@ -3133,12 +3222,28 @@ var CONSENT_COPY_TOKENS = {
|
|
|
3133
3222
|
expiresTemplate: "This request expires in {Time}. Approve before then, or the agent will need to ask again.",
|
|
3134
3223
|
expired: "This request expired. Ask the agent to try again."
|
|
3135
3224
|
},
|
|
3225
|
+
/**
|
|
3226
|
+
* What a screen reader calls each region a person can edit in edit mode
|
|
3227
|
+
* (`preview` and `editable` together).
|
|
3228
|
+
*/
|
|
3229
|
+
editRegions: {
|
|
3230
|
+
description: "Description",
|
|
3231
|
+
orgName: "Organization name",
|
|
3232
|
+
capabilityLabel: "Permission name",
|
|
3233
|
+
capabilityDescription: "Permission description",
|
|
3234
|
+
submitLabel: "Allow button label",
|
|
3235
|
+
cancelLabel: "Deny button label"
|
|
3236
|
+
},
|
|
3136
3237
|
attribution: {
|
|
3137
|
-
/**
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3238
|
+
/** consent-footer's line, in both themes. */
|
|
3239
|
+
byLine: "by Vouched KYA",
|
|
3240
|
+
howThisWorks: "How does this work?",
|
|
3241
|
+
/** Before the Vouched lockup under the capabilities screen's card. */
|
|
3242
|
+
securedBy: "Secured by",
|
|
3243
|
+
/** The lockup's accessible name. */
|
|
3244
|
+
lockup: "Vouched",
|
|
3245
|
+
/** Under the lockup's letters. */
|
|
3246
|
+
tagline: "Know Your Agent"
|
|
3142
3247
|
},
|
|
3143
3248
|
/**
|
|
3144
3249
|
* `consent-passkey` defaults. `PasskeyConfig.instructions`, `buttonText`
|
|
@@ -3180,20 +3285,6 @@ function formatToken(template, values) {
|
|
|
3180
3285
|
});
|
|
3181
3286
|
}
|
|
3182
3287
|
|
|
3183
|
-
// src/types/capabilities.types.ts
|
|
3184
|
-
var AGENT_VERIFICATIONS = [
|
|
3185
|
-
"verified",
|
|
3186
|
-
"domain",
|
|
3187
|
-
"unverified"
|
|
3188
|
-
];
|
|
3189
|
-
function agentVerification(agent) {
|
|
3190
|
-
const stated = agent.verification;
|
|
3191
|
-
if (stated !== void 0 && AGENT_VERIFICATIONS.includes(stated)) {
|
|
3192
|
-
return stated === "domain" && !agent.domain?.trim() ? "unverified" : stated;
|
|
3193
|
-
}
|
|
3194
|
-
return agent.verified === true ? "verified" : "unverified";
|
|
3195
|
-
}
|
|
3196
|
-
|
|
3197
3288
|
// src/components/consent-agent-header.ts
|
|
3198
3289
|
var ConsentAgentHeader = class extends i4 {
|
|
3199
3290
|
constructor() {
|
|
@@ -3201,8 +3292,6 @@ var ConsentAgentHeader = class extends i4 {
|
|
|
3201
3292
|
this.agentName = "";
|
|
3202
3293
|
this.vendor = "";
|
|
3203
3294
|
this.surfaceLabel = "";
|
|
3204
|
-
this.domain = "";
|
|
3205
|
-
this.verified = false;
|
|
3206
3295
|
this.logoUrl = "";
|
|
3207
3296
|
this.connectedAt = "";
|
|
3208
3297
|
}
|
|
@@ -3234,23 +3323,6 @@ var ConsentAgentHeader = class extends i4 {
|
|
|
3234
3323
|
this.renderConnectedFragment()
|
|
3235
3324
|
].filter(Boolean).join(tokens.metaSeparator);
|
|
3236
3325
|
}
|
|
3237
|
-
renderPill() {
|
|
3238
|
-
const tokens = CONSENT_COPY_TOKENS.agentTile;
|
|
3239
|
-
const state = agentVerification({
|
|
3240
|
-
verification: this.verification,
|
|
3241
|
-
verified: this.verified,
|
|
3242
|
-
domain: this.domain
|
|
3243
|
-
});
|
|
3244
|
-
if (state === "domain") {
|
|
3245
|
-
return b2`<span class="pill domain" part="pill"
|
|
3246
|
-
><span class="visually-hidden">${tokens.domainPillPrefix} </span
|
|
3247
|
-
>${this.domain.trim()}</span
|
|
3248
|
-
>`;
|
|
3249
|
-
}
|
|
3250
|
-
return b2`<span class="pill ${state}" part="pill">
|
|
3251
|
-
${state === "verified" ? tokens.verifiedPill : tokens.unverifiedPill}
|
|
3252
|
-
</span>`;
|
|
3253
|
-
}
|
|
3254
3326
|
render() {
|
|
3255
3327
|
const initial = (this.agentName || "?").trim().charAt(0).toUpperCase();
|
|
3256
3328
|
return b2`
|
|
@@ -3259,10 +3331,7 @@ var ConsentAgentHeader = class extends i4 {
|
|
|
3259
3331
|
${this.logoUrl ? b2`<img src="${this.logoUrl}" alt="" />` : b2`<div class="placeholder">${initial}</div>`}
|
|
3260
3332
|
</div>
|
|
3261
3333
|
<div class="body">
|
|
3262
|
-
<
|
|
3263
|
-
<span class="name">${this.agentName || A}</span>
|
|
3264
|
-
${this.renderPill()}
|
|
3265
|
-
</div>
|
|
3334
|
+
<span class="name">${this.agentName || A}</span>
|
|
3266
3335
|
<div class="meta">${this.renderMeta()}</div>
|
|
3267
3336
|
</div>
|
|
3268
3337
|
</div>
|
|
@@ -3276,7 +3345,7 @@ ConsentAgentHeader.styles = i`
|
|
|
3276
3345
|
}
|
|
3277
3346
|
|
|
3278
3347
|
/* In a narrow card the name moves under the logo rather than squeezing
|
|
3279
|
-
into a column too thin
|
|
3348
|
+
into a column too thin to read (see .body's basis). */
|
|
3280
3349
|
.tile {
|
|
3281
3350
|
display: flex;
|
|
3282
3351
|
flex-wrap: wrap;
|
|
@@ -3330,13 +3399,6 @@ ConsentAgentHeader.styles = i`
|
|
|
3330
3399
|
min-width: 0;
|
|
3331
3400
|
}
|
|
3332
3401
|
|
|
3333
|
-
.row-name {
|
|
3334
|
-
display: flex;
|
|
3335
|
-
align-items: center;
|
|
3336
|
-
gap: 10px;
|
|
3337
|
-
flex-wrap: wrap;
|
|
3338
|
-
}
|
|
3339
|
-
|
|
3340
3402
|
.name {
|
|
3341
3403
|
font-size: 16px;
|
|
3342
3404
|
font-weight: 600;
|
|
@@ -3344,64 +3406,9 @@ ConsentAgentHeader.styles = i`
|
|
|
3344
3406
|
letter-spacing: -0.01em;
|
|
3345
3407
|
}
|
|
3346
3408
|
|
|
3347
|
-
.pill {
|
|
3348
|
-
display: inline-flex;
|
|
3349
|
-
align-items: center;
|
|
3350
|
-
gap: 4px;
|
|
3351
|
-
padding: 2px 8px;
|
|
3352
|
-
border-radius: 999px;
|
|
3353
|
-
font-size: 11px;
|
|
3354
|
-
font-weight: 600;
|
|
3355
|
-
letter-spacing: 0.04em;
|
|
3356
|
-
}
|
|
3357
|
-
|
|
3358
|
-
.pill.verified {
|
|
3359
|
-
background: var(--cs-pill-verified-bg, #dcfce7);
|
|
3360
|
-
color: var(--cs-pill-verified-text, #166534);
|
|
3361
|
-
}
|
|
3362
|
-
|
|
3363
|
-
.pill.unverified {
|
|
3364
|
-
background: var(--cs-pill-unverified-bg, #f1f5f9);
|
|
3365
|
-
color: var(--cs-pill-unverified-text, #475569);
|
|
3366
|
-
letter-spacing: 0.08em;
|
|
3367
|
-
}
|
|
3368
|
-
|
|
3369
|
-
/*
|
|
3370
|
-
* Domain-bound: a tint and an outline from the brand primary, with the
|
|
3371
|
-
* theme's own text color, so the domain reads in light and dark
|
|
3372
|
-
* whatever the brand color is.
|
|
3373
|
-
*/
|
|
3374
|
-
.pill.domain {
|
|
3375
|
-
background: var(
|
|
3376
|
-
--cs-pill-domain-bg,
|
|
3377
|
-
color-mix(in srgb, var(--consent-primary, #2563eb) 14%, transparent)
|
|
3378
|
-
);
|
|
3379
|
-
box-shadow: inset 0 0 0 1px
|
|
3380
|
-
var(
|
|
3381
|
-
--cs-pill-domain-border,
|
|
3382
|
-
color-mix(in srgb, var(--consent-primary, #2563eb) 40%, transparent)
|
|
3383
|
-
);
|
|
3384
|
-
color: var(--cs-pill-domain-text, var(--cs-text-primary, #0f172a));
|
|
3385
|
-
font-weight: 500;
|
|
3386
|
-
letter-spacing: 0;
|
|
3387
|
-
overflow-wrap: anywhere;
|
|
3388
|
-
}
|
|
3389
|
-
|
|
3390
|
-
.visually-hidden {
|
|
3391
|
-
position: absolute;
|
|
3392
|
-
width: 1px;
|
|
3393
|
-
height: 1px;
|
|
3394
|
-
margin: -1px;
|
|
3395
|
-
padding: 0;
|
|
3396
|
-
overflow: hidden;
|
|
3397
|
-
clip: rect(0, 0, 0, 0);
|
|
3398
|
-
white-space: nowrap;
|
|
3399
|
-
border: 0;
|
|
3400
|
-
}
|
|
3401
|
-
|
|
3402
3409
|
.meta {
|
|
3403
3410
|
font-size: 12px;
|
|
3404
|
-
color: var(--cs-text-tertiary, #
|
|
3411
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
3405
3412
|
line-height: 1.5;
|
|
3406
3413
|
}
|
|
3407
3414
|
`;
|
|
@@ -3414,15 +3421,6 @@ __decorateClass([
|
|
|
3414
3421
|
__decorateClass([
|
|
3415
3422
|
n4({ type: String })
|
|
3416
3423
|
], ConsentAgentHeader.prototype, "surfaceLabel", 2);
|
|
3417
|
-
__decorateClass([
|
|
3418
|
-
n4({ type: String })
|
|
3419
|
-
], ConsentAgentHeader.prototype, "verification", 2);
|
|
3420
|
-
__decorateClass([
|
|
3421
|
-
n4({ type: String })
|
|
3422
|
-
], ConsentAgentHeader.prototype, "domain", 2);
|
|
3423
|
-
__decorateClass([
|
|
3424
|
-
n4({ type: Boolean })
|
|
3425
|
-
], ConsentAgentHeader.prototype, "verified", 2);
|
|
3426
3424
|
__decorateClass([
|
|
3427
3425
|
n4({ type: String })
|
|
3428
3426
|
], ConsentAgentHeader.prototype, "logoUrl", 2);
|
|
@@ -3433,16 +3431,318 @@ ConsentAgentHeader = __decorateClass([
|
|
|
3433
3431
|
t3("consent-agent-header")
|
|
3434
3432
|
], ConsentAgentHeader);
|
|
3435
3433
|
|
|
3434
|
+
// src/types/capabilities.types.ts
|
|
3435
|
+
var AGENT_VERIFICATIONS = [
|
|
3436
|
+
"verified",
|
|
3437
|
+
"domain",
|
|
3438
|
+
"unverified"
|
|
3439
|
+
];
|
|
3440
|
+
function agentVerification(agent) {
|
|
3441
|
+
const stated = agent.verification;
|
|
3442
|
+
if (stated !== void 0 && AGENT_VERIFICATIONS.includes(stated)) {
|
|
3443
|
+
return stated === "domain" && !agent.domain?.trim() ? "unverified" : stated;
|
|
3444
|
+
}
|
|
3445
|
+
return agent.verified === true ? "verified" : "unverified";
|
|
3446
|
+
}
|
|
3447
|
+
|
|
3448
|
+
// src/types/edit.types.ts
|
|
3449
|
+
var CONSENT_EDIT_KEYS = {
|
|
3450
|
+
/** The subhead under the headline. */
|
|
3451
|
+
description: "description",
|
|
3452
|
+
/** The organization's name in the headline. */
|
|
3453
|
+
orgName: "org-name",
|
|
3454
|
+
/** The Allow button's label. */
|
|
3455
|
+
submitLabel: "submit-label",
|
|
3456
|
+
/** The Deny button's label. */
|
|
3457
|
+
cancelLabel: "cancel-label",
|
|
3458
|
+
/** A headline a host words itself, in the `headline` slot. */
|
|
3459
|
+
headline: "headline",
|
|
3460
|
+
/** The title of a page a host draws after the decision. */
|
|
3461
|
+
terminalTitle: "terminal:title",
|
|
3462
|
+
/** The body of a page a host draws after the decision. */
|
|
3463
|
+
terminalBody: "terminal:body",
|
|
3464
|
+
/** A capability row's label, by the capability's id. */
|
|
3465
|
+
capabilityLabel: (id) => `capability:${id}:label`,
|
|
3466
|
+
/** A capability row's description, by the capability's id. */
|
|
3467
|
+
capabilityDescription: (id) => `capability:${id}:description`
|
|
3468
|
+
};
|
|
3469
|
+
var CONSENT_EDIT_EVENTS = {
|
|
3470
|
+
/** On every change to a region's text. */
|
|
3471
|
+
edit: "consent-edit",
|
|
3472
|
+
/** When a person leaves a region they changed, for hosts that group undo. */
|
|
3473
|
+
end: "consent-edit-end"
|
|
3474
|
+
};
|
|
3475
|
+
var FIXED_KEYS = /* @__PURE__ */ new Set([
|
|
3476
|
+
CONSENT_EDIT_KEYS.description,
|
|
3477
|
+
CONSENT_EDIT_KEYS.orgName,
|
|
3478
|
+
CONSENT_EDIT_KEYS.submitLabel,
|
|
3479
|
+
CONSENT_EDIT_KEYS.cancelLabel,
|
|
3480
|
+
CONSENT_EDIT_KEYS.headline,
|
|
3481
|
+
CONSENT_EDIT_KEYS.terminalTitle,
|
|
3482
|
+
CONSENT_EDIT_KEYS.terminalBody
|
|
3483
|
+
]);
|
|
3484
|
+
var CAPABILITY_PREFIX = "capability:";
|
|
3485
|
+
var CAPABILITY_SUFFIXES = [
|
|
3486
|
+
[":label", "capability-label"],
|
|
3487
|
+
[":description", "capability-description"]
|
|
3488
|
+
];
|
|
3489
|
+
function parseConsentEditKey(key) {
|
|
3490
|
+
if (FIXED_KEYS.has(key)) {
|
|
3491
|
+
return { kind: key };
|
|
3492
|
+
}
|
|
3493
|
+
if (!key.startsWith(CAPABILITY_PREFIX)) return null;
|
|
3494
|
+
for (const [suffix, kind] of CAPABILITY_SUFFIXES) {
|
|
3495
|
+
if (key.endsWith(suffix) && key.length > CAPABILITY_PREFIX.length + suffix.length) {
|
|
3496
|
+
return {
|
|
3497
|
+
kind,
|
|
3498
|
+
capabilityId: key.slice(CAPABILITY_PREFIX.length, -suffix.length)
|
|
3499
|
+
};
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3502
|
+
return null;
|
|
3503
|
+
}
|
|
3504
|
+
|
|
3505
|
+
// src/components/edit-region.ts
|
|
3506
|
+
var regions = /* @__PURE__ */ new WeakMap();
|
|
3507
|
+
var editableValue;
|
|
3508
|
+
function contentEditableValue() {
|
|
3509
|
+
if (editableValue) return editableValue;
|
|
3510
|
+
if (typeof document === "undefined") return "true";
|
|
3511
|
+
try {
|
|
3512
|
+
const probe = document.createElement("span");
|
|
3513
|
+
probe.contentEditable = "plaintext-only";
|
|
3514
|
+
editableValue = probe.contentEditable === "plaintext-only" ? "plaintext-only" : "true";
|
|
3515
|
+
} catch {
|
|
3516
|
+
editableValue = "true";
|
|
3517
|
+
}
|
|
3518
|
+
return editableValue;
|
|
3519
|
+
}
|
|
3520
|
+
function hasFocus(el) {
|
|
3521
|
+
const root = el.getRootNode();
|
|
3522
|
+
return root.activeElement === el;
|
|
3523
|
+
}
|
|
3524
|
+
function lineOf(text) {
|
|
3525
|
+
return text.replace(/ /g, " ").replace(/\s*[\r\n]+\s*/g, " ");
|
|
3526
|
+
}
|
|
3527
|
+
function emit(el, type, detail) {
|
|
3528
|
+
el.dispatchEvent(
|
|
3529
|
+
new CustomEvent(type, {
|
|
3530
|
+
detail,
|
|
3531
|
+
bubbles: true,
|
|
3532
|
+
composed: true
|
|
3533
|
+
})
|
|
3534
|
+
);
|
|
3535
|
+
}
|
|
3536
|
+
function caretToEnd(el) {
|
|
3537
|
+
el.ownerDocument.getSelection()?.collapse(el, el.childNodes.length);
|
|
3538
|
+
}
|
|
3539
|
+
function insertPlainText(el, text) {
|
|
3540
|
+
if (!text) return;
|
|
3541
|
+
const doc = el.ownerDocument;
|
|
3542
|
+
if (typeof doc.execCommand === "function") {
|
|
3543
|
+
try {
|
|
3544
|
+
if (doc.execCommand("insertText", false, text)) return;
|
|
3545
|
+
} catch {
|
|
3546
|
+
}
|
|
3547
|
+
}
|
|
3548
|
+
const selection = doc.getSelection();
|
|
3549
|
+
if (!selection || selection.rangeCount === 0) return;
|
|
3550
|
+
const range = selection.getRangeAt(0);
|
|
3551
|
+
if (!el.contains(range.commonAncestorContainer)) return;
|
|
3552
|
+
range.deleteContents();
|
|
3553
|
+
const node = doc.createTextNode(text);
|
|
3554
|
+
range.insertNode(node);
|
|
3555
|
+
range.setStartAfter(node);
|
|
3556
|
+
range.collapse(true);
|
|
3557
|
+
selection.removeAllRanges();
|
|
3558
|
+
selection.addRange(range);
|
|
3559
|
+
el.dispatchEvent(
|
|
3560
|
+
new InputEvent("input", {
|
|
3561
|
+
bubbles: true,
|
|
3562
|
+
composed: true,
|
|
3563
|
+
inputType: "insertText",
|
|
3564
|
+
data: text
|
|
3565
|
+
})
|
|
3566
|
+
);
|
|
3567
|
+
}
|
|
3568
|
+
function onPointerDown(event) {
|
|
3569
|
+
const state = regions.get(event.currentTarget);
|
|
3570
|
+
if (state) state.pointer = true;
|
|
3571
|
+
}
|
|
3572
|
+
function onMouseDown(event) {
|
|
3573
|
+
const el = event.currentTarget;
|
|
3574
|
+
const state = regions.get(el);
|
|
3575
|
+
if (!state || event.button !== 0 || hasFocus(el)) return;
|
|
3576
|
+
if (el.textContent === state.source) return;
|
|
3577
|
+
event.preventDefault();
|
|
3578
|
+
state.pointer = false;
|
|
3579
|
+
el.focus();
|
|
3580
|
+
}
|
|
3581
|
+
function onFocus(event) {
|
|
3582
|
+
const el = event.currentTarget;
|
|
3583
|
+
const state = regions.get(el);
|
|
3584
|
+
if (!state) return;
|
|
3585
|
+
state.changed = false;
|
|
3586
|
+
const swapped = el.textContent !== state.source;
|
|
3587
|
+
if (swapped) el.textContent = state.source;
|
|
3588
|
+
state.value = lineOf(el.textContent ?? "");
|
|
3589
|
+
if (swapped || !state.pointer) caretToEnd(el);
|
|
3590
|
+
state.pointer = false;
|
|
3591
|
+
}
|
|
3592
|
+
function onInput(event) {
|
|
3593
|
+
const el = event.currentTarget;
|
|
3594
|
+
const state = regions.get(el);
|
|
3595
|
+
if (!state) return;
|
|
3596
|
+
for (const br of el.querySelectorAll("br")) br.remove();
|
|
3597
|
+
state.changed = true;
|
|
3598
|
+
state.value = lineOf(el.textContent ?? "");
|
|
3599
|
+
emit(el, CONSENT_EDIT_EVENTS.edit, { key: state.key, value: state.value });
|
|
3600
|
+
}
|
|
3601
|
+
function onBlur(event) {
|
|
3602
|
+
const el = event.currentTarget;
|
|
3603
|
+
const state = regions.get(el);
|
|
3604
|
+
if (!state) return;
|
|
3605
|
+
state.pointer = false;
|
|
3606
|
+
if (el.textContent !== state.text) el.textContent = state.text;
|
|
3607
|
+
if (!state.changed) return;
|
|
3608
|
+
state.changed = false;
|
|
3609
|
+
emit(el, CONSENT_EDIT_EVENTS.end, { key: state.key, value: state.value });
|
|
3610
|
+
}
|
|
3611
|
+
function isImeKey(event) {
|
|
3612
|
+
return event.isComposing || event.keyCode === 229;
|
|
3613
|
+
}
|
|
3614
|
+
function onKeyDown(event) {
|
|
3615
|
+
event.stopPropagation();
|
|
3616
|
+
if (isImeKey(event)) return;
|
|
3617
|
+
if (event.key === "Enter" || event.key === "Escape") {
|
|
3618
|
+
event.preventDefault();
|
|
3619
|
+
event.currentTarget.blur();
|
|
3620
|
+
}
|
|
3621
|
+
}
|
|
3622
|
+
function onBeforeInput(event) {
|
|
3623
|
+
if (event.inputType.startsWith("format") || event.inputType === "insertParagraph" || event.inputType === "insertLineBreak") {
|
|
3624
|
+
event.preventDefault();
|
|
3625
|
+
}
|
|
3626
|
+
}
|
|
3627
|
+
function onPaste(event) {
|
|
3628
|
+
event.preventDefault();
|
|
3629
|
+
insertPlainText(
|
|
3630
|
+
event.currentTarget,
|
|
3631
|
+
lineOf(event.clipboardData?.getData("text/plain") ?? "")
|
|
3632
|
+
);
|
|
3633
|
+
}
|
|
3634
|
+
function onDrop(event) {
|
|
3635
|
+
event.preventDefault();
|
|
3636
|
+
}
|
|
3637
|
+
var EditableTextDirective = class extends i5 {
|
|
3638
|
+
constructor(partInfo) {
|
|
3639
|
+
super(partInfo);
|
|
3640
|
+
if (partInfo.type !== t4.ELEMENT) {
|
|
3641
|
+
throw new Error(
|
|
3642
|
+
"editableText goes on an element, as an attribute-less binding"
|
|
3643
|
+
);
|
|
3644
|
+
}
|
|
3645
|
+
}
|
|
3646
|
+
render(_key, _text, _source) {
|
|
3647
|
+
return E;
|
|
3648
|
+
}
|
|
3649
|
+
update(part, [key, text, source]) {
|
|
3650
|
+
const el = part.element;
|
|
3651
|
+
const state = regions.get(el);
|
|
3652
|
+
if (state) {
|
|
3653
|
+
state.key = key;
|
|
3654
|
+
state.text = text;
|
|
3655
|
+
state.source = source;
|
|
3656
|
+
} else {
|
|
3657
|
+
regions.set(el, {
|
|
3658
|
+
key,
|
|
3659
|
+
text,
|
|
3660
|
+
source,
|
|
3661
|
+
changed: false,
|
|
3662
|
+
value: text,
|
|
3663
|
+
pointer: false
|
|
3664
|
+
});
|
|
3665
|
+
}
|
|
3666
|
+
if (!hasFocus(el) && el.textContent !== text) el.textContent = text;
|
|
3667
|
+
return E;
|
|
3668
|
+
}
|
|
3669
|
+
};
|
|
3670
|
+
var editableText = e7(EditableTextDirective);
|
|
3671
|
+
function editRegion(key, label, text, source) {
|
|
3672
|
+
return b2`<span
|
|
3673
|
+
class="edit-region"
|
|
3674
|
+
data-edit-key=${key}
|
|
3675
|
+
role="textbox"
|
|
3676
|
+
aria-label=${label}
|
|
3677
|
+
contenteditable=${contentEditableValue()}
|
|
3678
|
+
spellcheck="true"
|
|
3679
|
+
${editableText(key, text, source?.[key] ?? text)}
|
|
3680
|
+
@pointerdown=${onPointerDown}
|
|
3681
|
+
@mousedown=${onMouseDown}
|
|
3682
|
+
@focus=${onFocus}
|
|
3683
|
+
@blur=${onBlur}
|
|
3684
|
+
@keydown=${onKeyDown}
|
|
3685
|
+
@beforeinput=${onBeforeInput}
|
|
3686
|
+
@input=${onInput}
|
|
3687
|
+
@paste=${onPaste}
|
|
3688
|
+
@drop=${onDrop}
|
|
3689
|
+
></span>`;
|
|
3690
|
+
}
|
|
3691
|
+
var editRegionStyles = i`
|
|
3692
|
+
.edit-region {
|
|
3693
|
+
cursor: text;
|
|
3694
|
+
border-radius: 3px;
|
|
3695
|
+
outline: 1px dashed transparent;
|
|
3696
|
+
outline-offset: 2px;
|
|
3697
|
+
transition:
|
|
3698
|
+
outline-color 0.12s ease,
|
|
3699
|
+
background-color 0.12s ease;
|
|
3700
|
+
}
|
|
3701
|
+
|
|
3702
|
+
.edit-region:hover {
|
|
3703
|
+
outline-color: var(
|
|
3704
|
+
--cs-edit-hover-ring,
|
|
3705
|
+
color-mix(in srgb, currentColor 45%, transparent)
|
|
3706
|
+
);
|
|
3707
|
+
}
|
|
3708
|
+
|
|
3709
|
+
.edit-region:focus {
|
|
3710
|
+
outline: 2px solid var(--cs-edit-focus-ring, currentColor);
|
|
3711
|
+
background-color: var(
|
|
3712
|
+
--cs-edit-wash,
|
|
3713
|
+
color-mix(in srgb, currentColor 8%, transparent)
|
|
3714
|
+
);
|
|
3715
|
+
}
|
|
3716
|
+
|
|
3717
|
+
/* An emptied region keeps room for the caret and something to click. */
|
|
3718
|
+
.edit-region:empty {
|
|
3719
|
+
display: inline-block;
|
|
3720
|
+
min-width: 1ch;
|
|
3721
|
+
}
|
|
3722
|
+
`;
|
|
3723
|
+
|
|
3436
3724
|
// src/components/consent-headline.ts
|
|
3437
|
-
var PLACEHOLDER = /(\{Agent\}|\{Verb\}
|
|
3725
|
+
var PLACEHOLDER = /(\{Agent\}|\{Verb\})/;
|
|
3726
|
+
var DETAILS_WIDTH_PX = 304;
|
|
3727
|
+
var DETAILS_GAP_PX = 8;
|
|
3728
|
+
var DETAILS_GUTTER_PX = 16;
|
|
3729
|
+
function initialOf(name) {
|
|
3730
|
+
return name.match(/[\p{L}\p{N}]/u)?.[0]?.toUpperCase() ?? "?";
|
|
3731
|
+
}
|
|
3732
|
+
function vouchingHost(agent) {
|
|
3733
|
+
return agentVerification(agent) === "domain" ? agent.domain?.trim() || void 0 : void 0;
|
|
3734
|
+
}
|
|
3735
|
+
var CHECK_ICON = w`<path d="M20 6 9 17l-5-5" />`;
|
|
3736
|
+
var GLOBE_ICON = w`<circle cx="12" cy="12" r="10" /><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" /><path d="M2 12h20" />`;
|
|
3438
3737
|
var ConsentHeadline = class extends i4 {
|
|
3439
3738
|
constructor() {
|
|
3440
3739
|
super(...arguments);
|
|
3441
3740
|
this.agentName = "";
|
|
3442
|
-
this.orgName = "";
|
|
3443
3741
|
this.verb = "";
|
|
3444
3742
|
this.description = "";
|
|
3445
3743
|
this.eyebrow = "";
|
|
3744
|
+
this.preview = false;
|
|
3745
|
+
this.editable = false;
|
|
3446
3746
|
this.hostHeadline = false;
|
|
3447
3747
|
/**
|
|
3448
3748
|
* Reads the slot itself, not the event's target: when a screen forwards its
|
|
@@ -3455,12 +3755,37 @@ var ConsentHeadline = class extends i4 {
|
|
|
3455
3755
|
);
|
|
3456
3756
|
this.hostHeadline = (slot?.assignedElements({ flatten: true }).length ?? 0) > 0;
|
|
3457
3757
|
};
|
|
3758
|
+
/** Places the popover under the name, inside the window, while it is open. */
|
|
3759
|
+
this.onDetailsToggle = (event) => {
|
|
3760
|
+
const opening = event.newState === "open";
|
|
3761
|
+
if (opening) {
|
|
3762
|
+
this.placeDetails();
|
|
3763
|
+
window.addEventListener("scroll", this.placeDetails, true);
|
|
3764
|
+
window.addEventListener("resize", this.placeDetails);
|
|
3765
|
+
} else {
|
|
3766
|
+
window.removeEventListener("scroll", this.placeDetails, true);
|
|
3767
|
+
window.removeEventListener("resize", this.placeDetails);
|
|
3768
|
+
}
|
|
3769
|
+
};
|
|
3770
|
+
this.placeDetails = () => {
|
|
3771
|
+
const name = this.renderRoot.querySelector(".agent");
|
|
3772
|
+
const details = this.renderRoot.querySelector(".details");
|
|
3773
|
+
if (!name || !details) return;
|
|
3774
|
+
const anchor = name.getBoundingClientRect();
|
|
3775
|
+
const width = Math.min(
|
|
3776
|
+
DETAILS_WIDTH_PX,
|
|
3777
|
+
window.innerWidth - 2 * DETAILS_GUTTER_PX
|
|
3778
|
+
);
|
|
3779
|
+
details.style.top = `${anchor.bottom + DETAILS_GAP_PX}px`;
|
|
3780
|
+
details.style.left = `${Math.max(
|
|
3781
|
+
DETAILS_GUTTER_PX,
|
|
3782
|
+
Math.min(anchor.left, window.innerWidth - width - DETAILS_GUTTER_PX)
|
|
3783
|
+
)}px`;
|
|
3784
|
+
};
|
|
3458
3785
|
}
|
|
3459
3786
|
render() {
|
|
3460
3787
|
const tokens = CONSENT_COPY_TOKENS;
|
|
3461
|
-
const subhead = this.
|
|
3462
|
-
Agent: this.agentName.trim() || "this agent"
|
|
3463
|
-
});
|
|
3788
|
+
const subhead = this.subheadText();
|
|
3464
3789
|
return b2`
|
|
3465
3790
|
<span class="eyebrow" part="eyebrow"
|
|
3466
3791
|
>${this.eyebrow.trim() || tokens.eyebrow.permissionRequest}</span
|
|
@@ -3468,9 +3793,30 @@ var ConsentHeadline = class extends i4 {
|
|
|
3468
3793
|
<h1 class="headline" part="headline">
|
|
3469
3794
|
<slot name="headline" @slotchange=${this.readHeadlineSlot}></slot>${this.hostHeadline ? A : this.headlinePieces()}
|
|
3470
3795
|
</h1>
|
|
3471
|
-
|
|
3796
|
+
${subhead === A ? A : b2`<p class="subhead" part="subhead">${subhead}</p>`}
|
|
3797
|
+
${this.agent && !this.hostHeadline ? this.renderDetails(this.agent) : A}
|
|
3472
3798
|
`;
|
|
3473
3799
|
}
|
|
3800
|
+
/** The name the headline gives the agent. */
|
|
3801
|
+
get displayName() {
|
|
3802
|
+
return this.agent?.name?.trim() || this.agentName.trim() || "An assistant";
|
|
3803
|
+
}
|
|
3804
|
+
/**
|
|
3805
|
+
* The subhead: the host's, as a region in edit mode. With none, nothing,
|
|
3806
|
+
* except in edit mode, where the region starts from the standard line.
|
|
3807
|
+
*/
|
|
3808
|
+
subheadText() {
|
|
3809
|
+
const given = this.description.trim();
|
|
3810
|
+
if (!isEditing(this)) return given || A;
|
|
3811
|
+
return editRegion(
|
|
3812
|
+
CONSENT_EDIT_KEYS.description,
|
|
3813
|
+
CONSENT_COPY_TOKENS.editRegions.description,
|
|
3814
|
+
given || formatToken(CONSENT_COPY_TOKENS.subhead.template, {
|
|
3815
|
+
Agent: this.displayName
|
|
3816
|
+
}),
|
|
3817
|
+
this.editSource
|
|
3818
|
+
);
|
|
3819
|
+
}
|
|
3474
3820
|
/**
|
|
3475
3821
|
* Before the first render, reads what the slot will hold from the light DOM,
|
|
3476
3822
|
* so the first render is already the right one. A change made here does not
|
|
@@ -3478,6 +3824,7 @@ var ConsentHeadline = class extends i4 {
|
|
|
3478
3824
|
*/
|
|
3479
3825
|
willUpdate() {
|
|
3480
3826
|
if (!this.hasUpdated) this.hostHeadline = this.lightHeadlineFilled();
|
|
3827
|
+
warnIfEditableWithoutPreview(this);
|
|
3481
3828
|
}
|
|
3482
3829
|
/**
|
|
3483
3830
|
* The children the `headline` slot will be given, flattened: a screen's
|
|
@@ -3492,22 +3839,107 @@ var ConsentHeadline = class extends i4 {
|
|
|
3492
3839
|
return true;
|
|
3493
3840
|
});
|
|
3494
3841
|
}
|
|
3495
|
-
/** The headline, with
|
|
3842
|
+
/** The headline, with the agent's name as a button when the agent is given. */
|
|
3496
3843
|
headlinePieces() {
|
|
3497
3844
|
const tokens = CONSENT_COPY_TOKENS;
|
|
3498
3845
|
const verb = this.verb.trim();
|
|
3499
3846
|
const template = verb && verb !== "use" ? tokens.headline.template : tokens.headline.fallbackTemplate;
|
|
3500
|
-
const agent = this.agentName.trim() || "An assistant";
|
|
3501
|
-
const org = this.orgName.trim() || "this site";
|
|
3502
3847
|
return template.split(PLACEHOLDER).map((piece) => {
|
|
3503
|
-
if (piece === "{Agent}") return
|
|
3504
|
-
if (piece === "{Org}") return b2`<em>${org}</em>`;
|
|
3848
|
+
if (piece === "{Agent}") return this.renderName();
|
|
3505
3849
|
if (piece === "{Verb}") return verb;
|
|
3506
3850
|
return piece;
|
|
3507
3851
|
});
|
|
3508
3852
|
}
|
|
3853
|
+
renderName() {
|
|
3854
|
+
const name = this.displayName;
|
|
3855
|
+
if (!this.agent) return b2`<em part="agent-name">${name}</em>`;
|
|
3856
|
+
const host = vouchingHost(this.agent);
|
|
3857
|
+
return b2`<button
|
|
3858
|
+
class="agent"
|
|
3859
|
+
part="agent-name"
|
|
3860
|
+
type="button"
|
|
3861
|
+
aria-haspopup="dialog"
|
|
3862
|
+
popovertarget="agent-details"
|
|
3863
|
+
>
|
|
3864
|
+
${name}</button
|
|
3865
|
+
>${host ? b2` <span class="host" part="host"
|
|
3866
|
+
><svg
|
|
3867
|
+
viewBox="0 0 24 24"
|
|
3868
|
+
fill="none"
|
|
3869
|
+
stroke="currentColor"
|
|
3870
|
+
stroke-width="2"
|
|
3871
|
+
stroke-linecap="round"
|
|
3872
|
+
stroke-linejoin="round"
|
|
3873
|
+
aria-hidden="true"
|
|
3874
|
+
>
|
|
3875
|
+
${CHECK_ICON}</svg
|
|
3876
|
+
><span class="sr-only"
|
|
3877
|
+
>${CONSENT_COPY_TOKENS.agentDetails.identifiedByPrefix}</span
|
|
3878
|
+
>${host}</span
|
|
3879
|
+
>` : A}`;
|
|
3880
|
+
}
|
|
3881
|
+
/** What the agent's name opens: who it is and how its name was checked. */
|
|
3882
|
+
renderDetails(agent) {
|
|
3883
|
+
const copy = CONSENT_COPY_TOKENS.agentDetails;
|
|
3884
|
+
const name = this.displayName;
|
|
3885
|
+
const host = vouchingHost(agent);
|
|
3886
|
+
const verified = agentVerification(agent) === "verified";
|
|
3887
|
+
const identity = host ? formatToken(copy.identifiedBy, { Host: host }) : verified ? copy.verified : copy.unverified;
|
|
3888
|
+
const explanation = host ? formatToken(copy.identifiedExplanation, { Host: host }) : verified ? copy.verifiedExplanation : copy.unverifiedExplanation;
|
|
3889
|
+
const logo = agent.logoUrl?.trim();
|
|
3890
|
+
return b2`<div
|
|
3891
|
+
id="agent-details"
|
|
3892
|
+
class="details"
|
|
3893
|
+
part="agent-details"
|
|
3894
|
+
popover="auto"
|
|
3895
|
+
role="dialog"
|
|
3896
|
+
aria-label=${formatToken(copy.about, { Agent: name })}
|
|
3897
|
+
@beforetoggle=${this.onDetailsToggle}
|
|
3898
|
+
>
|
|
3899
|
+
<div class="details-head">
|
|
3900
|
+
<span class="mark" aria-hidden="true"
|
|
3901
|
+
>${logo ? b2`<img src=${logo} alt="" />` : initialOf(name)}</span
|
|
3902
|
+
>
|
|
3903
|
+
<span class="who"
|
|
3904
|
+
><span class="name">${name}</span
|
|
3905
|
+
><span class="small">${copy.kind}</span></span
|
|
3906
|
+
>
|
|
3907
|
+
</div>
|
|
3908
|
+
<dl>
|
|
3909
|
+
<div class="fact">
|
|
3910
|
+
<svg
|
|
3911
|
+
viewBox="0 0 24 24"
|
|
3912
|
+
fill="none"
|
|
3913
|
+
stroke="currentColor"
|
|
3914
|
+
stroke-width="2"
|
|
3915
|
+
stroke-linecap="round"
|
|
3916
|
+
stroke-linejoin="round"
|
|
3917
|
+
aria-hidden="true"
|
|
3918
|
+
>
|
|
3919
|
+
${GLOBE_ICON}
|
|
3920
|
+
</svg>
|
|
3921
|
+
<div>
|
|
3922
|
+
<dt class="small">${copy.identity}</dt>
|
|
3923
|
+
<dd class="value">${identity}</dd>
|
|
3924
|
+
<dd class="small">${explanation}</dd>
|
|
3925
|
+
</div>
|
|
3926
|
+
</div>
|
|
3927
|
+
${agent.did?.trim() ? b2`<div class="agent-id">
|
|
3928
|
+
<dt class="small">${copy.agentId}</dt>
|
|
3929
|
+
<dd><code>${agent.did.trim()}</code></dd>
|
|
3930
|
+
</div>` : A}
|
|
3931
|
+
</dl>
|
|
3932
|
+
</div>`;
|
|
3933
|
+
}
|
|
3934
|
+
disconnectedCallback() {
|
|
3935
|
+
super.disconnectedCallback();
|
|
3936
|
+
window.removeEventListener("scroll", this.placeDetails, true);
|
|
3937
|
+
window.removeEventListener("resize", this.placeDetails);
|
|
3938
|
+
}
|
|
3509
3939
|
};
|
|
3510
3940
|
ConsentHeadline.styles = i`
|
|
3941
|
+
${editRegionStyles}
|
|
3942
|
+
|
|
3511
3943
|
:host {
|
|
3512
3944
|
display: flex;
|
|
3513
3945
|
flex-direction: column;
|
|
@@ -3519,17 +3951,20 @@ ConsentHeadline.styles = i`
|
|
|
3519
3951
|
font-size: 11px;
|
|
3520
3952
|
letter-spacing: 0.16em;
|
|
3521
3953
|
font-weight: 600;
|
|
3522
|
-
color: var(--cs-text-tertiary, #
|
|
3954
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
3523
3955
|
text-transform: uppercase;
|
|
3524
3956
|
}
|
|
3525
3957
|
|
|
3526
3958
|
.headline {
|
|
3527
|
-
font-family: "
|
|
3528
|
-
font-size: var(--cs-headline-font-size,
|
|
3529
|
-
|
|
3959
|
+
font-family: var(--cs-headline-font, "Instrument Serif", Georgia, serif);
|
|
3960
|
+
font-size: var(--cs-headline-font-size, 32px);
|
|
3961
|
+
font-weight: var(--cs-headline-weight, 600);
|
|
3962
|
+
line-height: 1.1;
|
|
3530
3963
|
letter-spacing: -0.01em;
|
|
3531
3964
|
color: var(--cs-text-primary, #0f172a);
|
|
3532
3965
|
margin: 0;
|
|
3966
|
+
text-align: left;
|
|
3967
|
+
text-wrap: pretty;
|
|
3533
3968
|
overflow-wrap: anywhere;
|
|
3534
3969
|
}
|
|
3535
3970
|
|
|
@@ -3537,32 +3972,221 @@ ConsentHeadline.styles = i`
|
|
|
3537
3972
|
font-style: italic;
|
|
3538
3973
|
}
|
|
3539
3974
|
|
|
3540
|
-
.
|
|
3541
|
-
font
|
|
3542
|
-
|
|
3543
|
-
|
|
3975
|
+
.agent {
|
|
3976
|
+
font: inherit;
|
|
3977
|
+
font-style: italic;
|
|
3978
|
+
color: var(--cs-action, currentColor);
|
|
3979
|
+
background: none;
|
|
3980
|
+
border: 0;
|
|
3981
|
+
padding: 0;
|
|
3544
3982
|
margin: 0;
|
|
3983
|
+
text-align: left;
|
|
3984
|
+
cursor: pointer;
|
|
3985
|
+
border-radius: 4px;
|
|
3986
|
+
text-decoration: underline dotted 2px;
|
|
3987
|
+
text-underline-offset: 0.3em;
|
|
3545
3988
|
}
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3989
|
+
|
|
3990
|
+
.agent:hover {
|
|
3991
|
+
text-decoration-style: solid;
|
|
3992
|
+
}
|
|
3993
|
+
|
|
3994
|
+
.agent:focus-visible {
|
|
3995
|
+
outline: 2px solid var(--cs-focus-ring, #0f172a);
|
|
3996
|
+
outline-offset: 2px;
|
|
3997
|
+
}
|
|
3998
|
+
|
|
3999
|
+
.host {
|
|
4000
|
+
display: inline-flex;
|
|
4001
|
+
max-width: 100%;
|
|
4002
|
+
align-items: center;
|
|
4003
|
+
gap: 4px;
|
|
4004
|
+
padding: 2px 6px;
|
|
4005
|
+
border-radius: 4px;
|
|
4006
|
+
border: 1px solid var(--cs-tint-line, rgba(15, 23, 42, 0.18));
|
|
4007
|
+
background: var(--cs-tint, rgba(15, 23, 42, 0.07));
|
|
4008
|
+
color: var(--cs-text-primary, #0f172a);
|
|
4009
|
+
font-family: var(
|
|
4010
|
+
--cs-font,
|
|
4011
|
+
system-ui,
|
|
4012
|
+
-apple-system,
|
|
4013
|
+
"Segoe UI",
|
|
4014
|
+
sans-serif
|
|
4015
|
+
);
|
|
4016
|
+
font-size: 14px;
|
|
4017
|
+
font-style: normal;
|
|
4018
|
+
font-weight: 500;
|
|
4019
|
+
line-height: 1.45;
|
|
4020
|
+
letter-spacing: 0;
|
|
4021
|
+
vertical-align: middle;
|
|
4022
|
+
overflow-wrap: anywhere;
|
|
4023
|
+
}
|
|
4024
|
+
|
|
4025
|
+
.host svg {
|
|
4026
|
+
width: 14px;
|
|
4027
|
+
height: 14px;
|
|
4028
|
+
flex-shrink: 0;
|
|
4029
|
+
color: var(--cs-mark, currentColor);
|
|
4030
|
+
}
|
|
4031
|
+
|
|
4032
|
+
.sr-only {
|
|
4033
|
+
position: absolute;
|
|
4034
|
+
width: 1px;
|
|
4035
|
+
height: 1px;
|
|
4036
|
+
margin: -1px;
|
|
4037
|
+
padding: 0;
|
|
4038
|
+
overflow: hidden;
|
|
4039
|
+
clip-path: inset(50%);
|
|
4040
|
+
white-space: nowrap;
|
|
4041
|
+
border: 0;
|
|
4042
|
+
}
|
|
4043
|
+
|
|
4044
|
+
.subhead {
|
|
4045
|
+
font-size: var(--cs-subhead-font-size, 14.5px);
|
|
4046
|
+
color: var(--cs-text-secondary, #334155);
|
|
4047
|
+
line-height: 1.55;
|
|
4048
|
+
margin: 0;
|
|
4049
|
+
text-align: left;
|
|
4050
|
+
text-wrap: pretty;
|
|
4051
|
+
}
|
|
4052
|
+
|
|
4053
|
+
.details {
|
|
4054
|
+
position: fixed;
|
|
4055
|
+
inset: auto;
|
|
4056
|
+
margin: 0;
|
|
4057
|
+
box-sizing: border-box;
|
|
4058
|
+
width: min(
|
|
4059
|
+
${DETAILS_WIDTH_PX}px,
|
|
4060
|
+
calc(100vw - ${2 * DETAILS_GUTTER_PX}px)
|
|
4061
|
+
);
|
|
4062
|
+
padding: 16px;
|
|
4063
|
+
border-radius: 12px;
|
|
4064
|
+
border: 1px solid var(--cs-surface-border, rgba(15, 23, 42, 0.1));
|
|
4065
|
+
background: var(--cs-surface-card, #ffffff);
|
|
4066
|
+
color: var(--cs-text-primary, #0f172a);
|
|
4067
|
+
box-shadow: var(--cs-card-shadow, 0 6px 20px -6px rgba(15, 23, 42, 0.1));
|
|
4068
|
+
font-size: 14px;
|
|
4069
|
+
line-height: 1.45;
|
|
4070
|
+
}
|
|
4071
|
+
|
|
4072
|
+
.details-head {
|
|
4073
|
+
display: flex;
|
|
4074
|
+
align-items: center;
|
|
4075
|
+
gap: 12px;
|
|
4076
|
+
}
|
|
4077
|
+
|
|
4078
|
+
.mark {
|
|
4079
|
+
display: grid;
|
|
4080
|
+
place-items: center;
|
|
4081
|
+
width: 40px;
|
|
4082
|
+
height: 40px;
|
|
4083
|
+
flex-shrink: 0;
|
|
4084
|
+
border-radius: 6px;
|
|
4085
|
+
border: 1px solid var(--cs-surface-border, rgba(15, 23, 42, 0.1));
|
|
4086
|
+
background: var(--cs-surface-card, #ffffff);
|
|
4087
|
+
font-size: 16px;
|
|
4088
|
+
font-weight: 600;
|
|
4089
|
+
overflow: hidden;
|
|
4090
|
+
}
|
|
4091
|
+
|
|
4092
|
+
.mark img {
|
|
4093
|
+
width: 28px;
|
|
4094
|
+
height: 28px;
|
|
4095
|
+
object-fit: contain;
|
|
4096
|
+
}
|
|
4097
|
+
|
|
4098
|
+
.who {
|
|
4099
|
+
display: flex;
|
|
4100
|
+
flex-direction: column;
|
|
4101
|
+
min-width: 0;
|
|
4102
|
+
}
|
|
4103
|
+
|
|
4104
|
+
.who .name {
|
|
4105
|
+
font-weight: 600;
|
|
4106
|
+
overflow-wrap: anywhere;
|
|
4107
|
+
}
|
|
4108
|
+
|
|
4109
|
+
.small {
|
|
4110
|
+
font-size: 12px;
|
|
4111
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
4112
|
+
}
|
|
4113
|
+
|
|
4114
|
+
.details dl {
|
|
4115
|
+
display: flex;
|
|
4116
|
+
flex-direction: column;
|
|
4117
|
+
gap: 12px;
|
|
4118
|
+
margin: 16px 0 0;
|
|
4119
|
+
}
|
|
4120
|
+
|
|
4121
|
+
.details dd {
|
|
4122
|
+
margin: 0;
|
|
4123
|
+
}
|
|
4124
|
+
|
|
4125
|
+
.fact {
|
|
4126
|
+
display: flex;
|
|
4127
|
+
align-items: flex-start;
|
|
4128
|
+
gap: 10px;
|
|
4129
|
+
}
|
|
4130
|
+
|
|
4131
|
+
.fact svg {
|
|
4132
|
+
width: 16px;
|
|
4133
|
+
height: 16px;
|
|
4134
|
+
flex-shrink: 0;
|
|
4135
|
+
margin-top: 2px;
|
|
4136
|
+
color: var(--cs-mark, currentColor);
|
|
4137
|
+
}
|
|
4138
|
+
|
|
4139
|
+
.fact .value {
|
|
4140
|
+
font-weight: 500;
|
|
4141
|
+
}
|
|
4142
|
+
|
|
4143
|
+
.agent-id {
|
|
4144
|
+
display: flex;
|
|
4145
|
+
flex-direction: column;
|
|
4146
|
+
gap: 4px;
|
|
4147
|
+
}
|
|
4148
|
+
|
|
4149
|
+
.agent-id code {
|
|
4150
|
+
word-break: break-all;
|
|
4151
|
+
border-radius: 4px;
|
|
4152
|
+
border: 1px solid var(--cs-surface-border, rgba(15, 23, 42, 0.1));
|
|
4153
|
+
background: color-mix(
|
|
4154
|
+
in srgb,
|
|
4155
|
+
var(--cs-text-primary, #0f172a) 4%,
|
|
4156
|
+
transparent
|
|
4157
|
+
);
|
|
4158
|
+
padding: 0 4px;
|
|
4159
|
+
font-size: 12px;
|
|
4160
|
+
}
|
|
4161
|
+
`;
|
|
4162
|
+
__decorateClass([
|
|
4163
|
+
n4({ type: String, attribute: "agent-name" })
|
|
4164
|
+
], ConsentHeadline.prototype, "agentName", 2);
|
|
4165
|
+
__decorateClass([
|
|
4166
|
+
n4({ attribute: false })
|
|
4167
|
+
], ConsentHeadline.prototype, "agent", 2);
|
|
4168
|
+
__decorateClass([
|
|
4169
|
+
n4({ type: String })
|
|
4170
|
+
], ConsentHeadline.prototype, "verb", 2);
|
|
4171
|
+
__decorateClass([
|
|
4172
|
+
n4({ type: String })
|
|
4173
|
+
], ConsentHeadline.prototype, "description", 2);
|
|
4174
|
+
__decorateClass([
|
|
4175
|
+
n4({ type: String })
|
|
4176
|
+
], ConsentHeadline.prototype, "eyebrow", 2);
|
|
4177
|
+
__decorateClass([
|
|
4178
|
+
n4({ type: Boolean, reflect: true })
|
|
4179
|
+
], ConsentHeadline.prototype, "preview", 2);
|
|
4180
|
+
__decorateClass([
|
|
4181
|
+
n4({ type: Boolean, reflect: true })
|
|
4182
|
+
], ConsentHeadline.prototype, "editable", 2);
|
|
4183
|
+
__decorateClass([
|
|
4184
|
+
n4({ attribute: false })
|
|
4185
|
+
], ConsentHeadline.prototype, "editSource", 2);
|
|
4186
|
+
__decorateClass([
|
|
4187
|
+
r5()
|
|
4188
|
+
], ConsentHeadline.prototype, "hostHeadline", 2);
|
|
4189
|
+
ConsentHeadline = __decorateClass([
|
|
3566
4190
|
t3("consent-headline")
|
|
3567
4191
|
], ConsentHeadline);
|
|
3568
4192
|
|
|
@@ -3644,10 +4268,16 @@ var ConsentCapabilityCard = class extends i4 {
|
|
|
3644
4268
|
this.disabled = false;
|
|
3645
4269
|
this.scopes = [];
|
|
3646
4270
|
this.compiledCedar = "";
|
|
4271
|
+
this.showIcon = false;
|
|
4272
|
+
this.preview = false;
|
|
4273
|
+
this.editable = false;
|
|
3647
4274
|
this.policyOpen = false;
|
|
3648
4275
|
}
|
|
4276
|
+
willUpdate() {
|
|
4277
|
+
warnIfEditableWithoutPreview(this);
|
|
4278
|
+
}
|
|
3649
4279
|
toggleChecked() {
|
|
3650
|
-
if (this.disabled) return;
|
|
4280
|
+
if (this.disabled || isEditing(this)) return;
|
|
3651
4281
|
this.checked = !this.checked;
|
|
3652
4282
|
const detail = {
|
|
3653
4283
|
id: this.capabilityId,
|
|
@@ -3687,6 +4317,26 @@ var ConsentCapabilityCard = class extends i4 {
|
|
|
3687
4317
|
event?.stopPropagation();
|
|
3688
4318
|
this.policyOpen = !this.policyOpen;
|
|
3689
4319
|
}
|
|
4320
|
+
/** The label, as a region in edit mode. */
|
|
4321
|
+
labelText() {
|
|
4322
|
+
if (!isEditing(this)) return this.label;
|
|
4323
|
+
return editRegion(
|
|
4324
|
+
CONSENT_EDIT_KEYS.capabilityLabel(this.capabilityId),
|
|
4325
|
+
CONSENT_COPY_TOKENS.editRegions.capabilityLabel,
|
|
4326
|
+
this.label,
|
|
4327
|
+
this.editSource
|
|
4328
|
+
);
|
|
4329
|
+
}
|
|
4330
|
+
/** The description, as a region in edit mode. */
|
|
4331
|
+
descriptionText() {
|
|
4332
|
+
if (!isEditing(this)) return this.description;
|
|
4333
|
+
return editRegion(
|
|
4334
|
+
CONSENT_EDIT_KEYS.capabilityDescription(this.capabilityId),
|
|
4335
|
+
CONSENT_COPY_TOKENS.editRegions.capabilityDescription,
|
|
4336
|
+
this.description,
|
|
4337
|
+
this.editSource
|
|
4338
|
+
);
|
|
4339
|
+
}
|
|
3690
4340
|
isHigherRisk() {
|
|
3691
4341
|
return this.riskLevel === "high" || this.riskLevel === "critical";
|
|
3692
4342
|
}
|
|
@@ -3714,15 +4364,16 @@ var ConsentCapabilityCard = class extends i4 {
|
|
|
3714
4364
|
}
|
|
3715
4365
|
render() {
|
|
3716
4366
|
const tokens = CONSENT_COPY_TOKENS.capabilityRow;
|
|
4367
|
+
const editing = isEditing(this);
|
|
3717
4368
|
return b2`
|
|
3718
4369
|
<div
|
|
3719
|
-
class="row"
|
|
4370
|
+
class="row${editing ? " editing" : ""}"
|
|
3720
4371
|
part="row"
|
|
3721
|
-
role
|
|
3722
|
-
aria-labelledby=${this.isHigherRisk() ? "label risk" : "label"}
|
|
3723
|
-
aria-describedby
|
|
3724
|
-
tabindex=${this.disabled ? "-1" : "0"}
|
|
3725
|
-
aria-disabled=${String(this.disabled)}
|
|
4372
|
+
role=${editing ? A : "button"}
|
|
4373
|
+
aria-labelledby=${editing ? A : this.isHigherRisk() ? "label risk" : "label"}
|
|
4374
|
+
aria-describedby=${editing ? A : "description"}
|
|
4375
|
+
tabindex=${editing ? A : this.disabled ? "-1" : "0"}
|
|
4376
|
+
aria-disabled=${editing ? A : String(this.disabled)}
|
|
3726
4377
|
@click=${this.onRowClick}
|
|
3727
4378
|
@keydown=${(e10) => {
|
|
3728
4379
|
if (e10.target === e10.currentTarget && (e10.key === " " || e10.key === "Enter")) {
|
|
@@ -3745,17 +4396,29 @@ var ConsentCapabilityCard = class extends i4 {
|
|
|
3745
4396
|
type="button"
|
|
3746
4397
|
tabindex="-1"
|
|
3747
4398
|
>
|
|
3748
|
-
${this.checked ? b2`<
|
|
4399
|
+
${this.checked ? b2`<svg
|
|
4400
|
+
class="check-mark"
|
|
4401
|
+
part="check"
|
|
4402
|
+
viewBox="0 0 24 24"
|
|
4403
|
+
fill="none"
|
|
4404
|
+
stroke="currentColor"
|
|
4405
|
+
stroke-width="3"
|
|
4406
|
+
stroke-linecap="round"
|
|
4407
|
+
stroke-linejoin="round"
|
|
4408
|
+
aria-hidden="true"
|
|
4409
|
+
>
|
|
4410
|
+
<path d="M20 6 9 17l-5-5" />
|
|
4411
|
+
</svg>` : A}
|
|
3749
4412
|
</button>
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
4413
|
+
${this.showIcon ? b2`<div class="icon-tile" part="icon" aria-hidden="true">
|
|
4414
|
+
${this.renderIcon()}
|
|
4415
|
+
</div>` : A}
|
|
3753
4416
|
<div class="body" part="body">
|
|
3754
4417
|
<div class="row-label" part="label-row">
|
|
3755
|
-
<span part="label-text"
|
|
3756
|
-
><strong id="label" part="label">${this.
|
|
4418
|
+
<span class="label-text" part="label-text"
|
|
4419
|
+
><strong id="label" part="label">${this.labelText()}</strong>
|
|
3757
4420
|
<span id="description" class="description" part="description"
|
|
3758
|
-
>${this.
|
|
4421
|
+
>${this.descriptionText()}</span
|
|
3759
4422
|
></span
|
|
3760
4423
|
>
|
|
3761
4424
|
${this.isHigherRisk() ? b2`<span id="risk" class="risk-chip" part="risk"
|
|
@@ -3783,6 +4446,8 @@ var ConsentCapabilityCard = class extends i4 {
|
|
|
3783
4446
|
}
|
|
3784
4447
|
};
|
|
3785
4448
|
ConsentCapabilityCard.styles = i`
|
|
4449
|
+
${editRegionStyles}
|
|
4450
|
+
|
|
3786
4451
|
:host {
|
|
3787
4452
|
display: block;
|
|
3788
4453
|
border-bottom: 1px solid var(--cs-surface-border, rgba(15, 23, 42, 0.08));
|
|
@@ -3794,7 +4459,7 @@ ConsentCapabilityCard.styles = i`
|
|
|
3794
4459
|
|
|
3795
4460
|
.row {
|
|
3796
4461
|
display: grid;
|
|
3797
|
-
grid-template-columns: 22px
|
|
4462
|
+
grid-template-columns: 22px minmax(0, 1fr);
|
|
3798
4463
|
gap: 14px;
|
|
3799
4464
|
padding: 16px 0;
|
|
3800
4465
|
align-items: flex-start;
|
|
@@ -3806,6 +4471,10 @@ ConsentCapabilityCard.styles = i`
|
|
|
3806
4471
|
border-radius: 8px;
|
|
3807
4472
|
}
|
|
3808
4473
|
|
|
4474
|
+
:host([show-icon]) .row {
|
|
4475
|
+
grid-template-columns: 22px 36px minmax(0, 1fr);
|
|
4476
|
+
}
|
|
4477
|
+
|
|
3809
4478
|
.row:hover {
|
|
3810
4479
|
background: var(--cs-row-hover-bg, rgba(15, 23, 42, 0.025));
|
|
3811
4480
|
}
|
|
@@ -3827,6 +4496,19 @@ ConsentCapabilityCard.styles = i`
|
|
|
3827
4496
|
overflow-wrap: anywhere;
|
|
3828
4497
|
}
|
|
3829
4498
|
|
|
4499
|
+
.scopes code {
|
|
4500
|
+
display: inline-block;
|
|
4501
|
+
padding: 0 4px;
|
|
4502
|
+
border-radius: 4px;
|
|
4503
|
+
border: 1px solid
|
|
4504
|
+
var(--cs-scope-border, var(--cs-surface-border, rgba(15, 23, 42, 0.1)));
|
|
4505
|
+
background: var(
|
|
4506
|
+
--cs-scope-bg,
|
|
4507
|
+
color-mix(in srgb, var(--cs-text-primary, #0f172a) 4%, transparent)
|
|
4508
|
+
);
|
|
4509
|
+
color: var(--cs-text-primary, #0f172a);
|
|
4510
|
+
}
|
|
4511
|
+
|
|
3830
4512
|
.checkbox {
|
|
3831
4513
|
width: 22px;
|
|
3832
4514
|
height: 22px;
|
|
@@ -3854,9 +4536,10 @@ ConsentCapabilityCard.styles = i`
|
|
|
3854
4536
|
}
|
|
3855
4537
|
|
|
3856
4538
|
.check-mark {
|
|
4539
|
+
display: block;
|
|
4540
|
+
width: 16px;
|
|
4541
|
+
height: 16px;
|
|
3857
4542
|
color: var(--cs-surface-accent-text, #fff);
|
|
3858
|
-
font-size: 14px;
|
|
3859
|
-
line-height: 1;
|
|
3860
4543
|
}
|
|
3861
4544
|
|
|
3862
4545
|
.icon-tile {
|
|
@@ -3867,7 +4550,7 @@ ConsentCapabilityCard.styles = i`
|
|
|
3867
4550
|
display: flex;
|
|
3868
4551
|
align-items: center;
|
|
3869
4552
|
justify-content: center;
|
|
3870
|
-
color: var(--cs-text-secondary, #334155);
|
|
4553
|
+
color: var(--cs-icon, var(--cs-text-secondary, #334155));
|
|
3871
4554
|
}
|
|
3872
4555
|
|
|
3873
4556
|
.icon-tile svg {
|
|
@@ -3883,27 +4566,40 @@ ConsentCapabilityCard.styles = i`
|
|
|
3883
4566
|
}
|
|
3884
4567
|
|
|
3885
4568
|
.row-label {
|
|
3886
|
-
display:
|
|
4569
|
+
display: grid;
|
|
4570
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
4571
|
+
grid-template-areas:
|
|
4572
|
+
"label risk"
|
|
4573
|
+
"description description";
|
|
4574
|
+
column-gap: 12px;
|
|
4575
|
+
row-gap: 0;
|
|
3887
4576
|
align-items: center;
|
|
3888
|
-
gap: 10px;
|
|
3889
|
-
flex-wrap: wrap;
|
|
3890
4577
|
font-size: 14.5px;
|
|
3891
4578
|
color: var(--cs-text-primary, #0f172a);
|
|
3892
4579
|
line-height: 1.45;
|
|
3893
4580
|
}
|
|
3894
4581
|
|
|
4582
|
+
.label-text {
|
|
4583
|
+
display: contents;
|
|
4584
|
+
}
|
|
4585
|
+
|
|
3895
4586
|
.row-label strong {
|
|
4587
|
+
grid-area: label;
|
|
3896
4588
|
font-weight: 600;
|
|
3897
4589
|
}
|
|
3898
4590
|
|
|
3899
4591
|
.description {
|
|
4592
|
+
grid-area: description;
|
|
4593
|
+
font-size: 14px;
|
|
3900
4594
|
color: var(--cs-text-secondary, #334155);
|
|
3901
4595
|
}
|
|
3902
4596
|
|
|
3903
4597
|
.risk-chip {
|
|
4598
|
+
grid-area: risk;
|
|
4599
|
+
justify-self: end;
|
|
3904
4600
|
display: inline-flex;
|
|
3905
4601
|
padding: 2px 8px;
|
|
3906
|
-
border-radius:
|
|
4602
|
+
border-radius: 4px;
|
|
3907
4603
|
font-size: 10.5px;
|
|
3908
4604
|
font-weight: 700;
|
|
3909
4605
|
letter-spacing: 0.06em;
|
|
@@ -3918,7 +4614,7 @@ ConsentCapabilityCard.styles = i`
|
|
|
3918
4614
|
padding: 0;
|
|
3919
4615
|
font-size: 12px;
|
|
3920
4616
|
font-weight: 500;
|
|
3921
|
-
color: var(--cs-text-tertiary, #
|
|
4617
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
3922
4618
|
text-decoration: underline;
|
|
3923
4619
|
text-underline-offset: 2px;
|
|
3924
4620
|
cursor: pointer;
|
|
@@ -3946,7 +4642,7 @@ ConsentCapabilityCard.styles = i`
|
|
|
3946
4642
|
font-size: 11px;
|
|
3947
4643
|
letter-spacing: 0.08em;
|
|
3948
4644
|
text-transform: uppercase;
|
|
3949
|
-
color: var(--cs-text-tertiary, #
|
|
4645
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
3950
4646
|
}
|
|
3951
4647
|
|
|
3952
4648
|
.policy-disclosure pre {
|
|
@@ -3963,6 +4659,16 @@ ConsentCapabilityCard.styles = i`
|
|
|
3963
4659
|
margin: 0;
|
|
3964
4660
|
padding-left: 18px;
|
|
3965
4661
|
}
|
|
4662
|
+
|
|
4663
|
+
/* In edit mode the row is not a toggle, so it does not look like one. */
|
|
4664
|
+
.row.editing,
|
|
4665
|
+
.row.editing .checkbox {
|
|
4666
|
+
cursor: default;
|
|
4667
|
+
}
|
|
4668
|
+
|
|
4669
|
+
.row.editing:hover {
|
|
4670
|
+
background: transparent;
|
|
4671
|
+
}
|
|
3966
4672
|
`;
|
|
3967
4673
|
__decorateClass([
|
|
3968
4674
|
n4({ type: String })
|
|
@@ -3991,6 +4697,18 @@ __decorateClass([
|
|
|
3991
4697
|
__decorateClass([
|
|
3992
4698
|
n4({ type: String, attribute: "compiled-cedar" })
|
|
3993
4699
|
], ConsentCapabilityCard.prototype, "compiledCedar", 2);
|
|
4700
|
+
__decorateClass([
|
|
4701
|
+
n4({ type: Boolean, reflect: true, attribute: "show-icon" })
|
|
4702
|
+
], ConsentCapabilityCard.prototype, "showIcon", 2);
|
|
4703
|
+
__decorateClass([
|
|
4704
|
+
n4({ type: Boolean, reflect: true })
|
|
4705
|
+
], ConsentCapabilityCard.prototype, "preview", 2);
|
|
4706
|
+
__decorateClass([
|
|
4707
|
+
n4({ type: Boolean, reflect: true })
|
|
4708
|
+
], ConsentCapabilityCard.prototype, "editable", 2);
|
|
4709
|
+
__decorateClass([
|
|
4710
|
+
n4({ attribute: false })
|
|
4711
|
+
], ConsentCapabilityCard.prototype, "editSource", 2);
|
|
3994
4712
|
__decorateClass([
|
|
3995
4713
|
r5()
|
|
3996
4714
|
], ConsentCapabilityCard.prototype, "policyOpen", 2);
|
|
@@ -4205,15 +4923,20 @@ var ConsentActionBar = class extends i4 {
|
|
|
4205
4923
|
this.cancelLabel = "";
|
|
4206
4924
|
this.submitIcon = "";
|
|
4207
4925
|
this.loadingLabel = "";
|
|
4926
|
+
this.preview = false;
|
|
4927
|
+
this.editable = false;
|
|
4928
|
+
}
|
|
4929
|
+
willUpdate() {
|
|
4930
|
+
warnIfEditableWithoutPreview(this);
|
|
4208
4931
|
}
|
|
4209
4932
|
emitAllow() {
|
|
4210
|
-
if (this.disabled || this.loading) return;
|
|
4933
|
+
if (this.disabled || this.loading || this.preview) return;
|
|
4211
4934
|
this.dispatchEvent(
|
|
4212
4935
|
new CustomEvent("consent-allow", { bubbles: true, composed: true })
|
|
4213
4936
|
);
|
|
4214
4937
|
}
|
|
4215
4938
|
emitDeny() {
|
|
4216
|
-
if (this.loading) return;
|
|
4939
|
+
if (this.loading || this.preview) return;
|
|
4217
4940
|
this.dispatchEvent(
|
|
4218
4941
|
new CustomEvent("consent-deny", { bubbles: true, composed: true })
|
|
4219
4942
|
);
|
|
@@ -4224,30 +4947,19 @@ var ConsentActionBar = class extends i4 {
|
|
|
4224
4947
|
})} \u2192`);
|
|
4225
4948
|
const submitLabel = this.loading && this.loadingLabel ? this.loadingLabel : allowLabel;
|
|
4226
4949
|
const denyLabel = this.cancelLabel || (this.theme === "dark" ? CONSENT_COPY_TOKENS.actions.deny : CONSENT_COPY_TOKENS.actions.notNow);
|
|
4950
|
+
if (isEditing(this)) return this.renderBoxes(allowLabel, denyLabel);
|
|
4227
4951
|
return b2`
|
|
4228
4952
|
<button
|
|
4229
|
-
class="primary"
|
|
4953
|
+
class="action primary"
|
|
4230
4954
|
part="submit"
|
|
4231
4955
|
type="button"
|
|
4232
4956
|
?disabled=${this.disabled || this.loading}
|
|
4233
4957
|
@click=${this.emitAllow}
|
|
4234
4958
|
>
|
|
4235
|
-
${this.
|
|
4236
|
-
part="submit-icon"
|
|
4237
|
-
class="submit-icon"
|
|
4238
|
-
viewBox="0 0 24 24"
|
|
4239
|
-
fill="none"
|
|
4240
|
-
stroke="currentColor"
|
|
4241
|
-
stroke-width="2"
|
|
4242
|
-
stroke-linecap="round"
|
|
4243
|
-
stroke-linejoin="round"
|
|
4244
|
-
aria-hidden="true"
|
|
4245
|
-
>
|
|
4246
|
-
${fingerprintIcon}
|
|
4247
|
-
</svg>` : A}${submitLabel}
|
|
4959
|
+
${this.renderSubmitIcon()}${submitLabel}
|
|
4248
4960
|
</button>
|
|
4249
4961
|
<button
|
|
4250
|
-
class="secondary"
|
|
4962
|
+
class="action secondary"
|
|
4251
4963
|
part="cancel"
|
|
4252
4964
|
type="button"
|
|
4253
4965
|
?disabled=${this.loading}
|
|
@@ -4257,8 +4969,57 @@ var ConsentActionBar = class extends i4 {
|
|
|
4257
4969
|
</button>
|
|
4258
4970
|
`;
|
|
4259
4971
|
}
|
|
4972
|
+
/**
|
|
4973
|
+
* Edit mode: the buttons as boxes with the same classes and parts, each
|
|
4974
|
+
* label a region. A disabled Allow looks disabled, as it would live.
|
|
4975
|
+
*/
|
|
4976
|
+
renderBoxes(allowLabel, denyLabel) {
|
|
4977
|
+
const tokens = CONSENT_COPY_TOKENS.editRegions;
|
|
4978
|
+
return b2`
|
|
4979
|
+
<div
|
|
4980
|
+
class="action primary${this.disabled || this.loading ? " disabled" : ""}"
|
|
4981
|
+
part="submit"
|
|
4982
|
+
>
|
|
4983
|
+
${this.renderSubmitIcon()}${editRegion(
|
|
4984
|
+
CONSENT_EDIT_KEYS.submitLabel,
|
|
4985
|
+
tokens.submitLabel,
|
|
4986
|
+
allowLabel,
|
|
4987
|
+
this.editSource
|
|
4988
|
+
)}
|
|
4989
|
+
</div>
|
|
4990
|
+
<div
|
|
4991
|
+
class="action secondary${this.loading ? " disabled" : ""}"
|
|
4992
|
+
part="cancel"
|
|
4993
|
+
>
|
|
4994
|
+
${editRegion(
|
|
4995
|
+
CONSENT_EDIT_KEYS.cancelLabel,
|
|
4996
|
+
tokens.cancelLabel,
|
|
4997
|
+
denyLabel,
|
|
4998
|
+
this.editSource
|
|
4999
|
+
)}
|
|
5000
|
+
</div>
|
|
5001
|
+
`;
|
|
5002
|
+
}
|
|
5003
|
+
renderSubmitIcon() {
|
|
5004
|
+
if (this.submitIcon !== "passkey") return A;
|
|
5005
|
+
return b2`<svg
|
|
5006
|
+
part="submit-icon"
|
|
5007
|
+
class="submit-icon"
|
|
5008
|
+
viewBox="0 0 24 24"
|
|
5009
|
+
fill="none"
|
|
5010
|
+
stroke="currentColor"
|
|
5011
|
+
stroke-width="2"
|
|
5012
|
+
stroke-linecap="round"
|
|
5013
|
+
stroke-linejoin="round"
|
|
5014
|
+
aria-hidden="true"
|
|
5015
|
+
>
|
|
5016
|
+
${fingerprintIcon}
|
|
5017
|
+
</svg>`;
|
|
5018
|
+
}
|
|
4260
5019
|
};
|
|
4261
5020
|
ConsentActionBar.styles = i`
|
|
5021
|
+
${editRegionStyles}
|
|
5022
|
+
|
|
4262
5023
|
:host {
|
|
4263
5024
|
display: flex;
|
|
4264
5025
|
flex-direction: column;
|
|
@@ -4266,13 +5027,25 @@ ConsentActionBar.styles = i`
|
|
|
4266
5027
|
width: 100%;
|
|
4267
5028
|
}
|
|
4268
5029
|
|
|
4269
|
-
button
|
|
5030
|
+
/* A button, or in edit mode a box, set out in full so both draw alike. */
|
|
5031
|
+
.action {
|
|
5032
|
+
box-sizing: border-box;
|
|
5033
|
+
display: block;
|
|
4270
5034
|
width: 100%;
|
|
5035
|
+
margin: 0;
|
|
4271
5036
|
padding: 14px 18px;
|
|
4272
|
-
border-radius: var(--cs-action-radius,
|
|
5037
|
+
border-radius: var(--cs-action-radius, 6px);
|
|
4273
5038
|
font-size: var(--cs-action-font-size, 15px);
|
|
4274
5039
|
font-weight: 500;
|
|
4275
5040
|
font-family: inherit;
|
|
5041
|
+
font-style: normal;
|
|
5042
|
+
line-height: normal;
|
|
5043
|
+
letter-spacing: normal;
|
|
5044
|
+
word-spacing: normal;
|
|
5045
|
+
text-align: center;
|
|
5046
|
+
text-indent: 0;
|
|
5047
|
+
text-transform: none;
|
|
5048
|
+
text-shadow: none;
|
|
4276
5049
|
cursor: pointer;
|
|
4277
5050
|
transition:
|
|
4278
5051
|
opacity 0.15s ease,
|
|
@@ -4280,11 +5053,17 @@ ConsentActionBar.styles = i`
|
|
|
4280
5053
|
border: none;
|
|
4281
5054
|
}
|
|
4282
5055
|
|
|
4283
|
-
|
|
5056
|
+
.action:disabled,
|
|
5057
|
+
.action.disabled {
|
|
4284
5058
|
opacity: 0.5;
|
|
4285
5059
|
cursor: not-allowed;
|
|
4286
5060
|
}
|
|
4287
5061
|
|
|
5062
|
+
div.action,
|
|
5063
|
+
div.action.disabled {
|
|
5064
|
+
cursor: default;
|
|
5065
|
+
}
|
|
5066
|
+
|
|
4288
5067
|
button:focus-visible {
|
|
4289
5068
|
outline: 2px solid var(--cs-focus-ring, #0f172a);
|
|
4290
5069
|
outline-offset: 3px;
|
|
@@ -4300,7 +5079,7 @@ ConsentActionBar.styles = i`
|
|
|
4300
5079
|
color: var(--cs-surface-accent-text, #ffffff);
|
|
4301
5080
|
}
|
|
4302
5081
|
|
|
4303
|
-
.primary:hover:not(:disabled) {
|
|
5082
|
+
button.primary:hover:not(:disabled) {
|
|
4304
5083
|
opacity: 0.92;
|
|
4305
5084
|
}
|
|
4306
5085
|
|
|
@@ -4317,7 +5096,7 @@ ConsentActionBar.styles = i`
|
|
|
4317
5096
|
font-weight: 500;
|
|
4318
5097
|
}
|
|
4319
5098
|
|
|
4320
|
-
.secondary:hover:not(:disabled) {
|
|
5099
|
+
button.secondary:hover:not(:disabled) {
|
|
4321
5100
|
color: var(--cs-text-primary, #0f172a);
|
|
4322
5101
|
}
|
|
4323
5102
|
`;
|
|
@@ -4345,6 +5124,15 @@ __decorateClass([
|
|
|
4345
5124
|
__decorateClass([
|
|
4346
5125
|
n4({ type: String, attribute: "loading-label" })
|
|
4347
5126
|
], ConsentActionBar.prototype, "loadingLabel", 2);
|
|
5127
|
+
__decorateClass([
|
|
5128
|
+
n4({ type: Boolean, reflect: true })
|
|
5129
|
+
], ConsentActionBar.prototype, "preview", 2);
|
|
5130
|
+
__decorateClass([
|
|
5131
|
+
n4({ type: Boolean, reflect: true })
|
|
5132
|
+
], ConsentActionBar.prototype, "editable", 2);
|
|
5133
|
+
__decorateClass([
|
|
5134
|
+
n4({ attribute: false })
|
|
5135
|
+
], ConsentActionBar.prototype, "editSource", 2);
|
|
4348
5136
|
ConsentActionBar = __decorateClass([
|
|
4349
5137
|
t3("consent-action-bar")
|
|
4350
5138
|
], ConsentActionBar);
|
|
@@ -4352,12 +5140,12 @@ ConsentActionBar = __decorateClass([
|
|
|
4352
5140
|
// src/components/consent-footer.ts
|
|
4353
5141
|
var ConsentFooter = class extends i4 {
|
|
4354
5142
|
constructor() {
|
|
4355
|
-
super(
|
|
4356
|
-
this.theme = "light";
|
|
5143
|
+
super();
|
|
4357
5144
|
this.howItWorksUrl = "";
|
|
5145
|
+
this.preview = false;
|
|
5146
|
+
guardPreviewNavigation(this);
|
|
4358
5147
|
}
|
|
4359
5148
|
render() {
|
|
4360
|
-
const attribution = this.theme === "dark" ? CONSENT_COPY_TOKENS.attribution.securedBy : CONSENT_COPY_TOKENS.attribution.protectedBy;
|
|
4361
5149
|
return b2`
|
|
4362
5150
|
<span class="left">
|
|
4363
5151
|
<svg
|
|
@@ -4372,7 +5160,7 @@ var ConsentFooter = class extends i4 {
|
|
|
4372
5160
|
>
|
|
4373
5161
|
<path d="m3.5 8.5 3 3 6-6.5" />
|
|
4374
5162
|
</svg>
|
|
4375
|
-
${attribution}
|
|
5163
|
+
${CONSENT_COPY_TOKENS.attribution.byLine}
|
|
4376
5164
|
</span>
|
|
4377
5165
|
${sanitizeLinkUrl(this.howItWorksUrl) ? b2`<a
|
|
4378
5166
|
class="how"
|
|
@@ -4398,7 +5186,7 @@ ConsentFooter.styles = i`
|
|
|
4398
5186
|
gap: 6px 16px;
|
|
4399
5187
|
padding-top: 12px;
|
|
4400
5188
|
font-size: 12px;
|
|
4401
|
-
color: var(--cs-text-tertiary, #
|
|
5189
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
4402
5190
|
border-top: 1px solid var(--cs-surface-border, transparent);
|
|
4403
5191
|
}
|
|
4404
5192
|
|
|
@@ -4429,16 +5217,96 @@ ConsentFooter.styles = i`
|
|
|
4429
5217
|
color: var(--cs-text-primary, #0f172a);
|
|
4430
5218
|
}
|
|
4431
5219
|
`;
|
|
4432
|
-
__decorateClass([
|
|
4433
|
-
n4({ type: String })
|
|
4434
|
-
], ConsentFooter.prototype, "theme", 2);
|
|
4435
5220
|
__decorateClass([
|
|
4436
5221
|
n4({ type: String })
|
|
4437
5222
|
], ConsentFooter.prototype, "howItWorksUrl", 2);
|
|
5223
|
+
__decorateClass([
|
|
5224
|
+
n4({ type: Boolean, reflect: true })
|
|
5225
|
+
], ConsentFooter.prototype, "preview", 2);
|
|
4438
5226
|
ConsentFooter = __decorateClass([
|
|
4439
5227
|
t3("consent-footer")
|
|
4440
5228
|
], ConsentFooter);
|
|
4441
5229
|
|
|
5230
|
+
// src/components/consent-secured-by.ts
|
|
5231
|
+
var ARTWORK_WIDTH = 676.3;
|
|
5232
|
+
var ARTWORK_HEIGHT = 272.2;
|
|
5233
|
+
var LOCKUP_HEIGHT = 40;
|
|
5234
|
+
var LETTER_BASELINE = 141;
|
|
5235
|
+
var TAGLINE_LEFT = 252;
|
|
5236
|
+
var LOCKUP_ART = w`<g><path opacity=".4" d="M175.7,252.4c-3.2-5.6-6.4-11.1-9.6-16.7-1.7-3.1-3.3-6.3-5.1-9.4-3.9-6.8-7.8-13.7-11.7-20.5-2.6-4.7-5.3-9.4-7.9-14.1-.2-.3-.4-.5-.7-.9-.2.2-.4.4-.4.5-4.1,7.2-8.2,14.3-12.3,21.4-5,8.6-9.9,17.2-14.8,25.8-4.4,7.8-8.9,15.5-13.3,23.3-2,3.4-3.9,6.9-5.9,10.4h28.8-.2c5.6-9.9,11.3-19.7,16.9-29.6.3-.4.5-.7.9-1.2h0c.3.5.6.8.8,1.1,2.1,3.8,4.2,7.7,6.3,11.5,3.4,6,6.8,12,10.1,18.1h28.9l-5.6-9.9c-1.8-3.2-3.6-6.5-5.4-9.7h.2Z" /><path opacity=".6" d="M86.1,189.9H16l14.3,24.7c11.8,0,23.6-.1,35.5-.2.4,0,.8,0,1.4.2,0,.1,0,.2,0,.3h.2c-.3.5-.4.9-.6,1.2h0c-2.3,3.7-4.6,7.4-6.8,11.2-3.8,6.3-7.5,12.7-11.3,19l-.2-.3h0l14.6,25.1,6.6-11h0l.2.2c1.9-3.2,3.8-6.4,5.7-9.6,3.3-5.5,6.4-11.1,9.7-16.7,1.8-3.1,3.8-6.1,5.6-9.2,4-6.8,7.9-13.6,11.9-20.4,2.7-4.6,5.5-9.3,8.2-13.9l.3-.6h-25.2,0Z" /><path opacity=".8" d="M85,142.3c-5-8.6-9.9-17.1-14.9-25.7-4.5-7.8-9-15.5-13.5-23.2-2.8-4.8-5.6-9.6-8.4-14.4v-.2q0,0,0,0l-14.5,25.3c0,.2.2.4.4.6,6.3,10.8,12.6,21.7,19,32.5.2.4.3.8.6,1.3h-1.4c-4.3,0-8.4-.2-12.7-.3h-1.4c-7.3,0-14.7-.2-22-.3h-1.9L0,162.7l.3.4,15.1.2h0c3.7,0,7.4.1,11.2.2h19.3c3.6,0,7.2.2,10.8.3,7.9,0,15.7,0,23.6.1,5.4,0,10.8,0,16.2.2h.9c0-.2,0-.3,0-.4-4.2-7.1-8.3-14.2-12.4-21.3h0Z" /><path opacity=".2" d="M238.1,166.4c-3.8-.2-7.5-.2-11.2-.2h-19.3c-3.6-.1-7.2-.3-10.8-.3h-23.6c-5.4,0-10.8-.2-16.2-.2s-.7,0-1.1,0v.4c4.1,7.1,8.2,14.2,12.4,21.3,5,8.6,9.9,17.1,14.9,25.7,4.5,7.7,9,15.5,13.5,23.2,2.3,4,4.6,8,7,12l14.5-25.3c-6-10.2-11.9-20.4-17.9-30.6-.2-.4-.4-.8-.6-1.3.6,0,.9-.1,1.3-.1s.2,0,.3,0h.2c4.2,0,8.3.2,12.5.3h.5c7.2,0,14.5.2,21.8.2l14.2-24.8-12.3-.2h-.1,0Z" /></g><path d="M676.4,36.5c0-.8,0-1.2-1.1-1.2h-18.8c-6.3,0-1.2.2-1.2,1.2v31.6c0,9.7-.2.6-.2,1h0c-.5-.5-.9-.7-1.2-1-2.6-2.4-5.6-4.2-8.8-5.5-6.8-2.7-13.8-2.8-20.9-1.5-10.2,1.9-18.1,7.5-23.5,16.4-5.7,9.2-7.3,19.3-5.9,30,.6,5,1.9,9.8,4.4,14.3,2.9,5.1,6.4,9.7,11.3,13.2,5,3.5,10.6,5.4,16.5,6.3,4.1.6,8.2.5,12.2-.3,6.6-1.2,12.3-4.1,16.7-9.3.2-.4.5-.7.8-1,.2.4.2.7.2,1.1v7c0,.7.2,1,1,1h17.5c.8,0,.9-.3.9-1.1-.2-1.5-.2-3-.2-4.5V40.3c0-1.3.2-2.5.2-3.8h0ZM651.1,114.9c-4.5,5.5-10.4,7.9-17.5,7.1-9.6-1.1-16.6-8.8-17.6-18.7-.4-4.6.3-8.9,2.2-12.9,2.8-5.8,7.5-9.4,13.8-10.6,7.3-1.4,13.7.6,18.6,6.3,3.6,4.1,5,9.2,5,13.1,0,6.8-1.2,11.6-4.5,15.7Z" /><path d="M477.7,63.2c-6.1-3.1-12.5-3.4-19.1-2.5-5.7.8-10.8,3.2-15.1,7.1-.2,0-.4.3-.6.4h0c0,0-.3,0-.3,0v-32c0-.6-.2-.9-.9-.9h-19.4c-.8,0-1.1.3-1.1,1.1v102.4c0,.8,0,1.1,1,1.1h19.4c.7,0,1,0,1-.9v-43.3c0-1.7.2-3.5.6-5.2,2.8-11,15.5-13.7,23-8,3.9,2.9,5.4,7.2,5.4,12v44.2c0,.9.2,1.2,1.2,1.2h19.1c.8,0,1.1-.2,1.1-1v-45.2c0-4.6-.4-9.2-1.7-13.7-2.2-7.6-6.7-13.1-13.7-16.7h.1Z" /><path d="M561.6,63.2c-7.5-3.4-15.4-3.9-23.4-2.5-12.8,2.3-22.4,9.2-28.5,20.8-4.1,7.7-5.4,15.9-4.3,24.5.8,6,2.5,11.6,6,16.7,4.8,7,11,12.1,18.8,15.4,3.1,1.4,6.3,2,9.6,2.6,4.8.9,9.6.9,14.4.3,9.1-1.2,17-4.9,24-10.6.5-.4.6-.8.2-1.4-2.7-4.3-5.4-8.7-8-13.1-.4-.6-.6-.7-1.2-.2-2.9,2.3-6.1,4.1-9.5,5.5-5.1,2.1-10.3,2.3-15.7,1.7-3.1-.3-6-1.2-8.7-2.9-3.1-2-5.6-4.6-7.2-7.9-.6-1.3-1-2.6-1.6-4.1v-.2h53.4c.6,0,1.2,0,1.2-.8.4-3.3,1.1-6.5,1.1-9.8s-.3-6.2-.9-9.3c-2.2-11.7-9.1-19.8-19.7-24.7h0ZM559.8,92.9h-33.3v-.6c1.8-5.1,4.3-9.7,9.3-12.5,3.7-2.1,7.7-2.8,11.9-2.2,2.9.4,5.6,1.5,8,3.3,3.3,2.6,5.2,6.1,5.7,10.2.3,1.8.2,1.8-1.6,1.8h0Z" /><path d="M322.4,63c0-.9-.2-1.2-1.1-1.2-6.3,0-12.5,0-18.8,0s-1.3,0-1.3,1.3v44.3c0,4-1.3,7.7-4.3,10.4-4.8,4.5-10.4,5.2-16.4,2.7-5-2.1-8.2-7.4-8.2-13.2v-44.2c0-1.4,4.8-1.4-1.5-1.4h-19.1c-.7,0-.9.3-.9,1v41c0,3.4.3,6.8.9,10.1.4,2.6,1.3,5.1,2.4,7.5,4.2,9.4,11.4,15.5,21.2,18.5,8.1,2.5,16.3,2.4,24.3-.3,6.6-2.2,12-6,16.1-11.6,4.6-6.4,6.8-13.6,6.8-21.4v-20.7h0v-22.9h-.1Z" /><path d="M409.3,78c-3.9-6.5-9.4-11.4-16.3-14.5-9.1-4.1-18.5-4.5-28-2.1-11.2,2.8-19.8,9.3-25.5,19.4-2.8,5-4.3,10.4-4.8,16.1-.6,6-.1,12,2.1,17.6,3,7.7,7.6,14.1,14.5,18.9,3.7,2.7,7.8,4.8,12.2,6.1,5.6,1.7,11.2,2.2,17,1.6,7.1-.6,13.5-3,19.2-7.2,3.9-2.9,7.1-6.5,9.6-10.7.5-.8.5-1.4-.4-2-2.4-1.7-4.7-3.5-7-5.3-2-1.6-4-3.2-6-4.8-.4-.4-.9-.6-1.3,0-1.6,2.7-3.8,4.9-6.4,6.7-4.4,3.1-9,4.6-14.4,3.8-4.4-.7-8.3-2.3-11.4-5.5-6.1-6.3-7.5-13.8-5.3-22.1,3.3-12.1,16.2-17.3,26.8-13.1,3.7,1.5,6.5,4.1,9,7.1.7.9,1.4,1.9,2.2,2.9v-.2c4.7-3.6,9.2-7.2,13.8-10.7,1.1-.9,1.2-.9.4-2.1h0Z" /><path d="M237.5,89.5c-1.7-5.8-4.3-11.2-8.5-15.5-8.5-8.8-18.8-13.6-31.2-13.6s-6.5.3-9.6.9c-3.4.7-6.7,1.8-9.8,3.3-6.1,2.9-11.2,7.1-15.1,12.6-6.2,8.8-8.4,18.7-7,29.4.3,2.2.8,4.3,1.4,6.4.7,2.2,1.5,4.3,2.6,6.4,1.3,2.4,2.9,4.7,4.6,6.8,6,7.3,13.3,11.8,21.8,13.9,3.3.8,6.8,1.2,10.5,1.3v.2c4.2,0,8.2-.4,12.2-1.6,1.5-.4,3-1,4.5-1.6,13.4-5.7,21.6-15.7,24.5-29.9,1.3-6.4,1-12.7-.9-19ZM217.1,104.3c-.5,3.5-1.7,6.7-3.8,9.5-3.9,5.2-9.2,7.6-14.1,8-11.5,0-19.8-7-21.5-17-.8-4.8-.3-9.5,1.8-13.9,2.8-5.9,7.5-9.7,14-10.9,8.5-1.7,16.5,2,20.9,9.4,2.7,4.6,3.5,9.6,2.7,14.9h0Z" /><path d="M64,52.7l8.3,14.9c1.8,3.2,3.6,6.5,5.4,9.8,3.2,5.6,6.4,11.1,9.6,16.7,1.8,3.1,3.4,6.3,5.2,9.4,3.9,6.8,7.8,13.7,11.7,20.5,2.7,4.7,5.3,9.4,7.9,14.1.2.3.4.6.7.9.2-.3.3-.4.4-.5,4.1-7.1,8.2-14.2,12.3-21.3,4.9-8.6,9.9-17.2,14.8-25.8,4.4-7.8,8.9-15.5,13.3-23.3,4.4-7.8,8.9-15.5,13.3-23.3,1.9-3.4,3.8-6.9,5.7-10.3,3.6-6.2,7.3-12.5,10.9-18.7,2.9-5,5.6-10.1,8.5-15.1.2-.3.3-.6.3-.8h-28.9s0,.1-.1.2h0c-.8,1.4-1.6,2.8-2.4,4.1-.8,1.4-1.6,2.8-2.5,4.3-1.5,2.5-2.9,5.1-4.4,7.6-1,1.7-2,3.5-3,5.2-6.3,10.9-12.4,21.9-18.7,32.9v.2c-6.2,10.9-12.4,21.8-18.7,32.7-.2.4-.5.7-.8,1.2-.3-.5-.6-.8-.8-1.1-2.1-3.8-4.2-7.7-6.3-11.5-3.8-6.8-7.6-13.6-11.4-20.4h0l-1.2-2.3v-.2h-29.1Z" />`;
|
|
5237
|
+
var ConsentSecuredBy = class extends i4 {
|
|
5238
|
+
render() {
|
|
5239
|
+
const copy = CONSENT_COPY_TOKENS.attribution;
|
|
5240
|
+
return b2`<p class="secured-by" part="secured-by">
|
|
5241
|
+
<span class="label">${copy.securedBy}</span
|
|
5242
|
+
><span class="lockup"
|
|
5243
|
+
><svg
|
|
5244
|
+
part="lockup"
|
|
5245
|
+
viewBox="0 0 ${ARTWORK_WIDTH} ${ARTWORK_HEIGHT}"
|
|
5246
|
+
role="img"
|
|
5247
|
+
aria-label=${copy.lockup}
|
|
5248
|
+
>
|
|
5249
|
+
${LOCKUP_ART}</svg
|
|
5250
|
+
><span class="tagline" part="tagline">${copy.tagline}</span></span
|
|
5251
|
+
>
|
|
5252
|
+
</p>`;
|
|
5253
|
+
}
|
|
5254
|
+
};
|
|
5255
|
+
ConsentSecuredBy.styles = i`
|
|
5256
|
+
:host {
|
|
5257
|
+
display: block;
|
|
5258
|
+
}
|
|
5259
|
+
|
|
5260
|
+
.secured-by {
|
|
5261
|
+
display: flex;
|
|
5262
|
+
align-items: flex-start;
|
|
5263
|
+
justify-content: center;
|
|
5264
|
+
gap: 6px;
|
|
5265
|
+
margin: 0;
|
|
5266
|
+
font-size: 12px;
|
|
5267
|
+
line-height: 16px;
|
|
5268
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
5269
|
+
}
|
|
5270
|
+
|
|
5271
|
+
/* Drops "Secured by" onto the baseline of the lockup's letters. */
|
|
5272
|
+
.label {
|
|
5273
|
+
margin-top: calc(
|
|
5274
|
+
${LOCKUP_HEIGHT}px * ${LETTER_BASELINE} / ${ARTWORK_HEIGHT} - 0.5lh -
|
|
5275
|
+
0.375em
|
|
5276
|
+
);
|
|
5277
|
+
}
|
|
5278
|
+
|
|
5279
|
+
.lockup {
|
|
5280
|
+
display: grid;
|
|
5281
|
+
}
|
|
5282
|
+
|
|
5283
|
+
.lockup > * {
|
|
5284
|
+
grid-area: 1 / 1;
|
|
5285
|
+
}
|
|
5286
|
+
|
|
5287
|
+
.lockup svg {
|
|
5288
|
+
display: block;
|
|
5289
|
+
height: ${LOCKUP_HEIGHT}px;
|
|
5290
|
+
width: ${Math.round(ARTWORK_WIDTH * LOCKUP_HEIGHT / ARTWORK_HEIGHT)}px;
|
|
5291
|
+
fill: var(--cs-lockup, #0810fe);
|
|
5292
|
+
}
|
|
5293
|
+
|
|
5294
|
+
.tagline {
|
|
5295
|
+
align-self: end;
|
|
5296
|
+
margin-left: ${Math.round(
|
|
5297
|
+
TAGLINE_LEFT * LOCKUP_HEIGHT / ARTWORK_HEIGHT
|
|
5298
|
+
)}px;
|
|
5299
|
+
white-space: nowrap;
|
|
5300
|
+
font-size: 12px;
|
|
5301
|
+
font-weight: 600;
|
|
5302
|
+
line-height: 1;
|
|
5303
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
5304
|
+
}
|
|
5305
|
+
`;
|
|
5306
|
+
ConsentSecuredBy = __decorateClass([
|
|
5307
|
+
t3("consent-secured-by")
|
|
5308
|
+
], ConsentSecuredBy);
|
|
5309
|
+
|
|
4442
5310
|
// src/components/consent-revocation-notice.ts
|
|
4443
5311
|
var ConsentRevocationNotice = class extends i4 {
|
|
4444
5312
|
constructor() {
|
|
@@ -4505,7 +5373,7 @@ ConsentRevocationNotice.styles = i`
|
|
|
4505
5373
|
height: 16px;
|
|
4506
5374
|
flex-shrink: 0;
|
|
4507
5375
|
margin-top: 2px;
|
|
4508
|
-
color: var(--cs-text-tertiary, #
|
|
5376
|
+
color: var(--cs-icon, var(--cs-text-tertiary, #5d6c82));
|
|
4509
5377
|
}
|
|
4510
5378
|
|
|
4511
5379
|
.content {
|
|
@@ -4540,6 +5408,30 @@ ConsentRevocationNotice = __decorateClass([
|
|
|
4540
5408
|
], ConsentRevocationNotice);
|
|
4541
5409
|
|
|
4542
5410
|
// src/components/consent-connector-header.ts
|
|
5411
|
+
var SHIELD_CHECK = b2`<svg
|
|
5412
|
+
viewBox="0 0 24 24"
|
|
5413
|
+
fill="none"
|
|
5414
|
+
stroke="currentColor"
|
|
5415
|
+
stroke-width="2"
|
|
5416
|
+
stroke-linecap="round"
|
|
5417
|
+
stroke-linejoin="round"
|
|
5418
|
+
>
|
|
5419
|
+
<path
|
|
5420
|
+
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"
|
|
5421
|
+
/>
|
|
5422
|
+
<path d="m9 12 2 2 4-4" />
|
|
5423
|
+
</svg>`;
|
|
5424
|
+
var DOTS_SHIELD = b2`<svg
|
|
5425
|
+
viewBox="0 0 24 24"
|
|
5426
|
+
fill="none"
|
|
5427
|
+
stroke="currentColor"
|
|
5428
|
+
stroke-width="2.2"
|
|
5429
|
+
stroke-linecap="round"
|
|
5430
|
+
stroke-linejoin="round"
|
|
5431
|
+
>
|
|
5432
|
+
<path d="M12 3l8 3v5c0 4.5-3.5 8.5-8 10-4.5-1.5-8-5.5-8-10V6l8-3z" />
|
|
5433
|
+
<path d="m9 12 2 2 4-4" />
|
|
5434
|
+
</svg>`;
|
|
4543
5435
|
var ConsentConnectorHeader = class extends i4 {
|
|
4544
5436
|
constructor() {
|
|
4545
5437
|
super(...arguments);
|
|
@@ -4550,9 +5442,20 @@ var ConsentConnectorHeader = class extends i4 {
|
|
|
4550
5442
|
this.serverDomain = "";
|
|
4551
5443
|
this.serverLogoUrl = "";
|
|
4552
5444
|
this.logoDevToken = "";
|
|
5445
|
+
this.variant = "bridge";
|
|
5446
|
+
this.via = "";
|
|
4553
5447
|
this.clientImageOk = true;
|
|
4554
5448
|
this.serverImageOk = true;
|
|
4555
5449
|
}
|
|
5450
|
+
/** A logo that failed is tried again when its URL changes. */
|
|
5451
|
+
willUpdate(changed) {
|
|
5452
|
+
if (changed.has("clientLogoUrl") || changed.has("clientDid")) {
|
|
5453
|
+
this.clientImageOk = true;
|
|
5454
|
+
}
|
|
5455
|
+
if (changed.has("serverLogoUrl") || changed.has("serverDomain") || changed.has("logoDevToken")) {
|
|
5456
|
+
this.serverImageOk = true;
|
|
5457
|
+
}
|
|
5458
|
+
}
|
|
4556
5459
|
/**
|
|
4557
5460
|
* Derive a logo URL for an agent DID via KTA hosting convention.
|
|
4558
5461
|
* `did:web:knowthat.ai:agents:claude` → `https://knowthat.ai/img/agents/claude.png`
|
|
@@ -4584,37 +5487,57 @@ var ConsentConnectorHeader = class extends i4 {
|
|
|
4584
5487
|
return this.logoDevLogo(this.serverDomain);
|
|
4585
5488
|
}
|
|
4586
5489
|
monogram(name) {
|
|
4587
|
-
return (name
|
|
5490
|
+
return (name.trim().charAt(0) || "?").toUpperCase();
|
|
5491
|
+
}
|
|
5492
|
+
/** What a screen reader hears in place of the picture. */
|
|
5493
|
+
description() {
|
|
5494
|
+
const client = this.clientName.trim() || "An agent";
|
|
5495
|
+
const server = this.serverName.trim() || "this site";
|
|
5496
|
+
const via = this.via.trim();
|
|
5497
|
+
return `${client} is connecting to ${server}${via ? ` via ${via}` : ""}`;
|
|
5498
|
+
}
|
|
5499
|
+
renderBridge() {
|
|
5500
|
+
const title = this.via.trim() ? `Protected by ${this.via.trim()}` : A;
|
|
5501
|
+
if (this.variant === "bridge") {
|
|
5502
|
+
return b2`<div class="bridge" aria-hidden="true">
|
|
5503
|
+
<span class="dash"></span>
|
|
5504
|
+
<span class="shield" title=${title}>${SHIELD_CHECK}</span>
|
|
5505
|
+
<span class="dash"></span>
|
|
5506
|
+
</div>`;
|
|
5507
|
+
}
|
|
5508
|
+
return b2`<div class="bridge" aria-hidden="true">
|
|
5509
|
+
<span class="dots"><span></span><span></span><span></span></span>
|
|
5510
|
+
<span class="shield" title=${title}>${DOTS_SHIELD}</span>
|
|
5511
|
+
<span class="dots"><span></span><span></span><span></span></span>
|
|
5512
|
+
</div>`;
|
|
4588
5513
|
}
|
|
4589
5514
|
render() {
|
|
4590
5515
|
const clientLogo = this.resolveClientLogo();
|
|
4591
|
-
const serverLogo = this.resolveServerLogo();
|
|
5516
|
+
const serverLogo = this.serverImageOk ? this.resolveServerLogo() : void 0;
|
|
4592
5517
|
return b2`
|
|
4593
5518
|
<div class="tile client" aria-hidden="true">
|
|
4594
5519
|
${clientLogo && this.clientImageOk ? b2`<img
|
|
4595
5520
|
src="${clientLogo}"
|
|
4596
5521
|
alt=""
|
|
4597
5522
|
@error=${() => this.clientImageOk = false}
|
|
4598
|
-
/>` : b2`<span class="monogram"
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
<span class="dots"><span></span><span></span><span></span></span>
|
|
4602
|
-
<span class="shield" title="Protected by Checkpoint">
|
|
4603
|
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
|
4604
|
-
<path d="M12 3l8 3v5c0 4.5-3.5 8.5-8 10-4.5-1.5-8-5.5-8-10V6l8-3z" />
|
|
4605
|
-
<path d="m9 12 2 2 4-4" />
|
|
4606
|
-
</svg>
|
|
4607
|
-
</span>
|
|
4608
|
-
<span class="dots"><span></span><span></span><span></span></span>
|
|
5523
|
+
/>` : b2`<span class="monogram"
|
|
5524
|
+
>${this.monogram(this.clientName)}</span
|
|
5525
|
+
>`}
|
|
4609
5526
|
</div>
|
|
4610
|
-
|
|
4611
|
-
|
|
5527
|
+
${this.renderBridge()}
|
|
5528
|
+
<div
|
|
5529
|
+
class="tile server ${serverLogo ? "has-logo" : ""}"
|
|
5530
|
+
aria-hidden="true"
|
|
5531
|
+
>
|
|
5532
|
+
${serverLogo ? b2`<img
|
|
4612
5533
|
src="${serverLogo}"
|
|
4613
5534
|
alt=""
|
|
4614
5535
|
@error=${() => this.serverImageOk = false}
|
|
4615
|
-
/>` : b2`<span class="monogram"
|
|
5536
|
+
/>` : b2`<span class="monogram"
|
|
5537
|
+
>${this.monogram(this.serverName)}</span
|
|
5538
|
+
>`}
|
|
4616
5539
|
</div>
|
|
4617
|
-
<span
|
|
5540
|
+
<span class="visually-hidden">${this.description()}</span>
|
|
4618
5541
|
`;
|
|
4619
5542
|
}
|
|
4620
5543
|
};
|
|
@@ -4627,10 +5550,16 @@ ConsentConnectorHeader.styles = i`
|
|
|
4627
5550
|
padding: 22px 0 4px;
|
|
4628
5551
|
}
|
|
4629
5552
|
|
|
5553
|
+
:host([variant="bridge"]) {
|
|
5554
|
+
gap: 8px;
|
|
5555
|
+
padding: 20px 0 14px;
|
|
5556
|
+
}
|
|
5557
|
+
|
|
4630
5558
|
.tile {
|
|
4631
|
-
|
|
5559
|
+
box-sizing: border-box;
|
|
4632
5560
|
height: 56px;
|
|
4633
|
-
|
|
5561
|
+
min-width: 56px;
|
|
5562
|
+
border-radius: var(--cs-tile-radius, 14px);
|
|
4634
5563
|
overflow: hidden;
|
|
4635
5564
|
display: flex;
|
|
4636
5565
|
align-items: center;
|
|
@@ -4640,30 +5569,46 @@ ConsentConnectorHeader.styles = i`
|
|
|
4640
5569
|
border: 1px solid var(--cs-surface-border, rgba(15, 23, 42, 0.08));
|
|
4641
5570
|
}
|
|
4642
5571
|
|
|
4643
|
-
/*
|
|
4644
|
-
it 56px outside; the shared .tile (server) box is left unchanged. */
|
|
5572
|
+
/* The agent's tile is white with a light border in every theme. */
|
|
4645
5573
|
.tile.client {
|
|
4646
|
-
|
|
4647
|
-
background: var(--cs-agent-tile-bg, #
|
|
5574
|
+
width: 56px;
|
|
5575
|
+
background: var(--cs-agent-tile-bg, #ffffff);
|
|
4648
5576
|
border: 1px solid var(--cs-agent-tile-border, rgba(15, 23, 42, 0.08));
|
|
4649
5577
|
}
|
|
4650
5578
|
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
height: 100%;
|
|
4654
|
-
object-fit: cover;
|
|
4655
|
-
}
|
|
4656
|
-
|
|
4657
|
-
/* Agent marks are contained, not cropped: 36px leaves a 10px inset inside
|
|
4658
|
-
the centred 56px tile, so non-square logos keep their full shape. */
|
|
5579
|
+
/* Marks are contained, not cropped: 36px leaves a 10px inset inside the
|
|
5580
|
+
56px tile, so a non-square logo keeps its whole shape. */
|
|
4659
5581
|
.tile.client img {
|
|
4660
5582
|
width: 36px;
|
|
4661
5583
|
height: 36px;
|
|
4662
5584
|
object-fit: contain;
|
|
4663
5585
|
}
|
|
4664
5586
|
|
|
5587
|
+
/* The server's logo at the mark's height: a square logo in a square tile,
|
|
5588
|
+
a wordmark widening the tile up to 126px and contained past that (a
|
|
5589
|
+
3.75:1 wordmark draws 108 by 29). Where the row is short of room the
|
|
5590
|
+
tile gives some back, down to square, and the wordmark is contained in
|
|
5591
|
+
what is left. */
|
|
5592
|
+
.tile.server {
|
|
5593
|
+
flex-shrink: 1;
|
|
5594
|
+
max-width: 126px;
|
|
5595
|
+
}
|
|
5596
|
+
|
|
5597
|
+
.tile.server.has-logo {
|
|
5598
|
+
padding: 0 8px;
|
|
5599
|
+
}
|
|
5600
|
+
|
|
5601
|
+
.tile.server img {
|
|
5602
|
+
display: block;
|
|
5603
|
+
height: 36px;
|
|
5604
|
+
width: auto;
|
|
5605
|
+
min-width: 36px;
|
|
5606
|
+
max-width: 100%;
|
|
5607
|
+
object-fit: contain;
|
|
5608
|
+
}
|
|
5609
|
+
|
|
4665
5610
|
.tile .monogram {
|
|
4666
|
-
width:
|
|
5611
|
+
width: 54px;
|
|
4667
5612
|
height: 100%;
|
|
4668
5613
|
display: flex;
|
|
4669
5614
|
align-items: center;
|
|
@@ -4673,11 +5618,11 @@ ConsentConnectorHeader.styles = i`
|
|
|
4673
5618
|
}
|
|
4674
5619
|
|
|
4675
5620
|
.tile.client .monogram {
|
|
4676
|
-
color: var(--cs-agent-tile-text, #
|
|
5621
|
+
color: var(--cs-agent-tile-text, #0f172a);
|
|
4677
5622
|
}
|
|
4678
5623
|
|
|
4679
5624
|
.tile.server .monogram {
|
|
4680
|
-
color: var(--cs-text-primary, #
|
|
5625
|
+
color: var(--cs-text-primary, #0f172a);
|
|
4681
5626
|
}
|
|
4682
5627
|
|
|
4683
5628
|
.bridge {
|
|
@@ -4695,7 +5640,7 @@ ConsentConnectorHeader.styles = i`
|
|
|
4695
5640
|
width: 4px;
|
|
4696
5641
|
height: 4px;
|
|
4697
5642
|
border-radius: 50%;
|
|
4698
|
-
background: var(--cs-text-tertiary, #
|
|
5643
|
+
background: var(--cs-text-tertiary, #94a3b8);
|
|
4699
5644
|
opacity: 0.55;
|
|
4700
5645
|
}
|
|
4701
5646
|
|
|
@@ -4707,7 +5652,7 @@ ConsentConnectorHeader.styles = i`
|
|
|
4707
5652
|
display: inline-flex;
|
|
4708
5653
|
align-items: center;
|
|
4709
5654
|
justify-content: center;
|
|
4710
|
-
color: #
|
|
5655
|
+
color: #15803d;
|
|
4711
5656
|
flex-shrink: 0;
|
|
4712
5657
|
}
|
|
4713
5658
|
|
|
@@ -4715,6 +5660,58 @@ ConsentConnectorHeader.styles = i`
|
|
|
4715
5660
|
width: 16px;
|
|
4716
5661
|
height: 16px;
|
|
4717
5662
|
}
|
|
5663
|
+
|
|
5664
|
+
/* 144px where there is room; it gives way first where there is not. */
|
|
5665
|
+
:host([variant="bridge"]) .bridge {
|
|
5666
|
+
flex: 0 4 144px;
|
|
5667
|
+
height: 56px;
|
|
5668
|
+
gap: 6px;
|
|
5669
|
+
}
|
|
5670
|
+
|
|
5671
|
+
.dash {
|
|
5672
|
+
flex: 1;
|
|
5673
|
+
min-width: 12px;
|
|
5674
|
+
height: 0;
|
|
5675
|
+
border-top: 1px dashed var(--cs-text-tertiary, #5d6c82);
|
|
5676
|
+
opacity: 0.5;
|
|
5677
|
+
}
|
|
5678
|
+
|
|
5679
|
+
:host([variant="bridge"]) .shield {
|
|
5680
|
+
box-sizing: border-box;
|
|
5681
|
+
width: 32px;
|
|
5682
|
+
height: 32px;
|
|
5683
|
+
background: var(
|
|
5684
|
+
--cs-tint,
|
|
5685
|
+
color-mix(
|
|
5686
|
+
in srgb,
|
|
5687
|
+
var(--cs-text-primary, #0f172a) 7%,
|
|
5688
|
+
var(--cs-surface-card, #fff)
|
|
5689
|
+
)
|
|
5690
|
+
);
|
|
5691
|
+
border: 1px solid
|
|
5692
|
+
var(
|
|
5693
|
+
--cs-tint-line,
|
|
5694
|
+
color-mix(
|
|
5695
|
+
in srgb,
|
|
5696
|
+
var(--cs-text-primary, #0f172a) 18%,
|
|
5697
|
+
var(--cs-surface-card, #fff)
|
|
5698
|
+
)
|
|
5699
|
+
);
|
|
5700
|
+
color: var(--cs-mark, var(--cs-text-primary, #0f172a));
|
|
5701
|
+
}
|
|
5702
|
+
|
|
5703
|
+
.visually-hidden {
|
|
5704
|
+
position: absolute;
|
|
5705
|
+
width: 1px;
|
|
5706
|
+
height: 1px;
|
|
5707
|
+
padding: 0;
|
|
5708
|
+
margin: -1px;
|
|
5709
|
+
overflow: hidden;
|
|
5710
|
+
clip: rect(0 0 0 0);
|
|
5711
|
+
clip-path: inset(50%);
|
|
5712
|
+
white-space: nowrap;
|
|
5713
|
+
border: 0;
|
|
5714
|
+
}
|
|
4718
5715
|
`;
|
|
4719
5716
|
__decorateClass([
|
|
4720
5717
|
n4({ type: String })
|
|
@@ -4737,6 +5734,12 @@ __decorateClass([
|
|
|
4737
5734
|
__decorateClass([
|
|
4738
5735
|
n4({ type: String, attribute: "logo-dev-token" })
|
|
4739
5736
|
], ConsentConnectorHeader.prototype, "logoDevToken", 2);
|
|
5737
|
+
__decorateClass([
|
|
5738
|
+
n4({ type: String, reflect: true })
|
|
5739
|
+
], ConsentConnectorHeader.prototype, "variant", 2);
|
|
5740
|
+
__decorateClass([
|
|
5741
|
+
n4({ type: String })
|
|
5742
|
+
], ConsentConnectorHeader.prototype, "via", 2);
|
|
4740
5743
|
__decorateClass([
|
|
4741
5744
|
r5()
|
|
4742
5745
|
], ConsentConnectorHeader.prototype, "clientImageOk", 2);
|
|
@@ -4750,9 +5753,13 @@ ConsentConnectorHeader = __decorateClass([
|
|
|
4750
5753
|
// src/styles/theme.ts
|
|
4751
5754
|
var FIXED_RISK_CHIP_BG = "#FCE7B6";
|
|
4752
5755
|
var FIXED_RISK_CHIP_TEXT = "#7A4F00";
|
|
5756
|
+
var LIGHT_RISK_CHIP_BG = "rgba(140, 74, 0, 0.10)";
|
|
5757
|
+
var LIGHT_RISK_CHIP_TEXT = "#8C4A00";
|
|
4753
5758
|
var FIXED_AGENT_TILE_BG = "#FFFFFF";
|
|
4754
5759
|
var FIXED_AGENT_TILE_BORDER = "rgba(15, 23, 42, 0.08)";
|
|
4755
5760
|
var FIXED_AGENT_TILE_TEXT = "#0F172A";
|
|
5761
|
+
var TINT_PERCENT = 7;
|
|
5762
|
+
var TINT_LINE_PERCENT = 18;
|
|
4756
5763
|
var lightTheme = {
|
|
4757
5764
|
surfaceBg: "#F4F1EA",
|
|
4758
5765
|
surfaceCard: "#FFFFFF",
|
|
@@ -4760,20 +5767,17 @@ var lightTheme = {
|
|
|
4760
5767
|
surfaceInset: "#F1ECE2",
|
|
4761
5768
|
textPrimary: "#0F172A",
|
|
4762
5769
|
textSecondary: "#334155",
|
|
4763
|
-
textTertiary: "#
|
|
5770
|
+
textTertiary: "#5D6C82",
|
|
4764
5771
|
surfaceAccent: "#0F172A",
|
|
4765
5772
|
surfaceAccentText: "#FFFFFF",
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
chipRiskBg: FIXED_RISK_CHIP_BG,
|
|
4771
|
-
chipRiskText: FIXED_RISK_CHIP_TEXT,
|
|
4772
|
-
focusRing: "rgba(15, 23, 42, 0.35)",
|
|
4773
|
-
cardShadow: "0 30px 80px -40px rgba(15, 23, 42, 0.40)",
|
|
5773
|
+
chipRiskBg: LIGHT_RISK_CHIP_BG,
|
|
5774
|
+
chipRiskText: LIGHT_RISK_CHIP_TEXT,
|
|
5775
|
+
focusRing: "#0F172A",
|
|
5776
|
+
cardShadow: "0 6px 20px -6px rgba(15, 23, 42, 0.10)",
|
|
4774
5777
|
agentTileBg: FIXED_AGENT_TILE_BG,
|
|
4775
5778
|
agentTileBorder: FIXED_AGENT_TILE_BORDER,
|
|
4776
|
-
agentTileText: FIXED_AGENT_TILE_TEXT
|
|
5779
|
+
agentTileText: FIXED_AGENT_TILE_TEXT,
|
|
5780
|
+
lockup: "#0810FE"
|
|
4777
5781
|
};
|
|
4778
5782
|
var darkTheme = {
|
|
4779
5783
|
surfaceBg: "#0B0808",
|
|
@@ -4785,36 +5789,64 @@ var darkTheme = {
|
|
|
4785
5789
|
textTertiary: "#94A3B8",
|
|
4786
5790
|
surfaceAccent: "#F8FAFC",
|
|
4787
5791
|
surfaceAccentText: "#0F172A",
|
|
4788
|
-
pillVerifiedBg: "rgba(34, 197, 94, 0.16)",
|
|
4789
|
-
pillVerifiedText: "#86EFAC",
|
|
4790
|
-
pillUnverifiedBg: "rgba(148, 163, 184, 0.18)",
|
|
4791
|
-
pillUnverifiedText: "#CBD5E1",
|
|
4792
5792
|
chipRiskBg: FIXED_RISK_CHIP_BG,
|
|
4793
5793
|
chipRiskText: FIXED_RISK_CHIP_TEXT,
|
|
4794
5794
|
focusRing: "rgba(248, 250, 252, 0.55)",
|
|
4795
5795
|
cardShadow: "0 40px 90px -40px rgba(0, 0, 0, 0.85)",
|
|
4796
5796
|
agentTileBg: FIXED_AGENT_TILE_BG,
|
|
4797
5797
|
agentTileBorder: FIXED_AGENT_TILE_BORDER,
|
|
4798
|
-
agentTileText: FIXED_AGENT_TILE_TEXT
|
|
5798
|
+
agentTileText: FIXED_AGENT_TILE_TEXT,
|
|
5799
|
+
warningText: "#FCD34D"
|
|
4799
5800
|
};
|
|
4800
5801
|
function getConsentTheme(theme) {
|
|
4801
5802
|
return theme === "dark" ? darkTheme : lightTheme;
|
|
4802
5803
|
}
|
|
4803
|
-
function
|
|
4804
|
-
const resolved = {
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
const declarations = [];
|
|
4811
|
-
for (const [key, value] of Object.entries(resolved)) {
|
|
4812
|
-
declarations.push(` --cs-${camelToKebab(key)}: ${value};`);
|
|
5804
|
+
function resolveThemeTokens(tokens) {
|
|
5805
|
+
const resolved = { ...tokens };
|
|
5806
|
+
for (const key of FIXED_KEYS2) {
|
|
5807
|
+
resolved[key] = tokens[key] ?? FIXED_TOKENS[key];
|
|
5808
|
+
}
|
|
5809
|
+
for (const key of DERIVED_KEYS) {
|
|
5810
|
+
resolved[key] = tokens[key] ?? DERIVED_TOKENS[key]((base) => tokens[base]);
|
|
4813
5811
|
}
|
|
4814
|
-
return
|
|
5812
|
+
return resolved;
|
|
5813
|
+
}
|
|
5814
|
+
function themeScopeStyle(tokens, scope) {
|
|
5815
|
+
const resolved = resolveThemeTokens(tokens);
|
|
5816
|
+
const keys = Object.keys(resolved);
|
|
5817
|
+
const resolvedName = (key) => `--_${themeTokenProperty(key).slice(2)}`;
|
|
5818
|
+
const isDerived = (key) => DERIVED_KEYS.includes(key);
|
|
5819
|
+
const fallback = (key) => isDerived(key) && tokens[key] === void 0 ? DERIVED_TOKENS[key]((base) => `var(${resolvedName(base)})`) : resolved[key];
|
|
5820
|
+
const resolve = keys.map(
|
|
5821
|
+
(key) => ` ${resolvedName(key)}: var(${themeTokenProperty(key)}, ${fallback(key)});`
|
|
5822
|
+
);
|
|
5823
|
+
const publish = keys.map(
|
|
5824
|
+
(key) => ` ${themeTokenProperty(key)}: var(${resolvedName(key)});`
|
|
5825
|
+
);
|
|
5826
|
+
return `:host {
|
|
5827
|
+
${resolve.join("\n")}
|
|
4815
5828
|
}
|
|
4816
|
-
|
|
4817
|
-
|
|
5829
|
+
${scope} {
|
|
5830
|
+
${publish.join("\n")}
|
|
5831
|
+
}`;
|
|
5832
|
+
}
|
|
5833
|
+
var FIXED_TOKENS = {
|
|
5834
|
+
agentTileBg: FIXED_AGENT_TILE_BG,
|
|
5835
|
+
agentTileBorder: FIXED_AGENT_TILE_BORDER,
|
|
5836
|
+
agentTileText: FIXED_AGENT_TILE_TEXT
|
|
5837
|
+
};
|
|
5838
|
+
var FIXED_KEYS2 = Object.keys(FIXED_TOKENS);
|
|
5839
|
+
var DERIVED_TOKENS = {
|
|
5840
|
+
tint: (token) => `color-mix(in srgb, ${token("textPrimary")} ${TINT_PERCENT}%, ${token("surfaceCard")})`,
|
|
5841
|
+
tintLine: (token) => `color-mix(in srgb, ${token("textPrimary")} ${TINT_LINE_PERCENT}%, ${token("surfaceCard")})`,
|
|
5842
|
+
mark: (token) => token("textPrimary"),
|
|
5843
|
+
action: (token) => token("textPrimary"),
|
|
5844
|
+
lockup: (token) => token("textPrimary"),
|
|
5845
|
+
warningText: (token) => token("chipRiskText")
|
|
5846
|
+
};
|
|
5847
|
+
var DERIVED_KEYS = Object.keys(DERIVED_TOKENS);
|
|
5848
|
+
function themeTokenProperty(key) {
|
|
5849
|
+
return `--cs-${key.replace(/[A-Z]/g, (c5) => `-${c5.toLowerCase()}`)}`;
|
|
4818
5850
|
}
|
|
4819
5851
|
|
|
4820
5852
|
// src/identity/entity-card.ts
|
|
@@ -5172,20 +6204,52 @@ function capabilitySeedKey(capabilities, allSelected) {
|
|
|
5172
6204
|
|
|
5173
6205
|
// src/constants/capabilities.ts
|
|
5174
6206
|
var CONSENT_CAPABILITIES_FEATURES = Object.freeze({
|
|
5175
|
-
/**
|
|
5176
|
-
|
|
6207
|
+
/**
|
|
6208
|
+
* 2 adds the `headline` slot, a slot per row and the row parts.
|
|
6209
|
+
* 3 lets the page theme the screen from any ancestor: a `--cs-*` property
|
|
6210
|
+
* set above the screen wins over its theme, and adds the card, action and
|
|
6211
|
+
* headline tokens and the tint, mark and action colors.
|
|
6212
|
+
* 4 draws Checkpoint's page by default: the agent's name opens its
|
|
6213
|
+
* details, an unverified agent is flagged, `approver` and `grantDetails`
|
|
6214
|
+
* draw their boxes, rows have no icon unless `show-icons`, and the `footer`
|
|
6215
|
+
* slot sits under the card beside the new `legal` slot.
|
|
6216
|
+
*/
|
|
6217
|
+
version: 4,
|
|
5177
6218
|
scopesOnly: true,
|
|
5178
6219
|
slots: Object.freeze([
|
|
5179
6220
|
"identity",
|
|
5180
6221
|
"details",
|
|
5181
6222
|
"notice",
|
|
5182
6223
|
"footer",
|
|
6224
|
+
"legal",
|
|
5183
6225
|
"headline"
|
|
5184
6226
|
]),
|
|
5185
6227
|
/** A row's slot is this prefix and the capability's id. */
|
|
5186
6228
|
capabilitySlotPrefix: "capability-"
|
|
5187
6229
|
});
|
|
5188
6230
|
|
|
6231
|
+
// src/components/decision-icons.ts
|
|
6232
|
+
var PATHS = {
|
|
6233
|
+
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" />`,
|
|
6234
|
+
check: w`<path d="M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z" /><path d="m9 12 2 2 4-4" />`,
|
|
6235
|
+
resource: w`<rect width="20" height="8" x="2" y="2" rx="2" ry="2" /><rect width="20" height="8" x="2" y="14" rx="2" ry="2" /><line x1="6" x2="6.01" y1="6" y2="6" /><line x1="6" x2="6.01" y1="18" y2="18" />`,
|
|
6236
|
+
duration: w`<path d="M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5" /><path d="M16 2v4" /><path d="M8 2v4" /><path d="M3 10h5" /><path d="M17.5 17.5 16 16.3V14" /><circle cx="16" cy="16" r="6" />`,
|
|
6237
|
+
budget: w`<path d="M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1" /><path d="M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4" />`,
|
|
6238
|
+
amountLimits: w`<rect width="20" height="14" x="2" y="5" rx="2" /><line x1="2" x2="22" y1="10" y2="10" />`,
|
|
6239
|
+
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" />`
|
|
6240
|
+
};
|
|
6241
|
+
function decisionIcon(name) {
|
|
6242
|
+
return w`<svg
|
|
6243
|
+
viewBox="0 0 24 24"
|
|
6244
|
+
fill="none"
|
|
6245
|
+
stroke="currentColor"
|
|
6246
|
+
stroke-width="2"
|
|
6247
|
+
stroke-linecap="round"
|
|
6248
|
+
stroke-linejoin="round"
|
|
6249
|
+
aria-hidden="true"
|
|
6250
|
+
>${PATHS[name]}</svg>`;
|
|
6251
|
+
}
|
|
6252
|
+
|
|
5189
6253
|
// src/grant/terms.ts
|
|
5190
6254
|
var MINUTE = 60;
|
|
5191
6255
|
var HOUR = 60 * MINUTE;
|
|
@@ -5286,7 +6350,7 @@ var fieldStyles = i`
|
|
|
5286
6350
|
}
|
|
5287
6351
|
|
|
5288
6352
|
input::placeholder {
|
|
5289
|
-
color: var(--cs-text-tertiary, #
|
|
6353
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
5290
6354
|
opacity: 1;
|
|
5291
6355
|
}
|
|
5292
6356
|
|
|
@@ -5315,7 +6379,7 @@ var fieldStyles = i`
|
|
|
5315
6379
|
}
|
|
5316
6380
|
|
|
5317
6381
|
.hint {
|
|
5318
|
-
color: var(--cs-text-tertiary, #
|
|
6382
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
5319
6383
|
}
|
|
5320
6384
|
|
|
5321
6385
|
.error {
|
|
@@ -5441,7 +6505,7 @@ ConsentDuration.styles = [
|
|
|
5441
6505
|
width: 14px;
|
|
5442
6506
|
height: 14px;
|
|
5443
6507
|
margin-top: -7px;
|
|
5444
|
-
color: var(--cs-text-tertiary, #
|
|
6508
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
5445
6509
|
pointer-events: none;
|
|
5446
6510
|
}
|
|
5447
6511
|
`
|
|
@@ -5890,14 +6954,20 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
5890
6954
|
this.disabled = false;
|
|
5891
6955
|
this.description = "";
|
|
5892
6956
|
this.submitLabel = "";
|
|
6957
|
+
this.showIcons = false;
|
|
5893
6958
|
this.cancelLabel = "";
|
|
5894
6959
|
this.allSelected = false;
|
|
5895
6960
|
this.allowDisabled = false;
|
|
5896
6961
|
this.serverDomain = "";
|
|
5897
6962
|
this.logoDevToken = "";
|
|
5898
6963
|
this.serverLogoUrl = "";
|
|
6964
|
+
this.connectorVariant = "bridge";
|
|
6965
|
+
this.via = "";
|
|
5899
6966
|
this.requireAll = false;
|
|
6967
|
+
this.preview = false;
|
|
6968
|
+
this.editable = false;
|
|
5900
6969
|
this.selected = /* @__PURE__ */ new Set();
|
|
6970
|
+
this.hasLegal = false;
|
|
5901
6971
|
/**
|
|
5902
6972
|
* Last capability set this component seeded `selected` from, per
|
|
5903
6973
|
* `capabilitySeedKey`. Re-seeding is keyed on this value rather than on
|
|
@@ -5917,7 +6987,7 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
5917
6987
|
this.selected = next;
|
|
5918
6988
|
};
|
|
5919
6989
|
this.onAllow = () => {
|
|
5920
|
-
if (this.loading || this.approvalDisabled) return;
|
|
6990
|
+
if (this.preview || this.loading || this.approvalDisabled) return;
|
|
5921
6991
|
const selectedCapabilities = this.capabilities.filter(
|
|
5922
6992
|
(c5) => this.selected.has(c5.id)
|
|
5923
6993
|
);
|
|
@@ -5941,14 +7011,18 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
5941
7011
|
);
|
|
5942
7012
|
};
|
|
5943
7013
|
this.onDeny = () => {
|
|
5944
|
-
if (this.loading) return;
|
|
7014
|
+
if (this.preview || this.loading) return;
|
|
5945
7015
|
this.dispatchEvent(
|
|
5946
7016
|
new CustomEvent("capabilities-deny", { bubbles: true, composed: true })
|
|
5947
7017
|
);
|
|
5948
7018
|
};
|
|
7019
|
+
this.readLegalSlot = (event) => {
|
|
7020
|
+
this.hasLegal = event.target.assignedNodes({ flatten: true }).length > 0;
|
|
7021
|
+
};
|
|
5949
7022
|
const refresh = () => this.requestUpdate();
|
|
5950
7023
|
this.addEventListener("consent-grant-terms-change", refresh);
|
|
5951
7024
|
for (const type of GRANT_FIELD_EVENTS) this.addEventListener(type, refresh);
|
|
7025
|
+
guardPreviewNavigation(this);
|
|
5952
7026
|
}
|
|
5953
7027
|
connectedCallback() {
|
|
5954
7028
|
super.connectedCallback();
|
|
@@ -5958,6 +7032,7 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
5958
7032
|
if (changed.has("capabilities") || changed.has("allSelected")) {
|
|
5959
7033
|
this.seedDefaults();
|
|
5960
7034
|
}
|
|
7035
|
+
warnIfEditableWithoutPreview(this);
|
|
5961
7036
|
}
|
|
5962
7037
|
/**
|
|
5963
7038
|
* Seed `selected` from the capability defaults, but only when the
|
|
@@ -5975,8 +7050,15 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
5975
7050
|
capabilityIdsFor(this.capabilities, this.allSelected)
|
|
5976
7051
|
);
|
|
5977
7052
|
}
|
|
7053
|
+
/**
|
|
7054
|
+
* The theme, as values the page can override: a `--cs-*` property set on
|
|
7055
|
+
* this element or on any ancestor wins over the theme's own.
|
|
7056
|
+
*/
|
|
5978
7057
|
hostStyle() {
|
|
5979
|
-
return
|
|
7058
|
+
return themeScopeStyle(
|
|
7059
|
+
getConsentTheme(this.theme),
|
|
7060
|
+
".card, consent-connector-header, .below"
|
|
7061
|
+
);
|
|
5980
7062
|
}
|
|
5981
7063
|
/** Grant terms in the `details` slot. None when rendered without a DOM. */
|
|
5982
7064
|
get slottedTerms() {
|
|
@@ -6016,12 +7098,9 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
6016
7098
|
}
|
|
6017
7099
|
}
|
|
6018
7100
|
render() {
|
|
6019
|
-
const tokens = CONSENT_COPY_TOKENS;
|
|
6020
7101
|
const agent = this.resolveAgent();
|
|
7102
|
+
const editing = isEditing(this);
|
|
6021
7103
|
const agentName = agent?.name || "this agent";
|
|
6022
|
-
const sectionHeader = formatToken(tokens.section.capabilitiesHeader, {
|
|
6023
|
-
Agent: agentName.toUpperCase()
|
|
6024
|
-
});
|
|
6025
7104
|
return b2`
|
|
6026
7105
|
<style>
|
|
6027
7106
|
${this.hostStyle()}
|
|
@@ -6035,34 +7114,27 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
6035
7114
|
server-logo-url="${this.serverLogoUrl}"
|
|
6036
7115
|
server-domain="${this.serverDomain}"
|
|
6037
7116
|
logo-dev-token="${this.logoDevToken}"
|
|
7117
|
+
variant=${this.connectorVariant}
|
|
7118
|
+
via=${this.via}
|
|
6038
7119
|
></consent-connector-header>
|
|
6039
7120
|
<div class="card" part="card">
|
|
6040
7121
|
<consent-headline
|
|
6041
|
-
exportparts="eyebrow, headline, subhead"
|
|
7122
|
+
exportparts="eyebrow, headline, agent-name, host, subhead, agent-details"
|
|
6042
7123
|
agent-name="${agent?.name ?? ""}"
|
|
6043
|
-
|
|
7124
|
+
.agent=${agent}
|
|
6044
7125
|
verb="${this.headlineVerb}"
|
|
6045
7126
|
description="${this.description}"
|
|
7127
|
+
?preview=${this.preview}
|
|
7128
|
+
?editable=${editing}
|
|
7129
|
+
.editSource=${this.editSource}
|
|
6046
7130
|
><slot name="headline" slot="headline"></slot
|
|
6047
7131
|
></consent-headline>
|
|
6048
7132
|
<slot name="recovery"></slot>
|
|
7133
|
+
${this.renderUnverified(agent)}
|
|
6049
7134
|
<slot name="identity"></slot>
|
|
6050
|
-
${
|
|
6051
|
-
part="agent"
|
|
6052
|
-
agentName="${agent.name}"
|
|
6053
|
-
vendor="${agent.vendor || ""}"
|
|
6054
|
-
surfaceLabel="${agent.surfaceLabel || ""}"
|
|
6055
|
-
verification="${agentVerification(agent)}"
|
|
6056
|
-
domain="${agent.domain || ""}"
|
|
6057
|
-
logoUrl="${agent.logoUrl || ""}"
|
|
6058
|
-
connectedAt="${agent.connectedAt || ""}"
|
|
6059
|
-
></consent-agent-header>` : A}
|
|
7135
|
+
${this.renderApprover()}
|
|
6060
7136
|
<slot name="agent-key"></slot>
|
|
6061
7137
|
<div part="permissions">
|
|
6062
|
-
<div class="section-header" part="section-header">
|
|
6063
|
-
<span>${sectionHeader}</span>
|
|
6064
|
-
<span class="hint">${tokens.section.tapToToggle}</span>
|
|
6065
|
-
</div>
|
|
6066
7138
|
<div class="rows" @capability-toggle=${this.onCapabilityToggle}>
|
|
6067
7139
|
${this.capabilities.map(
|
|
6068
7140
|
(capability) => b2`
|
|
@@ -6074,8 +7146,12 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
6074
7146
|
riskLevel="${capability.riskLevel}"
|
|
6075
7147
|
?checked=${this.selected.has(capability.id)}
|
|
6076
7148
|
?disabled=${this.loading || this.disabled}
|
|
7149
|
+
?show-icon=${this.showIcons}
|
|
6077
7150
|
.scopes=${capability.scopes}
|
|
6078
7151
|
compiled-cedar="${this.compileCapabilityCedar(capability)}"
|
|
7152
|
+
?preview=${this.preview}
|
|
7153
|
+
?editable=${editing}
|
|
7154
|
+
.editSource=${this.editSource}
|
|
6079
7155
|
exportparts=${CAPABILITY_ROW_EXPORT_PARTS}
|
|
6080
7156
|
><slot
|
|
6081
7157
|
name=${capabilitySlotName(capability.id)}
|
|
@@ -6088,15 +7164,16 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
6088
7164
|
</div>
|
|
6089
7165
|
<slot name="auth"></slot>
|
|
6090
7166
|
<slot name="details"></slot>
|
|
7167
|
+
${this.renderGrantDetails(editing)}
|
|
6091
7168
|
<slot name="notice"
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
7169
|
+
>${this.grantDetails ? A : b2`<consent-revocation-notice
|
|
7170
|
+
revocationPath="${this.revocationPath}"
|
|
7171
|
+
orgName="${this.orgName || "this site"}"
|
|
7172
|
+
inactivityDays=${this.inactivityDays}
|
|
7173
|
+
?fixed-expiry=${this.fixedExpiry}
|
|
7174
|
+
fixed-expiry-days=${this.fixedExpiryDays ?? A}
|
|
7175
|
+
></consent-revocation-notice>`}</slot
|
|
7176
|
+
>
|
|
6100
7177
|
<consent-action-bar
|
|
6101
7178
|
part="actions"
|
|
6102
7179
|
agentName="${agentName}"
|
|
@@ -6105,27 +7182,151 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
6105
7182
|
?disabled=${this.approvalDisabled}
|
|
6106
7183
|
submit-label=${this.submitLabel}
|
|
6107
7184
|
cancel-label=${this.cancelLabel}
|
|
7185
|
+
?preview=${this.preview}
|
|
7186
|
+
?editable=${editing}
|
|
7187
|
+
.editSource=${this.editSource}
|
|
6108
7188
|
exportparts="submit, cancel"
|
|
6109
7189
|
@consent-allow=${this.onAllow}
|
|
6110
7190
|
@consent-deny=${this.onDeny}
|
|
6111
7191
|
></consent-action-bar>
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
></consent-footer
|
|
6117
|
-
></slot>
|
|
7192
|
+
</div>
|
|
7193
|
+
<div class="below" part="below">
|
|
7194
|
+
<slot name="footer"><consent-secured-by></consent-secured-by></slot>
|
|
7195
|
+
${this.renderLegal()}
|
|
6118
7196
|
</div>
|
|
6119
7197
|
`;
|
|
6120
7198
|
}
|
|
7199
|
+
/** The warning for an agent that registered itself: its name is not checked. */
|
|
7200
|
+
renderUnverified(agent) {
|
|
7201
|
+
if (!agent || agentVerification(agent) !== "unverified") return A;
|
|
7202
|
+
const copy = CONSENT_COPY_TOKENS;
|
|
7203
|
+
return b2`<div class="unverified" part="unverified">
|
|
7204
|
+
<p class="unverified-heading">
|
|
7205
|
+
${decisionIcon("warning")}${copy.unverifiedAgent.heading}
|
|
7206
|
+
</p>
|
|
7207
|
+
<p class="unverified-body">
|
|
7208
|
+
${copy.agentDetails.unverifiedExplanation}
|
|
7209
|
+
${copy.unverifiedAgent.advice}
|
|
7210
|
+
</p>
|
|
7211
|
+
</div>`;
|
|
7212
|
+
}
|
|
7213
|
+
/** Who is signing in, and the checks they passed; nothing when there is neither. */
|
|
7214
|
+
renderApprover() {
|
|
7215
|
+
const identifier = this.approver?.identifier?.trim() ?? "";
|
|
7216
|
+
const checks = (this.approver?.checks ?? []).filter(
|
|
7217
|
+
(check) => check.label.trim()
|
|
7218
|
+
);
|
|
7219
|
+
if (!identifier && checks.length === 0) return A;
|
|
7220
|
+
return b2`<div class="approver tinted" part="approver">
|
|
7221
|
+
${identifier ? b2`<div class="signed-in">
|
|
7222
|
+
<span class="avatar" aria-hidden="true"
|
|
7223
|
+
>${initialOf(identifier)}</span
|
|
7224
|
+
>
|
|
7225
|
+
<span class="who">
|
|
7226
|
+
<span class="small"
|
|
7227
|
+
>${CONSENT_COPY_TOKENS.approver.signedIn}</span
|
|
7228
|
+
>
|
|
7229
|
+
<span class="identifier">${identifier}</span>
|
|
7230
|
+
</span>
|
|
7231
|
+
</div>` : A}
|
|
7232
|
+
${checks.map(
|
|
7233
|
+
(check, index) => b2`<div class="check${identifier || index > 0 ? " ruled" : ""}">
|
|
7234
|
+
<span class="check-icon">${decisionIcon("check")}</span>
|
|
7235
|
+
<span class="who">
|
|
7236
|
+
<span class="strong">${check.label}</span>
|
|
7237
|
+
${check.summary ? b2`<span>${check.summary}</span>` : A}
|
|
7238
|
+
${check.source ? b2`<span class="small">${check.source}</span>` : A}
|
|
7239
|
+
</span>
|
|
7240
|
+
</div>`
|
|
7241
|
+
)}
|
|
7242
|
+
</div>`;
|
|
7243
|
+
}
|
|
7244
|
+
/** The "Permission details" box, when the host gives `grantDetails`. */
|
|
7245
|
+
renderGrantDetails(editing) {
|
|
7246
|
+
const details = this.grantDetails;
|
|
7247
|
+
if (!details) return A;
|
|
7248
|
+
const copy = CONSENT_COPY_TOKENS.grantDetails;
|
|
7249
|
+
const org = this.orgName.trim();
|
|
7250
|
+
const resource = details.resource?.trim() ?? "";
|
|
7251
|
+
const orgValue = editing ? editRegion(
|
|
7252
|
+
CONSENT_EDIT_KEYS.orgName,
|
|
7253
|
+
CONSENT_COPY_TOKENS.editRegions.orgName,
|
|
7254
|
+
org,
|
|
7255
|
+
this.editSource
|
|
7256
|
+
) : org;
|
|
7257
|
+
const rows = [];
|
|
7258
|
+
if (org || resource || editing) {
|
|
7259
|
+
rows.push({
|
|
7260
|
+
icon: "resource",
|
|
7261
|
+
label: copy.connectsTo,
|
|
7262
|
+
values: org || editing ? [orgValue] : [resource],
|
|
7263
|
+
...resource && (org || editing) ? { note: resource } : {}
|
|
7264
|
+
});
|
|
7265
|
+
}
|
|
7266
|
+
const fact = (icon, label, given) => {
|
|
7267
|
+
const values = (given?.values ?? []).filter((value) => value.trim());
|
|
7268
|
+
const note = given?.note?.trim();
|
|
7269
|
+
if (values.length > 0 || note) {
|
|
7270
|
+
rows.push({ icon, label, values, ...note ? { note } : {} });
|
|
7271
|
+
}
|
|
7272
|
+
};
|
|
7273
|
+
fact("duration", copy.duration, details.duration);
|
|
7274
|
+
if (details.budget?.trim()) {
|
|
7275
|
+
rows.push({
|
|
7276
|
+
icon: "budget",
|
|
7277
|
+
label: copy.budget,
|
|
7278
|
+
values: [details.budget.trim()]
|
|
7279
|
+
});
|
|
7280
|
+
}
|
|
7281
|
+
fact("amountLimits", copy.amountLimits, details.amountLimits);
|
|
7282
|
+
fact("alreadyGranted", copy.alreadyGranted, details.alreadyGranted);
|
|
7283
|
+
if (rows.length === 0) return A;
|
|
7284
|
+
return b2`<section
|
|
7285
|
+
class="grant-details tinted"
|
|
7286
|
+
part="grant-details"
|
|
7287
|
+
aria-labelledby="grant-details-heading"
|
|
7288
|
+
>
|
|
7289
|
+
<h2 id="grant-details-heading">${copy.heading}</h2>
|
|
7290
|
+
<dl>
|
|
7291
|
+
${rows.map(
|
|
7292
|
+
(row) => b2`<div class="fact">
|
|
7293
|
+
<span class="fact-icon">${decisionIcon(row.icon)}</span>
|
|
7294
|
+
<div class="fact-text">
|
|
7295
|
+
<dt class="small">${row.label}</dt>
|
|
7296
|
+
${row.values.map(
|
|
7297
|
+
(value) => b2`<dd class="value">${value}</dd>`
|
|
7298
|
+
)}
|
|
7299
|
+
${row.note ? b2`<dd class="note small">${row.note}</dd>` : A}
|
|
7300
|
+
</div>
|
|
7301
|
+
</div>`
|
|
7302
|
+
)}
|
|
7303
|
+
</dl>
|
|
7304
|
+
</section>`;
|
|
7305
|
+
}
|
|
7306
|
+
/**
|
|
7307
|
+
* The host's legal links, or a "How does this work?" link when the host
|
|
7308
|
+
* gives its address; nothing when there is neither.
|
|
7309
|
+
*/
|
|
7310
|
+
renderLegal() {
|
|
7311
|
+
const howItWorks = sanitizeLinkUrl(this.howItWorksUrl);
|
|
7312
|
+
return b2`<div class="legal" ?hidden=${!this.hasLegal && !howItWorks}>
|
|
7313
|
+
<slot name="legal" @slotchange=${this.readLegalSlot}
|
|
7314
|
+
>${howItWorks ? b2`<a href=${howItWorks} target="_blank" rel="noopener noreferrer"
|
|
7315
|
+
>${CONSENT_COPY_TOKENS.attribution.howThisWorks}</a
|
|
7316
|
+
>` : A}</slot
|
|
7317
|
+
>
|
|
7318
|
+
</div>`;
|
|
7319
|
+
}
|
|
6121
7320
|
};
|
|
6122
7321
|
ConsentCapabilitiesScreen.features = CONSENT_CAPABILITIES_FEATURES;
|
|
6123
7322
|
ConsentCapabilitiesScreen.styles = i`
|
|
7323
|
+
${editRegionStyles}
|
|
7324
|
+
|
|
6124
7325
|
:host {
|
|
6125
7326
|
display: block;
|
|
6126
7327
|
box-sizing: border-box;
|
|
6127
7328
|
width: 100%;
|
|
6128
|
-
max-width: var(--cs-screen-max-width,
|
|
7329
|
+
max-width: var(--cs-screen-max-width, 576px);
|
|
6129
7330
|
margin: 0 auto;
|
|
6130
7331
|
}
|
|
6131
7332
|
|
|
@@ -6133,43 +7334,231 @@ ConsentCapabilitiesScreen.styles = i`
|
|
|
6133
7334
|
min-width: 0;
|
|
6134
7335
|
background: var(--cs-surface-card);
|
|
6135
7336
|
border: 1px solid var(--cs-surface-border);
|
|
6136
|
-
border-radius:
|
|
7337
|
+
border-radius: var(--cs-card-radius, 12px);
|
|
6137
7338
|
box-shadow: var(--cs-card-shadow);
|
|
6138
|
-
padding: var(--cs-card-padding, 28px 28px
|
|
7339
|
+
padding: var(--cs-card-padding, 28px 28px 24px);
|
|
6139
7340
|
display: flex;
|
|
6140
7341
|
flex-direction: column;
|
|
6141
7342
|
gap: var(--cs-card-gap, 22px);
|
|
6142
7343
|
color: var(--cs-text-primary);
|
|
6143
7344
|
}
|
|
6144
7345
|
|
|
6145
|
-
.
|
|
7346
|
+
.rows {
|
|
7347
|
+
display: flex;
|
|
7348
|
+
flex-direction: column;
|
|
7349
|
+
}
|
|
7350
|
+
|
|
7351
|
+
svg {
|
|
7352
|
+
flex-shrink: 0;
|
|
7353
|
+
}
|
|
7354
|
+
|
|
7355
|
+
.unverified {
|
|
7356
|
+
display: flex;
|
|
7357
|
+
flex-direction: column;
|
|
7358
|
+
gap: 2px;
|
|
7359
|
+
margin-top: 12px;
|
|
7360
|
+
font-size: 14px;
|
|
7361
|
+
line-height: 1.45;
|
|
7362
|
+
}
|
|
7363
|
+
|
|
7364
|
+
.unverified p {
|
|
7365
|
+
margin: 0;
|
|
7366
|
+
}
|
|
7367
|
+
|
|
7368
|
+
.unverified-heading {
|
|
6146
7369
|
display: flex;
|
|
6147
7370
|
align-items: center;
|
|
6148
|
-
|
|
6149
|
-
font-
|
|
6150
|
-
|
|
7371
|
+
gap: 6px;
|
|
7372
|
+
font-weight: 500;
|
|
7373
|
+
color: var(--cs-warning-text, #8c4a00);
|
|
7374
|
+
}
|
|
7375
|
+
|
|
7376
|
+
.unverified-heading svg {
|
|
7377
|
+
width: 16px;
|
|
7378
|
+
height: 16px;
|
|
7379
|
+
}
|
|
7380
|
+
|
|
7381
|
+
.unverified-body {
|
|
7382
|
+
color: var(--cs-text-secondary);
|
|
7383
|
+
}
|
|
7384
|
+
|
|
7385
|
+
.tinted {
|
|
7386
|
+
border-radius: 12px;
|
|
7387
|
+
border: 1px solid var(--cs-tint-line);
|
|
7388
|
+
background: var(--cs-tint);
|
|
7389
|
+
}
|
|
7390
|
+
|
|
7391
|
+
.approver {
|
|
7392
|
+
margin-top: 16px;
|
|
7393
|
+
padding: 12px 16px;
|
|
7394
|
+
font-size: 14px;
|
|
7395
|
+
line-height: 1.45;
|
|
7396
|
+
}
|
|
7397
|
+
|
|
7398
|
+
.signed-in,
|
|
7399
|
+
.check {
|
|
7400
|
+
display: flex;
|
|
7401
|
+
align-items: center;
|
|
7402
|
+
gap: 12px;
|
|
7403
|
+
}
|
|
7404
|
+
|
|
7405
|
+
.check {
|
|
7406
|
+
align-items: flex-start;
|
|
7407
|
+
}
|
|
7408
|
+
|
|
7409
|
+
.ruled {
|
|
7410
|
+
margin-top: 12px;
|
|
7411
|
+
padding-top: 12px;
|
|
7412
|
+
border-top: 1px solid var(--cs-tint-line);
|
|
7413
|
+
}
|
|
7414
|
+
|
|
7415
|
+
.avatar,
|
|
7416
|
+
.check-icon {
|
|
7417
|
+
display: grid;
|
|
7418
|
+
place-items: center;
|
|
7419
|
+
width: 40px;
|
|
7420
|
+
height: 40px;
|
|
7421
|
+
flex-shrink: 0;
|
|
7422
|
+
}
|
|
7423
|
+
|
|
7424
|
+
.avatar {
|
|
7425
|
+
border-radius: 50%;
|
|
7426
|
+
background: var(--cs-surface-accent);
|
|
7427
|
+
color: var(--cs-surface-accent-text);
|
|
6151
7428
|
font-weight: 600;
|
|
7429
|
+
}
|
|
7430
|
+
|
|
7431
|
+
.check-icon {
|
|
7432
|
+
color: var(--cs-mark);
|
|
7433
|
+
}
|
|
7434
|
+
|
|
7435
|
+
.check-icon svg {
|
|
7436
|
+
width: 20px;
|
|
7437
|
+
height: 20px;
|
|
7438
|
+
}
|
|
7439
|
+
|
|
7440
|
+
.who {
|
|
7441
|
+
display: flex;
|
|
7442
|
+
flex-direction: column;
|
|
7443
|
+
gap: 2px;
|
|
7444
|
+
min-width: 0;
|
|
7445
|
+
}
|
|
7446
|
+
|
|
7447
|
+
.identifier {
|
|
7448
|
+
font-weight: 500;
|
|
7449
|
+
overflow: hidden;
|
|
7450
|
+
text-overflow: ellipsis;
|
|
7451
|
+
white-space: nowrap;
|
|
7452
|
+
}
|
|
7453
|
+
|
|
7454
|
+
.small {
|
|
7455
|
+
font-size: 12px;
|
|
6152
7456
|
color: var(--cs-text-tertiary);
|
|
6153
|
-
|
|
7457
|
+
}
|
|
7458
|
+
|
|
7459
|
+
.strong {
|
|
7460
|
+
font-weight: 500;
|
|
7461
|
+
}
|
|
7462
|
+
|
|
7463
|
+
.grant-details {
|
|
7464
|
+
margin-top: 16px;
|
|
7465
|
+
padding: 16px;
|
|
7466
|
+
font-size: 14px;
|
|
7467
|
+
line-height: 1.45;
|
|
7468
|
+
}
|
|
7469
|
+
|
|
7470
|
+
.grant-details h2 {
|
|
7471
|
+
margin: 0 0 12px;
|
|
7472
|
+
font-size: 14px;
|
|
7473
|
+
font-weight: 600;
|
|
7474
|
+
}
|
|
7475
|
+
|
|
7476
|
+
.grant-details dl {
|
|
7477
|
+
display: flex;
|
|
7478
|
+
flex-direction: column;
|
|
6154
7479
|
gap: 12px;
|
|
6155
|
-
|
|
7480
|
+
margin: 0;
|
|
6156
7481
|
}
|
|
6157
7482
|
|
|
6158
|
-
.
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
font-size: 12px;
|
|
7483
|
+
.fact {
|
|
7484
|
+
display: flex;
|
|
7485
|
+
align-items: flex-start;
|
|
7486
|
+
gap: 12px;
|
|
6163
7487
|
}
|
|
6164
7488
|
|
|
6165
|
-
.
|
|
7489
|
+
.fact-icon {
|
|
7490
|
+
display: grid;
|
|
7491
|
+
place-items: center;
|
|
7492
|
+
width: 32px;
|
|
7493
|
+
height: 32px;
|
|
7494
|
+
flex-shrink: 0;
|
|
7495
|
+
border-radius: 6px;
|
|
7496
|
+
border: 1px solid var(--cs-surface-border);
|
|
7497
|
+
background: var(--cs-surface-card);
|
|
7498
|
+
color: var(--cs-mark);
|
|
7499
|
+
}
|
|
7500
|
+
|
|
7501
|
+
.fact-icon svg {
|
|
7502
|
+
width: 16px;
|
|
7503
|
+
height: 16px;
|
|
7504
|
+
}
|
|
7505
|
+
|
|
7506
|
+
.fact-text {
|
|
7507
|
+
display: flex;
|
|
7508
|
+
flex: 1;
|
|
7509
|
+
flex-direction: column;
|
|
7510
|
+
gap: 2px;
|
|
7511
|
+
min-width: 0;
|
|
7512
|
+
}
|
|
7513
|
+
|
|
7514
|
+
.fact dd {
|
|
7515
|
+
margin: 0;
|
|
7516
|
+
}
|
|
7517
|
+
|
|
7518
|
+
.fact .value {
|
|
7519
|
+
font-weight: 500;
|
|
7520
|
+
overflow-wrap: anywhere;
|
|
7521
|
+
}
|
|
7522
|
+
|
|
7523
|
+
.fact .note {
|
|
7524
|
+
overflow-wrap: break-word;
|
|
7525
|
+
}
|
|
7526
|
+
|
|
7527
|
+
.below {
|
|
6166
7528
|
display: flex;
|
|
6167
7529
|
flex-direction: column;
|
|
7530
|
+
align-items: center;
|
|
7531
|
+
margin-top: 16px;
|
|
7532
|
+
color: var(--cs-text-tertiary);
|
|
7533
|
+
}
|
|
7534
|
+
|
|
7535
|
+
.legal {
|
|
7536
|
+
display: flex;
|
|
7537
|
+
justify-content: center;
|
|
7538
|
+
gap: 20px;
|
|
7539
|
+
padding-top: 48px;
|
|
7540
|
+
font-size: 12px;
|
|
7541
|
+
}
|
|
7542
|
+
|
|
7543
|
+
.legal a {
|
|
7544
|
+
color: inherit;
|
|
7545
|
+
text-decoration: underline;
|
|
7546
|
+
text-underline-offset: 2px;
|
|
7547
|
+
border-radius: 2px;
|
|
7548
|
+
}
|
|
7549
|
+
|
|
7550
|
+
.legal a:hover {
|
|
7551
|
+
color: var(--cs-text-primary);
|
|
7552
|
+
}
|
|
7553
|
+
|
|
7554
|
+
.legal a:focus-visible {
|
|
7555
|
+
outline: 2px solid var(--cs-focus-ring);
|
|
7556
|
+
outline-offset: 2px;
|
|
6168
7557
|
}
|
|
6169
7558
|
|
|
6170
|
-
@media (max-width:
|
|
7559
|
+
@media (max-width: 640px) {
|
|
6171
7560
|
.card {
|
|
6172
|
-
padding: var(--cs-card-padding-mobile, 20px
|
|
7561
|
+
padding: var(--cs-card-padding-mobile, 20px 20px 24px);
|
|
6173
7562
|
}
|
|
6174
7563
|
}
|
|
6175
7564
|
`;
|
|
@@ -6221,6 +7610,15 @@ __decorateClass([
|
|
|
6221
7610
|
__decorateClass([
|
|
6222
7611
|
n4({ type: String, attribute: "submit-label" })
|
|
6223
7612
|
], ConsentCapabilitiesScreen.prototype, "submitLabel", 2);
|
|
7613
|
+
__decorateClass([
|
|
7614
|
+
n4({ attribute: false })
|
|
7615
|
+
], ConsentCapabilitiesScreen.prototype, "approver", 2);
|
|
7616
|
+
__decorateClass([
|
|
7617
|
+
n4({ attribute: false })
|
|
7618
|
+
], ConsentCapabilitiesScreen.prototype, "grantDetails", 2);
|
|
7619
|
+
__decorateClass([
|
|
7620
|
+
n4({ type: Boolean, attribute: "show-icons" })
|
|
7621
|
+
], ConsentCapabilitiesScreen.prototype, "showIcons", 2);
|
|
6224
7622
|
__decorateClass([
|
|
6225
7623
|
n4({ type: String, attribute: "cancel-label" })
|
|
6226
7624
|
], ConsentCapabilitiesScreen.prototype, "cancelLabel", 2);
|
|
@@ -6239,12 +7637,30 @@ __decorateClass([
|
|
|
6239
7637
|
__decorateClass([
|
|
6240
7638
|
n4({ type: String, attribute: "server-logo-url" })
|
|
6241
7639
|
], ConsentCapabilitiesScreen.prototype, "serverLogoUrl", 2);
|
|
7640
|
+
__decorateClass([
|
|
7641
|
+
n4({ type: String, attribute: "connector-variant" })
|
|
7642
|
+
], ConsentCapabilitiesScreen.prototype, "connectorVariant", 2);
|
|
7643
|
+
__decorateClass([
|
|
7644
|
+
n4({ type: String })
|
|
7645
|
+
], ConsentCapabilitiesScreen.prototype, "via", 2);
|
|
6242
7646
|
__decorateClass([
|
|
6243
7647
|
n4({ type: Boolean, attribute: "require-all" })
|
|
6244
7648
|
], ConsentCapabilitiesScreen.prototype, "requireAll", 2);
|
|
7649
|
+
__decorateClass([
|
|
7650
|
+
n4({ type: Boolean, reflect: true })
|
|
7651
|
+
], ConsentCapabilitiesScreen.prototype, "preview", 2);
|
|
7652
|
+
__decorateClass([
|
|
7653
|
+
n4({ type: Boolean, reflect: true })
|
|
7654
|
+
], ConsentCapabilitiesScreen.prototype, "editable", 2);
|
|
7655
|
+
__decorateClass([
|
|
7656
|
+
n4({ attribute: false })
|
|
7657
|
+
], ConsentCapabilitiesScreen.prototype, "editSource", 2);
|
|
6245
7658
|
__decorateClass([
|
|
6246
7659
|
r5()
|
|
6247
7660
|
], ConsentCapabilitiesScreen.prototype, "selected", 2);
|
|
7661
|
+
__decorateClass([
|
|
7662
|
+
r5()
|
|
7663
|
+
], ConsentCapabilitiesScreen.prototype, "hasLegal", 2);
|
|
6248
7664
|
ConsentCapabilitiesScreen = __decorateClass([
|
|
6249
7665
|
t3("consent-capabilities-screen")
|
|
6250
7666
|
], ConsentCapabilitiesScreen);
|
|
@@ -6261,15 +7677,16 @@ var ConsentRevoke = class extends i4 {
|
|
|
6261
7677
|
this.error = "";
|
|
6262
7678
|
this.confirmLabel = "";
|
|
6263
7679
|
this.keepLabel = "";
|
|
7680
|
+
this.preview = false;
|
|
6264
7681
|
}
|
|
6265
7682
|
onConfirm() {
|
|
6266
|
-
if (this.loading) return;
|
|
7683
|
+
if (this.loading || this.preview) return;
|
|
6267
7684
|
this.dispatchEvent(
|
|
6268
7685
|
new CustomEvent("consent-revoke", { bubbles: true, composed: true })
|
|
6269
7686
|
);
|
|
6270
7687
|
}
|
|
6271
7688
|
onKeep() {
|
|
6272
|
-
if (this.loading) return;
|
|
7689
|
+
if (this.loading || this.preview) return;
|
|
6273
7690
|
this.dispatchEvent(
|
|
6274
7691
|
new CustomEvent("consent-keep", { bubbles: true, composed: true })
|
|
6275
7692
|
);
|
|
@@ -6382,7 +7799,7 @@ ConsentRevoke.styles = i`
|
|
|
6382
7799
|
|
|
6383
7800
|
.ends-title {
|
|
6384
7801
|
margin: 0;
|
|
6385
|
-
color: var(--cs-text-tertiary, #
|
|
7802
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
6386
7803
|
font-size: 12px;
|
|
6387
7804
|
font-weight: 500;
|
|
6388
7805
|
}
|
|
@@ -6423,7 +7840,7 @@ ConsentRevoke.styles = i`
|
|
|
6423
7840
|
width: 100%;
|
|
6424
7841
|
padding: 13px 18px;
|
|
6425
7842
|
border: none;
|
|
6426
|
-
border-radius:
|
|
7843
|
+
border-radius: var(--cs-action-radius, 6px);
|
|
6427
7844
|
font: inherit;
|
|
6428
7845
|
font-size: var(--cs-action-font-size, 15px);
|
|
6429
7846
|
font-weight: 500;
|
|
@@ -6505,6 +7922,9 @@ __decorateClass([
|
|
|
6505
7922
|
__decorateClass([
|
|
6506
7923
|
n4({ type: String, attribute: "keep-label" })
|
|
6507
7924
|
], ConsentRevoke.prototype, "keepLabel", 2);
|
|
7925
|
+
__decorateClass([
|
|
7926
|
+
n4({ type: Boolean, reflect: true })
|
|
7927
|
+
], ConsentRevoke.prototype, "preview", 2);
|
|
6508
7928
|
ConsentRevoke = __decorateClass([
|
|
6509
7929
|
t3("consent-revoke")
|
|
6510
7930
|
], ConsentRevoke);
|
|
@@ -6752,7 +8172,7 @@ ConsentWalletOrb.styles = i`
|
|
|
6752
8172
|
.frame {
|
|
6753
8173
|
--_ink: var(--cs-wallet-accent, var(--cs-surface-accent, #0f172a));
|
|
6754
8174
|
--_success: var(--cs-wallet-success, #10b981);
|
|
6755
|
-
--_muted: var(--cs-wallet-muted, var(--cs-text-tertiary, #
|
|
8175
|
+
--_muted: var(--cs-wallet-muted, var(--cs-text-tertiary, #5d6c82));
|
|
6756
8176
|
position: relative;
|
|
6757
8177
|
width: 100%;
|
|
6758
8178
|
height: 100%;
|
|
@@ -6942,7 +8362,7 @@ ConsentWalletCheck.styles = i`
|
|
|
6942
8362
|
|
|
6943
8363
|
.caption {
|
|
6944
8364
|
margin: 0;
|
|
6945
|
-
color: var(--cs-text-tertiary, #
|
|
8365
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
6946
8366
|
font-size: 12px;
|
|
6947
8367
|
line-height: 1.35;
|
|
6948
8368
|
}
|
|
@@ -7053,7 +8473,7 @@ ConsentWalletNotice.styles = i`
|
|
|
7053
8473
|
.body,
|
|
7054
8474
|
.more {
|
|
7055
8475
|
margin: 0;
|
|
7056
|
-
color: var(--cs-text-tertiary, #
|
|
8476
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
7057
8477
|
font-size: 12px;
|
|
7058
8478
|
line-height: 1.375;
|
|
7059
8479
|
}
|
|
@@ -7143,7 +8563,7 @@ ConsentWalletSignature.styles = i`
|
|
|
7143
8563
|
|
|
7144
8564
|
.frame {
|
|
7145
8565
|
margin: 0;
|
|
7146
|
-
color: var(--cs-text-tertiary, #
|
|
8566
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
7147
8567
|
font-size: 12px;
|
|
7148
8568
|
line-height: 1.5;
|
|
7149
8569
|
}
|
|
@@ -7267,7 +8687,7 @@ ConsentRequestExpiry.styles = i`
|
|
|
7267
8687
|
|
|
7268
8688
|
p {
|
|
7269
8689
|
margin: 0;
|
|
7270
|
-
color: var(--cs-text-tertiary, #
|
|
8690
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
7271
8691
|
font-size: 12px;
|
|
7272
8692
|
line-height: 1.4;
|
|
7273
8693
|
}
|
|
@@ -7635,12 +9055,12 @@ ConsentPhoneHandoff.styles = i`
|
|
|
7635
9055
|
width: 16px;
|
|
7636
9056
|
height: 16px;
|
|
7637
9057
|
margin-top: calc((1.3em - 16px) / 2);
|
|
7638
|
-
color: var(--cs-text-tertiary, #
|
|
9058
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
7639
9059
|
}
|
|
7640
9060
|
|
|
7641
9061
|
.body {
|
|
7642
9062
|
margin: 0;
|
|
7643
|
-
color: var(--cs-text-tertiary, #
|
|
9063
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
7644
9064
|
font-size: 14px;
|
|
7645
9065
|
line-height: 1.45;
|
|
7646
9066
|
}
|
|
@@ -7668,7 +9088,7 @@ ConsentPhoneHandoff.styles = i`
|
|
|
7668
9088
|
.scan {
|
|
7669
9089
|
justify-self: stretch;
|
|
7670
9090
|
margin: 0;
|
|
7671
|
-
color: var(--cs-text-tertiary, #
|
|
9091
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
7672
9092
|
font-size: 12px;
|
|
7673
9093
|
line-height: 1.4;
|
|
7674
9094
|
}
|
|
@@ -7913,8 +9333,9 @@ var AUTH_REQUIRED_MODES = /* @__PURE__ */ new Set([
|
|
|
7913
9333
|
AUTH_MODES.MAGIC_LINK
|
|
7914
9334
|
]);
|
|
7915
9335
|
var McpConsent = class extends i4 {
|
|
9336
|
+
// === LIFECYCLE ===
|
|
7916
9337
|
constructor() {
|
|
7917
|
-
super(
|
|
9338
|
+
super();
|
|
7918
9339
|
this.tool = "";
|
|
7919
9340
|
this.scopes = [];
|
|
7920
9341
|
this.agentDid = "";
|
|
@@ -7925,6 +9346,7 @@ var McpConsent = class extends i4 {
|
|
|
7925
9346
|
this.agentName = "";
|
|
7926
9347
|
this.provider = "";
|
|
7927
9348
|
this.csrfToken = "";
|
|
9349
|
+
this.preview = false;
|
|
7928
9350
|
this.credentialProviderType = "";
|
|
7929
9351
|
this.credentialProvider = "";
|
|
7930
9352
|
this.userDid = "";
|
|
@@ -7940,6 +9362,8 @@ var McpConsent = class extends i4 {
|
|
|
7940
9362
|
this.inactivityDays = 90;
|
|
7941
9363
|
this.consentTheme = "light";
|
|
7942
9364
|
this.howItWorksUrl = "";
|
|
9365
|
+
this.via = "";
|
|
9366
|
+
this.connectorVariant = "bridge";
|
|
7943
9367
|
this.authorizationType = "password";
|
|
7944
9368
|
this.oauthProviderType = "";
|
|
7945
9369
|
this.currentMode = AUTH_MODES.CONSENT_ONLY;
|
|
@@ -7951,7 +9375,7 @@ var McpConsent = class extends i4 {
|
|
|
7951
9375
|
this.selectedScopes = [];
|
|
7952
9376
|
this.closeFailed = false;
|
|
7953
9377
|
this.restartApprovalPage = () => {
|
|
7954
|
-
if (!this.approvalRecovery?.reload || !this.anchorSid || typeof window === "undefined")
|
|
9378
|
+
if (this.preview || !this.approvalRecovery?.reload || !this.anchorSid || typeof window === "undefined")
|
|
7955
9379
|
return;
|
|
7956
9380
|
const target = new URL("/consent", window.location.origin);
|
|
7957
9381
|
target.searchParams.set("sid", this.anchorSid);
|
|
@@ -7973,6 +9397,7 @@ var McpConsent = class extends i4 {
|
|
|
7973
9397
|
this.termsAccepted = true;
|
|
7974
9398
|
void this.handleApprove();
|
|
7975
9399
|
};
|
|
9400
|
+
guardPreviewNavigation(this);
|
|
7976
9401
|
}
|
|
7977
9402
|
/**
|
|
7978
9403
|
* Flattened capability list, memoized against `this.capabilities` array
|
|
@@ -8000,13 +9425,12 @@ var McpConsent = class extends i4 {
|
|
|
8000
9425
|
}
|
|
8001
9426
|
return this.requestedCapabilitiesCache.result;
|
|
8002
9427
|
}
|
|
8003
|
-
// === LIFECYCLE ===
|
|
8004
9428
|
connectedCallback() {
|
|
8005
9429
|
super.connectedCallback();
|
|
8006
9430
|
this.resolved = resolveConsentConfig(this.config, this.agentName);
|
|
8007
9431
|
this.currentMode = this.mode ?? determineAuthMode(this.config) ?? AUTH_MODES.CONSENT_ONLY;
|
|
8008
9432
|
this.selectedScopes = [...this.scopes];
|
|
8009
|
-
this.readIdentityAssertionFromLocation();
|
|
9433
|
+
if (!this.preview) this.readIdentityAssertionFromLocation();
|
|
8010
9434
|
this.scheduleRequestExpiry();
|
|
8011
9435
|
}
|
|
8012
9436
|
/**
|
|
@@ -8118,6 +9542,7 @@ var McpConsent = class extends i4 {
|
|
|
8118
9542
|
*/
|
|
8119
9543
|
async handleApprove(e10) {
|
|
8120
9544
|
e10?.preventDefault();
|
|
9545
|
+
if (this.preview) return;
|
|
8121
9546
|
if (this.nativeScopeSelection && this.requestExpiresAt > 0 && Date.now() >= this.requestExpiresAt)
|
|
8122
9547
|
this.setApprovalRecovery("kyaos/pickup-expired");
|
|
8123
9548
|
if (this.approvalRecovery) return;
|
|
@@ -8264,6 +9689,7 @@ var McpConsent = class extends i4 {
|
|
|
8264
9689
|
}
|
|
8265
9690
|
}
|
|
8266
9691
|
handleDeny() {
|
|
9692
|
+
if (this.preview) return;
|
|
8267
9693
|
this.dispatchEvent(
|
|
8268
9694
|
new CustomEvent("mcp-consent:deny", {
|
|
8269
9695
|
bubbles: true,
|
|
@@ -8273,6 +9699,7 @@ var McpConsent = class extends i4 {
|
|
|
8273
9699
|
window.close();
|
|
8274
9700
|
}
|
|
8275
9701
|
handleClose() {
|
|
9702
|
+
if (this.preview) return;
|
|
8276
9703
|
window.close();
|
|
8277
9704
|
setTimeout(() => {
|
|
8278
9705
|
this.closeFailed = true;
|
|
@@ -8285,7 +9712,7 @@ var McpConsent = class extends i4 {
|
|
|
8285
9712
|
this.formData = { ...this.formData, [name]: value };
|
|
8286
9713
|
}
|
|
8287
9714
|
handleResendOtp() {
|
|
8288
|
-
if (this.resendCooldown > 0) {
|
|
9715
|
+
if (this.preview || this.resendCooldown > 0) {
|
|
8289
9716
|
return;
|
|
8290
9717
|
}
|
|
8291
9718
|
const cooldownSeconds = this.resolved?.otp?.resendCooldown ?? 60;
|
|
@@ -8381,6 +9808,7 @@ var McpConsent = class extends i4 {
|
|
|
8381
9808
|
return b2`
|
|
8382
9809
|
<div class="terms">
|
|
8383
9810
|
<consent-terms
|
|
9811
|
+
?preview=${this.preview}
|
|
8384
9812
|
name="termsAccepted"
|
|
8385
9813
|
text=${this.resolved.terms.text}
|
|
8386
9814
|
url=${this.resolved.terms.url ?? ""}
|
|
@@ -8409,7 +9837,7 @@ var McpConsent = class extends i4 {
|
|
|
8409
9837
|
}
|
|
8410
9838
|
scheduleRequestExpiry() {
|
|
8411
9839
|
clearTimeout(this.requestExpiryTimer);
|
|
8412
|
-
if (!this.nativeScopeSelection || !Number.isSafeInteger(this.requestExpiresAt) || this.requestExpiresAt <= 0)
|
|
9840
|
+
if (this.preview || !this.nativeScopeSelection || !Number.isSafeInteger(this.requestExpiresAt) || this.requestExpiresAt <= 0)
|
|
8413
9841
|
return;
|
|
8414
9842
|
const remaining = this.requestExpiresAt - Date.now();
|
|
8415
9843
|
if (remaining <= 0) {
|
|
@@ -8437,6 +9865,7 @@ var McpConsent = class extends i4 {
|
|
|
8437
9865
|
<p>${this.approvalRecovery.message}</p>
|
|
8438
9866
|
${this.approvalRecovery.reload ? b2`<consent-button
|
|
8439
9867
|
variant="secondary"
|
|
9868
|
+
?preview=${this.preview}
|
|
8440
9869
|
@click=${this.restartApprovalPage}
|
|
8441
9870
|
>Reload and sign in again</consent-button
|
|
8442
9871
|
>` : A}
|
|
@@ -8462,12 +9891,17 @@ var McpConsent = class extends i4 {
|
|
|
8462
9891
|
const { allowSubmit = true, submitText } = options;
|
|
8463
9892
|
return b2`
|
|
8464
9893
|
<div slot="footer">
|
|
8465
|
-
<consent-button
|
|
9894
|
+
<consent-button
|
|
9895
|
+
variant="secondary"
|
|
9896
|
+
?preview=${this.preview}
|
|
9897
|
+
@click=${this.handleDeny}
|
|
9898
|
+
>
|
|
8466
9899
|
${this.resolved?.ui.cancelButtonText ?? "Cancel"}
|
|
8467
9900
|
</consent-button>
|
|
8468
9901
|
${allowSubmit ? b2`
|
|
8469
9902
|
<consent-button
|
|
8470
9903
|
variant="primary"
|
|
9904
|
+
?preview=${this.preview}
|
|
8471
9905
|
?loading=${this.loading}
|
|
8472
9906
|
?disabled=${!!this.approvalRecovery || this.currentMode === AUTH_MODES.CONSENT_ONLY && this.resolved?.terms.required && !this.termsAccepted}
|
|
8473
9907
|
@click=${this.handleApprove}
|
|
@@ -8582,6 +10016,7 @@ var McpConsent = class extends i4 {
|
|
|
8582
10016
|
<div slot="content">
|
|
8583
10017
|
${this.renderError()} ${this.renderAgentInfo()}
|
|
8584
10018
|
${this.approvalRecovery ? A : b2`<consent-oauth-button
|
|
10019
|
+
?preview=${this.preview}
|
|
8585
10020
|
provider=${provider}
|
|
8586
10021
|
provider-name=${providerName}
|
|
8587
10022
|
url=${oauthButtonUrl}
|
|
@@ -8802,6 +10237,7 @@ var McpConsent = class extends i4 {
|
|
|
8802
10237
|
<consent-button
|
|
8803
10238
|
variant="primary"
|
|
8804
10239
|
full-width
|
|
10240
|
+
?preview=${this.preview}
|
|
8805
10241
|
@click=${this.handleClose}
|
|
8806
10242
|
>
|
|
8807
10243
|
${success?.continueButtonText ?? "Continue"}
|
|
@@ -8868,6 +10304,7 @@ var McpConsent = class extends i4 {
|
|
|
8868
10304
|
const allSelected = this.requiresAllCapabilities;
|
|
8869
10305
|
return b2`
|
|
8870
10306
|
<consent-capabilities-screen
|
|
10307
|
+
?preview=${this.preview}
|
|
8871
10308
|
.capabilities=${flatCapabilities}
|
|
8872
10309
|
.agentMetadata=${agent.agentMetadata}
|
|
8873
10310
|
.agentIdentity=${agent.agentIdentity}
|
|
@@ -8881,6 +10318,8 @@ var McpConsent = class extends i4 {
|
|
|
8881
10318
|
fixed-expiry-days=${this.resolved?.fixedExpiryDays ?? A}
|
|
8882
10319
|
theme="${this.consentTheme}"
|
|
8883
10320
|
how-it-works-url="${this.howItWorksUrl}"
|
|
10321
|
+
connector-variant=${this.connectorVariant}
|
|
10322
|
+
via=${this.via}
|
|
8884
10323
|
?loading=${this.loading}
|
|
8885
10324
|
?all-selected=${allSelected}
|
|
8886
10325
|
?disabled=${!!this.approvalRecovery}
|
|
@@ -9095,7 +10534,7 @@ McpConsent.styles = i`
|
|
|
9095
10534
|
/* Success Container - Standalone layout without consent-shell */
|
|
9096
10535
|
.success-container {
|
|
9097
10536
|
background: white;
|
|
9098
|
-
border-radius: 20px;
|
|
10537
|
+
border-radius: var(--cs-card-radius, 20px);
|
|
9099
10538
|
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
9100
10539
|
box-shadow:
|
|
9101
10540
|
0 20px 25px -5px rgba(0, 0, 0, 0.1),
|
|
@@ -9400,6 +10839,9 @@ __decorateClass([
|
|
|
9400
10839
|
__decorateClass([
|
|
9401
10840
|
n4({ type: String, attribute: "preview-step" })
|
|
9402
10841
|
], McpConsent.prototype, "previewStep", 2);
|
|
10842
|
+
__decorateClass([
|
|
10843
|
+
n4({ type: Boolean, reflect: true })
|
|
10844
|
+
], McpConsent.prototype, "preview", 2);
|
|
9403
10845
|
__decorateClass([
|
|
9404
10846
|
n4({ type: String, attribute: "credential-provider-type" })
|
|
9405
10847
|
], McpConsent.prototype, "credentialProviderType", 2);
|
|
@@ -9496,6 +10938,12 @@ __decorateClass([
|
|
|
9496
10938
|
__decorateClass([
|
|
9497
10939
|
n4({ type: String, attribute: "how-it-works-url" })
|
|
9498
10940
|
], McpConsent.prototype, "howItWorksUrl", 2);
|
|
10941
|
+
__decorateClass([
|
|
10942
|
+
n4({ type: String })
|
|
10943
|
+
], McpConsent.prototype, "via", 2);
|
|
10944
|
+
__decorateClass([
|
|
10945
|
+
n4({ type: String, attribute: "connector-variant" })
|
|
10946
|
+
], McpConsent.prototype, "connectorVariant", 2);
|
|
9499
10947
|
__decorateClass([
|
|
9500
10948
|
n4({
|
|
9501
10949
|
type: Object,
|
|
@@ -9575,7 +11023,216 @@ McpConsent = __decorateClass([
|
|
|
9575
11023
|
t3("mcp-consent")
|
|
9576
11024
|
], McpConsent);
|
|
9577
11025
|
|
|
9578
|
-
//
|
|
11026
|
+
// src/styles/brand.ts
|
|
11027
|
+
var AA_GRAPHIC_CONTRAST = 3;
|
|
11028
|
+
var TEXT_CONTRAST = 4.5;
|
|
11029
|
+
var ICON_TILE_PERCENT = 8;
|
|
11030
|
+
var HOVERED_ROW_PERCENT = 4;
|
|
11031
|
+
var MUTED_TEXT_PERCENT = 64;
|
|
11032
|
+
var PANEL_TINT_PERCENT = 4;
|
|
11033
|
+
var LIGHTNESS_STEP = 5e-3;
|
|
11034
|
+
var LIGHT_DRAWN_COLORS = Object.freeze({
|
|
11035
|
+
surface: lightTheme.surfaceCard,
|
|
11036
|
+
panel: lightTheme.surfaceInset,
|
|
11037
|
+
text: lightTheme.textPrimary,
|
|
11038
|
+
mutedText: lightTheme.textTertiary
|
|
11039
|
+
});
|
|
11040
|
+
var PALETTE_FIELDS = [
|
|
11041
|
+
"surfaceColor",
|
|
11042
|
+
"panelColor",
|
|
11043
|
+
"borderColor",
|
|
11044
|
+
"textColor",
|
|
11045
|
+
"mutedTextColor",
|
|
11046
|
+
"focusColor"
|
|
11047
|
+
];
|
|
11048
|
+
function rgbOf(hex) {
|
|
11049
|
+
return [1, 3, 5].map((at) => Number.parseInt(hex.slice(at, at + 2), 16));
|
|
11050
|
+
}
|
|
11051
|
+
function hexOf(channels2) {
|
|
11052
|
+
return `#${channels2.map((value) => Math.round(value).toString(16).padStart(2, "0")).join("")}`;
|
|
11053
|
+
}
|
|
11054
|
+
function mixOver(top, percent, under) {
|
|
11055
|
+
const share = percent / 100;
|
|
11056
|
+
const below = rgbOf(under);
|
|
11057
|
+
return hexOf(
|
|
11058
|
+
rgbOf(top).map((above, i7) => above * share + below[i7] * (1 - share))
|
|
11059
|
+
);
|
|
11060
|
+
}
|
|
11061
|
+
function hslOf(hex) {
|
|
11062
|
+
const [red, green, blue] = rgbOf(hex).map((value) => value / 255);
|
|
11063
|
+
const high = Math.max(red, green, blue);
|
|
11064
|
+
const low = Math.min(red, green, blue);
|
|
11065
|
+
const spread = high - low;
|
|
11066
|
+
const lightness = (high + low) / 2;
|
|
11067
|
+
if (spread === 0) return { hue: 0, saturation: 0, lightness };
|
|
11068
|
+
const saturation = spread / (1 - Math.abs(2 * lightness - 1));
|
|
11069
|
+
const sector = high === red ? (green - blue) / spread : high === green ? (blue - red) / spread + 2 : (red - green) / spread + 4;
|
|
11070
|
+
return { hue: (sector * 60 + 360) % 360, saturation, lightness };
|
|
11071
|
+
}
|
|
11072
|
+
function hexFromHsl({ hue, saturation, lightness }) {
|
|
11073
|
+
const reach = saturation * Math.min(lightness, 1 - lightness);
|
|
11074
|
+
const channel = (offset) => {
|
|
11075
|
+
const turn = (offset + hue / 30) % 12;
|
|
11076
|
+
return (lightness - reach * Math.max(-1, Math.min(turn - 3, 9 - turn, 1))) * 255;
|
|
11077
|
+
};
|
|
11078
|
+
return hexOf([channel(0), channel(8), channel(4)]);
|
|
11079
|
+
}
|
|
11080
|
+
function iconColorFor(hex, primary, drawn = LIGHT_DRAWN_COLORS) {
|
|
11081
|
+
const hoveredRow = mixOver(primary, HOVERED_ROW_PERCENT, drawn.surface);
|
|
11082
|
+
const surfaces = [
|
|
11083
|
+
drawn.surface,
|
|
11084
|
+
drawn.panel,
|
|
11085
|
+
mixOver(primary, ICON_TILE_PERCENT, drawn.surface),
|
|
11086
|
+
mixOver(primary, ICON_TILE_PERCENT, hoveredRow)
|
|
11087
|
+
];
|
|
11088
|
+
const worstRatio = (candidate) => Math.min(...surfaces.map((surface) => contrastRatio(candidate, surface)));
|
|
11089
|
+
if (worstRatio(hex) >= AA_GRAPHIC_CONTRAST) return hex;
|
|
11090
|
+
const start = hslOf(hex);
|
|
11091
|
+
for (let steps = 1; steps * LIGHTNESS_STEP <= 1; steps++) {
|
|
11092
|
+
for (const lightness of [
|
|
11093
|
+
start.lightness - steps * LIGHTNESS_STEP,
|
|
11094
|
+
start.lightness + steps * LIGHTNESS_STEP
|
|
11095
|
+
]) {
|
|
11096
|
+
if (lightness < 0 || lightness > 1) continue;
|
|
11097
|
+
const candidate = hexFromHsl({ ...start, lightness });
|
|
11098
|
+
if (worstRatio(candidate) >= AA_GRAPHIC_CONTRAST) return candidate;
|
|
11099
|
+
}
|
|
11100
|
+
}
|
|
11101
|
+
return worstRatio("#000000") >= worstRatio("#ffffff") ? "#000000" : "#ffffff";
|
|
11102
|
+
}
|
|
11103
|
+
function focusRingFor(hex, surface = LIGHT_DRAWN_COLORS.surface) {
|
|
11104
|
+
return contrastRatio(hex, surface) >= AA_GRAPHIC_CONTRAST ? "brand" : "ink";
|
|
11105
|
+
}
|
|
11106
|
+
function readsOnCardAndTint(hex, ratio, surface) {
|
|
11107
|
+
const tint = mixOver(hex, TINT_PERCENT, surface);
|
|
11108
|
+
return contrastRatio(hex, surface) >= ratio && contrastRatio(hex, tint) >= ratio;
|
|
11109
|
+
}
|
|
11110
|
+
function actionColorFor(hex, surface = LIGHT_DRAWN_COLORS.surface) {
|
|
11111
|
+
return readsOnCardAndTint(hex, TEXT_CONTRAST, surface) ? "brand" : "ink";
|
|
11112
|
+
}
|
|
11113
|
+
function markColorFor(hex, surface = LIGHT_DRAWN_COLORS.surface) {
|
|
11114
|
+
return readsOnCardAndTint(hex, AA_GRAPHIC_CONTRAST, surface) ? "brand" : "ink";
|
|
11115
|
+
}
|
|
11116
|
+
function onPrimaryFor(hex) {
|
|
11117
|
+
const luminance = relativeLuminance(hex);
|
|
11118
|
+
const againstWhite = 1.05 / (luminance + 0.05);
|
|
11119
|
+
const againstBlack = (luminance + 0.05) / 0.05;
|
|
11120
|
+
return againstBlack >= againstWhite ? "black" : "white";
|
|
11121
|
+
}
|
|
11122
|
+
function panelOf(palette, text, drawn) {
|
|
11123
|
+
if (palette.panelColor) return palette.panelColor;
|
|
11124
|
+
if (palette.surfaceColor)
|
|
11125
|
+
return mixOver(text, PANEL_TINT_PERCENT, palette.surfaceColor);
|
|
11126
|
+
return drawn.panel;
|
|
11127
|
+
}
|
|
11128
|
+
function mutedOn(palette, background, drawn) {
|
|
11129
|
+
if (palette.mutedTextColor) return palette.mutedTextColor;
|
|
11130
|
+
if (palette.textColor)
|
|
11131
|
+
return mixOver(palette.textColor, MUTED_TEXT_PERCENT, background);
|
|
11132
|
+
return drawn.mutedText;
|
|
11133
|
+
}
|
|
11134
|
+
function floorToHundredths(ratio) {
|
|
11135
|
+
return Math.floor(ratio * 100) / 100;
|
|
11136
|
+
}
|
|
11137
|
+
function paletteFailures(palette, drawn = {}) {
|
|
11138
|
+
const colors = { ...LIGHT_DRAWN_COLORS, ...drawn };
|
|
11139
|
+
const text = palette.textColor ?? colors.text;
|
|
11140
|
+
const backgrounds = [
|
|
11141
|
+
{
|
|
11142
|
+
background: "surfaceColor",
|
|
11143
|
+
color: palette.surfaceColor ?? colors.surface
|
|
11144
|
+
},
|
|
11145
|
+
{ background: "panelColor", color: panelOf(palette, text, colors) }
|
|
11146
|
+
];
|
|
11147
|
+
return backgrounds.flatMap(({ background, color }) => {
|
|
11148
|
+
const pairs = [
|
|
11149
|
+
{ foreground: "textColor", color: text, needs: TEXT_CONTRAST },
|
|
11150
|
+
{
|
|
11151
|
+
foreground: "mutedTextColor",
|
|
11152
|
+
color: mutedOn(palette, color, colors),
|
|
11153
|
+
needs: TEXT_CONTRAST
|
|
11154
|
+
},
|
|
11155
|
+
...palette.focusColor ? [
|
|
11156
|
+
{
|
|
11157
|
+
foreground: "focusColor",
|
|
11158
|
+
color: palette.focusColor,
|
|
11159
|
+
needs: AA_GRAPHIC_CONTRAST
|
|
11160
|
+
}
|
|
11161
|
+
] : []
|
|
11162
|
+
];
|
|
11163
|
+
return pairs.flatMap(({ foreground, color: ink, needs }) => {
|
|
11164
|
+
const ratio = contrastRatio(ink, color);
|
|
11165
|
+
return ratio >= needs ? [] : [{ foreground, background, ratio: floorToHundredths(ratio), needs }];
|
|
11166
|
+
});
|
|
11167
|
+
});
|
|
11168
|
+
}
|
|
11169
|
+
function drawablePalette(chosen, drawn = {}) {
|
|
11170
|
+
const { focusColor, borderColor, ...surfacesAndText } = chosen;
|
|
11171
|
+
const kept = paletteFailures(surfacesAndText, drawn).length === 0 ? surfacesAndText : {};
|
|
11172
|
+
const focusShows = focusColor !== void 0 && paletteFailures({ ...kept, focusColor }, drawn).length === 0;
|
|
11173
|
+
return {
|
|
11174
|
+
...kept,
|
|
11175
|
+
...borderColor ? { borderColor } : {},
|
|
11176
|
+
...focusShows ? { focusColor } : {}
|
|
11177
|
+
};
|
|
11178
|
+
}
|
|
11179
|
+
function brandTokens(brand) {
|
|
11180
|
+
for (const [field, value] of Object.entries(brand)) {
|
|
11181
|
+
if (value !== void 0 && !isHexColor(value)) {
|
|
11182
|
+
throw new RangeError(
|
|
11183
|
+
`${field} must be a #rrggbb color, got ${JSON.stringify(value)}`
|
|
11184
|
+
);
|
|
11185
|
+
}
|
|
11186
|
+
}
|
|
11187
|
+
const { primaryColor: primary, secondaryColor, ...chosen } = brand;
|
|
11188
|
+
const palette = drawablePalette(chosen);
|
|
11189
|
+
const surface = palette.surfaceColor ?? LIGHT_DRAWN_COLORS.surface;
|
|
11190
|
+
const panel = panelOf(
|
|
11191
|
+
palette,
|
|
11192
|
+
palette.textColor ?? LIGHT_DRAWN_COLORS.text,
|
|
11193
|
+
LIGHT_DRAWN_COLORS
|
|
11194
|
+
);
|
|
11195
|
+
const ink = palette.textColor ?? LIGHT_DRAWN_COLORS.text;
|
|
11196
|
+
const onPrimary = onPrimaryFor(primary);
|
|
11197
|
+
const inBrand = (pick) => pick === "brand" ? primary : ink;
|
|
11198
|
+
const tokens = {
|
|
11199
|
+
"--consent-primary": primary,
|
|
11200
|
+
"--consent-on-primary": onPrimary,
|
|
11201
|
+
"--consent-link": inBrand(actionColorFor(primary, surface)),
|
|
11202
|
+
"--cs-surface-accent": primary,
|
|
11203
|
+
"--cs-surface-accent-text": onPrimary,
|
|
11204
|
+
"--cs-tint": mixOver(primary, TINT_PERCENT, surface),
|
|
11205
|
+
"--cs-tint-line": mixOver(primary, TINT_LINE_PERCENT, surface),
|
|
11206
|
+
"--cs-mark": inBrand(markColorFor(primary, surface)),
|
|
11207
|
+
"--cs-action": inBrand(actionColorFor(primary, surface)),
|
|
11208
|
+
"--cs-focus-ring": palette.focusColor ?? inBrand(focusRingFor(primary, surface))
|
|
11209
|
+
};
|
|
11210
|
+
if (secondaryColor) {
|
|
11211
|
+
tokens["--cs-icon"] = iconColorFor(secondaryColor, primary, {
|
|
11212
|
+
surface,
|
|
11213
|
+
panel
|
|
11214
|
+
});
|
|
11215
|
+
}
|
|
11216
|
+
if (palette.surfaceColor) tokens["--cs-surface-card"] = palette.surfaceColor;
|
|
11217
|
+
if (palette.surfaceColor || palette.panelColor)
|
|
11218
|
+
tokens["--cs-surface-inset"] = panel;
|
|
11219
|
+
if (palette.borderColor) tokens["--cs-surface-border"] = palette.borderColor;
|
|
11220
|
+
if (palette.textColor) {
|
|
11221
|
+
tokens["--cs-text-primary"] = palette.textColor;
|
|
11222
|
+
tokens["--cs-text-secondary"] = palette.textColor;
|
|
11223
|
+
}
|
|
11224
|
+
if (palette.mutedTextColor) {
|
|
11225
|
+
tokens["--cs-text-tertiary"] = palette.mutedTextColor;
|
|
11226
|
+
} else if (palette.textColor) {
|
|
11227
|
+
tokens["--cs-text-tertiary"] = `color-mix(in srgb, ${palette.textColor} ${MUTED_TEXT_PERCENT}%, transparent)`;
|
|
11228
|
+
}
|
|
11229
|
+
return tokens;
|
|
11230
|
+
}
|
|
11231
|
+
function brandStyle(brand) {
|
|
11232
|
+
return Object.entries(brandTokens(brand)).map(([property, value]) => `${property}: ${value};`).join(" ");
|
|
11233
|
+
}
|
|
11234
|
+
|
|
11235
|
+
// ../../node_modules/.pnpm/@kya-os+id@0.8.0_@cfworker+json-schema@4.1.1_better-auth@1.7.7_@opentelemetry+api@1.9.0_98d979a42ec866ed3ae12afd77bd7a00/node_modules/@kya-os/id/dist/base64url.js
|
|
9579
11236
|
function bytesToBase64Url(bytes) {
|
|
9580
11237
|
let b642;
|
|
9581
11238
|
if (typeof Buffer !== "undefined") {
|
|
@@ -9610,14 +11267,14 @@ function base64UrlToBytesStrict(s5) {
|
|
|
9610
11267
|
return bytesToBase64Url(bytes) === s5 ? bytes : null;
|
|
9611
11268
|
}
|
|
9612
11269
|
|
|
9613
|
-
// ../../node_modules/.pnpm/@kya-os+id@0.8.0_@cfworker+json-schema@4.1.1_better-auth@1.7.7_@opentelemetry+api@1.9.
|
|
11270
|
+
// ../../node_modules/.pnpm/@kya-os+id@0.8.0_@cfworker+json-schema@4.1.1_better-auth@1.7.7_@opentelemetry+api@1.9.0_98d979a42ec866ed3ae12afd77bd7a00/node_modules/@kya-os/id/dist/passkey/types.js
|
|
9614
11271
|
var PASSKEY_COSE_ALGORITHMS = Object.freeze([
|
|
9615
11272
|
-8,
|
|
9616
11273
|
-7,
|
|
9617
11274
|
-257
|
|
9618
11275
|
]);
|
|
9619
11276
|
|
|
9620
|
-
// ../../node_modules/.pnpm/@kya-os+id@0.8.0_@cfworker+json-schema@4.1.1_better-auth@1.7.7_@opentelemetry+api@1.9.
|
|
11277
|
+
// ../../node_modules/.pnpm/@kya-os+id@0.8.0_@cfworker+json-schema@4.1.1_better-auth@1.7.7_@opentelemetry+api@1.9.0_98d979a42ec866ed3ae12afd77bd7a00/node_modules/@kya-os/id/dist/wallet/passkey.js
|
|
9621
11278
|
var PasskeyCeremonyError = class extends Error {
|
|
9622
11279
|
constructor(code, message, options) {
|
|
9623
11280
|
super(message, options);
|
|
@@ -9830,6 +11487,7 @@ var ConsentPasskey = class extends i4 {
|
|
|
9830
11487
|
constructor() {
|
|
9831
11488
|
super(...arguments);
|
|
9832
11489
|
this.disabled = false;
|
|
11490
|
+
this.preview = false;
|
|
9833
11491
|
this.supportResult = null;
|
|
9834
11492
|
this.phase = "checking";
|
|
9835
11493
|
/** Bumped on every start and every new step, so a stale result is dropped. */
|
|
@@ -9885,6 +11543,7 @@ var ConsentPasskey = class extends i4 {
|
|
|
9885
11543
|
}
|
|
9886
11544
|
/** The button's click handler: the only path that starts a ceremony. */
|
|
9887
11545
|
async handleClick() {
|
|
11546
|
+
if (this.preview) return;
|
|
9888
11547
|
const ceremony = this.validCeremony();
|
|
9889
11548
|
const options = this.options;
|
|
9890
11549
|
if (!this.canStart() || ceremony === void 0 || !options) return;
|
|
@@ -9967,12 +11626,17 @@ var ConsentPasskey = class extends i4 {
|
|
|
9967
11626
|
<button
|
|
9968
11627
|
part="button"
|
|
9969
11628
|
type="button"
|
|
9970
|
-
?disabled=${!this.canStart()}
|
|
11629
|
+
?disabled=${!this.preview && !this.canStart()}
|
|
9971
11630
|
@click=${this.handleClick}
|
|
9972
11631
|
>
|
|
9973
|
-
${this.config?.buttonText || ceremonyCopy.button}
|
|
11632
|
+
${renderButtonIcon()}${this.config?.buttonText || ceremonyCopy.button}
|
|
9974
11633
|
</button>
|
|
9975
|
-
<p
|
|
11634
|
+
<p
|
|
11635
|
+
class="status${status ? "" : " quiet"}"
|
|
11636
|
+
part="status"
|
|
11637
|
+
role="status"
|
|
11638
|
+
aria-live="polite"
|
|
11639
|
+
>
|
|
9976
11640
|
${status}
|
|
9977
11641
|
</p>
|
|
9978
11642
|
${errorCode ? b2`<p class="error" part="error" role="alert">
|
|
@@ -9993,6 +11657,7 @@ ConsentPasskey.styles = i`
|
|
|
9993
11657
|
}
|
|
9994
11658
|
|
|
9995
11659
|
.container {
|
|
11660
|
+
position: relative;
|
|
9996
11661
|
display: flex;
|
|
9997
11662
|
flex-direction: column;
|
|
9998
11663
|
gap: 12px;
|
|
@@ -10033,11 +11698,17 @@ ConsentPasskey.styles = i`
|
|
|
10033
11698
|
color: var(--cs-text-secondary, #334155);
|
|
10034
11699
|
}
|
|
10035
11700
|
|
|
11701
|
+
/* Set out like the action bar's passkey Allow: the fingerprint, then the label. */
|
|
10036
11702
|
button {
|
|
11703
|
+
display: flex;
|
|
11704
|
+
align-items: center;
|
|
11705
|
+
justify-content: center;
|
|
11706
|
+
gap: 8px;
|
|
11707
|
+
box-sizing: border-box;
|
|
10037
11708
|
width: 100%;
|
|
10038
11709
|
padding: 14px 18px;
|
|
10039
11710
|
border: none;
|
|
10040
|
-
border-radius:
|
|
11711
|
+
border-radius: var(--cs-action-radius, 6px);
|
|
10041
11712
|
min-height: var(--cs-action-min-height, 0px);
|
|
10042
11713
|
background: var(--cs-surface-accent, #0f172a);
|
|
10043
11714
|
color: var(--cs-surface-accent-text, #ffffff);
|
|
@@ -10052,6 +11723,12 @@ ConsentPasskey.styles = i`
|
|
|
10052
11723
|
opacity: 0.92;
|
|
10053
11724
|
}
|
|
10054
11725
|
|
|
11726
|
+
.button-icon {
|
|
11727
|
+
flex: none;
|
|
11728
|
+
width: 16px;
|
|
11729
|
+
height: 16px;
|
|
11730
|
+
}
|
|
11731
|
+
|
|
10055
11732
|
button:disabled {
|
|
10056
11733
|
opacity: 0.5;
|
|
10057
11734
|
cursor: not-allowed;
|
|
@@ -10064,13 +11741,25 @@ ConsentPasskey.styles = i`
|
|
|
10064
11741
|
|
|
10065
11742
|
.status {
|
|
10066
11743
|
margin: 0;
|
|
10067
|
-
min-height: 1em;
|
|
10068
11744
|
font-size: 12.5px;
|
|
10069
|
-
color: var(--cs-text-tertiary, #
|
|
11745
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
10070
11746
|
}
|
|
10071
11747
|
|
|
10072
|
-
|
|
10073
|
-
|
|
11748
|
+
/*
|
|
11749
|
+
* With nothing to say, the line takes no room and no gap, so the button
|
|
11750
|
+
* sits as far from the card's bottom as the heading from its top. It is
|
|
11751
|
+
* hidden from sight only, not with display: none, so it stays a live
|
|
11752
|
+
* region a screen reader watches and what it says next is announced.
|
|
11753
|
+
* A class marks it, not :empty: the template's whitespace around the
|
|
11754
|
+
* text keeps :empty from ever matching.
|
|
11755
|
+
*/
|
|
11756
|
+
.status.quiet {
|
|
11757
|
+
position: absolute;
|
|
11758
|
+
width: 1px;
|
|
11759
|
+
height: 1px;
|
|
11760
|
+
overflow: hidden;
|
|
11761
|
+
clip-path: inset(50%);
|
|
11762
|
+
white-space: nowrap;
|
|
10074
11763
|
}
|
|
10075
11764
|
|
|
10076
11765
|
.error {
|
|
@@ -10087,7 +11776,7 @@ ConsentPasskey.styles = i`
|
|
|
10087
11776
|
margin: 0;
|
|
10088
11777
|
font-size: 12.5px;
|
|
10089
11778
|
line-height: 1.5;
|
|
10090
|
-
color: var(--cs-text-tertiary, #
|
|
11779
|
+
color: var(--cs-text-tertiary, #5d6c82);
|
|
10091
11780
|
}
|
|
10092
11781
|
`;
|
|
10093
11782
|
__decorateClass([
|
|
@@ -10102,6 +11791,9 @@ __decorateClass([
|
|
|
10102
11791
|
__decorateClass([
|
|
10103
11792
|
n4({ type: Boolean, reflect: true })
|
|
10104
11793
|
], ConsentPasskey.prototype, "disabled", 2);
|
|
11794
|
+
__decorateClass([
|
|
11795
|
+
n4({ type: Boolean, reflect: true })
|
|
11796
|
+
], ConsentPasskey.prototype, "preview", 2);
|
|
10105
11797
|
__decorateClass([
|
|
10106
11798
|
r5()
|
|
10107
11799
|
], ConsentPasskey.prototype, "supportResult", 2);
|
|
@@ -10123,6 +11815,21 @@ function toErrorDetail(error) {
|
|
|
10123
11815
|
message: error instanceof Error ? error.message : String(error)
|
|
10124
11816
|
};
|
|
10125
11817
|
}
|
|
11818
|
+
function renderButtonIcon() {
|
|
11819
|
+
return b2`<svg
|
|
11820
|
+
part="button-icon"
|
|
11821
|
+
class="button-icon"
|
|
11822
|
+
viewBox="0 0 24 24"
|
|
11823
|
+
fill="none"
|
|
11824
|
+
stroke="currentColor"
|
|
11825
|
+
stroke-width="2"
|
|
11826
|
+
stroke-linecap="round"
|
|
11827
|
+
stroke-linejoin="round"
|
|
11828
|
+
aria-hidden="true"
|
|
11829
|
+
>
|
|
11830
|
+
${fingerprintIcon}
|
|
11831
|
+
</svg>`;
|
|
11832
|
+
}
|
|
10126
11833
|
function renderIcon() {
|
|
10127
11834
|
return b2`
|
|
10128
11835
|
<svg
|
|
@@ -10142,6 +11849,8 @@ function renderIcon() {
|
|
|
10142
11849
|
}
|
|
10143
11850
|
export {
|
|
10144
11851
|
CONSENT_CAPABILITIES_FEATURES,
|
|
11852
|
+
CONSENT_EDIT_EVENTS,
|
|
11853
|
+
CONSENT_EDIT_KEYS,
|
|
10145
11854
|
ConsentActionBar,
|
|
10146
11855
|
ConsentAgentHeader,
|
|
10147
11856
|
ConsentButton,
|
|
@@ -10159,7 +11868,13 @@ export {
|
|
|
10159
11868
|
ConsentRevocationNotice,
|
|
10160
11869
|
ConsentShell,
|
|
10161
11870
|
ConsentTerms,
|
|
10162
|
-
McpConsent
|
|
11871
|
+
McpConsent,
|
|
11872
|
+
PALETTE_FIELDS,
|
|
11873
|
+
brandStyle,
|
|
11874
|
+
brandTokens,
|
|
11875
|
+
drawablePalette,
|
|
11876
|
+
paletteFailures,
|
|
11877
|
+
parseConsentEditKey
|
|
10163
11878
|
};
|
|
10164
11879
|
/*! Bundled license information:
|
|
10165
11880
|
|