@kya-os/mcp-i-cloudflare 1.6.62 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.d.ts +4 -2
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +121 -94
- package/dist/agent.js.map +1 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +9 -95
- package/dist/app.js.map +1 -1
- package/dist/services/consent-config.service.d.ts +9 -3
- package/dist/services/consent-config.service.d.ts.map +1 -1
- package/dist/services/consent-config.service.js +90 -100
- package/dist/services/consent-config.service.js.map +1 -1
- package/dist/services/consent-page-renderer.d.ts.map +1 -1
- package/dist/services/consent-page-renderer.js +0 -5
- package/dist/services/consent-page-renderer.js.map +1 -1
- package/dist/services/consent-templates/base/base-template.d.ts +79 -0
- package/dist/services/consent-templates/base/base-template.d.ts.map +1 -0
- package/dist/services/consent-templates/base/base-template.js +283 -0
- package/dist/services/consent-templates/base/base-template.js.map +1 -0
- package/dist/services/consent-templates/base/components.d.ts +120 -0
- package/dist/services/consent-templates/base/components.d.ts.map +1 -0
- package/dist/services/consent-templates/base/components.js +278 -0
- package/dist/services/consent-templates/base/components.js.map +1 -0
- package/dist/services/consent-templates/base/escape.d.ts +53 -0
- package/dist/services/consent-templates/base/escape.d.ts.map +1 -0
- package/dist/services/consent-templates/base/escape.js +115 -0
- package/dist/services/consent-templates/base/escape.js.map +1 -0
- package/dist/services/consent-templates/base/index.d.ts +10 -0
- package/dist/services/consent-templates/base/index.d.ts.map +1 -0
- package/dist/services/consent-templates/base/index.js +10 -0
- package/dist/services/consent-templates/base/index.js.map +1 -0
- package/dist/services/consent-templates/base/styles.d.ts +80 -0
- package/dist/services/consent-templates/base/styles.d.ts.map +1 -0
- package/dist/services/consent-templates/base/styles.js +226 -0
- package/dist/services/consent-templates/base/styles.js.map +1 -0
- package/dist/services/consent-templates/helpers.d.ts +60 -0
- package/dist/services/consent-templates/helpers.d.ts.map +1 -0
- package/dist/services/consent-templates/helpers.js +121 -0
- package/dist/services/consent-templates/helpers.js.map +1 -0
- package/dist/services/consent-templates/index.d.ts +28 -0
- package/dist/services/consent-templates/index.d.ts.map +1 -0
- package/dist/services/consent-templates/index.js +36 -0
- package/dist/services/consent-templates/index.js.map +1 -0
- package/dist/services/consent-templates/modes/consent-only.template.d.ts +36 -0
- package/dist/services/consent-templates/modes/consent-only.template.d.ts.map +1 -0
- package/dist/services/consent-templates/modes/consent-only.template.js +69 -0
- package/dist/services/consent-templates/modes/consent-only.template.js.map +1 -0
- package/dist/services/consent-templates/modes/credentials.template.d.ts +59 -0
- package/dist/services/consent-templates/modes/credentials.template.d.ts.map +1 -0
- package/dist/services/consent-templates/modes/credentials.template.js +393 -0
- package/dist/services/consent-templates/modes/credentials.template.js.map +1 -0
- package/dist/services/consent-templates/modes/index.d.ts +13 -0
- package/dist/services/consent-templates/modes/index.d.ts.map +1 -0
- package/dist/services/consent-templates/modes/index.js +13 -0
- package/dist/services/consent-templates/modes/index.js.map +1 -0
- package/dist/services/consent-templates/modes/magic-link.template.d.ts +33 -0
- package/dist/services/consent-templates/modes/magic-link.template.d.ts.map +1 -0
- package/dist/services/consent-templates/modes/magic-link.template.js +191 -0
- package/dist/services/consent-templates/modes/magic-link.template.js.map +1 -0
- package/dist/services/consent-templates/modes/oauth.template.d.ts +40 -0
- package/dist/services/consent-templates/modes/oauth.template.d.ts.map +1 -0
- package/dist/services/consent-templates/modes/oauth.template.js +151 -0
- package/dist/services/consent-templates/modes/oauth.template.js.map +1 -0
- package/dist/services/consent-templates/modes/otp.template.d.ts +35 -0
- package/dist/services/consent-templates/modes/otp.template.d.ts.map +1 -0
- package/dist/services/consent-templates/modes/otp.template.js +311 -0
- package/dist/services/consent-templates/modes/otp.template.js.map +1 -0
- package/dist/services/consent-templates/registry.d.ts +61 -0
- package/dist/services/consent-templates/registry.d.ts.map +1 -0
- package/dist/services/consent-templates/registry.js +136 -0
- package/dist/services/consent-templates/registry.js.map +1 -0
- package/dist/services/consent-templates/template-renderer.d.ts +118 -0
- package/dist/services/consent-templates/template-renderer.d.ts.map +1 -0
- package/dist/services/consent-templates/template-renderer.js +334 -0
- package/dist/services/consent-templates/template-renderer.js.map +1 -0
- package/dist/services/consent-templates/types.d.ts +194 -0
- package/dist/services/consent-templates/types.d.ts.map +1 -0
- package/dist/services/consent-templates/types.js +23 -0
- package/dist/services/consent-templates/types.js.map +1 -0
- package/dist/services/consent.service.d.ts +9 -0
- package/dist/services/consent.service.d.ts.map +1 -1
- package/dist/services/consent.service.js +50 -6
- package/dist/services/consent.service.js.map +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consent Page Styles
|
|
3
|
+
*
|
|
4
|
+
* CSS classes and generators matching AgentShield preview components EXACTLY:
|
|
5
|
+
* - PreviewShell.tsx → container styling
|
|
6
|
+
* - PreviewButton.tsx → button styling
|
|
7
|
+
* - PreviewCheckbox.tsx → checkbox styling
|
|
8
|
+
* - PreviewHeader.tsx → header styling
|
|
9
|
+
*
|
|
10
|
+
* @module consent-templates/base/styles
|
|
11
|
+
*/
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// Default Colors (Matching AgentShield constants.ts)
|
|
14
|
+
// ============================================================================
|
|
15
|
+
export const DEFAULT_COLORS = {
|
|
16
|
+
/** Primary brand color - buttons, links, accents */
|
|
17
|
+
primary: "#2563EB",
|
|
18
|
+
/** Secondary color - backgrounds, highlights */
|
|
19
|
+
secondary: "#DBEAFE",
|
|
20
|
+
/** Title text color */
|
|
21
|
+
title: "#333333",
|
|
22
|
+
/** Muted text color */
|
|
23
|
+
muted: "#6B7280",
|
|
24
|
+
/** Card border color */
|
|
25
|
+
border: "rgba(0,0,0,0.1)",
|
|
26
|
+
};
|
|
27
|
+
// ============================================================================
|
|
28
|
+
// CSS Classes (Matching AgentShield Preview Components)
|
|
29
|
+
// ============================================================================
|
|
30
|
+
/**
|
|
31
|
+
* CSS classes matching AgentShield's consent preview components.
|
|
32
|
+
* These ensure pixel-perfect parity between WYSIWYG editor and live pages.
|
|
33
|
+
*/
|
|
34
|
+
export const CONSENT_CLASSES = {
|
|
35
|
+
// Container - matches PreviewShell.tsx exactly
|
|
36
|
+
container: "bg-white rounded-[20px] border border-black/10 shadow-xl overflow-hidden",
|
|
37
|
+
// Header - matches PreviewHeader.tsx
|
|
38
|
+
headerWrapper: "px-8 pt-5",
|
|
39
|
+
headerCenter: "px-8 pt-5 text-center",
|
|
40
|
+
title: "text-2xl font-bold text-[#333333]",
|
|
41
|
+
subtitle: "text-sm text-gray-500 mt-1",
|
|
42
|
+
// Content - matches PreviewContent.tsx
|
|
43
|
+
content: "p-8 pt-4 space-y-6",
|
|
44
|
+
// Agent info - matches PreviewAgentInfo.tsx
|
|
45
|
+
agentWrapper: "flex gap-4 items-start",
|
|
46
|
+
agentIcon: "w-[54px] h-[54px] rounded-[10px] border border-gray-300 flex items-center justify-center flex-shrink-0 overflow-hidden bg-white",
|
|
47
|
+
agentDescription: "text-base text-black leading-[1.4] flex-1",
|
|
48
|
+
// Buttons - matches PreviewButton.tsx
|
|
49
|
+
buttonGroup: "flex gap-3 justify-end pt-2",
|
|
50
|
+
buttonPrimary: "px-4 py-2 rounded-md text-white font-medium transition-opacity hover:opacity-90",
|
|
51
|
+
buttonSecondary: "px-4 py-2 rounded-md border border-gray-300 text-gray-700 font-medium hover:bg-gray-50",
|
|
52
|
+
buttonFull: "w-full py-3 px-4 rounded-lg text-white font-medium transition-opacity hover:opacity-90",
|
|
53
|
+
// Form elements
|
|
54
|
+
input: "w-full px-4 py-3 bg-white border border-gray-300 rounded-lg shadow-sm placeholder-gray-400 transition-colors text-gray-900",
|
|
55
|
+
inputFocus: "focus:ring-2 focus:ring-[var(--consent-primary)] focus:border-[var(--consent-primary)] focus:outline-none",
|
|
56
|
+
// Checkbox - matches PreviewCheckbox.tsx
|
|
57
|
+
// Note: Uses appearance-none with custom styling for cross-browser white background
|
|
58
|
+
checkbox: "w-5 h-5 rounded border border-gray-300 bg-white checked:bg-[var(--consent-primary)] checked:border-[var(--consent-primary)] appearance-none cursor-pointer relative",
|
|
59
|
+
checkboxLabel: "flex items-start gap-3 cursor-pointer",
|
|
60
|
+
checkboxText: "text-sm text-gray-700",
|
|
61
|
+
// Expiration notice - matches ExpirationNotice.tsx
|
|
62
|
+
expirationWrapper: "flex items-center gap-2 p-3 rounded-lg",
|
|
63
|
+
// Links
|
|
64
|
+
link: "text-[var(--consent-primary)] hover:underline",
|
|
65
|
+
// Error container
|
|
66
|
+
errorContainer: "p-3 bg-red-50 border border-red-200 rounded-lg text-red-700 text-sm",
|
|
67
|
+
// Permissions list
|
|
68
|
+
permissionsList: "space-y-4",
|
|
69
|
+
permissionsHeader: "text-base text-black",
|
|
70
|
+
};
|
|
71
|
+
// ============================================================================
|
|
72
|
+
// CSS Variable Generation
|
|
73
|
+
// ============================================================================
|
|
74
|
+
/**
|
|
75
|
+
* Convert hex color to RGB values for rgba() usage.
|
|
76
|
+
*
|
|
77
|
+
* @param hex - Hex color (e.g., "#2563EB")
|
|
78
|
+
* @returns RGB values string (e.g., "37, 99, 235")
|
|
79
|
+
*/
|
|
80
|
+
function hexToRgb(hex) {
|
|
81
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
82
|
+
if (!result) {
|
|
83
|
+
// Default blue if invalid
|
|
84
|
+
return "37, 99, 235";
|
|
85
|
+
}
|
|
86
|
+
return `${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)}`;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Generate CSS variables from branding config.
|
|
90
|
+
* Includes shadcn/ui CSS variables for component compatibility.
|
|
91
|
+
*
|
|
92
|
+
* @param branding - Branding configuration
|
|
93
|
+
* @returns CSS variable declarations
|
|
94
|
+
*/
|
|
95
|
+
export function generateCSSVariables(branding) {
|
|
96
|
+
const primary = branding.primaryColor || DEFAULT_COLORS.primary;
|
|
97
|
+
const secondary = branding.secondaryColor || DEFAULT_COLORS.secondary;
|
|
98
|
+
return `
|
|
99
|
+
:root {
|
|
100
|
+
/* Consent branding */
|
|
101
|
+
--consent-primary: ${primary};
|
|
102
|
+
--consent-secondary: ${secondary};
|
|
103
|
+
--consent-primary-rgb: ${hexToRgb(primary)};
|
|
104
|
+
--consent-secondary-rgb: ${hexToRgb(secondary)};
|
|
105
|
+
|
|
106
|
+
/* shadcn/ui compatible variables */
|
|
107
|
+
--background: 0 0% 100%;
|
|
108
|
+
--foreground: 222.2 84% 4.9%;
|
|
109
|
+
--card: 0 0% 100%;
|
|
110
|
+
--card-foreground: 222.2 84% 4.9%;
|
|
111
|
+
--popover: 0 0% 100%;
|
|
112
|
+
--popover-foreground: 222.2 84% 4.9%;
|
|
113
|
+
--primary: 222.2 47.4% 11.2%;
|
|
114
|
+
--primary-foreground: 210 40% 98%;
|
|
115
|
+
--secondary: 210 40% 96.1%;
|
|
116
|
+
--secondary-foreground: 222.2 47.4% 11.2%;
|
|
117
|
+
--muted: 210 40% 96.1%;
|
|
118
|
+
--muted-foreground: 215.4 16.3% 46.9%;
|
|
119
|
+
--accent: 210 40% 96.1%;
|
|
120
|
+
--accent-foreground: 222.2 47.4% 11.2%;
|
|
121
|
+
--destructive: 0 84.2% 60.2%;
|
|
122
|
+
--destructive-foreground: 210 40% 98%;
|
|
123
|
+
--border: 214.3 31.8% 91.4%;
|
|
124
|
+
--input: 214.3 31.8% 91.4%;
|
|
125
|
+
--ring: 222.2 84% 4.9%;
|
|
126
|
+
--radius: 0.5rem;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* Class-based variables for Tailwind */
|
|
130
|
+
.bg-background { background-color: hsl(var(--background)); }
|
|
131
|
+
.text-foreground { color: hsl(var(--foreground)); }
|
|
132
|
+
.border-input { border-color: hsl(var(--input)); }
|
|
133
|
+
.ring-offset-background { --tw-ring-offset-color: hsl(var(--background)); }
|
|
134
|
+
.focus-visible\\:ring-ring:focus-visible { --tw-ring-color: hsl(var(--ring)); }
|
|
135
|
+
.placeholder\\:text-muted-foreground::placeholder { color: hsl(var(--muted-foreground)); }
|
|
136
|
+
`;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Generate component styles using CSS variables.
|
|
140
|
+
*
|
|
141
|
+
* @returns CSS stylesheet string
|
|
142
|
+
*/
|
|
143
|
+
export function generateStylesheet() {
|
|
144
|
+
return `
|
|
145
|
+
/* Primary button */
|
|
146
|
+
.btn-primary {
|
|
147
|
+
background-color: var(--consent-primary);
|
|
148
|
+
color: white;
|
|
149
|
+
}
|
|
150
|
+
.btn-primary:hover {
|
|
151
|
+
opacity: 0.9;
|
|
152
|
+
}
|
|
153
|
+
.btn-primary:focus {
|
|
154
|
+
outline: none;
|
|
155
|
+
box-shadow: 0 0 0 2px var(--consent-primary), 0 0 0 4px white;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* Text with primary color */
|
|
159
|
+
.text-primary {
|
|
160
|
+
color: var(--consent-primary);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* Background colors */
|
|
164
|
+
.bg-secondary {
|
|
165
|
+
background-color: var(--consent-secondary);
|
|
166
|
+
}
|
|
167
|
+
.bg-secondary-50 {
|
|
168
|
+
background-color: rgba(var(--consent-secondary-rgb), 0.5);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* Custom checkbox styling (appearance-none based) */
|
|
172
|
+
input[type="checkbox"] {
|
|
173
|
+
accent-color: var(--consent-primary);
|
|
174
|
+
}
|
|
175
|
+
input[type="checkbox"]:checked::after {
|
|
176
|
+
content: '';
|
|
177
|
+
position: absolute;
|
|
178
|
+
top: 2px;
|
|
179
|
+
left: 6px;
|
|
180
|
+
width: 5px;
|
|
181
|
+
height: 10px;
|
|
182
|
+
border: solid white;
|
|
183
|
+
border-width: 0 2px 2px 0;
|
|
184
|
+
transform: rotate(45deg);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* Focus ring */
|
|
188
|
+
.focus-primary:focus {
|
|
189
|
+
--tw-ring-color: var(--consent-primary);
|
|
190
|
+
border-color: var(--consent-primary);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/* Links */
|
|
194
|
+
a.link-primary {
|
|
195
|
+
color: var(--consent-primary);
|
|
196
|
+
}
|
|
197
|
+
a.link-primary:hover {
|
|
198
|
+
text-decoration: underline;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/* Form input focus */
|
|
202
|
+
input:focus, select:focus, textarea:focus {
|
|
203
|
+
outline: none;
|
|
204
|
+
border-color: var(--consent-primary);
|
|
205
|
+
box-shadow: 0 0 0 2px rgba(var(--consent-primary-rgb), 0.2);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* Hide elements */
|
|
209
|
+
.hidden {
|
|
210
|
+
display: none;
|
|
211
|
+
}
|
|
212
|
+
`;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Generate the complete head styles for a consent page.
|
|
216
|
+
*
|
|
217
|
+
* @param branding - Branding configuration
|
|
218
|
+
* @returns Complete style tag content
|
|
219
|
+
*/
|
|
220
|
+
export function generateHeadStyles(branding) {
|
|
221
|
+
return `
|
|
222
|
+
${generateCSSVariables(branding)}
|
|
223
|
+
${generateStylesheet()}
|
|
224
|
+
`;
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/services/consent-templates/base/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,+EAA+E;AAC/E,qDAAqD;AACrD,+EAA+E;AAE/E,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,oDAAoD;IACpD,OAAO,EAAE,SAAS;IAClB,gDAAgD;IAChD,SAAS,EAAE,SAAS;IACpB,uBAAuB;IACvB,KAAK,EAAE,SAAS;IACh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IACvB,CAAC;IACD,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AAC9F,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAGpC;IACC,MAAM,OAAO,GAAG,QAAQ,CAAC,YAAY,IAAI,cAAc,CAAC,OAAO,CAAC;IAChE,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,IAAI,cAAc,CAAC,SAAS,CAAC;IAEtE,OAAO;;;2BAGkB,OAAO;6BACL,SAAS;+BACP,QAAQ,CAAC,OAAO,CAAC;iCACf,QAAQ,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCjD,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEN,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAGlC;IACC,OAAO;MACH,oBAAoB,CAAC,QAAQ,CAAC;MAC9B,kBAAkB,EAAE;GACvB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consent Config Resolution Helpers
|
|
3
|
+
*
|
|
4
|
+
* Ported from AgentShield's lib/bouncer/consent/render-helpers.ts
|
|
5
|
+
* Ensures identical defaults and resolution logic for pixel-perfect parity.
|
|
6
|
+
*
|
|
7
|
+
* @module consent-templates/helpers
|
|
8
|
+
*/
|
|
9
|
+
import type { ResolvedConsentCopy, ResolvedConsentBranding, ResolvedConsentConfig, ConsentConfigWithMeta } from "./types";
|
|
10
|
+
/**
|
|
11
|
+
* Default values matching AgentShield's consent editor defaults.
|
|
12
|
+
* These ensure the same look when no custom config is provided.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DEFAULTS: {
|
|
15
|
+
readonly branding: {
|
|
16
|
+
readonly primaryColor: "#2563EB";
|
|
17
|
+
readonly secondaryColor: "#DBEAFE";
|
|
18
|
+
};
|
|
19
|
+
readonly ui: {
|
|
20
|
+
readonly title: "Permission request";
|
|
21
|
+
readonly description: "It looks like you would like to use [AI Agent] to buy items on your behalf. If so, we need a few things from you.";
|
|
22
|
+
readonly expirationText: "This delegation will expire in";
|
|
23
|
+
readonly cancelButtonText: "Cancel";
|
|
24
|
+
readonly submitButtonText: "Allow access";
|
|
25
|
+
readonly permissionsHeader: "The agent is requesting the following permissions:";
|
|
26
|
+
};
|
|
27
|
+
readonly terms: {
|
|
28
|
+
readonly text: "Terms and Conditions";
|
|
29
|
+
readonly required: true;
|
|
30
|
+
};
|
|
31
|
+
readonly expirationDays: 30;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Resolve copy from config with defaults and placeholder substitution.
|
|
35
|
+
*
|
|
36
|
+
* @param config - The consent configuration
|
|
37
|
+
* @param agentName - Optional agent name to substitute for [AI Agent] placeholder
|
|
38
|
+
* @returns Resolved copy values ready for rendering
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveConsentCopy(config: ConsentConfigWithMeta, agentName?: string): ResolvedConsentCopy;
|
|
41
|
+
/**
|
|
42
|
+
* Resolve branding from config with defaults and CSS variables.
|
|
43
|
+
*
|
|
44
|
+
* @param config - The consent configuration
|
|
45
|
+
* @returns Resolved branding values including CSS variables
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolveConsentBranding(config: ConsentConfigWithMeta): ResolvedConsentBranding;
|
|
48
|
+
/**
|
|
49
|
+
* Resolve all consent config values at once.
|
|
50
|
+
*
|
|
51
|
+
* @param config - The consent configuration from AgentShield
|
|
52
|
+
* @param agentName - Optional agent name for placeholder substitution
|
|
53
|
+
* @returns All resolved values ready for rendering
|
|
54
|
+
*/
|
|
55
|
+
export declare function resolveConsentConfig(config: ConsentConfigWithMeta, agentName?: string): ResolvedConsentConfig;
|
|
56
|
+
/**
|
|
57
|
+
* Get default consent config (used when no remote config available).
|
|
58
|
+
*/
|
|
59
|
+
export declare function getDefaultConsentConfig(): ConsentConfigWithMeta;
|
|
60
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/services/consent-templates/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAOjB;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;CAmBX,CAAC;AAMX;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,qBAAqB,EAC7B,SAAS,CAAC,EAAE,MAAM,GACjB,mBAAmB,CAiCrB;AAMD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,qBAAqB,GAC5B,uBAAuB,CAgBzB;AAMD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,qBAAqB,EAC7B,SAAS,CAAC,EAAE,MAAM,GACjB,qBAAqB,CAMvB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,qBAAqB,CAO/D"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consent Config Resolution Helpers
|
|
3
|
+
*
|
|
4
|
+
* Ported from AgentShield's lib/bouncer/consent/render-helpers.ts
|
|
5
|
+
* Ensures identical defaults and resolution logic for pixel-perfect parity.
|
|
6
|
+
*
|
|
7
|
+
* @module consent-templates/helpers
|
|
8
|
+
*/
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Default Values (Matching AgentShield constants.ts EXACTLY)
|
|
11
|
+
// ============================================================================
|
|
12
|
+
/**
|
|
13
|
+
* Default values matching AgentShield's consent editor defaults.
|
|
14
|
+
* These ensure the same look when no custom config is provided.
|
|
15
|
+
*/
|
|
16
|
+
export const DEFAULTS = {
|
|
17
|
+
branding: {
|
|
18
|
+
primaryColor: "#2563EB",
|
|
19
|
+
secondaryColor: "#DBEAFE",
|
|
20
|
+
},
|
|
21
|
+
ui: {
|
|
22
|
+
title: "Permission request",
|
|
23
|
+
description: "It looks like you would like to use [AI Agent] to buy items on your behalf. If so, we need a few things from you.",
|
|
24
|
+
expirationText: "This delegation will expire in",
|
|
25
|
+
cancelButtonText: "Cancel",
|
|
26
|
+
submitButtonText: "Allow access",
|
|
27
|
+
permissionsHeader: "The agent is requesting the following permissions:",
|
|
28
|
+
},
|
|
29
|
+
terms: {
|
|
30
|
+
text: "Terms and Conditions",
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
expirationDays: 30,
|
|
34
|
+
};
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// Copy Resolution
|
|
37
|
+
// ============================================================================
|
|
38
|
+
/**
|
|
39
|
+
* Resolve copy from config with defaults and placeholder substitution.
|
|
40
|
+
*
|
|
41
|
+
* @param config - The consent configuration
|
|
42
|
+
* @param agentName - Optional agent name to substitute for [AI Agent] placeholder
|
|
43
|
+
* @returns Resolved copy values ready for rendering
|
|
44
|
+
*/
|
|
45
|
+
export function resolveConsentCopy(config, agentName) {
|
|
46
|
+
const title = config.ui?.title ?? DEFAULTS.ui.title;
|
|
47
|
+
const description = config.ui?.description ?? DEFAULTS.ui.description;
|
|
48
|
+
const expirationText = config.ui?.expirationText ?? DEFAULTS.ui.expirationText;
|
|
49
|
+
const cancelButtonText = config.ui?.cancelButtonText ?? DEFAULTS.ui.cancelButtonText;
|
|
50
|
+
const submitButtonText = config.ui?.submitButtonText ?? DEFAULTS.ui.submitButtonText;
|
|
51
|
+
const permissionsHeader = config.ui?.permissionsHeader ?? DEFAULTS.ui.permissionsHeader;
|
|
52
|
+
const termsText = config.terms?.text ?? DEFAULTS.terms.text;
|
|
53
|
+
const termsRequired = config.terms?.required ?? DEFAULTS.terms.required;
|
|
54
|
+
// Substitute [AI Agent] placeholder
|
|
55
|
+
const agentPlaceholder = agentName ?? "an AI Agent";
|
|
56
|
+
const resolvedDescription = description.replaceAll("[AI Agent]", agentPlaceholder);
|
|
57
|
+
return {
|
|
58
|
+
title,
|
|
59
|
+
description,
|
|
60
|
+
resolvedDescription,
|
|
61
|
+
expirationText,
|
|
62
|
+
cancelButtonText,
|
|
63
|
+
submitButtonText,
|
|
64
|
+
permissionsHeader,
|
|
65
|
+
termsText,
|
|
66
|
+
termsUrl: config.terms?.url,
|
|
67
|
+
termsRequired,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
// ============================================================================
|
|
71
|
+
// Branding Resolution
|
|
72
|
+
// ============================================================================
|
|
73
|
+
/**
|
|
74
|
+
* Resolve branding from config with defaults and CSS variables.
|
|
75
|
+
*
|
|
76
|
+
* @param config - The consent configuration
|
|
77
|
+
* @returns Resolved branding values including CSS variables
|
|
78
|
+
*/
|
|
79
|
+
export function resolveConsentBranding(config) {
|
|
80
|
+
const primaryColor = config.branding?.primaryColor ?? DEFAULTS.branding.primaryColor;
|
|
81
|
+
const secondaryColor = config.branding?.secondaryColor ?? DEFAULTS.branding.secondaryColor;
|
|
82
|
+
return {
|
|
83
|
+
primaryColor,
|
|
84
|
+
secondaryColor,
|
|
85
|
+
logoUrl: config.branding?.logoUrl,
|
|
86
|
+
companyName: config.branding?.companyName,
|
|
87
|
+
cssVars: {
|
|
88
|
+
"--consent-primary": primaryColor,
|
|
89
|
+
"--consent-secondary": secondaryColor,
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
// ============================================================================
|
|
94
|
+
// Combined Resolution
|
|
95
|
+
// ============================================================================
|
|
96
|
+
/**
|
|
97
|
+
* Resolve all consent config values at once.
|
|
98
|
+
*
|
|
99
|
+
* @param config - The consent configuration from AgentShield
|
|
100
|
+
* @param agentName - Optional agent name for placeholder substitution
|
|
101
|
+
* @returns All resolved values ready for rendering
|
|
102
|
+
*/
|
|
103
|
+
export function resolveConsentConfig(config, agentName) {
|
|
104
|
+
return {
|
|
105
|
+
copy: resolveConsentCopy(config, agentName),
|
|
106
|
+
branding: resolveConsentBranding(config),
|
|
107
|
+
customFields: config.customFields || [],
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Get default consent config (used when no remote config available).
|
|
112
|
+
*/
|
|
113
|
+
export function getDefaultConsentConfig() {
|
|
114
|
+
return {
|
|
115
|
+
branding: DEFAULTS.branding,
|
|
116
|
+
ui: DEFAULTS.ui,
|
|
117
|
+
terms: DEFAULTS.terms,
|
|
118
|
+
expirationDays: DEFAULTS.expirationDays,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/services/consent-templates/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,+EAA+E;AAC/E,6DAA6D;AAC7D,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,QAAQ,EAAE;QACR,YAAY,EAAE,SAAS;QACvB,cAAc,EAAE,SAAS;KAC1B;IACD,EAAE,EAAE;QACF,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACT,mHAAmH;QACrH,cAAc,EAAE,gCAAgC;QAChD,gBAAgB,EAAE,QAAQ;QAC1B,gBAAgB,EAAE,cAAc;QAChC,iBAAiB,EAAE,oDAAoD;KACxE;IACD,KAAK,EAAE;QACL,IAAI,EAAE,sBAAsB;QAC5B,QAAQ,EAAE,IAAI;KACf;IACD,cAAc,EAAE,EAAE;CACV,CAAC;AAEX,+E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Shield's consent preview components.
|
|
6
|
+
*
|
|
7
|
+
* @module consent-templates
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { renderConsentPage, renderOAuthConsentPage } from './consent-templates';
|
|
12
|
+
*
|
|
13
|
+
* // Render with auto-detected auth mode
|
|
14
|
+
* const html = renderConsentPage(pageConfig, remoteConfig);
|
|
15
|
+
*
|
|
16
|
+
* // Render OAuth page with URL
|
|
17
|
+
* const oauthHtml = renderOAuthConsentPage(pageConfig, oauthUrl, remoteConfig);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export { renderConsentPage, renderOAuthConsentPage, getTemplateForMode, detectAuthMode, isValidAuthMode, getRegisteredModes, } from "./registry";
|
|
21
|
+
export { resolveConsentConfig, resolveConsentCopy, resolveConsentBranding, getDefaultConsentConfig, DEFAULTS, } from "./helpers";
|
|
22
|
+
export * from "./types";
|
|
23
|
+
export { BaseConsentTemplate } from "./base/base-template";
|
|
24
|
+
export { escapeHtml, escapeAttr, escapeJs, validateUrl, validateColor, } from "./base/escape";
|
|
25
|
+
export { CONSENT_CLASSES, DEFAULT_COLORS, generateHeadStyles, } from "./base/styles";
|
|
26
|
+
export { renderHeader, renderAgentInfo, renderButton, renderButtonGroup, renderCheckbox, renderInput, renderExpirationNotice, renderErrorContainer, renderLogo, } from "./base/components";
|
|
27
|
+
export { TemplateRenderer, createTemplateRenderer } from "./template-renderer";
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/consent-templates/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,QAAQ,GACT,MAAM,WAAW,CAAC;AAGnB,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG3D,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,aAAa,GACd,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,eAAe,EACf,cAAc,EACd,kBAAkB,GACnB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,GACX,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consent Templates System
|
|
3
|
+
*
|
|
4
|
+
* Modular, extensible consent page rendering with pixel-perfect
|
|
5
|
+
* parity to AgentShield's consent preview components.
|
|
6
|
+
*
|
|
7
|
+
* @module consent-templates
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { renderConsentPage, renderOAuthConsentPage } from './consent-templates';
|
|
12
|
+
*
|
|
13
|
+
* // Render with auto-detected auth mode
|
|
14
|
+
* const html = renderConsentPage(pageConfig, remoteConfig);
|
|
15
|
+
*
|
|
16
|
+
* // Render OAuth page with URL
|
|
17
|
+
* const oauthHtml = renderOAuthConsentPage(pageConfig, oauthUrl, remoteConfig);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
// Core rendering functions
|
|
21
|
+
export { renderConsentPage, renderOAuthConsentPage, getTemplateForMode, detectAuthMode, isValidAuthMode, getRegisteredModes, } from "./registry";
|
|
22
|
+
// Helper functions
|
|
23
|
+
export { resolveConsentConfig, resolveConsentCopy, resolveConsentBranding, getDefaultConsentConfig, DEFAULTS, } from "./helpers";
|
|
24
|
+
// Types
|
|
25
|
+
export * from "./types";
|
|
26
|
+
// Base template (for extending)
|
|
27
|
+
export { BaseConsentTemplate } from "./base/base-template";
|
|
28
|
+
// Escape utilities (for custom renderers)
|
|
29
|
+
export { escapeHtml, escapeAttr, escapeJs, validateUrl, validateColor, } from "./base/escape";
|
|
30
|
+
// Style constants (for custom renderers)
|
|
31
|
+
export { CONSENT_CLASSES, DEFAULT_COLORS, generateHeadStyles, } from "./base/styles";
|
|
32
|
+
// Components (for custom renderers)
|
|
33
|
+
export { renderHeader, renderAgentInfo, renderButton, renderButtonGroup, renderCheckbox, renderInput, renderExpirationNotice, renderErrorContainer, renderLogo, } from "./base/components";
|
|
34
|
+
// Template Renderer (drop-in replacement for ConsentPageRenderer)
|
|
35
|
+
export { TemplateRenderer, createTemplateRenderer } from "./template-renderer";
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/consent-templates/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,2BAA2B;AAC3B,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,mBAAmB;AACnB,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,QAAQ,GACT,MAAM,WAAW,CAAC;AAEnB,QAAQ;AACR,cAAc,SAAS,CAAC;AAExB,gCAAgC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,0CAA0C;AAC1C,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB,yCAAyC;AACzC,OAAO,EACL,eAAe,EACf,cAAc,EACd,kBAAkB,GACnB,MAAM,eAAe,CAAC;AAEvB,oCAAoC;AACpC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,GACX,MAAM,mBAAmB,CAAC;AAE3B,kEAAkE;AAClE,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consent-Only Template
|
|
3
|
+
*
|
|
4
|
+
* Default clickwrap consent without authentication.
|
|
5
|
+
* User simply agrees to permissions and terms.
|
|
6
|
+
*
|
|
7
|
+
* @module consent-templates/modes/consent-only
|
|
8
|
+
*/
|
|
9
|
+
import { BaseConsentTemplate } from "../base/base-template";
|
|
10
|
+
import type { AuthMode } from "../types";
|
|
11
|
+
/**
|
|
12
|
+
* Consent-Only Template
|
|
13
|
+
*
|
|
14
|
+
* Renders a simple clickwrap consent page:
|
|
15
|
+
* - Shows requested permissions as checkboxes (pre-checked, disabled)
|
|
16
|
+
* - Shows expiration notice
|
|
17
|
+
* - Terms acceptance checkbox
|
|
18
|
+
* - Cancel/Allow buttons
|
|
19
|
+
*/
|
|
20
|
+
export declare class ConsentOnlyTemplate extends BaseConsentTemplate {
|
|
21
|
+
get authMode(): AuthMode;
|
|
22
|
+
renderAuthContent(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Render the list of requested permissions.
|
|
25
|
+
*/
|
|
26
|
+
private renderPermissionsList;
|
|
27
|
+
/**
|
|
28
|
+
* Render a single scope item with info tooltip.
|
|
29
|
+
*/
|
|
30
|
+
private renderScopeItem;
|
|
31
|
+
/**
|
|
32
|
+
* Render the expiration notice.
|
|
33
|
+
*/
|
|
34
|
+
private renderExpirationNotice;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=consent-only.template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent-only.template.d.ts","sourceRoot":"","sources":["../../../../src/services/consent-templates/modes/consent-only.template.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;;;;;GAQG;AACH,qBAAa,mBAAoB,SAAQ,mBAAmB;IAC1D,IAAI,QAAQ,IAAI,QAAQ,CAEvB;IAED,iBAAiB,IAAI,MAAM;IAO3B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAsB7B;;OAEG;IACH,OAAO,CAAC,eAAe;IAWvB;;OAEG;IACH,OAAO,CAAC,sBAAsB;CAK/B"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consent-Only Template
|
|
3
|
+
*
|
|
4
|
+
* Default clickwrap consent without authentication.
|
|
5
|
+
* User simply agrees to permissions and terms.
|
|
6
|
+
*
|
|
7
|
+
* @module consent-templates/modes/consent-only
|
|
8
|
+
*/
|
|
9
|
+
import { BaseConsentTemplate } from "../base/base-template";
|
|
10
|
+
import { renderCheckbox, renderExpirationNotice } from "../base/components";
|
|
11
|
+
import { CONSENT_CLASSES } from "../base/styles";
|
|
12
|
+
import { escapeHtml } from "../base/escape";
|
|
13
|
+
/**
|
|
14
|
+
* Consent-Only Template
|
|
15
|
+
*
|
|
16
|
+
* Renders a simple clickwrap consent page:
|
|
17
|
+
* - Shows requested permissions as checkboxes (pre-checked, disabled)
|
|
18
|
+
* - Shows expiration notice
|
|
19
|
+
* - Terms acceptance checkbox
|
|
20
|
+
* - Cancel/Allow buttons
|
|
21
|
+
*/
|
|
22
|
+
export class ConsentOnlyTemplate extends BaseConsentTemplate {
|
|
23
|
+
get authMode() {
|
|
24
|
+
return "consent-only";
|
|
25
|
+
}
|
|
26
|
+
renderAuthContent() {
|
|
27
|
+
return `
|
|
28
|
+
${this.renderPermissionsList()}
|
|
29
|
+
${this.renderExpirationNotice()}
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Render the list of requested permissions.
|
|
34
|
+
*/
|
|
35
|
+
renderPermissionsList() {
|
|
36
|
+
const { copy } = this.resolved;
|
|
37
|
+
const { scopes } = this.config;
|
|
38
|
+
if (scopes.length === 0) {
|
|
39
|
+
return `<p class="text-sm text-gray-600">No specific permissions required.</p>`;
|
|
40
|
+
}
|
|
41
|
+
const scopeItems = scopes
|
|
42
|
+
.map((scope) => this.renderScopeItem(scope))
|
|
43
|
+
.join("");
|
|
44
|
+
return `
|
|
45
|
+
<div class="space-y-5">
|
|
46
|
+
<p class="${CONSENT_CLASSES.permissionsHeader}">${escapeHtml(copy.permissionsHeader)}</p>
|
|
47
|
+
<div class="${CONSENT_CLASSES.permissionsList}">
|
|
48
|
+
${scopeItems}
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Render a single scope item with info tooltip.
|
|
55
|
+
*/
|
|
56
|
+
renderScopeItem(scope) {
|
|
57
|
+
// Scopes are pre-checked and disabled (informational only)
|
|
58
|
+
return renderCheckbox(`scope_${scope}`, escapeHtml(scope), false, true, true);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Render the expiration notice.
|
|
62
|
+
*/
|
|
63
|
+
renderExpirationNotice() {
|
|
64
|
+
const { copy } = this.resolved;
|
|
65
|
+
const expirationDays = this.config.expirationDays || 30;
|
|
66
|
+
return renderExpirationNotice(copy.expirationText, expirationDays);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=consent-only.template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent-only.template.js","sourceRoot":"","sources":["../../../../src/services/consent-templates/modes/consent-only.template.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAA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