@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.
13 lines (12 loc) • 998 B
JavaScript
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { SearchFacetsClient } from './search-facets-client';
import { RestClient } from '../../rest-sdk/rest-client';
import { setHideEmptyVisual, setWarning } from '../../editor/widget-framework/attributes';
export async function SearchFacetsDefaultView(props) {
const searchMetadata = await RestClient.getSearchMetadata();
if (!searchMetadata.SearchServiceSupportsFacets && props.widgetContext.metadata.editorMetadata) {
setHideEmptyVisual(props.attributes, true);
setWarning(props.attributes, 'This widget cannot be used with your current search service. Search facets work only with Azure Search and Elasticsearch services.');
}
return (_jsxs(_Fragment, { children: [_jsx("div", { ...props.attributes, children: _jsx(SearchFacetsClient, { ...props }) }), _jsx("input", { type: "hidden", id: "sf-currentPageUrl", value: props.widgetContext.requestContext.url || '' })] }));
}