import { ListableResourceType } from '@commercelayer/sdk'; import { JSX } from 'react'; import { RouteComponentProps } from 'wouter'; import { GetParams } from './utils'; /** * Renders the Switch component to conditionally render a route based on the current path * by leveraging the `wouter` library to handle routing. * Each route is loaded with a lazy component to improve the performance of the app. * While the (lazy) component is loading, a `LoadingPage` component is rendered. * If the route is not found, the `GenericPageNotFound` component is rendered. * * Note: Default exports are required for dynamic / lazy imports. * * ``` * await import('#pages/Home') * }, * details: { * component: async () => await import('#pages/Details') * }, * filters: { * component: async () => await import('#pages/Filters'), * overlay: true * } * }} * /> * ``` */ export declare function Routes>({ routes, list, }: { /** Object of available app routes build using the `createRoute` helper method */ routes: T; /** * Object that contains, for each, provided route the component tp render * and the instruction if it has to be rendered as overlay or regular page **/ list: { [key in keyof T]: { component: () => Promise<{ default: React.ComponentType; }>; overlay?: boolean; }; }; }): JSX.Element; export declare function LoadingPage({ overlay, }: { overlay?: boolean; }): JSX.Element; /** * This component can be used as error component when the resource is not found by passing the resource type. * When empty it will render a generic page not found message. */ export declare function GenericPageNotFound({ resource, }: { resource?: ListableResourceType; }): JSX.Element; /** * Typescript helper to statically type the props of a page component. * Usage: * ``` * const DetailsPage: FC> ({ params }) =>
{params.id}
* export default DetailsPage */ export type PageProps string; }> = RouteComponentProps> & { overlay?: boolean; };