@progress/sitefinity-nextjs-sdk
Version:
Provides OOB widgets developed using the Next.js framework, which includes an abstraction layer for Sitefinity communication. Additionally, it offers an expanded API, typings, and tools for further development and integration.
29 lines (28 loc) • 2.3 kB
TypeScript
import React from 'react';
import { TransferableRequestContext } from '../editor/request-context';
import { WidgetContext } from '../editor/widget-framework/widget-context';
import { WidgetModel } from '../editor/widget-framework/widget-model';
import { WidgetRegistry } from '../editor/widget-framework/widget-registry';
import { WidgetMetadata } from '../editor/widget-framework/widget-metadata';
/**
* RenderWidgetService is a class that provides methods to render widgets in the Sitefinity Next.js framework.
* It is responsible for rendering the widget components and handling their properties and context. Both server-side and client-side rendering are supported.
* The class uses the WidgetRegistry to find the appropriate widget component and its metadata.
*/
export declare class RenderWidgetService {
static widgetRegistry: WidgetRegistry;
/**
*
* @param {WidgetModel} widgetModel The widget model containing the widget's metadata and properties.
* @param {TransferableRequestContext} requestContext A {RequestContext} object containing the request context for the current page render. The request context contains information about the current request, such as the layout, search parameters, and culture.
* @param {any} [traceContext] Optional OpenTelemetry Context trace context for logging and diagnostics. If needed, the parent trace context can be passed to the widget in order to wrap the current trace data in the passed parent context.
* @returns {React.ReactElement} The rendered widget component as a React element. If the widget is not found in the registry, an error message is returned. If the widget is in edit mode and an error occurs during rendering, an error component is returned instead. If the widget is not found and not in edit mode, no error is returned and null will be rendered.
*/
static createComponent(widgetModel: WidgetModel, requestContext: TransferableRequestContext, traceContext?: any): React.FunctionComponentElement<import("../pages/error-boundary").ErrorBoundaryCustomProps> | React.FunctionComponentElement<{
error: string;
context: WidgetContext<any>;
}> | null;
static parseProperties(widgetProperties: {
[key: string]: any;
}, widgetMetadata: WidgetMetadata): any;
}