@kya-os/mcp-i-cloudflare 1.6.62 → 1.7.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.
Files changed (83) hide show
  1. package/dist/agent.d.ts +4 -2
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +121 -94
  4. package/dist/agent.js.map +1 -1
  5. package/dist/app.d.ts.map +1 -1
  6. package/dist/app.js +9 -95
  7. package/dist/app.js.map +1 -1
  8. package/dist/services/consent-config.service.d.ts +9 -3
  9. package/dist/services/consent-config.service.d.ts.map +1 -1
  10. package/dist/services/consent-config.service.js +90 -100
  11. package/dist/services/consent-config.service.js.map +1 -1
  12. package/dist/services/consent-page-renderer.d.ts.map +1 -1
  13. package/dist/services/consent-page-renderer.js +0 -5
  14. package/dist/services/consent-page-renderer.js.map +1 -1
  15. package/dist/services/consent-templates/base/base-template.d.ts +79 -0
  16. package/dist/services/consent-templates/base/base-template.d.ts.map +1 -0
  17. package/dist/services/consent-templates/base/base-template.js +283 -0
  18. package/dist/services/consent-templates/base/base-template.js.map +1 -0
  19. package/dist/services/consent-templates/base/components.d.ts +120 -0
  20. package/dist/services/consent-templates/base/components.d.ts.map +1 -0
  21. package/dist/services/consent-templates/base/components.js +278 -0
  22. package/dist/services/consent-templates/base/components.js.map +1 -0
  23. package/dist/services/consent-templates/base/escape.d.ts +53 -0
  24. package/dist/services/consent-templates/base/escape.d.ts.map +1 -0
  25. package/dist/services/consent-templates/base/escape.js +115 -0
  26. package/dist/services/consent-templates/base/escape.js.map +1 -0
  27. package/dist/services/consent-templates/base/index.d.ts +10 -0
  28. package/dist/services/consent-templates/base/index.d.ts.map +1 -0
  29. package/dist/services/consent-templates/base/index.js +10 -0
  30. package/dist/services/consent-templates/base/index.js.map +1 -0
  31. package/dist/services/consent-templates/base/styles.d.ts +80 -0
  32. package/dist/services/consent-templates/base/styles.d.ts.map +1 -0
  33. package/dist/services/consent-templates/base/styles.js +226 -0
  34. package/dist/services/consent-templates/base/styles.js.map +1 -0
  35. package/dist/services/consent-templates/helpers.d.ts +60 -0
  36. package/dist/services/consent-templates/helpers.d.ts.map +1 -0
  37. package/dist/services/consent-templates/helpers.js +121 -0
  38. package/dist/services/consent-templates/helpers.js.map +1 -0
  39. package/dist/services/consent-templates/index.d.ts +28 -0
  40. package/dist/services/consent-templates/index.d.ts.map +1 -0
  41. package/dist/services/consent-templates/index.js +36 -0
  42. package/dist/services/consent-templates/index.js.map +1 -0
  43. package/dist/services/consent-templates/modes/consent-only.template.d.ts +36 -0
  44. package/dist/services/consent-templates/modes/consent-only.template.d.ts.map +1 -0
  45. package/dist/services/consent-templates/modes/consent-only.template.js +69 -0
  46. package/dist/services/consent-templates/modes/consent-only.template.js.map +1 -0
  47. package/dist/services/consent-templates/modes/credentials.template.d.ts +59 -0
  48. package/dist/services/consent-templates/modes/credentials.template.d.ts.map +1 -0
  49. package/dist/services/consent-templates/modes/credentials.template.js +393 -0
  50. package/dist/services/consent-templates/modes/credentials.template.js.map +1 -0
  51. package/dist/services/consent-templates/modes/index.d.ts +13 -0
  52. package/dist/services/consent-templates/modes/index.d.ts.map +1 -0
  53. package/dist/services/consent-templates/modes/index.js +13 -0
  54. package/dist/services/consent-templates/modes/index.js.map +1 -0
  55. package/dist/services/consent-templates/modes/magic-link.template.d.ts +33 -0
  56. package/dist/services/consent-templates/modes/magic-link.template.d.ts.map +1 -0
  57. package/dist/services/consent-templates/modes/magic-link.template.js +191 -0
  58. package/dist/services/consent-templates/modes/magic-link.template.js.map +1 -0
  59. package/dist/services/consent-templates/modes/oauth.template.d.ts +40 -0
  60. package/dist/services/consent-templates/modes/oauth.template.d.ts.map +1 -0
  61. package/dist/services/consent-templates/modes/oauth.template.js +151 -0
  62. package/dist/services/consent-templates/modes/oauth.template.js.map +1 -0
  63. package/dist/services/consent-templates/modes/otp.template.d.ts +35 -0
  64. package/dist/services/consent-templates/modes/otp.template.d.ts.map +1 -0
  65. package/dist/services/consent-templates/modes/otp.template.js +311 -0
  66. package/dist/services/consent-templates/modes/otp.template.js.map +1 -0
  67. package/dist/services/consent-templates/registry.d.ts +61 -0
  68. package/dist/services/consent-templates/registry.d.ts.map +1 -0
  69. package/dist/services/consent-templates/registry.js +136 -0
  70. package/dist/services/consent-templates/registry.js.map +1 -0
  71. package/dist/services/consent-templates/template-renderer.d.ts +118 -0
  72. package/dist/services/consent-templates/template-renderer.d.ts.map +1 -0
  73. package/dist/services/consent-templates/template-renderer.js +334 -0
  74. package/dist/services/consent-templates/template-renderer.js.map +1 -0
  75. package/dist/services/consent-templates/types.d.ts +194 -0
  76. package/dist/services/consent-templates/types.d.ts.map +1 -0
  77. package/dist/services/consent-templates/types.js +23 -0
  78. package/dist/services/consent-templates/types.js.map +1 -0
  79. package/dist/services/consent.service.d.ts +9 -0
  80. package/dist/services/consent.service.d.ts.map +1 -1
  81. package/dist/services/consent.service.js +50 -6
  82. package/dist/services/consent.service.js.map +1 -1
  83. package/package.json +4 -3
@@ -0,0 +1,278 @@
1
+ /**
2
+ * Reusable HTML Components
3
+ *
4
+ * Each function corresponds to an AgentShield preview component:
5
+ * - renderLogo() → PreviewAgentInfo logo
6
+ * - renderHeader() → PreviewHeader
7
+ * - renderButton() → PreviewButton
8
+ * - renderCheckbox() → PreviewCheckbox
9
+ * - renderExpirationNotice() → ExpirationNotice
10
+ *
11
+ * @module consent-templates/base/components
12
+ */
13
+ import { CONSENT_CLASSES } from "./styles";
14
+ import { escapeHtml, escapeAttr, validateUrl } from "./escape";
15
+ // ============================================================================
16
+ // Logo & Agent Info
17
+ // ============================================================================
18
+ /**
19
+ * Render a default agent icon SVG.
20
+ * Used when no logo is provided.
21
+ */
22
+ export function renderDefaultAgentIcon() {
23
+ return `
24
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" class="text-gray-400">
25
+ <rect x="3" y="3" width="18" height="18" rx="2" stroke="currentColor" stroke-width="2" />
26
+ <circle cx="8" cy="8" r="1.5" fill="currentColor" />
27
+ <circle cx="16" cy="8" r="1.5" fill="currentColor" />
28
+ <path d="M8 14s1.5 2 4 2 4-2 4-2" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
29
+ </svg>
30
+ `;
31
+ }
32
+ /**
33
+ * Render a logo image or default icon.
34
+ *
35
+ * @param logoUrl - URL to logo image
36
+ * @param alt - Alt text for accessibility
37
+ * @returns HTML string
38
+ */
39
+ export function renderLogo(logoUrl, alt) {
40
+ if (!logoUrl) {
41
+ return renderDefaultAgentIcon();
42
+ }
43
+ const validUrl = validateUrl(logoUrl);
44
+ if (!validUrl) {
45
+ return renderDefaultAgentIcon();
46
+ }
47
+ return `<img src="${escapeAttr(validUrl)}" alt="${escapeAttr(alt || "Agent")}" class="w-full h-full object-contain" />`;
48
+ }
49
+ /**
50
+ * Render agent info section with logo and description.
51
+ *
52
+ * @param description - Agent description text
53
+ * @param logoUrl - Optional logo URL
54
+ * @returns HTML string
55
+ */
56
+ export function renderAgentInfo(description, logoUrl) {
57
+ return `
58
+ <div class="${CONSENT_CLASSES.agentWrapper}">
59
+ <div class="${CONSENT_CLASSES.agentIcon}">
60
+ ${renderLogo(logoUrl)}
61
+ </div>
62
+ <p class="${CONSENT_CLASSES.agentDescription}">${escapeHtml(description)}</p>
63
+ </div>
64
+ `;
65
+ }
66
+ // ============================================================================
67
+ // Header
68
+ // ============================================================================
69
+ /**
70
+ * Render page header with optional logo and company name.
71
+ *
72
+ * @param title - Page title
73
+ * @param subtitle - Optional subtitle
74
+ * @param logoUrl - Optional logo URL for header
75
+ * @param companyName - Optional company name
76
+ * @returns HTML string
77
+ */
78
+ export function renderHeader(title, subtitle, logoUrl, companyName) {
79
+ let logoHtml = "";
80
+ if (logoUrl) {
81
+ const validUrl = validateUrl(logoUrl);
82
+ if (validUrl) {
83
+ logoHtml = `<img src="${escapeAttr(validUrl)}" alt="${escapeAttr(companyName || "Logo")}" class="h-12 w-auto mb-4 mx-auto" />`;
84
+ }
85
+ }
86
+ const companyHtml = companyName
87
+ ? `<p class="text-sm text-gray-600 mb-2">${escapeHtml(companyName)}</p>`
88
+ : "";
89
+ const subtitleHtml = subtitle
90
+ ? `<p class="${CONSENT_CLASSES.subtitle}">${escapeHtml(subtitle)}</p>`
91
+ : "";
92
+ return `
93
+ <div class="${CONSENT_CLASSES.headerCenter}">
94
+ ${logoHtml}
95
+ ${companyHtml}
96
+ <h1 class="${CONSENT_CLASSES.title}">${escapeHtml(title)}</h1>
97
+ ${subtitleHtml}
98
+ </div>
99
+ `;
100
+ }
101
+ // ============================================================================
102
+ // Buttons
103
+ // ============================================================================
104
+ /**
105
+ * Render a button element.
106
+ *
107
+ * @param text - Button text
108
+ * @param variant - 'primary' | 'secondary'
109
+ * @param type - 'submit' | 'button'
110
+ * @param attributes - Additional HTML attributes
111
+ * @returns HTML string
112
+ */
113
+ export function renderButton(text, variant, type = "button", attributes = {}) {
114
+ const baseClass = variant === "primary"
115
+ ? `${CONSENT_CLASSES.buttonPrimary} btn-primary`
116
+ : CONSENT_CLASSES.buttonSecondary;
117
+ const attrs = Object.entries(attributes)
118
+ .map(([k, v]) => `${k}="${escapeAttr(v)}"`)
119
+ .join(" ");
120
+ return `<button type="${type}" class="${baseClass}" ${attrs}>${escapeHtml(text)}</button>`;
121
+ }
122
+ /**
123
+ * Render button group with cancel and submit buttons.
124
+ *
125
+ * @param cancelText - Cancel button text
126
+ * @param submitText - Submit button text
127
+ * @returns HTML string
128
+ */
129
+ export function renderButtonGroup(cancelText, submitText) {
130
+ return `
131
+ <div class="${CONSENT_CLASSES.buttonGroup}">
132
+ ${renderButton(cancelText, "secondary", "button", { onclick: "window.close()" })}
133
+ ${renderButton(submitText, "primary", "submit")}
134
+ </div>
135
+ `;
136
+ }
137
+ /**
138
+ * Render a full-width primary button.
139
+ *
140
+ * @param text - Button text
141
+ * @param type - 'submit' | 'button'
142
+ * @returns HTML string
143
+ */
144
+ export function renderFullWidthButton(text, type = "submit") {
145
+ return `<button type="${type}" class="${CONSENT_CLASSES.buttonFull} btn-primary">${escapeHtml(text)}</button>`;
146
+ }
147
+ // ============================================================================
148
+ // Form Elements
149
+ // ============================================================================
150
+ /**
151
+ * Render a checkbox input.
152
+ *
153
+ * @param name - Input name
154
+ * @param label - Label text (can include HTML like links)
155
+ * @param required - Whether field is required
156
+ * @param checked - Whether initially checked
157
+ * @param disabled - Whether disabled
158
+ * @returns HTML string
159
+ */
160
+ export function renderCheckbox(name, label, required = false, checked = false, disabled = false) {
161
+ const requiredAttr = required ? "required" : "";
162
+ const checkedAttr = checked ? "checked" : "";
163
+ const disabledAttr = disabled ? "disabled" : "";
164
+ return `
165
+ <label class="${CONSENT_CLASSES.checkboxLabel}">
166
+ <input type="checkbox" name="${escapeAttr(name)}"
167
+ class="${CONSENT_CLASSES.checkbox}"
168
+ ${requiredAttr} ${checkedAttr} ${disabledAttr} />
169
+ <span class="${CONSENT_CLASSES.checkboxText}">${label}</span>
170
+ </label>
171
+ `;
172
+ }
173
+ /**
174
+ * Render an input field with label.
175
+ *
176
+ * @param type - Input type
177
+ * @param name - Input name
178
+ * @param label - Label text
179
+ * @param placeholder - Placeholder text
180
+ * @param required - Whether required
181
+ * @param autocomplete - Autocomplete value
182
+ * @returns HTML string
183
+ */
184
+ export function renderInput(type, name, label, placeholder, required = false, autocomplete) {
185
+ const placeholderAttr = placeholder
186
+ ? `placeholder="${escapeAttr(placeholder)}"`
187
+ : "";
188
+ const requiredAttr = required ? "required" : "";
189
+ const autocompleteAttr = autocomplete
190
+ ? `autocomplete="${escapeAttr(autocomplete)}"`
191
+ : "";
192
+ return `
193
+ <div class="space-y-2">
194
+ <label for="${escapeAttr(name)}" class="block text-sm font-medium text-gray-700">
195
+ ${escapeHtml(label)}
196
+ </label>
197
+ <input
198
+ type="${type}"
199
+ id="${escapeAttr(name)}"
200
+ name="${escapeAttr(name)}"
201
+ ${placeholderAttr}
202
+ ${requiredAttr}
203
+ ${autocompleteAttr}
204
+ class="${CONSENT_CLASSES.input} ${CONSENT_CLASSES.inputFocus}"
205
+ />
206
+ </div>
207
+ `;
208
+ }
209
+ // ============================================================================
210
+ // Notices
211
+ // ============================================================================
212
+ /**
213
+ * Render expiration notice.
214
+ *
215
+ * @param text - Notice text
216
+ * @param days - Number of days (optional)
217
+ * @returns HTML string
218
+ */
219
+ export function renderExpirationNotice(text, days) {
220
+ const fullText = days ? `${text} ${days} days` : text;
221
+ return `
222
+ <div class="${CONSENT_CLASSES.expirationWrapper} bg-secondary-50">
223
+ <svg class="w-4 h-4 text-primary flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
224
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
225
+ d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
226
+ </svg>
227
+ <span class="text-sm text-gray-600">${escapeHtml(fullText)}</span>
228
+ </div>
229
+ `;
230
+ }
231
+ /**
232
+ * Render an error container (initially hidden).
233
+ *
234
+ * @param id - Container ID for JavaScript access
235
+ * @returns HTML string
236
+ */
237
+ export function renderErrorContainer(id = "error-container") {
238
+ return `
239
+ <div id="${escapeAttr(id)}" class="hidden">
240
+ <div class="${CONSENT_CLASSES.errorContainer}"></div>
241
+ </div>
242
+ `;
243
+ }
244
+ // ============================================================================
245
+ // Icons
246
+ // ============================================================================
247
+ /**
248
+ * Render a checkmark icon.
249
+ */
250
+ export function renderCheckIcon() {
251
+ return `
252
+ <svg class="w-5 h-5 text-green-500 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
253
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
254
+ </svg>
255
+ `;
256
+ }
257
+ /**
258
+ * Render a clock icon.
259
+ */
260
+ export function renderClockIcon() {
261
+ return `
262
+ <svg class="w-4 h-4 text-primary flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
263
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
264
+ d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
265
+ </svg>
266
+ `;
267
+ }
268
+ /**
269
+ * Render a success checkmark icon (large, green).
270
+ */
271
+ export function renderSuccessIcon() {
272
+ return `
273
+ <svg class="mx-auto h-12 w-12 text-green-500 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
274
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
275
+ </svg>
276
+ `;
277
+ }
278
+ //# sourceMappingURL=components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../../../../src/services/consent-templates/base/components.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE/D,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,UAAU,sBAAsB;IACpC,OAAO;;;;;;;GAON,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB,EAAE,GAAY;IACvD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,sBAAsB,EAAE,CAAC;IAClC,CAAC;IAED,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACtC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,sBAAsB,EAAE,CAAC;IAClC,CAAC;IAED,OAAO,aAAa,UAAU,CAAC,QAAQ,CAAC,UAAU,UAAU,CAAC,GAAG,IAAI,OAAO,CAAC,2CAA2C,CAAC;AAC1H,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,WAAmB,EAAE,OAAgB;IACnE,OAAO;kBACS,eAAe,CAAC,YAAY;oBAC1B,eAAe,CAAC,SAAS;UACnC,UAAU,CAAC,OAAO,CAAC;;kBAEX,eAAe,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AiB;IACjE,OAAO;eACM,UAAU,CAAC,EAAE,CAAC;oBACT,eAAe,CAAC,cAAc;;GAE/C,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,QAAQ;AACR,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO;;;;GAIN,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO;;;;;GAKN,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO;;;;GAIN,CAAC;AACJ,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * XSS Prevention Utilities
3
+ *
4
+ * Security-first HTML escaping for consent pages.
5
+ * All user input MUST be passed through these functions.
6
+ *
7
+ * @module consent-templates/base/escape
8
+ */
9
+ /**
10
+ * Escape HTML special characters to prevent XSS.
11
+ *
12
+ * @param text - Text to escape
13
+ * @returns Escaped text safe for HTML insertion
14
+ */
15
+ export declare function escapeHtml(text: string): string;
16
+ /**
17
+ * Escape text for use in a JavaScript string literal.
18
+ *
19
+ * @param text - Text to escape
20
+ * @returns Escaped text safe for JS string
21
+ */
22
+ export declare function escapeJs(text: string): string;
23
+ /**
24
+ * Validate and sanitize a URL.
25
+ * Only allows http/https protocols.
26
+ *
27
+ * @param url - URL to validate
28
+ * @returns Validated URL or undefined if invalid
29
+ */
30
+ export declare function validateUrl(url: string): string | undefined;
31
+ /**
32
+ * Validate a hex color value.
33
+ *
34
+ * @param color - Color to validate (e.g., "#FF5500")
35
+ * @param defaultColor - Default color if invalid
36
+ * @returns Valid hex color
37
+ */
38
+ export declare function validateColor(color: string, defaultColor: string): string;
39
+ /**
40
+ * Escape HTML attribute value.
41
+ *
42
+ * @param value - Attribute value to escape
43
+ * @returns Escaped value safe for HTML attributes
44
+ */
45
+ export declare function escapeAttr(value: string): string;
46
+ /**
47
+ * Sanitize and escape a complete config object's string values.
48
+ *
49
+ * @param obj - Object to sanitize
50
+ * @returns New object with sanitized string values
51
+ */
52
+ export declare function sanitizeStrings<T extends Record<string, unknown>>(obj: T): T;
53
+ //# sourceMappingURL=escape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escape.d.ts","sourceRoot":"","sources":["../../../../src/services/consent-templates/base/escape.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAgBH;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK7C;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAc3D;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAWzE;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAc5E"}
@@ -0,0 +1,115 @@
1
+ /**
2
+ * XSS Prevention Utilities
3
+ *
4
+ * Security-first HTML escaping for consent pages.
5
+ * All user input MUST be passed through these functions.
6
+ *
7
+ * @module consent-templates/base/escape
8
+ */
9
+ /**
10
+ * HTML entity map for escaping.
11
+ */
12
+ const HTML_ENTITIES = {
13
+ "&": "&amp;",
14
+ "<": "&lt;",
15
+ ">": "&gt;",
16
+ '"': "&quot;",
17
+ "'": "&#039;",
18
+ "/": "&#x2F;",
19
+ "`": "&#x60;",
20
+ "=": "&#x3D;",
21
+ };
22
+ /**
23
+ * Escape HTML special characters to prevent XSS.
24
+ *
25
+ * @param text - Text to escape
26
+ * @returns Escaped text safe for HTML insertion
27
+ */
28
+ export function escapeHtml(text) {
29
+ if (typeof text !== "string") {
30
+ return String(text);
31
+ }
32
+ return text.replace(/[&<>"'`=/]/g, (char) => HTML_ENTITIES[char] || char);
33
+ }
34
+ /**
35
+ * Escape text for use in a JavaScript string literal.
36
+ *
37
+ * @param text - Text to escape
38
+ * @returns Escaped text safe for JS string
39
+ */
40
+ export function escapeJs(text) {
41
+ if (typeof text !== "string") {
42
+ return String(text);
43
+ }
44
+ return JSON.stringify(text);
45
+ }
46
+ /**
47
+ * Validate and sanitize a URL.
48
+ * Only allows http/https protocols.
49
+ *
50
+ * @param url - URL to validate
51
+ * @returns Validated URL or undefined if invalid
52
+ */
53
+ export function validateUrl(url) {
54
+ if (!url || typeof url !== "string") {
55
+ return undefined;
56
+ }
57
+ try {
58
+ const parsed = new URL(url);
59
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
60
+ return undefined;
61
+ }
62
+ return url;
63
+ }
64
+ catch {
65
+ return undefined;
66
+ }
67
+ }
68
+ /**
69
+ * Validate a hex color value.
70
+ *
71
+ * @param color - Color to validate (e.g., "#FF5500")
72
+ * @param defaultColor - Default color if invalid
73
+ * @returns Valid hex color
74
+ */
75
+ export function validateColor(color, defaultColor) {
76
+ if (!color || typeof color !== "string") {
77
+ return defaultColor;
78
+ }
79
+ // Accept 3 or 6 digit hex colors
80
+ if (/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(color)) {
81
+ return color;
82
+ }
83
+ return defaultColor;
84
+ }
85
+ /**
86
+ * Escape HTML attribute value.
87
+ *
88
+ * @param value - Attribute value to escape
89
+ * @returns Escaped value safe for HTML attributes
90
+ */
91
+ export function escapeAttr(value) {
92
+ return escapeHtml(value);
93
+ }
94
+ /**
95
+ * Sanitize and escape a complete config object's string values.
96
+ *
97
+ * @param obj - Object to sanitize
98
+ * @returns New object with sanitized string values
99
+ */
100
+ export function sanitizeStrings(obj) {
101
+ const result = {};
102
+ for (const [key, value] of Object.entries(obj)) {
103
+ if (typeof value === "string") {
104
+ result[key] = escapeHtml(value);
105
+ }
106
+ else if (value && typeof value === "object" && !Array.isArray(value)) {
107
+ result[key] = sanitizeStrings(value);
108
+ }
109
+ else {
110
+ result[key] = value;
111
+ }
112
+ }
113
+ return result;
114
+ }
115
+ //# sourceMappingURL=escape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escape.js","sourceRoot":"","sources":["../../../../src/services/consent-templates/base/escape.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,aAAa,GAA2B;IAC5C,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;CACd,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;AAC5E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACpC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAA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M,CAAC;YACN,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,MAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Base Template Modules Index
3
+ *
4
+ * @module consent-templates/base
5
+ */
6
+ export * from "./base-template";
7
+ export * from "./styles";
8
+ export * from "./components";
9
+ export * from "./escape";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/consent-templates/base/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Base Template Modules Index
3
+ *
4
+ * @module consent-templates/base
5
+ */
6
+ export * from "./base-template";
7
+ export * from "./styles";
8
+ export * from "./components";
9
+ export * from "./escape";
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/consent-templates/base/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC"}
@@ -0,0 +1,80 @@
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
+ export declare const DEFAULT_COLORS: {
13
+ /** Primary brand color - buttons, links, accents */
14
+ readonly primary: "#2563EB";
15
+ /** Secondary color - backgrounds, highlights */
16
+ readonly secondary: "#DBEAFE";
17
+ /** Title text color */
18
+ readonly title: "#333333";
19
+ /** Muted text color */
20
+ readonly muted: "#6B7280";
21
+ /** Card border color */
22
+ readonly border: "rgba(0,0,0,0.1)";
23
+ };
24
+ /**
25
+ * CSS classes matching AgentShield's consent preview components.
26
+ * These ensure pixel-perfect parity between WYSIWYG editor and live pages.
27
+ */
28
+ export declare const CONSENT_CLASSES: {
29
+ readonly container: "bg-white rounded-[20px] border border-black/10 shadow-xl overflow-hidden";
30
+ readonly headerWrapper: "px-8 pt-5";
31
+ readonly headerCenter: "px-8 pt-5 text-center";
32
+ readonly title: "text-2xl font-bold text-[#333333]";
33
+ readonly subtitle: "text-sm text-gray-500 mt-1";
34
+ readonly content: "p-8 pt-4 space-y-6";
35
+ readonly agentWrapper: "flex gap-4 items-start";
36
+ readonly agentIcon: "w-[54px] h-[54px] rounded-[10px] border border-gray-300 flex items-center justify-center flex-shrink-0 overflow-hidden bg-white";
37
+ readonly agentDescription: "text-base text-black leading-[1.4] flex-1";
38
+ readonly buttonGroup: "flex gap-3 justify-end pt-2";
39
+ readonly buttonPrimary: "px-4 py-2 rounded-md text-white font-medium transition-opacity hover:opacity-90";
40
+ readonly buttonSecondary: "px-4 py-2 rounded-md border border-gray-300 text-gray-700 font-medium hover:bg-gray-50";
41
+ readonly buttonFull: "w-full py-3 px-4 rounded-lg text-white font-medium transition-opacity hover:opacity-90";
42
+ readonly 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";
43
+ readonly inputFocus: "focus:ring-2 focus:ring-[var(--consent-primary)] focus:border-[var(--consent-primary)] focus:outline-none";
44
+ readonly 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";
45
+ readonly checkboxLabel: "flex items-start gap-3 cursor-pointer";
46
+ readonly checkboxText: "text-sm text-gray-700";
47
+ readonly expirationWrapper: "flex items-center gap-2 p-3 rounded-lg";
48
+ readonly link: "text-[var(--consent-primary)] hover:underline";
49
+ readonly errorContainer: "p-3 bg-red-50 border border-red-200 rounded-lg text-red-700 text-sm";
50
+ readonly permissionsList: "space-y-4";
51
+ readonly permissionsHeader: "text-base text-black";
52
+ };
53
+ /**
54
+ * Generate CSS variables from branding config.
55
+ * Includes shadcn/ui CSS variables for component compatibility.
56
+ *
57
+ * @param branding - Branding configuration
58
+ * @returns CSS variable declarations
59
+ */
60
+ export declare function generateCSSVariables(branding: {
61
+ primaryColor?: string;
62
+ secondaryColor?: string;
63
+ }): string;
64
+ /**
65
+ * Generate component styles using CSS variables.
66
+ *
67
+ * @returns CSS stylesheet string
68
+ */
69
+ export declare function generateStylesheet(): string;
70
+ /**
71
+ * Generate the complete head styles for a consent page.
72
+ *
73
+ * @param branding - Branding configuration
74
+ * @returns Complete style tag content
75
+ */
76
+ export declare function generateHeadStyles(branding: {
77
+ primaryColor?: string;
78
+ secondaryColor?: string;
79
+ }): string;
80
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/services/consent-templates/base/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,eAAO,MAAM,cAAc;IACzB,oDAAoD;;IAEpD,gDAAgD;;IAEhD,uBAAuB;;IAEvB,uBAAuB;;IAEvB,wBAAwB;;CAEhB,CAAC;AAMX;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;CAsDlB,CAAC;AAqBX;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,MAAM,CA2CT;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAsE3C;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,MAAM,CAKT"}