UNPKG

@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.

192 lines (191 loc) 11.5 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; import { WidgetEntity } from '@progress/sitefinity-widget-designers-sdk/decorators/widget-entity'; import { ContentSection } from '@progress/sitefinity-widget-designers-sdk/decorators/content-section'; import { DisplayName } from '@progress/sitefinity-widget-designers-sdk/decorators/display-name'; import { Description } from '@progress/sitefinity-widget-designers-sdk/decorators/description'; import { DataType } from '@progress/sitefinity-widget-designers-sdk/decorators/data-type'; import { DefaultValue } from '@progress/sitefinity-widget-designers-sdk/decorators/default-value'; import { KnownFieldTypes } from '@progress/sitefinity-widget-designers-sdk/common'; import { ConditionalVisibility } from '@progress/sitefinity-widget-designers-sdk/decorators/conditional-visibility'; import { Category, PropertyCategory } from '@progress/sitefinity-widget-designers-sdk/decorators/category'; import { Attributes } from '@progress/sitefinity-widget-designers-sdk/decorators/attributes'; import { Placeholder } from '@progress/sitefinity-widget-designers-sdk/decorators/placeholder'; import { Choice } from '@progress/sitefinity-widget-designers-sdk/decorators/choice'; import { WidgetLabel } from '@progress/sitefinity-widget-designers-sdk/decorators/widget-label'; import { Content } from '@progress/sitefinity-widget-designers-sdk/decorators/content'; export var DisplayMode; (function (DisplayMode) { DisplayMode["Modal"] = "Modal"; DisplayMode["Inline"] = "Inline"; })(DisplayMode || (DisplayMode = {})); let SitefinityAssistantEntity = class SitefinityAssistantEntity { AssistantType = null; KnowledgeBoxName = null; ConfigurationName = null; AssistantApiKey = null; Nickname = 'AI assistant'; GreetingMessage = null; AssistantAvatar; ShowSources = true; ShowFeedback = true; DisplayMode = DisplayMode.Modal; OpeningChatIcon; ClosingChatIcon; ContainerId = 'sf-assistant-chat-container'; PlaceholderText = 'Ask anything...'; Notice = 'You are interacting with an AI-powered assistant and the responses are generated by AI.'; SfWidgetLabel = 'AI assistant'; CssClass = null; CustomCss = null; Attributes; }; __decorate([ ContentSection('AI assistant', 0), DisplayName('AI assistant type'), DataType(KnownFieldTypes.Choices), Choice({ ServiceUrl: '/Default.GetAvailableAssistantModules()', ServiceWarningMessage: 'No AI assistants are found.' }), Placeholder('Select assistant type'), Description('[{"Type":1,"Chunks":[{"Value":"Sitefinity AI Assistant: ","Presentation":[0]},{"Value":"Answers from your site\'s published content only.","Presentation":[]}]},{"Type":1,"Chunks":[{"Value":"Progress Agentic RAG: ","Presentation":[0]},{"Value":"Answers from the selected knowledge box.","Presentation":[]}]}]') ], SitefinityAssistantEntity.prototype, "AssistantType", void 0); __decorate([ ContentSection('AI assistant', 1), DisplayName('Knowledge box'), Description('A knowledge box is a separate collection of content in Progress Agentic RAG. Select which collection the assistant should use to answer questions.'), DataType(KnownFieldTypes.Choices), Choice({ ServiceUrl: '/Default.GetConfiguredKnowledgeBoxes()', ServiceWarningMessage: 'No PARAG knowledge boxes are found.' }), Placeholder('Select knowledge box'), ConditionalVisibility('{"conditions":[{"fieldName":"AssistantType","operator":"Equals","value":"PARAG"}]}') ], SitefinityAssistantEntity.prototype, "KnowledgeBoxName", void 0); __decorate([ ContentSection('AI assistant', 2), DisplayName('Search configuration'), Description('A saved set of search settings that the AI assistant uses to find content.'), DataType(KnownFieldTypes.Choices), Choice({ ServiceUrl: '/Default.GetSearchConfigurations(knowledgeBoxName=\'{0}\')', ServiceCallParameters: '[{ "knowledgeBoxName" : "{0}"}]' }), ConditionalVisibility('{"conditions":[{"fieldName":"AssistantType","operator":"Equals","value":"PARAG"}]}') ], SitefinityAssistantEntity.prototype, "ConfigurationName", void 0); __decorate([ ContentSection('AI assistant', 1), DisplayName('Select an AI assistant'), Description('[{"Type":1,"Chunks":[{"Value":"AI assitants are created and managed in","Presentation":[]},{"Value":"Administration > AI assistants","Presentation":[2]}]}]'), DataType(KnownFieldTypes.Choices), Placeholder('Select'), Choice({ ServiceUrl: '/Default.GetAiAssistantChoices()', ServiceWarningMessage: 'No AI assistants are found.' }), DefaultValue(''), ConditionalVisibility('{"conditions":[{"fieldName":"AssistantType","operator":"Equals","value":"SAIA"}]}') ], SitefinityAssistantEntity.prototype, "AssistantApiKey", void 0); __decorate([ ContentSection('AI assistant', 2), DisplayName('Nickname of the assistant'), Description('Name displayed before assistant\'s messages in the chat.'), ConditionalVisibility('{"operator":"Or","conditions":[{"fieldName":"AssistantType","operator":"Equals","value":"PARAG" },{"fieldName":"AssistantType","operator":"Equals","value":"SAIA" }]}') ], SitefinityAssistantEntity.prototype, "Nickname", void 0); __decorate([ ContentSection('AI assistant', 3), DisplayName('Greeting message'), Description('You can customize the bot\'s initial words by adding a phrase that triggers conversation on a specific topic.'), DataType(KnownFieldTypes.TextArea), ConditionalVisibility('{"operator":"Or","conditions":[{"fieldName":"AssistantType","operator":"Equals","value":"PARAG" },{"fieldName":"AssistantType","operator":"Equals","value":"SAIA" }]}') ], SitefinityAssistantEntity.prototype, "GreetingMessage", void 0); __decorate([ ContentSection('AI assistant', 4), DisplayName('Avatar of the assistant'), Content({ Type: 'Telerik.Sitefinity.Libraries.Model.Image', AllowMultipleItemsSelection: false }), ConditionalVisibility('{"operator":"Or","conditions":[{"fieldName":"AssistantType","operator":"Equals","value":"PARAG" },{"fieldName":"AssistantType","operator":"Equals","value":"SAIA" }]}') ], SitefinityAssistantEntity.prototype, "AssistantAvatar", void 0); __decorate([ ContentSection('AI assistant', 5), DisplayName('Display sources'), Description('In answers, display links to sources of information.'), DefaultValue(true), DataType(KnownFieldTypes.ChipChoice), Choice('[{"Title":"Yes","Name":"Yes","Value":"True","Icon":null},{"Title":"No","Name":"No","Value":"False","Icon":null}]'), ConditionalVisibility('{"conditions":[{"fieldName":"AssistantType","operator":"Equals","value":"PARAG"}]}') ], SitefinityAssistantEntity.prototype, "ShowSources", void 0); __decorate([ ContentSection('AI assistant', 6), DisplayName('Enable visitor feedback'), Description('If enabled, site visitors can provide feedback on the assistant answers in the chat window.'), DefaultValue(true), DataType(KnownFieldTypes.ChipChoice), Choice('[{"Title":"Yes","Name":"Yes","Value":"True","Icon":null},{"Title":"No","Name":"No","Value":"False","Icon":null}]'), ConditionalVisibility('{"conditions":[{"fieldName":"AssistantType","operator":"Equals","value":"PARAG"}]}') ], SitefinityAssistantEntity.prototype, "ShowFeedback", void 0); __decorate([ ContentSection('Chat window', 0), DisplayName('Chat window mode'), Description('[{"Type":1,"Chunks":[{"Value":"Display overlay: ","Presentation":[0]},{"Value":"Chat appears in a small window, usually in the bottom right corner of the screen. It requires user interaction to open and overlays parts of the page content.","Presentation":[]}]},{"Type":1,"Chunks":[{"Value":"Display inline: ","Presentation":[0]},{"Value":"Chat area is integrated into the page layout and does not overlay other elements. Suitable for long assistant responses and prompts.","Presentation":[]}]}]'), DataType(KnownFieldTypes.RadioChoice), Choice([ { Title: 'Display overlay', Value: DisplayMode.Modal }, { Title: 'Display inline', Value: DisplayMode.Inline } ]) ], SitefinityAssistantEntity.prototype, "DisplayMode", void 0); __decorate([ ContentSection('Chat window', 1), DisplayName('Opening chat icon'), Description('Select a custom icon for opening chat window. If left empty, default icon will be displayed.'), Content({ Type: 'Telerik.Sitefinity.Libraries.Model.Image', AllowMultipleItemsSelection: false }), ConditionalVisibility('{"conditions":[{"fieldName":"DisplayMode","operator":"Equals","value":"Modal"}]}') ], SitefinityAssistantEntity.prototype, "OpeningChatIcon", void 0); __decorate([ ContentSection('Chat window', 2), DisplayName('Closing chat icon'), Description('Select a custom icon for closing chat window. If left empty, default icon will be displayed.'), Content({ Type: 'Telerik.Sitefinity.Libraries.Model.Image', AllowMultipleItemsSelection: false }), ConditionalVisibility('{"conditions":[{"fieldName":"DisplayMode","operator":"Equals","value":"Modal"}]}') ], SitefinityAssistantEntity.prototype, "ClosingChatIcon", void 0); __decorate([ ContentSection('Chat window', 3), DisplayName('Container ID'), Description('ID of the HTML element that will host the chat widget.'), DataType('string'), DefaultValue('sf-assistant-chat-container'), ConditionalVisibility('{"conditions":[{"fieldName":"DisplayMode","operator":"Equals","value":"Inline"}]}') ], SitefinityAssistantEntity.prototype, "ContainerId", void 0); __decorate([ ContentSection('Message box', 0), DisplayName('Placeholder text in the message box'), DataType('string'), DefaultValue('Ask anything...') ], SitefinityAssistantEntity.prototype, "PlaceholderText", void 0); __decorate([ ContentSection('Message box', 1), DisplayName('Notice'), DefaultValue('You are interacting with an AI-powered assistant and the responses are generated by AI.'), Description('Text displayed under the message box, informing users that they are interacting with AI.'), DataType(KnownFieldTypes.TextArea) ], SitefinityAssistantEntity.prototype, "Notice", void 0); __decorate([ WidgetLabel() ], SitefinityAssistantEntity.prototype, "SfWidgetLabel", void 0); __decorate([ DisplayName('CSS class'), Category(PropertyCategory.Advanced) ], SitefinityAssistantEntity.prototype, "CssClass", void 0); __decorate([ Category(PropertyCategory.Advanced), DisplayName('CSS for custom design'), Placeholder('type URL or path to file...') ], SitefinityAssistantEntity.prototype, "CustomCss", void 0); __decorate([ Attributes('SitefinityAssistant') ], SitefinityAssistantEntity.prototype, "Attributes", void 0); SitefinityAssistantEntity = __decorate([ WidgetEntity('SitefinityAssistant', 'AI assistant') ], SitefinityAssistantEntity); export { SitefinityAssistantEntity };