UNPKG

@grafana/faro-react

Version:

Faro package that enables easier integration in projects built with React.

13 lines 931 B
import { jsx as _jsx } from "react/jsx-runtime"; import hoistNonReactStatics from 'hoist-non-react-statics'; import { unknownString } from '@grafana/faro-core'; import { FaroProfiler } from './FaroProfiler'; export function withFaroProfiler(WrappedComponent, options) { var _a, _b, _c; const componentDisplayName = (_c = (_b = (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : WrappedComponent.displayName) !== null && _b !== void 0 ? _b : WrappedComponent.name) !== null && _c !== void 0 ? _c : unknownString; const Component = (props) => (_jsx(FaroProfiler, { name: componentDisplayName, updateProps: props, children: _jsx(WrappedComponent, Object.assign({}, props)) })); Component.displayName = `faroProfiler(${componentDisplayName})`; hoistNonReactStatics(Component, WrappedComponent); return Component; } //# sourceMappingURL=withFaroProfiler.js.map