@embrace-io/web-sdk
Version:
23 lines (22 loc) • 997 B
JavaScript
import { page } from "../../../../../api-page/pageAPI.js";
import * as React$1 from "react";
import hoistNonReactStatics from "hoist-non-react-statics";
//#region src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withEmbraceRoutingLegacy.ts
const withEmbraceRoutingLegacy = (WrappedComponent) => {
const RouteWithEmbraceRoutingLegacy = (props) => {
if (props.path) {
const routeProps = props;
if (routeProps.computedMatch) page.setCurrentRoute({
path: routeProps.computedMatch.path,
url: routeProps.computedMatch.url
});
}
return React$1.createElement(WrappedComponent, props);
};
RouteWithEmbraceRoutingLegacy.displayName = `withEmbraceRoutingLegacy(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
hoistNonReactStatics(RouteWithEmbraceRoutingLegacy, WrappedComponent);
return RouteWithEmbraceRoutingLegacy;
};
//#endregion
export { withEmbraceRoutingLegacy };
//# sourceMappingURL=withEmbraceRoutingLegacy.js.map