2024-06-05 23:44:57 +00:00
|
|
|
import type { DeepPartial } from "keycloakify/tools/DeepPartial";
|
2024-06-06 03:26:06 +00:00
|
|
|
import type { KcContext } from "./KcContext";
|
2024-06-06 04:40:12 +00:00
|
|
|
import { createGetKcContextMock } from "keycloakify/account/KcContext";
|
2024-06-05 23:44:57 +00:00
|
|
|
import type {
|
|
|
|
KcContextExtraProperties,
|
|
|
|
KcContextExtraPropertiesPerPage
|
2024-06-06 03:26:06 +00:00
|
|
|
} from "./KcContext";
|
2024-06-05 23:44:57 +00:00
|
|
|
import KcApp from "./KcApp";
|
|
|
|
|
|
|
|
const kcContextExtraProperties: KcContextExtraProperties = {};
|
|
|
|
const kcContextExtraPropertiesPerPage: KcContextExtraPropertiesPerPage = {};
|
|
|
|
|
|
|
|
export const { getKcContextMock } = createGetKcContextMock({
|
|
|
|
kcContextExtraProperties,
|
|
|
|
kcContextExtraPropertiesPerPage,
|
|
|
|
overrides: {},
|
|
|
|
overridesPerPage: {}
|
|
|
|
});
|
|
|
|
|
2024-06-06 03:26:06 +00:00
|
|
|
export function createPageStory<PageId extends KcContext["pageId"]>(params: {
|
|
|
|
pageId: PageId;
|
|
|
|
}) {
|
2024-06-05 23:44:57 +00:00
|
|
|
const { pageId } = params;
|
|
|
|
|
2024-06-06 03:26:06 +00:00
|
|
|
function PageStory(props: {
|
|
|
|
kcContext?: DeepPartial<Extract<KcContext, { pageId: PageId }>>;
|
|
|
|
}) {
|
2024-06-05 23:44:57 +00:00
|
|
|
const { kcContext: overrides } = props;
|
|
|
|
|
|
|
|
const kcContextMock = getKcContextMock({
|
|
|
|
pageId,
|
|
|
|
overrides
|
|
|
|
});
|
|
|
|
|
2024-06-06 03:26:06 +00:00
|
|
|
return <KcApp kcContext={kcContextMock} />;
|
2024-06-05 23:44:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return { PageStory };
|
|
|
|
}
|