/**
* PublicEnvScript - Server component for exposing environment variables to the client.
*
* This component renders a script tag that injects server-side environment variables
* into the client-side JavaScript context, enabling runtime environment variable access
* without requiring NEXT_PUBLIC_ prefixes at build time.
*
* @remarks
* This is part of the simplified Next.js API. For advanced configuration loading
* with custom loaders or direct AWS SDK integration, import from `@dyanet/config-aws` directly.
*
* @example
* ```tsx
* // In your root layout.tsx
* import { PublicEnvScript } from '@dyanet/nextjs-config-aws';
*
* export default function RootLayout({ children }) {
* return (
*
*
*
*
* {children}
*
* );
* }
* ```
*/
import * as React from 'react';
/**
* Props for the PublicEnvScript component.
*/
export interface PublicEnvScriptProps {
/**
* Explicit list of environment variable names to expose to the client.
* Only variables in this list will be included in the output.
* Takes precedence over publicPrefix if both are provided.
*/
publicVars?: string[];
/**
* Prefix to filter environment variables.
* Only variables starting with this prefix will be included.
* The prefix is NOT stripped from the variable names in the output.
* @example 'PUBLIC_' will include PUBLIC_API_URL, PUBLIC_APP_NAME, etc.
*/
publicPrefix?: string;
/**
* The global variable name used to expose environment variables on the client.
* @default '__ENV'
*/
variableName?: string;
/**
* CSP nonce for script tag compliance with Content Security Policy.
* If provided, adds a nonce attribute to the script tag.
*/
nonce?: string;
}
/**
* Filters environment variables based on allowlist or prefix.
*
* @param env - The environment variables object (typically process.env)
* @param publicVars - Optional explicit list of variable names to include
* @param publicPrefix - Optional prefix to filter variables
* @returns Filtered environment variables object
*/
export declare function filterEnvVars(env: Record, publicVars?: string[], publicPrefix?: string): Record;
/**
* Generates the script content for injecting environment variables.
*
* @param filteredEnv - The filtered environment variables to expose
* @param variableName - The global variable name to use
* @returns The script content as a string
*/
export declare function generateScriptContent(filteredEnv: Record, variableName: string): string;
/**
* Server component that renders a script tag exposing environment variables to the client.
*
* This enables runtime environment variable access in Next.js applications without
* requiring NEXT_PUBLIC_ prefixes at build time. The same build artifact can be
* deployed to different environments with different configuration.
*
* Security considerations:
* - Only expose variables that are safe for public access
* - Use the publicVars allowlist for explicit control
* - Never expose secrets, API keys, or sensitive data
*
* @param props - Component props
* @returns A script element with environment variables, or null if no variables to expose
*/
export declare function PublicEnvScript({ publicVars, publicPrefix, variableName, nonce, }: PublicEnvScriptProps): React.ReactElement | null;
export default PublicEnvScript;
//# sourceMappingURL=public-env-script.d.ts.map