@kya-os/consent 0.1.21 → 0.1.23
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/bundle/inline.d.ts.map +1 -1
- package/dist/bundle/inline.js +2 -2
- package/dist/bundle/inline.js.map +1 -1
- package/dist/cjs/bundle/inline.js +2 -2
- package/dist/cjs/bundle/inline.js.map +1 -1
- package/dist/cjs/components/mcp-consent.js +0 -14
- package/dist/cjs/components/mcp-consent.js.map +1 -1
- package/dist/cjs/templates/modes/oauth.template.js +0 -28
- package/dist/cjs/templates/modes/oauth.template.js.map +1 -1
- package/dist/components/mcp-consent.d.ts.map +1 -1
- package/dist/components/mcp-consent.js +0 -14
- package/dist/components/mcp-consent.js.map +1 -1
- package/dist/consent.js +0 -14
- package/dist/consent.min.js +11 -25
- package/dist/templates/modes/oauth.template.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/bundle/index.d.ts +0 -44
- package/dist/bundle/shell.d.ts +0 -126
- package/dist/bundle/shell.js +0 -295
- package/dist/bundle/shell.js.map +0 -1
- package/dist/components/consent-button.d.ts +0 -61
- package/dist/components/consent-button.js +0 -177
- package/dist/components/consent-button.js.map +0 -1
- package/dist/components/consent-checkbox.d.ts +0 -61
- package/dist/components/consent-checkbox.js +0 -220
- package/dist/components/consent-checkbox.js.map +0 -1
- package/dist/components/consent-input.d.ts +0 -91
- package/dist/components/consent-input.js +0 -332
- package/dist/components/consent-input.js.map +0 -1
- package/dist/components/consent-oauth-button.d.ts +0 -87
- package/dist/components/consent-oauth-button.js +0 -389
- package/dist/components/consent-oauth-button.js.map +0 -1
- package/dist/components/consent-otp-input.d.ts +0 -92
- package/dist/components/consent-otp-input.js +0 -385
- package/dist/components/consent-otp-input.js.map +0 -1
- package/dist/components/consent-permissions.d.ts +0 -104
- package/dist/components/consent-permissions.js +0 -430
- package/dist/components/consent-permissions.js.map +0 -1
- package/dist/components/consent-shell.d.ts +0 -72
- package/dist/components/consent-shell.js +0 -231
- package/dist/components/consent-shell.js.map +0 -1
- package/dist/components/consent-terms.d.ts +0 -89
- package/dist/components/consent-terms.js +0 -284
- package/dist/components/consent-terms.js.map +0 -1
- package/dist/components/index.d.ts +0 -19
- package/dist/constants/auth-modes.d.ts +0 -59
- package/dist/constants/auth-modes.js +0 -120
- package/dist/constants/auth-modes.js.map +0 -1
- package/dist/constants/colors.d.ts +0 -38
- package/dist/constants/colors.js +0 -37
- package/dist/constants/colors.js.map +0 -1
- package/dist/constants/defaults.d.ts +0 -112
- package/dist/constants/defaults.js +0 -143
- package/dist/constants/defaults.js.map +0 -1
- package/dist/constants/index.d.ts +0 -12
- package/dist/constants/index.js +0 -16
- package/dist/constants/index.js.map +0 -1
- package/dist/index.d.ts +0 -19
- package/dist/index.js +0 -28
- package/dist/index.js.map +0 -1
- package/dist/react/index.d.ts +0 -123
- package/dist/resolution/index.d.ts +0 -12
- package/dist/resolution/index.js +0 -12
- package/dist/resolution/index.js.map +0 -1
- package/dist/resolution/resolve-branding.d.ts +0 -70
- package/dist/resolution/resolve-branding.js +0 -149
- package/dist/resolution/resolve-branding.js.map +0 -1
- package/dist/resolution/resolve-config.d.ts +0 -81
- package/dist/resolution/resolve-config.js +0 -258
- package/dist/resolution/resolve-config.js.map +0 -1
- package/dist/resolution/resolve-copy.d.ts +0 -53
- package/dist/resolution/resolve-copy.js +0 -128
- package/dist/resolution/resolve-copy.js.map +0 -1
- package/dist/schemas/api.schemas.js +0 -162
- package/dist/schemas/api.schemas.js.map +0 -1
- package/dist/schemas/branding.schemas.d.ts +0 -100
- package/dist/schemas/branding.schemas.js +0 -54
- package/dist/schemas/branding.schemas.js.map +0 -1
- package/dist/schemas/config.schemas.js +0 -141
- package/dist/schemas/config.schemas.js.map +0 -1
- package/dist/schemas/index.d.ts +0 -13
- package/dist/schemas/index.js +0 -13
- package/dist/schemas/index.js.map +0 -1
- package/dist/schemas/modes.schemas.js +0 -104
- package/dist/schemas/modes.schemas.js.map +0 -1
- package/dist/security/escape.d.ts +0 -114
- package/dist/security/escape.js +0 -197
- package/dist/security/escape.js.map +0 -1
- package/dist/security/index.d.ts +0 -10
- package/dist/security/index.js +0 -10
- package/dist/security/index.js.map +0 -1
- package/dist/security/validators.d.ts +0 -98
- package/dist/security/validators.js +0 -199
- package/dist/security/validators.js.map +0 -1
- package/dist/styles/css-variables.d.ts +0 -78
- package/dist/styles/css-variables.js +0 -120
- package/dist/styles/css-variables.js.map +0 -1
- package/dist/styles/index.d.ts +0 -12
- package/dist/styles/index.js +0 -12
- package/dist/styles/index.js.map +0 -1
- package/dist/styles/stylesheet.d.ts +0 -57
- package/dist/styles/stylesheet.js +0 -197
- package/dist/styles/stylesheet.js.map +0 -1
- package/dist/styles/tokens.d.ts +0 -141
- package/dist/styles/tokens.js +0 -180
- package/dist/styles/tokens.js.map +0 -1
- package/dist/templates/base/base-template.d.ts +0 -81
- package/dist/templates/base/base-template.js +0 -278
- package/dist/templates/base/base-template.js.map +0 -1
- package/dist/templates/base/components.d.ts +0 -120
- package/dist/templates/base/components.js +0 -279
- package/dist/templates/base/components.js.map +0 -1
- package/dist/templates/base/index.d.ts +0 -8
- package/dist/templates/base/index.js +0 -8
- package/dist/templates/base/index.js.map +0 -1
- package/dist/templates/index.d.ts +0 -18
- package/dist/templates/index.js +0 -18
- package/dist/templates/index.js.map +0 -1
- package/dist/templates/modes/consent-only.template.d.ts +0 -36
- package/dist/templates/modes/consent-only.template.js +0 -70
- package/dist/templates/modes/consent-only.template.js.map +0 -1
- package/dist/templates/modes/credentials.template.d.ts +0 -65
- package/dist/templates/modes/credentials.template.js +0 -410
- package/dist/templates/modes/credentials.template.js.map +0 -1
- package/dist/templates/modes/index.d.ts +0 -14
- package/dist/templates/modes/index.js +0 -14
- package/dist/templates/modes/index.js.map +0 -1
- package/dist/templates/modes/magic-link.template.d.ts +0 -33
- package/dist/templates/modes/magic-link.template.js +0 -192
- package/dist/templates/modes/magic-link.template.js.map +0 -1
- package/dist/templates/modes/oauth.template.d.ts +0 -40
- package/dist/templates/modes/oauth.template.js +0 -149
- package/dist/templates/modes/oauth.template.js.map +0 -1
- package/dist/templates/modes/otp.template.d.ts +0 -35
- package/dist/templates/modes/otp.template.js +0 -312
- package/dist/templates/modes/otp.template.js.map +0 -1
- package/dist/templates/modes/success.template.d.ts +0 -41
- package/dist/templates/registry.d.ts +0 -68
- package/dist/templates/registry.js +0 -125
- package/dist/templates/registry.js.map +0 -1
- package/dist/types/api.types.d.ts +0 -147
- package/dist/types/api.types.js +0 -9
- package/dist/types/api.types.js.map +0 -1
- package/dist/types/branding.types.d.ts +0 -53
- package/dist/types/branding.types.js +0 -9
- package/dist/types/branding.types.js.map +0 -1
- package/dist/types/config.types.d.ts +0 -201
- package/dist/types/config.types.js +0 -9
- package/dist/types/config.types.js.map +0 -1
- package/dist/types/copy.types.d.ts +0 -109
- package/dist/types/copy.types.js +0 -9
- package/dist/types/copy.types.js.map +0 -1
- package/dist/types/index.d.ts +0 -15
- package/dist/types/index.js +0 -15
- package/dist/types/index.js.map +0 -1
- package/dist/types/modes.types.d.ts +0 -287
- package/dist/types/modes.types.js +0 -136
- package/dist/types/modes.types.js.map +0 -1
- package/dist/types/page.types.d.ts +0 -120
- package/dist/types/page.types.js +0 -9
- package/dist/types/page.types.js.map +0 -1
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Consent Resolution Utilities
|
|
3
|
-
*
|
|
4
|
-
* Functions to resolve partial config into complete render-ready config.
|
|
5
|
-
* Applies defaults and placeholder substitution.
|
|
6
|
-
*
|
|
7
|
-
* @module @kya-os/consent/resolution
|
|
8
|
-
*/
|
|
9
|
-
export * from "./resolve-copy.js";
|
|
10
|
-
export * from "./resolve-branding.js";
|
|
11
|
-
export * from "./resolve-config.js";
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/resolution/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Consent Resolution Utilities
|
|
3
|
-
*
|
|
4
|
-
* Functions to resolve partial config into complete render-ready config.
|
|
5
|
-
* Applies defaults and placeholder substitution.
|
|
6
|
-
*
|
|
7
|
-
* @module @kya-os/consent/resolution
|
|
8
|
-
*/
|
|
9
|
-
export * from "./resolve-copy.js";
|
|
10
|
-
export * from "./resolve-branding.js";
|
|
11
|
-
export * from "./resolve-config.js";
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resolution/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Branding Resolution
|
|
3
|
-
*
|
|
4
|
-
* Resolves branding config with defaults and generates CSS variables.
|
|
5
|
-
*
|
|
6
|
-
* @module @kya-os/consent/resolution/resolve-branding
|
|
7
|
-
*/
|
|
8
|
-
import type { ConsentBranding, ResolvedConsentBranding, ConsentCSSVars } from "../types/branding.types.js";
|
|
9
|
-
/**
|
|
10
|
-
* Validate hex color format
|
|
11
|
-
*
|
|
12
|
-
* @param color - Color string to validate
|
|
13
|
-
* @returns True if valid hex color
|
|
14
|
-
*/
|
|
15
|
-
export declare function isValidHexColor(color: string | undefined): color is string;
|
|
16
|
-
/**
|
|
17
|
-
* Sanitize a color value, returning default if invalid
|
|
18
|
-
*
|
|
19
|
-
* @param color - Color to sanitize
|
|
20
|
-
* @param defaultColor - Default if invalid
|
|
21
|
-
* @returns Valid hex color
|
|
22
|
-
*/
|
|
23
|
-
export declare function sanitizeColor(color: string | undefined, defaultColor: string): string;
|
|
24
|
-
/**
|
|
25
|
-
* Validate URL format
|
|
26
|
-
*
|
|
27
|
-
* @param url - URL string to validate
|
|
28
|
-
* @returns True if valid http/https URL
|
|
29
|
-
*/
|
|
30
|
-
export declare function isValidUrl(url: string | undefined): url is string;
|
|
31
|
-
/**
|
|
32
|
-
* Sanitize a URL value, returning undefined if invalid
|
|
33
|
-
*
|
|
34
|
-
* @param url - URL to sanitize
|
|
35
|
-
* @returns Valid URL or undefined
|
|
36
|
-
*/
|
|
37
|
-
export declare function sanitizeUrl(url: string | undefined): string | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* Generate CSS variables from branding
|
|
40
|
-
*
|
|
41
|
-
* @param branding - Resolved branding config
|
|
42
|
-
* @returns CSS variable object
|
|
43
|
-
*/
|
|
44
|
-
export declare function generateBrandingCSSVars(branding: {
|
|
45
|
-
primaryColor: string;
|
|
46
|
-
secondaryColor: string;
|
|
47
|
-
}): ConsentCSSVars;
|
|
48
|
-
/**
|
|
49
|
-
* Resolve branding config with defaults and validation
|
|
50
|
-
*
|
|
51
|
-
* @param branding - Partial branding config
|
|
52
|
-
* @returns Fully resolved branding with CSS variables
|
|
53
|
-
*/
|
|
54
|
-
export declare function resolveConsentBranding(branding?: ConsentBranding): ResolvedConsentBranding;
|
|
55
|
-
/**
|
|
56
|
-
* Check if branding has custom values (non-default)
|
|
57
|
-
*
|
|
58
|
-
* @param branding - Branding config
|
|
59
|
-
* @returns True if any custom values are set
|
|
60
|
-
*/
|
|
61
|
-
export declare function hasCustomBranding(branding?: ConsentBranding): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Merge branding configs (later values override earlier)
|
|
64
|
-
*
|
|
65
|
-
* @param base - Base branding config
|
|
66
|
-
* @param override - Override values
|
|
67
|
-
* @returns Merged branding
|
|
68
|
-
*/
|
|
69
|
-
export declare function mergeBranding(base: ConsentBranding, override?: ConsentBranding): ConsentBranding;
|
|
70
|
-
//# sourceMappingURL=resolve-branding.d.ts.map
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Branding Resolution
|
|
3
|
-
*
|
|
4
|
-
* Resolves branding config with defaults and generates CSS variables.
|
|
5
|
-
*
|
|
6
|
-
* @module @kya-os/consent/resolution/resolve-branding
|
|
7
|
-
*/
|
|
8
|
-
import { DEFAULT_BRANDING } from "../constants/defaults.js";
|
|
9
|
-
import { DEFAULT_COLORS } from "../constants/colors.js";
|
|
10
|
-
/**
|
|
11
|
-
* Validate hex color format
|
|
12
|
-
*
|
|
13
|
-
* @param color - Color string to validate
|
|
14
|
-
* @returns True if valid hex color
|
|
15
|
-
*/
|
|
16
|
-
export function isValidHexColor(color) {
|
|
17
|
-
if (!color)
|
|
18
|
-
return false;
|
|
19
|
-
return /^#[0-9A-Fa-f]{6}$/.test(color);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Sanitize a color value, returning default if invalid
|
|
23
|
-
*
|
|
24
|
-
* @param color - Color to sanitize
|
|
25
|
-
* @param defaultColor - Default if invalid
|
|
26
|
-
* @returns Valid hex color
|
|
27
|
-
*/
|
|
28
|
-
export function sanitizeColor(color, defaultColor) {
|
|
29
|
-
if (isValidHexColor(color)) {
|
|
30
|
-
return color;
|
|
31
|
-
}
|
|
32
|
-
return defaultColor;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Validate URL format
|
|
36
|
-
*
|
|
37
|
-
* @param url - URL string to validate
|
|
38
|
-
* @returns True if valid http/https URL
|
|
39
|
-
*/
|
|
40
|
-
export function isValidUrl(url) {
|
|
41
|
-
if (!url)
|
|
42
|
-
return false;
|
|
43
|
-
try {
|
|
44
|
-
const parsed = new URL(url);
|
|
45
|
-
return parsed.protocol === "http:" || parsed.protocol === "https:";
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Sanitize a URL value, returning undefined if invalid
|
|
53
|
-
*
|
|
54
|
-
* @param url - URL to sanitize
|
|
55
|
-
* @returns Valid URL or undefined
|
|
56
|
-
*/
|
|
57
|
-
export function sanitizeUrl(url) {
|
|
58
|
-
if (isValidUrl(url)) {
|
|
59
|
-
return url;
|
|
60
|
-
}
|
|
61
|
-
return undefined;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Convert hex color to RGB string
|
|
65
|
-
*
|
|
66
|
-
* @param hex - Hex color string (e.g., '#2563EB')
|
|
67
|
-
* @returns RGB string (e.g., '37, 99, 235')
|
|
68
|
-
*/
|
|
69
|
-
function hexToRgb(hex) {
|
|
70
|
-
// Remove # if present
|
|
71
|
-
const cleanHex = hex.replace(/^#/, '');
|
|
72
|
-
// Parse hex to RGB
|
|
73
|
-
const r = parseInt(cleanHex.slice(0, 2), 16);
|
|
74
|
-
const g = parseInt(cleanHex.slice(2, 4), 16);
|
|
75
|
-
const b = parseInt(cleanHex.slice(4, 6), 16);
|
|
76
|
-
return `${r}, ${g}, ${b}`;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Generate CSS variables from branding
|
|
80
|
-
*
|
|
81
|
-
* @param branding - Resolved branding config
|
|
82
|
-
* @returns CSS variable object
|
|
83
|
-
*/
|
|
84
|
-
export function generateBrandingCSSVars(branding) {
|
|
85
|
-
return {
|
|
86
|
-
"--consent-primary": branding.primaryColor,
|
|
87
|
-
"--consent-secondary": branding.secondaryColor,
|
|
88
|
-
"--consent-primary-rgb": hexToRgb(branding.primaryColor),
|
|
89
|
-
"--consent-secondary-rgb": hexToRgb(branding.secondaryColor),
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Resolve branding config with defaults and validation
|
|
94
|
-
*
|
|
95
|
-
* @param branding - Partial branding config
|
|
96
|
-
* @returns Fully resolved branding with CSS variables
|
|
97
|
-
*/
|
|
98
|
-
export function resolveConsentBranding(branding) {
|
|
99
|
-
// Sanitize and resolve colors
|
|
100
|
-
const primaryColor = sanitizeColor(branding?.primaryColor, DEFAULT_COLORS.PRIMARY);
|
|
101
|
-
const secondaryColor = sanitizeColor(branding?.secondaryColor, DEFAULT_COLORS.SECONDARY);
|
|
102
|
-
// Sanitize URL (only allow valid http/https)
|
|
103
|
-
const logoUrl = sanitizeUrl(branding?.logoUrl);
|
|
104
|
-
// Company name - basic sanitization (just trim, escaping happens at render)
|
|
105
|
-
const companyName = branding?.companyName?.trim() || undefined;
|
|
106
|
-
// Generate CSS variables
|
|
107
|
-
const cssVars = generateBrandingCSSVars({ primaryColor, secondaryColor });
|
|
108
|
-
return {
|
|
109
|
-
primaryColor,
|
|
110
|
-
secondaryColor,
|
|
111
|
-
logoUrl,
|
|
112
|
-
companyName,
|
|
113
|
-
cssVars,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Check if branding has custom values (non-default)
|
|
118
|
-
*
|
|
119
|
-
* @param branding - Branding config
|
|
120
|
-
* @returns True if any custom values are set
|
|
121
|
-
*/
|
|
122
|
-
export function hasCustomBranding(branding) {
|
|
123
|
-
if (!branding)
|
|
124
|
-
return false;
|
|
125
|
-
return ((branding.primaryColor !== undefined &&
|
|
126
|
-
branding.primaryColor !== DEFAULT_BRANDING.primaryColor) ||
|
|
127
|
-
(branding.secondaryColor !== undefined &&
|
|
128
|
-
branding.secondaryColor !== DEFAULT_BRANDING.secondaryColor) ||
|
|
129
|
-
branding.logoUrl !== undefined ||
|
|
130
|
-
branding.companyName !== undefined);
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Merge branding configs (later values override earlier)
|
|
134
|
-
*
|
|
135
|
-
* @param base - Base branding config
|
|
136
|
-
* @param override - Override values
|
|
137
|
-
* @returns Merged branding
|
|
138
|
-
*/
|
|
139
|
-
export function mergeBranding(base, override) {
|
|
140
|
-
if (!override)
|
|
141
|
-
return base;
|
|
142
|
-
return {
|
|
143
|
-
primaryColor: override.primaryColor ?? base.primaryColor,
|
|
144
|
-
secondaryColor: override.secondaryColor ?? base.secondaryColor,
|
|
145
|
-
logoUrl: override.logoUrl ?? base.logoUrl,
|
|
146
|
-
companyName: override.companyName ?? base.companyName,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
//# sourceMappingURL=resolve-branding.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-branding.js","sourceRoot":"","sources":["../../src/resolution/resolve-branding.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAyB;IACvD,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,OAAO,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB,EAAE,YAAoB;IAC3E,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,GAAuB;IAChD,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC;IACvB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,GAAuB;IACjD,IAAI,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACpB,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,GAAW;IAC3B,sBAAsB;IACtB,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,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AC,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC,CAAC;IAE1E,OAAO;QACL,YAAY;QACZ,cAAc;QACd,OAAO;QACP,WAAW;QACX,OAAO;KACR,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAA0B;IAC1D,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5B,OAAO,CACL,CAAC,QAAQ,CAAC,YAAY,KAAK,SAAS;QAClC,QAAQ,CAAC,YAAY,KAAK,gBAAgB,CAAC,YAAY,CAAC;QAC1D,CAAC,QAAQ,CAAC,cAAc,KAAK,SAAS;YACpC,QAAQ,CAAC,cAAc,KAAK,gBAAgB,CAAC,cAAc,CAAC;QAC9D,QAAQ,CAAC,OAAO,KAAK,SAAS;QAC9B,QAAQ,CAAC,WAAW,KAAK,SAAS,CACnC,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAqB,EACrB,QAA0B;IAE1B,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAE3B,OAAO;QACL,YAAY,EAAE,QAAQ,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY;QACxD,cAAc,EAAE,QAAQ,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc;QAC9D,OAAO,EAAE,QAAQ,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO;QACzC,WAAW,EAAE,QAAQ,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW;KACtD,CAAC;AACJ,CAAC"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Config Resolution
|
|
3
|
-
*
|
|
4
|
-
* Resolves complete consent config with all defaults applied.
|
|
5
|
-
*
|
|
6
|
-
* @module @kya-os/consent/resolution/resolve-config
|
|
7
|
-
*/
|
|
8
|
-
import type { ConsentConfig, ConsentConfigWithMeta, ResolvedConsentConfig, ConsentCustomField, ResolvedUI, ResolvedTerms, ResolvedSuccess } from "../types/config.types.js";
|
|
9
|
-
import type { AuthMode } from "../types/modes.types.js";
|
|
10
|
-
/**
|
|
11
|
-
* Resolve custom fields with validation
|
|
12
|
-
*
|
|
13
|
-
* @param fields - Custom fields array
|
|
14
|
-
* @returns Validated custom fields (max 10)
|
|
15
|
-
*/
|
|
16
|
-
export declare function resolveCustomFields(fields?: ConsentCustomField[]): ConsentCustomField[];
|
|
17
|
-
/**
|
|
18
|
-
* Resolve expiration days with bounds checking
|
|
19
|
-
*
|
|
20
|
-
* @param days - Expiration days from config
|
|
21
|
-
* @returns Valid expiration days (1-365)
|
|
22
|
-
*/
|
|
23
|
-
export declare function resolveExpirationDays(days?: number): number;
|
|
24
|
-
/**
|
|
25
|
-
* Determine the effective auth mode from config
|
|
26
|
-
*
|
|
27
|
-
* @param config - Consent config
|
|
28
|
-
* @returns Effective auth mode
|
|
29
|
-
*/
|
|
30
|
-
export declare function determineAuthMode(config?: ConsentConfig): AuthMode;
|
|
31
|
-
/**
|
|
32
|
-
* Get default consent config
|
|
33
|
-
*
|
|
34
|
-
* @returns Default consent config with all fields undefined
|
|
35
|
-
*/
|
|
36
|
-
export declare function getDefaultConsentConfig(): ConsentConfigWithMeta;
|
|
37
|
-
/**
|
|
38
|
-
* Resolve UI settings with all defaults
|
|
39
|
-
*
|
|
40
|
-
* @param ui - Partial UI config
|
|
41
|
-
* @returns Fully resolved UI settings
|
|
42
|
-
*/
|
|
43
|
-
export declare function resolveUISettings(ui?: ConsentConfig["ui"]): ResolvedUI;
|
|
44
|
-
/**
|
|
45
|
-
* Resolve terms settings with all defaults
|
|
46
|
-
*
|
|
47
|
-
* @param terms - Partial terms config
|
|
48
|
-
* @returns Fully resolved terms settings
|
|
49
|
-
*/
|
|
50
|
-
export declare function resolveTermsSettings(terms?: ConsentConfig["terms"]): ResolvedTerms;
|
|
51
|
-
/**
|
|
52
|
-
* Resolve success settings with all defaults
|
|
53
|
-
*
|
|
54
|
-
* @param success - Partial success config
|
|
55
|
-
* @returns Fully resolved success settings
|
|
56
|
-
*/
|
|
57
|
-
export declare function resolveSuccessSettings(success?: ConsentConfig["success"]): ResolvedSuccess;
|
|
58
|
-
/**
|
|
59
|
-
* Resolve complete consent config with all defaults
|
|
60
|
-
*
|
|
61
|
-
* @param config - Partial consent config
|
|
62
|
-
* @param agentName - Optional agent name for placeholder substitution
|
|
63
|
-
* @returns Fully resolved config ready for rendering
|
|
64
|
-
*/
|
|
65
|
-
export declare function resolveConsentConfig(config?: ConsentConfig, agentName?: string): ResolvedConsentConfig;
|
|
66
|
-
/**
|
|
67
|
-
* Merge two config objects, with override taking precedence
|
|
68
|
-
*
|
|
69
|
-
* @param base - Base config
|
|
70
|
-
* @param override - Override config
|
|
71
|
-
* @returns Merged config
|
|
72
|
-
*/
|
|
73
|
-
export declare function mergeConsentConfigs(base: ConsentConfig, override?: ConsentConfig): ConsentConfig;
|
|
74
|
-
/**
|
|
75
|
-
* Check if config has any customization
|
|
76
|
-
*
|
|
77
|
-
* @param config - Config to check
|
|
78
|
-
* @returns True if any non-default values are set
|
|
79
|
-
*/
|
|
80
|
-
export declare function hasCustomConfig(config?: ConsentConfig): boolean;
|
|
81
|
-
//# sourceMappingURL=resolve-config.d.ts.map
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Config Resolution
|
|
3
|
-
*
|
|
4
|
-
* Resolves complete consent config with all defaults applied.
|
|
5
|
-
*
|
|
6
|
-
* @module @kya-os/consent/resolution/resolve-config
|
|
7
|
-
*/
|
|
8
|
-
import { AUTH_MODES } from "../types/modes.types.js";
|
|
9
|
-
import { DEFAULT_EXPIRATION_DAYS, DEFAULT_UI, DEFAULT_TERMS, DEFAULT_SUCCESS } from "../constants/defaults.js";
|
|
10
|
-
import { resolveConsentBranding } from "./resolve-branding.js";
|
|
11
|
-
import { resolveConsentCopy } from "./resolve-copy.js";
|
|
12
|
-
/**
|
|
13
|
-
* Resolve custom fields with validation
|
|
14
|
-
*
|
|
15
|
-
* @param fields - Custom fields array
|
|
16
|
-
* @returns Validated custom fields (max 10)
|
|
17
|
-
*/
|
|
18
|
-
export function resolveCustomFields(fields) {
|
|
19
|
-
if (!fields || fields.length === 0) {
|
|
20
|
-
return [];
|
|
21
|
-
}
|
|
22
|
-
// Limit to 10 fields
|
|
23
|
-
const limitedFields = fields.slice(0, 10);
|
|
24
|
-
// Filter valid fields
|
|
25
|
-
return limitedFields.filter((field) => {
|
|
26
|
-
// Must have name and label
|
|
27
|
-
if (!field.name || !field.label)
|
|
28
|
-
return false;
|
|
29
|
-
// Name must be alphanumeric with underscores
|
|
30
|
-
if (!/^[a-zA-Z0-9_]+$/.test(field.name))
|
|
31
|
-
return false;
|
|
32
|
-
// Select fields must have options
|
|
33
|
-
if (field.type === "select" && (!field.options || field.options.length === 0)) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
return true;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Resolve expiration days with bounds checking
|
|
41
|
-
*
|
|
42
|
-
* @param days - Expiration days from config
|
|
43
|
-
* @returns Valid expiration days (1-365)
|
|
44
|
-
*/
|
|
45
|
-
export function resolveExpirationDays(days) {
|
|
46
|
-
if (days === undefined || days === null) {
|
|
47
|
-
return DEFAULT_EXPIRATION_DAYS;
|
|
48
|
-
}
|
|
49
|
-
// Clamp to valid range
|
|
50
|
-
if (days < 1)
|
|
51
|
-
return 1;
|
|
52
|
-
if (days > 365)
|
|
53
|
-
return 365;
|
|
54
|
-
return Math.floor(days);
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Determine the effective auth mode from config
|
|
58
|
-
*
|
|
59
|
-
* @param config - Consent config
|
|
60
|
-
* @returns Effective auth mode
|
|
61
|
-
*/
|
|
62
|
-
export function determineAuthMode(config) {
|
|
63
|
-
// Check which auth mode is configured
|
|
64
|
-
if (config?.oauth?.providerId) {
|
|
65
|
-
return AUTH_MODES.OAUTH;
|
|
66
|
-
}
|
|
67
|
-
if (config?.credentials?.usernameLabel || config?.credentials?.passwordLabel) {
|
|
68
|
-
return AUTH_MODES.CREDENTIALS;
|
|
69
|
-
}
|
|
70
|
-
if (config?.magicLink?.enabled) {
|
|
71
|
-
return AUTH_MODES.MAGIC_LINK;
|
|
72
|
-
}
|
|
73
|
-
if (config?.otp?.enabled) {
|
|
74
|
-
return AUTH_MODES.OTP;
|
|
75
|
-
}
|
|
76
|
-
// Default to consent-only
|
|
77
|
-
return AUTH_MODES.CONSENT_ONLY;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Get default consent config
|
|
81
|
-
*
|
|
82
|
-
* @returns Default consent config with all fields undefined
|
|
83
|
-
*/
|
|
84
|
-
export function getDefaultConsentConfig() {
|
|
85
|
-
return {
|
|
86
|
-
branding: undefined,
|
|
87
|
-
ui: undefined,
|
|
88
|
-
terms: undefined,
|
|
89
|
-
success: undefined,
|
|
90
|
-
customFields: undefined,
|
|
91
|
-
credentials: undefined,
|
|
92
|
-
oauth: undefined,
|
|
93
|
-
magicLink: undefined,
|
|
94
|
-
otp: undefined,
|
|
95
|
-
qrCode: undefined,
|
|
96
|
-
passkey: undefined,
|
|
97
|
-
idv: undefined,
|
|
98
|
-
expirationDays: DEFAULT_EXPIRATION_DAYS,
|
|
99
|
-
metadata: undefined,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Resolve UI settings with all defaults
|
|
104
|
-
*
|
|
105
|
-
* @param ui - Partial UI config
|
|
106
|
-
* @returns Fully resolved UI settings
|
|
107
|
-
*/
|
|
108
|
-
export function resolveUISettings(ui) {
|
|
109
|
-
return {
|
|
110
|
-
title: ui?.title ?? DEFAULT_UI.title,
|
|
111
|
-
description: ui?.description ?? DEFAULT_UI.description,
|
|
112
|
-
expirationText: ui?.expirationText ?? DEFAULT_UI.expirationText,
|
|
113
|
-
cancelButtonText: ui?.cancelButtonText ?? DEFAULT_UI.cancelButtonText,
|
|
114
|
-
submitButtonText: ui?.submitButtonText ?? DEFAULT_UI.submitButtonText,
|
|
115
|
-
permissionsHeader: ui?.permissionsHeader ?? DEFAULT_UI.permissionsHeader,
|
|
116
|
-
autoClose: ui?.autoClose ?? DEFAULT_UI.autoClose,
|
|
117
|
-
popupEnabled: ui?.popupEnabled ?? DEFAULT_UI.popupEnabled,
|
|
118
|
-
theme: ui?.theme ?? DEFAULT_UI.theme,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Resolve terms settings with all defaults
|
|
123
|
-
*
|
|
124
|
-
* @param terms - Partial terms config
|
|
125
|
-
* @returns Fully resolved terms settings
|
|
126
|
-
*/
|
|
127
|
-
export function resolveTermsSettings(terms) {
|
|
128
|
-
return {
|
|
129
|
-
text: terms?.text ?? DEFAULT_TERMS.text,
|
|
130
|
-
url: terms?.url,
|
|
131
|
-
version: terms?.version,
|
|
132
|
-
required: terms?.required ?? DEFAULT_TERMS.required,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Resolve success settings with all defaults
|
|
137
|
-
*
|
|
138
|
-
* @param success - Partial success config
|
|
139
|
-
* @returns Fully resolved success settings
|
|
140
|
-
*/
|
|
141
|
-
export function resolveSuccessSettings(success) {
|
|
142
|
-
return {
|
|
143
|
-
title: success?.title ?? DEFAULT_SUCCESS.title,
|
|
144
|
-
description: success?.description ?? DEFAULT_SUCCESS.description,
|
|
145
|
-
showCredential: success?.showCredential ?? DEFAULT_SUCCESS.showCredential,
|
|
146
|
-
redirectUrl: success?.redirectUrl,
|
|
147
|
-
redirectDelay: success?.redirectDelay,
|
|
148
|
-
continueButtonText: success?.continueButtonText ?? DEFAULT_SUCCESS.continueButtonText,
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Resolve complete consent config with all defaults
|
|
153
|
-
*
|
|
154
|
-
* @param config - Partial consent config
|
|
155
|
-
* @param agentName - Optional agent name for placeholder substitution
|
|
156
|
-
* @returns Fully resolved config ready for rendering
|
|
157
|
-
*/
|
|
158
|
-
export function resolveConsentConfig(config, agentName) {
|
|
159
|
-
// Resolve branding
|
|
160
|
-
const branding = resolveConsentBranding(config?.branding);
|
|
161
|
-
// Resolve copy/text
|
|
162
|
-
const copy = resolveConsentCopy(config, agentName);
|
|
163
|
-
// Resolve UI, terms, success
|
|
164
|
-
const ui = resolveUISettings(config?.ui);
|
|
165
|
-
const terms = resolveTermsSettings(config?.terms);
|
|
166
|
-
const success = resolveSuccessSettings(config?.success);
|
|
167
|
-
// Resolve custom fields
|
|
168
|
-
const customFields = resolveCustomFields(config?.customFields);
|
|
169
|
-
// Resolve expiration
|
|
170
|
-
const expirationDays = resolveExpirationDays(config?.expirationDays);
|
|
171
|
-
// Determine auth mode
|
|
172
|
-
const authMode = determineAuthMode(config);
|
|
173
|
-
return {
|
|
174
|
-
branding,
|
|
175
|
-
copy,
|
|
176
|
-
ui,
|
|
177
|
-
terms,
|
|
178
|
-
success,
|
|
179
|
-
customFields,
|
|
180
|
-
expirationDays,
|
|
181
|
-
authMode,
|
|
182
|
-
// Passthrough mode configs
|
|
183
|
-
credentials: config?.credentials,
|
|
184
|
-
oauth: config?.oauth,
|
|
185
|
-
magicLink: config?.magicLink,
|
|
186
|
-
otp: config?.otp,
|
|
187
|
-
qrCode: config?.qrCode,
|
|
188
|
-
passkey: config?.passkey,
|
|
189
|
-
idv: config?.idv,
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Merge two optional objects, returning undefined if both are undefined
|
|
194
|
-
* This prevents spreading undefined values into empty objects
|
|
195
|
-
*
|
|
196
|
-
* @param base - Base object
|
|
197
|
-
* @param override - Override object
|
|
198
|
-
* @returns Merged object or undefined if both inputs are undefined
|
|
199
|
-
*/
|
|
200
|
-
function mergeObjects(base, override) {
|
|
201
|
-
// If both are undefined, return undefined (not an empty object)
|
|
202
|
-
if (base === undefined && override === undefined) {
|
|
203
|
-
return undefined;
|
|
204
|
-
}
|
|
205
|
-
// Otherwise merge with spread (at least one has a value)
|
|
206
|
-
return { ...base, ...override };
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Merge two config objects, with override taking precedence
|
|
210
|
-
*
|
|
211
|
-
* @param base - Base config
|
|
212
|
-
* @param override - Override config
|
|
213
|
-
* @returns Merged config
|
|
214
|
-
*/
|
|
215
|
-
export function mergeConsentConfigs(base, override) {
|
|
216
|
-
if (!override)
|
|
217
|
-
return base;
|
|
218
|
-
return {
|
|
219
|
-
branding: override.branding ?? base.branding,
|
|
220
|
-
ui: mergeObjects(base.ui, override.ui),
|
|
221
|
-
terms: mergeObjects(base.terms, override.terms),
|
|
222
|
-
success: mergeObjects(base.success, override.success),
|
|
223
|
-
customFields: override.customFields ?? base.customFields,
|
|
224
|
-
credentials: override.credentials ?? base.credentials,
|
|
225
|
-
oauth: override.oauth ?? base.oauth,
|
|
226
|
-
magicLink: override.magicLink ?? base.magicLink,
|
|
227
|
-
otp: override.otp ?? base.otp,
|
|
228
|
-
qrCode: override.qrCode ?? base.qrCode,
|
|
229
|
-
passkey: override.passkey ?? base.passkey,
|
|
230
|
-
idv: override.idv ?? base.idv,
|
|
231
|
-
expirationDays: override.expirationDays ?? base.expirationDays,
|
|
232
|
-
metadata: override.metadata ?? base.metadata,
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Check if config has any customization
|
|
237
|
-
*
|
|
238
|
-
* @param config - Config to check
|
|
239
|
-
* @returns True if any non-default values are set
|
|
240
|
-
*/
|
|
241
|
-
export function hasCustomConfig(config) {
|
|
242
|
-
if (!config)
|
|
243
|
-
return false;
|
|
244
|
-
return (config.branding !== undefined ||
|
|
245
|
-
config.ui !== undefined ||
|
|
246
|
-
config.terms !== undefined ||
|
|
247
|
-
config.success !== undefined ||
|
|
248
|
-
(config.customFields !== undefined && config.customFields.length > 0) ||
|
|
249
|
-
config.credentials !== undefined ||
|
|
250
|
-
config.oauth !== undefined ||
|
|
251
|
-
config.magicLink !== undefined ||
|
|
252
|
-
config.otp !== undefined ||
|
|
253
|
-
config.qrCode !== undefined ||
|
|
254
|
-
config.passkey !== undefined ||
|
|
255
|
-
config.idv !== undefined ||
|
|
256
|
-
config.expirationDays !== undefined);
|
|
257
|
-
}
|
|
258
|
-
//# sourceMappingURL=resolve-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-config.js","sourceRoot":"","sources":["../../src/resolution/resolve-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC/G,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAA6B;IAE7B,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,qBAAqB;IACrB,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAE1C,sBAAsB;IACtB,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QACpC,2BAA2B;QAC3B,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK;YAAE,OAAO,KAAK,CAAC;QAE9C,6CAA6C;QAC7C,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC;QAEtD,kCAAkC;QAClC,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAA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olve-copy
|
|
7
|
-
*/
|
|
8
|
-
import type { ConsentConfig, ConsentUI, ConsentTerms, ConsentSuccess } from "../types/config.types.js";
|
|
9
|
-
import type { ResolvedConsentCopy } from "../types/copy.types.js";
|
|
10
|
-
/**
|
|
11
|
-
* Placeholder for agent name in description text
|
|
12
|
-
*/
|
|
13
|
-
export declare const AGENT_NAME_PLACEHOLDER = "[AI Agent]";
|
|
14
|
-
/**
|
|
15
|
-
* Resolve UI text with defaults
|
|
16
|
-
*
|
|
17
|
-
* @param ui - Partial UI config
|
|
18
|
-
* @returns Resolved UI with all defaults applied
|
|
19
|
-
*/
|
|
20
|
-
export declare function resolveUI(ui?: ConsentUI): Required<ConsentUI>;
|
|
21
|
-
/**
|
|
22
|
-
* Resolve terms config with defaults
|
|
23
|
-
*
|
|
24
|
-
* @param terms - Partial terms config
|
|
25
|
-
* @returns Resolved terms with all defaults applied
|
|
26
|
-
*/
|
|
27
|
-
export declare function resolveTerms(terms?: ConsentTerms): Required<ConsentTerms>;
|
|
28
|
-
/**
|
|
29
|
-
* Resolve success page config with defaults
|
|
30
|
-
*
|
|
31
|
-
* @param success - Partial success config
|
|
32
|
-
* @returns Resolved success with all defaults applied
|
|
33
|
-
*/
|
|
34
|
-
export declare function resolveSuccess(success?: ConsentSuccess): Required<ConsentSuccess>;
|
|
35
|
-
/**
|
|
36
|
-
* Substitute agent name placeholder in text
|
|
37
|
-
*
|
|
38
|
-
* @param text - Text potentially containing [AI Agent] placeholder
|
|
39
|
-
* @param agentName - Agent name to substitute
|
|
40
|
-
* @returns Text with placeholder replaced
|
|
41
|
-
*/
|
|
42
|
-
export declare function substituteAgentName(text: string, agentName?: string): string;
|
|
43
|
-
/**
|
|
44
|
-
* Resolve consent copy from config
|
|
45
|
-
*
|
|
46
|
-
* Applies all defaults and performs placeholder substitution.
|
|
47
|
-
*
|
|
48
|
-
* @param config - Partial consent config
|
|
49
|
-
* @param agentName - Optional agent name for placeholder substitution
|
|
50
|
-
* @returns Fully resolved copy ready for rendering
|
|
51
|
-
*/
|
|
52
|
-
export declare function resolveConsentCopy(config?: ConsentConfig, agentName?: string): ResolvedConsentCopy;
|
|
53
|
-
//# sourceMappingURL=resolve-copy.d.ts.map
|