@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.
18 lines (17 loc) • 877 B
JavaScript
'use client';
import { ServiceMetadata } from '@progress/sitefinity-nextjs-sdk/rest-sdk';
/**
* Widget filter function for SitefinityAssistant widget.
* Filters the widget based on CDN configuration and whether the AI assistant module is enabled in Sitefinity.
* @param widgetMetadata The metadata of the widget to filter.
* @param args The arguments from the getWidgets call containing toolbox, category, search criteria.
* @returns Promise<boolean> True if the widget should be included in the results, false otherwise.
*/
export async function filterSitefinityAssistantWidget(widgetMetadata, args) {
// Only apply filtering logic to SitefinityAssistant widget
if (widgetMetadata.designerMetadata?.Name !== 'SitefinityAssistant') {
return true;
}
const isEnabled = ServiceMetadata.isModuleEnabled('sitefinityAssistant');
return isEnabled;
}