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.

162 lines (161 loc) 7.41 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 { ContentSectionTitles, KnownFieldTypes } from '@progress/sitefinity-widget-designers-sdk/common'; import { ContentSection } from '@progress/sitefinity-widget-designers-sdk/decorators/content-section'; import { DefaultValue } from '@progress/sitefinity-widget-designers-sdk/decorators/default-value'; import { Description } from '@progress/sitefinity-widget-designers-sdk/decorators/description'; import { DisplayName } from '@progress/sitefinity-widget-designers-sdk/decorators/display-name'; import { DataType } from '@progress/sitefinity-widget-designers-sdk/decorators/data-type'; import { Choice } from '@progress/sitefinity-widget-designers-sdk/decorators/choice'; import { Category, PropertyCategory } from '@progress/sitefinity-widget-designers-sdk/decorators/category'; import { WidgetEntity } from '@progress/sitefinity-widget-designers-sdk/decorators/widget-entity'; import { ViewSelector } from '@progress/sitefinity-widget-designers-sdk/decorators/view-selector'; import { WidgetLabel } from '@progress/sitefinity-widget-designers-sdk/decorators/widget-label'; import { Attributes } from '@progress/sitefinity-widget-designers-sdk/decorators/attributes'; import { Content } from '@progress/sitefinity-widget-designers-sdk/decorators/content'; import { Group } from '@progress/sitefinity-widget-designers-sdk/decorators/group'; import { Margins } from '@progress/sitefinity-widget-designers-sdk/decorators/margins'; import { RestSdkTypes } from '../../rest-sdk/rest-client'; const SetupSectionName = 'AI answer setup'; let AnswerEntity = class AnswerEntity { Title = 'AI answer'; AssistantAvatar = null; ShowSearchedPhrase = true; ShowSources = true; ShowNotice = true; ShowFeedback = true; SfViewName = 'Default'; Margins; SfWidgetLabel = 'AI answer'; CssClass = null; SearchedPhraseLabel = 'Answer for "{0}"'; Notice = 'AI answer may contain mistakes.'; PositiveFeedbackTooltip = 'Helpful'; NegativeFeedbackTooltip = 'Not helpful'; ThankYouMessage = 'Thank you for your feedback!'; ExpandAnswerLabel = 'Show more'; CollapseAnswerLabel = 'Show less'; LoadingLabel = 'Putting together an answer'; Attributes = null; }; __decorate([ ContentSection(SetupSectionName, 0), DefaultValue('AI answer'), DisplayName('Answer label'), Description('Label shown above the AI-generated text.') ], AnswerEntity.prototype, "Title", void 0); __decorate([ ContentSection(SetupSectionName, 1), Content({ Type: RestSdkTypes.Image, AllowMultipleItemsSelection: false }), DisplayName('Icon') ], AnswerEntity.prototype, "AssistantAvatar", void 0); __decorate([ ContentSection(SetupSectionName, 2), DisplayName('Searched phrase'), DefaultValue(true), DataType(KnownFieldTypes.CheckBox), Group('Include...') ], AnswerEntity.prototype, "ShowSearchedPhrase", void 0); __decorate([ ContentSection(SetupSectionName, 3), DisplayName('Sources'), Description('In AI-generated answer, display links to sources of information.'), DefaultValue(true), DataType(KnownFieldTypes.CheckBox), Group('Include...') ], AnswerEntity.prototype, "ShowSources", void 0); __decorate([ ContentSection(SetupSectionName, 4), DisplayName('Notice'), Description('Text displayed under the answer, informing users that they are interacting with AI.'), DefaultValue(true), DataType(KnownFieldTypes.CheckBox), Group('Include...') ], AnswerEntity.prototype, "ShowNotice", void 0); __decorate([ ContentSection(SetupSectionName, 5), DisplayName('Enable visitor feedback'), Description('If enabled, site visitors can provide feedback on the generated answer.'), DefaultValue(true), DataType(KnownFieldTypes.ChipChoice), Choice([ { Title: 'Yes', Name: 'Yes', Value: 'True', Icon: null }, { Title: 'No', Name: 'No', Value: 'False', Icon: null } ]) ], AnswerEntity.prototype, "ShowFeedback", void 0); __decorate([ ContentSection(ContentSectionTitles.DisplaySettings, 0), ViewSelector([{ Title: 'Default', Name: 'Default', Value: 'Default', Icon: null }]), DisplayName('AI answer template'), DefaultValue('Default') ], AnswerEntity.prototype, "SfViewName", void 0); __decorate([ ContentSection(ContentSectionTitles.DisplaySettings, 1), Margins('AI Answer') ], AnswerEntity.prototype, "Margins", void 0); __decorate([ WidgetLabel() ], AnswerEntity.prototype, "SfWidgetLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), DisplayName('Custom CSS class') ], AnswerEntity.prototype, "CssClass", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages, 0), DefaultValue('Answer for "{0}"'), DisplayName('Searched phrase label') ], AnswerEntity.prototype, "SearchedPhraseLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages, 1), DefaultValue('AI answer may contain mistakes.'), DisplayName('Notice') ], AnswerEntity.prototype, "Notice", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages, 2), DefaultValue('Helpful'), DisplayName('Positive feedback tooltip') ], AnswerEntity.prototype, "PositiveFeedbackTooltip", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages, 3), DefaultValue('Not helpful'), DisplayName('Negative feedback tooltip') ], AnswerEntity.prototype, "NegativeFeedbackTooltip", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages, 4), DefaultValue('Thank you for your feedback!'), DisplayName('Thank you message') ], AnswerEntity.prototype, "ThankYouMessage", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages, 5), DefaultValue('Show more'), DisplayName('Expand answer') ], AnswerEntity.prototype, "ExpandAnswerLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages, 6), DefaultValue('Show less'), DisplayName('Collapse answer') ], AnswerEntity.prototype, "CollapseAnswerLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages, 7), DefaultValue('Putting together an answer'), DisplayName('Loading text') ], AnswerEntity.prototype, "LoadingLabel", void 0); __decorate([ Attributes('Answer', 'AI answer', 0) ], AnswerEntity.prototype, "Attributes", void 0); AnswerEntity = __decorate([ WidgetEntity('SitefinityAnswer', 'AI answer') ], AnswerEntity); export { AnswerEntity };