@kya-os/consent 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +186 -22
- package/dist/bundle/index.d.ts +9 -0
- package/dist/bundle/index.d.ts.map +1 -1
- package/dist/bundle/index.js +13 -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 +36 -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 +456 -117
- package/dist/cjs/components/consent-capabilities-screen.js.map +1 -1
- package/dist/cjs/components/consent-capability-card.js +159 -32
- 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 +262 -45
- 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-flow-timeline.js +177 -0
- package/dist/cjs/components/consent-flow-timeline.js.map +1 -0
- package/dist/cjs/components/consent-flow.js +540 -0
- package/dist/cjs/components/consent-flow.js.map +1 -0
- package/dist/cjs/components/consent-footer.js +22 -14
- package/dist/cjs/components/consent-footer.js.map +1 -1
- package/dist/cjs/components/consent-headline.js +353 -33
- package/dist/cjs/components/consent-headline.js.map +1 -1
- package/dist/cjs/components/consent-oauth-button.js +68 -138
- 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 +29 -18
- 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 +26 -2
- package/dist/cjs/components/consent-wallet-check.js.map +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 +37 -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/flow-blocks.js +762 -0
- package/dist/cjs/components/flow-blocks.js.map +1 -0
- package/dist/cjs/components/flow-motion.js +177 -0
- package/dist/cjs/components/flow-motion.js.map +1 -0
- package/dist/cjs/components/grant-details.js +143 -0
- package/dist/cjs/components/grant-details.js.map +1 -0
- package/dist/cjs/components/grant-field-styles.js +2 -2
- package/dist/cjs/components/index.js +13 -1
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/components/mcp-consent.js +93 -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/components/provider-icons.js +92 -0
- package/dist/cjs/components/provider-icons.js.map +1 -0
- package/dist/cjs/constants/capabilities.js +17 -2
- package/dist/cjs/constants/capabilities.js.map +1 -1
- package/dist/cjs/copy/tokens.js +67 -24
- package/dist/cjs/copy/tokens.js.map +1 -1
- package/dist/cjs/flow/copy.js +146 -0
- package/dist/cjs/flow/copy.js.map +1 -0
- package/dist/cjs/flow/index.js +31 -0
- package/dist/cjs/flow/index.js.map +1 -0
- package/dist/cjs/flow/model.js +107 -0
- package/dist/cjs/flow/model.js.map +1 -0
- package/dist/cjs/flow/presets.js +157 -0
- package/dist/cjs/flow/presets.js.map +1 -0
- package/dist/cjs/flow/schema.js +76 -0
- package/dist/cjs/flow/schema.js.map +1 -0
- 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 +40 -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 +102 -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 +101 -17
- package/dist/components/consent-capabilities-screen.d.ts.map +1 -1
- package/dist/components/consent-capabilities-screen.js +457 -118
- package/dist/components/consent-capabilities-screen.js.map +1 -1
- package/dist/components/consent-capability-card.d.ts +32 -3
- package/dist/components/consent-capability-card.d.ts.map +1 -1
- package/dist/components/consent-capability-card.js +159 -32
- 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 +52 -7
- package/dist/components/consent-connector-header.d.ts.map +1 -1
- package/dist/components/consent-connector-header.js +262 -45
- package/dist/components/consent-connector-header.js.map +1 -1
- package/dist/components/consent-duration.js +1 -1
- package/dist/components/consent-flow-timeline.d.ts +49 -0
- package/dist/components/consent-flow-timeline.d.ts.map +1 -0
- package/dist/components/consent-flow-timeline.js +174 -0
- package/dist/components/consent-flow-timeline.js.map +1 -0
- package/dist/components/consent-flow.d.ts +101 -0
- package/dist/components/consent-flow.d.ts.map +1 -0
- package/dist/components/consent-flow.js +504 -0
- package/dist/components/consent-flow.js.map +1 -0
- 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 +22 -14
- package/dist/components/consent-footer.js.map +1 -1
- package/dist/components/consent-headline.d.ts +62 -16
- package/dist/components/consent-headline.d.ts.map +1 -1
- package/dist/components/consent-headline.js +352 -34
- package/dist/components/consent-headline.js.map +1 -1
- package/dist/components/consent-oauth-button.d.ts +9 -6
- package/dist/components/consent-oauth-button.d.ts.map +1 -1
- package/dist/components/consent-oauth-button.js +71 -141
- 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 +29 -18
- 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.d.ts +8 -0
- package/dist/components/consent-wallet-check.d.ts.map +1 -1
- package/dist/components/consent-wallet-check.js +27 -3
- package/dist/components/consent-wallet-check.js.map +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 +26 -0
- package/dist/components/decision-icons.d.ts.map +1 -0
- package/dist/components/decision-icons.js +34 -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/flow-blocks.d.ts +45 -0
- package/dist/components/flow-blocks.d.ts.map +1 -0
- package/dist/components/flow-blocks.js +755 -0
- package/dist/components/flow-blocks.js.map +1 -0
- package/dist/components/flow-motion.d.ts +41 -0
- package/dist/components/flow-motion.d.ts.map +1 -0
- package/dist/components/flow-motion.js +164 -0
- package/dist/components/flow-motion.js.map +1 -0
- package/dist/components/grant-details.d.ts +28 -0
- package/dist/components/grant-details.d.ts.map +1 -0
- package/dist/components/grant-details.js +138 -0
- package/dist/components/grant-details.js.map +1 -0
- package/dist/components/grant-field-styles.js +2 -2
- package/dist/components/index.d.ts +5 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +5 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/mcp-consent.d.ts +19 -0
- package/dist/components/mcp-consent.d.ts.map +1 -1
- package/dist/components/mcp-consent.js +93 -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/components/provider-icons.d.ts +16 -0
- package/dist/components/provider-icons.d.ts.map +1 -0
- package/dist/components/provider-icons.js +88 -0
- package/dist/components/provider-icons.js.map +1 -0
- package/dist/consent.js +4875 -1178
- package/dist/consent.min.js +2367 -814
- package/dist/constants/capabilities.d.ts +16 -3
- package/dist/constants/capabilities.d.ts.map +1 -1
- package/dist/constants/capabilities.js +17 -2
- package/dist/constants/capabilities.js.map +1 -1
- package/dist/copy/tokens.d.ts +67 -24
- package/dist/copy/tokens.d.ts.map +1 -1
- package/dist/copy/tokens.js +67 -24
- package/dist/copy/tokens.js.map +1 -1
- package/dist/flow/copy.d.ts +31 -0
- package/dist/flow/copy.d.ts.map +1 -0
- package/dist/flow/copy.js +137 -0
- package/dist/flow/copy.js.map +1 -0
- package/dist/flow/index.d.ts +15 -0
- package/dist/flow/index.d.ts.map +1 -0
- package/dist/flow/index.js +15 -0
- package/dist/flow/index.js.map +1 -0
- package/dist/flow/model.d.ts +209 -0
- package/dist/flow/model.d.ts.map +1 -0
- package/dist/flow/model.js +103 -0
- package/dist/flow/model.js.map +1 -0
- package/dist/flow/presets.d.ts +29 -0
- package/dist/flow/presets.d.ts.map +1 -0
- package/dist/flow/presets.js +153 -0
- package/dist/flow/presets.js.map +1 -0
- package/dist/flow/schema.d.ts +127 -0
- package/dist/flow/schema.d.ts.map +1 -0
- package/dist/flow/schema.js +72 -0
- package/dist/flow/schema.js.map +1 -0
- 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 +27 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +39 -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 +76 -13
- package/dist/styles/theme.d.ts.map +1 -1
- package/dist/styles/theme.js +98 -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 +10 -5
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Consent flow timeline
|
|
9
|
+
*
|
|
10
|
+
* An editor's scrubber for a `<consent-flow>`: one button per step the flow
|
|
11
|
+
* has, in the flow's own order. Choosing one sets the flow's `step`; the
|
|
12
|
+
* timeline follows the flow's `consent-flow-step` events, so it shows the
|
|
13
|
+
* step whoever moved it. It never takes focus from the flow, nor the flow
|
|
14
|
+
* from it.
|
|
15
|
+
*
|
|
16
|
+
* <consent-flow id="preview" preview></consent-flow>
|
|
17
|
+
* <consent-flow-timeline for="preview"></consent-flow-timeline>
|
|
18
|
+
*
|
|
19
|
+
* @module components/consent-flow-timeline
|
|
20
|
+
*/
|
|
21
|
+
import { LitElement, css, html, nothing } from "lit";
|
|
22
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
23
|
+
import { FLOW_STEPS } from "../flow/model.js";
|
|
24
|
+
/** Each step's name on the timeline. An editor can pass its own (`labels`). */
|
|
25
|
+
export const FLOW_STEP_LABELS = {
|
|
26
|
+
"sign-in": "Sign in",
|
|
27
|
+
consent: "Review",
|
|
28
|
+
passkey: "Passkey",
|
|
29
|
+
cancelled: "Passkey dismissed",
|
|
30
|
+
granted: "Granted",
|
|
31
|
+
denied: "Declined",
|
|
32
|
+
expired: "Expired",
|
|
33
|
+
error: "Error",
|
|
34
|
+
};
|
|
35
|
+
let ConsentFlowTimeline = class ConsentFlowTimeline extends LitElement {
|
|
36
|
+
constructor() {
|
|
37
|
+
super(...arguments);
|
|
38
|
+
/** The id of the `<consent-flow>` it drives, in the same document or shadow root. */
|
|
39
|
+
this.htmlFor = "";
|
|
40
|
+
/** The flow it drives, when the host holds a reference rather than an id. Wins over `for`. */
|
|
41
|
+
this.target = null;
|
|
42
|
+
/** Step names to show instead of the defaults. */
|
|
43
|
+
this.labels = {};
|
|
44
|
+
/** The navigation's accessible name. */
|
|
45
|
+
this.label = "Consent flow steps";
|
|
46
|
+
this.current = null;
|
|
47
|
+
this.steps = [];
|
|
48
|
+
this.watched = null;
|
|
49
|
+
this.onStep = () => this.read();
|
|
50
|
+
}
|
|
51
|
+
connectedCallback() {
|
|
52
|
+
super.connectedCallback();
|
|
53
|
+
queueMicrotask(() => this.watch());
|
|
54
|
+
}
|
|
55
|
+
disconnectedCallback() {
|
|
56
|
+
super.disconnectedCallback();
|
|
57
|
+
this.watch(null);
|
|
58
|
+
}
|
|
59
|
+
willUpdate(changed) {
|
|
60
|
+
if (changed.has("target") || changed.has("htmlFor"))
|
|
61
|
+
this.watch();
|
|
62
|
+
}
|
|
63
|
+
/** The flow this timeline drives: `target`, else the element `for` names. */
|
|
64
|
+
resolve() {
|
|
65
|
+
if (this.target)
|
|
66
|
+
return this.target;
|
|
67
|
+
if (!this.htmlFor || !this.isConnected)
|
|
68
|
+
return null;
|
|
69
|
+
const root = this.getRootNode();
|
|
70
|
+
const found = root.getElementById?.(this.htmlFor);
|
|
71
|
+
return found && found.localName === "consent-flow"
|
|
72
|
+
? found
|
|
73
|
+
: null;
|
|
74
|
+
}
|
|
75
|
+
watch(next = this.resolve()) {
|
|
76
|
+
if (next === this.watched)
|
|
77
|
+
return;
|
|
78
|
+
this.watched?.removeEventListener("consent-flow-step", this.onStep);
|
|
79
|
+
this.watched = next;
|
|
80
|
+
next?.addEventListener("consent-flow-step", this.onStep);
|
|
81
|
+
this.read();
|
|
82
|
+
}
|
|
83
|
+
read() {
|
|
84
|
+
const flow = this.watched;
|
|
85
|
+
this.steps = flow
|
|
86
|
+
? FLOW_STEPS.filter((step) => Boolean(flow.flow.steps[step]))
|
|
87
|
+
: [];
|
|
88
|
+
this.current = flow?.currentStep ?? null;
|
|
89
|
+
}
|
|
90
|
+
choose(step) {
|
|
91
|
+
if (this.watched)
|
|
92
|
+
this.watched.step = step;
|
|
93
|
+
}
|
|
94
|
+
render() {
|
|
95
|
+
if (this.steps.length === 0)
|
|
96
|
+
return nothing;
|
|
97
|
+
return html `<nav aria-label=${this.label}>
|
|
98
|
+
<ol>
|
|
99
|
+
${this.steps.map((step) => html `<li>
|
|
100
|
+
<button
|
|
101
|
+
type="button"
|
|
102
|
+
aria-current=${step === this.current ? "step" : "false"}
|
|
103
|
+
@click=${() => this.choose(step)}
|
|
104
|
+
>
|
|
105
|
+
${this.labels[step] ?? FLOW_STEP_LABELS[step]}
|
|
106
|
+
</button>
|
|
107
|
+
</li>`)}
|
|
108
|
+
</ol>
|
|
109
|
+
</nav>`;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
ConsentFlowTimeline.styles = css `
|
|
113
|
+
:host {
|
|
114
|
+
display: block;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
ol {
|
|
118
|
+
display: flex;
|
|
119
|
+
flex-wrap: wrap;
|
|
120
|
+
gap: 4px 16px;
|
|
121
|
+
margin: 0;
|
|
122
|
+
padding: 0;
|
|
123
|
+
list-style: none;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
button {
|
|
127
|
+
padding: 6px 0;
|
|
128
|
+
border: 0;
|
|
129
|
+
border-bottom: 2px solid transparent;
|
|
130
|
+
background: none;
|
|
131
|
+
color: var(--cs-text-secondary, #475569);
|
|
132
|
+
font: inherit;
|
|
133
|
+
font-size: 13px;
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
button:hover {
|
|
138
|
+
color: var(--cs-text-primary, #0f172a);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
button[aria-current="step"] {
|
|
142
|
+
color: var(--cs-text-primary, #0f172a);
|
|
143
|
+
border-bottom-color: currentColor;
|
|
144
|
+
font-weight: 600;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
button:focus-visible {
|
|
148
|
+
outline: 2px solid var(--cs-focus-ring, currentColor);
|
|
149
|
+
outline-offset: 2px;
|
|
150
|
+
}
|
|
151
|
+
`;
|
|
152
|
+
__decorate([
|
|
153
|
+
property({ type: String, attribute: "for" })
|
|
154
|
+
], ConsentFlowTimeline.prototype, "htmlFor", void 0);
|
|
155
|
+
__decorate([
|
|
156
|
+
property({ attribute: false })
|
|
157
|
+
], ConsentFlowTimeline.prototype, "target", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
property({ attribute: false })
|
|
160
|
+
], ConsentFlowTimeline.prototype, "labels", void 0);
|
|
161
|
+
__decorate([
|
|
162
|
+
property({ type: String })
|
|
163
|
+
], ConsentFlowTimeline.prototype, "label", void 0);
|
|
164
|
+
__decorate([
|
|
165
|
+
state()
|
|
166
|
+
], ConsentFlowTimeline.prototype, "current", void 0);
|
|
167
|
+
__decorate([
|
|
168
|
+
state()
|
|
169
|
+
], ConsentFlowTimeline.prototype, "steps", void 0);
|
|
170
|
+
ConsentFlowTimeline = __decorate([
|
|
171
|
+
customElement("consent-flow-timeline")
|
|
172
|
+
], ConsentFlowTimeline);
|
|
173
|
+
export { ConsentFlowTimeline };
|
|
174
|
+
//# sourceMappingURL=consent-flow-timeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent-flow-timeline.js","sourceRoot":"","sources":["../../src/components/consent-flow-timeline.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,UAAU,EA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
*
|
|
4
|
+
* A whole consent flow as one element: the package's connector, a card of
|
|
5
|
+
* blocks, "Secured by" under it, and the motion between steps. The flow is
|
|
6
|
+
* data (`@kya-os/consent/flow`): which blocks each step draws, the
|
|
7
|
+
* connector's state, focus, the approval method, motion, copy. The host owns
|
|
8
|
+
* the transport: it sets `step`, and hears what the person did as
|
|
9
|
+
* `consent-flow-*` events. The element makes no network calls.
|
|
10
|
+
*
|
|
11
|
+
* <consent-flow></consent-flow>
|
|
12
|
+
* flowEl.flow = flowPreset("passkey", { signIn: true });
|
|
13
|
+
* flowEl.data = { agent, merchant, verb: "order", approver, capabilities };
|
|
14
|
+
* flowEl.addEventListener("consent-flow-approve", (e) => ...);
|
|
15
|
+
* flowEl.step = "passkey";
|
|
16
|
+
*
|
|
17
|
+
* The DOM is final, the step announced and focus moved before any motion
|
|
18
|
+
* runs. Focus moves to the step's `focus` block only when focus (or the last
|
|
19
|
+
* pointer press) was inside the flow, so a timeline scrubbing it never takes
|
|
20
|
+
* focus. Reduced motion, or the `none` preset, cross-fades only.
|
|
21
|
+
*
|
|
22
|
+
* @module components/consent-flow
|
|
23
|
+
*/
|
|
24
|
+
import { LitElement, type PropertyValues } from "lit";
|
|
25
|
+
import { type ConsentFlowData, type ConsentFlowDefinition, type ConsentFlowEventMap, type FlowConnectorState, type FlowCopy, type FlowStep } from "../flow/model.js";
|
|
26
|
+
import type { ConsentTheme } from "../types/capabilities.types.js";
|
|
27
|
+
import "./consent-action-bar.js";
|
|
28
|
+
import "./consent-capability-card.js";
|
|
29
|
+
import "./consent-connector-header.js";
|
|
30
|
+
import "./consent-request-expiry.js";
|
|
31
|
+
import "./consent-secured-by.js";
|
|
32
|
+
import "./consent-wallet-check.js";
|
|
33
|
+
/**
|
|
34
|
+
* The wallet check's status in each connector state: at rest (not lit) until
|
|
35
|
+
* the person acts, turning while the passkey is open, open at the top when
|
|
36
|
+
* the passkey was dismissed, on its green check once granted, and its error
|
|
37
|
+
* once nothing was granted.
|
|
38
|
+
*/
|
|
39
|
+
export declare const CONNECTOR_WALLET_STATUS: Readonly<Record<FlowConnectorState, string>>;
|
|
40
|
+
export declare class ConsentFlow extends LitElement {
|
|
41
|
+
/** The flow: a preset from `@kya-os/consent/flow`, or a saved one (`parseConsentFlow`). */
|
|
42
|
+
flow: ConsentFlowDefinition;
|
|
43
|
+
/** The request it draws. Nothing is drawn without it. */
|
|
44
|
+
data: ConsentFlowData | undefined;
|
|
45
|
+
/** The project's copy, over the flow's own (and over a first-time shopper's). */
|
|
46
|
+
copy: FlowCopy;
|
|
47
|
+
/**
|
|
48
|
+
* The step on screen. Unset, or a step this flow lacks, lands on the flow's
|
|
49
|
+
* `initial` (or `consent`, when swapping flows mid-way). Reflected.
|
|
50
|
+
*/
|
|
51
|
+
step: FlowStep | "";
|
|
52
|
+
/** `light` or `dark`. Brand colours come in as `--cs-*` properties, as on the screen. */
|
|
53
|
+
theme: ConsentTheme;
|
|
54
|
+
/** An editor's preview: links don't navigate, and every event says `preview: true`. */
|
|
55
|
+
preview: boolean;
|
|
56
|
+
private selected;
|
|
57
|
+
private resolved;
|
|
58
|
+
private drawn;
|
|
59
|
+
private signatures;
|
|
60
|
+
private atRest;
|
|
61
|
+
private pointerInside;
|
|
62
|
+
private generation;
|
|
63
|
+
constructor();
|
|
64
|
+
/** The step on screen, once drawn. */
|
|
65
|
+
get currentStep(): FlowStep | null;
|
|
66
|
+
connectedCallback(): void;
|
|
67
|
+
disconnectedCallback(): void;
|
|
68
|
+
private onDocumentPointer;
|
|
69
|
+
private get card();
|
|
70
|
+
private get fx();
|
|
71
|
+
protected willUpdate(changed: PropertyValues<this>): void;
|
|
72
|
+
/** The starting ticks: `defaultOn`. A new request keeps what is still asked for and ticks what is new by its default. */
|
|
73
|
+
private reselect;
|
|
74
|
+
/** The words: the defaults, the flow's, a first-time shopper's, then the project's. */
|
|
75
|
+
private words;
|
|
76
|
+
/** A flow event's init: the step and preview mode, then its own detail; bubbling and composed. */
|
|
77
|
+
private init;
|
|
78
|
+
/** An event from a block's snapshot, as it leaves, is not the person's. */
|
|
79
|
+
private fromLeaving;
|
|
80
|
+
private onAllow;
|
|
81
|
+
private onDeny;
|
|
82
|
+
private onExpired;
|
|
83
|
+
private onToggle;
|
|
84
|
+
private onClick;
|
|
85
|
+
private specs;
|
|
86
|
+
protected render(): unknown;
|
|
87
|
+
protected updated(changed: PropertyValues<this>): void;
|
|
88
|
+
/** The step's `focus` block takes focus: its own target (`tabindex="-1"`), else its first control. */
|
|
89
|
+
private focusStep;
|
|
90
|
+
/** From the boxes before to the boxes now: leave, resize, move, cross-fade, arrive. */
|
|
91
|
+
private animateStep;
|
|
92
|
+
static styles: import("lit").CSSResult;
|
|
93
|
+
}
|
|
94
|
+
declare global {
|
|
95
|
+
interface HTMLElementTagNameMap {
|
|
96
|
+
"consent-flow": ConsentFlow;
|
|
97
|
+
}
|
|
98
|
+
interface HTMLElementEventMap extends ConsentFlowEventMap {
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=consent-flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent-flow.d.ts","sourceRoot":"","sources":["../../src/components/consent-flow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EACL,UAAU,EAIV,KAAK,cAAc,EAEpB,MAAM,KAAK,CAAC;AAIb,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAQxB,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACd,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAUnE,OAAO,yBAAyB,CAAC;AACjC,OAAO,8BAA8B,CAAC;AACtC,OAAO,+BAA+B,CAAC;AACvC,OAAO,6BAA6B,CAAC;AACrC,OAAO,yBAAyB,CAAC;AACjC,OAAO,2BAA2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