import { defineComponent, withApiName, detachedManifestScope, validateCustomApiName, type ComponentDefinition, } from './component'; import { ManifestFunction } from '../manifest-function'; import { SduiPage, type SduiPageProps } from '../sdui-page'; export type DefinePageProps = Omit & { apiName: `${string}__c`; function: ManifestFunction; }; export function definePage(props: DefinePageProps): SduiPage { validateCustomApiName(props.apiName); return pageComponent.register( withApiName(new SduiPage(detachedManifestScope, { ...props, sduiPageId: props.apiName }), props.apiName), props, ); } const pageComponent: ComponentDefinition = defineComponent({ type: 'SDUI_PAGE', define: definePage, references: (_definition, props) => [props.function], });