@persona/layout-editor-remote-module
Version:
Shared manifest format, Vite plugin, and host/iframe bridge for remotely-defined dashboard layout modules in Persona dashboard apps.
70 lines (69 loc) • 2.01 kB
text/typescript
import { t as Json } from "./types-CBSiNsDJ.mjs";
import { t as RemoteModuleContext } from "./protocol-ClWDYwW2.mjs";
import { CSSProperties, ReactNode, Ref } from "react";
//#region src/bridge/host/buildModuleSrc.d.ts
type BuildModuleSrcOptions = {
accessToken?: string;
environmentId?: string;
locale?: string;
extraParams?: Record<string, string>;
};
//#endregion
//#region src/bridge/host/createHostBridge.d.ts
type ResolveDataPath = (dataPath: string, variableMap?: Record<string, string | number>) => Promise<Json | undefined> | Json | undefined;
//#endregion
//#region src/bridge/host/RemoteModuleFrame.d.ts
type RemoteModuleFrameProps = {
documentUrl: string;
moduleOrigin: string;
accessToken?: string;
environmentId?: string;
locale?: string;
extraParams?: BuildModuleSrcOptions['extraParams'];
title: string;
sandbox: string;
allow?: string;
referrerPolicy?: ReferrerPolicy;
initRetryMs?: number;
initRetryTimeoutMs?: number;
dynamicHeight?: boolean;
heightOffset?: number;
minHeight?: number;
className?: string;
style?: CSSProperties;
/** Receives the underlying <iframe> so a host can attach extra postMessage bridges. */
iframeRef?: Ref<HTMLIFrameElement>;
data: Json;
context: RemoteModuleContext;
resolveDataPath: ResolveDataPath;
onRenderError?: (message: string) => void;
/** Rendered over the iframe until the module reports that it has loaded. */
loadingFallback?: ReactNode;
};
declare function RemoteModuleFrame({
documentUrl,
moduleOrigin,
accessToken,
environmentId,
locale,
extraParams,
title,
sandbox,
allow,
referrerPolicy,
initRetryMs,
initRetryTimeoutMs,
dynamicHeight,
heightOffset,
minHeight,
className,
style,
iframeRef: externalIframeRef,
data,
context,
resolveDataPath,
onRenderError,
loadingFallback
}: RemoteModuleFrameProps): ReactNode;
//#endregion
export { type Json, type RemoteModuleContext, RemoteModuleFrame, type RemoteModuleFrameProps, type ResolveDataPath };