plazbot
Version:
Official Plazbot SDK for creating AI agents for WhatsApp, portals, and developers.
16 lines (15 loc) • 813 B
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useMemo } from 'react';
import { PlazbotContext } from './PlazbotContext';
import { lightTheme, darkTheme } from '../styles/theme';
import { StyleInjector } from '../styles/StyleInjector';
export function PlazbotProvider({ sdk, agentId, theme = 'light', iconMode = 'svg', children }) {
const resolvedTheme = useMemo(() => {
if (typeof theme === 'string') {
return theme === 'dark' ? darkTheme : lightTheme;
}
return { ...lightTheme, ...theme };
}, [theme]);
const value = useMemo(() => ({ sdk, agentId, theme: resolvedTheme, iconMode }), [sdk, agentId, resolvedTheme, iconMode]);
return (_jsxs(PlazbotContext.Provider, { value: value, children: [_jsx(StyleInjector, {}), children] }));
}