"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BFUIProviders = BFUIProviders;
const jsx_runtime_1 = require("react/jsx-runtime");
const logger_1 = require("./logger");
const errors_1 = require("./errors");
const http_client_1 = require("./http-client");
/**
 * BFUI Providers component
 *
 * Provides all shared utilities to child components:
 * - Logger
 * - Error handling
 * - HTTP client
 */
function BFUIProviders({ children, options = {} }) {
    const { logger: loggerOptions = {}, httpClient: httpClientOptions = {} } = options;
    // Configure HTTP client options
    const httpOptions = {
        baseUrl: httpClientOptions.baseUrl || process.env.REACT_APP_API_URL || '/api',
        timeout: httpClientOptions.timeout || 30000,
        retries: httpClientOptions.retries || 3,
        headers: {
            'Content-Type': 'application/json',
            ...httpClientOptions.headers
        },
        validateStatus: true
    };
    // Nest providers to provide all shared utilities
    return ((0, jsx_runtime_1.jsx)(logger_1.LoggerProvider, { options: loggerOptions, children: (0, jsx_runtime_1.jsx)(errors_1.ErrorProvider, { children: (0, jsx_runtime_1.jsx)(http_client_1.HttpClientProvider, { options: httpOptions, withAuth: httpClientOptions.withAuth !== false, children: children }) }) }));
}
exports.default = BFUIProviders;
//# sourceMappingURL=BFUIProviders.js.map